markstream-vue 1.0.1-beta.4 → 1.0.1
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/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/dist/CodeBlockNode.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +43 -16
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +1 -1
- package/dist/index2.js +1 -1
- package/dist/index8.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 +10 -7
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 N,isCustomHtmlComponentTag as k,sanitizeHtmlContent as S,sanitizeImageSrc as b,shouldOpenLinkInNewTab as x,NON_STRUCTURING_HTML_TAGS as M,normalizeCustomHtmlTags as w,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as O,resolveCustomHtmlTags as T,parseMarkdownToStructure as I,EXTENDED_STANDARD_HTML_TAGS as L,stripCustomHtmlWrapper as A,setDefaultMathOptions as H}from"stream-markdown-parser";import{defineComponent as $,openBlock as E,createElementBlock as R,createVNode as P,unref as F,createElementVNode as K,Fragment as z,renderList as W,toDisplayString as j,inject as V,computed as D,shallowRef as q,h as U,normalizeClass as X,useAttrs as Z,ref as J,watch as Y,createCommentVNode as G,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,readonly as ce,provide as de,createTextVNode as fe,reactive as me,onScopeDispose as he,markRaw as ve,getCurrentScope as pe,onMounted as ge,resolveComponent as ye,withDirectives as Ne,vShow as ke,toRaw as Se,toValue as be}from"vue";import{resolveStreamingTextUpdate as xe,createSmoothMarkdownStream as Me}from"markstream-core";import{M as we,s as Ce,f as _e}from"./index2.js";import{a as Be}from"./workers-katexWorkerClient.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 Oe=["cite"],Te=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},Ie=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(E(),R("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[P(F(Vr),{"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,["index-key","nodes","custom-id","typewriter","fade"])],8,Oe))}}),[["__scopeId","data-v-83a20fd5"]]);Ie.install=e=>{e.component(Ie.__name,Ie)};const Le=["aria-label"],Ae={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"},He={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"},$e=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(E(),R("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(E(),R("svg",He,[...t[1]||(t[1]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),K("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(E(),R("svg",Ae,[...t[0]||(t[0]=[K("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Le))}),[["__scopeId","data-v-be21ab83"]]);$e.install=e=>{e.component($e.__name,$e)};const Ee={class:"definition-list"},Re={class:"definition-term"},Pe={class:"definition-desc"},Fe=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(E(),R("dl",Ee,[(E(!0),R(z,null,W(n.node.items,(o,l)=>(E(),R(z,{key:l},[K("dt",Re,[P(F(Vr),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),K("dd",Pe,[P(F(Vr),{"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"]]);Fe.install=e=>{e.component(Fe.__name,Fe)};const Ke={class:"emoji-node"},ze=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(E(),R("span",Ke,j(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ze.install=e=>{e.component(ze.__name,ze)};const We="__global__",je="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Ve=(()=>{const e=globalThis;if(e[je])return e[je];const n={scopedCustomComponents:{},revision:q(0)};return e[je]=n,n})(),De=Ve.revision,qe=/* @__PURE__ */Symbol("markstreamCustomComponents"),Ue=/* @__PURE__ */new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Xe(e){return Ue.has(String(e).trim().toLowerCase())}function Ze(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Je(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(Ze(t))]))!e||Xe(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Ye(e,n){"string"==typeof e?Ve.scopedCustomComponents[e]=Je(n||{}):Ve.scopedCustomComponents[We]=Je(e||{}),De.value++}function Ge(e){const n=Je(Ve.scopedCustomComponents[We]||{});if(!e)return n;const t=Je(Ve.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Qe(e){const n=V(qe,null);return D(()=>{var t;return De.value,function(e,n={}){return De.value,a(a(a({},Je(Ve.scopedCustomComponents[We]||{})),Je(n)),Je(function(e){return e&&Ve.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function en(e){if(e===We)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete Ve.scopedCustomComponents[e],De.value++}function nn(){delete Ve.scopedCustomComponents[We],De.value++}const tn=["id"],on=["title"],ln=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(E(),R("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[K("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+j(e.node.id)+"]",9,on)],8,tn))}}),[["__scopeId","data-v-c1463a29"]]);ln.install=e=>{e.component(ln.__name,ln)};const rn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function an(e){rn&&console.warn(e)}function un(e,n="safe",t){return m(e,n,t)}function sn(e){return p(e)}function cn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function dn(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),cn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),cn(e.value)]):Object.entries(l).map(([e,n])=>[e,cn(n)]):null,n,t);var l;if(!o)return;const r=sn(v(o));return Object.keys(r).length>0?r:void 0}function fn(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 mn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function hn(e,n,t,o,l,r,i=!1){const s=function(e,n){return k(e,n)}(e,o);if(g.has(e.toLowerCase())||!s&&y(e,r))return null;if(!s&&N(e,r))return i?[fn(e,n,!0)]:[fn(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=sn(c);return U(n,u(a({},l),{key:f}),t.length>0?t:void 0)}return U(e,u(a({},c),{innerHTML:void 0,key:f}),t.length>0?t:void 0)}function vn(e,n){return f(e,n)}function pn(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=hn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);mn(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=hn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?mn(l[l.length-1].children,a):mn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&an(`Auto-closing unclosed tag: <${i.tagName}>`)}else an(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=hn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?mn(l[l.length-1].children,o):mn(r,o),an(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,rn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const gn=["innerHTML"],yn=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=V("markstreamHtmlPolicy",void 0),o=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Qe(()=>n.customId),r=$({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=D(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:S(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=pn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!vn(e,l.value))return{mode:"html",content:S(e,o.value)};const t=pn(e,l.value,o.value);return null===t?{mode:"html",content:S(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(E(),R("span",{key:0,class:X(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[P(F(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(E(),R("span",{key:1,class:X(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},j(i.value.content),3)):(E(),R("span",{key:2,class:X(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,gn))}}),[["__scopeId","data-v-d17f12b0"]]);yn.install=e=>{e.component(yn.__name,yn)};const Nn={class:"inline-code"},kn={key:0},Sn=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=Z(),o=V("markstreamFade",void 0),l=V("markstreamTextStreamState",void 0),r=V("markstreamStreamVersion",void 0),i=D(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=D(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=D(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=J(n.node.code),c=J("");let d=null==r?void 0:r.value;const f=J(0);function m(){return s.value+c.value}function h(){c.value&&(s.value=m(),c.value="")}Y([()=>n.node.code,u,a,()=>null==r?void 0:r.value],([e,n,t,o])=>{const r=String(null!=e?e:""),i=u.value,m=o!==d;d=o;const h=xe({nextContent:r,persistedContent:i?null==l?void 0:l.get(i):void 0,currentState:{settledContent:s.value,streamedDelta:c.value},typewriterEnabled:a.value,streamRenderVersionChanged:m});s.value=h.settledContent,c.value=h.streamedDelta,h.appended&&(f.value+=1),i&&(null==l||l.set(i,r))},{immediate:!0}),Y(a,e=>{var n;e||(n=m(),s.value=n,c.value="")});const v=D(()=>f.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(E(),R("code",Nn,[s.value?(E(),R("span",kn,j(s.value),1)):G("",!0),c.value?(E(),R("span",{key:1,class:X(["inline-code-stream-delta",[v.value]]),onAnimationend:h},j(c.value),35)):G("",!0)]))}}),[["__scopeId","data-v-1348822e"]]);Sn.install=e=>{e.component(Sn.__name,Sn)};const bn=J(!1),xn=J(""),Mn=J("top"),wn=J(null),Cn=J(null),_n=J(null),Bn=J(null),On=J(null);let Tn=null,In=null,Ln=0;function An(){Tn&&(clearTimeout(Tn),Tn=null),In&&(clearTimeout(In),In=null)}let Hn=!1,$n=null,En=!1;function Rn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Ln;An();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!Hn&&!En&&"undefined"!=typeof document){null!=$n||($n=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":wn.value,content:xn.value,placement:Mn.value,id:Cn.value,originX:_n.value,originY:Bn.value,isDark:null!=(e=On.value)?e:void 0})}}).mount(o),Hn=!0}));try{yield $n}catch(e){Hn=!1,$n=null,En=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),Hn&&i===Ln){Cn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,wn.value=e,xn.value=n,Mn.value=t,_n.value=null!=(o=null==l?void 0:l.x)?o:null,Bn.value=null!=(a=null==l?void 0:l.y)?a:null,On.value="boolean"==typeof r?r:null,bn.value=!0;try{e.setAttribute("aria-describedby",Cn.value)}catch(u){}}});o?a():Tn=setTimeout(a,80)}function Pn(e=!1){Ln+=1,An();const n=()=>{if(wn.value&&Cn.value)try{wn.value.removeAttribute("aria-describedby")}catch(e){}bn.value=!1,wn.value=null,Cn.value=null,_n.value=null,Bn.value=null};e?n():In=setTimeout(n,120)}const Fn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function Kn(e){Object.assign(Fn,e)}const zn=e=>{var n;return null!=(n=Fn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function Wn(e){return{t(n){if(e.te&&Fn[n]&&!e.te(n))return zn(n);const t=e.t(n);return t===n&&Fn[n]?zn(n):t}}}function jn(){const e=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(e)return Wn(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return Wn({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:zn}}function Vn(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 Dn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],qn={key:1,class:"image-placeholder"},Un={key:1,class:"image-node__raw-text"},Xn={key:0,class:"image-shimmer-overlay"},Zn={key:1,class:"image-node__raw-text"},Jn={key:2,class:"image-error"},Yn=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=J(!1),r=J(!1),i=J(""),a=J("primary"),u=J(null),c=Z(),d=V(we,null);let f="",m=null;const h=D(()=>b(t.node.src)),v=D(()=>b(t.fallbackSrc)),p=D(()=>i.value),g=D(()=>!t.lazy),y=D(()=>!t.node.loading&&"failed"!==a.value&&i.value.length>0),N=D(()=>"failed"===a.value),k=D(()=>!g.value&&!l.value&&!r.value&&"failed"!==a.value&&i.value.length>0),S=D(()=>Vn(t,c));function x(e=S.value){e&&u.value&&(null==d||d.reportHeight(e,u.value.offsetHeight))}function M(e=S.value){e&&le(()=>{x(e)})}function w(){m&&(clearTimeout(m),m=null)}function C(){const e=S.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 O(){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:I}=jn();return Y([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}),Y([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 E(),R("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(E(),R("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:X(["image-node__img",{"is-loading":!g.value&&!l.value,"is-loaded":g.value||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:F(I)("image.preview"),onError:B,onLoad:O,onClick:T},null,42,Dn)):G("",!0),e.node.loading&&!r.value?(E(),R("span",qn,[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]=K("span",{class:"image-shimmer"},null,-1))],!0):(E(),R("span",Un,j(e.node.raw),1))])):G("",!0),P(te,{name:"shimmer-fade"},{default:oe(()=>[k.value&&!e.node.loading?(E(),R("span",Xn,[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]=K("span",{class:"image-shimmer"},null,-1))],!0):(E(),R("span",Zn,j(e.node.raw),1))])):G("",!0)]),_:3}),N.value?(E(),R("span",Jn,[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]=K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[K("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),K("span",null,j(F(I)("image.loadError")),1)],!0)])):G("",!0)],512)}}}),[["__scopeId","data-v-373b57e2"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const Gn={key:2},Qn=/* @__PURE__ */$({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=Qe(()=>n.customId),o=V("markstreamHtmlPolicy",void 0),l=V("markstreamNestedRendererProps",void 0),r=D(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=D(()=>{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(()=>Dr),suspensible:!1}),c=D(()=>n.components[String(n.node.type)]),d=D(()=>Boolean(c.value&&t.value[n.node.type]&&!Xe(String(n.node.type)))),f=D(()=>d.value?dn(n.node,r.value):void 0),m=D(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=D(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=D(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(E(),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?(E(),ie(F(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?(E(),ie(F(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"])):G("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(E(),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?(E(),R("span",Gn,j(v.value),1)):G("",!0)}}),et=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],nt={key:0,translate:"no",class:"markstream-pre__diff-code"},tt={class:"markstream-pre__diff-number","aria-hidden":"true"},ot={class:"markstream-pre__diff-content"},lt={class:"markstream-pre__diff-content-inner"},rt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},it=["textContent"],at=/* @__PURE__ */$({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const n=e,t=D(()=>{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=D(()=>`language-${t.value}`),l=D(()=>{var e,t;return String(null!=(t=null==(e=n.node)?void 0:e.code)?t:"").split(/\r\n|\n|\r/)}),r=D(()=>Array.from({length:Math.max(1,l.value.length)},(e,n)=>n+1)),i=D(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),s=D(()=>i.value&&!0===n.diffInline),c=D(()=>{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 d(e,n="context"){const t=function(e){return 0===String(null!=e?e:"").trim().length}(e);return{code:e,kind:t&&"hunk"!==n?"context":n,empty:t}}function f(e){return String(null!=e?e:"").split(/\r\n|\n|\r/)}function m(e){return e.startsWith("-")&&!e.startsWith("---")}function h(e){return e.startsWith("+")&&!e.startsWith("+++")}const v=D(()=>{var e,t,o,r,i,c;const v=l.value.some(e=>m(e)||h(e));if(s.value){const o=v?function(e){const n=[];let t=1,o=1;for(const[l,r]of e.entries())if(r.startsWith("@@"))n.push(u(a({},d(r,"hunk")),{key:`inline-hunk-${l}`,number:""}));else if(m(r))n.push(u(a({},d(r.slice(1),"removed")),{key:`inline-removed-${l}`,number:t++}));else if(h(r))n.push(u(a({},d(r.slice(1),"added")),{key:`inline-added-${l}`,number:o++}));else{const e=r.startsWith(" ")?r.slice(1):r;n.push(u(a({},d(e)),{key:`inline-context-${l}`,number:o})),t++,o++}return n}(l.value):function(e,n){const t=f(e),o=f(n),l=[];let r=0,i=t.length-1,s=o.length-1;for(;r<=i&&r<=s&&t[r]===o[r];)l.push(u(a({},d(o[r])),{key:`inline-prefix-${r}`,number:r+1})),r++;const c=[];for(;i>=r&&s>=r&&t[i]===o[s];)c.unshift(u(a({},d(o[s])),{key:`inline-suffix-${s}`,number:s+1})),i--,s--;for(let f=r;f<=i;f++)l.push(u(a({},d(t[f],"removed")),{key:`inline-removed-source-${f}`,number:f+1}));for(let f=r;f<=s;f++)l.push(u(a({},d(o[f],"added")),{key:`inline-added-source-${f}`,number:f+1}));return l.concat(c)}(null==(e=n.node)?void 0:e.originalCode,null==(t=n.node)?void 0:t.updatedCode);return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:o}]}if(!v&&(null!=(null==(o=n.node)?void 0:o.originalCode)||null!=(null==(r=n.node)?void 0:r.updatedCode)))return[{key:"original",className:"markstream-pre__diff-pane--original",lines:f(null==(i=n.node)?void 0:i.originalCode).map((e,n)=>u(a({},d(e,"removed")),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:f(null==(c=n.node)?void 0:c.updatedCode).map((e,n)=>u(a({},d(e,"added")),{key:`modified-${n}`,number:n+1}))}];const p=[],g=[];for(const n of l.value)if(n.startsWith("@@"))p.push(d(n,"hunk")),g.push(d(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))p.push(d(n.slice(1),"removed"));else if(n.startsWith("+")&&!n.startsWith("+++"))g.push(d(n.slice(1),"added"));else{const e=n.startsWith(" ")?n.slice(1):n;p.push(d(e)),g.push(d(e))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:p.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:g.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}]}),p=D(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"}),g=J(null),y=J([]);let N=null,k=null;function S(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function b(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 x(){"undefined"!=typeof window&&(null!=N&&window.cancelAnimationFrame(N),N=window.requestAnimationFrame(()=>{!function(){var e,n;N=null;const t=g.value;if(!t||!i.value)return void(y.value.length&&(y.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=S(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=S(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")),a=Math.max(l.length,r.length),u=[];for(let i=0;i<a;i++){const t=b(null!=(e=l[i])?e:null,o),a=b(null!=(n=r[i])?n:null,o),s=Math.max(o,t,a);u.push({rowHeight:s,originalHeight:t,modifiedHeight:a})}var s,c;s=y.value,c=u,s.length===c.length&&s.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})||(y.value=u)}()}))}function M(e){null==k||k.disconnect(),k=null,e&&i.value&&"undefined"!=typeof ResizeObserver&&(k=new ResizeObserver(()=>{x()}),k.observe(e))}function w(e,n){const t=y.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 Y(g,e=>{M(e),le(()=>x())},{flush:"post"}),Y([i,v],()=>{M(g.value),le(()=>x())},{flush:"post",immediate:!0}),ee(()=>{null!=N&&(window.cancelAnimationFrame(N),N=null),null==k||k.disconnect(),k=null}),(l,a)=>(E(),R("pre",{ref_key:"preRef",ref:g,style:se(c.value),class:X([o.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":i.value,"markstream-pre--diff-inline":s.value}]),"aria-busy":!0===e.node.loading,"aria-label":p.value,"data-language":t.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[i.value?(E(),R("code",nt,[(E(!0),R(z,null,W(v.value,e=>(E(),R("span",{key:e.key,class:X(["markstream-pre__diff-pane",e.className])},[(E(!0),R(z,null,W(e.lines,(n,t)=>(E(),R("span",{key:n.key,class:X(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(w(t,e.key))},[a[0]||(a[0]=K("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),K("span",tt,j(n.number),1),K("span",ot,[K("span",lt,j(n.code),1)])],6))),128))],2))),128))])):(E(),R(z,{key:1},[n.showLineNumbers?(E(),R("span",rt,[(E(!0),R(z,null,W(r.value,e=>(E(),R("span",{key:e,class:"markstream-pre__line-number"},j(e),1))),128))])):G("",!0),K("code",{translate:"no",class:"markstream-pre__code",textContent:j(e.node.code)},null,8,it)],64))],14,et))}});at.install=e=>{e.component(at.__name,at)};const ut=q(!1);let st=null;const ct={key:0},dt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(st||(st=Be().then(e=>{ut.value=!!e}).catch(()=>{ut.value=!1})),ce(ut)),o=Z(),l=V("markstreamFade",void 0),r=V("markstreamTextStreamState",void 0),i=V("markstreamStreamVersion",void 0),a=D(()=>{const e=o.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),u=D(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),s=D(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),c=J(n.node.content),d=J("");let f=null==i?void 0:i.value;const m=J(0);function h(){return c.value+d.value}function v(){d.value&&(c.value=h(),d.value="")}Y([()=>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=xe({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}),Y(u,e=>{var n;e||(n=h(),c.value=n,d.value="")});const p=D(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(E(),R("span",{class:X([[F(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[c.value?(E(),R("span",ct,j(c.value),1)):G("",!0),d.value?(E(),R("span",{key:1,class:X(["text-node-stream-delta",[p.value]]),onAnimationend:v},j(d.value),35)):G("",!0)],2))}}),[["__scopeId","data-v-43f5105c"]]);dt.install=e=>{e.component(dt.__name,dt)};const ft=$({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return U(at,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"}))}}}),mt=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),at}}),loadingComponent:ft,delay:0,suspensible:!1}),ht=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 U(dt,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 Be())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 U(dt,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:""}$`}}))}})),vt=re(()=>s(null,null,function*(){try{if(yield Be())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 U(dt,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:""}$$`}}))}})),pt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(E(),R("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"]]);pt.install=e=>{e.component(pt.__name,pt)};const gt={class:"superscript-node"},yt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,emphasis:$t,footnote_reference:ln,strikethrough:Mt,highlight:At,insert:It,subscript:kt,emoji:ze,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("sup",gt,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);yt.install=e=>{e.component(yt.__name,yt)};const Nt={class:"subscript-node"},kt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,emphasis:$t,footnote_reference:ln,strikethrough:Mt,highlight:At,insert:It,superscript:yt,emoji:ze,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("sub",Nt,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);kt.install=e=>{e.component(kt.__name,kt)};const St={class:"strong-node"},bt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,emphasis:$t,strikethrough:Mt,highlight:At,insert:It,subscript:kt,superscript:yt,emoji:ze,footnote_reference:ln,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("strong",St,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);bt.install=e=>{e.component(bt.__name,bt)};const xt={class:"strikethrough-node"},Mt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,emphasis:$t,highlight:At,insert:It,subscript:kt,superscript:yt,emoji:ze,footnote_reference:ln,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("del",xt,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);Mt.install=e=>{e.component(Mt.__name,Mt)};const wt=["href","title","aria-label","aria-hidden","target","rel"],Ct=["aria-hidden"],_t={class:"link-text-wrapper relative inline-flex"},Bt={class:"leading-[normal] link-text"},Ot=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=V("markstreamShowTooltips",void 0),o=D(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=D(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(s["--link-color"]=n.color),s}),r=Qe(()=>n.customId),i=D(()=>a({text:dt,strong:bt,strikethrough:Mt,emphasis:$t,image:Yn,html_inline:yn,inline_code:Sn},r.value)),u=Z(),s=D(()=>{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 un(l,"safe","a")}),c=D(()=>a(a({},u),s.value)),d=D(()=>{var e,t;return un({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=D(()=>{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=D(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=D(()=>{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=D(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Pn()}const g=D(()=>{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?(E(),R("span",ue({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},F(u),{style:l.value}),[K("span",_t,[K("span",Bt,[P(F(dt),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=K("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Ct)):(E(),R("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)||"";Rn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(E(!0),R(z,null,W(e.node.children,(t,o)=>(E(),ie(F(Qn),{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,wt))}}}),[["__scopeId","data-v-367e6ca4"]]);Ot.install=e=>{e.component(Ot.__name,Ot)};const Tt={class:"insert-node"},It=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,emphasis:$t,strikethrough:Mt,highlight:At,subscript:kt,superscript:yt,emoji:ze,footnote_reference:ln,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("ins",Tt,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);It.install=e=>{e.component(It.__name,It)};const Lt={class:"highlight-node"},At=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,emphasis:$t,strikethrough:Mt,insert:It,subscript:kt,superscript:yt,emoji:ze,footnote_reference:ln,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("mark",Lt,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);At.install=e=>{e.component(At.__name,At)};const Ht={class:"emphasis-node"},$t=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,html_inline:yn,strong:bt,strikethrough:Mt,highlight:At,insert:It,subscript:kt,superscript:yt,emoji:ze,footnote_reference:ln,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),R("em",Ht,[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{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"]]);$t.install=e=>{e.component($t.__name,$t)};const Et=["href","title"],Rt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth",block:"center"})}return(n,o)=>(E(),R("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Et))}}),[["__scopeId","data-v-e1eb37b6"]]);Rt.install=e=>{e.component(Rt.__name,Rt)};const Pt=["id"],Ft={class:"flex-1"},Kt=/* @__PURE__ */$({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(E(),R("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[K("div",Ft,[P(F(Vr),{"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,Pt))}});Kt.install=e=>{e.component(Kt.__name,Kt)};const zt={class:"hard-break"},Wt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(E(),R("br",zt))}),[["__scopeId","data-v-50c58f70"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const jt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Qe(()=>n.customId),o=D(()=>a({text:dt,inline_code:Sn,link:Ot,image:Yn,strong:bt,emphasis:$t,strikethrough:Mt,highlight:At,insert:It,subscript:kt,superscript:yt,emoji:ze,checkbox:$e,checkbox_input:$e,footnote_reference:ln,hardbreak:Wt,math_inline:ht,reference:pt},t.value));return(t,l)=>(E(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[(E(!0),R(z,null,W(e.node.children,(t,l)=>(E(),ie(F(Qn),{key:`${e.indexKey||"heading"}-${l}`,components:o.value,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-255b50da"]]),Vt=jt;Vt.install=e=>{e.component(jt.__name,jt)};const Dt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Object.freeze({}),l=D(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:o});return(e,o)=>{var r,i;return E(),R("li",ue({class:"list-item",dir:"auto"},l.value),[P(F(Vr),{"show-tooltips":n.showTooltips,"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"batch-rendering":!1,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"])],16)}}}),[["__scopeId","data-v-4ad4167b"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const qt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=Qe(()=>e.customId),t=D(()=>n.value.list_item||Dt);return(n,o)=>(E(),ie(ae(e.node.ordered?"ol":"ul"),{class:X(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(E(!0),R(z,null,W(e.node.items,(l,r)=>{var i;return E(),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,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","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-7c789f94"]]);qt.install=e=>{e.component(qt.__name,qt)};const Ut=/* @__PURE__ */Symbol("ViewportPriority");function Xt(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?J(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let u=null,s=null;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Set;let f=null;function m(){if(!c.size){try{null==u||u.disconnect()}catch(e){}u=null,s=null,d.size||function(){if(null!=f){try{null==a||a(f)}catch(e){}f=null}}()}}function h(e){const n=c.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==u||u.unobserve(e)}catch(t){}c.delete(e),d.delete(e),m()}}function v(){i&&null==f&&d.size&&(f=i(()=>{f=null;const e=d.values().next().value;e&&(d.delete(e),h(e),d.size&&v())},{timeout:1200}))}const p=(n,t)=>{const o=J(!1);let i,a=!1;const f=new Promise(e=>{i=()=>{a||(a=!0,e())}}),p=()=>{try{null==u||u.unobserve(n)}catch(e){}c.delete(n),d.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:p};const g=function(n,t){if(!l)return u;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(u&&(i=o,(r=s)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return u;var r,i;if(u)try{u.disconnect()}catch(a){}u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&h(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),s=o;for(const e of c.keys())u.observe(e);return u}(n,t);return g?(c.set(n,{resolve:i,visible:o}),g.observe(n),d.add(n),v(),{isVisible:o,whenVisible:f,destroy:p}):(o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:p})};return de(Ut,p),p}function Zt(){var e,n;const t=V(Ut,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,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=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||s()}},d=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),c(e),r.size&&d())},{timeout:1200}))};return e=>{const n=J(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),u=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||s()},f=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&c(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return f?(o.set(e,{resolve:t,visible:n}),f.observe(e),r.add(e),d(),{isVisible:n,whenVisible:a,destroy:u}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:u})}}const Jt={key:2,class:"html-block-node__raw"},Yt=["innerHTML"],Gt={key:1,class:"html-block-node__placeholder"},Qt=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=V("markstreamHtmlPolicy",void 0),o=V("markstreamNestedRendererProps",void 0),l=D(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=D(()=>{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(()=>Dr),suspensible:!1}),s=D(()=>{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=D(()=>{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=Qe(()=>n.customId),f=$({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=J(null),p=J("undefined"==typeof window),g=J(n.node.content),y=D(()=>Array.isArray(n.node.children)?n.node.children:[]),k=D(()=>String(n.node.tag||"div")),b=D(()=>{const e=k.value.trim().toLowerCase();return M.has(e)||N(e,l.value)}),x=D(()=>y.value.length>0&&!!n.node.tag&&!b.value),w=D(()=>{var e,t,o;if(x.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:S(r,l.value)};if(n.node.loading){const e=pn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!vn(r,d.value))return{mode:"html",content:S(r,l.value)};const i=pn(r,d.value,l.value);return null===i?{mode:"html",content:S(r,l.value)}:{mode:"dynamic",nodes:i}}),C=Zt(),_=J(null),B=!!n.node.loading;return"undefined"!=typeof window?(Y(m,e=>{var t,o;if(null==(o=null==(t=_.value)?void 0:t.destroy)||o.call(t),_.value=null,!B)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);const l=C(e,{rootMargin:"400px"});_.value=l,p.value=l.isVisible.value,l.whenVisible.then(()=>{p.value=!0})},{immediate:!0}),Y(()=>n.node.content,e=>{B&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=_.value)?void 0:e.destroy)||n.call(e),_.value=null}),(n,t)=>(E(),ie(ae(x.value?k.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},x.value?c.value:void 0),{default:oe(()=>[p.value?(E(),R(z,{key:0},["structured"===w.value.mode?(E(),ie(F(i),ue({key:0},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):"dynamic"===w.value.mode?(E(),ie(F(f),{key:1,nodes:w.value.nodes},null,8,["nodes"])):"text"===w.value.mode?(E(),R("pre",Jt,j(w.value.content),1)):(E(),R("div",ue({key:3},s.value,{innerHTML:w.value.content}),null,16,Yt))],64)):(E(),R("div",Gt,[ne(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=K("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=K("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=K("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-f1744dfb"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo={dir:"auto",class:"paragraph-node"},no=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=Qe(()=>n.customId),o=V("markstreamHtmlPolicy",void 0),l=V("markstreamParseOptions",void 0),r=V("markstreamCustomMarkdownIt",void 0),i=V("markstreamNestedRendererProps",void 0),s=D(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),c=D(()=>{var e;return null!=(e=n.parseOptions)?e:null==l?void 0:l.value}),d=D(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==r?void 0:r.value}),f=D(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==i?void 0:i.value)?void 0:e.customHtmlTags}),m=D(()=>{var e,t;const o=null!=(e=null==i?void 0:i.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:f.value,parseOptions:c.value,customMarkdownIt:d.value,htmlPolicy:s.value})}),h=re({loader:()=>Promise.resolve().then(()=>Dr),suspensible:!1});function v(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const p=D(()=>n.node.children.filter(e=>!v(e))),g=D(()=>p.value.length>0&&p.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!v(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),y=D(()=>new Set(w(f.value))),N=D(()=>{if(!g.value||p.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const o=n.node.children[t];if(!v(o)){e.push(o);continue}const l=e.length>0,r=n.node.children.slice(t+1).some(e=>!v(e));l&&r&&e.push(u(a({},o),{content:" ",raw:" "}))}return e});function k(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":f.value}}const S=D(()=>a({inline_code:Sn,image:Yn,link:Ot,hardbreak:Wt,emphasis:$t,strong:bt,strikethrough:Mt,highlight:At,insert:It,subscript:kt,superscript:yt,html_inline:yn,html_block:Qt,emoji:ze,checkbox:$e,math_inline:ht,checkbox_input:$e,reference:pt,footnote_anchor:Rt,footnote_reference:ln,text:dt},t.value)),b=D(()=>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&&!y.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:dt,isCustomComponent:!1}}}return{child:e,component:S.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Xe(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?dn(r.child,s.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)=>(E(),R("p",eo,[(E(!0),R(z,null,W(b.value,e=>{return E(),R(z,{key:e.key},[g.value&&v(e.originalChild)?(E(),R(z,{key:0},[fe(j((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(E(),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":f.value,"is-dark":m.value.isDark}),{default:oe(()=>[e.hasSlotChildren?(E(),ie(F(h),ue({key:0,ref_for:!0},m.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?(E(),ie(F(h),ue({key:1,ref_for:!0},m.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(E(),ie(ae(e.component),ue({key:2,ref_for:!0},k(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-4c47fbd3"]]);no.install=e=>{e.component(no.__name,no)};const to={class:"table-node-wrapper"},oo=["aria-busy"],lo={key:0},ro=["aria-label","onPointerdown"],io={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ao=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=D(()=>{var e;return null!=(e=n.node.loading)&&e}),o=D(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=J(null),r=J([]);let i=null;const a=D(()=>r.value.map(e=>e>0?{width:`${e}px`}:void 0)),u=D(()=>r.value.length>0);function s(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 c(){i&&(window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",c),i=null)}return Y(()=>n.node.header.cells.length,()=>{c(),r.value=[]}),ee(c),(d,f)=>(E(),R("div",to,[K("table",{ref_key:"tableRef",ref:l,class:X(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(E(),R("colgroup",lo,[(E(!0),R(z,null,W(e.node.header.cells,(e,n)=>(E(),R("col",{key:`col-${n}`,style:se(a.value[n])},null,4))),128))])):G("",!0),K("thead",null,[K("tr",null,[(E(!0),R(z,null,W(e.node.header.cells,(t,o)=>(E(),R("th",{key:`header-${o}`,dir:"auto",class:X(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[P(F(Vr),{nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:f[0]||(f[0]=e=>d.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade"]),o<e.node.header.cells.length-1?(E(),R("button",{key:0,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",s),window.addEventListener("pointerup",c),window.addEventListener("pointercancel",c))}(o,e)},null,40,ro)):G("",!0)],2))),128))])]),K("tbody",null,[(E(!0),R(z,null,W(o.value,(e,t)=>(E(),R("tr",{key:`row-${t}`},[(E(!0),R(z,null,W(e.cells,(e,o)=>(E(),R("td",{key:`cell-${t}-${o}`,class:X(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[P(F(Vr),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,onCopy:f[1]||(f[1]=e=>d.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade"])],2))),128))]))),128))])],10,oo),P(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(E(),R("div",io,[ne(d.$slots,"loading",{isLoading:t.value},()=>[f[2]||(f[2]=K("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),f[3]||(f[3]=K("span",{class:"sr-only"},"Loading",-1))],!0)])):G("",!0)]),_:3})]))}}),[["__scopeId","data-v-93c55efe"]]);ao.install=e=>{e.component(ao.__name,ao)};const uo={class:"hr-node"},so=/* @__PURE__ */Te({},[["render",function(e,n){return E(),R("hr",uo)}],["__scopeId","data-v-39b2349c"]]);so.install=e=>{e.component(so.__name,so)};const co={class:"unknown-node"},fo=/* @__PURE__ */$({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(E(),R("div",co,j(e.node.raw),1))}),mo=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=D(()=>`vmr-container vmr-container-${n.node.name}`),o=Qe(()=>n.customId),l=D(()=>a({text:dt,paragraph:no,heading:Vt,inline_code:Sn,link:Ot,image:Yn,strong:bt,emphasis:$t,strikethrough:Mt,insert:It,subscript:kt,superscript:yt,checkbox:$e,checkbox_input:$e,hardbreak:Wt,math_inline:ht,reference:pt,list:qt,math_block:vt,table:ao},o.value));return(o,r)=>(E(),R("div",ue({class:t.value},e.node.attrs),[(E(!0),R(z,null,W(e.node.children,(t,o)=>{return E(),ie(ae((r=t.type,l.value[r]||fo)),{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"]]);mo.install=e=>{e.component(mo.__name,mo)};const ho=["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"],vo=[[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 po(e){if(e<=255)return ho[e];let n=0,t=vo.length-1;for(;n<=t;){const o=n+t>>1,l=vo[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const go=/[ \t\n\r\f]+/g,yo=/[\t\n\r\f]| {2,}|^ | $/;let No=null;const ko=new RegExp("\\p{Script=Arabic}","u"),So=new RegExp("\\p{M}","u"),bo=new RegExp("\\p{Nd}","u");function xo(e){return ko.test(e)}function Mo(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function wo(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(Mo(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Mo(t))return!0}}return!1}const Co=/* @__PURE__ */new Set([" "," ","","\ufeff"]);function _o(e){return wo(e)}function Bo(e){return!function(e){const n=zo(e);return null!==n&&(Oo.has(n)||Lo.has(n))}(e)&&!function(e){const n=zo(e);return null!==n&&Co.has(n)}(e)}const Oo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),To=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),Io=/* @__PURE__ */new Set(["'","’"]),Lo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Ao=/* @__PURE__ */new Set([":",".","،","؛"]),Ho=/* @__PURE__ */new Set(["၏"]),$o=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Eo(e){if(Fo(e))return!0;let n=!1;for(const t of e)if(Lo.has(t))n=!0;else if(!n||!So.test(t))return!1;return n}function Ro(e){for(const n of e)if(!Oo.has(n)&&!Lo.has(n))return!1;return e.length>0}function Po(e){if(Fo(e))return!0;for(const n of e)if(!To.has(n)&&!Io.has(n)&&!So.test(n))return!1;return e.length>0}function Fo(e){let n=!1;for(const t of e)if("\\"!==t&&!So.test(t)){if(!(To.has(t)||Lo.has(t)||Io.has(t)))return!1;n=!0}return n}function Ko(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 zo(e){if(0===e.length)return null;const n=Ko(e,e.length);return e.slice(n)}function Wo(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(So.test(e))t--;else{if(!To.has(e)&&!Io.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function jo(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function Vo(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 Do(e,n){return e&&null!==n&&Ao.has(n)}function qo(e){const n=zo(e);return null!==n&&Ho.has(n)}function Uo(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 Xo(e){let n=e.length;for(;n>0;){const t=Ko(e,n),o=e.slice(t,n);if($o.has(o))return!0;if(!Lo.has(o))return!1;n=t}return!1}function Zo(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 Jo=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Yo(e){return 1===e.length?e[0]:e.join("")}function Go(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Yo(t)}function Qo(e,n,t,o){if(!Jo.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=Zo(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:Yo(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:Yo(i),isWordLike:u,kind:r,start:a}),l}function el(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const nl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function tl(e,n){const t=e.texts[n];return!!t.startsWith("www.")||nl.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function ol(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const ll=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),rl=/^[A-Za-z0-9_]+[,:;]*$/,il=/[,:;]+$/;function al(e){for(const n of e)if(bo.test(n))return!0;return!1}function ul(e){if(0===e.length)return!1;for(const n of e)if(!bo.test(n)&&!ll.has(n))return!1;return!0}function sl(e,n,t){var o,l,r;const i=(null===No&&(No=new Intl.Segmenter(void 0,{granularity:"word"})),No);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],N=[];for(const M of i.segment(e))for(const e of Qo(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==m[M]&&(s[M]=[Vo(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]||k,g[M]=b,y[M]=x,N[M]=Do(p[M],S)};const o="text"===e.kind,r=jo(e.text,e.isWordLike,e.kind),i=wo(e.text),k=xo(e.text),S=zo(e.text),b=Xo(e.text),x=qo(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[M]&&i&&v[M]&&g[M]||o&&a>0&&"text"===d[M]&&Ro(e.text)&&v[M]||o&&a>0&&"text"===d[M]&&y[M]?t():o&&a>0&&"text"===d[M]&&e.isWordLike&&k&&N[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]&&(Eo(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]=k,g[a]=b,y[a]=x,N[a]=Do(k,S),a++)}for(let M=0;M<a;M++)null===m[M]?u[M]=Yo(s[M]):u[M]=Vo(u,m,h,M);for(let M=1;M<a;M++)"text"===d[M]&&!c[M]&&Fo(u[M])&&"text"===d[M-1]&&(u[M-1]+=u[M],c[M-1]=c[M-1]||c[M],u[M]="");const k=Array.from({length:a},()=>null);let S=-1;for(let M=a-1;M>=0;M--){const e=u[M];if(0!==e.length){if("text"===d[M]&&!c[M]&&Po(e)&&S>=0&&"text"===d[S]){const n=null!=(r=k[S])?r:[];n.push(e),k[S]=n,f[S]=f[M],u[M]="";continue}S=M}}for(let M=0;M<a;M++){const e=k[M];null!=e&&(u[M]=Go(e,u[M]))}let b=0;for(let M=0;M<a;M++){const e=u[M];0!==e.length&&(b!==M&&(u[b]=e,c[b]=c[M],d[b]=d[M],f[b]=f[M]),b++)}u.length=b,c.length=b,d.length=b,f.length=b;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(!wo(n[r])||!wo(n[r+1]))continue;const e=Wo(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a&&u&&rl.test(i)){const a=[i];let u=il.test(i),s=r+1;for(;u&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&rl.test(e.texts[s]);){const n=e.texts[s];a.push(n),u=il.test(n),s++}n.push(Yo(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(u),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&al(n)&&ul(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&&ul(i)&&al(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&ul(e.texts[u]);)a.push(e.texts[u]),u++;n.push(Yo(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]),!ol(i))continue;const a=r+1;if(a>=e.len||el(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!el(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(Yo(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]||!tl(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!el(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]=Yo(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=Yo(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=Yo(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(Yo(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:b,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let M=0;M<x.len-1;M++){const e=Uo(x.texts[M]);null!==e&&("space"!==x.kinds[M]&&"preserved-space"!==x.kinds[M]||"text"!==x.kinds[M+1]||!xo(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}function cl(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}let dl=null;const fl=/* @__PURE__ */new Map;let ml=null;const hl=new RegExp("\\p{Emoji_Presentation}","u"),vl=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let pl=null;const gl=/* @__PURE__ */new Map;function yl(){if(null!==dl)return dl;if("undefined"!=typeof OffscreenCanvas)return dl=new OffscreenCanvas(1,1).getContext("2d"),dl;if("undefined"!=typeof document)return dl=document.createElement("canvas").getContext("2d"),dl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Nl(e,n){let t=n.get(e);return void 0===t&&(t={width:yl().measureText(e).width,containsCJK:wo(e)},n.set(e,t)),t}function kl(){if(null!==ml)return ml;if("undefined"==typeof navigator)return ml={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ml;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 ml={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},ml}function Sl(){return null===pl&&(pl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),pl}function bl(e){return hl.test(e)||e.includes("️")}function xl(e,n,t){return 0===t?n.width:n.width-function(e,n){return void 0===n.emojiCount&&(n.emojiCount=function(e){let n=0;const t=Sl();for(const o of t.segment(e))bl(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Ml(e,n){for(;n<e.widths.length;){const t=e.kinds[n];if("space"!==t&&"zero-width-break"!==t&&"soft-hyphen"!==t)break;n++}return n}function wl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function Cl(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+kl().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){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];s?u+n>i?(h(),p(e,o,n)):(u+=n,c=e,d=o+1):p(e,o,n)}s&&c===e&&d===t.length&&(c=e+1,d=0)}let N=0;for(;N<o.length&&(s||(N=Ml(e,N),!(N>=o.length)));){const e=o[N],t=l[N],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(s)if(u+e>i){if(a){g(N,e),h(N+1,0,u-e),N++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>n&&null!==r[N]){h(),y(N,0),N++;continue}h()}else g(N,e),a&&(f=N+1,m=u-e),N++;else e>n&&null!==r[N]?y(N,0):v(N,e),a&&(f=N+1,m=u-e),N++}return s&&h(),a}let _l=null;function Bl(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=Xo(e),a=To.has(e)}function c(e,n){o.push(e),r=r||n;const t=Xo(e);i=1===e.length&&Lo.has(e)&&i||t,a=!1}for(const d of(null===_l&&(_l=new Intl.Segmenter(void 0,{granularity:"grapheme"})),_l).segment(e)){const e=d.segment,t=wo(e);0!==o.length?a||Oo.has(e)||Lo.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 Ol(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=wo(e[0].text),r=Bo(e[0].text);function i(){n.push({text:1===t.length?t[0]:t.join(""),start:o})}for(let a=1;a<e.length;a++){const n=e[a],u=wo(n.text),s=Bo(n.text);l&&r?(t.push(n.text),l=l||u,r=s):(i(),t=[n.text],o=n.start,l=u,r=s)}return i(),n}function Tl(e,n,t,o){const l=kl(),{cache:r,emojiCorrection:i}=function(e,n){yl().font=e;const t=function(e){let n=fl.get(e);return n||(n=/* @__PURE__ */new Map,fl.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=gl.get(e);if(void 0!==t)return t;const o=yl();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 gl.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,vl.test(a)));var a;const u=xl("-",Nl("-",r),i),s=8*xl(" ",Nl(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const c=[],d=[],f=[],m=[];let h=e.chunks.length<=1;const v=t?[]:null,p=[],g=t?[]:null,y=Array.from({length:e.len});function N(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(h=!1),c.push(n),d.push(t),f.push(o),m.push(l),null==v||v.push(r),p.push(i),null!==g&&g.push(e)}function k(e,n,t,o,a){const u=Nl(e,r),s=xl(e,u,i),c="space"===n||"preserved-space"===n||"zero-width-break"===n?0:s,d="space"===n||"zero-width-break"===n?0:s;if(a&&o&&e.length>1){let o="sum-graphemes";ul(e)?o="pair-context":l.preferPrefixWidthsForBreakableRuns&&(o="segment-prefixes");const a=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances)return n.breakableFitAdvances;const r=Sl(),i=[];for(const 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=Nl(n,t);e.push(xl(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=xl(n,Nl(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Nl(i,t);e.push(xl(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=xl(u,Nl(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,u,r,i,o);return void N(e,s,c,d,n,t,a)}N(e,s,c,d,n,t,null)}for(let x=0;x<e.len;x++){y[x]=c.length;const n=e.texts[x],t=e.isWordLike[x],i=e.kinds[x],a=e.starts[x];if("soft-hyphen"===i){N(n,0,u,u,i,a,null);continue}if("hard-break"===i){N(n,0,0,0,i,a,null);continue}if("tab"===i){N(n,0,0,0,i,a,null);continue}const s=Nl(n,r);if("text"===i&&s.containsCJK){const e=Bl(n,l),r="keep-all"===o?Ol(e):e;for(let n=0;n<r.length;n++){const e=r[n];k(e.text,"text",a+e.start,t,"keep-all"===o||!wo(e.text))}continue}k(n,i,a,t,!0)}const S=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,y,c.length),b=null===v?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=po(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,v);return null!==g?{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:b,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:S,segments:g}:{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:b,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:S}}function Il(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return Tl(function(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!yo.test(e))return e;let n=e.replace(go," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i="keep-all"===o?function(e){if(e.len<=1)return e;const n=[],t=[],o=[],l=[];let r=null,i=!1,a=0,u=!1,s=!1;function c(){null!==r&&(n.push(Yo(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let d=0;d<e.len;d++){const f=e.texts[d],m=e.kinds[d],h=e.isWordLike[d],v=e.starts[d];if("text"===m){const e=_o(f),n=Bo(f);if(null!==r&&u&&s){r.push(f),i=i||h,u=u||e,s=n;continue}c(),r=[f],i=h,a=v,u=e,s=n;continue}c(),n.push(f),t.push(h),o.push(m),l.push(v)}return c(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(sl(r,n,l)):sl(r,n,l);return a({normalized:r,chunks:cl(i,l)},i)}(e,kl(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const Ll="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Al=(()=>{const e=globalThis;if(e[Ll])return e[Ll];const n={configs:{},controllers:{},revision:q(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Ll]=n,n})();let Hl=null;const $l=Al.revision;function El(e){var n;return e&&null!=(n=Al.configs[e])?n:null}function Rl(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Pl(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function Fl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Pl(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 Kl(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Hl)return Hl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Hl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Hl}catch(n){return Hl=!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=Al.blockEstimateCache.get(i);if(a)return Al.blockEstimateCache.delete(i),Al.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=Al.preparedCache.get(o);if(l)return Al.preparedCache.delete(o),Al.preparedCache.set(o,l),l.prepared;const r=Il(e,n,{whiteSpace:t});for(Al.preparedCache.set(o,{prepared:r});Al.preparedCache.size>240;){const e=Al.preparedCache.keys().next().value;if(!e)break;Al.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?Cl(e,n):function(e,n){if(e.simpleLineWalkFastPath)return Cl(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:s}=e;if(0===t.length||0===s.length)return 0;const c=kl(),d=c.lineFitEpsilon,f=n+d;let m=0,h=0,v=!1,p=0,g=0,y=-1,N=0,k=0,S=null;function b(){y=-1,N=0,k=0,S=null}function x(e=p,n=g,t=h){m++,h=0,v=!1,b()}function M(e,n){v=!0,p=e+1,g=0,h=n}function w(e,n,t){v=!0,p=e,g=n+1,h=t}function C(e,n){v?(h+=n,p=e+1,g=0):M(e,n)}function _(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,N=h-r+i,k=h-r+a,S=e}function B(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];v?h+n>f?(x(),w(e,o,n)):(h+=n,p=e,g=o+1):w(e,o,n)}v&&p===e&&g===t.length&&(p=e+1,g=0)}function O(e){if("soft-hyphen"!==S)return!1;const t=i[e];if(null==t)return!1;const{fitCount:o,fittedWidth:l}=function(e,n,t,o,l){let r=0,i=n;for(;r<e.length;){const n=i+e[r];if((r+1<e.length?n+l:n)>t+o)break;i=n,r++}return{fitCount:r,fittedWidth:i}}(t,h,n,d,a);return 0!==o&&(h=l,p=e,g=o,b(),o===t.length?(p=e+1,g=0,!0):(x(e,o,l+a),B(e,o),!0))}function T(e){m++,b()}for(let I=0;I<s.length;I++){const e=s[I];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}v=!1,h=0,e.startSegmentIndex,p=e.startSegmentIndex,g=0,b();let d=e.startSegmentIndex;for(;d<e.endSegmentIndex;){const e=r[d],s="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?wl(h,u):t[d];if("soft-hyphen"!==e)if(v){if(h+m>f){const t=h+("tab"===e?0:o[d]),r=h+("tab"===e?m:l[d]);if("soft-hyphen"===S&&c.preferEarlySoftHyphenBreak&&N<=f){x(y,0,k);continue}if("soft-hyphen"===S&&O(d)){d++;continue}if(s&&t<=f){C(d,m),x(d+1,0,r),d++;continue}if(y>=0&&N<=f){if(p>y||p===y&&g>0){x();continue}const e=y;x(e,0,k),d=e;continue}if(m>n&&null!==i[d]){x(),B(d,0),d++;continue}x();continue}C(d,m),_(e,s,d,m),d++}else m>n&&null!==i[d]?B(d,0):M(d,m),_(e,s,d,m),d++;else v&&(p=d+1,g=0,y=d+1,N=h+a,k=h+a,S=e),d++}if(v){const n=y===e.consumedEndSegmentIndex?k:h;x(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(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(Al.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Al.blockEstimateCache.size>4e3;){const e=Al.blockEstimateCache.keys().next().value;if(!e)break;Al.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function zl(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=Fl(e.children);return o&&t.paragraph?Kl(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=Fl(e.children),r=t.headings[o];return l&&r?Kl(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=Fl(null==(l=r[0])?void 0:l.children);return i?Kl(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=zl(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 Wl(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function jl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Vl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Rl(o.lineHeight,1.5*Rl(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:jl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}function Dl(e){const n="number"==typeof e?e:Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:null}function ql(e){var n;for(const t of e.split(/\r?\n/)){const e=t.trim();if(!e||e.startsWith("%%"))continue;const o=e.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==o?void 0:o[1])?void 0:n.toLowerCase())||""}return""}function Ul(e){const n=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),t=Math.max(1,n.length),o=ql(e);return"gantt"===o?220+28*t:"sequencediagram"===o?180+26*t:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*t:"flowchart"===o||"graph"===o?170+28*t:200+22*t}function Xl(e){const n=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return n>=3?500:n>0?280+60*n:360}function Zl(e,n=360,t=500){return null==t?Math.max(n,e):Math.min(Math.max(n,e),t)}function Jl(e,n=360,t=500){return Zl(e,n,t)}function Yl(e,n=360,t=500){return Zl(e,n,t)}function Gl(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)}const Ql=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function er(){return V(Ql,null)}const nr=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],tr=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],or=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition"]),lr=["raw","content","code","originalCode","updatedCode"],rr=/* @__PURE__ */new WeakMap,ir=/* @__PURE__ */new WeakMap;let ar=1;function ur(){return"undefined"!=typeof performance?performance.now():Date.now()}function sr(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function cr(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=rr.get(n);return t||(t=ar++,rr.set(n,t)),String(t)}function dr(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:cr(n),customMarkdownIt:cr(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:cr(e.validateLink),preTransformTokens:cr(e.preTransformTokens),postTransformTokens:cr(e.postTransformTokens)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function fr(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 mr(e){const n=String(null!=e?e:"");return`${n.length}:${fr(n)}`}function hr(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?mr(e):`${e.length}:${fr(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${cr(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:${cr(o)}`;const r=cr(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>hr(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}:${hr(o[e],n,t+1)}`).join(";")}`}return typeof e}function vr(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function pr(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>vr(e)?Nr(e,n,t+1):pr(e,n,t+1)).join(",")}`:vr(e)?Nr(e,n,t):hr(e,n,t)}function gr(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!lr.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${mr(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${cr(l)}`:or.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${pr(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${cr(l)}`:""}).filter(Boolean).join(";")}function yr(e){return lr.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${mr(t)}`:""}).filter(Boolean).join(";")}function Nr(e,n=/* @__PURE__ */new WeakMap,t=0){const o=ir.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}:${cr(l)}`;const i=cr(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=>Nr(e,n,t+1)).join("|"):"";return[e.type,yr(o),gr(o,n,t),l.length,r].join(":")}(e,n,t);return ir.set(l,a),a}function kr(e,n){return Nr(e)===Nr(n)}function Sr(e,n,t){const o=ur(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=ur()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function br(e,n,t){return Sr(n,t,()=>Nr(e))}function xr(e,n,t){return br(e,t,"stabilizeSignatureMs")===br(n,t,"stabilizeSignatureMs")}function Mr(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function wr(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function Cr(e,n){return e.length===n.length&&e===n}function _r(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(!Cr(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(!vr(e)||!vr(n))return null;const o=_r(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function Br(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=_r(e,n);return null!=t?t:kr(e,n)}function Or(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Sr(t,"stabilizeSignatureMs",()=>{o=_r(e,n)}),null!=o?o:xr(e,n,t)}function Tr(e,n){const t={};for(const o of nr){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 Ir(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:D(()=>!1),i=J(n.renderContent.value);let s,d=[],f="",m="",h="",v=0,p=0,y=ur();function N(){s&&(clearTimeout(s),s=void 0)}function k(){N();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=ur()}Y([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&&(t.endsWith("\n")||t.includes("\n\n")||/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,}|\|)/.test(t))}(i.value,n)?k():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)-(ur()-y));n<=0?k():s=setTimeout(k,n)}())},{flush:"sync",immediate:!0}),he(N);const S=D(()=>{var t,o,l,r;return O(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||Xe(t)||L.has(t)||g.has(t)?"":t}).filter(Boolean)))}),b=D(()=>{const{key:e,tags:t}=T(S.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}),x=D(()=>{const n=b.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),M=D(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=S.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}),w=D(()=>{var e;return new Set((null!=(e=M.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),C=D(()=>dr(M.value,x.value,e.customMarkdownIt,{includeFinal:!0})),_=D(()=>dr(M.value,x.value,e.customMarkdownIt,{includeFinal:!1}));Y([C,_],([e,n],[t,o])=>{t&&(e===t&&n===o||(k(),n!==o&&(d=[],h="")))},{flush:"sync"});const A=D(()=>{var t,o,l,r,s,c,g,y;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",ve(e.nodes.slice());const N=i.value;if(!N)return d=[],h="",[];const k=n.debugPerformanceEnabled.value,S=k?ur():0,b=x.value,w=C.value,B=_.value;f&&w!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(b),m&&B!==m&&(d=[],h="");const O=d.length>0&&N.startsWith(h)&&B===m,T=k?sr(b):null,L=k?{}:void 0,A=L?u(a({},M.value),{__timing:L}):M.value,H=I(N,b,A),$=k?ur():0,E=k?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let R,P=k?Mr(H.length):void 0,F=0,K=0;if(O){const e=k?ur():0;if(E){const e=function(e,n,t){if(!n.length)return{nodes:e,metrics:Mr(e.length)};const o=function(e,n,t){const o=Math.min(e.length,n.length);for(let l=0;l<o;l++)if(!Or(n[l],e[l],t))return l;return e.length===n.length?-1:o}(e,n,t);if(o<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:o,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const l=e.slice();let r=o;for(let i=0;i<o;i++)l[i]=n[i];for(let i=o;i<e.length;i++){const o=n[i],a=e[i];o&&xr(o,a,t)&&(l[i]=o,r+=1)}return{nodes:l,metrics:{reusedNodeCount:r,dirtyStartIndex:o,stablePrefixNodeCount:o,dirtyTailNodeCount:wr(o,e,n)}}}(H,d,E);R=e.nodes,P=e.metrics}else{const e=function(e,n){if(!n.length)return{nodes:e,metrics:Mr(e.length)};const t=function(e,n){const t=Math.min(e.length,n.length);for(let o=0;o<t;o++)if(!Br(n[o],e[o]))return o;return e.length===n.length?-1:t}(e,n);if(t<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:t,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const o=e.slice();let l=t;for(let r=0;r<t;r++)o[r]=n[r];for(let r=t;r<e.length;r++){const t=n[r],i=e[r];t&&kr(t,i)&&(o[r]=t,l+=1)}return{nodes:o,metrics:{reusedNodeCount:l,dirtyStartIndex:t,stablePrefixNodeCount:t,dirtyTailNodeCount:wr(t,e,n)}}}(H,d);R=e.nodes,P=e.metrics}F=k?ur()-e:0,K=null==(null==P?void 0:P.dirtyStartIndex)||P.dirtyStartIndex<0?R.length:P.dirtyStartIndex}else R=H;E?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Sr(n,"primeSignatureMs",()=>Nr(e[o]))}(R,E,K):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Nr(e[t])}(R,K);const z=k?ur()-$:0;if(v+=1,h=N,f=w,m=B,d=R,k){const e=sr(b),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(o=null==T?void 0:T.total)?o:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(ur()-S),nodes:R.length,contentLength:N.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:z,signatureMs:null!=(l=null==E?void 0:E.signatureMs)?l:0,stabilizeSignatureMs:null!=(r=null==E?void 0:E.stabilizeSignatureMs)?r:0,primeSignatureMs:null!=(s=null==E?void 0:E.primeSignatureMs)?s:0,signatureCallCount:null!=(c=null==E?void 0:E.signatureCallCount)?c:0,stabilizeSignatureCallCount:null!=(g=null==E?void 0:E.stabilizeSignatureCallCount)?g:0,primeSignatureCallCount:null!=(y=null==E?void 0:E.primeSignatureCallCount)?y:0,stabilizeMs:F},null!=P?P:{}),L?Object.fromEntries(tr.map(e=>{var n;return[e,null!=(n=L[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Tr(e,T),streamStats:e}:{}))}return ve(R)});return{effectiveCustomHtmlTags:S,effectiveCustomHtmlTagsSet:w,mdBase:b,mdInstance:x,mergedParseOptions:M,parsedNodes:A}}function Lr(e){const{isClient:n}=e,t=J(/* @__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 Ar(e={}){const n=J(""),t=J(""),o=J(!1),l=Me(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=D(()=>Math.max(0,n.value.length-t.value.length)),u=D(()=>0===a.value),s=D(()=>o.value&&u.value);return pe()&&he(()=>{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 Hr=/auto|scroll|overlay/i;function $r(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return Hr.test(n)||Hr.test(t)}function Er(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 Rr=$({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return Yl(null!=(t=Dl(e.estimatedPreviewHeightPx))?t:Xl(String(null!=(n=e.node.code)?n:"")))});return()=>U("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?U("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)"}},[U("div",{class:"flex items-center gap-x-2 overflow-hidden"},[U("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),U("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),U("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},()=>U("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,U("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[U("div",{class:"absolute inset-0"},[U("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),Pr=$({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=D(()=>{var n,t;return Jl(null!=(t=Dl(e.estimatedPreviewHeightPx))?t:Ul(String(null!=(n=e.node.code)?n:"")))});return()=>U("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?U("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)"}},[U("div",{class:"flex items-center gap-x-2 overflow-hidden"},[U("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),U("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},()=>U("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[U("span",{class:"action-icon block"})])))]):null,U("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)"}},[U("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"}})])])}}),Fr=["data-custom-id"],Kr={class:"m-0 p-0"},zr=["data-probe"],Wr=["data-node-index","data-node-type"],jr=/* @__PURE__ */Te(/* @__PURE__ */$(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},htmlPolicy:{},viewportPriority:{type:Boolean},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:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,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={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,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"}},i=D(()=>{return"chat"===(e=o.mode)||"minimal"===e||"docs"===e?e:"docs";var e}),c=D(()=>!0===o.renderCodeBlocksAsPre?"pre":"pre"===o.codeRenderer||"shiki"===o.codeRenderer||"monaco"===o.codeRenderer?o.codeRenderer:!1===o.renderCodeBlocksAsPre||"docs"===i.value?"monaco":"pre"),d=D(()=>r[i.value]),f=D(()=>{var e;return null!=(e=o.showTooltips)?e:d.value.showTooltips}),m=D(()=>{var e;return null!=(e=o.fade)?e:d.value.fade}),h=D(()=>{var e;return null!=(e=o.batchRendering)?e:d.value.batchRendering}),v=D(()=>{var e;return null!=(e=o.initialRenderBatchSize)?e:d.value.initialRenderBatchSize}),p=D(()=>{var e;return null!=(e=o.renderBatchSize)?e:d.value.renderBatchSize}),g=D(()=>{var e;return null!=(e=o.renderBatchDelay)?e:d.value.renderBatchDelay}),y=D(()=>{var e;return null!=(e=o.renderBatchBudgetMs)?e:d.value.renderBatchBudgetMs}),N=D(()=>{var e;return null!=(e=o.renderBatchIdleTimeoutMs)?e:d.value.renderBatchIdleTimeoutMs}),k=D(()=>{var e;return null!=(e=o.deferNodesUntilVisible)?e:d.value.deferNodesUntilVisible}),S=D(()=>{var e;return null!=(e=o.maxLiveNodes)?e:d.value.maxLiveNodes}),b=D(()=>{var e;return null!=(e=o.liveNodeBuffer)?e:d.value.liveNodeBuffer}),x=D(()=>{var e;return null!=(e=o.nodeVirtual)?e:d.value.nodeVirtual}),M={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return o.parseOptions},get customMarkdownIt(){return o.customMarkdownIt},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return o.customHtmlTags},get mode(){return o.mode},get htmlPolicy(){return o.htmlPolicy},get viewportPriority(){return o.viewportPriority},get codeBlockStream(){return o.codeBlockStream},get codeBlockDarkTheme(){return o.codeBlockDarkTheme},get codeBlockLightTheme(){return o.codeBlockLightTheme},get codeBlockMonacoOptions(){return o.codeBlockMonacoOptions},get codeRenderer(){return o.codeRenderer},get renderCodeBlocksAsPre(){return o.renderCodeBlocksAsPre},get codeBlockMinWidth(){return o.codeBlockMinWidth},get codeBlockMaxWidth(){return o.codeBlockMaxWidth},get codeBlockProps(){return o.codeBlockProps},get mermaidProps(){return o.mermaidProps},get d2Props(){return o.d2Props},get infographicProps(){return o.infographicProps},get showTooltips(){return f.value},get themes(){return o.themes},get isDark(){return o.isDark},get customId(){return o.customId},get indexKey(){return o.indexKey},get typewriter(){return o.typewriter},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return o.smoothStreamingOptions},get parseCoalesceMs(){return o.parseCoalesceMs},get fade(){return m.value},get batchRendering(){return h.value},get initialRenderBatchSize(){return v.value},get renderBatchSize(){return p.value},get renderBatchDelay(){return g.value},get renderBatchBudgetMs(){return y.value},get renderBatchIdleTimeoutMs(){return N.value},get deferNodesUntilVisible(){return k.value},get maxLiveNodes(){return S.value},get liveNodeBuffer(){return b.value},get nodeVirtual(){return x.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function w(e){l("height-change",e)}function B(e){l("virtual-state-change",e)}function O(e){l("anchor-change",e)}const T=J(),I=J(null),L=J(null),H=J(null),$=me({1:null,2:null,3:null,4:null,5:null,6:null}),j=J(!1),q=/* @__PURE__ */new Map,U=J(0),Q=J(0),ne=J({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function ce(){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 fe("function"==typeof t?t():t)}function fe(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?fe(e.value):"object"==typeof e&&"$el"in e?fe(e.$el):null:null}const{isClient:he,renderAsFragment:pe,debugPerformanceEnabled:Ne,resolvedShowTooltips:ke,resolvedHtmlPolicy:Se,inheritedSmoothStreaming:be,ownsTypewriterCursor:xe}=function(e){const n="undefined"!=typeof window,t=Z(),o=V("markstreamHtmlPolicy",void 0),l=V("markstreamTypewriterCursor",void 0),r=V("markstreamSmoothStreaming",void 0),i=D(()=>!0===e.renderAsFragment),a=D(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=D(()=>{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=D(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=D(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(M),{resolveViewportRoot:Me,resolveScrollContainer:Ce,isReverseFlexScrollRoot:_e,getNormalizedScrollTop:Be,getOffsetTopWithinRoot:Oe}=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($r(window.getComputedStyle(a))&&Er(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}}}(T,{isClient:he,scrollRoot:ce});de("markstreamShowTooltips",ke),de("markstreamHtmlPolicy",Se),de("markstreamTypewriter",D(()=>!1!==o.typewriter)),de("markstreamFade",D(()=>!1!==M.fade)),de("markstreamTypewriterCursor",D(()=>!0)),de("markstreamTextStreamState",q),de("markstreamStreamVersion",U),de("markstreamParseOptions",D(()=>o.parseOptions)),de("markstreamCustomMarkdownIt",D(()=>o.customMarkdownIt));const{smoothStreamingEnabled:Te,renderContent:Le,effectiveFinal:Ae}=function(e,n){const t=Ar(e.smoothStreamingOptions),o=D(()=>{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||!0===e.typewriter||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=J(!n.isClient||!0===e.smoothStreaming);ge(()=>{l.value=!0});const r=D(()=>l.value&&o.value),i=D(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),a=D(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),u=D(()=>{const e=a.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return Y([()=>e.content,()=>e.nodes,r,a],([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:a,effectiveFinal:u}}(M,{isClient:he,inheritedSmoothStreaming:be});de("markstreamSmoothStreaming",Te);const He=J(!1);let Ee="",Re=!1,Pe=null;function Ke(){he&&null!=Pe&&(window.clearTimeout(Pe),Pe=null)}function We(){He.value=!1,Ke()}function je(e,n){Ne.value&&console.info(`[markstream-vue][perf] ${e}`,n)}Y([Le,()=>o.nodes,Ae],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(We(),Ee=l,void(Re=!0)):Re?(Ee&&l.length>Ee.length&&l.startsWith(Ee)?(He.value=!0,he&&(Ke(),Pe=window.setTimeout(()=>{var e;Pe=null,!0===Ae.value||(null==(e=o.nodes)?void 0:e.length)||(_i(),He.value=!1,Oi())},1200))):(l.length<Ee.length||!l.startsWith(Ee))&&We(),void(Ee=l)):(Ee=l,void(Re=!0))},{flush:"sync",immediate:!0});const Ve=o.customId?`renderer-${o.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,De=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(Ve),qe=D(()=>`${Ve}:${U.value}`);de(Ql,De);const Ue=Qe(()=>o.customId),{effectiveCustomHtmlTagsSet:Ze,mergedParseOptions:Je,parsedNodes:Ye}=Ir(o,{instanceMsgId:Ve,renderContent:Le,effectiveFinal:Ae,smoothStreamingEnabled:Te,debugPerformanceEnabled:Ne,customComponentsMap:Ue,logPerf:je});Y(Ye,()=>{De.clear(),U.value+=1},{immediate:!0});const Ge=D(()=>({customId:o.customId,customHtmlTags:Je.value.customHtmlTags,parseOptions:o.parseOptions,customMarkdownIt:o.customMarkdownIt,htmlPolicy:Se.value,viewportPriority:o.viewportPriority,mode:i.value,codeRenderer:c.value,codeBlockStream:M.codeBlockStream,codeBlockDarkTheme:o.codeBlockDarkTheme,codeBlockLightTheme:o.codeBlockLightTheme,codeBlockMonacoOptions:o.codeBlockMonacoOptions,renderCodeBlocksAsPre:M.renderCodeBlocksAsPre,codeBlockMinWidth:o.codeBlockMinWidth,codeBlockMaxWidth:o.codeBlockMaxWidth,codeBlockProps:o.codeBlockProps,mermaidProps:o.mermaidProps,d2Props:o.d2Props,infographicProps:o.infographicProps,showTooltips:ke.value,themes:o.themes,isDark:o.isDark,typewriter:o.typewriter,smoothStreamingOptions:o.smoothStreamingOptions,parseCoalesceMs:o.parseCoalesceMs,fade:M.fade}));de("markstreamNestedRendererProps",Ge);const en=D(()=>Ye.value),nn=D(()=>Ye.value.length),tn=J(null),on=J(null),rn=J(null),an=J(null),un=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),sn=!un&&o.customId?El(o.customId):null,cn=D(()=>sn?($l.value,El(o.customId)):null),fn=D(()=>{var e;return Boolean(he&&!pe.value&&o.customId&&!un&&(null==(e=cn.value)?void 0:e.enabled))}),mn=D(()=>{var e;return Boolean(!pe.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),hn=J(!1);ge(()=>{hn.value=!0});const vn=D(()=>Boolean(he&&mn.value));de("markstreamHostScrollManaged",vn);const pn=D(()=>Boolean(hn.value&&vn.value)),gn=D(()=>fn.value||vn.value),Nn=D(()=>fn.value||pn.value),kn=D(()=>{var e;return gn.value&&!1!==(null==(e=cn.value)?void 0:e.textEstimation)}),bn=D(()=>{var e;return gn.value&&!1!==(null==(e=cn.value)?void 0:e.codeBlockEstimation)});function xn(){var e;const n=Q.value||(null==(e=T.value)?void 0:e.clientWidth)||0;return Number.isFinite(n)&&n>0?n:0}const Mn=D(()=>{const e=xn();return e>0?Math.max(1,Math.round(e)):640}),wn=D(()=>{var e;return Math.max(1,null!=(e=M.maxLiveNodes)?e:320)}),Cn=D(()=>{var e;return!pe.value&&!1!==M.nodeVirtual&&!((null!=(e=M.maxLiveNodes)?e:0)<=0)&&(!0===M.nodeVirtual?Ye.value.length>0:Ye.value.length>wn.value)}),_n=D(()=>Cn.value||fn.value||vn.value),Bn=D(()=>!1!==o.viewportPriority&&!j.value),On=Xt(e=>{var n;return Me(null!=(n=null!=e?e:T.value)?n:null)},Bn),{requestFrame:Tn,cancelFrame:In,hasIdleCallback:Ln,isTestEnv:An}=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:he}),{resolvedBatchSize:Hn,resolvedInitialBatch:$n,batchingEnabled:En,incrementalRenderingActive:Rn,renderedCount:Pn,previousRenderContext:Fn,adaptiveBatchSize:Kn,previousBatchConfig:zn}=function(e,n){var t;const o=D(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=D(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=D(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=J(0),a=J({key:e.indexKey,total:0}),u=J(Math.max(1,o.value||1)),s=D(()=>{var n;return r.value&&(null!=(n=e.maxLiveNodes)?n:0)<=0}),c=J({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}}(M,{isClient:he,isTestEnv:An,renderAsFragment:pe}),Wn=/* @__PURE__ */new Map,jn=/* @__PURE__ */new Map,Vn=/* @__PURE__ */new WeakMap;let Dn=null;const qn=/* @__PURE__ */new WeakMap,Un=/* @__PURE__ */new Map,Xn=J(0),Zn=D(()=>(Xn.value,Array.from(Wn.entries()).sort((e,n)=>e[0]-n[0]))),Jn=J(null),Gn=J(null);let Qn=null,et=0,nt=null;const{activeRestoreAnchor:tt,getRelativeScrollTopWithinContainer:ot,setRelativeScrollTopWithinContainer:lt,resolveAnchorOffset:rt,clearRestoreReconcile:it,scheduleRestoreReconcile:ut,captureRestoreAnchor:st,restoreAnchor:ct,getAnchorDrift:gt}=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=J(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)))}Gl(o,c,u(l,o)+r,{isReverseFlexScrollRoot:e=>{var n;return null!=(n=null==s?void 0:s(e))&&n},getNormalizedScrollTop:a})}function N(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 k(){if(null!=v&&(null==r||r(v),v=null),n)for(const e of p)window.clearTimeout(e);p=[]}function S(e){const n=N(e),t=g();null!=t&&Math.abs(t-n)<=2||y(n)}return{activeRestoreAnchor:h,getRelativeScrollTopWithinContainer:g,setRelativeScrollTopWithinContainer:y,resolveAnchorOffset:N,clearRestoreReconcile:k,applyRestoreAnchor:S,scheduleRestoreReconcile:function(){h.value&&n&&null==v&&(v=l?l(()=>{v=null,h.value&&S(h.value)}):null,null==v&&h.value&&S(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)},k(),S(h.value),n)for(const n of[0,120,280,480])p.push(window.setTimeout(()=>{h.value&&S(h.value)},n))},getAnchorDrift:function(e){const n=g();return null==n?null:n-N(e)}}}({isClient:he,containerRef:T,parsedNodeCount:nn,requestFrame:Tn,cancelFrame:In,resolveScrollContainer:()=>Jn.value||Ce(),getNormalizedScrollTop:Be,getOffsetTopWithinRoot:Oe,isReverseFlexScrollRoot:_e,estimateIndexForOffset:Si,estimateHeightRange:cl,getFallbackNodeHeight:rl,clamp:Xo}),{nodeHeights:Nt,heightStats:St,heightTreeSize:xt,heightSumTree:wt,heightKnownTree:Ct,averageNodeHeight:_t,resetHeightMeasurements:Bt,pruneHeightMeasurements:Tt,rebuildHeightTrees:Lt,recordNodeHeight:Ht,removeNodeHeights:Et,exportHeightCache:Pt,importHeightCache:Ft,fenwickRangeSum:zt}=function(e={}){const n=me({}),t=me({total:0,count:0}),o=J(0),l=J([]),r=J([]);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=D(()=>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:()=>{Oo(),vn.value&&Ei(),tt.value&&ut(),Gn.value&&Sr(),ki("node-resize")}});function jt(){Bt(),Un.clear()}function Ut(e){!Number.isInteger(e)||e<0||e>=Ye.value.length||Un.set(e,hr(e))}function Zt(e,n,t={}){const o=Nt[e];Ht(e,n,t);const l=Nt[e];l&&l>0?Ut(e):o&&Un.delete(e)}function Jt(e,n){var t,o;const l=null!=(o=null==(t=Wn.get(e))?void 0:t.offsetHeight)?o:0;return l>0?l:n.offsetHeight}function Yt(e,n={}){Ft(e,n),Zr()}const Gt=D(()=>{var e;return!pe.value&&!1!==M.deferNodesUntilVisible&&!((null!=(e=M.maxLiveNodes)?e:0)<=0)&&!Cn.value&&!(Ye.value.length>900)&&Bn.value}),eo=D(()=>!!On&&(Gt.value||Cn.value)),to=D(()=>Cn.value||vn.value),{liveNodeBufferResolved:oo,focusIndex:lo,liveRange:ro,updateLiveRange:io}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,clamp:r}=n,i=D(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),a=J(0),u=me({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)}}}(M,{parsedNodeCount:nn,virtualizationEnabled:Cn,maxLiveNodesResolved:wn,clamp:Xo}),uo=/* @__PURE__ */new Map,co=/* @__PURE__ */new Map,ho=/* @__PURE__ */new Map,vo=[],po=/* @__PURE__ */new Map,go=/* @__PURE__ */new Set,yo=J(0);let No=!1;const ko=D(()=>(yo.value,go.size)),So=/* @__PURE__ */new Map,bo=/* @__PURE__ */new Map,xo=J(0),Mo=D(()=>{xo.value;let e=0;for(const n of So.values())e+=Math.max(0,n);return e});let wo=null,Co=!0,_o=[0],Bo="";function Oo(){Co=!0}const To=D(()=>{if(!Cn.value)return Ye.value.length;const e=oo.value,n=Math.max(ro.end+e,$n.value),t=Math.min(Ye.value.length,n);return Math.max(Pn.value,t)});function Io(){No||(No=!0,queueMicrotask(()=>{No=!1,yo.value+=1}))}function Lo(e,n,t="node-resize"){if(!he||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{go.delete(o)&&Io();try{n()}finally{ki(t)}},Math.max(0,e));return go.add(o),Io(),o}function Ao(e){he&&null!=e&&(go.delete(e)&&Io(),window.clearTimeout(e))}function Ho(){if(he&&"undefined"!=typeof window)for(const e of go)window.clearTimeout(e);go.size&&(go.clear(),Io()),vo.length=0,ho.clear()}function $o(e){var n,t;return null!=(t=null==(n=an.value)?void 0:n[e])?t:null}const{cancelScheduledFocusSync:Eo,scheduleFocusSync:Ro}=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:he,containerRef:T,virtualizationEnabled:Cn,requestFrame:Tn,cancelFrame:In,syncFocusToScroll:function(e=!1){var n,t,o,l,r,i,a;if(!Cn.value)return;const u=Jn.value||Ce();if(!u)return;const s=u.ownerDocument||(null==(n=T.value)?void 0:n.ownerDocument)||document,c=(null==s?void 0:s.defaultView)||("undefined"!=typeof window?window:null),d=u===(null==s?void 0:s.documentElement)||u===(null==s?void 0:s.body),f=Ye.value.length;if(!d&&f>0&&_e(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n,t;const o=Ye.value;if(!o.length)return 0;if(e<=0)return Math.max(0,o.length-1);if(gn.value){const t=null!=(n=ul()[o.length])?n:0;return sl(Math.max(0,t-e))}if(xt.value===o.length){const n=cl(0,o.length);return Si(Math.max(0,n-e))}let l=e;for(let r=o.length-1;r>=0;r--){const e=null!=(t=Nt[r])?t:_t.value;if(l<=e)return r;l-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Xo(l,0,Math.max(0,f-1));return void((e||Math.abs(r-lo.value)>1)&&(lo.value=r,io()))}const m=d?null:u.getBoundingClientRect(),h=d?0:m.top,v=d?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:m.bottom,p=Zn.value;let g=null,y=null;for(const[k,S]of p){if(!S)continue;const e=S.getBoundingClientRect();e.bottom<=h||e.top>=v||(null==g&&(g=k),y=k)}if(null==g||null==y){const e=T.value;if(!e)return;const n=d?{top:0}:u.getBoundingClientRect(),t=Be(u,s,d),o=d?(()=>{const t=e.getBoundingClientRect(),o=(d?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Oe(e,u);return Math.max(0,t-n)})(),f=d?null!=(a=null!=(i=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==s?void 0:s.documentElement)?void 0:l.clientHeight)?i:u.clientHeight)?a:0:u.clientHeight,m=Si(o+.5*Math.max(0,f));return lo.value=Xo(m,0,Math.max(0,Ye.value.length-1)),void io()}const N=Math.round((g+y)/2);!e&&Math.abs(N-lo.value)<=1||(lo.value=Xo(N,0,Math.max(0,Ye.value.length-1)),io())}}),{visibleNodeIndices:Po,nodeVisibilityHandles:Fo,nodeVisibilityWatchStops:Ko,nodeVisibilityFallbackTimers:zo,clearVisibilityFallback:Wo,markNodeVisible:jo,cleanupNodeVisibility:Vo,destroyNodeVisibilityState:Do}=Lr({isClient:he,shouldTrackVisibleNodeIndices:()=>Gt.value,shouldCleanupNodeVisibility:()=>Cn.value,onNodeMarkedVisible:e=>{Cn.value?Ro():lo.value=Xo(e,0,Math.max(0,Ye.value.length-1))},onNodeVisibilityCleaned:e=>{Wn.delete(e)&&bi()}}),{cleanupScrollListener:qo,setupScrollListener:Uo}=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:he,virtualizationEnabled:Cn,listenerEnabled:to,scrollRootElement:Jn,resolveScrollContainer:Ce,scheduleFocusSync:Ro,onScroll:function(){const e=Gn.value;if(!e)return;const n=rr();if(!n)return;if(function(e){if(si()>=et)return nt=null,!1;const n=nt;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(nt=null),t}(n))return;const t=ar(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&kr("restore"):kr("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=T.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return Be(e,t,o)}});function Xo(e,n,t){return Math.min(Math.max(e,n),t)}function Zo(e){return null==e?void 0:e.firstElementChild}function Jo(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function Yo(){var e,n;if(!gn.value)return void(Q.value=0);const t=null!=(n=null==(e=T.value)?void 0:e.clientWidth)?n:0;Q.value=t>0?t:0}let Go=null;function Qo(){null==Go||Go.disconnect(),Go=null}const el=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:ft,delay:0,suspensible:!1});function nl(e){return e===el}const tl=D(()=>"pre"===c.value?at:"shiki"===c.value?el:mt);function ol(){var e;return!1!==(null==(e=o.codeBlockProps)?void 0:e.showHeader)}const ll=D(()=>{var e;const n=Ye.value;if(!n.length||!gn.value)return n.map(()=>null);const t=Q.value||(null==(e=T.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const l=Nt[n],r="number"==typeof l&&l>0;if(kn.value&&!r){const n=zl(e,t,ne.value);if(n)return n}if(bn.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ia(e,la(e));return nl(n)?"markdown":n===at?"pre":n===tl.value||n===mt?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(Wl(String(null!=(n=e.originalCode)?n:"")),Wl(String(null!=(t=e.updatedCode)?t:"")),Wl(String(null!=(o=e.code)?o:""))):Wl(String(null!=(l=e.code)?l:""))}(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(21*r+32),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}}(e,{rendererKind:n,monacoOptions:o.codeBlockMonacoOptions,showHeader:ol()})}return null})});function rl(e){var n;const t=Nt[e];if(Number.isFinite(t)&&t>0)return t;const o=null==(n=ll.value[e])?void 0:n.height;return Number.isFinite(o)&&o>0?o:Math.max(_t.value,function(e){var n,t,o,l,r,i,a,u,s,c,d,f,m;const h=Ye.value[e];if(!h||"object"!=typeof h)return 32;const v=String(null!=(n=h.type)?n:""),p=xn()||640;switch(v){case"heading":return 44;case"paragraph":return il(String(null!=(o=null!=(t=h.raw)?t:h.content)?o:""),p,34);case"list":{const e=Array.isArray(h.items)?h.items.length:1;return Math.max(48,30*e+12)}case"list_item":return il(String(null!=(r=null!=(l=h.raw)?l:h.content)?r:""),p,34);case"blockquote":return il(String(null!=(a=null!=(i=h.raw)?i:h.content)?a:""),p,56);case"table":{const e=Array.isArray(h.rows)?h.rows.length:Array.isArray(h.children)?h.children.length:3;return Math.max(120,38*e+48)}case"code_block":return il(String(null!=(s=null!=(u=h.code)?u:h.raw)?s:""),p,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return il(String(null!=(d=null!=(c=h.raw)?c:h.content)?d:""),p,96);case"thematic_break":return 24;default:return il(String(null!=(m=null!=(f=h.raw)?f:h.content)?m:""),p,40)}}(e))}function il(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 al(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function ul(){var e,n,t;const l=Ye.value.length,r=al(Q.value||(null==(e=T.value)?void 0:e.clientWidth)||0),i=null==(null==(n=o.virtualScroll)?void 0:n.measurementKey)?"":String(o.virtualScroll.measurementKey),a=[l,St.count,Math.round(St.total),Math.round(100*_t.value),i,r,gn.value?1:0,$l.value,U.value].join(":");if(!Co&&Bo===a)return _o;const u=new Array(l+1);u[0]=0;for(let o=0;o<l;o++)u[o+1]=u[o]+(gn.value?rl(o):null!=(t=Nt[o])?t:_t.value);return _o=u,Bo=a,Co=!1,u}function sl(e){var n,t;const o=Ye.value.length;if(o<=0)return 0;if(e<=0)return 0;const l=ul();if(e>=(null!=(n=l[o])?n:0))return o-1;let r=0,i=o-1,a=o-1;for(;r<=i;){const n=r+i>>1;(null!=(t=l[n+1])?t:0)>=e?(a=n,i=n-1):r=n+1}return a}function cl(e,n){var t,o;if(e>=n)return 0;if(gn.value)return function(e,n){var t,o;const l=Ye.value.length,r=Xo(Math.trunc(e),0,l),i=Xo(Math.trunc(n),r,l);if(r>=i)return 0;const a=ul();return(null!=(t=a[i])?t:0)-(null!=(o=a[r])?o:0)}(e,n);if(xt.value!==Ye.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Nt[l])?t:_t.value;return o}const l=wt.value,r=Ct.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Nt[l])?o:_t.value;return t}return zt(l,e,n)+(n-e-zt(r,e,n))*_t.value}Y(()=>Ye.value.length,e=>{Oo(),e<=0?jt():(e<xt.value&&Tt(e),e!==xt.value&&Lt(e))},{immediate:!0});const dl=D(()=>{if(!Cn.value)return Ye.value.map((e,n)=>({node:e,index:n}));const e=Ye.value.length,n=Xo(ro.start,0,e),t=Xo(ro.end,n,e);return Ye.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),fl=D(()=>Cn.value?cl(0,Math.min(ro.start,Ye.value.length)):0),ml=D(()=>{if(!Cn.value)return 0;const e=Ye.value.length;return cl(Math.min(ro.end,e),e)});function hl(){if(!gn.value)return 0;let e=0;const n=ll.value;for(let t=0;t<n.length;t++){if(!n[t])continue;const o=Nt[t];Number.isFinite(o)&&o>0||e++}return e}function vl(){const e=Ye.value.length;return{totalNodes:e,measuredCount:St.count,estimatedCount:hl(),averageNodeHeight:_t.value,topSpacerHeight:fl.value,bottomSpacerHeight:ml.value,estimatedTotalHeight:cl(0,e),width:wl()}}function pl(){const e=Ye.value,n=vl();return u(a({},n),{probe:{paragraphReady:Boolean(ne.value.paragraph),listItemReady:Boolean(ne.value.listItem),listWrapperOverhead:ne.value.listWrapperOverhead,headingReadyLevels:Object.entries(ne.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=ll.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=ll.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=ll.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=ll.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Nt[n])?c:null}})})}function gl(){return null!=o.indexKey?String(o.indexKey):mn.value?`virtual-${Nl()}`:"markdown-renderer"}function yl(e){const n=String(e),t=`${gl()}-`;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>=Ye.value.length?null:l}function Nl(){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:o.customId)?t:Ve)}function kl(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function Sl(e){var n;return(null!=e?e:"")===(null!=(n=kl())?n:"")}function bl(){var e;const n=null==(e=o.virtualScroll)?void 0:e.measurementKey;return null==n?"":String(n)}function xl(){const e=c.value,n="monaco"===e?o.codeBlockMonacoOptions:void 0,t=o.codeBlockProps;return[o.isDark?"dark":"light","monaco"===e?"code-rich":"pre"===e?"code-pre":"code-shiki",!1===M.codeBlockStream?"code-static":"code-stream",di(o.codeBlockMinWidth),di(o.codeBlockMaxWidth),di(null==n?void 0:n.fontSize),di(null==n?void 0:n.lineHeight),di(null==n?void 0:n.fontFamily),di(null==n?void 0:n.tabSize),di(null==n?void 0:n.MAX_HEIGHT),di(null==n?void 0:n.wordWrap),di(null==n?void 0:n.wrappingIndent),di(null==n?void 0:n.padding),di(null==t?void 0:t.showHeader),di(null==t?void 0:t.showCopyButton),di(null==t?void 0:t.showExpandButton),di(null==t?void 0:t.showPreviewButton),di(null==t?void 0:t.showCollapseButton),di(null==t?void 0:t.showFontSizeButtons)].join("\0")}function Ml(){return[bl(),xl()].join("\0")}function wl(){return xn()}const Cl=D(()=>al(wl())),_l=D(()=>[Ml(),Cl.value].join("\0")),Bl=D(()=>{var e;return mn.value?["virtual",null!=(e=kl())?e:"",Nl(),_l.value].join("\0"):o.indexKey});function Ol(){xo.value+=1}function Tl(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Ye.value.length||e.sessionKey!==Nl()||e.threadKey!==kl()||e.layoutEpochKey!==_l.value)}function Il(e){const n=String(e),t=bo.get(n);return t?Tl(t)?t.index:null:yl(n)}function Ll(e="async-node"){(So.size||bo.size)&&(So.clear(),bo.clear(),Ol(),ki(e))}const Hl=V(we,null),Rl={reportHeight(e,n){if(!vn.value)return;const t=Il(e);if(null==t)return;const o=uo.get(t);if(!o)return;const l=Number(n),r=Jt(t,o);Zt(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!vn.value)return;const n=yl(e);null!=n&&function(e,n){var t;const o=bo.get(e);if(o&&Tl(o))return So.set(e,Math.max(0,null!=(t=So.get(e))?t:0)+1),Ol(),void ki("async-node");So.set(e,1),bo.set(e,function(e){return{index:e,sessionKey:Nl(),threadKey:kl(),layoutEpochKey:_l.value}}(n)),Ol(),ki("async-node")}(String(e),n)},markSettled(e){if(!vn.value)return;const n=String(e),t=Il(e);(null!=t||function(e){return So.has(String(e))}(n))&&function(e){var n;const t=null!=(n=So.get(e))?n:0;return!(t<=0||(t<=1?(So.delete(e),bo.delete(e)):So.set(e,t-1),Ol(),1===t&&ki("async-node"),0))}(n)&&null!=t&&Oi()}};function Pl(){var e;let n=0;for(const t of uo.values())n+=null!=(e=null==t?void 0:t.offsetHeight)?e:0;return Math.ceil(Math.max(0,n))}de(we,{reportHeight(e,n){Rl.reportHeight(e,n),null==Hl||Hl.reportHeight(e,n)},markPending(e){Rl.markPending(e),null==Hl||Hl.markPending(e)},markSettled(e){Rl.markSettled(e),null==Hl||Hl.markSettled(e)}});let Fl,Kl=null,jl=null;function ql(e){return!1!==e&&null!=e&&""!==e}function Zl(){return Cn.value?function(){if(!Cn.value)return!0;const e=Ye.value.length,n=Xo(ro.start,0,e),t=Xo(ro.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Wn.has(o))return!1;if(xi(o)&&!uo.has(o))return!1}return!0}():Pn.value>=To.value}function er(){return!0===Ae.value&&!He.value&&0===Mo.value&&0===go.size&&0===po.size&&null==wo&&Zl()}function nr(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(Kl===Nl()&&Fl===kl())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!ql(t)&&jl===Fi(t)}function tr(){return er()&&nr()}function or(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 lr(e="manual",n){const t=vl(),o=function(e){return e||(!0!==Ae.value?Ye.value.length>0?"streaming":"estimating":!Zl()||po.size>0||null!=wo?"measuring":tr()?"settled":"settling")}(n);return{sessionKey:Nl(),threadKey:kl(),phase:o,nodeCount:t.totalNodes,liveRange:{start:ro.start,end:ro.end},renderedCount:Pn.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:Pl(),totalHeight:ir(),width:t.width,final:!0===Ae.value,stable:tr(),confidence:or(o,t),reason:e}}function rr(){var e,n,t,o,l,r;const i=Jn.value||Ce(),a=T.value;if(!i||!a)return null;const u=i.ownerDocument||a.ownerDocument||document,s=i===u.documentElement||i===u.body||i===u.scrollingElement;return{root:i,doc:u,isViewportRoot:s,scrollTop:Be(i,u,s),scrollHeight:s?Math.max(null!=(n=null==(e=u.documentElement)?void 0:e.scrollHeight)?n:0,null!=(o=null==(t=u.body)?void 0:t.scrollHeight)?o:0,null!=(l=i.scrollHeight)?l:0):i.scrollHeight,clientHeight:s?(null==(r=u.documentElement)?void 0:r.clientHeight)||i.clientHeight||0:i.clientHeight}}function ir(){var e,n,t,o;const l=Ye.value.length,r=Math.max(0,cl(0,l)),i=Math.max(0,null!=(n=null==(e=T.value)?void 0:e.scrollHeight)?n:0,null!=(o=null==(t=T.value)?void 0:t.offsetHeight)?o:0);return l<=0?Math.ceil(i):Cn.value?r>0?Math.max(1,Math.ceil(r),function(){var e;let n=fl.value+ml.value;for(const t of Wn.values())t&&(n+=Math.max(0,t.offsetHeight||0,(null==(e=t.getBoundingClientRect)?void 0:e.call(t).height)||0));return Math.ceil(Math.max(0,n))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(r,i)):Math.max(1,Math.ceil(i)):vn.value?r>0||St.count>0||hl()>0?(Rn.value&&Pn.value,Math.max(1,Math.ceil(i),Math.ceil(r))):Math.ceil(i):Math.max(1,Math.ceil(i),Math.ceil(r))}function ar(e){const n=T.value;if(!n)return null;const t=n.getBoundingClientRect(),o=function(e){return e.isViewportRoot?e.clientHeight:e.root.getBoundingClientRect().bottom}(e);return o-t.bottom}function ur(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 sr(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 cr=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function dr(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}:${ur(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(dr(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=dr(e[a],n,t+1);i=sr(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||cr.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${dr(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let fr=-1,mr="";function hr(e){const n=Ye.value[e];return n?ur(dr(n)):""}function vr(){const e=U.value;if(fr===e)return mr;let n=2166136261;for(let t=0;t<Ye.value.length;t++){const e=hr(t);for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)}return mr=(n>>>0).toString(36),fr=e,mr}function pr(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=Ye.value.length,i=Xo(ro.start-2*oo.value,0,r),a=Xo(ro.end+2*oo.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)}(Pt().map(e=>{var n;const t=Ye.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:hr(e.index)}):null}).filter(e=>Boolean(e))):[],s=function(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=rr(),t=T.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=e.root.getBoundingClientRect();return{top:n.top,bottom:n.bottom}}(n),l=t.getBoundingClientRect();return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=rr(),n=T.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=ar(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=st();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Ye.value.length;return e<=0?null:{type:"node",nodeIndex:Xo(lo.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}({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?vr():void 0,measurementKey:Ml()||void 0,heightCache:i.length?i:void 0}):null}function gr(e){var n,t;const o=rr();if(!o)return;const l=function(e){var n;const t=T.value;if(!t)return null;const o=Oe(t,e.root),l=Math.max(0,t.offsetHeight||0,t.scrollHeight||0,(null==(n=t.getBoundingClientRect)?void 0:n.call(t).height)||0),r=ir();return o+Math.max(l,r)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){et=si()+120,nt=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Gl(o.root,o.doc,i,{isReverseFlexScrollRoot:_e,getNormalizedScrollTop:Be})}const yr=[];function Nr(){if(he)for(null!=Qn&&(null==In||In(Qn),Qn=null);yr.length;){const e=yr.pop();null!=e&&window.clearTimeout(e)}}function kr(e){const n=Boolean(Gn.value);Gn.value=null,et=0,nt=null,Nr(),n&&e&&ki(e)}function Sr(){if(!Gn.value||!he)return;if(null!=Qn)return;const e=()=>{Qn=null;const e=Gn.value;e&&gr(e)};Qn=Tn?Tn(e):null,null==Qn&&e()}function br(e,n={}){const t=Ye.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=Ye.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==hr(e.index))}(e))}function xr(e){const n=al(wl()),t=al(e);return-1!==n&&-1!==t&&n===t}function Mr(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 wr(e){var n;return e.sessionKey===Nl()&&!!Sl(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Ml()&&!!xr(Mr(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Cr(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Cr(e){return Boolean(e.contentHash&&e.contentHash===vr())}function _r(e){return!Cr(e)}let Br=null,Or=null,Tr=null,Hr=null,jr=null;function Vr(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=al(wl());return[null!=(n=kl())?n:"",Nl(),Ml(),Ye.value.length,o,e.length,ur(t)].join(":")}function Dr(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!vn.value||!(null==e?void 0:e.length))return!1;if(Ye.value.length<=0)return!1;if(!xr(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=br(e,{requireSignature:!0});if(!t.length)return!1;const l=Vr(t);return l===Br?(Or="standalone",!0):(Yt(t,{mode:"merge"}),Oo(),Br=l,Or="standalone",hi(),ki("restore"),!0)}function qr(e,n={}){var t,o,l;if(!vn.value||!e)return!1;if(e.sessionKey!==Nl())return!1;if(!Sl(e.threadKey))return!1;if(Ye.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!Ur(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!Ur()&&Number(Mr(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&wr(e)){const n=br(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:_r(e)});n.length&&(Yt(n,{mode:"merge"}),Oo(),Br=Vr(n),Or="restore",hi(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&ki("restore"),!0;if(!i)return u&&ki("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=kl())?t:"",Nl(),Ml(),Cl.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return Tr===s?(u&&ki("restore"),!0):(Tr=s,function(e){const n=()=>{if("node"===e.type)return kr(),void ct({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(it(),tt.value=null,Gn.value=e,Nr(),gr(e),he)for(const e of[0,120,280,480])yr.push(window.setTimeout(()=>{const e=Gn.value;e&&gr(e)},e))};!function(e){if(!Cn.value)return!1;const n=Ye.value.length;return!(n<=0||(lo.value="node"===e.type?Xo(e.nodeIndex,0,n-1):n-1,io(),0))}(e)?n():le(n)}(i),ki("restore"),!0)}function Ur(){const e=wl();return Number.isFinite(e)&&e>0}function Xr(e){var n;return e.sessionKey===Nl()&&!!Sl(e.threadKey)&&(Ye.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||Ur())||!(!(e.anchor&&Number(Mr(e))>0)||Ur()))}function Zr(){Un.clear();for(const e of Object.keys(Nt)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Ye.value.length&&Ut(n)}}function Jr(){null!=wo&&(null==In||In(wo),wo=null),Ci()}function Yr(){return!he||An?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(Tn)return Tn(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function Gr(e,n=kl(),t=_l.value){return Nl()===e&&kl()===n&&_l.value===t}function ei(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Nl(),c=kl(),d=_l.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=lr(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),N=()=>Gr(s,c,d)&&(null==v||fi()===v);for(let o=0;o<f;o++){if(yield le(),!N())return y();if(yield Yr(),!N())return y();Oi(),Jr()}if(yield function(e){return!he||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!N())return y();if(p&&Ho(),Oi(),Jr(),!N())return y();const k=er();k&&(Kl=s,Fl=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&ql(null==(i=o.virtualScroll)?void 0:i.settledToken)&&fi()===v&&(jl=Fi(o.virtualScroll.settledToken)));const S=N()&&k&&nr(),b=lr(h,S?"final":void 0);return gi(b,!0),b})}let ni="content",ti=null,oi=null,li=0,ri=null,ii=null,ai=null,ui=null;function si(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function ci(e){var n,t;const l=ri;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 di(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)}}function fi(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return di(e)}function mi(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Ml(),vr(),di(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function hi(){ai=null,ui=null,ii=null}function vi(e){const n=e.heightCache;return(null==n?void 0:n.length)?Vr(n):""}function pi(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:Ml(),null!=(o=e.contentHash)?o:"",vi(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 gi(e,n=!1){if(!vn.value)return;if(function(e=!1){return!e&&mn.value&&!pn.value}(n))return;const t=n||ci(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:pr(e,{includeHeightCache:!0})}:{state:pr(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||pi(e)!==ii}(r,n)));if(t&&(w(e),ri=e,li=si()),r&&i&&(B(r),r.anchor&&O(r.anchor),ii=pi(r)),e.stable){const n=mi("settled",e);if(n!==ai){ai=n;const t=pr(e,{includeHeightCache:!0});t&&(B(t),ii=pi(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=mi("final",e);if(n!==ui){ui=n;const t=pr(e,{includeHeightCache:!0});t&&(B(t),ii=pi(t)),function(e){l("render-final",e)}(e)}}}function yi(){null!=ti&&(null==In||In(ti),ti=null),null!=oi&&he&&(window.clearTimeout(oi),oi=null)}function Ni(){ti=null,oi=null,function(e){if(po.size>0||null!=wo)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(ni)&&(Oi(),Jr()),gi(lr(ni))}function ki(e){var n,t;if(!vn.value)return;if(ni=e,null!=ti||null!=oi)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(si()-li)),i=()=>{oi=null,ti=Tn?Tn(Ni):null,null==ti&&Ni()};he&&r>0?oi=window.setTimeout(i,r):i()}function Si(e){var n;if(e<=0)return 0;const t=Ye.value;if(gn.value)return sl(e);if(xt.value===t.length&&wt.value.length&&Ct.value.length){const n=_t.value,o=wt.value,l=Ct.value,r=e=>e<=0?0:zt(o,0,e)+(e-zt(l,0,e))*n;let i=0,a=t.length-1,u=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(u=n,a=n-1):i=n+1}return u}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Nt[l])?n:_t.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function bi(){Xn.value+=1}function xi(e){return!(Rn.value&&e>=Pn.value)&&(!Gt.value||e<$n.value||Po.value.has(e))}function Mi(e){const n=Ko.get(e);n&&(n(),Ko.delete(e));const t=Fo.get(e);t&&(t.destroy(),Fo.delete(e)),Wo(e)}function wi(e,n){let t=!1;if(n){const o=Wn.get(e);Wn.set(e,n),o!==n&&(t=!0)}else Wn.delete(e)&&(t=!0);if(t&&bi(),n||Wo(e),!eo.value||!On)return Mi(e),void(n&&jo(e,!0));if(!Cn.value&&Gt.value&&!j.value&&Fo.size>=640&&(j.value||(j.value=!0,Do()),!eo.value||!On))return Mi(e),void(n&&jo(e,!0));if(e<$n.value&&!Cn.value)return Mi(e),void jo(e,!0);if(Po.value.has(e))return Mi(e),void jo(e,!0);if(!n)return void Mi(e);Mi(e);const o=On(n,{rootMargin:"400px"});if(!o)return;Fo.set(e,o),jo(e,o.isVisible.value),Gt.value&&function(e){if(!he||!Gt.value)return;Wo(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(zo.delete(e),!Gt.value)return;if(Po.value.has(e))return;const o=Wn.get(e);if(!o)return;const l=Ce(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,u=!a&&l?l.getBoundingClientRect():null,s=a?0:u.top,c=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:u.bottom,d=o.getBoundingClientRect();d.bottom>=s-500&&d.top<=c+500&&jo(e,!0)},1800+n);zo.set(e,t)}(e);let l=null;l=Y(()=>o.isVisible.value,n=>{if(n){Wo(e),jo(e,!0),null==l||l(),Ko.delete(e),Fo.get(e)===o&&Fo.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),Ko.set(e,l),Cn.value&&Ro()}function Ci(){wo=null;for(const[e,n]of po)po.delete(e),uo.get(e)===n.el&&co.get(e)===n.version&&Zt(e,n.height,{allowShrink:n.allowShrink})}function _i(){null!=wo&&(null==In||In(wo),wo=null),po.clear()}function Bi(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(uo.get(e)!==n)return;const r=co.get(e);if(null==r)return;const i=Ye.value[e],a=He.value&&!0!==Ae.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Ye.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=po.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;po.set(e,{height:d,allowShrink:c,version:r,el:n}),null==wo&&(wo=Tn?Tn(Ci):null,null==wo&&Ci())}(e,n,Jt(e,n))}function Oi(){for(const[e,n]of uo)n&&Bi(e,n)}function Ti(){null==Dn||Dn.disconnect(),Dn=null,jn.clear()}function Ii(){for(;vo.length;)Ao(vo.pop())}Y(pn,e=>{e&&ki("content")},{flush:"post"}),n({getVirtualMetrics:lr,captureVirtualState:function(e={}){var n;return pr(lr("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);Hr=e,jr={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!qr(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&Xr(e)||(Hr=null,jr=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield Yr(),Oi(),Jr(),yield le();const n=lr(e);return gi(n,!0),n})},settle:ei,scrollToNode:function(e,n="start"){kr(),it();const t=Ye.value.length;if(t<=0)return;const o=Xo(e,0,t-1),l=()=>{var e;const t=rt({nodeIndex:o,offsetWithinNodePx:0}),l=rl(o),r=rr(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=ot();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}lt(Math.max(0,u)),Ro({immediate:!0}),Cn.value&&(lo.value=o,io())};if(Cn.value)return lo.value=o,io(),void le(l);l()}}),Y(()=>_n.value,e=>{if(!e){Ti();for(const e of ho.values())for(const n of e)Ao(n);ho.clear(),co.clear(),Ii(),_i()}},{immediate:!0}),Y(Ae,e=>{e&&function(){if(he&&Ae.value&&uo.size){Ii();for(const e of[80,240,640]){const n=Lo(e,()=>{for(const[e,n]of uo)n&&Bi(e,n)},"final");null!=n&&vo.push(n)}}}(),ki(e?"final":"content")}),Y([()=>Ye.value.length,()=>Pn.value],()=>{Gn.value&&Sr(),ki("content")},{flush:"post",immediate:!0}),Y([()=>ro.start,()=>ro.end],()=>{ki("batch")},{flush:"post"});const{cleanupBatchScheduler:Li}=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:N,onDatasetKeyChanged:k,onDatasetChanged:S}=e;let b=null,x=null,M=!1,w=null,C=null,_=0,B=!1,O=!1;const T=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function L(){if(t){null!=b&&(null==g||g(b),b=null),null!=x&&(window.clearTimeout(x),x=null),null!=C&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(C),C=null),_+=1;for(const e of T)null==g||g(e);T.clear();for(const e of I)window.clearTimeout(e);I.clear(),M=!1,w=null,B=!1,O=!1}}function A(){return"undefined"!=typeof performance?performance.now():Date.now()}function H(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=O||f.value<i.value;O=!1,t&&R()}function $(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=A();let o=0;b=null,x=null,C=null,M=!1;const l=null!=w?w:c;w=null;const r=A();f.value=Math.min(u,f.value+l),N(f.value),o=A()-r,function(e,o){if(!t)return void H(o);B=!0;const l=++_;le().then(()=>{var t;if(l!==_)return;const r=A(),i=Math.max(o,r-e),a=()=>{l===_&&H(i)};if(p){let e=!1,o=null;const l=()=>{e||(e=!0,a())},r=p(()=>{T.delete(r),null!=o&&(window.clearTimeout(o),I.delete(o),o=null),l()});return T.add(r),o=window.setTimeout(()=>{null!=o&&I.delete(o),o=null,null==g||g(r),T.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?b=p(()=>{0!==m?x=window.setTimeout(()=>d(),m):d()}):x=window.setTimeout(()=>d(),m)}}function E(e,n={}){B?O=!0:null==e?R():$(e,n)}function R(){s.value&&$(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return Y([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 b=v.value,x=null!=(e=n.renderBatchDelay)?e:16,M=b.batchSize!==c.value||b.initial!==d.value||b.delay!==x||b.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:x,enabled:s.value},p&&k(o),(y||M||!s.value)&&L(),(y||M)&&(m.value=Math.max(1,c.value||1)),y&&S();const w=i.value;if(!o)return f.value=0,void N(0);if(!s.value)return f.value=w,void N(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?E(_,{immediate:!t}):N(f.value)},{immediate:!0}),Y(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&E())}),{cleanupBatchScheduler:L}}({props:M,isClient:he,isTestEnv:An,parsedNodesIdentity:en,parsedNodeCount:nn,desiredRenderedCount:To,datasetKey:Bl,batchingEnabled:En,incrementalRenderingActive:Rn,resolvedBatchSize:Hn,resolvedInitialBatch:$n,renderedCount:Pn,adaptiveBatchSize:Kn,previousRenderContext:Fn,previousBatchConfig:zn,requestFrame:Tn,cancelFrame:In,hasIdleCallback:Ln,cleanupNodeVisibility:Vo,onDatasetKeyChanged:e=>{_i(),jt(),Oo(),hi(),e>0&&Lt(e)},onDatasetChanged:()=>{Cn.value&&Ro({immediate:!0})}});Y([to,Cn,()=>T.value,()=>ce()],([e,n])=>{if(!e)return qo(),void Eo();Uo(),n?Ro({immediate:!0}):Eo()},{flush:"post",immediate:!0}),Y([()=>Ye.value.length,()=>Cn.value],e=>s(null,[e],function*([e,n]){n&&e&&he&&(yield le(),Ro({immediate:!0}))}),{flush:"post"}),Y(gn,e=>{e&&function(){var e;if(tn.value&&on.value&&rn.value&&(null==(e=an.value)?void 0:e[1]))return;const n=ve({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=ve({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=ve({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});tn.value=n,on.value=t,rn.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]=ve({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});an.value=l}()},{immediate:!0}),Y([()=>T.value,gn],()=>{if(!gn.value)return Qo(),void(Q.value=0);Yo(),Qo(),gn.value&&T.value&&"undefined"!=typeof ResizeObserver&&(Go=new ResizeObserver(()=>{Yo(),tt.value&&ut(),Gn.value&&Sr(),ki("resize")}),Go.observe(T.value))},{immediate:!0}),Y([gn,Mn,_l],()=>s(null,null,function*(){if(!gn.value)return ne.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Oo();yield le(),function(){var e,n,t,o;if(!gn.value||"undefined"==typeof window)return ne.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Oo();const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=Jo(Zo(I.value),".paragraph-node");l.paragraph=Vl(I.value,r,"pre-wrap");const i=Zo(L.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=Vl(L.value,a,"pre-wrap");const u=null!=(n=null==(e=H.value)?void 0:e.offsetHeight)?n:0,s=null!=(o=null==(t=L.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,u-s);for(let c=1;c<=6;c++){const e=Jo(Zo($[c]),`h${c}`);l.headings[c]=Vl($[c],e,"pre-wrap")}ne.value=l,Oo()}()}),{flush:"post",immediate:!0}),Y(()=>Ye.value.length,()=>{Cn.value&&Ro({immediate:!0})}),Y([gn,Q],()=>{Oo(),Cn.value&&Ro({immediate:!0}),tt.value&&ut(),Gn.value&&Sr(),ki("resize")},{immediate:!1}),Y(()=>Gt.value,e=>{if(e)for(const[n,t]of Wn)wi(n,t);else{Do();for(const[e,n]of Wn)n&&jo(e,!0)}},{immediate:!1}),Y([()=>o.viewportPriority,()=>Ye.value.length],([e,n])=>{!1!==e?j.value&&n<=200&&(j.value=!1):j.value=!1}),Y(()=>Pn.value,()=>{Cn.value&&Ro({immediate:!0})}),Y([lo,wn,oo,()=>Ye.value.length,Cn],()=>{io()},{immediate:!0});let Ai=null,Hi=!1,$i=null;function Ei(){Ai=null,Kl=null,Fl=void 0,jl=null,hi()}function Ri(){_i(),jt(),Oo(),Un.clear();const e=Ye.value.length;e>0&&Lt(e),Zr()}function Pi(){yi(),Ho(),ri=null,Br=null,Or=null,Tr=null,Hr=null,jr=null,Hi=!1,Ei(),Ll("restore"),it(),kr()}function Fi(e){var n;return[null!=(n=kl())?n:"",Nl(),Ml(),Cl.value,fi(e),Ye.value.length,Math.round(cl(0,Ye.value.length)),Math.round(wl()),St.count,Math.round(St.total)].join(":")}function Ki(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=fi(r),a=Nl(),u=kl(),s=_l.value;if(vn.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&ql(r))if(er()){if(Fi(r)!==jl&&!Hi){Hi=!0;try{const e=yield ei({reason:"manual",expectedSettledTokenKey:i}),n=fi()===i;Gr(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(jl=Fi(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{Hi=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=ql(e)?Fi(e):"";Gr(a,u,s)&&n&&jl!==n&&Ki()}}}else ki("manual")})}Y(vn,(e,n)=>{if(e!==n){if(!e)return Pi(),void yi();Pi(),Ri(),$i=_l.value,ki("content")}},{flush:"post"}),Y([vn,_l],([e,n])=>{e?null!=$i?$i!==n&&($i=n,function(e="resize"){_i(),jt(),Oo(),Un.clear();const n=Ye.value.length;n>0&&Lt(n),Zr(),Br=null,Or=null,Tr=null,ri=null,Hi=!1,Ei(),Dr(),le(()=>{Oi(),tt.value&&ut(),Gn.value&&Sr(),ki(e)})}("resize")):$i=n:$i=null},{flush:"post",immediate:!0}),Y([vn,()=>Nl(),()=>kl()],([e])=>{e&&(Pi(),Ri(),Ll("content"),ki("content"))}),Y([vn,()=>Nl(),()=>kl(),_l,()=>Ye.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(bo.entries()))Tl(o)||(bo.delete(t),So.delete(t),n=!0);n&&(Ol(),ki(e))}("async-node")},{flush:"post"}),Y([vn,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>U.value],([e])=>{e&&(hi(),function(e="content"){if(!vn.value)return;const n=[],t=Ye.value.length;for(const o of Array.from(Un.keys())){if(o>=t){n.push(o);continue}const e=hr(o),l=Un.get(o);null!=l&&l!==e&&n.push(o),Un.set(o,e)}for(const o of Array.from(Un.keys()))o>=t&&Un.delete(o);n.length&&(function(e,n={}){const t=Array.from(e,Number),o=Et(t,n);o>0&&function(e){for(const n of e)Un.delete(n)}(t)}(n,{notify:!1}),Oo(),Ei(),tt.value&&ut(),Gn.value&&Sr(),ki(e))}("content"))},{flush:"post",immediate:!0}),Y([vn,()=>Ye.value.length,()=>Nl(),()=>kl()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&Ei()},{flush:"post"}),Y([vn,()=>{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},()=>Ye.value.length,()=>Nl(),Q],()=>{Dr()},{flush:"post",immediate:!0}),Y([vn,()=>{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},()=>Ye.value.length,()=>Nl(),Q],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)}();qr(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),Y([vn,Q,()=>{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&&Br&&"restore"===Or&&(wr(t)||(Ri(),Br=null,Or=null,ki("resize")))},{flush:"post"}),Y([vn,()=>Ye.value.length,()=>Nl(),Q],e=>s(null,[e],function*([e]){var n;const t=Hr,o=jr;e&&t&&(yield le(),!qr(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)})&&Xr(t)||(Hr=null,jr=null))}),{flush:"post",immediate:!0}),Y([vn,Ae,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Nl(),()=>kl(),_l,Mo,ko,()=>Pn.value,To,()=>St.count,()=>St.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!tr())return;const o=function(){var e;const n=Ye.value.length;return[null!=(e=kl())?e:"",Nl(),Ml(),Cl.value,n,Math.round(cl(0,n)),Math.round(wl()),St.count,Math.round(St.total)].join(":")}();Ai!==o&&(Ai=o,ei({reason:"final"}).then(e=>{e.stable||Ai!==o||(Ai=null)}))},{flush:"post",immediate:!0}),Y([vn,Ae,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Nl(),()=>kl(),_l,Mo,ko,()=>Pn.value,To,()=>Ye.value.length,()=>St.count,()=>St.total],()=>{Ki()},{flush:"post",immediate:!0}),Y([()=>Ye.value.length,Cn,wn,oo,()=>ro.start,()=>ro.end],([e,n,t,o,l,r])=>{Ne.value&&je("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:lo.value,scroll:n?(()=>{const e=Jn.value||Ce();return e?{reverse:_e(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:Pn.value})}),Y([()=>o.customId],([e],n,t)=>{if(!e||un)return;const o=function(e,n){return e?(Al.controllers[e]=n,()=>{Al.controllers[e]===n&&delete Al.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:st,restoreAnchor:ct,getAnchorDrift:gt,getReport:pl});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(vn.value)try{Oi(),Jr();const e=lr("manual");ci(e)&&(w(e),ri=e,li=si());const n=pr(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(B(n),n.anchor&&O(n.anchor),ii=pi(n))}catch(e){}}(),Li(),Do(),Ke(),Ti();for(const e of ho.values())for(const n of e)Ao(n);ho.clear(),co.clear(),Un.clear(),Ii(),_i(),Qo(),it(),kr(),yi(),qo(),Eo()});const zi=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),at}}),loadingComponent:Pr,delay:0}),Wi=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),at}}),loadingComponent:Rr,delay:0}),ji=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),at}})),Vi={text:dt,paragraph:no,heading:Vt,code_block:mt,list:qt,list_item:Dt,blockquote:Ie,table:ao,definition_list:Fe,footnote:Kt,footnote_reference:ln,footnote_anchor:Rt,admonition:Qr,vmr_container:mo,hardbreak:Wt,link:Ot,image:Yn,thematic_break:so,math_inline:ht,math_block:vt,strong:bt,emphasis:$t,strikethrough:Mt,highlight:At,insert:It,subscript:kt,superscript:yt,emoji:ze,checkbox:$e,checkbox_input:$e,inline_code:Sn,html_inline:yn,reference:pt,html_block:Qt},Di=D(()=>gl()),qi=D(()=>a(a({stream:M.codeBlockStream,darkTheme:o.codeBlockDarkTheme,lightTheme:o.codeBlockLightTheme,monacoOptions:o.codeBlockMonacoOptions,themes:o.themes,minWidth:o.codeBlockMinWidth,maxWidth:o.codeBlockMaxWidth},"boolean"==typeof ke.value?{showTooltips:ke.value}:{}),o.codeBlockProps||{}));function Ui(e){return"boolean"==typeof e?e:void 0}const Xi=D(()=>{const e=o.codeBlockProps||{},n={},t=Ui(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const l=Ui(e.diffInline);void 0!==l&&(n.diffInline=l);const r=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(e.reservedHeightPx);return void 0!==r&&(n.reservedHeightPx=r),n}),Zi=D(()=>{const e=o.codeBlockProps||{};return a(a({stream:M.codeBlockStream,darkTheme:o.codeBlockDarkTheme,lightTheme:o.codeBlockLightTheme,themes:o.themes,minWidth:o.codeBlockMinWidth,maxWidth:o.codeBlockMaxWidth},"boolean"==typeof ke.value?{showTooltips:ke.value}:{}),e)}),Ji=D(()=>a({},o.mermaidProps||{})),Yi=D(()=>a({},o.d2Props||{})),Gi=D(()=>a({},o.infographicProps||{})),Qi=D(()=>({typewriter:o.typewriter,fade:M.fade,customHtmlTags:Je.value.customHtmlTags})),ea=D(()=>a(a({},Qi.value),"boolean"==typeof ke.value?{showTooltip:ke.value}:{})),na=D(()=>a(a({},Qi.value),"boolean"==typeof ke.value?{showTooltips:ke.value}:{}));function ta(e){return Array.isArray(e.children)&&e.children.length>0}const oa=D(()=>dl.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=qn.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return qn.set(s,{signature:c,node:f}),f}(e.node);const f=la(d);let m=ia(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===Vi[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=Ue.value[r];if(Ze.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:A(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=dt,d={type:"text",content:n,raw:n}):(m=no,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h=ra(d,f,m);let v=a({},function(e,n,t){const o=null!=n?n:la(e);return t&&ra(e,o,t)?Xi.value:"code_block"===e.type&&function(e){return Boolean(e&&e===Ue.value.code_block)}(t)?qi.value:"code_block"===e.type&&nl(t)?Zi.value:"mermaid"===o?Ji.value:"infographic"===o?Gi.value:"d2"===o||"d2lang"===o?Yi.value:"link"===e.type?ea.value:"list"===e.type?na.value:"code_block"===e.type?qi.value:Qi.value}(d,f,m));const p=ll.value[e.index];"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!=Dl(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Jl(Ul(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Dl(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Yl(Xl(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:qe.value}));const g=function(e,n){const t=String(e.type);return!Xe(t)&&Ue.value[t]===n}(d,m),y=g?dn(d,Se.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=y?y:{}),v),rendersCustomNode:g,hasSlotChildren:ta(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${Di.value}-${e.index}`})}));function la(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function ra(e,n,t){return"code_block"===e.type&&"pre"===c.value&&!function(e){return Boolean(e&&Ue.value[e])}(n)&&t===at}function ia(e,n){if(!e)return fo;const t=Ue.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:la(e),r=l?t[l]:void 0;if(r)return r;if("pre"===c.value)return t.code_block||at;if("mermaid"===l)return t.mermaid||zi;if("infographic"===l)return t.infographic||Wi;if("d2"===l||"d2lang"===l)return t.d2||ji;if(o)return o;return t.code_block||tl.value}return o||Vi[String(e.type)]||fo}function aa(e){l("click",e)}function ua(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function sa(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function ca(e){l("mouseover",e)}function da(e){l("mouseout",e)}const fa=J(null),ma=J(!1);let ha,va=null,pa=0,ga=0,ya=0;const Na=["code_block","admonition","table","math_block","html_block","image","thematic_break"],ka=new Set(Na),Sa=[".typewriter-cursor",".height-estimation-probes",...Na.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function ba(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&ka.has(n)}function xa(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+xa(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+xa(n),0):0}function Ma(){ha&&(clearTimeout(ha),ha=void 0)}function wa(){pa+=1,null!=va&&(null==In||In(va),va=null)}function Ca(){wa(),fa.value&&(fa.value.style.visibility="hidden")}function _a(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(Sa)}function Ba(e){let n=e.lastChild;for(;n;){if(_a(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Sa)&&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 Oa(){if(!he||!ma.value)return;if(null!=va)return;const e=pa,n=()=>{va=null,e===pa&&function(){var e,n;if(!(he&&ma.value&&T.value&&fa.value))return;const t=T.value,o=fa.value;o.style.visibility="hidden";const l=function(){const e=oa.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||ba(t.node)||!xi(t.index))continue;const o=Wn.get(t.index);if(!o)continue;const l=Ba(o);if(l)return l}return null}();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=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")}()};Tn?va=Tn(n):n()}return Y([Le,()=>o.content,()=>o.nodes,()=>o.typewriter,Ae],()=>s(null,null,function*(){var e,n;if(!he||pe.value||!xe.value)return;if(Ae.value)return ma.value=!1,Ma(),void Ca();if(null==(e=o.nodes)?void 0:e.length)return ma.value=!1,Ma(),Ca(),ga=(null!=(n=o.content)?n:"").length,void(ya=Le.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+xa(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+xa(n),0):Le.value.length}(),r=!ba(Ye.value[Ye.value.length-1]),i=t>ga,a=l>ya;if(!1===o.typewriter||!r||!i&&!a)return!1!==o.typewriter&&r||(ma.value=!1,Ca()),ga=t,void(ya=l);ga=t,ya=l,ma.value=!0,fa.value&&(fa.value.style.visibility="hidden"),Ma(),yield le(),Oa(),ha=setTimeout(()=>{ha=void 0,ma.value=!1},3e3)}),{flush:"post",immediate:!0}),Y(ma,e=>s(null,null,function*(){e?(yield le(),Oa()):Ca()}),{flush:"post"}),Y([()=>Pn.value,()=>ro.start,()=>ro.end],()=>s(null,null,function*(){he&&!pe.value&&xe.value&&ma.value&&(yield le(),Oa())}),{flush:"post"}),ee(()=>{Ma(),wa(),De.clear()}),(e,n)=>{const t=ye("NodeRenderer",!0);return F(pe)?(E(!0),R(z,{key:0},W(oa.value,e=>(E(),R(z,{key:e.index},[e.rendersCustomNode?(E(),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":o.customId,"is-dark":o.isDark,onClick:aa,onMouseover:ca,onMouseout:da,onCopy:n[0]||(n[0]=e=>l("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(E(),ie(t,ue({key:0,ref_for:!0},Ge.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?(E(),ie(t,ue({key:1,ref_for:!0},Ge.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(E(),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":o.customId,"is-dark":o.isDark,onClick:aa,onMouseover:ca,onMouseout:da,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)):(E(),R("div",{key:1,ref_key:"containerRef",ref:T,class:X(["markstream-vue markdown-renderer",[{dark:o.isDark},{virtualized:Cn.value},{"virtual-scroll-coordinated":pn.value}]]),"data-custom-id":o.customId,onClick:aa,onMouseover:ua,onMouseout:sa},[Nn.value||Cn.value?(E(),R(z,{key:0},[Nn.value?(E(),R("div",{key:0,class:"height-estimation-probes",style:se({width:`${Mn.value}px`}),"aria-hidden":"true"},[K("div",{ref_key:"paragraphProbeWrapperRef",ref:I,class:"node-content","data-probe":"paragraph"},[P(F(no),{node:tn.value,"index-key":"probe-paragraph"},null,8,["node"])],512),K("div",{ref_key:"listItemProbeWrapperRef",ref:L,class:"node-content","data-probe":"list-item"},[K("ul",Kr,[P(F(Dt),{node:on.value,"index-key":"probe-list-item"},null,8,["node"])])],512),K("div",{ref_key:"listProbeWrapperRef",ref:H,class:"node-content","data-probe":"list"},[P(F(qt),{node:rn.value,"index-key":"probe-list"},null,8,["node"])],512),(E(),R(z,null,W(6,e=>K("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||($[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[P(F(Vt),{node:$o(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,zr)),64))],4)):G("",!0),Cn.value?(E(),R("div",{key:1,class:"node-spacer",style:se({height:`${fl.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],64)):G("",!0),(E(!0),R(z,null,W(oa.value,e=>(E(),R("div",{key:e.index,ref_for:!0,ref:n=>wi(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[xi(e.index)?(E(),R("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${gl()}-${e}`;let t=!1;for(const o of Array.from(So.keys())){const l=bo.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(So.delete(o),bo.delete(o),t=!0)}t&&(Ol(),ki("async-node"))}(e),po.delete(e),function(e){var n;const t=(null!=(n=co.get(e))?n:0)+1;co.set(e,t)}(e);const o=ho.get(e);if(o){for(const e of o)Ao(e);ho.delete(e)}if(function(e){const n=jn.get(e);n&&(null==Dn||Dn.unobserve(n),Vn.delete(n),jn.delete(e))}(e),!n||!_n.value)return uo.delete(e),void co.delete(e);uo.set(e,n);const l=()=>{Bi(e,n)};queueMicrotask(l);const r=(Dn||"undefined"==typeof ResizeObserver||(Dn=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Vn.get(n.target),t=jn.get(null!=e?e:-1);null!=e&&t&&Bi(e,t)}else Oi()})),Dn);if(r&&(jn.set(e,n),Vn.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=Ye.value[e])?void 0:t.type)?[16,80,240,800]:Ae.value?[80]:[];if(n.length){const t=n.map(e=>Lo(e,l,"node-resize")).filter(e=>null!=e);t.length&&ho.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(E(),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":o.customId,"is-dark":o.isDark,onCopy:n[8]||(n[8]=e=>l("copy",e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(E(),ie(t,ue({key:0,ref_for:!0},Ge.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?(E(),ie(t,ue({key:1,ref_for:!0},Ge.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(E(),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":o.customId,"is-dark":o.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"])):(E(),ie(te,{key:0,name:"fade",css:!1!==M.fade,appear:!1!==M.fade},{default:oe(()=>[e.rendersCustomNode?(E(),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":o.customId,"is-dark":o.isDark,onCopy:n[4]||(n[4]=e=>l("copy",e)),onHandleArtifactClick:n[5]||(n[5]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(E(),ie(t,ue({key:0,ref_for:!0},Ge.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?(E(),ie(t,ue({key:1,ref_for:!0},Ge.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(E(),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":o.customId,"is-dark":o.isDark,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"]))]),_:2},1032,["css","appear"]))],512)):(E(),R("div",{key:1,class:"node-placeholder",style:se({height:`${rl(e.index)}px`})},null,4))],8,Wr))),128)),ma.value?(E(),R("span",{key:1,ref_key:"typewriterCursorRef",ref:fa,class:"typewriter-cursor","aria-hidden":"true"},null,512)):G("",!0),Cn.value?(E(),R("div",{key:2,class:"node-spacer",style:se({height:`${ml.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],42,Fr))}}})),[["__scopeId","data-v-bc800a7b"]]),Vr=jr;Vr.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",Vr.__name,Vr.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,jr)};const Dr=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),qr={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Ur={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"},Xr={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Zr={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Jr={class:"admonition-title"},Yr=["aria-expanded","aria-controls"],Gr=["id"],Qr=/* @__PURE__ */Te(/* @__PURE__ */$({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=D(()=>{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=J(!!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)=>(E(),R("div",{class:X(["admonition",[`admonition-${o.node.kind}`]])},[K("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(E(),R("svg",qr,[...t[1]||(t[1]=[K("circle",{cx:"12",cy:"12",r:"10"},null,-1),K("path",{d:"M12 16v-4"},null,-1),K("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(E(),R("svg",Ur,[...t[2]||(t[2]=[K("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),K("path",{d:"M9 18h6"},null,-1),K("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(E(),R("svg",Xr,[...t[3]||(t[3]=[K("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),K("path",{d:"M12 9v4"},null,-1),K("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(E(),R("svg",Zr,[...t[4]||(t[4]=[K("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),K("path",{d:"M12 8v4"},null,-1),K("path",{d:"M12 16h.01"},null,-1)])])):G("",!0),K("span",Jr,j(r.value),1),o.node.collapsible?(E(),R("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(E(),R("svg",{style:se({rotate:i.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...t[5]||(t[5]=[K("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Yr)):G("",!0)]),Ne(K("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[P(F(Vr),{"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,Gr),[[ke,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Qr.install=e=>{e.component(Qr.__name,Qr)};const ei=()=>import("@terrastruct/d2");let ni=null,ti=ei;function oi(e){ti=e,ni=null}function li(e){oi(null!=e?e:ei)}function ri(){oi(null)}function ii(){return"function"==typeof ti}function ai(){return s(this,null,function*(){if(ni)return ni;const e=ti;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===ei)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(ni=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),ni):null})}let ui=null,si=null,ci=0;function di(e){si=null!=e?e:null,ui=null,ci++}function fi(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");di(e)}function mi(){di()}function hi(){return"function"==typeof si}function vi(){return s(this,null,function*(){if(ui)return ui;const e=si,n=ci;if(!e)return null;const t=yield e();if(n!==ci||e!==si)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!==ci||e!==si?null:o?(ui=o,ui):null})}function pi(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function gi(e){var n;return e?Math.ceil(Math.max(0,e.offsetHeight||0,e.scrollHeight||0,(null==(n=e.getBoundingClientRect)?void 0:n.call(e).height)||0)):0}function yi(e){const n=gi(e);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return n;const t=window.getComputedStyle(e),o=pi(t.marginTop),l=pi(t.marginBottom);return Math.ceil(Math.max(0,n+o+l))}function Ni(e){if(!e)return 0;const n=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(!n)return 0;const t=yi(e),o=gi(n);return Math.max(0,t-o)}function ki(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 Si(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 bi(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 xi(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 Mi(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function wi(e,n,t){const o=Si(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&bi(e,n,t).length>0}function Ci(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=Si(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:bi(e,n,t).length>0?360:96}function _i(e){const n=me(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=me(/* @__PURE__ */new Map),l=me(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=J(!1),f=[0,80,180,360,640];let m,h=0,v=null,p=[],g=0;function y(){return[...be(e.items)]}function N(){const n=be(e.threadKey);return null==n?void 0:String(n)}function k(n,t){return ki(n,t,e)}function S(n,t){return wi(n,t,e)}function b(n,t){const o=k(n,t),l=N(),r=Mi(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function x(){const n=be(e.measurementKey);return null==n?void 0:String(n)}function M(){const n=be(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function w(){const n=be(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===M()?"monaco":"pre"}function C(){var e;return`${null!=(e=x())?e:""}${M()}${w()}`}function _(n,t){if(S(n,t))return b(n,t);const o=k(n,t),l=N(),r=Mi(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function B(e){const n=y();for(let t=0;t<n.length;t++){const o=n[t];if(k(o,t)===e)return{item:o,index:t}}return null}function O(e,n){var t;const o=B(e);if(!o||!n)return!1;if(n.sourceKey!==_(o.item,o.index))return!1;const l=S(o.item,o.index)?C():x();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function T(e){if(!O(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function I(e,n){var t,o;const l=B(e);return!!(l&&n&&S(l.item,l.index)&&n.sessionKey===b(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=N())?o:"")&&function(e){const n=C(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function L(e,n){return I(e,n)}function A(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function H(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(!L(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:(A(e,Math.ceil(r),n),Math.ceil(r))}function $(e){var n;return I(e,r.get(e))?null!=(n=l.get(e))?n:0:H(e)}function E(e){return Number.isFinite(e)&&e>0?e:null}function R(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function P(o,l,r=function(e){const n=B(e);return n?function(e,n){const t=S(e,n)?C():x();return a({sourceKey:_(e,n)},null==t?{}:{measurementKey:t})}(n.item,n.index):void 0}(o)){const i=E(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!=(N=null==f?void 0:f.measurementKey)?N:"")&&(null!=(k=null==c?void 0:c.widthBucket)?k:0)===(null!=(b=null==f?void 0:f.widthBucket)?b:0)));var c,f,h,p,y,N,k,b;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(()=>{U(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,U(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,w=M?V():void 0,O=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),T=M&&O<=2,I=M&&O<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var L;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),M&&((L=T?{type:"bottom",distanceFromBottomPx:0}:I?{type:"bottom",distanceFromBottomPx:O}:w)&&le(()=>{q(L),"function"==typeof requestAnimationFrame&&requestAnimationFrame(()=>{q(L)})}))}function F(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function K(e,n={}){const t=function(e){return yi(s.get(e))}(e),o=T(e);if(!function(e){const n=B(e);return!!n&&S(n.item,n.index)}(e))return void(t>0&&P(e,t));const l=$(e),r=function(e){return Ni(s.get(e))}(e);if(l>0){let i=Math.max(t,l+r);return(!n.allowMarkdownShrink||d.value)&&o>0&&(i=Math.max(i,o)),void(i>0&&P(e,i))}o>0?t>o+1&&P(e,t):t>0&&P(e,t)}function z(){const e={},n=y();for(let t=0;t<n.length;t++){const o=k(n[t],t),l=T(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function W(){const e={},n=y();for(let o=0;o<n.length;o++){const l=k(n[o],o),r=t.get(l);O(l,r)&&(e[l]=r)}return e}function j(){const e={};for(const[n,t]of o)e[n]=t;return e}function V(){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=y();for(let a=0;a<l.length;a++){const t=k(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:k(i,r.start),offsetWithinItemPx:0}:void 0}function D(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=x())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=E(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&O(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),H(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function q(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 U(e,n){e===h&&q(n)}function X(e){e===h&&(U(e,m),d.value=!1,m=void 0,g=0)}function Z(){R();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return pe()&&he(Z),{itemHeights:n,markdownStates:o,getItemKey:k,isMarkdownItem:S,measureItem:function(n,t,o){var l,r;const i=k(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 F(i);if(u===a)return void K(i);if(F(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),K(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),K(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=k(n,t),r=xi(n,t,e),a=N(),u=bi(n,t,e),s=b(n,t),c=C(),d=M(),f=w(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=Se(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=L(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:L(l,h)?h:null,restoreAnchor:!1,measurementKey:c,settleMode:"manual",settledToken:r,emitIntervalMs:32,heightDiffThresholdPx:1},g={content:u,final:r,mode:d,codeRenderer:f,nodeVirtual:"auto",fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==b(n,t))return;A(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:C()});const o=function(e){return"final"===e.phase||!!e.stable&&("measured"===e.confidence||"final"===e.confidence)}(e),r=Math.ceil(e.totalHeight);K(l,{allowMarkdownShrink:o}),le(()=>{$(l)===r&&K(l,{allowMarkdownShrink:o})})},onVirtualStateChange(e){e.sessionKey===b(n,t)&&(o.set(l,e),p.restoreState=e,H(l,e))}};return i.set(m,g),g},captureThreadState:function(){const e=x();return u(a({threadKey:N()},null==e?{}:{measurementKey:e}),{outerAnchor:V(),itemHeights:z(),itemSizeSources:W(),markdownStates:j()})},preloadThreadState:D,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(R(),d.value=Boolean(t),g=n,m=t,D(e),!t)return d.value=!1,m=void 0,void(g=0);U(n,t),le(()=>{U(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,U(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{U(n,t),o===f.length-1&&X(n)},e);p.push(l)}):X(n)})},dispose:Z}}function Bi(e){return re(e)}const Oi=Bi(()=>import("./index3.js")),Ti=Bi(()=>import("./index5.js")),Ii=Bi(()=>import("./index6.js")),Li=Bi(()=>import("./index11.js")),Ai=Bi(()=>import("./index10.js")),Hi=Bi(()=>import("./index7.js")),$i=Bi(()=>import("./index4.js")),Ei=Bi(()=>import("./index8.js")),Ri=Bi(()=>import("./index9.js")),Pi={MarkdownRender:Vr,NodeRenderer:Vr,AdmonitionNode:Qr,BlockquoteNode:Ie,CheckboxNode:$e,CodeBlockNode:Oi,DefinitionListNode:Fe,EmojiNode:ze,EmphasisNode:$t,FootnoteNode:Kt,FootnoteReferenceNode:ln,FootnoteAnchorNode:Rt,HardBreakNode:Wt,HeadingNode:Vt,HtmlBlockNode:Qt,HtmlInlineNode:yn,HighlightNode:At,ImageNode:Yn,D2BlockNode:Hi,InfographicBlockNode:Ai,InlineCodeNode:Sn,PreCodeNode:at,InsertNode:It,LinkNode:Ot,ListItemNode:Dt,ListNode:qt,MathBlockNode:Ti,MathInlineNode:Ii,MermaidBlockNode:Li,ParagraphNode:no,StrikethroughNode:Mt,StrongNode:bt,SubscriptNode:kt,SuperscriptNode:yt,TableNode:ao,TextNode:dt,ThematicBreakNode:so,VmrContainerNode:mo,ReferenceNode:pt,MarkdownCodeBlockNode:Ei,MarkstreamVirtualTimeline:Ri,Tooltip:$i},Fi={install(e,n){var t;Object.entries(Pi).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Ce(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&_e(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&H(n.mathOptions),n&&"infographicLoader"in n&&di(null!=(t=n.infographicLoader)?t:null),(null==n?void 0:n.components)&&e.provide(qe,function(e={}){return q(Je(e))}(n.components))}};export{Ii as $,Qr as A,Ie as B,$e as C,Oi as D,Hi as E,Fe as F,ze as G,$t as H,Rt as I,Kt as J,ln as K,Wt as L,Vt as M,At as N,Qt as O,yn as P,Yn as Q,Ai as R,Sn as S,It as T,Ot as U,Dt as V,qt as W,Ei as X,Ri as Y,Ti as Z,Te as _,er as a,Li as a0,no as a1,pt as a2,Mt as a3,bt as a4,kt as a5,yt as a6,ao as a7,dt as a8,so as a9,$i as aa,mo as ab,Fi as ac,nn as ad,ri as ae,mi as af,li as ag,fi as ah,Ge as ai,ii as aj,en as ak,Ye as al,oi as am,Kn as an,di as ao,_i as ap,Ar as aq,Zt as b,Vr as c,Si as d,Ci as e,ki as f,ai as g,Pn as h,wi as i,xi as j,bi as k,Mi as l,yi as m,Ni as n,Xl as o,Dl as p,hi as q,Vn as r,Rn as s,Yl as t,jn as u,vi as v,Ul as w,ql as x,Jl as y,at 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 O,resolveCustomHtmlTags as T,parseMarkdownToStructure as I,EXTENDED_STANDARD_HTML_TAGS as L,stripCustomHtmlWrapper as A,setDefaultMathOptions as H}from"stream-markdown-parser";import{shallowRef as $,inject as R,computed as E,defineComponent as F,openBlock as P,createElementBlock as K,createElementVNode as z,toDisplayString as W,h as j,normalizeClass as V,createVNode as D,unref as q,useAttrs as U,ref as X,watch as Z,Fragment as J,createTextVNode as Y,createCommentVNode as G,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,reactive as he,onScopeDispose as ve,getCurrentScope as pe,onMounted as ge,resolveComponent as ye,withDirectives as ke,vShow as Ne,toRaw as be,toValue as Se}from"vue";import{resolveStreamingTextUpdate as xe,createSmoothMarkdownStream as Me,normalizeShikiLanguage as we,getHighlightRegistrationKey as Ce}from"markstream-core";import{M as _e,n as Be,s as Oe,f as Te}from"./index2.js";import{a as Ie}from"./workers-katexWorkerClient.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 Le="__global__",Ae="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",He=(()=>{const e=globalThis;if(e[Ae])return e[Ae];const n={scopedCustomComponents:{},revision:$(0)};return e[Ae]=n,n})(),$e=He.revision,Re=/* @__PURE__ */Symbol("markstreamCustomComponents"),Ee=/* @__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 Fe(e){return Ee.has(String(e).trim().toLowerCase())}function Pe(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ke(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(Pe(t))]))!e||Fe(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function ze(e,n){"string"==typeof e?He.scopedCustomComponents[e]=Ke(n||{}):He.scopedCustomComponents[Le]=Ke(e||{}),$e.value++}function We(e){const n=Ke(He.scopedCustomComponents[Le]||{});if(!e)return n;const t=Ke(He.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function je(e){const n=R(Re,null);return E(()=>{var t;return $e.value,function(e,n={}){return $e.value,a(a(a({},Ke(He.scopedCustomComponents[Le]||{})),Ke(n)),Ke(function(e){return e&&He.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Ve(e){if(e===Le)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete He.scopedCustomComponents[e],$e.value++}function De(){delete He.scopedCustomComponents[Le],$e.value++}const qe=["aria-label"],Ue={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"},Xe={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"},Ze=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},Je=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(P(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(P(),K("svg",Xe,[...t[1]||(t[1]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),z("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(P(),K("svg",Ue,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,qe))}),[["__scopeId","data-v-be21ab83"]]);Je.install=e=>{e.component(Je.__name,Je)};const Ye={class:"emoji-node"},Ge=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(P(),K("span",Ye,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Ge.install=e=>{e.component(Ge.__name,Ge)};const Qe=["id"],en=["title"],nn=/* @__PURE__ */Ze(/* @__PURE__ */F({__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)=>(P(),K("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[z("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+W(e.node.id)+"]",9,en)],8,Qe))}}),[["__scopeId","data-v-c1463a29"]]);nn.install=e=>{e.component(nn.__name,nn)};const tn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function on(e){tn&&console.warn(e)}function ln(e,n="safe",t){return m(e,n,t)}function rn(e){return p(e)}function an(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function un(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),an(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),an(e.value)]):Object.entries(l).map(([e,n])=>[e,an(n)]):null,n,t);var l;if(!o)return;const r=rn(v(o));return Object.keys(r).length>0?r:void 0}function sn(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 cn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function dn(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?[sn(e,n,!0)]:[sn(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=rn(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 fn(e,n){return f(e,n)}function mn(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=dn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);cn(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=dn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?cn(l[l.length-1].children,a):cn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&on(`Auto-closing unclosed tag: <${i.tagName}>`)}else on(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=dn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?cn(l[l.length-1].children,o):cn(r,o),on(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,tn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const hn=["innerHTML"],vn=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("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=je(()=>n.customId),r=F({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=mn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!fn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=mn(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?(P(),K("span",{key:0,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[D(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(P(),K("span",{key:1,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(P(),K("span",{key:2,class:V(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,hn))}}),[["__scopeId","data-v-d17f12b0"]]);vn.install=e=>{e.component(vn.__name,vn)};const pn={class:"inline-code"},gn={key:0},yn=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=U(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=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="")}Z([()=>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=xe({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}),Z(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)=>(P(),K("code",pn,[s.value?(P(),K(J,{key:0},[Y(W(u.value),1)],64)):(P(),K(J,{key:1},[d.value?(P(),K("span",gn,W(d.value),1)):G("",!0),f.value?(P(),K("span",{key:1,class:V(["inline-code-stream-delta",[g.value]]),onAnimationend:p},W(f.value),35)):G("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);yn.install=e=>{e.component(yn.__name,yn)};const kn=X(!1),Nn=X(""),bn=X("top"),Sn=X(null),xn=X(null),Mn=X(null),wn=X(null),Cn=X(null);let _n=null,Bn=null,On=0;function Tn(){_n&&(clearTimeout(_n),_n=null),Bn&&(clearTimeout(Bn),Bn=null)}let In=!1,Ln=null,An=!1;function Hn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++On;Tn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!In&&!An&&"undefined"!=typeof document){null!=Ln||(Ln=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:kn.value,"anchor-el":Sn.value,content:Nn.value,placement:bn.value,id:xn.value,originX:Mn.value,originY:wn.value,isDark:null!=(e=Cn.value)?e:void 0})}}).mount(o),In=!0}));try{yield Ln}catch(e){In=!1,Ln=null,An=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),In&&i===On){xn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Sn.value=e,Nn.value=n,bn.value=t,Mn.value=null!=(o=null==l?void 0:l.x)?o:null,wn.value=null!=(a=null==l?void 0:l.y)?a:null,Cn.value="boolean"==typeof r?r:null,kn.value=!0;try{e.setAttribute("aria-describedby",xn.value)}catch(u){}}});o?a():_n=setTimeout(a,80)}function $n(e=!1){On+=1,Tn();const n=()=>{if(Sn.value&&xn.value)try{Sn.value.removeAttribute("aria-describedby")}catch(e){}kn.value=!1,Sn.value=null,xn.value=null,Mn.value=null,wn.value=null};e?n():Bn=setTimeout(n,120)}const Rn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function En(e){Object.assign(Rn,e)}const Fn=e=>{var n;return null!=(n=Rn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function Pn(e){return{t(n){if(e.te&&Rn[n]&&!e.te(n))return Fn(n);const t=e.t(n);return t===n&&Rn[n]?Fn(n):t}}}function Kn(){const e=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(e)return Pn(e);try{const e=globalThis.$vueI18nUse||null;if(e&&"function"==typeof e)try{const n=e();if(n&&"function"==typeof n.t)return Pn({t:n.t.bind(n),te:"function"==typeof n.te?n.te.bind(n):void 0})}catch(n){}}catch(n){}return{t:Fn}}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 Wn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],jn={key:1,class:"image-placeholder"},Vn={key:1,class:"image-node__raw-text"},Dn={key:0,class:"image-shimmer-overlay"},qn={key:1,class:"image-node__raw-text"},Un={key:2,class:"image-error"},Xn=/* @__PURE__ */Ze(/* @__PURE__ */F({__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=R(_e,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 O(){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:I}=Kn();return Z([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}),Z([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 P(),K("span",{ref_key:"rootRef",ref:u,class:"image-node-container"},[y.value?(P(),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:V(["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:O,onClick:T},null,42,Wn)):G("",!0),e.node.loading&&!r.value?(P(),K("span",jn,[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]=z("span",{class:"image-shimmer"},null,-1))],!0):(P(),K("span",Vn,W(e.node.raw),1))])):G("",!0),D(te,{name:"shimmer-fade"},{default:oe(()=>[N.value&&!e.node.loading?(P(),K("span",Dn,[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]=z("span",{class:"image-shimmer"},null,-1))],!0):(P(),K("span",qn,W(e.node.raw),1))])):G("",!0)]),_:3}),k.value?(P(),K("span",Un,[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]=z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[z("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)),z("span",null,W(q(I)("image.loadError")),1)],!0)])):G("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const Zn={key:2},Jn=/* @__PURE__ */F({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const n=e,t=je(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("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(()=>pi),suspensible:!1}),c=E(()=>n.components[String(n.node.type)]),d=E(()=>Boolean(c.value&&t.value[n.node.type]&&!Fe(String(n.node.type)))),f=E(()=>d.value?un(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?(P(),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?(P(),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?(P(),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"])):G("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(P(),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?(P(),K("span",Zn,W(v.value),1)):G("",!0)}}),Yn=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Gn={key:0,translate:"no",class:"markstream-pre__diff-code"},Qn={class:"markstream-pre__diff-number","aria-hidden":"true"},et={class:"markstream-pre__diff-content"},nt={class:"markstream-pre__diff-content-inner"},tt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},ot=["textContent"],lt=/* @__PURE__ */F({__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,n="context"){const t=function(e){return 0===String(null!=e?e:"").trim().length}(e);return{code:e,kind:t&&"hunk"!==n?"context":n,empty:t}}function m(e){return String(null!=e?e:"").split(/\r\n|\n|\r/)}function h(e){return e.startsWith("-")&&!e.startsWith("---")}function v(e){return e.startsWith("+")&&!e.startsWith("+++")}function p(e,n){const t=m(e),o=m(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({},f(t[n],"removed")),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},f(o[r],"added")),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},f(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({},f(t[n],"removed")),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<o.length;)e.push(u(a({},f(o[r],"added")),{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({},f(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({},f(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let m=i;m<=s;m++)r.push(u(a({},f(t[m],"removed")),{key:`inline-removed-source-${m}`,number:m+1}));for(let m=i;m<=c;m++)r.push(u(a({},f(o[m],"added")),{key:`inline-added-source-${m}`,number:m+1}));return r.concat(d)}const g=E(()=>{var e,t,o,l,i,s;const d=r.value.some(e=>h(e)||v(e));if(c.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:d?function(e){const n=[];let t=1,o=1;for(const[l,r]of e.entries())if(r.startsWith("@@"))n.push(u(a({},f(r,"hunk")),{key:`inline-hunk-${l}`,number:""}));else if(h(r))n.push(u(a({},f(r.slice(1),"removed")),{key:`inline-removed-${l}`,number:t++}));else if(v(r))n.push(u(a({},f(r.slice(1),"added")),{key:`inline-added-${l}`,number:o++}));else{const e=r.startsWith(" ")?r.slice(1):r;n.push(u(a({},f(e)),{key:`inline-context-${l}`,number:o})),t++,o++}return n}(r.value):p(null==(e=n.node)?void 0:e.originalCode,null==(t=n.node)?void 0:t.updatedCode)}];if(!d&&(null!=(null==(o=n.node)?void 0:o.originalCode)||null!=(null==(l=n.node)?void 0:l.updatedCode)))return[{key:"original",className:"markstream-pre__diff-pane--original",lines:m(null==(i=n.node)?void 0:i.originalCode).map((e,n)=>u(a({},f(e,"removed")),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:m(null==(s=n.node)?void 0:s.updatedCode).map((e,n)=>u(a({},f(e,"added")),{key:`modified-${n}`,number:n+1}))}];const g=[],y=[];for(const n of r.value)if(n.startsWith("@@"))g.push(f(n,"hunk")),y.push(f(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))g.push(f(n.slice(1),"removed"));else if(n.startsWith("+")&&!n.startsWith("+++"))y.push(f(n.slice(1),"added"));else{const e=n.startsWith(" ")?n.slice(1):n;g.push(f(e)),y.push(f(e))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:g.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:y.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}]}),y=E(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"}),k=X(null),N=X([]);let b=null,S=null;function x(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function M(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 w(){"undefined"!=typeof window&&(null!=b&&window.cancelAnimationFrame(b),b=window.requestAnimationFrame(()=>{!function(){var e,n;b=null;const t=k.value;if(!t||!s.value)return void(N.value.length&&(N.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=x(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=x(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=M(null!=(e=l[s])?e:null,o),i=M(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=N.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})||(N.value=a)}()}))}function C(e){null==S||S.disconnect(),S=null,e&&s.value&&"undefined"!=typeof ResizeObserver&&(S=new ResizeObserver(()=>{w()}),S.observe(e))}function _(e,n){const t=N.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 Z(k,e=>{C(e),le(()=>w())},{flush:"post"}),Z([s,g],()=>{C(k.value),le(()=>w())},{flush:"post",immediate:!0}),ee(()=>{null!=b&&(window.cancelAnimationFrame(b),b=null),null==S||S.disconnect(),S=null}),(r,a)=>(P(),K("pre",{ref_key:"preRef",ref:k,style:se(d.value),class:V([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":y.value,"data-language":t.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[s.value?(P(),K("code",Gn,[(P(!0),K(J,null,ce(g.value,e=>(P(),K("span",{key:e.key,class:V(["markstream-pre__diff-pane",e.className])},[(P(!0),K(J,null,ce(e.lines,(n,t)=>(P(),K("span",{key:n.key,class:V(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:se(_(t,e.key))},[a[0]||(a[0]=z("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),z("span",Qn,W(n.number),1),z("span",et,[z("span",nt,W(n.code),1)])],6))),128))],2))),128))])):(P(),K(J,{key:1},[n.showLineNumbers?(P(),K("span",tt,[(P(!0),K(J,null,ce(i.value,e=>(P(),K("span",{key:e,class:"markstream-pre__line-number"},W(e),1))),128))])):G("",!0),z("code",{translate:"no",class:"markstream-pre__code",textContent:W(l.value)},null,8,ot)],64))],14,Yn))}});lt.install=e=>{e.component(lt.__name,lt)};const rt=$(!1);let it=null;const at={key:0},ut=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(it||(it=Ie().then(e=>{rt.value=!!e}).catch(()=>{rt.value=!1})),de(rt)),o=U(),l=R("markstreamFade",void 0),r=R("markstreamTextStreamState",void 0),i=R("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="")}Z([()=>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=xe({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}),Z(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)=>(P(),K("span",{class:V([[q(t)&&e.node.center?"text-node-center":""],"text-node"])},[c.value?(P(),K("span",at,W(c.value),1)):G("",!0),d.value?(P(),K("span",{key:1,class:V(["text-node-stream-delta",[p.value]]),onAnimationend:v},W(d.value),35)):G("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);ut.install=e=>{e.component(ut.__name,ut)};const st=F({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:n}){const t=n;return()=>{var e;return j(lt,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"}))}}}),ct=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),lt}}),loadingComponent:st,delay:0,suspensible:!1}),dt=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(ut,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 Ie())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(ut,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:""}$`}}))}})),ft=re(()=>s(null,null,function*(){try{if(yield Ie())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(ut,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__ */Ze(/* @__PURE__ */F({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(P(),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))},W(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);mt.install=e=>{e.component(mt.__name,mt)};const ht={class:"superscript-node"},vt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,emphasis:Lt,footnote_reference:nn,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,emoji:Ge,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("sup",ht,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);vt.install=e=>{e.component(vt.__name,vt)};const pt={class:"subscript-node"},gt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,emphasis:Lt,footnote_reference:nn,strikethrough:bt,highlight:Tt,insert:Bt,superscript:vt,emoji:Ge,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("sub",pt,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt={class:"strong-node"},kt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,emphasis:Lt,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,footnote_reference:nn,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("strong",yt,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);kt.install=e=>{e.component(kt.__name,kt)};const Nt={class:"strikethrough-node"},bt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,emphasis:Lt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,footnote_reference:nn,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("del",Nt,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);bt.install=e=>{e.component(bt.__name,bt)};const St=["href","title","aria-label","aria-hidden","target","rel"],xt=["aria-hidden"],Mt={class:"link-text-wrapper relative inline-flex"},wt={class:"leading-[normal] link-text"},Ct=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=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=je(()=>n.customId),i=E(()=>a({text:ut,strong:kt,strikethrough:bt,emphasis:Lt,image:Xn,html_inline:vn,inline_code:yn},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 ln(l,"safe","a")}),c=E(()=>a(a({},u),s.value)),d=E(()=>{var e,t;return ln({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&&$n()}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?(P(),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}),[z("span",Mt,[z("span",wt,[D(q(ut),{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]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,xt)):(P(),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)||"";Hn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(P(!0),K(J,null,ce(e.node.children,(t,o)=>(P(),ie(q(Jn),{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,St))}}}),[["__scopeId","data-v-367e6ca4"]]);Ct.install=e=>{e.component(Ct.__name,Ct)};const _t={class:"insert-node"},Bt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,emphasis:Lt,strikethrough:bt,highlight:Tt,subscript:gt,superscript:vt,emoji:Ge,footnote_reference:nn,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("ins",_t,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);Bt.install=e=>{e.component(Bt.__name,Bt)};const Ot={class:"highlight-node"},Tt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,emphasis:Lt,strikethrough:bt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,footnote_reference:nn,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("mark",Ot,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);Tt.install=e=>{e.component(Tt.__name,Tt)};const It={class:"emphasis-node"},Lt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=E(()=>a({text:ut,inline_code:yn,link:Ct,html_inline:vn,strong:kt,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,footnote_reference:nn,math_inline:dt,reference:mt},t.value));return(t,l)=>(P(),K("em",It,[(P(!0),K(J,null,ce(e.node.children,(t,l)=>(P(),ie(q(Jn),{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"]]);Lt.install=e=>{e.component(Lt.__name,Lt)};const At={class:"hard-break"},Ht=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(P(),K("br",At))}),[["__scopeId","data-v-50c58f70"]]);Ht.install=e=>{e.component(Ht.__name,Ht)};const $t=/* @__PURE__ */F({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=fe({checkbox:Je,checkbox_input:Je,emoji:Ge,emphasis:Lt,hardbreak:Ht,highlight:Tt,inline_code:yn,insert:Bt,link:Ct,reference:mt,strikethrough:bt,strong:kt,subscript:gt,superscript:vt,text:ut}),o=je(()=>n.customId),l=E(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(P(!0),K(J,null,ce(e.nodes,(t,o)=>(P(),ie(q(Jn),{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 Rt(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(Rt)}function Et(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(Rt))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(Rt)?l:null}function Ft(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 Pt=["cite"],Kt={key:0,dir:"auto",class:"paragraph-node"},zt=["custom-id"],Wt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=je(()=>n.customId),o=E(()=>Boolean(t.value.paragraph)),l=E(()=>Boolean(t.value.text)),r=E(()=>Et(n.node.children,!o.value)),i=E(()=>!1!==n.fade||l.value?null:Ft(r.value));return me("markstreamShowTooltips",E(()=>n.showTooltips)),me("markstreamFade",E(()=>n.fade)),(t,o)=>(P(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(P(),K("p",Kt,[null!==i.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(i.value),9,zt)):(P(),ie(q($t),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(P(),ie(q(vi),{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,Pt))}}),[["__scopeId","data-v-abfecebc"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const jt={class:"definition-list"},Vt={class:"definition-term"},Dt={class:"definition-desc"},qt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(P(),K("dl",jt,[(P(!0),K(J,null,ce(n.node.items,(o,l)=>(P(),K(J,{key:l},[z("dt",Vt,[D(q(vi),{"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"])]),z("dd",Dt,[D(q(vi),{"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"]]);qt.install=e=>{e.component(qt.__name,qt)};const Ut=["href","title"],Xt=/* @__PURE__ */Ze(/* @__PURE__ */F({__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)=>(P(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,Ut))}}),[["__scopeId","data-v-e1eb37b6"]]);Xt.install=e=>{e.component(Xt.__name,Xt)};const Zt=["id"],Jt={class:"flex-1"},Yt=/* @__PURE__ */F({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(P(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",Jt,[D(q(vi),{"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,Zt))}});Yt.install=e=>{e.component(Yt.__name,Yt)};const Gt=["custom-id"],Qt=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=je(()=>n.customId),o=R("markstreamFade",void 0),l=E(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:Ft(n.node.children)),r=E(()=>a({text:ut,inline_code:yn,link:Ct,image:Xn,strong:kt,emphasis:Lt,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,checkbox:Je,checkbox_input:Je,footnote_reference:nn,hardbreak:Ht,math_inline:dt,reference:mt},t.value));return(t,o)=>(P(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:oe(()=>[null!==l.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(l.value),9,Gt)):(P(!0),K(J,{key:1},ce(e.node.children,(t,o)=>(P(),ie(q(Jn),{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"]]),eo=Qt;eo.install=e=>{e.component(Qt.__name,Qt)};const no={key:0,dir:"auto",class:"paragraph-node"},to=["custom-id"],oo={dir:"auto",class:"paragraph-node"},lo=["custom-id"],ro=/* @__PURE__ */Ze(/* @__PURE__ */F({__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=je(()=>n.customId),l=E(()=>Boolean(o.value.paragraph)),r=E(()=>Boolean(o.value.text)),i=E(()=>{var e;return Et(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=Et([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=E(()=>u()?Ft(i.value):null),c=E(()=>{var e;return u()?Ft(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 P(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(P(),K("p",no,[null!==s.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(s.value),9,to)):(P(),ie(q($t),{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?(P(),K(J,{key:1},[z("p",oo,[null!==c.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(c.value),9,lo)):(P(),ie(q($t),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(P(!0),K(J,null,ce(a.value.nestedLists,(t,l)=>(P(),ie(q(vi),{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)):(P(),ie(q(vi),{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"]]);ro.install=e=>{e.component(ro.__name,ro)};const io=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=je(()=>e.customId),t=E(()=>n.value.list_item||ro);return(n,o)=>(P(),ie(ae(e.node.ordered?"ol":"ul"),{class:V(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:oe(()=>[(P(!0),K(J,null,ce(e.node.items,(l,r)=>{var i;return P(),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"]]);io.install=e=>{e.component(io.__name,io)};const ao=/* @__PURE__ */Symbol("ViewportPriority");function uo(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;let u=null,s=null;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Set;let f=null;function m(){if(!c.size){try{null==u||u.disconnect()}catch(e){}u=null,s=null,d.size||function(){if(null!=f){try{null==a||a(f)}catch(e){}f=null}}()}}function h(e){const n=c.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==u||u.unobserve(e)}catch(t){}c.delete(e),d.delete(e),m()}}function v(){i&&null==f&&d.size&&(f=i(()=>{f=null;const e=d.values().next().value;e&&(d.delete(e),h(e),d.size&&v())},{timeout:1200}))}const p=(n,t)=>{const o=X(!1);let i,a=!1;const f=new Promise(e=>{i=()=>{a||(a=!0,e())}}),p=()=>{try{null==u||u.unobserve(n)}catch(e){}c.delete(n),d.delete(n),m()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:p};const g=function(n,t){if(!l)return u;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(u&&(i=o,(r=s)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return u;var r,i;if(u)try{u.disconnect()}catch(a){}u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&h(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),s=o;for(const e of c.keys())u.observe(e);return u}(n,t);return g?(c.set(n,{resolve:i,visible:o}),g.observe(n),d.add(n),v(),{isVisible:o,whenVisible:f,destroy:p}):(o.value=!0,i(),{isVisible:o,whenVisible:f,destroy:p})};return me(ao,p),p}function so(){var e,n;const t=R(ao,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,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=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||s()}},d=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),c(e),r.size&&d())},{timeout:1200}))};return e=>{const n=X(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),u=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||s()},f=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&c(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return f?(o.set(e,{resolve:t,visible:n}),f.observe(e),r.add(e),d(),{isVisible:n,whenVisible:a,destroy:u}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:u})}}const co={key:2,class:"html-block-node__raw"},fo=["innerHTML"],mo={key:1,class:"html-block-node__placeholder"},ho=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=R("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(()=>pi),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=je(()=>n.customId),f=F({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(()=>{const e=N.value.trim().toLowerCase();return M.has(e)||k(e,l.value)}),x=E(()=>y.value.length>0&&!!n.node.tag&&!S.value),w=E(()=>{var e,t,o;if(x.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=mn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!fn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=mn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),C=so(),_=X(null),B=!!n.node.loading;return"undefined"!=typeof window?(Z(m,e=>{var t,o;if(null==(o=null==(t=_.value)?void 0:t.destroy)||o.call(t),_.value=null,!B)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);const l=C(e,{rootMargin:"400px"});_.value=l,p.value=l.isVisible.value,l.whenVisible.then(()=>{p.value=!0})},{immediate:!0}),Z(()=>n.node.content,e=>{B&&!p.value||(g.value=e)})):p.value=!0,ee(()=>{var e,n;null==(n=null==(e=_.value)?void 0:e.destroy)||n.call(e),_.value=null}),(n,t)=>(P(),ie(ae(x.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node"},x.value?c.value:void 0),{default:oe(()=>[p.value?(P(),K(J,{key:0},["structured"===w.value.mode?(P(),ie(q(i),ue({key:0},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):"dynamic"===w.value.mode?(P(),ie(q(f),{key:1,nodes:w.value.nodes},null,8,["nodes"])):"text"===w.value.mode?(P(),K("pre",co,W(w.value.content),1)):(P(),K("div",ue({key:3},s.value,{innerHTML:w.value.content}),null,16,fo))],64)):(P(),K("div",mo,[ne(n.$slots,"placeholder",{node:e.node},()=>[t[0]||(t[0]=z("span",{class:"html-block-node__placeholder-bar"},null,-1)),t[1]||(t[1]=z("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),t[2]||(t[2]=z("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-f1744dfb"]]);ho.install=e=>{e.component(ho.__name,ho)};const vo={dir:"auto",class:"paragraph-node"},po=["custom-id"],go=/* @__PURE__ */Ze(/* @__PURE__ */F({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const n=e,t=je(()=>n.customId),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamFade",void 0),r=R("markstreamParseOptions",void 0),i=R("markstreamCustomMarkdownIt",void 0),s=R("markstreamNestedRendererProps",void 0),c=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(()=>pi),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?Ft(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:yn,image:Xn,link:Ct,hardbreak:Ht,emphasis:Lt,strong:kt,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,html_inline:vn,html_block:ho,emoji:Ge,checkbox:Je,math_inline:dt,checkbox_input:Je,reference:mt,footnote_anchor:Xt,footnote_reference:nn,text:ut},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:ut,isCustomComponent:!1}}}return{child:e,component:M.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Fe(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?un(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)=>(P(),K("p",vo,[null!==S.value?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(S.value),9,po)):(P(!0),K(J,{key:1},ce(B.value,e=>{return P(),K(J,{key:e.key},[y.value&&p(e.originalChild)?(P(),K(J,{key:0},[Y(W((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(P(),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?(P(),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?(P(),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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(P(),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"]]);go.install=e=>{e.component(go.__name,go)};const yo={class:"table-node-wrapper"},ko=["aria-busy"],No={key:0},bo=["custom-id"],So=["aria-label","onPointerdown"],xo=["custom-id"],Mo={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},wo=/* @__PURE__ */Ze(/* @__PURE__ */F({__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=je(()=>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=Et(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?Ft(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 Z(a,()=>{p(),r.value=[]}),ee(p),(a,c)=>(P(),K("div",yo,[z("table",{ref_key:"tableRef",ref:l,class:V(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(P(),K("colgroup",No,[(P(!0),K(J,null,ce(e.node.header.cells,(e,n)=>(P(),K("col",{key:n,style:se(s.value[n])},null,4))),128))])):G("",!0),z("thead",null,[z("tr",null,[(P(!0),K(J,null,ce(e.node.header.cells,(t,o)=>(P(),K("th",{key:o,dir:"auto",class:V(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(t).plainText),9,bo)):h(t).simpleChildren?(P(),ie(q($t),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(P(),ie(q(vi),{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?(P(),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,So)):G("",!0)],2))),128))])]),z("tbody",null,[(P(!0),K(J,null,ce(o.value,(e,t)=>(P(),K("tr",{key:t},[(P(!0),K(J,null,ce(e.cells,(e,o)=>(P(),K("td",{key:o,class:V(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(P(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(e).plainText),9,xo)):h(e).simpleChildren?(P(),ie(q($t),{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"])):(P(),ie(q(vi),{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,ko),D(te,{name:"table-node-fade"},{default:oe(()=>[t.value?(P(),K("div",Mo,[ne(a.$slots,"loading",{isLoading:t.value},()=>[c[2]||(c[2]=z("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),c[3]||(c[3]=z("span",{class:"sr-only"},"Loading",-1))],!0)])):G("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);wo.install=e=>{e.component(wo.__name,wo)};const Co={class:"hr-node"},_o=/* @__PURE__ */Ze({},[["render",function(e,n){return P(),K("hr",Co)}],["__scopeId","data-v-39b2349c"]]);_o.install=e=>{e.component(_o.__name,_o)};const Bo={class:"unknown-node"},Oo=/* @__PURE__ */F({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(P(),K("div",Bo,W(e.node.raw),1))}),To=/* @__PURE__ */Ze(/* @__PURE__ */F({__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=je(()=>n.customId),l=E(()=>a({text:ut,paragraph:go,heading:eo,inline_code:yn,link:Ct,image:Xn,strong:kt,emphasis:Lt,strikethrough:bt,insert:Bt,subscript:gt,superscript:vt,checkbox:Je,checkbox_input:Je,hardbreak:Ht,math_inline:dt,reference:mt,list:io,math_block:ft,table:wo},o.value));return(o,r)=>(P(),K("div",ue({class:t.value},e.node.attrs),[(P(!0),K(J,null,ce(e.node.children,(t,o)=>{return P(),ie(ae((r=t.type,l.value[r]||Oo)),{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"]]);To.install=e=>{e.component(To.__name,To)};const Io=["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"],Lo=[[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 Ao(e){if(e<=255)return Io[e];let n=0,t=Lo.length-1;for(;n<=t;){const o=n+t>>1,l=Lo[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const Ho=/[ \t\n\r\f]+/g,$o=/[\t\n\r\f]| {2,}|^ | $/;let Ro=null;const Eo=new RegExp("\\p{Script=Arabic}","u"),Fo=new RegExp("\\p{M}","u"),Po=new RegExp("\\p{Nd}","u");function Ko(e){return Eo.test(e)}function zo(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Wo(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(zo(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(zo(t))return!0}}return!1}const jo=/* @__PURE__ */new Set([" "," ","","\ufeff"]);function Vo(e){return Wo(e)}function Do(e){return!function(e){const n=ll(e);return null!==n&&(qo.has(n)||Zo.has(n))}(e)&&!function(e){const n=ll(e);return null!==n&&jo.has(n)}(e)}const qo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Uo=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),Xo=/* @__PURE__ */new Set(["'","’"]),Zo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Jo=/* @__PURE__ */new Set([":",".","،","؛"]),Yo=/* @__PURE__ */new Set(["၏"]),Go=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Qo(e){if(tl(e))return!0;let n=!1;for(const t of e)if(Zo.has(t))n=!0;else if(!n||!Fo.test(t))return!1;return n}function el(e){for(const n of e)if(!qo.has(n)&&!Zo.has(n))return!1;return e.length>0}function nl(e){if(tl(e))return!0;for(const n of e)if(!Uo.has(n)&&!Xo.has(n)&&!Fo.test(n))return!1;return e.length>0}function tl(e){let n=!1;for(const t of e)if("\\"!==t&&!Fo.test(t)){if(!(Uo.has(t)||Zo.has(t)||Xo.has(t)))return!1;n=!0}return n}function ol(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 ll(e){if(0===e.length)return null;const n=ol(e,e.length);return e.slice(n)}function rl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Fo.test(e))t--;else{if(!Uo.has(e)&&!Xo.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function il(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function al(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 ul(e,n){return e&&null!==n&&Jo.has(n)}function sl(e){const n=ll(e);return null!==n&&Yo.has(n)}function cl(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 dl(e){let n=e.length;for(;n>0;){const t=ol(e,n),o=e.slice(t,n);if(Go.has(o))return!0;if(!Zo.has(o))return!1;n=t}return!1}function fl(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 ml=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function hl(e){return 1===e.length?e[0]:e.join("")}function vl(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),hl(t)}function pl(e,n,t,o){if(!ml.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=fl(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:hl(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:hl(i),isWordLike:u,kind:r,start:a}),l}function gl(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const yl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function kl(e,n){const t=e.texts[n];return!!t.startsWith("www.")||yl.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Nl(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const bl=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Sl=/^[A-Za-z0-9_]+[,:;]*$/,xl=/[,:;]+$/;function Ml(e){for(const n of e)if(Po.test(n))return!0;return!1}function wl(e){if(0===e.length)return!1;for(const n of e)if(!Po.test(n)&&!bl.has(n))return!1;return!0}function Cl(e,n,t){var o,l,r;const i=(null===Ro&&(Ro=new Intl.Segmenter(void 0,{granularity:"word"})),Ro);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 pl(M.segment,null!=(o=M.isWordLike)&&o,M.index,t)){let t=function(){null!==m[M]&&(s[M]=[al(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]=ul(p[M],b)};const o="text"===e.kind,r=il(e.text,e.isWordLike,e.kind),i=Wo(e.text),N=Ko(e.text),b=ll(e.text),S=dl(e.text),x=sl(e.text),M=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[M]&&i&&v[M]&&g[M]||o&&a>0&&"text"===d[M]&&el(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]&&(Qo(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]=ul(N,b),a++)}for(let M=0;M<a;M++)null===m[M]?u[M]=hl(s[M]):u[M]=al(u,m,h,M);for(let M=1;M<a;M++)"text"===d[M]&&!c[M]&&tl(u[M])&&"text"===d[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]&&nl(e)&&b>=0&&"text"===d[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]=vl(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(!Wo(n[r])||!Wo(n[r+1]))continue;const e=rl(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a&&u&&Sl.test(i)){const a=[i];let u=xl.test(i),s=r+1;for(;u&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&Sl.test(e.texts[s]);){const n=e.texts[s];a.push(n),u=xl.test(n),s++}n.push(hl(a)),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(u),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&Ml(n)&&wl(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&&wl(i)&&Ml(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&wl(e.texts[u]);)a.push(e.texts[u]),u++;n.push(hl(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]),!Nl(i))continue;const a=r+1;if(a>=e.len||gl(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!gl(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(hl(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]||!kl(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!gl(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]=hl(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=hl(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=hl(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(hl(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=cl(x.texts[M]);null!==e&&("space"!==x.kinds[M]&&"preserved-space"!==x.kinds[M]||"text"!==x.kinds[M+1]||!Ko(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}function _l(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}let Bl=null;const Ol=/* @__PURE__ */new Map;let Tl=null;const Il=new RegExp("\\p{Emoji_Presentation}","u"),Ll=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Al=null;const Hl=/* @__PURE__ */new Map;function $l(){if(null!==Bl)return Bl;if("undefined"!=typeof OffscreenCanvas)return Bl=new OffscreenCanvas(1,1).getContext("2d"),Bl;if("undefined"!=typeof document)return Bl=document.createElement("canvas").getContext("2d"),Bl;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Rl(e,n){let t=n.get(e);return void 0===t&&(t={width:$l().measureText(e).width,containsCJK:Wo(e)},n.set(e,t)),t}function El(){if(null!==Tl)return Tl;if("undefined"==typeof navigator)return Tl={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Tl;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 Tl={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Tl}function Fl(){return null===Al&&(Al=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Al}function Pl(e){return Il.test(e)||e.includes("️")}function Kl(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=Fl();for(const o of t.segment(e))Pl(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function zl(e,n){for(;n<e.widths.length;){const t=e.kinds[n];if("space"!==t&&"zero-width-break"!==t&&"soft-hyphen"!==t)break;n++}return n}function Wl(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function jl(e,n,t){const{widths:o,kinds:l,breakableFitAdvances:r}=e;if(0===o.length)return 0;const i=n+El().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){const t=r[e];for(let o=n;o<t.length;o++){const n=t[o];s?u+n>i?(h(),p(e,o,n)):(u+=n,c=e,d=o+1):p(e,o,n)}s&&c===e&&d===t.length&&(c=e+1,d=0)}let k=0;for(;k<o.length&&(s||(k=zl(e,k),!(k>=o.length)));){const e=o[k],t=l[k],a="space"===t||"preserved-space"===t||"tab"===t||"zero-width-break"===t||"soft-hyphen"===t;if(s)if(u+e>i){if(a){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>n&&null!==r[k]){h(),y(k,0),k++;continue}h()}else g(k,e),a&&(f=k+1,m=u-e),k++;else e>n&&null!==r[k]?y(k,0):v(k,e),a&&(f=k+1,m=u-e),k++}return s&&h(),a}let Vl=null;function Dl(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=dl(e),a=Uo.has(e)}function c(e,n){o.push(e),r=r||n;const t=dl(e);i=1===e.length&&Zo.has(e)&&i||t,a=!1}for(const d of(null===Vl&&(Vl=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Vl).segment(e)){const e=d.segment,t=Wo(e);0!==o.length?a||qo.has(e)||Zo.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 ql(e){if(e.length<=1)return e;const n=[];let t=[e[0].text],o=e[0].start,l=Wo(e[0].text),r=Do(e[0].text);function i(){n.push({text:1===t.length?t[0]:t.join(""),start:o})}for(let a=1;a<e.length;a++){const n=e[a],u=Wo(n.text),s=Do(n.text);l&&r?(t.push(n.text),l=l||u,r=s):(i(),t=[n.text],o=n.start,l=u,r=s)}return i(),n}function Ul(e,n,t,o){const l=El(),{cache:r,emojiCorrection:i}=function(e,n){$l().font=e;const t=function(e){let n=Ol.get(e);return n||(n=/* @__PURE__ */new Map,Ol.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=Hl.get(e);if(void 0!==t)return t;const o=$l();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 Hl.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,Ll.test(a)));var a;const u=Kl("-",Rl("-",r),i),s=8*Kl(" ",Rl(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const c=[],d=[],f=[],m=[];let h=e.chunks.length<=1;const v=t?[]:null,p=[],g=t?[]:null,y=Array.from({length:e.len});function k(e,n,t,o,l,r,i){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(h=!1),c.push(n),d.push(t),f.push(o),m.push(l),null==v||v.push(r),p.push(i),null!==g&&g.push(e)}function N(e,n,t,o,a){const u=Rl(e,r),s=Kl(e,u,i),c="space"===n||"preserved-space"===n||"zero-width-break"===n?0:s,d="space"===n||"zero-width-break"===n?0:s;if(a&&o&&e.length>1){let o="sum-graphemes";wl(e)?o="pair-context":l.preferPrefixWidthsForBreakableRuns&&(o="segment-prefixes");const a=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances)return n.breakableFitAdvances;const r=Fl(),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=Rl(n,t);e.push(Kl(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=Kl(n,Rl(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Rl(i,t);e.push(Kl(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=Kl(u,Rl(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,u,r,i,o);return void k(e,s,c,d,n,t,a)}k(e,s,c,d,n,t,null)}for(let x=0;x<e.len;x++){y[x]=c.length;const n=e.texts[x],t=e.isWordLike[x],i=e.kinds[x],a=e.starts[x];if("soft-hyphen"===i){k(n,0,u,u,i,a,null);continue}if("hard-break"===i){k(n,0,0,0,i,a,null);continue}if("tab"===i){k(n,0,0,0,i,a,null);continue}const s=Rl(n,r);if("text"===i&&s.containsCJK){const e=Dl(n,l),r="keep-all"===o?ql(e):e;for(let n=0;n<r.length;n++){const e=r[n];N(e.text,"text",a+e.start,t,"keep-all"===o||!Wo(e.text))}continue}N(n,i,a,t,!0)}const b=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,y,c.length),S=null===v?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=Ao(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,v);return null!==g?{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:S,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:b,segments:g}:{widths:c,lineEndFitAdvances:d,lineEndPaintAdvances:f,kinds:m,simpleLineWalkFastPath:h,segLevels:S,breakableFitAdvances:p,discretionaryHyphenWidth:u,tabStopAdvance:s,chunks:b}}function Xl(e,n,t){return function(e,n,t,o){var l;const r=null!=(l=null==o?void 0:o.wordBreak)?l:"normal";return Ul(function(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!$o.test(e))return e;let n=e.replace(Ho," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i="keep-all"===o?function(e){if(e.len<=1)return e;const n=[],t=[],o=[],l=[];let r=null,i=!1,a=0,u=!1,s=!1;function c(){null!==r&&(n.push(hl(r)),t.push(i),o.push("text"),l.push(a),r=null)}for(let d=0;d<e.len;d++){const f=e.texts[d],m=e.kinds[d],h=e.isWordLike[d],v=e.starts[d];if("text"===m){const e=Vo(f),n=Do(f);if(null!==r&&u&&s){r.push(f),i=i||h,u=u||e,s=n;continue}c(),r=[f],i=h,a=v,u=e,s=n;continue}c(),n.push(f),t.push(h),o.push(m),l.push(v)}return c(),{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(Cl(r,n,l)):Cl(r,n,l);return a({normalized:r,chunks:_l(i,l)},i)}(e,El(),null==o?void 0:o.whiteSpace,r),n,!1,r)}(e,n,0,t)}const Zl="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Jl=(()=>{const e=globalThis;if(e[Zl])return e[Zl];const n={configs:{},controllers:{},revision:$(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Zl]=n,n})();let Yl=null;const Gl=Jl.revision;function Ql(e){var n;return e&&null!=(n=Jl.configs[e])?n:null}function er(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function nr(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function tr(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!nr(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 or(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Yl)return Yl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Yl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Yl}catch(n){return Yl=!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=Jl.blockEstimateCache.get(i);if(a)return Jl.blockEstimateCache.delete(i),Jl.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=Jl.preparedCache.get(o);if(l)return Jl.preparedCache.delete(o),Jl.preparedCache.set(o,l),l.prepared;const r=Xl(e,n,{whiteSpace:t});for(Jl.preparedCache.set(o,{prepared:r});Jl.preparedCache.size>240;){const e=Jl.preparedCache.keys().next().value;if(!e)break;Jl.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=function(e,n){return e.simpleLineWalkFastPath?jl(e,n):function(e,n){if(e.simpleLineWalkFastPath)return jl(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableFitAdvances:i,discretionaryHyphenWidth:a,tabStopAdvance:u,chunks:s}=e;if(0===t.length||0===s.length)return 0;const c=El(),d=c.lineFitEpsilon,f=n+d;let m=0,h=0,v=!1,p=0,g=0,y=-1,k=0,N=0,b=null;function S(){y=-1,k=0,N=0,b=null}function x(e=p,n=g,t=h){m++,h=0,v=!1,S()}function M(e,n){v=!0,p=e+1,g=0,h=n}function w(e,n,t){v=!0,p=e,g=n+1,h=t}function C(e,n){v?(h+=n,p=e+1,g=0):M(e,n)}function _(e,n,t,r){if(!n)return;const i="tab"===e?0:o[t],a="tab"===e?r:l[t];y=t+1,k=h-r+i,N=h-r+a,b=e}function B(e,n){const t=i[e];for(let o=n;o<t.length;o++){const n=t[o];v?h+n>f?(x(),w(e,o,n)):(h+=n,p=e,g=o+1):w(e,o,n)}v&&p===e&&g===t.length&&(p=e+1,g=0)}function O(e){if("soft-hyphen"!==b)return!1;const t=i[e];if(null==t)return!1;const{fitCount:o,fittedWidth:l}=function(e,n,t,o,l){let r=0,i=n;for(;r<e.length;){const n=i+e[r];if((r+1<e.length?n+l:n)>t+o)break;i=n,r++}return{fitCount:r,fittedWidth:i}}(t,h,n,d,a);return 0!==o&&(h=l,p=e,g=o,S(),o===t.length?(p=e+1,g=0,!0):(x(e,o,l+a),B(e,o),!0))}function T(e){m++,S()}for(let I=0;I<s.length;I++){const e=s[I];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}v=!1,h=0,e.startSegmentIndex,p=e.startSegmentIndex,g=0,S();let d=e.startSegmentIndex;for(;d<e.endSegmentIndex;){const e=r[d],s="space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e,m="tab"===e?Wl(h,u):t[d];if("soft-hyphen"!==e)if(v){if(h+m>f){const t=h+("tab"===e?0:o[d]),r=h+("tab"===e?m:l[d]);if("soft-hyphen"===b&&c.preferEarlySoftHyphenBreak&&k<=f){x(y,0,N);continue}if("soft-hyphen"===b&&O(d)){d++;continue}if(s&&t<=f){C(d,m),x(d+1,0,r),d++;continue}if(y>=0&&k<=f){if(p>y||p===y&&g>0){x();continue}const e=y;x(e,0,N),d=e;continue}if(m>n&&null!==i[d]){x(),B(d,0),d++;continue}x();continue}C(d,m),_(e,s,d,m),d++}else m>n&&null!==i[d]?B(d,0):M(d,m),_(e,s,d,m),d++;else v&&(p=d+1,g=0,y=d+1,k=h+a,N=h+a,b=e),d++}if(v){const n=y===e.consumedEndSegmentIndex?N:h;x(e.consumedEndSegmentIndex,0,n)}}return m}(e,n)}(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(Jl.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Jl.blockEstimateCache.size>4e3;){const e=Jl.blockEstimateCache.keys().next().value;if(!e)break;Jl.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function lr(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=tr(e.children);return o&&t.paragraph?or(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=tr(e.children),r=t.headings[o];return l&&r?or(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=tr(null==(l=r[0])?void 0:l.children);return i?or(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=lr(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 rr(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function ir(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o;return e.diff?Math.max(rr(String(null!=(n=e.originalCode)?n:"")),rr(String(null!=(t=e.updatedCode)?t:"")),rr(String(null!=(o=e.code)?o:""))):rr(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(21*r+32),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 ar(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function ur(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=er(o.lineHeight,1.5*er(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:ar(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const sr=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function cr(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))sr.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const dr=!1;function fr(){return dr}function mr(e){const n="number"==typeof e?e:Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:null}function hr(e){var n;for(const t of e.split(/\r?\n/)){const e=t.trim();if(!e||e.startsWith("%%"))continue;const o=e.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==o?void 0:o[1])?void 0:n.toLowerCase())||""}return""}function vr(e){const n=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("%%")),t=Math.max(1,n.length),o=hr(e);return"gantt"===o?220+28*t:"sequencediagram"===o?180+26*t:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*t:"flowchart"===o||"graph"===o?170+28*t:200+22*t}function pr(e){const n=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return n>=3?500:n>0?280+60*n:360}function gr(e,n=360,t=500){return null==t?Math.max(n,e):Math.min(Math.max(n,e),t)}function yr(e,n=360,t=500){return gr(e,n,t)}function kr(e,n=360,t=500){return gr(e,n,t)}function Nr(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)}const br=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function Sr(){return R(br,null)}const xr=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Mr=["tokenCloneMs","processTokensMs","parseMarkdownToStructureTotalMs"],wr=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition"]),Cr=["raw","content","code","originalCode","updatedCode"],_r=/* @__PURE__ */new WeakMap,Br=/* @__PURE__ */new WeakMap;let Or=1;function Tr(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ir(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function Lr(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=_r.get(n);return t||(t=Or++,_r.set(n,t)),String(t)}function Ar(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:Lr(n),customMarkdownIt:Lr(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:Lr(e.validateLink),preTransformTokens:Lr(e.preTransformTokens),postTransformTokens:Lr(e.postTransformTokens)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function Hr(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 $r(e){const n=Rr(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function Rr(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function Er(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 Fr(e){const n=String(null!=e?e:"");return`${n.length}:${Er(n)}`}function Pr(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?Fr(e):`${e.length}:${Er(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${Lr(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:${Lr(o)}`;const r=Lr(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>Pr(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}:${Pr(o[e],n,t+1)}`).join(";")}`}return typeof e}function Kr(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function zr(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>Kr(e)?Vr(e,n,t+1):zr(e,n,t+1)).join(",")}`:Kr(e)?Vr(e,n,t):Pr(e,n,t)}function Wr(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!Cr.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${Fr(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${Lr(l)}`:wr.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${zr(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${Lr(l)}`:""}).filter(Boolean).join(";")}function jr(e){return Cr.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${Fr(t)}`:""}).filter(Boolean).join(";")}function Vr(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Br.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}:${Lr(l)}`;const i=Lr(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=>Vr(e,n,t+1)).join("|"):"";return[e.type,jr(o),Wr(o,n,t),l.length,r].join(":")}(e,n,t);return Br.set(l,a),a}function Dr(e,n){return Vr(e)===Vr(n)}function qr(e,n,t){const o=Tr(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Tr()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Ur(e,n,t){return qr(n,t,()=>Vr(e))}function Xr(e,n,t){return Ur(e,t,"stabilizeSignatureMs")===Ur(n,t,"stabilizeSignatureMs")}function Zr(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Jr(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function Yr(e,n){return e.length===n.length&&e===n}function Gr(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(!Yr(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(!Kr(e)||!Kr(n))return null;const o=Gr(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function Qr(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=Gr(e,n);return null!=t?t:Dr(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 qr(t,"stabilizeSignatureMs",()=>{o=Gr(e,n)}),null!=o?o:Xr(e,n,t)}function ni(e,n){const t={};for(const o of xr){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 ti(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=Tr();function k(){s&&(clearTimeout(s),s=void 0)}function N(){k();const e=n.renderContent.value;i.value!==e&&(i.value=e),y=Tr()}Z([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&&(!!$r(Hr(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=Hr(e);if($r(n))return!1;const t=Rr(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?N():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)-(Tr()-y));n<=0?N():s=setTimeout(N,n)}())},{flush:"sync",immediate:!0}),ve(k);const b=E(()=>{var t,o,l,r;return O(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||Fe(t)||L.has(t)||g.has(t)?"":t}).filter(Boolean)))}),S=E(()=>{const{key:e,tags:t}=T(b.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}),x=E(()=>{const n=S.value;return e.customMarkdownIt?e.customMarkdownIt(n):n}),M=E(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=b.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}),w=E(()=>{var e;return new Set((null!=(e=M.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),C=E(()=>Ar(M.value,x.value,e.customMarkdownIt,{includeFinal:!0})),_=E(()=>Ar(M.value,x.value,e.customMarkdownIt,{includeFinal:!1}));Z([C,_],([e,n],[t,o])=>{t&&(e===t&&n===o||(N(),n!==o&&(d=[],h="")))},{flush:"sync"});const A=E(()=>{var t,o,l,r,s,c,g,y;if(null==(t=e.nodes)?void 0:t.length)return d=[],h="",fe(e.nodes.slice());const k=i.value;if(!k)return d=[],h="",[];const N=n.debugPerformanceEnabled.value,b=N?Tr():0,S=x.value,w=C.value,B=_.value;f&&w!==f&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(S),m&&B!==m&&(d=[],h="");const O=d.length>0&&k.startsWith(h)&&B===m,T=N?Ir(S):null,L=N?{}:void 0,A=L?u(a({},M.value),{__timing:L}):M.value,H=I(k,S,A),$=N?Tr():0,R=N?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let E,F=N?Zr(H.length):void 0,P=0,K=0;if(O){const e=N?Tr():0;if(R){const e=function(e,n,t){if(!n.length)return{nodes:e,metrics:Zr(e.length)};const o=function(e,n,t){const o=Math.min(e.length,n.length);for(let l=0;l<o;l++)if(!ei(n[l],e[l],t))return l;return e.length===n.length?-1:o}(e,n,t);if(o<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:o,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const l=e.slice();let r=o;for(let i=0;i<o;i++)l[i]=n[i];for(let i=o;i<e.length;i++){const o=n[i],a=e[i];o&&Xr(o,a,t)&&(l[i]=o,r+=1)}return{nodes:l,metrics:{reusedNodeCount:r,dirtyStartIndex:o,stablePrefixNodeCount:o,dirtyTailNodeCount:Jr(o,e,n)}}}(H,d,R);E=e.nodes,F=e.metrics}else{const e=function(e,n){if(!n.length)return{nodes:e,metrics:Zr(e.length)};const t=function(e,n){const t=Math.min(e.length,n.length);for(let o=0;o<t;o++)if(!Qr(n[o],e[o]))return o;return e.length===n.length?-1:t}(e,n);if(t<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:t,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const o=e.slice();let l=t;for(let r=0;r<t;r++)o[r]=n[r];for(let r=t;r<e.length;r++){const t=n[r],i=e[r];t&&Dr(t,i)&&(o[r]=t,l+=1)}return{nodes:o,metrics:{reusedNodeCount:l,dirtyStartIndex:t,stablePrefixNodeCount:t,dirtyTailNodeCount:Jr(t,e,n)}}}(H,d);E=e.nodes,F=e.metrics}P=N?Tr()-e:0,K=null==(null==F?void 0:F.dirtyStartIndex)||F.dirtyStartIndex<0?E.length:F.dirtyStartIndex}else E=H;R?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)qr(n,"primeSignatureMs",()=>Vr(e[o]))}(E,R,K):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Vr(e[t])}(E,K);const z=N?Tr()-$:0;if(v+=1,h=k,f=w,m=B,d=E,N){const e=Ir(S),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(o=null==T?void 0:T.total)?o:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Tr()-b),nodes:E.length,contentLength:k.length,parseCommitCount:v,parseCoalescedCount:p,nodeReuseMs:z,signatureMs:null!=(l=null==R?void 0:R.signatureMs)?l:0,stabilizeSignatureMs:null!=(r=null==R?void 0:R.stabilizeSignatureMs)?r:0,primeSignatureMs:null!=(s=null==R?void 0:R.primeSignatureMs)?s:0,signatureCallCount:null!=(c=null==R?void 0:R.signatureCallCount)?c:0,stabilizeSignatureCallCount:null!=(g=null==R?void 0:R.stabilizeSignatureCallCount)?g:0,primeSignatureCallCount:null!=(y=null==R?void 0:R.primeSignatureCallCount)?y:0,stabilizeMs:P},null!=F?F:{}),L?Object.fromEntries(Mr.map(e=>{var n;return[e,null!=(n=L[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:ni(e,T),streamStats:e}:{}))}return fe(E)});return{effectiveCustomHtmlTags:b,effectiveCustomHtmlTagsSet:w,mdBase:S,mdInstance:x,mergedParseOptions:M,parsedNodes:A}}function oi(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 li(e={}){const n=X(""),t=X(""),o=X(!1),l=Me(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 pe()&&ve(()=>{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 ri=/auto|scroll|overlay/i;function ii(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return ri.test(n)||ri.test(t)}function ai(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=F({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 kr(null!=(t=mr(e.estimatedPreviewHeightPx))?t:pr(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"})])])])}}),si=F({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 yr(null!=(t=mr(e.estimatedPreviewHeightPx))?t:vr(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"}})])])}}),ci=["data-custom-id"],di={class:"m-0 p-0"},fi=["data-probe"],mi=["data-node-index","data-node-type"],hi=/* @__PURE__ */Ze(/* @__PURE__ */F(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},htmlPolicy:{},viewportPriority:{type:Boolean},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,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=R("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=fr(),f={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,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"}},m=E(()=>{return"chat"===(e=c("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),h=E(()=>{const e=c("renderCodeBlocksAsPre"),n=c("codeRenderer");return!0===e?"pre":"pre"===n||"shiki"===n||"monaco"===n?n:!1===e||"docs"===m.value?"monaco":"pre"}),v=E(()=>f[m.value]),p=E(()=>{var e;return null!=(e=c("showTooltips"))?e:v.value.showTooltips}),g=E(()=>{var e;return null!=(e=c("fade"))?e:v.value.fade}),y=E(()=>{var e;return null!=(e=c("batchRendering"))?e:v.value.batchRendering}),k=E(()=>{var e;return null!=(e=c("initialRenderBatchSize"))?e:v.value.initialRenderBatchSize}),N=E(()=>{var e;return null!=(e=c("renderBatchSize"))?e:v.value.renderBatchSize}),b=E(()=>{var e;return null!=(e=c("renderBatchDelay"))?e:v.value.renderBatchDelay}),S=E(()=>{var e;return null!=(e=c("renderBatchBudgetMs"))?e:v.value.renderBatchBudgetMs}),x=E(()=>{var e;return null!=(e=c("renderBatchIdleTimeoutMs"))?e:v.value.renderBatchIdleTimeoutMs}),M=E(()=>{var e;return null!=(e=c("deferNodesUntilVisible"))?e:v.value.deferNodesUntilVisible}),w=E(()=>{var e;return null!=(e=c("maxLiveNodes"))?e:v.value.maxLiveNodes}),B=E(()=>{var e;return null!=(e=c("liveNodeBuffer"))?e:v.value.liveNodeBuffer}),O=E(()=>{var e;return null!=(e=c("nodeVirtual"))?e:v.value.nodeVirtual}),T={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 htmlPolicy(){return c("htmlPolicy")},get viewportPriority(){return c("viewportPriority")},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 p.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 g.value},get batchRendering(){return y.value},get initialRenderBatchSize(){return k.value},get renderBatchSize(){return N.value},get renderBatchDelay(){return b.value},get renderBatchBudgetMs(){return S.value},get renderBatchIdleTimeoutMs(){return x.value},get deferNodesUntilVisible(){return M.value},get maxLiveNodes(){return w.value},get liveNodeBuffer(){return B.value},get nodeVirtual(){return O.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function I(e){l("height-change",e)}function L(e){l("virtual-state-change",e)}function H(e){l("anchor-change",e)}const $=X(),F=X(null),W=X(null),j=X(null),Y=he({1:null,2:null,3:null,4:null,5:null,6:null}),ne=X(!1),de=/* @__PURE__ */new Map,ve=X(0),pe=X(0),ke=X({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Ne(){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 be("function"==typeof t?t():t)}function be(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?be(e.value):"object"==typeof e&&"$el"in e?be(e.$el):null:null}const{isClient:Se,renderAsFragment:xe,debugPerformanceEnabled:Me,resolvedShowTooltips:Oe,resolvedHtmlPolicy:Te,inheritedSmoothStreaming:Ie,ownsTypewriterCursor:Le}=function(e){const n="undefined"!=typeof window,t=U(),o=R("markstreamHtmlPolicy",void 0),l=R("markstreamTypewriterCursor",void 0),r=R("markstreamSmoothStreaming",void 0),i=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}}(T),{resolveViewportRoot:Ae,resolveScrollContainer:He,isReverseFlexScrollRoot:$e,getNormalizedScrollTop:Re,getOffsetTopWithinRoot:Ee}=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(ii(window.getComputedStyle(a))&&ai(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}}}($,{isClient:Se,scrollRoot:Ne});me("markstreamShowTooltips",Oe),me("markstreamHtmlPolicy",Te),me("markstreamTypewriter",E(()=>!1!==T.typewriter)),me("markstreamFade",E(()=>!1!==T.fade)),me("markstreamTypewriterCursor",E(()=>!0)),me("markstreamTextStreamState",de),me("markstreamStreamVersion",ve),me("markstreamParseOptions",E(()=>T.parseOptions)),me("markstreamCustomMarkdownIt",E(()=>T.customMarkdownIt));const{smoothStreamingEnabled:Pe,renderContent:Ke,effectiveFinal:ze}=function(e,n){const t=li(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||!0===e.typewriter||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=X(!n.isClient||!0===e.smoothStreaming);ge(()=>{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:""}),a=E(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),u=E(()=>{const e=a.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});return Z([()=>e.content,()=>e.nodes,r,a],([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:a,effectiveFinal:u}}(T,{isClient:Se,inheritedSmoothStreaming:Ie});me("markstreamSmoothStreaming",Pe);const We=X(!1);let Ve="",De=!1,qe=null;function Ue(){Se&&null!=qe&&(window.clearTimeout(qe),qe=null)}function Xe(){We.value=!1,Ue()}function Ze(e,n){if(!Me.value)return;const t=function(){if(!Me.value)return null;const e=on(Ye),n=on(Qe),t=Math.max(tn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=Ye,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return Ye.clear(),Qe.clear(),tn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}Z([Ke,()=>o.nodes,ze],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(Xe(),Ve=l,void(De=!0)):De?(Ve&&l.length>Ve.length&&l.startsWith(Ve)?(We.value=!0,Se&&(Ue(),qe=window.setTimeout(()=>{var e;qe=null,!0===ze.value||(null==(e=o.nodes)?void 0:e.length)||(Di(),We.value=!1,Ui())},1200))):(l.length<Ve.length||!l.startsWith(Ve))&&Xe(),void(Ve=l)):(Ve=l,void(De=!0))},{flush:"sync",immediate:!0});const Ye=/* @__PURE__ */new Map,Qe=/* @__PURE__ */new Map;let en=!1,tn=0;function on(e){let n=0;for(const t of e.values())n+=t;return n}function ln(){tn=Math.max(tn,on(Qe)),Qe.clear(),en=!1}function rn(e,n){return function(e){var n,t;Me.value&&(Ye.set(e,(null!=(n=Ye.get(e))?n:0)+1),Qe.set(e,(null!=(t=Qe.get(e))?t:0)+1),en||(en=!0,Se&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(ln):"function"!=typeof queueMicrotask?setTimeout(ln,0):queueMicrotask(ln)))}(e),n()}const an=T.customId?`renderer-${T.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,sn=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(an),cn=E(()=>`${an}:${ve.value}`);me(br,sn);const dn=je(()=>T.customId),{effectiveCustomHtmlTagsSet:fn,mergedParseOptions:mn,parsedNodes:hn}=ti(T,{instanceMsgId:an,renderContent:Ke,effectiveFinal:ze,smoothStreamingEnabled:Pe,debugPerformanceEnabled:Me,customComponentsMap:dn,logPerf:Ze});Z(hn,()=>{sn.clear(),ve.value+=1},{immediate:!0});const pn=E(()=>({customId:T.customId,customHtmlTags:mn.value.customHtmlTags,parseOptions:T.parseOptions,customMarkdownIt:T.customMarkdownIt,htmlPolicy:Te.value,viewportPriority:T.viewportPriority,mode:m.value,codeRenderer:h.value,codeBlockStream:T.codeBlockStream,codeBlockDarkTheme:T.codeBlockDarkTheme,codeBlockLightTheme:T.codeBlockLightTheme,codeBlockMonacoOptions:T.codeBlockMonacoOptions,renderCodeBlocksAsPre:T.renderCodeBlocksAsPre,codeBlockMinWidth:T.codeBlockMinWidth,codeBlockMaxWidth:T.codeBlockMaxWidth,codeBlockProps:T.codeBlockProps,mermaidProps:T.mermaidProps,d2Props:T.d2Props,infographicProps:T.infographicProps,showTooltips:Oe.value,themes:T.themes,langs:T.langs,isDark:T.isDark,typewriter:T.typewriter,smoothStreamingOptions:T.smoothStreamingOptions,parseCoalesceMs:T.parseCoalesceMs,fade:T.fade}));me("markstreamNestedRendererProps",pn);const gn=E(()=>hn.value),kn=E(()=>hn.value.length),Nn=X(null),bn=X(null),Sn=X(null),xn=X(null),Mn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),wn=!Mn&&T.customId?Ql(T.customId):null,Cn=E(()=>wn?(Gl.value,Ql(T.customId)):null),_n=E(()=>{var e;return Boolean(Se&&!xe.value&&T.customId&&!Mn&&(null==(e=Cn.value)?void 0:e.enabled))}),Bn=E(()=>{var e;return Boolean(!xe.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),On=X(!1);ge(()=>{On.value=!0});const Tn=E(()=>Boolean(Se&&Bn.value));me("markstreamHostScrollManaged",Tn);const In=E(()=>Boolean(On.value&&Tn.value)),Ln=E(()=>_n.value||Tn.value),An=E(()=>_n.value||In.value),Hn=E(()=>{var e;return Ln.value&&!1!==(null==(e=Cn.value)?void 0:e.textEstimation)}),$n=E(()=>{var e;return Ln.value&&!1!==(null==(e=Cn.value)?void 0:e.codeBlockEstimation)});function Rn(){const e=pe.value||rn("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=$.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const En=E(()=>{const e=Rn();return e>0?Math.max(1,Math.round(e)):640}),Fn=E(()=>{var e;return Math.max(1,null!=(e=T.maxLiveNodes)?e:320)}),Pn=E(()=>{var e;return!xe.value&&!1!==T.nodeVirtual&&!((null!=(e=T.maxLiveNodes)?e:0)<=0)&&(!0===T.nodeVirtual?hn.value.length>0:hn.value.length>Fn.value)}),Kn=E(()=>Pn.value||_n.value||Tn.value),zn=E(()=>!1!==T.viewportPriority&&!ne.value),Wn=uo(e=>{var n;return Ae(null!=(n=null!=e?e:$.value)?n:null)},zn),{requestFrame:jn,cancelFrame:Vn,hasIdleCallback:Dn,isTestEnv:qn}=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:Se}),{resolvedBatchSize:Un,resolvedInitialBatch:Zn,batchingEnabled:Jn,incrementalRenderingActive:Yn,renderedCount:Gn,previousRenderContext:Qn,adaptiveBatchSize:et,previousBatchConfig:nt}=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 n;return r.value&&(null!=(n=e.maxLiveNodes)?n: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}}(T,{isClient:Se,isTestEnv:qn,renderAsFragment:xe}),tt=/* @__PURE__ */new Map,ot=/* @__PURE__ */new Map,rt=/* @__PURE__ */new WeakMap;let it=null;const at=/* @__PURE__ */new WeakMap,ht=/* @__PURE__ */new Map,pt=X(0),yt=E(()=>(pt.value,Array.from(tt.entries()).sort((e,n)=>e[0]-n[0]))),Nt=X(null),St=X(null);let xt=null,Mt=0,wt=null;const{activeRestoreAnchor:_t,getRelativeScrollTopWithinContainer:Ot,setRelativeScrollTopWithinContainer:It,resolveAnchorOffset:At,clearRestoreReconcile:$t,scheduleRestoreReconcile:Rt,captureRestoreAnchor:Et,restoreAnchor:Ft,getAnchorDrift:Pt}=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)))}Nr(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:Se,containerRef:$,parsedNodeCount:kn,requestFrame:jn,cancelFrame:Vn,resolveScrollContainer:()=>Nt.value||He(),getNormalizedScrollTop:Re,getOffsetTopWithinRoot:Ee,isReverseFlexScrollRoot:$e,estimateIndexForOffset:Pi,estimateHeightRange:Ml,getFallbackNodeHeight:kl,clamp:sl}),{nodeHeights:Kt,heightStats:zt,heightTreeSize:jt,heightSumTree:Vt,heightKnownTree:Dt,averageNodeHeight:Ut,resetHeightMeasurements:Zt,pruneHeightMeasurements:Jt,rebuildHeightTrees:Gt,recordNodeHeight:Qt,removeNodeHeights:no,exportHeightCache:to,importHeightCache:oo,fenwickRangeSum:lo}=function(e={}){const n=he({}),t=he({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:()=>{Vo(),Tn.value&&ea(),_t.value&&Rt(),St.value&&Fr(),Fi("node-resize")}});function ao(){Zt(),ht.clear()}function so(e){!Number.isInteger(e)||e<0||e>=hn.value.length||ht.set(e,Ir(e))}function co(e,n,t={}){const o=Kt[e];Qt(e,n,t);const l=Kt[e];l&&l>0?so(e):o&&ht.delete(e)}function fo(e,n){const t=rn("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=tt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:rn("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function mo(e,n={}){oo(e,n),ri()}const vo=E(()=>{var e;return!xe.value&&!1!==T.deferNodesUntilVisible&&!((null!=(e=T.maxLiveNodes)?e:0)<=0)&&!Pn.value&&!(hn.value.length>900)&&zn.value}),po=E(()=>!!Wn&&(vo.value||Pn.value)),yo=E(()=>Pn.value||Tn.value),{liveNodeBufferResolved:ko,focusIndex:No,liveRange:bo,updateLiveRange:So}=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=he({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)}}}(T,{parsedNodeCount:kn,virtualizationEnabled:Pn,maxLiveNodesResolved:Fn,clamp:sl}),xo=/* @__PURE__ */new Map,Mo=/* @__PURE__ */new Map,Co=/* @__PURE__ */new Map,Bo=[],Io=/* @__PURE__ */new Map,Lo=/* @__PURE__ */new Set,Ao=X(0);let Ho=!1;const $o=E(()=>(Ao.value,Lo.size)),Ro=/* @__PURE__ */new Map,Eo=/* @__PURE__ */new Map,Fo=X(0),Po=E(()=>{Fo.value;let e=0;for(const n of Ro.values())e+=Math.max(0,n);return e});let Ko=null,zo=!0,Wo=[0],jo="";function Vo(){zo=!0}const Do=E(()=>{if(!Pn.value)return hn.value.length;const e=ko.value,n=Math.max(bo.end+e,Zn.value),t=Math.min(hn.value.length,n);return Math.max(Gn.value,t)});function qo(){Ho||(Ho=!0,queueMicrotask(()=>{Ho=!1,Ao.value+=1}))}function Uo(e,n,t="node-resize"){if(!Se||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Lo.delete(o)&&qo();try{n()}finally{Fi(t)}},Math.max(0,e));return Lo.add(o),qo(),o}function Xo(e){Se&&null!=e&&(Lo.delete(e)&&qo(),window.clearTimeout(e))}function Zo(){if(Se&&"undefined"!=typeof window)for(const e of Lo)window.clearTimeout(e);Lo.size&&(Lo.clear(),qo()),Bo.length=0,Co.clear()}function Jo(e){var n,t;return null!=(t=null==(n=xn.value)?void 0:n[e])?t:null}const{cancelScheduledFocusSync:Yo,scheduleFocusSync:Go}=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:Se,containerRef:$,virtualizationEnabled:Pn,requestFrame:jn,cancelFrame:Vn,syncFocusToScroll:function(e=!1){var n;if(!Pn.value)return;const t=Nt.value||He();if(!t)return;const o=t.ownerDocument||(null==(n=$.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(!r&&i>0&&$e(t)){const n=rn("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=rn("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o,r=function(e){var n,t;const o=hn.value;if(!o.length)return 0;if(e<=0)return Math.max(0,o.length-1);if(Ln.value){const t=null!=(n=Sl()[o.length])?n:0;return xl(Math.max(0,t-e))}if(jt.value===o.length){const n=Ml(0,o.length);return Pi(Math.max(0,n-e))}let l=e;for(let r=o.length-1;r>=0;r--){const e=null!=(t=Kt[r])?t:Ut.value;if(l<=e)return r;l-=e}return 0}(Math.max(0,l)+.5*Math.max(0,n)),a=sl(r,0,Math.max(0,i-1));return void((e||Math.abs(a-No.value)>1)&&(No.value=a,So()))}const a=r?null:rn("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),u=r?0:a.top,s=r?rn("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):a.bottom,c=yt.value;let d=null,f=null;for(const[h,v]of c){if(!v)continue;const e=rn("syncFocusToScroll.slot.getBoundingClientRect",()=>v.getBoundingClientRect());e.bottom<=u||e.top>=s||(null==d&&(d=h),f=h)}if(null==d||null==f){const e=$.value;if(!e)return;const n=r?{top:0}:rn("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=rn("syncFocusToScroll.fallback.scrollTop",()=>Re(t,o,r)),a=r?(()=>{const t=rn("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Ee(e,t);return Math.max(0,i-n)})(),u=r?rn("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}):rn("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight),s=Pi(a+.5*Math.max(0,u));return No.value=sl(s,0,Math.max(0,hn.value.length-1)),void So()}const m=Math.round((d+f)/2);!e&&Math.abs(m-No.value)<=1||(No.value=sl(m,0,Math.max(0,hn.value.length-1)),So())}}),{visibleNodeIndices:Qo,nodeVisibilityHandles:el,nodeVisibilityWatchStops:nl,nodeVisibilityFallbackTimers:tl,clearVisibilityFallback:ol,markNodeVisible:ll,cleanupNodeVisibility:rl,destroyNodeVisibilityState:il}=oi({isClient:Se,shouldTrackVisibleNodeIndices:()=>vo.value,shouldCleanupNodeVisibility:()=>Pn.value,onNodeMarkedVisible:e=>{Pn.value?Go():No.value=sl(e,0,Math.max(0,hn.value.length-1))},onNodeVisibilityCleaned:e=>{tt.delete(e)&&Ki()}}),{cleanupScrollListener:al,setupScrollListener:ul}=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:Se,virtualizationEnabled:Pn,listenerEnabled:yo,scrollRootElement:Nt,resolveScrollContainer:He,scheduleFocusSync:Go,onScroll:function(){const e=St.value;if(!e)return;const n=gr();if(!n)return;if(function(e){if(_i()>=Mt)return wt=null,!1;const n=wt;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(wt=null),t}(n))return;const t=xr(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Er("restore"):Er("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=$.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return rn("scrollListener.getScrollTop",()=>Re(e,t,o))}});function sl(e,n,t){return Math.min(Math.max(e,n),t)}function cl(e){return null==e?void 0:e.firstElementChild}function dl(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function fl(){if(!Ln.value)return void(pe.value=0);const e=rn("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=$.value)?void 0:e.clientWidth)?n:0});pe.value=e>0?e:0}let ml=null;function hl(){null==ml||ml.disconnect(),ml=null}const vl=re({loader:()=>s(null,null,function*(){return(yield import("./index8.js")).default}),loadingComponent:st,delay:0,suspensible:!1});function pl(e){return e===vl}const gl=E(()=>"pre"===h.value?lt:"shiki"===h.value?vl:ct),yl=E(()=>{const e=hn.value;if(!e.length||!Ln.value)return e.map(()=>null);const n=pe.value||rn("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=$.value)?void 0:e.clientWidth)||0});return!Number.isFinite(n)||n<=0?e.map(()=>null):e.map((e,t)=>{const o=Kt[t],l="number"==typeof o&&o>0;if(Hn.value&&!l){const t=lr(e,n,ke.value);if(t)return t}if($n.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=La(e,_a(e));return pl(n)?"markdown":n===lt?"pre":n===gl.value||n===ct?"monaco":null}(e);if("monaco"===n||"markdown"===n||"pre"===n)return ir(e,{rendererKind:n,monacoOptions:T.codeBlockMonacoOptions,showHeader:!1!==(null==(r=T.codeBlockProps)?void 0:r.showHeader)})}var r;return null})});function kl(e){var n;const t=Kt[e];if(Number.isFinite(t)&&t>0)return t;const o=null==(n=yl.value[e])?void 0:n.height;return Number.isFinite(o)&&o>0?o:Math.max(Ut.value,function(e){var n,t,o,l,r,i,a,u,s,c,d,f,m;const h=hn.value[e];if(!h||"object"!=typeof h)return 32;const v=String(null!=(n=h.type)?n:""),p=Rn()||640;switch(v){case"heading":return 44;case"paragraph":return Nl(String(null!=(o=null!=(t=h.raw)?t:h.content)?o:""),p,34);case"list":{const e=Array.isArray(h.items)?h.items.length:1;return Math.max(48,30*e+12)}case"list_item":return Nl(String(null!=(r=null!=(l=h.raw)?l:h.content)?r:""),p,34);case"blockquote":return Nl(String(null!=(a=null!=(i=h.raw)?i:h.content)?a:""),p,56);case"table":{const e=Array.isArray(h.rows)?h.rows.length:Array.isArray(h.children)?h.children.length:3;return Math.max(120,38*e+48)}case"code_block":return Nl(String(null!=(s=null!=(u=h.code)?u:h.raw)?s:""),p,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return Nl(String(null!=(d=null!=(c=h.raw)?c:h.content)?d:""),p,96);case"thematic_break":return 24;default:return Nl(String(null!=(m=null!=(f=h.raw)?f:h.content)?m:""),p,40)}}(e))}function Nl(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 bl(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Sl(){var e,n;const t=hn.value.length,l=bl(pe.value||rn("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=$.value)?void 0:e.clientWidth)||0})),r=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey),i=[t,zt.count,Math.round(zt.total),Math.round(100*Ut.value),r,l,Ln.value?1:0,Gl.value,ve.value].join(":");if(!zo&&jo===i)return Wo;const a=new Array(t+1);a[0]=0;for(let o=0;o<t;o++)a[o+1]=a[o]+(Ln.value?kl(o):null!=(n=Kt[o])?n:Ut.value);return Wo=a,jo=i,zo=!1,a}function xl(e){var n,t;const o=hn.value.length;if(o<=0)return 0;if(e<=0)return 0;const l=Sl();if(e>=(null!=(n=l[o])?n:0))return o-1;let r=0,i=o-1,a=o-1;for(;r<=i;){const n=r+i>>1;(null!=(t=l[n+1])?t:0)>=e?(a=n,i=n-1):r=n+1}return a}function Ml(e,n){var t,o;if(e>=n)return 0;if(Ln.value)return function(e,n){var t,o;const l=hn.value.length,r=sl(Math.trunc(e),0,l),i=sl(Math.trunc(n),r,l);if(r>=i)return 0;const a=Sl();return(null!=(t=a[i])?t:0)-(null!=(o=a[r])?o:0)}(e,n);if(jt.value!==hn.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Kt[l])?t:Ut.value;return o}const l=Vt.value,r=Dt.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Kt[l])?o:Ut.value;return t}return lo(l,e,n)+(n-e-lo(r,e,n))*Ut.value}Z(()=>hn.value.length,e=>{Vo(),e<=0?ao():(e<jt.value&&Jt(e),e!==jt.value&&Gt(e))},{immediate:!0});const wl=E(()=>{if(!Pn.value)return hn.value.map((e,n)=>({node:e,index:n}));const e=hn.value.length,n=sl(bo.start,0,e),t=sl(bo.end,n,e);return hn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Cl=E(()=>Pn.value?Ml(0,Math.min(bo.start,hn.value.length)):0),_l=E(()=>{if(!Pn.value)return 0;const e=hn.value.length;return Ml(Math.min(bo.end,e),e)});function Bl(){if(!Ln.value)return 0;let e=0;const n=yl.value;for(let t=0;t<n.length;t++){if(!n[t])continue;const o=Kt[t];Number.isFinite(o)&&o>0||e++}return e}function Ol(){const e=hn.value.length;return{totalNodes:e,measuredCount:zt.count,estimatedCount:Bl(),averageNodeHeight:Ut.value,topSpacerHeight:Cl.value,bottomSpacerHeight:_l.value,estimatedTotalHeight:Ml(0,e),width:Pl()}}function Tl(){const e=hn.value,n=Ol();return u(a({},n),{probe:{paragraphReady:Boolean(ke.value.paragraph),listItemReady:Boolean(ke.value.listItem),listWrapperOverhead:ke.value.listWrapperOverhead,headingReadyLevels:Object.entries(ke.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=yl.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=yl.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=yl.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=yl.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Kt[n])?c:null}})})}function Il(){return null!=o.indexKey?String(o.indexKey):Bn.value?`virtual-${Al()}`:"markdown-renderer"}function Ll(e){const n=String(e),t=`${Il()}-`;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 Al(){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:T.customId)?t:an)}function Hl(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}function $l(e){var n;return(null!=e?e:"")===(null!=(n=Hl())?n:"")}function Rl(){var e;const n=null==(e=o.virtualScroll)?void 0:e.measurementKey;return null==n?"":String(n)}function El(){var e,n;const t=h.value,o="monaco"===t?T.codeBlockMonacoOptions:void 0,l=T.codeBlockProps,r="shiki"===t;return[T.isDark?"dark":"light","monaco"===t?"code-rich":"pre"===t?"code-pre":"code-shiki",!1===T.codeBlockStream?"code-static":"code-stream",Oi(T.codeBlockMinWidth),Oi(T.codeBlockMaxWidth),...r?[Ce(null!=(e=null==l?void 0:l.themes)?e:T.themes,null!=(n=null==l?void 0:l.langs)?n:T.langs)]:[],Oi(null==o?void 0:o.fontSize),Oi(null==o?void 0:o.lineHeight),Oi(null==o?void 0:o.fontFamily),Oi(null==o?void 0:o.tabSize),Oi(null==o?void 0:o.MAX_HEIGHT),Oi(null==o?void 0:o.wordWrap),Oi(null==o?void 0:o.wrappingIndent),Oi(null==o?void 0:o.padding),Oi(null==l?void 0:l.showHeader),Oi(null==l?void 0:l.showCopyButton),Oi(null==l?void 0:l.showExpandButton),Oi(null==l?void 0:l.showPreviewButton),Oi(null==l?void 0:l.showCollapseButton),Oi(null==l?void 0:l.showFontSizeButtons)].join("\0")}function Fl(){return[Rl(),El()].join("\0")}function Pl(){return Rn()}const Kl=E(()=>bl(Pl())),zl=E(()=>[Fl(),Kl.value].join("\0")),Wl=E(()=>{var e;return Bn.value?["virtual",null!=(e=Hl())?e:"",Al(),zl.value].join("\0"):o.indexKey});function jl(){Fo.value+=1}function Vl(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=hn.value.length||e.sessionKey!==Al()||e.threadKey!==Hl()||e.layoutEpochKey!==zl.value)}function Dl(e){const n=String(e),t=Eo.get(n);return t?Vl(t)?t.index:null:Ll(n)}function ql(e="async-node"){(Ro.size||Eo.size)&&(Ro.clear(),Eo.clear(),jl(),Fi(e))}const Ul=R(_e,null),Xl={reportHeight(e,n){if(!Tn.value)return;const t=Dl(e);if(null==t)return;const o=xo.get(t);if(!o)return;const l=Number(n),r=fo(t,o);co(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!Tn.value)return;const n=Ll(e);null!=n&&function(e,n){var t;const o=Eo.get(e);if(o&&Vl(o))return Ro.set(e,Math.max(0,null!=(t=Ro.get(e))?t:0)+1),jl(),void Fi("async-node");Ro.set(e,1),Eo.set(e,function(e){return{index:e,sessionKey:Al(),threadKey:Hl(),layoutEpochKey:zl.value}}(n)),jl(),Fi("async-node")}(String(e),n)},markSettled(e){if(!Tn.value)return;const n=String(e),t=Dl(e);(null!=t||function(e){return Ro.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Ro.get(e))?n:0;return!(t<=0||(t<=1?(Ro.delete(e),Eo.delete(e)):Ro.set(e,t-1),jl(),1===t&&Fi("async-node"),0))}(n)&&null!=t&&Ui()}};function Zl(){let e=0;for(const n of xo.values())e+=rn("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}me(_e,{reportHeight(e,n){Xl.reportHeight(e,n),null==Ul||Ul.reportHeight(e,n)},markPending(e){Xl.markPending(e),null==Ul||Ul.markPending(e)},markSettled(e){Xl.markSettled(e),null==Ul||Ul.markSettled(e)}});let Yl,er=null,nr=null;function tr(e){return!1!==e&&null!=e&&""!==e}function or(){return Pn.value?function(){if(!Pn.value)return!0;const e=hn.value.length,n=sl(bo.start,0,e),t=sl(bo.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!tt.has(o))return!1;if(zi(o)&&!xo.has(o))return!1}return!0}():Gn.value>=Do.value}function rr(){return!0===ze.value&&!We.value&&0===Po.value&&0===Lo.size&&0===Io.size&&null==Ko&&or()}function ar(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(er===Al()&&Yl===Hl())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!tr(t)&&nr===oa(t)}function sr(){return rr()&&ar()}function dr(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 hr(e="manual",n){const t=Ol(),o=function(e){return e||(!0!==ze.value?hn.value.length>0?"streaming":"estimating":!or()||Io.size>0||null!=Ko?"measuring":sr()?"settled":"settling")}(n);return{sessionKey:Al(),threadKey:Hl(),phase:o,nodeCount:t.totalNodes,liveRange:{start:bo.start,end:bo.end},renderedCount:Gn.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:Zl(),totalHeight:Sr(),width:t.width,final:!0===ze.value,stable:sr(),confidence:dr(o,t),reason:e}}function gr(){const e=Nt.value||He(),n=$.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=rn("getScrollBox.scrollTop",()=>Re(e,t,o)),r=rn("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=rn("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 Sr(){const e=hn.value.length,n=Math.max(0,Ml(0,e)),t=rn("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=$.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:rn("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=$.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):Pn.value?n>0?Math.max(1,Math.ceil(n),function(){let e=Cl.value+_l.value;for(const n of tt.values())n&&(e+=Math.max(0,rn("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)):Tn.value?n>0||zt.count>0||Bl()>0?(Yn.value&&Gn.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function xr(e){const n=$.value;if(!n)return null;const t=rn("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:rn("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function Mr(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=gr(),t=$.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=rn("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=rn("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=gr(),n=$.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=xr(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=Et();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:sl(No.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function wr(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 Cr(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 _r=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Br(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}:${wr(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(Br(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=Br(e[a],n,t+1);i=Cr(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||_r.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${Br(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let Or=-1,Tr="";function Ir(e){const n=hn.value[e];return n?wr(Br(n)):""}function Lr(){const e=ve.value;if(Or===e)return Tr;let n=2166136261;for(let t=0;t<hn.value.length;t++){const e=Ir(t);for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)}return Tr=(n>>>0).toString(36),Or=e,Tr}function Ar(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=sl(bo.start-2*ko.value,0,r),a=sl(bo.end+2*ko.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)}(to().map(e=>{var n;const t=hn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Ir(e.index)}):null}).filter(e=>Boolean(e))):[],s=Mr({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?Lr():void 0,measurementKey:Fl()||void 0,heightCache:i.length?i:void 0}):null}function Hr(e){var n,t;const o=gr();if(!o)return;const l=function(e){const n=$.value;if(!n)return null;const t=Ee(n,e.root),o=hn.value.length,l=rn("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?rn("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=Sr();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){Mt=_i()+120,wt=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):Nr(o.root,o.doc,i,{isReverseFlexScrollRoot:$e,getNormalizedScrollTop:Re})}const $r=[];function Rr(){if(Se)for(null!=xt&&(null==Vn||Vn(xt),xt=null);$r.length;){const e=$r.pop();null!=e&&window.clearTimeout(e)}}function Er(e){const n=Boolean(St.value);St.value=null,Mt=0,wt=null,Rr(),n&&e&&Fi(e)}function Fr(){if(!St.value||!Se)return;if(null!=xt)return;const e=()=>{xt=null;const e=St.value;e&&Hr(e)};xt=jn?jn(e):null,null==xt&&e()}function Pr(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!==Ir(e.index))}(e))}function Kr(e){const n=bl(Pl()),t=bl(e);return-1!==n&&-1!==t&&n===t}function zr(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 Wr(e){var n;return e.sessionKey===Al()&&!!$l(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Fl()&&!!Kr(zr(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(jr(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function jr(e){return Boolean(e.contentHash&&e.contentHash===Lr())}function Vr(e){return!jr(e)}let Dr=null,qr=null,Ur=null,Xr=null,Zr=null,Jr=!1;function Yr(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=bl(Pl());return[null!=(n=Hl())?n:"",Al(),Fl(),hn.value.length,o,e.length,wr(t)].join(":")}function Gr(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!Tn.value||!(null==e?void 0:e.length))return!1;if(hn.value.length<=0)return!1;if(!Kr(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Pr(e,{requireSignature:!0});if(!t.length)return!Jr&&"undefined"!=typeof console&&d&&(Jr=!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=Yr(t);return l===Dr?(qr="standalone",!0):(mo(t,{mode:"merge"}),Vo(),Dr=l,qr="standalone",Li(),Fi("restore"),!0)}function Qr(e,n={}){var t,o,l;if(!Tn.value||!e)return!1;if(e.sessionKey!==Al())return!1;if(!$l(e.threadKey))return!1;if(hn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!ei(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!ei()&&Number(zr(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&Wr(e)){const n=Pr(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Vr(e)});n.length&&(mo(n,{mode:"merge"}),Vo(),Dr=Yr(n),qr="restore",Li(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Fi("restore"),!0;if(!i)return u&&Fi("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=Hl())?t:"",Al(),Fl(),Kl.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return Ur===s?(u&&Fi("restore"),!0):(Ur=s,function(e){const n=()=>{if("node"===e.type)return Er(),void Ft({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if($t(),_t.value=null,St.value=e,Rr(),Hr(e),Se)for(const e of[0,120,280,480])$r.push(window.setTimeout(()=>{const e=St.value;e&&Hr(e)},e))};!function(e){if(!Pn.value)return!1;const n=hn.value.length;return!(n<=0||(No.value="node"===e.type?sl(e.nodeIndex,0,n-1):n-1,So(),0))}(e)?n():le(n)}(i),Fi("restore"),!0)}function ei(){const e=Pl();return Number.isFinite(e)&&e>0}function ni(e){var n;return e.sessionKey===Al()&&!!$l(e.threadKey)&&(hn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||ei())||!(!(e.anchor&&Number(zr(e))>0)||ei()))}function ri(){ht.clear();for(const e of Object.keys(Kt)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<hn.value.length&&so(n)}}function hi(){null!=Ko&&(null==Vn||Vn(Ko),Ko=null),Vi()}function vi(){return!Se||qn?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(jn)return jn(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function pi(e,n=Hl(),t=zl.value){return Al()===e&&Hl()===n&&zl.value===t}function gi(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Al(),c=Hl(),d=zl.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=hr(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>pi(s,c,d)&&(null==v||Ti()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield vi(),!k())return y();Ui(),hi()}if(yield function(e){return!Se||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&Zo(),Ui(),hi(),!k())return y();const N=rr();N&&(er=s,Yl=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&tr(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Ti()===v&&(nr=oa(o.virtualScroll.settledToken)));const b=k()&&N&&ar(),S=hr(h,b?"final":void 0);return $i(S,!0),S})}let yi="content",ki=null,Ni=null,bi=0,Si=null,xi=null,wi=null,Ci=null;function _i(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Bi(e){var n,t;const l=Si;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 Oi(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)}}function Ti(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Oi(e)}function Ii(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Fl(),Lr(),Oi(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function Li(){wi=null,Ci=null,xi=null}function Ai(e){const n=e.heightCache;return(null==n?void 0:n.length)?Yr(n):""}function Hi(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:Fl(),null!=(o=e.contentHash)?o:"",Ai(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 $i(e,n=!1){if(!Tn.value)return;if(function(e=!1){return!e&&Bn.value&&!In.value}(n))return;const t=n||Bi(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Ar(e,{includeHeightCache:!0})}:{state:Ar(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||Hi(e)!==xi}(r,n)));if(t&&(I(e),Si=e,bi=_i()),r&&i&&(L(r),r.anchor&&H(r.anchor),xi=Hi(r)),e.stable){const n=Ii("settled",e);if(n!==wi){wi=n;const t=Ar(e,{includeHeightCache:!0});t&&(L(t),xi=Hi(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Ii("final",e);if(n!==Ci){Ci=n;const t=Ar(e,{includeHeightCache:!0});t&&(L(t),xi=Hi(t)),function(e){l("render-final",e)}(e)}}}function Ri(){null!=ki&&(null==Vn||Vn(ki),ki=null),null!=Ni&&Se&&(window.clearTimeout(Ni),Ni=null)}function Ei(){ki=null,Ni=null,function(e){if(Io.size>0||null!=Ko)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(yi)&&(Ui(),hi()),$i(hr(yi))}function Fi(e){var n,t;if(!Tn.value)return;if(yi=e,null!=ki||null!=Ni)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(_i()-bi)),i=()=>{Ni=null,ki=jn?jn(Ei):null,null==ki&&Ei()};Se&&r>0?Ni=window.setTimeout(i,r):i()}function Pi(e){var n;if(e<=0)return 0;const t=hn.value;if(Ln.value)return xl(e);if(jt.value===t.length&&Vt.value.length&&Dt.value.length){const n=Ut.value,o=Vt.value,l=Dt.value,r=e=>e<=0?0:lo(o,0,e)+(e-lo(l,0,e))*n;let i=0,a=t.length-1,u=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(u=n,a=n-1):i=n+1}return u}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Kt[l])?n:Ut.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Ki(){pt.value+=1}function zi(e){return!(Yn.value&&e>=Gn.value)&&(!vo.value||e<Zn.value||Qo.value.has(e))}function Wi(e){const n=nl.get(e);n&&(n(),nl.delete(e));const t=el.get(e);t&&(t.destroy(),el.delete(e)),ol(e)}function ji(e,n){let t=!1;if(n){const o=tt.get(e);tt.set(e,n),o!==n&&(t=!0)}else tt.delete(e)&&(t=!0);if(t&&Ki(),n||ol(e),!po.value||!Wn)return Wi(e),void(n&&ll(e,!0));if(!Pn.value&&vo.value&&!ne.value&&el.size>=640&&(ne.value||(ne.value=!0,d&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),il()),!po.value||!Wn))return Wi(e),void(n&&ll(e,!0));if(e<Zn.value&&!Pn.value)return Wi(e),void ll(e,!0);if(Qo.value.has(e))return Wi(e),void ll(e,!0);if(!n)return void Wi(e);Wi(e);const o=Wn(n,{rootMargin:"400px"});if(!o)return;el.set(e,o),ll(e,o.isVisible.value),vo.value&&function(e){if(!Se||!vo.value)return;ol(e);const n=e%17*23,t=window.setTimeout(()=>{if(tl.delete(e),!vo.value)return;if(Qo.value.has(e))return;const n=tt.get(e);if(!n)return;const t=He(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?rn("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?rn("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=rn("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&ll(e,!0)},1800+n);tl.set(e,t)}(e);let l=null;l=Z(()=>o.isVisible.value,n=>{if(n){ol(e),ll(e,!0),null==l||l(),nl.delete(e),el.get(e)===o&&el.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),nl.set(e,l),Pn.value&&Go()}function Vi(){Ko=null;for(const[e,n]of Io)Io.delete(e),xo.get(e)===n.el&&Mo.get(e)===n.version&&co(e,n.height,{allowShrink:n.allowShrink})}function Di(){null!=Ko&&(null==Vn||Vn(Ko),Ko=null),Io.clear()}function qi(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(xo.get(e)!==n)return;const r=Mo.get(e);if(null==r)return;const i=hn.value[e],a=We.value&&!0!==ze.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=hn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Io.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Io.set(e,{height:d,allowShrink:c,version:r,el:n}),null==Ko&&(Ko=jn?jn(Vi):null,null==Ko&&Vi())}(e,n,fo(e,n))}function Ui(){for(const[e,n]of xo)n&&qi(e,n)}function Xi(){null==it||it.disconnect(),it=null,ot.clear()}function Zi(){for(;Bo.length;)Xo(Bo.pop())}Z(In,e=>{e&&Fi("content")},{flush:"post"}),n({getVirtualMetrics:hr,captureVirtualState:function(e={}){var n;return Ar(hr("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);Xr=e,Zr={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!Qr(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&ni(e)||(Xr=null,Zr=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield vi(),Ui(),hi(),yield le();const n=hr(e);return $i(n,!0),n})},settle:gi,scrollToNode:function(e,n="start"){Er(),$t();const t=hn.value.length;if(t<=0)return;const o=sl(e,0,t-1),l=()=>{var e;const t=At({nodeIndex:o,offsetWithinNodePx:0}),l=kl(o),r=gr(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Ot();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}It(Math.max(0,u)),Go({immediate:!0}),Pn.value&&(No.value=o,So())};if(Pn.value)return No.value=o,So(),void le(l);l()}}),Z(()=>Kn.value,e=>{if(!e){Xi();for(const e of Co.values())for(const n of e)Xo(n);Co.clear(),Mo.clear(),Zi(),Di()}},{immediate:!0}),Z(ze,e=>{e&&function(){if(Se&&ze.value&&xo.size){Zi();for(const e of[80,240,640]){const n=Uo(e,()=>{for(const[e,n]of xo)n&&qi(e,n)},"final");null!=n&&Bo.push(n)}}}(),Fi(e?"final":"content")}),Z([()=>hn.value.length,()=>Gn.value],()=>{St.value&&Fr(),Fi("content")},{flush:"post",immediate:!0}),Z([()=>bo.start,()=>bo.end],()=>{Fi("batch")},{flush:"post"});const{cleanupBatchScheduler:Ji}=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,O=!1;const T=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function L(){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 T)null==g||g(e);T.clear();for(const e of I)window.clearTimeout(e);I.clear(),M=!1,w=null,B=!1,O=!1}}function A(){return"undefined"!=typeof performance?performance.now():Date.now()}function H(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=O||f.value<i.value;O=!1,t&&E()}function $(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=A();let o=0;S=null,x=null,C=null,M=!1;const l=null!=w?w:c;w=null;const r=A();f.value=Math.min(u,f.value+l),k(f.value),o=A()-r,function(e,o){if(!t)return void H(o);B=!0;const l=++_;le().then(()=>{var t;if(l!==_)return;const r=A(),i=Math.max(o,r-e),a=()=>{l===_&&H(i)};if(p){let e=!1,o=null;const l=()=>{e||(e=!0,a())},r=p(()=>{T.delete(r),null!=o&&(window.clearTimeout(o),I.delete(o),o=null),l()});return T.add(r),o=window.setTimeout(()=>{null!=o&&I.delete(o),o=null,null==g||g(r),T.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 R(e,n={}){B?O=!0:null==e?E():$(e,n)}function E(){s.value&&$(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return Z([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)&&L(),(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?R(_,{immediate:!t}):k(f.value)},{immediate:!0}),Z(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&R())}),{cleanupBatchScheduler:L}}({props:T,isClient:Se,isTestEnv:qn,parsedNodesIdentity:gn,parsedNodeCount:kn,desiredRenderedCount:Do,datasetKey:Wl,batchingEnabled:Jn,incrementalRenderingActive:Yn,resolvedBatchSize:Un,resolvedInitialBatch:Zn,renderedCount:Gn,adaptiveBatchSize:et,previousRenderContext:Qn,previousBatchConfig:nt,requestFrame:jn,cancelFrame:Vn,hasIdleCallback:Dn,cleanupNodeVisibility:rl,onDatasetKeyChanged:e=>{Di(),ao(),Vo(),Li(),e>0&&Gt(e)},onDatasetChanged:()=>{Pn.value&&Go({immediate:!0})}});Z([yo,Pn,()=>$.value,()=>Ne()],([e,n])=>{if(!e)return al(),void Yo();ul(),n?Go({immediate:!0}):Yo()},{flush:"post",immediate:!0}),Z([()=>hn.value.length,()=>Pn.value],e=>s(null,[e],function*([e,n]){n&&e&&Se&&(yield le(),Go({immediate:!0}))}),{flush:"post"}),Z(Ln,e=>{e&&function(){var e;if(Nn.value&&bn.value&&Sn.value&&(null==(e=xn.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"});Nn.value=n,bn.value=t,Sn.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`});xn.value=l}()},{immediate:!0}),Z([()=>$.value,Ln],()=>{if(!Ln.value)return hl(),void(pe.value=0);fl(),hl(),Ln.value&&$.value&&"undefined"!=typeof ResizeObserver&&(ml=new ResizeObserver(()=>{fl(),_t.value&&Rt(),St.value&&Fr(),Fi("resize")}),ml.observe($.value))},{immediate:!0}),Z([Ln,En,zl],()=>s(null,null,function*(){if(!Ln.value)return ke.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Vo();yield le(),function(){if(!Ln.value||"undefined"==typeof window)return ke.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Vo();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=dl(cl(F.value),".paragraph-node");e.paragraph=ur(F.value,n,"pre-wrap");const t=cl(W.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=ur(W.value,o,"pre-wrap");const l=rn("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=j.value)?void 0:e.offsetHeight)?n:0}),r=rn("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=W.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=dl(cl(Y[i]),`h${i}`);e.headings[i]=ur(Y[i],n,"pre-wrap")}ke.value=e,Vo()}()}),{flush:"post",immediate:!0}),Z(()=>hn.value.length,()=>{Pn.value&&Go({immediate:!0})}),Z([Ln,pe],()=>{Vo(),Pn.value&&Go({immediate:!0}),_t.value&&Rt(),St.value&&Fr(),Fi("resize")},{immediate:!1}),Z(()=>vo.value,e=>{if(e)for(const[n,t]of tt)ji(n,t);else{il();for(const[e,n]of tt)n&&ll(e,!0)}},{immediate:!1}),Z([()=>T.viewportPriority,()=>hn.value.length],([e,n])=>{!1!==e?ne.value&&n<=200&&(ne.value=!1):ne.value=!1}),Z(()=>Gn.value,()=>{Pn.value&&Go({immediate:!0})}),Z([No,Fn,ko,()=>hn.value.length,Pn],()=>{So()},{immediate:!0});let Yi=null,Gi=!1,Qi=null;function ea(){Yi=null,er=null,Yl=void 0,nr=null,Li()}function na(){Di(),ao(),Vo(),ht.clear();const e=hn.value.length;e>0&&Gt(e),ri()}function ta(){Ri(),Zo(),Si=null,Dr=null,qr=null,Ur=null,Xr=null,Zr=null,Gi=!1,ea(),ql("restore"),$t(),Er()}function oa(e){var n;return[null!=(n=Hl())?n:"",Al(),Fl(),Kl.value,Ti(e),hn.value.length,Math.round(Ml(0,hn.value.length)),Math.round(Pl()),zt.count,Math.round(zt.total)].join(":")}function la(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Ti(r),a=Al(),u=Hl(),s=zl.value;if(Tn.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&tr(r))if(rr()){if(oa(r)!==nr&&!Gi){Gi=!0;try{const e=yield gi({reason:"manual",expectedSettledTokenKey:i}),n=Ti()===i;pi(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(nr=oa(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{Gi=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=tr(e)?oa(e):"";pi(a,u,s)&&n&&nr!==n&&la()}}}else Fi("manual")})}Z(Tn,(e,n)=>{if(e!==n){if(!e)return ta(),void Ri();ta(),na(),Qi=zl.value,Fi("content")}},{flush:"post"}),Z([Tn,zl],([e,n])=>{e?null!=Qi?Qi!==n&&(Qi=n,function(e="resize"){Di(),ao(),Vo(),ht.clear();const n=hn.value.length;n>0&&Gt(n),ri(),Dr=null,qr=null,Ur=null,Si=null,Gi=!1,ea(),Gr(),le(()=>{Ui(),_t.value&&Rt(),St.value&&Fr(),Fi(e)})}("resize")):Qi=n:Qi=null},{flush:"post",immediate:!0}),Z([Tn,()=>Al(),()=>Hl()],([e])=>{e&&(ta(),na(),ql("content"),Fi("content"))}),Z([Tn,()=>Al(),()=>Hl(),zl,()=>hn.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(Eo.entries()))Vl(o)||(Eo.delete(t),Ro.delete(t),n=!0);n&&(jl(),Fi(e))}("async-node")},{flush:"post"}),Z([Tn,()=>{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&&(Li(),function(e="content"){if(!Tn.value)return;const n=[],t=hn.value.length;for(const o of Array.from(ht.keys())){if(o>=t){n.push(o);continue}const e=Ir(o),l=ht.get(o);null!=l&&l!==e&&n.push(o),ht.set(o,e)}for(const o of Array.from(ht.keys()))o>=t&&ht.delete(o);n.length&&(function(e,n={}){const t=Array.from(e,Number),o=no(t,n);o>0&&function(e){for(const n of e)ht.delete(n)}(t)}(n,{notify:!1}),Vo(),ea(),_t.value&&Rt(),St.value&&Fr(),Fi(e))}("content"))},{flush:"post",immediate:!0}),Z([Tn,()=>hn.value.length,()=>Al(),()=>Hl()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&ea()},{flush:"post"}),Z([Tn,()=>{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,()=>Al(),pe],()=>{Gr()},{flush:"post",immediate:!0}),Z([Tn,()=>{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,()=>Al(),pe],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)}();Qr(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),Z([Tn,pe,()=>{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&&Dr&&"restore"===qr&&(Wr(t)||(na(),Dr=null,qr=null,Fi("resize")))},{flush:"post"}),Z([Tn,()=>hn.value.length,()=>Al(),pe],e=>s(null,[e],function*([e]){var n;const t=Xr,o=Zr;e&&t&&(yield le(),!Qr(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)})&&ni(t)||(Xr=null,Zr=null))}),{flush:"post",immediate:!0}),Z([Tn,ze,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Al(),()=>Hl(),zl,Po,$o,()=>Gn.value,Do,()=>zt.count,()=>zt.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!sr())return;const o=function(){var e;const n=hn.value.length;return[null!=(e=Hl())?e:"",Al(),Fl(),Kl.value,n,Math.round(Ml(0,n)),Math.round(Pl()),zt.count,Math.round(zt.total)].join(":")}();Yi!==o&&(Yi=o,gi({reason:"final"}).then(e=>{e.stable||Yi!==o||(Yi=null)}))},{flush:"post",immediate:!0}),Z([Tn,ze,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Al(),()=>Hl(),zl,Po,$o,()=>Gn.value,Do,()=>hn.value.length,()=>zt.count,()=>zt.total],()=>{la()},{flush:"post",immediate:!0}),Z([()=>hn.value.length,Pn,Fn,ko,()=>bo.start,()=>bo.end],([e,n,t,o,l,r])=>{Me.value&&Ze("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:No.value,scroll:n?(()=>{const e=Nt.value||He();return e?{reverse:$e(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:Gn.value})}),Z([()=>T.customId],([e],n,t)=>{if(!e||Mn)return;const o=function(e,n){return e?(Jl.controllers[e]=n,()=>{Jl.controllers[e]===n&&delete Jl.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Et,restoreAnchor:Ft,getAnchorDrift:Pt,getReport:Tl});t(()=>{o()})},{immediate:!0}),ee(()=>{!function(){if(Tn.value)try{Ui(),hi();const e=hr("manual");Bi(e)&&(I(e),Si=e,bi=_i());const n=Ar(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(L(n),n.anchor&&H(n.anchor),xi=Hi(n))}catch(e){}}(),Ji(),il(),Ue(),Xi();for(const e of Co.values())for(const n of e)Xo(n);Co.clear(),Mo.clear(),ht.clear(),Zi(),Di(),hl(),$t(),Er(),Ri(),al(),Yo()});const ra=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),lt}}),loadingComponent:si,delay:0}),ia=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),lt}}),loadingComponent:ui,delay:0}),aa=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),lt}})),ua={text:ut,paragraph:go,heading:eo,code_block:ct,list:io,list_item:ro,blockquote:Wt,table:wo,definition_list:qt,footnote:Yt,footnote_reference:nn,footnote_anchor:Xt,admonition:Mi,vmr_container:To,hardbreak:Ht,link:Ct,image:Xn,thematic_break:_o,math_inline:dt,math_block:ft,strong:kt,emphasis:Lt,strikethrough:bt,highlight:Tt,insert:Bt,subscript:gt,superscript:vt,emoji:Ge,checkbox:Je,checkbox_input:Je,inline_code:yn,html_inline:vn,reference:mt,html_block:ho},sa=E(()=>Il()),ca=E(()=>cr(T.codeBlockProps)),da=E(()=>cr(T.codeBlockProps,{omit:["langs"]})),fa=E(()=>a(a({stream:T.codeBlockStream,darkTheme:T.codeBlockDarkTheme,lightTheme:T.codeBlockLightTheme,monacoOptions:T.codeBlockMonacoOptions,themes:T.themes,langs:"shiki"===h.value?T.langs:void 0,minWidth:T.codeBlockMinWidth,maxWidth:T.codeBlockMaxWidth},"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}),da.value)),ma=E(()=>a(u(a({},fa.value),{langs:T.langs}),ca.value));function ha(e){return"boolean"==typeof e?e:void 0}const va=E(()=>{const e=T.codeBlockProps||{},n={},t=ha(e.showLineNumbers);void 0!==t&&(n.showLineNumbers=t);const o=ha(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}),pa=E(()=>a(a({stream:T.codeBlockStream,darkTheme:T.codeBlockDarkTheme,lightTheme:T.codeBlockLightTheme,themes:T.themes,langs:T.langs,minWidth:T.codeBlockMinWidth,maxWidth:T.codeBlockMaxWidth},"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}),ca.value)),ga=E(()=>a({},T.mermaidProps||{})),ya=E(()=>a({},T.d2Props||{})),ka=E(()=>a({},T.infographicProps||{})),Na=E(()=>({typewriter:T.typewriter,fade:T.fade,customHtmlTags:mn.value.customHtmlTags})),ba=E(()=>a(a({},Na.value),"boolean"==typeof Oe.value?{showTooltip:Oe.value}:{})),Sa=E(()=>a(a({},Na.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{})),xa=E(()=>a(a({},Na.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{})),Ma=E(()=>a(a({},Na.value),"boolean"==typeof Oe.value?{showTooltips:Oe.value}:{}));function wa(e){return Array.isArray(e.children)&&e.children.length>0}const Ca=E(()=>wl.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=at.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return at.set(s,{signature:c,node:f}),f}(e.node);const f=_a(d);let m=La(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===ua[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=dn.value[r];if(fn.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:A(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=ut,d={type:"text",content:n,raw:n}):(m=go,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const v="code_block"===d.type&&"pre"===h.value&&m===lt&&!Ba(dn.value,f);let p=a({},function(e,n,t){const o=null!=n?n:_a(e);if("code_block"===e.type){const n=o?Ba(dn.value,o):void 0;if(t&&"pre"===h.value&&!n&&t===lt)return va.value;if(t&&o&&t===n)return"mermaid"===o?Ta(e):"infographic"===o?Ia(e):"d2"===o||"d2lang"===o?ya.value:ma.value;if(t&&t===dn.value.code_block)return ma.value;if(pl(t))return pa.value}return"mermaid"===o?Ta(e):"infographic"===o?Ia(e):"d2"===o||"d2lang"===o?ya.value:"link"===e.type?ba.value:"list"===e.type?Sa.value:"blockquote"===e.type?xa.value:"table"===e.type?Ma.value:"code_block"===e.type?fa.value:Na.value}(d,f,m));const g=yl.value[e.index];"code_block"===d.type&&"code-block"===(null==g?void 0:g.kind)&&(p=u(a({},p),v?{reservedHeightPx:null!=(r=g.height)?r:g.contentHeight}:{estimatedHeightPx:g.height,estimatedContentHeightPx:g.contentHeight})),v||"code_block"!==d.type||"mermaid"!==f||null!=mr(p.estimatedPreviewHeightPx)||(p=u(a({},p),{estimatedPreviewHeightPx:yr(vr(String(null!=(i=d.code)?i:"")))})),v||"code_block"!==d.type||"infographic"!==f||null!=mr(p.estimatedPreviewHeightPx)||(p=u(a({},p),{estimatedPreviewHeightPx:kr(pr(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(p=u(a({},p),{cacheScope:cn.value}));const y=function(e,n){const t=String(e.type);return!Fe(t)&&dn.value[t]===n}(d,m),k=y?un(d,Te.value):void 0;return u(a({},e),{node:d,component:m,bindings:p,customBindings:a(a({},null!=k?k:{}),p),rendersCustomNode:y,hasSlotChildren:wa(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${sa.value}-${e.index}`})}));function _a(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Ba(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Be(t),we(t)]){const n=o&&e[o];if(n)return n}}function Oa(e,n,t,o){var l,r;const i=a({},e.value);return null==mr(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=mr(i.maxHeight))?r:void 0)),i}function Ta(e){return Oa(ga,e,vr,yr)}function Ia(e){return Oa(ka,e,pr,kr)}function La(e,n){if(!e)return Oo;const t=dn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:_a(e),r=l?Ba(t,l):void 0;if(r)return r;if("pre"===h.value)return t.code_block||lt;if("mermaid"===l)return t.mermaid||ra;if("infographic"===l)return t.infographic||ia;if("d2"===l||"d2lang"===l)return t.d2||aa;if(o)return o;return t.code_block||gl.value}return o||ua[String(e.type)]||Oo}function Aa(e){l("click",e)}function Ha(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function $a(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function Ra(e){l("mouseover",e)}function Ea(e){l("mouseout",e)}const Fa=X(null),Pa=X(!1);let Ka,za=null,Wa=0,ja=0,Va=0;const Da=["code_block","admonition","table","math_block","html_block","image","thematic_break"],qa=new Set(Da),Ua=[".typewriter-cursor",".height-estimation-probes",...Da.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Xa(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&qa.has(n)}function Za(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+Za(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Za(n),0):0}function Ja(){Ka&&(clearTimeout(Ka),Ka=void 0)}function Ya(){Wa+=1,null!=za&&(null==Vn||Vn(za),za=null)}function Ga(){Ya(),Fa.value&&(Fa.value.style.visibility="hidden")}function Qa(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(Ua)}function eu(e){let n=e.lastChild;for(;n;){if(Qa(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Ua)&&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 nu(){if(!Se||!Pa.value)return;if(null!=za)return;const e=Wa,n=()=>{za=null,e===Wa&&function(){var e,n;if(!(Se&&Pa.value&&$.value&&Fa.value))return;const t=$.value,o=Fa.value;o.style.visibility="hidden";const l=function(){const e=Ca.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Xa(t.node)||!zi(t.index))continue;const o=tt.get(t.index);if(!o)continue;const l=eu(o);if(l)return l}return null}();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=rn("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")}()};jn?za=jn(n):n()}return Z([Ke,()=>o.content,()=>o.nodes,()=>T.typewriter,ze],()=>s(null,null,function*(){var e,n;if(!Se||xe.value||!Le.value)return;if(ze.value)return Pa.value=!1,Ja(),void Ga();if(null==(e=o.nodes)?void 0:e.length)return Pa.value=!1,Ja(),Ga(),ja=(null!=(n=o.content)?n:"").length,void(Va=Ke.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Za(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+Za(n),0):Ke.value.length}(),r=!Xa(hn.value[hn.value.length-1]),i=t>ja,a=l>Va;if(!1===T.typewriter||!r||!i&&!a)return!1!==T.typewriter&&r||(Pa.value=!1,Ga()),ja=t,void(Va=l);ja=t,Va=l,Pa.value=!0,Fa.value&&(Fa.value.style.visibility="hidden"),Ja(),yield le(),nu(),Ka=setTimeout(()=>{Ka=void 0,Pa.value=!1},3e3)}),{flush:"post",immediate:!0}),Z(Pa,e=>s(null,null,function*(){e?(yield le(),nu()):Ga()}),{flush:"post"}),Z([()=>Gn.value,()=>bo.start,()=>bo.end],()=>s(null,null,function*(){Se&&!xe.value&&Le.value&&Pa.value&&(yield le(),nu())}),{flush:"post"}),ee(()=>{Ja(),Ya(),sn.clear()}),(e,n)=>{const t=ye("NodeRenderer",!0);return q(xe)?(P(!0),K(J,{key:0},ce(Ca.value,e=>(P(),K(J,{key:e.index},[e.rendersCustomNode?(P(),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":T.customId,"is-dark":T.isDark,onClick:Aa,onMouseover:Ra,onMouseout:Ea,onCopy:n[0]||(n[0]=e=>l("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},pn.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?(P(),ie(t,ue({key:1,ref_for:!0},pn.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),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":T.customId,"is-dark":T.isDark,onClick:Aa,onMouseover:Ra,onMouseout:Ea,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)):(P(),K("div",{key:1,ref_key:"containerRef",ref:$,class:V(["markstream-vue markdown-renderer",[{dark:T.isDark},{virtualized:Pn.value},{"virtual-scroll-coordinated":In.value}]]),"data-custom-id":T.customId,onClick:Aa,onMouseover:Ha,onMouseout:$a},[An.value||Pn.value?(P(),K(J,{key:0},[An.value?(P(),K("div",{key:0,class:"height-estimation-probes",style:se({width:`${En.value}px`}),"aria-hidden":"true"},[z("div",{ref_key:"paragraphProbeWrapperRef",ref:F,class:"node-content","data-probe":"paragraph"},[D(q(go),{node:Nn.value,"index-key":"probe-paragraph"},null,8,["node"])],512),z("div",{ref_key:"listItemProbeWrapperRef",ref:W,class:"node-content","data-probe":"list-item"},[z("ul",di,[D(q(ro),{node:bn.value,"index-key":"probe-list-item"},null,8,["node"])])],512),z("div",{ref_key:"listProbeWrapperRef",ref:j,class:"node-content","data-probe":"list"},[D(q(io),{node:Sn.value,"index-key":"probe-list"},null,8,["node"])],512),(P(),K(J,null,ce(6,e=>z("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(Y[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[D(q(eo),{node:Jo(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,fi)),64))],4)):G("",!0),Pn.value?(P(),K("div",{key:1,class:"node-spacer",style:se({height:`${Cl.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],64)):G("",!0),(P(!0),K(J,null,ce(Ca.value,e=>(P(),K("div",{key:e.index,ref_for:!0,ref:n=>ji(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[zi(e.index)?(P(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Il()}-${e}`;let t=!1;for(const o of Array.from(Ro.keys())){const l=Eo.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Ro.delete(o),Eo.delete(o),t=!0)}t&&(jl(),Fi("async-node"))}(e),Io.delete(e),function(e){var n;const t=(null!=(n=Mo.get(e))?n:0)+1;Mo.set(e,t)}(e);const o=Co.get(e);if(o){for(const e of o)Xo(e);Co.delete(e)}if(function(e){const n=ot.get(e);n&&(null==it||it.unobserve(n),rt.delete(n),ot.delete(e))}(e),!n||!Kn.value)return xo.delete(e),void Mo.delete(e);xo.set(e,n);const l=()=>{qi(e,n)};queueMicrotask(l);const r=(it||"undefined"==typeof ResizeObserver||(it=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=rt.get(n.target),t=ot.get(null!=e?e:-1);null!=e&&t&&qi(e,t)}else Ui()})),it);if(r&&(ot.set(e,n),rt.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]:ze.value?[80]:[];if(n.length){const t=n.map(e=>Uo(e,l,"node-resize")).filter(e=>null!=e);t.length&&Co.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(P(),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":T.customId,"is-dark":T.isDark,onCopy:n[8]||(n[8]=e=>l("copy",e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},pn.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?(P(),ie(t,ue({key:1,ref_for:!0},pn.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),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":T.customId,"is-dark":T.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"])):(P(),ie(te,{key:0,name:"fade",css:!1!==T.fade,appear:!1!==T.fade},{default:oe(()=>[e.rendersCustomNode?(P(),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":T.customId,"is-dark":T.isDark,onCopy:n[4]||(n[4]=e=>l("copy",e)),onHandleArtifactClick:n[5]||(n[5]=e=>l("handleArtifactClick",e))}),{default:oe(()=>[e.hasSlotChildren?(P(),ie(t,ue({key:0,ref_for:!0},pn.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?(P(),ie(t,ue({key:1,ref_for:!0},pn.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"])):G("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(P(),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":T.customId,"is-dark":T.isDark,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"]))]),_:2},1032,["css","appear"]))],512)):(P(),K("div",{key:1,class:"node-placeholder",style:se({height:`${kl(e.index)}px`})},null,4))],8,mi))),128)),Pa.value?(P(),K("span",{key:1,ref_key:"typewriterCursorRef",ref:Fa,class:"typewriter-cursor","aria-hidden":"true"},null,512)):G("",!0),Pn.value?(P(),K("div",{key:2,class:"node-spacer",style:se({height:`${_l.value}px`}),"aria-hidden":"true"},null,4)):G("",!0)],42,ci))}}})),[["__scopeId","data-v-6eca2e33"]]),vi=hi;vi.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",vi.__name,vi.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,hi)};const pi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:vi},Symbol.toStringTag,{value:"Module"})),gi={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"},yi={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"},ki={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"},Ni={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"},bi={class:"admonition-title"},Si=["aria-expanded","aria-controls"],xi=["id"],Mi=/* @__PURE__ */Ze(/* @__PURE__ */F({__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)=>(P(),K("div",{class:V(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(P(),K("svg",gi,[...t[1]||(t[1]=[z("circle",{cx:"12",cy:"12",r:"10"},null,-1),z("path",{d:"M12 16v-4"},null,-1),z("path",{d:"M12 8h.01"},null,-1)])])):"tip"===o.node.kind?(P(),K("svg",yi,[...t[2]||(t[2]=[z("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),z("path",{d:"M9 18h6"},null,-1),z("path",{d:"M10 22h4"},null,-1)])])):"warning"===o.node.kind||"caution"===o.node.kind?(P(),K("svg",ki,[...t[3]||(t[3]=[z("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),z("path",{d:"M12 9v4"},null,-1),z("path",{d:"M12 17h.01"},null,-1)])])):"danger"===o.node.kind||"error"===o.node.kind?(P(),K("svg",Ni,[...t[4]||(t[4]=[z("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),z("path",{d:"M12 8v4"},null,-1),z("path",{d:"M12 16h.01"},null,-1)])])):G("",!0),z("span",bi,W(r.value),1),o.node.collapsible?(P(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(P(),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]=[z("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Si)):G("",!0)]),ke(z("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[D(q(vi),{"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,xi),[[Ne,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Mi.install=e=>{e.component(Mi.__name,Mi)};const wi=()=>import("@terrastruct/d2");let Ci=null,_i=wi;function Bi(e){_i=e,Ci=null}function Oi(e){Bi(null!=e?e:wi)}function Ti(){Bi(null)}function Ii(){return"function"==typeof _i}function Li(){return s(this,null,function*(){if(Ci)return Ci;const e=_i;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===wi)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(Ci=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),Ci):null})}let Ai=null,Hi=null,$i=0;function Ri(e){Hi=null!=e?e:null,Ai=null,$i++}function Ei(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Ri(e)}function Fi(){Ri()}function Pi(){return"function"==typeof Hi}function Ki(){return s(this,null,function*(){if(Ai)return Ai;const e=Hi,n=$i;if(!e)return null;const t=yield e();if(n!==$i||e!==Hi)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!==$i||e!==Hi?null:o?(Ai=o,Ai):null})}function zi(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function Wi(e,n){null==e||e(n)}function ji(e,n){return e?(Wi(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Vi(e,n){const t=ji(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;Wi(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=zi(o.marginTop),r=zi(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function Di(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):Vi(e,n),r=ji(o,n);return Math.max(0,l-r)}function qi(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 Ui(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 Xi(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 Zi(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 Ji(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function Yi(e,n,t){const o=Ui(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&Xi(e,n,t).length>0}function Gi(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=Ui(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:Xi(e,n,t).length>0?360:96}function Qi(e){const n=he(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=he(/* @__PURE__ */new Map),l=he(/* @__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[...Se(e.items)]}function O(){const n=Se(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return qi(n,t,e)}function I(n,t){return Yi(n,t,e)}function L(n,t){const o=T(n,t),l=O(),r=Ji(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function A(){const n=Se(e.measurementKey);return null==n?void 0:String(n)}function H(){const n=Se(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function $(){const n=Se(e.markdownCodeRenderer);return"pre"===n||"shiki"===n||"monaco"===n?n:"docs"===H()?"monaco":"pre"}function R(){var e;return`${null!=(e=A())?e:""}${H()}${$()}`}function E(n,t){if(I(n,t))return L(n,t);const o=T(n,t),l=O(),r=Ji(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function F(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 P(e,n){var t;const o=F(e);if(!o||!n)return!1;if(n.sourceKey!==E(o.item,o.index))return!1;const l=I(o.item,o.index)?R():A();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!P(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=F(e);return!!(l&&n&&I(l.item,l.index)&&n.sessionKey===L(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=O())?o:"")&&function(e){const n=R(),t=null!=e?e:"";return t===n||t.startsWith(`${n}\0`)}(n.measurementKey))}function W(e,n){return z(e,n)}function j(e,n,t){!Number.isFinite(n)||n<=0||(l.set(e,Math.ceil(n)),r.set(e,t))}function V(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(!W(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 D(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:V(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 Z(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function J(o,l,r=function(e){const n=F(e);return n?function(e,n){const t=I(e,n)?R():A();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()),O=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 L;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),w&&((L=O?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:B}:_)&&(x||(N=L,x=!0,M=C(U))))}function Y(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function G(){if(!b)return;b=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)D(n)===t.logicalHeight&&ee(n,{allowMarkdownShrink:t.allowMarkdownShrink});U()}function Q(){G(),U()}function ee(n,t={}){const o=function(e){return Vi(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=F(e);return!!n&&I(n.item,n.index)}(n))return o>0&&J(n,o),void i();const a=D(n),u=function(e,n){return Di(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&&J(n,e),void i()}const c=F(n);return c&&!Xi(c.item,c.index,e).trim()?(o>0&&J(n,o),void i()):l>0?(o>l+1&&J(n,o),void i()):(o>0&&J(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);P(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=A())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&P(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),V(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(){Z(),_(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 pe()&&ve(ce),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:I,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void Y(i);if(u===a)return void ee(i);if(Y(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ee(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;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=Zi(n,t,e),a=O(),u=Xi(n,t,e),s=L(n,t),c=R(),d=H(),f=$(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=be(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=W(l,h)?h:null),v;const p={enabled:!0,sessionKey:s,threadKey:a,scrollRoot:()=>e.virtualizer.getScrollElement(),restoreState:W(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!==L(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:R()});const o=function(e){return"final"===e.phase||!!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(G))},onVirtualStateChange(e){e.sessionKey===L(n,t)&&(o.set(l,e),p.restoreState=e,V(l,e))}};return i.set(m,g),g},captureThreadState:function(){Q();const e=A();return u(a({threadKey:O()},null==e?{}:{measurementKey:e}),{outerAnchor:re(),itemHeights:ne(),itemSizeSources:te(),markdownStates:oe()})},preloadThreadState:ie,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(Z(),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}}function ea(e){return re(e)}const na=ea(()=>import("./index3.js")),ta=ea(()=>import("./index5.js")),oa=ea(()=>import("./index6.js")),la=ea(()=>import("./index11.js")),ra=ea(()=>import("./index10.js")),ia=ea(()=>import("./index7.js")),aa=ea(()=>import("./index4.js")),ua=ea(()=>import("./index8.js")),sa=ea(()=>import("./index9.js")),ca={MarkdownRender:vi,NodeRenderer:vi,AdmonitionNode:Mi,BlockquoteNode:Wt,CheckboxNode:Je,CodeBlockNode:na,DefinitionListNode:qt,EmojiNode:Ge,EmphasisNode:Lt,FootnoteNode:Yt,FootnoteReferenceNode:nn,FootnoteAnchorNode:Xt,HardBreakNode:Ht,HeadingNode:eo,HtmlBlockNode:ho,HtmlInlineNode:vn,HighlightNode:Tt,ImageNode:Xn,D2BlockNode:ia,InfographicBlockNode:ra,InlineCodeNode:yn,PreCodeNode:lt,InsertNode:Bt,LinkNode:Ct,ListItemNode:ro,ListNode:io,MathBlockNode:ta,MathInlineNode:oa,MermaidBlockNode:la,ParagraphNode:go,StrikethroughNode:bt,StrongNode:kt,SubscriptNode:gt,SuperscriptNode:vt,TableNode:wo,TextNode:ut,ThematicBreakNode:_o,VmrContainerNode:To,ReferenceNode:mt,MarkdownCodeBlockNode:ua,MarkstreamVirtualTimeline:sa,Tooltip:aa},da={install(e,n){var t;Object.entries(ca).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Oe(n.iconTheme),(null==n?void 0:n.getLanguageIcon)&&Te(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&H(n.mathOptions),n&&"infographicLoader"in n&&Ri(null!=(t=n.infographicLoader)?t:null),(null==n?void 0:n.components)&&e.provide(Re,function(e={}){return $(Ke(e))}(n.components))}};export{ta as $,lt as A,Mi as B,Wt as C,Je as D,na as E,ia as F,qt as G,Ge as H,Lt as I,Xt as J,Yt as K,nn as L,Ht as M,eo as N,Tt as O,ho as P,vn as Q,Xn as R,ra as S,yn as T,Bt as U,Ct as V,ro as W,io as X,ua as Y,sa as Z,Ze as _,Sr as a,oa as a0,la as a1,go as a2,mt as a3,bt as a4,kt as a5,gt as a6,vt as a7,wo as a8,ut as a9,_o as aa,aa as ab,To as ac,da as ad,De as ae,Ti as af,Fi as ag,Oi as ah,Ei as ai,We as aj,Ii as ak,Ve as al,ze as am,Bi as an,En as ao,Ri as ap,Qi as aq,li as ar,so as b,vi as c,Yi as d,Ui as e,Gi as f,Li as g,$n as h,fr as i,qi as j,Zi as k,Xi as l,Ji as m,Vi as n,Di as o,mr as p,pr as q,zn as r,Hn as s,Pi as t,Kn as u,kr as v,Ki as w,vr as x,hr as y,yr as z};
|