markstream-vue 1.0.5 → 1.0.6-beta.2
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/CodeBlockNode.js +1 -1
- package/dist/CodeBlockShell.vue_vue_type_style_index_0_lang.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index6.js +1 -1
- package/dist/index9.js +1 -1
- package/dist/monaco.js +1 -1
- package/dist/tailwind.js +0 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +14 -14
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,hasCustomHtmlComponents as f,sanitizeHtmlAttrs as m,sanitizeHtmlTokenAttrs as h,tokenAttrsToRecord as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,isCustomHtmlComponentTag as N,sanitizeHtmlContent as b,sanitizeImageSrc as S,shouldOpenLinkInNewTab as x,NON_STRUCTURING_HTML_TAGS as M,normalizeCustomHtmlTags as w,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as T,resolveCustomHtmlTags as O,parseMarkdownToStructure as I,EXTENDED_STANDARD_HTML_TAGS as A,stripCustomHtmlWrapper as H,setDefaultMathOptions as L}from"stream-markdown-parser";import{shallowRef as R,inject as $,computed as E,defineComponent as P,openBlock as F,createElementBlock as K,createElementVNode as W,toDisplayString as z,h as j,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as X,watch as G,Fragment as Y,createTextVNode as J,createCommentVNode as Z,getCurrentInstance as Q,onBeforeUnmount as ee,renderSlot as ne,Transition as te,withCtx as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,normalizeStyle as se,renderList as ce,readonly as de,markRaw as fe,provide as me,normalizeProps as he,guardReactiveProps as ve,reactive as pe,onScopeDispose as ge,getCurrentScope as ye,onMounted as ke,watchEffect as Ne,triggerRef as be,resolveComponent as Se,withDirectives as xe,vShow as Me,toRaw as we,toValue as Ce}from"vue";import{resolveStreamingTextUpdate as _e,createSmoothMarkdownStream as Be,getHighlightRegistrationKey as Te,normalizeShikiLanguage as Oe}from"markstream-core";import{M as Ie,n as Ae,s as He,j as Le}from"./index2.js";import{b as Re}from"./workers-katexWorkerClient.js";import{c as $e,p as Ee,e as Pe,a as Fe,b 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 We="__global__",ze="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",je=(()=>{const e=globalThis;if(e[ze])return e[ze];const n={scopedCustomComponents:{},revision:R(0)};return e[ze]=n,n})(),De=je.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 Xe(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(Xe(t))]))!e||Ue(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Ye(e,n){"string"==typeof e?je.scopedCustomComponents[e]=Ge(n||{}):je.scopedCustomComponents[We]=Ge(e||{}),De.value++}function Je(e){const n=Ge(je.scopedCustomComponents[We]||{});if(!e)return n;const t=Ge(je.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=$(Ve,null);return E(()=>{var t;return De.value,function(e,n={}){return De.value,a(a(a({},Ge(je.scopedCustomComponents[We]||{})),Ge(n)),Ge(function(e){return e&&je.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Qe(e){if(e===We)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete je.scopedCustomComponents[e],De.value++}function en(){delete je.scopedCustomComponents[We],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(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),K("svg",on,[...t[1]||(t[1]=[W("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),W("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(),K("svg",tn,[...t[0]||(t[0]=[W("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(),K("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(),K("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[W("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="safe",t){return m(e,n,t)}function vn(e){return p(e)}function pn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function gn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=h((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),pn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),pn(e.value)]):Object.entries(l).map(([e,n])=>[e,pn(n)]):null,n,t);var l;if(!o)return;const r=vn(v(o));return Object.keys(r).length>0?r:void 0}function yn(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 kn(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=function(e,n){return N(e,n)}(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[yn(e,n,!0)]:[yn(e,n),...t,`</${e}>`];const c=m(n,r,e),d=c.key,f=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=vn(c);return j(n,u(a({},l),{key:f}),t.length>0?t:void 0)}return j(e,u(a({},c),{innerHTML:void 0,key:f}),t.length>0?t:void 0)}function bn(e,n){return f(e,n)}function Sn(e,n,t="safe"){if(!e)return[];try{const o=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);kn(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?kn(l[l.length-1].children,a):kn(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?kn(l[l.length-1].children,o):kn(r,o),mn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,fn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xn=["innerHTML"],Mn=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=E(()=>{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=E(()=>{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};if(n.node.loading&&n.node.autoClosed){const n=Sn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!bn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=Sn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(F(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},z(i.value.content),3)):(F(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,xn))}}),[["__scopeId","data-v-d17f12b0"]]);Mn.install=e=>{e.component(Mn.__name,Mn)};const wn={class:"inline-code"},Cn={key:0},_n=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=$("markstreamFade",void 0),l=$("markstreamTextStreamState",void 0),r=$("markstreamStreamVersion",void 0),i=E(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=E(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=E(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=E(()=>!a.value),c=E(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=X(n.node.code),f=X("");let m=null==r?void 0:r.value;const h=X(0);function v(){return d.value+f.value}function p(){f.value&&(d.value=v(),f.value="")}G([()=>n.node.code,c,a,()=>null==r?void 0:r.value],([e,n,t,o])=>{const r=String(null!=e?e:""),i=c.value,u=o!==m;m=o;const s=_e({nextContent:r,persistedContent:i?null==l?void 0:l.get(i):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value,streamRenderVersionChanged:u});d.value=s.settledContent,f.value=s.streamedDelta,s.appended&&(h.value+=1),i&&(null==l||l.set(i,r))},{immediate:!0}),G(a,e=>{var n;e||(n=v(),d.value=n,f.value="")});const g=E(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),K("code",wn,[s.value?(F(),K(Y,{key:0},[J(z(u.value),1)],64)):(F(),K(Y,{key:1},[d.value?(F(),K("span",Cn,z(d.value),1)):Z("",!0),f.value?(F(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},z(f.value),35)):Z("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);_n.install=e=>{e.component(_n.__name,_n)};const Bn=X(!1),Tn=X(""),On=X("top"),In=X(null),An=X(null),Hn=X(null),Ln=X(null),Rn=X(null);let $n=null,En=null,Pn=0;function Fn(){$n&&(clearTimeout($n),$n=null),En&&(clearTimeout(En),En=null)}let Kn=!1,Wn=null,zn=!1;function jn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Pn;Fn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!Kn&&!zn&&"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:Bn.value,"anchor-el":In.value,content:Tn.value,placement:On.value,id:An.value,originX:Hn.value,originY:Ln.value,isDark:null!=(e=Rn.value)?e:void 0})}}).mount(o),Kn=!0}));try{yield Wn}catch(e){Kn=!1,Wn=null,zn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),Kn&&i===Pn){An.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,In.value=e,Tn.value=n,On.value=t,Hn.value=null!=(o=null==l?void 0:l.x)?o:null,Ln.value=null!=(a=null==l?void 0:l.y)?a:null,Rn.value="boolean"==typeof r?r:null,Bn.value=!0;try{e.setAttribute("aria-describedby",An.value)}catch(u){}}});o?a():$n=setTimeout(a,80)}function Dn(e=!1){Pn+=1,Fn();const n=()=>{if(In.value&&An.value)try{In.value.removeAttribute("aria-describedby")}catch(e){}Bn.value=!1,In.value=null,An.value=null,Hn.value=null,Ln.value=null};e?n():En=setTimeout(n,120)}const Vn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},qn=/* @__PURE__ */Symbol("markstreamI18nFallback");function Un(e){Object.assign(Vn,e)}function Xn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:Vn[e]}const Gn=(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 Yn(e,n){return{t(t){const o=Xn(t,n);if(e.te&&null!=o&&!e.te(t))return Gn(t,n);const l=e.t(t);return l===t&&null!=o?Gn(t,n):l}}}function Jn(){const e=function(){var e,n,t;try{const o=Q(),l=qn,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=>Gn(n,e)}}function Zn(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 Qn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],et={key:1,class:"image-placeholder"},nt={key:1,class:"image-node__raw-text"},tt={key:0,class:"image-shimmer-overlay"},ot={key:1,class:"image-node__raw-text"},lt={key:2,class:"image-error"},rt=/* @__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}){const t=e,o=n,l=X(!1),r=X(!1),i=X(""),a=X("primary"),u=X(null),c=U(),d=$(Ie,null);let f="",m=null;const h=E(()=>S(t.node.src)),v=E(()=>S(t.fallbackSrc)),p=E(()=>i.value),g=E(()=>!t.lazy),y=E(()=>!t.node.loading&&"failed"!==a.value&&i.value.length>0),k=E(()=>"failed"===a.value),N=E(()=>!g.value&&!l.value&&!r.value&&"failed"!==a.value&&i.value.length>0),b=E(()=>Zn(t,c));function x(e=b.value){e&&u.value&&(null==d||d.reportHeight(e,u.value.offsetHeight))}function M(e=b.value){e&&le(()=>{x(e)})}function w(){m&&(clearTimeout(m),m=null)}function C(){const e=b.value;e&&f!==e&&(f&&(null==d||d.markSettled(f)),w(),f=e,null==d||d.markPending(e),"undefined"!=typeof window&&(m=window.setTimeout(()=>{f===e&&(M(e),_())},8e3)))}function _(){return s(this,null,function*(){const e=f;e&&(w(),f="",yield le(),x(e),null==d||d.markSettled(e))})}function B(){if("primary"===a.value&&v.value&&v.value!==i.value)return a.value="fallback",i.value=v.value,l.value=!1,r.value=!1,void M();a.value="failed",r.value=!0,o("error",i.value),M()}function T(){l.value=!0,r.value=!1,o("load",p.value),M()}function O(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,p.value])}const{t:I}=Jn();return G([h,v,()=>t.node.loading],()=>(l.value=!1,r.value=!1,t.node.loading||h.value?(i.value=h.value,void(a.value="primary")):v.value?(i.value=v.value,void(a.value="fallback")):(i.value="",a.value="failed",void(r.value=!0))),{immediate:!0}),G([y,l,r,p,()=>t.lazy],([e,n,t,o,l])=>e&&o&&!t?n?(_(),void M()):l?(C(),void M()):void(n||t||C()):(_(),void M()),{flush:"post",immediate:!0}),ee(()=>{!function(){const e=f;e&&(w(),f="",null==d||d.markSettled(e))}()}),(n,o)=>{var i,a,s,c,d;return F(),K("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(F(),K("img",{key:0,src:p.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(c=null!=(s=t.node.title)?s:t.node.alt)?c:""),class:D(["image-node__img",{"is-loading":!g.value&&!l.value,"is-loaded":g.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:g.value?"high":void 0,decoding:g.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(d=t.node.alt)?d:q(I)("image.preview"),onError:B,onLoad:T,onClick:O},null,42,Qn)):Z("",!0),e.node.loading&&!r.value?(F(),K("span",et,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=W("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",nt,z(e.node.raw),1))])):Z("",!0),V(te,{name:"shimmer-fade"},{default:oe(()=>[N.value&&!e.node.loading?(F(),K("span",tt,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=W("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",ot,z(e.node.raw),1))])):Z("",!0)]),_:3}),k.value?(F(),K("span",lt,[ne(n.$slots,"error",{node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[2]||(o[2]=W("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[W("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),W("span",null,z(q(I)("image.loadError")),1)],!0)])):Z("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);rt.install=e=>{e.component(rt.__name,rt)};const it={key:2},at=/* @__PURE__ */P({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Ze(()=>n.customId),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamNestedRendererProps",void 0),r=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=E(()=>{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=re({loader:()=>Promise.resolve().then(()=>la),suspensible:!1}),c=E(()=>n.components[String(n.node.type)]),d=E(()=>Boolean(c.value&&t.value[n.node.type]&&!Ue(String(n.node.type)))),f=E(()=>d.value?gn(n.node,r.value):void 0),m=E(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=E(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=E(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(F(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:oe(()=>[m.value?(F(),ie(q(s),ue({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"])):h.value?(F(),ie(q(s),ue({key:1},i.value,{content:h.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"])):c.value?(F(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(F(),K("span",it,z(v.value),1)):Z("",!0)}}),ut=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],st={key:0,translate:"no",class:"markstream-pre__diff-code"},ct={class:"markstream-pre__diff-number","aria-hidden":"true"},dt={class:"markstream-pre__diff-content"},ft={class:"markstream-pre__diff-content-inner"},mt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},ht=["textContent"],vt=/* @__PURE__ */P({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const n=e,t=E(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=E(()=>`language-${t.value}`),l=E(()=>{var e,t,o,l,r;return!0===(null==(e=n.node)?void 0:e.diff)?String(null!=(o=null==(t=n.node)?void 0:t.code)?o:""):function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(null==(l=n.node)?void 0:l.code,!0===(null==(r=n.node)?void 0:r.loading))}),r=E(()=>l.value.split(/\r\n|\n|\r/)),i=E(()=>Array.from({length:Math.max(1,r.value.length)},(e,n)=>n+1)),s=E(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),c=E(()=>s.value&&!0===n.diffInline),d=E(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return{height:t,minHeight:t,maxHeight:t,overflow:"auto"}});function f(e){return 0===String(null!=e?e:"").trim().length}function m(e,n="context",t={}){const o=f(e);return{code:e,kind:o&&"hunk"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function h(e){const n=String(null!=e?e:"");return n?n.split(/\r\n|\n|\r/):[]}function v(e,n){return!f(e[n])||n<e.length-1}function p(e){return e.startsWith("-")&&!e.startsWith("---")}function g(e){return e.startsWith("+")&&!e.startsWith("+++")}function y(e,n){const t=h(e),o=h(n),l=function(e,n){const t=e.length,o=n.length;if((t+1)*(o+1)>15e5)return null;const l=o+1,r=new Uint32Array((t+1)*(o+1));for(let s=1;s<=t;s++)for(let t=1;t<=o;t++){const o=s*l+t;if(e[s-1]===n[t-1])r[o]=r[(s-1)*l+(t-1)]+1;else{const e=r[(s-1)*l+t],n=r[s*l+(t-1)];r[o]=e>=n?e:n}}const i=[];let a=t,u=o;for(;a>0&&u>0;)e[a-1]===n[u-1]?(i.push({originalIndex:a-1,modifiedIndex:u-1}),a--,u--):r[(a-1)*l+u]>=r[a*l+(u-1)]?a--:u--;return i.reverse(),i}(t,o);if(l){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},m(o[i.modifiedIndex])),{key:`inline-context-source-${i.originalIndex}-${i.modifiedIndex}`,number:i.modifiedIndex+1})),n=i.originalIndex+1,r=i.modifiedIndex+1}for(;n<t.length;)e.push(u(a({},m(t[n],"removed",{preserveBlankKind:v(t,n)})),{key:`inline-removed-source-${n}`,number:""})),n++;for(;r<o.length;)e.push(u(a({},m(o[r],"added",{preserveBlankKind:v(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},m(o[i])),{key:`inline-prefix-${i}`,number:i+1})),i++;const d=[];for(;s>=i&&c>=i&&t[s]===o[c];)d.unshift(u(a({},m(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},m(t[f],"removed",{preserveBlankKind:v(t,f)})),{key:`inline-removed-source-${f}`,number:""}));for(let f=i;f<=c;f++)r.push(u(a({},m(o[f],"added",{preserveBlankKind:v(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}const k=E(()=>{var e,o,l,i;const s=function(e){const o=e.some(e=>p(e)),l=e.some(e=>g(e));return o&&l||function(){var e,o,l,r;if("diff"===t.value)return!0;const i=null!=(r=null==(l=String(null!=(o=null==(e=n.node)?void 0:e.raw)?o:"").split(/\r?\n/,1)[0])?void 0:l.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(o||l)}(r.value),d=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(c.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:s?function(e){const n=[];let t=1;for(const[o,l]of e.entries())if(l.startsWith("@@"))n.push(u(a({},m(l,"hunk")),{key:`inline-hunk-${o}`,number:""}));else if(p(l))n.push(u(a({},m(l.slice(1),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${o}`,number:""}));else if(g(l))n.push(u(a({},m(l.slice(1),"added",{preserveBlankKind:!0})),{key:`inline-added-${o}`,number:t++}));else{const e=l.startsWith(" ")?l.slice(1):l;n.push(u(a({},m(e)),{key:`inline-context-${o}`,number:t})),t++}return n}(r.value):y(null==(e=n.node)?void 0:e.originalCode,null==(o=n.node)?void 0:o.updatedCode)}];if(!s&&d){const e=h(null==(l=n.node)?void 0:l.originalCode),t=h(null==(i=n.node)?void 0:i.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:e.map((n,o)=>{const l=t[o]===n?"context":"removed";return u(a({},m(n,l,{preserveBlankKind:v(e,o)})),{key:`original-${o}`,number:o+1})})},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:t.map((n,o)=>{const l=e[o]===n?"context":"added";return u(a({},m(n,l,{preserveBlankKind:v(t,o)})),{key:`modified-${o}`,number:o+1})})}]}const f=[],k=[];for(const n of r.value)if(n.startsWith("@@"))f.push(m(n,"hunk")),k.push(m(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))f.push(m(n.slice(1),"removed",{preserveBlankKind:!0}));else if(n.startsWith("+")&&!n.startsWith("+++"))k.push(m(n.slice(1),"added",{preserveBlankKind:!0}));else{const e=n.startsWith(" ")?n.slice(1):n;f.push(m(e)),k.push(m(e))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:f.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:k.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}]}),N=E(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"}),b=X(null),S=X([]);let x=null,M=null;function w(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function C(e,n){var t;if(!e)return n;const o=e.querySelector(".markstream-pre__diff-content"),l=null==o?void 0:o.getBoundingClientRect(),r=null!=(t=null==l?void 0:l.height)?t:0;return Math.max(n,Math.ceil(r))}function _(){"undefined"!=typeof window&&(null!=x&&window.cancelAnimationFrame(x),x=window.requestAnimationFrame(()=>{!function(){var e,n;x=null;const t=b.value;if(!t||!s.value)return void(S.value.length&&(S.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=w(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=w(n.lineHeight);return o>0?o:18}(t),l=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),r=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),i=Math.max(l.length,r.length),a=[];for(let s=0;s<i;s++){const t=C(null!=(e=l[s])?e:null,o),i=C(null!=(n=r[s])?n:null,o),u=Math.max(o,t,i);a.push({rowHeight:u,originalHeight:t,modifiedHeight:i})}var u,c;u=S.value,c=a,u.length===c.length&&u.every((e,n)=>{const t=c[n];return t&&Math.abs(e.rowHeight-t.rowHeight)<=.5&&Math.abs(e.originalHeight-t.originalHeight)<=.5&&Math.abs(e.modifiedHeight-t.modifiedHeight)<=.5})||(S.value=a)}()}))}function B(e){null==M||M.disconnect(),M=null,e&&s.value&&"undefined"!=typeof ResizeObserver&&(M=new ResizeObserver(()=>{_()}),M.observe(e))}function T(e,n){const t=S.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 G(b,e=>{B(e),le(()=>_())},{flush:"post"}),G([s,k],()=>{B(b.value),le(()=>_())},{flush:"post",immediate:!0}),ee(()=>{null!=x&&(window.cancelAnimationFrame(x),x=null),null==M||M.disconnect(),M=null}),(r,a)=>(F(),K("pre",{ref_key:"preRef",ref:b,style:se(d.value),class:D([o.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":s.value,"markstream-pre--diff-inline":c.value}]),"aria-busy":!0===e.node.loading,"aria-label":N.value,"data-language":t.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[s.value?(F(),K("code",st,[(F(!0),K(Y,null,ce(k.value,e=>(F(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[(F(!0),K(Y,null,ce(e.lines,(n,t)=>(F(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(T(t,e.key))},[a[0]||(a[0]=W("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),W("span",ct,z(n.number),1),W("span",dt,[W("span",ft,z(n.code),1)])],6))),128))],2))),128))])):(F(),K(Y,{key:1},[n.showLineNumbers?(F(),K("span",mt,[(F(!0),K(Y,null,ce(i.value,e=>(F(),K("span",{key:e,class:"markstream-pre__line-number"},z(e),1))),128))])):Z("",!0),W("code",{translate:"no",class:"markstream-pre__code",textContent:z(l.value)},null,8,ht)],64))],14,ut))}});vt.install=e=>{e.component(vt.__name,vt)};const pt=R(!1);let gt=null;const yt={key:0},kt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(gt||(gt=Re().then(e=>{pt.value=!!e}).catch(()=>{pt.value=!1})),de(pt)),o=U(),l=$("markstreamFade",void 0),r=$("markstreamTextStreamState",void 0),i=$("markstreamStreamVersion",void 0),a=E(()=>{const e=o.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),u=E(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),s=E(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),c=X(n.node.content),d=X("");let f=null==i?void 0:i.value;const m=X(0);function h(){return c.value+d.value}function v(){d.value&&(c.value=h(),d.value="")}G([()=>n.node.content,s,u,()=>null==i?void 0:i.value],([e,n,t,o])=>{const l=String(null!=e?e:""),i=s.value,a=o!==f;f=o;const h=_e({nextContent:l,persistedContent:i?null==r?void 0:r.get(i):void 0,currentState:{settledContent:c.value,streamedDelta:d.value},typewriterEnabled:u.value,streamRenderVersionChanged:a});c.value=h.settledContent,d.value=h.streamedDelta,h.appended&&(m.value+=1),i&&(null==r||r.set(i,l))},{immediate:!0}),G(u,e=>{var n;e||(n=h(),c.value=n,d.value="")});const p=E(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(F(),K("span",{class:D([[q(t)&&e.node.center?"text-node-center":""],"text-node"])},[c.value?(F(),K("span",yt,z(c.value),1)):Z("",!0),d.value?(F(),K("span",{key:1,class:D(["text-node-stream-delta",[p.value]]),onAnimationend:v},z(d.value),35)):Z("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);kt.install=e=>{e.component(kt.__name,kt)};const Nt=P({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return j(vt,u(a({},n),{node:t.node,showLineNumbers:!0,reservedHeightPx:null!=(e=t.estimatedHeightPx)?e:t.estimatedContentHeightPx,class:["code-pre-fallback",n.class],"data-markstream-code-loading":"1"}))}}}),bt=re({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),vt}}),loadingComponent:Nt,delay:0,suspensible:!1}),St=re(()=>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(kt,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{if(yield Re())return(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(kt,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:""}$`}}))}})),xt=re(()=>s(null,null,function*(){try{if(yield Re())return(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(kt,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:""}$$`}}))}})),Mt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),K("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},z(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const wt={class:"superscript-node"},Ct=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,emphasis:jt,footnote_reference:dn,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,emoji:un,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("sup",wt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const _t={class:"subscript-node"},Bt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,emphasis:jt,footnote_reference:dn,strikethrough:At,highlight:Wt,insert:Ft,superscript:Ct,emoji:un,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("sub",_t,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Bt.install=e=>{e.component(Bt.__name,Bt)};const Tt={class:"strong-node"},Ot=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,emphasis:jt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("strong",Tt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Ot.install=e=>{e.component(Ot.__name,Ot)};const It={class:"strikethrough-node"},At=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,emphasis:jt,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("del",It,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);At.install=e=>{e.component(At.__name,At)};const Ht=["href","title","aria-label","aria-hidden","target","rel"],Lt=["aria-hidden"],Rt={class:"link-text-wrapper relative inline-flex"},$t={class:"leading-[normal] link-text"},Et=/* @__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=$("markstreamShowTooltips",void 0),o=E(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=E(()=>{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=E(()=>a({text:kt,strong:Ot,strikethrough:At,emphasis:jt,image:rt,html_inline:Mn,inline_code:_n},r.value)),u=U(),s=E(()=>{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 hn(l,"safe","a")}),c=E(()=>a(a({},u),s.value)),d=E(()=>{var e,t;return hn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=E(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(x(d.value)?"_blank":void 0)}),m=E(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=E(()=>{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=E(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Dn()}const g=E(()=>{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(),K("span",ue({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},q(u),{style:l.value}),[W("span",Rt,[W("span",$t,[V(q(kt),{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]=W("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Lt)):(F(),K("a",ue({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)||"";jn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>(F(),ie(q(at),{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,Ht))}}}),[["__scopeId","data-v-367e6ca4"]]);Et.install=e=>{e.component(Et.__name,Et)};const Pt={class:"insert-node"},Ft=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,emphasis:jt,strikethrough:At,highlight:Wt,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("ins",Pt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Ft.install=e=>{e.component(Ft.__name,Ft)};const Kt={class:"highlight-node"},Wt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,emphasis:jt,strikethrough:At,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("mark",Kt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const zt={class:"emphasis-node"},jt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Ot,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("em",zt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);jt.install=e=>{e.component(jt.__name,jt)};const Dt={class:"hard-break"},Vt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),K("br",Dt))}),[["__scopeId","data-v-50c58f70"]]);Vt.install=e=>{e.component(Vt.__name,Vt)};const qt=/* @__PURE__ */P({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=fe({checkbox:rn,checkbox_input:rn,emoji:un,emphasis:jt,hardbreak:Vt,highlight:Wt,inline_code:_n,insert:Ft,link:Et,reference:Mt,strikethrough:At,strong:Ot,subscript:Bt,superscript:Ct,text:kt}),o=Ze(()=>n.customId),l=E(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),K(Y,null,ce(e.nodes,(t,o)=>(F(),ie(q(at),{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 Ut(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(Ut)}function Xt(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Ut))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(Ut)?l:null}function Gt(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 Yt=["cite"],Jt={key:0,dir:"auto",class:"paragraph-node"},Zt=["custom-id"],Qt=/* @__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=E(()=>Boolean(t.value.paragraph)),l=E(()=>Boolean(t.value.text)),r=E(()=>Xt(n.node.children,!o.value)),i=E(()=>!1!==n.fade||l.value?null:Gt(r.value));return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(t,o)=>(F(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),K("p",Jt,[null!==i.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(i.value),9,Zt)):(F(),ie(q(qt),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),ie(q(oa),{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,Yt))}}),[["__scopeId","data-v-abfecebc"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo={class:"definition-list"},no={class:"definition-term"},to={class:"definition-desc"},oo=/* @__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(),K("dl",eo,[(F(!0),K(Y,null,ce(n.node.items,(o,l)=>(F(),K(Y,{key:l},[W("dt",no,[V(q(oa),{"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"])]),W("dd",to,[V(q(oa),{"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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["href","title"],ro=/* @__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(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,lo))}}),[["__scopeId","data-v-e1eb37b6"]]);ro.install=e=>{e.component(ro.__name,ro)};const io=["id"],ao={class:"flex-1"},uo=/* @__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(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[W("div",ao,[V(q(oa),{"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,io))}});uo.install=e=>{e.component(uo.__name,uo)};const so=["custom-id"],co=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$("markstreamFade",void 0),l=E(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Gt(n.node.children)),r=E(()=>a({text:kt,inline_code:_n,link:Et,image:rt,strong:Ot,emphasis:jt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,checkbox:rn,checkbox_input:rn,footnote_reference:dn,hardbreak:Vt,math_inline:St,reference:Mt},t.value));return(t,o)=>(F(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[null!==l.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(l.value),9,so)):(F(!0),K(Y,{key:1},ce(e.node.children,(t,o)=>(F(),ie(q(at),{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"]]),fo=co;fo.install=e=>{e.component(co.__name,co)};const mo={key:0,dir:"auto",class:"paragraph-node"},ho=["custom-id"],vo={dir:"auto",class:"paragraph-node"},po=["custom-id"],go=/* @__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=E(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Ze(()=>n.customId),l=E(()=>Boolean(o.value.paragraph)),r=E(()=>Boolean(o.value.text)),i=E(()=>{var e;return Xt(null==(e=t.value)?void 0:e.children,!l.value)}),a=E(()=>{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=Xt([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=E(()=>u()?Gt(i.value):null),c=E(()=>{var e;return u()?Gt(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=E(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(e,o)=>{var l,r;return F(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(F(),K("p",mo,[null!==s.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(s.value),9,ho)):(F(),ie(q(qt),{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(),K(Y,{key:1},[W("p",vo,[null!==c.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(c.value),9,po)):(F(),ie(q(qt),{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),K(Y,null,ce(a.value.nestedLists,(t,l)=>(F(),ie(q(oa),{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(),ie(q(oa),{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"]]);go.install=e=>{e.component(go.__name,go)};const yo=/* @__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=E(()=>n.value.list_item||go);return(n,o)=>(F(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(F(!0),K(Y,null,ce(e.node.items,(l,r)=>{var i;return F(),ie(ae(t.value),ue({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"]]);yo.install=e=>{e.component(yo.__name,yo)};const ko=/* @__PURE__ */Symbol("ViewportPriority"),No=/* @__PURE__ */Symbol("ViewportPriorityOptions"),bo="400px";function So(){return $(No,void 0)}function xo(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?X(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;function h(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function v(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function p(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||v()}function g(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),p(n.bucketKey)}function y(){!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),g(e),f.size&&y())},{timeout:1200}))}function k(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:bo,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[h((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)&&g(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}}G(r,e=>{if(!e){for(const e of Array.from(d.keys()))g(e);v()}},{flush:"sync"});const N=(e,n)=>{const t=X(!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 p();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),p(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=k(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),f.add(e),y(),{isVisible:t,whenVisible:a,destroy:u}};return N.refresh=function(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=k(n,t.opts);if(!o){g(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),p(l)}},me(ko,N),N}function Mo(){var e,n;const t=$(ko,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){for(const n of r){const t=o.get(n);if((null==t?void 0:t.bucketKey)===e)return}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),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=X(!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),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:bo,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:bo;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};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.io.observe(e),r.add(e),f(),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}const wo={key:2,class:"html-block-node__raw"},Co=["innerHTML"],_o={key:1,class:"html-block-node__placeholder"},Bo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=$("markstreamNestedRendererProps",void 0),l=E(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=E(()=>{var e,t;const r=null!=(e=null==o?void 0:o.value)?e:{};return u(a({},r),{customId:null!=(t=n.customId)?t:r.customId,htmlPolicy:l.value})}),i=re({loader:()=>Promise.resolve().then(()=>la),suspensible:!1}),s=E(()=>{const e=h(n.node.attrs,l.value);if(!e)return;const t=v(e);return Object.keys(t).length>0?t:void 0}),c=E(()=>{const e=String(n.node.tag||"").trim(),t=h(n.node.attrs,l.value,e);if(!t)return;const o=v(t);return Object.keys(o).length>0?o:void 0}),d=Ze(()=>n.customId),f=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=X(null),p=X("undefined"==typeof window),g=X(n.node.content),y=E(()=>Array.isArray(n.node.children)?n.node.children:[]),N=E(()=>String(n.node.tag||"div")),S=E(()=>{var e;if("details"!==N.value.trim().toLowerCase())return null;if(null==(e=n.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const t=y.value[0];return"html_block"===(null==t?void 0:t.type)&&"summary"===String(t.tag||"").toLowerCase()?t:null}),x=E(()=>{var e;return Gt(null==(e=S.value)?void 0:e.children)}),w=E(()=>{const e=S.value;if(!e)return;const n=h(e.attrs,l.value,"summary");if(!n)return;const t=v(n);return Object.keys(t).length>0?t:void 0}),C=E(()=>null==x.value?y.value:y.value.slice(1)),_=E(()=>{const e=N.value.trim().toLowerCase();return M.has(e)||k(e,l.value)}),B=E(()=>y.value.length>0&&!!n.node.tag&&!_.value),T=E(()=>{var e,t,o;if(B.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:null!=(e=g.value)?e:""};const r=null!=(t=g.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===l.value)return{mode:"html",content:b(r,l.value)};if(n.node.loading){const e=Sn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!bn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=Sn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),O=Mo(),I=So(),A=R(null),H=!!n.node.loading;return"undefined"!=typeof window?(G([()=>m.value,()=>null==I?void 0:I.value.heavyBlockMargin,()=>null==I?void 0:I.value.rootMargin],([e],t,o)=>{var l,r,i,a;if(null==(r=null==(l=A.value)?void 0:l.destroy)||r.call(l),A.value=null,!H)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);let u=!0;const s=null!=(a=null!=(i=null==I?void 0:I.value.heavyBlockMargin)?i:null==I?void 0:I.value.rootMargin)?a:bo,c=O(e,{rootMargin:s});A.value=c,p.value=p.value||c.isVisible.value,c.whenVisible.then(()=>{u&&A.value===c&&(p.value=!0)}),o(()=>{u=!1,c.destroy(),A.value===c&&(A.value=null)})},{immediate:!0}),G(()=>n.node.content,e=>{H&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=A.value)?void 0:e.destroy)||n.call(e),A.value=null}),(n,t)=>(F(),ie(ae(B.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},B.value?c.value:void 0),{default:oe(()=>[p.value?(F(),K(Y,{key:0},["structured"===T.value.mode?(F(),K(Y,{key:0},[null!==x.value?(F(),K(Y,{key:0},[W("summary",he(ve(w.value)),z(x.value),17),C.value.length?(F(),ie(q(i),ue({key:0},r.value,{nodes:C.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Z("",!0)],64)):(F(),ie(q(i),ue({key:1},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===T.value.mode?(F(),ie(q(f),{key:1,nodes:T.value.nodes},null,8,["nodes"])):"text"===T.value.mode?(F(),K("pre",wo,z(T.value.content),1)):(F(),K("div",ue({key:3},s.value,{innerHTML:T.value.content}),null,16,Co))],64)):(F(),K("div",_o,[ne(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=W("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=W("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=W("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-bdad99ed"]]);Bo.install=e=>{e.component(Bo.__name,Bo)};const To={dir:"auto",class:"paragraph-node"},Oo=["custom-id"],Io=/* @__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=$("markstreamHtmlPolicy",void 0),l=$("markstreamFade",void 0),r=$("markstreamParseOptions",void 0),i=$("markstreamCustomMarkdownIt",void 0),s=$("markstreamNestedRendererProps",void 0),c=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=E(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=E(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=E(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=E(()=>{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})}),v=re({loader:()=>Promise.resolve().then(()=>la),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=E(()=>n.node.children.filter(e=>!p(e))),y=E(()=>g.value.length>0&&g.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=>!p(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),k=E(()=>new Set(w(m.value))),N=E(()=>{if(!y.value||g.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(!p(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!p(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=E(()=>!1===(null==l?void 0:l.value)&&!t.value.text),S=E(()=>b.value?Gt(N.value):null);function x(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value}}const M=E(()=>a({inline_code:_n,image:rt,link:Et,hardbreak:Vt,emphasis:jt,strong:Ot,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,html_inline:Mn,html_block:Bo,emoji:un,checkbox:rn,math_inline:St,checkbox_input:rn,reference:Mt,footnote_anchor:ro,footnote_reference:dn,text:kt},t.value)),B=E(()=>N.value.map((e,o)=>{var l;const r=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()||C(e.content);if(t&&!k.value.has(t)&&_(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:kt,isCustomComponent:!1}}}return{child:e,component:M.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Ue(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?gn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(F(),K("p",To,[null!==S.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(S.value),9,Oo)):(F(!0),K(Y,{key:1},ce(B.value,e=>{return F(),K(Y,{key:e.key},[y.value&&p(e.originalChild)?(F(),K(Y,{key:0},[J(z((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),ie(ae(e.component),ue({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:oe(()=>[e.hasSlotChildren?(F(),ie(q(v),ue({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(),ie(q(v),ue({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(),ie(ae(e.component),ue({key:2,ref_for:!0},x(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Io.install=e=>{e.component(Io.__name,Io)};const Ao={class:"table-node-wrapper"},Ho=["aria-busy"],Lo={key:0},Ro=["custom-id"],$o=["aria-label","onPointerdown"],Eo=["custom-id"],Po={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Fo=/* @__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=E(()=>{var e;return null!=(e=n.node.loading)&&e}),o=E(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=X(null),r=X([]);let i=null;const a=E(()=>n.node.header.cells.length),u=E(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=E(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade));const c=Ze(()=>n.customId),d=E(()=>Boolean(c.value.text)),f=E(()=>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=Xt(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Gt(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 G(a,()=>{p(),r.value=[]}),ee(p),(a,c)=>(F(),K("div",Ao,[W("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),K("colgroup",Lo,[(F(!0),K(Y,null,ce(e.node.header.cells,(e,n)=>(F(),K("col",{key:n,style:se(s.value[n])},null,4))),128))])):Z("",!0),W("thead",null,[W("tr",null,[(F(!0),K(Y,null,ce(e.node.header.cells,(t,o)=>(F(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(h(t).plainText),9,Ro)):h(t).simpleChildren?(F(),ie(q(qt),{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(),ie(q(oa),{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(),K("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,$o)):Z("",!0)],2))),128))])]),W("tbody",null,[(F(!0),K(Y,null,ce(o.value,(e,t)=>(F(),K("tr",{key:t},[(F(!0),K(Y,null,ce(e.cells,(e,o)=>(F(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},z(h(e).plainText),9,Eo)):h(e).simpleChildren?(F(),ie(q(qt),{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(),ie(q(oa),{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,Ho),V(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(F(),K("div",Po,[ne(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=W("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=W("span",{class:"sr-only"},"Loading",-1))],!0)])):Z("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Fo.install=e=>{e.component(Fo.__name,Fo)};const Ko={class:"hr-node"},Wo=/* @__PURE__ */ln({},[["render",function(e,n){return F(),K("hr",Ko)}],["__scopeId","data-v-39b2349c"]]);Wo.install=e=>{e.component(Wo.__name,Wo)};const zo={class:"unknown-node"},jo=/* @__PURE__ */P({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),K("div",zo,z(e.node.raw),1))}),Do=/* @__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=E(()=>`vmr-container vmr-container-${n.node.name}`),o=Ze(()=>n.customId),l=E(()=>a({text:kt,paragraph:Io,heading:fo,inline_code:_n,link:Et,image:rt,strong:Ot,emphasis:jt,strikethrough:At,insert:Ft,subscript:Bt,superscript:Ct,checkbox:rn,checkbox_input:rn,hardbreak:Vt,math_inline:St,reference:Mt,list:yo,math_block:xt,table:Fo},o.value));return(o,r)=>(F(),K("div",ue({class:t.value},e.node.attrs),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>{return F(),ie(ae((r=t.type,l.value[r]||jo)),{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},null,8,["custom-id","node","index-key","typewriter","fade"]);var r}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Do.install=e=>{e.component(Do.__name,Do)};const Vo=["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"],qo=[[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 Uo(e){if(e<=255)return Vo[e];let n=0,t=qo.length-1;for(;n<=t;){const o=n+t>>1,l=qo[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const Xo=/[ \t\n\r\f]+/g,Go=/[\t\n\r\f]| {2,}|^ | $/;let Yo=null;const Jo=new RegExp("\\p{Script=Arabic}","u"),Zo=new RegExp("\\p{M}","u"),Qo=new RegExp("\\p{Nd}","u");function el(e){return Jo.test(e)}function nl(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 tl(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(nl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(nl(t))return!0}}return!1}const ol=/* @__PURE__ */new Set([" "," ","","\ufeff"]),ll=/* @__PURE__ */new Set(["-","‐","–","—"]);function rl(e,n){return!(function(e){const n=yl(e);return null!==n&&ol.has(n)}(e)||n&&(function(e){const n=yl(e);return null!==n&&(il.has(n)||sl.has(n))}(e)||function(e){const n=yl(e);return null!==n&&ll.has(n)}(e)))}const il=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),al=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),ul=/* @__PURE__ */new Set(["'","’"]),sl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),cl=/* @__PURE__ */new Set([":",".","،","؛"]),dl=/* @__PURE__ */new Set(["၏"]),fl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function ml(e){if(pl(e))return!0;let n=!1;for(const t of e)if(sl.has(t)||Nl(t))n=!0;else if(!n||!Zo.test(t))return!1;return n}function hl(e){for(const n of e)if(!il.has(n)&&!sl.has(n))return!1;return e.length>0}function vl(e){if(pl(e))return!0;for(const n of e)if(!(al.has(n)||ul.has(n)||Zo.test(n)||Nl(n)))return!1;return e.length>0}function pl(e){let n=!1;for(const t of e)if("\\"!==t&&!Zo.test(t)){if(!(al.has(t)||sl.has(t)||ul.has(t)))return!1;n=!0}return n}function gl(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 yl(e){if(0===e.length)return null;const n=gl(e,e.length);return e.slice(n)}const kl=[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 Nl(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,kl)}function bl(e){const n=function(e){for(const n of e)if(!Zo.test(n))return n;return null}(e);return null!==n&&Qo.test(n)}function Sl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Zo.test(e))t--;else{if(!al.has(e)&&!ul.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function xl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ml(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 wl(e,n){return e&&null!==n&&cl.has(n)}function Cl(e){const n=yl(e);return null!==n&&dl.has(n)}function _l(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 Bl(e){let n=e.length;for(;n>0;){const t=gl(e,n),o=e.slice(t,n);if(fl.has(o))return!0;if(!sl.has(o))return!1;n=t}return!1}function Tl(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 Ol=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Il(e){return 1===e.length?e[0]:e.join("")}function Al(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Il(t)}function Hl(e,n,t,o){if(!Ol.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=Tl(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:Il(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:Il(i),isWordLike:u,kind:r,start:a}),l}function Ll(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Rl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function $l(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Rl.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function El(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Pl=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Fl=/[\p{P}\p{S}\p{Co}]/u,Kl=new RegExp("\\p{Emoji_Presentation}","u"),Wl=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function zl(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):!Wl.has(e)&&!Kl.test(e)&&Fl.test(e)}function jl(e){let n=!1;for(const t of e)if(!Zo.test(t)){if(!zl(t))return!1;n=!0}return n}function Dl(e,n,t,o){const l=!n&&jl(e),r=!o&&jl(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=gl(e,n),o=e.slice(t,n);if(!Zo.test(o))return o;n=t}return null}(e);return null!==n&&Nl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=gl(e,n),o=e.slice(t,n);if(!Zo.test(o))return zl(o)||Nl(o);n=t}return!1}(e);return!!(l||r||a)&&!tl(e)&&!tl(t)&&(n||l||i)&&(o||r)}function Vl(e){for(const n of e)if(Qo.test(n))return!0;return!1}function ql(e){if(0===e.length)return!1;for(const n of e)if(!Qo.test(n)&&!Pl.has(n))return!1;return!0}function Ul(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 Xl(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(!Go.test(e))return e;let n=e.replace(Xo," ");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===Yo&&(Yo=new Intl.Segmenter(void 0,{granularity:"word"})),Yo);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const M of i.segment(e))for(const e of Hl(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==m[M]&&(s[M]=[Ml(u,m,h,M)],m[M]=null),s[M].push(e.text),c[M]=c[M]||e.isWordLike,v[M]=v[M]||i,p[M]=p[M]||N,g[M]=S,y[M]=x,k[M]=wl(p[M],b)};const o="text"===e.kind,r=xl(e.text,e.isWordLike,e.kind),i=tl(e.text),N=el(e.text),b=yl(e.text),S=Bl(e.text),x=Cl(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[M]&&i&&v[M]&&g[M]||o&&a>0&&"text"===d[M]&&hl(e.text)&&v[M]||o&&a>0&&"text"===d[M]&&y[M]?t():o&&a>0&&"text"===d[M]&&e.isWordLike&&N&&k[M]?(t(),c[M]=!0):null!==r&&a>0&&"text"===d[M]&&m[M]===r?h[M]=(null!=(l=h[M])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[M]&&!v[M]&&(ml(e.text)||"-"===e.text&&c[M])?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]=N,g[a]=S,y[a]=x,k[a]=wl(N,b),a++)}for(let M=0;M<a;M++)null===m[M]?u[M]=Il(s[M]):u[M]=Ml(u,m,h,M);for(let M=1;M<a;M++)"text"!==d[M]||c[M]||!pl(u[M])||"text"!==d[M-1]||v[M-1]||(u[M-1]+=u[M],c[M-1]=c[M-1]||c[M],u[M]="");const N=Array.from({length:a},()=>null);let b=-1;for(let M=a-1;M>=0;M--){const e=u[M];if(0!==e.length){if("text"===d[M]&&!c[M]&&b>=0&&"text"===d[b]&&(vl(e)||"-"===e&&bl(u[b]))){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[M],u[M]="";continue}b=M}}for(let M=0;M<a;M++){const e=N[M];null!=e&&(u[M]=Al(e,u[M]))}let S=0;for(let M=0;M<a;M++){const e=u[M];0!==e.length&&(S!==M&&(u[S]=e,c[S]=c[M],d[S]=d[M],f[S]=f[M]),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(!tl(n[r])||!tl(n[r+1]))continue;const e=Sl(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]&&Dl(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(Il(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&&Vl(n)&&ql(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&&ql(i)&&Vl(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&ql(e.texts[u]);)a.push(e.texts[u]),u++;n.push(Il(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]),!El(i))continue;const a=r+1;if(a>=e.len||Ll(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!Ll(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(Il(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]||!$l(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Ll(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]=Il(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=Il(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=Il(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(Il(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 M=0;M<x.len-1;M++){const e=_l(x.texts[M]);null!==e&&("space"!==x.kinds[M]&&"preserved-space"!==x.kinds[M]||"text"!==x.kinds[M+1]||!el(x.texts[M+1])||(x.texts[M]=e.space,x.isWordLike[M]=!1,x.kinds[M]="preserved-space"===x.kinds[M]?"preserved-space":"space",x.texts[M+1]=e.marks+x.texts[M+1],x.starts[M+1]=x.starts[M]+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&&!rl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||tl(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:Ul(u,l)},u)}let Gl=null;const Yl=/* @__PURE__ */new Map;let Jl=null;const Zl=new RegExp("\\p{Emoji_Presentation}","u"),Ql=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let er=null;const nr=/* @__PURE__ */new Map;function tr(){if(null!==Gl)return Gl;if("undefined"!=typeof OffscreenCanvas)return Gl=new OffscreenCanvas(1,1).getContext("2d"),Gl;if("undefined"!=typeof document)return Gl=document.createElement("canvas").getContext("2d"),Gl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function or(e,n){let t=n.get(e);return void 0===t&&(t={width:tr().measureText(e).width,containsCJK:tl(e)},n.set(e,t)),t}function lr(){if(null!==Jl)return Jl;if("undefined"==typeof navigator)return Jl={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Jl;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 Jl={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Jl}function rr(){return null===er&&(er=new Intl.Segmenter(void 0,{granularity:"grapheme"})),er}function ir(e){return Zl.test(e)||e.includes("️")}function ar(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=rr();for(const o of t.segment(e))ir(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function ur(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function sr(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function cr(e,n,t=e.widths.length){for(;n<t&&ur(e.kinds[n]);)n++;return n}function dr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function fr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function mr(e,n){return 0===n?0:e+n}function hr(e,n,t,o,l){return mr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function vr(e,n,t,o){return mr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function pr(e,n,t,o,l){return mr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function gr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function yr(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function kr(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Nr(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+lr().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:kr(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=kr(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=cr(e,k),!(k>=t.length)));){const e=t[k],n=sr(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=lr(),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 N(e=m,n=h,t){c++,d=0,f=!1,k()}function b(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):b(e,n)}function M(n,t,o,l,r,i){if(!t)return;const a=vr(e,n,o,r),u=pr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function w(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:kr(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=gr(e,!0,o),r=d+l;if(yr(e,r)>s){if(null!==a&&c>t){N(n,c),v=c,u=kr(a,u,v+1),c=-1;continue}N(),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 _=0;_<a.length;_++){const n=a[_];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=cr(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=sr(n),c=fr(e,f,r),k="tab"===n?dr(d+c,e.tabStopAdvance):t[r],S=c+k,C=hr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+vr(e,n,r,c);if(pr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){N(v,0);continue}if(a&&t<=s){x(r,S),N(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){N();continue}const e=v;N(e,0),r=e;continue}if(C>s&&null!==l[r]){N(),w(r,0),r++;continue}N();continue}x(r,S),M(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?w(r,0):b(r,k),M(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,N(n.consumedEndSegmentIndex,0))}return c}(e,n)}let br=null;function Sr(){return null===br&&(br=new Intl.Segmenter(void 0,{granularity:"grapheme"})),br}function xr(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=Bl(e),a=al.has(e)}function c(e,n){o.push(e),r=r||n;const t=Bl(e);i=1===e.length&&sl.has(e)&&i||t,a=!1}for(const d of Sr().segment(e)){const e=d.segment,t=tl(e);0!==o.length?a||il.has(e)||sl.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 Mr(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&&!rl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||tl(e.text)}return i(n.length),o}function wr(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=Sr();for(const l of o.segment(e))t++;return t}function Cr(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function _r(e,n,t,o,l){const r=lr(),{cache:i,emojiCorrection:a}=function(e,n){tr().font=e;const t=function(e){let n=Yl.get(e);return n||(n=/* @__PURE__ */new Map,Yl.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=nr.get(e);if(void 0!==t)return t;const o=tr();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 nr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,Ql.test(u)));var u;const s=ar("-",or("-",i),a)+(0===l?0:2*l),c=8*ar(" ",or(" ",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=[],N=[],b=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&&N.push(u),null!==b&&b.push(e)}function M(e,n,t,u,s){const c=or(e,i),f=d?wr(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(ar(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":ql(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=rr(),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=or(n,t);e.push(ar(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=ar(n,or(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=or(i,t);e.push(ar(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=ar(u,or(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 Sr().segment(e))t++,Cr(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 _=0;_<e.len;_++){S[_]=f.length;const n=e.texts[_],t=e.isWordLike[_],l=e.kinds[_],a=e.starts[_];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?wr(n,l):0);continue}const u=or(n,i);if("text"===l&&u.containsCJK){const e=xr(n,r),l="keep-all"===o?Mr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];M(e.text,"text",a+e.start,t,"keep-all"===o||!tl(e.text))}continue}M(n,l,a,t,!0)}const w=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=Uo(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!==b?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w,segments:b}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w}}const Br="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Tr=(()=>{const e=globalThis;if(e[Br])return e[Br];const n={configs:{},controllers:{},revision:R(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Br]=n,n})();let Or=null;const Ir=Tr.revision;function Ar(e){var n;return e&&null!=(n=Tr.configs[e])?n:null}function Hr(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Lr(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Rr(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Lr(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 $r(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Or)return Or;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Or=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Or}catch(n){return Or=!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=Tr.blockEstimateCache.get(i);if(a)return Tr.blockEstimateCache.delete(i),Tr.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=Tr.preparedCache.get(o);if(l)return Tr.preparedCache.delete(o),Tr.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 _r(Xl(e,lr(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(Tr.preparedCache.set(o,{prepared:r});Tr.preparedCache.size>240;){const e=Tr.preparedCache.keys().next().value;if(!e)break;Tr.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Nr(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(Tr.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Tr.blockEstimateCache.size>4e3;){const e=Tr.blockEstimateCache.keys().next().value;if(!e)break;Tr.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function Er(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Rr(e.children);return o&&t.paragraph?$r(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Rr(e.children),r=t.headings[o];return l&&r?$r(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=Rr(null==(l=r[0])?void 0:l.children);return i?$r(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=Er(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 Pr(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Fr(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l="pre"!==o&&!1!==n.showHeader,r=function(e){var n,t,o;return e.diff?Math.max(Pr(String(null!=(n=e.originalCode)?n:"")),Pr(String(null!=(t=e.updatedCode)?t:"")),Pr(String(null!=(o=e.code)?o:""))):Pr(function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(e.code,!0===e.loading))}(e),i=Boolean(e.diff);let a=0,u=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);u="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(28*r),u=Number.POSITIVE_INFINITY);const s=Math.max(1,Math.min(a,u));return{kind:"code-block",height:Math.round(s+(l?40:0)),contentHeight:s,rendererKind:o}}function Kr(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Wr(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Hr(o.lineHeight,1.5*Hr(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Kr(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const zr=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function jr(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))zr.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const Dr=!1;function Vr(){return Dr}function qr(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 Ur(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const Xr=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Gr(){return $(Xr,null)}const Yr=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),Jr=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function Zr(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Qr(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 ei(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(Yr.has(o))return!0;if(!Jr.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(ei)}function ni(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(ni).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function ti(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(ti)})}function oi(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 li(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h;if(!e||"object"!=typeof e)return 32;const v=e,p=String(null!=(t=v.type)?t:""),g=Number.isFinite(n)&&n>0?n:640;switch(p){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}(v);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:Qr(t,n,34)}(String(null!=(l=null!=(o=v.raw)?o:v.content)?l:""),g);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+=oi(ni(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))}(v,g);case"list_item":return Qr(String(null!=(i=null!=(r=v.raw)?r:v.content)?i:""),g,34);case"blockquote":return Qr(String(null!=(u=null!=(a=v.raw)?a:v.content)?u:""),g,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=ni(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(ti)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(v,g);case"code_block":return Qr(String(null!=(c=null!=(s=v.code)?s:v.raw)?c:""),g,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:"")?Qr((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):Qr(e,n,96)}(String(null!=(f=null!=(d=v.raw)?d:v.content)?f:""),g);case"thematic_break":return 24;default:return Qr(String(null!=(h=null!=(m=v.raw)?m:v.content)?h:""),g,40)}}function ri(e,n,t){return Math.min(Math.max(e,n),t)}const ii=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],ai=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],ui=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),si=["raw","content","code","originalCode","updatedCode"],ci=/* @__PURE__ */new WeakMap,di=/* @__PURE__ */new WeakMap;let fi=1;function mi(){return"undefined"!=typeof performance?performance.now():Date.now()}function hi(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function vi(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=ci.get(n);return t||(t=fi++,ci.set(n,t)),String(t)}function pi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:vi(n),customMarkdownIt:vi(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:vi(e.validateLink),preTransformTokens:vi(e.preTransformTokens),postTransformTokens:vi(e.postTransformTokens),postTransformNodes:vi(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function gi(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 yi(e){const n=ki(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function ki(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function Ni(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 bi(e){const n=String(null!=e?e:"");return`${n.length}:${Ni(n)}`}function Si(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?bi(e):`${e.length}:${Ni(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${vi(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:${vi(o)}`;const r=vi(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>Si(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.sort().map(e=>`${e}:${Si(o[e],n,t+1)}`).join(";")}`}return typeof e}function xi(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function Mi(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>xi(e)?_i(e,n,t+1):Mi(e,n,t+1)).join(",")}`:xi(e)?_i(e,n,t):Si(e,n,t)}function wi(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!si.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${bi(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${vi(l)}`:ui.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${Mi(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${vi(l)}`:""}).filter(Boolean).join(";")}function Ci(e){return si.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${bi(t)}`:""}).filter(Boolean).join(";")}function _i(e,n=/* @__PURE__ */new WeakMap,t=0){const o=di.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}:${vi(l)}`;const i=vi(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=>_i(e,n,t+1)).join("|"):"";return[e.type,Ci(o),wi(o,n,t),l.length,r].join(":")}(e,n,t);return di.set(l,a),a}function Bi(e,n){return _i(e)===_i(n)}function Ti(e,n,t){const o=mi(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=mi()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Oi(e,n,t){return Ti(n,t,()=>_i(e))}function Ii(e,n,t){return Oi(e,t,"stabilizeSignatureMs")===Oi(n,t,"stabilizeSignatureMs")}function Ai(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Hi(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function Li(e,n){return e.length===n.length&&e===n}function Ri(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(!Li(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(!xi(e)||!xi(n))return null;const o=Ri(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function $i(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=Ri(e,n);return null!=t?t:Bi(e,n)}function Ei(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Ti(t,"stabilizeSignatureMs",()=>{o=Ri(e,n)}),null!=o?o:Ii(e,n,t)}function Pi(e,n){const t={};for(const o of ii){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 Fi(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:E(()=>!1),i=X(n.renderContent.value);let s,d=[],f="",m="",h="",v=0,p=0,y=mi(),k=-1,N=0;function b(e){k=Number.isInteger(e)?e:0,N+=1}function S(){s&&(clearTimeout(s),s=void 0)}function x(){S();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=mi()}G([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&&(!!yi(gi(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=gi(e);if(yi(n))return!1;const t=ki(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?x():function(){if(p+=1,s)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(mi()-y));n<=0?x():s=setTimeout(x,n)}())},{flush:"sync",immediate:!0}),ge(S);const M=E(()=>{var t,o,l,r;return T(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)||A.has(t)||g.has(t)?"":t}).filter(Boolean)))}),w=E(()=>{const{key:e,tags:t}=O(M.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}),C=E(()=>{const n=w.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),_=E(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=M.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}),H=E(()=>{var e;return new Set((null!=(e=_.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),L=E(()=>pi(_.value,C.value,e.customMarkdownIt,{includeFinal:!0})),R=E(()=>pi(_.value,C.value,e.customMarkdownIt,{includeFinal:!1}));G([L,R],([e,n],[t,o])=>{t&&(e===t&&n===o||(x(),n!==o&&(d=[],h="")))},{flush:"sync"});const $=E(()=>{var t,o,l,r,s,c,g,y,N;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",b(0),fe(e.nodes.slice());const S=i.value;if(!S)return d=[],h="",b(-1),[];const x=n.debugPerformanceEnabled.value,M=x?mi():0,w=C.value,B=L.value,T=R.value;f&&B!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(w),m&&T!==m&&(d=[],h="");const O=d.length>0&&S.startsWith(h)&&T===m,A=x?hi(w):null,H=x?{}:void 0,$=H?u(a({},_.value),{__timing:H}):_.value,E=I(S,w,$),P=x?mi():0,F=x?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let K,W=x?Ai(E.length):void 0,z=0,j=0;if(O){const n=x?mi():0,t=function(e){var n,t,o,l;if(e.previousDirtyStartIndex<=0)return 0;if(!e.content.startsWith(e.previousContent)||e.content.length<=e.previousContent.length)return 0;if(!0===e.parseOptions.final)return 0;if(e.customMarkdownIt)return 0;if(function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e.md))return 0;if(o=e.previousContent,l=e.content,o&&l.startsWith(o)&&!(l.length<=o.length)&&function(e){let n=-1;for(let t=0;t<e.length;t++){const o=e.charCodeAt(t);if(n<0){91===o&&(n=t);continue}if(92===o){t+=1;continue}if(91===o){n=t;continue}if(93!==o)continue;let l=t+1;for(;l<e.length;){const n=e.charCodeAt(l);if(9!==n&&32!==n)break;l+=1}if(58===e.charCodeAt(l))return!0;n=-1}return!1}(l))return 0;const r=e.parseOptions;return"function"==typeof r.preTransformTokens||"function"==typeof r.postTransformTokens||"function"==typeof r.postTransformNodes||(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)>0?0:e.previousDirtyStartIndex}({content:S,previousContent:h,previousDirtyStartIndex:k,parseOptions:_.value,customMarkdownIt:e.customMarkdownIt,md:w}),o=t<=0;if(F){const e=function(e,n,t,o={}){var l;if(!n.length)return{nodes:e,metrics:Ai(e.length)};const r=null!=(l=o.scanStartIndex)?l:0,i=!1!==o.reuseDirtyTail,a=function(e,n,t,o=0){const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,o));r<l;r++)if(!Ei(n[r],e[r],t))return r;return e.length===n.length?-1:l}(e,n,t,r);if(a<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:a,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const u=e.slice();let s=a;for(let c=0;c<a;c++)u[c]=n[c];if(i)for(let c=a;c<e.length;c++){const o=n[c],l=e[c];o&&Ii(o,l,t)&&(u[c]=o,s+=1)}return{nodes:u,metrics:{reusedNodeCount:s,dirtyStartIndex:a,stablePrefixNodeCount:a,dirtyTailNodeCount:Hi(a,e,n)}}}(E,d,F,{reuseDirtyTail:o,scanStartIndex:t});K=e.nodes,W=e.metrics}else{const e=function(e,n,t={}){var o;if(!n.length)return{nodes:e,metrics:Ai(e.length)};const l=null!=(o=t.scanStartIndex)?o:0,r=!1!==t.reuseDirtyTail,i=function(e,n,t=0){const o=Math.min(e.length,n.length);for(let l=Math.min(o,Math.max(0,t));l<o;l++)if(!$i(n[l],e[l]))return l;return e.length===n.length?-1:o}(e,n,l);if(i<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:i,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const a=e.slice();let u=i;for(let s=0;s<i;s++)a[s]=n[s];if(r)for(let s=i;s<e.length;s++){const t=n[s],o=e[s];t&&Bi(t,o)&&(a[s]=t,u+=1)}return{nodes:a,metrics:{reusedNodeCount:u,dirtyStartIndex:i,stablePrefixNodeCount:i,dirtyTailNodeCount:Hi(i,e,n)}}}(E,d,{reuseDirtyTail:o,scanStartIndex:t});K=e.nodes,W=e.metrics}z=x?mi()-n:0,j=o?null==(null==W?void 0:W.dirtyStartIndex)||W.dirtyStartIndex<0?K.length:W.dirtyStartIndex:K.length}else K=E,W=Ai(K.length);F?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Ti(n,"primeSignatureMs",()=>_i(e[o]))}(K,F,j):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)_i(e[t])}(K,j);const D=x?mi()-P:0;if(v+=1,h=S,f=B,m=T,d=K,b(null!=(o=null==W?void 0:W.dirtyStartIndex)?o:0),x){const e=hi(w),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(l=null==A?void 0:A.total)?l:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(mi()-M),nodes:K.length,contentLength:S.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:D,signatureMs:null!=(r=null==F?void 0:F.signatureMs)?r:0,stabilizeSignatureMs:null!=(s=null==F?void 0:F.stabilizeSignatureMs)?s:0,primeSignatureMs:null!=(c=null==F?void 0:F.primeSignatureMs)?c:0,signatureCallCount:null!=(g=null==F?void 0:F.signatureCallCount)?g:0,stabilizeSignatureCallCount:null!=(y=null==F?void 0:F.stabilizeSignatureCallCount)?y:0,primeSignatureCallCount:null!=(N=null==F?void 0:F.primeSignatureCallCount)?N:0,stabilizeMs:z},null!=W?W:{}),H?Object.fromEntries(ai.map(e=>{var n;return[e,null!=(n=H[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Pi(e,A),streamStats:e}:{}))}return fe(K)});return{effectiveCustomHtmlTags:M,effectiveCustomHtmlTagsSet:H,mdBase:w,mdInstance:C,mergedParseOptions:_,getParsedNodesDirtyStartIndex:()=>k,getParsedNodesRevision:()=>N,parsedNodes:$}}function Ki(e){const{isClient:n}=e,t=X(/* @__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 Wi(e={}){const n=X(""),t=X(""),o=X(!1),l=Be(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=E(()=>Math.max(0,n.value.length-t.value.length)),u=E(()=>0===a.value),s=E(()=>o.value&&u.value);return ye()&&ge(()=>{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=>l.reset(e),pause:()=>l.pause(),resume:()=>l.resume()}}const zi={maxCharsPerSecond:1800,maxCommitFps:30,maxCharsPerCommit:96,catchUpLatencyMs:220,catchUpThreshold:400};const ji=/auto|scroll|overlay/i;function Di(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return ji.test(n)||ji.test(t)}function Vi(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 qi={class:"m-0 p-0"},Ui=["data-probe"],Xi=/* @__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(),K("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[W("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(Io),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),W("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[W("ul",qi,[V(q(go),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),W("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(yo),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),K(Y,null,ce(6,n=>W("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(fo),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,Ui)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),Gi=P({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return $e(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:Pe(String(null!=(n=e.node.code)?n:"")))});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("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),Yi=P({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return Fe(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:Ke(String(null!=(n=e.node.code)?n:"")))});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("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"}})])])}}),Ji={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:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Zi(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 Qi=["data-custom-id"],ea=["data-node-index","data-node-type"],na="typewriter-simple-cursor-target",ta=/* @__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},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},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","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,r=Q(),i=$("markstreamNestedRendererProps",void 0);function c(e){var n,t;const l=o[e];return function(e){const n=null==r?void 0:r.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}(e)?l:null!=(t=null==(n=null==i?void 0:i.value)?void 0:n[e])?t:l}const d=Vr(),f=E(()=>{return"chat"===(e=c("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),m=E(()=>Ur(c("typewriter"))),h=E(()=>"off"!==m.value),v=E(()=>"minimal"===c("domMode")?"minimal":"full"),p=E(()=>{return!0===(e={mode:f.value,codeRenderer:c("codeRenderer"),renderCodeBlocksAsPre:c("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre?"pre":"pre"===e.codeRenderer||"shiki"===e.codeRenderer||"monaco"===e.codeRenderer?e.codeRenderer:!1===e.renderCodeBlocksAsPre||"docs"===e.mode?"monaco":"pre";var e}),g=E(()=>Ji[f.value]),y=E(()=>{var e;return null!=(e=c("showTooltips"))?e:g.value.showTooltips}),k=E(()=>{var e;return null!=(e=c("fade"))?e:g.value.fade}),N=E(()=>{var e;return null!=(e=c("batchRendering"))?e:g.value.batchRendering}),b=E(()=>{var e;return null!=(e=c("initialRenderBatchSize"))?e:g.value.initialRenderBatchSize}),S=E(()=>{var e;return null!=(e=c("renderBatchSize"))?e:g.value.renderBatchSize}),x=E(()=>{var e;return null!=(e=c("renderBatchDelay"))?e:g.value.renderBatchDelay}),M=E(()=>{var e;return null!=(e=c("renderBatchBudgetMs"))?e:g.value.renderBatchBudgetMs}),w=E(()=>{var e;return null!=(e=c("renderBatchIdleTimeoutMs"))?e:g.value.renderBatchIdleTimeoutMs}),B=E(()=>{var e;return null!=(e=c("deferNodesUntilVisible"))?e:g.value.deferNodesUntilVisible}),T=E(()=>{var e;return null!=(e=c("maxLiveNodes"))?e:g.value.maxLiveNodes}),O=E(()=>{var e;return null!=(e=c("liveNodeBuffer"))?e:g.value.liveNodeBuffer}),I=E(()=>{var e;return null!=(e=c("nodeVirtual"))?e:g.value.nodeVirtual}),A={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return c("parseOptions")},get customMarkdownIt(){return c("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return c("customHtmlTags")},get mode(){return c("mode")},get domMode(){return v.value},get htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},get viewportPriorityOptions(){return c("viewportPriorityOptions")},get codeBlockStream(){return c("codeBlockStream")},get codeBlockDarkTheme(){return c("codeBlockDarkTheme")},get codeBlockLightTheme(){return c("codeBlockLightTheme")},get codeBlockMonacoOptions(){return c("codeBlockMonacoOptions")},get codeRenderer(){return c("codeRenderer")},get renderCodeBlocksAsPre(){return c("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return c("codeBlockMinWidth")},get codeBlockMaxWidth(){return c("codeBlockMaxWidth")},get codeBlockProps(){return c("codeBlockProps")},get mermaidProps(){return c("mermaidProps")},get d2Props(){return c("d2Props")},get infographicProps(){return c("infographicProps")},get showTooltips(){return y.value},get themes(){return c("themes")},get langs(){return c("langs")},get isDark(){return c("isDark")},get customId(){return c("customId")},get indexKey(){return o.indexKey},get typewriter(){return c("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return c("smoothStreamingOptions")},get parseCoalesceMs(){return c("parseCoalesceMs")},get fade(){return k.value},get batchRendering(){return N.value},get initialRenderBatchSize(){return b.value},get renderBatchSize(){return S.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return M.value},get renderBatchIdleTimeoutMs(){return w.value},get deferNodesUntilVisible(){return B.value},get maxLiveNodes(){return T.value},get liveNodeBuffer(){return O.value},get nodeVirtual(){return I.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function L(e){l("height-change",e)}function P(e){l("virtual-state-change",e)}function W(e){l("anchor-change",e)}const z=X(),j=X(null),V=X(null),J=X(null),ne=pe({1:null,2:null,3:null,4:null,5:null,6:null}),de=X(!1),he=/* @__PURE__ */new Map,ve=X(0),ge=X(0),ye=X({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function xe(e,n){return"string"!=typeof e?n:e.trim()||n}function Me(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const we=E(()=>{var e;const n=null!=(e=A.viewportPriorityOptions)?e:{},t=xe(n.rootMargin,bo);return{rootMargin:t,heavyBlockMargin:xe(n.heavyBlockMargin,t),maxTargets:Me(n.maxTargets)}}),Ce=E(()=>{var e;return null!=(e=we.value.rootMargin)?e:bo}),_e=E(()=>{var e;return null!=(e=we.value.maxTargets)?e:640});function Be(){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 He("function"==typeof t?t():t)}function He(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?He(e.value):"object"==typeof e&&"$el"in e?He(e.$el):null:null}me(No,we);const{isClient:Le,renderAsFragment:Re,debugPerformanceEnabled:We,resolvedShowTooltips:ze,resolvedHtmlPolicy:je,inheritedSmoothStreaming:De,ownsTypewriterCursor:Ve}=function(e){const n="undefined"!=typeof window,t=U(),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamTypewriterCursor",void 0),r=$("markstreamSmoothStreaming",void 0),i=E(()=>!0===e.renderAsFragment),a=E(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=E(()=>{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=E(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=E(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(A),{resolveViewportRoot:qe,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ge,getNormalizedScrollTop:Ye,getOffsetTopWithinRoot:Je}=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(Di(window.getComputedStyle(a))&&Vi(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}}}(z,{isClient:Le,scrollRoot:Be});me("markstreamShowTooltips",ze),me("markstreamHtmlPolicy",je),me("markstreamTypewriter",h),me("markstreamFade",E(()=>!1!==A.fade)),me("markstreamTypewriterCursor",E(()=>!0)),me("markstreamTextStreamState",he),me("markstreamStreamVersion",ve),me("markstreamParseOptions",E(()=>A.parseOptions)),me("markstreamCustomMarkdownIt",E(()=>A.customMarkdownIt));const{smoothStreamingEnabled:Qe,renderContent:en,requestedFinal:nn,effectiveFinal:tn}=function(e,n){const t=Wi(a(a({},zi),e.smoothStreamingOptions)),o=E(()=>{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||"off"!==Ur(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=X(!n.isClient||!0===e.smoothStreaming);ke(()=>{l.value=!0});const r=E(()=>l.value&&o.value),i=E(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),u=E(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),s=E(()=>{const e=u.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return G([()=>e.content,()=>e.nodes,r,u],([e,n,o,l])=>{if(null==n?void 0:n.length)return void t.reset("");const r=null!=e?e:"";if(!o)return t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;r?r===i||(r.startsWith(i)?t.enqueue(r.slice(i.length)):t.reset(r)):t.reset(""),l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:u,effectiveFinal:s}}(A,{isClient:Le,inheritedSmoothStreaming:De}),on=!0===nn.value;me("markstreamSmoothStreaming",Qe);const ln=X(!1);let an="",sn=!1,cn=null;function fn(){Le&&null!=cn&&(window.clearTimeout(cn),cn=null)}function mn(){ln.value=!1,fn()}function hn(e,n){if(!We.value)return;const t=function(){if(!We.value)return null;const e=Nn(vn),n=Nn(pn),t=Math.max(kn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=vn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return vn.clear(),pn.clear(),kn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}G([en,()=>o.nodes,tn],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(mn(),an=l,void(sn=!0)):sn?(an&&l.length>an.length&&l.startsWith(an)?(ln.value=!0,Le&&(fn(),cn=window.setTimeout(()=>{var e;cn=null,!0===tn.value||(null==(e=o.nodes)?void 0:e.length)||(Ra(),ln.value=!1,Ea())},1200))):(l.length<an.length||!l.startsWith(an))&&mn(),void(an=l)):(an=l,void(sn=!0))},{flush:"sync",immediate:!0});const vn=/* @__PURE__ */new Map,pn=/* @__PURE__ */new Map;let yn=!1,kn=0;function Nn(e){let n=0;for(const t of e.values())n+=t;return n}function bn(){kn=Math.max(kn,Nn(pn)),pn.clear(),yn=!1}function Sn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function xn(e){var n,t;We.value&&(vn.set(e,(null!=(n=vn.get(e))?n:0)+1),pn.set(e,(null!=(t=pn.get(e))?t:0)+1),function(e){const n=function(){if(!Le||"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(()=>Sn(n),0):queueMicrotask(()=>Sn(n)):window.requestAnimationFrame(()=>Sn(n))))}(e),yn||(yn=!0,Le&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(bn):"function"!=typeof queueMicrotask?setTimeout(bn,0):queueMicrotask(bn)))}function wn(e,n){return xn(e),n()}const Cn=A.customId?`renderer-${A.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Bn=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(Cn),Tn=E(()=>`${Cn}:${ve.value}`);me(Xr,Bn);const On=Ze(()=>A.customId),{effectiveCustomHtmlTagsSet:In,mergedParseOptions:An,parsedNodes:Hn,getParsedNodesDirtyStartIndex:Ln,getParsedNodesRevision:Rn}=Fi(A,{instanceMsgId:Cn,renderContent:en,effectiveFinal:tn,smoothStreamingEnabled:Qe,debugPerformanceEnabled:We,customComponentsMap:On,logPerf:hn});G(Hn,()=>{Bn.clear(),ve.value+=1},{immediate:!0});const $n=E(()=>({customId:A.customId,customHtmlTags:An.value.customHtmlTags,parseOptions:A.parseOptions,customMarkdownIt:A.customMarkdownIt,htmlPolicy:je.value,viewportPriority:A.viewportPriority,viewportPriorityOptions:we.value,mode:f.value,domMode:A.domMode,codeRenderer:p.value,codeBlockStream:A.codeBlockStream,codeBlockDarkTheme:A.codeBlockDarkTheme,codeBlockLightTheme:A.codeBlockLightTheme,codeBlockMonacoOptions:A.codeBlockMonacoOptions,renderCodeBlocksAsPre:A.renderCodeBlocksAsPre,codeBlockMinWidth:A.codeBlockMinWidth,codeBlockMaxWidth:A.codeBlockMaxWidth,codeBlockProps:A.codeBlockProps,mermaidProps:A.mermaidProps,d2Props:A.d2Props,infographicProps:A.infographicProps,showTooltips:ze.value,themes:A.themes,langs:A.langs,isDark:A.isDark,typewriter:h.value,smoothStreamingOptions:A.smoothStreamingOptions,parseCoalesceMs:A.parseCoalesceMs,fade:A.fade}));me("markstreamNestedRendererProps",$n);const En=E(()=>Hn.value),Pn=E(()=>Hn.value.length),Fn=X(null),Kn=X(null),Wn=X(null),zn=X(null),jn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Dn=!jn&&A.customId?Ar(A.customId):null,Vn=E(()=>Dn?(Ir.value,Ar(A.customId)):null),qn=E(()=>{var e;return Boolean(!Re.value&&A.customId&&!jn&&(null==(e=Vn.value)?void 0:e.enabled))}),Un=E(()=>Boolean(Le&&qn.value)),Xn=E(()=>{var e;return Boolean(!Re.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),Gn=E(()=>Xn.value),Yn=X(!1);ke(()=>{Yn.value=!0});const Jn=E(()=>Boolean(Le&&Xn.value));me("markstreamHostScrollManaged",Jn);const Zn=E(()=>Boolean(Yn.value&&Jn.value)),Qn=E(()=>Un.value||Jn.value),et=E(()=>Un.value||Zn.value),nt=E(()=>{var e;return Qn.value&&!1!==(null==(e=Vn.value)?void 0:e.textEstimation)});function tt(){const e=ge.value||wn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const ot=E(()=>{const e=tt();return e>0?Math.max(1,Math.round(e)):640}),lt=E(()=>{var e;return Math.max(1,null!=(e=A.maxLiveNodes)?e:320)}),it=E(()=>{var e;return!Re.value&&!1!==A.nodeVirtual&&!((null!=(e=A.maxLiveNodes)?e:0)<=0)&&(!0===A.nodeVirtual?Hn.value.length>0:Hn.value.length>lt.value)}),at=E(()=>it.value||Un.value||Jn.value),ut=E(()=>!1!==A.viewportPriority&&!de.value),st=E(()=>{var e;return!(Re.value||!1===A.deferNodesUntilVisible||(null!=(e=A.maxLiveNodes)?e:0)<=0||it.value||Hn.value.length>900||!1===A.viewportPriority)}),ct=xo(e=>{var n;return qe(null!=(n=null!=e?e:z.value)?n:null)},ut),{requestFrame:dt,cancelFrame:ft,hasIdleCallback:mt,isTestEnv:ht}=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:Le}),pt=E(()=>!0===tn.value&&!Xn.value),{resolvedBatchSize:gt,resolvedInitialBatch:yt,batchingEnabled:wt,incrementalRenderingActive:_t,renderedCount:Tt,previousRenderContext:It,adaptiveBatchSize:Ht,previousBatchConfig:Lt}=function(e,n){var t;const o=E(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=E(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=E(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=X(0),a=X({key:e.indexKey,total:0}),u=X(Math.max(1,o.value||1)),s=E(()=>{var t,o;return r.value&&!(null==(t=n.forceFullRenderFinalContent)?void 0:t.value)&&(null!=(o=e.maxLiveNodes)?o:0)<=0}),c=X({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}}(A,{isClient:Le,isTestEnv:ht,renderAsFragment:Re,forceFullRenderFinalContent:pt}),Rt=E(()=>{var e;return!Re.value&&!1!==A.batchRendering&>.value>0&&!ht&&(null!=(e=A.maxLiveNodes)?e:0)<=0&&!pt.value}),$t=E(()=>Rt.value),Pt=E(()=>Qn.value||$t.value),Kt=E(()=>{var e;return Pt.value&&!1!==(null==(e=Vn.value)?void 0:e.codeBlockEstimation)}),zt=/* @__PURE__ */new Map,Dt=/* @__PURE__ */new Map,qt=/* @__PURE__ */new WeakMap;let Ut=null;const Xt=/* @__PURE__ */new WeakMap,Gt=/* @__PURE__ */new Map,Yt=[];let Jt=[],Zt=[],eo=-1;const no=R(Yt),to=/* @__PURE__ */new Set,lo=X(0);let io=0;const ao=X(0),so=E(()=>(ao.value,Array.from(zt.entries()).sort((e,n)=>e[0]-n[0]))),co=X(null),mo=X(null);let ho,vo=null,po=0,ko=null;function So(){ho.markFallbackHeightPrefixDirty()}function Mo(e){return ho.getFallbackNodeHeight(e)}function wo(e,n){return ho.estimateHeightRange(e,n)}function Co(e){return ho.estimateIndexForOffset(e)}const{activeRestoreAnchor:_o,getRelativeScrollTopWithinContainer:To,setRelativeScrollTopWithinContainer:Oo,resolveAnchorOffset:Ao,clearRestoreReconcile:Ho,scheduleRestoreReconcile:Lo,captureRestoreAnchor:Ro,restoreAnchor:$o,getAnchorDrift:Eo}=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=X(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)))}qr(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 N(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function b(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:N,applyRestoreAnchor:b,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&b(h.value)}):null,null==v&&h.value&&b(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)},N(),b(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&b(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:Le,containerRef:z,parsedNodeCount:Pn,requestFrame:dt,cancelFrame:ft,resolveScrollContainer:()=>co.value||Xe(),getNormalizedScrollTop:Ye,getOffsetTopWithinRoot:Je,isReverseFlexScrollRoot:Ge,estimateIndexForOffset:Co,estimateHeightRange:wo,getFallbackNodeHeight:Mo,clamp:nr}),{nodeHeights:Po,heightStats:Ko,heightTreeSize:zo,heightSumTree:Vo,heightKnownTree:qo,averageNodeHeight:Uo,resetHeightMeasurements:Xo,pruneHeightMeasurements:Go,rebuildHeightTrees:Yo,recordNodeHeight:Jo,removeNodeHeights:Zo,exportHeightCache:Qo,importHeightCache:el,fenwickRangeSum:nl}=function(e={}){const n=pe({}),t=pe({total:0,count:0}),o=X(0),l=X([]),r=X([]);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){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 f(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 m=E(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:m,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:d,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,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=f(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},removeNodeHeights:function(n,t={}){var o;let l=0;for(const e of n)f(Number(e))&&l++;return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),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&&d(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:function(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}}}({onHeightRecorded:()=>{So(),Jn.value&&Da(),_o.value&&Lo(),mo.value&&_i(),Ta("node-resize")}});function tl(e){Number.isInteger(e)&&e>=0&&to.add(e)}function ol(e){for(const n of e)tl(Number(n))}function ll(e){io++;let n=!0;try{const t=e();return n=!1!==t,t}finally{io--,0===io&&n&&lo.value++}}function rl(){Jt=[],Zt=[],eo=-1,to.clear(),no.value=Yt}function il(){rl(),ll(()=>Xo()),Gt.clear()}function al(e){!Number.isInteger(e)||e<0||e>=Hn.value.length||Gt.set(e,ki(e))}function ul(e,n,t={}){const o=Po[e];tl(e),Jo(e,n,t);const l=Po[e];return Object.is(o,l)?(to.delete(e),!1):(l&&l>0?al(e):o&&Gt.delete(e),!0)}function sl(e,n){const t=wn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=zt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:wn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function cl(e,n={}){"merge"!==n.mode?rl():ol(e.map(e=>e.index)),ll(()=>el(e,n)),ra()}const dl=E(()=>st.value&&ut.value),fl=E(()=>{var e;return!Re.value&&!1!==A.batchRendering&>.value>0&&(null!=(e=A.maxLiveNodes)?e:0)<=0}),ml=E(()=>!Re.value&&on&&!0===tn.value&&!it.value&&!Xn.value&&!qn.value&&!dl.value&&!fl.value),hl=E(()=>!!ct&&(dl.value||it.value)),vl=E(()=>it.value||Jn.value),{liveNodeBufferResolved:pl,focusIndex:gl,liveRange:yl,updateLiveRange:kl}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,clamp:r}=n,i=E(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),a=X(0),u=pe({start:0,end:0});return{liveNodeBufferResolved:i,focusIndex:a,liveRange:u,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return u.start=0,void(u.end=e);const n=Math.min(l.value,e),s=i.value,c=r(a.value-s,0,Math.max(0,e-n));u.start=c,u.end=Math.min(e,c+n)}}}(A,{parsedNodeCount:Pn,virtualizationEnabled:it,maxLiveNodesResolved:lt,clamp:nr}),Nl=/* @__PURE__ */new Map,bl=/* @__PURE__ */new Map,Sl=/* @__PURE__ */new Map,xl=[],Ml=/* @__PURE__ */new Map,wl=/* @__PURE__ */new Set,Cl=X(0);let _l=!1;const Bl=E(()=>(Cl.value,wl.size)),Tl=/* @__PURE__ */new Map,Ol=/* @__PURE__ */new Map,Il=X(0),Al=E(()=>{Il.value;let e=0;for(const n of Tl.values())e+=Math.max(0,n);return e});let Hl=null;const Ll=E(()=>{if(!it.value)return Hn.value.length;const e=pl.value,n=Math.max(yl.end+e,yt.value),t=Math.min(Hn.value.length,n);return Math.max(Tt.value,t)});function Rl(){_l||(_l=!0,queueMicrotask(()=>{_l=!1,Cl.value+=1}))}function $l(e,n,t="node-resize"){if(!Le||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{wl.delete(o)&&Rl();try{n()}finally{Ta(t)}},Math.max(0,e));return wl.add(o),Rl(),o}function El(e){Le&&null!=e&&(wl.delete(e)&&Rl(),window.clearTimeout(e))}function Pl(){if(Le&&"undefined"!=typeof window)for(const e of wl)window.clearTimeout(e);wl.size&&(wl.clear(),Rl()),xl.length=0,Sl.clear()}function Fl(e){j.value=e}function Kl(e){V.value=e}function Wl(e){J.value=e}const{cancelScheduledFocusSync:zl,scheduleFocusSync:jl}=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:Le,containerRef:z,virtualizationEnabled:it,requestFrame:dt,cancelFrame:ft,syncFocusToScroll:function(e=!1){var n;if(!it.value)return;const t=co.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=z.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=Hn.value.length;if(i<=0)return;if(!r&&i>0&&Ge(t)){const n=wn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=wn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void er(nr((a=Math.max(0,l)+.5*Math.max(0,n),ho.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=z.value;if(!l)return null;const r=o?0:wn("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=wn("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?wn("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}):wn("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return nr(Co(a+.5*Math.max(0,u)),0,Math.max(0,Hn.value.length-1))}(t,o,l,r);if(null!=u)return void er(u,e);const s=r?null:wn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?wn("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=so.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=wn("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=z.value;if(!e)return;const n=r?{top:0}:wn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=wn("syncFocusToScroll.fallback.scrollTop",()=>Ye(t,o,r)),a=r?(()=>{const t=wn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Je(e,t);return Math.max(0,i-n)})(),u=r?wn("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}):wn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void er(nr(Co(a+.5*Math.max(0,u)),0,Math.max(0,Hn.value.length-1)),!0)}er(Math.round((m+h)/2),e)}}),{visibleNodeIndices:Dl,nodeVisibilityHandles:Vl,nodeVisibilityWatchStops:ql,nodeVisibilityFallbackTimers:Ul,clearVisibilityFallback:Xl,markNodeVisible:Gl,cleanupNodeVisibility:Yl,destroyNodeVisibilityState:Jl}=Ki({isClient:Le,shouldTrackVisibleNodeIndices:()=>dl.value,shouldCleanupNodeVisibility:()=>it.value,onNodeMarkedVisible:e=>{it.value?jl():gl.value=nr(e,0,Math.max(0,Hn.value.length-1))},onNodeVisibilityCleaned:e=>{zt.delete(e)&&Oa()}}),{cleanupScrollListener:Zl,setupScrollListener:Ql}=function(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null;function c(){u&&(u(),u=null),s=null,l.value=null}function d(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:c,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void c();var e;const f=r();if(!f)return void c();if(l.value===f&&u)return;c(),s=d(f);const m=()=>{if(null==a||a(),t.value){const e=function(e){const n=d(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}(f);e?i(e):i()}};f.addEventListener("scroll",m,{passive:!0}),l.value=f,u=()=>{f.removeEventListener("scroll",m)}}}}({isClient:Le,virtualizationEnabled:it,listenerEnabled:vl,scrollRootElement:co,resolveScrollContainer:Xe,scheduleFocusSync:jl,onScroll:function(){const e=mo.value;if(!e)return;const n=ui();if(!n)return;if(function(e){if(ka()>=po)return ko=null,!1;const n=ko;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(ko=null),t}(n))return;const t=ci(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Ci("restore"):Ci("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=z.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return wn("scrollListener.getScrollTop",()=>Ye(e,t,o))}});function er(e,n=!1){const t=nr(e,0,Math.max(0,Hn.value.length-1));!n&&Math.abs(t-gl.value)<=1||(gl.value=t,kl())}function nr(e,n,t){return Math.min(Math.max(e,n),t)}function tr(e=Hn.value.length){const n=Ln();return!Number.isInteger(n)||n<0?e:nr(n,0,e)}function or(e){return null==e?void 0:e.firstElementChild}function lr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function rr(e,n){e<1||e>6||(ne[e]=n)}function ir(){if(!Qn.value)return void(ge.value=0);const e=wn("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.clientWidth)?n:0});ge.value=e>0?e:0}let ar=null;function ur(){null==ar||ar.disconnect(),ar=null}const sr=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:Nt,delay:0,suspensible:!1});function cr(e){return e===sr}const dr=E(()=>"pre"===p.value?vt:"shiki"===p.value?sr:bt);function fr(){var e;return!1!==(null==(e=A.codeBlockProps)?void 0:e.showHeader)}function mr(e,n,t){const o=Po[n],l="number"==typeof o&&o>0;if(nt.value&&!l&&!function(e){return!!On.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=Er(e,t,ye.value);if(n)return n}if(Kt.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Su(e,gu(e));return cr(n)?"markdown":n===vt?"pre":n===dr.value||n===bt?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return Fr(e,{rendererKind:n,monacoOptions:A.codeBlockMonacoOptions,showHeader:fr()})}return null}Ne(()=>{if(lo.value,io>0)return;const e=Hn.value,n=Rn();if(!e.length||!Pt.value)return Jt=[],Zt=[],eo=-1,to.clear(),void(no.value=Yt);const t=ge.value||wn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return Jt=[],Zt=[],eo=-1,to.clear(),void(no.value=Yt);const o=function(e){return[Math.round(e),nt.value,Kt.value,ye.value,A.codeBlockMonacoOptions,fr(),p.value,On.value,Ir.value]}(t),l=Jt.length<=e.length&&(i=o,(r=Zt).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&eo===n?e.length:l?tr(e.length):0,u=l?Array.from(to):[];Jt.length=e.length;for(let s=a;s<e.length;s++)Jt[s]=mr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(Jt[s]=mr(e[s],s,t));to.clear(),Zt=o,eo=n,no.value=Jt,be(no)},{flush:"sync"});const hr=E(()=>no.value);ho=function(e){let n=!0,t=[0],o="";function l(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,i=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),a=e.estimatedNodeHeights.value[n],u=null==a?void 0:a.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,a,i)&&Number.isFinite(u)&&u>0)return u;const s=li(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&s<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(ei)}(l,i)?s:Math.max(e.averageNodeHeight.value,s)}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=ri(Math.trunc(n),0,i),u=ri(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?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 i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.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(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(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 s(){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:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,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=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Hn,nodeHeights:Po,heightStats:Ko,heightTreeSize:zo,heightSumTree:Vo,heightKnownTree:qo,averageNodeHeight:Uo,heightEstimationActive:Qn,estimatedNodeHeights:hr,getContainerWidth:tt,hasCustomParagraphComponent:()=>Boolean(On.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=Zr(ge.value||wn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=z.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[Hn.value.length,Ko.count,Math.round(Ko.total),Math.round(100*Uo.value),t,n,Qn.value?1:0,Ir.value,ve.value,On.value.paragraph?1:0]},fenwickRangeSum:nl}),G(()=>Hn.value.length,e=>{var n;So(),e<=0?il():(e<zo.value&&(n=e,rl(),ll(()=>Go(n))),e!==zo.value&&Yo(e))},{immediate:!0});const vr=E(()=>{if(!it.value)return Hn.value.map((e,n)=>({node:e,index:n}));const e=Hn.value.length,n=nr(yl.start,0,e),t=nr(yl.end,n,e);return Hn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),pr=E(()=>it.value?wo(0,Math.min(yl.start,Hn.value.length)):0),gr=E(()=>{if(!it.value)return 0;const e=Hn.value.length;return wo(Math.min(yl.end,e),e)});function yr(){return ho.buildVirtualHeightSummary({topSpacerHeight:pr.value,bottomSpacerHeight:gr.value,width:Cr()})}function kr(){const e=Hn.value,n=yr();return u(a({},n),{probe:{paragraphReady:Boolean(ye.value.paragraph),listItemReady:Boolean(ye.value.listItem),listWrapperOverhead:ye.value.listWrapperOverhead,headingReadyLevels:Object.entries(ye.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=hr.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=hr.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=hr.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=hr.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Po[n])?c:null}})})}function Nr(){return null!=o.indexKey?String(o.indexKey):Xn.value?`virtual-${Sr()}`:"markdown-renderer"}function br(e){const n=String(e),t=`${Nr()}-`;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>=Hn.value.length?null:l}function Sr(){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:A.customId)?t:Cn)}function xr(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function Mr(e){var n;return(null!=e?e:"")===(null!=(n=xr())?n:"")}function wr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(){const e=p.value;return function(e){var n,t;const o=e.renderer,l="monaco"===o?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i="shiki"===o;return[e.isDark?"dark":"light","monaco"===o?"code-rich":"pre"===o?"code-pre":"code-shiki",!1===e.codeBlockStream?"code-static":"code-stream",Zi(e.codeBlockMinWidth),Zi(e.codeBlockMaxWidth),...i?[Te(null!=(n=null==r?void 0:r.themes)?n:e.themes,null!=(t=null==r?void 0:r.langs)?t:e.langs)]:[],Zi(null==l?void 0:l.fontSize),Zi(null==l?void 0:l.lineHeight),Zi(null==l?void 0:l.fontFamily),Zi(null==l?void 0:l.tabSize),Zi(null==l?void 0:l.MAX_HEIGHT),Zi(null==l?void 0:l.wordWrap),Zi(null==l?void 0:l.wrappingIndent),Zi(null==l?void 0:l.padding),Zi(null==r?void 0:r.showHeader),Zi(null==r?void 0:r.showCopyButton),Zi(null==r?void 0:r.showExpandButton),Zi(null==r?void 0:r.showPreviewButton),Zi(null==r?void 0:r.showCollapseButton),Zi(null==r?void 0:r.showFontSizeButtons)].join("\0")}({renderer:e,isDark:A.isDark,codeBlockStream:A.codeBlockStream,codeBlockMinWidth:A.codeBlockMinWidth,codeBlockMaxWidth:A.codeBlockMaxWidth,codeBlockMonacoOptions:"monaco"===e?A.codeBlockMonacoOptions:void 0,codeBlockProps:A.codeBlockProps,themes:"shiki"===e?A.themes:void 0,langs:"shiki"===e?A.langs:void 0})}(),[null==n?"":String(n),t].join("\0")}function Cr(){return tt()}const _r=E(()=>Zr(Cr())),Br=E(()=>[wr(),_r.value].join("\0")),Or=E(()=>{var e;return Xn.value?["virtual",null!=(e=xr())?e:"",Sr(),Br.value].join("\0"):o.indexKey});function Hr(){Il.value+=1}function Lr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Hn.value.length||e.sessionKey!==Sr()||e.threadKey!==xr()||e.layoutEpochKey!==Br.value)}function Rr(e){const n=String(e),t=Ol.get(n);return t?Lr(t)?t.index:null:br(n)}function $r(e="async-node"){(Tl.size||Ol.size)&&(Tl.clear(),Ol.clear(),Hr(),Ta(e))}const Pr=$(Ie,null),Kr={reportHeight(e,n){if(!Jn.value)return;const t=Rr(e);if(null==t)return;const o=Nl.get(t);if(!o)return;const l=Number(n),r=sl(t,o);!function(e,n,t={}){ll(()=>ul(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!Jn.value)return;const n=br(e);null!=n&&function(e,n){var t;const o=Ol.get(e);if(o&&Lr(o))return Tl.set(e,Math.max(0,null!=(t=Tl.get(e))?t:0)+1),Hr(),void Ta("async-node");Tl.set(e,1),Ol.set(e,function(e){return{index:e,sessionKey:Sr(),threadKey:xr(),layoutEpochKey:Br.value}}(n)),Hr(),Ta("async-node")}(String(e),n)},markSettled(e){if(!Jn.value)return;const n=String(e),t=Rr(e);(null!=t||function(e){return Tl.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Tl.get(e))?n:0;return!(t<=0||(t<=1?(Tl.delete(e),Ol.delete(e)):Tl.set(e,t-1),Hr(),1===t&&Ta("async-node"),0))}(n)&&null!=t&&Ea()}};function zr(){let e=0;for(const n of Nl.values())e+=wn("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}me(Ie,{reportHeight(e,n){Kr.reportHeight(e,n),null==Pr||Pr.reportHeight(e,n)},markPending(e){Kr.markPending(e),null==Pr||Pr.markPending(e)},markSettled(e){Kr.markSettled(e),null==Pr||Pr.markSettled(e)}});let Dr,Gr=null,Yr=null;function Jr(e){return!1!==e&&null!=e&&""!==e}function Qr(){return it.value?function(){if(!it.value)return!0;const e=Hn.value.length,n=nr(yl.start,0,e),t=nr(yl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!zt.has(o))return!1;if(Ia(o)&&!Nl.has(o))return!1}return!0}():Tt.value>=Ll.value}function ni(){return!0===tn.value&&!ln.value&&0===Al.value&&0===wl.size&&0===Ml.size&&null==Hl&&Qr()}function ti(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(Gr===Sr()&&Dr===xr())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!Jr(t)&&Yr===Ua(t)}function oi(){return ni()&&ti()}function ii(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 ai(e="manual",n){const t=yr(),o=function(e){return e||(!0!==tn.value?Hn.value.length>0?"streaming":"estimating":!Qr()||Ml.size>0||null!=Hl?"measuring":oi()?"settled":"settling")}(n);return{sessionKey:Sr(),threadKey:xr(),phase:o,nodeCount:t.totalNodes,liveRange:{start:yl.start,end:yl.end},renderedCount:Tt.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:zr(),totalHeight:si(),width:t.width,final:!0===tn.value,stable:oi(),confidence:ii(o,t),reason:e}}function ui(){const e=co.value||Xe(),n=z.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=wn("getScrollBox.scrollTop",()=>Ye(e,t,o)),r=wn("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=wn("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 si(){const e=Hn.value.length,n=Math.max(0,wo(0,e)),t=wn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:wn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=z.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):it.value?n>0?Math.max(1,Math.ceil(n),function(){let e=pr.value+gr.value;for(const n of zt.values())n&&(e+=Math.max(0,wn("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}(n,o)):Math.max(1,Math.ceil(o)):Jn.value?n>0||Ko.count>0||ho.getEstimatedNodeHeightCount()>0?(_t.value&&Tt.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function ci(e){const n=z.value;if(!n)return null;const t=wn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:wn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function di(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=ui(),t=z.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=wn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=wn("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=ui(),n=z.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=ci(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=Ro();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Hn.value.length;return e<=0?null:{type:"node",nodeIndex:nr(gl.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function fi(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 mi(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 hi=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function vi(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}:${fi(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(vi(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=vi(e[a],n,t+1);i=mi(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||hi.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${vi(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let pi=-1,gi="",yi=[2166136261];function ki(e){const n=Hn.value[e];return n?fi(vi(n)):""}function Ni(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 bi(){var e,n;const t=ve.value;if(pi===t)return gi;const o=Hn.value.length;let l=tr(o);(pi!==t-1||l>o||yi.length<l+1)&&(l=0),0===l?yi=[2166136261]:yi.length=l+1;for(let r=l;r<o;r++){const n=ki(r);yi[r+1]=Ni(null!=(e=yi[r])?e:2166136261,n)}return yi.length=o+1,gi=((null!=(n=yi[o])?n:2166136261)>>>0).toString(36),pi=t,gi}function Si(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=Hn.value.length,i=nr(yl.start-2*pl.value,0,r),a=nr(yl.end+2*pl.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)}(Qo().map(e=>{var n;const t=Hn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:ki(e.index)}):null}).filter(e=>Boolean(e))):[],s=di({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?bi():void 0,measurementKey:wr()||void 0,heightCache:i.length?i:void 0}):null}function xi(e){var n,t;const o=ui();if(!o)return;const l=function(e){const n=z.value;if(!n)return null;const t=Je(n,e.root),o=Hn.value.length,l=wn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?wn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=si();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){po=ka()+120,ko=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):qr(o.root,o.doc,i,{isReverseFlexScrollRoot:Ge,getNormalizedScrollTop:Ye})}const Mi=[];function wi(){if(Le)for(null!=vo&&(null==ft||ft(vo),vo=null);Mi.length;){const e=Mi.pop();null!=e&&window.clearTimeout(e)}}function Ci(e){const n=Boolean(mo.value);mo.value=null,po=0,ko=null,wi(),n&&e&&Ta(e)}function _i(){if(!mo.value||!Le)return;if(null!=vo)return;const e=()=>{vo=null;const e=mo.value;e&&xi(e)};vo=dt?dt(e):null,null==vo&&e()}function Bi(e,n={}){const t=Hn.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=Hn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==ki(e.index))}(e))}function Ti(e){const n=Zr(Cr()),t=Zr(e);return-1!==n&&-1!==t&&n===t}function Oi(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 Ii(e){var n;return e.sessionKey===Sr()&&!!Mr(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===wr()&&!!Ti(Oi(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Ai(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Ai(e){return Boolean(e.contentHash&&e.contentHash===bi())}function Hi(e){return!Ai(e)}let Li=null,Ri=null,$i=null,Ei=null,Pi=null,ji=!1;function qi(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=Zr(Cr());return[null!=(n=xr())?n:"",Sr(),wr(),Hn.value.length,o,e.length,fi(t)].join(":")}function Ui(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!Jn.value||!(null==e?void 0:e.length))return!1;if(Hn.value.length<=0)return!1;if(!Ti(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Bi(e,{requireSignature:!0});if(!t.length)return!ji&&"undefined"!=typeof console&&d&&(ji=!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=qi(t);return l===Li?(Ri="standalone",!0):(cl(t,{mode:"merge"}),So(),Li=l,Ri="standalone",xa(),Ta("restore"),!0)}function ta(e,n={}){var t,o,l;if(!Jn.value||!e)return!1;if(e.sessionKey!==Sr())return!1;if(!Mr(e.threadKey))return!1;if(Hn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!oa(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!oa()&&Number(Oi(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&Ii(e)){const n=Bi(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Hi(e)});n.length&&(cl(n,{mode:"merge"}),So(),Li=qi(n),Ri="restore",xa(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Ta("restore"),!0;if(!i)return u&&Ta("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=xr())?t:"",Sr(),wr(),_r.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return $i===s?(u&&Ta("restore"),!0):($i=s,function(e){const n=()=>{if("node"===e.type)return Ci(),void $o({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Ho(),_o.value=null,mo.value=e,wi(),xi(e),Le)for(const e of[0,120,280,480])Mi.push(window.setTimeout(()=>{const e=mo.value;e&&xi(e)},e))};!function(e){if(!it.value)return!1;const n=Hn.value.length;return!(n<=0||(gl.value="node"===e.type?nr(e.nodeIndex,0,n-1):n-1,kl(),0))}(e)?n():le(n)}(i),Ta("restore"),!0)}function oa(){const e=Cr();return Number.isFinite(e)&&e>0}function la(e){var n;return e.sessionKey===Sr()&&!!Mr(e.threadKey)&&(Hn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||oa())||!(!(e.anchor&&Number(Oi(e))>0)||oa()))}function ra(){Gt.clear();for(const e of Object.keys(Po)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Hn.value.length&&al(n)}}function ia(){null!=Hl&&(null==ft||ft(Hl),Hl=null),La()}function aa(){return!Le||ht?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(dt)return dt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function ua(e,n=xr(),t=Br.value){return Sr()===e&&xr()===n&&Br.value===t}function sa(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Sr(),c=xr(),d=Br.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=ai(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>ua(s,c,d)&&(null==v||ba()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield aa(),!k())return y();Ea(),ia()}if(yield function(e){return!Le||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&Pl(),Ea(),ia(),!k())return y();const N=ni();N&&(Gr=s,Dr=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&Jr(null==(i=o.virtualScroll)?void 0:i.settledToken)&&ba()===v&&(Yr=Ua(o.virtualScroll.settledToken)));const b=k()&&N&&ti(),S=ai(h,b?"final":void 0);return Ca(S,!0),S})}let ca="content",da=null,ma=null,ha=0,va=null,pa=null,ga=null,ya=null;function ka(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Na(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 ba(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Zi(e)}function Sa(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",wr(),bi(),Zi(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function xa(){ga=null,ya=null,pa=null}function Ma(e){const n=e.heightCache;return(null==n?void 0:n.length)?qi(n):""}function wa(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:wr(),null!=(o=e.contentHash)?o:"",Ma(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 Ca(e,n=!1){if(!Jn.value)return;if(function(e=!1){return!e&&Xn.value&&!Zn.value}(n))return;const t=n||Na(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Si(e,{includeHeightCache:!0})}:{state:Si(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||wa(e)!==pa}(r,n)));if(t&&(L(e),va=e,ha=ka()),r&&i&&(P(r),r.anchor&&W(r.anchor),pa=wa(r)),e.stable){const n=Sa("settled",e);if(n!==ga){ga=n;const t=Si(e,{includeHeightCache:!0});t&&(P(t),pa=wa(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Sa("final",e);if(n!==ya){ya=n;const t=Si(e,{includeHeightCache:!0});t&&(P(t),pa=wa(t)),function(e){l("render-final",e)}(e)}}}function _a(){null!=da&&(null==ft||ft(da),da=null),null!=ma&&Le&&(window.clearTimeout(ma),ma=null)}function Ba(){da=null,ma=null,function(e){if(Ml.size>0||null!=Hl)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(ca)&&(Ea(),ia()),Ca(ai(ca))}function Ta(e){var n,t;if(!Jn.value)return;if(ca=e,null!=da||null!=ma)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(ka()-ha)),i=()=>{ma=null,da=dt?dt(Ba):null,null==da&&Ba()};Le&&r>0?ma=window.setTimeout(i,r):i()}function Oa(){ao.value+=1}function Ia(e){return!(_t.value&&e>=Tt.value)&&(!dl.value||e<yt.value||Dl.value.has(e))}function Aa(e){const n=ql.get(e);n&&(n(),ql.delete(e));const t=Vl.get(e);t&&(t.destroy(),Vl.delete(e)),Xl(e)}function Ha(e,n){let t=!1;if(n){const o=zt.get(e);zt.set(e,n),o!==n&&(t=!0)}else zt.delete(e)&&(t=!0);if(t&&Oa(),n||Xl(e),!hl.value||!ct)return Aa(e),void(n&&Gl(e,!0));if(!it.value&&dl.value&&!de.value&&Vl.size>=_e.value&&(de.value||(de.value=!0,d&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),Jl()),!hl.value||!ct))return Aa(e),void(n&&Gl(e,!0));if(e<yt.value&&!it.value)return Aa(e),void Gl(e,!0);if(Dl.value.has(e))return Aa(e),void Gl(e,!0);if(!n)return void Aa(e);Aa(e);const o=ct(n,{rootMargin:Ce.value});if(!o)return;Vl.set(e,o),Gl(e,o.isVisible.value),dl.value&&function(e){if(!Le||!dl.value)return;Xl(e);const n=e%17*23,t=window.setTimeout(()=>{if(Ul.delete(e),!dl.value)return;if(Dl.value.has(e))return;const n=zt.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?wn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?wn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=wn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&Gl(e,!0)},1800+n);Ul.set(e,t)}(e);let l=null;l=G(()=>o.isVisible.value,n=>{if(n){Xl(e),Gl(e,!0),null==l||l(),ql.delete(e),Vl.get(e)===o&&Vl.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),ql.set(e,l),it.value&&jl()}function La(){Hl=null,ll(()=>{let e=!1;for(const[n,t]of Ml)Ml.delete(n),Nl.get(n)===t.el&&bl.get(n)===t.version&&(e=ul(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function Ra(){null!=Hl&&(null==ft||ft(Hl),Hl=null),Ml.clear()}function $a(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Nl.get(e)!==n)return;const r=bl.get(e);if(null==r)return;const i=Hn.value[e],a=ln.value&&!0!==tn.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Hn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Ml.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Ml.set(e,{height:d,allowShrink:c,version:r,el:n}),null==Hl&&(Hl=dt?dt(La):null,null==Hl&&La())}(e,n,sl(e,n))}function Ea(){for(const[e,n]of Nl)n&&$a(e,n)}function Pa(){null==Ut||Ut.disconnect(),Ut=null,Dt.clear()}function Fa(){for(;xl.length;)El(xl.pop())}G(Zn,e=>{e&&Ta("content")},{flush:"post"}),n({getVirtualMetrics:ai,captureVirtualState:function(e={}){var n;return Si(ai("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);Ei=e,Pi={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!ta(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&la(e)||(Ei=null,Pi=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield aa(),Ea(),ia(),yield le();const n=ai(e);return Ca(n,!0),n})},settle:sa,scrollToNode:function(e,n="start"){Ci(),Ho();const t=Hn.value.length;if(t<=0)return;const o=nr(e,0,t-1),l=()=>{var e;const t=Ao({nodeIndex:o,offsetWithinNodePx:0}),l=Mo(o),r=ui(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=To();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}Oo(Math.max(0,u)),jl({immediate:!0}),it.value&&(gl.value=o,kl())};if(it.value)return gl.value=o,kl(),void le(l);l()}}),G(()=>at.value,e=>{if(!e){Pa();for(const e of Sl.values())for(const n of e)El(n);Sl.clear(),bl.clear(),Fa(),Ra()}},{immediate:!0}),G(tn,e=>{e&&function(){if(Le&&tn.value&&Nl.size){Fa();for(const e of[80,240,640]){const n=$l(e,()=>{for(const[e,n]of Nl)n&&$a(e,n)},"final");null!=n&&xl.push(n)}}}(),Ta(e?"final":"content")}),G([()=>Hn.value.length,()=>Tt.value],()=>{mo.value&&_i(),Ta("content")},{flush:"post",immediate:!0}),G([()=>yl.start,()=>yl.end],()=>{Ta("batch")},{flush:"post"});const{cleanupBatchScheduler:Ka}=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:N,onDatasetChanged:b}=e;let S=null,x=null,M=!1,w=null,C=null,_=0,B=!1,T=!1;const O=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function A(){if(t){null!=S&&(null==g||g(S),S=null),null!=x&&(window.clearTimeout(x),x=null),null!=C&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(C),C=null),_+=1;for(const e of O)null==g||g(e);O.clear();for(const e of I)window.clearTimeout(e);I.clear(),M=!1,w=null,B=!1,T=!1}}function H(){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.2*o?m.value=Math.max(r,Math.floor(.7*m.value)):e<.5*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),B=!1;const t=T||f.value<i.value;T=!1,t&&E()}function R(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=H();let o=0;S=null,x=null,C=null,M=!1;const l=null!=w?w:c;w=null;const r=H();f.value=Math.min(u,f.value+l),k(f.value),o=H()-r,function(e,o){if(!t)return void L(o);B=!0;const l=++_;le().then(()=>{var t;if(l!==_)return;const r=H(),i=Math.max(o,r-e),a=()=>{l===_&&L(i)};if(p){let e=!1,o=null;const l=()=>{e||(e=!0,a())},r=p(()=>{O.delete(r),null!=o&&(window.clearTimeout(o),I.delete(o),o=null),l()});return O.add(r),o=window.setTimeout(()=>{null!=o&&I.delete(o),o=null,null==g||g(r),O.delete(r),l()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,o)};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,!M){if(M=!0,!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return void(C=window.requestIdleCallback(()=>d(),{timeout:e}))}p&&!o?S=p(()=>{0!==m?x=window.setTimeout(()=>d(),m):d()}):x=window.setTimeout(()=>d(),m)}}function $(e,n={}){B?T=!0:null==e?E():R(e,n)}function E(){s.value&&R(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return G([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=p||g;h.value={key:u,total:o};const S=v.value,x=null!=(e=n.renderBatchDelay)?e:16,M=S.batchSize!==c.value||S.initial!==d.value||S.delay!==x||S.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:x,enabled:s.value},p&&N(o),(y||M||!s.value)&&A(),(y||M)&&(m.value=Math.max(1,c.value||1)),y&&b();const w=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=w,void k(f.value);const C=p||0===l.total;f.value=C||M?Math.min(w,d.value):Math.min(f.value,w);const _=Math.max(1,d.value||c.value||o);f.value<w?$(_,{immediate:!t}):k(f.value)},{immediate:!0}),G(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&$())}),{cleanupBatchScheduler:A}}({props:A,isClient:Le,isTestEnv:ht,parsedNodesIdentity:En,parsedNodeCount:Pn,desiredRenderedCount:Ll,datasetKey:Or,batchingEnabled:wt,incrementalRenderingActive:_t,resolvedBatchSize:gt,resolvedInitialBatch:yt,renderedCount:Tt,adaptiveBatchSize:Ht,previousRenderContext:It,previousBatchConfig:Lt,requestFrame:dt,cancelFrame:ft,hasIdleCallback:mt,cleanupNodeVisibility:Yl,onDatasetKeyChanged:e=>{Ra(),il(),So(),xa(),e>0&&Yo(e)},onDatasetChanged:()=>{it.value&&jl({immediate:!0})}});G([vl,it,()=>z.value,()=>Be()],([e,n])=>{if(!e)return Zl(),void zl();Ql(),n?jl({immediate:!0}):zl()},{flush:"post",immediate:!0}),G([()=>Hn.value.length,()=>it.value],e=>s(null,[e],function*([e,n]){n&&e&&Le&&(yield le(),jl({immediate:!0}))}),{flush:"post"}),G(Qn,e=>{e&&function(){var e;if(Fn.value&&Kn.value&&Wn.value&&(null==(e=zn.value)?void 0:e[1]))return;const n=fe({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=fe({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=fe({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Fn.value=n,Kn.value=t,Wn.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]=fe({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});zn.value=l}()},{immediate:!0}),G([()=>z.value,Qn],()=>{if(!Qn.value)return ur(),void(ge.value=0);ir(),ur(),Qn.value&&z.value&&"undefined"!=typeof ResizeObserver&&(ar=new ResizeObserver(()=>{ir(),_o.value&&Lo(),mo.value&&_i(),Ta("resize")}),ar.observe(z.value))},{immediate:!0}),G([Qn,ot,Br],()=>s(null,null,function*(){if(!Qn.value)return ye.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void So();yield le(),function(){if(!Qn.value||"undefined"==typeof window)return ye.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void So();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=lr(or(j.value),".paragraph-node");e.paragraph=Wr(j.value,n,"pre-wrap");const t=or(V.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=Wr(V.value,o,"pre-wrap");const l=wn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=J.value)?void 0:e.offsetHeight)?n:0}),r=wn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=lr(or(ne[i]),`h${i}`);e.headings[i]=Wr(ne[i],n,"pre-wrap")}ye.value=e,So()}()}),{flush:"post",immediate:!0}),G(()=>Hn.value.length,()=>{it.value&&jl({immediate:!0})}),G([Qn,ge],()=>{So(),it.value&&jl({immediate:!0}),_o.value&&Lo(),mo.value&&_i(),Ta("resize")},{immediate:!1}),G(()=>dl.value,e=>{if(e)for(const[n,t]of zt)Ha(n,t);else{Jl();for(const[e,n]of zt)n&&Gl(e,!0)}},{immediate:!1}),G([Ce,_e,()=>Be()],()=>{var e;null==(e=ct.refresh)||e.call(ct);for(const[n,t]of zt)Ha(n,t)},{immediate:!1}),G([()=>A.viewportPriority,()=>Hn.value.length,_e],([e,n,t])=>{if(!1!==e){if(de.value&&(n<=200||n<=t)){de.value=!1;for(const[e,n]of zt)Ha(e,n)}}else de.value=!1}),G(()=>Tt.value,()=>{it.value&&jl({immediate:!0})}),G([gl,lt,pl,()=>Hn.value.length,it],()=>{kl()},{immediate:!0});let Wa=null,za=!1,ja=null;function Da(){Wa=null,Gr=null,Dr=void 0,Yr=null,xa()}function Va(){Ra(),il(),So(),Gt.clear();const e=Hn.value.length;e>0&&Yo(e),ra()}function qa(){_a(),Pl(),va=null,Li=null,Ri=null,$i=null,Ei=null,Pi=null,za=!1,Da(),$r("restore"),Ho(),Ci()}function Ua(e){var n;return[null!=(n=xr())?n:"",Sr(),wr(),_r.value,ba(e),Hn.value.length,Math.round(wo(0,Hn.value.length)),Math.round(Cr()),Ko.count,Math.round(Ko.total)].join(":")}function Xa(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=ba(r),a=Sr(),u=xr(),s=Br.value;if(Jn.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&Jr(r))if(ni()){if(Ua(r)!==Yr&&!za){za=!0;try{const e=yield sa({reason:"manual",expectedSettledTokenKey:i}),n=ba()===i;ua(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(Yr=Ua(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{za=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=Jr(e)?Ua(e):"";ua(a,u,s)&&n&&Yr!==n&&Xa()}}}else Ta("manual")})}G(Jn,(e,n)=>{if(e!==n){if(!e)return qa(),void _a();qa(),Va(),ja=Br.value,Ta("content")}},{flush:"post"}),G([Jn,Br],([e,n])=>{e?null!=ja?ja!==n&&(ja=n,function(e="resize"){Ra(),il(),So(),Gt.clear();const n=Hn.value.length;n>0&&Yo(n),ra(),Li=null,Ri=null,$i=null,va=null,za=!1,Da(),Ui(),le(()=>{Ea(),_o.value&&Lo(),mo.value&&_i(),Ta(e)})}("resize")):ja=n:ja=null},{flush:"post",immediate:!0}),G([Jn,()=>Sr(),()=>xr()],([e])=>{e&&(qa(),Va(),$r("content"),Ta("content"))}),G([Jn,()=>Sr(),()=>xr(),Br,()=>Hn.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(Ol.entries()))Lr(o)||(Ol.delete(t),Tl.delete(t),n=!0);n&&(Hr(),Ta(e))}("async-node")},{flush:"post"}),G([Jn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>ve.value],([e])=>{e&&(xa(),function(e="content"){if(!Jn.value)return;const n=[],t=Hn.value.length,o=tr(t);for(const l of Array.from(Gt.keys())){if(l>=t){n.push(l);continue}if(l<o)continue;const e=ki(l),r=Gt.get(l);null!=r&&r!==e&&n.push(l),Gt.set(l,e)}for(const l of Array.from(Gt.keys()))l>=t&&Gt.delete(l);n.length&&(function(e,n={}){const t=Array.from(e,Number);ol(t);let o=0;if(ll(()=>(o=Zo(t,n),o>0)),o>0)!function(e){for(const n of e)Gt.delete(n)}(t);else for(const l of t)to.delete(l)}(n,{notify:!1}),So(),Da(),_o.value&&Lo(),mo.value&&_i(),Ta(e))}("content"))},{flush:"post",immediate:!0}),G([Jn,()=>Hn.value.length,()=>Sr(),()=>xr()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Da()},{flush:"post"}),G([Jn,()=>{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},()=>Hn.value.length,()=>Sr(),ge],()=>{Ui()},{flush:"post",immediate:!0}),G([Jn,()=>{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},()=>Hn.value.length,()=>Sr(),ge],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield le();const t=function(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}();ta(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),G([Jn,ge,()=>{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&&Li&&"restore"===Ri&&(Ii(t)||(Va(),Li=null,Ri=null,Ta("resize")))},{flush:"post"}),G([Jn,()=>Hn.value.length,()=>Sr(),ge],e=>s(null,[e],function*([e]){var n;const t=Ei,o=Pi;e&&t&&(yield le(),!ta(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)})&&la(t)||(Ei=null,Pi=null))}),{flush:"post",immediate:!0}),G([Jn,tn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Sr(),()=>xr(),Br,Al,Bl,()=>Tt.value,Ll,()=>Ko.count,()=>Ko.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!oi())return;const o=function(){var e;const n=Hn.value.length;return[null!=(e=xr())?e:"",Sr(),wr(),_r.value,n,Math.round(wo(0,n)),Math.round(Cr()),Ko.count,Math.round(Ko.total)].join(":")}();Wa!==o&&(Wa=o,sa({reason:"final"}).then(e=>{e.stable||Wa!==o||(Wa=null)}))},{flush:"post",immediate:!0}),G([Jn,tn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Sr(),()=>xr(),Br,Al,Bl,()=>Tt.value,Ll,()=>Hn.value.length,()=>Ko.count,()=>Ko.total],()=>{Xa()},{flush:"post",immediate:!0}),G([()=>Hn.value.length,it,lt,pl,()=>yl.start,()=>yl.end],([e,n,t,o,l,r])=>{We.value&&hn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:gl.value,scroll:n?(()=>{const e=co.value||Xe();return e?{reverse:Ge(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:Tt.value})}),G([()=>A.customId],([e],n,t)=>{if(!e||jn)return;const o=function(e,n){return e?(Tr.controllers[e]=n,()=>{Tr.controllers[e]===n&&delete Tr.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Ro,restoreAnchor:$o,getAnchorDrift:Eo,getReport:kr});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(Jn.value)try{Ea(),ia();const e=ai("manual");Na(e)&&(L(e),va=e,ha=ka());const n=Si(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(P(n),n.anchor&&W(n.anchor),pa=wa(n))}catch(e){}}(),Ka(),Jl(),fn(),Pa();for(const e of Sl.values())for(const n of e)El(n);Sl.clear(),bl.clear(),Gt.clear(),Fa(),Ra(),ur(),Ho(),Ci(),_a(),Zl(),zl()});const Ga=re({loader:()=>s(null,null,function*(){try{return(yield import("./index11.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),vt}}),loadingComponent:Yi,delay:0}),Ya=re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),vt}}),loadingComponent:Gi,delay:0}),Ja=re(()=>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),vt}})),Za={text:kt,paragraph:Io,heading:fo,code_block:bt,list:yo,list_item:go,blockquote:Qt,table:Fo,definition_list:oo,footnote:uo,footnote_reference:dn,footnote_anchor:ro,admonition:fa,vmr_container:Do,hardbreak:Vt,link:Et,image:rt,thematic_break:Wo,math_inline:St,math_block:xt,strong:Ot,emphasis:jt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,checkbox:rn,checkbox_input:rn,inline_code:_n,html_inline:Mn,reference:Mt,html_block:Bo},Qa=E(()=>Nr()),eu=E(()=>jr(A.codeBlockProps)),nu=E(()=>jr(A.codeBlockProps,{omit:["langs"]})),tu=E(()=>a(a({stream:A.codeBlockStream,darkTheme:A.codeBlockDarkTheme,lightTheme:A.codeBlockLightTheme,monacoOptions:A.codeBlockMonacoOptions,themes:A.themes,langs:"shiki"===p.value?A.langs:void 0,minWidth:A.codeBlockMinWidth,maxWidth:A.codeBlockMaxWidth},"boolean"==typeof ze.value?{showTooltips:ze.value}:{}),nu.value)),ou=E(()=>a(u(a({},tu.value),{langs:A.langs}),eu.value));function lu(e){return"boolean"==typeof e?e:void 0}const ru=E(()=>{const e=A.codeBlockProps||{},n={},t=lu(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const o=lu(e.diffInline);void 0!==o&&(n.diffInline=o);const l=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(e.reservedHeightPx);return void 0!==l&&(n.reservedHeightPx=l),n}),iu=E(()=>a(a({stream:A.codeBlockStream,darkTheme:A.codeBlockDarkTheme,lightTheme:A.codeBlockLightTheme,themes:A.themes,langs:A.langs,minWidth:A.codeBlockMinWidth,maxWidth:A.codeBlockMaxWidth},"boolean"==typeof ze.value?{showTooltips:ze.value}:{}),eu.value)),au=E(()=>a({},A.mermaidProps||{})),uu=E(()=>a({},A.d2Props||{})),su=E(()=>a({},A.infographicProps||{})),cu=E(()=>({typewriter:h.value,fade:A.fade,customHtmlTags:An.value.customHtmlTags})),du=E(()=>a(a({},cu.value),"boolean"==typeof ze.value?{showTooltip:ze.value}:{})),fu=E(()=>a(a({},cu.value),"boolean"==typeof ze.value?{showTooltips:ze.value}:{})),mu=E(()=>a(a({},cu.value),"boolean"==typeof ze.value?{showTooltips:ze.value}:{})),hu=E(()=>a(a({},cu.value),"boolean"==typeof ze.value?{showTooltips:ze.value}:{}));function vu(e){return Array.isArray(e.children)&&e.children.length>0}const pu=E(()=>vr.value.map(e=>{var n,t,o,l,r,i,s,c;let d=function(e){var n,t,o,l,r,i,u;if("code_block"!==e.type)return e;const s=e,c=[String(null!=(n=s.language)?n:""),String(null!=(t=s.loading)?t:""),String(null!=(o=s.diff)?o:""),String(null!=(l=s.code)?l:""),String(null!=(r=s.originalCode)?r:""),String(null!=(i=s.updatedCode)?i:""),String(null!=(u=s.raw)?u:"")].join("\0"),d=Xt.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return Xt.set(s,{signature:c,node:f}),f}(e.node);const f=gu(d);let m=Su(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===Za[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=On.value[r];if(In.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:H(e.content,r)});else if(_(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===d.type?(m=kt,d={type:"text",content:n,raw:n}):(m=Io,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h="code_block"===d.type&&"pre"===p.value&&m===vt&&!yu(On.value,f);let v=a({},function(e,n,t){const o=null!=n?n:gu(e);if("code_block"===e.type){const n=o?yu(On.value,o):void 0;if(t&&"pre"===p.value&&!n&&t===vt)return ru.value;if(t&&o&&t===n)return"mermaid"===o?Nu(e):"infographic"===o?bu(e):"d2"===o||"d2lang"===o?uu.value:ou.value;if(t&&t===On.value.code_block)return ou.value;if(cr(t))return iu.value}return"mermaid"===o?Nu(e):"infographic"===o?bu(e):"d2"===o||"d2lang"===o?uu.value:"link"===e.type?du.value:"list"===e.type?fu.value:"blockquote"===e.type?mu.value:"table"===e.type?hu.value:"code_block"===e.type?tu.value:cu.value}(d,f,m));const g=Qn.value?hr.value[e.index]:null;"code_block"===d.type&&"code-block"===(null==g?void 0:g.kind)&&(v=u(a({},v),h?{reservedHeightPx:null!=(r=g.height)?r:g.contentHeight}:{estimatedHeightPx:g.height,estimatedContentHeightPx:g.contentHeight})),h||"code_block"!==d.type||"mermaid"!==f||null!=Ee(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Fe(Ke(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Ee(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:$e(Pe(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:Tn.value}));const y=function(e,n){const t=String(e.type);return!Ue(t)&&On.value[t]===n}(d,m),k=y?gn(d,je.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=k?k:{}),v),rendersCustomNode:y,hasSlotChildren:vu(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${Qa.value}-${e.index}`})}));function gu(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function yu(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Ae(t),Oe(t)]){const n=o&&e[o];if(n)return n}}function ku(e,n,t,o){var l,r;const i=a({},e.value);return null==Ee(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Ee(i.maxHeight))?r:void 0)),i}function Nu(e){return ku(au,e,Ke,Fe)}function bu(e){return ku(su,e,Pe,$e)}function Su(e,n){if(!e)return jo;const t=On.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:gu(e),r=l?yu(t,l):void 0;if(r)return r;if("pre"===p.value)return t.code_block||vt;if("mermaid"===l)return t.mermaid||Ga;if("infographic"===l)return t.infographic||Ya;if("d2"===l||"d2lang"===l)return t.d2||Ja;if(o)return o;return t.code_block||dr.value}return o||Za[String(e.type)]||jo}function xu(e){l("click",e)}function Mu(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function wu(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function Cu(e){l("mouseover",e)}function _u(e){l("mouseout",e)}const Bu=X(null),Tu=X(!1),Ou=X(null),Iu=E(()=>!("minimal"!==A.domMode||Re.value||!1!==A.fade||h.value||Tu.value||Rt.value||it.value||Gn.value||qn.value||st.value||0!==Object.keys(On.value).length));let Au,Hu=null,Lu=0,Ru=0,$u=0;const Eu=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Pu=new Set(Eu),Fu=[".typewriter-cursor",".height-estimation-probes",...Eu.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Ku(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Pu.has(n)}function Wu(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+Wu(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Wu(n),0):0}function zu(){Au&&(clearTimeout(Au),Au=void 0)}function ju(){Lu+=1,null!=Hu&&(null==ft||ft(Hu),Hu=null)}function Du(){ju(),Xu(),Bu.value&&(Bu.value.style.visibility="hidden")}function Vu(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(Fu)}function qu(e){let n=e.lastChild;for(;n;){if(Vu(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Fu)&&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 Uu(){const e=pu.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Ku(t.node)||!Ia(t.index))continue;const o=zt.get(t.index);if(!o)continue;const l=qu(o);if(l)return l}return null}function Xu(){Ou.value&&(Ou.value.classList.remove(na),Ou.value=null)}function Gu(){if("simple"!==m.value||!Le||!Tu.value||!z.value)return void Xu();const e=Uu(),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!==Ou.value&&(Xu(),n&&(n.classList.add(na),Ou.value=n))}function Yu(){if("precise"!==m.value)return;if(!Le||!Tu.value)return;if(null!=Hu)return;const e=Lu,n=()=>{Hu=null,e===Lu&&function(){var e,n;if("precise"!==m.value)return;if(!(Le&&Tu.value&&z.value&&Bu.value))return;const t=z.value,o=Bu.value;o.style.visibility="hidden";const l=Uu();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=wn("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")}()};dt?Hu=dt(n):n()}return G([en,()=>o.content,()=>o.nodes,()=>A.typewriter,tn],()=>s(null,null,function*(){var e,n;if(!Le||Re.value||!Ve.value)return;if(tn.value)return Tu.value=!1,zu(),void Du();if(null==(e=o.nodes)?void 0:e.length)return Tu.value=!1,zu(),Du(),Ru=(null!=(n=o.content)?n:"").length,void($u=en.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Wu(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+Wu(n),0):en.value.length}(),r=!Ku(Hn.value[Hn.value.length-1]),i=t>Ru,a=l>$u;if(!h.value||!r||!i&&!a)return h.value&&r||(Tu.value=!1,Du()),Ru=t,void($u=l);Ru=t,$u=l,Tu.value=!0,"precise"===m.value&&Bu.value&&(Bu.value.style.visibility="hidden"),zu(),yield le(),"simple"===m.value?Gu():(Xu(),Yu()),Au=setTimeout(()=>{Au=void 0,Tu.value=!1},3e3)}),{flush:"post",immediate:!0}),G(Tu,e=>s(null,null,function*(){e?(yield le(),"simple"!==m.value?(Xu(),"precise"===m.value&&Yu()):Gu()):Du()}),{flush:"post"}),G(m,()=>s(null,null,function*(){if(Le&&!Re.value&&Ve.value&&Tu.value){if(yield le(),"simple"===m.value)return ju(),void Gu();Xu(),"precise"!==m.value?Du():Yu()}}),{flush:"post"}),G([()=>Tt.value,()=>yl.start,()=>yl.end],()=>s(null,null,function*(){Le&&!Re.value&&Ve.value&&Tu.value&&(yield le(),"simple"!==m.value?(Xu(),"precise"===m.value&&Yu()):Gu())}),{flush:"post"}),ee(()=>{zu(),ju(),Xu(),Bn.clear()}),(e,n)=>{const t=Se("NodeRenderer",!0);return q(Re)?(F(!0),K(Y,{key:0},ce(pu.value,e=>(F(),K(Y,{key:e.index},[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":A.customId,"is-dark":A.isDark,onClick:xu,onMouseover:Cu,onMouseout:_u,onCopy:n[0]||(n[0]=e=>l("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},$n.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(),ie(t,ue({key:1,ref_for:!0},$n.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":A.customId,"is-dark":A.isDark,onClick:xu,onMouseover:Cu,onMouseout:_u,onCopy:n[2]||(n[2]=e=>l("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(F(),K("div",{key:1,ref_key:"containerRef",ref:z,class:D(["markstream-vue markdown-renderer",[{dark:A.isDark},{virtualized:it.value},{"virtual-scroll-coordinated":Zn.value},{"stable-layout":ml.value},{"typewriter-simple-cursor":Tu.value&&"simple"===m.value}]]),"data-custom-id":A.customId,onClick:xu,onMouseover:Mu,onMouseout:wu},[et.value||it.value?(F(),K(Y,{key:0},[et.value?(F(),ie(Xi,{key:0,width:ot.value,"flow-root":it.value||Zn.value,"paragraph-node":Fn.value,"list-item-node":Kn.value,"list-node":Wn.value,"heading-nodes":zn.value,"set-paragraph-wrapper":Fl,"set-list-item-wrapper":Kl,"set-list-wrapper":Wl,"set-heading-wrapper":rr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Z("",!0),it.value?(F(),K("div",{key:1,class:"node-spacer",style:se({height:`${pr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],64)):Z("",!0),Iu.value?(F(!0),K(Y,{key:1},ce(pu.value,e=>(F(),K(Y,{key:e.index},[Ia(e.index)?(F(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":A.customId,"is-dark":A.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>l("copy",e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):Z("",!0)],64))),128)):(F(!0),K(Y,{key:2},ce(pu.value,e=>(F(),K("div",{key:e.index,ref_for:!0,ref:n=>Ha(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[Ia(e.index)?(F(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Nr()}-${e}`;let t=!1;for(const o of Array.from(Tl.keys())){const l=Ol.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Tl.delete(o),Ol.delete(o),t=!0)}t&&(Hr(),Ta("async-node"))}(e),Ml.delete(e),function(e){var n;const t=(null!=(n=bl.get(e))?n:0)+1;bl.set(e,t)}(e);const o=Sl.get(e);if(o){for(const e of o)El(e);Sl.delete(e)}if(function(e){const n=Dt.get(e);n&&(null==Ut||Ut.unobserve(n),qt.delete(n),Dt.delete(e))}(e),!n||!at.value)return Nl.delete(e),void bl.delete(e);Nl.set(e,n);const l=()=>{$a(e,n)};queueMicrotask(l);const r=(Ut||"undefined"==typeof ResizeObserver||(Ut=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=qt.get(n.target),t=Dt.get(null!=e?e:-1);null!=e&&t&&$a(e,t)}else Ea()})),Ut);if(r&&(Dt.set(e,n),qt.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=Hn.value[e])?void 0:t.type)?[16,80,240,800]:tn.value?[80]:[];if(n.length){const t=n.map(e=>$l(e,l,"node-resize")).filter(e=>null!=e);t.length&&Sl.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":A.customId,"is-dark":A.isDark,onCopy:n[12]||(n[12]=e=>l("copy",e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},$n.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(),ie(t,ue({key:1,ref_for:!0},$n.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":A.customId,"is-dark":A.isDark,onCopy:n[14]||(n[14]=e=>l("copy",e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(te,{key:0,name:"fade",css:!1!==A.fade,appear:!1!==A.fade},{default:oe(()=>[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":A.customId,"is-dark":A.isDark,onCopy:n[8]||(n[8]=e=>l("copy",e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},$n.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(),ie(t,ue({key:1,ref_for:!0},$n.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":A.customId,"is-dark":A.isDark,onCopy:n[10]||(n[10]=e=>l("copy",e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(F(),K("div",{key:1,class:"node-placeholder",style:se({height:`${Mo(e.index)}px`})},null,4))],8,ea))),128)),Tu.value&&"precise"===m.value?(F(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:Bu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Z("",!0),it.value?(F(),K("div",{key:4,class:"node-spacer",style:se({height:`${gr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],42,Qi))}}})),[["__scopeId","data-v-c4661863"]]),oa=ta;oa.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",oa.__name,oa.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,ta)};const la=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:oa},Symbol.toStringTag,{value:"Module"})),ra={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"},ia={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"},aa={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"},sa={class:"admonition-title"},ca=["aria-expanded","aria-controls"],da=["id"],fa=/* @__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=E(()=>{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=X(!!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(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[W("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),K("svg",ra,[...t[1]||(t[1]=[W("circle",{cx:"12",cy:"12",r:"10"},null,-1),W("path",{d:"M12 16v-4"},null,-1),W("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(F(),K("svg",ia,[...t[2]||(t[2]=[W("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),W("path",{d:"M9 18h6"},null,-1),W("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(F(),K("svg",aa,[...t[3]||(t[3]=[W("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),W("path",{d:"M12 9v4"},null,-1),W("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(F(),K("svg",ua,[...t[4]||(t[4]=[W("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),W("path",{d:"M12 8v4"},null,-1),W("path",{d:"M12 16h.01"},null,-1)])])):Z("",!0),W("span",sa,z(r.value),1),o.node.collapsible?(F(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),K("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]=[W("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,ca)):Z("",!0)]),xe(W("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(oa),{"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,da),[[Me,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);fa.install=e=>{e.component(fa.__name,fa)};const ma=()=>import("@terrastruct/d2");let ha=null,va=ma,pa=null,ga=!1,ya=!1,ka=0;function Na(e){va=e,ka++,ha=null,pa=null,ga=!1,ya=!1}function ba(e){Na(null!=e?e:ma)}function Sa(){Na(null)}function xa(){return"function"==typeof va}function Ma(){return s(this,null,function*(){if(ha)return ha;const e=va,n=ka;return e?e===ma&&ga?null:pa||(pa=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===ma)return n===ka&&e===va&&(ga=!0,function(e){ya||(ya=!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===ka&&e===va&&(pa=null)}return n!==ka||e!==va?null:t?(ha=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),ha):null}),pa):null})}let wa=null,Ca=null,_a=null,Ba=0;function Ta(e){Ca=null!=e?e:null,wa=null,_a=null,Ba++}function Oa(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Ta(e)}function Ia(){Ta()}function Aa(){return"function"==typeof Ca}function Ha(){return s(this,null,function*(){if(wa)return wa;const e=Ca,n=Ba;return e?_a||(_a=s(null,null,function*(){const t=yield e();if(n!==Ba||e!==Ca)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!==Ba||e!==Ca?null:o?(wa=o,wa):null}).finally(()=>{n===Ba&&e===Ca&&(_a=null)}),_a):null})}function La(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function Ra(e,n){null==e||e(n)}function $a(e,n){return e?(Ra(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Ea(e,n){const t=$a(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;Ra(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=La(o.marginTop),r=La(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function Pa(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):Ea(e,n),r=$a(o,n);return Math.max(0,l-r)}function Fa(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 Ka(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 Wa(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 za(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 ja(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function Da(e,n,t){const o=Ka(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&Wa(e,n,t).length>0}function Va(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=Ka(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:Wa(e,n,t).length>0?360:96}function qa(e){const n=pe(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=pe(/* @__PURE__ */new Map),l=pe(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=X(!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 N,b=!1,S=null,x=!1,M=null;function w(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):(le(e),null)}function _(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function B(){return[...Ce(e.items)]}function T(){const n=Ce(e.threadKey);return null==n?void 0:String(n)}function O(n,t){return Fa(n,t,e)}function I(n,t){return Da(n,t,e)}function A(n,t){const o=O(n,t),l=T(),r=ja(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function H(){const n=Ce(e.measurementKey);return null==n?void 0:String(n)}function L(){const n=Ce(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){const n=Ce(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===L()?"monaco":"pre"}function $(){var e;return`${null!=(e=H())?e:""}${L()}${R()}`}function E(n,t){if(I(n,t))return A(n,t);const o=O(n,t),l=T(),r=ja(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function P(e){const n=B();for(let t=0;t<n.length;t++){const o=n[t];if(O(o,t)===e)return{item:o,index:t}}return null}function F(e,n){var t;const o=P(e);if(!o||!n)return!1;if(n.sourceKey!==E(o.item,o.index))return!1;const l=I(o.item,o.index)?$():H();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!F(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function W(e,n){var t,o;const l=P(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===A(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=T())?o:"")&&function(e){const n=$(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function z(e,n){return W(e,n)}function j(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(!z(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:(j(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return W(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 U(){if(!x)return;x=!1,M=null;const e=N;N=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 Y(o,l,r=function(e){const n=P(e);return n?function(e,n){const t=I(e,n)?$():H();return a({sourceKey:E(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!=(b=null==c?void 0:c.widthBucket)?b:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,b,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&&le(()=>{ue(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,e)}))})}();const w=!1!==e.preserveScrollAnchor,_=w?re():void 0,B=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),T=w&&B<=2,O=w&&B<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var A;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),w&&((A=T?{type:"bottom",distanceFromBottomPx:0}:O?{type:"bottom",distanceFromBottomPx:B}:_)&&(x||(N=A,x=!0,M=C(U))))}function J(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Z(){if(!b)return;b=!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});U()}function Q(){Z(),U()}function ee(n,t={}){const o=function(e){return Ea(s.get(e),w)}(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=P(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 Pa(s.get(e),w,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=P(n);return c&&!Wa(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 ne(){const e={},n=B();for(let t=0;t<n.length;t++){const o=O(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function te(){const e={},n=B();for(let o=0;o<n.length;o++){const l=O(n[o],o),r=t.get(l);F(l,r)&&(e[l]=r)}return e}function oe(){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=B();for(let a=0;a<l.length;a++){const t=O(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:O(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=H())?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&&F(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 ce(){G(),_(M),x=!1,M=null,N=void 0,_(S),b=!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()&&ge(ce),{itemHeights:n,markdownStates:o,getItemKey:O,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=O(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 J(i);if(u===a)return void ee(i);if(J(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;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ee(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=O(n,t),r=za(n,t,e),a=T(),u=Wa(n,t,e),s=A(n,t),c=$(),d=L(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=we(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=z(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:z(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:96,heightDiffThresholdPx:4},g={content:u,final:r,mode:d,codeRenderer:f,nodeVirtual:!1,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==A(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:$()});const o=function(e){return"final"===e.phase||!0===e.final&&("measured"===e.confidence||"final"===e.confidence)||!!e.stable&&("measured"===e.confidence||"final"===e.confidence)}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),b||(b=!0,S=C(Z))},onVirtualStateChange(e){e.sessionKey===A(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=H();return u(a({threadKey:T()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:oe()})},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),le(()=>{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:ce}}const Ua=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function Xa(e){return re(e)}const Ga=Xa(()=>import("./index3.js")),Ya=Xa(()=>import("./index5.js")),Ja=Xa(()=>import("./index6.js")),Za=Xa(()=>import("./index11.js")),Qa=Xa(()=>import("./index10.js")),eu=Xa(()=>import("./index7.js")),nu=Xa(()=>import("./index4.js")),tu=Xa(()=>import("./index8.js")),ou=Xa(()=>import("./index9.js")),lu={MarkdownRender:oa,NodeRenderer:oa,AdmonitionNode:fa,BlockquoteNode:Qt,CheckboxNode:rn,CodeBlockNode:Ga,DefinitionListNode:oo,EmojiNode:un,EmphasisNode:jt,FootnoteNode:uo,FootnoteReferenceNode:dn,FootnoteAnchorNode:ro,HardBreakNode:Vt,HeadingNode:fo,HtmlBlockNode:Bo,HtmlInlineNode:Mn,HighlightNode:Wt,ImageNode:rt,D2BlockNode:eu,InfographicBlockNode:Qa,InlineCodeNode:_n,PreCodeNode:vt,InsertNode:Ft,LinkNode:Et,ListItemNode:go,ListNode:yo,MathBlockNode:Ya,MathInlineNode:Ja,MermaidBlockNode:Za,ParagraphNode:Io,StrikethroughNode:At,StrongNode:Ot,SubscriptNode:Bt,SuperscriptNode:Ct,TableNode:Fo,TextNode:kt,ThematicBreakNode:Wo,VmrContainerNode:Do,ReferenceNode:Mt,MarkdownCodeBlockNode:tu,MarkstreamVirtualTimeline:ou,Tooltip:nu},ru={install(e,n){var t,o;Object.entries(lu).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&He(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(Ua,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&Le(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&L(n.mathOptions),n&&"infographicLoader"in n&&Ta(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(qn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(Ve,function(e={}){return R(Ge(e))}(n.components))}};export{Ha as $,fa as A,Qt as B,rn as C,eu as D,un as E,ro as F,ln as G,Vt as H,rt as I,vt as J,uo as K,Et as L,Ua as M,en as N,Sa as O,Io as P,Ia as Q,Mt as R,At as S,Fo as T,ba as U,Do as V,Oa as W,Va as X,Je as Y,Ma as Z,fo as _,Ga as a,Pa as a0,Wa as a1,za as a2,Fa as a3,Ka as a4,ja as a5,Dn as a6,xa as a7,Vr as a8,Aa as a9,Da as aa,Ea as ab,Qe as ac,Zn as ad,Ye as ae,Na as af,Un as ag,Ta as ah,jn as ai,qa as aj,Gr as ak,Jn as al,Wi as am,Mo as an,So as ao,bo as b,oo as c,jt as d,dn as e,Wt as f,Bo as g,Mn as h,Qa as i,_n as j,Ft as k,go as l,yo as m,tu as n,ou as o,Ya as p,Ja as q,Za as r,Ot as s,Bt as t,Ct as u,kt as v,Wo as w,nu as x,ru as y,oa 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,hasCustomHtmlComponents as f,sanitizeHtmlAttrs as m,sanitizeHtmlTokenAttrs as h,tokenAttrsToRecord as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,isCustomHtmlComponentTag as N,sanitizeHtmlContent as b,sanitizeImageSrc as S,shouldOpenLinkInNewTab as x,NON_STRUCTURING_HTML_TAGS as M,normalizeCustomHtmlTags as w,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as I,resolveCustomHtmlTags as T,parseMarkdownToStructure as O,EXTENDED_STANDARD_HTML_TAGS as A,stripCustomHtmlWrapper as L,setDefaultMathOptions as H}from"stream-markdown-parser";import{shallowRef as R,inject as $,computed as E,defineComponent as P,openBlock as F,createElementBlock as K,createElementVNode as W,toDisplayString as j,h as z,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as X,watch as G,Fragment as Y,createTextVNode as J,createCommentVNode as Z,getCurrentInstance as Q,onBeforeUnmount as ee,renderSlot as ne,Transition as te,withCtx as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,normalizeStyle as se,renderList as ce,readonly as de,markRaw as fe,provide as me,normalizeProps as he,guardReactiveProps as ve,reactive as pe,onScopeDispose as ge,getCurrentScope as ye,onMounted as ke,watchEffect as Ne,triggerRef as be,resolveComponent as Se,withDirectives as xe,vShow as Me,toRaw as we,toValue as Ce}from"vue";import{resolveStreamingTextUpdate as _e,createSmoothMarkdownStream as Be,getHighlightRegistrationKey as Ie,normalizeShikiLanguage as Te}from"markstream-core";import{M as Oe,n as Ae,s as Le,j as He}from"./index2.js";import{b as Re}from"./workers-katexWorkerClient.js";import{c as $e,p as Ee,e as Pe,a as Fe,b 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 We="__global__",je="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ze=(()=>{const e=globalThis;if(e[je])return e[je];const n={scopedCustomComponents:{},revision:R(0)};return e[je]=n,n})(),De=ze.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 Xe(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(Xe(t))]))!e||Ue(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Ye(e,n){"string"==typeof e?ze.scopedCustomComponents[e]=Ge(n||{}):ze.scopedCustomComponents[We]=Ge(e||{}),De.value++}function Je(e){const n=Ge(ze.scopedCustomComponents[We]||{});if(!e)return n;const t=Ge(ze.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=$(Ve,null);return E(()=>{var t;return De.value,function(e,n={}){return De.value,a(a(a({},Ge(ze.scopedCustomComponents[We]||{})),Ge(n)),Ge(function(e){return e&&ze.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Qe(e){if(e===We)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ze.scopedCustomComponents[e],De.value++}function en(){delete ze.scopedCustomComponents[We],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(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),K("svg",on,[...t[1]||(t[1]=[W("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),W("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(),K("svg",tn,[...t[0]||(t[0]=[W("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(),K("span",an,j(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(),K("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[W("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+j(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="safe",t){return m(e,n,t)}function vn(e){return p(e)}function pn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function gn(e,n="safe"){const t=String(e.tag||e.type||"").trim(),o=h((l=e.attrs)?Array.isArray(l)?l.every(Array.isArray)?l.map(([e,n])=>[String(e),pn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),pn(e.value)]):Object.entries(l).map(([e,n])=>[e,pn(n)]):null,n,t);var l;if(!o)return;const r=vn(v(o));return Object.keys(r).length>0?r:void 0}function yn(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 kn(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=function(e,n){return N(e,n)}(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&k(e,r))return i?[yn(e,n,!0)]:[yn(e,n),...t,`</${e}>`];const c=m(n,r,e),d=c.key,f=null!=d&&""!==d?d:l;if(s){const n=o[e]||o[e.toLowerCase()],l=vn(c);return z(n,u(a({},l),{key:f}),t.length>0?t:void 0)}return z(e,u(a({},c),{innerHTML:void 0,key:f}),t.length>0?t:void 0)}function bn(e,n){return f(e,n)}function Sn(e,n,t="safe"){if(!e)return[];try{const o=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);kn(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?kn(l[l.length-1].children,a):kn(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?kn(l[l.length-1].children,o):kn(r,o),mn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,fn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xn=["innerHTML"],Mn=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=E(()=>{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=E(()=>{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};if(n.node.loading&&n.node.autoClosed){const n=Sn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!bn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=Sn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(F(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},j(i.value.content),3)):(F(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,xn))}}),[["__scopeId","data-v-d17f12b0"]]);Mn.install=e=>{e.component(Mn.__name,Mn)};const wn={class:"inline-code"},Cn={key:0},_n=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=$("markstreamFade",void 0),l=$("markstreamTextStreamState",void 0),r=$("markstreamStreamVersion",void 0),i=E(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=E(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=E(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=E(()=>!a.value),c=E(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=X(n.node.code),f=X("");let m=null==r?void 0:r.value;const h=X(0);function v(){return d.value+f.value}function p(){f.value&&(d.value=v(),f.value="")}G([()=>n.node.code,c,a,()=>null==r?void 0:r.value],([e,n,t,o])=>{const r=String(null!=e?e:""),i=c.value,u=o!==m;m=o;const s=_e({nextContent:r,persistedContent:i?null==l?void 0:l.get(i):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value,streamRenderVersionChanged:u});d.value=s.settledContent,f.value=s.streamedDelta,s.appended&&(h.value+=1),i&&(null==l||l.set(i,r))},{immediate:!0}),G(a,e=>{var n;e||(n=v(),d.value=n,f.value="")});const g=E(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),K("code",wn,[s.value?(F(),K(Y,{key:0},[J(j(u.value),1)],64)):(F(),K(Y,{key:1},[d.value?(F(),K("span",Cn,j(d.value),1)):Z("",!0),f.value?(F(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},j(f.value),35)):Z("",!0)],64))]))}}),[["__scopeId","data-v-9c5f6e69"]]);_n.install=e=>{e.component(_n.__name,_n)};const Bn=X(!1),In=X(""),Tn=X("top"),On=X(null),An=X(null),Ln=X(null),Hn=X(null),Rn=X(null);let $n=null,En=null,Pn=0;function Fn(){$n&&(clearTimeout($n),$n=null),En&&(clearTimeout(En),En=null)}let Kn=!1,Wn=null,jn=!1;function zn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Pn;Fn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!Kn&&!jn&&"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:Bn.value,"anchor-el":On.value,content:In.value,placement:Tn.value,id:An.value,originX:Ln.value,originY:Hn.value,isDark:null!=(e=Rn.value)?e:void 0})}}).mount(o),Kn=!0}));try{yield Wn}catch(e){Kn=!1,Wn=null,jn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),Kn&&i===Pn){An.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,On.value=e,In.value=n,Tn.value=t,Ln.value=null!=(o=null==l?void 0:l.x)?o:null,Hn.value=null!=(a=null==l?void 0:l.y)?a:null,Rn.value="boolean"==typeof r?r:null,Bn.value=!0;try{e.setAttribute("aria-describedby",An.value)}catch(u){}}});o?a():$n=setTimeout(a,80)}function Dn(e=!1){Pn+=1,Fn();const n=()=>{if(On.value&&An.value)try{On.value.removeAttribute("aria-describedby")}catch(e){}Bn.value=!1,On.value=null,An.value=null,Ln.value=null,Hn.value=null};e?n():En=setTimeout(n,120)}const Vn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},qn=/* @__PURE__ */Symbol("markstreamI18nFallback");function Un(e){Object.assign(Vn,e)}function Xn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:Vn[e]}const Gn=(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 Yn(e,n){return{t(t){const o=Xn(t,n);if(e.te&&null!=o&&!e.te(t))return Gn(t,n);const l=e.t(t);return l===t&&null!=o?Gn(t,n):l}}}function Jn(){const e=function(){var e,n,t;try{const o=Q(),l=qn,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=>Gn(n,e)}}function Zn(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 Qn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],et={key:1,class:"image-placeholder"},nt={key:1,class:"image-node__raw-text"},tt={key:0,class:"image-shimmer-overlay"},ot={key:1,class:"image-node__raw-text"},lt={key:2,class:"image-error"},rt=/* @__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}){const t=e,o=n,l=X(!1),r=X(!1),i=X(""),a=X("primary"),u=X(null),c=U(),d=$(Oe,null);let f="",m=null;const h=E(()=>S(t.node.src)),v=E(()=>S(t.fallbackSrc)),p=E(()=>i.value),g=E(()=>!t.lazy),y=E(()=>!t.node.loading&&"failed"!==a.value&&i.value.length>0),k=E(()=>"failed"===a.value),N=E(()=>!g.value&&!l.value&&!r.value&&"failed"!==a.value&&i.value.length>0),b=E(()=>Zn(t,c));function x(e=b.value){e&&u.value&&(null==d||d.reportHeight(e,u.value.offsetHeight))}function M(e=b.value){e&&le(()=>{x(e)})}function w(){m&&(clearTimeout(m),m=null)}function C(){const e=b.value;e&&f!==e&&(f&&(null==d||d.markSettled(f)),w(),f=e,null==d||d.markPending(e),"undefined"!=typeof window&&(m=window.setTimeout(()=>{f===e&&(M(e),_())},8e3)))}function _(){return s(this,null,function*(){const e=f;e&&(w(),f="",yield le(),x(e),null==d||d.markSettled(e))})}function B(){if("primary"===a.value&&v.value&&v.value!==i.value)return a.value="fallback",i.value=v.value,l.value=!1,r.value=!1,void M();a.value="failed",r.value=!0,o("error",i.value),M()}function I(){l.value=!0,r.value=!1,o("load",p.value),M()}function T(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,p.value])}const{t:O}=Jn();return G([h,v,()=>t.node.loading],()=>(l.value=!1,r.value=!1,t.node.loading||h.value?(i.value=h.value,void(a.value="primary")):v.value?(i.value=v.value,void(a.value="fallback")):(i.value="",a.value="failed",void(r.value=!0))),{immediate:!0}),G([y,l,r,p,()=>t.lazy],([e,n,t,o,l])=>e&&o&&!t?n?(_(),void M()):l?(C(),void M()):void(n||t||C()):(_(),void M()),{flush:"post",immediate:!0}),ee(()=>{!function(){const e=f;e&&(w(),f="",null==d||d.markSettled(e))}()}),(n,o)=>{var i,a,s,c,d;return F(),K("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(F(),K("img",{key:0,src:p.value,alt:String(null!=(a=null!=(i=t.node.alt)?i:t.node.title)?a:""),title:String(null!=(c=null!=(s=t.node.title)?s:t.node.alt)?c:""),class:D(["image-node__img",{"is-loading":!g.value&&!l.value,"is-loaded":g.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:g.value?"high":void 0,decoding:g.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(d=t.node.alt)?d:q(O)("image.preview"),onError:B,onLoad:I,onClick:T},null,42,Qn)):Z("",!0),e.node.loading&&!r.value?(F(),K("span",et,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=W("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",nt,j(e.node.raw),1))])):Z("",!0),V(te,{name:"shimmer-fade"},{default:oe(()=>[N.value&&!e.node.loading?(F(),K("span",tt,[t.usePlaceholder?ne(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=W("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",ot,j(e.node.raw),1))])):Z("",!0)]),_:3}),k.value?(F(),K("span",lt,[ne(n.$slots,"error",{node:t.node,displaySrc:p.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[2]||(o[2]=W("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[W("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),W("span",null,j(q(O)("image.loadError")),1)],!0)])):Z("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);rt.install=e=>{e.component(rt.__name,rt)};const it={key:2},at=/* @__PURE__ */P({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Ze(()=>n.customId),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamNestedRendererProps",void 0),r=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=E(()=>{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=re({loader:()=>Promise.resolve().then(()=>ra),suspensible:!1}),c=E(()=>n.components[String(n.node.type)]),d=E(()=>Boolean(c.value&&t.value[n.node.type]&&!Ue(String(n.node.type)))),f=E(()=>d.value?gn(n.node,r.value):void 0),m=E(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=E(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=E(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(F(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:oe(()=>[m.value?(F(),ie(q(s),ue({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"])):h.value?(F(),ie(q(s),ue({key:1},i.value,{content:h.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"])):c.value?(F(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(F(),K("span",it,j(v.value),1)):Z("",!0)}}),ut=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],st={key:0,translate:"no",class:"markstream-pre__diff-code"},ct={class:"markstream-pre__diff-number","aria-hidden":"true"},dt={class:"markstream-pre__diff-content"},ft={class:"markstream-pre__diff-content-inner"},mt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},ht=["textContent"],vt=/* @__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;function t(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}const o=E(()=>{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"}),l=E(()=>`language-${o.value}`),r=E(()=>{var e;return!0===n.loading||!0===(null==(e=n.node)?void 0:e.loading)}),i=E(()=>{var e;return t(null==(e=n.node)?void 0:e.code,r.value)}),s=E(()=>i.value.split(/\r\n|\n|\r/)),c=E(()=>Array.from({length:Math.max(1,s.value.length)},(e,n)=>n+1)),d=E(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),f=E(()=>d.value&&!0===n.diffInline),m=E(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return r.value?{maxHeight:t,overflow:"auto"}:{height:t,minHeight:t,maxHeight:t,overflow:"auto"}}),h=["diff ","index ","--- ","+++ ","@@ "];function v(e){return 0===String(null!=e?e:"").trim().length}function p(e,n="context",t={}){const o=v(e);return{code:e,kind:o&&"hunk"!==n&&"spacer"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function g(e){const n=t(e,r.value);return n?n.split(/\r\n|\n|\r/):[]}function y(e,n){return!v(e[n])||n<e.length-1}function k(e){return e.startsWith("-")&&!e.startsWith("---")}function N(e){return e.startsWith("+")&&!e.startsWith("+++")}function b(e){return e.some(e=>h.some(n=>e.startsWith(n)))}function S(e,n){return n||!e.startsWith(" ")||e.startsWith(" ")?e:` ${e}`}function x(e,n){const t=e.length,o=n.length,l=[];let i=0;for(;i<t&&i<o&&e[i]===n[i];)l.push({originalIndex:i,modifiedIndex:i}),i++;const a=[];let u=t-1,s=o-1;for(;u>=i&&s>=i&&e[u]===n[s];)a.unshift({originalIndex:u,modifiedIndex:s}),u--,s--;const c=u-i+1,d=s-i+1;if(c<=0||d<=0)return l.concat(a);if(r.value)return l.concat(a);if((c+1)*(d+1)>15e5)return l.concat(a);const f=d+1,m=new Uint32Array((c+1)*(d+1));for(let r=c-1;r>=0;r--)for(let t=d-1;t>=0;t--){const o=r*f+t;if(e[i+r]===n[i+t])m[o]=m[(r+1)*f+t+1]+1;else{const e=m[(r+1)*f+t],n=m[r*f+t+1];m[o]=e>=n?e:n}}const h=[];let v=0,p=0;for(;v<c&&p<d;)e[i+v]===n[i+p]?(h.push({originalIndex:i+v,modifiedIndex:i+p}),v++,p++):m[(v+1)*f+p]>=m[v*f+p+1]?v++:p++;return l.concat(h,a)}function M(e){var t;const o=function(){var e,t;const o=n.diffHideUnchangedRegions;if(null==o||!1===o)return null;const l=!0===o?{}:o;return!1===l.enabled?null:{contextLineCount:Math.max(0,Math.floor(null!=(e=l.contextLineCount)?e:2)),minimumLineCount:Math.max(1,Math.floor(null!=(t=l.minimumLineCount)?t:4))}}();if(!o||e.length<1||e.length>2)return e;if(2===e.length&&e[0].lines.length!==e[1].lines.length)return e;const l=e[0].lines,r=null==(t=e[1])?void 0:t.lines,i=e=>"context"===l[e].kind&&(void 0===r||"context"===r[e].kind&&l[e].code===r[e].code),s=[];let c=0;for(;c<l.length;){const e=c;for(;c<l.length&&i(c);)c++;const n=c;if(n-e>=o.minimumLineCount){const t=e+(0===e?0:o.contextLineCount),r=n-(n===l.length?0:o.contextLineCount);r>t&&s.push({start:t,end:r})}c===e&&c++}return s.length?e.map((e,n)=>{const t=[];let o=0;for(const l of s)t.push(...e.lines.slice(o,l.start)),t.push({code:0===n?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${e.key}-collapsed-${l.start}-${l.end}`,number:""}),o=l.end;return t.push(...e.lines.slice(o)),u(a({},e),{lines:t})}):e}const w=E(()=>{var e,t,l,r;const i=function(e){const t=e.some(e=>k(e)),l=e.some(e=>N(e));return t&&l||function(){var e,t,l,r;if("diff"===o.value)return!0;const i=null!=(r=null==(l=String(null!=(t=null==(e=n.node)?void 0:e.raw)?t:"").split(/\r?\n/,1)[0])?void 0:l.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(t||l)}(s.value),c=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(f.value){const o=c?function(e,n){const t=g(e),o=g(n),l=x(t,o);if(l.length>0){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},p(t[n],"removed",{preserveBlankKind:y(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},p(o[r],"added",{preserveBlankKind:y(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},p(o[i.modifiedIndex])),{key:`inline-context-source-${i.originalIndex}-${i.modifiedIndex}`,number:i.modifiedIndex+1})),n=i.originalIndex+1,r=i.modifiedIndex+1}for(;n<t.length;)e.push(u(a({},p(t[n],"removed",{preserveBlankKind:y(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<o.length;)e.push(u(a({},p(o[r],"added",{preserveBlankKind:y(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},p(o[i])),{key:`inline-prefix-${i}`,number:i+1})),i++;const d=[];for(;s>=i&&c>=i&&t[s]===o[c];)d.unshift(u(a({},p(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},p(t[f],"removed",{preserveBlankKind:y(t,f)})),{key:`inline-removed-source-${f}`,number:f+1}));for(let f=i;f<=c;f++)r.push(u(a({},p(o[f],"added",{preserveBlankKind:y(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}(null==(e=n.node)?void 0:e.originalCode,null==(t=n.node)?void 0:t.updatedCode):function(e){const n=[];let t=1,o=1;const l=b(e);for(const[r,i]of e.entries())if(i.startsWith("@@")){const e=i.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);e&&(t=Number(e[1]),o=Number(e[2])),n.push(u(a({},p(i,"hunk")),{key:`inline-hunk-${r}`,number:""}))}else if(k(i))n.push(u(a({},p(S(i.slice(1),l),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${r}`,number:t++}));else if(N(i))n.push(u(a({},p(S(i.slice(1),l),"added",{preserveBlankKind:!0})),{key:`inline-added-${r}`,number:o++}));else{const e=l&&i.startsWith(" ")?i.slice(1):i;n.push(u(a({},p(e)),{key:`inline-context-${r}`,number:o})),t++,o++}return n}(s.value);return M([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:o}])}if(!i&&c)return function(e,n){const t=g(e),o=g(n),l=x(t,o),r=[],i=[];let s=0,c=0,d=0;const f=(e,n)=>{const l=Math.max(e-s,n-c);for(let f=0;f<l;f++){const l=s+f,m=c+f;r.push(l<e?u(a({},p(t[l],"removed",{preserveBlankKind:y(t,l)})),{key:`original-changed-${d}-${l}`,number:l+1}):u(a({},p("","spacer")),{key:`original-spacer-${d}-${f}`,number:""})),i.push(m<n?u(a({},p(o[m],"added",{preserveBlankKind:y(o,m)})),{key:`modified-changed-${d}-${m}`,number:m+1}):u(a({},p("","spacer")),{key:`modified-spacer-${d}-${f}`,number:""}))}s=e,c=n,d++};for(const m of l)f(m.originalIndex,m.modifiedIndex),r.push(u(a({},p(t[m.originalIndex])),{key:`original-context-${m.originalIndex}-${m.modifiedIndex}`,number:m.originalIndex+1})),i.push(u(a({},p(o[m.modifiedIndex])),{key:`modified-context-${m.originalIndex}-${m.modifiedIndex}`,number:m.modifiedIndex+1})),s=m.originalIndex+1,c=m.modifiedIndex+1;return f(t.length,o.length),M([{key:"original",className:"markstream-pre__diff-pane--original",lines:r},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:i}])}(null==(l=n.node)?void 0:l.originalCode,null==(r=n.node)?void 0:r.updatedCode);const d=[],m=[],h=b(s.value);for(const n of s.value)if(n.startsWith("@@"))d.push(p(n,"hunk")),m.push(p(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))d.push(p(S(n.slice(1),h),"removed",{preserveBlankKind:!0}));else if(n.startsWith("+")&&!n.startsWith("+++"))m.push(p(S(n.slice(1),h),"added",{preserveBlankKind:!0}));else{const e=h&&n.startsWith(" ")?n.slice(1):n;d.push(p(e)),m.push(p(e))}return M([{key:"original",className:"markstream-pre__diff-pane--original",lines:d.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:m.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}])}),C=E(()=>w.value.some(e=>e.lines.some(e=>"collapsed"===e.kind))),_=E(()=>{const e=o.value;return e?`Code block: ${e}`:"Code block"}),B=X(null),I=X([]);let T=null,O=!1,A=null;function L(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function H(e,n){var t;if(!e)return n;if(e.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const o=e.querySelector(".markstream-pre__diff-content"),l=null==o?void 0:o.getBoundingClientRect(),r=null!=(t=null==l?void 0:l.height)?t:0;return Math.max(n,Math.ceil(r))}function R(){O||"undefined"==typeof window||(null!=T&&window.cancelAnimationFrame(T),T=window.requestAnimationFrame(()=>{T=null,O||function(){var e,n;T=null;const t=B.value;if(!t||!d.value)return void(I.value.length&&(I.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=L(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=L(n.lineHeight);return o>0?o:18}(t),l=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),r=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),i=Math.max(l.length,r.length),a=[];for(let c=0;c<i;c++){const t=H(null!=(e=l[c])?e:null,o),i=H(null!=(n=r[c])?n:null,o),u=Math.max(o,t,i);a.push({rowHeight:u,originalHeight:t,modifiedHeight:i})}var u,s;u=I.value,s=a,u.length===s.length&&u.every((e,n)=>{const t=s[n];return t&&Math.abs(e.rowHeight-t.rowHeight)<=.5&&Math.abs(e.originalHeight-t.originalHeight)<=.5&&Math.abs(e.modifiedHeight-t.modifiedHeight)<=.5})||(I.value=a)}()}))}function $(e){null==A||A.disconnect(),A=null,e&&d.value&&"undefined"!=typeof ResizeObserver&&(A=new ResizeObserver(()=>{R()}),A.observe(e))}function P(e,n){const t=I.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 G(B,e=>{$(e),le(()=>R())},{flush:"post"}),G([d,w],()=>{$(B.value),le(()=>R())},{flush:"post",immediate:!0}),ee(()=>{O=!0,null!=T&&(window.cancelAnimationFrame(T),T=null),null==A||A.disconnect(),A=null}),(e,t)=>(F(),K("pre",{ref_key:"preRef",ref:B,style:se(m.value),class:D([l.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":d.value,"markstream-pre--diff-inline":f.value,"markstream-pre--diff-collapsed":C.value}]),"aria-busy":r.value,"aria-label":_.value,"data-language":o.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[d.value?(F(),K("code",st,[(F(!0),K(Y,null,ce(w.value,e=>(F(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[(F(!0),K(Y,null,ce(e.lines,(n,o)=>(F(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(P(o,e.key))},[t[0]||(t[0]=W("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),W("span",ct,j(n.number),1),W("span",dt,[W("span",ft,j(n.code),1)])],6))),128))],2))),128))])):(F(),K(Y,{key:1},[n.showLineNumbers?(F(),K("span",mt,[(F(!0),K(Y,null,ce(c.value,e=>(F(),K("span",{key:e,class:"markstream-pre__line-number"},j(e),1))),128))])):Z("",!0),W("code",{translate:"no",class:"markstream-pre__code",textContent:j(i.value)},null,8,ht)],64))],14,ut))}});vt.install=e=>{e.component(vt.__name,vt)};const pt=R(!1);let gt=null;const yt={key:0},kt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(gt||(gt=Re().then(e=>{pt.value=!!e}).catch(()=>{pt.value=!1})),de(pt)),o=U(),l=$("markstreamFade",void 0),r=$("markstreamTextStreamState",void 0),i=$("markstreamStreamVersion",void 0),a=E(()=>{const e=o.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),u=E(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),s=E(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),c=X(n.node.content),d=X("");let f=null==i?void 0:i.value;const m=X(0);function h(){return c.value+d.value}function v(){d.value&&(c.value=h(),d.value="")}G([()=>n.node.content,s,u,()=>null==i?void 0:i.value],([e,n,t,o])=>{const l=String(null!=e?e:""),i=s.value,a=o!==f;f=o;const h=_e({nextContent:l,persistedContent:i?null==r?void 0:r.get(i):void 0,currentState:{settledContent:c.value,streamedDelta:d.value},typewriterEnabled:u.value,streamRenderVersionChanged:a});c.value=h.settledContent,d.value=h.streamedDelta,h.appended&&(m.value+=1),i&&(null==r||r.set(i,l))},{immediate:!0}),G(u,e=>{var n;e||(n=h(),c.value=n,d.value="")});const p=E(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(F(),K("span",{class:D([[q(t)&&e.node.center?"text-node-center":""],"text-node"])},[c.value?(F(),K("span",yt,j(c.value),1)):Z("",!0),d.value?(F(),K("span",{key:1,class:D(["text-node-stream-delta",[p.value]]),onAnimationend:v},j(d.value),35)):Z("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);kt.install=e=>{e.component(kt.__name,kt)};const Nt=P({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return z(vt,u(a({},n),{node:t.node,showLineNumbers:!0,reservedHeightPx:null!=(e=t.estimatedHeightPx)?e:t.estimatedContentHeightPx,class:["code-pre-fallback",n.class],"data-markstream-code-loading":"1"}))}}}),bt=re({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),vt}}),loadingComponent:Nt,delay:0,suspensible:!1}),St=re(()=>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 z(kt,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{if(yield Re())return(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 z(kt,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:""}$`}}))}})),xt=re(()=>s(null,null,function*(){try{if(yield Re())return(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 z(kt,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:""}$$`}}))}})),Mt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),K("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},j(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const wt={class:"superscript-node"},Ct=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,emphasis:zt,footnote_reference:dn,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,emoji:un,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("sup",wt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const _t={class:"subscript-node"},Bt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,emphasis:zt,footnote_reference:dn,strikethrough:At,highlight:Wt,insert:Ft,superscript:Ct,emoji:un,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("sub",_t,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Bt.install=e=>{e.component(Bt.__name,Bt)};const It={class:"strong-node"},Tt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,emphasis:zt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("strong",It,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Tt.install=e=>{e.component(Tt.__name,Tt)};const Ot={class:"strikethrough-node"},At=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,emphasis:zt,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("del",Ot,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);At.install=e=>{e.component(At.__name,At)};const Lt=["href","title","aria-label","aria-hidden","target","rel"],Ht=["aria-hidden"],Rt={class:"link-text-wrapper relative inline-flex"},$t={class:"leading-[normal] link-text"},Et=/* @__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=$("markstreamShowTooltips",void 0),o=E(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=E(()=>{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=E(()=>a({text:kt,strong:Tt,strikethrough:At,emphasis:zt,image:rt,html_inline:Mn,inline_code:_n},r.value)),u=U(),s=E(()=>{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 hn(l,"safe","a")}),c=E(()=>a(a({},u),s.value)),d=E(()=>{var e,t;return hn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=E(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(x(d.value)?"_blank":void 0)}),m=E(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=E(()=>{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=E(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Dn()}const g=E(()=>{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(),K("span",ue({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},q(u),{style:l.value}),[W("span",Rt,[W("span",$t,[V(q(kt),{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]=W("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Ht)):(F(),K("a",ue({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)||"";zn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>(F(),ie(q(at),{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,Lt))}}}),[["__scopeId","data-v-367e6ca4"]]);Et.install=e=>{e.component(Et.__name,Et)};const Pt={class:"insert-node"},Ft=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,emphasis:zt,strikethrough:At,highlight:Wt,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("ins",Pt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Ft.install=e=>{e.component(Ft.__name,Ft)};const Kt={class:"highlight-node"},Wt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,emphasis:zt,strikethrough:At,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("mark",Kt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const jt={class:"emphasis-node"},zt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=E(()=>a({text:kt,inline_code:_n,link:Et,html_inline:Mn,strong:Tt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,footnote_reference:dn,math_inline:St,reference:Mt},t.value));return(t,l)=>(F(),K("em",jt,[(F(!0),K(Y,null,ce(e.node.children,(t,l)=>(F(),ie(q(at),{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"]]);zt.install=e=>{e.component(zt.__name,zt)};const Dt={class:"hard-break"},Vt=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),K("br",Dt))}),[["__scopeId","data-v-50c58f70"]]);Vt.install=e=>{e.component(Vt.__name,Vt)};const qt=/* @__PURE__ */P({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=fe({checkbox:rn,checkbox_input:rn,emoji:un,emphasis:zt,hardbreak:Vt,highlight:Wt,inline_code:_n,insert:Ft,link:Et,reference:Mt,strikethrough:At,strong:Tt,subscript:Bt,superscript:Ct,text:kt}),o=Ze(()=>n.customId),l=E(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),K(Y,null,ce(e.nodes,(t,o)=>(F(),ie(q(at),{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 Ut(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(Ut)}function Xt(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Ut))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(Ut)?l:null}function Gt(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 Yt=["cite"],Jt={key:0,dir:"auto",class:"paragraph-node"},Zt=["custom-id"],Qt=/* @__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=E(()=>Boolean(t.value.paragraph)),l=E(()=>Boolean(t.value.text)),r=E(()=>Xt(n.node.children,!o.value)),i=E(()=>!1!==n.fade||l.value?null:Gt(r.value));return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(t,o)=>(F(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),K("p",Jt,[null!==i.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(i.value),9,Zt)):(F(),ie(q(qt),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),ie(q(la),{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,Yt))}}),[["__scopeId","data-v-abfecebc"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo={class:"definition-list"},no={class:"definition-term"},to={class:"definition-desc"},oo=/* @__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(),K("dl",eo,[(F(!0),K(Y,null,ce(n.node.items,(o,l)=>(F(),K(Y,{key:l},[W("dt",no,[V(q(la),{"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"])]),W("dd",to,[V(q(la),{"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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["href","title"],ro=/* @__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(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,lo))}}),[["__scopeId","data-v-e1eb37b6"]]);ro.install=e=>{e.component(ro.__name,ro)};const io=["id"],ao={class:"flex-1"},uo=/* @__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(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[W("div",ao,[V(q(la),{"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,io))}});uo.install=e=>{e.component(uo.__name,uo)};const so=["custom-id"],co=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ze(()=>n.customId),o=$("markstreamFade",void 0),l=E(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Gt(n.node.children)),r=E(()=>a({text:kt,inline_code:_n,link:Et,image:rt,strong:Tt,emphasis:zt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,checkbox:rn,checkbox_input:rn,footnote_reference:dn,hardbreak:Vt,math_inline:St,reference:Mt},t.value));return(t,o)=>(F(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[null!==l.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(l.value),9,so)):(F(!0),K(Y,{key:1},ce(e.node.children,(t,o)=>(F(),ie(q(at),{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"]]),fo=co;fo.install=e=>{e.component(co.__name,co)};const mo={key:0,dir:"auto",class:"paragraph-node"},ho=["custom-id"],vo={dir:"auto",class:"paragraph-node"},po=["custom-id"],go=/* @__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=E(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Ze(()=>n.customId),l=E(()=>Boolean(o.value.paragraph)),r=E(()=>Boolean(o.value.text)),i=E(()=>{var e;return Xt(null==(e=t.value)?void 0:e.children,!l.value)}),a=E(()=>{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=Xt([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=E(()=>u()?Gt(i.value):null),c=E(()=>{var e;return u()?Gt(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=E(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(e,o)=>{var l,r;return F(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(F(),K("p",mo,[null!==s.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(s.value),9,ho)):(F(),ie(q(qt),{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(),K(Y,{key:1},[W("p",vo,[null!==c.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(c.value),9,po)):(F(),ie(q(qt),{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),K(Y,null,ce(a.value.nestedLists,(t,l)=>(F(),ie(q(la),{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(),ie(q(la),{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"]]);go.install=e=>{e.component(go.__name,go)};const yo=/* @__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=E(()=>n.value.list_item||go);return(n,o)=>(F(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(F(!0),K(Y,null,ce(e.node.items,(l,r)=>{var i;return F(),ie(ae(t.value),ue({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"]]);yo.install=e=>{e.component(yo.__name,yo)};const ko=/* @__PURE__ */Symbol("ViewportPriority"),No=/* @__PURE__ */Symbol("ViewportPriorityOptions"),bo="400px";function So(){return $(No,void 0)}function xo(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?X(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;function h(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function v(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function p(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||v()}function g(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),p(n.bucketKey)}function y(){!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),g(e),f.size&&y())},{timeout:1200}))}function k(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:bo,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[h((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)&&g(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}}G(r,e=>{if(!e){for(const e of Array.from(d.keys()))g(e);v()}},{flush:"sync"});const N=(e,n)=>{const t=X(!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 p();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),p(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=k(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),f.add(e),y(),{isVisible:t,whenVisible:a,destroy:u}};return N.refresh=function(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=k(n,t.opts);if(!o){g(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),p(l)}},me(ko,N),N}function Mo(){var e,n;const t=$(ko,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){for(const n of r){const t=o.get(n);if((null==t?void 0:t.bucketKey)===e)return}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),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=X(!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),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:bo,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:bo;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};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.io.observe(e),r.add(e),f(),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}const wo={key:2,class:"html-block-node__raw"},Co=["innerHTML"],_o={key:1,class:"html-block-node__placeholder"},Bo=/* @__PURE__ */ln(/* @__PURE__ */P({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=$("markstreamHtmlPolicy",void 0),o=$("markstreamNestedRendererProps",void 0),l=E(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=E(()=>{var e,t;const r=null!=(e=null==o?void 0:o.value)?e:{};return u(a({},r),{customId:null!=(t=n.customId)?t:r.customId,htmlPolicy:l.value})}),i=re({loader:()=>Promise.resolve().then(()=>ra),suspensible:!1}),s=E(()=>{const e=h(n.node.attrs,l.value);if(!e)return;const t=v(e);return Object.keys(t).length>0?t:void 0}),c=E(()=>{const e=String(n.node.tag||"").trim(),t=h(n.node.attrs,l.value,e);if(!t)return;const o=v(t);return Object.keys(o).length>0?o:void 0}),d=Ze(()=>n.customId),f=P({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=X(null),p=X("undefined"==typeof window),g=X(n.node.content),y=E(()=>Array.isArray(n.node.children)?n.node.children:[]),N=E(()=>String(n.node.tag||"div")),S=E(()=>{var e;if("details"!==N.value.trim().toLowerCase())return null;if(null==(e=n.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const t=y.value[0];return"html_block"===(null==t?void 0:t.type)&&"summary"===String(t.tag||"").toLowerCase()?t:null}),x=E(()=>{var e;return Gt(null==(e=S.value)?void 0:e.children)}),w=E(()=>{const e=S.value;if(!e)return;const n=h(e.attrs,l.value,"summary");if(!n)return;const t=v(n);return Object.keys(t).length>0?t:void 0}),C=E(()=>null==x.value?y.value:y.value.slice(1)),_=E(()=>{const e=N.value.trim().toLowerCase();return M.has(e)||k(e,l.value)}),B=E(()=>y.value.length>0&&!!n.node.tag&&!_.value),I=E(()=>{var e,t,o;if(B.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:null!=(e=g.value)?e:""};const r=null!=(t=g.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===l.value)return{mode:"html",content:b(r,l.value)};if(n.node.loading){const e=Sn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!bn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=Sn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),T=Mo(),O=So(),A=R(null),L=!!n.node.loading;return"undefined"!=typeof window?(G([()=>m.value,()=>null==O?void 0:O.value.heavyBlockMargin,()=>null==O?void 0:O.value.rootMargin],([e],t,o)=>{var l,r,i,a;if(null==(r=null==(l=A.value)?void 0:l.destroy)||r.call(l),A.value=null,!L)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);let u=!0;const s=null!=(a=null!=(i=null==O?void 0:O.value.heavyBlockMargin)?i:null==O?void 0:O.value.rootMargin)?a:bo,c=T(e,{rootMargin:s});A.value=c,p.value=p.value||c.isVisible.value,c.whenVisible.then(()=>{u&&A.value===c&&(p.value=!0)}),o(()=>{u=!1,c.destroy(),A.value===c&&(A.value=null)})},{immediate:!0}),G(()=>n.node.content,e=>{L&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=A.value)?void 0:e.destroy)||n.call(e),A.value=null}),(n,t)=>(F(),ie(ae(B.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},B.value?c.value:void 0),{default:oe(()=>[p.value?(F(),K(Y,{key:0},["structured"===I.value.mode?(F(),K(Y,{key:0},[null!==x.value?(F(),K(Y,{key:0},[W("summary",he(ve(w.value)),j(x.value),17),C.value.length?(F(),ie(q(i),ue({key:0},r.value,{nodes:C.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Z("",!0)],64)):(F(),ie(q(i),ue({key:1},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===I.value.mode?(F(),ie(q(f),{key:1,nodes:I.value.nodes},null,8,["nodes"])):"text"===I.value.mode?(F(),K("pre",wo,j(I.value.content),1)):(F(),K("div",ue({key:3},s.value,{innerHTML:I.value.content}),null,16,Co))],64)):(F(),K("div",_o,[ne(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=W("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=W("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=W("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-bdad99ed"]]);Bo.install=e=>{e.component(Bo.__name,Bo)};const Io={dir:"auto",class:"paragraph-node"},To=["custom-id"],Oo=/* @__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=$("markstreamHtmlPolicy",void 0),l=$("markstreamFade",void 0),r=$("markstreamParseOptions",void 0),i=$("markstreamCustomMarkdownIt",void 0),s=$("markstreamNestedRendererProps",void 0),c=E(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=E(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=E(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=E(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=E(()=>{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})}),v=re({loader:()=>Promise.resolve().then(()=>ra),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=E(()=>n.node.children.filter(e=>!p(e))),y=E(()=>g.value.length>0&&g.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=>!p(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),k=E(()=>new Set(w(m.value))),N=E(()=>{if(!y.value||g.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(!p(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!p(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e}),b=E(()=>!1===(null==l?void 0:l.value)&&!t.value.text),S=E(()=>b.value?Gt(N.value):null);function x(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value}}const M=E(()=>a({inline_code:_n,image:rt,link:Et,hardbreak:Vt,emphasis:zt,strong:Tt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,html_inline:Mn,html_block:Bo,emoji:un,checkbox:rn,math_inline:St,checkbox_input:rn,reference:Mt,footnote_anchor:ro,footnote_reference:dn,text:kt},t.value)),B=E(()=>N.value.map((e,o)=>{var l;const r=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()||C(e.content);if(t&&!k.value.has(t)&&_(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:kt,isCustomComponent:!1}}}return{child:e,component:M.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Ue(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?gn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(F(),K("p",Io,[null!==S.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(S.value),9,To)):(F(!0),K(Y,{key:1},ce(B.value,e=>{return F(),K(Y,{key:e.key},[y.value&&p(e.originalChild)?(F(),K(Y,{key:0},[J(j((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),ie(ae(e.component),ue({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:oe(()=>[e.hasSlotChildren?(F(),ie(q(v),ue({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(),ie(q(v),ue({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(),ie(ae(e.component),ue({key:2,ref_for:!0},x(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Oo.install=e=>{e.component(Oo.__name,Oo)};const Ao={class:"table-node-wrapper"},Lo=["aria-busy"],Ho={key:0},Ro=["custom-id"],$o=["aria-label","onPointerdown"],Eo=["custom-id"],Po={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Fo=/* @__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=E(()=>{var e;return null!=(e=n.node.loading)&&e}),o=E(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=X(null),r=X([]);let i=null;const a=E(()=>n.node.header.cells.length),u=E(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=E(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade));const c=Ze(()=>n.customId),d=E(()=>Boolean(c.value.text)),f=E(()=>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=Xt(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Gt(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 G(a,()=>{p(),r.value=[]}),ee(p),(a,c)=>(F(),K("div",Ao,[W("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),K("colgroup",Ho,[(F(!0),K(Y,null,ce(e.node.header.cells,(e,n)=>(F(),K("col",{key:n,style:se(s.value[n])},null,4))),128))])):Z("",!0),W("thead",null,[W("tr",null,[(F(!0),K(Y,null,ce(e.node.header.cells,(t,o)=>(F(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(h(t).plainText),9,Ro)):h(t).simpleChildren?(F(),ie(q(qt),{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(),ie(q(la),{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(),K("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,$o)):Z("",!0)],2))),128))])]),W("tbody",null,[(F(!0),K(Y,null,ce(o.value,(e,t)=>(F(),K("tr",{key:t},[(F(!0),K(Y,null,ce(e.cells,(e,o)=>(F(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},j(h(e).plainText),9,Eo)):h(e).simpleChildren?(F(),ie(q(qt),{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(),ie(q(la),{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,Lo),V(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(F(),K("div",Po,[ne(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=W("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=W("span",{class:"sr-only"},"Loading",-1))],!0)])):Z("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Fo.install=e=>{e.component(Fo.__name,Fo)};const Ko={class:"hr-node"},Wo=/* @__PURE__ */ln({},[["render",function(e,n){return F(),K("hr",Ko)}],["__scopeId","data-v-39b2349c"]]);Wo.install=e=>{e.component(Wo.__name,Wo)};const jo={class:"unknown-node"},zo=/* @__PURE__ */P({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),K("div",jo,j(e.node.raw),1))}),Do=/* @__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=E(()=>`vmr-container vmr-container-${n.node.name}`),o=Ze(()=>n.customId),l=E(()=>a({text:kt,paragraph:Oo,heading:fo,inline_code:_n,link:Et,image:rt,strong:Tt,emphasis:zt,strikethrough:At,insert:Ft,subscript:Bt,superscript:Ct,checkbox:rn,checkbox_input:rn,hardbreak:Vt,math_inline:St,reference:Mt,list:yo,math_block:xt,table:Fo},o.value));return(o,r)=>(F(),K("div",ue({class:t.value},e.node.attrs),[(F(!0),K(Y,null,ce(e.node.children,(t,o)=>{return F(),ie(ae((r=t.type,l.value[r]||zo)),{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},null,8,["custom-id","node","index-key","typewriter","fade"]);var r}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Do.install=e=>{e.component(Do.__name,Do)};const Vo=["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"],qo=[[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 Uo(e){if(e<=255)return Vo[e];let n=0,t=qo.length-1;for(;n<=t;){const o=n+t>>1,l=qo[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const Xo=/[ \t\n\r\f]+/g,Go=/[\t\n\r\f]| {2,}|^ | $/;let Yo=null;const Jo=new RegExp("\\p{Script=Arabic}","u"),Zo=new RegExp("\\p{M}","u"),Qo=new RegExp("\\p{Nd}","u");function el(e){return Jo.test(e)}function nl(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 tl(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(nl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(nl(t))return!0}}return!1}const ol=/* @__PURE__ */new Set([" "," ","","\ufeff"]),ll=/* @__PURE__ */new Set(["-","‐","–","—"]);function rl(e,n){return!(function(e){const n=yl(e);return null!==n&&ol.has(n)}(e)||n&&(function(e){const n=yl(e);return null!==n&&(il.has(n)||sl.has(n))}(e)||function(e){const n=yl(e);return null!==n&&ll.has(n)}(e)))}const il=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),al=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),ul=/* @__PURE__ */new Set(["'","’"]),sl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),cl=/* @__PURE__ */new Set([":",".","،","؛"]),dl=/* @__PURE__ */new Set(["၏"]),fl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function ml(e){if(pl(e))return!0;let n=!1;for(const t of e)if(sl.has(t)||Nl(t))n=!0;else if(!n||!Zo.test(t))return!1;return n}function hl(e){for(const n of e)if(!il.has(n)&&!sl.has(n))return!1;return e.length>0}function vl(e){if(pl(e))return!0;for(const n of e)if(!(al.has(n)||ul.has(n)||Zo.test(n)||Nl(n)))return!1;return e.length>0}function pl(e){let n=!1;for(const t of e)if("\\"!==t&&!Zo.test(t)){if(!(al.has(t)||sl.has(t)||ul.has(t)))return!1;n=!0}return n}function gl(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 yl(e){if(0===e.length)return null;const n=gl(e,e.length);return e.slice(n)}const kl=[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 Nl(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,kl)}function bl(e){const n=function(e){for(const n of e)if(!Zo.test(n))return n;return null}(e);return null!==n&&Qo.test(n)}function Sl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Zo.test(e))t--;else{if(!al.has(e)&&!ul.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function xl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Ml(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 wl(e,n){return e&&null!==n&&cl.has(n)}function Cl(e){const n=yl(e);return null!==n&&dl.has(n)}function _l(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 Bl(e){let n=e.length;for(;n>0;){const t=gl(e,n),o=e.slice(t,n);if(fl.has(o))return!0;if(!sl.has(o))return!1;n=t}return!1}function Il(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 Tl=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Ol(e){return 1===e.length?e[0]:e.join("")}function Al(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Ol(t)}function Ll(e,n,t,o){if(!Tl.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=Il(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:Ol(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:Ol(i),isWordLike:u,kind:r,start:a}),l}function Hl(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Rl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function $l(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Rl.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function El(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Pl=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Fl=/[\p{P}\p{S}\p{Co}]/u,Kl=new RegExp("\\p{Emoji_Presentation}","u"),Wl=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function jl(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):!Wl.has(e)&&!Kl.test(e)&&Fl.test(e)}function zl(e){let n=!1;for(const t of e)if(!Zo.test(t)){if(!jl(t))return!1;n=!0}return n}function Dl(e,n,t,o){const l=!n&&zl(e),r=!o&&zl(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=gl(e,n),o=e.slice(t,n);if(!Zo.test(o))return o;n=t}return null}(e);return null!==n&&Nl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=gl(e,n),o=e.slice(t,n);if(!Zo.test(o))return jl(o)||Nl(o);n=t}return!1}(e);return!!(l||r||a)&&!tl(e)&&!tl(t)&&(n||l||i)&&(o||r)}function Vl(e){for(const n of e)if(Qo.test(n))return!0;return!1}function ql(e){if(0===e.length)return!1;for(const n of e)if(!Qo.test(n)&&!Pl.has(n))return!1;return!0}function Ul(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 Xl(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(!Go.test(e))return e;let n=e.replace(Xo," ");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===Yo&&(Yo=new Intl.Segmenter(void 0,{granularity:"word"})),Yo);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const M of i.segment(e))for(const e of Ll(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==m[M]&&(s[M]=[Ml(u,m,h,M)],m[M]=null),s[M].push(e.text),c[M]=c[M]||e.isWordLike,v[M]=v[M]||i,p[M]=p[M]||N,g[M]=S,y[M]=x,k[M]=wl(p[M],b)};const o="text"===e.kind,r=xl(e.text,e.isWordLike,e.kind),i=tl(e.text),N=el(e.text),b=yl(e.text),S=Bl(e.text),x=Cl(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[M]&&i&&v[M]&&g[M]||o&&a>0&&"text"===d[M]&&hl(e.text)&&v[M]||o&&a>0&&"text"===d[M]&&y[M]?t():o&&a>0&&"text"===d[M]&&e.isWordLike&&N&&k[M]?(t(),c[M]=!0):null!==r&&a>0&&"text"===d[M]&&m[M]===r?h[M]=(null!=(l=h[M])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[M]&&!v[M]&&(ml(e.text)||"-"===e.text&&c[M])?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]=N,g[a]=S,y[a]=x,k[a]=wl(N,b),a++)}for(let M=0;M<a;M++)null===m[M]?u[M]=Ol(s[M]):u[M]=Ml(u,m,h,M);for(let M=1;M<a;M++)"text"!==d[M]||c[M]||!pl(u[M])||"text"!==d[M-1]||v[M-1]||(u[M-1]+=u[M],c[M-1]=c[M-1]||c[M],u[M]="");const N=Array.from({length:a},()=>null);let b=-1;for(let M=a-1;M>=0;M--){const e=u[M];if(0!==e.length){if("text"===d[M]&&!c[M]&&b>=0&&"text"===d[b]&&(vl(e)||"-"===e&&bl(u[b]))){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[M],u[M]="";continue}b=M}}for(let M=0;M<a;M++){const e=N[M];null!=e&&(u[M]=Al(e,u[M]))}let S=0;for(let M=0;M<a;M++){const e=u[M];0!==e.length&&(S!==M&&(u[S]=e,c[S]=c[M],d[S]=d[M],f[S]=f[M]),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(!tl(n[r])||!tl(n[r+1]))continue;const e=Sl(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]&&Dl(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(Ol(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&&Vl(n)&&ql(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&&ql(i)&&Vl(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&ql(e.texts[u]);)a.push(e.texts[u]),u++;n.push(Ol(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]),!El(i))continue;const a=r+1;if(a>=e.len||Hl(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!Hl(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(Ol(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]||!$l(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Hl(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]=Ol(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=Ol(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=Ol(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(Ol(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 M=0;M<x.len-1;M++){const e=_l(x.texts[M]);null!==e&&("space"!==x.kinds[M]&&"preserved-space"!==x.kinds[M]||"text"!==x.kinds[M+1]||!el(x.texts[M+1])||(x.texts[M]=e.space,x.isWordLike[M]=!1,x.kinds[M]="preserved-space"===x.kinds[M]?"preserved-space":"space",x.texts[M+1]=e.marks+x.texts[M+1],x.starts[M+1]=x.starts[M]+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&&!rl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||tl(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:Ul(u,l)},u)}let Gl=null;const Yl=/* @__PURE__ */new Map;let Jl=null;const Zl=new RegExp("\\p{Emoji_Presentation}","u"),Ql=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let er=null;const nr=/* @__PURE__ */new Map;function tr(){if(null!==Gl)return Gl;if("undefined"!=typeof OffscreenCanvas)return Gl=new OffscreenCanvas(1,1).getContext("2d"),Gl;if("undefined"!=typeof document)return Gl=document.createElement("canvas").getContext("2d"),Gl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function or(e,n){let t=n.get(e);return void 0===t&&(t={width:tr().measureText(e).width,containsCJK:tl(e)},n.set(e,t)),t}function lr(){if(null!==Jl)return Jl;if("undefined"==typeof navigator)return Jl={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Jl;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 Jl={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Jl}function rr(){return null===er&&(er=new Intl.Segmenter(void 0,{granularity:"grapheme"})),er}function ir(e){return Zl.test(e)||e.includes("️")}function ar(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=rr();for(const o of t.segment(e))ir(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function ur(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function sr(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function cr(e,n,t=e.widths.length){for(;n<t&&ur(e.kinds[n]);)n++;return n}function dr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function fr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function mr(e,n){return 0===n?0:e+n}function hr(e,n,t,o,l){return mr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function vr(e,n,t,o){return mr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function pr(e,n,t,o,l){return mr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function gr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function yr(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function kr(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Nr(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+lr().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:kr(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=kr(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=cr(e,k),!(k>=t.length)));){const e=t[k],n=sr(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=lr(),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 N(e=m,n=h,t){c++,d=0,f=!1,k()}function b(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):b(e,n)}function M(n,t,o,l,r,i){if(!t)return;const a=vr(e,n,o,r),u=pr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function w(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:kr(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=gr(e,!0,o),r=d+l;if(yr(e,r)>s){if(null!==a&&c>t){N(n,c),v=c,u=kr(a,u,v+1),c=-1;continue}N(),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 _=0;_<a.length;_++){const n=a[_];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=cr(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=sr(n),c=fr(e,f,r),k="tab"===n?dr(d+c,e.tabStopAdvance):t[r],S=c+k,C=hr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+vr(e,n,r,c);if(pr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){N(v,0);continue}if(a&&t<=s){x(r,S),N(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){N();continue}const e=v;N(e,0),r=e;continue}if(C>s&&null!==l[r]){N(),w(r,0),r++;continue}N();continue}x(r,S),M(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?w(r,0):b(r,k),M(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,N(n.consumedEndSegmentIndex,0))}return c}(e,n)}let br=null;function Sr(){return null===br&&(br=new Intl.Segmenter(void 0,{granularity:"grapheme"})),br}function xr(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=Bl(e),a=al.has(e)}function c(e,n){o.push(e),r=r||n;const t=Bl(e);i=1===e.length&&sl.has(e)&&i||t,a=!1}for(const d of Sr().segment(e)){const e=d.segment,t=tl(e);0!==o.length?a||il.has(e)||sl.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 Mr(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&&!rl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||tl(e.text)}return i(n.length),o}function wr(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=Sr();for(const l of o.segment(e))t++;return t}function Cr(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function _r(e,n,t,o,l){const r=lr(),{cache:i,emojiCorrection:a}=function(e,n){tr().font=e;const t=function(e){let n=Yl.get(e);return n||(n=/* @__PURE__ */new Map,Yl.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=nr.get(e);if(void 0!==t)return t;const o=tr();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 nr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,Ql.test(u)));var u;const s=ar("-",or("-",i),a)+(0===l?0:2*l),c=8*ar(" ",or(" ",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=[],N=[],b=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&&N.push(u),null!==b&&b.push(e)}function M(e,n,t,u,s){const c=or(e,i),f=d?wr(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(ar(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":ql(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=rr(),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=or(n,t);e.push(ar(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=ar(n,or(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=or(i,t);e.push(ar(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=ar(u,or(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 Sr().segment(e))t++,Cr(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 _=0;_<e.len;_++){S[_]=f.length;const n=e.texts[_],t=e.isWordLike[_],l=e.kinds[_],a=e.starts[_];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?wr(n,l):0);continue}const u=or(n,i);if("text"===l&&u.containsCJK){const e=xr(n,r),l="keep-all"===o?Mr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];M(e.text,"text",a+e.start,t,"keep-all"===o||!tl(e.text))}continue}M(n,l,a,t,!0)}const w=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=Uo(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!==b?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w,segments:b}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:w}}const Br="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Ir=(()=>{const e=globalThis;if(e[Br])return e[Br];const n={configs:{},controllers:{},revision:R(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Br]=n,n})();let Tr=null;const Or=Ir.revision;function Ar(e){var n;return e&&null!=(n=Ir.configs[e])?n:null}function Lr(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Hr(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Rr(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Hr(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 $r(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Tr)return Tr;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Tr=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Tr}catch(n){return Tr=!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=Ir.blockEstimateCache.get(i);if(a)return Ir.blockEstimateCache.delete(i),Ir.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=Ir.preparedCache.get(o);if(l)return Ir.preparedCache.delete(o),Ir.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 _r(Xl(e,lr(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(Ir.preparedCache.set(o,{prepared:r});Ir.preparedCache.size>240;){const e=Ir.preparedCache.keys().next().value;if(!e)break;Ir.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Nr(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(Ir.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Ir.blockEstimateCache.size>4e3;){const e=Ir.blockEstimateCache.keys().next().value;if(!e)break;Ir.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function Er(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Rr(e.children);return o&&t.paragraph?$r(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Rr(e.children),r=t.headings[o];return l&&r?$r(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=Rr(null==(l=r[0])?void 0:l.children);return i?$r(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=Er(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 Pr(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Fr(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l="pre"!==o&&!1!==n.showHeader,r=function(e){var n,t,o;return e.diff?Math.max(Pr(String(null!=(n=e.originalCode)?n:"")),Pr(String(null!=(t=e.updatedCode)?t:"")),Pr(String(null!=(o=e.code)?o:""))):Pr(function(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}(e.code,!0===e.loading))}(e),i=Boolean(e.diff);let a=0,u=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);u="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*o)}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(28*r),u=Number.POSITIVE_INFINITY);const s=Math.max(1,Math.min(a,u));return{kind:"code-block",height:Math.round(s+(l?40:0)),contentHeight:s,rendererKind:o}}function Kr(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Wr(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Lr(o.lineHeight,1.5*Lr(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Kr(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const jr=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function zr(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))jr.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const Dr=!1;function Vr(){return Dr}function qr(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 Ur(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 Xr(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const Gr=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Yr(){return $(Gr,null)}const Jr=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),Zr=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function Qr(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function ei(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 ni(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(Jr.has(o))return!0;if(!Zr.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(ni)}function ti(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(ti).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function oi(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(oi)})}function li(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 ri(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h;if(!e||"object"!=typeof e)return 32;const v=e,p=String(null!=(t=v.type)?t:""),g=Number.isFinite(n)&&n>0?n:640;switch(p){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}(v);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:ei(t,n,34)}(String(null!=(l=null!=(o=v.raw)?o:v.content)?l:""),g);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+=li(ti(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))}(v,g);case"list_item":return ei(String(null!=(i=null!=(r=v.raw)?r:v.content)?i:""),g,34);case"blockquote":return ei(String(null!=(u=null!=(a=v.raw)?a:v.content)?u:""),g,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=ti(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(oi)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(v,g);case"code_block":return ei(String(null!=(c=null!=(s=v.code)?s:v.raw)?c:""),g,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:"")?ei((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):ei(e,n,96)}(String(null!=(f=null!=(d=v.raw)?d:v.content)?f:""),g);case"thematic_break":return 24;default:return ei(String(null!=(h=null!=(m=v.raw)?m:v.content)?h:""),g,40)}}function ii(e,n,t){return Math.min(Math.max(e,n),t)}const ai=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],ui=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],si=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),ci=["raw","content","code","originalCode","updatedCode"],di=/* @__PURE__ */new WeakMap,fi=/* @__PURE__ */new WeakMap;let mi=1;function hi(){return"undefined"!=typeof performance?performance.now():Date.now()}function vi(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function pi(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=di.get(n);return t||(t=mi++,di.set(n,t)),String(t)}function gi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:pi(n),customMarkdownIt:pi(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:pi(e.validateLink),preTransformTokens:pi(e.preTransformTokens),postTransformTokens:pi(e.postTransformTokens),postTransformNodes:pi(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function yi(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 ki(e){const n=Ni(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function Ni(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function bi(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 Si(e){const n=String(null!=e?e:"");return`${n.length}:${bi(n)}`}function xi(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?Si(e):`${e.length}:${bi(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${pi(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:${pi(o)}`;const r=pi(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>xi(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.sort().map(e=>`${e}:${xi(o[e],n,t+1)}`).join(";")}`}return typeof e}function Mi(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function wi(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>Mi(e)?Bi(e,n,t+1):wi(e,n,t+1)).join(",")}`:Mi(e)?Bi(e,n,t):xi(e,n,t)}function Ci(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!ci.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${Si(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${pi(l)}`:si.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${wi(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${pi(l)}`:""}).filter(Boolean).join(";")}function _i(e){return ci.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${Si(t)}`:""}).filter(Boolean).join(";")}function Bi(e,n=/* @__PURE__ */new WeakMap,t=0){const o=fi.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}:${pi(l)}`;const i=pi(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=>Bi(e,n,t+1)).join("|"):"";return[e.type,_i(o),Ci(o,n,t),l.length,r].join(":")}(e,n,t);return fi.set(l,a),a}function Ii(e,n){return Bi(e)===Bi(n)}function Ti(e,n,t){const o=hi(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=hi()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Oi(e,n,t){return Ti(n,t,()=>Bi(e))}function Ai(e,n,t){return Oi(e,t,"stabilizeSignatureMs")===Oi(n,t,"stabilizeSignatureMs")}function Li(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Hi(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function Ri(e,n){return e.length===n.length&&e===n}function $i(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(!Ri(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(!Mi(e)||!Mi(n))return null;const o=$i(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function Ei(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=$i(e,n);return null!=t?t:Ii(e,n)}function Pi(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Ti(t,"stabilizeSignatureMs",()=>{o=$i(e,n)}),null!=o?o:Ai(e,n,t)}function Fi(e,n){const t={};for(const o of ai){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 Ki(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:E(()=>!1),i=X(n.renderContent.value);let s,d=[],f="",m="",h="",v=0,p=0,y=hi(),k=-1,N=0;function b(e){k=Number.isInteger(e)?e:0,N+=1}function S(){s&&(clearTimeout(s),s=void 0)}function x(){S();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=hi()}G([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&&(!!ki(yi(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=yi(e);if(ki(n))return!1;const t=Ni(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?x():function(){if(p+=1,s)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(hi()-y));n<=0?x():s=setTimeout(x,n)}())},{flush:"sync",immediate:!0}),ge(S);const M=E(()=>{var t,o,l,r;return I(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)||A.has(t)||g.has(t)?"":t}).filter(Boolean)))}),w=E(()=>{const{key:e,tags:t}=T(M.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}),C=E(()=>{const n=w.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),_=E(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=M.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}),L=E(()=>{var e;return new Set((null!=(e=_.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),H=E(()=>gi(_.value,C.value,e.customMarkdownIt,{includeFinal:!0})),R=E(()=>gi(_.value,C.value,e.customMarkdownIt,{includeFinal:!1}));G([H,R],([e,n],[t,o])=>{t&&(e===t&&n===o||(x(),n!==o&&(d=[],h="")))},{flush:"sync"});const $=E(()=>{var t,o,l,r,s,c,g,y,N;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",b(0),fe(e.nodes.slice());const S=i.value;if(!S)return d=[],h="",b(-1),[];const x=n.debugPerformanceEnabled.value,M=x?hi():0,w=C.value,B=H.value,I=R.value;f&&B!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(w),m&&I!==m&&(d=[],h="");const T=d.length>0&&S.startsWith(h)&&I===m,A=x?vi(w):null,L=x?{}:void 0,$=L?u(a({},_.value),{__timing:L}):_.value,E=O(S,w,$),P=x?hi():0,F=x?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let K,W=x?Li(E.length):void 0,j=0,z=0;if(T){const n=x?hi():0,t=function(e){var n,t,o,l;if(e.previousDirtyStartIndex<=0)return 0;if(!e.content.startsWith(e.previousContent)||e.content.length<=e.previousContent.length)return 0;if(!0===e.parseOptions.final)return 0;if(e.customMarkdownIt)return 0;if(function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e.md))return 0;if(o=e.previousContent,l=e.content,o&&l.startsWith(o)&&!(l.length<=o.length)&&function(e){let n=-1;for(let t=0;t<e.length;t++){const o=e.charCodeAt(t);if(n<0){91===o&&(n=t);continue}if(92===o){t+=1;continue}if(91===o){n=t;continue}if(93!==o)continue;let l=t+1;for(;l<e.length;){const n=e.charCodeAt(l);if(9!==n&&32!==n)break;l+=1}if(58===e.charCodeAt(l))return!0;n=-1}return!1}(l))return 0;const r=e.parseOptions;return"function"==typeof r.preTransformTokens||"function"==typeof r.postTransformTokens||"function"==typeof r.postTransformNodes||(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)>0?0:e.previousDirtyStartIndex}({content:S,previousContent:h,previousDirtyStartIndex:k,parseOptions:_.value,customMarkdownIt:e.customMarkdownIt,md:w}),o=t<=0;if(F){const e=function(e,n,t,o={}){var l;if(!n.length)return{nodes:e,metrics:Li(e.length)};const r=null!=(l=o.scanStartIndex)?l:0,i=!1!==o.reuseDirtyTail,a=function(e,n,t,o=0){const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,o));r<l;r++)if(!Pi(n[r],e[r],t))return r;return e.length===n.length?-1:l}(e,n,t,r);if(a<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:a,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const u=e.slice();let s=a;for(let c=0;c<a;c++)u[c]=n[c];if(i)for(let c=a;c<e.length;c++){const o=n[c],l=e[c];o&&Ai(o,l,t)&&(u[c]=o,s+=1)}return{nodes:u,metrics:{reusedNodeCount:s,dirtyStartIndex:a,stablePrefixNodeCount:a,dirtyTailNodeCount:Hi(a,e,n)}}}(E,d,F,{reuseDirtyTail:o,scanStartIndex:t});K=e.nodes,W=e.metrics}else{const e=function(e,n,t={}){var o;if(!n.length)return{nodes:e,metrics:Li(e.length)};const l=null!=(o=t.scanStartIndex)?o:0,r=!1!==t.reuseDirtyTail,i=function(e,n,t=0){const o=Math.min(e.length,n.length);for(let l=Math.min(o,Math.max(0,t));l<o;l++)if(!Ei(n[l],e[l]))return l;return e.length===n.length?-1:o}(e,n,l);if(i<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:i,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const a=e.slice();let u=i;for(let s=0;s<i;s++)a[s]=n[s];if(r)for(let s=i;s<e.length;s++){const t=n[s],o=e[s];t&&Ii(t,o)&&(a[s]=t,u+=1)}return{nodes:a,metrics:{reusedNodeCount:u,dirtyStartIndex:i,stablePrefixNodeCount:i,dirtyTailNodeCount:Hi(i,e,n)}}}(E,d,{reuseDirtyTail:o,scanStartIndex:t});K=e.nodes,W=e.metrics}j=x?hi()-n:0,z=o?null==(null==W?void 0:W.dirtyStartIndex)||W.dirtyStartIndex<0?K.length:W.dirtyStartIndex:K.length}else K=E,W=Li(K.length);!0!==n.effectiveFinal.value&&(F?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Ti(n,"primeSignatureMs",()=>Bi(e[o]))}(K,F,z):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Bi(e[t])}(K,z));const D=x?hi()-P:0;if(v+=1,h=S,f=B,m=I,d=K,b(null!=(o=null==W?void 0:W.dirtyStartIndex)?o:0),x){const e=vi(w),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(l=null==A?void 0:A.total)?l:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(hi()-M),nodes:K.length,contentLength:S.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:D,signatureMs:null!=(r=null==F?void 0:F.signatureMs)?r:0,stabilizeSignatureMs:null!=(s=null==F?void 0:F.stabilizeSignatureMs)?s:0,primeSignatureMs:null!=(c=null==F?void 0:F.primeSignatureMs)?c:0,signatureCallCount:null!=(g=null==F?void 0:F.signatureCallCount)?g:0,stabilizeSignatureCallCount:null!=(y=null==F?void 0:F.stabilizeSignatureCallCount)?y:0,primeSignatureCallCount:null!=(N=null==F?void 0:F.primeSignatureCallCount)?N:0,stabilizeMs:j},null!=W?W:{}),L?Object.fromEntries(ui.map(e=>{var n;return[e,null!=(n=L[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Fi(e,A),streamStats:e}:{}))}return fe(K)});return{effectiveCustomHtmlTags:M,effectiveCustomHtmlTagsSet:L,mdBase:w,mdInstance:C,mergedParseOptions:_,getParsedNodesDirtyStartIndex:()=>k,getParsedNodesRevision:()=>N,parsedNodes:$}}function Wi(e){const{isClient:n}=e,t=X(/* @__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 ji(e={}){const n=X(""),t=X(""),o=X(!1),l=Be(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=E(()=>Math.max(0,n.value.length-t.value.length)),u=E(()=>0===a.value),s=E(()=>o.value&&u.value);return ye()&&ge(()=>{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=>l.reset(e),pause:()=>l.pause(),resume:()=>l.resume()}}const zi={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400};const Di=/auto|scroll|overlay/i;function Vi(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return Di.test(n)||Di.test(t)}function qi(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 Ui={class:"m-0 p-0"},Xi=["data-probe"],Gi=/* @__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(),K("div",{class:"height-estimation-probes",style:se({width:`${e.width}px`}),"aria-hidden":"true"},[W("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(Oo),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),W("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[W("ul",Ui,[V(q(go),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),W("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(yo),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),K(Y,null,ce(6,n=>W("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(fo),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,Xi)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),Yi=P({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return $e(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:Pe(String(null!=(n=e.node.code)?n:"")))});return()=>z("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?z("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)"}},[z("div",{class:"flex items-center gap-x-2 overflow-hidden"},[z("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),z("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),z("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},()=>z("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,z("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[z("div",{class:"absolute inset-0"},[z("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),Ji=P({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=E(()=>{var n,t;return Fe(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:Ke(String(null!=(n=e.node.code)?n:"")))});return()=>z("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?z("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)"}},[z("div",{class:"flex items-center gap-x-2 overflow-hidden"},[z("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),z("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},()=>z("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[z("span",{class:"action-icon block"})])))]):null,z("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)"}},[z("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"}})])])}}),Zi={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 Qi(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 ea=["data-custom-id"],na=["data-node-index","data-node-type"],ta="typewriter-simple-cursor-target",oa=/* @__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},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},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)}const i=Q(),c=$("markstreamNestedRendererProps",void 0);function d(e){const n=null==i?void 0:i.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 f(e){var n,t;const l=o[e];return d(e)?l:null!=(t=null==(n=null==c?void 0:c.value)?void 0:n[e])?t:l}const m=Vr(),h=E(()=>{return"chat"===(e=f("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),v=E(()=>Xr(f("typewriter"))),p=E(()=>"off"!==v.value),g=E(()=>"minimal"===f("domMode")?"minimal":"full"),y=E(()=>{return!0===(e={mode:h.value,codeRenderer:f("codeRenderer"),renderCodeBlocksAsPre:f("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre?"pre":"pre"===e.codeRenderer||"shiki"===e.codeRenderer||"monaco"===e.codeRenderer?e.codeRenderer:!1===e.renderCodeBlocksAsPre||"docs"===e.mode?"monaco":"pre";var e}),k=E(()=>Zi[h.value]),N=E(()=>{var e;return null!=(e=f("showTooltips"))?e:k.value.showTooltips}),b=E(()=>{var e;return null!=(e=f("fade"))?e:k.value.fade}),S=E(()=>{var e;return null!=(e=f("batchRendering"))?e:k.value.batchRendering}),x=E(()=>{var e;return null!=(e=f("initialRenderBatchSize"))?e:k.value.initialRenderBatchSize}),M=E(()=>{var e;return null!=(e=f("renderBatchSize"))?e:k.value.renderBatchSize}),w=E(()=>{var e;return null!=(e=f("renderBatchDelay"))?e:k.value.renderBatchDelay}),B=E(()=>{var e;return null!=(e=f("renderBatchBudgetMs"))?e:k.value.renderBatchBudgetMs}),I=E(()=>{var e;return null!=(e=f("renderBatchIdleTimeoutMs"))?e:k.value.renderBatchIdleTimeoutMs}),T=E(()=>{var e;return null!=(e=f("deferNodesUntilVisible"))?e:k.value.deferNodesUntilVisible}),O=E(()=>{var e;return null!=(e=f("maxLiveNodes"))?e:k.value.maxLiveNodes}),A=E(()=>{var e;return null!=(e=f("liveNodeBuffer"))?e:k.value.liveNodeBuffer}),H=E(()=>{var e;return null!=(e=f("nodeVirtual"))?e:k.value.nodeVirtual}),P={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return f("parseOptions")},get customMarkdownIt(){return f("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return f("customHtmlTags")},get mode(){return f("mode")},get domMode(){return g.value},get htmlPolicy(){return f("htmlPolicy")},get viewportPriority(){return f("viewportPriority")},get viewportPriorityOptions(){return f("viewportPriorityOptions")},get codeBlockStream(){return f("codeBlockStream")},get codeBlockDarkTheme(){return f("codeBlockDarkTheme")},get codeBlockLightTheme(){return f("codeBlockLightTheme")},get codeBlockMonacoOptions(){return f("codeBlockMonacoOptions")},get codeRenderer(){return f("codeRenderer")},get renderCodeBlocksAsPre(){return f("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return f("codeBlockMinWidth")},get codeBlockMaxWidth(){return f("codeBlockMaxWidth")},get codeBlockProps(){return f("codeBlockProps")},get mermaidProps(){return f("mermaidProps")},get d2Props(){return f("d2Props")},get infographicProps(){return f("infographicProps")},get showTooltips(){return N.value},get themes(){return f("themes")},get langs(){return f("langs")},get isDark(){return f("isDark")},get customId(){return f("customId")},get indexKey(){return o.indexKey},get typewriter(){return f("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return f("smoothStreamingOptions")},get parseCoalesceMs(){return f("parseCoalesceMs")},get fade(){return b.value},get batchRendering(){return S.value},get initialRenderBatchSize(){return x.value},get renderBatchSize(){return M.value},get renderBatchDelay(){return w.value},get renderBatchBudgetMs(){return B.value},get renderBatchIdleTimeoutMs(){return I.value},get deferNodesUntilVisible(){return T.value},get maxLiveNodes(){return O.value},get liveNodeBuffer(){return A.value},get nodeVirtual(){return H.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function W(e){l("height-change",e)}function j(e){l("virtual-state-change",e)}function z(e){l("anchor-change",e)}const V=X(),J=X(null),ne=X(null),de=X(null),he=pe({1:null,2:null,3:null,4:null,5:null,6:null}),ve=X(!1),ge=/* @__PURE__ */new Map,ye=X(0),xe=X(0),Me=X({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function we(e,n){return"string"!=typeof e?n:e.trim()||n}function Ce(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const _e=E(()=>{var e;const n=null!=(e=P.viewportPriorityOptions)?e:{},t=we(n.rootMargin,bo);return{rootMargin:t,heavyBlockMargin:we(n.heavyBlockMargin,t),maxTargets:Ce(n.maxTargets)}}),Be=E(()=>{var e;return null!=(e=_e.value.rootMargin)?e:bo}),Le=E(()=>{var e;return null!=(e=_e.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}me(No,_e);const{isClient:We,renderAsFragment:je,debugPerformanceEnabled:ze,resolvedShowTooltips:De,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:qe,ownsTypewriterCursor:Xe}=function(e){const n="undefined"!=typeof window,t=U(),o=$("markstreamHtmlPolicy",void 0),l=$("markstreamTypewriterCursor",void 0),r=$("markstreamSmoothStreaming",void 0),i=E(()=>!0===e.renderAsFragment),a=E(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=E(()=>{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=E(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=E(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(P),{resolveViewportRoot:Ge,resolveScrollContainer:Ye,isReverseFlexScrollRoot:Je,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(Vi(window.getComputedStyle(a))&&qi(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}}}(V,{isClient:We,scrollRoot:He});me("markstreamShowTooltips",De),me("markstreamHtmlPolicy",Ve),me("markstreamTypewriter",p),me("markstreamFade",E(()=>!1!==P.fade)),me("markstreamTypewriterCursor",E(()=>!0)),me("markstreamTextStreamState",ge),me("markstreamStreamVersion",ye),me("markstreamParseOptions",E(()=>P.parseOptions)),me("markstreamCustomMarkdownIt",E(()=>P.customMarkdownIt));const{smoothStreamingEnabled:nn,renderContent:tn,requestedFinal:on,effectiveFinal:ln}=function(e,n){const t=ji(a(a({},zi),e.smoothStreamingOptions)),o=E(()=>{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||"off"!==Xr(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=X(!n.isClient||!0===e.smoothStreaming);ke(()=>{l.value=!0});const r=E(()=>l.value&&o.value),i=E(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),u=E(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),s=E(()=>{const e=u.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return G([()=>e.content,()=>e.nodes,r,u],([e,n,o,l])=>{if(null==n?void 0:n.length)return void t.reset("");const r=null!=e?e:"";if(!o)return t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;r?r===i||(r.startsWith(i)?t.enqueue(r.slice(i.length)):t.reset(r)):t.reset(""),l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:u,effectiveFinal:s}}(P,{isClient:We,inheritedSmoothStreaming:qe}),an=!0===on.value;me("markstreamSmoothStreaming",nn);const sn=X(!1),cn=X(!1);let fn="",mn=!1,hn=null;function vn(){We&&null!=hn&&(window.clearTimeout(hn),hn=null)}function pn(){sn.value=!1,vn()}function yn(e,n){if(!ze.value)return;const t=function(){if(!ze.value)return null;const e=xn(kn),n=xn(Nn),t=Math.max(Sn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=kn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return kn.clear(),Nn.clear(),Sn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}G([()=>P.indexKey,()=>P.customId],()=>{var e,n;pn(),cn.value=!(null==(e=o.nodes)?void 0:e.length)&&!0!==on.value&&Boolean(o.content),fn=null!=(n=tn.value)?n:"",mn=fn.length>0},{flush:"sync"}),G([()=>o.content,()=>o.nodes,on],([e,n,t])=>{!(null==n?void 0:n.length)&&!0!==t&&Boolean(e)&&(cn.value=!0)},{flush:"sync",immediate:!0}),G([tn,()=>o.nodes,on],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(pn(),fn=l,void(mn=!0)):(l.length>0&&(cn.value=!0),mn?(fn&&l.length>fn.length&&l.startsWith(fn)?(sn.value=!0,We&&(vn(),hn=window.setTimeout(()=>{var e;hn=null,!0===ln.value||(null==(e=o.nodes)?void 0:e.length)||(Ka(),sn.value=!1,ja())},1200))):(l.length<fn.length||!l.startsWith(fn))&&pn(),void(fn=l)):(fn=l,void(mn=!0)))},{flush:"sync",immediate:!0});const kn=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map;let bn=!1,Sn=0;function xn(e){let n=0;for(const t of e.values())n+=t;return n}function wn(){Sn=Math.max(Sn,xn(Nn)),Nn.clear(),bn=!1}function Cn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function Bn(e){var n,t;ze.value&&(kn.set(e,(null!=(n=kn.get(e))?n:0)+1),Nn.set(e,(null!=(t=Nn.get(e))?t:0)+1),function(e){const n=function(){if(!We||"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(()=>Cn(n),0):queueMicrotask(()=>Cn(n)):window.requestAnimationFrame(()=>Cn(n))))}(e),bn||(bn=!0,We&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(wn):"function"!=typeof queueMicrotask?setTimeout(wn,0):queueMicrotask(wn)))}function In(e,n){return Bn(e),n()}const Tn=P.customId?`renderer-${P.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,On=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(Tn),An=E(()=>`${Tn}:${ye.value}`);me(Gr,On);const Ln=Ze(()=>P.customId),{effectiveCustomHtmlTagsSet:Hn,mergedParseOptions:Rn,parsedNodes:$n,getParsedNodesDirtyStartIndex:En,getParsedNodesRevision:Pn}=Ki(P,{instanceMsgId:Tn,renderContent:tn,effectiveFinal:ln,smoothStreamingEnabled:nn,debugPerformanceEnabled:ze,customComponentsMap:Ln,logPerf:yn});G($n,()=>{On.clear(),ye.value+=1},{immediate:!0});const Fn=E(()=>({customId:P.customId,customHtmlTags:Rn.value.customHtmlTags,parseOptions:P.parseOptions,customMarkdownIt:P.customMarkdownIt,htmlPolicy:Ve.value,viewportPriority:P.viewportPriority,viewportPriorityOptions:_e.value,mode:h.value,domMode:P.domMode,codeRenderer:y.value,codeBlockStream:P.codeBlockStream,codeBlockDarkTheme:P.codeBlockDarkTheme,codeBlockLightTheme:P.codeBlockLightTheme,codeBlockMonacoOptions:P.codeBlockMonacoOptions,renderCodeBlocksAsPre:P.renderCodeBlocksAsPre,codeBlockMinWidth:P.codeBlockMinWidth,codeBlockMaxWidth:P.codeBlockMaxWidth,codeBlockProps:P.codeBlockProps,mermaidProps:P.mermaidProps,d2Props:P.d2Props,infographicProps:P.infographicProps,showTooltips:De.value,themes:P.themes,langs:P.langs,isDark:P.isDark,typewriter:p.value,smoothStreamingOptions:P.smoothStreamingOptions,parseCoalesceMs:P.parseCoalesceMs,fade:P.fade}));me("markstreamNestedRendererProps",Fn);const Kn=E(()=>$n.value),Wn=E(()=>$n.value.length),jn=X(null),zn=X(null),Dn=X(null),Vn=X(null),qn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Un=!qn&&P.customId?Ar(P.customId):null,Xn=E(()=>Un?(Or.value,Ar(P.customId)):null),Gn=E(()=>{var e;return Boolean(!je.value&&P.customId&&!qn&&(null==(e=Xn.value)?void 0:e.enabled))}),Yn=E(()=>Boolean(We&&Gn.value)),Jn=E(()=>{var e;return Boolean(!je.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),Zn=E(()=>Jn.value),Qn=X(!1);ke(()=>{Qn.value=!0});const et=E(()=>Boolean(We&&Jn.value));me("markstreamHostScrollManaged",et);const nt=E(()=>Boolean(Qn.value&&et.value)),tt=E(()=>Yn.value||et.value),ot=E(()=>Yn.value||nt.value),lt=E(()=>{var e;return tt.value&&!1!==(null==(e=Xn.value)?void 0:e.textEstimation)});function it(){const e=xe.value||In("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const at=E(()=>{const e=it();return e>0?Math.max(1,Math.round(e)):640}),ut=E(()=>{var e,n;return!(!0!==ln.value||Jn.value||"chat"!==h.value&&"minimal"!==h.value||d("maxLiveNodes")||d("liveNodeBuffer")||(null==(e=o.nodes)?void 0:e.length)||cn.value||!((null!=(n=P.maxLiveNodes)?n:0)<=0))}),st=E(()=>{var e;return ut.value?50:Math.max(1,null!=(e=P.maxLiveNodes)?e:320)}),ct=E(()=>{var e;return ut.value?16:Math.max(0,null!=(e=P.liveNodeBuffer)?e:60)}),dt=E(()=>{var e;return!je.value&&!1!==P.nodeVirtual&&!((null!=(e=P.maxLiveNodes)?e:0)<=0&&!ut.value)&&(!0===P.nodeVirtual?$n.value.length>0:$n.value.length>st.value)}),ft=E(()=>dt.value||Yn.value||et.value),mt=E(()=>!1!==P.viewportPriority&&!ve.value),ht=E(()=>{var e;return!(je.value||!1===P.deferNodesUntilVisible||(null!=(e=P.maxLiveNodes)?e:0)<=0||dt.value||$n.value.length>900||!1===P.viewportPriority)}),pt=xo(e=>{var n;return Ge(null!=(n=null!=e?e:V.value)?n:null)},mt),{requestFrame:gt,cancelFrame:yt,hasIdleCallback:wt,isTestEnv:_t}=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:We}),It=E(()=>!0===ln.value&&!Jn.value),{resolvedBatchSize:Ot,resolvedInitialBatch:Lt,batchingEnabled:Ht,incrementalRenderingActive:Rt,renderedCount:$t,previousRenderContext:Pt,adaptiveBatchSize:Kt,previousBatchConfig:jt}=function(e,n){var t;const o=E(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=E(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=E(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=X(0),a=X({key:e.indexKey,total:0}),u=X(Math.max(1,o.value||1)),s=E(()=>{var t,o;return r.value&&!(null==(t=n.forceFullRenderFinalContent)?void 0:t.value)&&(null!=(o=e.maxLiveNodes)?o:0)<=0}),c=X({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}}(P,{isClient:We,isTestEnv:_t,renderAsFragment:je,forceFullRenderFinalContent:It}),Dt=E(()=>{var e;return!je.value&&!1!==P.batchRendering&&Ot.value>0&&!_t&&(null!=(e=P.maxLiveNodes)?e:0)<=0&&!It.value}),qt=E(()=>Dt.value),Ut=E(()=>tt.value||qt.value),Xt=E(()=>{var e;return Ut.value&&!1!==(null==(e=Xn.value)?void 0:e.codeBlockEstimation)}),Gt=/* @__PURE__ */new Map,Yt=/* @__PURE__ */new Map,Jt=/* @__PURE__ */new WeakMap;let Zt=null;const eo=/* @__PURE__ */new WeakMap,no=/* @__PURE__ */new Map,to=[];let lo=[],io=[],ao=-1;const so=R(to),co=/* @__PURE__ */new Set,mo=X(0);let ho=0;const vo=X(0),po=E(()=>(vo.value,Array.from(Gt.entries()).sort((e,n)=>e[0]-n[0]))),ko=X(null),So=X(null);let Mo,wo=null,Co=0,_o=null;function Io(){Mo.markFallbackHeightPrefixDirty()}function To(e){return Mo.getFallbackNodeHeight(e)}function Ao(e,n){return Mo.estimateHeightRange(e,n)}function Lo(e){return Mo.estimateIndexForOffset(e)}const{activeRestoreAnchor:Ho,getRelativeScrollTopWithinContainer:Ro,setRelativeScrollTopWithinContainer:$o,resolveAnchorOffset:Eo,clearRestoreReconcile:Po,scheduleRestoreReconcile:Ko,captureRestoreAnchor:jo,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=X(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)))}qr(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 N(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function b(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:N,applyRestoreAnchor:b,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&b(h.value)}):null,null==v&&h.value&&b(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)},N(),b(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&b(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-k(e)}}}({isClient:We,containerRef:V,parsedNodeCount:Wn,requestFrame:gt,cancelFrame:yt,resolveScrollContainer:()=>ko.value||Ye(),getNormalizedScrollTop:Qe,getOffsetTopWithinRoot:en,isReverseFlexScrollRoot:Je,estimateIndexForOffset:Lo,estimateHeightRange:Ao,getFallbackNodeHeight:To,clamp:rr}),{nodeHeights:Uo,heightStats:Xo,heightTreeSize:Go,heightSumTree:Yo,heightKnownTree:Jo,averageNodeHeight:Zo,resetHeightMeasurements:Qo,pruneHeightMeasurements:el,rebuildHeightTrees:nl,recordNodeHeight:tl,removeNodeHeights:ol,exportHeightCache:ll,importHeightCache:rl,fenwickRangeSum:il}=function(e={}){const n=pe({}),t=pe({total:0,count:0}),o=X(0),l=X([]),r=X([]);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){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 f(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 m=E(()=>t.count>0?Math.max(12,t.total/t.count):32);return{nodeHeights:n,heightStats:t,heightTreeSize:o,heightSumTree:l,heightKnownTree:r,averageNodeHeight:m,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:d,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,c,u(a({},d),{notify:!0}))},removeNodeHeight:function(n,t={}){var o;const l=f(n);return l&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),l},removeNodeHeights:function(n,t={}){var o;let l=0;for(const e of n)f(Number(e))&&l++;return l>0&&!1!==t.notify&&(null==(o=e.onHeightRecorded)||o.call(e)),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&&d(a),null==(i=e.onHeightRecorded)||i.call(e))},fenwickRangeSum:function(e,n,t){if(t<=n)return 0;const o=c(e,t-1);return n<=0?o:o-c(e,n-1)}}}({onHeightRecorded:()=>{Io(),et.value&&Ja(),Ho.value&&Ko(),So.value&&Ai(),Ha("node-resize")}});function al(e){Number.isInteger(e)&&e>=0&&co.add(e)}function ul(e){for(const n of e)al(Number(n))}function sl(e){ho++;let n=!0;try{const t=e();return n=!1!==t,t}finally{ho--,0===ho&&n&&mo.value++}}function cl(){lo=[],io=[],ao=-1,co.clear(),so.value=to}function dl(){cl(),sl(()=>Qo()),no.clear()}function fl(e){!Number.isInteger(e)||e<0||e>=$n.value.length||no.set(e,Mi(e))}function ml(e,n,t={}){const o=Uo[e];al(e),tl(e,n,t);const l=Uo[e];return Object.is(o,l)?(co.delete(e),!1):(l&&l>0?fl(e):o&&no.delete(e),!0)}function hl(e,n){const t=In("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Gt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:In("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function vl(e,n={}){"merge"!==n.mode?cl():ul(e.map(e=>e.index)),sl(()=>rl(e,n)),ca()}const pl=E(()=>ht.value&&mt.value),gl=E(()=>{var e;return!je.value&&!1!==P.batchRendering&&Ot.value>0&&(null!=(e=P.maxLiveNodes)?e:0)<=0}),yl=E(()=>!je.value&&an&&!0===ln.value&&!dt.value&&!Jn.value&&!Gn.value&&!pl.value&&!gl.value),kl=E(()=>!!pt&&(pl.value||dt.value)),Nl=E(()=>dt.value||et.value),{focusIndex:bl,liveRange:Sl,updateLiveRange:xl}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,liveNodeBufferResolved:r,clamp:i}=n,a=null!=r?r:E(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),u=X(0),s=pe({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)}}}(P,{parsedNodeCount:Wn,virtualizationEnabled:dt,maxLiveNodesResolved:st,liveNodeBufferResolved:ct,clamp:rr}),Ml=/* @__PURE__ */new Map,wl=/* @__PURE__ */new Map,Cl=/* @__PURE__ */new Map,_l=[],Bl=/* @__PURE__ */new Map,Il=/* @__PURE__ */new Set,Tl=X(0);let Ol=!1;const Al=E(()=>(Tl.value,Il.size)),Ll=/* @__PURE__ */new Map,Hl=/* @__PURE__ */new Map,Rl=X(0),$l=E(()=>{Rl.value;let e=0;for(const n of Ll.values())e+=Math.max(0,n);return e});let El=null;const Pl=E(()=>{if(!dt.value)return $n.value.length;const e=ct.value,n=Math.max(Sl.end+e,Lt.value),t=Math.min($n.value.length,n);return Math.max($t.value,t)});function Fl(){Ol||(Ol=!0,queueMicrotask(()=>{Ol=!1,Tl.value+=1}))}function Kl(e,n,t="node-resize"){if(!We||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Il.delete(o)&&Fl();try{n()}finally{Ha(t)}},Math.max(0,e));return Il.add(o),Fl(),o}function Wl(e){We&&null!=e&&(Il.delete(e)&&Fl(),window.clearTimeout(e))}function jl(){if(We&&"undefined"!=typeof window)for(const e of Il)window.clearTimeout(e);Il.size&&(Il.clear(),Fl()),_l.length=0,Cl.clear()}function zl(e){J.value=e}function Dl(e){ne.value=e}function Vl(e){de.value=e}const{cancelScheduledFocusSync:ql,scheduleFocusSync:Ul}=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:We,containerRef:V,virtualizationEnabled:dt,requestFrame:gt,cancelFrame:yt,syncFocusToScroll:function(e=!1){var n;if(!dt.value)return;const t=ko.value||Ye();if(!t)return;const o=t.ownerDocument||(null==(n=V.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=$n.value.length;if(i<=0)return;if(!r&&i>0&&Je(t)){const n=In("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=In("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void lr(rr((a=Math.max(0,l)+.5*Math.max(0,n),Mo.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=V.value;if(!l)return null;const r=o?0:In("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=In("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?In("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}):In("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return rr(Lo(a+.5*Math.max(0,u)),0,Math.max(0,$n.value.length-1))}(t,o,l,r);if(null!=u)return void lr(u,e);const s=r?null:In("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?In("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=po.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=In("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=V.value;if(!e)return;const n=r?{top:0}:In("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=In("syncFocusToScroll.fallback.scrollTop",()=>Qe(t,o,r)),a=r?(()=>{const t=In("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?In("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}):In("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void lr(rr(Lo(a+.5*Math.max(0,u)),0,Math.max(0,$n.value.length-1)),!0)}lr(Math.round((m+h)/2),e)}}),{visibleNodeIndices:Xl,nodeVisibilityHandles:Gl,nodeVisibilityWatchStops:Yl,nodeVisibilityFallbackTimers:Jl,clearVisibilityFallback:Zl,markNodeVisible:Ql,cleanupNodeVisibility:er,destroyNodeVisibilityState:nr}=Wi({isClient:We,shouldTrackVisibleNodeIndices:()=>pl.value,shouldCleanupNodeVisibility:()=>dt.value,onNodeMarkedVisible:e=>{dt.value?Ul():bl.value=rr(e,0,Math.max(0,$n.value.length-1))},onNodeVisibilityCleaned:e=>{Gt.delete(e)&&Ra()}}),{cleanupScrollListener:tr,setupScrollListener:or}=function(e){const{isClient:n,virtualizationEnabled:t,listenerEnabled:o,scrollRootElement:l,resolveScrollContainer:r,scheduleFocusSync:i,onScroll:a}=e;let u=null,s=null;function c(){u&&(u(),u=null),s=null,l.value=null}function d(n){const t=e.getScrollTop?e.getScrollTop(n):n.scrollTop;return Math.max(0,Number.isFinite(t)?Math.abs(t):0)}return{cleanupScrollListener:c,setupScrollListener:function(){if(!n)return;if(!(null!=(e=null==o?void 0:o.value)?e:t.value))return void c();var e;const f=r();if(!f)return void c();if(l.value===f&&u)return;c(),s=d(f);const m=()=>{if(null==a||a(),t.value){const e=function(e){const n=d(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}(f);e?i(e):i()}};f.addEventListener("scroll",m,{passive:!0}),l.value=f,u=()=>{f.removeEventListener("scroll",m)}}}}({isClient:We,virtualizationEnabled:dt,listenerEnabled:Nl,scrollRootElement:ko,resolveScrollContainer:Ye,scheduleFocusSync:Ul,onScroll:function(){const e=So.value;if(!e)return;const n=mi();if(!n)return;if(function(e){if(Ma()>=Co)return _o=null,!1;const n=_o;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(_o=null),t}(n))return;const t=vi(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Oi("restore"):Oi("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=V.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return In("scrollListener.getScrollTop",()=>Qe(e,t,o))}});function lr(e,n=!1){const t=rr(e,0,Math.max(0,$n.value.length-1));!n&&Math.abs(t-bl.value)<=1||(bl.value=t,xl())}function rr(e,n,t){return Math.min(Math.max(e,n),t)}function ir(e=$n.value.length){const n=En();return!Number.isInteger(n)||n<0?e:rr(n,0,e)}function ar(e){return null==e?void 0:e.firstElementChild}function ur(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function sr(e,n){e<1||e>6||(he[e]=n)}function cr(){if(!tt.value)return void(xe.value=0);const e=In("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.clientWidth)?n:0});xe.value=e>0?e:0}let dr=null;function fr(){null==dr||dr.disconnect(),dr=null}const mr=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:Nt,delay:0,suspensible:!1});function hr(e){return e===mr}const vr=E(()=>"pre"===y.value?vt:"shiki"===y.value?mr:bt);function pr(){var e;return!1!==(null==(e=P.codeBlockProps)?void 0:e.showHeader)}function gr(e,n,t){const o=Uo[n],l="number"==typeof o&&o>0;if(lt.value&&!l&&!function(e){return!!Ln.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=Er(e,t,Me.value);if(n)return n}if(Xt.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Iu(e,Mu(e));return hr(n)?"markdown":n===vt?"pre":n===vr.value||n===bt?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return Fr(e,{rendererKind:n,monacoOptions:P.codeBlockMonacoOptions,showHeader:pr()})}return null}Ne(()=>{if(mo.value,ho>0)return;const e=$n.value,n=Pn();if(!e.length||!Ut.value)return lo=[],io=[],ao=-1,co.clear(),void(so.value=to);const t=xe.value||In("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return lo=[],io=[],ao=-1,co.clear(),void(so.value=to);const o=function(e){return[Math.round(e),lt.value,Xt.value,Me.value,P.codeBlockMonacoOptions,pr(),y.value,Ln.value,Or.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&&ao===n?e.length:l?ir(e.length):0,u=l?Array.from(co):[];lo.length=e.length;for(let s=a;s<e.length;s++)lo[s]=gr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(lo[s]=gr(e[s],s,t));co.clear(),io=o,ao=n,so.value=lo,be(so)},{flush:"sync"});const yr=E(()=>so.value);Mo=function(e){let n=!0,t=[0],o="";function l(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,i=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),a=e.estimatedNodeHeights.value[n],u=null==a?void 0:a.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,a,i)&&Number.isFinite(u)&&u>0)return u;const s=ri(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&s<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(ni)}(l,i)?s:Math.max(e.averageNodeHeight.value,s)}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=ii(Math.trunc(n),0,i),u=ii(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?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 i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.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(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(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 s(){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:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,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=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:$n,nodeHeights:Uo,heightStats:Xo,heightTreeSize:Go,heightSumTree:Yo,heightKnownTree:Jo,averageNodeHeight:Zo,heightEstimationActive:tt,estimatedNodeHeights:yr,getContainerWidth:it,hasCustomParagraphComponent:()=>Boolean(Ln.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=Qr(xe.value||In("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[$n.value.length,Xo.count,Math.round(Xo.total),Math.round(100*Zo.value),t,n,tt.value?1:0,Or.value,ye.value,Ln.value.paragraph?1:0]},fenwickRangeSum:il}),G(()=>$n.value.length,e=>{var n;Io(),e<=0?dl():(e<Go.value&&(n=e,cl(),sl(()=>el(n))),e!==Go.value&&nl(e))},{immediate:!0});const kr=E(()=>{if(!dt.value)return $n.value.map((e,n)=>({node:e,index:n}));const e=$n.value.length,n=rr(Sl.start,0,e),t=rr(Sl.end,n,e);return $n.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Nr=E(()=>dt.value?Ao(0,Math.min(Sl.start,$n.value.length)):0),br=E(()=>{if(!dt.value)return 0;const e=$n.value.length;return Ao(Math.min(Sl.end,e),e)});function Sr(){return Mo.buildVirtualHeightSummary({topSpacerHeight:Nr.value,bottomSpacerHeight:br.value,width:Lr()})}function xr(){const e=$n.value,n=Sr();return u(a({},n),{probe:{paragraphReady:Boolean(Me.value.paragraph),listItemReady:Boolean(Me.value.listItem),listWrapperOverhead:Me.value.listWrapperOverhead,headingReadyLevels:Object.entries(Me.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=yr.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=yr.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=yr.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=yr.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Uo[n])?c:null}})})}function Mr(){return null!=o.indexKey?String(o.indexKey):Jn.value?`virtual-${Cr()}`:"markdown-renderer"}function wr(e){const n=String(e),t=`${Mr()}-`;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>=$n.value.length?null:l}function Cr(){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:P.customId)?t:Tn)}function _r(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function Br(e){var n;return(null!=e?e:"")===(null!=(n=_r())?n:"")}function Tr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(){const e=y.value;return function(e){var n,t;const o=e.renderer,l="monaco"===o?e.codeBlockMonacoOptions:void 0,r=e.codeBlockProps,i="shiki"===o;return[e.isDark?"dark":"light","monaco"===o?"code-rich":"pre"===o?"code-pre":"code-shiki",!1===e.codeBlockStream?"code-static":"code-stream",Qi(e.codeBlockMinWidth),Qi(e.codeBlockMaxWidth),...i?[Ie(null!=(n=null==r?void 0:r.themes)?n:e.themes,null!=(t=null==r?void 0:r.langs)?t:e.langs)]:[],Qi(null==l?void 0:l.fontSize),Qi(null==l?void 0:l.lineHeight),Qi(null==l?void 0:l.fontFamily),Qi(null==l?void 0:l.tabSize),Qi(null==l?void 0:l.MAX_HEIGHT),Qi(null==l?void 0:l.wordWrap),Qi(null==l?void 0:l.wrappingIndent),Qi(null==l?void 0:l.padding),Qi(null==r?void 0:r.showHeader),Qi(null==r?void 0:r.showCopyButton),Qi(null==r?void 0:r.showExpandButton),Qi(null==r?void 0:r.showPreviewButton),Qi(null==r?void 0:r.showCollapseButton),Qi(null==r?void 0:r.showFontSizeButtons)].join("\0")}({renderer:e,isDark:P.isDark,codeBlockStream:P.codeBlockStream,codeBlockMinWidth:P.codeBlockMinWidth,codeBlockMaxWidth:P.codeBlockMaxWidth,codeBlockMonacoOptions:"monaco"===e?P.codeBlockMonacoOptions:void 0,codeBlockProps:P.codeBlockProps,themes:"shiki"===e?P.themes:void 0,langs:"shiki"===e?P.langs:void 0})}(),[null==n?"":String(n),t].join("\0")}function Lr(){return it()}const Hr=E(()=>Qr(Lr())),Rr=E(()=>[Tr(),Hr.value].join("\0")),$r=E(()=>{var e;return Jn.value?["virtual",null!=(e=_r())?e:"",Cr(),Rr.value].join("\0"):o.indexKey});function Pr(){Rl.value+=1}function Kr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=$n.value.length||e.sessionKey!==Cr()||e.threadKey!==_r()||e.layoutEpochKey!==Rr.value)}function jr(e){const n=String(e),t=Hl.get(n);return t?Kr(t)?t.index:null:wr(n)}function Dr(e="async-node"){(Ll.size||Hl.size)&&(Ll.clear(),Hl.clear(),Pr(),Ha(e))}const Yr=$(Oe,null),Jr={reportHeight(e,n){if(!et.value)return;const t=jr(e);if(null==t)return;const o=Ml.get(t);if(!o)return;const l=Number(n),r=hl(t,o);!function(e,n,t={}){sl(()=>ml(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!et.value)return;const n=wr(e);null!=n&&function(e,n){var t;const o=Hl.get(e);if(o&&Kr(o))return Ll.set(e,Math.max(0,null!=(t=Ll.get(e))?t:0)+1),Pr(),void Ha("async-node");Ll.set(e,1),Hl.set(e,function(e){return{index:e,sessionKey:Cr(),threadKey:_r(),layoutEpochKey:Rr.value}}(n)),Pr(),Ha("async-node")}(String(e),n)},markSettled(e){if(!et.value)return;const n=String(e),t=jr(e);(null!=t||function(e){return Ll.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Ll.get(e))?n:0;return!(t<=0||(t<=1?(Ll.delete(e),Hl.delete(e)):Ll.set(e,t-1),Pr(),1===t&&Ha("async-node"),0))}(n)&&null!=t&&ja()}};function Zr(){let e=0;for(const n of Ml.values())e+=In("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}me(Oe,{reportHeight(e,n){Jr.reportHeight(e,n),null==Yr||Yr.reportHeight(e,n)},markPending(e){Jr.markPending(e),null==Yr||Yr.markPending(e)},markSettled(e){Jr.markSettled(e),null==Yr||Yr.markSettled(e)}});let ei,ti=null,oi=null;function li(e){return!1!==e&&null!=e&&""!==e}function ai(){return dt.value?function(){if(!dt.value)return!0;const e=$n.value.length,n=rr(Sl.start,0,e),t=rr(Sl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Gt.has(o))return!1;if($a(o)&&!Ml.has(o))return!1}return!0}():$t.value>=Pl.value}function ui(){return!0===ln.value&&!sn.value&&0===$l.value&&0===Il.size&&0===Bl.size&&null==El&&ai()}function si(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(ti===Cr()&&ei===_r())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!li(t)&&oi===eu(t)}function ci(){return ui()&&si()}function di(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 fi(e="manual",n){const t=Sr(),o=function(e){return e||(!0!==ln.value?$n.value.length>0?"streaming":"estimating":!ai()||Bl.size>0||null!=El?"measuring":ci()?"settled":"settling")}(n);return{sessionKey:Cr(),threadKey:_r(),phase:o,nodeCount:t.totalNodes,liveRange:{start:Sl.start,end:Sl.end},renderedCount:$t.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:Zr(),totalHeight:hi(),width:t.width,final:!0===ln.value,stable:ci(),confidence:di(o,t),reason:e}}function mi(){const e=ko.value||Ye(),n=V.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=In("getScrollBox.scrollTop",()=>Qe(e,t,o)),r=In("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=In("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 hi(){const e=$n.value.length,n=Math.max(0,Ao(0,e)),t=In("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:In("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):dt.value?n>0?Math.max(1,Math.ceil(n),function(){let e=Nr.value+br.value;for(const n of Gt.values())n&&(e+=Math.max(0,In("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}(n,o)):Math.max(1,Math.ceil(o)):et.value?n>0||Xo.count>0||Mo.getEstimatedNodeHeightCount()>0?(Rt.value&&$t.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function vi(e){const n=V.value;if(!n)return null;const t=In("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:In("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function pi(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=mi(),t=V.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=In("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=In("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=mi(),n=V.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=vi(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=jo();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=$n.value.length;return e<=0?null:{type:"node",nodeIndex:rr(bl.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function gi(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 yi(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 ki=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Ni(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}:${gi(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(Ni(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=Ni(e[a],n,t+1);i=yi(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||ki.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${Ni(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let bi=-1,Si="",xi=[2166136261];function Mi(e){const n=$n.value[e];return n?gi(Ni(n)):""}function wi(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 Ci(){var e,n;const t=ye.value;if(bi===t)return Si;const o=$n.value.length;let l=ir(o);(bi!==t-1||l>o||xi.length<l+1)&&(l=0),0===l?xi=[2166136261]:xi.length=l+1;for(let r=l;r<o;r++){const n=Mi(r);xi[r+1]=wi(null!=(e=xi[r])?e:2166136261,n)}return xi.length=o+1,Si=((null!=(n=xi[o])?n:2166136261)>>>0).toString(36),bi=t,Si}function _i(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=$n.value.length,i=rr(Sl.start-2*ct.value,0,r),a=rr(Sl.end+2*ct.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)}(ll().map(e=>{var n;const t=$n.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Mi(e.index)}):null}).filter(e=>Boolean(e))):[],s=pi({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?Ci():void 0,measurementKey:Tr()||void 0,heightCache:i.length?i:void 0}):null}function Bi(e){var n,t;const o=mi();if(!o)return;const l=function(e){const n=V.value;if(!n)return null;const t=en(n,e.root),o=$n.value.length,l=In("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?In("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=hi();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){Co=Ma()+120,_o=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):qr(o.root,o.doc,i,{isReverseFlexScrollRoot:Je,getNormalizedScrollTop:Qe})}const Ii=[];function Ti(){if(We)for(null!=wo&&(null==yt||yt(wo),wo=null);Ii.length;){const e=Ii.pop();null!=e&&window.clearTimeout(e)}}function Oi(e){const n=Boolean(So.value);So.value=null,Co=0,_o=null,Ti(),n&&e&&Ha(e)}function Ai(){if(!So.value||!We)return;if(null!=wo)return;const e=()=>{wo=null;const e=So.value;e&&Bi(e)};wo=gt?gt(e):null,null==wo&&e()}function Li(e,n={}){const t=$n.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=$n.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==Mi(e.index))}(e))}function Hi(e){const n=Qr(Lr()),t=Qr(e);return-1!==n&&-1!==t&&n===t}function Ri(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 $i(e){var n;return e.sessionKey===Cr()&&!!Br(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Tr()&&!!Hi(Ri(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Ei(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Ei(e){return Boolean(e.contentHash&&e.contentHash===Ci())}function Pi(e){return!Ei(e)}let Fi=null,Di=null,Ui=null,Xi=null,oa=null,la=!1;function ra(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=Qr(Lr());return[null!=(n=_r())?n:"",Cr(),Tr(),$n.value.length,o,e.length,gi(t)].join(":")}function ia(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!et.value||!(null==e?void 0:e.length))return!1;if($n.value.length<=0)return!1;if(!Hi(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Li(e,{requireSignature:!0});if(!t.length)return!la&&"undefined"!=typeof console&&m&&(la=!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=ra(t);return l===Fi?(Di="standalone",!0):(vl(t,{mode:"merge"}),Io(),Fi=l,Di="standalone",Ba(),Ha("restore"),!0)}function aa(e,n={}){var t,o,l;if(!et.value||!e)return!1;if(e.sessionKey!==Cr())return!1;if(!Br(e.threadKey))return!1;if($n.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!ua(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!ua()&&Number(Ri(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&$i(e)){const n=Li(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Pi(e)});n.length&&(vl(n,{mode:"merge"}),Io(),Fi=ra(n),Di="restore",Ba(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Ha("restore"),!0;if(!i)return u&&Ha("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=_r())?t:"",Cr(),Tr(),Hr.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return Ui===s?(u&&Ha("restore"),!0):(Ui=s,function(e){const n=()=>{if("node"===e.type)return Oi(),void Vo({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Po(),Ho.value=null,So.value=e,Ti(),Bi(e),We)for(const e of[0,120,280,480])Ii.push(window.setTimeout(()=>{const e=So.value;e&&Bi(e)},e))};!function(e){if(!dt.value)return!1;const n=$n.value.length;return!(n<=0||(bl.value="node"===e.type?rr(e.nodeIndex,0,n-1):n-1,xl(),0))}(e)?n():le(n)}(i),Ha("restore"),!0)}function ua(){const e=Lr();return Number.isFinite(e)&&e>0}function sa(e){var n;return e.sessionKey===Cr()&&!!Br(e.threadKey)&&($n.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||ua())||!(!(e.anchor&&Number(Ri(e))>0)||ua()))}function ca(){no.clear();for(const e of Object.keys(Uo)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<$n.value.length&&fl(n)}}function da(){null!=El&&(null==yt||yt(El),El=null),Fa()}function fa(){return!We||_t?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(gt)return gt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function ha(e,n=_r(),t=Rr.value){return Cr()===e&&_r()===n&&Rr.value===t}function va(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Cr(),c=_r(),d=Rr.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=fi(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>ha(s,c,d)&&(null==v||Ca()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield fa(),!k())return y();ja(),da()}if(yield function(e){return!We||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&jl(),ja(),da(),!k())return y();const N=ui();N&&(ti=s,ei=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&li(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Ca()===v&&(oi=eu(o.virtualScroll.settledToken)));const b=k()&&N&&si(),S=fi(h,b?"final":void 0);return Oa(S,!0),S})}let pa="content",ga=null,ya=null,ka=0,Na=null,ba=null,Sa=null,xa=null;function Ma(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function wa(e){var n,t;const l=Na;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 Ca(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Qi(e)}function _a(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Tr(),Ci(),Qi(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function Ba(){Sa=null,xa=null,ba=null}function Ia(e){const n=e.heightCache;return(null==n?void 0:n.length)?ra(n):""}function Ta(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:Tr(),null!=(o=e.contentHash)?o:"",Ia(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 Oa(e,n=!1){if(!et.value)return;if(function(e=!1){return!e&&Jn.value&&!nt.value}(n))return;const t=n||wa(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:_i(e,{includeHeightCache:!0})}:{state:_i(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||Ta(e)!==ba}(r,n)));if(t&&(W(e),Na=e,ka=Ma()),r&&i&&(j(r),r.anchor&&z(r.anchor),ba=Ta(r)),e.stable){const n=_a("settled",e);if(n!==Sa){Sa=n;const t=_i(e,{includeHeightCache:!0});t&&(j(t),ba=Ta(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=_a("final",e);if(n!==xa){xa=n;const t=_i(e,{includeHeightCache:!0});t&&(j(t),ba=Ta(t)),function(e){l("render-final",e)}(e)}}}function Aa(){null!=ga&&(null==yt||yt(ga),ga=null),null!=ya&&We&&(window.clearTimeout(ya),ya=null)}function La(){ga=null,ya=null,function(e){if(Bl.size>0||null!=El)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(pa)&&(ja(),da()),Oa(fi(pa))}function Ha(e){var n,t;if(!et.value)return;if(pa=e,null!=ga||null!=ya)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(Ma()-ka)),i=()=>{ya=null,ga=gt?gt(La):null,null==ga&&La()};We&&r>0?ya=window.setTimeout(i,r):i()}function Ra(){vo.value+=1}function $a(e){return!(Rt.value&&e>=$t.value)&&(!pl.value||e<Lt.value||Xl.value.has(e))}function Ea(e){const n=Yl.get(e);n&&(n(),Yl.delete(e));const t=Gl.get(e);t&&(t.destroy(),Gl.delete(e)),Zl(e)}function Pa(e,n){let t=!1;if(n){const o=Gt.get(e);Gt.set(e,n),o!==n&&(t=!0)}else Gt.delete(e)&&(t=!0);if(t&&Ra(),n||Zl(e),!kl.value||!pt)return Ea(e),void(n&&Ql(e,!0));if(!dt.value&&pl.value&&!ve.value&&Gl.size>=Le.value&&(ve.value||(ve.value=!0,m&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),nr()),!kl.value||!pt))return Ea(e),void(n&&Ql(e,!0));if(e<Lt.value&&!dt.value)return Ea(e),void Ql(e,!0);if(Xl.value.has(e))return Ea(e),void Ql(e,!0);if(!n)return void Ea(e);Ea(e);const o=pt(n,{rootMargin:Be.value});if(!o)return;Gl.set(e,o),Ql(e,o.isVisible.value),pl.value&&function(e){if(!We||!pl.value)return;Zl(e);const n=e%17*23,t=window.setTimeout(()=>{if(Jl.delete(e),!pl.value)return;if(Xl.value.has(e))return;const n=Gt.get(e);if(!n)return;const t=Ye(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?In("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?In("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=In("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&Ql(e,!0)},1800+n);Jl.set(e,t)}(e);let l=null;l=G(()=>o.isVisible.value,n=>{if(n){Zl(e),Ql(e,!0),null==l||l(),Yl.delete(e),Gl.get(e)===o&&Gl.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),Yl.set(e,l),dt.value&&Ul()}function Fa(){El=null,sl(()=>{let e=!1;for(const[n,t]of Bl)Bl.delete(n),Ml.get(n)===t.el&&wl.get(n)===t.version&&(e=ml(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function Ka(){null!=El&&(null==yt||yt(El),El=null),Bl.clear()}function Wa(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Ml.get(e)!==n)return;const r=wl.get(e);if(null==r)return;const i=$n.value[e],a=sn.value&&!0!==ln.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=$n.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Bl.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Bl.set(e,{height:d,allowShrink:c,version:r,el:n}),null==El&&(El=gt?gt(Fa):null,null==El&&Fa())}(e,n,hl(e,n))}function ja(){for(const[e,n]of Ml)n&&Wa(e,n)}function za(){null==Zt||Zt.disconnect(),Zt=null,Yt.clear()}function Da(){for(;_l.length;)Wl(_l.pop())}G(nt,e=>{e&&Ha("content")},{flush:"post"}),n({getVirtualMetrics:fi,captureVirtualState:function(e={}){var n;return _i(fi("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);Xi=e,oa={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!aa(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&sa(e)||(Xi=null,oa=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield fa(),ja(),da(),yield le();const n=fi(e);return Oa(n,!0),n})},settle:va,scrollToNode:function(e,n="start"){Oi(),Po();const t=$n.value.length;if(t<=0)return;const o=rr(e,0,t-1),l=()=>{var e;const t=Eo({nodeIndex:o,offsetWithinNodePx:0}),l=To(o),r=mi(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Ro();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)),Ul({immediate:!0}),dt.value&&(bl.value=o,xl())};if(dt.value)return bl.value=o,xl(),void le(l);l()}}),G(()=>ft.value,e=>{if(!e){za();for(const e of Cl.values())for(const n of e)Wl(n);Cl.clear(),wl.clear(),Da(),Ka()}},{immediate:!0}),G(ln,e=>{e&&function(){if(We&&ln.value&&Ml.size){Da();for(const e of[80,240,640]){const n=Kl(e,()=>{for(const[e,n]of Ml)n&&Wa(e,n)},"final");null!=n&&_l.push(n)}}}(),Ha(e?"final":"content")});const Va=Ur(()=>Ha("content"),16),qa=Ur(()=>Ha("batch"),16);G([()=>$n.value.length,()=>$t.value],()=>{So.value&&Ai(),Va()},{flush:"post",immediate:!0}),G([()=>Sl.start,()=>Sl.end],()=>{qa()},{flush:"post"});const{cleanupBatchScheduler:Ua}=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:N,onDatasetChanged:b}=e;let S=null,x="raf",M=null,w=0,C=!1,_=!1;const B=/* @__PURE__ */new Set,I=/* @__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),w+=1;for(const e of B)g&&g(e);for(const e of I)window.clearTimeout(e);B.clear(),I.clear(),M=null,C=!1,_=!1}}function O(){return"undefined"!=typeof performance?performance.now():Date.now()}function A(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=_||f.value<i.value;_=!1,t&&R()}function L(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=O();S=null;const o=null!=M?M:c;M=null;const l=O();f.value=Math.min(u,f.value+o),k(f.value),function(e,o){if(!t)return void A(o);C=!0;const l=++w;le().then(()=>{var t;if(l!==w)return;const r=O(),i=Math.max(o,r-e),a=()=>{l===w&&A(i)};if(p){let e=null,o=null,l=!1;const r=()=>{l||(l=!0,null!==e&&(B.delete(e),e=null),null!==o&&(I.delete(o),window.clearTimeout(o),o=null),a())};return e=p(()=>{r()}),B.add(e),o=window.setTimeout(()=>{null!==e&&g&&g(e),r()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,O()-l)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(M=null!=M?Math.max(M,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?_=!0:null==e?R():L(e,n)}function R(){s.value&&L(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return G([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=p||g;h.value={key:u,total:o};const S=v.value,x=null!=(e=n.renderBatchDelay)?e:16,M=S.batchSize!==c.value||S.initial!==d.value||S.delay!==x||S.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:x,enabled:s.value},p&&N(o),(y||M||!s.value)&&T(),(y||M)&&(m.value=Math.max(1,c.value||1)),y&&b();const w=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=w,void k(f.value);const C=p||0===l.total;f.value=C||M?Math.min(w,d.value):Math.min(f.value,w);const _=Math.max(1,d.value||c.value||o);f.value<w?H(_,{immediate:!t}):k(f.value)},{immediate:!0}),G(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&H())}),{cleanupBatchScheduler:T}}({props:P,isClient:We,isTestEnv:_t,parsedNodesIdentity:Kn,parsedNodeCount:Wn,desiredRenderedCount:Pl,datasetKey:$r,batchingEnabled:Ht,incrementalRenderingActive:Rt,resolvedBatchSize:Ot,resolvedInitialBatch:Lt,renderedCount:$t,adaptiveBatchSize:Kt,previousRenderContext:Pt,previousBatchConfig:jt,requestFrame:gt,cancelFrame:yt,hasIdleCallback:wt,cleanupNodeVisibility:er,onDatasetKeyChanged:e=>{Ka(),dl(),Io(),Ba(),e>0&&nl(e)},onDatasetChanged:()=>{dt.value&&Ul({immediate:!0})}});G([Nl,dt,()=>V.value,()=>He()],([e,n])=>{if(!e)return tr(),void ql();or(),n?Ul({immediate:!0}):ql()},{flush:"post",immediate:!0}),G([()=>$n.value.length,()=>dt.value],e=>s(null,[e],function*([e,n]){n&&e&&We&&(yield le(),Ul({immediate:!0}))}),{flush:"post"}),G(tt,e=>{e&&function(){var e;if(jn.value&&zn.value&&Dn.value&&(null==(e=Vn.value)?void 0:e[1]))return;const n=fe({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=fe({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=fe({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});jn.value=n,zn.value=t,Dn.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]=fe({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Vn.value=l}()},{immediate:!0}),G([()=>V.value,tt],()=>{if(!tt.value)return fr(),void(xe.value=0);cr(),fr(),tt.value&&V.value&&"undefined"!=typeof ResizeObserver&&(dr=new ResizeObserver(()=>{cr(),Ho.value&&Ko(),So.value&&Ai(),Ha("resize")}),dr.observe(V.value))},{immediate:!0}),G([tt,at,Rr],()=>s(null,null,function*(){if(!tt.value)return Me.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Io();yield le(),function(){if(!tt.value||"undefined"==typeof window)return Me.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Io();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=ur(ar(J.value),".paragraph-node");e.paragraph=Wr(J.value,n,"pre-wrap");const t=ar(ne.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=Wr(ne.value,o,"pre-wrap");const l=In("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=de.value)?void 0:e.offsetHeight)?n:0}),r=In("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=ne.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=ur(ar(he[i]),`h${i}`);e.headings[i]=Wr(he[i],n,"pre-wrap")}Me.value=e,Io()}()}),{flush:"post",immediate:!0}),G(()=>$n.value.length,()=>{dt.value&&Ul({immediate:!0})}),G([tt,xe],()=>{Io(),dt.value&&Ul({immediate:!0}),Ho.value&&Ko(),So.value&&Ai(),Ha("resize")},{immediate:!1}),G(()=>pl.value,e=>{if(e)for(const[n,t]of Gt)Pa(n,t);else{nr();for(const[e,n]of Gt)n&&Ql(e,!0)}},{immediate:!1}),G([Be,Le,()=>He()],()=>{var e;null==(e=pt.refresh)||e.call(pt);for(const[n,t]of Gt)Pa(n,t)},{immediate:!1}),G([()=>P.viewportPriority,()=>$n.value.length,Le],([e,n,t])=>{if(!1!==e){if(ve.value&&(n<=200||n<=t)){ve.value=!1;for(const[e,n]of Gt)Pa(e,n)}}else ve.value=!1}),G(()=>$t.value,()=>{dt.value&&Ul({immediate:!0})}),G([bl,st,ct,()=>$n.value.length,dt],()=>{xl()},{immediate:!0});let Xa=null,Ga=!1,Ya=null;function Ja(){Xa=null,ti=null,ei=void 0,oi=null,Ba()}function Za(){Ka(),dl(),Io(),no.clear();const e=$n.value.length;e>0&&nl(e),ca()}function Qa(){Aa(),jl(),Na=null,Fi=null,Di=null,Ui=null,Xi=null,oa=null,Ga=!1,Ja(),Dr("restore"),Po(),Oi()}function eu(e){var n;return[null!=(n=_r())?n:"",Cr(),Tr(),Hr.value,Ca(e),$n.value.length,Math.round(Ao(0,$n.value.length)),Math.round(Lr()),Xo.count,Math.round(Xo.total)].join(":")}function nu(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Ca(r),a=Cr(),u=_r(),s=Rr.value;if(et.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&li(r))if(ui()){if(eu(r)!==oi&&!Ga){Ga=!0;try{const e=yield va({reason:"manual",expectedSettledTokenKey:i}),n=Ca()===i;ha(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(oi=eu(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{Ga=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=li(e)?eu(e):"";ha(a,u,s)&&n&&oi!==n&&nu()}}}else Ha("manual")})}G(et,(e,n)=>{if(e!==n){if(!e)return Qa(),void Aa();Qa(),Za(),Ya=Rr.value,Ha("content")}},{flush:"post"}),G([et,Rr],([e,n])=>{e?null!=Ya?Ya!==n&&(Ya=n,function(e="resize"){Ka(),dl(),Io(),no.clear();const n=$n.value.length;n>0&&nl(n),ca(),Fi=null,Di=null,Ui=null,Na=null,Ga=!1,Ja(),ia(),le(()=>{ja(),Ho.value&&Ko(),So.value&&Ai(),Ha(e)})}("resize")):Ya=n:Ya=null},{flush:"post",immediate:!0}),G([et,()=>Cr(),()=>_r()],([e])=>{e&&(Qa(),Za(),Dr("content"),Ha("content"))}),G([et,()=>Cr(),()=>_r(),Rr,()=>$n.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(Hl.entries()))Kr(o)||(Hl.delete(t),Ll.delete(t),n=!0);n&&(Pr(),Ha(e))}("async-node")},{flush:"post"}),G([et,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>ye.value],([e])=>{e&&(Ba(),function(e="content"){if(!et.value)return;const n=[],t=$n.value.length,o=ir(t);for(const l of Array.from(no.keys())){if(l>=t){n.push(l);continue}if(l<o)continue;const e=Mi(l),r=no.get(l);null!=r&&r!==e&&n.push(l),no.set(l,e)}for(const l of Array.from(no.keys()))l>=t&&no.delete(l);n.length&&(function(e,n={}){const t=Array.from(e,Number);ul(t);let o=0;if(sl(()=>(o=ol(t,n),o>0)),o>0)!function(e){for(const n of e)no.delete(n)}(t);else for(const l of t)co.delete(l)}(n,{notify:!1}),Io(),Ja(),Ho.value&&Ko(),So.value&&Ai(),Ha(e))}("content"))},{flush:"post",immediate:!0}),G([et,()=>$n.value.length,()=>Cr(),()=>_r()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Ja()},{flush:"post"}),G([et,()=>{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},()=>$n.value.length,()=>Cr(),xe],()=>{ia()},{flush:"post",immediate:!0}),G([et,()=>{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},()=>$n.value.length,()=>Cr(),xe],e=>s(null,[e],function*([e,n]){if(!e||!n)return;yield le();const t=function(){var e;const n=null==(e=o.virtualScroll)?void 0:e.restoreAnchor;return null==n||!1===n?null:!0===n?"true":String(n)}();aa(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),G([et,xe,()=>{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&&Fi&&"restore"===Di&&($i(t)||(Za(),Fi=null,Di=null,Ha("resize")))},{flush:"post"}),G([et,()=>$n.value.length,()=>Cr(),xe],e=>s(null,[e],function*([e]){var n;const t=Xi,o=oa;e&&t&&(yield le(),!aa(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)})&&sa(t)||(Xi=null,oa=null))}),{flush:"post",immediate:!0}),G([et,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Cr(),()=>_r(),Rr,$l,Al,()=>$t.value,Pl,()=>Xo.count,()=>Xo.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!ci())return;const o=function(){var e;const n=$n.value.length;return[null!=(e=_r())?e:"",Cr(),Tr(),Hr.value,n,Math.round(Ao(0,n)),Math.round(Lr()),Xo.count,Math.round(Xo.total)].join(":")}();Xa!==o&&(Xa=o,va({reason:"final"}).then(e=>{e.stable||Xa!==o||(Xa=null)}))},{flush:"post",immediate:!0}),G([et,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Cr(),()=>_r(),Rr,$l,Al,()=>$t.value,Pl,()=>$n.value.length,()=>Xo.count,()=>Xo.total],()=>{nu()},{flush:"post",immediate:!0}),G([()=>$n.value.length,dt,st,ct,()=>Sl.start,()=>Sl.end],([e,n,t,o,l,r])=>{ze.value&&yn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:bl.value,scroll:n?(()=>{const e=ko.value||Ye();return e?{reverse:Je(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})}),G([()=>P.customId],([e],n,t)=>{if(!e||qn)return;const o=function(e,n){return e?(Ir.controllers[e]=n,()=>{Ir.controllers[e]===n&&delete Ir.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:jo,restoreAnchor:Vo,getAnchorDrift:qo,getReport:xr});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(et.value)try{ja(),da();const e=fi("manual");wa(e)&&(W(e),Na=e,ka=Ma());const n=_i(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(j(n),n.anchor&&z(n.anchor),ba=Ta(n))}catch(e){}}(),Ua(),nr(),vn(),za();for(const e of Cl.values())for(const n of e)Wl(n);Cl.clear(),wl.clear(),no.clear(),Da(),Ka(),fr(),Po(),Oi(),Aa(),tr(),ql()});const tu=re({loader:()=>s(null,null,function*(){try{return(yield import("./index11.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),vt}}),loadingComponent:Ji,delay:0}),ou=re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',e),vt}}),loadingComponent:Yi,delay:0}),lu=re(()=>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),vt}})),ru={text:kt,paragraph:Oo,heading:fo,code_block:bt,list:yo,list_item:go,blockquote:Qt,table:Fo,definition_list:oo,footnote:uo,footnote_reference:dn,footnote_anchor:ro,admonition:ma,vmr_container:Do,hardbreak:Vt,link:Et,image:rt,thematic_break:Wo,math_inline:St,math_block:xt,strong:Tt,emphasis:zt,strikethrough:At,highlight:Wt,insert:Ft,subscript:Bt,superscript:Ct,emoji:un,checkbox:rn,checkbox_input:rn,inline_code:_n,html_inline:Mn,reference:Mt,html_block:Bo},iu=E(()=>Mr()),au=E(()=>zr(P.codeBlockProps)),uu=E(()=>zr(P.codeBlockProps,{omit:["langs"]})),su=E(()=>a(a({stream:P.codeBlockStream,darkTheme:P.codeBlockDarkTheme,lightTheme:P.codeBlockLightTheme,monacoOptions:P.codeBlockMonacoOptions,themes:P.themes,langs:"shiki"===y.value?P.langs:void 0,minWidth:P.codeBlockMinWidth,maxWidth:P.codeBlockMaxWidth},"boolean"==typeof De.value?{showTooltips:De.value}:{}),uu.value)),cu=E(()=>a(u(a({},su.value),{langs:P.langs}),au.value));function du(e){return"boolean"==typeof e?e:void 0}const fu=E(()=>{const e=P.codeBlockProps||{},n={},t=du(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const o=du(e.diffInline);void 0!==o&&(n.diffInline=o);const l=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(e.reservedHeightPx);return void 0!==l&&(n.reservedHeightPx=l),n}),mu=E(()=>a(a({stream:P.codeBlockStream,darkTheme:P.codeBlockDarkTheme,lightTheme:P.codeBlockLightTheme,themes:P.themes,langs:P.langs,minWidth:P.codeBlockMinWidth,maxWidth:P.codeBlockMaxWidth},"boolean"==typeof De.value?{showTooltips:De.value}:{}),au.value)),hu=E(()=>a({},P.mermaidProps||{})),vu=E(()=>a({},P.d2Props||{})),pu=E(()=>a({},P.infographicProps||{})),gu=E(()=>({typewriter:p.value,fade:P.fade,customHtmlTags:Rn.value.customHtmlTags})),yu=E(()=>a(a({},gu.value),"boolean"==typeof De.value?{showTooltip:De.value}:{})),ku=E(()=>a(a({},gu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),Nu=E(()=>a(a({},gu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{})),bu=E(()=>a(a({},gu.value),"boolean"==typeof De.value?{showTooltips:De.value}:{}));function Su(e){return Array.isArray(e.children)&&e.children.length>0}const xu=E(()=>kr.value.map(e=>{var n,t,o,l,r,i,s,c;let d=function(e){var n,t,o,l,r,i,u;if("code_block"!==e.type)return e;const s=e,c=[String(null!=(n=s.language)?n:""),String(null!=(t=s.loading)?t:""),String(null!=(o=s.diff)?o:""),String(null!=(l=s.code)?l:""),String(null!=(r=s.originalCode)?r:""),String(null!=(i=s.updatedCode)?i:""),String(null!=(u=s.raw)?u:"")].join("\0"),d=eo.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return eo.set(s,{signature:c,node:f}),f}(e.node);const f=Mu(d);let m=Iu(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===ru[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=Ln.value[r];if(Hn.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:L(e.content,r)});else if(_(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===d.type?(m=kt,d={type:"text",content:n,raw:n}):(m=Oo,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h="code_block"===d.type&&"pre"===y.value&&m===vt&&!wu(Ln.value,f);let v=a({},function(e,n,t){const o=null!=n?n:Mu(e);if("code_block"===e.type){const n=o?wu(Ln.value,o):void 0;if(t&&"pre"===y.value&&!n&&t===vt)return fu.value;if(t&&o&&t===n)return"mermaid"===o?_u(e):"infographic"===o?Bu(e):"d2"===o||"d2lang"===o?vu.value:cu.value;if(t&&t===Ln.value.code_block)return cu.value;if(hr(t))return mu.value}return"mermaid"===o?_u(e):"infographic"===o?Bu(e):"d2"===o||"d2lang"===o?vu.value:"link"===e.type?yu.value:"list"===e.type?ku.value:"blockquote"===e.type?Nu.value:"table"===e.type?bu.value:"code_block"===e.type?su.value:gu.value}(d,f,m));const p=tt.value?yr.value[e.index]:null;"code_block"===d.type&&"code-block"===(null==p?void 0:p.kind)&&(v=u(a({},v),h?{reservedHeightPx:null!=(r=p.height)?r:p.contentHeight}:{estimatedHeightPx:p.height,estimatedContentHeightPx:p.contentHeight})),h||"code_block"!==d.type||"mermaid"!==f||null!=Ee(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Fe(Ke(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Ee(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:$e(Pe(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:An.value}));const g=function(e,n){const t=String(e.type);return!Ue(t)&&Ln.value[t]===n}(d,m),k=g?gn(d,Ve.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=k?k:{}),v),rendersCustomNode:g,hasSlotChildren:Su(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${iu.value}-${e.index}`})}));function Mu(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function wu(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Ae(t),Te(t)]){const n=o&&e[o];if(n)return n}}function Cu(e,n,t,o){var l,r;const i=a({},e.value);return null==Ee(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Ee(i.maxHeight))?r:void 0)),i}function _u(e){return Cu(hu,e,Ke,Fe)}function Bu(e){return Cu(pu,e,Pe,$e)}function Iu(e,n){if(!e)return zo;const t=Ln.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:Mu(e),r=l?wu(t,l):void 0;if(r)return r;if("pre"===y.value)return t.code_block||vt;if("mermaid"===l)return t.mermaid||tu;if("infographic"===l)return t.infographic||ou;if("d2"===l||"d2lang"===l)return t.d2||lu;if(o)return o;return t.code_block||vr.value}return o||ru[String(e.type)]||zo}function Tu(e){l("click",e)}function Ou(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function Au(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function Lu(e){l("mouseover",e)}function Hu(e){l("mouseout",e)}const Ru=X(null),$u=X(!1),Eu=X(null),Pu=E(()=>!("minimal"!==P.domMode||je.value||!1!==P.fade||p.value||$u.value||Dt.value||dt.value||Zn.value||Gn.value||ht.value||0!==Object.keys(Ln.value).length));let Fu,Ku=null,Wu=0,ju=0,zu=0;const Du=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Vu=new Set(Du),qu=[".typewriter-cursor",".height-estimation-probes",...Du.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Uu(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Vu.has(n)}function Xu(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+Xu(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Xu(n),0):0}function Gu(){Fu&&(clearTimeout(Fu),Fu=void 0)}function Yu(){Wu+=1,null!=Ku&&(null==yt||yt(Ku),Ku=null)}function Ju(){Yu(),ns(),Ru.value&&(Ru.value.style.visibility="hidden")}function Zu(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(qu)}function Qu(e){let n=e.lastChild;for(;n;){if(Zu(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(qu)&&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 es(){const e=xu.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Uu(t.node)||!$a(t.index))continue;const o=Gt.get(t.index);if(!o)continue;const l=Qu(o);if(l)return l}return null}function ns(){Eu.value&&(Eu.value.classList.remove(ta),Eu.value=null)}function ts(){if("simple"!==v.value||!We||!$u.value||!V.value)return void ns();const e=es(),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!==Eu.value&&(ns(),n&&(n.classList.add(ta),Eu.value=n))}function os(){if("precise"!==v.value)return;if(!We||!$u.value)return;if(null!=Ku)return;const e=Wu,n=()=>{Ku=null,e===Wu&&function(){var e,n;if("precise"!==v.value)return;if(!(We&&$u.value&&V.value&&Ru.value))return;const t=V.value,o=Ru.value;o.style.visibility="hidden";const l=es();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=In("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")}()};gt?Ku=gt(n):n()}return G([tn,()=>o.content,()=>o.nodes,()=>P.typewriter,ln],()=>s(null,null,function*(){var e,n;if(!We||je.value||!Xe.value)return;if(ln.value)return $u.value=!1,Gu(),void Ju();if(null==(e=o.nodes)?void 0:e.length)return $u.value=!1,Gu(),Ju(),ju=(null!=(n=o.content)?n:"").length,void(zu=tn.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Xu(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+Xu(n),0):tn.value.length}(),r=!Uu($n.value[$n.value.length-1]),i=t>ju,a=l>zu;if(!p.value||!r||!i&&!a)return p.value&&r||($u.value=!1,Ju()),ju=t,void(zu=l);ju=t,zu=l,$u.value=!0,"precise"===v.value&&Ru.value&&(Ru.value.style.visibility="hidden"),Gu(),yield le(),"simple"===v.value?ts():(ns(),os()),Fu=setTimeout(()=>{Fu=void 0,$u.value=!1},3e3)}),{flush:"post",immediate:!0}),G($u,e=>s(null,null,function*(){e?(yield le(),"simple"!==v.value?(ns(),"precise"===v.value&&os()):ts()):Ju()}),{flush:"post"}),G(v,()=>s(null,null,function*(){if(We&&!je.value&&Xe.value&&$u.value){if(yield le(),"simple"===v.value)return Yu(),void ts();ns(),"precise"!==v.value?Ju():os()}}),{flush:"post"}),G([()=>$t.value,()=>Sl.start,()=>Sl.end],()=>s(null,null,function*(){We&&!je.value&&Xe.value&&$u.value&&(yield le(),"simple"!==v.value?(ns(),"precise"===v.value&&os()):ts())}),{flush:"post"}),ee(()=>{Gu(),Yu(),ns(),On.clear()}),(e,n)=>{const t=Se("NodeRenderer",!0);return q(je)?(F(!0),K(Y,{key:0},ce(xu.value,e=>(F(),K(Y,{key:e.index},[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":P.customId,"is-dark":P.isDark,onClick:Tu,onMouseover:Lu,onMouseout:Hu,onCopy:n[0]||(n[0]=e=>r(e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.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(),ie(t,ue({key:1,ref_for:!0},Fn.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":P.customId,"is-dark":P.isDark,onClick:Tu,onMouseover:Lu,onMouseout:Hu,onCopy:n[2]||(n[2]=e=>r(e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(F(),K("div",{key:1,ref_key:"containerRef",ref:V,class:D(["markstream-vue markdown-renderer",[{dark:P.isDark},{virtualized:dt.value},{"virtual-scroll-coordinated":nt.value},{"stable-layout":yl.value},{"typewriter-simple-cursor":$u.value&&"simple"===v.value}]]),"data-custom-id":P.customId,onClick:Tu,onMouseover:Ou,onMouseout:Au},[ot.value||dt.value?(F(),K(Y,{key:0},[ot.value?(F(),ie(Gi,{key:0,width:at.value,"flow-root":dt.value||nt.value,"paragraph-node":jn.value,"list-item-node":zn.value,"list-node":Dn.value,"heading-nodes":Vn.value,"set-paragraph-wrapper":zl,"set-list-item-wrapper":Dl,"set-list-wrapper":Vl,"set-heading-wrapper":sr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Z("",!0),dt.value?(F(),K("div",{key:1,class:"node-spacer",style:se({height:`${Nr.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],64)):Z("",!0),Pu.value?(F(!0),K(Y,{key:1},ce(xu.value,e=>(F(),K(Y,{key:e.index},[$a(e.index)?(F(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":P.customId,"is-dark":P.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>r(e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):Z("",!0)],64))),128)):(F(!0),K(Y,{key:2},ce(xu.value,e=>(F(),K("div",{key:e.index,ref_for:!0,ref:n=>Pa(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[$a(e.index)?(F(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Mr()}-${e}`;let t=!1;for(const o of Array.from(Ll.keys())){const l=Hl.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Ll.delete(o),Hl.delete(o),t=!0)}t&&(Pr(),Ha("async-node"))}(e),Bl.delete(e),function(e){var n;const t=(null!=(n=wl.get(e))?n:0)+1;wl.set(e,t)}(e);const o=Cl.get(e);if(o){for(const e of o)Wl(e);Cl.delete(e)}if(function(e){const n=Yt.get(e);n&&(null==Zt||Zt.unobserve(n),Jt.delete(n),Yt.delete(e))}(e),!n||!ft.value)return Ml.delete(e),void wl.delete(e);Ml.set(e,n);const l=()=>{Wa(e,n)};queueMicrotask(l);const r=(Zt||"undefined"==typeof ResizeObserver||(Zt=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Jt.get(n.target),t=Yt.get(null!=e?e:-1);null!=e&&t&&Wa(e,t)}else ja()})),Zt);if(r&&(Yt.set(e,n),Jt.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=$n.value[e])?void 0:t.type)?[16,80,240,800]:ln.value?[80]:[];if(n.length){const t=n.map(e=>Kl(e,l,"node-resize")).filter(e=>null!=e);t.length&&Cl.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":P.customId,"is-dark":P.isDark,onCopy:n[12]||(n[12]=e=>r(e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.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(),ie(t,ue({key:1,ref_for:!0},Fn.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":P.customId,"is-dark":P.isDark,onCopy:n[14]||(n[14]=e=>r(e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(te,{key:0,name:"fade",css:!1!==P.fade,appear:!1!==P.fade},{default:oe(()=>[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":P.customId,"is-dark":P.isDark,onCopy:n[8]||(n[8]=e=>r(e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.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(),ie(t,ue({key:1,ref_for:!0},Fn.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,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":P.customId,"is-dark":P.isDark,onCopy:n[10]||(n[10]=e=>r(e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(F(),K("div",{key:1,class:"node-placeholder",style:se({height:`${To(e.index)}px`})},null,4))],8,na))),128)),$u.value&&"precise"===v.value?(F(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:Ru,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Z("",!0),dt.value?(F(),K("div",{key:4,class:"node-spacer",style:se({height:`${br.value}px`}),"aria-hidden":"true"},null,4)):Z("",!0)],42,ea))}}})),[["__scopeId","data-v-73bc50d4"]]),la=oa;la.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",la.__name,la.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,oa)};const ra=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:la},Symbol.toStringTag,{value:"Module"})),ia={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"},aa={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"},ua={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"},sa={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"},ca={class:"admonition-title"},da=["aria-expanded","aria-controls"],fa=["id"],ma=/* @__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=E(()=>{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=X(!!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(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[W("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),K("svg",ia,[...t[1]||(t[1]=[W("circle",{cx:"12",cy:"12",r:"10"},null,-1),W("path",{d:"M12 16v-4"},null,-1),W("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(F(),K("svg",aa,[...t[2]||(t[2]=[W("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),W("path",{d:"M9 18h6"},null,-1),W("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(F(),K("svg",ua,[...t[3]||(t[3]=[W("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),W("path",{d:"M12 9v4"},null,-1),W("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(F(),K("svg",sa,[...t[4]||(t[4]=[W("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),W("path",{d:"M12 8v4"},null,-1),W("path",{d:"M12 16h.01"},null,-1)])])):Z("",!0),W("span",ca,j(r.value),1),o.node.collapsible?(F(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),K("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]=[W("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,da)):Z("",!0)]),xe(W("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(la),{"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,fa),[[Me,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);ma.install=e=>{e.component(ma.__name,ma)};const ha=()=>import("@terrastruct/d2");let va=null,pa=ha,ga=null,ya=!1,ka=!1,Na=0;function ba(e){pa=e,Na++,va=null,ga=null,ya=!1,ka=!1}function Sa(e){ba(null!=e?e:ha)}function xa(){ba(null)}function Ma(){return"function"==typeof pa}function wa(){return s(this,null,function*(){if(va)return va;const e=pa,n=Na;return e?e===ha&&ya?null:ga||(ga=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===ha)return n===Na&&e===pa&&(ya=!0,function(e){ka||(ka=!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===Na&&e===pa&&(ga=null)}return n!==Na||e!==pa?null:t?(va=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),va):null}),ga):null})}let Ca=null,_a=null,Ba=null,Ia=0;function Ta(e){_a=null!=e?e:null,Ca=null,Ba=null,Ia++}function Oa(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Ta(e)}function Aa(){Ta()}function La(){return"function"==typeof _a}function Ha(){return s(this,null,function*(){if(Ca)return Ca;const e=_a,n=Ia;return e?Ba||(Ba=s(null,null,function*(){const t=yield e();if(n!==Ia||e!==_a)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!==Ia||e!==_a?null:o?(Ca=o,Ca):null}).finally(()=>{n===Ia&&e===_a&&(Ba=null)}),Ba):null})}function Ra(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function $a(e,n){null==e||e(n)}function Ea(e,n){return e?($a(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Pa(e,n){const t=Ea(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;$a(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=Ra(o.marginTop),r=Ra(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function Fa(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):Pa(e,n),r=Ea(o,n);return Math.max(0,l-r)}function Ka(e){return"measured"===e||"final"===e}function Wa(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 ja(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 za(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 Da(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 Va(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function qa(e,n,t){const o=ja(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&za(e,n,t).length>0}function Ua(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=ja(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:za(e,n,t).length>0?360:96}function Xa(e){const n=pe(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=pe(/* @__PURE__ */new Map),l=pe(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=X(!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 N,b=!1,S=null,x=!1,M=null;function w(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):(le(e),null)}function _(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function B(){return[...Ce(e.items)]}function I(){const n=Ce(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return Wa(n,t,e)}function O(n,t){return qa(n,t,e)}function A(n,t){const o=T(n,t),l=I(),r=Va(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function L(){const n=Ce(e.measurementKey);return null==n?void 0:String(n)}function H(){const n=Ce(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function R(){const n=Ce(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===H()?"monaco":"pre"}function $(){var e;return`${null!=(e=L())?e:""}${H()}${R()}`}function E(n,t){if(O(n,t))return A(n,t);const o=T(n,t),l=I(),r=Va(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function P(e){const n=B();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 F(e,n){var t;const o=P(e);if(!o||!n)return!1;if(n.sourceKey!==E(o.item,o.index))return!1;const l=O(o.item,o.index)?$():L();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!F(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function W(e,n){var t,o;const l=P(e);return!!(l&&n&&O(l.item,l.index)&&n.sessionKey===A(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=I())?o:"")&&function(e){const n=$(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function j(e,n){return W(e,n)}function z(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:(z(e,Math.ceil(r),n),Math.ceil(r))}function V(e){var n;return W(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 U(){if(!x)return;x=!1,M=null;const e=N;N=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 Y(o,l,r=function(e){const n=P(e);return n?function(e,n){const t=O(e,n)?$():L();return a({sourceKey:E(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!=(b=null==c?void 0:c.widthBucket)?b:0)===(null!=(S=null==f?void 0:f.widthBucket)?S:0)));var c,f,h,p,y,k,b,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&&le(()=>{ue(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,ue(n,e)}))})}();const w=!1!==e.preserveScrollAnchor,_=w?re():void 0,B=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),I=w&&B<=2,T=w&&B<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var A;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),w&&((A=I?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:B}:_)&&(x||(N=A,x=!0,M=C(U))))}function J(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Z(){if(!b)return;b=!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});U()}function Q(){Z(),U()}function ee(n,t={}){const o=function(e){return Pa(s.get(e),w)}(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=P(e);return!!n&&O(n.item,n.index)}(n))return o>0&&Y(n,o),void i();const a=V(n),u=function(e,n){return Fa(s.get(e),w,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=P(n);return c&&!za(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 ne(){const e={},n=B();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=B();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);F(l,r)&&(e[l]=r)}return e}function oe(){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=B();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=L())?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&&F(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 ce(){G(),_(M),x=!1,M=null,N=void 0,_(S),b=!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()&&ge(ce),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:O,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 J(i);if(u===a)return void ee(i);if(J(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;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ee(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=T(n,t),r=Da(n,t,e),a=I(),u=za(n,t,e),s=A(n,t),c=$(),d=H(),f=R(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=we(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,codeRenderer: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!==A(n,t))return;z(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:$()});const o=function(e){return"final"===e.phase||!(!0!==e.final||!Ka(e.confidence))||!!e.stable&&(Ka(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),b||(b=!0,S=C(Z))},onVirtualStateChange(e){e.sessionKey===A(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=L();return u(a({threadKey:I()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:oe()})},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),le(()=>{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:ce}}const Ga=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function Ya(e){return re(e)}const Ja=Ya(()=>import("./index3.js")),Za=Ya(()=>import("./index5.js")),Qa=Ya(()=>import("./index6.js")),eu=Ya(()=>import("./index11.js")),nu=Ya(()=>import("./index10.js")),tu=Ya(()=>import("./index7.js")),ou=Ya(()=>import("./index4.js")),lu=Ya(()=>import("./index8.js")),ru=Ya(()=>import("./index9.js")),iu={MarkdownRender:la,NodeRenderer:la,AdmonitionNode:ma,BlockquoteNode:Qt,CheckboxNode:rn,CodeBlockNode:Ja,DefinitionListNode:oo,EmojiNode:un,EmphasisNode:zt,FootnoteNode:uo,FootnoteReferenceNode:dn,FootnoteAnchorNode:ro,HardBreakNode:Vt,HeadingNode:fo,HtmlBlockNode:Bo,HtmlInlineNode:Mn,HighlightNode:Wt,ImageNode:rt,D2BlockNode:tu,InfographicBlockNode:nu,InlineCodeNode:_n,PreCodeNode:vt,InsertNode:Ft,LinkNode:Et,ListItemNode:go,ListNode:yo,MathBlockNode:Za,MathInlineNode:Qa,MermaidBlockNode:eu,ParagraphNode:Oo,StrikethroughNode:At,StrongNode:Tt,SubscriptNode:Bt,SuperscriptNode:Ct,TableNode:Fo,TextNode:kt,ThematicBreakNode:Wo,VmrContainerNode:Do,ReferenceNode:Mt,MarkdownCodeBlockNode:lu,MarkstreamVirtualTimeline:ru,Tooltip:ou},au={install(e,n){var t,o;Object.entries(iu).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Le(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(Ga,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&He(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&H(n.mathOptions),n&&"infographicLoader"in n&&Ta(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(qn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(Ve,function(e={}){return R(Ge(e))}(n.components))}};export{Ha as $,ma as A,Qt as B,rn as C,tu as D,un as E,ro as F,ln as G,Vt as H,rt as I,vt as J,uo as K,Et as L,Ga as M,en as N,xa as O,Oo as P,Aa as Q,Mt as R,At as S,Fo as T,Sa as U,Do as V,Oa as W,Ua as X,Je as Y,wa as Z,fo as _,Ja as a,Fa as a0,za as a1,Da as a2,Wa as a3,ja as a4,Va as a5,Dn as a6,Ma as a7,Vr as a8,La as a9,qa as aa,Pa as ab,Qe as ac,Zn as ad,Ye as ae,ba as af,Un as ag,Ta as ah,zn as ai,Xa as aj,Yr as ak,Jn as al,ji as am,Mo as an,So as ao,bo as b,oo as c,zt as d,dn as e,Wt as f,Bo as g,Mn as h,nu as i,_n as j,Ft as k,go as l,yo as m,lu as n,ru as o,Za as p,Qa as q,eu as r,Tt as s,Bt as t,Ct as u,kt as v,Wo as w,ou as x,au as y,la as z};
|