markstream-vue 2.0.9 → 2.0.11-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/exports.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},u=(e,o)=>n(e,t(o)),s=(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{normalizeCustomHtmlTagName as c,tokenizeHtml as d,sanitizeHtmlAttrs as f,sanitizeHtmlTokenAttrs as m,tokenAttrsToRecord as h,isCustomHtmlComponentTag as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,sanitizeHtmlContent as b,sanitizeImageSrc as N,shouldOpenLinkInNewTab as S,NON_STRUCTURING_HTML_TAGS as x,normalizeCustomHtmlTags as w,getHtmlTagFromContent as M,shouldRenderUnknownHtmlTagAsText as C,getMarkdown as B,mergeCustomHtmlTags as _,resolveCustomHtmlTags as O,parseMarkdownToStructure as T,EXTENDED_STANDARD_HTML_TAGS as I,stripCustomHtmlWrapper as L,setDefaultMathOptions as A}from"stream-markdown-parser";import{shallowRef as H,inject as R,computed as P,defineComponent as $,openBlock as F,createElementBlock as E,createElementVNode as K,toDisplayString as z,h as j,normalizeClass as W,createVNode as D,unref as V,useAttrs as q,ref as U,watch as J,onScopeDispose as G,Fragment as X,createTextVNode as Y,createCommentVNode as Z,getCurrentInstance as Q,provide as ee,onBeforeUnmount as ne,renderSlot as te,nextTick as oe,defineAsyncComponent as le,createBlock as re,resolveDynamicComponent as ie,mergeProps as ae,withCtx as ue,normalizeStyle as se,renderList as ce,withDirectives as de,vShow as fe,markRaw as me,normalizeProps as he,guardReactiveProps as ve,Transition as pe,reactive as ge,getCurrentScope as ye,onMounted as ke,watchEffect as be,triggerRef as Ne,resolveComponent as Se,toRaw as xe,toValue as we}from"vue";import{resolveStreamingTextUpdate as Me,createDiffMatchCache as Ce,buildDiffPreviewPanes as Be,normalizeShikiLanguage as _e,createSmoothMarkdownStream as Oe}from"markstream-core";import{M as Te,n as Ie,c as Le,g as Ae,s as He,h as Re}from"./index2.js";import{b as Pe}from"./workers-katexWorkerClient.js";import{a as $e,b as Fe,c as Ee,e as Ke,p as ze}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const je="__global__",We="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",De=(()=>{const e=globalThis;if(e[We])return e[We];const n={scopedCustomComponents:{},revision:H(0)};return e[We]=n,n})(),Ve=De.revision,qe=/* @__PURE__ */Symbol("markstreamCustomComponents"),Ue=/* @__PURE__ */new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Je(e){return Ue.has(String(e).trim().toLowerCase())}function Ge(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Xe(e={}){const n={};for(const[t,o]of Object.entries(e))if(null!=o){n[t]=o;for(const e of/* @__PURE__ */new Set([c(t),c(Ge(t))]))!e||Je(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Ye(e,n){"string"==typeof e?De.scopedCustomComponents[e]=Xe(n||{}):De.scopedCustomComponents[je]=Xe(e||{}),Ve.value++}function Ze(e){const n=Xe(De.scopedCustomComponents[je]||{});if(!e)return n;const t=Xe(De.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Qe(e){const n=R(qe,null);return P(()=>{var t;return Ve.value,function(e,n={}){return Ve.value,a(a(a({},Xe(De.scopedCustomComponents[je]||{})),Xe(n)),Xe(function(e){return e&&De.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function en(e){if(e===je)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete De.scopedCustomComponents[e],Ve.value++}function nn(){delete De.scopedCustomComponents[je],Ve.value++}const tn=["aria-label"],on={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"},ln={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"},rn=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},an=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(F(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),E("svg",ln,[...t[1]||(t[1]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),K("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(F(),E("svg",on,[...t[0]||(t[0]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,tn))}),[["__scopeId","data-v-be21ab83"]]);an.install=e=>{e.component(an.__name,an)};const un={class:"emoji-node"},sn=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(F(),E("span",un,z(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);sn.install=e=>{e.component(sn.__name,sn)};const cn=["id"],dn=["title"],fn=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${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)=>(F(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[K("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+z(e.node.id)+"]",9,dn)],8,cn))}}),[["__scopeId","data-v-c1463a29"]]);fn.install=e=>{e.component(fn.__name,fn)};const mn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function hn(e){mn&&console.warn(e)}function vn(e,n){return v(e,n)}function pn(e,n="safe",t){return f(e,n,t)}function gn(e){return p(e)}function yn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function kn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=m((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),yn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),yn(e.value)]):Object.entries(l).map(([e,n])=>[e,yn(n)]):null,n,t);var l;if(!o)return;const r=gn(h(o));return Object.keys(r).length>0?r:void 0}function bn(e,n,t=!1){const o=Object.entries(null!=n?n:{}),l=o.length>0?o.map(([e,n])=>""===n?` ${e}`:` ${e}="${n}"`).join(""):"";return t?`<${e}${l} />`:`<${e}${l}>`}function Nn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function Sn(e,n,t,o,l,r,i=!1){const s=vn(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[bn(e,n,!0)]:[bn(e,n),...t,`</${e}>`];const c=f(n,r,e),d=c.key,m=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=gn(c);return j(n,u(a({},l),{key:m}),t.length>0?t:void 0)}return j(e,u(a({},c),{innerHTML:void 0,key:m}),t.length>0?t:void 0)}function xn(e,n,t="safe",o=!1){var l,r;try{if(!o&&0===Object.keys(n).length)return{ok:!0,hasCustomComponents:!1,nodes:null};const r=d(e);let i=!1;for(const e of r)if(("tag_open"===e.type||"self_closing"===e.type)&&vn(null!=(l=e.tagName)?l:"",n)){i=!0;break}const a=o||i?function(e,n,t="safe"){let o=0;const l=[],r=[];for(const i of e)if("text"===i.type)(l.length>0?l[l.length-1].children:r).push(i.content);else if("self_closing"===i.type){const e=Sn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);Nn(l.length>0?l[l.length-1].children:r,e)}else if("tag_open"===i.type)l.push({tagName:i.tagName,children:[],attrs:i.attrs,autoKey:"ms-html-"+o++});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let o=-1;for(let n=l.length-1;n>=0;n--)if(l[n].tagName.toLowerCase()===e){o=n;break}if(-1!==o)for(;l.length>o;){const i=l.pop(),a=Sn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?Nn(l[l.length-1].children,a):Nn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&hn(`Auto-closing unclosed tag: <${i.tagName}>`)}else hn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=Sn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?Nn(l[l.length-1].children,o):Nn(r,o),hn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(r,n,t):null;return{ok:!0,hasCustomComponents:i,nodes:a}}catch(i){return r=i,mn&&console.error("Failed to parse HTML to VNodes:",r),{ok:!1,hasCustomComponents:!1,nodes:null}}}const wn=["innerHTML"],Mn=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=P(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Qe(()=>n.customId),r=$({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=P(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};const t=!0===n.node.loading&&!0===n.node.autoClosed,r=xn(e,l.value,o.value,t);return r.ok&&(t||r.hasCustomComponents)?{mode:"dynamic",nodes:r.nodes}:{mode:"html",content:b(e,o.value)}});return(e,t)=>"dynamic"===i.value.mode?(F(),E("span",{key:0,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[D(V(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),E("span",{key:1,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},z(i.value.content),3)):(F(),E("span",{key:2,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,wn))}}),[["__scopeId","data-v-fbbbc497"]]);Mn.install=e=>{e.component(Mn.__name,Mn)};const Cn={class:"inline-code"},Bn={key:0},_n=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=q(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=R("markstreamStreamVersion",void 0),i=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=P(()=>!a.value),c=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=U(n.node.code),f=U(""),m=U(0);let h;function v(){null==h||h(),h=void 0}function p(){f.value&&(d.value=d.value+f.value,f.value="")}J([()=>n.node.code,c,a],([e])=>{const n=String(null!=e?e:""),t=c.value,o=Me({nextContent:n,persistedContent:t?null==l?void 0:l.get(t):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value});d.value=o.settledContent,f.value=o.streamedDelta,o.appended?(m.value+=1,!h&&r&&(h=J(()=>r.value,()=>{f.value&&p()},{flush:"sync"}))):f.value||v(),t&&(null==l||l.set(t,n))},{immediate:!0}),G(v);const g=P(()=>m.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),E("code",Cn,[s.value?(F(),E(X,{key:0},[Y(z(u.value),1)],64)):(F(),E(X,{key:1},[d.value?(F(),E("span",Bn,z(d.value),1)):Z("",!0),f.value?(F(),E("span",{key:1,class:W(["inline-code-stream-delta",[g.value]]),onAnimationend:p},z(f.value),35)):Z("",!0)],64))]))}}),[["__scopeId","data-v-cd37b762"]]);_n.install=e=>{e.component(_n.__name,_n)};const On=U(!1),Tn=U(""),In=U("top"),Ln=U(null),An=U(null),Hn=U(null),Rn=U(null),Pn=U(null);let $n=null,Fn=null,En=0;function Kn(){$n&&(clearTimeout($n),$n=null),Fn&&(clearTimeout(Fn),Fn=null)}let zn=!1,jn=null,Wn=!1;function Dn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++En;Kn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!zn&&!Wn&&"undefined"!=typeof document){null!=jn||(jn=s(null,null,function*(){const[{createApp:e,h:n},{default:t}]=yield Promise.all([import("vue"),import("./Tooltip.js")]),o=document.createElement("div");o.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(o),e({setup:()=>()=>{var e;return n(t,{visible:On.value,"anchor-el":Ln.value,content:Tn.value,placement:In.value,id:An.value,originX:Hn.value,originY:Rn.value,isDark:null!=(e=Pn.value)?e:void 0})}}).mount(o),zn=!0}));try{yield jn}catch(e){zn=!1,jn=null,Wn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),zn&&i===En){An.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Ln.value=e,Tn.value=n,In.value=t,Hn.value=null!=(o=null==l?void 0:l.x)?o:null,Rn.value=null!=(a=null==l?void 0:l.y)?a:null,Pn.value="boolean"==typeof r?r:null,On.value=!0;try{e.setAttribute("aria-describedby",An.value)}catch(u){}}});o?a():$n=setTimeout(a,80)}function Vn(e=!1){En+=1,Kn();const n=()=>{if(Ln.value&&An.value)try{Ln.value.removeAttribute("aria-describedby")}catch(e){}On.value=!1,Ln.value=null,An.value=null,Hn.value=null,Rn.value=null};e?n():Fn=setTimeout(n,120)}const qn={"common.copy":"Copy","common.selectCopy":"全选(复制)","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..."},Un=/* @__PURE__ */Symbol("markstreamI18nFallback");function Jn(e){Object.assign(qn,e)}function Gn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:qn[e]}const Xn=(e,n)=>{var t;return null!=(t=Gn(e,n))?t: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 Yn(e,n){return{t(t){const o=Gn(t,n);if(e.te&&null!=o&&!e.te(t))return Xn(t,n);const l=e.t(t);return l===t&&null!=o?Xn(t,n):l}}}function Zn(){const e=function(){var e,n,t;try{const o=Q(),l=Un,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=Q(),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(n)return Yn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return Yn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Xn(n,e)}}const Qn=/* @__PURE__ */Symbol("ViewportPriority"),et=/* @__PURE__ */Symbol("ViewportPriorityOptions"),nt=/* @__PURE__ */Symbol("OffscreenHeavyNodeDeferral"),tt=P(()=>!1),ot="400px";function lt(){return R(et,void 0)}function rt(){return R(nt,tt)}function it(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?U(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,u=/* @__PURE__ */new WeakMap;let s=1;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Set;let m=null,h=null;function v(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function p(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function g(e){if(e){const t=c.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch(n){}c.delete(e)}}d.size||f.size||p()}function y(e){const n=d.get(e);if(!n)return;const t=c.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(o){}}try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)}function k(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==m&&f.size&&(m=i(()=>{m=null;const e=f.values().next().value;e&&(f.delete(e),y(e),f.size&&k())},{timeout:1200}))}function b(n,t){if(!l)return null;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:ot,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[v((i=o).root),i.rootMargin,i.threshold].join("\0");var i;const a=c.get(r);if(a)return{key:r,bucket:a};let u;try{u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&y(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold})}catch(d){return null}const s={io:u,targets:/* @__PURE__ */new Map};return c.set(r,s),{key:r,bucket:s}}function N(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=b(n,t.opts);if(!o){y(n);continue}if(o.key===t.bucketKey)continue;const l=t.bucketKey,r=c.get(l);try{null==r||r.io.unobserve(n)}catch(e){}null==r||r.targets.delete(n),t.bucketKey=o.key,o.bucket.targets.set(n,t),o.bucket.io.observe(n),g(l)}}J(r,e=>{if(!e){for(const e of Array.from(d.keys()))y(e);p()}},{flush:"sync"});const S=(e,n)=>{const t=U(!1);let o,i=!1;const a=new Promise(e=>{o=()=>{i||(i=!0,e())}}),u=()=>{const n=d.get(e);if(!n)return f.delete(e),void g();const t=c.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=b(e,n);if(!s)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const m={resolve:o,visible:t,bucketKey:s.key,opts:n};return d.set(e,m),s.bucket.targets.set(e,m),s.bucket.io.observe(e),l&&null==h&&(h=window.requestAnimationFrame(()=>{h=null,N()})),!1!==(null==n?void 0:n.allowIdle)&&(f.add(e),k()),{isVisible:t,whenVisible:a,destroy:u}};return S.refresh=N,ee(Qn,S),S}function at(){var e,n;const t=R(Qn,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new Map,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,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=e=>{if(!e)return;const n=l.get(e);if(n&&!n.targets.size){try{n.io.disconnect()}catch(t){}l.delete(e)}},d=e=>{const n=o.get(e);if(!n)return;const t=l.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(i){}}try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},f=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&f())},{timeout:1200}))};return(e,n)=>{const t=U(!1);let i,a=!1;const u=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{const n=o.get(e);if(!n)return r.delete(e),void(r.size||s());const t=l.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},h=(e=>{var n,t;if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return null;const o=(e=>{var n,t;return[null!=(n=null==e?void 0:e.rootMargin)?n:ot,null!=(t=null==e?void 0:e.threshold)?t:0].join("\0")})(e),r=l.get(o);if(r)return{key:o,bucket:r};const i=null!=(n=null==e?void 0:e.rootMargin)?n:ot;let a;try{a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:i,threshold:null!=(t=null==e?void 0:e.threshold)?t:0})}catch(s){return null}const u={io:a,targets:/* @__PURE__ */new Set};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.targets.add(e),h.bucket.io.observe(e),!1!==(null==n?void 0:n.allowIdle)&&(r.add(e),f()),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}function ut(e,n){var t,o;const l=null!=(o=null!=(t=e.indexKey)?t:n["index-key"])?o:n.indexKey;return null==l||""===l?"":String(l)}const st=["data-markstream-viewport-pending"],ct=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],dt={key:1,class:"image-placeholder"},ft={key:1,class:"image-node__raw-text"},mt={key:2,class:"image-shimmer-overlay"},ht={key:1,class:"image-node__raw-text"},vt={key:3,class:"image-error"},pt=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){var t,o,l;const r=e,i=n,a=U(!1),u=U(!1),c=U(""),d=U("primary"),f=U(null),m=q(),h=R(Te,null),v=at(),p=lt(),g=rt(),y=P(()=>N(r.node.src)),k=P(()=>N(r.fallbackSrc)),b=null==(l=null==(o=null==(t=Q())?void 0:t.vnode.el)?void 0:o.querySelector)?void 0:l.call(o,"img"),S="undefined"!=typeof window&&(null==b?void 0:b.getAttribute("src"))===(y.value||k.value),x=U("undefined"==typeof window||S||!g.value),w=H(null);let M="",C=null;const B=P(()=>c.value),_=P(()=>!r.lazy),O=P(()=>"undefined"!=typeof window&&g.value&&!S),T=P(()=>!O.value||x.value),I=P(()=>T.value?B.value:""),L=P(()=>{var e,n;return null!=(n=null!=(e=null==p?void 0:p.value.heavyBlockMargin)?e:null==p?void 0:p.value.rootMargin)?n:ot}),A=P(()=>!r.node.loading&&"failed"!==d.value&&c.value.length>0),$=P(()=>"failed"===d.value),j=P(()=>(!_.value||O.value&&!x.value)&&!a.value&&!u.value&&"failed"!==d.value&&c.value.length>0),D=P(()=>ut(r,m));function G(e=D.value){e&&f.value&&(null==h||h.reportHeight(e,f.value.offsetHeight))}function X(e=D.value){e&&oe(()=>{G(e)})}function Y(){C&&(clearTimeout(C),C=null)}function ee(){const e=D.value;e&&M!==e&&(M&&(null==h||h.markSettled(M)),Y(),M=e,null==h||h.markPending(e),"undefined"!=typeof window&&(C=window.setTimeout(()=>{M===e&&(X(e),le())},8e3)))}function le(){return s(this,null,function*(){const e=M;e&&(Y(),M="",yield oe(),G(e),null==h||h.markSettled(e))})}function re(){if("primary"===d.value&&k.value&&k.value!==c.value)return d.value="fallback",c.value=k.value,a.value=!1,u.value=!1,void X();d.value="failed",u.value=!0,i("error",c.value),X()}function ie(){a.value=!0,u.value=!1,i("load",B.value),X()}function ae(e){e.preventDefault(),a.value&&!u.value&&i("click",[e,B.value])}const{t:ue}=Zn();return J([y,k,()=>r.node.loading],()=>(a.value=!1,u.value=!1,r.node.loading||y.value?(c.value=y.value,void(d.value="primary")):k.value?(c.value=k.value,void(d.value="fallback")):(c.value="",d.value="failed",void(u.value=!0))),{immediate:!0}),"undefined"!=typeof window&&J([f,O],([e,n],t,o)=>{var l;if(null==(l=w.value)||l.destroy(),w.value=null,!n||x.value)return void(x.value=!0);if(!e)return void(x.value=!1);let r=!0;const i=v(e,{rootMargin:L.value,allowIdle:!1});w.value=i,x.value=i.isVisible.value,i.whenVisible.then(()=>{r&&w.value===i&&(x.value=!0)}),o(()=>{r=!1,i.destroy(),w.value===i&&(w.value=null)})},{immediate:!0}),J([A,a,u,B,()=>r.lazy,T],([e,n,t,o,l,r])=>e&&o&&!t&&r?n?(le(),void X()):l?(ee(),void X()):void(n||t||ee()):(le(),void X()),{flush:"post",immediate:!0}),ne(()=>{var e;null==(e=w.value)||e.destroy(),w.value=null,function(){const e=M;e&&(Y(),M="",null==h||h.markSettled(e))}()}),(n,t)=>{var o,l,i,s,c;return F(),E("span",{ref_key:"rootRef",ref:f,class:"image-node-container","data-markstream-viewport-pending":O.value&&!x.value?"true":void 0},[A.value?(F(),E("img",{key:0,src:I.value||void 0,alt:String(null!=(l=null!=(o=r.node.alt)?o:r.node.title)?l:""),title:String(null!=(s=null!=(i=r.node.title)?i:r.node.alt)?s:""),class:W(["image-node__img",{"is-loading":!_.value&&!a.value,"is-loaded":_.value||a.value,"has-natural-size":a.value,"cursor-pointer":a.value}]),loading:r.lazy?"lazy":void 0,fetchpriority:_.value?"high":void 0,decoding:_.value?"sync":"async",tabindex:a.value?0:-1,"aria-label":null!=(c=r.node.alt)?c:V(ue)("image.preview"),onError:re,onLoad:ie,onClick:ae},null,42,ct)):Z("",!0),e.node.loading&&!u.value?(F(),E("span",dt,[r.usePlaceholder?te(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[0]||(t[0]=K("span",{class:"image-shimmer"},null,-1))],!0):(F(),E("span",ft,z(e.node.raw),1))])):Z("",!0),j.value&&!e.node.loading?(F(),E("span",mt,[r.usePlaceholder?te(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[1]||(t[1]=K("span",{class:"image-shimmer"},null,-1))],!0):(F(),E("span",ht,z(e.node.raw),1))])):Z("",!0),$.value?(F(),E("span",vt,[te(n.$slots,"error",{node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[2]||(t[2]=K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[K("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),K("span",null,z(V(ue)("image.loadError")),1)],!0)])):Z("",!0)],8,st)}}}),[["__scopeId","data-v-a026f5e7"]]);pt.install=e=>{e.component(pt.__name,pt)};const gt=le({loader:()=>Promise.resolve().then(()=>Wa),suspensible:!1}),yt={key:2},kt=/* @__PURE__ */$({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Qe(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamNestedRendererProps",void 0),r=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=P(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=P(()=>n.components[String(n.node.type)]),c=P(()=>Boolean(s.value&&t.value[n.node.type]&&!Je(String(n.node.type)))),d=P(()=>c.value?kn(n.node,r.value):void 0),f=P(()=>Array.isArray(n.node.children)&&n.node.children.length>0),m=P(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),h=P(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>s.value&&c.value?(F(),re(ie(s.value),ae({key:0},d.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark,"data-markstream-reference-id":"reference"===e.node.type?String(e.node.id):void 0}),{default:ue(()=>[f.value?(F(),re(V(gt),ae({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):m.value?(F(),re(V(gt),ae({key:1},i.value,{content:m.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark","data-markstream-reference-id"])):s.value?(F(),re(ie(s.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey,"data-markstream-reference-id":"reference"===e.node.type?String(e.node.id):void 0},null,8,["node","custom-id","index-key","data-markstream-reference-id"])):e.fallbackToText?(F(),E("span",yt,z(h.value),1)):Z("",!0)}}),bt=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Nt={key:0,translate:"no",class:"markstream-pre__diff-code"},St={class:"markstream-pre__diff-pane-content"},xt={key:0,class:"markstream-pre__diff-collapsed-icon","aria-hidden":"true"},wt={class:"markstream-pre__diff-number","aria-hidden":"true"},Mt={class:"markstream-pre__diff-content"},Ct={class:"markstream-pre__diff-content-inner"},Bt={key:0,translate:"no",class:"markstream-pre__code markstream-pre__code--wrapped"},_t=["data-line-number","textContent"],Ot={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Tt=["textContent"],It=["textContent"],Lt=/* @__PURE__ */$({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const n=e,t=q(),o=Ce();function l(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}const r=P(()=>{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"}),i=P(()=>`language-${r.value}`),a=P(()=>{var e;return!0===n.loading||!0===(null==(e=n.node)?void 0:e.loading)}),u=P(()=>{var e;return l(null==(e=n.node)?void 0:e.code,a.value)});let s="",c=1;const d=P(()=>function(e){let n=0,t=1;e.startsWith(s)&&(n=s.length,t=c,n>0&&"\r"===e[n-1]&&"\n"===e[n]&&n++);for(let o=n;o<e.length;o++)"\n"===e[o]?t++:"\r"===e[o]&&(t++,"\n"===e[o+1]&&o++);return s=e,c=t,t}(u.value));let f="",m=[],h=0,v=0;const p=new RegExp("(?<=\\n)|(?<=\\r)(?!\\n)"),g=P(()=>function(e){const n=e.length>f.length&&e.startsWith(f),t=n?m:[],o=n?v:0;n&&(t.length=h);for(const r of e.slice(o).split(p))t.push(r);const l=e[e.length-1];return"\n"===l?(h=t.length,v=e.length,t.push("")):(h=t.length-1,v=e.length-t[t.length-1].length,"\r"===l&&t.push("")),f=e,m=t,t}(u.value)),y=P(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),k=P(()=>{var e;if(W(t.class).split(/\s+/).includes("is-wrap"))return!0;const n=se(t.style);return"string"==typeof n?/(?:^|;)\s*white-space\s*:\s*(?:pre-wrap|break-spaces)(?:\s*!important)?\s*(?:;|$)/i.test(n):["pre-wrap","break-spaces"].includes(String(null!=(e=null==n?void 0:n.whiteSpace)?e:null==n?void 0:n["white-space"]))}),b=P(()=>y.value&&k.value);let N=0,S="";const x=P(()=>{const e=d.value;e<N&&(N=0,S="");for(let n=N+1;n<=e;n++)S+=`${S?"\n":""}${n}`;return N=e,S}),w=P(()=>y.value&&!0===n.diffInline),M=P(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return a.value?{maxHeight:t,overflow:"auto"}:{height:t,minHeight:t,maxHeight:t,overflow:"auto"}});function C(e,n){const t=l(e,n);if(!t)return 0;let o=1;for(let l=0;l<t.length;l++)"\n"===t[l]?o++:"\r"===t[l]&&(o++,"\n"===t[l+1]&&l++);return o}const B=P(()=>{var e,t,l,r,i;return y.value?Be({code:null==(e=n.node)?void 0:e.code,hideUnchangedRegions:n.diffHideUnchangedRegions,inline:w.value,language:null==(t=n.node)?void 0:t.language,loading:a.value,matchCache:o,originalCode:null==(l=n.node)?void 0:l.originalCode,raw:null==(r=n.node)?void 0:r.raw,updatedCode:null==(i=n.node)?void 0:i.updatedCode}):[]}),_=P(()=>{const e=B.value;let n=1,t=!1;for(const o of e)for(const e of o.lines)"collapsed"===e.kind&&(t=!0),"number"==typeof e.number&&e.number>n&&(n=e.number);return{maxNumberedLine:n,hasCollapsed:t}}),O=P(()=>{var e,t;if(!0!==n.showLineNumbers)return;let o=y.value?1:d.value;y.value&&(o=Math.max(o,C(null==(e=n.node)?void 0:e.originalCode,a.value),C(null==(t=n.node)?void 0:t.updatedCode,a.value),_.value.maxNumberedLine));const l=`${Math.max(2,String(o).length)}ch`;return{"--markstream-pre-line-number-width":l,"--markstream-pre-diff-line-number-width":l,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}}),T=P(()=>y.value&&_.value.hasCollapsed),I=P(()=>{const e=r.value;return e?`Code block: ${e}`:"Code block"}),L=U(null),A=U([]);let H=null,R=null,$=!1,j=null;function D(){if($||"undefined"==typeof window||!y.value||w.value||!b.value)return;if(null!=H)return;const e=null!=R?R:R=import("./preCodeDiffMetrics.js");H=window.requestAnimationFrame(()=>{e.then(({measurePreCodeDiffLines:e})=>{!$&&L.value&&(A.value=e(L.value,A.value))},()=>{R=null}).finally(()=>{H=null})})}function V(e){null==j||j.disconnect(),j=null,e&&y.value&&!w.value&&b.value&&"undefined"!=typeof ResizeObserver&&(j=new ResizeObserver(()=>{D()}),j.observe(e))}function G(e,n){if(!b.value)return;const t=A.value[e];if(!t)return;const o="original"===n?t.originalHeight:t.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(t.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(o)}px`}}return J(L,e=>{V(e),D()},{flush:"post"}),J([y,w,B,b],()=>{V(L.value),y.value&&!w.value&&b.value?D():A.value.length&&(A.value=[])},{flush:"post",immediate:!0}),ne(()=>{$=!0,null!=H&&(window.cancelAnimationFrame(H),H=null),null==j||j.disconnect(),j=null}),(e,t)=>{return F(),E("pre",{ref_key:"preRef",ref:L,style:se([M.value,O.value]),class:W([i.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":y.value,"markstream-pre--diff-inline":w.value,"markstream-pre--diff-collapsed":T.value}]),"aria-busy":a.value,"aria-label":I.value,"data-language":r.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[y.value?(F(),E("code",Nt,[(F(!0),E(X,null,ce(B.value,e=>(F(),E("span",{key:e.key,class:W(["markstream-pre__diff-pane",e.className])},[K("span",St,[(F(!0),E(X,null,ce(e.lines,(n,o)=>(F(),E("span",{key:n.key,class:W(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,n.metadataKind?`markstream-pre__diff-line--metadata-${n.metadataKind}`:"",{"markstream-pre__diff-line--empty":n.empty,"markstream-pre__diff-line--collapsed-first":!0===n.collapsedFirst,"markstream-pre__diff-line--collapsed-last":!0===n.collapsedLast}]]),style:se(G(o,e.key))},[t[1]||(t[1]=K("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),"collapsed"===n.kind?(F(),E("span",xt,[...t[0]||(t[0]=[K("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[K("path",{d:"M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"})],-1)])])):Z("",!0),K("span",wt,z(n.number),1),K("span",Mt,[K("span",Ct,z(n.code),1)])],6))),128))])],2))),128))])):(F(),E(X,{key:1},[!0===n.showLineNumbers&&!0!==(null==(o=n.node)?void 0:o.diff)&&k.value?(F(),E("code",Bt,[(F(!0),E(X,null,ce(g.value,(e,n)=>(F(),E("span",{key:n,class:"markstream-pre__logical-line","data-line-number":n+1,textContent:z(e)},null,8,_t))),128))])):(F(),E(X,{key:1},[n.showLineNumbers?(F(),E("span",Ot,[K("span",{class:"markstream-pre__line-numbers-text",textContent:z(x.value)},null,8,Tt)])):Z("",!0),K("code",{translate:"no",class:"markstream-pre__code",textContent:z(u.value)},null,8,It)],64))],64))],14,bt);var o}}});Lt.install=e=>{e.component(Lt.__name,Lt)};const At=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=q(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=R("markstreamStreamVersion",void 0),i=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=U(n.node.content),c=U(""),d=U(0),f=U(n.node.content);let m;const h=U(null),v=U(null),p=U(null);let g,y="",k=null,b=null,N=!1;function S(e){var n;const t=null==(n=document.getSelection)?void 0:n.call(document);if(!t||0===t.rangeCount||t.isCollapsed)return!1;for(let o=0;o<t.rangeCount;o++)if(t.getRangeAt(o).intersectsNode(e))return!0;return!1}function x(){null==m||m(),m=void 0}function w(){if(p.value&&S(p.value))return N=!0,void B();N=!1,c.value&&(s.value=s.value+c.value,c.value="")}function M(e){const n=u.value,t=Me({nextContent:e,persistedContent:n?null==l?void 0:l.get(n):void 0,currentState:{settledContent:s.value,streamedDelta:c.value},typewriterEnabled:a.value});s.value=t.settledContent,c.value=t.streamedDelta,t.appended?(d.value+=1,!m&&r&&(m=J(()=>r.value,()=>{c.value&&w()},{flush:"sync"}))):c.value||x(),n&&(null==l||l.set(n,e))}function C(){if(!p.value||!S(p.value))if(_(),null!=b){const e=b;b=null,N=!1,M(e)}else N&&w()}function B(){g||(g=document,g.addEventListener("selectionchange",C))}function _(){null==g||g.removeEventListener("selectionchange",C),g=void 0}J([s,h,v],function(){var e,n;const t=h.value;if(!t)return;const o=String(null!=(e=s.value)?e:""),l=v.value;return k||(k=t.firstChild,y=null!=(n=null==k?void 0:k.data)?n:""),o.startsWith(y)?!k&&o?(t.textContent=o,k=t.firstChild,void(y=o)):void(o.length>y.length&&l&&(l.appendChild(document.createTextNode(o.slice(y.length))),y=o,function(e){var n,t;if(e.childNodes.length<=4)return;if(function(e){var n;const t=null==(n=document.getSelection)?void 0:n.call(document);if(!t||0===t.rangeCount)return!1;const{anchorNode:o,focusNode:l}=t;return null!=o&&e.contains(o)||null!=l&&e.contains(l)}(e))return;let o="";for(let l=0;l<e.childNodes.length;l++)o+=null!=(t=null==(n=e.childNodes[l])?void 0:n.textContent)?t:"";e.textContent=o}(l))):(t.textContent=o,k=t.firstChild,l&&(l.textContent=""),void(y=o))},{immediate:!0}),J([()=>n.node.content,u,a],([e])=>{const n=String(null!=e?e:"");if(p.value&&S(p.value))return b=n,void B();b=null,N=!1,M(n)},{immediate:!0}),G(()=>{x(),_()});const O=P(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,t)=>(F(),E("span",{class:W([[e.node.center?"text-node-center":""],"text-node"])},[de(K("span",{ref_key:"settledTextEl",ref:h},z(f.value),513),[[fe,""!==s.value]]),de(K("span",{ref_key:"settledAppendsEl",ref:v},null,512),[[fe,""!==s.value]]),c.value?(F(),E("span",{key:0,ref_key:"streamedDeltaEl",ref:p,class:W(["text-node-stream-delta",[O.value]]),onAnimationend:w},z(c.value),35)):Z("",!0)],2))}}),[["__scopeId","data-v-423ca752"]]);function Ht(e){var n;if("boolean"==typeof e)return e;const t=e;if(!0===(null==t?void 0:t.expandUnchanged))return!1;const o=Number(null==(n=null==t?void 0:t.parseDiffOptions)?void 0:n.context),l=Number(null==t?void 0:t.collapsedContextThreshold);return{enabled:!0,contextLineCount:isFinite(o)&&o>=0?Math.floor(o):2,minimumLineCount:isFinite(l)&&l>=0?Math.floor(l)+1:6,revealLineCount:5}}function Rt(e){return"unified"===e.diffStyle}function Pt(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let r=3;for(;o[r]===l;)r+=1;return o.slice(r).trim()}function $t(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}function Ft(e){var n;return!0===e.diff||$t(e.language)||$t(Pt(String(null!=(n=e.raw)?n:"")))}function Et(e,n,t){const o=function(e){const n=Pt(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:o||n,caption:o?t?`Diff / ${n}`:n:""}}function Kt(e){const n=String(null!=e?e:"").replace(/\r\n$|\n$|\r$/,"");return n?n.split(/\r\n|\n|\r/):[]}At.install=e=>{e.component(At.__name,At)};let zt="",jt="",Wt=null;function Dt(e,n){var t;if(Wt&&zt===e&&jt===n)return Wt;const o=Kt(e),l=Kt(n);let r=0,i=o.length-1,a=l.length-1;for(;r<=i&&r<=a&&o[r]===l[r];)r++;for(;i>=r&&a>=r&&o[i]===l[a];)i--,a--;const u=Math.max(0,i-r+1),s=Math.max(0,a-r+1);let c;if(0===u||0===s)c={removed:u,added:s};else if((u+1)*(s+1)<=15e5){const e=/* @__PURE__ */new Map,n=new Uint32Array(s);for(let t=0;t<s;t++){const o=l[r+t];let i=e.get(o);void 0===i&&(i=e.size+1,e.set(o,i)),n[t]=i}const i=new Uint32Array(u);for(let l=0;l<u;l++)i[l]=null!=(t=e.get(o[r+l]))?t:0;const a=s+1;let d=new Uint32Array(a),f=new Uint32Array(a);for(let t=u-1;t>=0;t--){f[s]=0;for(let o=s-1;o>=0;o--)f[o]=i[t]===n[o]?d[o+1]+1:Math.max(d[o],f[o+1]);const e=d;d=f,f=e}const m=d[0];c={removed:u-m,added:s-m}}else c={removed:u,added:s};return zt=e,jt=n,Wt=c,c}function Vt(e){var n,t,o,l,r;const i=e.isDark?"dark":"light";return void 0!==e.theme?"string"==typeof e.theme?e.theme:e.theme[i]:null!=(r=e.isDark?null!=(t=e.darkTheme)?t:null==(n=e.themes)?void 0:n[0]:null!=(l=e.lightTheme)?l:null==(o=e.themes)?void 0:o[1])?r:`vitesse-${i}`}function qt(e,n=!1){const t=e.toLowerCase();return t?/dark|night|moon|black|dracula|mocha|frappe|macchiato|ocean|poimandres|monokai|laserwave|tokyo|rose-pine|material-theme/.test(t)&&!/light|latte|dawn|lotus/.test(t):n}function Ut(e){const n=Vt(e),t="vitesse-dark"===n||"vitesse-light"!==n&&qt(n,!0===e.isDark);if("vitesse-dark"!==n&&"vitesse-light"!==n){const e=t?"var(--markstream-code-theme-bg, #121212)":"var(--markstream-code-theme-bg, #ffffff)";return{builtin:!1,dark:t,name:n,background:e,diffAddedLine:`color-mix(in lab, ${e} ${t?"80%":"88%"}, ${t?"#4d9375":"#1e754f"})`,diffAddedNumber:`color-mix(in lab, ${e} ${t?"85%":"91%"}, ${t?"#4d9375":"#1e754f"})`,diffRemovedLine:`color-mix(in lab, ${e} ${t?"80%":"88%"}, ${t?"#cb7676":"#ab5959"})`,diffRemovedNumber:`color-mix(in lab, ${e} ${t?"85%":"91%"}, ${t?"#cb7676":"#ab5959"})`,foreground:t?"var(--markstream-code-theme-fg, #dbd7caee)":"var(--markstream-code-theme-fg, #393a34)",lineNumber:t?"var(--markstream-code-theme-line-number, #dedcd550)":"var(--markstream-code-theme-line-number, #393a3450)"}}return t?{builtin:!0,dark:!0,name:n,background:"#121212",diffAddedLine:"color-mix(in lab, #121212 80%, #4d9375)",diffAddedNumber:"color-mix(in lab, #121212 85%, #4d9375)",diffRemovedLine:"color-mix(in lab, #121212 80%, #cb7676)",diffRemovedNumber:"color-mix(in lab, #121212 85%, #cb7676)",foreground:"#dbd7caee",lineNumber:"#dedcd550"}:{builtin:!0,dark:!1,name:n,background:"#ffffff",diffAddedLine:"color-mix(in lab, #ffffff 88%, #1e754f)",diffAddedNumber:"color-mix(in lab, #ffffff 91%, #1e754f)",diffRemovedLine:"color-mix(in lab, #ffffff 88%, #ab5959)",diffRemovedNumber:"color-mix(in lab, #ffffff 91%, #ab5959)",foreground:"#393a34",lineNumber:"#393a3450"}}const Jt=12,Gt=18;function Xt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Yt(e){var n,t,o,l,r,i;const a=null!=(n=Xt(null==e?void 0:e.fontSize))?n:12,u=null!=(t=Xt(null==e?void 0:e.lineHeight))?t:12===a?18:Math.max(12,Math.round(1.5*a)),s="string"==typeof(null==e?void 0:e.fontFamily)&&e.fontFamily.trim()?e.fontFamily.trim():'"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace',c=null!=(o="number"==typeof(d=null==e?void 0:e.padding)&&Number.isFinite(d)&&d>=0?d:void 0)?o:8;var d;return{fontFamily:s,fontSize:a,lineHeight:u,maxHeight:null!=(l=Xt(null==e?void 0:e.maxHeight))?l:500,overflow:null!=(r=null==e?void 0:e.overflow)?r:"wrap",padding:c,paddingBottom:c,scrollbarGutter:6,tabSize:null!=(i=Xt(null==e?void 0:e.tabSize))?i:4}}function Zt(e,n,t){return $({name:e,inheritAttrs:!1,setup(e,{attrs:o,slots:l}){var r,i;const s=at(),c=lt(),d=rt(),f="undefined"!=typeof window&&1===(null==(i=null==(r=Q())?void 0:r.vnode.el)?void 0:i.nodeType),m=U("undefined"==typeof window||f||!d.value),h=H(null);let v=null;function p(e){const n=e&&"$el"in e?e.$el:e;h.value=n instanceof HTMLElement?n:null}return"undefined"!=typeof window&&J([h,d],([e,n],t,o)=>{if(null==v||v.destroy(),v=null,!n||m.value)return void(m.value=!0);if(!e)return;let l=!0;const r=s(e,{rootMargin:null==c?void 0:c.value.heavyBlockMargin,allowIdle:!1});v=r,m.value=r.isVisible.value,r.whenVisible.then(()=>{l&&v===r&&(m.value=!0)}),o(()=>{l=!1,r.destroy(),v===r&&(v=null)})},{immediate:!0}),ne(()=>{null==v||v.destroy(),v=null}),()=>j(m.value?n:t,u(a({},o),{ref:p}),l)}})}const Qt=$({name:"CodeBlockNodeLoadingShell",inheritAttrs:!1,props:["node","isDark","loading","stream","codeBlockOptions","showLineNumbers","theme","darkTheme","lightTheme","isShowPreview","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","enableFontSizeControl","minWidth","maxWidth","themes","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","indexKey","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline","diffInline","diffHideUnchangedRegions","reservedHeightPx"],emits:["click","mouseover","mouseout","copy","previewCode","handleArtifactClick"],setup(e,{attrs:n}){const t=e,o=Ce();return()=>{var e,l,r,i,s,c,d,f,m,h,v,p;const g=null!=(e=t.codeBlockOptions)?e:{},y=Yt(g),k=Ut({darkTheme:t.darkTheme,isDark:t.isDark,lightTheme:t.lightTheme,theme:t.theme,themes:t.themes}),b=Ie(String(null!=(r=null==(l=t.node)?void 0:l.language)?r:"")),N=Ft(t.node),S=Et(String(null!=(s=null==(i=t.node)?void 0:i.raw)?s:""),Le[b]||("typescript"===b?"TypeScript":b?b.charAt(0).toUpperCase()+b.slice(1):Le[""]),N),x=N?Be({originalCode:null==(c=t.node)?void 0:c.originalCode,updatedCode:null==(d=t.node)?void 0:d.updatedCode,loading:!0,matchCache:o}).flatMap(e=>e.lines):[],w=N?{removed:x.filter(e=>"removed"===e.kind).length,added:x.filter(e=>"added"===e.kind).length}:null,M=Number(null!=(f=t.estimatedContentHeightPx)?f:t.reservedHeightPx),C=!N&&Number.isFinite(M)&&M>0?Math.min(y.maxHeight,Math.ceil(M)):void 0,B=e=>j("button",{class:`code-action-btn code-loading-action code-loading-action--${e} inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0`,"aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"}),_=!1!==t.showExpandButton||!1!==t.showPreviewButton&&!1!==t.isShowPreview&&("html"===b||"svg"===b)||!1!==t.showFontSizeButtons&&!1!==t.enableFontSizeControl,O=e=>null==e?void 0:"number"==typeof e?`${e}px`:String(e),T={"--code-bg":k.background,"--code-fg":k.foreground,"--code-line-number":k.lineNumber,"--markstream-code-fallback-bg":k.background,"--markstream-code-fallback-fg":k.foreground,"--markstream-diff-added-line-fill":k.diffAddedLine,"--markstream-diff-added-number-fill":k.diffAddedNumber,"--markstream-diff-editor-bg":k.background,"--markstream-diff-metadata-bg":k.background,"--markstream-diff-metadata-fg":k.lineNumber,"--markstream-diff-removed-line-fill":k.diffRemovedLine,"--markstream-diff-removed-number-fill":k.diffRemovedNumber,"--markstream-diff-shell-bg":k.background,"--markstream-pre-resolved-theme-bg":k.background,"--markstream-pre-resolved-theme-fg":k.foreground,"--markstream-pre-resolved-theme-line-number":k.lineNumber};return j("div",u(a({},n),{class:["code-block-container rounded-lg border",{dark:!0===t.isDark,"is-dark":k.dark,"is-rendering":!1!==t.loading,"is-diff":N},n.class],style:[a(u(a({},T),{backgroundColor:k.background,color:k.foreground,minWidth:O(t.minWidth),maxWidth:O(t.maxWidth)}),N?{}:{borderColor:"var(--markstream-code-border-color, var(--code-border))"}),n.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":t.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[!1===t.showHeader?null:j("div",{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)]"},[j("div",{class:"code-header-main"},[j("span",{class:"icon-slot h-4 w-4 flex-shrink-0","aria-hidden":"true",innerHTML:Ae(b)}),j("div",{class:"code-header-copy"},[j("div",{class:"code-header-title"},S.title),S.caption?j("div",{class:"code-header-caption"},S.caption):null])]),j("div",{class:"flex items-center gap-0.5"},[w?j("div",{class:"code-diff-stats","aria-label":`-${w.removed} +${w.added}`},[j("span",{class:"code-diff-stat removed"},`-${w.removed}`),j("span",{class:"code-diff-stat added"},`+${w.added}`)]):null,!1===t.showCopyButton?null:B("copy"),!1===t.showCollapseButton?null:B("collapse"),_?j("div",{class:"relative"},[B("more")]):null])]),j("div",{class:"code-block-shell-content",style:!1!==t.stream||!1===t.loading?void 0:{display:"none"}},[j(Lt,{node:t.node,loading:t.loading,showLineNumbers:null!=(m=t.showLineNumbers)?m:!0!==g.disableLineNumbers,diffInline:N&&Boolean(null!=(v=null!=(h=t.diffInline)?h:t.estimatedDiffInline)?v:"unified"===g.diffStyle),diffHideUnchangedRegions:N?null!=(p=t.diffHideUnchangedRegions)?p:Ht(g):void 0,reservedHeightPx:C,class:["code-pre-fallback",{"is-wrap":"wrap"===y.overflow}],style:u(a({},T),{"--markstream-code-padding-x":`${y.padding}px`,"--markstream-code-padding-y":`${y.padding}px`,"--markstream-code-tab-size":y.tabSize,"--markstream-pre-diff-line-height":`${y.lineHeight}px`,backgroundColor:k.background,color:k.foreground,fontFamily:y.fontFamily,fontSize:`${y.fontSize}px`,lineHeight:`${y.lineHeight}px`,maxHeight:`${null!=C?C:y.maxHeight}px`,overflow:"auto",paddingTop:`${y.padding}px`,paddingBottom:`${y.paddingBottom}px`,tabSize:y.tabSize,whiteSpace:"wrap"===y.overflow?"pre-wrap":"pre",overflowWrap:"wrap"===y.overflow?"anywhere":"normal"}),"data-markstream-code-loading":"1"})]),j("div",{class:"code-loading-placeholder",style:!1===t.stream&&!1!==t.loading?void 0:{display:"none"}},[j("div",{class:"loading-skeleton"},[j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line short"})])])])}}}),eo=le({loader:()=>import("./PreCodeBlock.js"),loadingComponent:Qt,delay:0,suspensible:!0}),no=Zt("ViewportDeferredCodeBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load the enhanced CodeBlockNode chunk; falling back to preformatted code rendering. Enhanced code blocks require the optional "stream-diffs" peer.',e),Lt}}),loadingComponent:Qt,delay:0,suspensible:!1}),Qt),to=le(()=>s(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 j(At,u(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{return yield Pe(),(yield import("./index6.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 j(At,u(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:""}$`}}))}})),oo=le(()=>s(null,null,function*(){try{return yield Pe(),(yield import("./index5.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 j(At,u(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:""}$$`}}))}})),lo=["data-reference-id","data-markstream-reference-id"],ro=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0","data-reference-id":e.node.id,"data-markstream-reference-id":e.node.id,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))},z(e.node.id),41,lo))}),[["__scopeId","data-v-b96c91c3"]]);ro.install=e=>{e.component(ro.__name,ro)};const io={class:"superscript-node"},ao=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,emphasis:Mo,footnote_reference:fn,strikethrough:ho,highlight:xo,insert:No,subscript:so,emoji:sn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("sup",io,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);ao.install=e=>{e.component(ao.__name,ao)};const uo={class:"subscript-node"},so=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,emphasis:Mo,footnote_reference:fn,strikethrough:ho,highlight:xo,insert:No,superscript:ao,emoji:sn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("sub",uo,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);so.install=e=>{e.component(so.__name,so)};const co={class:"strong-node"},fo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:sn,footnote_reference:fn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("strong",co,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:t,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":n.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);fo.install=e=>{e.component(fo.__name,fo)};const mo={class:"strikethrough-node"},ho=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,emphasis:Mo,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:sn,footnote_reference:fn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("del",mo,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);ho.install=e=>{e.component(ho.__name,ho)};const vo=["href","title","aria-label","aria-hidden","target","rel"],po=["aria-hidden"],go={class:"link-text-wrapper relative inline-flex"},yo={class:"leading-[normal] link-text"},ko=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=P(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=P(()=>{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,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--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&&(s["--link-color"]=n.color),s}),r=Qe(()=>n.customId),i=P(()=>a({text:At,strong:fo,strikethrough:ho,emphasis:Mo,image:pt,html_inline:Mn,inline_code:_n},r.value)),u=q(),s=P(()=>{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 pn(l,"safe","a")}),c=P(()=>a(a({},u),s.value)),d=P(()=>{var e,t;return pn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=P(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(S(d.value)?"_blank":void 0)}),m=P(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=P(()=>{if(!d.value)return;const e=c.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),v=P(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Vn()}const g=P(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(F(),E("span",ae({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},V(u),{style:l.value}),[K("span",go,[K("span",yo,[D(V(At),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=K("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,po)):(F(),E("a",ae({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";Dn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),E(X,null,ce(e.node.children,(t,o)=>(F(),re(V(kt),{key:`${e.indexKey||"emphasis"}-${o}`,components:i.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))],16,vo))}}}),[["__scopeId","data-v-a414d325"]]);ko.install=e=>{e.component(ko.__name,ko)};const bo={class:"insert-node"},No=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,subscript:so,superscript:ao,emoji:sn,footnote_reference:fn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("ins",bo,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);No.install=e=>{e.component(No.__name,No)};const So={class:"highlight-node"},xo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,emphasis:Mo,strikethrough:ho,insert:No,subscript:so,superscript:ao,emoji:sn,footnote_reference:fn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("mark",So,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);xo.install=e=>{e.component(xo.__name,xo)};const wo={class:"emphasis-node"},Mo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>a({text:At,inline_code:_n,link:ko,html_inline:Mn,strong:fo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:sn,footnote_reference:fn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("em",wo,[(F(!0),E(X,null,ce(e.node.children,(t,l)=>(F(),re(V(kt),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Mo.install=e=>{e.component(Mo.__name,Mo)};const Co={class:"hard-break"},Bo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),E("br",Co))}),[["__scopeId","data-v-50c58f70"]]);Bo.install=e=>{e.component(Bo.__name,Bo)};const _o=/* @__PURE__ */$({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=me({checkbox:an,checkbox_input:an,emoji:sn,emphasis:Mo,hardbreak:Bo,highlight:xo,inline_code:_n,insert:No,link:ko,reference:ro,strikethrough:ho,strong:fo,subscript:so,superscript:ao,text:At}),o=Qe(()=>n.customId),l=P(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),E(X,null,ce(e.nodes,(t,o)=>(F(),re(V(kt),{key:o,components:l.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"inline"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))}});function Oo(e){if(!e||"object"!=typeof e)return!1;const n=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(n))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(n))return!0;const t=e.children;return Array.isArray(t)&&t.every(Oo)}function To(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Oo))return e;if(!n||1!==e.length)return null;const o=e[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const l=o.children;return(t||l.length>0)&&l.every(Oo)?l:null}function Io(e){var n,t;if(!(null==e?void 0:e.length))return null;let o="";for(const l of e){if("text"!==(null==l?void 0:l.type)||!0===l.center)return null;o+=String(null!=(t=null!=(n=l.content)?n:l.raw)?t:"")}return o}const Lo=["cite"],Ao={key:0,dir:"auto",class:"paragraph-node"},Ho=["custom-id"],Ro=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=Qe(()=>n.customId),o=P(()=>Boolean(t.value.paragraph)),l=P(()=>Boolean(t.value.text)),r=P(()=>To(n.node.children,!o.value)),i=P(()=>!1!==n.fade||l.value?null:Io(r.value));return ee("markstreamShowTooltips",P(()=>n.showTooltips)),ee("markstreamFade",P(()=>n.fade)),(t,o)=>(F(),E("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),E("p",Ao,[null!==i.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(i.value),9,Ho)):(F(),re(V(_o),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),re(V(ja),{key:1,"show-tooltips":n.showTooltips,"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,Lo))}}),[["__scopeId","data-v-abfecebc"]]);Ro.install=e=>{e.component(Ro.__name,Ro)};const Po={class:"definition-list"},$o={class:"definition-term"},Fo={class:"definition-desc"},Eo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(F(),E("dl",Po,[(F(!0),E(X,null,ce(n.node.items,(o,l)=>(F(),E(X,{key:l},[K("dt",$o,[D(V(ja),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),K("dd",Fo,[D(V(ja),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Eo.install=e=>{e.component(Eo.__name,Eo)};const Ko=["href","title"],zo=/* @__PURE__ */rn(/* @__PURE__ */$({__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",block:"center"})}return(n,o)=>(F(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Ko))}}),[["__scopeId","data-v-e1eb37b6"]]);zo.install=e=>{e.component(zo.__name,zo)};const jo=["id"],Wo={class:"flex-1"},Do=/* @__PURE__ */$({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(F(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[K("div",Wo,[D(V(ja),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,jo))}});Do.install=e=>{e.component(Do.__name,Do)};const Vo=["custom-id"],qo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=R("markstreamFade",void 0),l=P(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Io(n.node.children)),r=P(()=>a({text:At,inline_code:_n,link:ko,image:pt,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:sn,checkbox:an,checkbox_input:an,footnote_reference:fn,hardbreak:Bo,math_inline:to,reference:ro},t.value));return(t,o)=>(F(),re(ie(`h${e.node.level}`),ae({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:ue(()=>[null!==l.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(l.value),9,Vo)):(F(!0),E(X,{key:1},ce(e.node.children,(t,o)=>(F(),re(V(kt),{key:o,components:r.value,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${o}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Uo=qo;Uo.install=e=>{e.component(qo.__name,qo)};const Jo={key:0,dir:"auto",class:"paragraph-node"},Go=["custom-id"],Xo={dir:"auto",class:"paragraph-node"},Yo=["custom-id"],Zo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Qe(()=>n.customId),l=P(()=>Boolean(o.value.paragraph)),r=P(()=>Boolean(o.value.text)),i=P(()=>{var e;return To(null==(e=t.value)?void 0:e.children,!l.value)}),a=P(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=To([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=P(()=>u()?Io(i.value):null),c=P(()=>{var e;return u()?Io(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=P(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return ee("markstreamShowTooltips",P(()=>n.showTooltips)),ee("markstreamFade",P(()=>n.fade)),(e,o)=>{var l,r;return F(),E("li",ae({class:"list-item",dir:"auto"},f.value),[i.value?(F(),E("p",Jo,[null!==s.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(s.value),9,Go)):(F(),re(V(_o),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(F(),E(X,{key:1},[K("p",Xo,[null!==c.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(c.value),9,Yo)):(F(),re(V(_o),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(F(!0),E(X,null,ce(a.value.nestedLists,(t,l)=>(F(),re(V(ja),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(F(),re(V(ja),{key:2,"show-tooltips":n.showTooltips,"index-key":`list-item-${n.indexKey}`,nodes:null!=(r=null==(l=t.value)?void 0:l.children)?r:[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,onCopy:o[1]||(o[1]=n=>e.$emit("copy",n))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);Zo.install=e=>{e.component(Zo.__name,Zo)};const Qo=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=Qe(()=>e.customId),t=P(()=>n.value.list_item||Zo);return(n,o)=>(F(),re(ie(e.node.ordered?"ol":"ul"),{class:W(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:ue(()=>[(F(!0),E(X,null,ce(e.node.items,(l,r)=>{var i;return F(),re(ie(t.value),ae({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,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);Qo.install=e=>{e.component(Qo.__name,Qo)};const el={key:2,class:"html-block-node__raw"},nl=["innerHTML"],tl={key:1,class:"html-block-node__placeholder"},ol=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){var n;const t=e,o=R("markstreamHtmlPolicy",void 0),l=R("markstreamNestedRendererProps",void 0),r=P(()=>{var e,n;return null!=(n=null!=(e=t.htmlPolicy)?e:null==o?void 0:o.value)?n:"safe"}),i=P(()=>{var e,n;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(n=t.customId)?n:o.customId,htmlPolicy:r.value})}),c=le({loader:()=>Promise.resolve().then(()=>Wa),suspensible:!1}),d=P(()=>{const e=m(t.node.attrs,r.value);if(!e)return;const n=h(e);return Object.keys(n).length>0?n:void 0}),f=P(()=>{const e=String(t.node.tag||"").trim(),n=m(t.node.attrs,r.value,e);if(!n)return;const o=h(n);return Object.keys(o).length>0?o:void 0}),v=Qe(()=>t.customId),p=$({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),g=U(null);function y(e,n,t,o){if(!0!==e)return!1;const l=String(null!=n?n:"");if(!l)return!1;if(l!==String(null!=t?t:""))return!0;const r=String(null!=o?o:"").trim();return!!r&&!1===l.toLowerCase().includes(`</${r.toLowerCase()}`)}const N=U(y(t.node.loading,t.node.raw,t.node.content,t.node.tag)),S=U("undefined"==typeof window||N.value),w=U(t.node.content),M=U(0),C=U(String(null!=(n=t.node.raw)?n:"")),B=P(()=>Array.isArray(t.node.children)?t.node.children:[]);J(()=>[t.node.loading,t.node.raw,t.node.content,t.node.tag],([e,n,t,o])=>{const l=String(null!=n?n:""),r=!C.value||l.startsWith(C.value),i=y(e,n,t,o);r?i&&(N.value=!0):(N.value=i,M.value=0),i&&(S.value=!0),C.value=l},{flush:"sync"});const _=P(()=>String(t.node.tag||"div")),O=P(()=>{var e;if("details"!==_.value.trim().toLowerCase())return null;if(null==(e=t.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const n=B.value[0];return"html_block"===(null==n?void 0:n.type)&&"summary"===String(n.tag||"").toLowerCase()?n:null}),T=P(()=>{var e;return Io(null==(e=O.value)?void 0:e.children)}),I=P(()=>{const e=O.value;if(!e)return;const n=m(e.attrs,r.value,"summary");if(!n)return;const t=h(n);return Object.keys(t).length>0?t:void 0}),L=P(()=>null==T.value?B.value:B.value.slice(1)),A=P(()=>{const e=_.value.trim().toLowerCase();return x.has(e)||k(e,r.value)}),j=P(()=>B.value.length>0&&!!t.node.tag&&!A.value),W=P(()=>{var e,n,o;if(j.value)return{mode:"structured"};if(!S.value)return{mode:"html",content:null!=(e=w.value)?e:""};const l=null!=(n=w.value)?n:t.node.content;if(!l)return{mode:"html",content:""};if("escape"===r.value)return{mode:"html",content:b(l,r.value)};const i=N.value||!0===t.node.loading,a=xn(l,v.value,r.value,i);return a.ok&&(i||a.hasCustomComponents)?{mode:"dynamic",nodes:a.nodes}:i?{mode:"text",content:null!=(o=t.node.raw)?o:l}:{mode:"html",content:b(l,r.value)}}),D=at(),q=lt(),G=rt(),Y=H(null),Q=!!t.node.loading;let ee=null;return"undefined"!=typeof window?(J([()=>g.value,()=>t.node.loading,N],([e,n,o],l,r)=>{if(null==ee||ee.disconnect(),ee=null,!e||!o||!1===n||"undefined"==typeof ResizeObserver)return;const i=new ResizeObserver(e=>{var n,o;if(!N.value||!1===t.node.loading)return;const l=e[0],r=Array.isArray(null==l?void 0:l.borderBoxSize)?l.borderBoxSize[0]:null==l?void 0:l.borderBoxSize,i=null!=(o=null!=(n=null==r?void 0:r.blockSize)?n:null==l?void 0:l.contentRect.height)?o:0;i>M.value&&(M.value=i)});ee=i,i.observe(e),r(()=>i.disconnect())},{immediate:!0}),J(()=>t.node.loading,e=>s(null,null,function*(){!1!==e||!N.value||M.value<=0||(yield oe(),requestAnimationFrame(()=>{!1===t.node.loading&&(M.value=0)}))})),J([()=>g.value,()=>null==q?void 0:q.value.heavyBlockMargin,()=>null==q?void 0:q.value.rootMargin],([e],n,o)=>{var l,r,i,a;if(null==(r=null==(l=Y.value)?void 0:l.destroy)||r.call(l),Y.value=null,!Q)return S.value=!0,void(w.value=t.node.content);if(!e)return void(N.value||(S.value=!1));let u=!0;const s=null!=(a=null!=(i=null==q?void 0:q.value.heavyBlockMargin)?i:null==q?void 0:q.value.rootMargin)?a:ot,c=D(e,{rootMargin:s,allowIdle:!G.value});Y.value=c,S.value=S.value||c.isVisible.value,c.whenVisible.then(()=>{u&&Y.value===c&&(S.value=!0)}),o(()=>{u=!1,c.destroy(),Y.value===c&&(Y.value=null)})},{immediate:!0}),J(()=>t.node.content,e=>{Q&&!S.value||(w.value=e)})):S.value=!0,ne(()=>{var e,n;null==ee||ee.disconnect(),ee=null,null==(n=null==(e=Y.value)?void 0:e.destroy)||n.call(e),Y.value=null}),(n,t)=>(F(),re(ie(j.value?_.value:"div"),ae({ref_key:"htmlRef",ref:g,class:"html-block-node",style:M.value>0?{boxSizing:"border-box",minHeight:`${M.value}px`}:void 0,"data-markstream-viewport-pending":V(G)&&!S.value?"true":void 0},j.value?f.value:void 0),{default:ue(()=>[S.value?(F(),E(X,{key:0},["structured"===W.value.mode?(F(),E(X,{key:0},[null!==T.value?(F(),E(X,{key:0},[K("summary",he(ve(I.value)),z(T.value),17),L.value.length?(F(),re(V(c),ae({key:0},i.value,{nodes:L.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Z("",!0)],64)):(F(),re(V(c),ae({key:1},i.value,{nodes:B.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===W.value.mode?(F(),re(V(p),{key:1,nodes:W.value.nodes},null,8,["nodes"])):"text"===W.value.mode?(F(),E("pre",el,z(W.value.content),1)):(F(),E("div",ae({key:3},d.value,{innerHTML:W.value.content}),null,16,nl))],64)):(F(),E("div",tl,[te(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=K("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=K("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=K("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["style","data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-08559f85"]]);ol.install=e=>{e.component(ol.__name,ol)};const ll={dir:"auto",class:"paragraph-node"},rl=["custom-id"],il=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=Qe(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamFade",void 0),r=R("markstreamParseOptions",void 0),i=R("markstreamCustomMarkdownIt",void 0),s=R("markstreamNestedRendererProps",void 0),c=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=P(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=P(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=P(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=P(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})});function v(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const p=P(()=>n.node.children.filter(e=>!v(e))),g=P(()=>p.value.length>0&&p.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=>!v(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),y=P(()=>new Set(w(m.value))),k=P(()=>{if(!g.value||p.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const o=n.node.children[t];if(!v(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!v(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=P(()=>!1===(null==l?void 0:l.value)&&!t.value.text),N=P(()=>b.value?Io(k.value):null);function S(e,t){return a({node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value},"reference"===e.type?{"data-markstream-reference-id":String(e.id)}:{})}function x(e){var n,o;const l=e,r=String(l.type);if(t.value[r])return null;const i=function(e){if(!Array.isArray(e))return"";const n=[];for(const t of e){if(!t||"object"!=typeof t)return null;const e=x(t);if(null==e)return null;n.push(e)}return n.join("")}(l.children);if(null==i)return null;const a=[r,l.loading,i];switch(r){case"text":return[...a,l.content,l.center].join("");case"inline_code":return[...a,l.code].join("");case"image":return[...a,l.src,l.alt,l.title].join("");case"link":return[...a,l.href,l.title,l.text,JSON.stringify(null!=(n=l.attrs)?n:null)].join("");case"html_inline":case"html_block":return[...a,l.tag,l.content,l.autoClosed,JSON.stringify(null!=(o=l.attrs)?o:null)].join("");case"emoji":return[...a,l.name,l.markup].join("");case"checkbox":case"checkbox_input":return[...a,l.checked].join("");case"math_inline":return[...a,l.content,l.markup].join("");case"reference":case"footnote_anchor":case"footnote_reference":return[...a,l.id].join("");case"hardbreak":case"emphasis":case"strong":case"strikethrough":case"highlight":case"insert":case"subscript":case"superscript":return a.join("");default:return null}}const B=/* @__PURE__ */new Map,_=P(()=>a({inline_code:_n,image:pt,link:ko,hardbreak:Bo,emphasis:Mo,strong:fo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,html_inline:Mn,html_block:ol,emoji:sn,checkbox:an,math_inline:to,checkbox_input:an,reference:ro,footnote_anchor:zo,footnote_reference:fn,text:At},t.value)),O=P(()=>{const e=k.value;if(B.size>e.length)for(const n of B.keys())n>=e.length&&B.delete(n);return e.map((e,o)=>{var l;const r=x(e),i=B.get(o),s=null!=r&&(null==i?void 0:i.sig)===r?i.child:e;null==r?B.delete(o):B.set(o,{child:s,sig:r});const d=function(e){var n,o,l,r;if("html_block"===e.type||"html_inline"===e.type){const t=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||M(e.content);if(t&&!y.value.has(t)&&C(null!=(o=e.content)?o:e.raw,t)){const n=String(null!=(r=null!=(l=e.content)?l:e.raw)?r:"");return{child:{type:"text",content:n,raw:n},component:At,isCustomComponent:!1}}}return{child:e,component:_.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Je(String(e.type)))}}(s);return u(a({},d),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:d.isCustomComponent?kn(d.child,c.value):void 0,hasSlotChildren:Array.isArray(d.child.children)&&d.child.children.length>0,slotContent:String(null!=(l=d.child.content)?l:""),originalChild:s})})});return(e,t)=>(F(),E("p",ll,[null!==N.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(N.value),9,rl)):(F(!0),E(X,{key:1},ce(O.value,e=>{return F(),E(X,{key:e.key},[g.value&&v(e.originalChild)?(F(),E(X,{key:0},[Y(z((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:ue(()=>[e.hasSlotChildren?(F(),re(V(gt),ae({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(V(gt),ae({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(F(),re(ie(e.component),ae({key:2,ref_for:!0},S(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-0498f5d7"]]);il.install=e=>{e.component(il.__name,il)};const al={class:"table-node-wrapper"},ul=["aria-busy"],sl={key:0},cl=["custom-id"],dl=["aria-label","onPointerdown"],fl=["custom-id"],ml={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},hl=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node.loading)&&e}),o=P(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=U(null),r=U([]);let i=null;const a=P(()=>n.node.header.cells.length),u=P(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=P(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);ee("markstreamShowTooltips",P(()=>n.showTooltips)),ee("markstreamFade",P(()=>n.fade));const c=Qe(()=>n.customId),d=P(()=>Boolean(c.value.text)),f=P(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=To(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Io(r):null};return m.set(e,{children:e.children,textFastPath:t,paragraphFastPath:o,info:i}),i}function v(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 p(){i&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),i=null)}return J(a,()=>{p(),r.value=[]}),ne(p),(a,c)=>(F(),E("div",al,[K("table",{ref_key:"tableRef",ref:l,class:W(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),E("colgroup",sl,[(F(!0),E(X,null,ce(e.node.header.cells,(e,n)=>(F(),E("col",{key:n,style:se(s.value[n])},null,4))),128))])):Z("",!0),K("thead",null,[K("tr",null,[(F(!0),E(X,null,ce(e.node.header.cells,(t,o)=>(F(),E("th",{key:o,dir:"auto",class:W(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(h(t).plainText),9,cl)):h(t).simpleChildren?(F(),re(V(_o),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),re(V(ja),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(F(),E("button",{key:3,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",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,dl)):Z("",!0)],2))),128))])]),K("tbody",null,[(F(!0),E(X,null,ce(o.value,(e,t)=>(F(),E("tr",{key:t},[(F(!0),E(X,null,ce(e.cells,(e,o)=>(F(),E("td",{key:o,class:W(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(h(e).plainText),9,fl)):h(e).simpleChildren?(F(),re(V(_o),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),re(V(ja),{key:2,nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[1]||(c[1]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,ul),D(pe,{name:"table-node-fade"},{default:ue(()=>[t.value?(F(),E("div",ml,[te(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=K("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=K("span",{class:"sr-only"},"Loading",-1))],!0)])):Z("",!0)]),_:3})]))}}),[["__scopeId","data-v-cd7fd3ec"]]);hl.install=e=>{e.component(hl.__name,hl)};const vl={class:"hr-node"},pl=/* @__PURE__ */rn({},[["render",function(e,n){return F(),E("hr",vl)}],["__scopeId","data-v-39b2349c"]]);pl.install=e=>{e.component(pl.__name,pl)};const gl={class:"unknown-node"},yl=/* @__PURE__ */$({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),E("div",gl,z(e.node.raw),1))}),kl=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=P(()=>`vmr-container vmr-container-${n.node.name}`),o=Qe(()=>n.customId),l=P(()=>a({text:At,paragraph:il,heading:Uo,inline_code:_n,link:ko,image:pt,strong:fo,emphasis:Mo,strikethrough:ho,insert:No,subscript:so,superscript:ao,checkbox:an,checkbox_input:an,hardbreak:Bo,math_inline:to,reference:ro,list:Qo,math_block:oo,table:hl},o.value));return(o,r)=>(F(),E("div",ae({class:t.value},e.node.attrs),[(F(!0),E(X,null,ce(e.node.children,(t,o)=>{return F(),re(ie((r=t.type,l.value[r]||yl)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`,typewriter:n.typewriter,fade:n.fade,"data-markstream-reference-id":"reference"===t.type?String(t.id):void 0},null,8,["custom-id","node","index-key","typewriter","fade","data-markstream-reference-id"]);var r}),128))],16))}}),[["__scopeId","data-v-672fe0a7"]]);kl.install=e=>{e.component(kl.__name,kl)};const bl=["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"],Nl=[[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 Sl(e){if(e<=255)return bl[e];let n=0,t=Nl.length-1;for(;n<=t;){const o=n+t>>1,l=Nl[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const xl=/[ \t\n\r\f]+/g,wl=/[\t\n\r\f]| {2,}|^ | $/;let Ml=null;const Cl=new RegExp("\\p{Script=Arabic}","u"),Bl=new RegExp("\\p{M}","u"),_l=new RegExp("\\p{Nd}","u");function Ol(e){return Cl.test(e)}function Tl(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>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function Il(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(Tl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Tl(t))return!0}}return!1}const Ll=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]),Al=/* @__PURE__ */new Set(["-","‐","–","—"]);function Hl(e,n){return!(function(e){const n=Ul(e);return null!==n&&Ll.has(n)}(e)||n&&(function(e){const n=Ul(e);return null!==n&&(Rl.has(n)||Fl.has(n))}(e)||function(e){const n=Ul(e);return null!==n&&Al.has(n)}(e)))}const Rl=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Pl=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),$l=/* @__PURE__ */new Set(["'","’"]),Fl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),El=/* @__PURE__ */new Set([":",".","،","؛"]),Kl=/* @__PURE__ */new Set(["၏"]),zl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function jl(e){if(Vl(e))return!0;let n=!1;for(const t of e)if(Fl.has(t)||Gl(t))n=!0;else if(!n||!Bl.test(t))return!1;return n}function Wl(e){for(const n of e)if(!Rl.has(n)&&!Fl.has(n))return!1;return e.length>0}function Dl(e){if(Vl(e))return!0;for(const n of e)if(!(Pl.has(n)||$l.has(n)||Bl.test(n)||Gl(n)))return!1;return e.length>0}function Vl(e){let n=!1;for(const t of e)if("\\"!==t&&!Bl.test(t)){if(!(Pl.has(t)||Fl.has(t)||$l.has(t)))return!1;n=!0}return n}function ql(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 Ul(e){if(0===e.length)return null;const n=ql(e,e.length);return e.slice(n)}const Jl=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Gl(e){const n=e.codePointAt(0);return void 0!==n&&function(e,n){for(let t=0;t<n.length;t+=2)if(e>=n[t]&&e<=n[t+1])return!0;return!1}(n,Jl)}function Xl(e){const n=function(e){for(const n of e)if(!Bl.test(n))return n;return null}(e);return null!==n&&_l.test(n)}function Yl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Bl.test(e))t--;else{if(!Pl.has(e)&&!$l.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Zl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ql(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 er(e,n){return e&&null!==n&&El.has(n)}function nr(e){const n=Ul(e);return null!==n&&Kl.has(n)}function tr(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 or(e){let n=e.length;for(;n>0;){const t=ql(e,n),o=e.slice(t,n);if(zl.has(o))return!0;if(!Fl.has(o))return!1;n=t}return!1}function lr(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 rr=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function ir(e){return 1===e.length?e[0]:e.join("")}function ar(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),ir(t)}function ur(e,n,t,o){if(!rr.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,u=!1,s=0;for(const c of e){const e=lr(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:ir(i),isWordLike:u,kind:r,start:a}),r=e,i=[c],a=t+s,u=d,s+=c.length):(i.push(c),s+=c.length)}return null!==r&&l.push({text:ir(i),isWordLike:u,kind:r,start:a}),l}function sr(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const cr=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function dr(e,n){const t=e.texts[n];return!!t.startsWith("www.")||cr.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function fr(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const mr=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),hr=/[\p{P}\p{S}\p{Co}]/u,vr=new RegExp("\\p{Emoji_Presentation}","u"),pr=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function gr(e){const n=e.charCodeAt(0);return n<128?function(e){return e>=33&&e<=47&&45!==e||e>=58&&e<=64&&63!==e||e>=91&&e<=96||e>=123&&e<=126}(n):!pr.has(e)&&!vr.test(e)&&hr.test(e)}function yr(e){let n=!1;for(const t of e)if(!Bl.test(t)){if(!gr(t))return!1;n=!0}return n}function kr(e,n,t,o){const l=!n&&yr(e),r=!o&&yr(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=ql(e,n),o=e.slice(t,n);if(!Bl.test(o))return o;n=t}return null}(e);return null!==n&&Gl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=ql(e,n),o=e.slice(t,n);if(!Bl.test(o))return gr(o)||Gl(o);n=t}return!1}(e);return!!(l||r||a)&&!Il(e)&&!Il(t)&&(n||l||i)&&(o||r)}function br(e){for(const n of e)if(_l.test(n))return!0;return!1}function Nr(e){if(0===e.length)return!1;for(const n of e)if(!_l.test(n)&&!mr.has(n))return!1;return!0}function Sr(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}function xr(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}(e):function(e){if(!wl.test(e))return e;let n=e.replace(xl," ");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=function(e,n,t){var o,l,r;const i=(null===Ml&&(Ml=new Intl.Segmenter(void 0,{granularity:"word"})),Ml);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const w of i.segment(e))for(const e of ur(w.segment,null!=(o=w.isWordLike)&&o,w.index,t)){let t=function(){null!==m[w]&&(s[w]=[Ql(u,m,h,w)],m[w]=null),s[w].push(e.text),c[w]=c[w]||e.isWordLike,v[w]=v[w]||i,p[w]=p[w]||b,g[w]=S,y[w]=x,k[w]=er(p[w],N)};const o="text"===e.kind,r=Zl(e.text,e.isWordLike,e.kind),i=Il(e.text),b=Ol(e.text),N=Ul(e.text),S=or(e.text),x=nr(e.text),w=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[w]&&i&&v[w]&&g[w]||o&&a>0&&"text"===d[w]&&Wl(e.text)&&v[w]||o&&a>0&&"text"===d[w]&&y[w]?t():o&&a>0&&"text"===d[w]&&e.isWordLike&&b&&k[w]?(t(),c[w]=!0):null!==r&&a>0&&"text"===d[w]&&m[w]===r?h[w]=(null!=(l=h[w])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[w]&&!v[w]&&(jl(e.text)||"-"===e.text&&c[w])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=b,g[a]=S,y[a]=x,k[a]=er(b,N),a++)}for(let w=0;w<a;w++)null===m[w]?u[w]=ir(s[w]):u[w]=Ql(u,m,h,w);for(let w=1;w<a;w++)"text"!==d[w]||c[w]||!Vl(u[w])||"text"!==d[w-1]||v[w-1]||(u[w-1]+=u[w],c[w-1]=c[w-1]||c[w],u[w]="");const b=Array.from({length:a},()=>null);let N=-1;for(let w=a-1;w>=0;w--){const e=u[w];if(0!==e.length){if("text"===d[w]&&!c[w]&&N>=0&&"text"===d[N]&&(Dl(e)||"-"===e&&Xl(u[N]))){const n=null!=(r=b[N])?r:[];n.push(e),b[N]=n,f[N]=f[w],u[w]="";continue}N=w}}for(let w=0;w<a;w++){const e=b[w];null!=e&&(u[w]=ar(e,u[w]))}let S=0;for(let w=0;w<a;w++){const e=u[w];0!==e.length&&(S!==w&&(u[S]=e,c[S]=c[w],d[S]=d[w],f[S]=f[w]),S++)}u.length=S,c.length=S,d.length=S,f.length=S;const x=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(!Il(n[r])||!Il(n[r+1]))continue;const e=Yl(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=[];let r=0;for(;r<e.len;){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a){const a=[i];let s=r+1,c=u;for(;s<e.len&&"text"===e.kinds[s]&&kr(e.texts[s-1],e.isWordLike[s-1],e.texts[s],e.isWordLike[s]);){const n=e.texts[s];a.push(n),c=c||e.isWordLike[s],s++}if(s>r+1){n.push(ir(a)),t.push(c),o.push("text"),l.push(e.starts[r]),r=s;continue}}n.push(i),t.push(u),o.push(a),l.push(e.starts[r]),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 u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&br(n)&&Nr(n)||(u=!1)}if(u){let i=0;for(let u=0;u<a.length;u++){const s=a[u],c=u<a.length-1?`${s}-`:s;n.push(c),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=c.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&&Nr(i)&&br(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&Nr(e.texts[u]);)a.push(e.texts[u]),u++;n.push(ir(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-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]),!fr(i))continue;const a=r+1;if(a>=e.len||sr(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!sr(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(ir(u)),t.push(!0),o.push("text"),l.push(s),r=c-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]||!dr(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!sr(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]=ir(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],u=e.kinds[r],s=e.starts[r];if("glue"===u){const c=[i[0]],d=s;for(r++;r<e.len&&"glue"===e.kinds[r];)c.push(e.texts[r]),r++;const f=ir(c);if(!(r<e.len&&"text"===e.kinds[r])){n.push(f),t.push(!1),o.push("glue"),l.push(d);continue}i[0]=f,i.push(e.texts[r]),a=e.isWordLike[r],u="text",s=d,r++}else r++;if("text"===u)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=ir(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(ir(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:S,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let w=0;w<x.len-1;w++){const e=tr(x.texts[w]);null!==e&&("space"!==x.kinds[w]&&"preserved-space"!==x.kinds[w]||"text"!==x.kinds[w+1]||!Ol(x.texts[w+1])||(x.texts[w]=e.space,x.isWordLike[w]=!1,x.kinds[w]="preserved-space"===x.kinds[w]?"preserved-space":"space",x.texts[w+1]=e.marks+x.texts[w+1],x.starts[w+1]=x.starts[w]+e.space.length))}return x}(r,n,l),u="keep-all"===o?function(e,n,t){if(n.len<=1)return n;const o=[],l=[],r=[],i=[];let a=-1,u=!1;function s(e){o.push(n.texts[e]),l.push(n.isWordLike[e]),r.push("text"),i.push(n.starts[e])}function c(t){if(!(a<0)){if(u)a+1===t?s(a):function(t,a){let u=!1;for(let e=t;e<a;e++)u=u||n.isWordLike[e];const s=n.starts[t],c=a<n.len?n.starts[a]:e.length;o.push(e.slice(s,c)),l.push(u),r.push("text"),i.push(s)}(a,t);else for(let e=a;e<t;e++)s(e);a=-1,u=!1}}for(let d=0;d<n.len;d++){const e=n.texts[d],s=n.kinds[d];"text"!==s?(c(d),o.push(e),l.push(n.isWordLike[d]),r.push(s),i.push(n.starts[d])):(a>=0&&!Hl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||Il(e))}return c(n.len),{len:o.length,texts:o,isWordLike:l,kinds:r,starts:i}}(r,i,n.breakKeepAllAfterPunctuation):i;return a({normalized:r,chunks:Sr(u,l)},u)}let wr=null;const Mr=/* @__PURE__ */new Map;let Cr=null;const Br=new RegExp("\\p{Emoji_Presentation}","u"),_r=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Or=null;const Tr=/* @__PURE__ */new Map;function Ir(){if(null!==wr)return wr;if("undefined"!=typeof OffscreenCanvas)return wr=new OffscreenCanvas(1,1).getContext("2d"),wr;if("undefined"!=typeof document)return wr=document.createElement("canvas").getContext("2d"),wr;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Lr(e,n){let t=n.get(e);return void 0===t&&(t={width:Ir().measureText(e).width,containsCJK:Il(e)},n.set(e,t)),t}function Ar(){if(null!==Cr)return Cr;if("undefined"==typeof navigator)return Cr={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Cr;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 Cr={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Cr}function Hr(){return null===Or&&(Or=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Or}function Rr(e){return Br.test(e)||e.includes("️")}function Pr(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=Hr();for(const o of t.segment(e))Rr(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function $r(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function Fr(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Er(e,n,t=e.widths.length){for(;n<t&&$r(e.kinds[n]);)n++;return n}function Kr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function zr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function jr(e,n){return 0===n?0:e+n}function Wr(e,n,t,o,l){return jr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function Dr(e,n,t,o){return jr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function Vr(e,n,t,o,l){return jr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function qr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function Ur(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function Jr(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Gr(e,n){return function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r}=e;if(0===t.length)return 0;const i=n+Ar().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){var t;const o=l[e],a=null!=(t=r[e])?t:null;let f=null===a?-1:Jr(a,0,n+1),m=-1,v=0,g=n;for(;g<o.length;){const t=o[g];if(s)if(u+t>i){if(null!==a&&m>n){h(e,m,v),g=m,f=Jr(a,f,g+1),m=-1,v=0;continue}h(),p(e,g,t)}else u+=t,c=e,d=g+1;else p(e,g,t);const l=g+1;null!==a&&a[f]===l&&(m=l,v=u,f++),g++}s&&c===e&&d===o.length&&(c=e+1,d=0)}let k=0;for(;k<t.length&&(s||(k=Er(e,k),!(k>=t.length)));){const e=t[k],n=Fr(o[k]);if(s)if(u+e>i){if(n){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>i&&null!==l[k]){h(),y(k,0),k++;continue}h()}else g(k,e),n&&(f=k+1,m=u-e),k++;else e>i&&null!==l[k]?y(k,0):v(k,e),n&&(f=k+1,m=u-e),k++}return s&&h(),a}(e,n);const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r,discretionaryHyphenWidth:i,chunks:a}=e;if(0===t.length||0===a.length)return 0;const u=Ar(),s=n+u.lineFitEpsilon;let c=0,d=0,f=!1,m=0,h=0,v=-1,p=0,g=0,y=null;function k(){v=-1,p=0,g=0,y=null}function b(e=m,n=h,t){c++,d=0,f=!1,k()}function N(e,n){f=!0,m=e+1,h=0,d=n}function S(e,n,t){f=!0,m=e,h=n+1,d=t}function x(e,n){f?(d+=n,m=e+1,h=0):N(e,n)}function w(n,t,o,l,r,i){if(!t)return;const a=Dr(e,n,o,r),u=Vr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function M(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:Jr(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=qr(e,!0,o),r=d+l;if(Ur(e,r)>s){if(null!==a&&c>t){b(n,c),v=c,u=Jr(a,u,v+1),c=-1;continue}b(),S(n,v,o)}else d=r,m=n,h=v+1}else S(n,v,o);const l=v+1;null!==a&&a[u]===l&&(c=l,u++),v++}f&&m===n&&h===i.length&&(m=n+1,h=0)}function C(e){c++,k()}for(let B=0;B<a.length;B++){const n=a[B];if(n.startSegmentIndex===n.endSegmentIndex){C();continue}f=!1,d=0,n.startSegmentIndex,m=n.startSegmentIndex,h=0,k();let r=n.startSegmentIndex;for(;r<n.endSegmentIndex&&(f||(r=Er(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=Fr(n),c=zr(e,f,r),k="tab"===n?Kr(d+c,e.tabStopAdvance):t[r],S=c+k,C=Wr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+Dr(e,n,r,c);if(Vr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){b(v,0);continue}if(a&&t<=s){x(r,S),b(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){b();continue}const e=v;b(e,0),r=e;continue}if(C>s&&null!==l[r]){b(),M(r,0),r++;continue}b();continue}x(r,S),w(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?M(r,0):N(r,k),w(n,a,r,k,c,S),r++;else f&&(m=r+1,h=0,v=r+1,p=d+i,g=d+i,y=n),r++}f&&(n.consumedEndSegmentIndex,b(n.consumedEndSegmentIndex,0))}return c}(e,n)}let Xr=null;function Yr(){return null===Xr&&(Xr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Xr}function Zr(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function u(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function s(e,n,t){o=[e],l=n,r=t,i=or(e),a=Pl.has(e)}function c(e,n){o.push(e),r=r||n;const t=or(e);i=1===e.length&&Fl.has(e)&&i||t,a=!1}for(const d of Yr().segment(e)){const e=d.segment,t=Il(e);0!==o.length?a||Rl.has(e)||Fl.has(e)||n.carryCJKAfterClosingQuote&&t&&i?c(e,t):r||t?(u(),s(e,d.index,t)):c(e,t):s(e,d.index,t)}return u(),t}function Qr(e,n,t){if(n.length<=1)return n;const o=[];let l=-1,r=!1;function i(t){if(!(l<0)){if(r)l+1===t?o.push(n[l]):function(t,l){const r=n[t].start,i=l<n.length?n[l].start:e.length;o.push({text:e.slice(r,i),start:r})}(l,t);else for(let e=l;e<t;e++)o.push(n[e]);l=-1,r=!1}}for(let a=0;a<n.length;a++){const e=n[a];l>=0&&!Hl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||Il(e.text)}return i(n.length),o}function ei(e,n){if("zero-width-break"===n||"soft-hyphen"===n||"hard-break"===n)return 0;if("tab"===n)return 1;let t=0;const o=Yr();for(const l of o.segment(e))t++;return t}function ni(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function ti(e,n,t,o,l){const r=Ar(),{cache:i,emojiCorrection:a}=function(e,n){Ir().font=e;const t=function(e){let n=Mr.get(e);return n||(n=/* @__PURE__ */new Map,Mr.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=Tr.get(e);if(void 0!==t)return t;const o=Ir();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 Tr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,_r.test(u)));var u;const s=Pr("-",Lr("-",i),a)+(0===l?0:2*l),c=8*Pr(" ",Lr(" ",i),a),d=0!==l;if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],m=[],h=[],v=[];let p=e.chunks.length<=1&&!d;const g=t?[]:null,y=[],k=[],b=[],N=t?[]:null,S=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a,u){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(p=!1),f.push(n),m.push(t),h.push(o),v.push(l),null==g||g.push(r),y.push(i),k.push(a),d&&b.push(u),null!==N&&N.push(e)}function w(e,n,t,u,s){const c=Lr(e,i),f=d?ei(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(Pr(e,c,a),f,l),h="space"===n||"preserved-space"===n||"zero-width-break"===n?0:m,v=0===h?0:h+(f>0?l:0),p="space"===n||"zero-width-break"===n?0:m;if(s&&u&&e.length>1){let u="sum-graphemes";0!==l?u="segment-prefixes":Nr(e)?u="pair-context":r.preferPrefixWidthsForBreakableRuns&&(u="segment-prefixes");const s=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances&&n.breakableFitMode===l)return n.breakableFitAdvances;n.breakableFitMode=l;const r=Hr(),i=[];for(const c of r.segment(e))i.push(c.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=Lr(n,t);e.push(Pr(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=Pr(n,Lr(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Lr(i,t);e.push(Pr(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let u="",s=0;for(const c of i){u+=c;const e=Pr(u,Lr(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,c,i,a,u),d=null===s||"keep-all"===o?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const n=[];let t=0;for(const o of Yr().segment(e))t++,ni(o.segment)&&n.push(t);return 0===n.length?null:n}(e);return void x(e,m,v,p,n,t,s,d,f)}x(e,m,v,p,n,t,null,null,f)}for(let B=0;B<e.len;B++){S[B]=f.length;const n=e.texts[B],t=e.isWordLike[B],l=e.kinds[B],a=e.starts[B];if("soft-hyphen"===l){x(n,0,s,s,l,a,null,null,0);continue}if("hard-break"===l){x(n,0,0,0,l,a,null,null,0);continue}if("tab"===l){x(n,0,0,0,l,a,null,null,d?ei(n,l):0);continue}const u=Lr(n,i);if("text"===l&&u.containsCJK){const e=Zr(n,r),l="keep-all"===o?Qr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];w(e.text,"text",a+e.start,t,"keep-all"===o||!Il(e.text))}continue}w(n,l,a,t,!0)}const M=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,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,S,f.length),C=null===g?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 s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=Sl(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=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,g);return null!==N?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:b,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M,segments:N}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:b,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M}}const oi="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",li=["diff ","index ","--- ","+++ ","@@ "],ri=(()=>{const e=globalThis;if(e[oi])return e[oi];const n={configs:{},controllers:{},revision:H(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[oi]=n,n})();let ii=null;const ai=ri.revision;function ui(e){var n;return e&&null!=(n=ri.configs[e])?n:null}function si(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function ci(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function di(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!ci(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 fi(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=ii)return ii;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return ii=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),ii}catch(n){return ii=!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=ri.blockEstimateCache.get(i);if(a)return ri.blockEstimateCache.delete(i),ri.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const u=null!=(l=t.whiteSpace)?l:"pre-wrap",s=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=ri.preparedCache.get(o);if(l)return ri.preparedCache.delete(o),ri.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){var l,r;const i=null!=(l=null==o?void 0:o.wordBreak)?l:"normal",a=null!=(r=null==o?void 0:o.letterSpacing)?r:0;return ti(xr(e,Ar(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(ri.preparedCache.set(o,{prepared:r});ri.preparedCache.size>240;){const e=ri.preparedCache.keys().next().value;if(!e)break;ri.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Gr(e,n);return{lineCount:o,height:o*t}}(s,Math.max(24,r-t.widthAdjustment),t.lineHeight),d=Math.max(t.lineHeight,c.height),f=Math.max(t.lineHeight,Math.round(d+t.wrapperOverhead));for(ri.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});ri.blockEstimateCache.size>4e3;){const e=ri.blockEstimateCache.keys().next().value;if(!e)break;ri.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function mi(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=di(e.children);return o&&t.paragraph?fi(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=di(e.children),r=t.headings[o];return l&&r?fi(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=di(null==(l=r[0])?void 0:l.children);return i?fi(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=mi(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 hi(e){if(!e)return 1;const n=String(e).split(/\r\n|\n|\r/);return Math.max(1,n.length)}function vi(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function pi(e,n){return e.diff?Rt({diffStyle:n})?function(e){const n=vi(e.raw);if(n){const t=n.split(/\r?\n/);return null!=e.originalCode||null!=e.updatedCode?Math.max(1,t.filter(e=>!li.some(n=>e.startsWith(n))).length):Math.max(1,t.length)}return hi(vi(e.originalCode))+hi(vi(e.updatedCode))}(e):function(e){const n=e.originalCode,t=e.updatedCode;if(null!=n||null!=t)return Math.max(hi(vi(n)),hi(vi(t)));const o=vi(e.code).split(/\r?\n/);let l=0,r=0;for(const i of o)i.startsWith("+")&&!i.startsWith("+++")?r++:i.startsWith("-")&&!i.startsWith("---")?l++:(l++,r++);return Math.max(1,l,r)}(e):hi(vi(e.code,!0===e.loading))}function gi(e,n,t){return Math.max(1,Math.ceil(function(e,n){let t=0;for(const o of e)t+="\t"===o?n-t%n:o>="ᄀ"?2:1;return t}(e,t)/n))}function yi(e,n,t,o,l,r){var i,a,u;const s=e/(r?2:1),c=null==(null==(i=l.codeBlockOptions)?void 0:i.padding)?n:o.padding,d=null!=(u=l.showLineNumbers)?u:!0!==(null==(a=l.codeBlockOptions)?void 0:a.disableLineNumbers),f=Math.max(2,String(Math.max(1,t)).length)*n,m=d?3*n+f+2:0;return Math.max(1,Math.floor((s-m-2*c)/n))}function ki(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function bi(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=si(o.lineHeight,1.5*si(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:ki(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const Ni=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function Si(e,n={}){var t;const o={},l=new Set(null!=(t=n.omit)?t:[]);if(!e||"object"!=typeof e)return o;const r=Object.getOwnPropertyDescriptors(e);for(const[i,a]of Object.entries(r))Ni.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}function xi(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Ie(t),_e(t),"d2lang"===t?"d2":""]){const n=o&&e[o];if(n)return n}}const wi=!1;function Mi(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function Ci(e,n){let t=0,o=null,l=null;const r=()=>{const n=l;l=null,o=null,n&&(t=Date.now(),e(...n))};return function(...i){const a=Date.now(),u=n-(a-t);l=i,u<=0?(o&&(clearTimeout(o),o=null),t=a,l=null,e(...i)):o||(o=setTimeout(r,u))}}function Bi(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}function _i(e){return"off"!==Bi(e)}const Oi=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Ti(){return R(Oi,null)}const Ii=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),Li=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function Ai(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Hi(e,n,t,o=22){const l=String(null!=e?e:"");if(!l)return t;const r=Math.max(18,Math.floor(Math.max(320,n)/8)),i=l.split(/\r?\n/).length,a=Math.ceil(l.length/r),u=Math.max(1,i,a);return Math.max(t,Math.ceil(u*o+12))}function Ri(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(Ii.has(o))return!0;if(!Li.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(Ri)}function Pi(e){var n,t,o,l,r,i,a,u;if(!e||"object"!=typeof e)return"";const s=e,c=String(null!=(n=s.type)?n:"");if("text"===c)return String(null!=(o=null!=(t=s.content)?t:s.raw)?o:"");if("inline_code"===c)return String(null!=(i=null!=(r=null!=(l=s.code)?l:s.content)?r:s.raw)?i:"");if("emoji"===c)return String(null!=(u=null!=(a=s.name)?a:s.raw)?u:"");if("string"==typeof s.text)return s.text;const d=[];for(const f of["children","items","cells","rows"]){const e=s[f];if(Array.isArray(e)){const n=e.map(Pi).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function $i(e){if(!e||"object"!=typeof e)return!1;const n=e;return"inline_code"===n.type||["children","items","cells","rows"].some(e=>{const t=n[e];return Array.isArray(t)&&t.some($i)})}function Fi(e,n){if(!e)return 30;const t=Math.max(18,Math.floor(Math.max(320,n)/8)),o=e.split(/\r?\n/).length,l=Math.ceil(e.length/t),r=Math.max(1,o,l);return 30+26*Math.max(0,r-1)}function Ei(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h,v;if(!e||"object"!=typeof e)return 32;const p=e,g=String(null!=(t=p.type)?t:""),y=Number.isFinite(n)&&n>0?n:640;switch(g){case"heading":return function(e){var n;const t=Number(null!=(n=e.level)?n:e.depth);return t>=4?20:3===t?30:2===t?32:44}(p);case"paragraph":return function(e,n){const t=String(null!=e?e:"");if(!t)return 28;const o=Math.max(18,Math.floor(Math.max(320,n)/8)),l=t.split(/\r?\n/).length,r=Math.ceil(t.length/o);return Math.max(1,l,r)<=1?28:Hi(t,n,34)}(String(null!=(l=null!=(o=p.raw)?o:p.content)?l:""),y);case"list":return function(e,n){var t;const o=Array.isArray(e.items)?e.items:[];if(!o.length)return 48;const l=Math.max(48,30*o.length+12);let r=12;for(const u of o)r+=Fi(Pi(u)||String(null!=(t=u.raw)?t:""),n);const i=Math.max(0,r-l);if(o.length>20){const e=Math.round(2.4*o.length);return Math.round(l+Math.max(e,Math.min(i,3*o.length)))}if(i<=0)return l;const a=o.length>8?8*o.length:i;return Math.round(l+Math.min(i,a))}(p,y);case"list_item":return Hi(String(null!=(i=null!=(r=p.raw)?r:p.content)?i:""),y,34);case"blockquote":return Hi(String(null!=(u=null!=(a=p.raw)?a:p.content)?u:""),y,56);case"table":return function(e,n){const t=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!t.length){const n=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*n+48)}return Math.max(120,Math.round(4+t.reduce((e,t)=>e+function(e,n){const t=Math.max(1,e.length),o=Math.max(80,(n-32)/t),l=Math.max(10,Math.floor(o/8)),r=Math.max(1,...e.map(e=>{var n;const t=Pi(e)||String(null!=(n=null==e?void 0:e.raw)?n:"");return Math.ceil(t.length/l)||1}));return 54+34*Math.max(0,r-1)+(t<=3&&e.some($i)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(p,y);case"code_block":{const e=String(null!=(s=p.language)?s:"").trim().toLowerCase(),n=String(null!=(d=null!=(c=p.code)?c:p.raw)?d:"");return"mermaid"===e?$e(Fe(n)):"infographic"===e?Ee(Ke(n)):Hi(n,y,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return function(e,n){var t,o,l;const r=e.match(/^\s*<details\b([^>]*)>/i);return r&&!/(?:^|\s)open(?:\s|=|$)/i.test(null!=(t=r[1])?t:"")?Hi((null==(l=null==(o=e.match(/<summary\b[^>]*>([\s\S]*?)<\/summary>/i))?void 0:o[1])?void 0:l.replace(/<[^>]*>/g,"").trim())||"Details",n,28,28):Hi(e,n,96)}(String(null!=(m=null!=(f=p.raw)?f:p.content)?m:""),y);case"thematic_break":return 24;default:return Hi(String(null!=(v=null!=(h=p.raw)?h:p.content)?v:""),y,40)}}function Ki(e,n,t){return Math.min(Math.max(e,n),t)}const zi=/* @__PURE__ */new WeakMap;function ji(e,n,t){var o;const l=e;if(t.has(l))return t.get(l);const r=String(e.type).trim().toLowerCase();if(n[r])return t.set(l,!0),!0;if("code_block"===r){const r=String(null!=(o=e.language)?o:"").trim().toLowerCase();if(r&&xi(n,r))return t.set(l,!0),!0}const i=e;t.set(l,!1);const a=Object.values(i).some(e=>Array.isArray(e)?e.some(e=>la(e)&&ji(e,n,t)):la(e)&&ji(e,n,t));return t.set(l,a),a}const Wi=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Di=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","safeMarkdownMs","tokenizeMs","htmlBlockPassesMs","parseMarkdownToStructureTotalMs"],Vi=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),qi=["raw","content","code","originalCode","updatedCode"],Ui=/* @__PURE__ */new WeakMap,Ji=/* @__PURE__ */new WeakMap;let Gi=1;function Xi(){return"undefined"!=typeof performance?performance.now():Date.now()}function Yi(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function Zi(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=Ui.get(n);return t||(t=Gi++,Ui.set(n,t)),String(t)}function Qi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:Zi(n),customMarkdownIt:Zi(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:Zi(e.validateLink),preTransformTokens:Zi(e.preTransformTokens),postTransformTokens:Zi(e.postTransformTokens),postTransformNodes:Zi(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function ea(e){let n=e.length;for(;n>0&&10===e.charCodeAt(n-1);)n-=1;const t=e.lastIndexOf("\n",n-1)+1;return e.slice(t,n).trim()}function na(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function ta(e){const n=String(null!=e?e:"");return`${n.length}:${na(n)}`}function oa(e,n=/* @__PURE__ */new WeakMap,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){return e.length<=8192?ta(e):`${e.length}:${na(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${Zi(e)}`;if("object"!=typeof e)return typeof e;const o=e,l=n.get(o);if(l)return`cycle:${l}`;if(t>=6)return`object:${Zi(o)}`;const r=Zi(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>oa(e,n,t+1)).join(",")}`}if("object"==typeof e){const o=e,l=Object.keys(o).sort(),r=l.slice(0,80);return`o:${l.length}:${r.map(e=>`${e}:${oa(o[e],n,t+1)}`).join(";")}`}return typeof e}function la(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function ra(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>la(e)?ua(e,n,t+1):ra(e,n,t+1)).join(",")}`:la(e)?ua(e,n,t):oa(e,n,t)}function ia(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!qi.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${ta(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${Zi(l)}`:Vi.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${ra(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${Zi(l)}`:""}).filter(Boolean).join(";")}function aa(e){return qi.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${ta(t)}`:""}).filter(Boolean).join(";")}function ua(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Ji.get(e);if(o)return o;const l=e,r=n.get(l);if(r)return`node-cycle:${r}`;if(t>=6)return`node:${e.type}:${Zi(l)}`;const i=Zi(l);n.set(l,i);const a=function(e,n,t){const o=e,l=Array.isArray(o.children)?o.children:[],r=l.length?l.slice(0,200).map(e=>ua(e,n,t+1)).join("|"):"";return[e.type,aa(o),ia(o,n,t),l.length,r].join(":")}(e,n,t);return Ji.set(l,a),a}function sa(e,n){return ua(e)===ua(n)}function ca(e,n,t){const o=Xi(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Xi()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function da(e,n,t){return ca(n,t,()=>ua(e))}function fa(e,n,t){return da(e,t,"stabilizeSignatureMs")===da(n,t,"stabilizeSignatureMs")}function ma(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ha(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function va(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e)}function pa(e,n){return e.length===n.length&&e===n}function ga(e,n,t=0){if(t>=4)return null;if(e.type!==n.type)return!1;const o=e,l=n,r=Object.keys(o).filter(e=>"type"!==e&&"children"!==e).sort(),i=Object.keys(l).filter(e=>"type"!==e&&"children"!==e).sort();if(r.length!==i.length)return!1;for(let c=0;c<r.length;c++){const e=r[c];if(e!==i[c])return!1;const n=o[e],t=l[e];if(typeof n!=typeof t)return!1;if("string"!=typeof n){if("number"!=typeof n&&"boolean"!=typeof n&&null!=n)return null;if(!Object.is(n,t))return!1}else{if("string"!=typeof t)return!1;if(!pa(n,t))return!1}}const a=Object.prototype.hasOwnProperty.call(o,"children");if(a!==Object.prototype.hasOwnProperty.call(l,"children"))return!1;if(!a)return!0;const u=o.children,s=l.children;if(!Array.isArray(u)||!Array.isArray(s))return null;if(u.length!==s.length)return!1;for(let c=0;c<u.length;c++){const e=u[c],n=s[c];if(!la(e)||!la(n))return null;const o=ga(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function ya(e,n,t=0){if(e===n||e.type!==n.type||t>=6)return;const o=e,l=n;for(const r of["children","items","rows","cells"]){const e=o[r],n=l[r];if(!Array.isArray(e)||!Array.isArray(n))continue;const i=Math.min(e.length,n.length);for(let o=0;o<i;o++){const l=e[o],r=n[o];l!==r&&la(l)&&la(r)&&(!0===ga(l,r)?n[o]=l:ya(l,r,t+1))}}}function ka(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=ga(e,n);return null!=t?t:sa(e,n)}function ba(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return ca(t,"stabilizeSignatureMs",()=>{o=ga(e,n)}),null!=o?o:fa(e,n,t)}function Na(e,n){const t={};for(const o of Wi){const l=e[o],r=null==n?void 0:n[o];"number"==typeof l&&(t[o]=l-("number"==typeof r?r:0))}return t}function Sa(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:P(()=>!1),i=U(n.renderContent.value);let s=[],d="",f="",m="",h=!1,v="",p=/* @__PURE__ */new WeakMap;const y=function(){let e="",n=0,t=!1,o=!1,l=!1,r=!1;function i(){e="",n=0,t=!1,o=!1,l=!1,r=!1}function a(e){let i=!1;for(let a=0;a<e.length;a++){const u=e.charCodeAt(a);if(10===u||13===u){const e=10===u&&r;r=13===u,t=!1,e||(l||(o=!1,n=0),l=!1);continue}r=!1;const s=9===u||32===u;if(s||(l=!0,o&&(i=!0)),n)if(1!==n)s||(58!==u?n=91===u?1:0:(i=!0,o=!0));else{if(t){t=!1;continue}if(92===u){t=!0;continue}93===u&&(n=2)}else 91===u&&(n=1)}return i}return(n,t)=>{if(!n||!t.startsWith(n)||t.length<=n.length)return i(),[!0,0];let o=0;e!==n&&(i(),a(n),o=n.length);const l=t.slice(n.length),r=a(l);return e=t,[r,o+l.length]}}();let k,b=0,N=0,S=Xi(),x=-1,w=0;function M(e){x=Number.isInteger(e)?e:0,w+=1}function C(){k&&(clearTimeout(k),k=void 0)}function L(){C();const e=n.renderContent.value;i.value!==e&&(i.value=e),S=Xi()}J([n.renderContent,n.effectiveFinal,r],([n,t,o])=>{i.value!==n&&(!o||t||function(e,n){if(!e&&n)return!0;if(n.length<=80)return!0;if(n.length<e.length||!n.startsWith(e))return!0;const t=n.slice(e.length);return!(!t||!function(e){const n=function(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}(ea(n))&&(o=n,l=ea(o),!(/^={3,}$/.test(l)||/^-{3,}$/.test(l)||t.includes("\n\n")||/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))));var o,l}(i.value,n)?L():function(){if(N+=1,k)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(Xi()-S));n<=0?L():k=setTimeout(L,n)}())},{flush:"sync",immediate:!0}),G(C);const A=P(()=>{var t,o,l,r;return _(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||Je(t)||I.has(t)||g.has(t)?"":t}).filter(Boolean)))}),H=P(()=>{const{key:e,tags:t}=O(A.value);if(!e)return o;const r=l.get(e);if(r)return r;const i=B(n.instanceMsgId,{customHtmlTags:t});return l.set(e,i),i}),R=P(()=>{const n=H.value;if(!e.customMarkdownIt)return n;const t=e.customMarkdownIt(n);return n.__markstreamHasCustomParserExtensions=!0,t.__markstreamHasCustomParserExtensions=!0,t}),$=P(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=A.value,s=null!=r,c=i.length>0;return s||c||null==l.streamParse?a(a(u(a({},l),{streamParse:null==(o=l.streamParse)||o}),s?{final:r}:{}),c?{customHtmlTags:i}:{}):l}),F=P(()=>{var e;return new Set((null!=(e=$.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),E=P(()=>Qi($.value,R.value,e.customMarkdownIt,{includeFinal:!0})),K=P(()=>Qi($.value,R.value,e.customMarkdownIt,{includeFinal:!1}));J([E,K],([e,n],[t,o])=>{t&&(e===t&&n===o||(L(),n!==o&&(s=[],m="")))},{flush:"sync"});const z=P(()=>{var t,o,l,r,c,g,k,S,w,C,B;if(null==(t=e.nodes)?void 0:t.length)return s=[],m="",M(0),me(e.nodes.slice());const _=i.value;if(!_)return s=[],m="",M(-1),[];const O=n.debugPerformanceEnabled.value,I=O?Xi():0,L=R.value,A=E.value,H=K.value;d&&A!==d&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(L),f&&H!==f&&(s=[],m="");const P=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},F=function(e){const n=e,t=zi.get(n);if(void 0!==t)return t;const o=function(e){return JSON.stringify(Object.entries(e).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,Zi(n)]))}(e);return zi.set(n,o),o}(P);v&&F!==v&&(s=[],m="",p=/* @__PURE__ */new WeakMap);const z=Object.keys(P).length>0,j="function"==typeof $.value.postTransformNodes;j!==h&&(s=[],m="");const W=!j&&s.length>0&&_.startsWith(m)&&H===f,D=O?Yi(L):null,V=O?{}:void 0,q=va(L),U=z&&s.some(e=>ji(e,P,p)),J=!q&&!j&&(!z||s.length>0&&!U),G=a(u(a({},$.value),{reuseStableTopLevelNodes:J}),V?{parserMetrics:V}:{}),X=T(_,L,G),Y=O?Xi():0;if(W&&!q&&!z&&!$.value.preTransformTokens&&!$.value.postTransformTokens){const e=Math.min(s.length,X.length);for(let n=0;n<e;n++)ya(s[n],X[n])}const Z=O?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let Q,ee=O?ma(X.length):void 0,ne=0,te=0,oe=0;if(W){const n=O?Xi():0,[t,o]=z?[0,0]:function(e){var n,t;const[o,l]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!va(e.md)&&!o&&"function"!=typeof r.preTransformTokens&&"function"!=typeof r.postTransformTokens&&"function"!=typeof r.postTransformNodes&&0===(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)?e.previousDirtyStartIndex:0,l]}({content:_,previousContent:m,previousDirtyStartIndex:x,parseOptions:$.value,customMarkdownIt:e.customMarkdownIt,md:L,scanGlobalReferenceAppend:y});oe=o;const l=t<=0,r=z?e=>!ji(e,P,p):void 0;if(Z){const e=function(e,n,t,o={}){if(!n.length)return{nodes:e,metrics:ma(e.length)};const l=!1!==o.reuseDirtyTail,r=function(e,n,t,o){var l;const r=Math.min(e.length,n.length);for(let i=Math.min(r,Math.max(0,null!=(l=o.scanStartIndex)?l:0));i<r;i++){const l=n[i],r=e[i];if(o.canReuseNode&&(!o.canReuseNode(l)||!o.canReuseNode(r))||!ba(l,r,t))return i}return e.length===n.length?-1:r}(e,n,t,o);if(r<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:r,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const i=e.slice();let a=r;for(let u=0;u<r;u++)i[u]=n[u];if(l)for(let u=r;u<e.length;u++){const l=n[u],r=e[u];l&&(!o.canReuseNode||o.canReuseNode(l)&&o.canReuseNode(r))&&fa(l,r,t)&&(i[u]=l,a+=1)}return{nodes:i,metrics:{reusedNodeCount:a,dirtyStartIndex:r,stablePrefixNodeCount:r,dirtyTailNodeCount:ha(r,e,n)}}}(X,s,Z,{canReuseNode:r,reuseDirtyTail:l,scanStartIndex:t});Q=e.nodes,ee=e.metrics}else{const e=function(e,n,t={}){if(!n.length)return{nodes:e,metrics:ma(e.length)};const o=!1!==t.reuseDirtyTail,l=function(e,n,t){var o;const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,null!=(o=t.scanStartIndex)?o:0));r<l;r++){const o=n[r],l=e[r];if(t.canReuseNode&&(!t.canReuseNode(o)||!t.canReuseNode(l))||!ka(o,l))return r}return e.length===n.length?-1:l}(e,n,t);if(l<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:l,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const r=e.slice();let i=l;for(let a=0;a<l;a++)r[a]=n[a];if(o)for(let a=l;a<e.length;a++){const o=n[a],l=e[a];o&&(!t.canReuseNode||t.canReuseNode(o)&&t.canReuseNode(l))&&sa(o,l)&&(r[a]=o,i+=1)}return{nodes:r,metrics:{reusedNodeCount:i,dirtyStartIndex:l,stablePrefixNodeCount:l,dirtyTailNodeCount:ha(l,e,n)}}}(X,s,{canReuseNode:r,reuseDirtyTail:l,scanStartIndex:t});Q=e.nodes,ee=e.metrics}ne=O?Xi()-n:0,te=l?null==(null==ee?void 0:ee.dirtyStartIndex)||ee.dirtyStartIndex<0?Q.length:ee.dirtyStartIndex:Q.length}else Q=X,ee=ma(Q.length);if(!0!==n.effectiveFinal.value&&(Z?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)ca(n,"primeSignatureMs",()=>ua(e[o]))}(Q,Z,te):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)ua(e[t])}(Q,te)),z)for(let e=null!=(null==ee?void 0:ee.dirtyStartIndex)&&ee.dirtyStartIndex>=0?ee.dirtyStartIndex:Q.length;e<Q.length;e++)ji(Q[e],P,p);const le=O?Xi()-Y:0;if(b+=1,m=_,d=A,f=H,h=j,v=F,s=Q,M(null!=(r=null==ee?void 0:ee.dirtyStartIndex)?r:0),O){const e=Yi(L),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(c=null==D?void 0:D.total)?c:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Xi()-I),nodes:Q.length,contentLength:_.length,parseCommitCount:b,parseCoalescedCount:N,nodeReuseMs:le,referenceDefinitionScanChars:oe,signatureMs:null!=(g=null==Z?void 0:Z.signatureMs)?g:0,stabilizeSignatureMs:null!=(k=null==Z?void 0:Z.stabilizeSignatureMs)?k:0,primeSignatureMs:null!=(S=null==Z?void 0:Z.primeSignatureMs)?S:0,signatureCallCount:null!=(w=null==Z?void 0:Z.signatureCallCount)?w:0,stabilizeSignatureCallCount:null!=(C=null==Z?void 0:Z.stabilizeSignatureCallCount)?C:0,primeSignatureCallCount:null!=(B=null==Z?void 0:Z.primeSignatureCallCount)?B:0,stabilizeMs:ne},null!=ee?ee:{}),V?Object.fromEntries(Di.map(e=>{var n;return[e,null!=(n=V[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Na(e,D),streamStats:e}:{}))}return me(Q)});return{effectiveCustomHtmlTags:A,effectiveCustomHtmlTagsSet:F,mdBase:H,mdInstance:R,mergedParseOptions:$,getParsedNodesDirtyStartIndex:()=>x,getParsedNodesRevision:()=>w,parsedNodes:z}}function xa(e){const{isClient:n}=e,t=U(/* @__PURE__ */new Set),o=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;function i(e){if(!n)return;const t=r.get(e);null!=t&&(window.clearTimeout(t),r.delete(e))}function a(){if(n)for(const e of r.values())window.clearTimeout(e);r.clear()}function u(){t.value=/* @__PURE__ */new Set}return{visibleNodeIndices:t,nodeVisibilityHandles:o,nodeVisibilityWatchStops:l,nodeVisibilityFallbackTimers:r,clearVisibilityFallback:i,clearAllVisibilityFallbacks:a,markNodeVisible:function(n,o=!0){var l;o&&i(n),function(n,o){if(null!=(r=null==(l=e.shouldTrackVisibleNodeIndices)?void 0:l.call(e))&&!r)return;var l,r;const i=t.value,a=i.has(n);if(o){if(a)return;const e=new Set(i);return e.add(n),void(t.value=e)}if(!a)return;const u=new Set(i);u.delete(n),t.value=u}(n,o),o&&(null==(l=e.onNodeMarkedVisible)||l.call(e,n))},resetNodeVisibleState:u,cleanupNodeVisibility:function(n){var a;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[e,t]of l.entries())e<n||(t(),l.delete(e));for(const[t,l]of o.entries())t<n||(l.destroy(),o.delete(t),i(t),null==(a=e.onNodeVisibilityCleaned)||a.call(e,t));for(const e of Array.from(r.keys()))e<n||i(e);if(!t.value.size)return;const u=/* @__PURE__ */new Set;for(const e of t.value)e<n&&u.add(e);t.value=u},destroyNodeVisibilityState:function(){u();for(const e of l.values())e();l.clear();for(const e of o.values())e.destroy();o.clear(),a()}}}function wa(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null,c=!1,d=null;const f=void 0===e.requestFrame?"function"==typeof requestAnimationFrame?requestAnimationFrame:null:e.requestFrame,m=void 0===e.cancelFrame?"function"==typeof cancelAnimationFrame?cancelAnimationFrame:null:e.cancelFrame;function h(){null!=d&&(null==m||m(d),d=null),c=!1,u&&(u(),u=null),s=null,l.value=null}function v(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:h,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void h();var e;const m=r();if(!m)return void h();if(l.value===m&&u)return;h(),s=v(m);const p=()=>{null==a||a(),t.value&&(()=>{if(c)return;c=!0;const e=()=>{if(c=!1,d=null,t.value){const e=function(e){const n=v(e),t=s;s=n;const o=Math.max(480,.75*(e.clientHeight||0));return null==t?n>o?{immediate:!0}:void 0:Math.abs(n-t)>o?{immediate:!0}:void 0}(m);e?i(e):i()}};f?d=f(e):e()})()};m.addEventListener("scroll",p,{passive:!0}),l.value=m,u=()=>{m.removeEventListener("scroll",p)}}}}function Ma(e={}){const n=U(""),t=U(""),o=U(!1),l=Oe(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=P(()=>Math.max(0,n.value.length-t.value.length)),u=P(()=>0===a.value),s=P(()=>o.value&&u.value);return ye()&&G(()=>{i(),l.destroy()}),{source:n,visible:t,done:o,final:s,caughtUp:u,pendingChars:a,enqueue:e=>l.enqueue(e),finish:e=>l.finish(e),flush:()=>l.flush(),reset:(e,n)=>l.reset(e,n),pause:()=>l.pause(),resume:()=>l.resume()}}const Ca={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},Ba=/auto|scroll|overlay/i;function _a(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return Ba.test(n)||Ba.test(t)}function Oa(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}const Ta={class:"m-0 p-0"},Ia=["data-probe"],La=/* @__PURE__ */rn(/* @__PURE__ */$(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(F(),E("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[K("div",{ref:n=>e.setParagraphWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[D(V(il),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),K("div",{ref:n=>e.setListItemWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[K("ul",Ta,[D(V(Zo),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),K("div",{ref:n=>e.setListWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[D(V(Qo),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),E(X,null,ce(6,n=>K("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[D(V(Uo),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,Ia)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),Aa=$({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return Ee(null!=(t=ze(e.estimatedPreviewHeightPx))?t:Ke(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),Ha=$({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return $e(null!=(t=ze(e.estimatedPreviewHeightPx))?t:Fe(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),Ra=$({name:"NodeRendererContent",props:["item","sourceNodes","fade","final","nestedRendererProps"],setup:e=>()=>j(pe,{name:"fade",css:!1!==e.fade,appear:!1!==e.fade&&!0!==e.final},{default:()=>{const n=e.item;return n.rendersCustomNode?j(n.component,a({key:0},n.customNodeProps),{default:()=>n.hasSlotChildren?j(za,u(a({key:0},e.nestedRendererProps),{nodes:n.node.children,indexKey:n.indexKey,batchRendering:!1,deferNodesUntilVisible:!1,renderAsFragment:!0})):n.slotContent?j(za,u(a({key:1},e.nestedRendererProps),{content:n.slotContent,final:!n.node.loading,indexKey:`${n.indexKey}-content`,smoothStreaming:!1,batchRendering:!1,deferNodesUntilVisible:!1,renderAsFragment:!0})):Z("v-if",!0)}):j(n.component,a({key:1},n.nodeProps))}})}),Pa={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function $a(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const Fa=["data-custom-id"],Ea=["data-node-index","data-node-type"],Ka="typewriter-simple-cursor-target",za=/* @__PURE__ */rn(/* @__PURE__ */$(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockOptions:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t;function r(e){if(!("undefined"!=typeof Event&&e instanceof Event))return"string"==typeof e?(l("copy-code",e),void l("copy",e)):void l("copy",e)}function i(e){l("handleArtifactClick",e)}function c(e){l("mouseover",e)}function d(e){l("mouseout",e)}const f=Q(),m=R("markstreamNestedRendererProps",void 0);function h(e){const n=null==f?void 0:f.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function v(e){var n,t;const l=o[e];return h(e)?l:null!=(t=null==(n=null==m?void 0:m.value)?void 0:n[e])?t:l}const p=wi,g=P(()=>{return"chat"===(e=v("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),y=P(()=>Bi(v("typewriter"))),k=P(()=>"off"!==y.value),b=P(()=>"minimal"===v("domMode")?"minimal":"full"),N=P(()=>!0===v("renderCodeBlocksAsPre")),S=P(()=>Pa[g.value]),x=P(()=>{var e;return null!=(e=v("showTooltips"))?e:S.value.showTooltips}),w=P(()=>{var e;return null!=(e=v("fade"))?e:S.value.fade}),B=P(()=>{var e;return null!=(e=v("batchRendering"))?e:S.value.batchRendering}),_=P(()=>{var e;return null!=(e=v("initialRenderBatchSize"))?e:S.value.initialRenderBatchSize}),O=P(()=>{var e;return null!=(e=v("renderBatchSize"))?e:S.value.renderBatchSize}),T=P(()=>{var e;return null!=(e=v("renderBatchDelay"))?e:S.value.renderBatchDelay}),I=P(()=>{var e;return null!=(e=v("renderBatchBudgetMs"))?e:S.value.renderBatchBudgetMs}),A=P(()=>{var e;return null!=(e=v("renderBatchIdleTimeoutMs"))?e:S.value.renderBatchIdleTimeoutMs}),$=P(()=>{var e;return null!=(e=v("deferNodesUntilVisible"))?e:S.value.deferNodesUntilVisible}),K=P(()=>{var e;return null!=(e=v("maxLiveNodes"))?e:S.value.maxLiveNodes}),z=P(()=>{var e;return null!=(e=v("liveNodeBuffer"))?e:S.value.liveNodeBuffer}),j=P(()=>{var e;return null!=(e=v("nodeVirtual"))?e:S.value.nodeVirtual}),D={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return v("parseOptions")},get customMarkdownIt(){return v("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return v("customHtmlTags")},get mode(){return v("mode")},get domMode(){return b.value},get htmlPolicy(){return v("htmlPolicy")},get viewportPriority(){return v("viewportPriority")},get viewportPriorityOptions(){return v("viewportPriorityOptions")},get codeBlockStream(){return v("codeBlockStream")},get codeBlockDarkTheme(){return v("codeBlockDarkTheme")},get codeBlockLightTheme(){return v("codeBlockLightTheme")},get codeBlockMinWidth(){return v("codeBlockMinWidth")},get codeBlockMaxWidth(){return v("codeBlockMaxWidth")},get codeBlockOptions(){return v("codeBlockOptions")},get codeBlockProps(){return v("codeBlockProps")},get mermaidProps(){return v("mermaidProps")},get d2Props(){return v("d2Props")},get infographicProps(){return v("infographicProps")},get showTooltips(){return x.value},get themes(){return v("themes")},get isDark(){return v("isDark")},get customId(){return v("customId")},get indexKey(){return o.indexKey},get typewriter(){return v("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return v("smoothStreamingOptions")},get parseCoalesceMs(){return v("parseCoalesceMs")},get fade(){return w.value},get batchRendering(){return B.value},get initialRenderBatchSize(){return _.value},get renderBatchSize(){return O.value},get renderBatchDelay(){return T.value},get renderBatchBudgetMs(){return I.value},get renderBatchIdleTimeoutMs(){return A.value},get deferNodesUntilVisible(){return $.value},get maxLiveNodes(){return K.value},get liveNodeBuffer(){return z.value},get nodeVirtual(){return j.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function G(e){l("height-change",e)}function Y(e){l("virtual-state-change",e)}function te(e){l("anchor-change",e)}const de=U(),fe=U(null),he=U(null),ve=U(null),pe=ge({1:null,2:null,3:null,4:null,5:null,6:null}),ye=U(!1),xe=/* @__PURE__ */new Map,we=U(0);let Me=!1;const Ce=U(0),Be=U({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function _e(e,n){return"string"!=typeof e?n:e.trim()||n}function Oe(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const Ie=P(()=>{var e;const n=null!=(e=D.viewportPriorityOptions)?e:{},t=_e(n.rootMargin,ot);return{rootMargin:t,heavyBlockMargin:_e(n.heavyBlockMargin,t),maxTargets:Oe(n.maxTargets)}}),Le=P(()=>{var e;return null!=(e=Ie.value.rootMargin)?e:ot}),Ae=P(()=>{var e;return null!=(e=Ie.value.maxTargets)?e:640});function He(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return Re("function"==typeof t?t():t)}function Re(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?Re(e.value):"object"==typeof e&&"$el"in e?Re(e.$el):null:null}ee(et,Ie);const{isClient:Pe,renderAsFragment:je,debugPerformanceEnabled:We,resolvedShowTooltips:De,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:qe,ownsTypewriterCursor:Ue}=function(e){const n="undefined"!=typeof window,t=q(),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamTypewriterCursor",void 0),r=R("markstreamSmoothStreaming",void 0),i=P(()=>!0===e.renderAsFragment),a=P(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=P(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=P(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=P(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(D),{resolveViewportRoot:Ge,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:en}=function(e,n){function t(){var e,t;return null!=(t=null==(e=n.scrollRoot)?void 0:e.call(n))?t:null}function o(n){if("undefined"==typeof window)return null;const o=t();if(o)return o;const l=null!=n?n:e.value;if(!l)return null;const r=l.ownerDocument||document,i=r.scrollingElement||r.documentElement;let a=l;for(;a&&a!==r.body&&a!==i;){if(_a(window.getComputedStyle(a))&&Oa(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(de,{isClient:Pe,scrollRoot:He});ee("markstreamShowTooltips",De),ee("markstreamHtmlPolicy",Ve),ee("markstreamTypewriter",k),ee("markstreamFade",P(()=>!1!==D.fade)),ee("markstreamTypewriterCursor",P(()=>!0)),ee("markstreamTextStreamState",xe),ee("markstreamStreamVersion",we),ee("markstreamParseOptions",P(()=>D.parseOptions)),ee("markstreamCustomMarkdownIt",P(()=>D.customMarkdownIt));const{smoothStreamingEnabled:nn,renderContent:tn,requestedFinal:on,effectiveFinal:ln}=function(e,n){const t=Ma(u(a(a({},Ca),e.smoothStreamingOptions),{burstInitialContent:!_i(e.typewriter)})),o=P(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||_i(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=U(!n.isClient||!0===e.smoothStreaming);ke(()=>{l.value=!0});const r=P(()=>l.value&&o.value),i=P(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),s=P(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),c=P(()=>{const e=s.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});let d=0,f=!1;function m(){d=0,f=!1}return J([()=>e.content,()=>e.nodes,r,s],([e,n,o,l])=>{if(null==n?void 0:n.length)return m(),void t.reset("");const r=null!=e?e:"";if(!o)return m(),t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;if(r)if(r===i);else if(r.startsWith(i)){const e=r.slice(i.length),n=t.pendingChars.value;e.length<=8?(d++,f||d>=2&&n<=8?(f=!0,t.reset(r,{prefixKnown:!0})):t.enqueue(e)):(m(),t.enqueue(e))}else m(),t.reset(r);else m(),t.reset("");l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:s,effectiveFinal:c}}(D,{isClient:Pe,inheritedSmoothStreaming:qe}),rn=!0===on.value;ee("markstreamSmoothStreaming",nn);const un=U(!1),cn=U(!1),dn=U(!1);let mn="",hn=!1,vn=null;function pn(){Pe&&null!=vn&&(window.clearTimeout(vn),vn=null)}function gn(){un.value=!1,pn()}function yn(e,n){if(!We.value)return;const t=function(){if(!We.value)return null;const e=wn(bn),n=wn(Nn),t=Math.max(xn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=bn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return bn.clear(),Nn.clear(),xn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}J([()=>D.indexKey,()=>D.customId],()=>{var e,n;gn(),cn.value=!1,dn.value=!(null==(e=o.nodes)?void 0:e.length)&&!0!==on.value&&Boolean(o.content),mn=null!=(n=tn.value)?n:"",hn=mn.length>0},{flush:"sync"}),J([()=>o.content,()=>o.nodes,on],([e,n,t])=>{!(null==n?void 0:n.length)&&!0!==t&&Boolean(e)&&(dn.value=!0)},{flush:"sync",immediate:!0}),J([tn,()=>o.nodes,on],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(gn(),cn.value=!1,mn=l,void(hn=!0)):(l.length>0&&(dn.value=!0),hn?(mn&&l.length>mn.length&&l.startsWith(mn)?(un.value=!0,cn.value=!0,Pe&&(pn(),vn=window.setTimeout(()=>{var e;vn=null,!0===ln.value||(null==(e=o.nodes)?void 0:e.length)||(fu(),un.value=!1,vu())},1200))):(l.length<mn.length||!l.startsWith(mn))&&(gn(),cn.value=!1),void(mn=l)):(mn=l,void(hn=!0)))},{flush:"sync",immediate:!0});const bn=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map;let Sn=!1,xn=0;function wn(e){let n=0;for(const t of e.values())n+=t;return n}function Cn(){xn=Math.max(xn,wn(Nn)),Nn.clear(),Sn=!1}function Bn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function On(e){var n,t;We.value&&(bn.set(e,(null!=(n=bn.get(e))?n:0)+1),Nn.set(e,(null!=(t=Nn.get(e))?t:0)+1),function(e){const n=function(){if(!Pe||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>Bn(n),0):queueMicrotask(()=>Bn(n)):window.requestAnimationFrame(()=>Bn(n))))}(e),Sn||(Sn=!0,Pe&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(Cn):"function"!=typeof queueMicrotask?setTimeout(Cn,0):queueMicrotask(Cn)))}function Tn(e,n){return On(e),n()}const In=D.customId?`renderer-${D.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Ln=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(In),An=In;ee(Oi,Ln);const Hn=Qe(()=>D.customId),{effectiveCustomHtmlTagsSet:Rn,mdInstance:Pn,mergedParseOptions:$n,parsedNodes:Fn,getParsedNodesDirtyStartIndex:En,getParsedNodesRevision:Kn}=Sa(D,{instanceMsgId:In,renderContent:tn,effectiveFinal:ln,smoothStreamingEnabled:nn,debugPerformanceEnabled:We,customComponentsMap:Hn,logPerf:yn});J(Fn,()=>{un.value||Ln.clear(),we.value+=1,Me&&To(Nr(Fn.value.length))},{immediate:!0});const zn=P(()=>({customId:D.customId,customHtmlTags:$n.value.customHtmlTags,parseOptions:D.parseOptions,customMarkdownIt:D.customMarkdownIt,htmlPolicy:Ve.value,viewportPriority:D.viewportPriority,viewportPriorityOptions:Ie.value,mode:g.value,domMode:D.domMode,codeBlockStream:D.codeBlockStream,codeBlockDarkTheme:D.codeBlockDarkTheme,codeBlockLightTheme:D.codeBlockLightTheme,renderCodeBlocksAsPre:N.value,codeBlockMinWidth:D.codeBlockMinWidth,codeBlockMaxWidth:D.codeBlockMaxWidth,codeBlockOptions:D.codeBlockOptions,codeBlockProps:D.codeBlockProps,mermaidProps:D.mermaidProps,d2Props:D.d2Props,infographicProps:D.infographicProps,showTooltips:De.value,themes:D.themes,isDark:D.isDark,typewriter:k.value,smoothStreamingOptions:D.smoothStreamingOptions,parseCoalesceMs:D.parseCoalesceMs,fade:D.fade}));ee("markstreamNestedRendererProps",zn);const jn=P(()=>Fn.value),Wn=P(()=>Fn.value.length),Dn=U(null),Vn=U(null),qn=U(null),Un=U(null),Jn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Gn=!Jn&&D.customId?ui(D.customId):null,Xn=P(()=>Gn?(ai.value,ui(D.customId)):null),Yn=P(()=>{var e;return Boolean(!je.value&&D.customId&&!Jn&&(null==(e=Xn.value)?void 0:e.enabled))}),Zn=P(()=>Boolean(Pe&&Yn.value)),Qn=P(()=>{var e;return Boolean(!je.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),tt=P(()=>Qn.value),lt=U(!1);ke(()=>{lt.value=!0});const rt=P(()=>Boolean(Pe&&Qn.value));ee("markstreamHostScrollManaged",rt);const at=P(()=>Boolean(lt.value&&rt.value)),ut=P(()=>Zn.value||rt.value),st=P(()=>Zn.value||at.value),ct=P(()=>{var e;return ut.value&&!1!==(null==(e=Xn.value)?void 0:e.textEstimation)});function dt(){if(Ce.value>0)return Ce.value;const e=Tn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const ft=P(()=>{const e=dt();return e>0?Math.max(1,Math.round(e)):640}),mt=P(()=>{var e,n;return!(!0!==ln.value||Qn.value||"chat"!==g.value&&"minimal"!==g.value||h("maxLiveNodes")||h("liveNodeBuffer")||(null==(e=o.nodes)?void 0:e.length)||dn.value||!((null!=(n=D.maxLiveNodes)?n:0)<=0))}),ht=P(()=>{var e;return mt.value?50:Math.max(1,null!=(e=D.maxLiveNodes)?e:320)}),vt=P(()=>{var e;return mt.value?16:Math.max(0,null!=(e=D.liveNodeBuffer)?e:60)}),gt=P(()=>{var e;return!je.value&&!1!==D.nodeVirtual&&!((null!=(e=D.maxLiveNodes)?e:0)<=0&&!mt.value)&&(!0===D.nodeVirtual?Fn.value.length>0:Fn.value.length>ht.value)}),yt=P(()=>gt.value||Zn.value||rt.value),kt=P(()=>!1!==D.viewportPriority),bt=P(()=>!!kt.value&&!ye.value);var Nt;Nt=P(()=>kt.value),ee(nt,Nt);const St=P(()=>{var e;return!(je.value||!1===D.deferNodesUntilVisible||(null!=(e=D.maxLiveNodes)?e:0)<=0||gt.value||Fn.value.length>900||!1===D.viewportPriority)}),xt=it(e=>{var n,t;return Ge(null!=(t=null!=(n=null==e?void 0:e.parentElement)?n:de.value)?t:null)},kt),{requestFrame:wt,cancelFrame:Mt,hasIdleCallback:Ct,isTestEnv:Bt}=function(e){const n=e.isClient&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,t=e.isClient&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,o=e.isClient&&"function"==typeof window.requestIdleCallback,l=function(){var e;if("undefined"==typeof globalThis||!("process"in globalThis))return;const n=null==(e=Object.getOwnPropertyDescriptor(globalThis,"process"))?void 0:e.value;return null==n?void 0:n.env}();return{requestFrame:n,cancelFrame:t,hasIdleCallback:o,isTestEnv:"test"===(null==l?void 0:l.NODE_ENV)}}({isClient:Pe}),_t=P(()=>!0===ln.value&&!Qn.value),{resolvedBatchSize:Ot,resolvedInitialBatch:Tt,batchingEnabled:It,incrementalRenderingActive:Ht,renderedCount:Pt,previousRenderContext:$t,adaptiveBatchSize:Ft,previousBatchConfig:Et}=function(e,n){var t;const o=P(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=P(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=P(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=U(0),a=U({key:e.indexKey,total:0}),u=U(Math.max(1,o.value||1)),s=P(()=>{var t,o,l;return r.value&&!(null==(t=n.continuousStreaming)?void 0:t.value)&&!(null==(o=n.forceFullRenderFinalContent)?void 0:o.value)&&(null!=(l=e.maxLiveNodes)?l:0)<=0}),c=U({batchSize:o.value,initial:l.value,delay:null!=(t=e.renderBatchDelay)?t:16,enabled:s.value});return{resolvedBatchSize:o,resolvedInitialBatch:l,batchingEnabled:r,incrementalRenderingActive:s,renderedCount:i,previousRenderContext:a,adaptiveBatchSize:u,previousBatchConfig:c}}(D,{isClient:Pe,isTestEnv:Bt,renderAsFragment:je,forceFullRenderFinalContent:_t,continuousStreaming:P(()=>cn.value&&!0!==ln.value)}),Kt=P(()=>{var e;return!je.value&&!1!==D.batchRendering&&Ot.value>0&&!Bt&&(null!=(e=D.maxLiveNodes)?e:0)<=0&&!_t.value}),zt=P(()=>Kt.value),jt=P(()=>ut.value||zt.value),Wt=P(()=>{var e;return jt.value&&!1!==(null==(e=Xn.value)?void 0:e.codeBlockEstimation)}),Dt=/* @__PURE__ */new Map,Vt=/* @__PURE__ */new Map,qt=/* @__PURE__ */new Map,Ut=/* @__PURE__ */new WeakMap;let Jt=null;const Gt=[];J(()=>Fn.value.length,e=>{Gt.length>e&&(Gt.length=e)});const Xt=[],Qt=[];let lo=[],io=[],uo=-1;const co=H(Qt),mo=/* @__PURE__ */new Set,vo=U(0);let po=0;const go=U(0),yo=P(()=>(go.value,Array.from(Dt.entries()).sort((e,n)=>e[0]-n[0]))),bo=U(null),So=U(null);let wo,Co=null,_o=0,Oo=null;function To(e){wo.markFallbackHeightPrefixDirty(e)}function Io(e){return wo.getFallbackNodeHeight(e)}function Lo(e,n){return wo.estimateHeightRange(e,n)}function Ao(e){return wo.estimateIndexForOffset(e)}const{activeRestoreAnchor:Ho,getRelativeScrollTopWithinContainer:Po,setRelativeScrollTopWithinContainer:$o,resolveAnchorOffset:Fo,clearRestoreReconcile:Ko,scheduleRestoreReconcile:jo,captureRestoreAnchor:Wo,restoreAnchor:Vo,getAnchorDrift:qo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=U(null);let v=null,p=[];function g(){const e=i(),n=t.value;if(!e||!n)return null;const o=e.ownerDocument||n.ownerDocument||document;if(e===o.documentElement||e===o.body||e===o.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,a(e,o,!1)-u(n,e))}function y(e){var n;const o=i(),l=t.value;if(!o||!l)return;const r=Math.max(0,e),c=o.ownerDocument||l.ownerDocument||document,d=c.defaultView||("undefined"!=typeof window?window:null);if(o===c.documentElement||o===c.body||o===c.scrollingElement){const e=a(o,c,!0)+l.getBoundingClientRect().top;return void(null==(n=null==d?void 0:d.scrollTo)||n.call(d,0,Math.max(0,e+r)))}Mi(o,c,u(l,o)+r,{isReverseFlexScrollRoot:e=>{var n;return null!=(n=null==s?void 0:s(e))&&n},getNormalizedScrollTop:a})}function k(e){const n=o.value,t=m(e.nodeIndex,0,Math.max(0,n-1));return d(0,t)+Math.max(0,e.offsetWithinNodePx)}function b(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function N(e){const n=k(e),t=g();null!=t&&Math.abs(t-n)<=.5||y(n)}return{activeRestoreAnchor:h,getRelativeScrollTopWithinContainer:g,setRelativeScrollTopWithinContainer:y,resolveAnchorOffset:k,clearRestoreReconcile:b,applyRestoreAnchor:N,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&N(h.value)}):null,null==v&&h.value&&N(h.value))},captureRestoreAnchor:function(){const e=g(),n=o.value;if(null==e||n<=0)return null;const t=m(c(e+1),0,n-1),l=d(0,t),r=f(t);return{nodeIndex:t,offsetWithinNodePx:m(e-l,0,Math.max(0,r-1))}},restoreAnchor:function(e){const t=o.value;if(h.value={nodeIndex:m(e.nodeIndex,0,Math.max(0,t-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},b(),N(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&N(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:Pe,containerRef:de,parsedNodeCount:Wn,requestFrame:wt,cancelFrame:Mt,resolveScrollContainer:()=>bo.value||Xe(),getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:en,isReverseFlexScrollRoot:Ye,estimateIndexForOffset:Ao,estimateHeightRange:Lo,getFallbackNodeHeight:Io,clamp:br}),{nodeHeights:Jo,heightStats:Go,heightTreeSize:Xo,heightSumTree:Yo,heightKnownTree:el,averageNodeHeight:nl,resetHeightMeasurements:tl,pruneHeightMeasurements:ll,rebuildHeightTrees:rl,syncHeightTreeSize:al,recordNodeHeight:ul,removeNodeHeights:sl,exportHeightCache:cl,importHeightCache:dl,fenwickRangeSum:fl}=function(e={}){const n=ge({}),t=ge({total:0,count:0}),o=U(0),l=U([]),r=U([]);function i(){for(const e of Object.keys(n))delete n[Number(e)];t.total=0,t.count=0,o.value=0,l.value=[],r.value=[]}function s(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function c(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function d(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}function f(e){o.value=e;const t=new Array(e+1).fill(0),i=new Array(e+1).fill(0);for(const[o,l]of Object.entries(n)){const n=Number(o),r=Number(l);!Number.isFinite(n)||n<0||n>=e||!Number.isFinite(r)||r<=0||(s(t,n,r),s(i,n,1))}l.value=t,r.value=i}function m(e){if(!Number.isInteger(e)||e<0)return!1;const i=n[e];if(!Number.isFinite(i)||i<=0)return!1;if(delete n[e],t.total=Math.max(0,t.total-i),t.count=Math.max(0,t.count-1),o.value>e){const n=l.value,t=r.value;n.length&&t.length&&(s(n,e,-i),s(t,e,-1))}return!0}const h=P(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:h,resetHeightMeasurements:i,pruneHeightMeasurements:function(e){if(e<=0)return void i();let o=0,l=0;for(const[t,r]of Object.entries(n)){const i=Number(t),a=Number(r);!Number.isFinite(i)||i<0||i>=e||!Number.isFinite(a)||a<=0?delete n[i]:(o+=a,l++)}t.total=o,t.count=l},rebuildHeightTrees:f,syncHeightTreeSize:function(e){const t=o.value;if(e===t)return;if(e<t||0===t)return void f(e);const i=l.value,a=r.value;i.length=e+1,a.length=e+1;for(let n=t;n<e;n++)i[n+1]=0,a[n+1]=0;for(let o=t;o<e;o++){const e=Number(n[o]);!Number.isFinite(e)||e<=0||(s(i,o,e),s(a,o,1))}for(let n=t+1;n<=e;n++){const e=n-(n&-n);e>=t||(i[n]+=d(i,e,t),a[n]+=d(a,e,t))}o.value=e},recordNodeHeight:function(i,c,d={}){!function(i,a,u={}){var c;if(!Number.isFinite(a)||a<=0)return!1;const d=n[i];if(d){if(!1===u.allowShrink&&a<d)return!1;if(Math.abs(a-d)<=1)return!1}if(n[i]=a,d?t.total+=a-d:(t.total+=a,t.count++),o.value>i){const e=l.value,n=r.value;if(e.length&&n.length)if(d){const n=a-d;0!==n&&s(e,i,n)}else s(e,i,a),s(n,i,1)}!1!==u.notify&&(null==(c=e.onHeightRecorded)||c.call(e,i))}(i,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=m(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e,n)),l},removeNodeHeights:function(n,t={}){var o;let l=0,r=Number.POSITIVE_INFINITY;for(const e of n){const n=Number(e);m(n)&&(l++,n<r&&(r=n))}return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e,Number.isFinite(r)?r:void 0)),l},exportHeightCache:function(){return Object.entries(n).map(([e,n])=>({index:Number(e),height:Number(n)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,n)=>e.index-n.index)},importHeightCache:function(l,r={}){var i;if(!Array.isArray(l))return;const a=o.value;let u=!1;if("merge"!==r.mode){const e=Object.keys(n);if(e.length>0){for(const t of e)delete n[Number(t)];u=!0}}for(const e of l){const t=Number(e.index),o=Number(e.height);if(!Number.isInteger(t)||t<0)continue;if(a>0&&t>=a)continue;if(!Number.isFinite(o)||o<=0)continue;const l=n[t];l&&Math.abs(l-o)<=1||(n[t]=o,u=!0)}u&&(function(){let e=0,l=0;const r=o.value;for(const[t,o]of Object.entries(n)){const i=Number(t),a=Number(o);!Number.isFinite(i)||i<0||r>0&&i>=r||!Number.isFinite(a)||a<=0?delete n[i]:(e+=a,l++)}t.total=e,t.count=l}(),a>0&&f(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:d}}({onHeightRecorded:e=>{To(null!=e?e:0),rt.value&&Cu(),Ho.value&&jo(),So.value&&na(),iu("node-resize")}});function ml(e){Number.isInteger(e)&&e>=0&&mo.add(e)}function vl(e){for(const n of e)ml(Number(n))}function gl(e){po++;let n=!0;try{const t=e();return n=!1!==t,t}finally{po--,0===po&&n&&vo.value++}}function bl(){lo=[],io=[],uo=-1,mo.clear(),co.value=Qt}function Nl(){bl(),gl(()=>tl()),Xt.length=0}function Sl(e){!Number.isInteger(e)||e<0||e>=Fn.value.length||(Xt[e]=Ui(e))}function xl(e,n,t={}){const o=Jo[e];ml(e),ul(e,n,t);const l=Jo[e];return Object.is(o,l)?(mo.delete(e),!1):(l&&l>0?Sl(e):o&&e<Xt.length&&(Xt[e]=void 0),!0)}function wl(e,n){const t=Tn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight);return t>0?t:Tn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Dt.get(e))?void 0:n.offsetHeight)?t:0})}function Ml(e,n={}){"merge"!==n.mode?bl():vl(e.map(e=>e.index)),gl(()=>dl(e,n)),ba()}const Cl=P(()=>St.value&&bt.value),Bl=P(()=>ut.value||Kt.value||Cl.value&&Fn.value.length>Tt.value),_l=P(()=>{var e;return!je.value&&!1!==D.batchRendering&&Ot.value>0&&(null!=(e=D.maxLiveNodes)?e:0)<=0}),Ol=P(()=>!je.value&&rn&&!0===ln.value&&!gt.value&&!Qn.value&&!Yn.value&&!Cl.value&&!_l.value),Tl=P(()=>!!xt&&Cl.value),Il=P(()=>[Tl.value,Cl.value,gt.value,ye.value,Ae.value,Le.value,Tt.value,Boolean(xt)].join("|")),Ll=P(()=>gt.value||rt.value),{focusIndex:Al,liveRange:Hl,updateLiveRange:Rl}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,liveNodeBufferResolved:r,clamp:i}=n,a=null!=r?r:P(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),u=U(0),s=ge({start:0,end:0});return{liveNodeBufferResolved:a,focusIndex:u,liveRange:s,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return s.start=0,void(s.end=e);const n=Math.min(l.value,e),r=a.value,c=i(u.value-r,0,Math.max(0,e-n));s.start=c,s.end=Math.min(e,c+n)}}}(D,{parsedNodeCount:Wn,virtualizationEnabled:gt,maxLiveNodesResolved:ht,liveNodeBufferResolved:vt,clamp:br}),Pl=/* @__PURE__ */new Map,$l=/* @__PURE__ */new Map,Fl=/* @__PURE__ */new Map,El=/* @__PURE__ */new Map,Kl=[],zl=/* @__PURE__ */new Map;let jl=-1/0;const Wl=/* @__PURE__ */new Set,Dl=U(0);let Vl=!1;const ql=P(()=>(Dl.value,Wl.size)),Ul=/* @__PURE__ */new Map,Jl=/* @__PURE__ */new Map,Gl=U(0);let Xl=0;const Yl=P(()=>(Gl.value,Xl));let Zl=null;const Ql=P(()=>{if(!gt.value)return Fn.value.length;const e=vt.value,n=Math.max(Hl.end+e,Tt.value),t=Math.min(Fn.value.length,n);return Math.max(Pt.value,t)});function er(){Vl||(Vl=!0,queueMicrotask(()=>{Vl=!1,Dl.value+=1}))}function nr(e,n,t="node-resize"){if(!Pe||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Wl.delete(o)&&er();try{n()}finally{iu(t)}},Math.max(0,e));return Wl.add(o),er(),o}function tr(e){Pe&&null!=e&&(Wl.delete(e)&&er(),window.clearTimeout(e))}function or(){if(Pe&&"undefined"!=typeof window)for(const e of Wl)window.clearTimeout(e);Wl.size&&(Wl.clear(),er()),Kl.length=0,El.clear()}function lr(e){fe.value=e}function rr(e){he.value=e}function ir(e){ve.value=e}const{cancelScheduledFocusSync:ar,scheduleFocusSync:ur}=function(e){const{isClient:n,containerRef:t,virtualizationEnabled:o,requestFrame:l,cancelFrame:r,syncFocusToScroll:i}=e;let a=null;function u(){var e,n,o;return null!=(o=null==(n=null==(e=t.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?o:"undefined"!=typeof window?window:null}function s(){if(!a)return;const e=u();a.viaTimeout?e?e.clearTimeout(a.id):clearTimeout(a.id):null==r||r(a.id),a=null}return{cancelScheduledFocusSync:s,scheduleFocusSync:function(e={}){if(!o.value)return;if(!n)return void i(!0);if(e.immediate)return s(),void i(!0);if(a)return;const t=()=>{a=null,i()};if(l)return void(a={id:l(t),viaTimeout:!1});const r=u(),c=r?r.setTimeout(t,16):setTimeout(t,16);a={id:c,viaTimeout:!0}}}}({isClient:Pe,containerRef:de,virtualizationEnabled:gt,requestFrame:wt,cancelFrame:Mt,syncFocusToScroll:function(e=!1){var n;if(!gt.value)return;const t=bo.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=de.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=Fn.value.length;if(i<=0)return;if(!r&&i>0&&Ye(t)){const n=Tn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=Tn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void kr(br((a=Math.max(0,l)+.5*Math.max(0,n),wo.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=de.value;if(!l)return null;const r=o?0:Tn("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=Tn("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?Tn("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):Tn("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return br(Ao(a+.5*Math.max(0,u)),0,Math.max(0,Fn.value.length-1))}(t,o,l,r);if(null!=u)return void kr(u,e);const s=r?null:Tn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?Tn("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=yo.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=Tn("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=de.value;if(!e)return;const n=r?{top:0}:Tn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=Tn("syncFocusToScroll.fallback.scrollTop",()=>Ze(t,o,r)),a=r?(()=>{const t=Tn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=en(e,t);return Math.max(0,i-n)})(),u=r?Tn("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):Tn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void kr(br(Ao(a+.5*Math.max(0,u)),0,Math.max(0,Fn.value.length-1)),!0)}kr(Math.round((m+h)/2),e)}}),{visibleNodeIndices:sr,nodeVisibilityHandles:cr,nodeVisibilityWatchStops:dr,nodeVisibilityFallbackTimers:fr,clearVisibilityFallback:mr,markNodeVisible:hr,cleanupNodeVisibility:vr,destroyNodeVisibilityState:pr}=xa({isClient:Pe,shouldTrackVisibleNodeIndices:()=>Cl.value,shouldCleanupNodeVisibility:()=>gt.value,onNodeMarkedVisible:e=>{gt.value?ur():Al.value=br(e,0,Math.max(0,Fn.value.length-1))},onNodeVisibilityCleaned:e=>{Dt.delete(e)&&au()}}),{cleanupScrollListener:gr,setupScrollListener:yr}=wa({isClient:Pe,virtualizationEnabled:gt,listenerEnabled:Ll,scrollRootElement:bo,resolveScrollContainer:Xe,scheduleFocusSync:ur,onScroll:function(){const e=So.value;if(!e)return;const n=Ti();if(!n)return;if(function(e){if(Ga()>=_o)return Oo=null,!1;const n=Oo;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(Oo=null),t}(n))return;const t=Li(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&ea("restore"):ea("restore")},requestFrame:wt,cancelFrame:Mt,getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=de.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return Tn("scrollListener.getScrollTop",()=>Ze(e,t,o))}});function kr(e,n=!1){const t=br(e,0,Math.max(0,Fn.value.length-1));!n&&Math.abs(t-Al.value)<=1||(Al.value=t,Rl())}function br(e,n,t){return Math.min(Math.max(e,n),t)}function Nr(e=Fn.value.length){const n=En();return!Number.isInteger(n)||n<0?e:br(n,0,e)}function Sr(e){return null==e?void 0:e.firstElementChild}function xr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function wr(e,n){e<1||e>6||(pe[e]=n)}function Mr(){if(!Bl.value||"undefined"==typeof ResizeObserver)return void(Ce.value=0);const e=Tn("updateMeasuredContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.clientWidth)?n:0});Ce.value=e>0?e:0}let Cr=null;function Br(){null==Cr||Cr.disconnect(),Cr=null}const _r=P(()=>N.value?eo:no);function Or(){var e;return!1!==(null==(e=D.codeBlockProps)?void 0:e.showHeader)}function Tr(){var e;return!1!==(null==(e=D.codeBlockProps)?void 0:e.showCopyButton)}function Ir(){var e,n;const t=null==(e=D.codeBlockProps)?void 0:e.showLineNumbers;return"boolean"==typeof t?t:!0!==(null==(n=D.codeBlockOptions)?void 0:n.disableLineNumbers)}function Lr(e,n,t){var o;const l=Jo[n],r="number"==typeof l&&l>0;if(ct.value&&!r&&!function(e){return!!Hn.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=mi(e,t,Be.value);if(n)return n}if(Wt.value&&!r&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ds(e,as(e));return n===eo?"pre":n===_r.value||n===no?"stream-diffs":null}(e);if("stream-diffs"===n||"pre"===n)return function(e,n){if(!e||"code_block"!==e.type)return null;const t=n.rendererKind,o="pre"!==t&&!1!==n.showHeader,l="pre"===t&&!1!==n.showHeader,r=Boolean(e.diff);let i=0,u=500;if("stream-diffs"===t){const t=pi(e,n.diffStyle),o=18,l=function(e){return e?0:16}(r);u=500,i=Math.round(t*o+l)}else{const t=Yt(n.codeBlockOptions),o=function(e,n,t){var o,l;const r=pi(e,n.diffStyle),i=Number(n.width);if("wrap"!==t.overflow||!Number.isFinite(i)||i<=0)return r;const a=Math.max(1,.6*t.fontSize),u=Boolean(e.diff),s=u&&Rt({diffStyle:n.diffStyle});if(!u||s){const o=(u?vi(e.raw)||[vi(e.originalCode),vi(e.updatedCode)].filter(Boolean).join("\n"):vi(e.code,!0===e.loading)).split(/\r\n|\n|\r/),l=yi(i,a,o.length,t,n,!1);return o.reduce((e,n)=>e+gi(n,l,t.tabSize),0)}const c=vi(e.originalCode).split(/\r\n|\n|\r/),d=vi(e.updatedCode).split(/\r\n|\n|\r/);if(null==e.originalCode&&null==e.updatedCode)return r;const f=Math.max(c.length,d.length),m=yi(i,a,f,t,n,!0);let h=0;for(let v=0;v<f;v++)h+=Math.max(gi(null!=(o=c[v])?o:"",m,t.tabSize),gi(null!=(l=d[v])?l:"",m,t.tabSize));return h}(e,n,t);i=Math.round(o*t.lineHeight+t.padding+t.paddingBottom),u=t.maxHeight}const s=Math.max(1,Math.min(i,u));return a({kind:"code-block",height:Math.round(s+("pre"===t?l?37:0:o?40:0)),contentHeight:s,rendererKind:t},r&&"stream-diffs"===t?{diffInline:Rt({diffStyle:n.diffStyle})}:{})}(e,{rendererKind:n,codeBlockOptions:D.codeBlockOptions,showHeader:Or(),showLineNumbers:Ir(),width:t,diffStyle:null==(o=D.codeBlockOptions)?void 0:o.diffStyle})}return null}be(()=>{if(vo.value,po>0)return;const e=Fn.value,n=Kn();if(!e.length||!jt.value)return lo=[],io=[],uo=-1,mo.clear(),void(co.value=Qt);const t=Ce.value||Tn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return lo=[],io=[],uo=-1,mo.clear(),void(co.value=Qt);const o=function(e){var n,t;const o=Yt(D.codeBlockOptions);return[Math.round(e),ct.value,Wt.value,Be.value,o.fontSize,o.lineHeight,o.fontFamily,o.padding,o.paddingBottom,o.maxHeight,o.tabSize,o.overflow,null!=(t=null==(n=D.codeBlockOptions)?void 0:n.diffStyle)?t:"split",Ir(),Or(),Tr(),N.value,Hn.value,ai.value]}(t),l=lo.length<=e.length&&(i=o,(r=io).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&uo===n?e.length:l?Nr(e.length):0,u=l?Array.from(mo):[];lo.length=e.length;for(let s=a;s<e.length;s++)lo[s]=Lr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(lo[s]=Lr(e[s],s,t));mo.clear(),io=o,uo=n,co.value=lo,Ne(co)},{flush:"sync"});const Ar=P(()=>co.value);wo=function(e){let n=!0,t=-1;const o=[0];let l="",r=-1;const i=/* @__PURE__ */new WeakMap;function a(e=0){n=!0,e<=0?t=0:(t<0||e<t)&&(t=e)}function u(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=e.parsedNodes.value[n],r=null==l?void 0:l.type,a=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),u=e.estimatedNodeHeights.value[n],s=null==u?void 0:u.height;if(!function(e,n,t){return Boolean(t&&"simple-text"===(null==n?void 0:n.kind)&&("paragraph"===e||"list_item"===e||"list"===e))}(r,u,a)&&Number.isFinite(s)&&s>0)return s;const c=function(n,t){var o;if(!n||"object"!=typeof n||!1===(null==(o=e.shouldCacheStaticFallbackHeight)?void 0:o.call(e)))return Ei(n,t);const l=n,r=i.get(l);if(r&&r.width===t)return r.height;const a=Ei(n,t);return i.set(l,{width:t,height:a}),a}(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&c<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(Ri)}(l,a)?c:Math.max(e.averageNodeHeight.value,c)}function s(){var i;const s=e.parsedNodes.value.length,c=e.getPrefixCacheKeyParts().join(":"),d=o;l!==c&&(l=c,a(0));const f=e.averageNodeHeight.value;r!==f&&(r=f,a(0)),d.length>s+1&&(d.length=s+1,t>=0&&t>=d.length-1&&(n=!1));const m=d.length-1;if(!n){if(m===s)return d;t=m}const h=Math.min(t,m);d.length<s+1&&(d.length=s+1);for(let n=h;n<s;n++)d[n+1]=d[n]+(e.heightEstimationActive.value?u(n):null!=(i=e.nodeHeights[n])?i:f);return n=!1,t=s,d}function c(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const r=s();if(n>=(null!=(t=r[l])?t:0))return l-1;let i=0,a=l-1,u=l-1;for(;i<=a;){const e=i+a>>1;(null!=(o=r[e+1])?o:0)>=n?(u=e,a=e-1):i=e+1}return u}function d(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const r=e.parsedNodes.value.length,i=Ki(Math.trunc(n),0,r),a=Ki(Math.trunc(t),i,r);if(i>=a)return 0;const u=s();return(null!=(o=u[a])?o:0)-(null!=(l=u[i])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const r=e.heightSumTree.value,i=e.heightKnownTree.value;if(!r.length||!i.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(r,n,t)+(t-n-e.fenwickRangeSum(i,n,t))*e.averageNodeHeight.value}function f(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return c(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function m(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:a,getFallbackNodeHeight:u,estimateHeightRange:d,estimateIndexForOffset:f,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=s()[l.length])?t:0;return c(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=d(0,l.length);return f(Math.max(0,e-n))}let r=n;for(let i=l.length-1;i>=0;i--){const n=null!=(o=e.nodeHeights[i])?o:e.averageNodeHeight.value;if(r<=n)return i;r-=n}return 0},getEstimatedNodeHeightCount:m,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:m(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:d(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Fn,nodeHeights:Jo,heightStats:Go,heightTreeSize:Xo,heightSumTree:Yo,heightKnownTree:el,averageNodeHeight:nl,heightEstimationActive:ut,estimatedNodeHeights:Ar,getContainerWidth:dt,shouldCacheStaticFallbackHeight:()=>{var e;return!(null==(e=o.nodes)?void 0:e.length)},hasCustomParagraphComponent:()=>Boolean(Hn.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=Ai(Ce.value||Tn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0}));return[null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey),n,ut.value?1:0,ai.value,Hn.value.paragraph?1:0]},fenwickRangeSum:fl}),Me=!0,J(()=>Fn.value.length,(e,n)=>{var t;To(null!=n&&e>=n?Nr(e):0),e<=0?Nl():(e<Xo.value&&(t=e,bl(),gl(()=>ll(t))),al(e))},{immediate:!0});const Hr=P(()=>{if(!gt.value)return Fn.value.map((e,n)=>({node:e,index:n}));const e=Fn.value.length,n=br(Hl.start,0,e),t=br(Hl.end,n,e);return Fn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Rr=P(()=>gt.value?Lo(0,Math.min(Hl.start,Fn.value.length)):0),Pr=P(()=>{if(!gt.value)return 0;const e=Fn.value.length;return Lo(Math.min(Hl.end,e),e)});function $r(){return wo.buildVirtualHeightSummary({topSpacerHeight:Rr.value,bottomSpacerHeight:Pr.value,width:qr()})}function Fr(){const e=Fn.value,n=$r();return u(a({},n),{probe:{paragraphReady:Boolean(Be.value.paragraph),listItemReady:Boolean(Be.value.listItem),listWrapperOverhead:Be.value.listWrapperOverhead,headingReadyLevels:Object.entries(Be.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:e.map((e,n)=>{var t,o,l,r,i,a,u,s,c;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=Ar.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=Ar.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=Ar.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=Ar.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Jo[n])?c:null}})})}function Er(){return null!=o.indexKey?String(o.indexKey):Qn.value?`virtual-${zr()}`:"markdown-renderer"}function Kr(e){const n=String(e),t=`${Er()}-`;if(!n.startsWith(t))return null;const o=n.slice(t.length).match(/^(\d+)(?:$|-)/);if(!o)return null;const l=Number(o[1]);return!Number.isInteger(l)||l<0||l>=Fn.value.length?null:l}function zr(){var e,n,t;const l=null==(e=o.virtualScroll)?void 0:e.sessionKey;return String(null!=l&&""!==l?l:null!=(t=null!=(n=o.indexKey)?n:D.customId)?t:In)}function jr(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}const Wr=P(()=>{var e,n,t;return null!=(t=jr())?t:String(null!=(n=null!=(e=o.indexKey)?e:D.customId)?n:In)});function Dr(e){var n;return(null!=e?e:"")===(null!=(n=jr())?n:"")}function Vr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(e){const n=e.codeBlockProps,t=e.codeBlockOptions,o=null==t?void 0:t.parseDiffOptions;return[e.isDark?"dark":"light",e.renderCodeBlocksAsPre?"code-pre":"code-rich",!1===e.codeBlockStream?"code-static":"code-stream",$a(e.codeBlockMinWidth),$a(e.codeBlockMaxWidth),$a(null==t?void 0:t.fontSize),$a(null==t?void 0:t.lineHeight),$a(null==t?void 0:t.fontFamily),$a(null==t?void 0:t.maxHeight),$a(null==t?void 0:t.tabSize),$a(null==t?void 0:t.padding),$a(null==t?void 0:t.overflow),$a(null==t?void 0:t.disableLineNumbers),$a(null==t?void 0:t.diffStyle),$a(null==t?void 0:t.diffIndicators),$a(null==t?void 0:t.hunkSeparators),$a(null==t?void 0:t.expandUnchanged),$a(null==t?void 0:t.collapsedContextThreshold),$a(null==t?void 0:t.expansionLineCount),$a(null==o?void 0:o.context),$a(null==n?void 0:n.showHeader),$a(null==n?void 0:n.showCopyButton),$a(null==n?void 0:n.showExpandButton),$a(null==n?void 0:n.showPreviewButton),$a(null==n?void 0:n.showCollapseButton),$a(null==n?void 0:n.showFontSizeButtons),$a(null==n?void 0:n.showLineNumbers)].join("\0")}({renderCodeBlocksAsPre:N.value,isDark:D.isDark,codeBlockStream:D.codeBlockStream,codeBlockMinWidth:D.codeBlockMinWidth,codeBlockMaxWidth:D.codeBlockMaxWidth,codeBlockOptions:D.codeBlockOptions,codeBlockProps:D.codeBlockProps}),[null==n?"":String(n),t].join("\0")}function qr(){return dt()}const Ur=P(()=>Ai(qr())),Jr=P(()=>[Vr(),Ur.value].join("\0")),Gr=P(()=>{var e;return Qn.value?["virtual",null!=(e=jr())?e:"",zr(),Jr.value].join("\0"):o.indexKey});function Xr(){Gl.value+=1}function Yr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Fn.value.length||e.sessionKey!==zr()||e.threadKey!==jr()||e.layoutEpochKey!==Jr.value)}function Zr(e){const n=String(e),t=Jl.get(n);return t?Yr(t)?t.index:null:Kr(n)}function Qr(e="async-node"){(Ul.size||Jl.size)&&(Xl=0,Ul.clear(),Jl.clear(),Xr(),iu(e))}const ei=R(Te,null),ni={reportHeight(e,n){if(!rt.value)return;const t=Zr(e);if(null==t)return;const o=Pl.get(t);if(!o)return;const l=Number(n),r=wl(t,o);!function(e,n,t={}){gl(()=>xl(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!rt.value)return;const n=Kr(e);null!=n&&function(e,n){var t;const o=Jl.get(e);if(o&&Yr(o))return Ul.set(e,Math.max(0,null!=(t=Ul.get(e))?t:0)+1),Xl+=1,Xr(),void iu("async-node");Ul.set(e,1),Xl+=1,Jl.set(e,function(e){return{index:e,sessionKey:zr(),threadKey:jr(),layoutEpochKey:Jr.value}}(n)),Xr(),iu("async-node")}(String(e),n)},markSettled(e){if(!rt.value)return;const n=String(e),t=Zr(e);if((null!=t||function(e){return Ul.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Ul.get(e))?n:0;return!(t<=0||(t<=1?(Ul.delete(e),Jl.delete(e)):Ul.set(e,t-1),Xl=Math.max(0,Xl-1),Xr(),1===t&&iu("async-node"),0))}(n)&&null!=t){const e=Pl.get(t);e&&hu(t,e)}}};function ti(e){if(void 0!==e)return e;let n=0;for(const t of Pl.values())n+=Tn("getVisibleDomHeight.offsetHeight",()=>t.offsetHeight);return n}ee(Te,{reportHeight(e,n){ni.reportHeight(e,n),null==ei||ei.reportHeight(e,n)},markPending(e){ni.markPending(e),null==ei||ei.markPending(e)},markSettled(e){ni.markSettled(e),null==ei||ei.markSettled(e)}});let oi,li=null,ii=null;function si(e){return!1!==e&&null!=e&&""!==e}function ci(){return gt.value?function(){if(!gt.value)return!0;const e=Fn.value.length,n=br(Hl.start,0,e),t=br(Hl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Dt.has(o))return!1;if(uu(o)&&!Pl.has(o))return!1}return!0}():Pt.value>=Ql.value}function di(){return!0===ln.value&&!un.value&&0===Yl.value&&0===Wl.size&&0===zl.size&&null==Zl&&ci()}function fi(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(li===zr()&&oi===jr())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!si(t)&&ii===Ou(t)}function hi(){return di()&&fi()}function ki(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function Ni(e="manual",n,t){const o=$r(),l=function(e){return e||(!0!==ln.value?Fn.value.length>0?"streaming":"estimating":!ci()||zl.size>0||null!=Zl?"measuring":hi()?"settled":"settling")}(n);return{sessionKey:zr(),threadKey:jr(),phase:l,nodeCount:o.totalNodes,liveRange:{start:Hl.start,end:Hl.end},renderedCount:Pt.value,measuredCount:o.measuredCount,estimatedCount:o.estimatedCount,averageNodeHeight:o.averageNodeHeight,topSpacerHeight:o.topSpacerHeight,bottomSpacerHeight:o.bottomSpacerHeight,visibleDomHeight:ti(t),totalHeight:Ii(o),width:o.width,final:!0===ln.value,stable:hi(),confidence:ki(l,o),reason:e}}function Ti(){const e=bo.value||Xe(),n=de.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=Tn("getScrollBox.scrollTop",()=>Ze(e,t,o)),r=Tn("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=Tn("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function Ii(e){var n;const t=Fn.value.length,o=Math.max(0,Lo(0,t)),l=Tn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.offsetHeight)?n:0}),r=Math.max(0,l>0?l:Tn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.scrollHeight)?n:0}));return t<=0?Math.ceil(l):gt.value?o>0?Math.max(1,Math.ceil(o),function(){let e=Rr.value+Pr.value;for(const n of Dt.values())n&&(e+=Math.max(0,Tn("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(o,r)):Math.max(1,Math.ceil(r)):rt.value?o>0||Go.count>0||(null!=(n=null==e?void 0:e.estimatedCount)?n:wo.getEstimatedNodeHeightCount())>0?(Ht.value&&Pt.value,Math.max(1,Math.ceil(r),Math.ceil(o))):Math.ceil(r):Math.max(1,Math.ceil(r),Math.ceil(o))}function Li(e){const n=de.value;if(!n)return null;const t=Tn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:Tn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function Hi(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=Ti(),t=de.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=Tn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=Tn("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=Ti(),n=de.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=Li(e);return null==t?null:t>=-8&&t<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,t)}:null}();if(o)return{anchor:o,captured:!0};const l=Wo();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Fn.value.length;return e<=0?null:{type:"node",nodeIndex:br(Al.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function Pi(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function $i(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t^=31,t=Math.imul(t,16777619),t}const Fi=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function zi(e,n=/* @__PURE__ */new WeakSet,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){const n=e.length>8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${Pi(n)}`}(e)}`;if("function"==typeof e)return"fn";if("object"!=typeof e)return typeof e;if(n.has(e))return"cycle";if(t>=6)return"max-depth";n.add(e);try{if(Array.isArray(e)){if(e.length<=160){const o=[];for(let l=0;l<e.length;l++)o.push(zi(e[l],n,t+1));return`a:${e.length}:${o.join(",")}`}const o=[],l=[],r=Math.max(0,e.length-32);let i=2166136261;for(let a=0;a<e.length;a++){const u=zi(e[a],n,t+1);i=$i(i,u),a<32&&o.push(u),a>=r&&l.push(u)}return[`a:${e.length}`,`h=${o.join(",")}`,`t=${l.join(",")}`,`all=${(i>>>0).toString(36)}`].join(":")}const o=e,l=Object.keys(o).filter(e=>{const n=o[e];return"parent"!==e&&"el"!==e&&"component"!==e&&(null==n||"string"==typeof n||"number"==typeof n||"boolean"==typeof n||Fi.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${zi(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let ji=-1;const Wi=/* @__PURE__ */new Map;let Di=-1,Vi="",qi=[2166136261];function Ui(e){var n;const t=Fn.value[e],l=Kn();if(ji!==l&&(ji=l,Wi.clear()),!t)return"";if((null==(n=o.nodes)?void 0:n.length)||D.parseOptions||D.customMarkdownIt||Pn.value.__markstreamHasCustomParserExtensions||0!==Object.keys(Hn.value).length)return Pi(zi(t));const r=Wi.get(e);if(void 0!==r)return r;const i=Pi(zi(t));return Wi.set(e,i),i}function Ji(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function Gi(){var e,n;const t=we.value;if(Di===t)return Vi;const o=Fn.value.length;let l=Nr(o);(Di!==t-1||l>o||qi.length<l+1)&&(l=0),0===l?qi=[2166136261]:qi.length=l+1;for(let r=l;r<o;r++){const n=Ui(r);qi[r+1]=Ji(null!=(e=qi[r])?e:2166136261,n)}return qi.length=o+1,Vi=((null!=(n=qi[o])?n:2166136261)>>>0).toString(36),Di=t,Vi}function Xi(e,n={}){var t;const l=!0===n.includeHeightCache,r=null!=(t=n.includeContentHash)?t:l,i=l?function(e){const n=function(){var e,n;const t=Number(null!=(n=null==(e=o.virtualScroll)?void 0:e.heightCacheLimit)?n:5e3);return!Number.isFinite(t)||t<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(t))}();if(!Number.isFinite(n)||e.length<=n)return e;const t=/* @__PURE__ */new Map,l=e=>{!e||t.size>=n||t.set(e.index,e)},r=Fn.value.length,i=br(Hl.start-2*vt.value,0,r),a=br(Hl.end+2*vt.value,i,r);for(const o of e)o.index>=i&&o.index<a&&l(o);const u=Math.max(1,Math.ceil(e.length/n));for(let o=0;o<e.length&&t.size<n;o+=u)l(e[o]);for(let o=e.length-1;o>=0&&t.size<n;o-=u)l(e[o]);return Array.from(t.values()).sort((e,n)=>e.index-n.index).slice(0,n)}(cl().map(e=>{var n;const t=Fn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Ui(e.index)}):null}).filter(e=>Boolean(e))):[],s=Hi({allowFallback:!0===n.allowAnchorFallback,requireViewport:n.requireViewport});return s||i.length||!0===n.includeEmptyState?u(a({sessionKey:e.sessionKey,threadKey:e.threadKey},s?{anchor:s.anchor,anchorCaptured:s.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?Gi():void 0,measurementKey:Vr()||void 0,heightCache:i.length?i:void 0}):null}function Yi(e){var n,t;const o=Ti();if(!o)return;const l=function(e){const n=de.value;if(!n)return null;const t=en(n,e.root),o=Fn.value.length,l=Tn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?Tn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=Ii();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){_o=Ga()+120,Oo=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Mi(o.root,o.doc,i,{isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze})}const Zi=[];function Qi(){if(Pe)for(null!=Co&&(null==Mt||Mt(Co),Co=null);Zi.length;){const e=Zi.pop();null!=e&&window.clearTimeout(e)}}function ea(e){const n=Boolean(So.value);So.value=null,_o=0,Oo=null,Qi(),n&&e&&iu(e)}function na(){if(!So.value||!Pe)return;if(null!=Co)return;const e=()=>{Co=null;const e=So.value;e&&Yi(e)};Co=wt?wt(e):null,null==Co&&e()}function ta(e,n={}){const t=Fn.value.length;return t<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=t)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(n.requireSignature&&!e.signature)&&!(n.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){var n;const t=Fn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==Ui(e.index))}(e))}function oa(e){const n=Ai(qr()),t=Ai(e);return-1!==n&&-1!==t&&n===t}function la(e){var n;const t=Number(null==e?void 0:e.width);if(Number.isFinite(t)&&t>0)return t;const o=Number(null==(n=null==e?void 0:e.metrics)?void 0:n.width);return Number.isFinite(o)&&o>0?o:null}function ra(e){var n;return e.sessionKey===zr()&&!!Dr(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Vr()&&!!oa(la(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(ia(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function ia(e){return Boolean(e.contentHash&&e.contentHash===Gi())}function aa(e){return!ia(e)}let ua=null,sa=null,ca=null,da=null,fa=null,ma=!1;function ha(e){var n;const t=e.map(e=>{var n,t;return[e.index,Math.round(10*e.height),null!=(n=e.nodeType)?n:"",null!=(t=e.signature)?t:""].join("")}).join(""),o=Ai(qr());return[null!=(n=jr())?n:"",zr(),Vr(),Fn.value.length,o,e.length,Pi(t)].join(":")}function va(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!rt.value||!(null==e?void 0:e.length))return!1;if(Fn.value.length<=0)return!1;if(!oa(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=ta(e,{requireSignature:!0});if(!t.length)return!ma&&"undefined"!=typeof console&&p&&(ma=!0,console.warn("[markstream-vue] virtualScroll.heightCache ignored: standalone heightCache entries must include compatible signature metadata. Use heightCache exported from virtual-state-change/render-settled, and pass heightCacheWidth from the same state.")),!1;const l=ha(t);return l===ua?(sa="standalone",!0):(Ml(t,{mode:"merge"}),To(),ua=l,sa="standalone",eu(),iu("restore"),!0)}function pa(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}function ga(e,n={}){var t,o,l;if(!rt.value||!e)return!1;if(e.sessionKey!==zr())return!1;if(!Dr(e.threadKey))return!1;if(Fn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!ya(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!ya()&&Number(la(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&ra(e)){const n=ta(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:aa(e)});n.length&&(Ml(n,{mode:"merge"}),To(),ua=ha(n),sa="restore",eu(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&iu("restore"),!0;if(!i)return u&&iu("restore"),!0;const s=function(e,n){var t;const o=e.anchor,l=o?"bottom"===o.type?`bottom:${Math.round(o.distanceFromBottomPx)}`:`node:${o.nodeIndex}:${Math.round(o.offsetWithinNodePx)}`:"none";return[null!=(t=jr())?t:"",zr(),Vr(),Ur.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return ca===s?(u&&iu("restore"),!0):(ca=s,function(e){const n=()=>{if("node"===e.type)return ea(),void Vo({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Ko(),Ho.value=null,So.value=e,Qi(),Yi(e),Pe)for(const e of[0,120,280,480])Zi.push(window.setTimeout(()=>{const e=So.value;e&&Yi(e)},e))};!function(e){if(!gt.value)return!1;const n=Fn.value.length;return!(n<=0||(Al.value="node"===e.type?br(e.nodeIndex,0,n-1):n-1,Rl(),0))}(e)?n():oe(n)}(i),iu("restore"),!0)}function ya(){const e=qr();return Number.isFinite(e)&&e>0}function ka(e){var n;return e.sessionKey===zr()&&!!Dr(e.threadKey)&&(Fn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||ya())||!(!(e.anchor&&Number(la(e))>0)||ya()))}function ba(){Xt.length=0;for(const e of Object.keys(Jo)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Fn.value.length&&Sl(n)}}function Na(){null!=Zl&&(null==Mt||Mt(Zl),Zl=null),du()}function Ba(){return!Pe||Bt?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(wt)return wt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function Ta(e,n=jr(),t=Jr.value){return zr()===e&&jr()===n&&Jr.value===t}function Ia(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=zr(),c=jr(),d=Jr.value,f=null!=(n=e.frames)?n:2,m=null!=(t=e.timeoutMs)?t:120,h=null!=(l=e.reason)?l:"manual",v=e.expectedSettledTokenKey,p=!0===e.flushPendingTimers,g=Ni(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>Ta(s,c,d)&&(null==v||Za()===v);for(let o=0;o<f;o++){if(yield oe(),!k())return y();if(yield Ba(),!k())return y();vu(),Na()}if(yield function(e){return!Pe||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&or(),vu(),Na(),!k())return y();const b=di();b&&(li=s,oi=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&si(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Za()===v&&(ii=Ou(o.virtualScroll.settledToken)));const N=k()&&b&&fi(),S=Ni(h,N?"final":void 0);return ou(S,!0),S})}let za="content",ja=null,Wa=null,Da=0,Va=null,qa=null,Ua=null,Ja=null;function Ga(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Xa(e){var n,t;const l=Va;if(!l)return!0;const r=null!=(t=null==(n=o.virtualScroll)?void 0:n.heightDiffThresholdPx)?t:1;return Math.abs(e.totalHeight-l.totalHeight)>r||e.sessionKey!==l.sessionKey||e.phase!==l.phase||e.stable!==l.stable||e.final!==l.final||e.threadKey!==l.threadKey||e.nodeCount!==l.nodeCount||e.measuredCount!==l.measuredCount||e.width!==l.width}function Za(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return $a(e)}function Qa(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Vr(),Gi(),$a(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function eu(){Ua=null,Ja=null,qa=null}function nu(e){const n=e.heightCache;return(null==n?void 0:n.length)?ha(n):""}function tu(e){var n,t,o;const l=e.metrics,r=e.anchor?"bottom"===(i=e.anchor).type?`bottom:${Math.round(i.distanceFromBottomPx)}`:`node:${i.nodeIndex}:${Math.round(i.offsetWithinNodePx)}`:"none";var i;return[e.sessionKey,null!=(n=e.threadKey)?n:"",null!=(t=e.measurementKey)?t:Vr(),null!=(o=e.contentHash)?o:"",nu(e),r,e.anchorCaptured?1:0,l.liveRange.start,l.liveRange.end,l.renderedCount,l.nodeCount,Math.round(l.totalHeight),Math.round(l.width),l.phase,l.stable?1:0].join("\0")}function ou(e,n=!1){if(!rt.value)return;if(function(e=!1){return!e&&Qn.value&&!at.value}(n))return;const t=n||Xa(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Xi(e,{includeHeightCache:!0})}:{state:Xi(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||tu(e)!==qa}(r,n)));if(t&&(G(e),Va=e,Da=Ga()),r&&i&&(Y(r),r.anchor&&te(r.anchor),qa=tu(r)),e.stable){const n=Qa("settled",e);if(n!==Ua){Ua=n;const t=Xi(e,{includeHeightCache:!0});t&&(Y(t),qa=tu(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Qa("final",e);if(n!==Ja){Ja=n;const t=Xi(e,{includeHeightCache:!0});t&&(Y(t),qa=tu(t)),function(e){l("render-final",e)}(e)}}}function lu(){null!=ja&&(null==Mt||Mt(ja),ja=null),null!=Wa&&Pe&&(window.clearTimeout(Wa),Wa=null)}function ru(){ja=null,Wa=null;const e=Ga();let n;e-jl>=120&&(jl=e,n=vu()),(zl.size>8||null==Zl)&&Na(),ou(Ni(za,void 0,n))}function iu(e){var n,t;if(!rt.value)return;if(za=e,null!=ja||null!=Wa)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(Ga()-Da)),i=()=>{Wa=null,ja=wt?wt(ru):null,null==ja&&ru()};Pe&&r>0?Wa=window.setTimeout(i,r):i()}function au(){go.value+=1}function uu(e){var n;if(Ht.value&&e>=Pt.value){const n=Fn.value[e],t=!0===on.value&&!0!==ln.value&&e>=Fn.value.length-2,o="code_block"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type)||"mermaid"===(null==n?void 0:n.type)||"infographic"===(null==n?void 0:n.type);if(!t||o)return!1}return!Cl.value||e<Tt.value||!!(un.value&&!0!==ln.value&&!(null==(n=o.nodes)?void 0:n.length)&&e>=Fn.value.length-vt.value)||sr.value.has(e)}function su(e){const n=dr.get(e);n&&(n(),dr.delete(e));const t=cr.get(e);t&&(t.destroy(),cr.delete(e)),mr(e)}function cu(e,n){let t=!1;if(n){const o=Dt.get(e);if(o===n&&Vt.get(e)===Il.value)return;Dt.set(e,n),o!==n&&(t=!0)}else Dt.delete(e)&&(t=!0);if(t&&au(),n||mr(e),!Tl.value||!xt)return su(e),n?Vt.set(e,Il.value):Vt.delete(e),void(n&&Cl.value&&hr(e,!0));if(!gt.value&&Cl.value&&!ye.value&&cr.size>=Ae.value&&(ye.value||(ye.value=!0,p&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),pr()),!Tl.value||!xt))return su(e),Vt.set(e,Il.value),void(n&&hr(e,!0));if(e<Tt.value&&!gt.value)return su(e),Vt.set(e,Il.value),void hr(e,!0);if(sr.value.has(e))return su(e),Vt.set(e,Il.value),void hr(e,!0);if(!n)return su(e),void Vt.delete(e);su(e);const o=xt(n,{rootMargin:Le.value});if(!o)return void Vt.delete(e);cr.set(e,o),Vt.set(e,Il.value),hr(e,o.isVisible.value),Cl.value&&function(e){if(!Pe||!Cl.value)return;mr(e);const n=e%17*23,t=window.setTimeout(()=>{if(fr.delete(e),!Cl.value)return;if(sr.value.has(e))return;const n=Dt.get(e);if(!n)return;const t=Xe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?Tn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?Tn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=Tn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&hr(e,!0)},1800+n);fr.set(e,t)}(e);let l=null;l=J(()=>o.isVisible.value,n=>{if(n){mr(e),hr(e,!0),null==l||l(),dr.delete(e),cr.get(e)===o&&cr.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),dr.set(e,l),gt.value&&ur()}function du(){Zl=null,gl(()=>{let e=!1;for(const[n,t]of zl)zl.delete(n),Pl.get(n)===t.el&&$l.get(n)===t.version&&(e=xl(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function fu(){null!=Zl&&(null==Mt||Mt(Zl),Zl=null),zl.clear()}function mu(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Pl.get(e)!==n)return;const r=$l.get(e);if(null==r)return;const i=Fn.value[e],a=un.value&&!0!==ln.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Fn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=zl.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;zl.set(e,{height:d,allowShrink:c,version:r,el:n}),null==Zl&&(Zl=wt?wt(du):null,null==Zl&&du())}function hu(e,n){mu(e,n,wl(e,n))}function vu(){let e=0;for(const[n,t]of Pl){const o=wl(n,t);e+=o,mu(n,t,o)}return e}function pu(){null==Jt||Jt.disconnect(),Jt=null,qt.clear()}function gu(){for(;Kl.length;)tr(Kl.pop())}J(at,e=>{e&&iu("content")},{flush:"post"}),n({getVirtualMetrics:Ni,captureVirtualState:function(e={}){var n;return Xi(Ni("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:null==(n=e.includeEmptyState)||n})},restoreVirtualState:function(e,n={}){const t=!0===n.restoreAnchor,o=null==n.restoreToken?"imperative":String(n.restoreToken);da=e,fa={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!ga(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&ka(e)||(da=null,fa=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield oe(),yield Ba(),vu(),Na(),yield oe();const n=Ni(e);return ou(n,!0),n})},settle:Ia,scrollToNode:function(e,n="start"){ea(),Ko();const t=Fn.value.length;if(t<=0)return;const o=br(e,0,t-1),l=()=>{var e;const t=Fo({nodeIndex:o,offsetWithinNodePx:0}),l=Io(o),r=Ti(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Po();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}$o(Math.max(0,u)),ur({immediate:!0}),gt.value&&(Al.value=o,Rl())};if(gt.value)return Al.value=o,Rl(),void oe(l);l()}}),J(()=>yt.value,e=>{if(e)Fl.clear();else{pu();for(const e of El.values())for(const n of e)tr(n);El.clear(),$l.clear(),gu(),fu()}},{immediate:!0}),J(ln,e=>{e&&function(){if(Pe&&ln.value&&Pl.size){gu();for(const e of Jt?[80]:[80,240,640]){const n=nr(e,()=>{for(const[e,n]of Pl)n&&hu(e,n)},"final");null!=n&&Kl.push(n)}}}(),iu(e?"final":"content")});const yu=Ci(()=>iu("content"),16),ku=Ci(()=>iu("batch"),16);J([()=>Fn.value.length,()=>Pt.value],()=>{So.value&&na(),yu()},{flush:"post",immediate:!0}),J([()=>Hl.start,()=>Hl.end],()=>{ku()},{flush:"post"});const{cleanupBatchScheduler:bu}=function(e){const{props:n,isClient:t,isTestEnv:o,parsedNodesIdentity:l,parsedNodeCount:r,desiredRenderedCount:i,datasetKey:a,batchingEnabled:u,incrementalRenderingActive:s,resolvedBatchSize:c,resolvedInitialBatch:d,renderedCount:f,adaptiveBatchSize:m,previousRenderContext:h,previousBatchConfig:v,requestFrame:p,cancelFrame:g,hasIdleCallback:y,cleanupNodeVisibility:k,onDatasetKeyChanged:b,onDatasetChanged:N}=e;let S=null,x="raf",w=null,M=0,C=!1,B=!1;const _=/* @__PURE__ */new Set,O=/* @__PURE__ */new Set;function T(){if(t){null!=S&&("raf"===x&&g?g(S):"idle"===x&&"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(S):"timeout"===x&&window.clearTimeout(S),S=null),M+=1;for(const e of _)g&&g(e);for(const e of O)window.clearTimeout(e);_.clear(),O.clear(),w=null,C=!1,B=!1}}function I(){return"undefined"!=typeof performance?performance.now():Date.now()}function L(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.5*o?m.value=Math.max(r,Math.floor(.8*m.value)):e<.6*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),C=!1;const t=B||f.value<i.value;B=!1,t&&R()}function A(e,l={}){var r,a;if(!s.value)return;const u=i.value;if(f.value>=u)return;const c=Math.max(1,e),d=()=>{const e=I();S=null;const o=null!=w?w:c;w=null;const l=I();f.value=Math.min(u,f.value+o),k(f.value),function(e,o){if(!t)return void L(o);C=!0;const l=++M;oe().then(()=>{var t;if(l!==M)return;const r=I(),i=Math.max(o,r-e),a=()=>{l===M&&L(i)};if(p){let e=null,o=null,l=!1;const r=()=>{l||(l=!0,null!==e&&(_.delete(e),e=null),null!==o&&(O.delete(o),window.clearTimeout(o),o=null),a())};return e=p(()=>{r()}),_.add(e),o=window.setTimeout(()=>{null!==e&&g&&g(e),r()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void O.add(o)}const u=window.setTimeout(()=>{O.delete(u),a()},0);O.add(u)})}(e,I()-l)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(w=null!=w?Math.max(w,c):c,null==S){if(!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return x="idle",void(S=window.requestIdleCallback(()=>d(),{timeout:e}))}if(p&&!o)return x="raf",void(S=p(()=>{0===m?d():(x="timeout",S=window.setTimeout(()=>d(),m))}));x="timeout",S=window.setTimeout(()=>d(),m)}}function H(e,n={}){C?B=!0:null==e?R():A(e,n)}function R(){s.value&&A(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return J([l,r,a,s,c,d,()=>n.renderBatchDelay],()=>{var e;const o=r.value,l=h.value,u=a.value,p=!Object.is(u,l.key),g=o!==l.total,y=g&&o>l.total&&l.total>0&&!p,S=p||g;h.value={key:u,total:o};const x=v.value,w=null!=(e=n.renderBatchDelay)?e:16,M=x.batchSize!==c.value||x.initial!==d.value||x.delay!==w||x.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:w,enabled:s.value},p&&b(o),(S||M||!s.value)&&T(),(S&&!y||M)&&(m.value=Math.max(1,c.value||1)),S&&!y&&N();const C=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=C,void k(f.value);const B=p||0===l.total;f.value=B||M?Math.min(C,d.value):Math.min(f.value,C);const _=Math.max(1,d.value||c.value||o);f.value<C?H(_,{immediate:!t}):k(f.value)},{immediate:!0}),J(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&H())}),{cleanupBatchScheduler:T}}({props:D,isClient:Pe,isTestEnv:Bt,parsedNodesIdentity:jn,parsedNodeCount:Wn,desiredRenderedCount:Ql,datasetKey:Gr,batchingEnabled:It,incrementalRenderingActive:Ht,resolvedBatchSize:Ot,resolvedInitialBatch:Tt,renderedCount:Pt,adaptiveBatchSize:Ft,previousRenderContext:$t,previousBatchConfig:Et,requestFrame:wt,cancelFrame:Mt,hasIdleCallback:Ct,cleanupNodeVisibility:vr,onDatasetKeyChanged:e=>{fu(),Nl(),To(),eu(),e>0&&rl(e)},onDatasetChanged:()=>{gt.value&&ur({immediate:!0})}});J([Ll,gt,()=>de.value,()=>He()],([e,n])=>{if(!e)return gr(),void ar();yr(),n?ur({immediate:!0}):ar()},{flush:"post",immediate:!0});let Nu=!1;function Su(){gt.value&&Pe&&!Nu&&(Nu=!0,wt?wt(()=>{Nu=!1,ur({immediate:!0})}):queueMicrotask(()=>{Nu=!1,ur({immediate:!0})}))}J([()=>Fn.value.length,()=>gt.value],([e,n])=>{n&&e&&Pe&&Su()},{flush:"post"}),J(ut,e=>{e&&function(){var e;if(Dn.value&&Vn.value&&qn.value&&(null==(e=Un.value)?void 0:e[1]))return;const n=me({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=me({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=me({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Dn.value=n,Vn.value=t,qn.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]=me({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Un.value=l}()},{immediate:!0}),J([()=>de.value,Bl],()=>{if(!Bl.value)return Br(),void(Ce.value=0);Mr(),Br(),Bl.value&&de.value&&"undefined"!=typeof ResizeObserver&&(Cr=new ResizeObserver(()=>{Mr(),ut.value&&(Ho.value&&jo(),So.value&&na(),iu("resize"))}),Cr.observe(de.value))},{immediate:!0}),J([ut,ft,Jr],()=>s(null,null,function*(){if(!ut.value)return Be.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void To();yield oe(),function(){if(!ut.value||"undefined"==typeof window)return Be.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void To();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=xr(Sr(fe.value),".paragraph-node");e.paragraph=bi(fe.value,n,"pre-wrap");const t=Sr(he.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=bi(he.value,o,"pre-wrap");const l=Tn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=ve.value)?void 0:e.offsetHeight)?n:0}),r=Tn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=he.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=xr(Sr(pe[i]),`h${i}`);e.headings[i]=bi(pe[i],n,"pre-wrap")}Be.value=e,To()}()}),{flush:"post",immediate:!0}),J(()=>Fn.value.length,()=>{gt.value&&Su()}),J([ut,Ce],()=>{To(),gt.value&&ur({immediate:!0}),Ho.value&&jo(),So.value&&na(),iu("resize")},{immediate:!1}),J(()=>Cl.value,e=>{if(e)for(const[n,t]of Dt)cu(n,t);else if(pr(),gt.value)ur({immediate:!0});else for(const[n,t]of Dt)t&&hr(n,!0)},{immediate:!1}),J([Le,Ae,()=>He()],()=>{var e;null==(e=xt.refresh)||e.call(xt);for(const[n,t]of Dt)cu(n,t)},{immediate:!1}),J([()=>D.viewportPriority,()=>Fn.value.length,Ae],([e,n,t])=>{if(!1!==e){if(ye.value&&(n<=200||n<=t)){ye.value=!1;for(const[e,n]of Dt)cu(e,n)}}else ye.value=!1}),J(()=>Pt.value,()=>{gt.value&&ur({immediate:!0})}),J([Al,ht,vt,()=>Fn.value.length,gt],()=>{Rl()},{immediate:!0});let xu=null,wu=!1,Mu=null;function Cu(){xu=null,li=null,oi=void 0,ii=null,eu()}function Bu(){fu(),Nl(),To(),Xt.length=0;const e=Fn.value.length;e>0&&rl(e),ba()}function _u(){lu(),or(),Va=null,ua=null,sa=null,ca=null,da=null,fa=null,wu=!1,Cu(),Qr("restore"),Ko(),ea()}function Ou(e){var n;return[null!=(n=jr())?n:"",zr(),Vr(),Ur.value,Za(e),Fn.value.length,Math.round(Lo(0,Fn.value.length)),Math.round(qr()),Go.count,Math.round(Go.total)].join(":")}function Tu(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Za(r),a=zr(),u=jr(),s=Jr.value;if(rt.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&si(r))if(di()){if(Ou(r)!==ii&&!wu){wu=!0;try{const e=yield Ia({reason:"manual",expectedSettledTokenKey:i}),n=Za()===i;Ta(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(ii=Ou(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{wu=!1,yield oe();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=si(e)?Ou(e):"";Ta(a,u,s)&&n&&ii!==n&&Tu()}}}else iu("manual")})}J(rt,(e,n)=>{if(e!==n){if(!e)return _u(),void lu();_u(),Bu(),Mu=Jr.value,iu("content")}},{flush:"post"}),J([rt,Jr],([e,n])=>{e?null!=Mu?Mu!==n&&(Mu=n,function(e="resize"){fu(),Nl(),To(),Xt.length=0;const n=Fn.value.length;n>0&&rl(n),ba(),ua=null,sa=null,ca=null,Va=null,wu=!1,Cu(),va(),oe(()=>{vu(),Ho.value&&jo(),So.value&&na(),iu(e)})}("resize")):Mu=n:Mu=null},{flush:"post",immediate:!0}),J([rt,()=>zr(),()=>jr()],([e])=>{e&&(_u(),Bu(),Qr("content"),iu("content"))}),J([rt,()=>zr(),()=>jr(),Jr,()=>Fn.value.length],([e])=>{e&&function(e="async-node"){var n;let t=!1;for(const[o,l]of Array.from(Jl.entries()))Yr(l)||(Xl-=Math.max(0,null!=(n=Ul.get(o))?n:0),Jl.delete(o),Ul.delete(o),t=!0);t&&(Xr(),iu(e))}("async-node")},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>we.value],([e])=>{e&&(eu(),function(e="content"){if(!rt.value)return;const n=[],t=Fn.value.length,o=Nr(t),l=Xt.length-1,r=Math.max(t-1,l);for(let i=o;i<=r;i++){if(i>=t){i<=l&&void 0!==Xt[i]&&n.push(i);continue}const e=Ui(i),o=Xt[i];null!=o&&o!==e&&n.push(i),Xt[i]=e}if(l>=t){for(let e=t;e<=l;e++)Xt[e]=void 0;Xt.length=t}n.length&&(function(e,n={}){const t=Array.from(e,Number);vl(t);let o=0;if(gl(()=>(o=sl(t,n),o>0)),o>0)!function(e){for(const n of e)Number.isInteger(n)&&n>=0&&n<Xt.length&&(Xt[n]=void 0)}(t);else for(const l of t)mo.delete(l)}(n,{notify:!1}),To(o),Cu(),Ho.value&&jo(),So.value&&na(),iu(e))}("content"))},{flush:"post",immediate:!0}),J([rt,()=>Fn.value.length,()=>zr(),()=>jr()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Cu()},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCache},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCacheWidth},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Fn.value.length,()=>zr(),Ce],()=>{va()},{flush:"post",immediate:!0}),J(pa,(e,n)=>{null==e&&null!=n&&(Ko(),Ho.value=null,ea(),ca=null)},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreAnchor},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Fn.value.length,()=>zr(),Ce],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield oe();const t=pa();ga(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),J([rt,Ce,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey}],([e])=>{var n;if(!e)return;const t=null==(n=o.virtualScroll)?void 0:n.restoreState;t&&ua&&"restore"===sa&&(ra(t)||(Bu(),ua=null,sa=null,iu("resize")))},{flush:"post"}),J([rt,()=>Fn.value.length,()=>zr(),Ce],e=>s(null,[e],function*([e]){var n;const t=da,o=fa;e&&t&&(yield oe(),!ga(t,{restoreAnchor:!0===(null==o?void 0:o.restoreAnchor),restoreToken:null!=(n=null==o?void 0:o.restoreToken)?n:"imperative",allowUncapturedAnchor:!0===(null==o?void 0:o.allowUncapturedAnchor)})&&ka(t)||(da=null,fa=null))}),{flush:"post",immediate:!0}),J([rt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>zr(),()=>jr(),Jr,Yl,ql,()=>Pt.value,Ql,()=>Go.count,()=>Go.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!hi())return;const o=function(){var e;const n=Fn.value.length;return[null!=(e=jr())?e:"",zr(),Vr(),Ur.value,n,Math.round(Lo(0,n)),Math.round(qr()),Go.count,Math.round(Go.total)].join(":")}();xu!==o&&(xu=o,Ia({reason:"final"}).then(e=>{e.stable||xu!==o||(xu=null)}))},{flush:"post",immediate:!0}),J([rt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>zr(),()=>jr(),Jr,Yl,ql,()=>Pt.value,Ql,()=>Fn.value.length,()=>Go.count,()=>Go.total],()=>{Tu()},{flush:"post",immediate:!0}),J([()=>Fn.value.length,gt,ht,vt,()=>Hl.start,()=>Hl.end],([e,n,t,o,l,r])=>{We.value&&yn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Al.value,scroll:n?(()=>{const e=bo.value||Xe();return e?{reverse:Ye(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:Pt.value})}),J([()=>D.customId],([e],n,t)=>{if(!e||Jn)return;const o=function(e,n){return e?(ri.controllers[e]=n,()=>{ri.controllers[e]===n&&delete ri.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Wo,restoreAnchor:Vo,getAnchorDrift:qo,getReport:Fr});t(()=>{o()})},{immediate:!0}),ne(()=>{!function(){if(rt.value)try{vu(),Na();const e=Ni("manual");Xa(e)&&(G(e),Va=e,Da=Ga());const n=Xi(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(Y(n),n.anchor&&te(n.anchor),qa=tu(n))}catch(e){}}(),bu(),pr(),pn(),pu();for(const e of El.values())for(const n of e)tr(n);El.clear(),$l.clear(),Xt.length=0,gu(),fu(),Br(),Ko(),ea(),lu(),gr(),ar()});const Iu=Zt("ViewportDeferredMermaidBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./index10.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),Lt}}),loadingComponent:Ha,delay:0}),Ha),Lu=Zt("ViewportDeferredInfographicBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./index9.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Showing the Infographic source fallback. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),Aa}}),loadingComponent:Aa,delay:0}),Aa),Au=Zt("ViewportDeferredD2BlockNode",le(()=>s(null,null,function*(){try{return(yield import("./index7.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),Lt}})),Lt),Hu={text:At,paragraph:il,heading:Uo,code_block:no,list:Qo,list_item:Zo,blockquote:Ro,table:hl,definition_list:Eo,footnote:Do,footnote_reference:fn,footnote_anchor:zo,admonition:Ya,vmr_container:kl,hardbreak:Bo,link:ko,image:pt,thematic_break:pl,math_inline:to,math_block:oo,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:sn,checkbox:an,checkbox_input:an,inline_code:_n,html_inline:Mn,reference:ro,html_block:ol},Ru=P(()=>Er()),Pu=P(()=>Si(D.codeBlockProps)),$u=P(()=>Si(D.codeBlockProps)),Fu=P(()=>u(a(a({stream:D.codeBlockStream,darkTheme:D.codeBlockDarkTheme,lightTheme:D.codeBlockLightTheme,themes:D.themes,minWidth:D.codeBlockMinWidth,maxWidth:D.codeBlockMaxWidth},"boolean"==typeof De.value?{showTooltips:De.value}:{}),$u.value),{codeBlockOptions:D.codeBlockOptions})),Eu=P(()=>u(a(a({},Fu.value),Pu.value),{codeBlockOptions:D.codeBlockOptions}));function Ku(e){return"boolean"==typeof e?e:void 0}const zu=P(()=>{var e,n,t,o,l,r,i;const a=D.codeBlockProps||{},u={},s=Ku(a.showLineNumbers);u.showLineNumbers=null!=s?s:!0!==(null==(e=D.codeBlockOptions)?void 0:e.disableLineNumbers),u.showHeader=null==(n=Ku(a.showHeader))||n,u.showCopyButton=null==(t=Ku(a.showCopyButton))||t;const c=null!=(o=Ku(a.showTooltips))?o:De.value;"boolean"==typeof c&&(u.showTooltips=c),u.codeBlockOptions=D.codeBlockOptions,u.isDark=D.isDark,u.darkTheme=null!=(l=a.darkTheme)?l:D.codeBlockDarkTheme,u.lightTheme=null!=(r=a.lightTheme)?r:D.codeBlockLightTheme,u.theme=a.theme,u.themes=null!=(i=a.themes)?i:D.themes;const d=Ku(a.diffInline);void 0!==d&&(u.diffInline=d),void 0!==a.diffHideUnchangedRegions&&(u.diffHideUnchangedRegions=a.diffHideUnchangedRegions);const f=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(a.reservedHeightPx);return void 0!==f&&(u.reservedHeightPx=f),u}),ju=P(()=>a({},D.mermaidProps||{})),Wu=P(()=>a({},D.d2Props||{})),Du=P(()=>a({},D.infographicProps||{})),Vu=P(()=>({typewriter:k.value,fade:D.fade,customHtmlTags:$n.value.customHtmlTags})),qu=P(()=>a(a({},Vu.value),"boolean"==typeof De.value?{showTooltip:De.value}:{})),Uu=P(()=>a(a({},Vu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),Ju=P(()=>a(a({},Vu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),Gu=P(()=>a(a({},Vu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{}));function Xu(e){return Array.isArray(e.children)&&e.children.length>0}const Yu=/* @__PURE__ */new WeakMap,Zu=/* @__PURE__ */new WeakMap,Qu=[],es=[];let ns=null,ts=[];function os(e,n){var t;const o=String(null!=(t=null==e?void 0:e.code)?t:""),l=Zu.get(e);if(l&&l.code===o)return l.height;const r=n(o);return Zu.set(e,{code:o,height:r}),r}function ls(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!Object.is(e[t],n[t]))return!1;return!0}function rs(e,n){var t,o,l,s,f;const m=function(e,n,t){const o=ut.value?Ar.value[n]:null;return[n,e.loading,o,t]}(e.node,e.index,n),h=Yu.get(e.node);if(h&&ls(h.signature,m))return h.item;let v=function(e,n){var t,o;if("code_block"!==e.type)return Gt[n]=void 0,e;const l=e,r=[l.language,l.loading,l.diff,l.code,l.originalCode,l.updatedCode,l.raw,l.startLine,l.endLine,null==(t=l.sourceMap)?void 0:t.startLine,null==(o=l.sourceMap)?void 0:o.endLine],i=Gt[n];if(i&&r.every((e,n)=>e===i.signature[n]))return i.node;const u=a({},l);return Gt[n]={signature:r,node:u},u}(e.node,e.index);const p=as(v);let g=ds(v,p);if(("html_block"===v.type||"html_inline"===v.type)&&g===Hu[v.type]){const e=v,n=String(null!=(t=e.tag)?t:"").trim().toLowerCase()||M(e.content);if(n){const t=Hn.value[n];if(Rn.value.has(n)&&t)g=t,v=u(a({},e),{type:n,tag:n,content:L(e.content,n)});else if(C(null!=(o=e.content)?o:e.raw,n)){const n=String(null!=(s=null!=(l=e.content)?l:e.raw)?s:"");"html_inline"===v.type?(g=At,v={type:"text",content:n,raw:n}):(g=il,v={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const y="code_block"===v.type&&N.value&&g===eo&&!xi(Hn.value,p);let k=a({},function(e,n,t){const o=null!=n?n:as(e);if("code_block"===e.type){const n=o?xi(Hn.value,o):void 0;if(t&&N.value&&!n&&t===eo)return zu.value;if(t&&o&&t===n)return"mermaid"===o?ss(e):"infographic"===o?cs(e):"d2"===o||"d2lang"===o?Wu.value:Eu.value;if(t&&t===Hn.value.code_block)return Eu.value}return"mermaid"===o?ss(e):"infographic"===o?cs(e):"d2"===o||"d2lang"===o?Wu.value:"link"===e.type?qu.value:"list"===e.type?Uu.value:"blockquote"===e.type?Ju.value:"table"===e.type?Gu.value:"code_block"===e.type?Fu.value:Vu.value}(v,p,g));const b=ut.value?Ar.value[e.index]:null;"code_block"===v.type&&"code-block"===(null==b?void 0:b.kind)&&(k=u(a({},k),y?{reservedHeightPx:b.contentHeight}:{estimatedHeightPx:b.height,estimatedContentHeightPx:b.contentHeight,estimatedDiffInline:b.diffInline})),y||"code_block"!==v.type||"mermaid"!==p||null!=ze(k.estimatedPreviewHeightPx)||(k=u(a({},k),{estimatedPreviewHeightPx:$e(os(v,Fe))})),y||"code_block"!==v.type||"infographic"!==p||null!=ze(k.estimatedPreviewHeightPx)||(k=u(a({},k),{estimatedPreviewHeightPx:Ee(os(v,Ke))})),"math_block"===v.type&&(k=u(a({},k),{cacheScope:An}));const S=function(e,n){const t=String(e.type);return!Je(t)&&Hn.value[t]===n}(v,g),x=S?kn(v,Ve.value):void 0,w=v.loading,B=`${Ru.value}-${e.index}`,_=a({node:v,loading:w,"index-key":B},"reference"===v.type?{"data-markstream-reference-id":String(v.id)}:{}),O={"custom-id":D.customId,"is-dark":D.isDark},T={onCopy:r,onHandleArtifactClick:i},I={onClick:fs,onMouseover:vs,onMouseout:ps},A={onMouseover:c,onMouseout:d},H=a(a({},null!=x?x:{}),k),R=ae(_,k,O,T),P=ae(H,_,O,T),$={node:v,sourceLoading:w,index:e.index,component:g,bindings:k,customBindings:H,nodeProps:R,customNodeProps:P,fragmentNodeProps:ae(R,I),customFragmentNodeProps:ae(P,I),minimalNodeProps:ae(R,A),rendersCustomNode:S,hasSlotChildren:Xu(v),slotContent:String(null!=(f=v.content)?f:""),isCodeBlock:"code_block"===v.type,indexKey:B,vnodeKey:`${Wr.value}\0${e.index}\0${v.type}`};return Yu.set(e.node,{signature:m,item:$}),$}const is=P(()=>{var e,n,t,o,l;const r=ns,i=function(){const e=[N.value,Hn.value,Rn.value,Ve.value,Wr.value,Ru.value,An,_r.value,D.customId,D.isDark,zu.value,Fu.value,Eu.value,ju.value,Du.value,Wu.value,Vu.value,qu.value,Uu.value,Ju.value,Gu.value,ut.value,ai.value,Ce.value];return ns&&ls(ns,e)?ns:(ns=e,e)}(),a=r!==i;if(ns=i,gt.value)return Hr.value.map(e=>rs(e,i));const u=Fn.value,s=u.length;let c=!1;Qu.length>s&&(Qu.length=s,es.length=s,c=!0);const d=Qu,f=Math.min(d.length,s);let m=a?0:f;if(!a)for(let v=0;v<f;v++){const r=u[v];if("code_block"===r.type){if((null==(e=d[v])?void 0:e.node)!==(null==(n=Gt[v])?void 0:n.node)||es[v]!==r||!Object.is(null==(t=d[v])?void 0:t.sourceLoading,r.loading)){m=v;break}}else if((null==(o=d[v])?void 0:o.node)!==r||!Object.is(null==(l=d[v])?void 0:l.sourceLoading,r.loading)){m=v;break}}if(!c&&m===s)return ts;for(let v=m;v<s;v++)d[v]=rs({node:u[v],index:v},i),es[v]=u[v];const h=d.slice();return ts=h,h});function as(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function us(e,n,t,o){var l;const r=a({},e.value);return null==ze(r.estimatedPreviewHeightPx)&&(r.estimatedPreviewHeightPx=o(os(n,t),void 0,"none"===r.maxHeight?null:null!=(l=ze(r.maxHeight))?l:void 0)),r}function ss(e){return us(ju,e,Fe,$e)}function cs(e){return us(Du,e,Ke,Ee)}function ds(e,n){if(!e)return yl;const t=Hn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:as(e),r=l?xi(t,l):void 0;if(r)return r;if(N.value)return t.code_block||eo;if("mermaid"===l)return t.mermaid||Iu;if("infographic"===l)return t.infographic||Lu;if("d2"===l||"d2lang"===l)return t.d2||Au;if(o)return o;return t.code_block||_r.value}return o||Hu[String(e.type)]||yl}function fs(e){const n=e.target instanceof Element?e.target.closest("[data-markstream-reference-id]"):null,t=e.currentTarget,o=n&&t instanceof Element&&t.contains(n)?n.dataset.markstreamReferenceId:void 0;l("click",e,o)}function ms(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function hs(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function vs(e){l("mouseover",e)}function ps(e){l("mouseout",e)}const gs=U(null),ys=U(!1),ks=U(null),bs=P(()=>!("minimal"!==D.domMode||je.value||!1!==D.fade||k.value||ys.value||Kt.value||gt.value||tt.value||Yn.value||St.value||0!==Object.keys(Hn.value).length));let Ns,Ss=null,xs=0,ws=0,Ms=0;const Cs=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Bs=new Set(Cs),_s=[".typewriter-cursor",".height-estimation-probes",...Cs.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Os(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Bs.has(n)}function Ts(e){var n,t;if(!e||"object"!=typeof e)return 0;const o=e,l=null!=(t=null!=(n=o.raw)?n:o.content)?t:o.code;if("string"==typeof l)return l.length;const r=o.children;if(Array.isArray(r))return r.reduce((e,n)=>e+Ts(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Ts(n),0):0}function Is(){Ns&&(clearTimeout(Ns),Ns=void 0)}function Ls(){xs+=1,null!=Ss&&(null==Mt||Mt(Ss),Ss=null)}function As(){Ls(),$s(),gs.value&&(gs.value.style.visibility="hidden")}function Hs(e){var n;if(e.nodeType!==Node.TEXT_NODE)return!1;if(!(null!=(n=e.textContent)?n:"").trim())return!1;const t=e.parentElement;return!!t&&!t.closest(_s)}function Rs(e){let n=e.lastChild;for(;n;){if(Hs(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(_s)&&e.lastChild){n=e.lastChild;continue}}for(;n&&n!==e&&!n.previousSibling;)n=n.parentNode;if(!n||n===e)break;n=n.previousSibling}return null}function Ps(){const e=is.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Os(t.node)||!uu(t.index))continue;const o=Dt.get(t.index);if(!o)continue;const l=Rs(o);if(l)return l}return null}function $s(){ks.value&&(ks.value.classList.remove(Ka),ks.value=null)}function Fs(){if("simple"!==y.value||!Pe||!ys.value||!de.value)return void $s();const e=Ps(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==ks.value&&($s(),n&&(n.classList.add(Ka),ks.value=n))}function Es(){if("precise"!==y.value)return;if(!Pe||!ys.value)return;if(null!=Ss)return;const e=xs,n=()=>{Ss=null,e===xs&&function(){var e,n;if("precise"!==y.value)return;if(!(Pe&&ys.value&&de.value&&gs.value))return;const t=de.value,o=gs.value;o.style.visibility="hidden";const l=Ps();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=Tn("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};wt?Ss=wt(n):n()}return J([tn,()=>o.content,()=>o.nodes,()=>D.typewriter,ln],()=>s(null,null,function*(){var e,n;if(!Pe||je.value||!Ue.value)return;if(!k.value)return void((ys.value||Ns||null!=Ss||ks.value||gs.value)&&(ys.value=!1,Is(),As()));if(ln.value)return ys.value=!1,Is(),void As();if(null==(e=o.nodes)?void 0:e.length)return ys.value=!1,Is(),As(),ws=(null!=(n=o.content)?n:"").length,void(Ms=tn.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Ts(n),0):(null!=(n=o.content)?n:"").length}(),l=function(){var e;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Ts(n),0):tn.value.length}(),r=!Os(Fn.value[Fn.value.length-1]),i=t>ws,a=l>Ms;if(!k.value||!r||!i&&!a)return k.value&&r||(ys.value=!1,As()),ws=t,void(Ms=l);ws=t,Ms=l,ys.value=!0,"precise"===y.value&&gs.value&&(gs.value.style.visibility="hidden"),Is(),yield oe(),"simple"===y.value?Fs():($s(),Es()),Ns=setTimeout(()=>{Ns=void 0,ys.value=!1},3e3)}),{flush:"post",immediate:!0}),J(ys,e=>s(null,null,function*(){e?(yield oe(),"simple"!==y.value?($s(),"precise"===y.value&&Es()):Fs()):As()}),{flush:"post"}),J(y,()=>s(null,null,function*(){if(Pe&&!je.value&&Ue.value&&ys.value){if(yield oe(),"simple"===y.value)return Ls(),void Fs();$s(),"precise"!==y.value?As():Es()}}),{flush:"post"}),J([()=>Pt.value,()=>Hl.start,()=>Hl.end],()=>s(null,null,function*(){Pe&&!je.value&&Ue.value&&ys.value&&(yield oe(),"simple"!==y.value?($s(),"precise"===y.value&&Es()):Fs())}),{flush:"post"}),ne(()=>{Is(),Ls(),$s(),Ln.clear()}),(e,n)=>{const t=Se("NodeRenderer",!0);return V(je)?(F(!0),E(X,{key:0},ce(is.value,e=>(F(),E(X,{key:e.vnodeKey},[e.rendersCustomNode?(F(),re(ie(e.component),ae({key:0,ref_for:!0},e.customFragmentNodeProps),{default:ue(()=>[e.hasSlotChildren?(F(),re(t,ae({key:0,ref_for:!0},zn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(t,ae({key:1,ref_for:!0},zn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040)):(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.fragmentNodeProps),null,16))],64))),128)):(F(),E("div",{key:1,ref_key:"containerRef",ref:de,class:W(["markstream-vue markdown-renderer",[{dark:D.isDark},{virtualized:gt.value},{"virtual-scroll-coordinated":at.value},{"stable-layout":Ol.value},{"typewriter-simple-cursor":ys.value&&"simple"===y.value}]]),"data-custom-id":D.customId,onClick:fs,onMouseover:ms,onMouseout:hs},[st.value||gt.value?(F(),E(X,{key:0},[st.value?(F(),re(La,{key:0,width:ft.value,"flow-root":gt.value||at.value,"paragraph-node":Dn.value,"list-item-node":Vn.value,"list-node":qn.value,"heading-nodes":Un.value,"set-paragraph-wrapper":lr,"set-list-item-wrapper":rr,"set-list-wrapper":ir,"set-heading-wrapper":wr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Z("",!0),gt.value?(F(),E("div",{key:1,class:"node-spacer",style:se({height:`${Rr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],64)):Z("",!0),bs.value?(F(!0),E(X,{key:1},ce(is.value,e=>(F(),E(X,{key:e.vnodeKey},[uu(e.index)?(F(),re(ie(e.component),ae({key:0,ref_for:!0},e.minimalNodeProps),null,16)):Z("",!0)],64))),128)):(F(!0),E(X,{key:2},ce(is.value,e=>(F(),E("div",{key:e.vnodeKey,ref_for:!0,ref:n=>cu(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[uu(e.index)?(F(),E("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t,o;if(n){const t=Fn.value[e],o=Fl.get(e);if(o&&o.el===n&&o.node===t&&o.loading===(null==t?void 0:t.loading))return}n||function(e){var n;const t=`${Er()}-${e}`;let o=!1;for(const l of Array.from(Ul.keys())){const r=Jl.get(l);((null==r?void 0:r.index)===e||l===t||l.startsWith(`${t}-`))&&(Xl-=Math.max(0,null!=(n=Ul.get(l))?n:0),Ul.delete(l),Jl.delete(l),o=!0)}o&&(Xr(),iu("async-node"))}(e),zl.delete(e),function(e){var n;const t=(null!=(n=$l.get(e))?n:0)+1;$l.set(e,t)}(e);const l=El.get(e);if(l){for(const e of l)tr(e);El.delete(e)}if(function(e){const n=qt.get(e);n&&(null==Jt||Jt.unobserve(n),Ut.delete(n),qt.delete(e))}(e),!n||!yt.value)return Pl.delete(e),$l.delete(e),void Fl.delete(e);Pl.set(e,n),Fl.set(e,{el:n,node:Fn.value[e],loading:null==(t=Fn.value[e])?void 0:t.loading});const r=()=>{hu(e,n)};queueMicrotask(r);const i=(Jt||"undefined"==typeof ResizeObserver||(Jt=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Ut.get(n.target),t=qt.get(null!=e?e:-1);null!=e&&t&&hu(e,t)}else vu()})),Jt);if(i&&(qt.set(e,n),Ut.set(n,e),i.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(o=Fn.value[e])?void 0:o.type)?[16,80,240,800]:ln.value?[80]:[];if(n.length){const t=n.map(e=>nr(e,r,"node-resize")).filter(e=>null!=e);t.length&&El.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.customNodeProps),{default:ue(()=>[e.hasSlotChildren?(F(),re(t,ae({key:0,ref_for:!0},zn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(t,ae({key:1,ref_for:!0},zn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Z("",!0)]),_:2},1040)):(F(),re(ie(e.component),ae({key:2,ref_for:!0},e.nodeProps),null,16)):(F(),re(Ra,{key:0,item:e,"source-nodes":o.nodes,fade:D.fade,final:V(on),"nested-renderer-props":e.rendersCustomNode?zn.value:void 0},null,8,["item","source-nodes","fade","final","nested-renderer-props"]))],512)):(F(),E("div",{key:1,class:"node-placeholder",style:se({height:`${Io(e.index)}px`})},null,4))],8,Ea))),128)),ys.value&&"precise"===y.value?(F(),E("span",{key:3,ref_key:"typewriterCursorRef",ref:gs,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Z("",!0),gt.value?(F(),E("div",{key:4,class:"node-spacer",style:se({height:`${Pr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],42,Fa))}}})),[["__scopeId","data-v-7173605a"]]),ja=za;ja.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",ja.__name,ja.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,za)};const Wa=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ja},Symbol.toStringTag,{value:"Module"})),Da={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"},Va={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"},qa={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"},Ua={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"},Ja={class:"admonition-title"},Ga=["aria-expanded","aria-controls"],Xa=["id"],Ya=/* @__PURE__ */rn(/* @__PURE__ */$({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=P(()=>{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=U(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(F(),E("div",{class:W(["admonition",[`admonition-${o.node.kind}`]])},[K("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),E("svg",Da,[...t[1]||(t[1]=[K("circle",{cx:"12",cy:"12",r:"10"},null,-1),K("path",{d:"M12 16v-4"},null,-1),K("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(F(),E("svg",Va,[...t[2]||(t[2]=[K("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),K("path",{d:"M9 18h6"},null,-1),K("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(F(),E("svg",qa,[...t[3]||(t[3]=[K("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),K("path",{d:"M12 9v4"},null,-1),K("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(F(),E("svg",Ua,[...t[4]||(t[4]=[K("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),K("path",{d:"M12 8v4"},null,-1),K("path",{d:"M12 16h.01"},null,-1)])])):Z("",!0),K("span",Ja,z(r.value),1),o.node.collapsible?(F(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),E("svg",{style:se({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]=[K("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Ga)):Z("",!0)]),de(K("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[D(V(ja),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Xa),[[fe,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Ya.install=e=>{e.component(Ya.__name,Ya)};const Za=()=>import("@terrastruct/d2");let Qa=null,eu=Za,nu=null,tu=!1,ou=!1,lu=0;function ru(e){eu=e,lu++,Qa=null,nu=null,tu=!1,ou=!1}function iu(e){ru(null!=e?e:Za)}function au(){ru(null)}function uu(){return"function"==typeof eu}function su(){return s(this,null,function*(){if(Qa)return Qa;const e=eu,n=lu;return e?e===Za&&tu?null:nu||(nu=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===Za)return n===lu&&e===eu&&(tu=!0,function(e){ou||(ou=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===lu&&e===eu&&(nu=null)}return n!==lu||e!==eu?null:t?(Qa=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}(t),Qa):null}),nu):null})}let cu=null,du=null,fu=null,mu=0;function hu(e){du=null!=e?e:null,cu=null,fu=null,mu++}function vu(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");hu(e)}function pu(){hu()}function gu(){return"function"==typeof du}function yu(){return s(this,null,function*(){if(cu)return cu;const e=du,n=mu;return e?fu||(fu=s(null,null,function*(){const t=yield e();if(n!==mu||e!==du)return null;const o=function(e){var n,t,o;if(!e)return null;const l=null!=(n=e.default)?n:e,r="function"==typeof l&&"function"==typeof(null==(t=l.prototype)?void 0:t.render)?l:null!=(o=e.Infographic)?o:null==l?void 0:l.Infographic;return"function"==typeof r?r:null}(t);return n!==mu||e!==du?null:o?(cu=o,cu):null}).finally(()=>{n===mu&&e===du&&(fu=null)}),fu):null})}function ku(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function bu(e,n){null==e||e(n)}function Nu(e,n){return e?(bu(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Su(e,n){const t=Nu(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;bu(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=ku(o.marginTop),r=ku(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function xu(e,n,t){if(!e)return 0;const o=function(e){var n;return e?(null==(n=e.matches)?void 0:n.call(e,".markstream-vue.markdown-renderer"))?e:e.querySelector(".markstream-vue.markdown-renderer"):null}(e);if(!o)return 0;const l=Number.isFinite(t)?Number(t):Su(e,n),r=Nu(o,n);return Math.max(0,l-r)}function wu(e){return"measured"===e||"final"===e}function Mu(e,n,t){var o,l,r;const i=null!=(r=null!=(l=null==(o=t.getKey)?void 0:o.call(t,e,n))?l:e.id)?r:n;return String(i)}function Cu(e,n,t){var o,l,r;return null!=(r=null==(o=t.getKind)?void 0:o.call(t,e,n))?r:String(null!=(l=e.kind)?l:"")}function Bu(e,n,t){var o,l;const r=null!=(l=null==(o=t.getContent)?void 0:o.call(t,e,n))?l:e.content;return"string"==typeof r?r:""}function _u(e,n,t){var o;const l=null==(o=t.getFinal)?void 0:o.call(t,e,n);if("boolean"==typeof l)return l;const r=e.final;return"boolean"!=typeof r||r}function Ou(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function Tu(e,n,t){const o=Cu(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&Bu(e,n,t).length>0}function Iu(e,n,t){var o;const l=null==(o=t.estimateItemHeight)?void 0:o.call(t,e,n);if(Number.isFinite(l)&&l>0)return l;const r=Cu(e,n,t);return"assistant-markdown"===r||"markdown"===r?360:"system-divider"===r?44:"tool-call"===r?72:"thinking"===r?92:"error"===r?76:"user-message"===r?88:Bu(e,n,t).length>0?360:96}function Lu(e){const n=ge(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=ge(/* @__PURE__ */new Map),l=ge(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=U(!1),f=[0,80,180,360,640];let m,h=0,v=null,p=[],g=0;const y=/* @__PURE__ */new Map,k=/* @__PURE__ */new Map;let b,N=!1,S=null,x=!1,w=null;function M(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(oe(e),null)}function B(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function _(){return[...we(e.items)]}function O(){const n=we(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return Mu(n,t,e)}function I(n,t){return Tu(n,t,e)}function L(n,t){const o=T(n,t),l=O(),r=Ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function A(){const n=we(e.measurementKey);return null==n?void 0:String(n)}function H(){const n=we(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){return!0===we(e.renderCodeBlocksAsPre)}function P(){var e;const n=R()?"pre":"rich";return`${null!=(e=A())?e:""}${H()}${n}`}function $(n,t){if(I(n,t))return L(n,t);const o=T(n,t),l=O(),r=Ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function F(e){const n=_();for(let t=0;t<n.length;t++){const o=n[t];if(T(o,t)===e)return{item:o,index:t}}return null}function E(e,n){var t;const o=F(e);if(!o||!n)return!1;if(n.sourceKey!==$(o.item,o.index))return!1;const l=I(o.item,o.index)?P():A();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!E(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=F(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===L(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=O())?o:"")&&function(e){const n=P(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function j(e,n){return z(e,n)}function W(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!j(e,n))return 0;const l=Number(null==(t=null==n?void 0:n.metrics)?void 0:t.totalHeight);return Number.isFinite(l)&&l>0?Math.ceil(l):0}(e,n);return!Number.isFinite(r)||r<=0||!n?0:(W(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function q(e){return Number.isFinite(e)&&e>0?e:null}function J(){if(!x)return;x=!1,w=null;const e=b;b=void 0,e&&ue(e)}function X(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function Y(o,l,r=function(e){const n=F(e);return n?function(e,n){const t=I(e,n)?P():A();return a({sourceKey:$(e,n)},null==t?{}:{measurementKey:t})}(n.item,n.index):void 0}(o)){const i=q(l);if(null==i)return;const u=n.get(o),s=r&&(f=r,!((null!=(h=null==(c=t.get(o))?void 0:c.sourceKey)?h:"")===(null!=(p=null==f?void 0:f.sourceKey)?p:"")&&(null!=(y=null==c?void 0:c.measurementKey)?y:"")===(null!=(k=null==f?void 0:f.measurementKey)?k:"")&&(null!=(N=null==c?void 0:c.widthBucket)?N:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,N,S;if(null!=u&&Math.abs(u-i)<.5&&!s)return;if(d.value)return n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),void function(){const e=m,n=g;e&&oe(()=>{se(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,B=M?ie():void 0,_=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),O=M&&_<=2,T=M&&_<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var L;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),M&&((L=O?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:_}:B)&&(x||(b=L,x=!0,w=C(J))))}function Z(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Q(){if(!N)return;N=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ne(n,{allowMarkdownShrink:t.allowMarkdownShrink});J()}function ee(){Q(),J()}function ne(n,t={}){const o=function(e){return Su(s.get(e),M)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=F(e);return!!n&&I(n.item,n.index)}(n))return o>0&&Y(n,o),void i();const a=V(n),u=function(e,n){return xu(s.get(e),M,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&Y(n,e),void i()}const c=F(n);return c&&!Bu(c.item,c.index,e).trim()?(o>0&&Y(n,o),void i()):l>0?(o>l+1&&Y(n,o),void i()):(o>0&&Y(n,o),void i())}function te(){const e={},n=_();for(let t=0;t<n.length;t++){const o=T(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function le(){const e={},n=_();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);E(l,r)&&(e[l]=r)}return e}function re(){const e={};for(const[n,t]of o)e[n]=t;return e}function ie(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=_();for(let a=0;a<l.length;a++){const t=T(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:T(i,r.start),offsetWithinItemPx:0}:void 0}function ae(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=A())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&E(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ue(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function se(e,n){e===h&&ue(n)}function ce(e){e===h&&(d.value=!1,ee(),se(e,m),m=void 0,g=0)}function de(){X(),B(w),x=!1,w=null,b=void 0,B(S),N=!1,S=null,k.clear();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return ye()&&G(de),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void Z(i);if(u===a)return void ne(i);if(Z(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ne(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;a.isConnected&&(null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ne(i))});d.observe(a),c.set(i,d)},unobserveItem:function(e){Z(e)},releaseDetached:function(){let e=0;for(const[n,t]of s)t.isConnected||(Z(n),e++);return e},markdownProps:function(n,t){const l=T(n,t),r=_u(n,t,e),a=O(),u=Bu(n,t,e),s=L(n,t),c=P(),d=H(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=xe(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=j(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:j(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:96,heightDiffThresholdPx:4},g={content:u,final:r,mode:d,renderCodeBlocksAsPre:f,nodeVirtual:!!r&&"auto",maxLiveNodes:r?50:void 0,liveNodeBuffer:r?16:void 0,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==L(n,t))return;W(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:P()});const o=function(e){return"final"===e.phase||!(!0!==e.final||!wu(e.confidence))||!!e.stable&&(wu(e.confidence)||function(e){var n,t,o,l;const r=Number(e.nodeCount),i=Number(e.measuredCount),a=Math.max(0,Number(null!=(t=null==(n=e.liveRange)?void 0:n.start)?t:0)),u=Math.min(r,Math.max(a,Number(null!=(l=null==(o=e.liveRange)?void 0:o.end)?l:0))),s=Math.max(0,u-a);return!0===e.final&&!0===e.stable&&"mixed"===e.confidence&&r>0&&i>0&&i<r&&(s<=0||i>=s)}(e))}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),N||(N=!0,S=C(Q))},onVirtualStateChange(e){e.sessionKey===L(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){ee();const e=A();return u(a({threadKey:O()},null==e?{}:{measurementKey:e}),{outerAnchor:ie(),itemHeights:te(),itemSizeSources:le(),markdownStates:re()})},preloadThreadState:ae,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(X(),d.value=Boolean(t),g=n,m=t,ae(e),!t)return d.value=!1,m=void 0,void(g=0);se(n,t),oe(()=>{se(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{se(n,t),o===f.length-1&&ce(n)},e);p.push(l)}):ce(n)})},dispose:de}}const Au=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");let Hu=null;function Ru(e){Hu=null!=e?e:null}function Pu(){return Hu}function $u(){Hu=null}function Fu(){var e;try{null==(e=null==Hu?void 0:Hu.terminate)||e.call(Hu)}catch(n){}Hu=null}function Eu(e){return s(this,null,function*(){const n=Hu;if(n&&"function"==typeof n.setRenderOptions)try{yield n.setRenderOptions({theme:e})}catch(t){}})}function Ku(e){return le(e)}const zu=Ku(()=>import("./index3.js")),ju=Ku(()=>import("./index5.js")),Wu=Ku(()=>import("./index6.js")),Du=Ku(()=>import("./index10.js")),Vu=Ku(()=>import("./index9.js")),qu=Ku(()=>import("./index7.js")),Uu=Ku(()=>import("./index4.js")),Ju=Ku(()=>import("./index8.js")),Gu={MarkdownRender:ja,NodeRenderer:ja,AdmonitionNode:Ya,BlockquoteNode:Ro,CheckboxNode:an,CodeBlockNode:zu,DefinitionListNode:Eo,EmojiNode:sn,EmphasisNode:Mo,FootnoteNode:Do,FootnoteReferenceNode:fn,FootnoteAnchorNode:zo,HardBreakNode:Bo,HeadingNode:Uo,HtmlBlockNode:ol,HtmlInlineNode:Mn,HighlightNode:xo,ImageNode:pt,D2BlockNode:qu,InfographicBlockNode:Vu,InlineCodeNode:_n,PreCodeNode:Lt,InsertNode:No,LinkNode:ko,ListItemNode:Zo,ListNode:Qo,MathBlockNode:ju,MathInlineNode:Wu,MermaidBlockNode:Du,ParagraphNode:il,StrikethroughNode:ho,StrongNode:fo,SubscriptNode:so,SuperscriptNode:ao,TableNode:hl,TextNode:At,ThematicBreakNode:pl,VmrContainerNode:kl,ReferenceNode:ro,MarkstreamVirtualTimeline:Ju,Tooltip:Uu},Xu={install(e,n){var t,o;Object.entries(Gu).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&He(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(Au,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&Re(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions),n&&"infographicLoader"in n&&hu(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Un,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(qe,function(e={}){return H(Xe(e))}(n.components))}};export{Ze as $,Ya as A,Ro as B,an as C,qu as D,sn as E,zo as F,rn as G,Bo as H,pt as I,Lt as J,Do as K,ko as L,Au as M,nn as N,$u as O,il as P,au as Q,ro as R,ho as S,hl as T,pu as U,kl as V,iu as W,vu as X,Dt as Y,Iu as Z,Uo as _,zu as a,su as a0,yu as a1,xu as a2,Bu as a3,_u as a4,Mu as a5,Cu as a6,Ou as a7,Pu as a8,Vn as a9,Ma as aA,at as aB,lt as aC,uu as aa,Ft as ab,gu as ac,Tu as ad,qt as ae,Su as af,en as ag,Et as ah,Ht as ai,Rt as aj,ut as ak,Vt as al,Ut as am,Yt as an,Ye as ao,ru as ap,Jn as aq,hu as ar,Ru as as,Dn as at,Eu as au,Fu as av,Lu as aw,Ti as ax,rt as ay,Zn as az,Jt as b,Gt as c,Eo as d,Mo as e,fn as f,xo as g,ol as h,Mn as i,Vu as j,_n as k,No as l,Zo as m,Qo as n,Ju as o,ju as p,Wu as q,Du as r,fo as s,so as t,ao as u,At as v,pl as w,Uu as x,Xu as y,ja 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},u=(e,o)=>n(e,t(o)),s=(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{normalizeCustomHtmlTagName as c,tokenizeHtml as d,sanitizeHtmlAttrs as f,sanitizeHtmlTokenAttrs as m,tokenAttrsToRecord as h,isCustomHtmlComponentTag as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,sanitizeHtmlContent as b,sanitizeImageSrc as N,shouldOpenLinkInNewTab as S,NON_STRUCTURING_HTML_TAGS as x,normalizeCustomHtmlTags as w,getHtmlTagFromContent as M,shouldRenderUnknownHtmlTagAsText as C,getMarkdown as B,mergeCustomHtmlTags as _,resolveCustomHtmlTags as O,parseMarkdownToStructure as T,EXTENDED_STANDARD_HTML_TAGS as I,stripCustomHtmlWrapper as L,setDefaultMathOptions as A}from"stream-markdown-parser";import{shallowRef as H,inject as R,computed as $,defineComponent as P,openBlock as F,createElementBlock as E,createElementVNode as K,toDisplayString as z,h as j,normalizeClass as W,createVNode as D,unref as V,ref as q,useAttrs as U,watch as J,Fragment as G,createTextVNode as X,createCommentVNode as Y,renderList as Z,getCurrentInstance as Q,provide as ee,onBeforeUnmount as ne,renderSlot as te,nextTick as oe,defineAsyncComponent as le,createBlock as re,resolveDynamicComponent as ie,mergeProps as ae,withCtx as ue,normalizeStyle as se,onScopeDispose as ce,withDirectives as de,vShow as fe,markRaw as me,normalizeProps as he,guardReactiveProps as ve,Transition as pe,reactive as ge,getCurrentScope as ye,onMounted as ke,watchEffect as be,triggerRef as Ne,resolveComponent as Se,toRaw as xe,toValue as we}from"vue";import{M as Me,n as Ce,c as Be,g as _e,s as Oe,h as Te}from"./index2.js";import{b as Ie}from"./workers-katexWorkerClient.js";import{createDiffMatchCache as Le,buildDiffPreviewPanes as Ae,normalizeShikiLanguage as He,createSmoothMarkdownStream as Re}from"markstream-core";import{a as $e,b as Pe,c as Fe,e as Ee,p as Ke}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const ze="__global__",je="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",We=(()=>{const e=globalThis;if(e[je])return e[je];const n={scopedCustomComponents:{},revision:H(0)};return e[je]=n,n})(),De=We.revision,Ve=/* @__PURE__ */Symbol("markstreamCustomComponents"),qe=/* @__PURE__ */new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Ue(e){return qe.has(String(e).trim().toLowerCase())}function Je(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ge(e={}){const n={};for(const[t,o]of Object.entries(e))if(null!=o){n[t]=o;for(const e of/* @__PURE__ */new Set([c(t),c(Je(t))]))!e||Ue(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Xe(e,n){"string"==typeof e?We.scopedCustomComponents[e]=Ge(n||{}):We.scopedCustomComponents[ze]=Ge(e||{}),De.value++}function Ye(e){const n=Ge(We.scopedCustomComponents[ze]||{});if(!e)return n;const t=Ge(We.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ze(e){const n=R(Ve,null);return $(()=>{var t;return De.value,function(e,n={}){return De.value,a(a(a({},Ge(We.scopedCustomComponents[ze]||{})),Ge(n)),Ge(function(e){return e&&We.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Qe(e){if(e===ze)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete We.scopedCustomComponents[e],De.value++}function en(){delete We.scopedCustomComponents[ze],De.value++}const nn=["aria-label"],tn={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"},on={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"},ln=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},rn=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(F(),E("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),E("svg",on,[...t[1]||(t[1]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),K("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(F(),E("svg",tn,[...t[0]||(t[0]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,nn))}),[["__scopeId","data-v-be21ab83"]]);rn.install=e=>{e.component(rn.__name,rn)};const an={class:"emoji-node"},un=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(F(),E("span",an,z(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);un.install=e=>{e.component(un.__name,un)};const sn=["id"],cn=["title"],dn=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${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)=>(F(),E("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[K("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+z(e.node.id)+"]",9,cn)],8,sn))}}),[["__scopeId","data-v-c1463a29"]]);dn.install=e=>{e.component(dn.__name,dn)};const fn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function mn(e){fn&&console.warn(e)}function hn(e,n){return v(e,n)}function vn(e,n="safe",t){return f(e,n,t)}function pn(e){return p(e)}function gn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function yn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=m((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),gn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),gn(e.value)]):Object.entries(l).map(([e,n])=>[e,gn(n)]):null,n,t);var l;if(!o)return;const r=pn(h(o));return Object.keys(r).length>0?r:void 0}function kn(e,n,t=!1){const o=Object.entries(null!=n?n:{}),l=o.length>0?o.map(([e,n])=>""===n?` ${e}`:` ${e}="${n}"`).join(""):"";return t?`<${e}${l} />`:`<${e}${l}>`}function bn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function Nn(e,n,t,o,l,r,i=!1){const s=hn(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[kn(e,n,!0)]:[kn(e,n),...t,`</${e}>`];const c=f(n,r,e),d=c.key,m=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=pn(c);return j(n,u(a({},l),{key:m}),t.length>0?t:void 0)}return j(e,u(a({},c),{innerHTML:void 0,key:m}),t.length>0?t:void 0)}function Sn(e,n,t="safe",o=!1){var l,r;try{if(!o&&0===Object.keys(n).length)return{ok:!0,hasCustomComponents:!1,nodes:null};const r=d(e);let i=!1;for(const e of r)if(("tag_open"===e.type||"self_closing"===e.type)&&hn(null!=(l=e.tagName)?l:"",n)){i=!0;break}const a=o||i?function(e,n,t="safe"){let o=0;const l=[],r=[];for(const i of e)if("text"===i.type)(l.length>0?l[l.length-1].children:r).push(i.content);else if("self_closing"===i.type){const e=Nn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);bn(l.length>0?l[l.length-1].children:r,e)}else if("tag_open"===i.type)l.push({tagName:i.tagName,children:[],attrs:i.attrs,autoKey:"ms-html-"+o++});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let o=-1;for(let n=l.length-1;n>=0;n--)if(l[n].tagName.toLowerCase()===e){o=n;break}if(-1!==o)for(;l.length>o;){const i=l.pop(),a=Nn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?bn(l[l.length-1].children,a):bn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&mn(`Auto-closing unclosed tag: <${i.tagName}>`)}else mn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=Nn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?bn(l[l.length-1].children,o):bn(r,o),mn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(r,n,t):null;return{ok:!0,hasCustomComponents:i,nodes:a}}catch(i){return r=i,fn&&console.error("Failed to parse HTML to VNodes:",r),{ok:!1,hasCustomComponents:!1,nodes:null}}}const xn=["innerHTML"],wn=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=$(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Ze(()=>n.customId),r=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=$(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};const t=!0===n.node.loading&&!0===n.node.autoClosed,r=Sn(e,l.value,o.value,t);return r.ok&&(t||r.hasCustomComponents)?{mode:"dynamic",nodes:r.nodes}:{mode:"html",content:b(e,o.value)}});return(e,t)=>"dynamic"===i.value.mode?(F(),E("span",{key:0,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[D(V(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),E("span",{key:1,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},z(i.value.content),3)):(F(),E("span",{key:2,class:W(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,xn))}}),[["__scopeId","data-v-fbbbc497"]]);function Mn(e){const n=q(e),t=H([]);let o=e,l=0;function r(){let e=0,o="";for(const n of t.value){if(!n.finished)break;o+=n.content,e++}e&&(n.value+=o,t.value=t.value.slice(e))}return{settledContent:n,segments:t,update:function(e,r,i){if(i&&e===o&&(!r||r===e||t.value.length>0))return;const s=null!=r?r:o;if(i&&s&&e.length>s.length&&e.startsWith(s)){s!==o&&(n.value=s,t.value=[]);const r=e.slice(s.length),i=performance.now(),c=t.value.at(-1);c&&(i-c.startedAt<50||t.value.length>=4)?t.value=[...t.value.slice(0,-1),u(a({},c),{content:c.content+r})]:t.value=[...t.value,{id:l++,content:r,startedAt:i,finished:!1}]}else n.value=e,t.value=[];o=e},finish:function(e,n=!1){const o=t.value.find(n=>n.id===e);o&&(o.finished=!0,n||r())},settleFinished:r}}wn.install=e=>{e.component(wn.__name,wn)};const Cn={class:"inline-code"},Bn={key:0},_n=["onAnimationend"],On=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=$(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=$(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=$(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),u=$(()=>!i.value),s=$(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),{settledContent:c,segments:d,update:f,finish:m}=Mn(n.node.code);return J([()=>n.node.code,s,i],([e])=>{const n=String(null!=e?e:""),t=s.value;f(n,t?null==l?void 0:l.get(t):void 0,i.value),t&&(null==l||l.set(t,n))},{immediate:!0}),(e,n)=>(F(),E("code",Cn,[u.value?(F(),E(G,{key:0},[X(z(a.value),1)],64)):(F(),E(G,{key:1},[V(c)?(F(),E("span",Bn,z(V(c)),1)):Y("",!0),(F(!0),E(G,null,Z(V(d),e=>(F(),E("span",{key:e.id,class:"inline-code-stream-delta",onAnimationend:n=>V(m)(e.id)},z(e.content),41,_n))),128))],64))]))}}),[["__scopeId","data-v-557cf4dd"]]);On.install=e=>{e.component(On.__name,On)};const Tn=q(!1),In=q(""),Ln=q("top"),An=q(null),Hn=q(null),Rn=q(null),$n=q(null),Pn=q(null);let Fn=null,En=null,Kn=0;function zn(){Fn&&(clearTimeout(Fn),Fn=null),En&&(clearTimeout(En),En=null)}let jn=!1,Wn=null,Dn=!1;function Vn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Kn;zn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!jn&&!Dn&&"undefined"!=typeof document){null!=Wn||(Wn=s(null,null,function*(){const[{createApp:e,h:n},{default:t}]=yield Promise.all([import("vue"),import("./Tooltip.js")]),o=document.createElement("div");o.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(o),e({setup:()=>()=>{var e;return n(t,{visible:Tn.value,"anchor-el":An.value,content:In.value,placement:Ln.value,id:Hn.value,originX:Rn.value,originY:$n.value,isDark:null!=(e=Pn.value)?e:void 0})}}).mount(o),jn=!0}));try{yield Wn}catch(e){jn=!1,Wn=null,Dn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),jn&&i===Kn){Hn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,An.value=e,In.value=n,Ln.value=t,Rn.value=null!=(o=null==l?void 0:l.x)?o:null,$n.value=null!=(a=null==l?void 0:l.y)?a:null,Pn.value="boolean"==typeof r?r:null,Tn.value=!0;try{e.setAttribute("aria-describedby",Hn.value)}catch(u){}}});o?a():Fn=setTimeout(a,80)}function qn(e=!1){Kn+=1,zn();const n=()=>{if(An.value&&Hn.value)try{An.value.removeAttribute("aria-describedby")}catch(e){}Tn.value=!1,An.value=null,Hn.value=null,Rn.value=null,$n.value=null};e?n():En=setTimeout(n,120)}const Un={"common.copy":"Copy","common.selectCopy":"全选(复制)","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..."},Jn=/* @__PURE__ */Symbol("markstreamI18nFallback");function Gn(e){Object.assign(Un,e)}function Xn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:Un[e]}const Yn=(e,n)=>{var t;return null!=(t=Xn(e,n))?t: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 Zn(e,n){return{t(t){const o=Xn(t,n);if(e.te&&null!=o&&!e.te(t))return Yn(t,n);const l=e.t(t);return l===t&&null!=o?Yn(t,n):l}}}function Qn(){const e=function(){var e,n,t;try{const o=Q(),l=Jn,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=Q(),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(n)return Zn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return Zn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Yn(n,e)}}const et=/* @__PURE__ */Symbol("ViewportPriority"),nt=/* @__PURE__ */Symbol("ViewportPriorityOptions"),tt=/* @__PURE__ */Symbol("OffscreenHeavyNodeDeferral"),ot=$(()=>!1),lt="400px";function rt(){return R(nt,void 0)}function it(){return R(tt,ot)}function at(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?q(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,u=/* @__PURE__ */new WeakMap;let s=1;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Set;let m=null,h=null;function v(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function p(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function g(e){if(e){const t=c.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch(n){}c.delete(e)}}d.size||f.size||p()}function y(e){const n=d.get(e);if(!n)return;const t=c.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(o){}}try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)}function k(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==m&&f.size&&(m=i(()=>{m=null;const e=f.values().next().value;e&&(f.delete(e),y(e),f.size&&k())},{timeout:1200}))}function b(n,t){if(!l)return null;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:lt,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[v((i=o).root),i.rootMargin,i.threshold].join("\0");var i;const a=c.get(r);if(a)return{key:r,bucket:a};let u;try{u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&y(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold})}catch(d){return null}const s={io:u,targets:/* @__PURE__ */new Map};return c.set(r,s),{key:r,bucket:s}}function N(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=b(n,t.opts);if(!o){y(n);continue}if(o.key===t.bucketKey)continue;const l=t.bucketKey,r=c.get(l);try{null==r||r.io.unobserve(n)}catch(e){}null==r||r.targets.delete(n),t.bucketKey=o.key,o.bucket.targets.set(n,t),o.bucket.io.observe(n),g(l)}}J(r,e=>{if(!e){for(const e of Array.from(d.keys()))y(e);p()}},{flush:"sync"});const S=(e,n)=>{const t=q(!1);let o,i=!1;const a=new Promise(e=>{o=()=>{i||(i=!0,e())}}),u=()=>{const n=d.get(e);if(!n)return f.delete(e),void g();const t=c.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=b(e,n);if(!s)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const m={resolve:o,visible:t,bucketKey:s.key,opts:n};return d.set(e,m),s.bucket.targets.set(e,m),s.bucket.io.observe(e),l&&null==h&&(h=window.requestAnimationFrame(()=>{h=null,N()})),!1!==(null==n?void 0:n.allowIdle)&&(f.add(e),k()),{isVisible:t,whenVisible:a,destroy:u}};return S.refresh=N,ee(et,S),S}function ut(){var e,n;const t=R(et,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new Map,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,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=e=>{if(!e)return;const n=l.get(e);if(n&&!n.targets.size){try{n.io.disconnect()}catch(t){}l.delete(e)}},d=e=>{const n=o.get(e);if(!n)return;const t=l.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(i){}}try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},f=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&f())},{timeout:1200}))};return(e,n)=>{const t=q(!1);let i,a=!1;const u=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{const n=o.get(e);if(!n)return r.delete(e),void(r.size||s());const t=l.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},h=(e=>{var n,t;if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return null;const o=(e=>{var n,t;return[null!=(n=null==e?void 0:e.rootMargin)?n:lt,null!=(t=null==e?void 0:e.threshold)?t:0].join("\0")})(e),r=l.get(o);if(r)return{key:o,bucket:r};const i=null!=(n=null==e?void 0:e.rootMargin)?n:lt;let a;try{a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:i,threshold:null!=(t=null==e?void 0:e.threshold)?t:0})}catch(s){return null}const u={io:a,targets:/* @__PURE__ */new Set};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.targets.add(e),h.bucket.io.observe(e),!1!==(null==n?void 0:n.allowIdle)&&(r.add(e),f()),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}function st(e,n){var t,o;const l=null!=(o=null!=(t=e.indexKey)?t:n["index-key"])?o:n.indexKey;return null==l||""===l?"":String(l)}const ct=["data-markstream-viewport-pending"],dt=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],ft={key:1,class:"image-placeholder"},mt={key:1,class:"image-node__raw-text"},ht={key:2,class:"image-error"},vt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){var t,o,l;const r=e,i=n,a=q(!1),u=q(!1),c=q(!1),d=q(""),f=q("primary"),m=q(null),h=U(),v=R(Me,null),p=ut(),g=rt(),y=it(),k=$(()=>N(r.node.src)),b=$(()=>N(r.fallbackSrc)),S=null==(l=null==(o=null==(t=Q())?void 0:t.vnode.el)?void 0:o.querySelector)?void 0:l.call(o,"img"),x="undefined"!=typeof window&&(null==S?void 0:S.getAttribute("src"))===(k.value||b.value),w=q("undefined"==typeof window||x||!y.value),M=H(null);let C="",B=null;const _=$(()=>d.value),O=$(()=>!r.lazy),T=$(()=>"undefined"!=typeof window&&y.value&&!x),I=$(()=>!T.value||w.value),L=$(()=>I.value?_.value:""),A=$(()=>{var e,n;return null!=(n=null!=(e=null==g?void 0:g.value.heavyBlockMargin)?e:null==g?void 0:g.value.rootMargin)?n:lt}),P=$(()=>!r.node.loading&&"failed"!==f.value&&d.value.length>0),j=$(()=>"failed"===f.value),D=$(()=>(u.value||!O.value||T.value)&&!a.value&&!c.value&&"failed"!==f.value&&d.value.length>0),G=$(()=>st(r,h));function X(e=G.value){e&&m.value&&(null==v||v.reportHeight(e,m.value.offsetHeight))}function Z(e=G.value){e&&oe(()=>{X(e)})}function ee(){B&&(clearTimeout(B),B=null)}function le(){const e=G.value;e&&C!==e&&(C&&(null==v||v.markSettled(C)),ee(),C=e,null==v||v.markPending(e),"undefined"!=typeof window&&(B=window.setTimeout(()=>{C===e&&(Z(e),re())},8e3)))}function re(){return s(this,null,function*(){const e=C;e&&(ee(),C="",yield oe(),X(e),null==v||v.markSettled(e))})}function ie(){if("primary"===f.value&&b.value&&b.value!==d.value)return f.value="fallback",d.value=b.value,a.value=!1,c.value=!1,void Z();f.value="failed",c.value=!0,i("error",d.value),Z()}function ae(){a.value=!0,u.value=!1,c.value=!1,i("load",_.value),Z()}function ue(e){e.preventDefault(),a.value&&!c.value&&i("click",[e,_.value])}const{t:se}=Qn();return J([k,b,()=>r.node.loading],()=>(a.value=!1,c.value=!1,r.node.loading?(u.value=!0,d.value=k.value,void(f.value="primary")):k.value?(d.value=k.value,void(f.value="primary")):b.value?(d.value=b.value,void(f.value="fallback")):(d.value="",f.value="failed",void(c.value=!0))),{immediate:!0}),"undefined"!=typeof window&&J([m,T],([e,n],t,o)=>{var l;if(null==(l=M.value)||l.destroy(),M.value=null,!n||w.value)return void(w.value=!0);if(!e)return void(w.value=!1);let r=!0;const i=p(e,{rootMargin:A.value,allowIdle:!1});M.value=i,w.value=i.isVisible.value,i.whenVisible.then(()=>{r&&M.value===i&&(w.value=!0)}),o(()=>{r=!1,i.destroy(),M.value===i&&(M.value=null)})},{immediate:!0}),J([P,a,c,_,()=>r.lazy,I],([e,n,t,o,l,r])=>e&&o&&!t&&r?n?(re(),void Z()):l?(le(),void Z()):void(n||t||le()):(re(),void Z()),{flush:"post",immediate:!0}),ne(()=>{var e;null==(e=M.value)||e.destroy(),M.value=null,function(){const e=C;e&&(ee(),C="",null==v||v.markSettled(e))}()}),(n,t)=>{var o,l,i,u,s;return F(),E("span",{ref_key:"rootRef",ref:m,class:"image-node-container","data-markstream-viewport-pending":T.value&&!w.value?"true":void 0},[P.value?(F(),E("img",{key:0,src:L.value||void 0,alt:String(null!=(l=null!=(o=r.node.alt)?o:r.node.title)?l:""),title:String(null!=(u=null!=(i=r.node.title)?i:r.node.alt)?u:""),class:W(["image-node__img",{"has-placeholder":e.node.loading||D.value,"is-loading":!O.value&&!a.value,"is-loaded":O.value||a.value,"has-natural-size":a.value,"cursor-pointer":a.value}]),loading:r.lazy?"lazy":void 0,fetchpriority:O.value?"high":void 0,decoding:O.value?"sync":"async",tabindex:a.value?0:-1,"aria-label":null!=(s=r.node.alt)?s:V(se)("image.preview"),onError:ie,onLoad:ae,onClick:ue},null,42,dt)):Y("",!0),!e.node.loading&&!D.value||c.value?Y("",!0):(F(),E("span",ft,[r.usePlaceholder?te(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:_.value,imageLoaded:a.value,hasError:c.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[0]||(t[0]=K("span",{class:"image-shimmer"},null,-1))],!0):(F(),E("span",mt,z(e.node.raw),1))])),j.value?(F(),E("span",ht,[te(n.$slots,"error",{node:r.node,displaySrc:_.value,imageLoaded:a.value,hasError:c.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[1]||(t[1]=K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[K("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),K("span",null,z(V(se)("image.loadError")),1)],!0)])):Y("",!0)],8,ct)}}}),[["__scopeId","data-v-e4e45fcb"]]);vt.install=e=>{e.component(vt.__name,vt)};const pt=le({loader:()=>Promise.resolve().then(()=>Wa),suspensible:!1}),gt={key:2},yt=/* @__PURE__ */P({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Ze(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamNestedRendererProps",void 0),r=$(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=$(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=$(()=>n.components[String(n.node.type)]),c=$(()=>Boolean(s.value&&t.value[n.node.type]&&!Ue(String(n.node.type)))),d=$(()=>c.value?yn(n.node,r.value):void 0),f=$(()=>Array.isArray(n.node.children)&&n.node.children.length>0),m=$(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),h=$(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>s.value&&c.value?(F(),re(ie(s.value),ae({key:0},d.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark,"data-markstream-reference-id":"reference"===e.node.type?String(e.node.id):void 0}),{default:ue(()=>[f.value?(F(),re(V(pt),ae({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):m.value?(F(),re(V(pt),ae({key:1},i.value,{content:m.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Y("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark","data-markstream-reference-id"])):s.value?(F(),re(ie(s.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey,"data-markstream-reference-id":"reference"===e.node.type?String(e.node.id):void 0},null,8,["node","custom-id","index-key","data-markstream-reference-id"])):e.fallbackToText?(F(),E("span",gt,z(h.value),1)):Y("",!0)}}),kt=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],bt={key:0,translate:"no",class:"markstream-pre__diff-code"},Nt={class:"markstream-pre__diff-pane-content"},St={key:0,class:"markstream-pre__diff-collapsed-icon","aria-hidden":"true"},xt={class:"markstream-pre__diff-number","aria-hidden":"true"},wt={class:"markstream-pre__diff-content"},Mt={class:"markstream-pre__diff-content-inner"},Ct={key:0,translate:"no",class:"markstream-pre__code markstream-pre__code--wrapped"},Bt=["data-line-number","textContent"],_t={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Ot=["textContent"],Tt=["textContent"],It=/* @__PURE__ */P({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const n=e,t=U(),o=Le();function l(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}const r=$(()=>{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"}),i=$(()=>`language-${r.value}`),a=$(()=>{var e;return!0===n.loading||!0===(null==(e=n.node)?void 0:e.loading)}),u=$(()=>{var e;return l(null==(e=n.node)?void 0:e.code,a.value)});let s="",c=1;const d=$(()=>function(e){let n=0,t=1;e.startsWith(s)&&(n=s.length,t=c,n>0&&"\r"===e[n-1]&&"\n"===e[n]&&n++);for(let o=n;o<e.length;o++)"\n"===e[o]?t++:"\r"===e[o]&&(t++,"\n"===e[o+1]&&o++);return s=e,c=t,t}(u.value));let f="",m=[],h=0,v=0;const p=new RegExp("(?<=\\n)|(?<=\\r)(?!\\n)"),g=$(()=>function(e){const n=e.length>f.length&&e.startsWith(f),t=n?m:[],o=n?v:0;n&&(t.length=h);for(const r of e.slice(o).split(p))t.push(r);const l=e[e.length-1];return"\n"===l?(h=t.length,v=e.length,t.push("")):(h=t.length-1,v=e.length-t[t.length-1].length,"\r"===l&&t.push("")),f=e,m=t,t}(u.value)),y=$(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),k=$(()=>{var e;if(W(t.class).split(/\s+/).includes("is-wrap"))return!0;const n=se(t.style);return"string"==typeof n?/(?:^|;)\s*white-space\s*:\s*(?:pre-wrap|break-spaces)(?:\s*!important)?\s*(?:;|$)/i.test(n):["pre-wrap","break-spaces"].includes(String(null!=(e=null==n?void 0:n.whiteSpace)?e:null==n?void 0:n["white-space"]))}),b=$(()=>y.value&&k.value);let N=0,S="";const x=$(()=>{const e=d.value;e<N&&(N=0,S="");for(let n=N+1;n<=e;n++)S+=`${S?"\n":""}${n}`;return N=e,S}),w=$(()=>y.value&&!0===n.diffInline),M=$(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return a.value?{maxHeight:t,overflow:"auto"}:{height:t,minHeight:t,maxHeight:t,overflow:"auto"}});function C(e,n){const t=l(e,n);if(!t)return 0;let o=1;for(let l=0;l<t.length;l++)"\n"===t[l]?o++:"\r"===t[l]&&(o++,"\n"===t[l+1]&&l++);return o}const B=$(()=>{var e,t,l,r,i;return y.value?Ae({code:null==(e=n.node)?void 0:e.code,hideUnchangedRegions:n.diffHideUnchangedRegions,inline:w.value,language:null==(t=n.node)?void 0:t.language,loading:a.value,matchCache:o,originalCode:null==(l=n.node)?void 0:l.originalCode,raw:null==(r=n.node)?void 0:r.raw,updatedCode:null==(i=n.node)?void 0:i.updatedCode}):[]}),_=$(()=>{const e=B.value;let n=1,t=!1;for(const o of e)for(const e of o.lines)"collapsed"===e.kind&&(t=!0),"number"==typeof e.number&&e.number>n&&(n=e.number);return{maxNumberedLine:n,hasCollapsed:t}}),O=$(()=>{var e,t;if(!0!==n.showLineNumbers)return;let o=y.value?1:d.value;y.value&&(o=Math.max(o,C(null==(e=n.node)?void 0:e.originalCode,a.value),C(null==(t=n.node)?void 0:t.updatedCode,a.value),_.value.maxNumberedLine));const l=`${Math.max(2,String(o).length)}ch`;return{"--markstream-pre-line-number-width":l,"--markstream-pre-diff-line-number-width":l,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}}),T=$(()=>y.value&&_.value.hasCollapsed),I=$(()=>{const e=r.value;return e?`Code block: ${e}`:"Code block"}),L=q(null),A=q([]);let H=null,R=null,P=!1,j=null;function D(){if(P||"undefined"==typeof window||!y.value||w.value||!b.value)return;if(null!=H)return;const e=null!=R?R:R=import("./preCodeDiffMetrics.js");H=window.requestAnimationFrame(()=>{e.then(({measurePreCodeDiffLines:e})=>{!P&&L.value&&(A.value=e(L.value,A.value))},()=>{R=null}).finally(()=>{H=null})})}function V(e){null==j||j.disconnect(),j=null,e&&y.value&&!w.value&&b.value&&"undefined"!=typeof ResizeObserver&&(j=new ResizeObserver(()=>{D()}),j.observe(e))}function X(e,n){if(!b.value)return;const t=A.value[e];if(!t)return;const o="original"===n?t.originalHeight:t.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(t.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(o)}px`}}return J(L,e=>{V(e),D()},{flush:"post"}),J([y,w,B,b],()=>{V(L.value),y.value&&!w.value&&b.value?D():A.value.length&&(A.value=[])},{flush:"post",immediate:!0}),ne(()=>{P=!0,null!=H&&(window.cancelAnimationFrame(H),H=null),null==j||j.disconnect(),j=null}),(e,t)=>{return F(),E("pre",{ref_key:"preRef",ref:L,style:se([M.value,O.value]),class:W([i.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":y.value,"markstream-pre--diff-inline":w.value,"markstream-pre--diff-collapsed":T.value}]),"aria-busy":a.value,"aria-label":I.value,"data-language":r.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[y.value?(F(),E("code",bt,[(F(!0),E(G,null,Z(B.value,e=>(F(),E("span",{key:e.key,class:W(["markstream-pre__diff-pane",e.className])},[K("span",Nt,[(F(!0),E(G,null,Z(e.lines,(n,o)=>(F(),E("span",{key:n.key,class:W(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,n.metadataKind?`markstream-pre__diff-line--metadata-${n.metadataKind}`:"",{"markstream-pre__diff-line--empty":n.empty,"markstream-pre__diff-line--collapsed-first":!0===n.collapsedFirst,"markstream-pre__diff-line--collapsed-last":!0===n.collapsedLast}]]),style:se(X(o,e.key))},[t[1]||(t[1]=K("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),"collapsed"===n.kind?(F(),E("span",St,[...t[0]||(t[0]=[K("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[K("path",{d:"M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"})],-1)])])):Y("",!0),K("span",xt,z(n.number),1),K("span",wt,[K("span",Mt,z(n.code),1)])],6))),128))])],2))),128))])):(F(),E(G,{key:1},[!0===n.showLineNumbers&&!0!==(null==(o=n.node)?void 0:o.diff)&&k.value?(F(),E("code",Ct,[(F(!0),E(G,null,Z(g.value,(e,n)=>(F(),E("span",{key:n,class:"markstream-pre__logical-line","data-line-number":n+1,textContent:z(e)},null,8,Bt))),128))])):(F(),E(G,{key:1},[n.showLineNumbers?(F(),E("span",_t,[K("span",{class:"markstream-pre__line-numbers-text",textContent:z(x.value)},null,8,Ot)])):Y("",!0),K("code",{translate:"no",class:"markstream-pre__code",textContent:z(u.value)},null,8,Tt)],64))],64))],14,kt);var o}}});It.install=e=>{e.component(It.__name,It)};const Lt=["onAnimationend"],At=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=U(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=$(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=$(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=$(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),{settledContent:u,segments:s,update:c,finish:d,settleFinished:f}=Mn(n.node.content),m=q(null),h=q(null),v=q([]);let p,g="",y=null,k=null,b=!1;function N(){var e;if(!v.value.length)return!1;const n=null==(e=document.getSelection)?void 0:e.call(document);if(!n||n.isCollapsed)return!1;for(let t=0;t<n.rangeCount;t++){const e=n.getRangeAt(t);if(v.value.some(n=>e.intersectsNode(n)))return!0}return!1}function S(e){const n=a.value;c(e,n?null==l?void 0:l.get(n):void 0,i.value),n&&(null==l||l.set(n,e))}J([u,m,h],function(){var e,n;const t=m.value;if(!t)return;const o=String(null!=(e=u.value)?e:""),l=h.value;return y||(y=t.firstChild,g=null!=(n=null==y?void 0:y.data)?n:""),o.startsWith(g)?!y&&o?(t.textContent=o,y=t.firstChild,void(g=o)):void(o.length>g.length&&l&&(l.appendChild(document.createTextNode(o.slice(g.length))),g=o,function(e){var n,t;if(e.childNodes.length<=4)return;if(function(e){var n;const t=null==(n=document.getSelection)?void 0:n.call(document);if(!t||0===t.rangeCount)return!1;const{anchorNode:o,focusNode:l}=t;return null!=o&&e.contains(o)||null!=l&&e.contains(l)}(e))return;let o="";for(let l=0;l<e.childNodes.length;l++)o+=null!=(t=null==(n=e.childNodes[l])?void 0:n.textContent)?t:"";e.textContent=o}(l))):(t.textContent=o,y=t.firstChild,l&&(l.textContent=""),void(g=o))},{immediate:!0}),J([()=>n.node.content,a,i],([e])=>{const n=String(null!=e?e:"");if(N())return k=n,void M();k=null,b=!1,S(n)},{immediate:!0});const x=q(u.value);function w(){if(!N())if(C(),null!=k){const e=k;k=null,b=!1,S(e),f()}else b&&(b=!1,f())}function M(){p||(p=document,p.addEventListener("selectionchange",w))}function C(){null==p||p.removeEventListener("selectionchange",w),p=void 0}return ce(C),(n,t)=>(F(),E("span",{class:W([[e.node.center?"text-node-center":""],"text-node"])},[de(K("span",{ref_key:"settledTextEl",ref:m},z(x.value),513),[[fe,""!==V(u)]]),de(K("span",{ref_key:"settledAppendsEl",ref:h},null,512),[[fe,""!==V(u)]]),(F(!0),E(G,null,Z(V(s),e=>(F(),E("span",{key:e.id,ref_for:!0,ref_key:"streamedDeltaEls",ref:v,class:"text-node-stream-delta",onAnimationend:n=>function(e){const n=N();d(e,n),n&&(b=!0,M())}(e.id)},z(e.content),41,Lt))),128))],2))}}),[["__scopeId","data-v-3be01052"]]);function Ht(e){var n;if("boolean"==typeof e)return e;const t=e;if(!0===(null==t?void 0:t.expandUnchanged))return!1;const o=Number(null==(n=null==t?void 0:t.parseDiffOptions)?void 0:n.context),l=Number(null==t?void 0:t.collapsedContextThreshold);return{enabled:!0,contextLineCount:isFinite(o)&&o>=0?Math.floor(o):2,minimumLineCount:isFinite(l)&&l>=0?Math.floor(l)+1:6,revealLineCount:5}}function Rt(e){return"unified"===e.diffStyle}function $t(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let r=3;for(;o[r]===l;)r+=1;return o.slice(r).trim()}function Pt(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}function Ft(e){var n;return!0===e.diff||Pt(e.language)||Pt($t(String(null!=(n=e.raw)?n:"")))}function Et(e,n,t){const o=function(e){const n=$t(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:o||n,caption:o?t?`Diff / ${n}`:n:""}}function Kt(e){const n=String(null!=e?e:"").replace(/\r\n$|\n$|\r$/,"");return n?n.split(/\r\n|\n|\r/):[]}At.install=e=>{e.component(At.__name,At)};let zt="",jt="",Wt=null;function Dt(e,n){var t;if(Wt&&zt===e&&jt===n)return Wt;const o=Kt(e),l=Kt(n);let r=0,i=o.length-1,a=l.length-1;for(;r<=i&&r<=a&&o[r]===l[r];)r++;for(;i>=r&&a>=r&&o[i]===l[a];)i--,a--;const u=Math.max(0,i-r+1),s=Math.max(0,a-r+1);let c;if(0===u||0===s)c={removed:u,added:s};else if((u+1)*(s+1)<=15e5){const e=/* @__PURE__ */new Map,n=new Uint32Array(s);for(let t=0;t<s;t++){const o=l[r+t];let i=e.get(o);void 0===i&&(i=e.size+1,e.set(o,i)),n[t]=i}const i=new Uint32Array(u);for(let l=0;l<u;l++)i[l]=null!=(t=e.get(o[r+l]))?t:0;const a=s+1;let d=new Uint32Array(a),f=new Uint32Array(a);for(let t=u-1;t>=0;t--){f[s]=0;for(let o=s-1;o>=0;o--)f[o]=i[t]===n[o]?d[o+1]+1:Math.max(d[o],f[o+1]);const e=d;d=f,f=e}const m=d[0];c={removed:u-m,added:s-m}}else c={removed:u,added:s};return zt=e,jt=n,Wt=c,c}function Vt(e){var n,t,o,l,r;const i=e.isDark?"dark":"light";return void 0!==e.theme?"string"==typeof e.theme?e.theme:e.theme[i]:null!=(r=e.isDark?null!=(t=e.darkTheme)?t:null==(n=e.themes)?void 0:n[0]:null!=(l=e.lightTheme)?l:null==(o=e.themes)?void 0:o[1])?r:`vitesse-${i}`}function qt(e,n=!1){const t=e.toLowerCase();return t?/dark|night|moon|black|dracula|mocha|frappe|macchiato|ocean|poimandres|monokai|laserwave|tokyo|rose-pine|material-theme/.test(t)&&!/light|latte|dawn|lotus/.test(t):n}function Ut(e){const n=Vt(e),t="vitesse-dark"===n||"vitesse-light"!==n&&qt(n,!0===e.isDark);if("vitesse-dark"!==n&&"vitesse-light"!==n){const e=t?"var(--markstream-code-theme-bg, #121212)":"var(--markstream-code-theme-bg, #ffffff)";return{builtin:!1,dark:t,name:n,background:e,diffAddedLine:`color-mix(in lab, ${e} ${t?"80%":"88%"}, ${t?"#4d9375":"#1e754f"})`,diffAddedNumber:`color-mix(in lab, ${e} ${t?"85%":"91%"}, ${t?"#4d9375":"#1e754f"})`,diffRemovedLine:`color-mix(in lab, ${e} ${t?"80%":"88%"}, ${t?"#cb7676":"#ab5959"})`,diffRemovedNumber:`color-mix(in lab, ${e} ${t?"85%":"91%"}, ${t?"#cb7676":"#ab5959"})`,foreground:t?"var(--markstream-code-theme-fg, #dbd7caee)":"var(--markstream-code-theme-fg, #393a34)",lineNumber:t?"var(--markstream-code-theme-line-number, #dedcd550)":"var(--markstream-code-theme-line-number, #393a3450)"}}return t?{builtin:!0,dark:!0,name:n,background:"#121212",diffAddedLine:"color-mix(in lab, #121212 80%, #4d9375)",diffAddedNumber:"color-mix(in lab, #121212 85%, #4d9375)",diffRemovedLine:"color-mix(in lab, #121212 80%, #cb7676)",diffRemovedNumber:"color-mix(in lab, #121212 85%, #cb7676)",foreground:"#dbd7caee",lineNumber:"#dedcd550"}:{builtin:!0,dark:!1,name:n,background:"#ffffff",diffAddedLine:"color-mix(in lab, #ffffff 88%, #1e754f)",diffAddedNumber:"color-mix(in lab, #ffffff 91%, #1e754f)",diffRemovedLine:"color-mix(in lab, #ffffff 88%, #ab5959)",diffRemovedNumber:"color-mix(in lab, #ffffff 91%, #ab5959)",foreground:"#393a34",lineNumber:"#393a3450"}}const Jt=12,Gt=18;function Xt(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Yt(e){var n,t,o,l,r,i;const a=null!=(n=Xt(null==e?void 0:e.fontSize))?n:12,u=null!=(t=Xt(null==e?void 0:e.lineHeight))?t:12===a?18:Math.max(12,Math.round(1.5*a)),s="string"==typeof(null==e?void 0:e.fontFamily)&&e.fontFamily.trim()?e.fontFamily.trim():'"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace',c=null!=(o="number"==typeof(d=null==e?void 0:e.padding)&&Number.isFinite(d)&&d>=0?d:void 0)?o:8;var d;return{fontFamily:s,fontSize:a,lineHeight:u,maxHeight:null!=(l=Xt(null==e?void 0:e.maxHeight))?l:500,overflow:null!=(r=null==e?void 0:e.overflow)?r:"wrap",padding:c,paddingBottom:c,scrollbarGutter:6,tabSize:null!=(i=Xt(null==e?void 0:e.tabSize))?i:4}}function Zt(e,n,t){return P({name:e,inheritAttrs:!1,setup(e,{attrs:o,slots:l}){var r,i;const s=ut(),c=rt(),d=it(),f="undefined"!=typeof window&&1===(null==(i=null==(r=Q())?void 0:r.vnode.el)?void 0:i.nodeType),m=q("undefined"==typeof window||f||!d.value),h=H(null);let v=null;function p(e){const n=e&&"$el"in e?e.$el:e;h.value=n instanceof HTMLElement?n:null}return"undefined"!=typeof window&&J([h,d],([e,n],t,o)=>{if(null==v||v.destroy(),v=null,!n||m.value)return void(m.value=!0);if(!e)return;let l=!0;const r=s(e,{rootMargin:null==c?void 0:c.value.heavyBlockMargin,allowIdle:!1});v=r,m.value=r.isVisible.value,r.whenVisible.then(()=>{l&&v===r&&(m.value=!0)}),o(()=>{l=!1,r.destroy(),v===r&&(v=null)})},{immediate:!0}),ne(()=>{null==v||v.destroy(),v=null}),()=>j(m.value?n:t,u(a({},o),{ref:p}),l)}})}const Qt=P({name:"CodeBlockNodeLoadingShell",inheritAttrs:!1,props:["node","isDark","loading","stream","codeBlockOptions","showLineNumbers","theme","darkTheme","lightTheme","isShowPreview","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","enableFontSizeControl","minWidth","maxWidth","themes","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","indexKey","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline","diffInline","diffHideUnchangedRegions","reservedHeightPx"],emits:["click","mouseover","mouseout","copy","previewCode","handleArtifactClick"],setup(e,{attrs:n}){const t=e,o=Le();return()=>{var e,l,r,i,s,c,d,f,m,h,v,p;const g=null!=(e=t.codeBlockOptions)?e:{},y=Yt(g),k=Ut({darkTheme:t.darkTheme,isDark:t.isDark,lightTheme:t.lightTheme,theme:t.theme,themes:t.themes}),b=Ce(String(null!=(r=null==(l=t.node)?void 0:l.language)?r:"")),N=Ft(t.node),S=Et(String(null!=(s=null==(i=t.node)?void 0:i.raw)?s:""),Be[b]||("typescript"===b?"TypeScript":b?b.charAt(0).toUpperCase()+b.slice(1):Be[""]),N),x=N?Ae({originalCode:null==(c=t.node)?void 0:c.originalCode,updatedCode:null==(d=t.node)?void 0:d.updatedCode,loading:!0,matchCache:o}).flatMap(e=>e.lines):[],w=N?{removed:x.filter(e=>"removed"===e.kind).length,added:x.filter(e=>"added"===e.kind).length}:null,M=Number(null!=(f=t.estimatedContentHeightPx)?f:t.reservedHeightPx),C=!N&&Number.isFinite(M)&&M>0?Math.min(y.maxHeight,Math.ceil(M)):void 0,B=e=>j("button",{class:`code-action-btn code-loading-action code-loading-action--${e} inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0`,"aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"}),_=!1!==t.showExpandButton||!1!==t.showPreviewButton&&!1!==t.isShowPreview&&("html"===b||"svg"===b)||!1!==t.showFontSizeButtons&&!1!==t.enableFontSizeControl,O=e=>null==e?void 0:"number"==typeof e?`${e}px`:String(e),T={"--code-bg":k.background,"--code-fg":k.foreground,"--code-line-number":k.lineNumber,"--markstream-code-fallback-bg":k.background,"--markstream-code-fallback-fg":k.foreground,"--markstream-diff-added-line-fill":k.diffAddedLine,"--markstream-diff-added-number-fill":k.diffAddedNumber,"--markstream-diff-editor-bg":k.background,"--markstream-diff-metadata-bg":k.background,"--markstream-diff-metadata-fg":k.lineNumber,"--markstream-diff-removed-line-fill":k.diffRemovedLine,"--markstream-diff-removed-number-fill":k.diffRemovedNumber,"--markstream-diff-shell-bg":k.background,"--markstream-pre-resolved-theme-bg":k.background,"--markstream-pre-resolved-theme-fg":k.foreground,"--markstream-pre-resolved-theme-line-number":k.lineNumber};return j("div",u(a({},n),{class:["code-block-container rounded-lg border",{dark:!0===t.isDark,"is-dark":k.dark,"is-rendering":!1!==t.loading,"is-diff":N},n.class],style:[a(u(a({},T),{backgroundColor:k.background,color:k.foreground,minWidth:O(t.minWidth),maxWidth:O(t.maxWidth)}),N?{}:{borderColor:"var(--markstream-code-border-color, var(--code-border))"}),n.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":t.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[!1===t.showHeader?null:j("div",{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)]"},[j("div",{class:"code-header-main"},[j("span",{class:"icon-slot h-4 w-4 flex-shrink-0","aria-hidden":"true",innerHTML:_e(b)}),j("div",{class:"code-header-copy"},[j("div",{class:"code-header-title"},S.title),S.caption?j("div",{class:"code-header-caption"},S.caption):null])]),j("div",{class:"flex items-center gap-0.5"},[w?j("div",{class:"code-diff-stats","aria-label":`-${w.removed} +${w.added}`},[j("span",{class:"code-diff-stat removed"},`-${w.removed}`),j("span",{class:"code-diff-stat added"},`+${w.added}`)]):null,!1===t.showCopyButton?null:B("copy"),!1===t.showCollapseButton?null:B("collapse"),_?j("div",{class:"relative"},[B("more")]):null])]),j("div",{class:"code-block-shell-content",style:!1!==t.stream||!1===t.loading?void 0:{display:"none"}},[j(It,{node:t.node,loading:t.loading,showLineNumbers:null!=(m=t.showLineNumbers)?m:!0!==g.disableLineNumbers,diffInline:N&&Boolean(null!=(v=null!=(h=t.diffInline)?h:t.estimatedDiffInline)?v:"unified"===g.diffStyle),diffHideUnchangedRegions:N?null!=(p=t.diffHideUnchangedRegions)?p:Ht(g):void 0,reservedHeightPx:C,class:["code-pre-fallback",{"is-wrap":"wrap"===y.overflow}],style:u(a({},T),{"--markstream-code-padding-x":`${y.padding}px`,"--markstream-code-padding-y":`${y.padding}px`,"--markstream-code-tab-size":y.tabSize,"--markstream-pre-diff-line-height":`${y.lineHeight}px`,backgroundColor:k.background,color:k.foreground,fontFamily:y.fontFamily,fontSize:`${y.fontSize}px`,lineHeight:`${y.lineHeight}px`,maxHeight:`${null!=C?C:y.maxHeight}px`,overflow:"auto",paddingTop:`${y.padding}px`,paddingBottom:`${y.paddingBottom}px`,tabSize:y.tabSize,whiteSpace:"wrap"===y.overflow?"pre-wrap":"pre",overflowWrap:"wrap"===y.overflow?"anywhere":"normal"}),"data-markstream-code-loading":"1"})]),j("div",{class:"code-loading-placeholder",style:!1===t.stream&&!1!==t.loading?void 0:{display:"none"}},[j("div",{class:"loading-skeleton"},[j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line short"})])])])}}}),eo=le({loader:()=>import("./PreCodeBlock.js"),loadingComponent:Qt,delay:0,suspensible:!0}),no=Zt("ViewportDeferredCodeBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load the enhanced CodeBlockNode chunk; falling back to preformatted code rendering. Enhanced code blocks require the optional "stream-diffs" peer.',e),It}}),loadingComponent:Qt,delay:0,suspensible:!1}),Qt),to=le(()=>s(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 j(At,u(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{return yield Ie(),(yield import("./index6.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 j(At,u(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:""}$`}}))}})),oo=le(()=>s(null,null,function*(){try{return yield Ie(),(yield import("./index5.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 j(At,u(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:""}$$`}}))}})),lo=["data-reference-id","data-markstream-reference-id"],ro=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),E("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0","data-reference-id":e.node.id,"data-markstream-reference-id":e.node.id,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))},z(e.node.id),41,lo))}),[["__scopeId","data-v-b96c91c3"]]);ro.install=e=>{e.component(ro.__name,ro)};const io={class:"superscript-node"},ao=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,emphasis:Mo,footnote_reference:dn,strikethrough:ho,highlight:xo,insert:No,subscript:so,emoji:un,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("sup",io,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);ao.install=e=>{e.component(ao.__name,ao)};const uo={class:"subscript-node"},so=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,emphasis:Mo,footnote_reference:dn,strikethrough:ho,highlight:xo,insert:No,superscript:ao,emoji:un,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("sub",uo,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);so.install=e=>{e.component(so.__name,so)};const co={class:"strong-node"},fo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:un,footnote_reference:dn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("strong",co,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:t,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":n.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);fo.install=e=>{e.component(fo.__name,fo)};const mo={class:"strikethrough-node"},ho=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,emphasis:Mo,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:un,footnote_reference:dn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("del",mo,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);ho.install=e=>{e.component(ho.__name,ho)};const vo=["href","title","aria-label","aria-hidden","target","rel"],po=["aria-hidden"],go={class:"link-text-wrapper relative inline-flex"},yo={class:"leading-[normal] link-text"},ko=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=$(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=$(()=>{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,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--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&&(s["--link-color"]=n.color),s}),r=Ze(()=>n.customId),i=$(()=>a({text:At,strong:fo,strikethrough:ho,emphasis:Mo,image:vt,html_inline:wn,inline_code:On},r.value)),u=U(),s=$(()=>{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 vn(l,"safe","a")}),c=$(()=>a(a({},u),s.value)),d=$(()=>{var e,t;return vn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=$(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(S(d.value)?"_blank":void 0)}),m=$(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=$(()=>{if(!d.value)return;const e=c.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),v=$(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&qn()}const g=$(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(F(),E("span",ae({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},V(u),{style:l.value}),[K("span",go,[K("span",yo,[D(V(At),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=K("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,po)):(F(),E("a",ae({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";Vn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),E(G,null,Z(e.node.children,(t,o)=>(F(),re(V(yt),{key:`${e.indexKey||"emphasis"}-${o}`,components:i.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))],16,vo))}}}),[["__scopeId","data-v-a414d325"]]);ko.install=e=>{e.component(ko.__name,ko)};const bo={class:"insert-node"},No=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,subscript:so,superscript:ao,emoji:un,footnote_reference:dn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("ins",bo,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);No.install=e=>{e.component(No.__name,No)};const So={class:"highlight-node"},xo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,emphasis:Mo,strikethrough:ho,insert:No,subscript:so,superscript:ao,emoji:un,footnote_reference:dn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("mark",So,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);xo.install=e=>{e.component(xo.__name,xo)};const wo={class:"emphasis-node"},Mo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>a({text:At,inline_code:On,link:ko,html_inline:wn,strong:fo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:un,footnote_reference:dn,math_inline:to,reference:ro},t.value));return(t,l)=>(F(),E("em",wo,[(F(!0),E(G,null,Z(e.node.children,(t,l)=>(F(),re(V(yt),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Mo.install=e=>{e.component(Mo.__name,Mo)};const Co={class:"hard-break"},Bo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),E("br",Co))}),[["__scopeId","data-v-50c58f70"]]);Bo.install=e=>{e.component(Bo.__name,Bo)};const _o=/* @__PURE__ */P({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=me({checkbox:rn,checkbox_input:rn,emoji:un,emphasis:Mo,hardbreak:Bo,highlight:xo,inline_code:On,insert:No,link:ko,reference:ro,strikethrough:ho,strong:fo,subscript:so,superscript:ao,text:At}),o=Ze(()=>n.customId),l=$(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),E(G,null,Z(e.nodes,(t,o)=>(F(),re(V(yt),{key:o,components:l.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"inline"}-${o}`},null,8,["components","node","custom-id","index-key"]))),128))}});function Oo(e){if(!e||"object"!=typeof e)return!1;const n=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(n))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(n))return!0;const t=e.children;return Array.isArray(t)&&t.every(Oo)}function To(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Oo))return e;if(!n||1!==e.length)return null;const o=e[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const l=o.children;return(t||l.length>0)&&l.every(Oo)?l:null}function Io(e){var n,t;if(!(null==e?void 0:e.length))return null;let o="";for(const l of e){if("text"!==(null==l?void 0:l.type)||!0===l.center)return null;o+=String(null!=(t=null!=(n=l.content)?n:l.raw)?t:"")}return o}const Lo=["cite"],Ao={key:0,dir:"auto",class:"paragraph-node"},Ho=["custom-id"],Ro=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=Ze(()=>n.customId),o=$(()=>Boolean(t.value.paragraph)),l=$(()=>Boolean(t.value.text)),r=$(()=>To(n.node.children,!o.value)),i=$(()=>!1!==n.fade||l.value?null:Io(r.value));return ee("markstreamShowTooltips",$(()=>n.showTooltips)),ee("markstreamFade",$(()=>n.fade)),(t,o)=>(F(),E("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),E("p",Ao,[null!==i.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(i.value),9,Ho)):(F(),re(V(_o),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),re(V(ja),{key:1,"show-tooltips":n.showTooltips,"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,Lo))}}),[["__scopeId","data-v-abfecebc"]]);Ro.install=e=>{e.component(Ro.__name,Ro)};const $o={class:"definition-list"},Po={class:"definition-term"},Fo={class:"definition-desc"},Eo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(F(),E("dl",$o,[(F(!0),E(G,null,Z(n.node.items,(o,l)=>(F(),E(G,{key:l},[K("dt",Po,[D(V(ja),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),K("dd",Fo,[D(V(ja),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Eo.install=e=>{e.component(Eo.__name,Eo)};const Ko=["href","title"],zo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth",block:"center"})}return(n,o)=>(F(),E("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Ko))}}),[["__scopeId","data-v-e1eb37b6"]]);zo.install=e=>{e.component(zo.__name,zo)};const jo=["id"],Wo={class:"flex-1"},Do=/* @__PURE__ */P({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(F(),E("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[K("div",Wo,[D(V(ja),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,jo))}});Do.install=e=>{e.component(Do.__name,Do)};const Vo=["custom-id"],qo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=R("markstreamFade",void 0),l=$(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Io(n.node.children)),r=$(()=>a({text:At,inline_code:On,link:ko,image:vt,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:un,checkbox:rn,checkbox_input:rn,footnote_reference:dn,hardbreak:Bo,math_inline:to,reference:ro},t.value));return(t,o)=>(F(),re(ie(`h${e.node.level}`),ae({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:ue(()=>[null!==l.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(l.value),9,Vo)):(F(!0),E(G,{key:1},Z(e.node.children,(t,o)=>(F(),re(V(yt),{key:o,components:r.value,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${o}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Uo=qo;Uo.install=e=>{e.component(qo.__name,qo)};const Jo={key:0,dir:"auto",class:"paragraph-node"},Go=["custom-id"],Xo={dir:"auto",class:"paragraph-node"},Yo=["custom-id"],Zo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=$(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Ze(()=>n.customId),l=$(()=>Boolean(o.value.paragraph)),r=$(()=>Boolean(o.value.text)),i=$(()=>{var e;return To(null==(e=t.value)?void 0:e.children,!l.value)}),a=$(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=To([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=$(()=>u()?Io(i.value):null),c=$(()=>{var e;return u()?Io(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=$(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return ee("markstreamShowTooltips",$(()=>n.showTooltips)),ee("markstreamFade",$(()=>n.fade)),(e,o)=>{var l,r;return F(),E("li",ae({class:"list-item",dir:"auto"},f.value),[i.value?(F(),E("p",Jo,[null!==s.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(s.value),9,Go)):(F(),re(V(_o),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(F(),E(G,{key:1},[K("p",Xo,[null!==c.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(c.value),9,Yo)):(F(),re(V(_o),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(F(!0),E(G,null,Z(a.value.nestedLists,(t,l)=>(F(),re(V(ja),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(F(),re(V(ja),{key:2,"show-tooltips":n.showTooltips,"index-key":`list-item-${n.indexKey}`,nodes:null!=(r=null==(l=t.value)?void 0:l.children)?r:[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,onCopy:o[1]||(o[1]=n=>e.$emit("copy",n))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);Zo.install=e=>{e.component(Zo.__name,Zo)};const Qo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=Ze(()=>e.customId),t=$(()=>n.value.list_item||Zo);return(n,o)=>(F(),re(ie(e.node.ordered?"ol":"ul"),{class:W(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:ue(()=>[(F(!0),E(G,null,Z(e.node.items,(l,r)=>{var i;return F(),re(ie(t.value),ae({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,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);Qo.install=e=>{e.component(Qo.__name,Qo)};const el={key:2,class:"html-block-node__raw"},nl=["innerHTML"],tl={key:1,class:"html-block-node__placeholder"},ol=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){var n;const t=e,o=R("markstreamHtmlPolicy",void 0),l=R("markstreamNestedRendererProps",void 0),r=$(()=>{var e,n;return null!=(n=null!=(e=t.htmlPolicy)?e:null==o?void 0:o.value)?n:"safe"}),i=$(()=>{var e,n;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(n=t.customId)?n:o.customId,htmlPolicy:r.value})}),c=le({loader:()=>Promise.resolve().then(()=>Wa),suspensible:!1}),d=$(()=>{const e=m(t.node.attrs,r.value);if(!e)return;const n=h(e);return Object.keys(n).length>0?n:void 0}),f=$(()=>{const e=String(t.node.tag||"").trim(),n=m(t.node.attrs,r.value,e);if(!n)return;const o=h(n);return Object.keys(o).length>0?o:void 0}),v=Ze(()=>t.customId),p=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),g=q(null);function y(e,n,t,o){if(!0!==e)return!1;const l=String(null!=n?n:"");if(!l)return!1;if(l!==String(null!=t?t:""))return!0;const r=String(null!=o?o:"").trim();return!!r&&!1===l.toLowerCase().includes(`</${r.toLowerCase()}`)}const N=q(y(t.node.loading,t.node.raw,t.node.content,t.node.tag)),S=q("undefined"==typeof window||N.value),w=q(t.node.content),M=q(0),C=q(String(null!=(n=t.node.raw)?n:"")),B=$(()=>Array.isArray(t.node.children)?t.node.children:[]);J(()=>[t.node.loading,t.node.raw,t.node.content,t.node.tag],([e,n,t,o])=>{const l=String(null!=n?n:""),r=!C.value||l.startsWith(C.value),i=y(e,n,t,o);r?i&&(N.value=!0):(N.value=i,M.value=0),i&&(S.value=!0),C.value=l},{flush:"sync"});const _=$(()=>String(t.node.tag||"div")),O=$(()=>{var e;if("details"!==_.value.trim().toLowerCase())return null;if(null==(e=t.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const n=B.value[0];return"html_block"===(null==n?void 0:n.type)&&"summary"===String(n.tag||"").toLowerCase()?n:null}),T=$(()=>{var e;return Io(null==(e=O.value)?void 0:e.children)}),I=$(()=>{const e=O.value;if(!e)return;const n=m(e.attrs,r.value,"summary");if(!n)return;const t=h(n);return Object.keys(t).length>0?t:void 0}),L=$(()=>null==T.value?B.value:B.value.slice(1)),A=$(()=>{const e=_.value.trim().toLowerCase();return x.has(e)||k(e,r.value)}),j=$(()=>B.value.length>0&&!!t.node.tag&&!A.value),W=$(()=>{var e,n,o;if(j.value)return{mode:"structured"};if(!S.value)return{mode:"html",content:null!=(e=w.value)?e:""};const l=null!=(n=w.value)?n:t.node.content;if(!l)return{mode:"html",content:""};if("escape"===r.value)return{mode:"html",content:b(l,r.value)};const i=N.value||!0===t.node.loading,a=Sn(l,v.value,r.value,i);return a.ok&&(i||a.hasCustomComponents)?{mode:"dynamic",nodes:a.nodes}:i?{mode:"text",content:null!=(o=t.node.raw)?o:l}:{mode:"html",content:b(l,r.value)}}),D=ut(),U=rt(),X=it(),Z=H(null),Q=!!t.node.loading;let ee=null;return"undefined"!=typeof window?(J([()=>g.value,()=>t.node.loading,N],([e,n,o],l,r)=>{if(null==ee||ee.disconnect(),ee=null,!e||!o||!1===n||"undefined"==typeof ResizeObserver)return;const i=new ResizeObserver(e=>{var n,o;if(!N.value||!1===t.node.loading)return;const l=e[0],r=Array.isArray(null==l?void 0:l.borderBoxSize)?l.borderBoxSize[0]:null==l?void 0:l.borderBoxSize,i=null!=(o=null!=(n=null==r?void 0:r.blockSize)?n:null==l?void 0:l.contentRect.height)?o:0;i>M.value&&(M.value=i)});ee=i,i.observe(e),r(()=>i.disconnect())},{immediate:!0}),J(()=>t.node.loading,e=>s(null,null,function*(){!1!==e||!N.value||M.value<=0||(yield oe(),requestAnimationFrame(()=>{!1===t.node.loading&&(M.value=0)}))})),J([()=>g.value,()=>null==U?void 0:U.value.heavyBlockMargin,()=>null==U?void 0:U.value.rootMargin],([e],n,o)=>{var l,r,i,a;if(null==(r=null==(l=Z.value)?void 0:l.destroy)||r.call(l),Z.value=null,!Q)return S.value=!0,void(w.value=t.node.content);if(!e)return void(N.value||(S.value=!1));let u=!0;const s=null!=(a=null!=(i=null==U?void 0:U.value.heavyBlockMargin)?i:null==U?void 0:U.value.rootMargin)?a:lt,c=D(e,{rootMargin:s,allowIdle:!X.value});Z.value=c,S.value=S.value||c.isVisible.value,c.whenVisible.then(()=>{u&&Z.value===c&&(S.value=!0)}),o(()=>{u=!1,c.destroy(),Z.value===c&&(Z.value=null)})},{immediate:!0}),J(()=>t.node.content,e=>{Q&&!S.value||(w.value=e)})):S.value=!0,ne(()=>{var e,n;null==ee||ee.disconnect(),ee=null,null==(n=null==(e=Z.value)?void 0:e.destroy)||n.call(e),Z.value=null}),(n,t)=>(F(),re(ie(j.value?_.value:"div"),ae({ref_key:"htmlRef",ref:g,class:"html-block-node",style:M.value>0?{boxSizing:"border-box",minHeight:`${M.value}px`}:void 0,"data-markstream-viewport-pending":V(X)&&!S.value?"true":void 0},j.value?f.value:void 0),{default:ue(()=>[S.value?(F(),E(G,{key:0},["structured"===W.value.mode?(F(),E(G,{key:0},[null!==T.value?(F(),E(G,{key:0},[K("summary",he(ve(I.value)),z(T.value),17),L.value.length?(F(),re(V(c),ae({key:0},i.value,{nodes:L.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Y("",!0)],64)):(F(),re(V(c),ae({key:1},i.value,{nodes:B.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===W.value.mode?(F(),re(V(p),{key:1,nodes:W.value.nodes},null,8,["nodes"])):"text"===W.value.mode?(F(),E("pre",el,z(W.value.content),1)):(F(),E("div",ae({key:3},d.value,{innerHTML:W.value.content}),null,16,nl))],64)):(F(),E("div",tl,[te(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=K("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=K("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=K("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["style","data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-08559f85"]]);ol.install=e=>{e.component(ol.__name,ol)};const ll={dir:"auto",class:"paragraph-node"},rl=["custom-id"],il=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=Ze(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamFade",void 0),r=R("markstreamParseOptions",void 0),i=R("markstreamCustomMarkdownIt",void 0),s=R("markstreamNestedRendererProps",void 0),c=$(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=$(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=$(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=$(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=$(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})});function v(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const p=$(()=>n.node.children.filter(e=>!v(e))),g=$(()=>p.value.length>0&&p.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=>!v(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),y=$(()=>new Set(w(m.value))),k=$(()=>{if(!g.value||p.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const o=n.node.children[t];if(!v(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!v(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=$(()=>!1===(null==l?void 0:l.value)&&!t.value.text),N=$(()=>b.value?Io(k.value):null);function S(e,t){return a({node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value},"reference"===e.type?{"data-markstream-reference-id":String(e.id)}:{})}function x(e){var n,o;const l=e,r=String(l.type);if(t.value[r])return null;const i=function(e){if(!Array.isArray(e))return"";const n=[];for(const t of e){if(!t||"object"!=typeof t)return null;const e=x(t);if(null==e)return null;n.push(e)}return n.join("")}(l.children);if(null==i)return null;const a=[r,l.loading,i];switch(r){case"text":return[...a,l.content,l.center].join("");case"inline_code":return[...a,l.code].join("");case"image":return[...a,l.src,l.alt,l.title].join("");case"link":return[...a,l.href,l.title,l.text,JSON.stringify(null!=(n=l.attrs)?n:null)].join("");case"html_inline":case"html_block":return[...a,l.tag,l.content,l.autoClosed,JSON.stringify(null!=(o=l.attrs)?o:null)].join("");case"emoji":return[...a,l.name,l.markup].join("");case"checkbox":case"checkbox_input":return[...a,l.checked].join("");case"math_inline":return[...a,l.content,l.markup].join("");case"reference":case"footnote_anchor":case"footnote_reference":return[...a,l.id].join("");case"hardbreak":case"emphasis":case"strong":case"strikethrough":case"highlight":case"insert":case"subscript":case"superscript":return a.join("");default:return null}}const B=/* @__PURE__ */new Map,_=$(()=>a({inline_code:On,image:vt,link:ko,hardbreak:Bo,emphasis:Mo,strong:fo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,html_inline:wn,html_block:ol,emoji:un,checkbox:rn,math_inline:to,checkbox_input:rn,reference:ro,footnote_anchor:zo,footnote_reference:dn,text:At},t.value)),O=$(()=>{const e=k.value;if(B.size>e.length)for(const n of B.keys())n>=e.length&&B.delete(n);return e.map((e,o)=>{var l;const r=x(e),i=B.get(o),s=null!=r&&(null==i?void 0:i.sig)===r?i.child:e;null==r?B.delete(o):B.set(o,{child:s,sig:r});const d=function(e){var n,o,l,r;if("html_block"===e.type||"html_inline"===e.type){const t=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||M(e.content);if(t&&!y.value.has(t)&&C(null!=(o=e.content)?o:e.raw,t)){const n=String(null!=(r=null!=(l=e.content)?l:e.raw)?r:"");return{child:{type:"text",content:n,raw:n},component:At,isCustomComponent:!1}}}return{child:e,component:_.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Ue(String(e.type)))}}(s);return u(a({},d),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:d.isCustomComponent?yn(d.child,c.value):void 0,hasSlotChildren:Array.isArray(d.child.children)&&d.child.children.length>0,slotContent:String(null!=(l=d.child.content)?l:""),originalChild:s})})});return(e,t)=>(F(),E("p",ll,[null!==N.value?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(N.value),9,rl)):(F(!0),E(G,{key:1},Z(O.value,e=>{return F(),E(G,{key:e.key},[g.value&&v(e.originalChild)?(F(),E(G,{key:0},[X(z((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:ue(()=>[e.hasSlotChildren?(F(),re(V(pt),ae({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(V(pt),ae({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Y("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(F(),re(ie(e.component),ae({key:2,ref_for:!0},S(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-0498f5d7"]]);il.install=e=>{e.component(il.__name,il)};const al={class:"table-node-wrapper"},ul=["aria-busy"],sl={key:0},cl=["custom-id"],dl=["aria-label","onPointerdown"],fl=["custom-id"],ml={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},hl=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=$(()=>{var e;return null!=(e=n.node.loading)&&e}),o=$(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=q(null),r=q([]);let i=null;const a=$(()=>n.node.header.cells.length),u=$(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=$(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);ee("markstreamShowTooltips",$(()=>n.showTooltips)),ee("markstreamFade",$(()=>n.fade));const c=Ze(()=>n.customId),d=$(()=>Boolean(c.value.text)),f=$(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=To(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Io(r):null};return m.set(e,{children:e.children,textFastPath:t,paragraphFastPath:o,info:i}),i}function v(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 p(){i&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),i=null)}return J(a,()=>{p(),r.value=[]}),ne(p),(a,c)=>(F(),E("div",al,[K("table",{ref_key:"tableRef",ref:l,class:W(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),E("colgroup",sl,[(F(!0),E(G,null,Z(e.node.header.cells,(e,n)=>(F(),E("col",{key:n,style:se(s.value[n])},null,4))),128))])):Y("",!0),K("thead",null,[K("tr",null,[(F(!0),E(G,null,Z(e.node.header.cells,(t,o)=>(F(),E("th",{key:o,dir:"auto",class:W(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(h(t).plainText),9,cl)):h(t).simpleChildren?(F(),re(V(_o),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),re(V(ja),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(F(),E("button",{key:3,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",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,dl)):Y("",!0)],2))),128))])]),K("tbody",null,[(F(!0),E(G,null,Z(o.value,(e,t)=>(F(),E("tr",{key:t},[(F(!0),E(G,null,Z(e.cells,(e,o)=>(F(),E("td",{key:o,class:W(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),E("span",{key:0,class:"text-node","custom-id":n.customId},z(h(e).plainText),9,fl)):h(e).simpleChildren?(F(),re(V(_o),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),re(V(ja),{key:2,nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[1]||(c[1]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,ul),D(pe,{name:"table-node-fade"},{default:ue(()=>[t.value?(F(),E("div",ml,[te(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=K("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=K("span",{class:"sr-only"},"Loading",-1))],!0)])):Y("",!0)]),_:3})]))}}),[["__scopeId","data-v-cd7fd3ec"]]);hl.install=e=>{e.component(hl.__name,hl)};const vl={class:"hr-node"},pl=/* @__PURE__ */ln({},[["render",function(e,n){return F(),E("hr",vl)}],["__scopeId","data-v-39b2349c"]]);pl.install=e=>{e.component(pl.__name,pl)};const gl={class:"unknown-node"},yl=/* @__PURE__ */P({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),E("div",gl,z(e.node.raw),1))}),kl=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=$(()=>`vmr-container vmr-container-${n.node.name}`),o=Ze(()=>n.customId),l=$(()=>a({text:At,paragraph:il,heading:Uo,inline_code:On,link:ko,image:vt,strong:fo,emphasis:Mo,strikethrough:ho,insert:No,subscript:so,superscript:ao,checkbox:rn,checkbox_input:rn,hardbreak:Bo,math_inline:to,reference:ro,list:Qo,math_block:oo,table:hl},o.value));return(o,r)=>(F(),E("div",ae({class:t.value},e.node.attrs),[(F(!0),E(G,null,Z(e.node.children,(t,o)=>{return F(),re(ie((r=t.type,l.value[r]||yl)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`,typewriter:n.typewriter,fade:n.fade,"data-markstream-reference-id":"reference"===t.type?String(t.id):void 0},null,8,["custom-id","node","index-key","typewriter","fade","data-markstream-reference-id"]);var r}),128))],16))}}),[["__scopeId","data-v-672fe0a7"]]);kl.install=e=>{e.component(kl.__name,kl)};const bl=["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"],Nl=[[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 Sl(e){if(e<=255)return bl[e];let n=0,t=Nl.length-1;for(;n<=t;){const o=n+t>>1,l=Nl[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const xl=/[ \t\n\r\f]+/g,wl=/[\t\n\r\f]| {2,}|^ | $/;let Ml=null;const Cl=new RegExp("\\p{Script=Arabic}","u"),Bl=new RegExp("\\p{M}","u"),_l=new RegExp("\\p{Nd}","u");function Ol(e){return Cl.test(e)}function Tl(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>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function Il(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(Tl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Tl(t))return!0}}return!1}const Ll=/* @__PURE__ */new Set([" "," ","⁠","\ufeff"]),Al=/* @__PURE__ */new Set(["-","‐","–","—"]);function Hl(e,n){return!(function(e){const n=Ul(e);return null!==n&&Ll.has(n)}(e)||n&&(function(e){const n=Ul(e);return null!==n&&(Rl.has(n)||Fl.has(n))}(e)||function(e){const n=Ul(e);return null!==n&&Al.has(n)}(e)))}const Rl=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),$l=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),Pl=/* @__PURE__ */new Set(["'","’"]),Fl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),El=/* @__PURE__ */new Set([":",".","،","؛"]),Kl=/* @__PURE__ */new Set(["၏"]),zl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function jl(e){if(Vl(e))return!0;let n=!1;for(const t of e)if(Fl.has(t)||Gl(t))n=!0;else if(!n||!Bl.test(t))return!1;return n}function Wl(e){for(const n of e)if(!Rl.has(n)&&!Fl.has(n))return!1;return e.length>0}function Dl(e){if(Vl(e))return!0;for(const n of e)if(!($l.has(n)||Pl.has(n)||Bl.test(n)||Gl(n)))return!1;return e.length>0}function Vl(e){let n=!1;for(const t of e)if("\\"!==t&&!Bl.test(t)){if(!($l.has(t)||Fl.has(t)||Pl.has(t)))return!1;n=!0}return n}function ql(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 Ul(e){if(0===e.length)return null;const n=ql(e,e.length);return e.slice(n)}const Jl=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Gl(e){const n=e.codePointAt(0);return void 0!==n&&function(e,n){for(let t=0;t<n.length;t+=2)if(e>=n[t]&&e<=n[t+1])return!0;return!1}(n,Jl)}function Xl(e){const n=function(e){for(const n of e)if(!Bl.test(n))return n;return null}(e);return null!==n&&_l.test(n)}function Yl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Bl.test(e))t--;else{if(!$l.has(e)&&!Pl.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Zl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ql(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 er(e,n){return e&&null!==n&&El.has(n)}function nr(e){const n=Ul(e);return null!==n&&Kl.has(n)}function tr(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 or(e){let n=e.length;for(;n>0;){const t=ql(e,n),o=e.slice(t,n);if(zl.has(o))return!0;if(!Fl.has(o))return!1;n=t}return!1}function lr(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 rr=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function ir(e){return 1===e.length?e[0]:e.join("")}function ar(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),ir(t)}function ur(e,n,t,o){if(!rr.test(e))return[{text:e,isWordLike:n,kind:"text",start:t}];const l=[];let r=null,i=[],a=t,u=!1,s=0;for(const c of e){const e=lr(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:ir(i),isWordLike:u,kind:r,start:a}),r=e,i=[c],a=t+s,u=d,s+=c.length):(i.push(c),s+=c.length)}return null!==r&&l.push({text:ir(i),isWordLike:u,kind:r,start:a}),l}function sr(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const cr=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function dr(e,n){const t=e.texts[n];return!!t.startsWith("www.")||cr.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function fr(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const mr=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),hr=/[\p{P}\p{S}\p{Co}]/u,vr=new RegExp("\\p{Emoji_Presentation}","u"),pr=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function gr(e){const n=e.charCodeAt(0);return n<128?function(e){return e>=33&&e<=47&&45!==e||e>=58&&e<=64&&63!==e||e>=91&&e<=96||e>=123&&e<=126}(n):!pr.has(e)&&!vr.test(e)&&hr.test(e)}function yr(e){let n=!1;for(const t of e)if(!Bl.test(t)){if(!gr(t))return!1;n=!0}return n}function kr(e,n,t,o){const l=!n&&yr(e),r=!o&&yr(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=ql(e,n),o=e.slice(t,n);if(!Bl.test(o))return o;n=t}return null}(e);return null!==n&&Gl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=ql(e,n),o=e.slice(t,n);if(!Bl.test(o))return gr(o)||Gl(o);n=t}return!1}(e);return!!(l||r||a)&&!Il(e)&&!Il(t)&&(n||l||i)&&(o||r)}function br(e){for(const n of e)if(_l.test(n))return!0;return!1}function Nr(e){if(0===e.length)return!1;for(const n of e)if(!_l.test(n)&&!mr.has(n))return!1;return!0}function Sr(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}function xr(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}(e):function(e){if(!wl.test(e))return e;let n=e.replace(xl," ");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=function(e,n,t){var o,l,r;const i=(null===Ml&&(Ml=new Intl.Segmenter(void 0,{granularity:"word"})),Ml);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const w of i.segment(e))for(const e of ur(w.segment,null!=(o=w.isWordLike)&&o,w.index,t)){let t=function(){null!==m[w]&&(s[w]=[Ql(u,m,h,w)],m[w]=null),s[w].push(e.text),c[w]=c[w]||e.isWordLike,v[w]=v[w]||i,p[w]=p[w]||b,g[w]=S,y[w]=x,k[w]=er(p[w],N)};const o="text"===e.kind,r=Zl(e.text,e.isWordLike,e.kind),i=Il(e.text),b=Ol(e.text),N=Ul(e.text),S=or(e.text),x=nr(e.text),w=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[w]&&i&&v[w]&&g[w]||o&&a>0&&"text"===d[w]&&Wl(e.text)&&v[w]||o&&a>0&&"text"===d[w]&&y[w]?t():o&&a>0&&"text"===d[w]&&e.isWordLike&&b&&k[w]?(t(),c[w]=!0):null!==r&&a>0&&"text"===d[w]&&m[w]===r?h[w]=(null!=(l=h[w])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[w]&&!v[w]&&(jl(e.text)||"-"===e.text&&c[w])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=b,g[a]=S,y[a]=x,k[a]=er(b,N),a++)}for(let w=0;w<a;w++)null===m[w]?u[w]=ir(s[w]):u[w]=Ql(u,m,h,w);for(let w=1;w<a;w++)"text"!==d[w]||c[w]||!Vl(u[w])||"text"!==d[w-1]||v[w-1]||(u[w-1]+=u[w],c[w-1]=c[w-1]||c[w],u[w]="");const b=Array.from({length:a},()=>null);let N=-1;for(let w=a-1;w>=0;w--){const e=u[w];if(0!==e.length){if("text"===d[w]&&!c[w]&&N>=0&&"text"===d[N]&&(Dl(e)||"-"===e&&Xl(u[N]))){const n=null!=(r=b[N])?r:[];n.push(e),b[N]=n,f[N]=f[w],u[w]="";continue}N=w}}for(let w=0;w<a;w++){const e=b[w];null!=e&&(u[w]=ar(e,u[w]))}let S=0;for(let w=0;w<a;w++){const e=u[w];0!==e.length&&(S!==w&&(u[S]=e,c[S]=c[w],d[S]=d[w],f[S]=f[w]),S++)}u.length=S,c.length=S,d.length=S,f.length=S;const x=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(!Il(n[r])||!Il(n[r+1]))continue;const e=Yl(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=[];let r=0;for(;r<e.len;){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a){const a=[i];let s=r+1,c=u;for(;s<e.len&&"text"===e.kinds[s]&&kr(e.texts[s-1],e.isWordLike[s-1],e.texts[s],e.isWordLike[s]);){const n=e.texts[s];a.push(n),c=c||e.isWordLike[s],s++}if(s>r+1){n.push(ir(a)),t.push(c),o.push("text"),l.push(e.starts[r]),r=s;continue}}n.push(i),t.push(u),o.push(a),l.push(e.starts[r]),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 u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&br(n)&&Nr(n)||(u=!1)}if(u){let i=0;for(let u=0;u<a.length;u++){const s=a[u],c=u<a.length-1?`${s}-`:s;n.push(c),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=c.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&&Nr(i)&&br(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&Nr(e.texts[u]);)a.push(e.texts[u]),u++;n.push(ir(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=u-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]),!fr(i))continue;const a=r+1;if(a>=e.len||sr(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!sr(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(ir(u)),t.push(!0),o.push("text"),l.push(s),r=c-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]||!dr(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!sr(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]=ir(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],u=e.kinds[r],s=e.starts[r];if("glue"===u){const c=[i[0]],d=s;for(r++;r<e.len&&"glue"===e.kinds[r];)c.push(e.texts[r]),r++;const f=ir(c);if(!(r<e.len&&"text"===e.kinds[r])){n.push(f),t.push(!1),o.push("glue"),l.push(d);continue}i[0]=f,i.push(e.texts[r]),a=e.isWordLike[r],u="text",s=d,r++}else r++;if("text"===u)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=ir(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(ir(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:S,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let w=0;w<x.len-1;w++){const e=tr(x.texts[w]);null!==e&&("space"!==x.kinds[w]&&"preserved-space"!==x.kinds[w]||"text"!==x.kinds[w+1]||!Ol(x.texts[w+1])||(x.texts[w]=e.space,x.isWordLike[w]=!1,x.kinds[w]="preserved-space"===x.kinds[w]?"preserved-space":"space",x.texts[w+1]=e.marks+x.texts[w+1],x.starts[w+1]=x.starts[w]+e.space.length))}return x}(r,n,l),u="keep-all"===o?function(e,n,t){if(n.len<=1)return n;const o=[],l=[],r=[],i=[];let a=-1,u=!1;function s(e){o.push(n.texts[e]),l.push(n.isWordLike[e]),r.push("text"),i.push(n.starts[e])}function c(t){if(!(a<0)){if(u)a+1===t?s(a):function(t,a){let u=!1;for(let e=t;e<a;e++)u=u||n.isWordLike[e];const s=n.starts[t],c=a<n.len?n.starts[a]:e.length;o.push(e.slice(s,c)),l.push(u),r.push("text"),i.push(s)}(a,t);else for(let e=a;e<t;e++)s(e);a=-1,u=!1}}for(let d=0;d<n.len;d++){const e=n.texts[d],s=n.kinds[d];"text"!==s?(c(d),o.push(e),l.push(n.isWordLike[d]),r.push(s),i.push(n.starts[d])):(a>=0&&!Hl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||Il(e))}return c(n.len),{len:o.length,texts:o,isWordLike:l,kinds:r,starts:i}}(r,i,n.breakKeepAllAfterPunctuation):i;return a({normalized:r,chunks:Sr(u,l)},u)}let wr=null;const Mr=/* @__PURE__ */new Map;let Cr=null;const Br=new RegExp("\\p{Emoji_Presentation}","u"),_r=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Or=null;const Tr=/* @__PURE__ */new Map;function Ir(){if(null!==wr)return wr;if("undefined"!=typeof OffscreenCanvas)return wr=new OffscreenCanvas(1,1).getContext("2d"),wr;if("undefined"!=typeof document)return wr=document.createElement("canvas").getContext("2d"),wr;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Lr(e,n){let t=n.get(e);return void 0===t&&(t={width:Ir().measureText(e).width,containsCJK:Il(e)},n.set(e,t)),t}function Ar(){if(null!==Cr)return Cr;if("undefined"==typeof navigator)return Cr={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Cr;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 Cr={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Cr}function Hr(){return null===Or&&(Or=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Or}function Rr(e){return Br.test(e)||e.includes("️")}function $r(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=Hr();for(const o of t.segment(e))Rr(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Pr(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function Fr(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Er(e,n,t=e.widths.length){for(;n<t&&Pr(e.kinds[n]);)n++;return n}function Kr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function zr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function jr(e,n){return 0===n?0:e+n}function Wr(e,n,t,o,l){return jr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function Dr(e,n,t,o){return jr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function Vr(e,n,t,o,l){return jr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function qr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function Ur(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function Jr(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Gr(e,n){return function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r}=e;if(0===t.length)return 0;const i=n+Ar().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){var t;const o=l[e],a=null!=(t=r[e])?t:null;let f=null===a?-1:Jr(a,0,n+1),m=-1,v=0,g=n;for(;g<o.length;){const t=o[g];if(s)if(u+t>i){if(null!==a&&m>n){h(e,m,v),g=m,f=Jr(a,f,g+1),m=-1,v=0;continue}h(),p(e,g,t)}else u+=t,c=e,d=g+1;else p(e,g,t);const l=g+1;null!==a&&a[f]===l&&(m=l,v=u,f++),g++}s&&c===e&&d===o.length&&(c=e+1,d=0)}let k=0;for(;k<t.length&&(s||(k=Er(e,k),!(k>=t.length)));){const e=t[k],n=Fr(o[k]);if(s)if(u+e>i){if(n){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>i&&null!==l[k]){h(),y(k,0),k++;continue}h()}else g(k,e),n&&(f=k+1,m=u-e),k++;else e>i&&null!==l[k]?y(k,0):v(k,e),n&&(f=k+1,m=u-e),k++}return s&&h(),a}(e,n);const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r,discretionaryHyphenWidth:i,chunks:a}=e;if(0===t.length||0===a.length)return 0;const u=Ar(),s=n+u.lineFitEpsilon;let c=0,d=0,f=!1,m=0,h=0,v=-1,p=0,g=0,y=null;function k(){v=-1,p=0,g=0,y=null}function b(e=m,n=h,t){c++,d=0,f=!1,k()}function N(e,n){f=!0,m=e+1,h=0,d=n}function S(e,n,t){f=!0,m=e,h=n+1,d=t}function x(e,n){f?(d+=n,m=e+1,h=0):N(e,n)}function w(n,t,o,l,r,i){if(!t)return;const a=Dr(e,n,o,r),u=Vr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function M(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:Jr(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=qr(e,!0,o),r=d+l;if(Ur(e,r)>s){if(null!==a&&c>t){b(n,c),v=c,u=Jr(a,u,v+1),c=-1;continue}b(),S(n,v,o)}else d=r,m=n,h=v+1}else S(n,v,o);const l=v+1;null!==a&&a[u]===l&&(c=l,u++),v++}f&&m===n&&h===i.length&&(m=n+1,h=0)}function C(e){c++,k()}for(let B=0;B<a.length;B++){const n=a[B];if(n.startSegmentIndex===n.endSegmentIndex){C();continue}f=!1,d=0,n.startSegmentIndex,m=n.startSegmentIndex,h=0,k();let r=n.startSegmentIndex;for(;r<n.endSegmentIndex&&(f||(r=Er(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=Fr(n),c=zr(e,f,r),k="tab"===n?Kr(d+c,e.tabStopAdvance):t[r],S=c+k,C=Wr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+Dr(e,n,r,c);if(Vr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){b(v,0);continue}if(a&&t<=s){x(r,S),b(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){b();continue}const e=v;b(e,0),r=e;continue}if(C>s&&null!==l[r]){b(),M(r,0),r++;continue}b();continue}x(r,S),w(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?M(r,0):N(r,k),w(n,a,r,k,c,S),r++;else f&&(m=r+1,h=0,v=r+1,p=d+i,g=d+i,y=n),r++}f&&(n.consumedEndSegmentIndex,b(n.consumedEndSegmentIndex,0))}return c}(e,n)}let Xr=null;function Yr(){return null===Xr&&(Xr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Xr}function Zr(e,n){const t=[];let o=[],l=0,r=!1,i=!1,a=!1;function u(){0!==o.length&&(t.push({text:1===o.length?o[0]:o.join(""),start:l}),o=[],r=!1,i=!1,a=!1)}function s(e,n,t){o=[e],l=n,r=t,i=or(e),a=$l.has(e)}function c(e,n){o.push(e),r=r||n;const t=or(e);i=1===e.length&&Fl.has(e)&&i||t,a=!1}for(const d of Yr().segment(e)){const e=d.segment,t=Il(e);0!==o.length?a||Rl.has(e)||Fl.has(e)||n.carryCJKAfterClosingQuote&&t&&i?c(e,t):r||t?(u(),s(e,d.index,t)):c(e,t):s(e,d.index,t)}return u(),t}function Qr(e,n,t){if(n.length<=1)return n;const o=[];let l=-1,r=!1;function i(t){if(!(l<0)){if(r)l+1===t?o.push(n[l]):function(t,l){const r=n[t].start,i=l<n.length?n[l].start:e.length;o.push({text:e.slice(r,i),start:r})}(l,t);else for(let e=l;e<t;e++)o.push(n[e]);l=-1,r=!1}}for(let a=0;a<n.length;a++){const e=n[a];l>=0&&!Hl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||Il(e.text)}return i(n.length),o}function ei(e,n){if("zero-width-break"===n||"soft-hyphen"===n||"hard-break"===n)return 0;if("tab"===n)return 1;let t=0;const o=Yr();for(const l of o.segment(e))t++;return t}function ni(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function ti(e,n,t,o,l){const r=Ar(),{cache:i,emojiCorrection:a}=function(e,n){Ir().font=e;const t=function(e){let n=Mr.get(e);return n||(n=/* @__PURE__ */new Map,Mr.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=Tr.get(e);if(void 0!==t)return t;const o=Ir();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 Tr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,_r.test(u)));var u;const s=$r("-",Lr("-",i),a)+(0===l?0:2*l),c=8*$r(" ",Lr(" ",i),a),d=0!==l;if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],m=[],h=[],v=[];let p=e.chunks.length<=1&&!d;const g=t?[]:null,y=[],k=[],b=[],N=t?[]:null,S=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a,u){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(p=!1),f.push(n),m.push(t),h.push(o),v.push(l),null==g||g.push(r),y.push(i),k.push(a),d&&b.push(u),null!==N&&N.push(e)}function w(e,n,t,u,s){const c=Lr(e,i),f=d?ei(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}($r(e,c,a),f,l),h="space"===n||"preserved-space"===n||"zero-width-break"===n?0:m,v=0===h?0:h+(f>0?l:0),p="space"===n||"zero-width-break"===n?0:m;if(s&&u&&e.length>1){let u="sum-graphemes";0!==l?u="segment-prefixes":Nr(e)?u="pair-context":r.preferPrefixWidthsForBreakableRuns&&(u="segment-prefixes");const s=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances&&n.breakableFitMode===l)return n.breakableFitAdvances;n.breakableFitMode=l;const r=Hr(),i=[];for(const c of r.segment(e))i.push(c.segment);if(i.length<=1)return n.breakableFitAdvances=null,n.breakableFitAdvances;if("sum-graphemes"===l){const e=[];for(const n of i){const l=Lr(n,t);e.push($r(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=$r(n,Lr(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Lr(i,t);e.push($r(i,a,o)-r)}l=n,r=i}return n.breakableFitAdvances=e,n.breakableFitAdvances}const a=[];let u="",s=0;for(const c of i){u+=c;const e=$r(u,Lr(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,c,i,a,u),d=null===s||"keep-all"===o?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const n=[];let t=0;for(const o of Yr().segment(e))t++,ni(o.segment)&&n.push(t);return 0===n.length?null:n}(e);return void x(e,m,v,p,n,t,s,d,f)}x(e,m,v,p,n,t,null,null,f)}for(let B=0;B<e.len;B++){S[B]=f.length;const n=e.texts[B],t=e.isWordLike[B],l=e.kinds[B],a=e.starts[B];if("soft-hyphen"===l){x(n,0,s,s,l,a,null,null,0);continue}if("hard-break"===l){x(n,0,0,0,l,a,null,null,0);continue}if("tab"===l){x(n,0,0,0,l,a,null,null,d?ei(n,l):0);continue}const u=Lr(n,i);if("text"===l&&u.containsCJK){const e=Zr(n,r),l="keep-all"===o?Qr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];w(e.text,"text",a+e.start,t,"keep-all"===o||!Il(e.text))}continue}w(n,l,a,t,!0)}const M=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,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,S,f.length),C=null===g?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 s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=Sl(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=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,g);return null!==N?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:b,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M,segments:N}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:b,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M}}const oi="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",li=["diff ","index ","--- ","+++ ","@@ "],ri=(()=>{const e=globalThis;if(e[oi])return e[oi];const n={configs:{},controllers:{},revision:H(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[oi]=n,n})();let ii=null;const ai=ri.revision;function ui(e){var n;return e&&null!=(n=ri.configs[e])?n:null}function si(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function ci(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function di(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!ci(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 fi(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=ii)return ii;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return ii=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),ii}catch(n){return ii=!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=ri.blockEstimateCache.get(i);if(a)return ri.blockEstimateCache.delete(i),ri.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const u=null!=(l=t.whiteSpace)?l:"pre-wrap",s=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=ri.preparedCache.get(o);if(l)return ri.preparedCache.delete(o),ri.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){var l,r;const i=null!=(l=null==o?void 0:o.wordBreak)?l:"normal",a=null!=(r=null==o?void 0:o.letterSpacing)?r:0;return ti(xr(e,Ar(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(ri.preparedCache.set(o,{prepared:r});ri.preparedCache.size>240;){const e=ri.preparedCache.keys().next().value;if(!e)break;ri.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Gr(e,n);return{lineCount:o,height:o*t}}(s,Math.max(24,r-t.widthAdjustment),t.lineHeight),d=Math.max(t.lineHeight,c.height),f=Math.max(t.lineHeight,Math.round(d+t.wrapperOverhead));for(ri.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});ri.blockEstimateCache.size>4e3;){const e=ri.blockEstimateCache.keys().next().value;if(!e)break;ri.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function mi(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=di(e.children);return o&&t.paragraph?fi(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=di(e.children),r=t.headings[o];return l&&r?fi(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=di(null==(l=r[0])?void 0:l.children);return i?fi(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=mi(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 hi(e){if(!e)return 1;const n=String(e).split(/\r\n|\n|\r/);return Math.max(1,n.length)}function vi(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function pi(e,n){return e.diff?Rt({diffStyle:n})?function(e){const n=vi(e.raw);if(n){const t=n.split(/\r?\n/);return null!=e.originalCode||null!=e.updatedCode?Math.max(1,t.filter(e=>!li.some(n=>e.startsWith(n))).length):Math.max(1,t.length)}return hi(vi(e.originalCode))+hi(vi(e.updatedCode))}(e):function(e){const n=e.originalCode,t=e.updatedCode;if(null!=n||null!=t)return Math.max(hi(vi(n)),hi(vi(t)));const o=vi(e.code).split(/\r?\n/);let l=0,r=0;for(const i of o)i.startsWith("+")&&!i.startsWith("+++")?r++:i.startsWith("-")&&!i.startsWith("---")?l++:(l++,r++);return Math.max(1,l,r)}(e):hi(vi(e.code,!0===e.loading))}function gi(e,n,t){return Math.max(1,Math.ceil(function(e,n){let t=0;for(const o of e)t+="\t"===o?n-t%n:o>="ᄀ"?2:1;return t}(e,t)/n))}function yi(e,n,t,o,l,r){var i,a,u;const s=e/(r?2:1),c=null==(null==(i=l.codeBlockOptions)?void 0:i.padding)?n:o.padding,d=null!=(u=l.showLineNumbers)?u:!0!==(null==(a=l.codeBlockOptions)?void 0:a.disableLineNumbers),f=Math.max(2,String(Math.max(1,t)).length)*n,m=d?3*n+f+2:0;return Math.max(1,Math.floor((s-m-2*c)/n))}function ki(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function bi(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=si(o.lineHeight,1.5*si(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:ki(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const Ni=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function Si(e,n={}){var t;const o={},l=new Set(null!=(t=n.omit)?t:[]);if(!e||"object"!=typeof e)return o;const r=Object.getOwnPropertyDescriptors(e);for(const[i,a]of Object.entries(r))Ni.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}function xi(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Ce(t),He(t),"d2lang"===t?"d2":""]){const n=o&&e[o];if(n)return n}}const wi=!1;function Mi(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function Ci(e,n){let t=0,o=null,l=null;const r=()=>{const n=l;l=null,o=null,n&&(t=Date.now(),e(...n))};return function(...i){const a=Date.now(),u=n-(a-t);l=i,u<=0?(o&&(clearTimeout(o),o=null),t=a,l=null,e(...i)):o||(o=setTimeout(r,u))}}function Bi(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}function _i(e){return"off"!==Bi(e)}const Oi=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Ti(){return R(Oi,null)}const Ii=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),Li=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function Ai(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Hi(e,n,t,o=22){const l=String(null!=e?e:"");if(!l)return t;const r=Math.max(18,Math.floor(Math.max(320,n)/8)),i=l.split(/\r?\n/).length,a=Math.ceil(l.length/r),u=Math.max(1,i,a);return Math.max(t,Math.ceil(u*o+12))}function Ri(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(Ii.has(o))return!0;if(!Li.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(Ri)}function $i(e){var n,t,o,l,r,i,a,u;if(!e||"object"!=typeof e)return"";const s=e,c=String(null!=(n=s.type)?n:"");if("text"===c)return String(null!=(o=null!=(t=s.content)?t:s.raw)?o:"");if("inline_code"===c)return String(null!=(i=null!=(r=null!=(l=s.code)?l:s.content)?r:s.raw)?i:"");if("emoji"===c)return String(null!=(u=null!=(a=s.name)?a:s.raw)?u:"");if("string"==typeof s.text)return s.text;const d=[];for(const f of["children","items","cells","rows"]){const e=s[f];if(Array.isArray(e)){const n=e.map($i).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function Pi(e){if(!e||"object"!=typeof e)return!1;const n=e;return"inline_code"===n.type||["children","items","cells","rows"].some(e=>{const t=n[e];return Array.isArray(t)&&t.some(Pi)})}function Fi(e,n){if(!e)return 30;const t=Math.max(18,Math.floor(Math.max(320,n)/8)),o=e.split(/\r?\n/).length,l=Math.ceil(e.length/t),r=Math.max(1,o,l);return 30+26*Math.max(0,r-1)}function Ei(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h,v;if(!e||"object"!=typeof e)return 32;const p=e,g=String(null!=(t=p.type)?t:""),y=Number.isFinite(n)&&n>0?n:640;switch(g){case"heading":return function(e){var n;const t=Number(null!=(n=e.level)?n:e.depth);return t>=4?20:3===t?30:2===t?32:44}(p);case"paragraph":return function(e,n){const t=String(null!=e?e:"");if(!t)return 28;const o=Math.max(18,Math.floor(Math.max(320,n)/8)),l=t.split(/\r?\n/).length,r=Math.ceil(t.length/o);return Math.max(1,l,r)<=1?28:Hi(t,n,34)}(String(null!=(l=null!=(o=p.raw)?o:p.content)?l:""),y);case"list":return function(e,n){var t;const o=Array.isArray(e.items)?e.items:[];if(!o.length)return 48;const l=Math.max(48,30*o.length+12);let r=12;for(const u of o)r+=Fi($i(u)||String(null!=(t=u.raw)?t:""),n);const i=Math.max(0,r-l);if(o.length>20){const e=Math.round(2.4*o.length);return Math.round(l+Math.max(e,Math.min(i,3*o.length)))}if(i<=0)return l;const a=o.length>8?8*o.length:i;return Math.round(l+Math.min(i,a))}(p,y);case"list_item":return Hi(String(null!=(i=null!=(r=p.raw)?r:p.content)?i:""),y,34);case"blockquote":return Hi(String(null!=(u=null!=(a=p.raw)?a:p.content)?u:""),y,56);case"table":return function(e,n){const t=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!t.length){const n=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*n+48)}return Math.max(120,Math.round(4+t.reduce((e,t)=>e+function(e,n){const t=Math.max(1,e.length),o=Math.max(80,(n-32)/t),l=Math.max(10,Math.floor(o/8)),r=Math.max(1,...e.map(e=>{var n;const t=$i(e)||String(null!=(n=null==e?void 0:e.raw)?n:"");return Math.ceil(t.length/l)||1}));return 54+34*Math.max(0,r-1)+(t<=3&&e.some(Pi)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(p,y);case"code_block":{const e=String(null!=(s=p.language)?s:"").trim().toLowerCase(),n=String(null!=(d=null!=(c=p.code)?c:p.raw)?d:"");return"mermaid"===e?$e(Pe(n)):"infographic"===e?Fe(Ee(n)):Hi(n,y,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return function(e,n){var t,o,l;const r=e.match(/^\s*<details\b([^>]*)>/i);return r&&!/(?:^|\s)open(?:\s|=|$)/i.test(null!=(t=r[1])?t:"")?Hi((null==(l=null==(o=e.match(/<summary\b[^>]*>([\s\S]*?)<\/summary>/i))?void 0:o[1])?void 0:l.replace(/<[^>]*>/g,"").trim())||"Details",n,28,28):Hi(e,n,96)}(String(null!=(m=null!=(f=p.raw)?f:p.content)?m:""),y);case"thematic_break":return 24;default:return Hi(String(null!=(v=null!=(h=p.raw)?h:p.content)?v:""),y,40)}}function Ki(e,n,t){return Math.min(Math.max(e,n),t)}const zi=/* @__PURE__ */new WeakMap;function ji(e,n,t){var o;const l=e;if(t.has(l))return t.get(l);const r=String(e.type).trim().toLowerCase();if(n[r])return t.set(l,!0),!0;if("code_block"===r){const r=String(null!=(o=e.language)?o:"").trim().toLowerCase();if(r&&xi(n,r))return t.set(l,!0),!0}const i=e;t.set(l,!1);const a=Object.values(i).some(e=>Array.isArray(e)?e.some(e=>la(e)&&ji(e,n,t)):la(e)&&ji(e,n,t));return t.set(l,a),a}const Wi=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Di=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","safeMarkdownMs","tokenizeMs","htmlBlockPassesMs","parseMarkdownToStructureTotalMs"],Vi=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),qi=["raw","content","code","originalCode","updatedCode"],Ui=/* @__PURE__ */new WeakMap,Ji=/* @__PURE__ */new WeakMap;let Gi=1;function Xi(){return"undefined"!=typeof performance?performance.now():Date.now()}function Yi(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function Zi(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=Ui.get(n);return t||(t=Gi++,Ui.set(n,t)),String(t)}function Qi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:Zi(n),customMarkdownIt:Zi(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:Zi(e.validateLink),preTransformTokens:Zi(e.preTransformTokens),postTransformTokens:Zi(e.postTransformTokens),postTransformNodes:Zi(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function ea(e){let n=e.length;for(;n>0&&10===e.charCodeAt(n-1);)n-=1;const t=e.lastIndexOf("\n",n-1)+1;return e.slice(t,n).trim()}function na(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function ta(e){const n=String(null!=e?e:"");return`${n.length}:${na(n)}`}function oa(e,n=/* @__PURE__ */new WeakMap,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){return e.length<=8192?ta(e):`${e.length}:${na(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${Zi(e)}`;if("object"!=typeof e)return typeof e;const o=e,l=n.get(o);if(l)return`cycle:${l}`;if(t>=6)return`object:${Zi(o)}`;const r=Zi(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>oa(e,n,t+1)).join(",")}`}if("object"==typeof e){const o=e,l=Object.keys(o).sort(),r=l.slice(0,80);return`o:${l.length}:${r.map(e=>`${e}:${oa(o[e],n,t+1)}`).join(";")}`}return typeof e}function la(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function ra(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>la(e)?ua(e,n,t+1):ra(e,n,t+1)).join(",")}`:la(e)?ua(e,n,t):oa(e,n,t)}function ia(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!qi.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${ta(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${Zi(l)}`:Vi.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${ra(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${Zi(l)}`:""}).filter(Boolean).join(";")}function aa(e){return qi.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${ta(t)}`:""}).filter(Boolean).join(";")}function ua(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Ji.get(e);if(o)return o;const l=e,r=n.get(l);if(r)return`node-cycle:${r}`;if(t>=6)return`node:${e.type}:${Zi(l)}`;const i=Zi(l);n.set(l,i);const a=function(e,n,t){const o=e,l=Array.isArray(o.children)?o.children:[],r=l.length?l.slice(0,200).map(e=>ua(e,n,t+1)).join("|"):"";return[e.type,aa(o),ia(o,n,t),l.length,r].join(":")}(e,n,t);return Ji.set(l,a),a}function sa(e,n){return ua(e)===ua(n)}function ca(e,n,t){const o=Xi(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Xi()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function da(e,n,t){return ca(n,t,()=>ua(e))}function fa(e,n,t){return da(e,t,"stabilizeSignatureMs")===da(n,t,"stabilizeSignatureMs")}function ma(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ha(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function va(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e)}function pa(e,n){return e.length===n.length&&e===n}function ga(e,n,t=0){if(t>=4)return null;if(e.type!==n.type)return!1;const o=e,l=n,r=Object.keys(o).filter(e=>"type"!==e&&"children"!==e).sort(),i=Object.keys(l).filter(e=>"type"!==e&&"children"!==e).sort();if(r.length!==i.length)return!1;for(let c=0;c<r.length;c++){const e=r[c];if(e!==i[c])return!1;const n=o[e],t=l[e];if(typeof n!=typeof t)return!1;if("string"!=typeof n){if("number"!=typeof n&&"boolean"!=typeof n&&null!=n)return null;if(!Object.is(n,t))return!1}else{if("string"!=typeof t)return!1;if(!pa(n,t))return!1}}const a=Object.prototype.hasOwnProperty.call(o,"children");if(a!==Object.prototype.hasOwnProperty.call(l,"children"))return!1;if(!a)return!0;const u=o.children,s=l.children;if(!Array.isArray(u)||!Array.isArray(s))return null;if(u.length!==s.length)return!1;for(let c=0;c<u.length;c++){const e=u[c],n=s[c];if(!la(e)||!la(n))return null;const o=ga(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function ya(e,n,t=0){if(e===n||e.type!==n.type||t>=6)return;const o=e,l=n;for(const r of["children","items","rows","cells"]){const e=o[r],n=l[r];if(!Array.isArray(e)||!Array.isArray(n))continue;const i=Math.min(e.length,n.length);for(let o=0;o<i;o++){const l=e[o],r=n[o];l!==r&&la(l)&&la(r)&&(!0===ga(l,r)?n[o]=l:ya(l,r,t+1))}}}function ka(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=ga(e,n);return null!=t?t:sa(e,n)}function ba(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return ca(t,"stabilizeSignatureMs",()=>{o=ga(e,n)}),null!=o?o:fa(e,n,t)}function Na(e,n){const t={};for(const o of Wi){const l=e[o],r=null==n?void 0:n[o];"number"==typeof l&&(t[o]=l-("number"==typeof r?r:0))}return t}function Sa(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:$(()=>!1),i=q(n.renderContent.value);let s=[],d="",f="",m="",h=!1,v="",p=/* @__PURE__ */new WeakMap;const y=function(){let e="",n=0,t=!1,o=!1,l=!1,r=!1;function i(){e="",n=0,t=!1,o=!1,l=!1,r=!1}function a(e){let i=!1;for(let a=0;a<e.length;a++){const u=e.charCodeAt(a);if(10===u||13===u){const e=10===u&&r;r=13===u,t=!1,e||(l||(o=!1,n=0),l=!1);continue}r=!1;const s=9===u||32===u;if(s||(l=!0,o&&(i=!0)),n)if(1!==n)s||(58!==u?n=91===u?1:0:(i=!0,o=!0));else{if(t){t=!1;continue}if(92===u){t=!0;continue}93===u&&(n=2)}else 91===u&&(n=1)}return i}return(n,t)=>{if(!n||!t.startsWith(n)||t.length<=n.length)return i(),[!0,0];let o=0;e!==n&&(i(),a(n),o=n.length);const l=t.slice(n.length),r=a(l);return e=t,[r,o+l.length]}}();let k,b=0,N=0,S=Xi(),x=-1,w=0;function M(e){x=Number.isInteger(e)?e:0,w+=1}function C(){k&&(clearTimeout(k),k=void 0)}function L(){C();const e=n.renderContent.value;i.value!==e&&(i.value=e),S=Xi()}J([n.renderContent,n.effectiveFinal,r],([n,t,o])=>{i.value!==n&&(!o||t||function(e,n){if(!e&&n)return!0;if(n.length<=80)return!0;if(n.length<e.length||!n.startsWith(e))return!0;const t=n.slice(e.length);return!(!t||!function(e){const n=function(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}(ea(n))&&(o=n,l=ea(o),!(/^={3,}$/.test(l)||/^-{3,}$/.test(l)||t.includes("\n\n")||/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))));var o,l}(i.value,n)?L():function(){if(N+=1,k)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(Xi()-S));n<=0?L():k=setTimeout(L,n)}())},{flush:"sync",immediate:!0}),ce(C);const A=$(()=>{var t,o,l,r;return _(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||Ue(t)||I.has(t)||g.has(t)?"":t}).filter(Boolean)))}),H=$(()=>{const{key:e,tags:t}=O(A.value);if(!e)return o;const r=l.get(e);if(r)return r;const i=B(n.instanceMsgId,{customHtmlTags:t});return l.set(e,i),i}),R=$(()=>{const n=H.value;if(!e.customMarkdownIt)return n;const t=e.customMarkdownIt(n);return n.__markstreamHasCustomParserExtensions=!0,t.__markstreamHasCustomParserExtensions=!0,t}),P=$(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=A.value,s=null!=r,c=i.length>0;return s||c||null==l.streamParse?a(a(u(a({},l),{streamParse:null==(o=l.streamParse)||o}),s?{final:r}:{}),c?{customHtmlTags:i}:{}):l}),F=$(()=>{var e;return new Set((null!=(e=P.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),E=$(()=>Qi(P.value,R.value,e.customMarkdownIt,{includeFinal:!0})),K=$(()=>Qi(P.value,R.value,e.customMarkdownIt,{includeFinal:!1}));J([E,K],([e,n],[t,o])=>{t&&(e===t&&n===o||(L(),n!==o&&(s=[],m="")))},{flush:"sync"});const z=$(()=>{var t,o,l,r,c,g,k,S,w,C,B;if(null==(t=e.nodes)?void 0:t.length)return s=[],m="",M(0),me(e.nodes.slice());const _=i.value;if(!_)return s=[],m="",M(-1),[];const O=n.debugPerformanceEnabled.value,I=O?Xi():0,L=R.value,A=E.value,H=K.value;d&&A!==d&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(L),f&&H!==f&&(s=[],m="");const $=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},F=function(e){const n=e,t=zi.get(n);if(void 0!==t)return t;const o=function(e){return JSON.stringify(Object.entries(e).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,Zi(n)]))}(e);return zi.set(n,o),o}($);v&&F!==v&&(s=[],m="",p=/* @__PURE__ */new WeakMap);const z=Object.keys($).length>0,j="function"==typeof P.value.postTransformNodes;j!==h&&(s=[],m="");const W=!j&&s.length>0&&_.startsWith(m)&&H===f,D=O?Yi(L):null,V=O?{}:void 0,q=va(L),U=z&&s.some(e=>ji(e,$,p)),J=!q&&!j&&(!z||s.length>0&&!U),G=a(u(a({},P.value),{reuseStableTopLevelNodes:J}),V?{parserMetrics:V}:{}),X=T(_,L,G),Y=O?Xi():0;if(W&&!q&&!z&&!P.value.preTransformTokens&&!P.value.postTransformTokens){const e=Math.min(s.length,X.length);for(let n=0;n<e;n++)ya(s[n],X[n])}const Z=O?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let Q,ee=O?ma(X.length):void 0,ne=0,te=0,oe=0;if(W){const n=O?Xi():0,[t,o]=z?[0,0]:function(e){var n,t;const[o,l]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!va(e.md)&&!o&&"function"!=typeof r.preTransformTokens&&"function"!=typeof r.postTransformTokens&&"function"!=typeof r.postTransformNodes&&0===(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)?e.previousDirtyStartIndex:0,l]}({content:_,previousContent:m,previousDirtyStartIndex:x,parseOptions:P.value,customMarkdownIt:e.customMarkdownIt,md:L,scanGlobalReferenceAppend:y});oe=o;const l=t<=0,r=z?e=>!ji(e,$,p):void 0;if(Z){const e=function(e,n,t,o={}){if(!n.length)return{nodes:e,metrics:ma(e.length)};const l=!1!==o.reuseDirtyTail,r=function(e,n,t,o){var l;const r=Math.min(e.length,n.length);for(let i=Math.min(r,Math.max(0,null!=(l=o.scanStartIndex)?l:0));i<r;i++){const l=n[i],r=e[i];if(o.canReuseNode&&(!o.canReuseNode(l)||!o.canReuseNode(r))||!ba(l,r,t))return i}return e.length===n.length?-1:r}(e,n,t,o);if(r<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:r,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const i=e.slice();let a=r;for(let u=0;u<r;u++)i[u]=n[u];if(l)for(let u=r;u<e.length;u++){const l=n[u],r=e[u];l&&(!o.canReuseNode||o.canReuseNode(l)&&o.canReuseNode(r))&&fa(l,r,t)&&(i[u]=l,a+=1)}return{nodes:i,metrics:{reusedNodeCount:a,dirtyStartIndex:r,stablePrefixNodeCount:r,dirtyTailNodeCount:ha(r,e,n)}}}(X,s,Z,{canReuseNode:r,reuseDirtyTail:l,scanStartIndex:t});Q=e.nodes,ee=e.metrics}else{const e=function(e,n,t={}){if(!n.length)return{nodes:e,metrics:ma(e.length)};const o=!1!==t.reuseDirtyTail,l=function(e,n,t){var o;const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,null!=(o=t.scanStartIndex)?o:0));r<l;r++){const o=n[r],l=e[r];if(t.canReuseNode&&(!t.canReuseNode(o)||!t.canReuseNode(l))||!ka(o,l))return r}return e.length===n.length?-1:l}(e,n,t);if(l<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:l,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const r=e.slice();let i=l;for(let a=0;a<l;a++)r[a]=n[a];if(o)for(let a=l;a<e.length;a++){const o=n[a],l=e[a];o&&(!t.canReuseNode||t.canReuseNode(o)&&t.canReuseNode(l))&&sa(o,l)&&(r[a]=o,i+=1)}return{nodes:r,metrics:{reusedNodeCount:i,dirtyStartIndex:l,stablePrefixNodeCount:l,dirtyTailNodeCount:ha(l,e,n)}}}(X,s,{canReuseNode:r,reuseDirtyTail:l,scanStartIndex:t});Q=e.nodes,ee=e.metrics}ne=O?Xi()-n:0,te=l?null==(null==ee?void 0:ee.dirtyStartIndex)||ee.dirtyStartIndex<0?Q.length:ee.dirtyStartIndex:Q.length}else Q=X,ee=ma(Q.length);if(!0!==n.effectiveFinal.value&&(Z?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)ca(n,"primeSignatureMs",()=>ua(e[o]))}(Q,Z,te):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)ua(e[t])}(Q,te)),z)for(let e=null!=(null==ee?void 0:ee.dirtyStartIndex)&&ee.dirtyStartIndex>=0?ee.dirtyStartIndex:Q.length;e<Q.length;e++)ji(Q[e],$,p);const le=O?Xi()-Y:0;if(b+=1,m=_,d=A,f=H,h=j,v=F,s=Q,M(null!=(r=null==ee?void 0:ee.dirtyStartIndex)?r:0),O){const e=Yi(L),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(c=null==D?void 0:D.total)?c:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Xi()-I),nodes:Q.length,contentLength:_.length,parseCommitCount:b,parseCoalescedCount:N,nodeReuseMs:le,referenceDefinitionScanChars:oe,signatureMs:null!=(g=null==Z?void 0:Z.signatureMs)?g:0,stabilizeSignatureMs:null!=(k=null==Z?void 0:Z.stabilizeSignatureMs)?k:0,primeSignatureMs:null!=(S=null==Z?void 0:Z.primeSignatureMs)?S:0,signatureCallCount:null!=(w=null==Z?void 0:Z.signatureCallCount)?w:0,stabilizeSignatureCallCount:null!=(C=null==Z?void 0:Z.stabilizeSignatureCallCount)?C:0,primeSignatureCallCount:null!=(B=null==Z?void 0:Z.primeSignatureCallCount)?B:0,stabilizeMs:ne},null!=ee?ee:{}),V?Object.fromEntries(Di.map(e=>{var n;return[e,null!=(n=V[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Na(e,D),streamStats:e}:{}))}return me(Q)});return{effectiveCustomHtmlTags:A,effectiveCustomHtmlTagsSet:F,mdBase:H,mdInstance:R,mergedParseOptions:P,getParsedNodesDirtyStartIndex:()=>x,getParsedNodesRevision:()=>w,parsedNodes:z}}function xa(e){const{isClient:n}=e,t=q(/* @__PURE__ */new Set),o=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;function i(e){if(!n)return;const t=r.get(e);null!=t&&(window.clearTimeout(t),r.delete(e))}function a(){if(n)for(const e of r.values())window.clearTimeout(e);r.clear()}function u(){t.value=/* @__PURE__ */new Set}return{visibleNodeIndices:t,nodeVisibilityHandles:o,nodeVisibilityWatchStops:l,nodeVisibilityFallbackTimers:r,clearVisibilityFallback:i,clearAllVisibilityFallbacks:a,markNodeVisible:function(n,o=!0){var l;o&&i(n),function(n,o){if(null!=(r=null==(l=e.shouldTrackVisibleNodeIndices)?void 0:l.call(e))&&!r)return;var l,r;const i=t.value,a=i.has(n);if(o){if(a)return;const e=new Set(i);return e.add(n),void(t.value=e)}if(!a)return;const u=new Set(i);u.delete(n),t.value=u}(n,o),o&&(null==(l=e.onNodeMarkedVisible)||l.call(e,n))},resetNodeVisibleState:u,cleanupNodeVisibility:function(n){var a;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[e,t]of l.entries())e<n||(t(),l.delete(e));for(const[t,l]of o.entries())t<n||(l.destroy(),o.delete(t),i(t),null==(a=e.onNodeVisibilityCleaned)||a.call(e,t));for(const e of Array.from(r.keys()))e<n||i(e);if(!t.value.size)return;const u=/* @__PURE__ */new Set;for(const e of t.value)e<n&&u.add(e);t.value=u},destroyNodeVisibilityState:function(){u();for(const e of l.values())e();l.clear();for(const e of o.values())e.destroy();o.clear(),a()}}}function wa(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null,c=!1,d=null;const f=void 0===e.requestFrame?"function"==typeof requestAnimationFrame?requestAnimationFrame:null:e.requestFrame,m=void 0===e.cancelFrame?"function"==typeof cancelAnimationFrame?cancelAnimationFrame:null:e.cancelFrame;function h(){null!=d&&(null==m||m(d),d=null),c=!1,u&&(u(),u=null),s=null,l.value=null}function v(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:h,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void h();var e;const m=r();if(!m)return void h();if(l.value===m&&u)return;h(),s=v(m);const p=()=>{null==a||a(),t.value&&(()=>{if(c)return;c=!0;const e=()=>{if(c=!1,d=null,t.value){const e=function(e){const n=v(e),t=s;s=n;const o=Math.max(480,.75*(e.clientHeight||0));return null==t?n>o?{immediate:!0}:void 0:Math.abs(n-t)>o?{immediate:!0}:void 0}(m);e?i(e):i()}};f?d=f(e):e()})()};m.addEventListener("scroll",p,{passive:!0}),l.value=m,u=()=>{m.removeEventListener("scroll",p)}}}}function Ma(e={}){const n=q(""),t=q(""),o=q(!1),l=Re(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=$(()=>Math.max(0,n.value.length-t.value.length)),u=$(()=>0===a.value),s=$(()=>o.value&&u.value);return ye()&&ce(()=>{i(),l.destroy()}),{source:n,visible:t,done:o,final:s,caughtUp:u,pendingChars:a,enqueue:e=>l.enqueue(e),finish:e=>l.finish(e),flush:()=>l.flush(),reset:(e,n)=>l.reset(e,n),pause:()=>l.pause(),resume:()=>l.resume()}}const Ca={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},Ba=/auto|scroll|overlay/i;function _a(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return Ba.test(n)||Ba.test(t)}function Oa(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}const Ta={class:"m-0 p-0"},Ia=["data-probe"],La=/* @__PURE__ */ln(/* @__PURE__ */P(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(F(),E("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[K("div",{ref:n=>e.setParagraphWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[D(V(il),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),K("div",{ref:n=>e.setListItemWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[K("ul",Ta,[D(V(Zo),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),K("div",{ref:n=>e.setListWrapper(n),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[D(V(Qo),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),E(G,null,Z(6,n=>K("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:W(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[D(V(Uo),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,Ia)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),Aa=P({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=$(()=>{var n,t;return Fe(null!=(t=Ke(e.estimatedPreviewHeightPx))?t:Ee(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),Ha=P({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=$(()=>{var n,t;return $e(null!=(t=Ke(e.estimatedPreviewHeightPx))?t:Pe(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),Ra=P({name:"NodeRendererContent",props:["item","sourceNodes","fade","final","nestedRendererProps"],setup:e=>()=>j(pe,{name:"fade",css:!1!==e.fade,appear:!1!==e.fade&&!0!==e.final},{default:()=>{const n=e.item;return n.rendersCustomNode?j(n.component,a({key:0},n.customNodeProps),{default:()=>n.hasSlotChildren?j(za,u(a({key:0},e.nestedRendererProps),{nodes:n.node.children,indexKey:n.indexKey,batchRendering:!1,deferNodesUntilVisible:!1,renderAsFragment:!0})):n.slotContent?j(za,u(a({key:1},e.nestedRendererProps),{content:n.slotContent,final:!n.node.loading,indexKey:`${n.indexKey}-content`,smoothStreaming:!1,batchRendering:!1,deferNodesUntilVisible:!1,renderAsFragment:!0})):Y("v-if",!0)}):j(n.component,a({key:1},n.nodeProps))}})}),$a={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Pa(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const Fa=["data-custom-id"],Ea=["data-node-index","data-node-type"],Ka="typewriter-simple-cursor-target",za=/* @__PURE__ */ln(/* @__PURE__ */P(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockOptions:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t;function r(e){if(!("undefined"!=typeof Event&&e instanceof Event))return"string"==typeof e?(l("copy-code",e),void l("copy",e)):void l("copy",e)}function i(e){l("handleArtifactClick",e)}function c(e){l("mouseover",e)}function d(e){l("mouseout",e)}const f=Q(),m=R("markstreamNestedRendererProps",void 0);function h(e){const n=null==f?void 0:f.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function v(e){var n,t;const l=o[e];return h(e)?l:null!=(t=null==(n=null==m?void 0:m.value)?void 0:n[e])?t:l}const p=wi,g=$(()=>{return"chat"===(e=v("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),y=$(()=>Bi(v("typewriter"))),k=$(()=>"off"!==y.value),b=$(()=>"minimal"===v("domMode")?"minimal":"full"),N=$(()=>!0===v("renderCodeBlocksAsPre")),S=$(()=>$a[g.value]),x=$(()=>{var e;return null!=(e=v("showTooltips"))?e:S.value.showTooltips}),w=$(()=>{var e;return null!=(e=v("fade"))?e:S.value.fade}),B=$(()=>{var e;return null!=(e=v("batchRendering"))?e:S.value.batchRendering}),_=$(()=>{var e;return null!=(e=v("initialRenderBatchSize"))?e:S.value.initialRenderBatchSize}),O=$(()=>{var e;return null!=(e=v("renderBatchSize"))?e:S.value.renderBatchSize}),T=$(()=>{var e;return null!=(e=v("renderBatchDelay"))?e:S.value.renderBatchDelay}),I=$(()=>{var e;return null!=(e=v("renderBatchBudgetMs"))?e:S.value.renderBatchBudgetMs}),A=$(()=>{var e;return null!=(e=v("renderBatchIdleTimeoutMs"))?e:S.value.renderBatchIdleTimeoutMs}),P=$(()=>{var e;return null!=(e=v("deferNodesUntilVisible"))?e:S.value.deferNodesUntilVisible}),K=$(()=>{var e;return null!=(e=v("maxLiveNodes"))?e:S.value.maxLiveNodes}),z=$(()=>{var e;return null!=(e=v("liveNodeBuffer"))?e:S.value.liveNodeBuffer}),j=$(()=>{var e;return null!=(e=v("nodeVirtual"))?e:S.value.nodeVirtual}),D={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return v("parseOptions")},get customMarkdownIt(){return v("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return v("customHtmlTags")},get mode(){return v("mode")},get domMode(){return b.value},get htmlPolicy(){return v("htmlPolicy")},get viewportPriority(){return v("viewportPriority")},get viewportPriorityOptions(){return v("viewportPriorityOptions")},get codeBlockStream(){return v("codeBlockStream")},get codeBlockDarkTheme(){return v("codeBlockDarkTheme")},get codeBlockLightTheme(){return v("codeBlockLightTheme")},get codeBlockMinWidth(){return v("codeBlockMinWidth")},get codeBlockMaxWidth(){return v("codeBlockMaxWidth")},get codeBlockOptions(){return v("codeBlockOptions")},get codeBlockProps(){return v("codeBlockProps")},get mermaidProps(){return v("mermaidProps")},get d2Props(){return v("d2Props")},get infographicProps(){return v("infographicProps")},get showTooltips(){return x.value},get themes(){return v("themes")},get isDark(){return v("isDark")},get customId(){return v("customId")},get indexKey(){return o.indexKey},get typewriter(){return v("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return v("smoothStreamingOptions")},get parseCoalesceMs(){return v("parseCoalesceMs")},get fade(){return w.value},get batchRendering(){return B.value},get initialRenderBatchSize(){return _.value},get renderBatchSize(){return O.value},get renderBatchDelay(){return T.value},get renderBatchBudgetMs(){return I.value},get renderBatchIdleTimeoutMs(){return A.value},get deferNodesUntilVisible(){return P.value},get maxLiveNodes(){return K.value},get liveNodeBuffer(){return z.value},get nodeVirtual(){return j.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function X(e){l("height-change",e)}function te(e){l("virtual-state-change",e)}function ce(e){l("anchor-change",e)}const de=q(),fe=q(null),he=q(null),ve=q(null),pe=ge({1:null,2:null,3:null,4:null,5:null,6:null}),ye=q(!1),xe=/* @__PURE__ */new Map,we=q(0);let Ce=!1;const Be=q(0),_e=q({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Oe(e,n){return"string"!=typeof e?n:e.trim()||n}function Te(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const Ie=$(()=>{var e;const n=null!=(e=D.viewportPriorityOptions)?e:{},t=Oe(n.rootMargin,lt);return{rootMargin:t,heavyBlockMargin:Oe(n.heavyBlockMargin,t),maxTargets:Te(n.maxTargets)}}),Le=$(()=>{var e;return null!=(e=Ie.value.rootMargin)?e:lt}),Ae=$(()=>{var e;return null!=(e=Ie.value.maxTargets)?e:640});function He(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return Re("function"==typeof t?t():t)}function Re(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?Re(e.value):"object"==typeof e&&"$el"in e?Re(e.$el):null:null}ee(nt,Ie);const{isClient:ze,renderAsFragment:je,debugPerformanceEnabled:We,resolvedShowTooltips:De,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:qe,ownsTypewriterCursor:Je}=function(e){const n="undefined"!=typeof window,t=U(),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamTypewriterCursor",void 0),r=R("markstreamSmoothStreaming",void 0),i=$(()=>!0===e.renderAsFragment),a=$(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=$(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=$(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=$(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(D),{resolveViewportRoot:Ge,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Qe,getOffsetTopWithinRoot:en}=function(e,n){function t(){var e,t;return null!=(t=null==(e=n.scrollRoot)?void 0:e.call(n))?t:null}function o(n){if("undefined"==typeof window)return null;const o=t();if(o)return o;const l=null!=n?n:e.value;if(!l)return null;const r=l.ownerDocument||document,i=r.scrollingElement||r.documentElement;let a=l;for(;a&&a!==r.body&&a!==i;){if(_a(window.getComputedStyle(a))&&Oa(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(de,{isClient:ze,scrollRoot:He});ee("markstreamShowTooltips",De),ee("markstreamHtmlPolicy",Ve),ee("markstreamTypewriter",k),ee("markstreamFade",$(()=>!1!==D.fade)),ee("markstreamTypewriterCursor",$(()=>!0)),ee("markstreamTextStreamState",xe),ee("markstreamStreamVersion",we),ee("markstreamParseOptions",$(()=>D.parseOptions)),ee("markstreamCustomMarkdownIt",$(()=>D.customMarkdownIt));const{smoothStreamingEnabled:nn,renderContent:tn,requestedFinal:on,effectiveFinal:ln}=function(e,n){const t=Ma(u(a(a({},Ca),e.smoothStreamingOptions),{burstInitialContent:!_i(e.typewriter)})),o=$(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||_i(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=q(!n.isClient||!0===e.smoothStreaming);ke(()=>{l.value=!0});const r=$(()=>l.value&&o.value),i=$(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),s=$(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),c=$(()=>{const e=s.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});let d=0,f=!1;function m(){d=0,f=!1}return J([()=>e.content,()=>e.nodes,r,s],([e,n,o,l])=>{if(null==n?void 0:n.length)return m(),void t.reset("");const r=null!=e?e:"";if(!o)return m(),t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;if(r)if(r===i);else if(r.startsWith(i)){const e=r.slice(i.length),n=t.pendingChars.value;e.length<=8?(d++,f||d>=2&&n<=8?(f=!0,t.reset(r,{prefixKnown:!0})):t.enqueue(e)):(m(),t.enqueue(e))}else m(),t.reset(r);else m(),t.reset("");l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:s,effectiveFinal:c}}(D,{isClient:ze,inheritedSmoothStreaming:qe}),an=!0===on.value;ee("markstreamSmoothStreaming",nn);const sn=q(!1),cn=q(!1),fn=q(!1);let mn="",hn=!1,vn=null;function pn(){ze&&null!=vn&&(window.clearTimeout(vn),vn=null)}function gn(){sn.value=!1,pn()}function kn(e,n){if(!We.value)return;const t=function(){if(!We.value)return null;const e=Mn(bn),n=Mn(Nn),t=Math.max(xn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=bn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return bn.clear(),Nn.clear(),xn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}J([()=>D.indexKey,()=>D.customId],()=>{var e,n;gn(),cn.value=!1,fn.value=!(null==(e=o.nodes)?void 0:e.length)&&!0!==on.value&&Boolean(o.content),mn=null!=(n=tn.value)?n:"",hn=mn.length>0},{flush:"sync"}),J([()=>o.content,()=>o.nodes,on],([e,n,t])=>{!(null==n?void 0:n.length)&&!0!==t&&Boolean(e)&&(fn.value=!0)},{flush:"sync",immediate:!0}),J([tn,()=>o.nodes,ln],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(gn(),cn.value=!1,mn=l,void(hn=!0)):(l.length>0&&(fn.value=!0),hn?(mn&&l.length>mn.length&&l.startsWith(mn)?(sn.value=!0,cn.value=!0,ze&&(pn(),vn=window.setTimeout(()=>{var e;vn=null,!0===ln.value||(null==(e=o.nodes)?void 0:e.length)||(fu(),sn.value=!1,vu())},1200))):(l.length<mn.length||!l.startsWith(mn))&&(gn(),cn.value=!1),void(mn=l)):(mn=l,void(hn=!0)))},{flush:"sync",immediate:!0});const bn=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map;let Sn=!1,xn=0;function Mn(e){let n=0;for(const t of e.values())n+=t;return n}function Cn(){xn=Math.max(xn,Mn(Nn)),Nn.clear(),Sn=!1}function Bn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function _n(e){var n,t;We.value&&(bn.set(e,(null!=(n=bn.get(e))?n:0)+1),Nn.set(e,(null!=(t=Nn.get(e))?t:0)+1),function(e){const n=function(){if(!ze||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>Bn(n),0):queueMicrotask(()=>Bn(n)):window.requestAnimationFrame(()=>Bn(n))))}(e),Sn||(Sn=!0,ze&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(Cn):"function"!=typeof queueMicrotask?setTimeout(Cn,0):queueMicrotask(Cn)))}function Tn(e,n){return _n(e),n()}const In=D.customId?`renderer-${D.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Ln=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(In),An=In;ee(Oi,Ln);const Hn=Ze(()=>D.customId),{effectiveCustomHtmlTagsSet:Rn,mdInstance:$n,mergedParseOptions:Pn,parsedNodes:Fn,getParsedNodesDirtyStartIndex:En,getParsedNodesRevision:Kn}=Sa(D,{instanceMsgId:In,renderContent:tn,effectiveFinal:ln,smoothStreamingEnabled:nn,debugPerformanceEnabled:We,customComponentsMap:Hn,logPerf:kn});J(Fn,()=>{sn.value||Ln.clear(),we.value+=1,Ce&&To(Nr(Fn.value.length))},{immediate:!0});const zn=$(()=>({customId:D.customId,customHtmlTags:Pn.value.customHtmlTags,parseOptions:D.parseOptions,customMarkdownIt:D.customMarkdownIt,htmlPolicy:Ve.value,viewportPriority:D.viewportPriority,viewportPriorityOptions:Ie.value,mode:g.value,domMode:D.domMode,codeBlockStream:D.codeBlockStream,codeBlockDarkTheme:D.codeBlockDarkTheme,codeBlockLightTheme:D.codeBlockLightTheme,renderCodeBlocksAsPre:N.value,codeBlockMinWidth:D.codeBlockMinWidth,codeBlockMaxWidth:D.codeBlockMaxWidth,codeBlockOptions:D.codeBlockOptions,codeBlockProps:D.codeBlockProps,mermaidProps:D.mermaidProps,d2Props:D.d2Props,infographicProps:D.infographicProps,showTooltips:De.value,themes:D.themes,isDark:D.isDark,typewriter:k.value,smoothStreamingOptions:D.smoothStreamingOptions,parseCoalesceMs:D.parseCoalesceMs,fade:D.fade}));ee("markstreamNestedRendererProps",zn);const jn=$(()=>Fn.value),Wn=$(()=>Fn.value.length),Dn=q(null),Vn=q(null),qn=q(null),Un=q(null),Jn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Gn=!Jn&&D.customId?ui(D.customId):null,Xn=$(()=>Gn?(ai.value,ui(D.customId)):null),Yn=$(()=>{var e;return Boolean(!je.value&&D.customId&&!Jn&&(null==(e=Xn.value)?void 0:e.enabled))}),Zn=$(()=>Boolean(ze&&Yn.value)),Qn=$(()=>{var e;return Boolean(!je.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),et=$(()=>Qn.value),ot=q(!1);ke(()=>{ot.value=!0});const rt=$(()=>Boolean(ze&&Qn.value));ee("markstreamHostScrollManaged",rt);const it=$(()=>Boolean(ot.value&&rt.value)),ut=$(()=>Zn.value||rt.value),st=$(()=>Zn.value||it.value),ct=$(()=>{var e;return ut.value&&!1!==(null==(e=Xn.value)?void 0:e.textEstimation)});function dt(){if(Be.value>0)return Be.value;const e=Tn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const ft=$(()=>{const e=dt();return e>0?Math.max(1,Math.round(e)):640}),mt=$(()=>{var e,n;return!(!0!==ln.value||Qn.value||"chat"!==g.value&&"minimal"!==g.value||h("maxLiveNodes")||h("liveNodeBuffer")||(null==(e=o.nodes)?void 0:e.length)||fn.value||!((null!=(n=D.maxLiveNodes)?n:0)<=0))}),ht=$(()=>{var e;return mt.value?50:Math.max(1,null!=(e=D.maxLiveNodes)?e:320)}),pt=$(()=>{var e;return mt.value?16:Math.max(0,null!=(e=D.liveNodeBuffer)?e:60)}),gt=$(()=>{var e;return!je.value&&!1!==D.nodeVirtual&&!((null!=(e=D.maxLiveNodes)?e:0)<=0&&!mt.value)&&(!0===D.nodeVirtual?Fn.value.length>0:Fn.value.length>ht.value)}),yt=$(()=>gt.value||Zn.value||rt.value),kt=$(()=>!1!==D.viewportPriority),bt=$(()=>!!kt.value&&!ye.value);var Nt;Nt=$(()=>kt.value),ee(tt,Nt);const St=$(()=>{var e;return!(je.value||!1===D.deferNodesUntilVisible||(null!=(e=D.maxLiveNodes)?e:0)<=0||gt.value||Fn.value.length>900||!1===D.viewportPriority)}),xt=at(e=>{var n,t;return Ge(null!=(t=null!=(n=null==e?void 0:e.parentElement)?n:de.value)?t:null)},kt),{requestFrame:wt,cancelFrame:Mt,hasIdleCallback:Ct,isTestEnv:Bt}=function(e){const n=e.isClient&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,t=e.isClient&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,o=e.isClient&&"function"==typeof window.requestIdleCallback,l=function(){var e;if("undefined"==typeof globalThis||!("process"in globalThis))return;const n=null==(e=Object.getOwnPropertyDescriptor(globalThis,"process"))?void 0:e.value;return null==n?void 0:n.env}();return{requestFrame:n,cancelFrame:t,hasIdleCallback:o,isTestEnv:"test"===(null==l?void 0:l.NODE_ENV)}}({isClient:ze}),_t=$(()=>!0===ln.value&&!Qn.value),{resolvedBatchSize:Ot,resolvedInitialBatch:Tt,batchingEnabled:Lt,incrementalRenderingActive:Ht,renderedCount:$t,previousRenderContext:Pt,adaptiveBatchSize:Ft,previousBatchConfig:Et}=function(e,n){var t;const o=$(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=$(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=$(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=q(0),a=q({key:e.indexKey,total:0}),u=q(Math.max(1,o.value||1)),s=$(()=>{var t,o,l;return r.value&&!(null==(t=n.continuousStreaming)?void 0:t.value)&&!(null==(o=n.forceFullRenderFinalContent)?void 0:o.value)&&(null!=(l=e.maxLiveNodes)?l:0)<=0}),c=q({batchSize:o.value,initial:l.value,delay:null!=(t=e.renderBatchDelay)?t:16,enabled:s.value});return{resolvedBatchSize:o,resolvedInitialBatch:l,batchingEnabled:r,incrementalRenderingActive:s,renderedCount:i,previousRenderContext:a,adaptiveBatchSize:u,previousBatchConfig:c}}(D,{isClient:ze,isTestEnv:Bt,renderAsFragment:je,forceFullRenderFinalContent:_t,continuousStreaming:$(()=>cn.value&&!0!==ln.value)}),Kt=$(()=>{var e;return!je.value&&!1!==D.batchRendering&&Ot.value>0&&!Bt&&(null!=(e=D.maxLiveNodes)?e:0)<=0&&!_t.value}),zt=$(()=>Kt.value),jt=$(()=>ut.value||zt.value),Wt=$(()=>{var e;return jt.value&&!1!==(null==(e=Xn.value)?void 0:e.codeBlockEstimation)}),Dt=/* @__PURE__ */new Map,Vt=/* @__PURE__ */new Map,qt=/* @__PURE__ */new Map,Ut=/* @__PURE__ */new WeakMap;let Jt=null;const Gt=[];J(()=>Fn.value.length,e=>{Gt.length>e&&(Gt.length=e)});const Xt=[],Qt=[];let lo=[],io=[],uo=-1;const co=H(Qt),mo=/* @__PURE__ */new Set,vo=q(0);let po=0;const go=q(0),yo=$(()=>(go.value,Array.from(Dt.entries()).sort((e,n)=>e[0]-n[0]))),bo=q(null),So=q(null);let wo,Co=null,_o=0,Oo=null;function To(e){wo.markFallbackHeightPrefixDirty(e)}function Io(e){return wo.getFallbackNodeHeight(e)}function Lo(e,n){return wo.estimateHeightRange(e,n)}function Ao(e){return wo.estimateIndexForOffset(e)}const{activeRestoreAnchor:Ho,getRelativeScrollTopWithinContainer:$o,setRelativeScrollTopWithinContainer:Po,resolveAnchorOffset:Fo,clearRestoreReconcile:Ko,scheduleRestoreReconcile:jo,captureRestoreAnchor:Wo,restoreAnchor:Vo,getAnchorDrift:qo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=q(null);let v=null,p=[];function g(){const e=i(),n=t.value;if(!e||!n)return null;const o=e.ownerDocument||n.ownerDocument||document;if(e===o.documentElement||e===o.body||e===o.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,a(e,o,!1)-u(n,e))}function y(e){var n;const o=i(),l=t.value;if(!o||!l)return;const r=Math.max(0,e),c=o.ownerDocument||l.ownerDocument||document,d=c.defaultView||("undefined"!=typeof window?window:null);if(o===c.documentElement||o===c.body||o===c.scrollingElement){const e=a(o,c,!0)+l.getBoundingClientRect().top;return void(null==(n=null==d?void 0:d.scrollTo)||n.call(d,0,Math.max(0,e+r)))}Mi(o,c,u(l,o)+r,{isReverseFlexScrollRoot:e=>{var n;return null!=(n=null==s?void 0:s(e))&&n},getNormalizedScrollTop:a})}function k(e){const n=o.value,t=m(e.nodeIndex,0,Math.max(0,n-1));return d(0,t)+Math.max(0,e.offsetWithinNodePx)}function b(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function N(e){const n=k(e),t=g();null!=t&&Math.abs(t-n)<=.5||y(n)}return{activeRestoreAnchor:h,getRelativeScrollTopWithinContainer:g,setRelativeScrollTopWithinContainer:y,resolveAnchorOffset:k,clearRestoreReconcile:b,applyRestoreAnchor:N,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&N(h.value)}):null,null==v&&h.value&&N(h.value))},captureRestoreAnchor:function(){const e=g(),n=o.value;if(null==e||n<=0)return null;const t=m(c(e+1),0,n-1),l=d(0,t),r=f(t);return{nodeIndex:t,offsetWithinNodePx:m(e-l,0,Math.max(0,r-1))}},restoreAnchor:function(e){const t=o.value;if(h.value={nodeIndex:m(e.nodeIndex,0,Math.max(0,t-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},b(),N(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&N(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:ze,containerRef:de,parsedNodeCount:Wn,requestFrame:wt,cancelFrame:Mt,resolveScrollContainer:()=>bo.value||Xe(),getNormalizedScrollTop:Qe,getOffsetTopWithinRoot:en,isReverseFlexScrollRoot:Ye,estimateIndexForOffset:Ao,estimateHeightRange:Lo,getFallbackNodeHeight:Io,clamp:br}),{nodeHeights:Jo,heightStats:Go,heightTreeSize:Xo,heightSumTree:Yo,heightKnownTree:el,averageNodeHeight:nl,resetHeightMeasurements:tl,pruneHeightMeasurements:ll,rebuildHeightTrees:rl,syncHeightTreeSize:al,recordNodeHeight:ul,removeNodeHeights:sl,exportHeightCache:cl,importHeightCache:dl,fenwickRangeSum:fl}=function(e={}){const n=ge({}),t=ge({total:0,count:0}),o=q(0),l=q([]),r=q([]);function i(){for(const e of Object.keys(n))delete n[Number(e)];t.total=0,t.count=0,o.value=0,l.value=[],r.value=[]}function s(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function c(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function d(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}function f(e){o.value=e;const t=new Array(e+1).fill(0),i=new Array(e+1).fill(0);for(const[o,l]of Object.entries(n)){const n=Number(o),r=Number(l);!Number.isFinite(n)||n<0||n>=e||!Number.isFinite(r)||r<=0||(s(t,n,r),s(i,n,1))}l.value=t,r.value=i}function m(e){if(!Number.isInteger(e)||e<0)return!1;const i=n[e];if(!Number.isFinite(i)||i<=0)return!1;if(delete n[e],t.total=Math.max(0,t.total-i),t.count=Math.max(0,t.count-1),o.value>e){const n=l.value,t=r.value;n.length&&t.length&&(s(n,e,-i),s(t,e,-1))}return!0}const h=$(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:h,resetHeightMeasurements:i,pruneHeightMeasurements:function(e){if(e<=0)return void i();let o=0,l=0;for(const[t,r]of Object.entries(n)){const i=Number(t),a=Number(r);!Number.isFinite(i)||i<0||i>=e||!Number.isFinite(a)||a<=0?delete n[i]:(o+=a,l++)}t.total=o,t.count=l},rebuildHeightTrees:f,syncHeightTreeSize:function(e){const t=o.value;if(e===t)return;if(e<t||0===t)return void f(e);const i=l.value,a=r.value;i.length=e+1,a.length=e+1;for(let n=t;n<e;n++)i[n+1]=0,a[n+1]=0;for(let o=t;o<e;o++){const e=Number(n[o]);!Number.isFinite(e)||e<=0||(s(i,o,e),s(a,o,1))}for(let n=t+1;n<=e;n++){const e=n-(n&-n);e>=t||(i[n]+=d(i,e,t),a[n]+=d(a,e,t))}o.value=e},recordNodeHeight:function(i,c,d={}){!function(i,a,u={}){var c;if(!Number.isFinite(a)||a<=0)return!1;const d=n[i];if(d){if(!1===u.allowShrink&&a<d)return!1;if(Math.abs(a-d)<=1)return!1}if(n[i]=a,d?t.total+=a-d:(t.total+=a,t.count++),o.value>i){const e=l.value,n=r.value;if(e.length&&n.length)if(d){const n=a-d;0!==n&&s(e,i,n)}else s(e,i,a),s(n,i,1)}!1!==u.notify&&(null==(c=e.onHeightRecorded)||c.call(e,i))}(i,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=m(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e,n)),l},removeNodeHeights:function(n,t={}){var o;let l=0,r=Number.POSITIVE_INFINITY;for(const e of n){const n=Number(e);m(n)&&(l++,n<r&&(r=n))}return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e,Number.isFinite(r)?r:void 0)),l},exportHeightCache:function(){return Object.entries(n).map(([e,n])=>({index:Number(e),height:Number(n)})).filter(e=>Number.isFinite(e.index)&&e.index>=0&&Number.isFinite(e.height)&&e.height>0).sort((e,n)=>e.index-n.index)},importHeightCache:function(l,r={}){var i;if(!Array.isArray(l))return;const a=o.value;let u=!1;if("merge"!==r.mode){const e=Object.keys(n);if(e.length>0){for(const t of e)delete n[Number(t)];u=!0}}for(const e of l){const t=Number(e.index),o=Number(e.height);if(!Number.isInteger(t)||t<0)continue;if(a>0&&t>=a)continue;if(!Number.isFinite(o)||o<=0)continue;const l=n[t];l&&Math.abs(l-o)<=1||(n[t]=o,u=!0)}u&&(function(){let e=0,l=0;const r=o.value;for(const[t,o]of Object.entries(n)){const i=Number(t),a=Number(o);!Number.isFinite(i)||i<0||r>0&&i>=r||!Number.isFinite(a)||a<=0?delete n[i]:(e+=a,l++)}t.total=e,t.count=l}(),a>0&&f(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:d}}({onHeightRecorded:e=>{To(null!=e?e:0),rt.value&&Bu(),Ho.value&&jo(),So.value&&na(),iu("node-resize")}});function ml(e){Number.isInteger(e)&&e>=0&&mo.add(e)}function vl(e){for(const n of e)ml(Number(n))}function gl(e){po++;let n=!0;try{const t=e();return n=!1!==t,t}finally{po--,0===po&&n&&vo.value++}}function bl(){lo=[],io=[],uo=-1,mo.clear(),co.value=Qt}function Nl(){bl(),gl(()=>tl()),Xt.length=0}function Sl(e){!Number.isInteger(e)||e<0||e>=Fn.value.length||(Xt[e]=Ui(e))}function xl(e,n,t={}){const o=Jo[e];ml(e),ul(e,n,t);const l=Jo[e];return Object.is(o,l)?(mo.delete(e),!1):(l&&l>0?Sl(e):o&&e<Xt.length&&(Xt[e]=void 0),!0)}function wl(e,n){const t=Tn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight);return t>0?t:Tn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Dt.get(e))?void 0:n.offsetHeight)?t:0})}function Ml(e,n={}){"merge"!==n.mode?bl():vl(e.map(e=>e.index)),gl(()=>dl(e,n)),ba()}const Cl=$(()=>St.value&&bt.value),Bl=$(()=>ut.value||Kt.value||Cl.value&&Fn.value.length>Tt.value),_l=$(()=>{var e;return!je.value&&!1!==D.batchRendering&&Ot.value>0&&(null!=(e=D.maxLiveNodes)?e:0)<=0}),Ol=$(()=>!je.value&&an&&!0===ln.value&&!gt.value&&!Qn.value&&!Yn.value&&!Cl.value&&!_l.value),Tl=$(()=>!!xt&&Cl.value),Il=$(()=>[Tl.value,Cl.value,gt.value,ye.value,Ae.value,Le.value,Tt.value,Boolean(xt)].join("|")),Ll=$(()=>gt.value||rt.value),{focusIndex:Al,liveRange:Hl,updateLiveRange:Rl}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,liveNodeBufferResolved:r,clamp:i}=n,a=null!=r?r:$(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),u=q(0),s=ge({start:0,end:0});return{liveNodeBufferResolved:a,focusIndex:u,liveRange:s,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return s.start=0,void(s.end=e);const n=Math.min(l.value,e),r=a.value,c=i(u.value-r,0,Math.max(0,e-n));s.start=c,s.end=Math.min(e,c+n)}}}(D,{parsedNodeCount:Wn,virtualizationEnabled:gt,maxLiveNodesResolved:ht,liveNodeBufferResolved:pt,clamp:br}),$l=/* @__PURE__ */new Map,Pl=/* @__PURE__ */new Map,Fl=/* @__PURE__ */new Map,El=/* @__PURE__ */new Map,Kl=[],zl=/* @__PURE__ */new Map;let jl=-1/0;const Wl=/* @__PURE__ */new Set,Dl=q(0);let Vl=!1;const ql=$(()=>(Dl.value,Wl.size)),Ul=/* @__PURE__ */new Map,Jl=/* @__PURE__ */new Map,Gl=q(0);let Xl=0;const Yl=$(()=>(Gl.value,Xl));let Zl=null;const Ql=$(()=>{if(!gt.value)return Fn.value.length;const e=pt.value,n=Math.max(Hl.end+e,Tt.value),t=Math.min(Fn.value.length,n);return Math.max($t.value,t)});function er(){Vl||(Vl=!0,queueMicrotask(()=>{Vl=!1,Dl.value+=1}))}function nr(e,n,t="node-resize"){if(!ze||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Wl.delete(o)&&er();try{n()}finally{iu(t)}},Math.max(0,e));return Wl.add(o),er(),o}function tr(e){ze&&null!=e&&(Wl.delete(e)&&er(),window.clearTimeout(e))}function or(){if(ze&&"undefined"!=typeof window)for(const e of Wl)window.clearTimeout(e);Wl.size&&(Wl.clear(),er()),Kl.length=0,El.clear()}function lr(e){fe.value=e}function rr(e){he.value=e}function ir(e){ve.value=e}const{cancelScheduledFocusSync:ar,scheduleFocusSync:ur}=function(e){const{isClient:n,containerRef:t,virtualizationEnabled:o,requestFrame:l,cancelFrame:r,syncFocusToScroll:i}=e;let a=null;function u(){var e,n,o;return null!=(o=null==(n=null==(e=t.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?o:"undefined"!=typeof window?window:null}function s(){if(!a)return;const e=u();a.viaTimeout?e?e.clearTimeout(a.id):clearTimeout(a.id):null==r||r(a.id),a=null}return{cancelScheduledFocusSync:s,scheduleFocusSync:function(e={}){if(!o.value)return;if(!n)return void i(!0);if(e.immediate)return s(),void i(!0);if(a)return;const t=()=>{a=null,i()};if(l)return void(a={id:l(t),viaTimeout:!1});const r=u(),c=r?r.setTimeout(t,16):setTimeout(t,16);a={id:c,viaTimeout:!0}}}}({isClient:ze,containerRef:de,virtualizationEnabled:gt,requestFrame:wt,cancelFrame:Mt,syncFocusToScroll:function(e=!1){var n;if(!gt.value)return;const t=bo.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=de.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=Fn.value.length;if(i<=0)return;if(!r&&i>0&&Ye(t)){const n=Tn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=Tn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void kr(br((a=Math.max(0,l)+.5*Math.max(0,n),wo.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=de.value;if(!l)return null;const r=o?0:Tn("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=Tn("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?Tn("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):Tn("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return br(Ao(a+.5*Math.max(0,u)),0,Math.max(0,Fn.value.length-1))}(t,o,l,r);if(null!=u)return void kr(u,e);const s=r?null:Tn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?Tn("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=yo.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=Tn("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=de.value;if(!e)return;const n=r?{top:0}:Tn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=Tn("syncFocusToScroll.fallback.scrollTop",()=>Qe(t,o,r)),a=r?(()=>{const t=Tn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=en(e,t);return Math.max(0,i-n)})(),u=r?Tn("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):Tn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void kr(br(Ao(a+.5*Math.max(0,u)),0,Math.max(0,Fn.value.length-1)),!0)}kr(Math.round((m+h)/2),e)}}),{visibleNodeIndices:sr,nodeVisibilityHandles:cr,nodeVisibilityWatchStops:dr,nodeVisibilityFallbackTimers:fr,clearVisibilityFallback:mr,markNodeVisible:hr,cleanupNodeVisibility:vr,destroyNodeVisibilityState:pr}=xa({isClient:ze,shouldTrackVisibleNodeIndices:()=>Cl.value,shouldCleanupNodeVisibility:()=>gt.value,onNodeMarkedVisible:e=>{gt.value?ur():Al.value=br(e,0,Math.max(0,Fn.value.length-1))},onNodeVisibilityCleaned:e=>{Dt.delete(e)&&au()}}),{cleanupScrollListener:gr,setupScrollListener:yr}=wa({isClient:ze,virtualizationEnabled:gt,listenerEnabled:Ll,scrollRootElement:bo,resolveScrollContainer:Xe,scheduleFocusSync:ur,onScroll:function(){const e=So.value;if(!e)return;const n=Ti();if(!n)return;if(function(e){if(Ga()>=_o)return Oo=null,!1;const n=Oo;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(Oo=null),t}(n))return;const t=Li(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&ea("restore"):ea("restore")},requestFrame:wt,cancelFrame:Mt,getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=de.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return Tn("scrollListener.getScrollTop",()=>Qe(e,t,o))}});function kr(e,n=!1){const t=br(e,0,Math.max(0,Fn.value.length-1));!n&&Math.abs(t-Al.value)<=1||(Al.value=t,Rl())}function br(e,n,t){return Math.min(Math.max(e,n),t)}function Nr(e=Fn.value.length){const n=En();return!Number.isInteger(n)||n<0?e:br(n,0,e)}function Sr(e){return null==e?void 0:e.firstElementChild}function xr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function wr(e,n){e<1||e>6||(pe[e]=n)}function Mr(){if(!Bl.value||"undefined"==typeof ResizeObserver)return void(Be.value=0);const e=Tn("updateMeasuredContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.clientWidth)?n:0});Be.value=e>0?e:0}let Cr=null;function Br(){null==Cr||Cr.disconnect(),Cr=null}const _r=$(()=>N.value?eo:no);function Or(){var e;return!1!==(null==(e=D.codeBlockProps)?void 0:e.showHeader)}function Tr(){var e;return!1!==(null==(e=D.codeBlockProps)?void 0:e.showCopyButton)}function Ir(){var e,n;const t=null==(e=D.codeBlockProps)?void 0:e.showLineNumbers;return"boolean"==typeof t?t:!0!==(null==(n=D.codeBlockOptions)?void 0:n.disableLineNumbers)}function Lr(e,n,t){var o;const l=Jo[n],r="number"==typeof l&&l>0;if(ct.value&&!r&&!function(e){return!!Hn.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=mi(e,t,_e.value);if(n)return n}if(Wt.value&&!r&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ms(e,ss(e));return n===eo?"pre":n===_r.value||n===no?"stream-diffs":null}(e);if("stream-diffs"===n||"pre"===n)return function(e,n){if(!e||"code_block"!==e.type)return null;const t=n.rendererKind,o="pre"!==t&&!1!==n.showHeader,l="pre"===t&&!1!==n.showHeader,r=Boolean(e.diff);let i=0,u=500;if("stream-diffs"===t){const t=pi(e,n.diffStyle),o=18,l=function(e){return e?0:16}(r);u=500,i=Math.round(t*o+l)}else{const t=Yt(n.codeBlockOptions),o=function(e,n,t){var o,l;const r=pi(e,n.diffStyle),i=Number(n.width);if("wrap"!==t.overflow||!Number.isFinite(i)||i<=0)return r;const a=Math.max(1,.6*t.fontSize),u=Boolean(e.diff),s=u&&Rt({diffStyle:n.diffStyle});if(!u||s){const o=(u?vi(e.raw)||[vi(e.originalCode),vi(e.updatedCode)].filter(Boolean).join("\n"):vi(e.code,!0===e.loading)).split(/\r\n|\n|\r/),l=yi(i,a,o.length,t,n,!1);return o.reduce((e,n)=>e+gi(n,l,t.tabSize),0)}const c=vi(e.originalCode).split(/\r\n|\n|\r/),d=vi(e.updatedCode).split(/\r\n|\n|\r/);if(null==e.originalCode&&null==e.updatedCode)return r;const f=Math.max(c.length,d.length),m=yi(i,a,f,t,n,!0);let h=0;for(let v=0;v<f;v++)h+=Math.max(gi(null!=(o=c[v])?o:"",m,t.tabSize),gi(null!=(l=d[v])?l:"",m,t.tabSize));return h}(e,n,t);i=Math.round(o*t.lineHeight+t.padding+t.paddingBottom),u=t.maxHeight}const s=Math.max(1,Math.min(i,u));return a({kind:"code-block",height:Math.round(s+("pre"===t?l?37:0:o?40:0)),contentHeight:s,rendererKind:t},r&&"stream-diffs"===t?{diffInline:Rt({diffStyle:n.diffStyle})}:{})}(e,{rendererKind:n,codeBlockOptions:D.codeBlockOptions,showHeader:Or(),showLineNumbers:Ir(),width:t,diffStyle:null==(o=D.codeBlockOptions)?void 0:o.diffStyle})}return null}be(()=>{if(vo.value,po>0)return;const e=Fn.value,n=Kn();if(!e.length||!jt.value)return lo=[],io=[],uo=-1,mo.clear(),void(co.value=Qt);const t=Be.value||Tn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return lo=[],io=[],uo=-1,mo.clear(),void(co.value=Qt);const o=function(e){var n,t;const o=Yt(D.codeBlockOptions);return[Math.round(e),ct.value,Wt.value,_e.value,o.fontSize,o.lineHeight,o.fontFamily,o.padding,o.paddingBottom,o.maxHeight,o.tabSize,o.overflow,null!=(t=null==(n=D.codeBlockOptions)?void 0:n.diffStyle)?t:"split",Ir(),Or(),Tr(),N.value,Hn.value,ai.value]}(t),l=lo.length<=e.length&&(i=o,(r=io).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&uo===n?e.length:l?Nr(e.length):0,u=l?Array.from(mo):[];lo.length=e.length;for(let s=a;s<e.length;s++)lo[s]=Lr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(lo[s]=Lr(e[s],s,t));mo.clear(),io=o,uo=n,co.value=lo,Ne(co)},{flush:"sync"});const Ar=$(()=>co.value);wo=function(e){let n=!0,t=-1;const o=[0];let l="",r=-1;const i=/* @__PURE__ */new WeakMap;function a(e=0){n=!0,e<=0?t=0:(t<0||e<t)&&(t=e)}function u(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=e.parsedNodes.value[n],r=null==l?void 0:l.type,a=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),u=e.estimatedNodeHeights.value[n],s=null==u?void 0:u.height;if(!function(e,n,t){return Boolean(t&&"simple-text"===(null==n?void 0:n.kind)&&("paragraph"===e||"list_item"===e||"list"===e))}(r,u,a)&&Number.isFinite(s)&&s>0)return s;const c=function(n,t){var o;if(!n||"object"!=typeof n||!1===(null==(o=e.shouldCacheStaticFallbackHeight)?void 0:o.call(e)))return Ei(n,t);const l=n,r=i.get(l);if(r&&r.width===t)return r.height;const a=Ei(n,t);return i.set(l,{width:t,height:a}),a}(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&c<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(Ri)}(l,a)?c:Math.max(e.averageNodeHeight.value,c)}function s(){var i;const s=e.parsedNodes.value.length,c=e.getPrefixCacheKeyParts().join(":"),d=o;l!==c&&(l=c,a(0));const f=e.averageNodeHeight.value;r!==f&&(r=f,a(0)),d.length>s+1&&(d.length=s+1,t>=0&&t>=d.length-1&&(n=!1));const m=d.length-1;if(!n){if(m===s)return d;t=m}const h=Math.min(t,m);d.length<s+1&&(d.length=s+1);for(let n=h;n<s;n++)d[n+1]=d[n]+(e.heightEstimationActive.value?u(n):null!=(i=e.nodeHeights[n])?i:f);return n=!1,t=s,d}function c(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const r=s();if(n>=(null!=(t=r[l])?t:0))return l-1;let i=0,a=l-1,u=l-1;for(;i<=a;){const e=i+a>>1;(null!=(o=r[e+1])?o:0)>=n?(u=e,a=e-1):i=e+1}return u}function d(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const r=e.parsedNodes.value.length,i=Ki(Math.trunc(n),0,r),a=Ki(Math.trunc(t),i,r);if(i>=a)return 0;const u=s();return(null!=(o=u[a])?o:0)-(null!=(l=u[i])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const r=e.heightSumTree.value,i=e.heightKnownTree.value;if(!r.length||!i.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(r,n,t)+(t-n-e.fenwickRangeSum(i,n,t))*e.averageNodeHeight.value}function f(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return c(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function m(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:a,getFallbackNodeHeight:u,estimateHeightRange:d,estimateIndexForOffset:f,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=s()[l.length])?t:0;return c(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=d(0,l.length);return f(Math.max(0,e-n))}let r=n;for(let i=l.length-1;i>=0;i--){const n=null!=(o=e.nodeHeights[i])?o:e.averageNodeHeight.value;if(r<=n)return i;r-=n}return 0},getEstimatedNodeHeightCount:m,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:m(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:d(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Fn,nodeHeights:Jo,heightStats:Go,heightTreeSize:Xo,heightSumTree:Yo,heightKnownTree:el,averageNodeHeight:nl,heightEstimationActive:ut,estimatedNodeHeights:Ar,getContainerWidth:dt,shouldCacheStaticFallbackHeight:()=>{var e;return!(null==(e=o.nodes)?void 0:e.length)},hasCustomParagraphComponent:()=>Boolean(Hn.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=Ai(Be.value||Tn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=de.value)?void 0:e.clientWidth)||0}));return[null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey),n,ut.value?1:0,ai.value,Hn.value.paragraph?1:0]},fenwickRangeSum:fl}),Ce=!0,J(()=>Fn.value.length,(e,n)=>{var t;To(null!=n&&e>=n?Nr(e):0),e<=0?Nl():(e<Xo.value&&(t=e,bl(),gl(()=>ll(t))),al(e))},{immediate:!0});const Hr=$(()=>{if(!gt.value)return Fn.value.map((e,n)=>({node:e,index:n}));const e=Fn.value.length,n=br(Hl.start,0,e),t=br(Hl.end,n,e);return Fn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Rr=$(()=>gt.value?Lo(0,Math.min(Hl.start,Fn.value.length)):0),$r=$(()=>{if(!gt.value)return 0;const e=Fn.value.length;return Lo(Math.min(Hl.end,e),e)});function Pr(){return wo.buildVirtualHeightSummary({topSpacerHeight:Rr.value,bottomSpacerHeight:$r.value,width:qr()})}function Fr(){const e=Fn.value,n=Pr();return u(a({},n),{probe:{paragraphReady:Boolean(_e.value.paragraph),listItemReady:Boolean(_e.value.listItem),listWrapperOverhead:_e.value.listWrapperOverhead,headingReadyLevels:Object.entries(_e.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:e.map((e,n)=>{var t,o,l,r,i,a,u,s,c;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=Ar.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=Ar.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=Ar.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=Ar.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Jo[n])?c:null}})})}function Er(){return null!=o.indexKey?String(o.indexKey):Qn.value?`virtual-${zr()}`:"markdown-renderer"}function Kr(e){const n=String(e),t=`${Er()}-`;if(!n.startsWith(t))return null;const o=n.slice(t.length).match(/^(\d+)(?:$|-)/);if(!o)return null;const l=Number(o[1]);return!Number.isInteger(l)||l<0||l>=Fn.value.length?null:l}function zr(){var e,n,t;const l=null==(e=o.virtualScroll)?void 0:e.sessionKey;return String(null!=l&&""!==l?l:null!=(t=null!=(n=o.indexKey)?n:D.customId)?t:In)}function jr(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}const Wr=$(()=>{var e,n,t;return null!=(t=jr())?t:String(null!=(n=null!=(e=o.indexKey)?e:D.customId)?n:In)});function Dr(e){var n;return(null!=e?e:"")===(null!=(n=jr())?n:"")}function Vr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(e){const n=e.codeBlockProps,t=e.codeBlockOptions,o=null==t?void 0:t.parseDiffOptions;return[e.isDark?"dark":"light",e.renderCodeBlocksAsPre?"code-pre":"code-rich",!1===e.codeBlockStream?"code-static":"code-stream",Pa(e.codeBlockMinWidth),Pa(e.codeBlockMaxWidth),Pa(null==t?void 0:t.fontSize),Pa(null==t?void 0:t.lineHeight),Pa(null==t?void 0:t.fontFamily),Pa(null==t?void 0:t.maxHeight),Pa(null==t?void 0:t.tabSize),Pa(null==t?void 0:t.padding),Pa(null==t?void 0:t.overflow),Pa(null==t?void 0:t.disableLineNumbers),Pa(null==t?void 0:t.diffStyle),Pa(null==t?void 0:t.diffIndicators),Pa(null==t?void 0:t.hunkSeparators),Pa(null==t?void 0:t.expandUnchanged),Pa(null==t?void 0:t.collapsedContextThreshold),Pa(null==t?void 0:t.expansionLineCount),Pa(null==o?void 0:o.context),Pa(null==n?void 0:n.showHeader),Pa(null==n?void 0:n.showCopyButton),Pa(null==n?void 0:n.showExpandButton),Pa(null==n?void 0:n.showPreviewButton),Pa(null==n?void 0:n.showCollapseButton),Pa(null==n?void 0:n.showFontSizeButtons),Pa(null==n?void 0:n.showLineNumbers)].join("\0")}({renderCodeBlocksAsPre:N.value,isDark:D.isDark,codeBlockStream:D.codeBlockStream,codeBlockMinWidth:D.codeBlockMinWidth,codeBlockMaxWidth:D.codeBlockMaxWidth,codeBlockOptions:D.codeBlockOptions,codeBlockProps:D.codeBlockProps}),[null==n?"":String(n),t].join("\0")}function qr(){return dt()}const Ur=$(()=>Ai(qr())),Jr=$(()=>[Vr(),Ur.value].join("\0")),Gr=$(()=>{var e;return Qn.value?["virtual",null!=(e=jr())?e:"",zr(),Jr.value].join("\0"):o.indexKey});function Xr(){Gl.value+=1}function Yr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Fn.value.length||e.sessionKey!==zr()||e.threadKey!==jr()||e.layoutEpochKey!==Jr.value)}function Zr(e){const n=String(e),t=Jl.get(n);return t?Yr(t)?t.index:null:Kr(n)}function Qr(e="async-node"){(Ul.size||Jl.size)&&(Xl=0,Ul.clear(),Jl.clear(),Xr(),iu(e))}const ei=R(Me,null),ni={reportHeight(e,n){if(!rt.value)return;const t=Zr(e);if(null==t)return;const o=$l.get(t);if(!o)return;const l=Number(n),r=wl(t,o);!function(e,n,t={}){gl(()=>xl(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!rt.value)return;const n=Kr(e);null!=n&&function(e,n){var t;const o=Jl.get(e);if(o&&Yr(o))return Ul.set(e,Math.max(0,null!=(t=Ul.get(e))?t:0)+1),Xl+=1,Xr(),void iu("async-node");Ul.set(e,1),Xl+=1,Jl.set(e,function(e){return{index:e,sessionKey:zr(),threadKey:jr(),layoutEpochKey:Jr.value}}(n)),Xr(),iu("async-node")}(String(e),n)},markSettled(e){if(!rt.value)return;const n=String(e),t=Zr(e);if((null!=t||function(e){return Ul.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Ul.get(e))?n:0;return!(t<=0||(t<=1?(Ul.delete(e),Jl.delete(e)):Ul.set(e,t-1),Xl=Math.max(0,Xl-1),Xr(),1===t&&iu("async-node"),0))}(n)&&null!=t){const e=$l.get(t);e&&hu(t,e)}}};function ti(e){if(void 0!==e)return e;let n=0;for(const t of $l.values())n+=Tn("getVisibleDomHeight.offsetHeight",()=>t.offsetHeight);return n}ee(Me,{reportHeight(e,n){ni.reportHeight(e,n),null==ei||ei.reportHeight(e,n)},markPending(e){ni.markPending(e),null==ei||ei.markPending(e)},markSettled(e){ni.markSettled(e),null==ei||ei.markSettled(e)}});let oi,li=null,ii=null;function si(e){return!1!==e&&null!=e&&""!==e}function ci(){return gt.value?function(){if(!gt.value)return!0;const e=Fn.value.length,n=br(Hl.start,0,e),t=br(Hl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Dt.has(o))return!1;if(uu(o)&&!$l.has(o))return!1}return!0}():$t.value>=Ql.value}function di(){return!0===ln.value&&!sn.value&&0===Yl.value&&0===Wl.size&&0===zl.size&&null==Zl&&ci()}function fi(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(li===zr()&&oi===jr())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!si(t)&&ii===Tu(t)}function hi(){return di()&&fi()}function ki(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function Ni(e="manual",n,t){const o=Pr(),l=function(e){return e||(!0!==ln.value?Fn.value.length>0?"streaming":"estimating":!ci()||zl.size>0||null!=Zl?"measuring":hi()?"settled":"settling")}(n);return{sessionKey:zr(),threadKey:jr(),phase:l,nodeCount:o.totalNodes,liveRange:{start:Hl.start,end:Hl.end},renderedCount:$t.value,measuredCount:o.measuredCount,estimatedCount:o.estimatedCount,averageNodeHeight:o.averageNodeHeight,topSpacerHeight:o.topSpacerHeight,bottomSpacerHeight:o.bottomSpacerHeight,visibleDomHeight:ti(t),totalHeight:Ii(o),width:o.width,final:!0===ln.value,stable:hi(),confidence:ki(l,o),reason:e}}function Ti(){const e=bo.value||Xe(),n=de.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=Tn("getScrollBox.scrollTop",()=>Qe(e,t,o)),r=Tn("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=Tn("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function Ii(e){var n;const t=Fn.value.length,o=Math.max(0,Lo(0,t)),l=Tn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.offsetHeight)?n:0}),r=Math.max(0,l>0?l:Tn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.scrollHeight)?n:0}));return t<=0?Math.ceil(l):gt.value?o>0?Math.max(1,Math.ceil(o),function(){let e=Rr.value+$r.value;for(const n of Dt.values())n&&(e+=Math.max(0,Tn("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(o,r)):Math.max(1,Math.ceil(r)):rt.value?o>0||Go.count>0||(null!=(n=null==e?void 0:e.estimatedCount)?n:wo.getEstimatedNodeHeightCount())>0?(Ht.value&&$t.value,Math.max(1,Math.ceil(r),Math.ceil(o))):Math.ceil(r):Math.max(1,Math.ceil(r),Math.ceil(o))}function Li(e){const n=de.value;if(!n)return null;const t=Tn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:Tn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function Hi(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=Ti(),t=de.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=Tn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=Tn("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=Ti(),n=de.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=Li(e);return null==t?null:t>=-8&&t<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,t)}:null}();if(o)return{anchor:o,captured:!0};const l=Wo();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Fn.value.length;return e<=0?null:{type:"node",nodeIndex:br(Al.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function $i(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Pi(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t^=31,t=Math.imul(t,16777619),t}const Fi=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function zi(e,n=/* @__PURE__ */new WeakSet,t=0){if(null==e||"number"==typeof e||"boolean"==typeof e)return String(e);if("string"==typeof e)return`s:${function(e){const n=e.length>8192?`${e.slice(0,8192)}...${e.length}`:e;return`${e.length}:${$i(n)}`}(e)}`;if("function"==typeof e)return"fn";if("object"!=typeof e)return typeof e;if(n.has(e))return"cycle";if(t>=6)return"max-depth";n.add(e);try{if(Array.isArray(e)){if(e.length<=160){const o=[];for(let l=0;l<e.length;l++)o.push(zi(e[l],n,t+1));return`a:${e.length}:${o.join(",")}`}const o=[],l=[],r=Math.max(0,e.length-32);let i=2166136261;for(let a=0;a<e.length;a++){const u=zi(e[a],n,t+1);i=Pi(i,u),a<32&&o.push(u),a>=r&&l.push(u)}return[`a:${e.length}`,`h=${o.join(",")}`,`t=${l.join(",")}`,`all=${(i>>>0).toString(36)}`].join(":")}const o=e,l=Object.keys(o).filter(e=>{const n=o[e];return"parent"!==e&&"el"!==e&&"component"!==e&&(null==n||"string"==typeof n||"number"==typeof n||"boolean"==typeof n||Fi.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${zi(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let ji=-1;const Wi=/* @__PURE__ */new Map;let Di=-1,Vi="",qi=[2166136261];function Ui(e){var n;const t=Fn.value[e],l=Kn();if(ji!==l&&(ji=l,Wi.clear()),!t)return"";if((null==(n=o.nodes)?void 0:n.length)||D.parseOptions||D.customMarkdownIt||$n.value.__markstreamHasCustomParserExtensions||0!==Object.keys(Hn.value).length)return $i(zi(t));const r=Wi.get(e);if(void 0!==r)return r;const i=$i(zi(t));return Wi.set(e,i),i}function Ji(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function Gi(){var e,n;const t=we.value;if(Di===t)return Vi;const o=Fn.value.length;let l=Nr(o);(Di!==t-1||l>o||qi.length<l+1)&&(l=0),0===l?qi=[2166136261]:qi.length=l+1;for(let r=l;r<o;r++){const n=Ui(r);qi[r+1]=Ji(null!=(e=qi[r])?e:2166136261,n)}return qi.length=o+1,Vi=((null!=(n=qi[o])?n:2166136261)>>>0).toString(36),Di=t,Vi}function Xi(e,n={}){var t;const l=!0===n.includeHeightCache,r=null!=(t=n.includeContentHash)?t:l,i=l?function(e){const n=function(){var e,n;const t=Number(null!=(n=null==(e=o.virtualScroll)?void 0:e.heightCacheLimit)?n:5e3);return!Number.isFinite(t)||t<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(t))}();if(!Number.isFinite(n)||e.length<=n)return e;const t=/* @__PURE__ */new Map,l=e=>{!e||t.size>=n||t.set(e.index,e)},r=Fn.value.length,i=br(Hl.start-2*pt.value,0,r),a=br(Hl.end+2*pt.value,i,r);for(const o of e)o.index>=i&&o.index<a&&l(o);const u=Math.max(1,Math.ceil(e.length/n));for(let o=0;o<e.length&&t.size<n;o+=u)l(e[o]);for(let o=e.length-1;o>=0&&t.size<n;o-=u)l(e[o]);return Array.from(t.values()).sort((e,n)=>e.index-n.index).slice(0,n)}(cl().map(e=>{var n;const t=Fn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Ui(e.index)}):null}).filter(e=>Boolean(e))):[],s=Hi({allowFallback:!0===n.allowAnchorFallback,requireViewport:n.requireViewport});return s||i.length||!0===n.includeEmptyState?u(a({sessionKey:e.sessionKey,threadKey:e.threadKey},s?{anchor:s.anchor,anchorCaptured:s.captured}:{anchorCaptured:!1}),{metrics:e,width:e.width,contentHash:r?Gi():void 0,measurementKey:Vr()||void 0,heightCache:i.length?i:void 0}):null}function Yi(e){var n,t;const o=Ti();if(!o)return;const l=function(e){const n=de.value;if(!n)return null;const t=en(n,e.root),o=Fn.value.length,l=Tn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?Tn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=Ii();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){_o=Ga()+120,Oo=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Mi(o.root,o.doc,i,{isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Qe})}const Zi=[];function Qi(){if(ze)for(null!=Co&&(null==Mt||Mt(Co),Co=null);Zi.length;){const e=Zi.pop();null!=e&&window.clearTimeout(e)}}function ea(e){const n=Boolean(So.value);So.value=null,_o=0,Oo=null,Qi(),n&&e&&iu(e)}function na(){if(!So.value||!ze)return;if(null!=Co)return;const e=()=>{Co=null;const e=So.value;e&&Yi(e)};Co=wt?wt(e):null,null==Co&&e()}function ta(e,n={}){const t=Fn.value.length;return t<=0?[]:e.filter(e=>!(!Number.isInteger(e.index)||e.index<0||e.index>=t)&&!(!Number.isFinite(e.height)||e.height<=0)&&!(n.requireSignature&&!e.signature)&&!(n.requireCompatibilityMetadata&&!e.nodeType&&!e.signature)&&function(e){var n;const t=Fn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==Ui(e.index))}(e))}function oa(e){const n=Ai(qr()),t=Ai(e);return-1!==n&&-1!==t&&n===t}function la(e){var n;const t=Number(null==e?void 0:e.width);if(Number.isFinite(t)&&t>0)return t;const o=Number(null==(n=null==e?void 0:e.metrics)?void 0:n.width);return Number.isFinite(o)&&o>0?o:null}function ra(e){var n;return e.sessionKey===zr()&&!!Dr(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Vr()&&!!oa(la(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(ia(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function ia(e){return Boolean(e.contentHash&&e.contentHash===Gi())}function aa(e){return!ia(e)}let ua=null,sa=null,ca=null,da=null,fa=null,ma=!1;function ha(e){var n;const t=e.map(e=>{var n,t;return[e.index,Math.round(10*e.height),null!=(n=e.nodeType)?n:"",null!=(t=e.signature)?t:""].join("")}).join(""),o=Ai(qr());return[null!=(n=jr())?n:"",zr(),Vr(),Fn.value.length,o,e.length,$i(t)].join(":")}function va(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!rt.value||!(null==e?void 0:e.length))return!1;if(Fn.value.length<=0)return!1;if(!oa(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=ta(e,{requireSignature:!0});if(!t.length)return!ma&&"undefined"!=typeof console&&p&&(ma=!0,console.warn("[markstream-vue] virtualScroll.heightCache ignored: standalone heightCache entries must include compatible signature metadata. Use heightCache exported from virtual-state-change/render-settled, and pass heightCacheWidth from the same state.")),!1;const l=ha(t);return l===ua?(sa="standalone",!0):(Ml(t,{mode:"merge"}),To(),ua=l,sa="standalone",eu(),iu("restore"),!0)}function pa(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}function ga(e,n={}){var t,o,l;if(!rt.value||!e)return!1;if(e.sessionKey!==zr())return!1;if(!Dr(e.threadKey))return!1;if(Fn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!ya(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!ya()&&Number(la(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&ra(e)){const n=ta(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:aa(e)});n.length&&(Ml(n,{mode:"merge"}),To(),ua=ha(n),sa="restore",eu(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&iu("restore"),!0;if(!i)return u&&iu("restore"),!0;const s=function(e,n){var t;const o=e.anchor,l=o?"bottom"===o.type?`bottom:${Math.round(o.distanceFromBottomPx)}`:`node:${o.nodeIndex}:${Math.round(o.offsetWithinNodePx)}`:"none";return[null!=(t=jr())?t:"",zr(),Vr(),Ur.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return ca===s?(u&&iu("restore"),!0):(ca=s,function(e){const n=()=>{if("node"===e.type)return ea(),void Vo({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Ko(),Ho.value=null,So.value=e,Qi(),Yi(e),ze)for(const e of[0,120,280,480])Zi.push(window.setTimeout(()=>{const e=So.value;e&&Yi(e)},e))};!function(e){if(!gt.value)return!1;const n=Fn.value.length;return!(n<=0||(Al.value="node"===e.type?br(e.nodeIndex,0,n-1):n-1,Rl(),0))}(e)?n():oe(n)}(i),iu("restore"),!0)}function ya(){const e=qr();return Number.isFinite(e)&&e>0}function ka(e){var n;return e.sessionKey===zr()&&!!Dr(e.threadKey)&&(Fn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||ya())||!(!(e.anchor&&Number(la(e))>0)||ya()))}function ba(){Xt.length=0;for(const e of Object.keys(Jo)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Fn.value.length&&Sl(n)}}function Na(){null!=Zl&&(null==Mt||Mt(Zl),Zl=null),du()}function Ba(){return!ze||Bt?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(wt)return wt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function Ta(e,n=jr(),t=Jr.value){return zr()===e&&jr()===n&&Jr.value===t}function Ia(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=zr(),c=jr(),d=Jr.value,f=null!=(n=e.frames)?n:2,m=null!=(t=e.timeoutMs)?t:120,h=null!=(l=e.reason)?l:"manual",v=e.expectedSettledTokenKey,p=!0===e.flushPendingTimers,g=Ni(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>Ta(s,c,d)&&(null==v||Za()===v);for(let o=0;o<f;o++){if(yield oe(),!k())return y();if(yield Ba(),!k())return y();vu(),Na()}if(yield function(e){return!ze||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&or(),vu(),Na(),!k())return y();const b=di();b&&(li=s,oi=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&si(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Za()===v&&(ii=Tu(o.virtualScroll.settledToken)));const N=k()&&b&&fi(),S=Ni(h,N?"final":void 0);return ou(S,!0),S})}let za="content",ja=null,Wa=null,Da=0,Va=null,qa=null,Ua=null,Ja=null;function Ga(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Xa(e){var n,t;const l=Va;if(!l)return!0;const r=null!=(t=null==(n=o.virtualScroll)?void 0:n.heightDiffThresholdPx)?t:1;return Math.abs(e.totalHeight-l.totalHeight)>r||e.sessionKey!==l.sessionKey||e.phase!==l.phase||e.stable!==l.stable||e.final!==l.final||e.threadKey!==l.threadKey||e.nodeCount!==l.nodeCount||e.measuredCount!==l.measuredCount||e.width!==l.width}function Za(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Pa(e)}function Qa(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Vr(),Gi(),Pa(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function eu(){Ua=null,Ja=null,qa=null}function nu(e){const n=e.heightCache;return(null==n?void 0:n.length)?ha(n):""}function tu(e){var n,t,o;const l=e.metrics,r=e.anchor?"bottom"===(i=e.anchor).type?`bottom:${Math.round(i.distanceFromBottomPx)}`:`node:${i.nodeIndex}:${Math.round(i.offsetWithinNodePx)}`:"none";var i;return[e.sessionKey,null!=(n=e.threadKey)?n:"",null!=(t=e.measurementKey)?t:Vr(),null!=(o=e.contentHash)?o:"",nu(e),r,e.anchorCaptured?1:0,l.liveRange.start,l.liveRange.end,l.renderedCount,l.nodeCount,Math.round(l.totalHeight),Math.round(l.width),l.phase,l.stable?1:0].join("\0")}function ou(e,n=!1){if(!rt.value)return;if(function(e=!1){return!e&&Qn.value&&!it.value}(n))return;const t=n||Xa(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Xi(e,{includeHeightCache:!0})}:{state:Xi(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||tu(e)!==qa}(r,n)));if(t&&(X(e),Va=e,Da=Ga()),r&&i&&(te(r),r.anchor&&ce(r.anchor),qa=tu(r)),e.stable){const n=Qa("settled",e);if(n!==Ua){Ua=n;const t=Xi(e,{includeHeightCache:!0});t&&(te(t),qa=tu(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Qa("final",e);if(n!==Ja){Ja=n;const t=Xi(e,{includeHeightCache:!0});t&&(te(t),qa=tu(t)),function(e){l("render-final",e)}(e)}}}function lu(){null!=ja&&(null==Mt||Mt(ja),ja=null),null!=Wa&&ze&&(window.clearTimeout(Wa),Wa=null)}function ru(){ja=null,Wa=null;const e=Ga();let n;e-jl>=120&&(jl=e,n=vu()),(zl.size>8||null==Zl)&&Na(),ou(Ni(za,void 0,n))}function iu(e){var n,t;if(!rt.value)return;if(za=e,null!=ja||null!=Wa)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(Ga()-Da)),i=()=>{Wa=null,ja=wt?wt(ru):null,null==ja&&ru()};ze&&r>0?Wa=window.setTimeout(i,r):i()}function au(){go.value+=1}function uu(e){var n;if(Ht.value&&e>=$t.value){const n=Fn.value[e],t=!0===on.value&&!0!==ln.value&&e>=Fn.value.length-2,o="code_block"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type)||"mermaid"===(null==n?void 0:n.type)||"infographic"===(null==n?void 0:n.type);if(!t||o)return!1}return!Cl.value||e<Tt.value||!!(sn.value&&!0!==ln.value&&!(null==(n=o.nodes)?void 0:n.length)&&e>=Fn.value.length-pt.value)||sr.value.has(e)}function su(e){const n=dr.get(e);n&&(n(),dr.delete(e));const t=cr.get(e);t&&(t.destroy(),cr.delete(e)),mr(e)}function cu(e,n){let t=!1;if(n){const o=Dt.get(e);if(o===n&&Vt.get(e)===Il.value)return;Dt.set(e,n),o!==n&&(t=!0)}else Dt.delete(e)&&(t=!0);if(t&&au(),n||mr(e),!Tl.value||!xt)return su(e),n?Vt.set(e,Il.value):Vt.delete(e),void(n&&Cl.value&&hr(e,!0));if(!gt.value&&Cl.value&&!ye.value&&cr.size>=Ae.value&&(ye.value||(ye.value=!0,p&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),pr()),!Tl.value||!xt))return su(e),Vt.set(e,Il.value),void(n&&hr(e,!0));if(e<Tt.value&&!gt.value)return su(e),Vt.set(e,Il.value),void hr(e,!0);if(sr.value.has(e))return su(e),Vt.set(e,Il.value),void hr(e,!0);if(!n)return su(e),void Vt.delete(e);su(e);const o=xt(n,{rootMargin:Le.value});if(!o)return void Vt.delete(e);cr.set(e,o),Vt.set(e,Il.value),hr(e,o.isVisible.value),Cl.value&&function(e){if(!ze||!Cl.value)return;mr(e);const n=e%17*23,t=window.setTimeout(()=>{if(fr.delete(e),!Cl.value)return;if(sr.value.has(e))return;const n=Dt.get(e);if(!n)return;const t=Xe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?Tn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?Tn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=Tn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&hr(e,!0)},1800+n);fr.set(e,t)}(e);let l=null;l=J(()=>o.isVisible.value,n=>{if(n){mr(e),hr(e,!0),null==l||l(),dr.delete(e),cr.get(e)===o&&cr.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),dr.set(e,l),gt.value&&ur()}function du(){Zl=null,gl(()=>{let e=!1;for(const[n,t]of zl)zl.delete(n),$l.get(n)===t.el&&Pl.get(n)===t.version&&(e=xl(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function fu(){null!=Zl&&(null==Mt||Mt(Zl),Zl=null),zl.clear()}function mu(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if($l.get(e)!==n)return;const r=Pl.get(e);if(null==r)return;const i=Fn.value[e],a=sn.value&&!0!==ln.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Fn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=zl.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;zl.set(e,{height:d,allowShrink:c,version:r,el:n}),null==Zl&&(Zl=wt?wt(du):null,null==Zl&&du())}function hu(e,n){mu(e,n,wl(e,n))}function vu(){let e=0;for(const[n,t]of $l){const o=wl(n,t);e+=o,mu(n,t,o)}return e}function pu(){null==Jt||Jt.disconnect(),Jt=null,qt.clear()}function gu(){for(;Kl.length;)tr(Kl.pop())}J(it,e=>{e&&iu("content")},{flush:"post"}),n({getVirtualMetrics:Ni,captureVirtualState:function(e={}){var n;return Xi(Ni("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!0===e.allowFallbackAnchor,requireViewport:!0===e.requireViewport,includeEmptyState:null==(n=e.includeEmptyState)||n})},restoreVirtualState:function(e,n={}){const t=!0===n.restoreAnchor,o=null==n.restoreToken?"imperative":String(n.restoreToken);da=e,fa={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!ga(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&ka(e)||(da=null,fa=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield oe(),yield Ba(),vu(),Na(),yield oe();const n=Ni(e);return ou(n,!0),n})},settle:Ia,scrollToNode:function(e,n="start"){ea(),Ko();const t=Fn.value.length;if(t<=0)return;const o=br(e,0,t-1),l=()=>{var e;const t=Fo({nodeIndex:o,offsetWithinNodePx:0}),l=Io(o),r=Ti(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=$o();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}Po(Math.max(0,u)),ur({immediate:!0}),gt.value&&(Al.value=o,Rl())};if(gt.value)return Al.value=o,Rl(),void oe(l);l()}});const yu=/* @__PURE__ */new Set;J(()=>yt.value,e=>{if(e)Fl.clear();else{pu();for(const e of El.values())for(const n of e)tr(n);El.clear(),Pl.clear(),gu(),fu()}},{immediate:!0}),J(ln,e=>{e&&function(){if(ze&&ln.value&&$l.size){gu();for(const e of Jt?[80]:[80,240,640]){const n=nr(e,()=>{for(const[e,n]of $l)n&&hu(e,n)},"final");null!=n&&Kl.push(n)}}}(),iu(e?"final":"content")});const ku=Ci(()=>iu("content"),16),bu=Ci(()=>iu("batch"),16);J([()=>Fn.value.length,()=>$t.value],()=>{So.value&&na(),ku()},{flush:"post",immediate:!0}),J([()=>Hl.start,()=>Hl.end],()=>{bu()},{flush:"post"});const{cleanupBatchScheduler:Nu}=function(e){const{props:n,isClient:t,isTestEnv:o,parsedNodesIdentity:l,parsedNodeCount:r,desiredRenderedCount:i,datasetKey:a,batchingEnabled:u,incrementalRenderingActive:s,resolvedBatchSize:c,resolvedInitialBatch:d,renderedCount:f,adaptiveBatchSize:m,previousRenderContext:h,previousBatchConfig:v,requestFrame:p,cancelFrame:g,hasIdleCallback:y,cleanupNodeVisibility:k,onDatasetKeyChanged:b,onDatasetChanged:N}=e;let S=null,x="raf",w=null,M=0,C=!1,B=!1;const _=/* @__PURE__ */new Set,O=/* @__PURE__ */new Set;function T(){if(t){null!=S&&("raf"===x&&g?g(S):"idle"===x&&"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(S):"timeout"===x&&window.clearTimeout(S),S=null),M+=1;for(const e of _)g&&g(e);for(const e of O)window.clearTimeout(e);_.clear(),O.clear(),w=null,C=!1,B=!1}}function I(){return"undefined"!=typeof performance?performance.now():Date.now()}function L(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.5*o?m.value=Math.max(r,Math.floor(.8*m.value)):e<.6*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),C=!1;const t=B||f.value<i.value;B=!1,t&&R()}function A(e,l={}){var r,a;if(!s.value)return;const u=i.value;if(f.value>=u)return;const c=Math.max(1,e),d=()=>{const e=I();S=null;const o=null!=w?w:c;w=null;const l=I();f.value=Math.min(u,f.value+o),k(f.value),function(e,o){if(!t)return void L(o);C=!0;const l=++M;oe().then(()=>{var t;if(l!==M)return;const r=I(),i=Math.max(o,r-e),a=()=>{l===M&&L(i)};if(p){let e=null,o=null,l=!1;const r=()=>{l||(l=!0,null!==e&&(_.delete(e),e=null),null!==o&&(O.delete(o),window.clearTimeout(o),o=null),a())};return e=p(()=>{r()}),_.add(e),o=window.setTimeout(()=>{null!==e&&g&&g(e),r()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void O.add(o)}const u=window.setTimeout(()=>{O.delete(u),a()},0);O.add(u)})}(e,I()-l)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(w=null!=w?Math.max(w,c):c,null==S){if(!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return x="idle",void(S=window.requestIdleCallback(()=>d(),{timeout:e}))}if(p&&!o)return x="raf",void(S=p(()=>{0===m?d():(x="timeout",S=window.setTimeout(()=>d(),m))}));x="timeout",S=window.setTimeout(()=>d(),m)}}function H(e,n={}){C?B=!0:null==e?R():A(e,n)}function R(){s.value&&A(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return J([l,r,a,s,c,d,()=>n.renderBatchDelay],()=>{var e;const o=r.value,l=h.value,u=a.value,p=!Object.is(u,l.key),g=o!==l.total,y=g&&o>l.total&&l.total>0&&!p,S=p||g;h.value={key:u,total:o};const x=v.value,w=null!=(e=n.renderBatchDelay)?e:16,M=x.batchSize!==c.value||x.initial!==d.value||x.delay!==w||x.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:w,enabled:s.value},p&&b(o),(S||M||!s.value)&&T(),(S&&!y||M)&&(m.value=Math.max(1,c.value||1)),S&&!y&&N();const C=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=C,void k(f.value);const B=p||0===l.total;f.value=B||M?Math.min(C,d.value):Math.min(f.value,C);const _=Math.max(1,d.value||c.value||o);f.value<C?H(_,{immediate:!t}):k(f.value)},{immediate:!0}),J(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&H())}),{cleanupBatchScheduler:T}}({props:D,isClient:ze,isTestEnv:Bt,parsedNodesIdentity:jn,parsedNodeCount:Wn,desiredRenderedCount:Ql,datasetKey:Gr,batchingEnabled:Lt,incrementalRenderingActive:Ht,resolvedBatchSize:Ot,resolvedInitialBatch:Tt,renderedCount:$t,adaptiveBatchSize:Ft,previousRenderContext:Pt,previousBatchConfig:Et,requestFrame:wt,cancelFrame:Mt,hasIdleCallback:Ct,cleanupNodeVisibility:vr,onDatasetKeyChanged:e=>{fu(),Nl(),To(),eu(),e>0&&rl(e)},onDatasetChanged:()=>{gt.value&&ur({immediate:!0})}});J([Ll,gt,()=>de.value,()=>He()],([e,n])=>{if(!e)return gr(),void ar();yr(),n?ur({immediate:!0}):ar()},{flush:"post",immediate:!0});let Su=!1;function xu(){gt.value&&ze&&!Su&&(Su=!0,wt?wt(()=>{Su=!1,ur({immediate:!0})}):queueMicrotask(()=>{Su=!1,ur({immediate:!0})}))}J([()=>Fn.value.length,()=>gt.value],([e,n])=>{n&&e&&ze&&xu()},{flush:"post"}),J(ut,e=>{e&&function(){var e;if(Dn.value&&Vn.value&&qn.value&&(null==(e=Un.value)?void 0:e[1]))return;const n=me({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=me({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=me({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Dn.value=n,Vn.value=t,qn.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]=me({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Un.value=l}()},{immediate:!0}),J([()=>de.value,Bl],()=>{if(!Bl.value)return Br(),void(Be.value=0);Mr(),Br(),Bl.value&&de.value&&"undefined"!=typeof ResizeObserver&&(Cr=new ResizeObserver(()=>{Mr(),ut.value&&(Ho.value&&jo(),So.value&&na(),iu("resize"))}),Cr.observe(de.value))},{immediate:!0}),J([ut,ft,Jr],()=>s(null,null,function*(){if(!ut.value)return _e.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void To();yield oe(),function(){if(!ut.value||"undefined"==typeof window)return _e.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void To();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=xr(Sr(fe.value),".paragraph-node");e.paragraph=bi(fe.value,n,"pre-wrap");const t=Sr(he.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=bi(he.value,o,"pre-wrap");const l=Tn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=ve.value)?void 0:e.offsetHeight)?n:0}),r=Tn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=he.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=xr(Sr(pe[i]),`h${i}`);e.headings[i]=bi(pe[i],n,"pre-wrap")}_e.value=e,To()}()}),{flush:"post",immediate:!0}),J(()=>Fn.value.length,()=>{gt.value&&xu()}),J([ut,Be],()=>{To(),gt.value&&ur({immediate:!0}),Ho.value&&jo(),So.value&&na(),iu("resize")},{immediate:!1}),J(()=>Cl.value,e=>{if(e)for(const[n,t]of Dt)cu(n,t);else if(pr(),gt.value)ur({immediate:!0});else for(const[n,t]of Dt)t&&hr(n,!0)},{immediate:!1}),J([Le,Ae,()=>He()],()=>{var e;null==(e=xt.refresh)||e.call(xt);for(const[n,t]of Dt)cu(n,t)},{immediate:!1}),J([()=>D.viewportPriority,()=>Fn.value.length,Ae],([e,n,t])=>{if(!1!==e){if(ye.value&&(n<=200||n<=t)){ye.value=!1;for(const[e,n]of Dt)cu(e,n)}}else ye.value=!1}),J(()=>$t.value,()=>{gt.value&&ur({immediate:!0})}),J([Al,ht,pt,()=>Fn.value.length,gt],()=>{Rl()},{immediate:!0});let wu=null,Mu=!1,Cu=null;function Bu(){wu=null,li=null,oi=void 0,ii=null,eu()}function _u(){fu(),Nl(),To(),Xt.length=0;const e=Fn.value.length;e>0&&rl(e),ba()}function Ou(){lu(),or(),Va=null,ua=null,sa=null,ca=null,da=null,fa=null,Mu=!1,Bu(),Qr("restore"),Ko(),ea()}function Tu(e){var n;return[null!=(n=jr())?n:"",zr(),Vr(),Ur.value,Za(e),Fn.value.length,Math.round(Lo(0,Fn.value.length)),Math.round(qr()),Go.count,Math.round(Go.total)].join(":")}function Iu(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Za(r),a=zr(),u=jr(),s=Jr.value;if(rt.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&si(r))if(di()){if(Tu(r)!==ii&&!Mu){Mu=!0;try{const e=yield Ia({reason:"manual",expectedSettledTokenKey:i}),n=Za()===i;Ta(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(ii=Tu(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{Mu=!1,yield oe();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=si(e)?Tu(e):"";Ta(a,u,s)&&n&&ii!==n&&Iu()}}}else iu("manual")})}J(rt,(e,n)=>{if(e!==n){if(!e)return Ou(),void lu();Ou(),_u(),Cu=Jr.value,iu("content")}},{flush:"post"}),J([rt,Jr],([e,n])=>{e?null!=Cu?Cu!==n&&(Cu=n,function(e="resize"){fu(),Nl(),To(),Xt.length=0;const n=Fn.value.length;n>0&&rl(n),ba(),ua=null,sa=null,ca=null,Va=null,Mu=!1,Bu(),va(),oe(()=>{vu(),Ho.value&&jo(),So.value&&na(),iu(e)})}("resize")):Cu=n:Cu=null},{flush:"post",immediate:!0}),J([rt,()=>zr(),()=>jr()],([e])=>{e&&(Ou(),_u(),Qr("content"),iu("content"))}),J([rt,()=>zr(),()=>jr(),Jr,()=>Fn.value.length],([e])=>{e&&function(e="async-node"){var n;let t=!1;for(const[o,l]of Array.from(Jl.entries()))Yr(l)||(Xl-=Math.max(0,null!=(n=Ul.get(o))?n:0),Jl.delete(o),Ul.delete(o),t=!0);t&&(Xr(),iu(e))}("async-node")},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>we.value],([e])=>{e&&(eu(),function(e="content"){if(!rt.value)return;const n=[],t=Fn.value.length,o=Nr(t),l=Xt.length-1,r=Math.max(t-1,l);for(let i=o;i<=r;i++){if(i>=t){i<=l&&void 0!==Xt[i]&&n.push(i);continue}const e=Ui(i),o=Xt[i];null!=o&&o!==e&&n.push(i),Xt[i]=e}if(l>=t){for(let e=t;e<=l;e++)Xt[e]=void 0;Xt.length=t}n.length&&(function(e,n={}){const t=Array.from(e,Number);vl(t);let o=0;if(gl(()=>(o=sl(t,n),o>0)),o>0)!function(e){for(const n of e)Number.isInteger(n)&&n>=0&&n<Xt.length&&(Xt[n]=void 0)}(t);else for(const l of t)mo.delete(l)}(n,{notify:!1}),To(o),Bu(),Ho.value&&jo(),So.value&&na(),iu(e))}("content"))},{flush:"post",immediate:!0}),J([rt,()=>Fn.value.length,()=>zr(),()=>jr()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Bu()},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCache},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.heightCacheWidth},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Fn.value.length,()=>zr(),Be],()=>{va()},{flush:"post",immediate:!0}),J(pa,(e,n)=>{null==e&&null!=n&&(Ko(),Ho.value=null,ea(),ca=null)},{flush:"post"}),J([rt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreAnchor},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>Fn.value.length,()=>zr(),Be],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield oe();const t=pa();ga(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),J([rt,Be,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.restoreState},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey}],([e])=>{var n;if(!e)return;const t=null==(n=o.virtualScroll)?void 0:n.restoreState;t&&ua&&"restore"===sa&&(ra(t)||(_u(),ua=null,sa=null,iu("resize")))},{flush:"post"}),J([rt,()=>Fn.value.length,()=>zr(),Be],e=>s(null,[e],function*([e]){var n;const t=da,o=fa;e&&t&&(yield oe(),!ga(t,{restoreAnchor:!0===(null==o?void 0:o.restoreAnchor),restoreToken:null!=(n=null==o?void 0:o.restoreToken)?n:"imperative",allowUncapturedAnchor:!0===(null==o?void 0:o.allowUncapturedAnchor)})&&ka(t)||(da=null,fa=null))}),{flush:"post",immediate:!0}),J([rt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>zr(),()=>jr(),Jr,Yl,ql,()=>$t.value,Ql,()=>Go.count,()=>Go.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!hi())return;const o=function(){var e;const n=Fn.value.length;return[null!=(e=jr())?e:"",zr(),Vr(),Ur.value,n,Math.round(Lo(0,n)),Math.round(qr()),Go.count,Math.round(Go.total)].join(":")}();wu!==o&&(wu=o,Ia({reason:"final"}).then(e=>{e.stable||wu!==o||(wu=null)}))},{flush:"post",immediate:!0}),J([rt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>zr(),()=>jr(),Jr,Yl,ql,()=>$t.value,Ql,()=>Fn.value.length,()=>Go.count,()=>Go.total],()=>{Iu()},{flush:"post",immediate:!0}),J([()=>Fn.value.length,gt,ht,pt,()=>Hl.start,()=>Hl.end],([e,n,t,o,l,r])=>{We.value&&kn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Al.value,scroll:n?(()=>{const e=bo.value||Xe();return e?{reverse:Ye(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:$t.value})}),J([()=>D.customId],([e],n,t)=>{if(!e||Jn)return;const o=function(e,n){return e?(ri.controllers[e]=n,()=>{ri.controllers[e]===n&&delete ri.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Wo,restoreAnchor:Vo,getAnchorDrift:qo,getReport:Fr});t(()=>{o()})},{immediate:!0}),ne(()=>{!function(){if(rt.value)try{vu(),Na();const e=Ni("manual");Xa(e)&&(X(e),Va=e,Da=Ga());const n=Xi(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(te(n),n.anchor&&ce(n.anchor),qa=tu(n))}catch(e){}}(),Nu(),pr(),pn(),pu();for(const e of El.values())for(const n of e)tr(n);El.clear(),Pl.clear(),Xt.length=0,gu(),fu(),Br(),Ko(),ea(),lu(),gr(),ar()});const Lu=Zt("ViewportDeferredMermaidBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./index10.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),It}}),loadingComponent:Ha,delay:0}),Ha),Au=Zt("ViewportDeferredInfographicBlockNode",le({loader:()=>s(null,null,function*(){try{return(yield import("./index9.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Showing the Infographic source fallback. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),Aa}}),loadingComponent:Aa,delay:0}),Aa),Hu=Zt("ViewportDeferredD2BlockNode",le(()=>s(null,null,function*(){try{return(yield import("./index7.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),It}})),It),Ru={text:At,paragraph:il,heading:Uo,code_block:no,list:Qo,list_item:Zo,blockquote:Ro,table:hl,definition_list:Eo,footnote:Do,footnote_reference:dn,footnote_anchor:zo,admonition:Ya,vmr_container:kl,hardbreak:Bo,link:ko,image:vt,thematic_break:pl,math_inline:to,math_block:oo,strong:fo,emphasis:Mo,strikethrough:ho,highlight:xo,insert:No,subscript:so,superscript:ao,emoji:un,checkbox:rn,checkbox_input:rn,inline_code:On,html_inline:wn,reference:ro,html_block:ol},$u=$(()=>Er()),Pu=$(()=>Si(D.codeBlockProps)),Fu=$(()=>Si(D.codeBlockProps)),Eu=$(()=>u(a(a({stream:D.codeBlockStream,darkTheme:D.codeBlockDarkTheme,lightTheme:D.codeBlockLightTheme,themes:D.themes,minWidth:D.codeBlockMinWidth,maxWidth:D.codeBlockMaxWidth},"boolean"==typeof De.value?{showTooltips:De.value}:{}),Fu.value),{codeBlockOptions:D.codeBlockOptions})),Ku=$(()=>u(a(a({},Eu.value),Pu.value),{codeBlockOptions:D.codeBlockOptions}));function zu(e){return"boolean"==typeof e?e:void 0}const ju=$(()=>{var e,n,t,o,l,r,i;const a=D.codeBlockProps||{},u={},s=zu(a.showLineNumbers);u.showLineNumbers=null!=s?s:!0!==(null==(e=D.codeBlockOptions)?void 0:e.disableLineNumbers),u.showHeader=null==(n=zu(a.showHeader))||n,u.showCopyButton=null==(t=zu(a.showCopyButton))||t;const c=null!=(o=zu(a.showTooltips))?o:De.value;"boolean"==typeof c&&(u.showTooltips=c),u.codeBlockOptions=D.codeBlockOptions,u.isDark=D.isDark,u.darkTheme=null!=(l=a.darkTheme)?l:D.codeBlockDarkTheme,u.lightTheme=null!=(r=a.lightTheme)?r:D.codeBlockLightTheme,u.theme=a.theme,u.themes=null!=(i=a.themes)?i:D.themes;const d=zu(a.diffInline);void 0!==d&&(u.diffInline=d),void 0!==a.diffHideUnchangedRegions&&(u.diffHideUnchangedRegions=a.diffHideUnchangedRegions);const f=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(a.reservedHeightPx);return void 0!==f&&(u.reservedHeightPx=f),u}),Wu=$(()=>a({},D.mermaidProps||{})),Du=$(()=>a({},D.d2Props||{})),Vu=$(()=>a({},D.infographicProps||{})),qu=$(()=>({typewriter:k.value,fade:D.fade,customHtmlTags:Pn.value.customHtmlTags})),Uu=$(()=>a(a({},qu.value),"boolean"==typeof De.value?{showTooltip:De.value}:{})),Ju=$(()=>a(a({},qu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),Gu=$(()=>a(a({},qu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),Xu=$(()=>a(a({},qu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{}));function Yu(e){return Array.isArray(e.children)&&e.children.length>0}const Zu=/* @__PURE__ */new WeakMap,Qu=/* @__PURE__ */new WeakMap,es=[],ns=[];let ts=null,os=[];function ls(e,n){var t;const o=String(null!=(t=null==e?void 0:e.code)?t:""),l=Qu.get(e);if(l&&l.code===o)return l.height;const r=n(o);return Qu.set(e,{code:o,height:r}),r}function rs(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!Object.is(e[t],n[t]))return!1;return!0}const is=$(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return Fn.value.forEach((t,o)=>{var l;if("footnote"!==t.type)return;const r=t.id,i=null!=(l=e.get(r))?l:0;n.set(o,i),e.set(r,i+1)}),n});function as(e,n){var t,o,l,s,f;const m=function(e,n,t){const o=ut.value?Ar.value[n]:null;return[n,e.loading,o,t]}(e.node,e.index,n),h=Zu.get(e.node);if(h&&rs(h.signature,m))return h.item;let v=function(e,n){var t,o;if("code_block"!==e.type)return Gt[n]=void 0,e;const l=e,r=[l.language,l.loading,l.diff,l.code,l.originalCode,l.updatedCode,l.raw,l.startLine,l.endLine,null==(t=l.sourceMap)?void 0:t.startLine,null==(o=l.sourceMap)?void 0:o.endLine],i=Gt[n];if(i&&r.every((e,n)=>e===i.signature[n]))return i.node;const u=a({},l);return Gt[n]={signature:r,node:u},u}(e.node,e.index);const p=ss(v);let g=ms(v,p);if(("html_block"===v.type||"html_inline"===v.type)&&g===Ru[v.type]){const e=v,n=String(null!=(t=e.tag)?t:"").trim().toLowerCase()||M(e.content);if(n){const t=Hn.value[n];if(Rn.value.has(n)&&t)g=t,v=u(a({},e),{type:n,tag:n,content:L(e.content,n)});else if(C(null!=(o=e.content)?o:e.raw,n)){const n=String(null!=(s=null!=(l=e.content)?l:e.raw)?s:"");"html_inline"===v.type?(g=At,v={type:"text",content:n,raw:n}):(g=il,v={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const y="code_block"===v.type&&N.value&&g===eo&&!xi(Hn.value,p);let k=a({},function(e,n,t){const o=null!=n?n:ss(e);if("code_block"===e.type){const n=o?xi(Hn.value,o):void 0;if(t&&N.value&&!n&&t===eo)return ju.value;if(t&&o&&t===n)return"mermaid"===o?ds(e):"infographic"===o?fs(e):"d2"===o||"d2lang"===o?Du.value:Ku.value;if(t&&t===Hn.value.code_block)return Ku.value}return"mermaid"===o?ds(e):"infographic"===o?fs(e):"d2"===o||"d2lang"===o?Du.value:"link"===e.type?Uu.value:"list"===e.type?Ju.value:"blockquote"===e.type?Gu.value:"table"===e.type?Xu.value:"code_block"===e.type?Eu.value:qu.value}(v,p,g));const b=ut.value?Ar.value[e.index]:null;"code_block"===v.type&&"code-block"===(null==b?void 0:b.kind)&&(k=u(a({},k),y?{reservedHeightPx:b.contentHeight}:{estimatedHeightPx:b.height,estimatedContentHeightPx:b.contentHeight,estimatedDiffInline:b.diffInline})),y||"code_block"!==v.type||"mermaid"!==p||null!=Ke(k.estimatedPreviewHeightPx)||(k=u(a({},k),{estimatedPreviewHeightPx:$e(ls(v,Pe))})),y||"code_block"!==v.type||"infographic"!==p||null!=Ke(k.estimatedPreviewHeightPx)||(k=u(a({},k),{estimatedPreviewHeightPx:Fe(ls(v,Ee))})),"math_block"===v.type&&(k=u(a({},k),{cacheScope:An}));const S=function(e,n){const t=String(e.type);return!Ue(t)&&Hn.value[t]===n}(v,g),x=S?yn(v,Ve.value):void 0,w=v.loading;let B=e.index;"footnote"===v.type&&g===Do&&(B=`footnote-${v.id}-${is.value.get(e.index)}`);const _=`${$u.value}-${B}`,O=a({node:v,loading:w,"index-key":_},"reference"===v.type?{"data-markstream-reference-id":String(v.id)}:{}),T={"custom-id":D.customId,"is-dark":D.isDark},I={onCopy:r,onHandleArtifactClick:i},A={onClick:hs,onMouseover:gs,onMouseout:ys},H={onMouseover:c,onMouseout:d},R=a(a({},null!=x?x:{}),k),$=ae(O,k,T,I),P=ae(R,O,T,I),F={node:v,sourceLoading:w,index:e.index,component:g,bindings:k,customBindings:R,nodeProps:$,customNodeProps:P,fragmentNodeProps:ae($,A),customFragmentNodeProps:ae(P,A),minimalNodeProps:ae($,H),rendersCustomNode:S,hasSlotChildren:Yu(v),slotContent:String(null!=(f=v.content)?f:""),isCodeBlock:"code_block"===v.type,indexKey:_,vnodeKey:`${Wr.value}\0${B}\0${v.type}`};return Zu.set(e.node,{signature:m,item:F}),F}const us=$(()=>{var e,n,t,o,l;const r=ts,i=function(){const e=[N.value,Hn.value,Rn.value,Ve.value,Wr.value,$u.value,An,_r.value,D.customId,D.isDark,ju.value,Eu.value,Ku.value,Wu.value,Vu.value,Du.value,qu.value,Uu.value,Ju.value,Gu.value,Xu.value,ut.value,ai.value,Be.value];return ts&&rs(ts,e)?ts:(ts=e,e)}(),a=r!==i;if(ts=i,gt.value)return Hr.value.map(e=>as(e,i));const u=Fn.value,s=u.length;let c=!1;es.length>s&&(es.length=s,ns.length=s,c=!0);const d=es,f=Math.min(d.length,s);let m=a?0:f;if(!a)for(let v=0;v<f;v++){const r=u[v];if("code_block"===r.type){if((null==(e=d[v])?void 0:e.node)!==(null==(n=Gt[v])?void 0:n.node)||ns[v]!==r||!Object.is(null==(t=d[v])?void 0:t.sourceLoading,r.loading)){m=v;break}}else if((null==(o=d[v])?void 0:o.node)!==r||!Object.is(null==(l=d[v])?void 0:l.sourceLoading,r.loading)){m=v;break}}if(!c&&m===s)return os;for(let v=m;v<s;v++)d[v]=as({node:u[v],index:v},i),ns[v]=u[v];const h=d.slice();return os=h,h});function ss(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function cs(e,n,t,o){var l;const r=a({},e.value);return null==Ke(r.estimatedPreviewHeightPx)&&(r.estimatedPreviewHeightPx=o(ls(n,t),void 0,"none"===r.maxHeight?null:null!=(l=Ke(r.maxHeight))?l:void 0)),r}function ds(e){return cs(Wu,e,Pe,$e)}function fs(e){return cs(Vu,e,Ee,Fe)}function ms(e,n){if(!e)return yl;const t=Hn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:ss(e),r=l?xi(t,l):void 0;if(r)return r;if(N.value)return t.code_block||eo;if("mermaid"===l)return t.mermaid||Lu;if("infographic"===l)return t.infographic||Au;if("d2"===l||"d2lang"===l)return t.d2||Hu;if(o)return o;return t.code_block||_r.value}return o||Ru[String(e.type)]||yl}function hs(e){const n=e.target instanceof Element?e.target.closest("[data-markstream-reference-id]"):null,t=e.currentTarget,o=n&&t instanceof Element&&t.contains(n)?n.dataset.markstreamReferenceId:void 0;l("click",e,o)}function vs(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function ps(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function gs(e){l("mouseover",e)}function ys(e){l("mouseout",e)}const ks=q(null),bs=q(!1),Ns=q(null),Ss=$(()=>!("minimal"!==D.domMode||je.value||!1!==D.fade||k.value||bs.value||Kt.value||gt.value||et.value||Yn.value||St.value||0!==Object.keys(Hn.value).length));let xs,ws=null,Ms=0,Cs=0,Bs=0;const _s=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Os=new Set(_s),Ts=[".typewriter-cursor",".height-estimation-probes",..._s.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Is(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Os.has(n)}function Ls(e){var n,t;if(!e||"object"!=typeof e)return 0;const o=e,l=null!=(t=null!=(n=o.raw)?n:o.content)?t:o.code;if("string"==typeof l)return l.length;const r=o.children;if(Array.isArray(r))return r.reduce((e,n)=>e+Ls(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Ls(n),0):0}function As(){xs&&(clearTimeout(xs),xs=void 0)}function Hs(){Ms+=1,null!=ws&&(null==Mt||Mt(ws),ws=null)}function Rs(){Hs(),Es(),ks.value&&(ks.value.style.visibility="hidden")}function $s(e){var n;if(e.nodeType!==Node.TEXT_NODE)return!1;if(!(null!=(n=e.textContent)?n:"").trim())return!1;const t=e.parentElement;return!!t&&!t.closest(Ts)}function Ps(e){let n=e.lastChild;for(;n;){if($s(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Ts)&&e.lastChild){n=e.lastChild;continue}}for(;n&&n!==e&&!n.previousSibling;)n=n.parentNode;if(!n||n===e)break;n=n.previousSibling}return null}function Fs(){const e=us.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Is(t.node)||!uu(t.index))continue;const o=Dt.get(t.index);if(!o)continue;const l=Ps(o);if(l)return l}return null}function Es(){Ns.value&&(Ns.value.classList.remove(Ka),Ns.value=null)}function Ks(){if("simple"!==y.value||!ze||!bs.value||!de.value)return void Es();const e=Fs(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==Ns.value&&(Es(),n&&(n.classList.add(Ka),Ns.value=n))}function zs(){if("precise"!==y.value)return;if(!ze||!bs.value)return;if(null!=ws)return;const e=Ms,n=()=>{ws=null,e===Ms&&function(){var e,n;if("precise"!==y.value)return;if(!(ze&&bs.value&&de.value&&ks.value))return;const t=de.value,o=ks.value;o.style.visibility="hidden";const l=Fs();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=Tn("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};wt?ws=wt(n):n()}return J([tn,()=>o.content,()=>o.nodes,()=>D.typewriter,ln],()=>s(null,null,function*(){var e,n;if(!ze||je.value||!Je.value)return;if(!k.value)return void((bs.value||xs||null!=ws||Ns.value||ks.value)&&(bs.value=!1,As(),Rs()));if(ln.value)return bs.value=!1,As(),void Rs();if(null==(e=o.nodes)?void 0:e.length)return bs.value=!1,As(),Rs(),Cs=(null!=(n=o.content)?n:"").length,void(Bs=tn.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Ls(n),0):(null!=(n=o.content)?n:"").length}(),l=function(){var e;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Ls(n),0):tn.value.length}(),r=!Is(Fn.value[Fn.value.length-1]),i=t>Cs,a=l>Bs;if(!k.value||!r||!i&&!a)return k.value&&r||(bs.value=!1,Rs()),Cs=t,void(Bs=l);Cs=t,Bs=l,bs.value=!0,"precise"===y.value&&ks.value&&(ks.value.style.visibility="hidden"),As(),yield oe(),"simple"===y.value?Ks():(Es(),zs()),xs=setTimeout(()=>{xs=void 0,bs.value=!1},3e3)}),{flush:"post",immediate:!0}),J(bs,e=>s(null,null,function*(){e?(yield oe(),"simple"!==y.value?(Es(),"precise"===y.value&&zs()):Ks()):Rs()}),{flush:"post"}),J(y,()=>s(null,null,function*(){if(ze&&!je.value&&Je.value&&bs.value){if(yield oe(),"simple"===y.value)return Hs(),void Ks();Es(),"precise"!==y.value?Rs():zs()}}),{flush:"post"}),J([()=>$t.value,()=>Hl.start,()=>Hl.end],()=>s(null,null,function*(){ze&&!je.value&&Je.value&&bs.value&&(yield oe(),"simple"!==y.value?(Es(),"precise"===y.value&&zs()):Ks())}),{flush:"post"}),ne(()=>{As(),Hs(),Es(),Ln.clear()}),(e,n)=>{const t=Se("NodeRenderer",!0);return V(je)?(F(!0),E(G,{key:0},Z(us.value,e=>(F(),E(G,{key:e.vnodeKey},[e.rendersCustomNode?(F(),re(ie(e.component),ae({key:0,ref_for:!0},e.customFragmentNodeProps),{default:ue(()=>[e.hasSlotChildren?(F(),re(t,ae({key:0,ref_for:!0},zn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(t,ae({key:1,ref_for:!0},zn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Y("",!0)]),_:2},1040)):(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.fragmentNodeProps),null,16))],64))),128)):(F(),E("div",{key:1,ref_key:"containerRef",ref:de,class:W(["markstream-vue markdown-renderer",[{dark:D.isDark},{virtualized:gt.value},{"virtual-scroll-coordinated":it.value},{"stable-layout":Ol.value},{"typewriter-simple-cursor":bs.value&&"simple"===y.value}]]),"data-custom-id":D.customId,onClick:hs,onMouseover:vs,onMouseout:ps},[st.value||gt.value?(F(),E(G,{key:0},[st.value?(F(),re(La,{key:0,width:ft.value,"flow-root":gt.value||it.value,"paragraph-node":Dn.value,"list-item-node":Vn.value,"list-node":qn.value,"heading-nodes":Un.value,"set-paragraph-wrapper":lr,"set-list-item-wrapper":rr,"set-list-wrapper":ir,"set-heading-wrapper":wr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Y("",!0),gt.value?(F(),E("div",{key:1,class:"node-spacer",style:se({height:`${Rr.value}px`}),"aria-hidden":"true"},null,4)):Y("",!0)],64)):Y("",!0),Ss.value?(F(!0),E(G,{key:1},Z(us.value,e=>(F(),E(G,{key:e.vnodeKey},[uu(e.index)?(F(),re(ie(e.component),ae({key:0,ref_for:!0},e.minimalNodeProps),null,16)):Y("",!0)],64))),128)):(F(!0),E(G,{key:2},Z(us.value,e=>(F(),E("div",{key:e.vnodeKey,ref_for:!0,ref:n=>cu(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[V(yu).has(e.vnodeKey)||uu(e.index)?(F(),E("div",{key:0,ref_for:!0,ref:n=>function(e,n,t){var o,l;if(t?yu.add(n):yu.delete(n),t){const n=Fn.value[e],o=Fl.get(e);if(o&&o.el===t&&o.node===n&&o.loading===(null==n?void 0:n.loading))return}t||function(e){var n;const t=`${Er()}-${e}`;let o=!1;for(const l of Array.from(Ul.keys())){const r=Jl.get(l);((null==r?void 0:r.index)===e||l===t||l.startsWith(`${t}-`))&&(Xl-=Math.max(0,null!=(n=Ul.get(l))?n:0),Ul.delete(l),Jl.delete(l),o=!0)}o&&(Xr(),iu("async-node"))}(e),zl.delete(e),function(e){var n;const t=(null!=(n=Pl.get(e))?n:0)+1;Pl.set(e,t)}(e);const r=El.get(e);if(r){for(const e of r)tr(e);El.delete(e)}if(function(e){const n=qt.get(e);n&&(null==Jt||Jt.unobserve(n),Ut.delete(n),qt.delete(e))}(e),!t||!yt.value)return $l.delete(e),Pl.delete(e),void Fl.delete(e);$l.set(e,t),Fl.set(e,{el:t,node:Fn.value[e],loading:null==(o=Fn.value[e])?void 0:o.loading});const i=()=>{hu(e,t)};queueMicrotask(i);const a=(Jt||"undefined"==typeof ResizeObserver||(Jt=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Ut.get(n.target),t=qt.get(null!=e?e:-1);null!=e&&t&&hu(e,t)}else vu()})),Jt);if(a&&(qt.set(e,t),Ut.set(t,e),a.observe(t)),"undefined"!=typeof window){const n="code_block"===(null==(l=Fn.value[e])?void 0:l.type)?[16,80,240,800]:ln.value?[80]:[];if(n.length){const t=n.map(e=>nr(e,i,"node-resize")).filter(e=>null!=e);t.length&&El.set(e,t)}}}(e.index,e.vnodeKey,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),re(ie(e.component),ae({key:1,ref_for:!0},e.customNodeProps),{default:ue(()=>[e.hasSlotChildren?(F(),re(t,ae({key:0,ref_for:!0},zn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),re(t,ae({key:1,ref_for:!0},zn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Y("",!0)]),_:2},1040)):(F(),re(ie(e.component),ae({key:2,ref_for:!0},e.nodeProps),null,16)):(F(),re(Ra,{key:0,item:e,"source-nodes":o.nodes,fade:D.fade,final:V(on),"nested-renderer-props":e.rendersCustomNode?zn.value:void 0},null,8,["item","source-nodes","fade","final","nested-renderer-props"]))],512)):(F(),E("div",{key:1,class:"node-placeholder",style:se({height:`${Io(e.index)}px`})},null,4))],8,Ea))),128)),bs.value&&"precise"===y.value?(F(),E("span",{key:3,ref_key:"typewriterCursorRef",ref:ks,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Y("",!0),gt.value?(F(),E("div",{key:4,class:"node-spacer",style:se({height:`${$r.value}px`}),"aria-hidden":"true"},null,4)):Y("",!0)],42,Fa))}}})),[["__scopeId","data-v-424c6fcc"]]),ja=za;ja.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",ja.__name,ja.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,za)};const Wa=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:ja},Symbol.toStringTag,{value:"Module"})),Da={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"},Va={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"},qa={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"},Ua={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"},Ja={class:"admonition-title"},Ga=["aria-expanded","aria-controls"],Xa=["id"],Ya=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=$(()=>{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=q(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(F(),E("div",{class:W(["admonition",[`admonition-${o.node.kind}`]])},[K("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),E("svg",Da,[...t[1]||(t[1]=[K("circle",{cx:"12",cy:"12",r:"10"},null,-1),K("path",{d:"M12 16v-4"},null,-1),K("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(F(),E("svg",Va,[...t[2]||(t[2]=[K("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),K("path",{d:"M9 18h6"},null,-1),K("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(F(),E("svg",qa,[...t[3]||(t[3]=[K("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),K("path",{d:"M12 9v4"},null,-1),K("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(F(),E("svg",Ua,[...t[4]||(t[4]=[K("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),K("path",{d:"M12 8v4"},null,-1),K("path",{d:"M12 16h.01"},null,-1)])])):Y("",!0),K("span",Ja,z(r.value),1),o.node.collapsible?(F(),E("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),E("svg",{style:se({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]=[K("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Ga)):Y("",!0)]),de(K("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[D(V(ja),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Xa),[[fe,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Ya.install=e=>{e.component(Ya.__name,Ya)};const Za=()=>import("@terrastruct/d2");let Qa=null,eu=Za,nu=null,tu=!1,ou=!1,lu=0;function ru(e){eu=e,lu++,Qa=null,nu=null,tu=!1,ou=!1}function iu(e){ru(null!=e?e:Za)}function au(){ru(null)}function uu(){return"function"==typeof eu}function su(){return s(this,null,function*(){if(Qa)return Qa;const e=eu,n=lu;return e?e===Za&&tu?null:nu||(nu=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===Za)return n===lu&&e===eu&&(tu=!0,function(e){ou||(ou=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===lu&&e===eu&&(nu=null)}return n!==lu||e!==eu?null:t?(Qa=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}(t),Qa):null}),nu):null})}let cu=null,du=null,fu=null,mu=0;function hu(e){du=null!=e?e:null,cu=null,fu=null,mu++}function vu(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");hu(e)}function pu(){hu()}function gu(){return"function"==typeof du}function yu(){return s(this,null,function*(){if(cu)return cu;const e=du,n=mu;return e?fu||(fu=s(null,null,function*(){const t=yield e();if(n!==mu||e!==du)return null;const o=function(e){var n,t,o;if(!e)return null;const l=null!=(n=e.default)?n:e,r="function"==typeof l&&"function"==typeof(null==(t=l.prototype)?void 0:t.render)?l:null!=(o=e.Infographic)?o:null==l?void 0:l.Infographic;return"function"==typeof r?r:null}(t);return n!==mu||e!==du?null:o?(cu=o,cu):null}).finally(()=>{n===mu&&e===du&&(fu=null)}),fu):null})}function ku(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function bu(e,n){null==e||e(n)}function Nu(e,n){return e?(bu(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Su(e,n){const t=Nu(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;bu(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=ku(o.marginTop),r=ku(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function xu(e,n,t){if(!e)return 0;const o=function(e){var n;return e?(null==(n=e.matches)?void 0:n.call(e,".markstream-vue.markdown-renderer"))?e:e.querySelector(".markstream-vue.markdown-renderer"):null}(e);if(!o)return 0;const l=Number.isFinite(t)?Number(t):Su(e,n),r=Nu(o,n);return Math.max(0,l-r)}function wu(e){return"measured"===e||"final"===e}function Mu(e,n,t){var o,l,r;const i=null!=(r=null!=(l=null==(o=t.getKey)?void 0:o.call(t,e,n))?l:e.id)?r:n;return String(i)}function Cu(e,n,t){var o,l,r;return null!=(r=null==(o=t.getKind)?void 0:o.call(t,e,n))?r:String(null!=(l=e.kind)?l:"")}function Bu(e,n,t){var o,l;const r=null!=(l=null==(o=t.getContent)?void 0:o.call(t,e,n))?l:e.content;return"string"==typeof r?r:""}function _u(e,n,t){var o;const l=null==(o=t.getFinal)?void 0:o.call(t,e,n);if("boolean"==typeof l)return l;const r=e.final;return"boolean"!=typeof r||r}function Ou(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function Tu(e,n,t){const o=Cu(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&Bu(e,n,t).length>0}function Iu(e,n,t){var o;const l=null==(o=t.estimateItemHeight)?void 0:o.call(t,e,n);if(Number.isFinite(l)&&l>0)return l;const r=Cu(e,n,t);return"assistant-markdown"===r||"markdown"===r?360:"system-divider"===r?44:"tool-call"===r?72:"thinking"===r?92:"error"===r?76:"user-message"===r?88:Bu(e,n,t).length>0?360:96}function Lu(e){const n=ge(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=ge(/* @__PURE__ */new Map),l=ge(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=q(!1),f=[0,80,180,360,640];let m,h=0,v=null,p=[],g=0;const y=/* @__PURE__ */new Map,k=/* @__PURE__ */new Map;let b,N=!1,S=null,x=!1,w=null;function M(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(oe(e),null)}function B(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function _(){return[...we(e.items)]}function O(){const n=we(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return Mu(n,t,e)}function I(n,t){return Tu(n,t,e)}function L(n,t){const o=T(n,t),l=O(),r=Ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function A(){const n=we(e.measurementKey);return null==n?void 0:String(n)}function H(){const n=we(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){return!0===we(e.renderCodeBlocksAsPre)}function $(){var e;const n=R()?"pre":"rich";return`${null!=(e=A())?e:""}${H()}${n}`}function P(n,t){if(I(n,t))return L(n,t);const o=T(n,t),l=O(),r=Ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function F(e){const n=_();for(let t=0;t<n.length;t++){const o=n[t];if(T(o,t)===e)return{item:o,index:t}}return null}function E(e,n){var t;const o=F(e);if(!o||!n)return!1;if(n.sourceKey!==P(o.item,o.index))return!1;const l=I(o.item,o.index)?$():A();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!E(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=F(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===L(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=O())?o:"")&&function(e){const n=$(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function j(e,n){return z(e,n)}function W(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!j(e,n))return 0;const l=Number(null==(t=null==n?void 0:n.metrics)?void 0:t.totalHeight);return Number.isFinite(l)&&l>0?Math.ceil(l):0}(e,n);return!Number.isFinite(r)||r<=0||!n?0:(W(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function U(e){return Number.isFinite(e)&&e>0?e:null}function J(){if(!x)return;x=!1,w=null;const e=b;b=void 0,e&&ae(e)}function G(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function X(o,l,r=function(e){const n=F(e);return n?function(e,n){const t=I(e,n)?$():A();return a({sourceKey:P(e,n)},null==t?{}:{measurementKey:t})}(n.item,n.index):void 0}(o)){const i=U(l);if(null==i)return;const u=n.get(o),s=r&&(f=r,!((null!=(h=null==(c=t.get(o))?void 0:c.sourceKey)?h:"")===(null!=(p=null==f?void 0:f.sourceKey)?p:"")&&(null!=(y=null==c?void 0:c.measurementKey)?y:"")===(null!=(k=null==f?void 0:f.measurementKey)?k:"")&&(null!=(N=null==c?void 0:c.widthBucket)?N:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,N,S;if(null!=u&&Math.abs(u-i)<.5&&!s)return;if(d.value)return n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),void function(){const e=m,n=g;e&&oe(()=>{ue(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,B=M?re():void 0,_=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),O=M&&_<=2,T=M&&_<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var L;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),M&&((L=O?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:_}:B)&&(x||(b=L,x=!0,w=C(J))))}function Y(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Z(){if(!N)return;N=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ee(n,{allowMarkdownShrink:t.allowMarkdownShrink});J()}function Q(){Z(),J()}function ee(n,t={}){const o=function(e){return Su(s.get(e),M)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=F(e);return!!n&&I(n.item,n.index)}(n))return o>0&&X(n,o),void i();const a=V(n),u=function(e,n){return xu(s.get(e),M,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&X(n,e),void i()}const c=F(n);return c&&!Bu(c.item,c.index,e).trim()?(o>0&&X(n,o),void i()):l>0?(o>l+1&&X(n,o),void i()):(o>0&&X(n,o),void i())}function ne(){const e={},n=_();for(let t=0;t<n.length;t++){const o=T(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function te(){const e={},n=_();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);E(l,r)&&(e[l]=r)}return e}function le(){const e={};for(const[n,t]of o)e[n]=t;return e}function re(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=_();for(let a=0;a<l.length;a++){const t=T(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:T(i,r.start),offsetWithinItemPx:0}:void 0}function ie(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=A())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=U(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&E(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ae(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function ue(e,n){e===h&&ae(n)}function se(e){e===h&&(d.value=!1,Q(),ue(e,m),m=void 0,g=0)}function de(){G(),B(w),x=!1,w=null,b=void 0,B(S),N=!1,S=null,k.clear();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return ye()&&ce(de),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void Y(i);if(u===a)return void ee(i);if(Y(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ee(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;a.isConnected&&(null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ee(i))});d.observe(a),c.set(i,d)},unobserveItem:function(e){Y(e)},releaseDetached:function(){let e=0;for(const[n,t]of s)t.isConnected||(Y(n),e++);return e},markdownProps:function(n,t){const l=T(n,t),r=_u(n,t,e),a=O(),u=Bu(n,t,e),s=L(n,t),c=$(),d=H(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=xe(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=j(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:j(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:96,heightDiffThresholdPx:4},g={content:u,final:r,mode:d,renderCodeBlocksAsPre:f,nodeVirtual:!!r&&"auto",maxLiveNodes:r?50:void 0,liveNodeBuffer:r?16:void 0,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==L(n,t))return;W(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:$()});const o=function(e){return"final"===e.phase||!(!0!==e.final||!wu(e.confidence))||!!e.stable&&(wu(e.confidence)||function(e){var n,t,o,l;const r=Number(e.nodeCount),i=Number(e.measuredCount),a=Math.max(0,Number(null!=(t=null==(n=e.liveRange)?void 0:n.start)?t:0)),u=Math.min(r,Math.max(a,Number(null!=(l=null==(o=e.liveRange)?void 0:o.end)?l:0))),s=Math.max(0,u-a);return!0===e.final&&!0===e.stable&&"mixed"===e.confidence&&r>0&&i>0&&i<r&&(s<=0||i>=s)}(e))}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),N||(N=!0,S=C(Z))},onVirtualStateChange(e){e.sessionKey===L(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=A();return u(a({threadKey:O()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:le()})},preloadThreadState:ie,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(G(),d.value=Boolean(t),g=n,m=t,ie(e),!t)return d.value=!1,m=void 0,void(g=0);ue(n,t),oe(()=>{ue(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{ue(n,t),o===f.length-1&&se(n)},e);p.push(l)}):se(n)})},dispose:de}}const Au=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");let Hu=null;function Ru(e){Hu=null!=e?e:null}function $u(){return Hu}function Pu(){Hu=null}function Fu(){var e;try{null==(e=null==Hu?void 0:Hu.terminate)||e.call(Hu)}catch(n){}Hu=null}function Eu(e){return s(this,null,function*(){const n=Hu;if(n&&"function"==typeof n.setRenderOptions)try{yield n.setRenderOptions({theme:e})}catch(t){}})}function Ku(e){return le(e)}const zu=Ku(()=>import("./index3.js")),ju=Ku(()=>import("./index5.js")),Wu=Ku(()=>import("./index6.js")),Du=Ku(()=>import("./index10.js")),Vu=Ku(()=>import("./index9.js")),qu=Ku(()=>import("./index7.js")),Uu=Ku(()=>import("./index4.js")),Ju=Ku(()=>import("./index8.js")),Gu={MarkdownRender:ja,NodeRenderer:ja,AdmonitionNode:Ya,BlockquoteNode:Ro,CheckboxNode:rn,CodeBlockNode:zu,DefinitionListNode:Eo,EmojiNode:un,EmphasisNode:Mo,FootnoteNode:Do,FootnoteReferenceNode:dn,FootnoteAnchorNode:zo,HardBreakNode:Bo,HeadingNode:Uo,HtmlBlockNode:ol,HtmlInlineNode:wn,HighlightNode:xo,ImageNode:vt,D2BlockNode:qu,InfographicBlockNode:Vu,InlineCodeNode:On,PreCodeNode:It,InsertNode:No,LinkNode:ko,ListItemNode:Zo,ListNode:Qo,MathBlockNode:ju,MathInlineNode:Wu,MermaidBlockNode:Du,ParagraphNode:il,StrikethroughNode:ho,StrongNode:fo,SubscriptNode:so,SuperscriptNode:ao,TableNode:hl,TextNode:At,ThematicBreakNode:pl,VmrContainerNode:kl,ReferenceNode:ro,MarkstreamVirtualTimeline:Ju,Tooltip:Uu},Xu={install(e,n){var t,o;Object.entries(Gu).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Oe(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(Au,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&Te(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions),n&&"infographicLoader"in n&&hu(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Jn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(Ve,function(e={}){return H(Ge(e))}(n.components))}};export{Ye as $,Ya as A,Ro as B,rn as C,qu as D,un as E,zo as F,ln as G,Bo as H,vt as I,It as J,Do as K,ko as L,Au as M,en as N,Pu as O,il as P,au as Q,ro as R,ho as S,hl as T,pu as U,kl as V,iu as W,vu as X,Dt as Y,Iu as Z,Uo as _,zu as a,su as a0,yu as a1,xu as a2,Bu as a3,_u as a4,Mu as a5,Cu as a6,Ou as a7,$u as a8,qn as a9,Ma as aA,ut as aB,rt as aC,uu as aa,Ft as ab,gu as ac,Tu as ad,qt as ae,Su as af,Qe as ag,Et as ah,Ht as ai,Rt as aj,st as ak,Vt as al,Ut as am,Yt as an,Xe as ao,ru as ap,Gn as aq,hu as ar,Ru as as,Vn as at,Eu as au,Fu as av,Lu as aw,Ti as ax,it as ay,Qn as az,Jt as b,Gt as c,Eo as d,Mo as e,dn as f,xo as g,ol as h,wn as i,Vu as j,On as k,No as l,Zo as m,Qo as n,Ju as o,ju as p,Wu as q,Du as r,fo as s,so as t,ao as u,At as v,pl as w,Uu as x,Xu as y,ja as z};