markstream-vue 2.0.0-beta.1 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CodeBlockNode.js +1 -1
- package/dist/CodeBlockNodeLoading.js +1 -0
- package/dist/PreCodeBlock.js +1 -0
- package/dist/PreCodeBlock.vue_vue_type_style_index_0_lang.js +1 -0
- package/dist/Tooltip.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- 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/index2.js +1 -1
- package/dist/index5.js +1 -1
- package/dist/index6.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.js +1 -1
- package/dist/index9.js +1 -1
- package/dist/preCodeDiffMetrics.js +1 -0
- package/dist/preCodeTheme.js +1 -0
- package/dist/tailwind.js +0 -0
- package/package.json +5 -3
package/dist/exports.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},u=(e,o)=>n(e,t(o)),s=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{normalizeCustomHtmlTagName as c,tokenizeHtml as d,hasCustomHtmlComponents as f,sanitizeHtmlAttrs as m,sanitizeHtmlTokenAttrs as h,tokenAttrsToRecord as v,convertHtmlAttrsToProps as p,BLOCKED_HTML_TAGS as g,isHtmlTagHardBlocked as y,isHtmlTagBlocked as k,isCustomHtmlComponentTag as N,sanitizeHtmlContent as b,sanitizeImageSrc as x,shouldOpenLinkInNewTab as S,NON_STRUCTURING_HTML_TAGS as w,normalizeCustomHtmlTags as M,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as _,getMarkdown as B,mergeCustomHtmlTags as I,resolveCustomHtmlTags as O,parseMarkdownToStructure as T,EXTENDED_STANDARD_HTML_TAGS as L,stripCustomHtmlWrapper as H,setDefaultMathOptions as A}from"stream-markdown-parser";import{shallowRef as $,inject as R,computed as P,defineComponent as E,openBlock as F,createElementBlock as K,createElementVNode as z,toDisplayString as W,h as j,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as G,watch as X,onScopeDispose as Y,Fragment as J,createTextVNode as Z,createCommentVNode as Q,getCurrentInstance as ee,provide as ne,onBeforeUnmount as te,renderSlot as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,withCtx as se,normalizeStyle as ce,renderList as de,withDirectives as fe,vShow as me,markRaw as he,normalizeProps as ve,guardReactiveProps as pe,Transition as ge,reactive as ye,getCurrentScope as ke,onMounted as Ne,watchEffect as be,triggerRef as xe,resolveComponent as Se,toRaw as we,toValue as Me}from"vue";import{resolveStreamingTextUpdate as Ce,createSmoothMarkdownStream as _e,normalizeShikiLanguage as Be}from"markstream-core";import{M as Ie,n as Oe,c as Te,s as Le,h as He}from"./index2.js";import{b as Ae}from"./workers-katexWorkerClient.js";import{a as $e,b as Re,c as Pe,e as Ee,p as Fe}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const Ke="__global__",ze="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",We=(()=>{const e=globalThis;if(e[ze])return e[ze];const n={scopedCustomComponents:{},revision:$(0)};return e[ze]=n,n})(),je=We.revision,De=/* @__PURE__ */Symbol("markstreamCustomComponents"),Ve=/* @__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 qe(e){return Ve.has(String(e).trim().toLowerCase())}function Ue(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ge(e={}){const n={};for(const[t,o]of Object.entries(e))if(null!=o){n[t]=o;for(const e of/* @__PURE__ */new Set([c(t),c(Ue(t))]))!e||qe(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Xe(e,n){"string"==typeof e?We.scopedCustomComponents[e]=Ge(n||{}):We.scopedCustomComponents[Ke]=Ge(e||{}),je.value++}function Ye(e){const n=Ge(We.scopedCustomComponents[Ke]||{});if(!e)return n;const t=Ge(We.scopedCustomComponents[e]||{});return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Je(e){const n=R(De,null);return P(()=>{var t;return je.value,function(e,n={}){return je.value,a(a(a({},Ge(We.scopedCustomComponents[Ke]||{})),Ge(n)),Ge(function(e){return e&&We.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Ze(e){if(e===Ke)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete We.scopedCustomComponents[e],je.value++}function Qe(){delete We.scopedCustomComponents[Ke],je.value++}const en=["aria-label"],nn={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"},tn={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"},on=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},ln=/* @__PURE__ */on(/* @__PURE__ */E({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),K("svg",tn,[...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)])])):(F(),K("svg",nn,[...t[0]||(t[0]=[z("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,en))}),[["__scopeId","data-v-be21ab83"]]);ln.install=e=>{e.component(ln.__name,ln)};const rn={class:"emoji-node"},an=/* @__PURE__ */on(/* @__PURE__ */E({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",rn,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);an.install=e=>{e.component(an.__name,an)};const un=["id"],sn=["title"],cn=/* @__PURE__ */on(/* @__PURE__ */E({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(F(),K("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[z("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+W(e.node.id)+"]",9,sn)],8,un))}}),[["__scopeId","data-v-c1463a29"]]);cn.install=e=>{e.component(cn.__name,cn)};const dn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function fn(e){dn&&console.warn(e)}function mn(e,n="safe",t){return m(e,n,t)}function hn(e){return p(e)}function vn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function pn(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),vn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),vn(e.value)]):Object.entries(l).map(([e,n])=>[e,vn(n)]):null,n,t);var l;if(!o)return;const r=hn(v(o));return Object.keys(r).length>0?r:void 0}function gn(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 yn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function kn(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?[gn(e,n,!0)]:[gn(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=hn(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 Nn(e,n){return f(e,n)}function bn(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=kn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);yn(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=kn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?yn(l[l.length-1].children,a):yn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&fn(`Auto-closing unclosed tag: <${i.tagName}>`)}else fn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=kn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?yn(l[l.length-1].children,o):yn(r,o),fn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,dn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xn=["innerHTML"],Sn=/* @__PURE__ */on(/* @__PURE__ */E({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=P(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Je(()=>n.customId),r=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=P(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=bn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Nn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=bn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(F(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(F(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,xn))}}),[["__scopeId","data-v-d17f12b0"]]);Sn.install=e=>{e.component(Sn.__name,Sn)};const wn={class:"inline-code"},Mn={key:0},Cn=/* @__PURE__ */on(/* @__PURE__ */E({__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=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=P(()=>!a.value),c=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=G(n.node.code),f=G(""),m=G(0);let h;function v(){null==h||h(),h=void 0}function p(){v(),f.value&&(d.value=d.value+f.value,f.value="")}X([()=>n.node.code,c,a],([e])=>{const n=String(null!=e?e:""),t=c.value,o=Ce({nextContent:n,persistedContent:t?null==l?void 0:l.get(t):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value});d.value=o.settledContent,f.value=o.streamedDelta,o.appended?(m.value+=1,function(){if(!f.value||h||!r)return;const e=r.value;h=X(()=>r.value,n=>{n!==e&&p()},{flush:"sync"})}()):f.value||v(),t&&(null==l||l.set(t,n))},{immediate:!0}),Y(v);const g=P(()=>m.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),K("code",wn,[s.value?(F(),K(J,{key:0},[Z(W(u.value),1)],64)):(F(),K(J,{key:1},[d.value?(F(),K("span",Mn,W(d.value),1)):Q("",!0),f.value?(F(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},W(f.value),35)):Q("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);Cn.install=e=>{e.component(Cn.__name,Cn)};const _n=G(!1),Bn=G(""),In=G("top"),On=G(null),Tn=G(null),Ln=G(null),Hn=G(null),An=G(null);let $n=null,Rn=null,Pn=0;function En(){$n&&(clearTimeout($n),$n=null),Rn&&(clearTimeout(Rn),Rn=null)}let Fn=!1,Kn=null,zn=!1;function Wn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Pn;En();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!Fn&&!zn&&"undefined"!=typeof document){null!=Kn||(Kn=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:_n.value,"anchor-el":On.value,content:Bn.value,placement:In.value,id:Tn.value,originX:Ln.value,originY:Hn.value,isDark:null!=(e=An.value)?e:void 0})}}).mount(o),Fn=!0}));try{yield Kn}catch(e){Fn=!1,Kn=null,zn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),Fn&&i===Pn){Tn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,On.value=e,Bn.value=n,In.value=t,Ln.value=null!=(o=null==l?void 0:l.x)?o:null,Hn.value=null!=(a=null==l?void 0:l.y)?a:null,An.value="boolean"==typeof r?r:null,_n.value=!0;try{e.setAttribute("aria-describedby",Tn.value)}catch(u){}}});o?a():$n=setTimeout(a,80)}function jn(e=!1){Pn+=1,En();const n=()=>{if(On.value&&Tn.value)try{On.value.removeAttribute("aria-describedby")}catch(e){}_n.value=!1,On.value=null,Tn.value=null,Ln.value=null,Hn.value=null};e?n():Rn=setTimeout(n,120)}const Dn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Vn=/* @__PURE__ */Symbol("markstreamI18nFallback");function qn(e){Object.assign(Dn,e)}function Un(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:Dn[e]}const Gn=(e,n)=>{var t;return null!=(t=Un(e,n))?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function Xn(e,n){return{t(t){const o=Un(t,n);if(e.te&&null!=o&&!e.te(t))return Gn(t,n);const l=e.t(t);return l===t&&null!=o?Gn(t,n):l}}}function Yn(){const e=function(){var e,n,t;try{const o=ee(),l=Vn,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=ee(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(n)return Xn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return Xn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Gn(n,e)}}const Jn=/* @__PURE__ */Symbol("ViewportPriority"),Zn=/* @__PURE__ */Symbol("ViewportPriorityOptions"),Qn=/* @__PURE__ */Symbol("OffscreenHeavyNodeDeferral"),et=P(()=>!1),nt="400px";function tt(){return R(Zn,void 0)}function ot(){return R(Qn,et)}function lt(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?G(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null,u=/* @__PURE__ */new WeakMap;let s=1;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Set;let m=null,h=null;function v(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function p(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function g(e){if(e){const t=c.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch(n){}c.delete(e)}}d.size||f.size||p()}function y(e){const n=d.get(e);if(!n)return;const t=c.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(o){}}try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)}function k(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==m&&f.size&&(m=i(()=>{m=null;const e=f.values().next().value;e&&(f.delete(e),y(e),f.size&&k())},{timeout:1200}))}function N(n,t){if(!l)return null;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:nt,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[v((i=o).root),i.rootMargin,i.threshold].join("\0");var i;const a=c.get(r);if(a)return{key:r,bucket:a};let u;try{u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&y(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold})}catch(d){return null}const s={io:u,targets:/* @__PURE__ */new Map};return c.set(r,s),{key:r,bucket:s}}function b(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=N(n,t.opts);if(!o){y(n);continue}if(o.key===t.bucketKey)continue;const l=t.bucketKey,r=c.get(l);try{null==r||r.io.unobserve(n)}catch(e){}null==r||r.targets.delete(n),t.bucketKey=o.key,o.bucket.targets.set(n,t),o.bucket.io.observe(n),g(l)}}X(r,e=>{if(!e){for(const e of Array.from(d.keys()))y(e);p()}},{flush:"sync"});const x=(e,n)=>{const t=G(!1);let o,i=!1;const a=new Promise(e=>{o=()=>{i||(i=!0,e())}}),u=()=>{const n=d.get(e);if(!n)return f.delete(e),void g();const t=c.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=N(e,n);if(!s)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const m={resolve:o,visible:t,bucketKey:s.key,opts:n};return d.set(e,m),s.bucket.targets.set(e,m),s.bucket.io.observe(e),l&&null==h&&(h=window.requestAnimationFrame(()=>{h=null,b()})),!1!==(null==n?void 0:n.allowIdle)&&(f.add(e),k()),{isVisible:t,whenVisible:a,destroy:u}};return x.refresh=b,ne(Jn,x),x}function rt(){var e,n;const t=R(Jn,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=e=>{if(!e)return;const n=l.get(e);if(n&&!n.targets.size){try{n.io.disconnect()}catch(t){}l.delete(e)}},d=e=>{const n=o.get(e);if(!n)return;const t=l.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(i){}}try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},f=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&f())},{timeout:1200}))};return(e,n)=>{const t=G(!1);let i,a=!1;const u=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{const n=o.get(e);if(!n)return r.delete(e),void(r.size||s());const t=l.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},h=(e=>{var n,t;if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return null;const o=(e=>{var n,t;return[null!=(n=null==e?void 0:e.rootMargin)?n:nt,null!=(t=null==e?void 0:e.threshold)?t:0].join("\0")})(e),r=l.get(o);if(r)return{key:o,bucket:r};const i=null!=(n=null==e?void 0:e.rootMargin)?n:nt;let a;try{a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:i,threshold:null!=(t=null==e?void 0:e.threshold)?t:0})}catch(s){return null}const u={io:a,targets:/* @__PURE__ */new Set};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.targets.add(e),h.bucket.io.observe(e),!1!==(null==n?void 0:n.allowIdle)&&(r.add(e),f()),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}function it(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 at=["data-markstream-viewport-pending"],ut=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],st={key:1,class:"image-placeholder"},ct={key:1,class:"image-node__raw-text"},dt={key:2,class:"image-shimmer-overlay"},ft={key:1,class:"image-node__raw-text"},mt={key:3,class:"image-error"},ht=/* @__PURE__ */on(/* @__PURE__ */E({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){var t,o,l;const r=e,i=n,a=G(!1),u=G(!1),c=G(""),d=G("primary"),f=G(null),m=U(),h=R(Ie,null),v=rt(),p=tt(),g=ot(),y=P(()=>x(r.node.src)),k=P(()=>x(r.fallbackSrc)),N=null==(l=null==(o=null==(t=ee())?void 0:t.vnode.el)?void 0:o.querySelector)?void 0:l.call(o,"img"),b="undefined"!=typeof window&&(null==N?void 0:N.getAttribute("src"))===(y.value||k.value),S=G("undefined"==typeof window||b||!g.value),w=$(null);let M="",C=null;const _=P(()=>c.value),B=P(()=>!r.lazy),I=P(()=>"undefined"!=typeof window&&g.value&&!b),O=P(()=>!I.value||S.value),T=P(()=>O.value?_.value:""),L=P(()=>{var e,n;return null!=(n=null!=(e=null==p?void 0:p.value.heavyBlockMargin)?e:null==p?void 0:p.value.rootMargin)?n:nt}),H=P(()=>!r.node.loading&&"failed"!==d.value&&c.value.length>0),A=P(()=>"failed"===d.value),E=P(()=>(!B.value||I.value&&!S.value)&&!a.value&&!u.value&&"failed"!==d.value&&c.value.length>0),j=P(()=>it(r,m));function V(e=j.value){e&&f.value&&(null==h||h.reportHeight(e,f.value.offsetHeight))}function Y(e=j.value){e&&le(()=>{V(e)})}function J(){C&&(clearTimeout(C),C=null)}function Z(){const e=j.value;e&&M!==e&&(M&&(null==h||h.markSettled(M)),J(),M=e,null==h||h.markPending(e),"undefined"!=typeof window&&(C=window.setTimeout(()=>{M===e&&(Y(e),ne())},8e3)))}function ne(){return s(this,null,function*(){const e=M;e&&(J(),M="",yield le(),V(e),null==h||h.markSettled(e))})}function re(){if("primary"===d.value&&k.value&&k.value!==c.value)return d.value="fallback",c.value=k.value,a.value=!1,u.value=!1,void Y();d.value="failed",u.value=!0,i("error",c.value),Y()}function ie(){a.value=!0,u.value=!1,i("load",_.value),Y()}function ae(e){e.preventDefault(),a.value&&!u.value&&i("click",[e,_.value])}const{t:ue}=Yn();return X([y,k,()=>r.node.loading],()=>(a.value=!1,u.value=!1,r.node.loading||y.value?(c.value=y.value,void(d.value="primary")):k.value?(c.value=k.value,void(d.value="fallback")):(c.value="",d.value="failed",void(u.value=!0))),{immediate:!0}),"undefined"!=typeof window&&X([f,I],([e,n],t,o)=>{var l;if(null==(l=w.value)||l.destroy(),w.value=null,!n||S.value)return void(S.value=!0);if(!e)return void(S.value=!1);let r=!0;const i=v(e,{rootMargin:L.value,allowIdle:!1});w.value=i,S.value=i.isVisible.value,i.whenVisible.then(()=>{r&&w.value===i&&(S.value=!0)}),o(()=>{r=!1,i.destroy(),w.value===i&&(w.value=null)})},{immediate:!0}),X([H,a,u,_,()=>r.lazy,O],([e,n,t,o,l,r])=>e&&o&&!t&&r?n?(ne(),void Y()):l?(Z(),void Y()):void(n||t||Z()):(ne(),void Y()),{flush:"post",immediate:!0}),te(()=>{var e;null==(e=w.value)||e.destroy(),w.value=null,function(){const e=M;e&&(J(),M="",null==h||h.markSettled(e))}()}),(n,t)=>{var o,l,i,s,c;return F(),K("span",{ref_key:"rootRef",ref:f,class:"image-node-container","data-markstream-viewport-pending":I.value&&!S.value?"true":void 0},[H.value?(F(),K("img",{key:0,src:T.value||void 0,alt:String(null!=(l=null!=(o=r.node.alt)?o:r.node.title)?l:""),title:String(null!=(s=null!=(i=r.node.title)?i:r.node.alt)?s:""),class:D(["image-node__img",{"is-loading":!B.value&&!a.value,"is-loaded":B.value||a.value,"has-natural-size":a.value,"cursor-pointer":a.value}]),loading:r.lazy?"lazy":void 0,fetchpriority:B.value?"high":void 0,decoding:B.value?"sync":"async",tabindex:a.value?0:-1,"aria-label":null!=(c=r.node.alt)?c:q(ue)("image.preview"),onError:re,onLoad:ie,onClick:ae},null,42,ut)):Q("",!0),e.node.loading&&!u.value?(F(),K("span",st,[r.usePlaceholder?oe(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:_.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[0]||(t[0]=z("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",ct,W(e.node.raw),1))])):Q("",!0),E.value&&!e.node.loading?(F(),K("span",dt,[r.usePlaceholder?oe(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:_.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[1]||(t[1]=z("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",ft,W(e.node.raw),1))])):Q("",!0),A.value?(F(),K("span",mt,[oe(n.$slots,"error",{node:r.node,displaySrc:_.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[2]||(t[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(ue)("image.loadError")),1)],!0)])):Q("",!0)],8,at)}}}),[["__scopeId","data-v-046e82ac"]]);ht.install=e=>{e.component(ht.__name,ht)};const vt={key:2},pt=/* @__PURE__ */E({__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=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=P(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=re({loader:()=>Promise.resolve().then(()=>ga),suspensible:!1}),c=P(()=>n.components[String(n.node.type)]),d=P(()=>Boolean(c.value&&t.value[n.node.type]&&!qe(String(n.node.type)))),f=P(()=>d.value?pn(n.node,r.value):void 0),m=P(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=P(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=P(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(F(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:se(()=>[m.value?(F(),ie(q(s),ue({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):h.value?(F(),ie(q(s),ue({key:1},i.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(F(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(F(),K("span",vt,W(v.value),1)):Q("",!0)}}),gt=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function yt(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return u(a(a({},gt),t),{enabled:null==(n=t.enabled)||n})}return a({},gt)}function kt(e){return"unified"===e.diffStyle}function Nt(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let r=3;for(;o[r]===l;)r+=1;return o.slice(r).trim()}function bt(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}function xt(e){var n;return!0===e.diff||bt(e.language)||bt(Nt(String(null!=(n=e.raw)?n:"")))}function St(e,n,t){const o=function(e){const n=Nt(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:o||n,caption:o?t?`Diff / ${n}`:n:""}}const wt=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Mt={key:0,translate:"no",class:"markstream-pre__diff-code"},Ct={class:"markstream-pre__diff-pane-content"},_t={class:"markstream-pre__diff-number","aria-hidden":"true"},Bt={class:"markstream-pre__diff-content"},It={class:"markstream-pre__diff-content-inner"},Ot={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Tt=["textContent"],Lt=["textContent"],Ht=/* @__PURE__ */E({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const n=e;function t(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}const o=P(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),l=P(()=>`language-${o.value}`),r=P(()=>{var e;return!0===n.loading||!0===(null==(e=n.node)?void 0:e.loading)}),i=P(()=>{var e;return t(null==(e=n.node)?void 0:e.code,r.value)});let s="",c=1;const d=P(()=>function(e){let n=0,t=1;e.startsWith(s)&&(n=s.length,t=c,n>0&&"\r"===e[n-1]&&"\n"===e[n]&&n++);for(let o=n;o<e.length;o++)"\n"===e[o]?t++:"\r"===e[o]&&(t++,"\n"===e[o+1]&&o++);return s=e,c=t,t}(i.value)),f=P(()=>i.value.split(/\r\n|\n|\r/));let m=0,h="";const v=P(()=>{const e=d.value;e<m&&(m=0,h="");for(let n=m+1;n<=e;n++)h+=`${h?"\n":""}${n}`;return m=e,h}),p=P(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),g=P(()=>p.value&&!0===n.diffInline),y=P(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return r.value?{maxHeight:t,overflow:"auto"}:{height:t,minHeight:t,maxHeight:t,overflow:"auto"}}),k=["diff ","index ","--- ","+++ ","@@ "];function N(e){return 0===String(null!=e?e:"").trim().length}function b(e,n="context",t={}){const o=N(e);return{code:e,kind:o&&"hunk"!==n&&"spacer"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function x(e){const n=t(e,r.value);return n?n.split(/\r\n|\n|\r/):[]}function S(e,n){return!N(e[n])||n<e.length-1}function w(e){return e.startsWith("-")&&!e.startsWith("---")}function M(e){return e.startsWith("+")&&!e.startsWith("+++")}function C(e){return e.some(e=>k.some(n=>e.startsWith(n)))}function _(e,n){return n||!e.startsWith(" ")||e.startsWith(" ")?e:` ${e}`}function B(e,n){const t=e.length,o=n.length,l=[];let i=0;for(;i<t&&i<o&&e[i]===n[i];)l.push({originalIndex:i,modifiedIndex:i}),i++;const a=[];let u=t-1,s=o-1;for(;u>=i&&s>=i&&e[u]===n[s];)a.unshift({originalIndex:u,modifiedIndex:s}),u--,s--;const c=u-i+1,d=s-i+1;if(c<=0||d<=0)return l.concat(a);if(r.value)return l.concat(a);if((c+1)*(d+1)>15e5)return l.concat(a);const f=d+1,m=new Uint32Array((c+1)*(d+1));for(let r=c-1;r>=0;r--)for(let t=d-1;t>=0;t--){const o=r*f+t;if(e[i+r]===n[i+t])m[o]=m[(r+1)*f+t+1]+1;else{const e=m[(r+1)*f+t],n=m[r*f+t+1];m[o]=e>=n?e:n}}const h=[];let v=0,p=0;for(;v<c&&p<d;)e[i+v]===n[i+p]?(h.push({originalIndex:i+v,modifiedIndex:i+p}),v++,p++):m[(v+1)*f+p]>=m[v*f+p+1]?v++:p++;return l.concat(h,a)}function I(e){var t;const o=function(){var e,t;const o=n.diffHideUnchangedRegions;if(null==o||!1===o)return null;const l=!0===o?{}:o;return!1===l.enabled?null:{contextLineCount:Math.max(0,Math.floor(null!=(e=l.contextLineCount)?e:2)),minimumLineCount:Math.max(1,Math.floor(null!=(t=l.minimumLineCount)?t:4))}}();if(!o||e.length<1||e.length>2)return e;if(2===e.length&&e[0].lines.length!==e[1].lines.length)return e;const l=e[0].lines,r=null==(t=e[1])?void 0:t.lines,i=e=>"context"===l[e].kind&&(void 0===r||"context"===r[e].kind&&l[e].code===r[e].code),s=[];let c=0;for(;c<l.length;){const e=c;for(;c<l.length&&i(c);)c++;const n=c;if(n-e>=o.minimumLineCount){const t=e+(0===e?0:o.contextLineCount),r=n-(n===l.length?0:o.contextLineCount);r-t>=o.minimumLineCount&&s.push({start:t,end:r})}c===e&&c++}return s.length?e.map((e,n)=>{const t=[];let o=0;for(const l of s)t.push(...e.lines.slice(o,l.start)),t.push({code:0===n?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${e.key}-collapsed-${l.start}-${l.end}`,number:""}),o=l.end;return t.push(...e.lines.slice(o)),u(a({},e),{lines:t})}):e}const O=P(()=>{var e,t,l,r;if(!p.value)return[];const i=function(e){const t=e.some(e=>w(e)),l=e.some(e=>M(e));return t&&l||function(){var e,t,l,r;if("diff"===o.value)return!0;const i=null!=(r=null==(l=String(null!=(t=null==(e=n.node)?void 0:e.raw)?t:"").split(/\r?\n/,1)[0])?void 0:l.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(t||l)}(f.value),s=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(g.value){const o=s?function(e,n){const t=x(e),o=x(n),l=B(t,o);if(l.length>0){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},b(t[n],"removed",{preserveBlankKind:S(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},b(o[r],"added",{preserveBlankKind:S(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},b(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({},b(t[n],"removed",{preserveBlankKind:S(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<o.length;)e.push(u(a({},b(o[r],"added",{preserveBlankKind:S(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},b(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({},b(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},b(t[f],"removed",{preserveBlankKind:S(t,f)})),{key:`inline-removed-source-${f}`,number:f+1}));for(let f=i;f<=c;f++)r.push(u(a({},b(o[f],"added",{preserveBlankKind:S(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}(null==(e=n.node)?void 0:e.originalCode,null==(t=n.node)?void 0:t.updatedCode):function(e){const n=[];let t=1,o=1;const l=C(e);for(const[r,i]of e.entries())if(i.startsWith("@@")){const e=i.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);e&&(t=Number(e[1]),o=Number(e[2])),n.push(u(a({},b(i,"hunk")),{key:`inline-hunk-${r}`,number:""}))}else if(w(i))n.push(u(a({},b(_(i.slice(1),l),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${r}`,number:t++}));else if(M(i))n.push(u(a({},b(_(i.slice(1),l),"added",{preserveBlankKind:!0})),{key:`inline-added-${r}`,number:o++}));else{const e=l&&i.startsWith(" ")?i.slice(1):i;n.push(u(a({},b(e)),{key:`inline-context-${r}`,number:o})),t++,o++}return n}(f.value);return I([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:o}])}if(!i&&s)return function(e,n){const t=x(e),o=x(n),l=B(t,o),r=[],i=[];let s=0,c=0,d=0;const f=(e,n)=>{const l=Math.max(e-s,n-c);for(let f=0;f<l;f++){const l=s+f,m=c+f;r.push(l<e?u(a({},b(t[l],"removed",{preserveBlankKind:S(t,l)})),{key:`original-changed-${d}-${l}`,number:l+1}):u(a({},b("","spacer")),{key:`original-spacer-${d}-${f}`,number:""})),i.push(m<n?u(a({},b(o[m],"added",{preserveBlankKind:S(o,m)})),{key:`modified-changed-${d}-${m}`,number:m+1}):u(a({},b("","spacer")),{key:`modified-spacer-${d}-${f}`,number:""}))}s=e,c=n,d++};for(const m of l)f(m.originalIndex,m.modifiedIndex),r.push(u(a({},b(t[m.originalIndex])),{key:`original-context-${m.originalIndex}-${m.modifiedIndex}`,number:m.originalIndex+1})),i.push(u(a({},b(o[m.modifiedIndex])),{key:`modified-context-${m.originalIndex}-${m.modifiedIndex}`,number:m.modifiedIndex+1})),s=m.originalIndex+1,c=m.modifiedIndex+1;return f(t.length,o.length),I([{key:"original",className:"markstream-pre__diff-pane--original",lines:r},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:i}])}(null==(l=n.node)?void 0:l.originalCode,null==(r=n.node)?void 0:r.updatedCode);const c=[],d=[],m=C(f.value);for(const n of f.value)if(n.startsWith("@@"))c.push(b(n,"hunk")),d.push(b(n,"hunk"));else if(n.startsWith("-")&&!n.startsWith("---"))c.push(b(_(n.slice(1),m),"removed",{preserveBlankKind:!0}));else if(n.startsWith("+")&&!n.startsWith("+++"))d.push(b(_(n.slice(1),m),"added",{preserveBlankKind:!0}));else{const e=m&&n.startsWith(" ")?n.slice(1):n;c.push(b(e)),d.push(b(e))}return I([{key:"original",className:"markstream-pre__diff-pane--original",lines:c.map((e,n)=>u(a({},e),{key:`original-${n}`,number:n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:d.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:n+1}))}])}),T=P(()=>{var e,t;if(!0!==n.showLineNumbers)return;let o=p.value?1:d.value;if(p.value){o=Math.max(o,x(null==(e=n.node)?void 0:e.originalCode).length,x(null==(t=n.node)?void 0:t.updatedCode).length);for(const e of O.value)for(const n of e.lines)"number"==typeof n.number&&(o=Math.max(o,n.number))}const l=`${Math.max(2,String(o).length)}ch`;return{"--markstream-pre-line-number-width":l,"--markstream-pre-diff-line-number-width":l,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}}),L=P(()=>O.value.some(e=>e.lines.some(e=>"collapsed"===e.kind))),H=P(()=>{const e=o.value;return e?`Code block: ${e}`:"Code block"}),A=G(null),$=G([]);let R=null,E=!1,j=null;function V(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)&&n>0?n:0}function q(e,n){var t;if(!e)return n;if(e.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const o=e.querySelector(".markstream-pre__diff-content"),l=null==o?void 0:o.getBoundingClientRect(),r=null!=(t=null==l?void 0:l.height)?t:0;return Math.max(n,Math.ceil(r))}function U(){E||"undefined"==typeof window||(null!=R&&window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>{R=null,E||function(){var e,n;R=null;const t=A.value;if(!t||!p.value||g.value||!t.classList.contains("is-wrap"))return void($.value.length&&($.value=[]));const o=function(e){const n=window.getComputedStyle(e),t=V(n.getPropertyValue("--markstream-pre-diff-line-height"));if(t>0)return t;const o=V(n.lineHeight);return o>0?o:18}(t),l=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),r=Array.from(t.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),i=Math.max(l.length,r.length),a=[];for(let c=0;c<i;c++){const t=q(null!=(e=l[c])?e:null,o),i=q(null!=(n=r[c])?n:null,o),u=Math.max(o,t,i);a.push({rowHeight:u,originalHeight:t,modifiedHeight:i})}var u,s;u=$.value,s=a,u.length===s.length&&u.every((e,n)=>{const t=s[n];return t&&Math.abs(e.rowHeight-t.rowHeight)<=.5&&Math.abs(e.originalHeight-t.originalHeight)<=.5&&Math.abs(e.modifiedHeight-t.modifiedHeight)<=.5})||($.value=a)}()}))}function Y(e){null==j||j.disconnect(),j=null,e&&p.value&&!g.value&&"undefined"!=typeof ResizeObserver&&(j=new ResizeObserver(()=>{U()}),j.observe(e))}function Z(e,n){const t=$.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 X(A,e=>{Y(e),le(()=>U())},{flush:"post"}),X([p,g,O],()=>{Y(A.value),le(()=>U())},{flush:"post",immediate:!0}),te(()=>{E=!0,null!=R&&(window.cancelAnimationFrame(R),R=null),null==j||j.disconnect(),j=null}),(e,t)=>(F(),K("pre",{ref_key:"preRef",ref:A,style:ce([y.value,T.value]),class:D([l.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":p.value,"markstream-pre--diff-inline":g.value,"markstream-pre--diff-collapsed":L.value}]),"aria-busy":r.value,"aria-label":H.value,"data-language":o.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[p.value?(F(),K("code",Mt,[(F(!0),K(J,null,de(O.value,e=>(F(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[z("span",Ct,[(F(!0),K(J,null,de(e.lines,(n,o)=>(F(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,{"markstream-pre__diff-line--empty":n.empty}]]),style:ce(Z(o,e.key))},[t[0]||(t[0]=z("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),z("span",_t,W(n.number),1),z("span",Bt,[z("span",It,W(n.code),1)])],6))),128))])],2))),128))])):(F(),K(J,{key:1},[n.showLineNumbers?(F(),K("span",Ot,[z("span",{class:"markstream-pre__line-numbers-text",textContent:W(v.value)},null,8,Tt)])):Q("",!0),z("code",{translate:"no",class:"markstream-pre__code",textContent:W(i.value)},null,8,Lt)],64))],14,wt))}});Ht.install=e=>{e.component(Ht.__name,Ht)};const At=/* @__PURE__ */on(/* @__PURE__ */E({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=U(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=R("markstreamStreamVersion",void 0),i=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=G(n.node.content),c=G(""),d=G(0),f=G(n.node.content);let m;const h=G(null),v=G(null);let p="",g=null;function y(){null==m||m(),m=void 0}function k(){y(),c.value&&(s.value=s.value+c.value,c.value="")}X([s,h,v],function(){var e,n;const t=h.value;if(!t)return;const o=String(null!=(e=s.value)?e:""),l=v.value;return g||(g=t.firstChild,p=null!=(n=null==g?void 0:g.data)?n:""),o.startsWith(p)?!g&&o?(t.textContent=o,g=t.firstChild,void(p=o)):void(o.length>p.length&&l&&(l.appendChild(document.createTextNode(o.slice(p.length))),p=o)):(t.textContent=o,g=t.firstChild,l&&(l.textContent=""),void(p=o))},{immediate:!0}),X([()=>n.node.content,u,a],([e])=>{const n=String(null!=e?e:""),t=u.value,o=Ce({nextContent:n,persistedContent:t?null==l?void 0:l.get(t):void 0,currentState:{settledContent:s.value,streamedDelta:c.value},typewriterEnabled:a.value});s.value=o.settledContent,c.value=o.streamedDelta,o.appended?(d.value+=1,function(){if(!c.value||m||!r)return;const e=r.value;m=X(()=>r.value,n=>{n!==e&&k()},{flush:"sync"})}()):c.value||y(),t&&(null==l||l.set(t,n))},{immediate:!0}),Y(y);const N=P(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,t)=>(F(),K("span",{class:D([[e.node.center?"text-node-center":""],"text-node"])},[fe(z("span",{ref_key:"settledTextEl",ref:h},W(f.value),513),[[me,""!==s.value]]),fe(z("span",{ref_key:"settledAppendsEl",ref:v},null,512),[[me,""!==s.value]]),c.value?(F(),K("span",{key:0,class:D(["text-node-stream-delta",[N.value]]),onAnimationend:k},W(c.value),35)):Q("",!0)],2))}}),[["__scopeId","data-v-fd79037c"]]);function $t(e,n,t){return E({name:e,inheritAttrs:!1,setup(e,{attrs:o,slots:l}){var r,i;const s=rt(),c=tt(),d=ot(),f="undefined"!=typeof window&&1===(null==(i=null==(r=ee())?void 0:r.vnode.el)?void 0:i.nodeType),m=G("undefined"==typeof window||f||!d.value),h=$(null);let v=null;function p(e){const n=e&&"$el"in e?e.$el:e;h.value=n instanceof HTMLElement?n:null}return"undefined"!=typeof window&&X([h,d],([e,n],t,o)=>{if(null==v||v.destroy(),v=null,!n||m.value)return void(m.value=!0);if(!e)return;let l=!0;const r=s(e,{rootMargin:null==c?void 0:c.value.heavyBlockMargin,allowIdle:!1});v=r,m.value=r.isVisible.value,r.whenVisible.then(()=>{l&&v===r&&(m.value=!0)}),o(()=>{l=!1,r.destroy(),v===r&&(v=null)})},{immediate:!0}),te(()=>{null==v||v.destroy(),v=null}),()=>j(m.value?n:t,u(a({},o),{ref:p}),l)}})}At.install=e=>{e.component(At.__name,At)};const Rt=E({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","codeBlockOptions","showLineNumbers","theme","darkTheme","lightTheme","isShowPreview","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:n}){const t=e;return()=>{var e,o,l,r,i,s,c;const d=Oe(String(null!=(o=null==(e=t.node)?void 0:e.language)?o:"")),f=Te[d]||(d?d.charAt(0).toUpperCase()+d.slice(1):Te[""]),m=xt(t.node),h=St(String(null!=(r=null==(l=t.node)?void 0:l.raw)?r:""),f,m),v=null!=(i=t.codeBlockOptions)?i:{},p=m&&(null!=(s=t.estimatedDiffInline)?s:kt(v)),g=!0===t.isDark,y="number"==typeof v.fontSize&&Number.isFinite(v.fontSize)&&v.fontSize>0?v.fontSize:12,k="number"==typeof v.lineHeight&&Number.isFinite(v.lineHeight)&&v.lineHeight>0?v.lineHeight:12===y?18:Math.max(12,Math.round(1.5*y)),N="number"==typeof v.tabSize&&Number.isFinite(v.tabSize)&&v.tabSize>0?v.tabSize:4,b=m?0:8,x="number"==typeof v.padding&&Number.isFinite(v.padding)&&v.padding>=0?v.padding:b,S=x,w=x,M="string"==typeof v.fontFamily?v.fontFamily.trim():"",C="number"==typeof v.maxHeight&&Number.isFinite(v.maxHeight)&&v.maxHeight>0?v.maxHeight:500,_=!m&&"number"==typeof t.estimatedContentHeightPx&&Number.isFinite(t.estimatedContentHeightPx)?Math.min(C,Math.ceil(t.estimatedContentHeightPx)):C,B=null!=(c=t.showLineNumbers)?c:!0!==v.disableLineNumbers,I=a(a({fontSize:`${y}px`,lineHeight:`${k}px`,tabSize:N,paddingTop:`${S}px`,paddingBottom:`${w}px`,maxHeight:`${_}px`,overflow:"auto",whiteSpace:"scroll"===v.overflow?"pre":"pre-wrap","--markstream-pre-line-number-top":`${S}px`},m?{"--markstream-pre-diff-line-height":`${k}px`}:{}),M?{"--markstream-code-font-family":M,fontFamily:M}:{}),O=()=>j("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[j("svg",{class:"action-icon",width:"14",height:"14"})]),T=!1!==t.isShowPreview&&("html"===d||"svg"===d),L=!1!==t.showFontSizeButtons&&!1!==t.enableFontSizeControl||!1!==t.showExpandButton||T&&!1!==t.showPreviewButton,H=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},A=a(a(a({"--markstream-code-layout-character-width":"1ch"},H(t.minWidth)?{minWidth:H(t.minWidth)}:{}),H(t.maxWidth)?{maxWidth:H(t.maxWidth)}:{}),m?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--markstream-code-fallback-bg, var(--code-bg, #fff))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return j("div",u(a({},n),{class:["code-block-container","rounded-lg","border",{dark:!0===t.isDark,"is-rendering":!1!==t.loading,"is-dark":g,"is-diff":m,"is-plain-text":""===d||"plaintext"===d||"text"===d},n.class],style:[A,n.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":t.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[!1===t.showHeader?null:j("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[j("div",{class:"code-header-main",style:{minWidth:0,flex:"1 1 auto",display:"flex",alignItems:"center",gap:"var(--ms-gap-header-main, 0.625rem)",overflow:"hidden"}},[j("span",{class:"icon-slot h-4 w-4 flex-shrink-0","aria-hidden":"true",style:{display:"inline-flex",width:"1rem",height:"1rem",flex:"0 0 auto"}}),j("div",{class:"code-header-copy",style:{minWidth:0,display:"grid",gap:"2px"}},[j("div",{class:"code-header-title",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--ms-text-label, 0.75rem)",fontWeight:"500",color:"var(--code-action-fg)"}},h.title),h.caption?j("div",{class:"code-header-caption",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.75rem",color:"var(--code-line-number)"}},h.caption):null])]),j("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[m?j("div",{class:"code-diff-stats","aria-hidden":"true"},[j("span",{class:"code-diff-stat removed"},"-0"),j("span",{class:"code-diff-stat added"},"+0")]):null,!1===t.showCopyButton?null:O(),!1===t.showCollapseButton?null:O(),L?j("div",{class:"relative"},[O()]):null])]),j("div",{class:"code-block-shell-content",style:!1!==t.stream||!1===t.loading?void 0:{display:"none"}},[j(Ht,{node:t.node,loading:t.loading,showLineNumbers:B,reservedHeightPx:m||null==t.estimatedContentHeightPx?void 0:Math.min(t.estimatedContentHeightPx,C),diffInline:p,diffHideUnchangedRegions:m?yt(v):void 0,class:"code-pre-fallback",style:I,"data-markstream-code-loading":"1"})]),j("div",{class:"code-loading-placeholder",style:!1===t.stream&&!1!==t.loading?void 0:{display:"none"}},[j("div",{class:"loading-skeleton"},[j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line"}),j("div",{class:"skeleton-line short"})])]),j("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),Pt=$t("ViewportDeferredCodeBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load the enhanced CodeBlockNode chunk; falling back to preformatted code rendering. Enhanced code blocks require the optional "stream-diffs" peer.',e),Ht}}),loadingComponent:Rt,delay:0,suspensible:!1}),Rt),Et=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(At,u(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{return yield Ae(),(yield import("./index6.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var n,t,o,l;return j(At,u(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Ft=re(()=>s(null,null,function*(){try{return yield Ae(),(yield import("./index5.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t,o,l;return j(At,u(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Kt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),K("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},W(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Kt.install=e=>{e.component(Kt.__name,Kt)};const zt={class:"superscript-node"},Wt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,emphasis:ro,footnote_reference:cn,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,emoji:an,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("sup",zt,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);Wt.install=e=>{e.component(Wt.__name,Wt)};const jt={class:"subscript-node"},Dt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,emphasis:ro,footnote_reference:cn,strikethrough:Gt,highlight:oo,insert:no,superscript:Wt,emoji:an,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("sub",jt,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);Dt.install=e=>{e.component(Dt.__name,Dt)};const Vt={class:"strong-node"},qt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,emphasis:ro,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,superscript:Wt,emoji:an,footnote_reference:cn,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("strong",Vt,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);qt.install=e=>{e.component(qt.__name,qt)};const Ut={class:"strikethrough-node"},Gt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,emphasis:ro,highlight:oo,insert:no,subscript:Dt,superscript:Wt,emoji:an,footnote_reference:cn,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("del",Ut,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);Gt.install=e=>{e.component(Gt.__name,Gt)};const Xt=["href","title","aria-label","aria-hidden","target","rel"],Yt=["aria-hidden"],Jt={class:"link-text-wrapper relative inline-flex"},Zt={class:"leading-[normal] link-text"},Qt=/* @__PURE__ */on(/* @__PURE__ */E({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=P(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=P(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(s["--link-color"]=n.color),s}),r=Je(()=>n.customId),i=P(()=>a({text:At,strong:qt,strikethrough:Gt,emphasis:ro,image:ht,html_inline:Sn,inline_code:Cn},r.value)),u=U(),s=P(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const l={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(l[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,r]of Object.entries(o))n&&null!=r&&!1!==r&&(l[n]=!0===r?"":String(r));return mn(l,"safe","a")}),c=P(()=>a(a({},u),s.value)),d=P(()=>{var e,t;return mn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=P(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(S(d.value)?"_blank":void 0)}),m=P(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=P(()=>{if(!d.value)return;const e=c.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),v=P(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&jn()}const g=P(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(F(),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",Jt,[z("span",Zt,[V(q(At),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(a=e.node.text)?a:""),raw:String(null!=(s=e.node.text)?s:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),r[1]||(r[1]=z("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Yt)):(F(),K("a",ue({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";Wn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),K(J,null,de(e.node.children,(t,o)=>(F(),ie(q(pt),{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,Xt))}}}),[["__scopeId","data-v-367e6ca4"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo={class:"insert-node"},no=/* @__PURE__ */on(/* @__PURE__ */E({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,emphasis:ro,strikethrough:Gt,highlight:oo,subscript:Dt,superscript:Wt,emoji:an,footnote_reference:cn,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("ins",eo,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);no.install=e=>{e.component(no.__name,no)};const to={class:"highlight-node"},oo=/* @__PURE__ */on(/* @__PURE__ */E({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,emphasis:ro,strikethrough:Gt,insert:no,subscript:Dt,superscript:Wt,emoji:an,footnote_reference:cn,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("mark",to,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo={class:"emphasis-node"},ro=/* @__PURE__ */on(/* @__PURE__ */E({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:At,inline_code:Cn,link:Qt,html_inline:Sn,strong:qt,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,superscript:Wt,emoji:an,footnote_reference:cn,math_inline:Et,reference:Kt},t.value));return(t,l)=>(F(),K("em",lo,[(F(!0),K(J,null,de(e.node.children,(t,l)=>(F(),ie(q(pt),{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"]]);ro.install=e=>{e.component(ro.__name,ro)};const io={class:"hard-break"},ao=/* @__PURE__ */on(/* @__PURE__ */E({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),K("br",io))}),[["__scopeId","data-v-50c58f70"]]);ao.install=e=>{e.component(ao.__name,ao)};const uo=/* @__PURE__ */E({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=he({checkbox:ln,checkbox_input:ln,emoji:an,emphasis:ro,hardbreak:ao,highlight:oo,inline_code:Cn,insert:no,link:Qt,reference:Kt,strikethrough:Gt,strong:qt,subscript:Dt,superscript:Wt,text:At}),o=Je(()=>n.customId),l=P(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),K(J,null,de(e.nodes,(t,o)=>(F(),ie(q(pt),{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 so(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(so)}function co(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(so))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(so)?l:null}function fo(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 mo=["cite"],ho={key:0,dir:"auto",class:"paragraph-node"},vo=["custom-id"],po=/* @__PURE__ */on(/* @__PURE__ */E({__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=P(()=>Boolean(t.value.paragraph)),l=P(()=>Boolean(t.value.text)),r=P(()=>co(n.node.children,!o.value)),i=P(()=>!1!==n.fade||l.value?null:fo(r.value));return ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade)),(t,o)=>(F(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),K("p",ho,[null!==i.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(i.value),9,vo)):(F(),ie(q(uo),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),ie(q(pa),{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,mo))}}),[["__scopeId","data-v-abfecebc"]]);po.install=e=>{e.component(po.__name,po)};const go={class:"definition-list"},yo={class:"definition-term"},ko={class:"definition-desc"},No=/* @__PURE__ */on(/* @__PURE__ */E({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(F(),K("dl",go,[(F(!0),K(J,null,de(n.node.items,(o,l)=>(F(),K(J,{key:l},[z("dt",yo,[V(q(pa),{"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",ko,[V(q(pa),{"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"]]);No.install=e=>{e.component(No.__name,No)};const bo=["href","title"],xo=/* @__PURE__ */on(/* @__PURE__ */E({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth",block:"center"})}return(n,o)=>(F(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,bo))}}),[["__scopeId","data-v-e1eb37b6"]]);xo.install=e=>{e.component(xo.__name,xo)};const So=["id"],wo={class:"flex-1"},Mo=/* @__PURE__ */E({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(F(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",wo,[V(q(pa),{"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,So))}});Mo.install=e=>{e.component(Mo.__name,Mo)};const Co=["custom-id"],_o=/* @__PURE__ */on(/* @__PURE__ */E({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=R("markstreamFade",void 0),l=P(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:fo(n.node.children)),r=P(()=>a({text:At,inline_code:Cn,link:Qt,image:ht,strong:qt,emphasis:ro,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,superscript:Wt,emoji:an,checkbox:ln,checkbox_input:ln,footnote_reference:cn,hardbreak:ao,math_inline:Et,reference:Kt},t.value));return(t,o)=>(F(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:se(()=>[null!==l.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(l.value),9,Co)):(F(!0),K(J,{key:1},de(e.node.children,(t,o)=>(F(),ie(q(pt),{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"]]),Bo=_o;Bo.install=e=>{e.component(_o.__name,_o)};const Io={key:0,dir:"auto",class:"paragraph-node"},Oo=["custom-id"],To={dir:"auto",class:"paragraph-node"},Lo=["custom-id"],Ho=/* @__PURE__ */on(/* @__PURE__ */E({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Je(()=>n.customId),l=P(()=>Boolean(o.value.paragraph)),r=P(()=>Boolean(o.value.text)),i=P(()=>{var e;return co(null==(e=t.value)?void 0:e.children,!l.value)}),a=P(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=co([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=P(()=>u()?fo(i.value):null),c=P(()=>{var e;return u()?fo(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=P(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade)),(e,o)=>{var l,r;return F(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(F(),K("p",Io,[null!==s.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(s.value),9,Oo)):(F(),ie(q(uo),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(F(),K(J,{key:1},[z("p",To,[null!==c.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(c.value),9,Lo)):(F(),ie(q(uo),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(F(!0),K(J,null,de(a.value.nestedLists,(t,l)=>(F(),ie(q(pa),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(F(),ie(q(pa),{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"]]);Ho.install=e=>{e.component(Ho.__name,Ho)};const Ao=/* @__PURE__ */on(/* @__PURE__ */E({__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=P(()=>n.value.list_item||Ho);return(n,o)=>(F(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:se(()=>[(F(!0),K(J,null,de(e.node.items,(l,r)=>{var i;return F(),ie(ae(t.value),ue({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);Ao.install=e=>{e.component(Ao.__name,Ao)};const $o={key:2,class:"html-block-node__raw"},Ro=["innerHTML"],Po={key:1,class:"html-block-node__placeholder"},Eo=/* @__PURE__ */on(/* @__PURE__ */E({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=R("markstreamNestedRendererProps",void 0),l=P(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=P(()=>{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(()=>ga),suspensible:!1}),s=P(()=>{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=P(()=>{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=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=G(null),p=G("undefined"==typeof window),g=G(n.node.content),y=P(()=>Array.isArray(n.node.children)?n.node.children:[]),N=P(()=>String(n.node.tag||"div")),x=P(()=>{var e;if("details"!==N.value.trim().toLowerCase())return null;if(null==(e=n.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const t=y.value[0];return"html_block"===(null==t?void 0:t.type)&&"summary"===String(t.tag||"").toLowerCase()?t:null}),S=P(()=>{var e;return fo(null==(e=x.value)?void 0:e.children)}),M=P(()=>{const e=x.value;if(!e)return;const n=h(e.attrs,l.value,"summary");if(!n)return;const t=v(n);return Object.keys(t).length>0?t:void 0}),C=P(()=>null==S.value?y.value:y.value.slice(1)),_=P(()=>{const e=N.value.trim().toLowerCase();return w.has(e)||k(e,l.value)}),B=P(()=>y.value.length>0&&!!n.node.tag&&!_.value),I=P(()=>{var e,t,o;if(B.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:null!=(e=g.value)?e:""};const r=null!=(t=g.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if("escape"===l.value)return{mode:"html",content:b(r,l.value)};if(n.node.loading){const e=bn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!Nn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=bn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),O=rt(),T=tt(),L=ot(),H=$(null),A=!!n.node.loading;return"undefined"!=typeof window?(X([()=>m.value,()=>null==T?void 0:T.value.heavyBlockMargin,()=>null==T?void 0:T.value.rootMargin],([e],t,o)=>{var l,r,i,a;if(null==(r=null==(l=H.value)?void 0:l.destroy)||r.call(l),H.value=null,!A)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);let u=!0;const s=null!=(a=null!=(i=null==T?void 0:T.value.heavyBlockMargin)?i:null==T?void 0:T.value.rootMargin)?a:nt,c=O(e,{rootMargin:s,allowIdle:!L.value});H.value=c,p.value=p.value||c.isVisible.value,c.whenVisible.then(()=>{u&&H.value===c&&(p.value=!0)}),o(()=>{u=!1,c.destroy(),H.value===c&&(H.value=null)})},{immediate:!0}),X(()=>n.node.content,e=>{A&&!p.value||(g.value=e)})):p.value=!0,te(()=>{var e,n;null==(n=null==(e=H.value)?void 0:e.destroy)||n.call(e),H.value=null}),(n,t)=>(F(),ie(ae(B.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node","data-markstream-viewport-pending":q(L)&&!p.value?"true":void 0},B.value?c.value:void 0),{default:se(()=>[p.value?(F(),K(J,{key:0},["structured"===I.value.mode?(F(),K(J,{key:0},[null!==S.value?(F(),K(J,{key:0},[z("summary",ve(pe(M.value)),W(S.value),17),C.value.length?(F(),ie(q(i),ue({key:0},r.value,{nodes:C.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Q("",!0)],64)):(F(),ie(q(i),ue({key:1},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===I.value.mode?(F(),ie(q(f),{key:1,nodes:I.value.nodes},null,8,["nodes"])):"text"===I.value.mode?(F(),K("pre",$o,W(I.value.content),1)):(F(),K("div",ue({key:3},s.value,{innerHTML:I.value.content}),null,16,Ro))],64)):(F(),K("div",Po,[oe(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,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Eo.install=e=>{e.component(Eo.__name,Eo)};const Fo={dir:"auto",class:"paragraph-node"},Ko=["custom-id"],zo=/* @__PURE__ */on(/* @__PURE__ */E({__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=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=P(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=P(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=P(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=P(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})}),v=re({loader:()=>Promise.resolve().then(()=>ga),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=P(()=>n.node.children.filter(e=>!p(e))),y=P(()=>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=P(()=>new Set(M(m.value))),N=P(()=>{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=P(()=>!1===(null==l?void 0:l.value)&&!t.value.text),x=P(()=>b.value?fo(N.value):null);function S(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":m.value}}const w=P(()=>a({inline_code:Cn,image:ht,link:Qt,hardbreak:ao,emphasis:ro,strong:qt,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,superscript:Wt,html_inline:Sn,html_block:Eo,emoji:an,checkbox:ln,math_inline:Et,checkbox_input:ln,reference:Kt,footnote_anchor:xo,footnote_reference:cn,text:At},t.value)),B=P(()=>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:At,isCustomComponent:!1}}}return{child:e,component:w.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!qe(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?pn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(F(),K("p",Fo,[null!==x.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(x.value),9,Ko)):(F(!0),K(J,{key:1},de(B.value,e=>{return F(),K(J,{key:e.key},[y.value&&p(e.originalChild)?(F(),K(J,{key:0},[Z(W((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:se(()=>[e.hasSlotChildren?(F(),ie(q(v),ue({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(q(v),ue({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(F(),ie(ae(e.component),ue({key:2,ref_for:!0},S(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);zo.install=e=>{e.component(zo.__name,zo)};const Wo={class:"table-node-wrapper"},jo=["aria-busy"],Do={key:0},Vo=["custom-id"],qo=["aria-label","onPointerdown"],Uo=["custom-id"],Go={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Xo=/* @__PURE__ */on(/* @__PURE__ */E({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node.loading)&&e}),o=P(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=G(null),r=G([]);let i=null;const a=P(()=>n.node.header.cells.length),u=P(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=P(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade));const c=Je(()=>n.customId),d=P(()=>Boolean(c.value.text)),f=P(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=co(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?fo(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 X(a,()=>{p(),r.value=[]}),te(p),(a,c)=>(F(),K("div",Wo,[z("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),K("colgroup",Do,[(F(!0),K(J,null,de(e.node.header.cells,(e,n)=>(F(),K("col",{key:n,style:ce(s.value[n])},null,4))),128))])):Q("",!0),z("thead",null,[z("tr",null,[(F(!0),K(J,null,de(e.node.header.cells,(t,o)=>(F(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(t).plainText),9,Vo)):h(t).simpleChildren?(F(),ie(q(uo),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(pa),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(F(),K("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,qo)):Q("",!0)],2))),128))])]),z("tbody",null,[(F(!0),K(J,null,de(o.value,(e,t)=>(F(),K("tr",{key:t},[(F(!0),K(J,null,de(e.cells,(e,o)=>(F(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(e).plainText),9,Uo)):h(e).simpleChildren?(F(),ie(q(uo),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(pa),{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,jo),V(ge,{name:"table-node-fade"},{default:se(()=>[t.value?(F(),K("div",Go,[oe(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)])):Q("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);Xo.install=e=>{e.component(Xo.__name,Xo)};const Yo={class:"hr-node"},Jo=/* @__PURE__ */on({},[["render",function(e,n){return F(),K("hr",Yo)}],["__scopeId","data-v-39b2349c"]]);Jo.install=e=>{e.component(Jo.__name,Jo)};const Zo={class:"unknown-node"},Qo=/* @__PURE__ */E({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),K("div",Zo,W(e.node.raw),1))}),el=/* @__PURE__ */on(/* @__PURE__ */E({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=P(()=>`vmr-container vmr-container-${n.node.name}`),o=Je(()=>n.customId),l=P(()=>a({text:At,paragraph:zo,heading:Bo,inline_code:Cn,link:Qt,image:ht,strong:qt,emphasis:ro,strikethrough:Gt,insert:no,subscript:Dt,superscript:Wt,checkbox:ln,checkbox_input:ln,hardbreak:ao,math_inline:Et,reference:Kt,list:Ao,math_block:Ft,table:Xo},o.value));return(o,r)=>(F(),K("div",ue({class:t.value},e.node.attrs),[(F(!0),K(J,null,de(e.node.children,(t,o)=>{return F(),ie(ae((r=t.type,l.value[r]||Qo)),{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"]]);el.install=e=>{e.component(el.__name,el)};const nl=["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"],tl=[[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 ol(e){if(e<=255)return nl[e];let n=0,t=tl.length-1;for(;n<=t;){const o=n+t>>1,l=tl[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const ll=/[ \t\n\r\f]+/g,rl=/[\t\n\r\f]| {2,}|^ | $/;let il=null;const al=new RegExp("\\p{Script=Arabic}","u"),ul=new RegExp("\\p{M}","u"),sl=new RegExp("\\p{Nd}","u");function cl(e){return al.test(e)}function dl(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function fl(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(dl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(dl(t))return!0}}return!1}const ml=/* @__PURE__ */new Set([" "," ","","\ufeff"]),hl=/* @__PURE__ */new Set(["-","‐","–","—"]);function vl(e,n){return!(function(e){const n=Bl(e);return null!==n&&ml.has(n)}(e)||n&&(function(e){const n=Bl(e);return null!==n&&(pl.has(n)||kl.has(n))}(e)||function(e){const n=Bl(e);return null!==n&&hl.has(n)}(e)))}const pl=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),gl=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),yl=/* @__PURE__ */new Set(["'","’"]),kl=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Nl=/* @__PURE__ */new Set([":",".","،","؛"]),bl=/* @__PURE__ */new Set(["၏"]),xl=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Sl(e){if(Cl(e))return!0;let n=!1;for(const t of e)if(kl.has(t)||Ol(t))n=!0;else if(!n||!ul.test(t))return!1;return n}function wl(e){for(const n of e)if(!pl.has(n)&&!kl.has(n))return!1;return e.length>0}function Ml(e){if(Cl(e))return!0;for(const n of e)if(!(gl.has(n)||yl.has(n)||ul.test(n)||Ol(n)))return!1;return e.length>0}function Cl(e){let n=!1;for(const t of e)if("\\"!==t&&!ul.test(t)){if(!(gl.has(t)||kl.has(t)||yl.has(t)))return!1;n=!0}return n}function _l(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 Bl(e){if(0===e.length)return null;const n=_l(e,e.length);return e.slice(n)}const Il=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Ol(e){const n=e.codePointAt(0);return void 0!==n&&function(e,n){for(let t=0;t<n.length;t+=2)if(e>=n[t]&&e<=n[t+1])return!0;return!1}(n,Il)}function Tl(e){const n=function(e){for(const n of e)if(!ul.test(n))return n;return null}(e);return null!==n&&sl.test(n)}function Ll(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(ul.test(e))t--;else{if(!gl.has(e)&&!yl.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Hl(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 $l(e,n){return e&&null!==n&&Nl.has(n)}function Rl(e){const n=Bl(e);return null!==n&&bl.has(n)}function Pl(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 El(e){let n=e.length;for(;n>0;){const t=_l(e,n),o=e.slice(t,n);if(xl.has(o))return!0;if(!kl.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 Kl=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function zl(e){return 1===e.length?e[0]:e.join("")}function Wl(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),zl(t)}function jl(e,n,t,o){if(!Kl.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:zl(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:zl(i),isWordLike:u,kind:r,start:a}),l}function Dl(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const Vl=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function ql(e,n){const t=e.texts[n];return!!t.startsWith("www.")||Vl.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Ul(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Gl=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Xl=/[\p{P}\p{S}\p{Co}]/u,Yl=new RegExp("\\p{Emoji_Presentation}","u"),Jl=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function Zl(e){const n=e.charCodeAt(0);return n<128?function(e){return e>=33&&e<=47&&45!==e||e>=58&&e<=64&&63!==e||e>=91&&e<=96||e>=123&&e<=126}(n):!Jl.has(e)&&!Yl.test(e)&&Xl.test(e)}function Ql(e){let n=!1;for(const t of e)if(!ul.test(t)){if(!Zl(t))return!1;n=!0}return n}function er(e,n,t,o){const l=!n&&Ql(e),r=!o&&Ql(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=_l(e,n),o=e.slice(t,n);if(!ul.test(o))return o;n=t}return null}(e);return null!==n&&Ol(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=_l(e,n),o=e.slice(t,n);if(!ul.test(o))return Zl(o)||Ol(o);n=t}return!1}(e);return!!(l||r||a)&&!fl(e)&&!fl(t)&&(n||l||i)&&(o||r)}function nr(e){for(const n of e)if(sl.test(n))return!0;return!1}function tr(e){if(0===e.length)return!1;for(const n of e)if(!sl.test(n)&&!Gl.has(n))return!1;return!0}function or(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}function lr(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e}(e):function(e){if(!rl.test(e))return e;let n=e.replace(ll," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i=function(e,n,t){var o,l,r;const i=(null===il&&(il=new Intl.Segmenter(void 0,{granularity:"word"})),il);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const w of i.segment(e))for(const e of jl(w.segment,null!=(o=w.isWordLike)&&o,w.index,t)){let t=function(){null!==m[w]&&(s[w]=[Al(u,m,h,w)],m[w]=null),s[w].push(e.text),c[w]=c[w]||e.isWordLike,v[w]=v[w]||i,p[w]=p[w]||N,g[w]=x,y[w]=S,k[w]=$l(p[w],b)};const o="text"===e.kind,r=Hl(e.text,e.isWordLike,e.kind),i=fl(e.text),N=cl(e.text),b=Bl(e.text),x=El(e.text),S=Rl(e.text),w=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[w]&&i&&v[w]&&g[w]||o&&a>0&&"text"===d[w]&&wl(e.text)&&v[w]||o&&a>0&&"text"===d[w]&&y[w]?t():o&&a>0&&"text"===d[w]&&e.isWordLike&&N&&k[w]?(t(),c[w]=!0):null!==r&&a>0&&"text"===d[w]&&m[w]===r?h[w]=(null!=(l=h[w])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[w]&&!v[w]&&(Sl(e.text)||"-"===e.text&&c[w])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=N,g[a]=x,y[a]=S,k[a]=$l(N,b),a++)}for(let w=0;w<a;w++)null===m[w]?u[w]=zl(s[w]):u[w]=Al(u,m,h,w);for(let w=1;w<a;w++)"text"!==d[w]||c[w]||!Cl(u[w])||"text"!==d[w-1]||v[w-1]||(u[w-1]+=u[w],c[w-1]=c[w-1]||c[w],u[w]="");const N=Array.from({length:a},()=>null);let b=-1;for(let w=a-1;w>=0;w--){const e=u[w];if(0!==e.length){if("text"===d[w]&&!c[w]&&b>=0&&"text"===d[b]&&(Ml(e)||"-"===e&&Tl(u[b]))){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[w],u[w]="";continue}b=w}}for(let w=0;w<a;w++){const e=N[w];null!=e&&(u[w]=Wl(e,u[w]))}let x=0;for(let w=0;w<a;w++){const e=u[w];0!==e.length&&(x!==w&&(u[x]=e,c[x]=c[w],d[x]=d[w],f[x]=f[w]),x++)}u.length=x,c.length=x,d.length=x,f.length=x;const S=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(!fl(n[r])||!fl(n[r+1]))continue;const e=Ll(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a){const a=[i];let s=r+1,c=u;for(;s<e.len&&"text"===e.kinds[s]&&er(e.texts[s-1],e.isWordLike[s-1],e.texts[s],e.isWordLike[s]);){const n=e.texts[s];a.push(n),c=c||e.isWordLike[s],s++}if(s>r+1){n.push(zl(a)),t.push(c),o.push("text"),l.push(e.starts[r]),r=s;continue}}n.push(i),t.push(u),o.push(a),l.push(e.starts[r]),r++}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&nr(n)&&tr(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&&tr(i)&&nr(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&tr(e.texts[u]);)a.push(e.texts[u]),u++;n.push(zl(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]),!Ul(i))continue;const a=r+1;if(a>=e.len||Dl(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!Dl(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(zl(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]||!ql(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Dl(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]=zl(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=zl(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=zl(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(zl(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:x,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let w=0;w<S.len-1;w++){const e=Pl(S.texts[w]);null!==e&&("space"!==S.kinds[w]&&"preserved-space"!==S.kinds[w]||"text"!==S.kinds[w+1]||!cl(S.texts[w+1])||(S.texts[w]=e.space,S.isWordLike[w]=!1,S.kinds[w]="preserved-space"===S.kinds[w]?"preserved-space":"space",S.texts[w+1]=e.marks+S.texts[w+1],S.starts[w+1]=S.starts[w]+e.space.length))}return S}(r,n,l),u="keep-all"===o?function(e,n,t){if(n.len<=1)return n;const o=[],l=[],r=[],i=[];let a=-1,u=!1;function s(e){o.push(n.texts[e]),l.push(n.isWordLike[e]),r.push("text"),i.push(n.starts[e])}function c(t){if(!(a<0)){if(u)a+1===t?s(a):function(t,a){let u=!1;for(let e=t;e<a;e++)u=u||n.isWordLike[e];const s=n.starts[t],c=a<n.len?n.starts[a]:e.length;o.push(e.slice(s,c)),l.push(u),r.push("text"),i.push(s)}(a,t);else for(let e=a;e<t;e++)s(e);a=-1,u=!1}}for(let d=0;d<n.len;d++){const e=n.texts[d],s=n.kinds[d];"text"!==s?(c(d),o.push(e),l.push(n.isWordLike[d]),r.push(s),i.push(n.starts[d])):(a>=0&&!vl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||fl(e))}return c(n.len),{len:o.length,texts:o,isWordLike:l,kinds:r,starts:i}}(r,i,n.breakKeepAllAfterPunctuation):i;return a({normalized:r,chunks:or(u,l)},u)}let rr=null;const ir=/* @__PURE__ */new Map;let ar=null;const ur=new RegExp("\\p{Emoji_Presentation}","u"),sr=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let cr=null;const dr=/* @__PURE__ */new Map;function fr(){if(null!==rr)return rr;if("undefined"!=typeof OffscreenCanvas)return rr=new OffscreenCanvas(1,1).getContext("2d"),rr;if("undefined"!=typeof document)return rr=document.createElement("canvas").getContext("2d"),rr;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function mr(e,n){let t=n.get(e);return void 0===t&&(t={width:fr().measureText(e).width,containsCJK:fl(e)},n.set(e,t)),t}function hr(){if(null!==ar)return ar;if("undefined"==typeof navigator)return ar={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ar;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 ar={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},ar}function vr(){return null===cr&&(cr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),cr}function pr(e){return ur.test(e)||e.includes("️")}function gr(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=vr();for(const o of t.segment(e))pr(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function yr(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function kr(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Nr(e,n,t=e.widths.length){for(;n<t&&yr(e.kinds[n]);)n++;return n}function br(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function xr(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function Sr(e,n){return 0===n?0:e+n}function wr(e,n,t,o,l){return Sr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function Mr(e,n,t,o){return Sr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function Cr(e,n,t,o,l){return Sr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function _r(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function Br(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function Ir(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Or(e,n){return function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r}=e;if(0===t.length)return 0;const i=n+hr().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){var t;const o=l[e],a=null!=(t=r[e])?t:null;let f=null===a?-1:Ir(a,0,n+1),m=-1,v=0,g=n;for(;g<o.length;){const t=o[g];if(s)if(u+t>i){if(null!==a&&m>n){h(e,m,v),g=m,f=Ir(a,f,g+1),m=-1,v=0;continue}h(),p(e,g,t)}else u+=t,c=e,d=g+1;else p(e,g,t);const l=g+1;null!==a&&a[f]===l&&(m=l,v=u,f++),g++}s&&c===e&&d===o.length&&(c=e+1,d=0)}let k=0;for(;k<t.length&&(s||(k=Nr(e,k),!(k>=t.length)));){const e=t[k],n=kr(o[k]);if(s)if(u+e>i){if(n){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>i&&null!==l[k]){h(),y(k,0),k++;continue}h()}else g(k,e),n&&(f=k+1,m=u-e),k++;else e>i&&null!==l[k]?y(k,0):v(k,e),n&&(f=k+1,m=u-e),k++}return s&&h(),a}(e,n);const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r,discretionaryHyphenWidth:i,chunks:a}=e;if(0===t.length||0===a.length)return 0;const u=hr(),s=n+u.lineFitEpsilon;let c=0,d=0,f=!1,m=0,h=0,v=-1,p=0,g=0,y=null;function k(){v=-1,p=0,g=0,y=null}function N(e=m,n=h,t){c++,d=0,f=!1,k()}function b(e,n){f=!0,m=e+1,h=0,d=n}function x(e,n,t){f=!0,m=e,h=n+1,d=t}function S(e,n){f?(d+=n,m=e+1,h=0):b(e,n)}function w(n,t,o,l,r,i){if(!t)return;const a=Mr(e,n,o,r),u=Cr(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function M(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:Ir(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=_r(e,!0,o),r=d+l;if(Br(e,r)>s){if(null!==a&&c>t){N(n,c),v=c,u=Ir(a,u,v+1),c=-1;continue}N(),x(n,v,o)}else d=r,m=n,h=v+1}else x(n,v,o);const l=v+1;null!==a&&a[u]===l&&(c=l,u++),v++}f&&m===n&&h===i.length&&(m=n+1,h=0)}function C(e){c++,k()}for(let _=0;_<a.length;_++){const n=a[_];if(n.startSegmentIndex===n.endSegmentIndex){C();continue}f=!1,d=0,n.startSegmentIndex,m=n.startSegmentIndex,h=0,k();let r=n.startSegmentIndex;for(;r<n.endSegmentIndex&&(f||(r=Nr(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=kr(n),c=xr(e,f,r),k="tab"===n?br(d+c,e.tabStopAdvance):t[r],x=c+k,C=wr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+Mr(e,n,r,c);if(Cr(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){N(v,0);continue}if(a&&t<=s){S(r,x),N(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){N();continue}const e=v;N(e,0),r=e;continue}if(C>s&&null!==l[r]){N(),M(r,0),r++;continue}N();continue}S(r,x),w(n,a,r,k,c,x),r++}else C>s&&null!==l[r]?M(r,0):b(r,k),w(n,a,r,k,c,x),r++;else f&&(m=r+1,h=0,v=r+1,p=d+i,g=d+i,y=n),r++}f&&(n.consumedEndSegmentIndex,N(n.consumedEndSegmentIndex,0))}return c}(e,n)}let Tr=null;function Lr(){return null===Tr&&(Tr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Tr}function Hr(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=El(e),a=gl.has(e)}function c(e,n){o.push(e),r=r||n;const t=El(e);i=1===e.length&&kl.has(e)&&i||t,a=!1}for(const d of Lr().segment(e)){const e=d.segment,t=fl(e);0!==o.length?a||pl.has(e)||kl.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 Ar(e,n,t){if(n.length<=1)return n;const o=[];let l=-1,r=!1;function i(t){if(!(l<0)){if(r)l+1===t?o.push(n[l]):function(t,l){const r=n[t].start,i=l<n.length?n[l].start:e.length;o.push({text:e.slice(r,i),start:r})}(l,t);else for(let e=l;e<t;e++)o.push(n[e]);l=-1,r=!1}}for(let a=0;a<n.length;a++){const e=n[a];l>=0&&!vl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||fl(e.text)}return i(n.length),o}function $r(e,n){if("zero-width-break"===n||"soft-hyphen"===n||"hard-break"===n)return 0;if("tab"===n)return 1;let t=0;const o=Lr();for(const l of o.segment(e))t++;return t}function Rr(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function Pr(e,n,t,o,l){const r=hr(),{cache:i,emojiCorrection:a}=function(e,n){fr().font=e;const t=function(e){let n=ir.get(e);return n||(n=/* @__PURE__ */new Map,ir.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=dr.get(e);if(void 0!==t)return t;const o=fr();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 dr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,sr.test(u)));var u;const s=gr("-",mr("-",i),a)+(0===l?0:2*l),c=8*gr(" ",mr(" ",i),a),d=0!==l;if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],m=[],h=[],v=[];let p=e.chunks.length<=1&&!d;const g=t?[]:null,y=[],k=[],N=[],b=t?[]:null,x=Array.from({length:e.len});function S(e,n,t,o,l,r,i,a,u){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(p=!1),f.push(n),m.push(t),h.push(o),v.push(l),null==g||g.push(r),y.push(i),k.push(a),d&&N.push(u),null!==b&&b.push(e)}function w(e,n,t,u,s){const c=mr(e,i),f=d?$r(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(gr(e,c,a),f,l),h="space"===n||"preserved-space"===n||"zero-width-break"===n?0:m,v=0===h?0:h+(f>0?l:0),p="space"===n||"zero-width-break"===n?0:m;if(s&&u&&e.length>1){let u="sum-graphemes";0!==l?u="segment-prefixes":tr(e)?u="pair-context":r.preferPrefixWidthsForBreakableRuns&&(u="segment-prefixes");const s=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances&&n.breakableFitMode===l)return n.breakableFitAdvances;n.breakableFitMode=l;const r=vr(),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=mr(n,t);e.push(gr(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=gr(n,mr(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=mr(i,t);e.push(gr(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=gr(u,mr(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,c,i,a,u),d=null===s||"keep-all"===o?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const n=[];let t=0;for(const o of Lr().segment(e))t++,Rr(o.segment)&&n.push(t);return 0===n.length?null:n}(e);return void S(e,m,v,p,n,t,s,d,f)}S(e,m,v,p,n,t,null,null,f)}for(let _=0;_<e.len;_++){x[_]=f.length;const n=e.texts[_],t=e.isWordLike[_],l=e.kinds[_],a=e.starts[_];if("soft-hyphen"===l){S(n,0,s,s,l,a,null,null,0);continue}if("hard-break"===l){S(n,0,0,0,l,a,null,null,0);continue}if("tab"===l){S(n,0,0,0,l,a,null,null,d?$r(n,l):0);continue}const u=mr(n,i);if("text"===l&&u.containsCJK){const e=Hr(n,r),l="keep-all"===o?Ar(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];w(e.text,"text",a+e.start,t,"keep-all"===o||!fl(e.text))}continue}w(n,l,a,t,!0)}const M=function(e,n,t){const o=[];for(let l=0;l<e.length;l++){const r=e[l],i=r.startSegmentIndex<n.length?n[r.startSegmentIndex]:t,a=r.endSegmentIndex<n.length?n[r.endSegmentIndex]:t,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,x,f.length),C=null===g?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=!1;for(let s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=ol(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,g);return null!==b?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M,segments:b}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M}}const Er="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Fr=["diff ","index ","--- ","+++ ","@@ "],Kr=(()=>{const e=globalThis;if(e[Er])return e[Er];const n={configs:{},controllers:{},revision:$(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Er]=n,n})();let zr=null;const Wr=Kr.revision;function jr(e){var n;return e&&null!=(n=Kr.configs[e])?n:null}function Dr(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function Vr(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function qr(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!Vr(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 Ur(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=zr)return zr;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return zr=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),zr}catch(n){return zr=!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=Kr.blockEstimateCache.get(i);if(a)return Kr.blockEstimateCache.delete(i),Kr.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=Kr.preparedCache.get(o);if(l)return Kr.preparedCache.delete(o),Kr.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){var l,r;const i=null!=(l=null==o?void 0:o.wordBreak)?l:"normal",a=null!=(r=null==o?void 0:o.letterSpacing)?r:0;return Pr(lr(e,hr(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(Kr.preparedCache.set(o,{prepared:r});Kr.preparedCache.size>240;){const e=Kr.preparedCache.keys().next().value;if(!e)break;Kr.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Or(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(Kr.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Kr.blockEstimateCache.size>4e3;){const e=Kr.blockEstimateCache.keys().next().value;if(!e)break;Kr.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function Gr(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=qr(e.children);return o&&t.paragraph?Ur(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=qr(e.children),r=t.headings[o];return l&&r?Ur(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=qr(null==(l=r[0])?void 0:l.children);return i?Ur(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=Gr(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 Xr(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function Yr(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function Jr(e,n){return e.diff?kt({diffStyle:n})?function(e){const n=Yr(e.raw);if(n){const t=n.split(/\r?\n/);return null!=e.originalCode||null!=e.updatedCode?Math.max(1,t.filter(e=>!Fr.some(n=>e.startsWith(n))).length):Math.max(1,t.length)}return Xr(Yr(e.originalCode))+Xr(Yr(e.updatedCode))}(e):function(e){const n=e.originalCode,t=e.updatedCode;if(null!=n||null!=t)return Math.max(Xr(Yr(n)),Xr(Yr(t)));const o=Yr(e.code).split(/\r?\n/);let l=0,r=0;for(const i of o)i.startsWith("+")&&!i.startsWith("+++")?r++:i.startsWith("-")&&!i.startsWith("---")?l++:(l++,r++);return Math.max(1,l,r)}(e):Xr(Yr(e.code,!0===e.loading))}function Zr(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function Qr(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Dr(o.lineHeight,1.5*Dr(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:Zr(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const ei=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function ni(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))ei.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const ti=!1;function oi(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function li(e,n){let t=0,o=null,l=null;const r=()=>{const n=l;l=null,o=null,n&&(t=Date.now(),e(...n))};return function(...i){const a=Date.now(),u=n-(a-t);l=i,u<=0?(o&&(clearTimeout(o),o=null),t=a,l=null,e(...i)):o||(o=setTimeout(r,u))}}function ri(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const ii=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function ai(){return R(ii,null)}const ui=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),si=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function ci(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function di(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 fi(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(ui.has(o))return!0;if(!si.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(fi)}function mi(e){var n,t,o,l,r,i,a,u;if(!e||"object"!=typeof e)return"";const s=e,c=String(null!=(n=s.type)?n:"");if("text"===c)return String(null!=(o=null!=(t=s.content)?t:s.raw)?o:"");if("inline_code"===c)return String(null!=(i=null!=(r=null!=(l=s.code)?l:s.content)?r:s.raw)?i:"");if("emoji"===c)return String(null!=(u=null!=(a=s.name)?a:s.raw)?u:"");if("string"==typeof s.text)return s.text;const d=[];for(const f of["children","items","cells","rows"]){const e=s[f];if(Array.isArray(e)){const n=e.map(mi).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function hi(e){if(!e||"object"!=typeof e)return!1;const n=e;return"inline_code"===n.type||["children","items","cells","rows"].some(e=>{const t=n[e];return Array.isArray(t)&&t.some(hi)})}function vi(e,n){if(!e)return 30;const t=Math.max(18,Math.floor(Math.max(320,n)/8)),o=e.split(/\r?\n/).length,l=Math.ceil(e.length/t),r=Math.max(1,o,l);return 30+26*Math.max(0,r-1)}function pi(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h,v;if(!e||"object"!=typeof e)return 32;const p=e,g=String(null!=(t=p.type)?t:""),y=Number.isFinite(n)&&n>0?n:640;switch(g){case"heading":return function(e){var n;const t=Number(null!=(n=e.level)?n:e.depth);return t>=4?20:3===t?30:2===t?32:44}(p);case"paragraph":return function(e,n){const t=String(null!=e?e:"");if(!t)return 28;const o=Math.max(18,Math.floor(Math.max(320,n)/8)),l=t.split(/\r?\n/).length,r=Math.ceil(t.length/o);return Math.max(1,l,r)<=1?28:di(t,n,34)}(String(null!=(l=null!=(o=p.raw)?o:p.content)?l:""),y);case"list":return function(e,n){var t;const o=Array.isArray(e.items)?e.items:[];if(!o.length)return 48;const l=Math.max(48,30*o.length+12);let r=12;for(const u of o)r+=vi(mi(u)||String(null!=(t=u.raw)?t:""),n);const i=Math.max(0,r-l);if(o.length>20){const e=Math.round(2.4*o.length);return Math.round(l+Math.max(e,Math.min(i,3*o.length)))}if(i<=0)return l;const a=o.length>8?8*o.length:i;return Math.round(l+Math.min(i,a))}(p,y);case"list_item":return di(String(null!=(i=null!=(r=p.raw)?r:p.content)?i:""),y,34);case"blockquote":return di(String(null!=(u=null!=(a=p.raw)?a:p.content)?u:""),y,56);case"table":return function(e,n){const t=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!t.length){const n=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*n+48)}return Math.max(120,Math.round(4+t.reduce((e,t)=>e+function(e,n){const t=Math.max(1,e.length),o=Math.max(80,(n-32)/t),l=Math.max(10,Math.floor(o/8)),r=Math.max(1,...e.map(e=>{var n;const t=mi(e)||String(null!=(n=null==e?void 0:e.raw)?n:"");return Math.ceil(t.length/l)||1}));return 54+34*Math.max(0,r-1)+(t<=3&&e.some(hi)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(p,y);case"code_block":{const e=String(null!=(s=p.language)?s:"").trim().toLowerCase(),n=String(null!=(d=null!=(c=p.code)?c:p.raw)?d:"");return"mermaid"===e?$e(Re(n)):"infographic"===e?Pe(Ee(n)):di(n,y,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return function(e,n){var t,o,l;const r=e.match(/^\s*<details\b([^>]*)>/i);return r&&!/(?:^|\s)open(?:\s|=|$)/i.test(null!=(t=r[1])?t:"")?di((null==(l=null==(o=e.match(/<summary\b[^>]*>([\s\S]*?)<\/summary>/i))?void 0:o[1])?void 0:l.replace(/<[^>]*>/g,"").trim())||"Details",n,28,28):di(e,n,96)}(String(null!=(m=null!=(f=p.raw)?f:p.content)?m:""),y);case"thematic_break":return 24;default:return di(String(null!=(v=null!=(h=p.raw)?h:p.content)?v:""),y,40)}}function gi(e,n,t){return Math.min(Math.max(e,n),t)}const yi=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],ki=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","safeMarkdownMs","tokenizeMs","htmlBlockPassesMs","parseMarkdownToStructureTotalMs"],Ni=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),bi=["raw","content","code","originalCode","updatedCode"],xi=/* @__PURE__ */new WeakMap,Si=/* @__PURE__ */new WeakMap;let wi=1;function Mi(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ci(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function _i(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=xi.get(n);return t||(t=wi++,xi.set(n,t)),String(t)}function Bi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:_i(n),customMarkdownIt:_i(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:_i(e.validateLink),preTransformTokens:_i(e.preTransformTokens),postTransformTokens:_i(e.postTransformTokens),postTransformNodes:_i(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function Ii(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 Oi(e){const n=Ti(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function Ti(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function Li(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 Hi(e){const n=String(null!=e?e:"");return`${n.length}:${Li(n)}`}function Ai(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?Hi(e):`${e.length}:${Li(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${_i(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:${_i(o)}`;const r=_i(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>Ai(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}:${Ai(o[e],n,t+1)}`).join(";")}`}return typeof e}function $i(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function Ri(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>$i(e)?Fi(e,n,t+1):Ri(e,n,t+1)).join(",")}`:$i(e)?Fi(e,n,t):Ai(e,n,t)}function Pi(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!bi.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${Hi(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${_i(l)}`:Ni.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${Ri(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${_i(l)}`:""}).filter(Boolean).join(";")}function Ei(e){return bi.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${Hi(t)}`:""}).filter(Boolean).join(";")}function Fi(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Si.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}:${_i(l)}`;const i=_i(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=>Fi(e,n,t+1)).join("|"):"";return[e.type,Ei(o),Pi(o,n,t),l.length,r].join(":")}(e,n,t);return Si.set(l,a),a}function Ki(e,n){return Fi(e)===Fi(n)}function zi(e,n,t){const o=Mi(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Mi()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Wi(e,n,t){return zi(n,t,()=>Fi(e))}function ji(e,n,t){return Wi(e,t,"stabilizeSignatureMs")===Wi(n,t,"stabilizeSignatureMs")}function Di(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function Vi(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function qi(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e)}function Ui(e,n){return e.length===n.length&&e===n}function Gi(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(!Ui(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(!$i(e)||!$i(n))return null;const o=Gi(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function Xi(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=Gi(e,n);return null!=t?t:Ki(e,n)}function Yi(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return zi(t,"stabilizeSignatureMs",()=>{o=Gi(e,n)}),null!=o?o:ji(e,n,t)}function Ji(e,n){const t={};for(const o of yi){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 Zi(e,n){var t;const o=B(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:P(()=>!1),i=G(n.renderContent.value);let s=[],d="",f="",m="",h=!1;const v=function(){let e="",n=0,t=!1,o=!1,l=!1,r=!1;function i(){e="",n=0,t=!1,o=!1,l=!1,r=!1}function a(e){let i=!1;for(let a=0;a<e.length;a++){const u=e.charCodeAt(a);if(10===u||13===u){const e=10===u&&r;r=13===u,t=!1,e||(l||(o=!1,n=0),l=!1);continue}r=!1;const s=9===u||32===u;if(s||(l=!0,o&&(i=!0)),n)if(1!==n)s||(58!==u?n=91===u?1:0:(i=!0,o=!0));else{if(t){t=!1;continue}if(92===u){t=!0;continue}93===u&&(n=2)}else 91===u&&(n=1)}return i}return(n,t)=>{if(!n||!t.startsWith(n)||t.length<=n.length)return i(),[!0,0];let o=0;e!==n&&(i(),a(n),o=n.length);const l=t.slice(n.length),r=a(l);return e=t,[r,o+l.length]}}();let p,y=0,k=0,N=Mi(),b=-1,x=0;function S(e){b=Number.isInteger(e)?e:0,x+=1}function w(){p&&(clearTimeout(p),p=void 0)}function M(){w();const e=n.renderContent.value;i.value!==e&&(i.value=e),N=Mi()}X([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&&(!!Oi(Ii(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=Ii(e);if(Oi(n))return!1;const t=Ti(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?M():function(){if(k+=1,p)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(Mi()-N));n<=0?M():p=setTimeout(M,n)}())},{flush:"sync",immediate:!0}),Y(w);const C=P(()=>{var t,o,l,r;return I(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||qe(t)||L.has(t)||g.has(t)?"":t}).filter(Boolean)))}),_=P(()=>{const{key:e,tags:t}=O(C.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}),H=P(()=>{const n=_.value;if(!e.customMarkdownIt)return n;const t=e.customMarkdownIt(n);return n.__markstreamHasCustomParserExtensions=!0,t.__markstreamHasCustomParserExtensions=!0,t}),A=P(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=C.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}),$=P(()=>{var e;return new Set((null!=(e=A.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),R=P(()=>Bi(A.value,H.value,e.customMarkdownIt,{includeFinal:!0})),E=P(()=>Bi(A.value,H.value,e.customMarkdownIt,{includeFinal:!1}));X([R,E],([e,n],[t,o])=>{t&&(e===t&&n===o||(M(),n!==o&&(s=[],m="")))},{flush:"sync"});const F=P(()=>{var t,o,l,r,c,p,g,N,x,w,M;if(null==(t=e.nodes)?void 0:t.length)return s=[],m="",S(0),he(e.nodes.slice());const C=i.value;if(!C)return s=[],m="",S(-1),[];const _=n.debugPerformanceEnabled.value,B=_?Mi():0,I=H.value,O=R.value,L=E.value;d&&O!==d&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(I),f&&L!==f&&(s=[],m="");const $=Object.keys(null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{}).length>0||"function"==typeof A.value.postTransformNodes;$!==h&&(s=[],m="");const P=!$&&s.length>0&&C.startsWith(m)&&L===f,F=_?Ci(I):null,K=_?{}:void 0,z=!qi(I)&&!$,W=a(u(a({},A.value),{reuseStableTopLevelNodes:z}),K?{parserMetrics:K}:{}),j=T(C,I,W),D=_?Mi():0,V=_?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let q,U=_?Di(j.length):void 0,G=0,X=0,Y=0;if(P){const n=_?Mi():0,[t,o]=function(e){var n,t;const[o,l]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!qi(e.md)&&!o&&"function"!=typeof r.preTransformTokens&&"function"!=typeof r.postTransformTokens&&"function"!=typeof r.postTransformNodes&&0===(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)?e.previousDirtyStartIndex:0,l]}({content:C,previousContent:m,previousDirtyStartIndex:b,parseOptions:A.value,customMarkdownIt:e.customMarkdownIt,md:I,scanGlobalReferenceAppend:v});Y=o;const l=t<=0;if(V){const e=function(e,n,t,o={}){var l;if(!n.length)return{nodes:e,metrics:Di(e.length)};const r=null!=(l=o.scanStartIndex)?l:0,i=!1!==o.reuseDirtyTail,a=function(e,n,t,o=0){const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,o));r<l;r++)if(!Yi(n[r],e[r],t))return r;return e.length===n.length?-1:l}(e,n,t,r);if(a<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:a,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const u=e.slice();let s=a;for(let c=0;c<a;c++)u[c]=n[c];if(i)for(let c=a;c<e.length;c++){const o=n[c],l=e[c];o&&ji(o,l,t)&&(u[c]=o,s+=1)}return{nodes:u,metrics:{reusedNodeCount:s,dirtyStartIndex:a,stablePrefixNodeCount:a,dirtyTailNodeCount:Vi(a,e,n)}}}(j,s,V,{reuseDirtyTail:l,scanStartIndex:t});q=e.nodes,U=e.metrics}else{const e=function(e,n,t={}){var o;if(!n.length)return{nodes:e,metrics:Di(e.length)};const l=null!=(o=t.scanStartIndex)?o:0,r=!1!==t.reuseDirtyTail,i=function(e,n,t=0){const o=Math.min(e.length,n.length);for(let l=Math.min(o,Math.max(0,t));l<o;l++)if(!Xi(n[l],e[l]))return l;return e.length===n.length?-1:o}(e,n,l);if(i<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:i,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const a=e.slice();let u=i;for(let s=0;s<i;s++)a[s]=n[s];if(r)for(let s=i;s<e.length;s++){const t=n[s],o=e[s];t&&Ki(t,o)&&(a[s]=t,u+=1)}return{nodes:a,metrics:{reusedNodeCount:u,dirtyStartIndex:i,stablePrefixNodeCount:i,dirtyTailNodeCount:Vi(i,e,n)}}}(j,s,{reuseDirtyTail:l,scanStartIndex:t});q=e.nodes,U=e.metrics}G=_?Mi()-n:0,X=l?null==(null==U?void 0:U.dirtyStartIndex)||U.dirtyStartIndex<0?q.length:U.dirtyStartIndex:q.length}else q=j,U=Di(q.length);!0!==n.effectiveFinal.value&&(V?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)zi(n,"primeSignatureMs",()=>Fi(e[o]))}(q,V,X):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Fi(e[t])}(q,X));const J=_?Mi()-D:0;if(y+=1,m=C,d=O,f=L,h=$,s=q,S(null!=(r=null==U?void 0:U.dirtyStartIndex)?r:0),_){const e=Ci(I),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(c=null==F?void 0:F.total)?c:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Mi()-B),nodes:q.length,contentLength:C.length,parseCommitCount:y,parseCoalescedCount:k,nodeReuseMs:J,referenceDefinitionScanChars:Y,signatureMs:null!=(p=null==V?void 0:V.signatureMs)?p:0,stabilizeSignatureMs:null!=(g=null==V?void 0:V.stabilizeSignatureMs)?g:0,primeSignatureMs:null!=(N=null==V?void 0:V.primeSignatureMs)?N:0,signatureCallCount:null!=(x=null==V?void 0:V.signatureCallCount)?x:0,stabilizeSignatureCallCount:null!=(w=null==V?void 0:V.stabilizeSignatureCallCount)?w:0,primeSignatureCallCount:null!=(M=null==V?void 0:V.primeSignatureCallCount)?M:0,stabilizeMs:G},null!=U?U:{}),K?Object.fromEntries(ki.map(e=>{var n;return[e,null!=(n=K[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:Ji(e,F),streamStats:e}:{}))}return he(q)});return{effectiveCustomHtmlTags:C,effectiveCustomHtmlTagsSet:$,mdBase:_,mdInstance:H,mergedParseOptions:A,getParsedNodesDirtyStartIndex:()=>b,getParsedNodesRevision:()=>x,parsedNodes:F}}function Qi(e){const{isClient:n}=e,t=G(/* @__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 ea(e={}){const n=G(""),t=G(""),o=G(!1),l=_e(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=P(()=>Math.max(0,n.value.length-t.value.length)),u=P(()=>0===a.value),s=P(()=>o.value&&u.value);return ke()&&Y(()=>{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 na={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400};const ta=/auto|scroll|overlay/i;function oa(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return ta.test(n)||ta.test(t)}function la(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 ra={class:"m-0 p-0"},ia=["data-probe"],aa=/* @__PURE__ */on(/* @__PURE__ */E(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(F(),K("div",{class:"height-estimation-probes",style:ce({width:`${e.width}px`}),"aria-hidden":"true"},[z("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(zo),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),z("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[z("ul",ra,[V(q(Ho),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),z("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(Ao),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),K(J,null,de(6,n=>z("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(Bo),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,ia)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),ua=E({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return Pe(null!=(t=Fe(e.estimatedPreviewHeightPx))?t:Ee(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),sa=E({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return $e(null!=(t=Fe(e.estimatedPreviewHeightPx))?t:Re(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),ca={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function da(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const fa=["data-custom-id"],ma=["data-node-index","data-node-type"],ha="typewriter-simple-cursor-target",va=/* @__PURE__ */on(/* @__PURE__ */E(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockOptions:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t;function r(e){if(!("undefined"!=typeof Event&&e instanceof Event))return"string"==typeof e?(l("copy-code",e),void l("copy",e)):void l("copy",e)}const i=ee(),c=R("markstreamNestedRendererProps",void 0);function d(e){const n=null==i?void 0:i.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function f(e){var n,t;const l=o[e];return d(e)?l:null!=(t=null==(n=null==c?void 0:c.value)?void 0:n[e])?t:l}const m=ti,h=P(()=>{return"chat"===(e=f("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),v=P(()=>ri(f("typewriter"))),p=P(()=>"off"!==v.value),g=P(()=>"minimal"===f("domMode")?"minimal":"full"),y=P(()=>!0===f("renderCodeBlocksAsPre")),k=P(()=>ca[h.value]),N=P(()=>{var e;return null!=(e=f("showTooltips"))?e:k.value.showTooltips}),b=P(()=>{var e;return null!=(e=f("fade"))?e:k.value.fade}),x=P(()=>{var e;return null!=(e=f("batchRendering"))?e:k.value.batchRendering}),S=P(()=>{var e;return null!=(e=f("initialRenderBatchSize"))?e:k.value.initialRenderBatchSize}),w=P(()=>{var e;return null!=(e=f("renderBatchSize"))?e:k.value.renderBatchSize}),M=P(()=>{var e;return null!=(e=f("renderBatchDelay"))?e:k.value.renderBatchDelay}),B=P(()=>{var e;return null!=(e=f("renderBatchBudgetMs"))?e:k.value.renderBatchBudgetMs}),I=P(()=>{var e;return null!=(e=f("renderBatchIdleTimeoutMs"))?e:k.value.renderBatchIdleTimeoutMs}),O=P(()=>{var e;return null!=(e=f("deferNodesUntilVisible"))?e:k.value.deferNodesUntilVisible}),T=P(()=>{var e;return null!=(e=f("maxLiveNodes"))?e:k.value.maxLiveNodes}),L=P(()=>{var e;return null!=(e=f("liveNodeBuffer"))?e:k.value.liveNodeBuffer}),A=P(()=>{var e;return null!=(e=f("nodeVirtual"))?e:k.value.nodeVirtual}),E={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return f("parseOptions")},get customMarkdownIt(){return f("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return f("customHtmlTags")},get mode(){return f("mode")},get domMode(){return g.value},get htmlPolicy(){return f("htmlPolicy")},get viewportPriority(){return f("viewportPriority")},get viewportPriorityOptions(){return f("viewportPriorityOptions")},get codeBlockStream(){return f("codeBlockStream")},get codeBlockDarkTheme(){return f("codeBlockDarkTheme")},get codeBlockLightTheme(){return f("codeBlockLightTheme")},get codeBlockMinWidth(){return f("codeBlockMinWidth")},get codeBlockMaxWidth(){return f("codeBlockMaxWidth")},get codeBlockOptions(){return f("codeBlockOptions")},get codeBlockProps(){return f("codeBlockProps")},get mermaidProps(){return f("mermaidProps")},get d2Props(){return f("d2Props")},get infographicProps(){return f("infographicProps")},get showTooltips(){return N.value},get themes(){return f("themes")},get isDark(){return f("isDark")},get customId(){return f("customId")},get indexKey(){return o.indexKey},get typewriter(){return f("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return f("smoothStreamingOptions")},get parseCoalesceMs(){return f("parseCoalesceMs")},get fade(){return b.value},get batchRendering(){return x.value},get initialRenderBatchSize(){return S.value},get renderBatchSize(){return w.value},get renderBatchDelay(){return M.value},get renderBatchBudgetMs(){return B.value},get renderBatchIdleTimeoutMs(){return I.value},get deferNodesUntilVisible(){return O.value},get maxLiveNodes(){return T.value},get liveNodeBuffer(){return L.value},get nodeVirtual(){return A.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function z(e){l("height-change",e)}function W(e){l("virtual-state-change",e)}function j(e){l("anchor-change",e)}const V=G(),Y=G(null),Z=G(null),oe=G(null),fe=ye({1:null,2:null,3:null,4:null,5:null,6:null}),me=G(!1),ve=/* @__PURE__ */new Map,pe=G(0),ke=G(0),we=G({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Me(e,n){return"string"!=typeof e?n:e.trim()||n}function Ce(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const _e=P(()=>{var e;const n=null!=(e=E.viewportPriorityOptions)?e:{},t=Me(n.rootMargin,nt);return{rootMargin:t,heavyBlockMargin:Me(n.heavyBlockMargin,t),maxTargets:Ce(n.maxTargets)}}),Te=P(()=>{var e;return null!=(e=_e.value.rootMargin)?e:nt}),Le=P(()=>{var e;return null!=(e=_e.value.maxTargets)?e:640});function He(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return Ae("function"==typeof t?t():t)}function Ae(e){return e?"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?e:"object"==typeof e&&"value"in e?Ae(e.value):"object"==typeof e&&"$el"in e?Ae(e.$el):null:null}ne(Zn,_e);const{isClient:Ke,renderAsFragment:ze,debugPerformanceEnabled:We,resolvedShowTooltips:je,resolvedHtmlPolicy:De,inheritedSmoothStreaming:Ve,ownsTypewriterCursor:Ue}=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=P(()=>!0===e.renderAsFragment),a=P(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=P(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=P(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=P(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(E),{resolveViewportRoot:Ge,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:Qe}=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(oa(window.getComputedStyle(a))&&la(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(V,{isClient:Ke,scrollRoot:He});ne("markstreamShowTooltips",je),ne("markstreamHtmlPolicy",De),ne("markstreamTypewriter",p),ne("markstreamFade",P(()=>!1!==E.fade)),ne("markstreamTypewriterCursor",P(()=>!0)),ne("markstreamTextStreamState",ve),ne("markstreamStreamVersion",pe),ne("markstreamParseOptions",P(()=>E.parseOptions)),ne("markstreamCustomMarkdownIt",P(()=>E.customMarkdownIt));const{smoothStreamingEnabled:en,renderContent:nn,requestedFinal:tn,effectiveFinal:on}=function(e,n){const t=ea(a(a({},na),e.smoothStreamingOptions)),o=P(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||"off"!==ri(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=G(!n.isClient||!0===e.smoothStreaming);Ne(()=>{l.value=!0});const r=P(()=>l.value&&o.value),i=P(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),u=P(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),s=P(()=>{const e=u.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});let c=0,d=!1;function f(){c=0,d=!1}return X([()=>e.content,()=>e.nodes,r,u],([e,n,o,l])=>{if(null==n?void 0:n.length)return f(),void t.reset("");const r=null!=e?e:"";if(!o)return f(),t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;if(r)if(r===i);else if(r.startsWith(i)){const e=r.slice(i.length),n=t.pendingChars.value;e.length<=8?(c++,d||c>=2&&n<=8?(d=!0,t.reset(r)):t.enqueue(e)):(f(),t.enqueue(e))}else f(),t.reset(r);else f(),t.reset("");l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:u,effectiveFinal:s}}(E,{isClient:Ke,inheritedSmoothStreaming:Ve}),rn=!0===tn.value;ne("markstreamSmoothStreaming",en);const un=G(!1),sn=G(!1),dn=G(!1);let fn="",mn=!1,hn=null;function vn(){Ke&&null!=hn&&(window.clearTimeout(hn),hn=null)}function gn(){un.value=!1,vn()}function yn(e,n){if(!We.value)return;const t=function(){if(!We.value)return null;const e=wn(kn),n=wn(Nn),t=Math.max(xn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=kn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return kn.clear(),Nn.clear(),xn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}X([()=>E.indexKey,()=>E.customId],()=>{var e,n;gn(),sn.value=!1,dn.value=!(null==(e=o.nodes)?void 0:e.length)&&!0!==tn.value&&Boolean(o.content),fn=null!=(n=nn.value)?n:"",mn=fn.length>0},{flush:"sync"}),X([()=>o.content,()=>o.nodes,tn],([e,n,t])=>{!(null==n?void 0:n.length)&&!0!==t&&Boolean(e)&&(dn.value=!0)},{flush:"sync",immediate:!0}),X([nn,()=>o.nodes,tn],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(gn(),sn.value=!1,fn=l,void(mn=!0)):(l.length>0&&(dn.value=!0),mn?(fn&&l.length>fn.length&&l.startsWith(fn)?(un.value=!0,sn.value=!0,Ke&&(vn(),hn=window.setTimeout(()=>{var e;hn=null,!0===on.value||(null==(e=o.nodes)?void 0:e.length)||(ja(),un.value=!1,Va())},1200))):(l.length<fn.length||!l.startsWith(fn))&&(gn(),sn.value=!1),void(fn=l)):(fn=l,void(mn=!0)))},{flush:"sync",immediate:!0});const kn=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map;let bn=!1,xn=0;function wn(e){let n=0;for(const t of e.values())n+=t;return n}function Mn(){xn=Math.max(xn,wn(Nn)),Nn.clear(),bn=!1}function _n(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function Bn(e){var n,t;We.value&&(kn.set(e,(null!=(n=kn.get(e))?n:0)+1),Nn.set(e,(null!=(t=Nn.get(e))?t:0)+1),function(e){const n=function(){if(!Ke||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>_n(n),0):queueMicrotask(()=>_n(n)):window.requestAnimationFrame(()=>_n(n))))}(e),bn||(bn=!0,Ke&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(Mn):"function"!=typeof queueMicrotask?setTimeout(Mn,0):queueMicrotask(Mn)))}function In(e,n){return Bn(e),n()}const On=E.customId?`renderer-${E.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Tn=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(On),Ln=On;ne(ii,Tn);const Hn=Je(()=>E.customId),{effectiveCustomHtmlTagsSet:An,mergedParseOptions:$n,parsedNodes:Rn,getParsedNodesDirtyStartIndex:Pn,getParsedNodesRevision:En}=Zi(E,{instanceMsgId:On,renderContent:nn,effectiveFinal:on,smoothStreamingEnabled:en,debugPerformanceEnabled:We,customComponentsMap:Hn,logPerf:yn});X(Rn,()=>{un.value||Tn.clear(),pe.value+=1},{immediate:!0});const Fn=P(()=>({customId:E.customId,customHtmlTags:$n.value.customHtmlTags,parseOptions:E.parseOptions,customMarkdownIt:E.customMarkdownIt,htmlPolicy:De.value,viewportPriority:E.viewportPriority,viewportPriorityOptions:_e.value,mode:h.value,domMode:E.domMode,codeBlockStream:E.codeBlockStream,codeBlockDarkTheme:E.codeBlockDarkTheme,codeBlockLightTheme:E.codeBlockLightTheme,renderCodeBlocksAsPre:y.value,codeBlockMinWidth:E.codeBlockMinWidth,codeBlockMaxWidth:E.codeBlockMaxWidth,codeBlockOptions:E.codeBlockOptions,codeBlockProps:E.codeBlockProps,mermaidProps:E.mermaidProps,d2Props:E.d2Props,infographicProps:E.infographicProps,showTooltips:je.value,themes:E.themes,isDark:E.isDark,typewriter:p.value,smoothStreamingOptions:E.smoothStreamingOptions,parseCoalesceMs:E.parseCoalesceMs,fade:E.fade}));ne("markstreamNestedRendererProps",Fn);const Kn=P(()=>Rn.value),zn=P(()=>Rn.value.length),Wn=G(null),jn=G(null),Dn=G(null),Vn=G(null),qn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Un=!qn&&E.customId?jr(E.customId):null,Gn=P(()=>Un?(Wr.value,jr(E.customId)):null),Xn=P(()=>{var e;return Boolean(!ze.value&&E.customId&&!qn&&(null==(e=Gn.value)?void 0:e.enabled))}),Yn=P(()=>Boolean(Ke&&Xn.value)),Jn=P(()=>{var e;return Boolean(!ze.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),et=P(()=>Jn.value),tt=G(!1);Ne(()=>{tt.value=!0});const ot=P(()=>Boolean(Ke&&Jn.value));ne("markstreamHostScrollManaged",ot);const rt=P(()=>Boolean(tt.value&&ot.value)),it=P(()=>Yn.value||ot.value),at=P(()=>Yn.value||rt.value),ut=P(()=>{var e;return it.value&&!1!==(null==(e=Gn.value)?void 0:e.textEstimation)});function st(){const e=ke.value||In("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const ct=P(()=>{const e=st();return e>0?Math.max(1,Math.round(e)):640}),dt=P(()=>{var e,n;return!(!0!==on.value||Jn.value||"chat"!==h.value&&"minimal"!==h.value||d("maxLiveNodes")||d("liveNodeBuffer")||(null==(e=o.nodes)?void 0:e.length)||dn.value||!((null!=(n=E.maxLiveNodes)?n:0)<=0))}),ft=P(()=>{var e;return dt.value?50:Math.max(1,null!=(e=E.maxLiveNodes)?e:320)}),mt=P(()=>{var e;return dt.value?16:Math.max(0,null!=(e=E.liveNodeBuffer)?e:60)}),vt=P(()=>{var e;return!ze.value&&!1!==E.nodeVirtual&&!((null!=(e=E.maxLiveNodes)?e:0)<=0&&!dt.value)&&(!0===E.nodeVirtual?Rn.value.length>0:Rn.value.length>ft.value)}),pt=P(()=>vt.value||Yn.value||ot.value),gt=P(()=>!1!==E.viewportPriority),yt=P(()=>!!gt.value&&!me.value);var Nt;Nt=P(()=>gt.value),ne(Qn,Nt);const bt=P(()=>{var e;return!(ze.value||!1===E.deferNodesUntilVisible||(null!=(e=E.maxLiveNodes)?e:0)<=0||vt.value||Rn.value.length>900||!1===E.viewportPriority)}),xt=lt(e=>{var n;return Ge(null!=(n=null!=e?e:V.value)?n:null)},gt),{requestFrame:St,cancelFrame:wt,hasIdleCallback:Mt,isTestEnv:Ct}=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:Ke}),_t=P(()=>!0===on.value&&!Jn.value),{resolvedBatchSize:Bt,resolvedInitialBatch:It,batchingEnabled:Ot,incrementalRenderingActive:Tt,renderedCount:Lt,previousRenderContext:Rt,adaptiveBatchSize:zt,previousBatchConfig:jt}=function(e,n){var t;const o=P(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=P(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=P(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=G(0),a=G({key:e.indexKey,total:0}),u=G(Math.max(1,o.value||1)),s=P(()=>{var t,o,l;return r.value&&!(null==(t=n.continuousStreaming)?void 0:t.value)&&!(null==(o=n.forceFullRenderFinalContent)?void 0:o.value)&&(null!=(l=e.maxLiveNodes)?l:0)<=0}),c=G({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}}(E,{isClient:Ke,isTestEnv:Ct,renderAsFragment:ze,forceFullRenderFinalContent:_t,continuousStreaming:P(()=>sn.value&&!0!==on.value)}),Vt=P(()=>{var e;return!ze.value&&!1!==E.batchRendering&&Bt.value>0&&!Ct&&(null!=(e=E.maxLiveNodes)?e:0)<=0&&!_t.value}),Ut=P(()=>Vt.value),Xt=P(()=>it.value||Ut.value),Yt=P(()=>{var e;return Xt.value&&!1!==(null==(e=Gn.value)?void 0:e.codeBlockEstimation)}),Jt=/* @__PURE__ */new Map,Zt=/* @__PURE__ */new Map,eo=/* @__PURE__ */new WeakMap;let to=null;const lo=/* @__PURE__ */new WeakMap,io=/* @__PURE__ */new Map,uo=[];let so=[],co=[],fo=-1;const mo=$(uo),ho=/* @__PURE__ */new Set,vo=G(0);let go=0;const yo=G(0),ko=P(()=>(yo.value,Array.from(Jt.entries()).sort((e,n)=>e[0]-n[0]))),bo=G(null),So=G(null);let wo,Co=null,_o=0,Io=null;function Oo(){wo.markFallbackHeightPrefixDirty()}function To(e){return wo.getFallbackNodeHeight(e)}function Lo(e,n){return wo.estimateHeightRange(e,n)}function $o(e){return wo.estimateIndexForOffset(e)}const{activeRestoreAnchor:Ro,getRelativeScrollTopWithinContainer:Po,setRelativeScrollTopWithinContainer:Fo,resolveAnchorOffset:Ko,clearRestoreReconcile:Wo,scheduleRestoreReconcile:jo,captureRestoreAnchor:Do,restoreAnchor:Vo,getAnchorDrift:qo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=G(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)))}oi(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:Ke,containerRef:V,parsedNodeCount:zn,requestFrame:St,cancelFrame:wt,resolveScrollContainer:()=>bo.value||Xe(),getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:Qe,isReverseFlexScrollRoot:Ye,estimateIndexForOffset:$o,estimateHeightRange:Lo,getFallbackNodeHeight:To,clamp:sr}),{nodeHeights:Uo,heightStats:Go,heightTreeSize:Yo,heightSumTree:Zo,heightKnownTree:nl,averageNodeHeight:tl,resetHeightMeasurements:ol,pruneHeightMeasurements:ll,rebuildHeightTrees:rl,recordNodeHeight:il,removeNodeHeights:al,exportHeightCache:ul,importHeightCache:sl,fenwickRangeSum:cl}=function(e={}){const n=ye({}),t=ye({total:0,count:0}),o=G(0),l=G([]),r=G([]);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=P(()=>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(),ot.value&&eu(),Ro.value&&jo(),So.value&&$i(),Pa("node-resize")}});function dl(e){Number.isInteger(e)&&e>=0&&ho.add(e)}function fl(e){for(const n of e)dl(Number(n))}function ml(e){go++;let n=!0;try{const t=e();return n=!1!==t,t}finally{go--,0===go&&n&&vo.value++}}function hl(){so=[],co=[],fo=-1,ho.clear(),mo.value=uo}function vl(){hl(),ml(()=>ol()),io.clear()}function pl(e){!Number.isInteger(e)||e<0||e>=Rn.value.length||io.set(e,_i(e))}function gl(e,n,t={}){const o=Uo[e];dl(e),il(e,n,t);const l=Uo[e];return Object.is(o,l)?(ho.delete(e),!1):(l&&l>0?pl(e):o&&io.delete(e),!0)}function yl(e,n){const t=In("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Jt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:In("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function kl(e,n={}){"merge"!==n.mode?hl():fl(e.map(e=>e.index)),ml(()=>sl(e,n)),ra()}const Nl=P(()=>bt.value&&yt.value),bl=P(()=>{var e;return!ze.value&&!1!==E.batchRendering&&Bt.value>0&&(null!=(e=E.maxLiveNodes)?e:0)<=0}),xl=P(()=>!ze.value&&rn&&!0===on.value&&!vt.value&&!Jn.value&&!Xn.value&&!Nl.value&&!bl.value),Sl=P(()=>!!xt&&Nl.value),wl=P(()=>vt.value||ot.value),{focusIndex:Ml,liveRange:Cl,updateLiveRange:_l}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,liveNodeBufferResolved:r,clamp:i}=n,a=null!=r?r:P(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),u=G(0),s=ye({start:0,end:0});return{liveNodeBufferResolved:a,focusIndex:u,liveRange:s,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return s.start=0,void(s.end=e);const n=Math.min(l.value,e),r=a.value,c=i(u.value-r,0,Math.max(0,e-n));s.start=c,s.end=Math.min(e,c+n)}}}(E,{parsedNodeCount:zn,virtualizationEnabled:vt,maxLiveNodesResolved:ft,liveNodeBufferResolved:mt,clamp:sr}),Bl=/* @__PURE__ */new Map,Il=/* @__PURE__ */new Map,Ol=/* @__PURE__ */new Map,Tl=[],Ll=/* @__PURE__ */new Map,Hl=/* @__PURE__ */new Set,Al=G(0);let $l=!1;const Rl=P(()=>(Al.value,Hl.size)),Pl=/* @__PURE__ */new Map,El=/* @__PURE__ */new Map,Fl=G(0),Kl=P(()=>{Fl.value;let e=0;for(const n of Pl.values())e+=Math.max(0,n);return e});let zl=null;const Wl=P(()=>{if(!vt.value)return Rn.value.length;const e=mt.value,n=Math.max(Cl.end+e,It.value),t=Math.min(Rn.value.length,n);return Math.max(Lt.value,t)});function jl(){$l||($l=!0,queueMicrotask(()=>{$l=!1,Al.value+=1}))}function Dl(e,n,t="node-resize"){if(!Ke||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{Hl.delete(o)&&jl();try{n()}finally{Pa(t)}},Math.max(0,e));return Hl.add(o),jl(),o}function Vl(e){Ke&&null!=e&&(Hl.delete(e)&&jl(),window.clearTimeout(e))}function ql(){if(Ke&&"undefined"!=typeof window)for(const e of Hl)window.clearTimeout(e);Hl.size&&(Hl.clear(),jl()),Tl.length=0,Ol.clear()}function Ul(e){Y.value=e}function Gl(e){Z.value=e}function Xl(e){oe.value=e}const{cancelScheduledFocusSync:Yl,scheduleFocusSync:Jl}=function(e){const{isClient:n,containerRef:t,virtualizationEnabled:o,requestFrame:l,cancelFrame:r,syncFocusToScroll:i}=e;let a=null;function u(){var e,n,o;return null!=(o=null==(n=null==(e=t.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?o:"undefined"!=typeof window?window:null}function s(){if(!a)return;const e=u();a.viaTimeout?e?e.clearTimeout(a.id):clearTimeout(a.id):null==r||r(a.id),a=null}return{cancelScheduledFocusSync:s,scheduleFocusSync:function(e={}){if(!o.value)return;if(!n)return void i(!0);if(e.immediate)return s(),void i(!0);if(a)return;const t=()=>{a=null,i()};if(l)return void(a={id:l(t),viaTimeout:!1});const r=u(),c=r?r.setTimeout(t,16):setTimeout(t,16);a={id:c,viaTimeout:!0}}}}({isClient:Ke,containerRef:V,virtualizationEnabled:vt,requestFrame:St,cancelFrame:wt,syncFocusToScroll:function(e=!1){var n;if(!vt.value)return;const t=bo.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=V.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=Rn.value.length;if(i<=0)return;if(!r&&i>0&&Ye(t)){const n=In("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=In("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void ur(sr((a=Math.max(0,l)+.5*Math.max(0,n),wo.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=V.value;if(!l)return null;const r=o?0:In("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=In("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?In("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):In("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return sr($o(a+.5*Math.max(0,u)),0,Math.max(0,Rn.value.length-1))}(t,o,l,r);if(null!=u)return void ur(u,e);const s=r?null:In("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?In("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=ko.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=In("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=V.value;if(!e)return;const n=r?{top:0}:In("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=In("syncFocusToScroll.fallback.scrollTop",()=>Ze(t,o,r)),a=r?(()=>{const t=In("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Qe(e,t);return Math.max(0,i-n)})(),u=r?In("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):In("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void ur(sr($o(a+.5*Math.max(0,u)),0,Math.max(0,Rn.value.length-1)),!0)}ur(Math.round((m+h)/2),e)}}),{visibleNodeIndices:Zl,nodeVisibilityHandles:Ql,nodeVisibilityWatchStops:er,nodeVisibilityFallbackTimers:nr,clearVisibilityFallback:tr,markNodeVisible:or,cleanupNodeVisibility:lr,destroyNodeVisibilityState:rr}=Qi({isClient:Ke,shouldTrackVisibleNodeIndices:()=>Nl.value,shouldCleanupNodeVisibility:()=>vt.value,onNodeMarkedVisible:e=>{vt.value?Jl():Ml.value=sr(e,0,Math.max(0,Rn.value.length-1))},onNodeVisibilityCleaned:e=>{Jt.delete(e)&&Ea()}}),{cleanupScrollListener:ir,setupScrollListener:ar}=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:Ke,virtualizationEnabled:vt,listenerEnabled:wl,scrollRootElement:bo,resolveScrollContainer:Xe,scheduleFocusSync:Jl,onScroll:function(){const e=So.value;if(!e)return;const n=hi();if(!n)return;if(function(e){if(_a()>=_o)return Io=null,!1;const n=Io;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(Io=null),t}(n))return;const t=yi(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&Ai("restore"):Ai("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=V.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return In("scrollListener.getScrollTop",()=>Ze(e,t,o))}});function ur(e,n=!1){const t=sr(e,0,Math.max(0,Rn.value.length-1));!n&&Math.abs(t-Ml.value)<=1||(Ml.value=t,_l())}function sr(e,n,t){return Math.min(Math.max(e,n),t)}function cr(e=Rn.value.length){const n=Pn();return!Number.isInteger(n)||n<0?e:sr(n,0,e)}function dr(e){return null==e?void 0:e.firstElementChild}function fr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function mr(e,n){e<1||e>6||(fe[e]=n)}function hr(){if(!it.value)return void(ke.value=0);const e=In("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.clientWidth)?n:0});ke.value=e>0?e:0}let vr=null;function pr(){null==vr||vr.disconnect(),vr=null}const gr=P(()=>y.value?Ht:Pt);function yr(){var e;return!1!==(null==(e=E.codeBlockProps)?void 0:e.showHeader)}function kr(e,n,t){var o;const l=Uo[n],r="number"==typeof l&&l>0;if(ut.value&&!r&&!function(e){return!!Hn.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=Gr(e,t,we.value);if(n)return n}if(Yt.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Tu(e,Cu(e));return n===Ht?"pre":n===gr.value||n===Pt?"stream-diffs":null}(e);if("stream-diffs"===n||"pre"===n)return function(e,n){if(!e||"code_block"!==e.type)return null;const t=n.rendererKind,o="pre"!==t&&!1!==n.showHeader,l=Boolean(e.diff);let r=0,i=500;if("stream-diffs"===t){const t=Jr(e,n.diffStyle),o=18,a=function(e){return e?0:16}(l);i=500,r=Math.round(t*o+a)}else{const n=Jr(e);r=Math.round(28*n),i=Number.POSITIVE_INFINITY}const u=Math.max(1,Math.min(r,i));return a({kind:"code-block",height:Math.round(u+(o?40:0)),contentHeight:u,rendererKind:t},l&&"stream-diffs"===t?{diffInline:kt({diffStyle:n.diffStyle})}:{})}(e,{rendererKind:n,showHeader:yr(),diffStyle:null==(o=E.codeBlockOptions)?void 0:o.diffStyle})}return null}be(()=>{if(vo.value,go>0)return;const e=Rn.value,n=En();if(!e.length||!Xt.value)return so=[],co=[],fo=-1,ho.clear(),void(mo.value=uo);const t=ke.value||In("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return so=[],co=[],fo=-1,ho.clear(),void(mo.value=uo);const o=function(e){return[Math.round(e),ut.value,Yt.value,we.value,yr(),y.value,Hn.value,Wr.value]}(t),l=so.length<=e.length&&(i=o,(r=co).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&fo===n?e.length:l?cr(e.length):0,u=l?Array.from(ho):[];so.length=e.length;for(let s=a;s<e.length;s++)so[s]=kr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(so[s]=kr(e[s],s,t));ho.clear(),co=o,fo=n,mo.value=so,xe(mo)},{flush:"sync"});const Nr=P(()=>mo.value);wo=function(e){let n=!0,t=[0],o="";function l(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=e.parsedNodes.value[n],r=null==l?void 0:l.type,i=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),a=e.estimatedNodeHeights.value[n],u=null==a?void 0:a.height;if(!function(e,n,t){return Boolean(t&&"simple-text"===(null==n?void 0:n.kind)&&("paragraph"===e||"list_item"===e||"list"===e))}(r,a,i)&&Number.isFinite(u)&&u>0)return u;const s=pi(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&s<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(fi)}(l,i)?s:Math.max(e.averageNodeHeight.value,s)}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=gi(Math.trunc(n),0,i),u=gi(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function s(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Rn,nodeHeights:Uo,heightStats:Go,heightTreeSize:Yo,heightSumTree:Zo,heightKnownTree:nl,averageNodeHeight:tl,heightEstimationActive:it,estimatedNodeHeights:Nr,getContainerWidth:st,hasCustomParagraphComponent:()=>Boolean(Hn.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=ci(ke.value||In("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[Rn.value.length,Go.count,Math.round(Go.total),Math.round(100*tl.value),t,n,it.value?1:0,Wr.value,pe.value,Hn.value.paragraph?1:0]},fenwickRangeSum:cl}),X(()=>Rn.value.length,e=>{var n;Oo(),e<=0?vl():(e<Yo.value&&(n=e,hl(),ml(()=>ll(n))),e!==Yo.value&&rl(e))},{immediate:!0});const br=P(()=>{if(!vt.value)return Rn.value.map((e,n)=>({node:e,index:n}));const e=Rn.value.length,n=sr(Cl.start,0,e),t=sr(Cl.end,n,e);return Rn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),xr=P(()=>vt.value?Lo(0,Math.min(Cl.start,Rn.value.length)):0),Sr=P(()=>{if(!vt.value)return 0;const e=Rn.value.length;return Lo(Math.min(Cl.end,e),e)});function wr(){return wo.buildVirtualHeightSummary({topSpacerHeight:xr.value,bottomSpacerHeight:Sr.value,width:Hr()})}function Mr(){const e=Rn.value,n=wr();return u(a({},n),{probe:{paragraphReady:Boolean(we.value.paragraph),listItemReady:Boolean(we.value.listItem),listWrapperOverhead:we.value.listWrapperOverhead,headingReadyLevels:Object.entries(we.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=Nr.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=Nr.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=Nr.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=Nr.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Uo[n])?c:null}})})}function Cr(){return null!=o.indexKey?String(o.indexKey):Jn.value?`virtual-${Br()}`:"markdown-renderer"}function _r(e){const n=String(e),t=`${Cr()}-`;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>=Rn.value.length?null:l}function Br(){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:E.customId)?t:On)}function Ir(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}const Or=P(()=>{var e,n,t;return null!=(t=Ir())?t:String(null!=(n=null!=(e=o.indexKey)?e:E.customId)?n:On)});function Tr(e){var n;return(null!=e?e:"")===(null!=(n=Ir())?n:"")}function Lr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(e){const n=e.codeBlockProps,t=e.codeBlockOptions,o=null==t?void 0:t.parseDiffOptions;return[e.isDark?"dark":"light",e.renderCodeBlocksAsPre?"code-pre":"code-rich",!1===e.codeBlockStream?"code-static":"code-stream",da(e.codeBlockMinWidth),da(e.codeBlockMaxWidth),da(null==t?void 0:t.fontSize),da(null==t?void 0:t.lineHeight),da(null==t?void 0:t.fontFamily),da(null==t?void 0:t.maxHeight),da(null==t?void 0:t.tabSize),da(null==t?void 0:t.padding),da(null==t?void 0:t.overflow),da(null==t?void 0:t.disableLineNumbers),da(null==t?void 0:t.diffStyle),da(null==t?void 0:t.diffIndicators),da(null==t?void 0:t.hunkSeparators),da(null==t?void 0:t.expandUnchanged),da(null==t?void 0:t.collapsedContextThreshold),da(null==t?void 0:t.expansionLineCount),da(null==o?void 0:o.context),da(null==n?void 0:n.showHeader),da(null==n?void 0:n.showCopyButton),da(null==n?void 0:n.showExpandButton),da(null==n?void 0:n.showPreviewButton),da(null==n?void 0:n.showCollapseButton),da(null==n?void 0:n.showFontSizeButtons),da(null==n?void 0:n.showLineNumbers)].join("\0")}({renderCodeBlocksAsPre:y.value,isDark:E.isDark,codeBlockStream:E.codeBlockStream,codeBlockMinWidth:E.codeBlockMinWidth,codeBlockMaxWidth:E.codeBlockMaxWidth,codeBlockOptions:E.codeBlockOptions,codeBlockProps:E.codeBlockProps}),[null==n?"":String(n),t].join("\0")}function Hr(){return st()}const Ar=P(()=>ci(Hr())),$r=P(()=>[Lr(),Ar.value].join("\0")),Rr=P(()=>{var e;return Jn.value?["virtual",null!=(e=Ir())?e:"",Br(),$r.value].join("\0"):o.indexKey});function Pr(){Fl.value+=1}function Er(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Rn.value.length||e.sessionKey!==Br()||e.threadKey!==Ir()||e.layoutEpochKey!==$r.value)}function Fr(e){const n=String(e),t=El.get(n);return t?Er(t)?t.index:null:_r(n)}function zr(e="async-node"){(Pl.size||El.size)&&(Pl.clear(),El.clear(),Pr(),Pa(e))}const Dr=R(Ie,null),Vr={reportHeight(e,n){if(!ot.value)return;const t=Fr(e);if(null==t)return;const o=Bl.get(t);if(!o)return;const l=Number(n),r=yl(t,o);!function(e,n,t={}){ml(()=>gl(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!ot.value)return;const n=_r(e);null!=n&&function(e,n){var t;const o=El.get(e);if(o&&Er(o))return Pl.set(e,Math.max(0,null!=(t=Pl.get(e))?t:0)+1),Pr(),void Pa("async-node");Pl.set(e,1),El.set(e,function(e){return{index:e,sessionKey:Br(),threadKey:Ir(),layoutEpochKey:$r.value}}(n)),Pr(),Pa("async-node")}(String(e),n)},markSettled(e){if(!ot.value)return;const n=String(e),t=Fr(e);(null!=t||function(e){return Pl.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Pl.get(e))?n:0;return!(t<=0||(t<=1?(Pl.delete(e),El.delete(e)):Pl.set(e,t-1),Pr(),1===t&&Pa("async-node"),0))}(n)&&null!=t&&Va()}};function qr(){let e=0;for(const n of Bl.values())e+=In("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}ne(Ie,{reportHeight(e,n){Vr.reportHeight(e,n),null==Dr||Dr.reportHeight(e,n)},markPending(e){Vr.markPending(e),null==Dr||Dr.markPending(e)},markSettled(e){Vr.markSettled(e),null==Dr||Dr.markSettled(e)}});let Ur,Xr=null,Yr=null;function Zr(e){return!1!==e&&null!=e&&""!==e}function ei(){return vt.value?function(){if(!vt.value)return!0;const e=Rn.value.length,n=sr(Cl.start,0,e),t=sr(Cl.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Jt.has(o))return!1;if(Fa(o)&&!Bl.has(o))return!1}return!0}():Lt.value>=Wl.value}function ai(){return!0===on.value&&!un.value&&0===Kl.value&&0===Hl.size&&0===Ll.size&&null==zl&&ei()}function ui(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(Xr===Br()&&Ur===Ir())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!Zr(t)&&Yr===ou(t)}function si(){return ai()&&ui()}function di(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function mi(e="manual",n){const t=wr(),o=function(e){return e||(!0!==on.value?Rn.value.length>0?"streaming":"estimating":!ei()||Ll.size>0||null!=zl?"measuring":si()?"settled":"settling")}(n);return{sessionKey:Br(),threadKey:Ir(),phase:o,nodeCount:t.totalNodes,liveRange:{start:Cl.start,end:Cl.end},renderedCount:Lt.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:qr(),totalHeight:vi(),width:t.width,final:!0===on.value,stable:si(),confidence:di(o,t),reason:e}}function hi(){const e=bo.value||Xe(),n=V.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=In("getScrollBox.scrollTop",()=>Ze(e,t,o)),r=In("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=In("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function vi(){const e=Rn.value.length,n=Math.max(0,Lo(0,e)),t=In("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:In("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):vt.value?n>0?Math.max(1,Math.ceil(n),function(){let e=xr.value+Sr.value;for(const n of Jt.values())n&&(e+=Math.max(0,In("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(n,o)):Math.max(1,Math.ceil(o)):ot.value?n>0||Go.count>0||wo.getEstimatedNodeHeightCount()>0?(Tt.value&&Lt.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function yi(e){const n=V.value;if(!n)return null;const t=In("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:In("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function ki(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=hi(),t=V.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=In("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=In("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=hi(),n=V.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=yi(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=Do();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Rn.value.length;return e<=0?null:{type:"node",nodeIndex:sr(Ml.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function Ni(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function bi(e,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 xi=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Si(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}:${Ni(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(Si(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=Si(e[a],n,t+1);i=bi(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||xi.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${Si(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let wi=-1,Mi="",Ci=[2166136261];function _i(e){const n=Rn.value[e];return n?Ni(Si(n)):""}function Bi(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function Ii(){var e,n;const t=pe.value;if(wi===t)return Mi;const o=Rn.value.length;let l=cr(o);(wi!==t-1||l>o||Ci.length<l+1)&&(l=0),0===l?Ci=[2166136261]:Ci.length=l+1;for(let r=l;r<o;r++){const n=_i(r);Ci[r+1]=Bi(null!=(e=Ci[r])?e:2166136261,n)}return Ci.length=o+1,Mi=((null!=(n=Ci[o])?n:2166136261)>>>0).toString(36),wi=t,Mi}function Oi(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=Rn.value.length,i=sr(Cl.start-2*mt.value,0,r),a=sr(Cl.end+2*mt.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)}(ul().map(e=>{var n;const t=Rn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:_i(e.index)}):null}).filter(e=>Boolean(e))):[],s=ki({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?Ii():void 0,measurementKey:Lr()||void 0,heightCache:i.length?i:void 0}):null}function Ti(e){var n,t;const o=hi();if(!o)return;const l=function(e){const n=V.value;if(!n)return null;const t=Qe(n,e.root),o=Rn.value.length,l=In("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?In("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=vi();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){_o=_a()+120,Io=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):oi(o.root,o.doc,i,{isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze})}const Li=[];function Hi(){if(Ke)for(null!=Co&&(null==wt||wt(Co),Co=null);Li.length;){const e=Li.pop();null!=e&&window.clearTimeout(e)}}function Ai(e){const n=Boolean(So.value);So.value=null,_o=0,Io=null,Hi(),n&&e&&Pa(e)}function $i(){if(!So.value||!Ke)return;if(null!=Co)return;const e=()=>{Co=null;const e=So.value;e&&Ti(e)};Co=St?St(e):null,null==Co&&e()}function Ri(e,n={}){const t=Rn.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=Rn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==_i(e.index))}(e))}function Pi(e){const n=ci(Hr()),t=ci(e);return-1!==n&&-1!==t&&n===t}function Ei(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 Fi(e){var n;return e.sessionKey===Br()&&!!Tr(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Lr()&&!!Pi(Ei(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Ki(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Ki(e){return Boolean(e.contentHash&&e.contentHash===Ii())}function zi(e){return!Ki(e)}let Wi=null,ji=null,Di=null,Vi=null,qi=null,Ui=!1;function Gi(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=ci(Hr());return[null!=(n=Ir())?n:"",Br(),Lr(),Rn.value.length,o,e.length,Ni(t)].join(":")}function Xi(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!ot.value||!(null==e?void 0:e.length))return!1;if(Rn.value.length<=0)return!1;if(!Pi(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=Ri(e,{requireSignature:!0});if(!t.length)return!Ui&&"undefined"!=typeof console&&m&&(Ui=!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=Gi(t);return l===Wi?(ji="standalone",!0):(kl(t,{mode:"merge"}),Oo(),Wi=l,ji="standalone",Ta(),Pa("restore"),!0)}function Yi(e,n={}){var t,o,l;if(!ot.value||!e)return!1;if(e.sessionKey!==Br())return!1;if(!Tr(e.threadKey))return!1;if(Rn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!Ji(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!Ji()&&Number(Ei(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&Fi(e)){const n=Ri(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:zi(e)});n.length&&(kl(n,{mode:"merge"}),Oo(),Wi=Gi(n),ji="restore",Ta(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Pa("restore"),!0;if(!i)return u&&Pa("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=Ir())?t:"",Br(),Lr(),Ar.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return Di===s?(u&&Pa("restore"),!0):(Di=s,function(e){const n=()=>{if("node"===e.type)return Ai(),void Vo({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Wo(),Ro.value=null,So.value=e,Hi(),Ti(e),Ke)for(const e of[0,120,280,480])Li.push(window.setTimeout(()=>{const e=So.value;e&&Ti(e)},e))};!function(e){if(!vt.value)return!1;const n=Rn.value.length;return!(n<=0||(Ml.value="node"===e.type?sr(e.nodeIndex,0,n-1):n-1,_l(),0))}(e)?n():le(n)}(i),Pa("restore"),!0)}function Ji(){const e=Hr();return Number.isFinite(e)&&e>0}function ta(e){var n;return e.sessionKey===Br()&&!!Tr(e.threadKey)&&(Rn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||Ji())||!(!(e.anchor&&Number(Ei(e))>0)||Ji()))}function ra(){io.clear();for(const e of Object.keys(Uo)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Rn.value.length&&pl(n)}}function ia(){null!=zl&&(null==wt||wt(zl),zl=null),Wa()}function va(){return!Ke||Ct?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(St)return St(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function pa(e,n=Ir(),t=$r.value){return Br()===e&&Ir()===n&&$r.value===t}function ga(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Br(),c=Ir(),d=$r.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=mi(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>pa(s,c,d)&&(null==v||Ia()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield va(),!k())return y();Va(),ia()}if(yield function(e){return!Ke||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&ql(),Va(),ia(),!k())return y();const N=ai();N&&(Xr=s,Ur=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&Zr(null==(i=o.virtualScroll)?void 0:i.settledToken)&&Ia()===v&&(Yr=ou(o.virtualScroll.settledToken)));const b=k()&&N&&ui(),x=mi(h,b?"final":void 0);return Aa(x,!0),x})}let ya="content",ka=null,Na=null,ba=0,xa=null,Sa=null,wa=null,Ca=null;function _a(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Ba(e){var n,t;const l=xa;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 Ia(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return da(e)}function Oa(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Lr(),Ii(),da(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function Ta(){wa=null,Ca=null,Sa=null}function La(e){const n=e.heightCache;return(null==n?void 0:n.length)?Gi(n):""}function Ha(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:Lr(),null!=(o=e.contentHash)?o:"",La(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 Aa(e,n=!1){if(!ot.value)return;if(function(e=!1){return!e&&Jn.value&&!rt.value}(n))return;const t=n||Ba(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Oi(e,{includeHeightCache:!0})}:{state:Oi(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||Ha(e)!==Sa}(r,n)));if(t&&(z(e),xa=e,ba=_a()),r&&i&&(W(r),r.anchor&&j(r.anchor),Sa=Ha(r)),e.stable){const n=Oa("settled",e);if(n!==wa){wa=n;const t=Oi(e,{includeHeightCache:!0});t&&(W(t),Sa=Ha(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Oa("final",e);if(n!==Ca){Ca=n;const t=Oi(e,{includeHeightCache:!0});t&&(W(t),Sa=Ha(t)),function(e){l("render-final",e)}(e)}}}function $a(){null!=ka&&(null==wt||wt(ka),ka=null),null!=Na&&Ke&&(window.clearTimeout(Na),Na=null)}function Ra(){ka=null,Na=null,function(e){if(Ll.size>0||null!=zl)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(ya)&&(Va(),ia()),Aa(mi(ya))}function Pa(e){var n,t;if(!ot.value)return;if(ya=e,null!=ka||null!=Na)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(_a()-ba)),i=()=>{Na=null,ka=St?St(Ra):null,null==ka&&Ra()};Ke&&r>0?Na=window.setTimeout(i,r):i()}function Ea(){yo.value+=1}function Fa(e){var n;if(Tt.value&&e>=Lt.value){const n=Rn.value[e],t=!0===tn.value&&!0!==on.value&&e>=Rn.value.length-2,o="code_block"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type)||"mermaid"===(null==n?void 0:n.type)||"infographic"===(null==n?void 0:n.type);if(!t||o)return!1}return!Nl.value||e<It.value||!!(un.value&&!0!==on.value&&!(null==(n=o.nodes)?void 0:n.length)&&e>=Rn.value.length-mt.value)||Zl.value.has(e)}function Ka(e){const n=er.get(e);n&&(n(),er.delete(e));const t=Ql.get(e);t&&(t.destroy(),Ql.delete(e)),tr(e)}function za(e,n){let t=!1;if(n){const o=Jt.get(e);Jt.set(e,n),o!==n&&(t=!0)}else Jt.delete(e)&&(t=!0);if(t&&Ea(),n||tr(e),!Sl.value||!xt)return Ka(e),void(n&&Nl.value&&or(e,!0));if(!vt.value&&Nl.value&&!me.value&&Ql.size>=Le.value&&(me.value||(me.value=!0,m&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),rr()),!Sl.value||!xt))return Ka(e),void(n&&or(e,!0));if(e<It.value&&!vt.value)return Ka(e),void or(e,!0);if(Zl.value.has(e))return Ka(e),void or(e,!0);if(!n)return void Ka(e);Ka(e);const o=xt(n,{rootMargin:Te.value});if(!o)return;Ql.set(e,o),or(e,o.isVisible.value),Nl.value&&function(e){if(!Ke||!Nl.value)return;tr(e);const n=e%17*23,t=window.setTimeout(()=>{if(nr.delete(e),!Nl.value)return;if(Zl.value.has(e))return;const n=Jt.get(e);if(!n)return;const t=Xe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?In("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?In("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=In("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&or(e,!0)},1800+n);nr.set(e,t)}(e);let l=null;l=X(()=>o.isVisible.value,n=>{if(n){tr(e),or(e,!0),null==l||l(),er.delete(e),Ql.get(e)===o&&Ql.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),er.set(e,l),vt.value&&Jl()}function Wa(){zl=null,ml(()=>{let e=!1;for(const[n,t]of Ll)Ll.delete(n),Bl.get(n)===t.el&&Il.get(n)===t.version&&(e=gl(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function ja(){null!=zl&&(null==wt||wt(zl),zl=null),Ll.clear()}function Da(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Bl.get(e)!==n)return;const r=Il.get(e);if(null==r)return;const i=Rn.value[e],a=un.value&&!0!==on.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Rn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Ll.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Ll.set(e,{height:d,allowShrink:c,version:r,el:n}),null==zl&&(zl=St?St(Wa):null,null==zl&&Wa())}(e,n,yl(e,n))}function Va(){for(const[e,n]of Bl)n&&Da(e,n)}function qa(){null==to||to.disconnect(),to=null,Zt.clear()}function Ua(){for(;Tl.length;)Vl(Tl.pop())}X(rt,e=>{e&&Pa("content")},{flush:"post"}),n({getVirtualMetrics:mi,captureVirtualState:function(e={}){var n;return Oi(mi("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);Vi=e,qi={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!Yi(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&ta(e)||(Vi=null,qi=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield va(),Va(),ia(),yield le();const n=mi(e);return Aa(n,!0),n})},settle:ga,scrollToNode:function(e,n="start"){Ai(),Wo();const t=Rn.value.length;if(t<=0)return;const o=sr(e,0,t-1),l=()=>{var e;const t=Ko({nodeIndex:o,offsetWithinNodePx:0}),l=To(o),r=hi(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Po();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}Fo(Math.max(0,u)),Jl({immediate:!0}),vt.value&&(Ml.value=o,_l())};if(vt.value)return Ml.value=o,_l(),void le(l);l()}}),X(()=>pt.value,e=>{if(!e){qa();for(const e of Ol.values())for(const n of e)Vl(n);Ol.clear(),Il.clear(),Ua(),ja()}},{immediate:!0}),X(on,e=>{e&&function(){if(Ke&&on.value&&Bl.size){Ua();for(const e of[80,240,640]){const n=Dl(e,()=>{for(const[e,n]of Bl)n&&Da(e,n)},"final");null!=n&&Tl.push(n)}}}(),Pa(e?"final":"content")});const Ga=li(()=>Pa("content"),16),Xa=li(()=>Pa("batch"),16);X([()=>Rn.value.length,()=>Lt.value],()=>{So.value&&$i(),Ga()},{flush:"post",immediate:!0}),X([()=>Cl.start,()=>Cl.end],()=>{Xa()},{flush:"post"});const{cleanupBatchScheduler:Ya}=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 x=null,S="raf",w=null,M=0,C=!1,_=!1;const B=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function O(){if(t){null!=x&&("raf"===S&&g?g(x):"idle"===S&&"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(x):"timeout"===S&&window.clearTimeout(x),x=null),M+=1;for(const e of B)g&&g(e);for(const e of I)window.clearTimeout(e);B.clear(),I.clear(),w=null,C=!1,_=!1}}function T(){return"undefined"!=typeof performance?performance.now():Date.now()}function L(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.5*o?m.value=Math.max(r,Math.floor(.8*m.value)):e<.6*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),C=!1;const t=_||f.value<i.value;_=!1,t&&$()}function H(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=T();x=null;const o=null!=w?w:c;w=null;const l=T();f.value=Math.min(u,f.value+o),k(f.value),function(e,o){if(!t)return void L(o);C=!0;const l=++M;le().then(()=>{var t;if(l!==M)return;const r=T(),i=Math.max(o,r-e),a=()=>{l===M&&L(i)};if(p){let e=null,o=null,l=!1;const r=()=>{l||(l=!0,null!==e&&(B.delete(e),e=null),null!==o&&(I.delete(o),window.clearTimeout(o),o=null),a())};return e=p(()=>{r()}),B.add(e),o=window.setTimeout(()=>{null!==e&&g&&g(e),r()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,T()-l)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(w=null!=w?Math.max(w,c):c,null==x){if(!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return S="idle",void(x=window.requestIdleCallback(()=>d(),{timeout:e}))}if(p&&!o)return S="raf",void(x=p(()=>{0===m?d():(S="timeout",x=window.setTimeout(()=>d(),m))}));S="timeout",x=window.setTimeout(()=>d(),m)}}function A(e,n={}){C?_=!0:null==e?$():H(e,n)}function $(){s.value&&H(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return X([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 x=v.value,S=null!=(e=n.renderBatchDelay)?e:16,w=x.batchSize!==c.value||x.initial!==d.value||x.delay!==S||x.enabled!==s.value;v.value={batchSize:c.value,initial:d.value,delay:S,enabled:s.value},p&&N(o),(y||w||!s.value)&&O(),(y||w)&&(m.value=Math.max(1,c.value||1)),y&&b();const M=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=M,void k(f.value);const C=p||0===l.total;f.value=C||w?Math.min(M,d.value):Math.min(f.value,M);const _=Math.max(1,d.value||c.value||o);f.value<M?A(_,{immediate:!t}):k(f.value)},{immediate:!0}),X(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&A())}),{cleanupBatchScheduler:O}}({props:E,isClient:Ke,isTestEnv:Ct,parsedNodesIdentity:Kn,parsedNodeCount:zn,desiredRenderedCount:Wl,datasetKey:Rr,batchingEnabled:Ot,incrementalRenderingActive:Tt,resolvedBatchSize:Bt,resolvedInitialBatch:It,renderedCount:Lt,adaptiveBatchSize:zt,previousRenderContext:Rt,previousBatchConfig:jt,requestFrame:St,cancelFrame:wt,hasIdleCallback:Mt,cleanupNodeVisibility:lr,onDatasetKeyChanged:e=>{ja(),vl(),Oo(),Ta(),e>0&&rl(e)},onDatasetChanged:()=>{vt.value&&Jl({immediate:!0})}});X([wl,vt,()=>V.value,()=>He()],([e,n])=>{if(!e)return ir(),void Yl();ar(),n?Jl({immediate:!0}):Yl()},{flush:"post",immediate:!0}),X([()=>Rn.value.length,()=>vt.value],e=>s(null,[e],function*([e,n]){n&&e&&Ke&&(yield le(),Jl({immediate:!0}))}),{flush:"post"}),X(it,e=>{e&&function(){var e;if(Wn.value&&jn.value&&Dn.value&&(null==(e=Vn.value)?void 0:e[1]))return;const n=he({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=he({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=he({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Wn.value=n,jn.value=t,Dn.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=he({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Vn.value=l}()},{immediate:!0}),X([()=>V.value,it],()=>{if(!it.value)return pr(),void(ke.value=0);hr(),pr(),it.value&&V.value&&"undefined"!=typeof ResizeObserver&&(vr=new ResizeObserver(()=>{hr(),Ro.value&&jo(),So.value&&$i(),Pa("resize")}),vr.observe(V.value))},{immediate:!0}),X([it,ct,$r],()=>s(null,null,function*(){if(!it.value)return we.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(){if(!it.value||"undefined"==typeof window)return we.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Oo();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=fr(dr(Y.value),".paragraph-node");e.paragraph=Qr(Y.value,n,"pre-wrap");const t=dr(Z.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=Qr(Z.value,o,"pre-wrap");const l=In("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=oe.value)?void 0:e.offsetHeight)?n:0}),r=In("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=Z.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=fr(dr(fe[i]),`h${i}`);e.headings[i]=Qr(fe[i],n,"pre-wrap")}we.value=e,Oo()}()}),{flush:"post",immediate:!0}),X(()=>Rn.value.length,()=>{vt.value&&Jl({immediate:!0})}),X([it,ke],()=>{Oo(),vt.value&&Jl({immediate:!0}),Ro.value&&jo(),So.value&&$i(),Pa("resize")},{immediate:!1}),X(()=>Nl.value,e=>{if(e)for(const[n,t]of Jt)za(n,t);else if(rr(),vt.value)Jl({immediate:!0});else for(const[n,t]of Jt)t&&or(n,!0)},{immediate:!1}),X([Te,Le,()=>He()],()=>{var e;null==(e=xt.refresh)||e.call(xt);for(const[n,t]of Jt)za(n,t)},{immediate:!1}),X([()=>E.viewportPriority,()=>Rn.value.length,Le],([e,n,t])=>{if(!1!==e){if(me.value&&(n<=200||n<=t)){me.value=!1;for(const[e,n]of Jt)za(e,n)}}else me.value=!1}),X(()=>Lt.value,()=>{vt.value&&Jl({immediate:!0})}),X([Ml,ft,mt,()=>Rn.value.length,vt],()=>{_l()},{immediate:!0});let Ja=null,Za=!1,Qa=null;function eu(){Ja=null,Xr=null,Ur=void 0,Yr=null,Ta()}function nu(){ja(),vl(),Oo(),io.clear();const e=Rn.value.length;e>0&&rl(e),ra()}function tu(){$a(),ql(),xa=null,Wi=null,ji=null,Di=null,Vi=null,qi=null,Za=!1,eu(),zr("restore"),Wo(),Ai()}function ou(e){var n;return[null!=(n=Ir())?n:"",Br(),Lr(),Ar.value,Ia(e),Rn.value.length,Math.round(Lo(0,Rn.value.length)),Math.round(Hr()),Go.count,Math.round(Go.total)].join(":")}function lu(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=Ia(r),a=Br(),u=Ir(),s=$r.value;if(ot.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&Zr(r))if(ai()){if(ou(r)!==Yr&&!Za){Za=!0;try{const e=yield ga({reason:"manual",expectedSettledTokenKey:i}),n=Ia()===i;pa(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(Yr=ou(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{Za=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=Zr(e)?ou(e):"";pa(a,u,s)&&n&&Yr!==n&&lu()}}}else Pa("manual")})}X(ot,(e,n)=>{if(e!==n){if(!e)return tu(),void $a();tu(),nu(),Qa=$r.value,Pa("content")}},{flush:"post"}),X([ot,$r],([e,n])=>{e?null!=Qa?Qa!==n&&(Qa=n,function(e="resize"){ja(),vl(),Oo(),io.clear();const n=Rn.value.length;n>0&&rl(n),ra(),Wi=null,ji=null,Di=null,xa=null,Za=!1,eu(),Xi(),le(()=>{Va(),Ro.value&&jo(),So.value&&$i(),Pa(e)})}("resize")):Qa=n:Qa=null},{flush:"post",immediate:!0}),X([ot,()=>Br(),()=>Ir()],([e])=>{e&&(tu(),nu(),zr("content"),Pa("content"))}),X([ot,()=>Br(),()=>Ir(),$r,()=>Rn.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(El.entries()))Er(o)||(El.delete(t),Pl.delete(t),n=!0);n&&(Pr(),Pa(e))}("async-node")},{flush:"post"}),X([ot,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>pe.value],([e])=>{e&&(Ta(),function(e="content"){if(!ot.value)return;const n=[],t=Rn.value.length,o=cr(t);for(const l of Array.from(io.keys())){if(l>=t){n.push(l);continue}if(l<o)continue;const e=_i(l),r=io.get(l);null!=r&&r!==e&&n.push(l),io.set(l,e)}for(const l of Array.from(io.keys()))l>=t&&io.delete(l);n.length&&(function(e,n={}){const t=Array.from(e,Number);fl(t);let o=0;if(ml(()=>(o=al(t,n),o>0)),o>0)!function(e){for(const n of e)io.delete(n)}(t);else for(const l of t)ho.delete(l)}(n,{notify:!1}),Oo(),eu(),Ro.value&&jo(),So.value&&$i(),Pa(e))}("content"))},{flush:"post",immediate:!0}),X([ot,()=>Rn.value.length,()=>Br(),()=>Ir()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&eu()},{flush:"post"}),X([ot,()=>{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},()=>Rn.value.length,()=>Br(),ke],()=>{Xi()},{flush:"post",immediate:!0}),X([ot,()=>{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},()=>Rn.value.length,()=>Br(),ke],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)}();Yi(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),X([ot,ke,()=>{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&&Wi&&"restore"===ji&&(Fi(t)||(nu(),Wi=null,ji=null,Pa("resize")))},{flush:"post"}),X([ot,()=>Rn.value.length,()=>Br(),ke],e=>s(null,[e],function*([e]){var n;const t=Vi,o=qi;e&&t&&(yield le(),!Yi(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)})&&ta(t)||(Vi=null,qi=null))}),{flush:"post",immediate:!0}),X([ot,on,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Br(),()=>Ir(),$r,Kl,Rl,()=>Lt.value,Wl,()=>Go.count,()=>Go.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!si())return;const o=function(){var e;const n=Rn.value.length;return[null!=(e=Ir())?e:"",Br(),Lr(),Ar.value,n,Math.round(Lo(0,n)),Math.round(Hr()),Go.count,Math.round(Go.total)].join(":")}();Ja!==o&&(Ja=o,ga({reason:"final"}).then(e=>{e.stable||Ja!==o||(Ja=null)}))},{flush:"post",immediate:!0}),X([ot,on,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Br(),()=>Ir(),$r,Kl,Rl,()=>Lt.value,Wl,()=>Rn.value.length,()=>Go.count,()=>Go.total],()=>{lu()},{flush:"post",immediate:!0}),X([()=>Rn.value.length,vt,ft,mt,()=>Cl.start,()=>Cl.end],([e,n,t,o,l,r])=>{We.value&&yn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Ml.value,scroll:n?(()=>{const e=bo.value||Xe();return e?{reverse:Ye(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:Lt.value})}),X([()=>E.customId],([e],n,t)=>{if(!e||qn)return;const o=function(e,n){return e?(Kr.controllers[e]=n,()=>{Kr.controllers[e]===n&&delete Kr.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Do,restoreAnchor:Vo,getAnchorDrift:qo,getReport:Mr});t(()=>{o()})},{immediate:!0}),te(()=>{!function(){if(ot.value)try{Va(),ia();const e=mi("manual");Ba(e)&&(z(e),xa=e,ba=_a());const n=Oi(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(W(n),n.anchor&&j(n.anchor),Sa=Ha(n))}catch(e){}}(),Ya(),rr(),vn(),qa();for(const e of Ol.values())for(const n of e)Vl(n);Ol.clear(),Il.clear(),io.clear(),Ua(),ja(),pr(),Wo(),Ai(),$a(),ir(),Yl()});const ru=$t("ViewportDeferredMermaidBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),Ht}}),loadingComponent:sa,delay:0}),sa),iu=$t("ViewportDeferredInfographicBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./index9.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),Ht}}),loadingComponent:ua,delay:0}),ua),au=$t("ViewportDeferredD2BlockNode",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),Ht}})),Ht),uu={text:At,paragraph:zo,heading:Bo,code_block:Pt,list:Ao,list_item:Ho,blockquote:po,table:Xo,definition_list:No,footnote:Mo,footnote_reference:cn,footnote_anchor:xo,admonition:Ma,vmr_container:el,hardbreak:ao,link:Qt,image:ht,thematic_break:Jo,math_inline:Et,math_block:Ft,strong:qt,emphasis:ro,strikethrough:Gt,highlight:oo,insert:no,subscript:Dt,superscript:Wt,emoji:an,checkbox:ln,checkbox_input:ln,inline_code:Cn,html_inline:Sn,reference:Kt,html_block:Eo},su=P(()=>Cr()),cu=P(()=>ni(E.codeBlockProps)),du=P(()=>ni(E.codeBlockProps)),fu=P(()=>u(a(a({stream:E.codeBlockStream,darkTheme:E.codeBlockDarkTheme,lightTheme:E.codeBlockLightTheme,themes:E.themes,minWidth:E.codeBlockMinWidth,maxWidth:E.codeBlockMaxWidth},"boolean"==typeof je.value?{showTooltips:je.value}:{}),du.value),{codeBlockOptions:E.codeBlockOptions})),mu=P(()=>u(a(a({},fu.value),cu.value),{codeBlockOptions:E.codeBlockOptions}));function hu(e){return"boolean"==typeof e?e:void 0}const vu=P(()=>{var e,n;const t=E.codeBlockProps||{},o={},l=hu(t.showLineNumbers),r=null==(e=E.codeBlockOptions)?void 0:e.disableLineNumbers;o.showLineNumbers=null!=l?l:"boolean"==typeof r&&!r,(null==(n=E.codeBlockOptions)?void 0:n.overflow)&&(o.style={whiteSpace:"scroll"===E.codeBlockOptions.overflow?"pre":"pre-wrap"});const i=hu(t.diffInline);void 0!==i&&(o.diffInline=i);const a=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(t.reservedHeightPx);return void 0!==a&&(o.reservedHeightPx=a),o}),pu=P(()=>a({},E.mermaidProps||{})),gu=P(()=>a({},E.d2Props||{})),yu=P(()=>a({},E.infographicProps||{})),ku=P(()=>({typewriter:p.value,fade:E.fade,customHtmlTags:$n.value.customHtmlTags})),Nu=P(()=>a(a({},ku.value),"boolean"==typeof je.value?{showTooltip:je.value}:{})),bu=P(()=>a(a({},ku.value),"boolean"==typeof je.value?{showTooltips:je.value}:{})),xu=P(()=>a(a({},ku.value),"boolean"==typeof je.value?{showTooltips:je.value}:{})),Su=P(()=>a(a({},ku.value),"boolean"==typeof je.value?{showTooltips:je.value}:{}));function wu(e){return Array.isArray(e.children)&&e.children.length>0}const Mu=P(()=>br.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=lo.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return lo.set(s,{signature:c,node:f}),f}(e.node);const f=Cu(d);let m=Tu(d,f);if(("html_block"===d.type||"html_inline"===d.type)&&m===uu[d.type]){const e=d,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=Hn.value[r];if(An.value.has(r)&&n)m=n,d=u(a({},e),{type:r,tag:r,content:H(e.content,r)});else if(_(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===d.type?(m=At,d={type:"text",content:n,raw:n}):(m=zo,d={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const h="code_block"===d.type&&y.value&&m===Ht&&!_u(Hn.value,f);let v=a({},function(e,n,t){const o=null!=n?n:Cu(e);if("code_block"===e.type){const n=o?_u(Hn.value,o):void 0;if(t&&y.value&&!n&&t===Ht)return vu.value;if(t&&o&&t===n)return"mermaid"===o?Iu(e):"infographic"===o?Ou(e):"d2"===o||"d2lang"===o?gu.value:mu.value;if(t&&t===Hn.value.code_block)return mu.value}return"mermaid"===o?Iu(e):"infographic"===o?Ou(e):"d2"===o||"d2lang"===o?gu.value:"link"===e.type?Nu.value:"list"===e.type?bu.value:"blockquote"===e.type?xu.value:"table"===e.type?Su.value:"code_block"===e.type?fu.value:ku.value}(d,f,m));const p=it.value?Nr.value[e.index]:null;"code_block"===d.type&&"code-block"===(null==p?void 0:p.kind)&&(v=u(a({},v),h?{reservedHeightPx:null!=(r=p.height)?r:p.contentHeight}:{estimatedHeightPx:p.height,estimatedContentHeightPx:p.contentHeight,estimatedDiffInline:p.diffInline})),h||"code_block"!==d.type||"mermaid"!==f||null!=Fe(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:$e(Re(String(null!=(i=d.code)?i:"")))})),h||"code_block"!==d.type||"infographic"!==f||null!=Fe(v.estimatedPreviewHeightPx)||(v=u(a({},v),{estimatedPreviewHeightPx:Pe(Ee(String(null!=(s=d.code)?s:"")))})),"math_block"===d.type&&(v=u(a({},v),{cacheScope:Ln}));const g=function(e,n){const t=String(e.type);return!qe(t)&&Hn.value[t]===n}(d,m),k=g?pn(d,De.value):void 0;return u(a({},e),{node:d,component:m,bindings:v,customBindings:a(a({},null!=k?k:{}),v),rendersCustomNode:g,hasSlotChildren:wu(d),slotContent:String(null!=(c=d.content)?c:""),isCodeBlock:"code_block"===d.type,indexKey:`${su.value}-${e.index}`,vnodeKey:`${Or.value}\0${e.index}\0${d.type}`})}));function Cu(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function _u(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Oe(t),Be(t)]){const n=o&&e[o];if(n)return n}}function Bu(e,n,t,o){var l,r;const i=a({},e.value);return null==Fe(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Fe(i.maxHeight))?r:void 0)),i}function Iu(e){return Bu(pu,e,Re,$e)}function Ou(e){return Bu(yu,e,Ee,Pe)}function Tu(e,n){if(!e)return Qo;const t=Hn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:Cu(e),r=l?_u(t,l):void 0;if(r)return r;if(y.value)return t.code_block||Ht;if("mermaid"===l)return t.mermaid||ru;if("infographic"===l)return t.infographic||iu;if("d2"===l||"d2lang"===l)return t.d2||au;if(o)return o;return t.code_block||gr.value}return o||uu[String(e.type)]||Qo}function Lu(e){l("click",e)}function Hu(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function Au(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function $u(e){l("mouseover",e)}function Ru(e){l("mouseout",e)}const Pu=G(null),Eu=G(!1),Fu=G(null),Ku=P(()=>!("minimal"!==E.domMode||ze.value||!1!==E.fade||p.value||Eu.value||Vt.value||vt.value||et.value||Xn.value||bt.value||0!==Object.keys(Hn.value).length));let zu,Wu=null,ju=0,Du=0,Vu=0;const qu=["code_block","admonition","table","math_block","html_block","image","thematic_break"],Uu=new Set(qu),Gu=[".typewriter-cursor",".height-estimation-probes",...qu.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function Xu(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&Uu.has(n)}function Yu(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+Yu(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+Yu(n),0):0}function Ju(){zu&&(clearTimeout(zu),zu=void 0)}function Zu(){ju+=1,null!=Wu&&(null==wt||wt(Wu),Wu=null)}function Qu(){Zu(),os(),Pu.value&&(Pu.value.style.visibility="hidden")}function es(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(Gu)}function ns(e){let n=e.lastChild;for(;n;){if(es(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(Gu)&&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 ts(){const e=Mu.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||Xu(t.node)||!Fa(t.index))continue;const o=Jt.get(t.index);if(!o)continue;const l=ns(o);if(l)return l}return null}function os(){Fu.value&&(Fu.value.classList.remove(ha),Fu.value=null)}function ls(){if("simple"!==v.value||!Ke||!Eu.value||!V.value)return void os();const e=ts(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==Fu.value&&(os(),n&&(n.classList.add(ha),Fu.value=n))}function rs(){if("precise"!==v.value)return;if(!Ke||!Eu.value)return;if(null!=Wu)return;const e=ju,n=()=>{Wu=null,e===ju&&function(){var e,n;if("precise"!==v.value)return;if(!(Ke&&Eu.value&&V.value&&Pu.value))return;const t=V.value,o=Pu.value;o.style.visibility="hidden";const l=ts();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=In("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};St?Wu=St(n):n()}return X([nn,()=>o.content,()=>o.nodes,()=>E.typewriter,on],()=>s(null,null,function*(){var e,n;if(!Ke||ze.value||!Ue.value)return;if(on.value)return Eu.value=!1,Ju(),void Qu();if(null==(e=o.nodes)?void 0:e.length)return Eu.value=!1,Ju(),Qu(),Du=(null!=(n=o.content)?n:"").length,void(Vu=nn.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+Yu(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+Yu(n),0):nn.value.length}(),r=!Xu(Rn.value[Rn.value.length-1]),i=t>Du,a=l>Vu;if(!p.value||!r||!i&&!a)return p.value&&r||(Eu.value=!1,Qu()),Du=t,void(Vu=l);Du=t,Vu=l,Eu.value=!0,"precise"===v.value&&Pu.value&&(Pu.value.style.visibility="hidden"),Ju(),yield le(),"simple"===v.value?ls():(os(),rs()),zu=setTimeout(()=>{zu=void 0,Eu.value=!1},3e3)}),{flush:"post",immediate:!0}),X(Eu,e=>s(null,null,function*(){e?(yield le(),"simple"!==v.value?(os(),"precise"===v.value&&rs()):ls()):Qu()}),{flush:"post"}),X(v,()=>s(null,null,function*(){if(Ke&&!ze.value&&Ue.value&&Eu.value){if(yield le(),"simple"===v.value)return Zu(),void ls();os(),"precise"!==v.value?Qu():rs()}}),{flush:"post"}),X([()=>Lt.value,()=>Cl.start,()=>Cl.end],()=>s(null,null,function*(){Ke&&!ze.value&&Ue.value&&Eu.value&&(yield le(),"simple"!==v.value?(os(),"precise"===v.value&&rs()):ls())}),{flush:"post"}),te(()=>{Ju(),Zu(),os(),Tn.clear()}),(e,n)=>{const t=Se("NodeRenderer",!0);return q(ze)?(F(!0),K(J,{key:0},de(Mu.value,e=>(F(),K(J,{key:e.vnodeKey},[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onClick:Lu,onMouseover:$u,onMouseout:Ru,onCopy:n[0]||(n[0]=e=>r(e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onClick:Lu,onMouseover:$u,onMouseout:Ru,onCopy:n[2]||(n[2]=e=>r(e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(F(),K("div",{key:1,ref_key:"containerRef",ref:V,class:D(["markstream-vue markdown-renderer",[{dark:E.isDark},{virtualized:vt.value},{"virtual-scroll-coordinated":rt.value},{"stable-layout":xl.value},{"typewriter-simple-cursor":Eu.value&&"simple"===v.value}]]),"data-custom-id":E.customId,onClick:Lu,onMouseover:Hu,onMouseout:Au},[at.value||vt.value?(F(),K(J,{key:0},[at.value?(F(),ie(aa,{key:0,width:ct.value,"flow-root":vt.value||rt.value,"paragraph-node":Wn.value,"list-item-node":jn.value,"list-node":Dn.value,"heading-nodes":Vn.value,"set-paragraph-wrapper":Ul,"set-list-item-wrapper":Gl,"set-list-wrapper":Xl,"set-heading-wrapper":mr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Q("",!0),vt.value?(F(),K("div",{key:1,class:"node-spacer",style:ce({height:`${xr.value}px`}),"aria-hidden":"true"},null,4)):Q("",!0)],64)):Q("",!0),Ku.value?(F(!0),K(J,{key:1},de(Mu.value,e=>(F(),K(J,{key:e.vnodeKey},[Fa(e.index)?(F(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>r(e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):Q("",!0)],64))),128)):(F(!0),K(J,{key:2},de(Mu.value,e=>(F(),K("div",{key:e.vnodeKey,ref_for:!0,ref:n=>za(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[Fa(e.index)?(F(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Cr()}-${e}`;let t=!1;for(const o of Array.from(Pl.keys())){const l=El.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Pl.delete(o),El.delete(o),t=!0)}t&&(Pr(),Pa("async-node"))}(e),Ll.delete(e),function(e){var n;const t=(null!=(n=Il.get(e))?n:0)+1;Il.set(e,t)}(e);const o=Ol.get(e);if(o){for(const e of o)Vl(e);Ol.delete(e)}if(function(e){const n=Zt.get(e);n&&(null==to||to.unobserve(n),eo.delete(n),Zt.delete(e))}(e),!n||!pt.value)return Bl.delete(e),void Il.delete(e);Bl.set(e,n);const l=()=>{Da(e,n)};queueMicrotask(l);const r=(to||"undefined"==typeof ResizeObserver||(to=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=eo.get(n.target),t=Zt.get(null!=e?e:-1);null!=e&&t&&Da(e,t)}else Va()})),to);if(r&&(Zt.set(e,n),eo.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=Rn.value[e])?void 0:t.type)?[16,80,240,800]:on.value?[80]:[];if(n.length){const t=n.map(e=>Dl(e,l,"node-resize")).filter(e=>null!=e);t.length&&Ol.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[12]||(n[12]=e=>r(e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[14]||(n[14]=e=>r(e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ge,{key:0,name:"fade",css:!1!==E.fade,appear:!1!==E.fade},{default:se(()=>[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[8]||(n[8]=e=>r(e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[10]||(n[10]=e=>r(e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(F(),K("div",{key:1,class:"node-placeholder",style:ce({height:`${To(e.index)}px`})},null,4))],8,ma))),128)),Eu.value&&"precise"===v.value?(F(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:Pu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Q("",!0),vt.value?(F(),K("div",{key:4,class:"node-spacer",style:ce({height:`${Sr.value}px`}),"aria-hidden":"true"},null,4)):Q("",!0)],42,fa))}}})),[["__scopeId","data-v-1616e21d"]]),pa=va;pa.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",pa.__name,pa.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,va)};const ga=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:pa},Symbol.toStringTag,{value:"Module"})),ya={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"},ka={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"},Na={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"},ba={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"},xa={class:"admonition-title"},Sa=["aria-expanded","aria-controls"],wa=["id"],Ma=/* @__PURE__ */on(/* @__PURE__ */E({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=P(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),i=G(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(F(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),K("svg",ya,[...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?(F(),K("svg",ka,[...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?(F(),K("svg",Na,[...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?(F(),K("svg",ba,[...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)])])):Q("",!0),z("span",xa,W(r.value),1),o.node.collapsible?(F(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),K("svg",{style:ce({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,Sa)):Q("",!0)]),fe(z("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(pa),{"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,wa),[[me,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Ma.install=e=>{e.component(Ma.__name,Ma)};const Ca=()=>import("@terrastruct/d2");let _a=null,Ba=Ca,Ia=null,Oa=!1,Ta=!1,La=0;function Ha(e){Ba=e,La++,_a=null,Ia=null,Oa=!1,Ta=!1}function Aa(e){Ha(null!=e?e:Ca)}function $a(){Ha(null)}function Ra(){return"function"==typeof Ba}function Pa(){return s(this,null,function*(){if(_a)return _a;const e=Ba,n=La;return e?e===Ca&&Oa?null:Ia||(Ia=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===Ca)return n===La&&e===Ba&&(Oa=!0,function(e){Ta||(Ta=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===La&&e===Ba&&(Ia=null)}return n!==La||e!==Ba?null:t?(_a=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(t),_a):null}),Ia):null})}let Ea=null,Fa=null,Ka=null,za=0;function Wa(e){Fa=null!=e?e:null,Ea=null,Ka=null,za++}function ja(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Wa(e)}function Da(){Wa()}function Va(){return"function"==typeof Fa}function qa(){return s(this,null,function*(){if(Ea)return Ea;const e=Fa,n=za;return e?Ka||(Ka=s(null,null,function*(){const t=yield e();if(n!==za||e!==Fa)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!==za||e!==Fa?null:o?(Ea=o,Ea):null}).finally(()=>{n===za&&e===Fa&&(Ka=null)}),Ka):null})}function Ua(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function Ga(e,n){null==e||e(n)}function Xa(e,n){return e?(Ga(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function Ya(e,n){const t=Xa(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;Ga(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=Ua(o.marginTop),r=Ua(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function Ja(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):Ya(e,n),r=Xa(o,n);return Math.max(0,l-r)}function Za(e){return"measured"===e||"final"===e}function Qa(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 eu(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 nu(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 tu(e,n,t){var o;const l=null==(o=t.getFinal)?void 0:o.call(t,e,n);if("boolean"==typeof l)return l;const r=e.final;return"boolean"!=typeof r||r}function ou(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function lu(e,n,t){const o=eu(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&nu(e,n,t).length>0}function ru(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=eu(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:nu(e,n,t).length>0?360:96}function iu(e){const n=ye(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=ye(/* @__PURE__ */new Map),l=ye(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=G(!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,x=null,S=!1,w=null;function M(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(le(e),null)}function _(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function B(){return[...Me(e.items)]}function I(){const n=Me(e.threadKey);return null==n?void 0:String(n)}function O(n,t){return Qa(n,t,e)}function T(n,t){return lu(n,t,e)}function L(n,t){const o=O(n,t),l=I(),r=ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function H(){const n=Me(e.measurementKey);return null==n?void 0:String(n)}function A(){const n=Me(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function $(){return!0===Me(e.renderCodeBlocksAsPre)}function R(){var e;const n=$()?"pre":"rich";return`${null!=(e=H())?e:""}${A()}${n}`}function P(n,t){if(T(n,t))return L(n,t);const o=O(n,t),l=I(),r=ou(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function E(e){const n=B();for(let t=0;t<n.length;t++){const o=n[t];if(O(o,t)===e)return{item:o,index:t}}return null}function F(e,n){var t;const o=E(e);if(!o||!n)return!1;if(n.sourceKey!==P(o.item,o.index))return!1;const l=T(o.item,o.index)?R():H();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!F(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=E(e);return!!(l&&n&&T(l.item,l.index)&&n.sessionKey===L(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=I())?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 D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!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 V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function q(e){return Number.isFinite(e)&&e>0?e:null}function U(){if(!S)return;S=!1,w=null;const e=N;N=void 0,e&&ue(e)}function X(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function J(o,l,r=function(e){const n=E(e);return n?function(e,n){const t=T(e,n)?R():H();return a({sourceKey:P(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!=(x=null==f?void 0:f.widthBucket)?x:0)));var c,f,h,p,y,k,b,x;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(()=>{se(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,_=M?ie():void 0,B=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),I=M&&B<=2,O=M&&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),M&&((L=I?{type:"bottom",distanceFromBottomPx:0}:O?{type:"bottom",distanceFromBottomPx:B}:_)&&(S||(N=L,S=!0,w=C(U))))}function Z(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Q(){if(!b)return;b=!1,x=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ne(n,{allowMarkdownShrink:t.allowMarkdownShrink});U()}function ee(){Q(),U()}function ne(n,t={}){const o=function(e){return Ya(s.get(e),M)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=E(e);return!!n&&T(n.item,n.index)}(n))return o>0&&J(n,o),void i();const a=V(n),u=function(e,n){return Ja(s.get(e),M,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&J(n,e),void i()}const c=E(n);return c&&!nu(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 te(){const e={},n=B();for(let t=0;t<n.length;t++){const o=O(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function oe(){const e={},n=B();for(let o=0;o<n.length;o++){const l=O(n[o],o),r=t.get(l);F(l,r)&&(e[l]=r)}return e}function re(){const e={};for(const[n,t]of o)e[n]=t;return e}function ie(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=B();for(let a=0;a<l.length;a++){const t=O(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:O(i,r.start),offsetWithinItemPx:0}:void 0}function ae(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=H())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&F(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ue(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function se(e,n){e===h&&ue(n)}function ce(e){e===h&&(d.value=!1,ee(),se(e,m),m=void 0,g=0)}function de(){X(),_(w),S=!1,w=null,N=void 0,_(x),b=!1,x=null,k.clear();for(const e of c.values())e.disconnect();c.clear(),s.clear(),t.clear(),l.clear(),r.clear(),i.clear()}return ke()&&Y(de),{itemHeights:n,markdownStates:o,getItemKey:O,isMarkdownItem:T,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=O(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void Z(i);if(u===a)return void ne(i);if(Z(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ne(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ne(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=O(n,t),r=tu(n,t,e),a=I(),u=nu(n,t,e),s=L(n,t),c=R(),d=A(),f=$(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=we(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=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,renderCodeBlocksAsPre:f,nodeVirtual:!!r&&"auto",maxLiveNodes:r?50:void 0,liveNodeBuffer:r?16:void 0,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==L(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:R()});const o=function(e){return"final"===e.phase||!(!0!==e.final||!Za(e.confidence))||!!e.stable&&(Za(e.confidence)||function(e){var n,t,o,l;const r=Number(e.nodeCount),i=Number(e.measuredCount),a=Math.max(0,Number(null!=(t=null==(n=e.liveRange)?void 0:n.start)?t:0)),u=Math.min(r,Math.max(a,Number(null!=(l=null==(o=e.liveRange)?void 0:o.end)?l:0))),s=Math.max(0,u-a);return!0===e.final&&!0===e.stable&&"mixed"===e.confidence&&r>0&&i>0&&i<r&&(s<=0||i>=s)}(e))}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),b||(b=!0,x=C(Q))},onVirtualStateChange(e){e.sessionKey===L(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){ee();const e=H();return u(a({threadKey:I()},null==e?{}:{measurementKey:e}),{outerAnchor:ie(),itemHeights:te(),itemSizeSources:oe(),markdownStates:re()})},preloadThreadState:ae,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(X(),d.value=Boolean(t),g=n,m=t,ae(e),!t)return d.value=!1,m=void 0,void(g=0);se(n,t),le(()=>{se(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{se(n,t),o===f.length-1&&ce(n)},e);p.push(l)}):ce(n)})},dispose:de}}const au=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function uu(e){return re(e)}const su=uu(()=>import("./index3.js")),cu=uu(()=>import("./index5.js")),du=uu(()=>import("./index6.js")),fu=uu(()=>import("./index10.js")),mu=uu(()=>import("./index9.js")),hu=uu(()=>import("./index7.js")),vu=uu(()=>import("./index4.js")),pu=uu(()=>import("./index8.js")),gu={MarkdownRender:pa,NodeRenderer:pa,AdmonitionNode:Ma,BlockquoteNode:po,CheckboxNode:ln,CodeBlockNode:su,DefinitionListNode:No,EmojiNode:an,EmphasisNode:ro,FootnoteNode:Mo,FootnoteReferenceNode:cn,FootnoteAnchorNode:xo,HardBreakNode:ao,HeadingNode:Bo,HtmlBlockNode:Eo,HtmlInlineNode:Sn,HighlightNode:oo,ImageNode:ht,D2BlockNode:hu,InfographicBlockNode:mu,InlineCodeNode:Cn,PreCodeNode:Ht,InsertNode:no,LinkNode:Qt,ListItemNode:Ho,ListNode:Ao,MathBlockNode:cu,MathInlineNode:du,MermaidBlockNode:fu,ParagraphNode:zo,StrikethroughNode:Gt,StrongNode:qt,SubscriptNode:Dt,SuperscriptNode:Wt,TableNode:Xo,TextNode:At,ThematicBreakNode:Jo,VmrContainerNode:el,ReferenceNode:Kt,MarkstreamVirtualTimeline:pu,Tooltip:vu},yu={install(e,n){var t,o;Object.entries(gu).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Le(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(au,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&He(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions),n&&"infographicLoader"in n&&Wa(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Vn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(De,function(e={}){return $(Ge(e))}(n.components))}};export{nu as $,Ma as A,po as B,ln as C,hu as D,an as E,xo as F,Mo as G,ao as H,ht as I,Qe as J,$a as K,Qt as L,au as M,Da as N,Aa as O,zo as P,ja as Q,Kt as R,Gt as S,Xo as T,ru as U,el as V,Ye as W,Pa as X,qa as Y,Ja as Z,Bo as _,su as a,tu as a0,Qa as a1,eu as a2,ou as a3,jn as a4,Ra as a5,xt as a6,Va as a7,lu as a8,Ya as a9,Ze as aa,St as ab,it as ac,Xe as ad,Ha as ae,qn as af,Wa as ag,Wn as ah,iu as ai,ai as aj,ot as ak,Yn as al,ea as am,rt as an,tt as ao,No as b,ro as c,cn as d,oo as e,Eo as f,Sn as g,mu as h,Cn as i,no as j,Ho as k,Ao as l,pu as m,cu as n,du as o,fu as p,qt as q,Dt as r,Wt as s,At as t,Jo as u,vu as v,yu as w,pa as x,on as y,Ht 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 w,normalizeCustomHtmlTags as M,getHtmlTagFromContent as C,shouldRenderUnknownHtmlTagAsText as B,getMarkdown as _,mergeCustomHtmlTags as I,resolveCustomHtmlTags as T,parseMarkdownToStructure as O,EXTENDED_STANDARD_HTML_TAGS as L,stripCustomHtmlWrapper as H,setDefaultMathOptions as A}from"stream-markdown-parser";import{shallowRef as $,inject as R,computed as P,defineComponent as E,openBlock as F,createElementBlock as K,createElementVNode as z,toDisplayString as W,h as j,normalizeClass as D,createVNode as V,unref as q,useAttrs as U,ref as G,watch as X,onScopeDispose as J,Fragment as Y,createTextVNode as Z,createCommentVNode as Q,getCurrentInstance as ee,provide as ne,onBeforeUnmount as te,renderSlot as oe,nextTick as le,defineAsyncComponent as re,createBlock as ie,resolveDynamicComponent as ae,mergeProps as ue,withCtx as se,normalizeStyle as ce,renderList as de,withDirectives as fe,vShow as me,markRaw as he,normalizeProps as ve,guardReactiveProps as pe,Transition as ge,reactive as ye,getCurrentScope as ke,onMounted as Ne,watchEffect as be,triggerRef as Se,resolveComponent as xe,toRaw as we,toValue as Me}from"vue";import{resolveStreamingTextUpdate as Ce,createSmoothMarkdownStream as Be,normalizeShikiLanguage as _e}from"markstream-core";import{M as Ie,n as Te,s as Oe,h as Le}from"./index2.js";import{b as He}from"./workers-katexWorkerClient.js";import{a as Ae,b as $e,c as Re,e as Pe,p as Ee}from"./diagramHeight.js";import"./workers-mermaidWorkerClient.js";import"./workers/katexCdnWorker.js";import"./workers/mermaidCdnWorker.js";import"./utils/katex-threshold.js";import"./utils/performance-monitor.js";import"./utils/safeRaf.js";const Fe="__global__",Ke="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",ze=(()=>{const e=globalThis;if(e[Ke])return e[Ke];const n={scopedCustomComponents:{},revision:$(0)};return e[Ke]=n,n})(),We=ze.revision,je=/* @__PURE__ */Symbol("markstreamCustomComponents"),De=/* @__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 Ve(e){return De.has(String(e).trim().toLowerCase())}function qe(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ue(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(qe(t))]))!e||Ve(e)||Object.prototype.hasOwnProperty.call(n,e)||(n[e]=o)}return n}function Ge(e,n){"string"==typeof e?ze.scopedCustomComponents[e]=Ue(n||{}):ze.scopedCustomComponents[Fe]=Ue(e||{}),We.value++}function Xe(e){const n=Ue(ze.scopedCustomComponents[Fe]||{});if(!e)return n;const t=Ue(ze.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(je,null);return P(()=>{var t;return We.value,function(e,n={}){return We.value,a(a(a({},Ue(ze.scopedCustomComponents[Fe]||{})),Ue(n)),Ue(function(e){return e&&ze.scopedCustomComponents[e]||{}}(e)))}(null==e?void 0:e(),null!=(t=null==n?void 0:n.value)?t:{})})}function Ye(e){if(e===Fe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete ze.scopedCustomComponents[e],We.value++}function Ze(){delete ze.scopedCustomComponents[Fe],We.value++}const Qe=["aria-label"],en={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"},nn={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"},tn=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},on=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(F(),K("svg",nn,[...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)])])):(F(),K("svg",en,[...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"]]);on.install=e=>{e.component(on.__name,on)};const ln={class:"emoji-node"},rn=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(F(),K("span",ln,W(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);rn.install=e=>{e.component(rn.__name,rn)};const an=["id"],un=["title"],sn=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#fnref--${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(F(),K("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[z("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+W(e.node.id)+"]",9,un)],8,an))}}),[["__scopeId","data-v-c1463a29"]]);sn.install=e=>{e.component(sn.__name,sn)};const cn=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function dn(e){cn&&console.warn(e)}function fn(e,n="safe",t){return m(e,n,t)}function mn(e){return p(e)}function hn(e){return!0===e?"":!1===e?"false":null==e?null:String(e)}function vn(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),hn(n)]):l.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)&&"name"in e).map(e=>[String(e.name),hn(e.value)]):Object.entries(l).map(([e,n])=>[e,hn(n)]):null,n,t);var l;if(!o)return;const r=mn(v(o));return Object.keys(r).length>0?r:void 0}function pn(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 gn(e,n){Array.isArray(n)?e.push(...n):null!=n&&e.push(n)}function yn(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?[pn(e,n,!0)]:[pn(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=mn(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 kn(e,n){return f(e,n)}function Nn(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=yn(i.tagName,i.attrs||{},[],n,"ms-html-"+o++,t,!0);gn(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=yn(i.tagName,i.attrs||{},i.children,n,i.autoKey,t);l.length>0?gn(l[l.length-1].children,a):gn(r,a),i.tagName.toLowerCase()!==e&&l.length>o&&dn(`Auto-closing unclosed tag: <${i.tagName}>`)}else dn(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;l.length>0;){const e=l.pop(),o=yn(e.tagName,e.attrs||{},e.children,n,e.autoKey,t);l.length>0?gn(l[l.length-1].children,o):gn(r,o),dn(`Auto-closing unclosed tag: <${e.tagName}>`)}return r}(d(e),n,t);return o}catch(l){return o=l,cn&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const bn=["innerHTML"],Sn=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=P(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),l=Je(()=>n.customId),r=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),i=P(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if("escape"===o.value)return{mode:"html",content:b(e,o.value)};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=Nn(e,l.value,o.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!kn(e,l.value))return{mode:"html",content:b(e,o.value)};const t=Nn(e,l.value,o.value);return null===t?{mode:"html",content:b(e,o.value)}:{mode:"dynamic",nodes:t}});return(e,t)=>"dynamic"===i.value.mode?(F(),K("span",{key:0,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[V(q(r),{nodes:i.value.nodes},null,8,["nodes"])],2)):"text"===i.value.mode?(F(),K("span",{key:1,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},W(i.value.content),3)):(F(),K("span",{key:2,class:D(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:i.value.content},null,10,bn))}}),[["__scopeId","data-v-d17f12b0"]]);Sn.install=e=>{e.component(Sn.__name,Sn)};const xn={class:"inline-code"},wn={key:0},Mn=/* @__PURE__ */tn(/* @__PURE__ */E({__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=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;return String(null!=(e=n.node.code)?e:"")}),s=P(()=>!a.value),c=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),d=G(n.node.code),f=G(""),m=G(0);let h;function v(){null==h||h(),h=void 0}function p(){v(),f.value&&(d.value=d.value+f.value,f.value="")}X([()=>n.node.code,c,a],([e])=>{const n=String(null!=e?e:""),t=c.value,o=Ce({nextContent:n,persistedContent:t?null==l?void 0:l.get(t):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:a.value});d.value=o.settledContent,f.value=o.streamedDelta,o.appended?(m.value+=1,function(){if(!f.value||h||!r)return;const e=r.value;h=X(()=>r.value,n=>{n!==e&&p()},{flush:"sync"})}()):f.value||v(),t&&(null==l||l.set(t,n))},{immediate:!0}),J(v);const g=P(()=>m.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(F(),K("code",xn,[s.value?(F(),K(Y,{key:0},[Z(W(u.value),1)],64)):(F(),K(Y,{key:1},[d.value?(F(),K("span",wn,W(d.value),1)):Q("",!0),f.value?(F(),K("span",{key:1,class:D(["inline-code-stream-delta",[g.value]]),onAnimationend:p},W(f.value),35)):Q("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);Mn.install=e=>{e.component(Mn.__name,Mn)};const Cn=G(!1),Bn=G(""),_n=G("top"),In=G(null),Tn=G(null),On=G(null),Ln=G(null),Hn=G(null);let An=null,$n=null,Rn=0;function Pn(){An&&(clearTimeout(An),An=null),$n&&(clearTimeout($n),$n=null)}let En=!1,Fn=null,Kn=!1;function zn(e,n,t="top",o=!1,l,r){if(!e)return;const i=++Rn;Pn();const a=()=>s(null,null,function*(){var o,a;if(yield function(){return s(this,null,function*(){if(!En&&!Kn&&"undefined"!=typeof document){null!=Fn||(Fn=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:Cn.value,"anchor-el":In.value,content:Bn.value,placement:_n.value,id:Tn.value,originX:On.value,originY:Ln.value,isDark:null!=(e=Hn.value)?e:void 0})}}).mount(o),En=!0}));try{yield Fn}catch(e){En=!1,Fn=null,Kn=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}})}(),En&&i===Rn){Tn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,In.value=e,Bn.value=n,_n.value=t,On.value=null!=(o=null==l?void 0:l.x)?o:null,Ln.value=null!=(a=null==l?void 0:l.y)?a:null,Hn.value="boolean"==typeof r?r:null,Cn.value=!0;try{e.setAttribute("aria-describedby",Tn.value)}catch(u){}}});o?a():An=setTimeout(a,80)}function Wn(e=!1){Rn+=1,Pn();const n=()=>{if(In.value&&Tn.value)try{In.value.removeAttribute("aria-describedby")}catch(e){}Cn.value=!1,In.value=null,Tn.value=null,On.value=null,Ln.value=null};e?n():$n=setTimeout(n,120)}const jn={"common.copy":"Copy","common.selectCopy":"全选(复制)","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Dn=/* @__PURE__ */Symbol("markstreamI18nFallback");function Vn(e){Object.assign(jn,e)}function qn(e,n){var t;return null!=(t=null==n?void 0:n[e])?t:jn[e]}const Un=(e,n)=>{var t;return null!=(t=qn(e,n))?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)};function Gn(e,n){return{t(t){const o=qn(t,n);if(e.te&&null!=o&&!e.te(t))return Un(t,n);const l=e.t(t);return l===t&&null!=o?Un(t,n):l}}}function Xn(){const e=function(){var e,n,t;try{const o=ee(),l=Dn,r=null==o?void 0:o.provides,i=null==(e=null==o?void 0:o.appContext)?void 0:e.provides;return null!=(t=null!=(n=null==r?void 0:r[l])?n:null==i?void 0:i[l])?t:null}catch(o){}return null}(),n=function(){var e,n;try{const t=ee(),o=null==t?void 0:t.proxy,l=null==o?void 0:o.$t;if("function"==typeof l){const e=null==o?void 0:o.$te;return{t:l.bind(o),te:"function"==typeof e?e.bind(o):void 0}}const r=null==(n=null==(e=null==t?void 0:t.appContext)?void 0:e.config)?void 0:n.globalProperties,i=null==r?void 0:r.$t;if("function"==typeof i){const e=null==r?void 0:r.$te;return{t:i.bind(r),te:"function"==typeof e?e.bind(r):void 0}}}catch(t){}return null}();if(n)return Gn(n,e);try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const t=n();if(t&&"function"==typeof t.t)return Gn({t:t.t.bind(t),te:"function"==typeof t.te?t.te.bind(t):void 0},e)}catch(t){}}catch(t){}return{t:n=>Un(n,e)}}const Jn=/* @__PURE__ */Symbol("ViewportPriority"),Yn=/* @__PURE__ */Symbol("ViewportPriorityOptions"),Zn=/* @__PURE__ */Symbol("OffscreenHeavyNodeDeferral"),Qn=P(()=>!1),et="400px";function nt(){return R(Yn,void 0)}function tt(){return R(Zn,Qn)}function ot(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?G(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null,u=/* @__PURE__ */new WeakMap;let s=1;const c=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map,f=/* @__PURE__ */new Set;let m=null,h=null;function v(e){if(!e)return"viewport";let n=u.get(e);return n||(n=s++,u.set(e,n)),String(n)}function p(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}function g(e){if(e){const t=c.get(e);if(t&&!t.targets.size){try{t.io.disconnect()}catch(n){}c.delete(e)}}d.size||f.size||p()}function y(e){const n=d.get(e);if(!n)return;const t=c.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(o){}}try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)}function k(){!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&i&&null==m&&f.size&&(m=i(()=>{m=null;const e=f.values().next().value;e&&(f.delete(e),y(e),f.size&&k())},{timeout:1200}))}function N(n,t){if(!l)return null;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:et,threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t),r=[v((i=o).root),i.rootMargin,i.threshold].join("\0");var i;const a=c.get(r);if(a)return{key:r,bucket:a};let u;try{u=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&y(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold})}catch(d){return null}const s={io:u,targets:/* @__PURE__ */new Map};return c.set(r,s),{key:r,bucket:s}}function b(){if(l&&r.value)for(const[n,t]of Array.from(d.entries())){const o=N(n,t.opts);if(!o){y(n);continue}if(o.key===t.bucketKey)continue;const l=t.bucketKey,r=c.get(l);try{null==r||r.io.unobserve(n)}catch(e){}null==r||r.targets.delete(n),t.bucketKey=o.key,o.bucket.targets.set(n,t),o.bucket.io.observe(n),g(l)}}X(r,e=>{if(!e){for(const e of Array.from(d.keys()))y(e);p()}},{flush:"sync"});const S=(e,n)=>{const t=G(!1);let o,i=!1;const a=new Promise(e=>{o=()=>{i||(i=!0,e())}}),u=()=>{const n=d.get(e);if(!n)return f.delete(e),void g();const t=c.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(o){}null==t||t.targets.delete(e),d.delete(e),f.delete(e),g(n.bucketKey)};if(!l||!r.value)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const s=N(e,n);if(!s)return t.value=!0,o(),{isVisible:t,whenVisible:a,destroy:u};const m={resolve:o,visible:t,bucketKey:s.key,opts:n};return d.set(e,m),s.bucket.targets.set(e,m),s.bucket.io.observe(e),l&&null==h&&(h=window.requestAnimationFrame(()=>{h=null,b()})),!1!==(null==n?void 0:n.allowIdle)&&(f.add(e),k()),{isVisible:t,whenVisible:a,destroy:u}};return S.refresh=b,ne(Jn,S),S}function lt(){var e,n;const t=R(Jn,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new Map,r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,u="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,s=()=>{if(null!=i){try{null==u||u(i)}catch(e){}i=null}},c=e=>{if(!e)return;const n=l.get(e);if(n&&!n.targets.size){try{n.io.disconnect()}catch(t){}l.delete(e)}},d=e=>{const n=o.get(e);if(!n)return;const t=l.get(n.bucketKey);if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(i){}}try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},f=()=>{!0!==window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__&&a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&f())},{timeout:1200}))};return(e,n)=>{const t=G(!1);let i,a=!1;const u=new Promise(e=>{i=()=>{a||(a=!0,e())}}),m=()=>{const n=o.get(e);if(!n)return r.delete(e),void(r.size||s());const t=l.get(n.bucketKey);try{null==t||t.io.unobserve(e)}catch(i){}o.delete(e),null==t||t.targets.delete(e),r.delete(e),c(n.bucketKey),r.size||s()},h=(e=>{var n,t;if("undefined"==typeof window||"undefined"==typeof IntersectionObserver)return null;const o=(e=>{var n,t;return[null!=(n=null==e?void 0:e.rootMargin)?n:et,null!=(t=null==e?void 0:e.threshold)?t:0].join("\0")})(e),r=l.get(o);if(r)return{key:o,bucket:r};const i=null!=(n=null==e?void 0:e.rootMargin)?n:et;let a;try{a=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:i,threshold:null!=(t=null==e?void 0:e.threshold)?t:0})}catch(s){return null}const u={io:a,targets:/* @__PURE__ */new Set};return l.set(o,u),{key:o,bucket:u}})(n);return h?(o.set(e,{resolve:i,visible:t,bucketKey:h.key}),h.bucket.targets.add(e),h.bucket.io.observe(e),!1!==(null==n?void 0:n.allowIdle)&&(r.add(e),f()),{isVisible:t,whenVisible:u,destroy:m}):(t.value=!0,i(),{isVisible:t,whenVisible:u,destroy:m})}}function rt(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 it=["data-markstream-viewport-pending"],at=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],ut={key:1,class:"image-placeholder"},st={key:1,class:"image-node__raw-text"},ct={key:2,class:"image-shimmer-overlay"},dt={key:1,class:"image-node__raw-text"},ft={key:3,class:"image-error"},mt=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){var t,o,l;const r=e,i=n,a=G(!1),u=G(!1),c=G(""),d=G("primary"),f=G(null),m=U(),h=R(Ie,null),v=lt(),p=nt(),g=tt(),y=P(()=>S(r.node.src)),k=P(()=>S(r.fallbackSrc)),N=null==(l=null==(o=null==(t=ee())?void 0:t.vnode.el)?void 0:o.querySelector)?void 0:l.call(o,"img"),b="undefined"!=typeof window&&(null==N?void 0:N.getAttribute("src"))===(y.value||k.value),x=G("undefined"==typeof window||b||!g.value),w=$(null);let M="",C=null;const B=P(()=>c.value),_=P(()=>!r.lazy),I=P(()=>"undefined"!=typeof window&&g.value&&!b),T=P(()=>!I.value||x.value),O=P(()=>T.value?B.value:""),L=P(()=>{var e,n;return null!=(n=null!=(e=null==p?void 0:p.value.heavyBlockMargin)?e:null==p?void 0:p.value.rootMargin)?n:et}),H=P(()=>!r.node.loading&&"failed"!==d.value&&c.value.length>0),A=P(()=>"failed"===d.value),E=P(()=>(!_.value||I.value&&!x.value)&&!a.value&&!u.value&&"failed"!==d.value&&c.value.length>0),j=P(()=>rt(r,m));function V(e=j.value){e&&f.value&&(null==h||h.reportHeight(e,f.value.offsetHeight))}function J(e=j.value){e&&le(()=>{V(e)})}function Y(){C&&(clearTimeout(C),C=null)}function Z(){const e=j.value;e&&M!==e&&(M&&(null==h||h.markSettled(M)),Y(),M=e,null==h||h.markPending(e),"undefined"!=typeof window&&(C=window.setTimeout(()=>{M===e&&(J(e),ne())},8e3)))}function ne(){return s(this,null,function*(){const e=M;e&&(Y(),M="",yield le(),V(e),null==h||h.markSettled(e))})}function re(){if("primary"===d.value&&k.value&&k.value!==c.value)return d.value="fallback",c.value=k.value,a.value=!1,u.value=!1,void J();d.value="failed",u.value=!0,i("error",c.value),J()}function ie(){a.value=!0,u.value=!1,i("load",B.value),J()}function ae(e){e.preventDefault(),a.value&&!u.value&&i("click",[e,B.value])}const{t:ue}=Xn();return X([y,k,()=>r.node.loading],()=>(a.value=!1,u.value=!1,r.node.loading||y.value?(c.value=y.value,void(d.value="primary")):k.value?(c.value=k.value,void(d.value="fallback")):(c.value="",d.value="failed",void(u.value=!0))),{immediate:!0}),"undefined"!=typeof window&&X([f,I],([e,n],t,o)=>{var l;if(null==(l=w.value)||l.destroy(),w.value=null,!n||x.value)return void(x.value=!0);if(!e)return void(x.value=!1);let r=!0;const i=v(e,{rootMargin:L.value,allowIdle:!1});w.value=i,x.value=i.isVisible.value,i.whenVisible.then(()=>{r&&w.value===i&&(x.value=!0)}),o(()=>{r=!1,i.destroy(),w.value===i&&(w.value=null)})},{immediate:!0}),X([H,a,u,B,()=>r.lazy,T],([e,n,t,o,l,r])=>e&&o&&!t&&r?n?(ne(),void J()):l?(Z(),void J()):void(n||t||Z()):(ne(),void J()),{flush:"post",immediate:!0}),te(()=>{var e;null==(e=w.value)||e.destroy(),w.value=null,function(){const e=M;e&&(Y(),M="",null==h||h.markSettled(e))}()}),(n,t)=>{var o,l,i,s,c;return F(),K("span",{ref_key:"rootRef",ref:f,class:"image-node-container","data-markstream-viewport-pending":I.value&&!x.value?"true":void 0},[H.value?(F(),K("img",{key:0,src:O.value||void 0,alt:String(null!=(l=null!=(o=r.node.alt)?o:r.node.title)?l:""),title:String(null!=(s=null!=(i=r.node.title)?i:r.node.alt)?s:""),class:D(["image-node__img",{"is-loading":!_.value&&!a.value,"is-loaded":_.value||a.value,"has-natural-size":a.value,"cursor-pointer":a.value}]),loading:r.lazy?"lazy":void 0,fetchpriority:_.value?"high":void 0,decoding:_.value?"sync":"async",tabindex:a.value?0:-1,"aria-label":null!=(c=r.node.alt)?c:q(ue)("image.preview"),onError:re,onLoad:ie,onClick:ae},null,42,at)):Q("",!0),e.node.loading&&!u.value?(F(),K("span",ut,[r.usePlaceholder?oe(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[0]||(t[0]=z("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",st,W(e.node.raw),1))])):Q("",!0),E.value&&!e.node.loading?(F(),K("span",ct,[r.usePlaceholder?oe(n.$slots,"placeholder",{key:0,node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[1]||(t[1]=z("span",{class:"image-shimmer"},null,-1))],!0):(F(),K("span",dt,W(e.node.raw),1))])):Q("",!0),A.value?(F(),K("span",ft,[oe(n.$slots,"error",{node:r.node,displaySrc:B.value,imageLoaded:a.value,hasError:u.value,fallbackSrc:r.fallbackSrc,lazy:r.lazy},()=>[t[2]||(t[2]=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(ue)("image.loadError")),1)],!0)])):Q("",!0)],8,it)}}}),[["__scopeId","data-v-046e82ac"]]);mt.install=e=>{e.component(mt.__name,mt)};const ht={key:2},vt=/* @__PURE__ */E({__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=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),i=P(()=>{var e,t;const o=null!=(e=null==l?void 0:l.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,htmlPolicy:r.value})}),s=re({loader:()=>Promise.resolve().then(()=>_a),suspensible:!1}),c=P(()=>n.components[String(n.node.type)]),d=P(()=>Boolean(c.value&&t.value[n.node.type]&&!Ve(String(n.node.type)))),f=P(()=>d.value?vn(n.node,r.value):void 0),m=P(()=>Array.isArray(n.node.children)&&n.node.children.length>0),h=P(()=>{var e;return String(null!=(e=n.node.content)?e:"")}),v=P(()=>{var e,t;return String(null!=(t=null!=(e=n.node.content)?e:n.node.raw)?t:"")});return(n,t)=>c.value&&d.value?(F(),ie(ae(c.value),ue({key:0},f.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":i.value.isDark}),{default:se(()=>[m.value?(F(),ie(q(s),ue({key:0},i.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):h.value?(F(),ie(q(s),ue({key:1},i.value,{content:h.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):c.value?(F(),ie(ae(c.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(F(),K("span",ht,W(v.value),1)):Q("",!0)}});function pt(e){var n;if("boolean"==typeof e)return e;const t=e;if(!0===(null==t?void 0:t.expandUnchanged))return!1;const o=Number(null==(n=null==t?void 0:t.parseDiffOptions)?void 0:n.context),l=Number(null==t?void 0:t.collapsedContextThreshold);return{enabled:!0,contextLineCount:isFinite(o)&&o>=0?Math.floor(o):2,minimumLineCount:isFinite(l)&&l>=0?Math.floor(l)+1:6,revealLineCount:5}}function gt(e){return"unified"===e.diffStyle}function yt(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let r=3;for(;o[r]===l;)r+=1;return o.slice(r).trim()}function kt(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}function Nt(e){var n;return!0===e.diff||kt(e.language)||kt(yt(String(null!=(n=e.raw)?n:"")))}function bt(e,n,t){const o=function(e){const n=yt(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:o||n,caption:o?t?`Diff / ${n}`:n:""}}const St=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],xt={key:0,translate:"no",class:"markstream-pre__diff-code"},wt={class:"markstream-pre__diff-pane-content"},Mt={class:"markstream-pre__diff-number","aria-hidden":"true"},Ct={class:"markstream-pre__diff-content"},Bt={class:"markstream-pre__diff-content-inner"},_t={key:0,translate:"no",class:"markstream-pre__code markstream-pre__code--wrapped"},It=["data-line-number","textContent"],Tt={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Ot=["textContent"],Lt=["textContent"],Ht="\",At=/* @__PURE__ */E({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const n=e,t=U();function o(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}const l=P(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),r=P(()=>`language-${l.value}`),i=P(()=>{var e;return!0===n.loading||!0===(null==(e=n.node)?void 0:e.loading)}),s=P(()=>{var e;return o(null==(e=n.node)?void 0:e.code,i.value)});let c="",d=1;const f=P(()=>function(e){let n=0,t=1;e.startsWith(c)&&(n=c.length,t=d,n>0&&"\r"===e[n-1]&&"\n"===e[n]&&n++);for(let o=n;o<e.length;o++)"\n"===e[o]?t++:"\r"===e[o]&&(t++,"\n"===e[o+1]&&o++);return c=e,d=t,t}(s.value)),m=P(()=>s.value.split(/\r\n|\n|\r/)),h=P(()=>{const e=s.value,n=e.split(new RegExp("(?<=\\n)|(?<=\\r)(?!\\n)"));return/(?:\r\n|\n|\r)$/.test(e)&&n.push(""),n}),v=P(()=>{var e;return!0===n.showLineNumbers&&!0===(null==(e=n.node)?void 0:e.diff)}),p=P(()=>{var e;if(D(t.class).split(/\s+/).includes("is-wrap"))return!0;const n=ce(t.style);return"string"==typeof n?/(?:^|;)\s*white-space\s*:\s*(?:pre-wrap|break-spaces)(?:\s*!important)?\s*(?:;|$)/i.test(n):["pre-wrap","break-spaces"].includes(String(null!=(e=null==n?void 0:n.whiteSpace)?e:null==n?void 0:n["white-space"]))}),g=P(()=>v.value&&p.value);let y=0,k="";const N=P(()=>{const e=f.value;e<y&&(y=0,k="");for(let n=y+1;n<=e;n++)k+=`${k?"\n":""}${n}`;return y=e,k}),b=P(()=>v.value&&!0===n.diffInline),S=P(()=>{const e=Number(n.reservedHeightPx);if(!Number.isFinite(e)||e<=0)return;const t=`${Math.ceil(e)}px`;return i.value?{maxHeight:t,overflow:"auto"}:{height:t,minHeight:t,maxHeight:t,overflow:"auto"}}),x=["diff ","index ","--- ","+++ ","@@ "];function w(e){return 0===String(null!=e?e:"").trim().length}function M(e,n="context",t={}){const o=w(e);return{code:e,kind:o&&"hunk"!==n&&"spacer"!==n&&!t.preserveBlankKind?"context":n,empty:o}}function C(e){const n=o(e,i.value);return n?n.split(/\r\n|\n|\r/):[]}function B(e){return/(?:\r\n|\n|\r)$/.test(String(null!=e?e:""))}function _(e,n){return u(a({},M("No newline at end of file","metadata")),{key:e,metadataKind:n,number:""})}function I(e,n){return!w(e[n])||n<e.length-1}function T(e){return e.startsWith("-")&&!e.startsWith("---")}function O(e){return e.startsWith("+")&&!e.startsWith("+++")}function L(e){return e.some(e=>x.some(n=>e.startsWith(n)))}function H(e,n){return n||!e.startsWith(" ")||e.startsWith(" ")?e:` ${e}`}function A(e,n){const t=e.length,o=n.length,l=[];let r=0;for(;r<t&&r<o&&e[r]===n[r];)l.push({originalIndex:r,modifiedIndex:r}),r++;const a=[];let u=t-1,s=o-1;for(;u>=r&&s>=r&&e[u]===n[s];)a.unshift({originalIndex:u,modifiedIndex:s}),u--,s--;const c=u-r+1,d=s-r+1;if(c<=0||d<=0)return l.concat(a);if(i.value)return l.concat(a);if((c+1)*(d+1)>15e5)return l.concat(a);const f=d+1,m=new Uint32Array((c+1)*(d+1));for(let i=c-1;i>=0;i--)for(let t=d-1;t>=0;t--){const o=i*f+t;if(e[r+i]===n[r+t])m[o]=m[(i+1)*f+t+1]+1;else{const e=m[(i+1)*f+t],n=m[i*f+t+1];m[o]=e>=n?e:n}}const h=[];let v=0,p=0;for(;v<c&&p<d;)e[r+v]===n[r+p]?(h.push({originalIndex:r+v,modifiedIndex:r+p}),v++,p++):m[(v+1)*f+p]>=m[v*f+p+1]?v++:p++;return l.concat(h,a)}function $(e){var t;const o=function(){var e,t;const o=n.diffHideUnchangedRegions;if(null==o||!1===o)return null;const l=!0===o?{}:o;return!1===l.enabled?null:{contextLineCount:Math.max(0,Math.floor(null!=(e=l.contextLineCount)?e:2)),minimumLineCount:Math.max(1,Math.floor(null!=(t=l.minimumLineCount)?t:4))}}();if(!o||e.length<1||e.length>2)return e;if(2===e.length&&e[0].lines.length!==e[1].lines.length)return e;const l=e[0].lines,r=null==(t=e[1])?void 0:t.lines;let i=l.length;for(;i>0&&e.every(e=>"metadata"===e.lines[i-1].kind);)i--;const s=e=>"context"===l[e].kind&&(void 0===r||"context"===r[e].kind&&l[e].code===r[e].code),c=[];let d=0;for(;d<i;){const e=d;for(;d<i&&s(d);)d++;const n=d;if(n-e>=o.minimumLineCount){const t=e+(0===e?0:o.contextLineCount),r=n===i,a=n-(r?0:o.contextLineCount);a-t>=o.minimumLineCount&&c.push({start:t,end:r?l.length:a})}d===e&&d++}return c.length?e.map((e,n)=>{const t=[];let o=0;for(const l of c)t.push(...e.lines.slice(o,l.start)),t.push({code:0===n?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${e.key}-collapsed-${l.start}-${l.end}`,number:""}),o=l.end;return t.push(...e.lines.slice(o)),u(a({},e),{lines:t})}):e}const R=P(()=>{var e,t,o,r,i,s;if(!v.value)return[];const c=function(e){const t=e.some(e=>T(e)),o=e.some(e=>O(e));return t&&o||function(){var e,t,o,r;if("diff"===l.value)return!0;const i=null!=(r=null==(o=String(null!=(t=null==(e=n.node)?void 0:e.raw)?t:"").split(/\r?\n/,1)[0])?void 0:o.trim())?r:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(i)}()&&(t||o)}(m.value),d=function(){var e,t;return null!=(null==(e=n.node)?void 0:e.originalCode)||null!=(null==(t=n.node)?void 0:t.updatedCode)}();if(b.value){const l=d?function(e,n,t){const o=String(null!=n?n:"").length>0&&!B(n),l=String(null!=t?t:"").length>0&&!B(t);return o||l?(o&&e.push(_("inline-no-newline-original","removed")),l&&e.push(_("inline-no-newline-modified","added")),e):e}(function(e,n){const t=C(e),o=C(n),l=A(t,o);if(l.length>0){const e=[];let n=0,r=0;for(const i of l){for(;n<i.originalIndex;)e.push(u(a({},M(t[n],"removed",{preserveBlankKind:I(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<i.modifiedIndex;)e.push(u(a({},M(o[r],"added",{preserveBlankKind:I(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;e.push(u(a({},M(o[i.modifiedIndex])),{key:`inline-context-source-${i.originalIndex}-${i.modifiedIndex}`,number:i.modifiedIndex+1})),n=i.originalIndex+1,r=i.modifiedIndex+1}for(;n<t.length;)e.push(u(a({},M(t[n],"removed",{preserveBlankKind:I(t,n)})),{key:`inline-removed-source-${n}`,number:n+1})),n++;for(;r<o.length;)e.push(u(a({},M(o[r],"added",{preserveBlankKind:I(o,r)})),{key:`inline-added-source-${r}`,number:r+1})),r++;return e}const r=[];let i=0,s=t.length-1,c=o.length-1;for(;i<=s&&i<=c&&t[i]===o[i];)r.push(u(a({},M(o[i])),{key:`inline-prefix-${i}`,number:i+1})),i++;const d=[];for(;s>=i&&c>=i&&t[s]===o[c];)d.unshift(u(a({},M(o[c])),{key:`inline-suffix-${c}`,number:c+1})),s--,c--;for(let f=i;f<=s;f++)r.push(u(a({},M(t[f],"removed",{preserveBlankKind:I(t,f)})),{key:`inline-removed-source-${f}`,number:f+1}));for(let f=i;f<=c;f++)r.push(u(a({},M(o[f],"added",{preserveBlankKind:I(o,f)})),{key:`inline-added-source-${f}`,number:f+1}));return r.concat(d)}(null==(e=n.node)?void 0:e.originalCode,null==(t=n.node)?void 0:t.updatedCode),null==(o=n.node)?void 0:o.originalCode,null==(r=n.node)?void 0:r.updatedCode):function(e){var n;const t=[];let o=1,l=1;const r=L(e);for(const[i,s]of e.entries())if(s===Ht){const e=null==(n=t.at(-1))?void 0:n.kind,o="removed"===e||"added"===e?e:"context";t.push(_(`inline-no-newline-${i}`,o))}else if(s.startsWith("@@")){const e=s.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);e&&(o=Number(e[1]),l=Number(e[2])),t.push(u(a({},M(s,"hunk")),{key:`inline-hunk-${i}`,number:""}))}else if(T(s))t.push(u(a({},M(H(s.slice(1),r),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${i}`,number:o++}));else if(O(s))t.push(u(a({},M(H(s.slice(1),r),"added",{preserveBlankKind:!0})),{key:`inline-added-${i}`,number:l++}));else{const e=r&&s.startsWith(" ")?s.slice(1):s;t.push(u(a({},M(e)),{key:`inline-context-${i}`,number:l})),o++,l++}return t}(m.value);return $([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:l}])}if(!c&&d)return function(e,n){const t=C(e),o=C(n),l=A(t,o),r=[],i=[];let s=0,c=0,d=0;const f=(e,n)=>{const l=Math.max(e-s,n-c);for(let f=0;f<l;f++){const l=s+f,m=c+f;r.push(l<e?u(a({},M(t[l],"removed",{preserveBlankKind:I(t,l)})),{key:`original-changed-${d}-${l}`,number:l+1}):u(a({},M("","spacer")),{key:`original-spacer-${d}-${f}`,number:""})),i.push(m<n?u(a({},M(o[m],"added",{preserveBlankKind:I(o,m)})),{key:`modified-changed-${d}-${m}`,number:m+1}):u(a({},M("","spacer")),{key:`modified-spacer-${d}-${f}`,number:""}))}s=e,c=n,d++};for(const v of l)f(v.originalIndex,v.modifiedIndex),r.push(u(a({},M(t[v.originalIndex])),{key:`original-context-${v.originalIndex}-${v.modifiedIndex}`,number:v.originalIndex+1})),i.push(u(a({},M(o[v.modifiedIndex])),{key:`modified-context-${v.originalIndex}-${v.modifiedIndex}`,number:v.modifiedIndex+1})),s=v.originalIndex+1,c=v.modifiedIndex+1;f(t.length,o.length);const m=String(null!=e?e:"").length>0&&!B(e),h=String(null!=n?n:"").length>0&&!B(n);return(m||h)&&(r.push(m?_("original-no-newline","removed"):u(a({},M("","spacer")),{key:"original-no-newline-spacer",number:""})),i.push(h?_("modified-no-newline","added"):u(a({},M("","spacer")),{key:"modified-no-newline-spacer",number:""}))),$([{key:"original",className:"markstream-pre__diff-pane--original",lines:r},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:i}])}(null==(i=n.node)?void 0:i.originalCode,null==(s=n.node)?void 0:s.updatedCode);const f=[],h=[],p=L(m.value);let g="context";for(const n of m.value)if(n===Ht)"removed"===g?(f.push(_("original-patch-no-newline","removed")),h.push(M("","spacer"))):"added"===g?(f.push(M("","spacer")),h.push(_("modified-patch-no-newline","added"))):(f.push(_("original-patch-no-newline","context")),h.push(_("modified-patch-no-newline","context")));else if(n.startsWith("@@"))f.push(M(n,"hunk")),h.push(M(n,"hunk")),g="context";else if(n.startsWith("-")&&!n.startsWith("---"))f.push(M(H(n.slice(1),p),"removed",{preserveBlankKind:!0})),g="removed";else if(n.startsWith("+")&&!n.startsWith("+++"))h.push(M(H(n.slice(1),p),"added",{preserveBlankKind:!0})),g="added";else{const e=p&&n.startsWith(" ")?n.slice(1):n;f.push(M(e)),h.push(M(e)),g="context"}return $([{key:"original",className:"markstream-pre__diff-pane--original",lines:f.map((e,n)=>u(a({},e),{key:`original-${n}`,number:"metadata"===e.kind||"spacer"===e.kind?"":n+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:h.map((e,n)=>u(a({},e),{key:`modified-${n}`,number:"metadata"===e.kind||"spacer"===e.kind?"":n+1}))}])}),E=P(()=>{var e,t;if(!0!==n.showLineNumbers)return;let o=v.value?1:f.value;if(v.value){o=Math.max(o,C(null==(e=n.node)?void 0:e.originalCode).length,C(null==(t=n.node)?void 0:t.updatedCode).length);for(const e of R.value)for(const n of e.lines)"number"==typeof n.number&&(o=Math.max(o,n.number))}const l=`${Math.max(2,String(o).length)}ch`;return{"--markstream-pre-line-number-width":l,"--markstream-pre-diff-line-number-width":l,"--markstream-code-padding-left":"calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"}}),j=P(()=>R.value.some(e=>e.lines.some(e=>"collapsed"===e.kind))),V=P(()=>{const e=l.value;return e?`Code block: ${e}`:"Code block"}),q=G(null),J=G([]);let Z=null,ee=null,ne=!1,oe=null;function le(){if(ne||"undefined"==typeof window||!v.value||b.value||!g.value)return;if(null!=Z)return;const e=null!=ee?ee:ee=import("./preCodeDiffMetrics.js");Z=window.requestAnimationFrame(()=>{e.then(({measurePreCodeDiffLines:e})=>{!ne&&q.value&&(J.value=e(q.value,J.value))},()=>{ee=null}).finally(()=>{Z=null})})}function re(e){null==oe||oe.disconnect(),oe=null,e&&v.value&&!b.value&&g.value&&"undefined"!=typeof ResizeObserver&&(oe=new ResizeObserver(()=>{le()}),oe.observe(e))}function ie(e,n){if(!g.value)return;const t=J.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 X(q,e=>{re(e),le()},{flush:"post"}),X([v,b,R,g],()=>{re(q.value),v.value&&!b.value&&g.value?le():J.value.length&&(J.value=[])},{flush:"post",immediate:!0}),te(()=>{ne=!0,null!=Z&&(window.cancelAnimationFrame(Z),Z=null),null==oe||oe.disconnect(),oe=null}),(e,t)=>{return F(),K("pre",{ref_key:"preRef",ref:q,style:ce([S.value,E.value]),class:D([r.value,{"markstream-pre--line-numbers":n.showLineNumbers,"markstream-pre--diff-preview":v.value,"markstream-pre--diff-inline":b.value,"markstream-pre--diff-collapsed":j.value}]),"aria-busy":i.value,"aria-label":V.value,"data-language":l.value,"data-markstream-line-numbers":n.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[v.value?(F(),K("code",xt,[(F(!0),K(Y,null,de(R.value,e=>(F(),K("span",{key:e.key,class:D(["markstream-pre__diff-pane",e.className])},[z("span",wt,[(F(!0),K(Y,null,de(e.lines,(n,o)=>(F(),K("span",{key:n.key,class:D(["markstream-pre__diff-line",[`markstream-pre__diff-line--${n.kind}`,n.metadataKind?`markstream-pre__diff-line--metadata-${n.metadataKind}`:"",{"markstream-pre__diff-line--empty":n.empty}]]),style:ce(ie(o,e.key))},[t[0]||(t[0]=z("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),z("span",Mt,W(n.number),1),z("span",Ct,[z("span",Bt,W(n.code),1)])],6))),128))])],2))),128))])):(F(),K(Y,{key:1},[!0===n.showLineNumbers&&!0!==(null==(o=n.node)?void 0:o.diff)&&p.value?(F(),K("code",_t,[(F(!0),K(Y,null,de(h.value,(e,n)=>(F(),K("span",{key:n,class:"markstream-pre__logical-line","data-line-number":n+1,textContent:W(e)},null,8,It))),128))])):(F(),K(Y,{key:1},[n.showLineNumbers?(F(),K("span",Tt,[z("span",{class:"markstream-pre__line-numbers-text",textContent:W(N.value)},null,8,Ot)])):Q("",!0),z("code",{translate:"no",class:"markstream-pre__code",textContent:W(s.value)},null,8,Lt)],64))],64))],14,St);var o}}});function $t(e){var n,t,o,l,r;const i=e.isDark?"dark":"light";return void 0!==e.theme?"string"==typeof e.theme?e.theme:e.theme[i]:null!=(r=e.isDark?null!=(t=e.darkTheme)?t:null==(n=e.themes)?void 0:n[0]:null!=(l=e.lightTheme)?l:null==(o=e.themes)?void 0:o[1])?r:`vitesse-${i}`}function Rt(e,n=!1){const t=e.toLowerCase();return t?/dark|night|moon|black|dracula|mocha|frappe|macchiato|ocean|poimandres|monokai|laserwave|tokyo|rose-pine|material-theme/.test(t)&&!/light|latte|dawn|lotus/.test(t):n}At.install=e=>{e.component(At.__name,At)};const Pt=12,Et=18;function Ft(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?e:void 0}function Kt(e){var n,t,o,l,r,i;const a=null!=(n=Ft(null==e?void 0:e.fontSize))?n:12,u=null!=(t=Ft(null==e?void 0:e.lineHeight))?t:12===a?18:Math.max(12,Math.round(1.5*a)),s="string"==typeof(null==e?void 0:e.fontFamily)&&e.fontFamily.trim()?e.fontFamily.trim():'"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace',c=null!=(o="number"==typeof(d=null==e?void 0:e.padding)&&Number.isFinite(d)&&d>=0?d:void 0)?o:8;var d;return{fontFamily:s,fontSize:a,lineHeight:u,maxHeight:null!=(l=Ft(null==e?void 0:e.maxHeight))?l:500,overflow:null!=(r=null==e?void 0:e.overflow)?r:"wrap",padding:c,paddingBottom:c,scrollbarGutter:6,tabSize:null!=(i=Ft(null==e?void 0:e.tabSize))?i:4}}const zt=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=U(),o=R("markstreamFade",void 0),l=R("markstreamTextStreamState",void 0),r=R("markstreamStreamVersion",void 0),i=P(()=>{const e=t.fade;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),a=P(()=>"boolean"==typeof i.value?i.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),u=P(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=G(n.node.content),c=G(""),d=G(0),f=G(n.node.content);let m;const h=G(null),v=G(null);let p="",g=null;function y(){null==m||m(),m=void 0}function k(){y(),c.value&&(s.value=s.value+c.value,c.value="")}X([s,h,v],function(){var e,n;const t=h.value;if(!t)return;const o=String(null!=(e=s.value)?e:""),l=v.value;return g||(g=t.firstChild,p=null!=(n=null==g?void 0:g.data)?n:""),o.startsWith(p)?!g&&o?(t.textContent=o,g=t.firstChild,void(p=o)):void(o.length>p.length&&l&&(l.appendChild(document.createTextNode(o.slice(p.length))),p=o)):(t.textContent=o,g=t.firstChild,l&&(l.textContent=""),void(p=o))},{immediate:!0}),X([()=>n.node.content,u,a],([e])=>{const n=String(null!=e?e:""),t=u.value,o=Ce({nextContent:n,persistedContent:t?null==l?void 0:l.get(t):void 0,currentState:{settledContent:s.value,streamedDelta:c.value},typewriterEnabled:a.value});s.value=o.settledContent,c.value=o.streamedDelta,o.appended?(d.value+=1,function(){if(!c.value||m||!r)return;const e=r.value;m=X(()=>r.value,n=>{n!==e&&k()},{flush:"sync"})}()):c.value||y(),t&&(null==l||l.set(t,n))},{immediate:!0}),J(y);const N=P(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,t)=>(F(),K("span",{class:D([[e.node.center?"text-node-center":""],"text-node"])},[fe(z("span",{ref_key:"settledTextEl",ref:h},W(f.value),513),[[me,""!==s.value]]),fe(z("span",{ref_key:"settledAppendsEl",ref:v},null,512),[[me,""!==s.value]]),c.value?(F(),K("span",{key:0,class:D(["text-node-stream-delta",[N.value]]),onAnimationend:k},W(c.value),35)):Q("",!0)],2))}}),[["__scopeId","data-v-fd79037c"]]);function Wt(e,n,t){return E({name:e,inheritAttrs:!1,setup(e,{attrs:o,slots:l}){var r,i;const s=lt(),c=nt(),d=tt(),f="undefined"!=typeof window&&1===(null==(i=null==(r=ee())?void 0:r.vnode.el)?void 0:i.nodeType),m=G("undefined"==typeof window||f||!d.value),h=$(null);let v=null;function p(e){const n=e&&"$el"in e?e.$el:e;h.value=n instanceof HTMLElement?n:null}return"undefined"!=typeof window&&X([h,d],([e,n],t,o)=>{if(null==v||v.destroy(),v=null,!n||m.value)return void(m.value=!0);if(!e)return;let l=!0;const r=s(e,{rootMargin:null==c?void 0:c.value.heavyBlockMargin,allowIdle:!1});v=r,m.value=r.isVisible.value,r.whenVisible.then(()=>{l&&v===r&&(m.value=!0)}),o(()=>{l=!1,r.destroy(),v===r&&(v=null)})},{immediate:!0}),te(()=>{null==v||v.destroy(),v=null}),()=>j(m.value?n:t,u(a({},o),{ref:p}),l)}})}zt.install=e=>{e.component(zt.__name,zt)};const jt=E({name:"CodeBlockNodeLoadingShell",inheritAttrs:!1,props:["node","isDark","loading","stream","codeBlockOptions","showLineNumbers","theme","darkTheme","lightTheme","isShowPreview","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","indexKey","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline","diffInline","diffHideUnchangedRegions","reservedHeightPx"],emits:["click","mouseover","mouseout","copy","previewCode","handleArtifactClick"],setup(e,{attrs:n}){const t=e;return()=>{var e,o,l,r,i,s;const c=null!=(e=t.codeBlockOptions)?e:{},d=Kt(c),f=$t(t),m=Rt(f,!0===t.isDark),h=m?["#121212","#dbd7caee","#dedcd550"]:["#ffffff","#393a34","#393a3450"];/^vitesse-(?:dark|light)$/.test(f)||(h[0]=`var(--markstream-code-theme-bg, ${h[0]})`,h[1]=`var(--markstream-code-theme-fg, ${h[1]})`,h[2]=`var(--markstream-code-theme-line-number, ${h[2]})`);const v=Nt(t.node),p=v&&Boolean(null!=(l=null!=(o=t.diffInline)?o:t.estimatedDiffInline)?l:"unified"===c.diffStyle),g=null!=(r=t.showLineNumbers)?r:!0!==c.disableLineNumbers,y="wrap"===d.overflow,k=Number(null!=(i=t.estimatedContentHeightPx)?i:t.reservedHeightPx),N=Number.isFinite(k)&&k>0?Math.min(d.maxHeight,Math.ceil(k)):void 0,b={class:n.class,style:n.style};return j("div",u(a({},b),{class:["code-block-container",{"is-dark":m},b.class],style:[{"--code-bg":h[0],"--code-fg":h[1],"--code-line-number":h[2]},b.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":t.loading?"streaming":"settled"}),[!1===t.showHeader?null:j("div",{class:"code-block-header",style:{minHeight:"37px"}}),j(At,{node:t.node,loading:t.loading,showLineNumbers:g,diffInline:p,diffHideUnchangedRegions:v?null!=(s=t.diffHideUnchangedRegions)?s:pt(c):void 0,reservedHeightPx:N,class:["code-pre-fallback",{"is-wrap":y}],style:[y&&"white-space:pre-wrap;overflow-wrap:anywhere",{"--markstream-code-padding-x":`${d.padding}px`,"--markstream-code-padding-y":`${d.padding}px`,"--markstream-code-tab-size":d.tabSize,"--markstream-pre-diff-line-height":`${d.lineHeight}px`,font:`${d.fontSize}px/${d.lineHeight}px ${d.fontFamily}`,maxHeight:`${null!=N?N:d.maxHeight}px`}],"data-markstream-code-loading":"1"})])}}}),Dt=re({loader:()=>import("./CodeBlockNodeLoading.js"),loadingComponent:jt,errorComponent:jt,delay:0,suspensible:!0}),Vt=re({loader:()=>import("./PreCodeBlock.js"),loadingComponent:Dt,delay:0,suspensible:!0}),qt=Wt("ViewportDeferredCodeBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Failed to load the enhanced CodeBlockNode chunk; falling back to preformatted code rendering. Enhanced code blocks require the optional "stream-diffs" peer.',e),At}}),loadingComponent:Dt,delay:0,suspensible:!1}),jt),Ut=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(zt,u(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{return yield He(),(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(zt,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:""}$`}}))}})),Gt=re(()=>s(null,null,function*(){try{return yield He(),(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(zt,u(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Xt=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(F(),K("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:t[0]||(t[0]=t=>n.$emit("click",t,e.node.id,e.messageId,e.threadId)),onMouseenter:t[1]||(t[1]=t=>n.$emit("mouseEnter",t,e.node.id,e.messageId,e.threadId)),onMouseleave:t[2]||(t[2]=t=>n.$emit("mouseLeave",t,e.node.id,e.messageId,e.threadId))},W(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Xt.install=e=>{e.component(Xt.__name,Xt)};const Jt={class:"superscript-node"},Yt=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,emphasis:vo,footnote_reference:sn,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,emoji:rn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("sup",Jt,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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 Zt={class:"subscript-node"},Qt=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,emphasis:vo,footnote_reference:sn,strikethrough:oo,highlight:mo,insert:co,superscript:Yt,emoji:rn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("sub",Zt,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);Qt.install=e=>{e.component(Qt.__name,Qt)};const eo={class:"strong-node"},no=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,emphasis:vo,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,footnote_reference:sn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("strong",eo,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);no.install=e=>{e.component(no.__name,no)};const to={class:"strikethrough-node"},oo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,emphasis:vo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,footnote_reference:sn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("del",to,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);oo.install=e=>{e.component(oo.__name,oo)};const lo=["href","title","aria-label","aria-hidden","target","rel"],ro=["aria-hidden"],io={class:"link-text-wrapper relative inline-flex"},ao={class:"leading-[normal] link-text"},uo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=R("markstreamShowTooltips",void 0),o=P(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=P(()=>{var e,t,o,l,r;const i=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",a=null!=(e=n.animationOpacity)?e:.35,u=Math.max(.12,Math.min(.5*a,a)),s={"--underline-height":`${null!=(t=n.underlineHeight)?t:2}px`,"--underline-bottom":i,"--underline-opacity":String(a),"--underline-rest-opacity":String(u),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(l=n.animationTiming)?l:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(r=n.animationIteration)?r:"infinite"};return n.color&&(s["--link-color"]=n.color),s}),r=Je(()=>n.customId),i=P(()=>a({text:zt,strong:no,strikethrough:oo,emphasis:vo,image:mt,html_inline:Sn,inline_code:Mn},r.value)),u=U(),s=P(()=>{var e,t;const o=null==(e=n.node)?void 0:e.attrs;if(!o||"object"!=typeof o)return{};const l={};if(Array.isArray(o))for(const n of o)Array.isArray(n)&&n[0]&&(l[String(n[0])]=String(null!=(t=n[1])?t:""));else for(const[n,r]of Object.entries(o))n&&null!=r&&!1!==r&&(l[n]=!0===r?"":String(r));return fn(l,"safe","a")}),c=P(()=>a(a({},u),s.value)),d=P(()=>{var e,t;return fn({href:String(null!=(t=null==(e=n.node)?void 0:e.href)?t:"")},"safe","a").href}),f=P(()=>{if(!d.value)return;const e=c.value.target;return("string"==typeof e?e.trim():String(null!=e?e:"").trim())||(x(d.value)?"_blank":void 0)}),m=P(()=>{var e;return"_blank"===String(null!=(e=f.value)?e:"").trim().toLowerCase()}),h=P(()=>{if(!d.value)return;const e=c.value.rel,n=new Set(("string"==typeof e?e:String(null!=e?e:"")).split(/\s+/).filter(Boolean)),t=new Set(Array.from(n).filter(e=>"opener"!==e.toLowerCase()));return m.value&&(t.add("noopener"),t.add("noreferrer")),t.size>0?Array.from(t).join(" "):void 0}),v=P(()=>{const e=a({},c.value);return delete e.title,delete e.href,delete e.target,delete e.rel,e});function p(){o.value&&Wn()}const g=P(()=>{var e,t;const o=null==(e=n.node)?void 0:e.title;return"string"==typeof o&&o.trim().length>0?o:String(null!=(t=d.value)?t:"")});return(t,r)=>{var a,s;return e.node.loading?(F(),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",io,[z("span",ao,[V(q(zt),{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,ro)):(F(),K("a",ue({key:0,class:"link-node",href:d.value,title:o.value?"":g.value,"aria-label":`Link: ${g.value}`,"aria-hidden":e.node.loading?"true":"false",target:f.value,rel:h.value},v.value,{style:l.value,onMouseenter:r[0]||(r[0]=e=>function(e){var t,l,r,i;if(!o.value)return;const a=e,u=null!=(null==a?void 0:a.clientX)&&null!=(null==a?void 0:a.clientY)?{x:a.clientX,y:a.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||((null==(l=d.value)?void 0:l.includes("xn--"))&&(null==(i=null==(r=n.node)?void 0:r.text)?void 0:i.includes("://"))?n.node.text:d.value)||"";zn(e.currentTarget,s,"top",!1,u)}(e)),onMouseleave:p}),[(F(!0),K(Y,null,de(e.node.children,(t,o)=>(F(),ie(q(vt),{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,lo))}}}),[["__scopeId","data-v-367e6ca4"]]);uo.install=e=>{e.component(uo.__name,uo)};const so={class:"insert-node"},co=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,emphasis:vo,strikethrough:oo,highlight:mo,subscript:Qt,superscript:Yt,emoji:rn,footnote_reference:sn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("ins",so,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);co.install=e=>{e.component(co.__name,co)};const fo={class:"highlight-node"},mo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,emphasis:vo,strikethrough:oo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,footnote_reference:sn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("mark",fo,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);mo.install=e=>{e.component(mo.__name,mo)};const ho={class:"emphasis-node"},vo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=P(()=>a({text:zt,inline_code:Mn,link:uo,html_inline:Sn,strong:no,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,footnote_reference:sn,math_inline:Ut,reference:Xt},t.value));return(t,l)=>(F(),K("em",ho,[(F(!0),K(Y,null,de(e.node.children,(t,l)=>(F(),ie(q(vt),{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"]]);vo.install=e=>{e.component(vo.__name,vo)};const po={class:"hard-break"},go=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(F(),K("br",po))}),[["__scopeId","data-v-50c58f70"]]);go.install=e=>{e.component(go.__name,go)};const yo=/* @__PURE__ */E({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const n=e,t=he({checkbox:on,checkbox_input:on,emoji:rn,emphasis:vo,hardbreak:go,highlight:mo,inline_code:Mn,insert:co,link:uo,reference:Xt,strikethrough:oo,strong:no,subscript:Qt,superscript:Yt,text:zt}),o=Je(()=>n.customId),l=P(()=>{const e=o.value;return Object.keys(e).length>0?a(a({},t),e):t});return(t,o)=>(F(!0),K(Y,null,de(e.nodes,(t,o)=>(F(),ie(q(vt),{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 ko(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(ko)}function No(e,n=!0,t=!1){if(!e||!t&&0===e.length)return null;if(e.every(ko))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(ko)?l:null}function bo(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 So=["cite"],xo={key:0,dir:"auto",class:"paragraph-node"},wo=["custom-id"],Mo=/* @__PURE__ */tn(/* @__PURE__ */E({__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=P(()=>Boolean(t.value.paragraph)),l=P(()=>Boolean(t.value.text)),r=P(()=>No(n.node.children,!o.value)),i=P(()=>!1!==n.fade||l.value?null:bo(r.value));return ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade)),(t,o)=>(F(),K("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[r.value?(F(),K("p",xo,[null!==i.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(i.value),9,wo)):(F(),ie(q(yo),{key:1,nodes:r.value,"custom-id":n.customId,"index-key":`blockquote-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(F(),ie(q(Ba),{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,So))}}),[["__scopeId","data-v-abfecebc"]]);Mo.install=e=>{e.component(Mo.__name,Mo)};const Co={class:"definition-list"},Bo={class:"definition-term"},_o={class:"definition-desc"},Io=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(F(),K("dl",Co,[(F(!0),K(Y,null,de(n.node.items,(o,l)=>(F(),K(Y,{key:l},[z("dt",Bo,[V(q(Ba),{"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",_o,[V(q(Ba),{"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"]]);Io.install=e=>{e.component(Io.__name,Io)};const To=["href","title"],Oo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth",block:"center"})}return(n,o)=>(F(),K("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,To))}}),[["__scopeId","data-v-e1eb37b6"]]);Oo.install=e=>{e.component(Oo.__name,Oo)};const Lo=["id"],Ho={class:"flex-1"},Ao=/* @__PURE__ */E({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(F(),K("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[z("div",Ho,[V(q(Ba),{"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,Lo))}});Ao.install=e=>{e.component(Ao.__name,Ao)};const $o=["custom-id"],Ro=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Je(()=>n.customId),o=R("markstreamFade",void 0),l=P(()=>!1!==(null==o?void 0:o.value)||t.value.text?null:bo(n.node.children)),r=P(()=>a({text:zt,inline_code:Mn,link:uo,image:mt,strong:no,emphasis:vo,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,checkbox:on,checkbox_input:on,footnote_reference:sn,hardbreak:go,math_inline:Ut,reference:Xt},t.value));return(t,o)=>(F(),ie(ae(`h${e.node.level}`),ue({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:se(()=>[null!==l.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(l.value),9,$o)):(F(!0),K(Y,{key:1},de(e.node.children,(t,o)=>(F(),ie(q(vt),{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"]]),Po=Ro;Po.install=e=>{e.component(Ro.__name,Ro)};const Eo={key:0,dir:"auto",class:"paragraph-node"},Fo=["custom-id"],Ko={dir:"auto",class:"paragraph-node"},zo=["custom-id"],Wo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node)?e:n.item}),o=Je(()=>n.customId),l=P(()=>Boolean(o.value.paragraph)),r=P(()=>Boolean(o.value.text)),i=P(()=>{var e;return No(null==(e=t.value)?void 0:e.children,!l.value)}),a=P(()=>{var e;if(l.value)return null;const n=null==(e=t.value)?void 0:e.children;if(!Array.isArray(n)||n.length<2)return null;const o=n[0];if("paragraph"!==(null==o?void 0:o.type)||!Array.isArray(o.children))return null;const r=n.slice(1);if(!r.every(e=>"list"===(null==e?void 0:e.type)))return null;const i=No([o]);return i?{paragraphChildren:i,nestedLists:r}:null});function u(){return!1===n.fade&&!r.value}const s=P(()=>u()?bo(i.value):null),c=P(()=>{var e;return u()?bo(null==(e=a.value)?void 0:e.paragraphChildren):null}),d=Object.freeze({}),f=P(()=>{const{value:e}=n;return"number"==typeof e&&Number.isFinite(e)?{value:e}:d});return ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade)),(e,o)=>{var l,r;return F(),K("li",ue({class:"list-item",dir:"auto"},f.value),[i.value?(F(),K("p",Eo,[null!==s.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(s.value),9,Fo)):(F(),ie(q(yo),{key:1,nodes:i.value,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):a.value?(F(),K(Y,{key:1},[z("p",Ko,[null!==c.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(c.value),9,zo)):(F(),ie(q(yo),{key:1,nodes:a.value.paragraphChildren,"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(F(!0),K(Y,null,de(a.value.nestedLists,(t,l)=>(F(),ie(q(Ba),{key:l,nodes:[t],"custom-id":n.customId,"index-key":`list-item-${n.indexKey}-nested-${l}`,"show-tooltips":n.showTooltips,typewriter:n.typewriter,fade:n.fade,"is-dark":n.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:o[0]||(o[0]=n=>e.$emit("copy",n))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(F(),ie(q(Ba),{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"]]);Wo.install=e=>{e.component(Wo.__name,Wo)};const jo=/* @__PURE__ */tn(/* @__PURE__ */E({__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=P(()=>n.value.list_item||Wo);return(n,o)=>(F(),ie(ae(e.node.ordered?"ol":"ul"),{class:D(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:se(()=>[(F(!0),K(Y,null,de(e.node.items,(l,r)=>{var i;return F(),ie(ae(t.value),ue({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>n.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);jo.install=e=>{e.component(jo.__name,jo)};const Do={key:2,class:"html-block-node__raw"},Vo=["innerHTML"],qo={key:1,class:"html-block-node__placeholder"},Uo=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const n=e,t=R("markstreamHtmlPolicy",void 0),o=R("markstreamNestedRendererProps",void 0),l=P(()=>{var e,o;return null!=(o=null!=(e=n.htmlPolicy)?e:null==t?void 0:t.value)?o:"safe"}),r=P(()=>{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(()=>_a),suspensible:!1}),s=P(()=>{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=P(()=>{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=E({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),m=G(null),p=G("undefined"==typeof window),g=G(n.node.content),y=P(()=>Array.isArray(n.node.children)?n.node.children:[]),N=P(()=>String(n.node.tag||"div")),S=P(()=>{var e;if("details"!==N.value.trim().toLowerCase())return null;if(null==(e=n.node.attrs)?void 0:e.some(([e])=>"open"===String(e).toLowerCase()))return null;const t=y.value[0];return"html_block"===(null==t?void 0:t.type)&&"summary"===String(t.tag||"").toLowerCase()?t:null}),x=P(()=>{var e;return bo(null==(e=S.value)?void 0:e.children)}),M=P(()=>{const e=S.value;if(!e)return;const n=h(e.attrs,l.value,"summary");if(!n)return;const t=v(n);return Object.keys(t).length>0?t:void 0}),C=P(()=>null==x.value?y.value:y.value.slice(1)),B=P(()=>{const e=N.value.trim().toLowerCase();return w.has(e)||k(e,l.value)}),_=P(()=>y.value.length>0&&!!n.node.tag&&!B.value),I=P(()=>{var e,t,o;if(_.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=Nn(r,d.value,l.value);return null===e?{mode:"text",content:null!=(o=n.node.raw)?o:r}:{mode:"dynamic",nodes:e}}if(!kn(r,d.value))return{mode:"html",content:b(r,l.value)};const i=Nn(r,d.value,l.value);return null===i?{mode:"html",content:b(r,l.value)}:{mode:"dynamic",nodes:i}}),T=lt(),O=nt(),L=tt(),H=$(null),A=!!n.node.loading;return"undefined"!=typeof window?(X([()=>m.value,()=>null==O?void 0:O.value.heavyBlockMargin,()=>null==O?void 0:O.value.rootMargin],([e],t,o)=>{var l,r,i,a;if(null==(r=null==(l=H.value)?void 0:l.destroy)||r.call(l),H.value=null,!A)return p.value=!0,void(g.value=n.node.content);if(!e)return void(p.value=!1);let u=!0;const s=null!=(a=null!=(i=null==O?void 0:O.value.heavyBlockMargin)?i:null==O?void 0:O.value.rootMargin)?a:et,c=T(e,{rootMargin:s,allowIdle:!L.value});H.value=c,p.value=p.value||c.isVisible.value,c.whenVisible.then(()=>{u&&H.value===c&&(p.value=!0)}),o(()=>{u=!1,c.destroy(),H.value===c&&(H.value=null)})},{immediate:!0}),X(()=>n.node.content,e=>{A&&!p.value||(g.value=e)})):p.value=!0,te(()=>{var e,n;null==(n=null==(e=H.value)?void 0:e.destroy)||n.call(e),H.value=null}),(n,t)=>(F(),ie(ae(_.value?N.value:"div"),ue({ref_key:"htmlRef",ref:m,class:"html-block-node","data-markstream-viewport-pending":q(L)&&!p.value?"true":void 0},_.value?c.value:void 0),{default:se(()=>[p.value?(F(),K(Y,{key:0},["structured"===I.value.mode?(F(),K(Y,{key:0},[null!==x.value?(F(),K(Y,{key:0},[z("summary",ve(pe(M.value)),W(x.value),17),C.value.length?(F(),ie(q(i),ue({key:0},r.value,{nodes:C.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):Q("",!0)],64)):(F(),ie(q(i),ue({key:1},r.value,{nodes:y.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):"dynamic"===I.value.mode?(F(),ie(q(f),{key:1,nodes:I.value.nodes},null,8,["nodes"])):"text"===I.value.mode?(F(),K("pre",Do,W(I.value.content),1)):(F(),K("div",ue({key:3},s.value,{innerHTML:I.value.content}),null,16,Vo))],64)):(F(),K("div",qo,[oe(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,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Uo.install=e=>{e.component(Uo.__name,Uo)};const Go={dir:"auto",class:"paragraph-node"},Xo=["custom-id"],Jo=/* @__PURE__ */tn(/* @__PURE__ */E({__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=P(()=>{var e;return null!=(e=null==o?void 0:o.value)?e:"safe"}),d=P(()=>{var e;return null!=(e=n.parseOptions)?e:null==r?void 0:r.value}),f=P(()=>{var e;return null!=(e=n.customMarkdownIt)?e:null==i?void 0:i.value}),m=P(()=>{var e,t;return null!=(t=n.customHtmlTags)?t:null==(e=null==s?void 0:s.value)?void 0:e.customHtmlTags}),h=P(()=>{var e,t;const o=null!=(e=null==s?void 0:s.value)?e:{};return u(a({},o),{customId:null!=(t=n.customId)?t:o.customId,customHtmlTags:m.value,parseOptions:d.value,customMarkdownIt:f.value,htmlPolicy:c.value})}),v=re({loader:()=>Promise.resolve().then(()=>_a),suspensible:!1});function p(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}const g=P(()=>n.node.children.filter(e=>!p(e))),y=P(()=>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=P(()=>new Set(M(m.value))),N=P(()=>{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=P(()=>!1===(null==l?void 0:l.value)&&!t.value.text),S=P(()=>b.value?bo(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 w=P(()=>a({inline_code:Mn,image:mt,link:uo,hardbreak:go,emphasis:vo,strong:no,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,html_inline:Sn,html_block:Uo,emoji:rn,checkbox:on,math_inline:Ut,checkbox_input:on,reference:Xt,footnote_anchor:Oo,footnote_reference:sn,text:zt},t.value)),_=P(()=>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)&&B(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:zt,isCustomComponent:!1}}}return{child:e,component:w.value[e.type],isCustomComponent:Boolean(t.value[e.type]&&!Ve(String(e.type)))}}(e);return u(a({},r),{index:o,key:`${n.indexKey||"paragraph"}-${o}`,customAttrs:r.isCustomComponent?vn(r.child,c.value):void 0,hasSlotChildren:Array.isArray(r.child.children)&&r.child.children.length>0,slotContent:String(null!=(l=r.child.content)?l:""),originalChild:e})}));return(e,t)=>(F(),K("p",Go,[null!==S.value?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(S.value),9,Xo)):(F(!0),K(Y,{key:1},de(_.value,e=>{return F(),K(Y,{key:e.key},[y.value&&p(e.originalChild)?(F(),K(Y,{key:0},[Z(W((t=e.originalChild,String(null!=(o=t.content)?o:""))),1)],64)):e.isCustomComponent?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customAttrs,{node:e.child,loading:e.child.loading,"index-key":e.key,"custom-id":n.customId,"custom-html-tags":m.value,"is-dark":h.value.isDark}),{default:se(()=>[e.hasSlotChildren?(F(),ie(q(v),ue({key:0,ref_for:!0},h.value,{nodes:e.child.children,"index-key":e.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(q(v),ue({key:1,ref_for:!0},h.value,{content:e.slotContent,final:!e.child.loading,"index-key":`${e.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(F(),ie(ae(e.component),ue({key:2,ref_for:!0},x(e.child,e.index)),null,16))],64);var t,o}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);Jo.install=e=>{e.component(Jo.__name,Jo)};const Yo={class:"table-node-wrapper"},Zo=["aria-busy"],Qo={key:0},el=["custom-id"],nl=["aria-label","onPointerdown"],tl=["custom-id"],ol={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ll=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=P(()=>{var e;return null!=(e=n.node.loading)&&e}),o=P(()=>{var e;return null!=(e=n.node.rows)?e:[]}),l=G(null),r=G([]);let i=null;const a=P(()=>n.node.header.cells.length),u=P(()=>r.value.some(e=>Number.isFinite(e)&&e>0)),s=P(()=>u.value?r.value.map(e=>e>0?{width:`${e}px`}:void 0):[]);ne("markstreamShowTooltips",P(()=>n.showTooltips)),ne("markstreamFade",P(()=>n.fade));const c=Je(()=>n.customId),d=P(()=>Boolean(c.value.text)),f=P(()=>Boolean(c.value.paragraph)),m=/* @__PURE__ */new WeakMap;function h(e){const t=!1===n.fade&&!d.value,o=!f.value,l=m.get(e);if((null==l?void 0:l.children)===e.children&&l.textFastPath===t&&l.paragraphFastPath===o)return l.info;const r=No(e.children,o,!0),i={simpleChildren:r,plainText:r&&t?bo(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 X(a,()=>{p(),r.value=[]}),te(p),(a,c)=>(F(),K("div",Yo,[z("table",{ref_key:"tableRef",ref:l,class:D(["table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[u.value?(F(),K("colgroup",Qo,[(F(!0),K(Y,null,de(e.node.header.cells,(e,n)=>(F(),K("col",{key:n,style:ce(s.value[n])},null,4))),128))])):Q("",!0),z("thead",null,[z("tr",null,[(F(!0),K(Y,null,de(e.node.header.cells,(t,o)=>(F(),K("th",{key:o,dir:"auto",class:D(["right"===t.align?"text-right":"center"===t.align?"text-center":"text-left"])},[null!==h(t).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(t).plainText),9,el)):h(t).simpleChildren?(F(),ie(q(yo),{key:1,nodes:h(t).simpleChildren,"custom-id":n.customId,"index-key":`table-th-${n.indexKey}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(Ba),{key:2,nodes:t.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,fade:n.fade,"show-tooltips":n.showTooltips,onCopy:c[0]||(c[0]=e=>a.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),o<e.node.header.cells.length-1?(F(),K("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${o+1} and ${o+2}`,onPointerdown:e=>function(e,n){if(0!==n.button)return;const t=function(){var e;const n=null==(e=l.value)?void 0:e.querySelectorAll("thead th");return Array.from(null!=n?n:[],e=>Math.round(e.getBoundingClientRect().width))}(),o=t[e],a=t[e+1];o&&a&&(n.preventDefault(),i={index:e,startX:n.clientX,startWidth:o,nextStartWidth:a,widths:t},r.value=t,window.addEventListener("pointermove",v),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p))}(o,e)},null,40,nl)):Q("",!0)],2))),128))])]),z("tbody",null,[(F(!0),K(Y,null,de(o.value,(e,t)=>(F(),K("tr",{key:t},[(F(!0),K(Y,null,de(e.cells,(e,o)=>(F(),K("td",{key:o,class:D(["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]),dir:"auto"},[null!==h(e).plainText?(F(),K("span",{key:0,class:"text-node","custom-id":n.customId},W(h(e).plainText),9,tl)):h(e).simpleChildren?(F(),ie(q(yo),{key:1,nodes:h(e).simpleChildren,"custom-id":n.customId,"index-key":`table-td-${n.indexKey}-${t}-${o}`},null,8,["nodes","custom-id","index-key"])):(F(),ie(q(Ba),{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,Zo),V(ge,{name:"table-node-fade"},{default:se(()=>[t.value?(F(),K("div",ol,[oe(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)])):Q("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);ll.install=e=>{e.component(ll.__name,ll)};const rl={class:"hr-node"},il=/* @__PURE__ */tn({},[["render",function(e,n){return F(),K("hr",rl)}],["__scopeId","data-v-39b2349c"]]);il.install=e=>{e.component(il.__name,il)};const al={class:"unknown-node"},ul=/* @__PURE__ */E({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(F(),K("div",al,W(e.node.raw),1))}),sl=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const n=e,t=P(()=>`vmr-container vmr-container-${n.node.name}`),o=Je(()=>n.customId),l=P(()=>a({text:zt,paragraph:Jo,heading:Po,inline_code:Mn,link:uo,image:mt,strong:no,emphasis:vo,strikethrough:oo,insert:co,subscript:Qt,superscript:Yt,checkbox:on,checkbox_input:on,hardbreak:go,math_inline:Ut,reference:Xt,list:jo,math_block:Gt,table:ll},o.value));return(o,r)=>(F(),K("div",ue({class:t.value},e.node.attrs),[(F(!0),K(Y,null,de(e.node.children,(t,o)=>{return F(),ie(ae((r=t.type,l.value[r]||ul)),{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"]]);sl.install=e=>{e.component(sl.__name,sl)};const cl=["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"],dl=[[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 fl(e){if(e<=255)return cl[e];let n=0,t=dl.length-1;for(;n<=t;){const o=n+t>>1,l=dl[o];if(e<l[0])t=o-1;else{if(!(e>l[1]))return l[2];n=o+1}}return"L"}const ml=/[ \t\n\r\f]+/g,hl=/[\t\n\r\f]| {2,}|^ | $/;let vl=null;const pl=new RegExp("\\p{Script=Arabic}","u"),gl=new RegExp("\\p{M}","u"),yl=new RegExp("\\p{Nd}","u");function kl(e){return pl.test(e)}function Nl(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function bl(e){for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(!(t<12288)){if(t>=55296&&t<=56319&&n+1<e.length){const o=e.charCodeAt(n+1);if(o>=56320&&o<=57343){if(Nl(o-56320+(t-55296<<10)+65536))return!0;n++;continue}}if(Nl(t))return!0}}return!1}const Sl=/* @__PURE__ */new Set([" "," ","","\ufeff"]),xl=/* @__PURE__ */new Set(["-","‐","–","—"]);function wl(e,n){return!(function(e){const n=Pl(e);return null!==n&&Sl.has(n)}(e)||n&&(function(e){const n=Pl(e);return null!==n&&(Ml.has(n)||_l.has(n))}(e)||function(e){const n=Pl(e);return null!==n&&xl.has(n)}(e)))}const Ml=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Cl=/* @__PURE__ */new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),Bl=/* @__PURE__ */new Set(["'","’"]),_l=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Il=/* @__PURE__ */new Set([":",".","،","؛"]),Tl=/* @__PURE__ */new Set(["၏"]),Ol=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function Ll(e){if($l(e))return!0;let n=!1;for(const t of e)if(_l.has(t)||Fl(t))n=!0;else if(!n||!gl.test(t))return!1;return n}function Hl(e){for(const n of e)if(!Ml.has(n)&&!_l.has(n))return!1;return e.length>0}function Al(e){if($l(e))return!0;for(const n of e)if(!(Cl.has(n)||Bl.has(n)||gl.test(n)||Fl(n)))return!1;return e.length>0}function $l(e){let n=!1;for(const t of e)if("\\"!==t&&!gl.test(t)){if(!(Cl.has(t)||_l.has(t)||Bl.has(t)))return!1;n=!0}return n}function Rl(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 Pl(e){if(0===e.length)return null;const n=Rl(e,e.length);return e.slice(n)}const El=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function Fl(e){const n=e.codePointAt(0);return void 0!==n&&function(e,n){for(let t=0;t<n.length;t+=2)if(e>=n[t]&&e<=n[t+1])return!0;return!1}(n,El)}function Kl(e){const n=function(e){for(const n of e)if(!gl.test(n))return n;return null}(e);return null!==n&&yl.test(n)}function zl(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(gl.test(e))t--;else{if(!Cl.has(e)&&!Bl.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function Wl(e,n,t){return"text"!==t||n||1!==e.length||"-"===e||"—"===e?null:e}function jl(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 Dl(e,n){return e&&null!==n&&Il.has(n)}function Vl(e){const n=Pl(e);return null!==n&&Tl.has(n)}function ql(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 Ul(e){let n=e.length;for(;n>0;){const t=Rl(e,n),o=e.slice(t,n);if(Ol.has(o))return!0;if(!_l.has(o))return!1;n=t}return!1}function Gl(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 Xl=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Jl(e){return 1===e.length?e[0]:e.join("")}function Yl(e,n){const t=[];for(let o=e.length-1;o>=0;o--)t.push(e[o]);return t.push(n),Jl(t)}function Zl(e,n,t,o){if(!Xl.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=Gl(c,o),d="text"===e&&n;null===r||e!==r||d!==u?(null!==r&&l.push({text:Jl(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:Jl(i),isWordLike:u,kind:r,start:a}),l}function Ql(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const er=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function nr(e,n){const t=e.texts[n];return!!t.startsWith("www.")||er.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function tr(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const or=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),lr=/[\p{P}\p{S}\p{Co}]/u,rr=new RegExp("\\p{Emoji_Presentation}","u"),ir=/* @__PURE__ */new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function ar(e){const n=e.charCodeAt(0);return n<128?function(e){return e>=33&&e<=47&&45!==e||e>=58&&e<=64&&63!==e||e>=91&&e<=96||e>=123&&e<=126}(n):!ir.has(e)&&!rr.test(e)&&lr.test(e)}function ur(e){let n=!1;for(const t of e)if(!gl.test(t)){if(!ar(t))return!1;n=!0}return n}function sr(e,n,t,o){const l=!n&&ur(e),r=!o&&ur(t),i=function(e){const n=function(e){for(let n=e.length;n>0;){const t=Rl(e,n),o=e.slice(t,n);if(!gl.test(o))return o;n=t}return null}(e);return null!==n&&Fl(n)}(e),a=(n||i)&&function(e){for(let n=e.length;n>0;){const t=Rl(e,n),o=e.slice(t,n);if(!gl.test(o))return ar(o)||Fl(o);n=t}return!1}(e);return!!(l||r||a)&&!bl(e)&&!bl(t)&&(n||l||i)&&(o||r)}function cr(e){for(const n of e)if(yl.test(n))return!0;return!1}function dr(e){if(0===e.length)return!1;for(const n of e)if(!yl.test(n)&&!or.has(n))return!1;return!0}function fr(e,n){if(0===e.len)return[];if(!n.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const t=[];let o=0;for(let l=0;l<e.len;l++)"hard-break"===e.kinds[l]&&(t.push({startSegmentIndex:o,endSegmentIndex:l,consumedEndSegmentIndex:l+1}),o=l+1);return o<e.len&&t.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),t}function mr(e,n,t="normal",o="normal"){const l=function(e){const n=null!=e?e:"normal";return"pre-wrap"===n?{mode:n,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:n,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}(t),r="pre-wrap"===l.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e}(e):function(e){if(!hl.test(e))return e;let n=e.replace(ml," ");return 32===n.charCodeAt(0)&&(n=n.slice(1)),n.length>0&&32===n.charCodeAt(n.length-1)&&(n=n.slice(0,-1)),n}(e);if(0===r.length)return{normalized:r,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const i=function(e,n,t){var o,l,r;const i=(null===vl&&(vl=new Intl.Segmenter(void 0,{granularity:"word"})),vl);let a=0;const u=[],s=[],c=[],d=[],f=[],m=[],h=[],v=[],p=[],g=[],y=[],k=[];for(const w of i.segment(e))for(const e of Zl(w.segment,null!=(o=w.isWordLike)&&o,w.index,t)){let t=function(){null!==m[w]&&(s[w]=[jl(u,m,h,w)],m[w]=null),s[w].push(e.text),c[w]=c[w]||e.isWordLike,v[w]=v[w]||i,p[w]=p[w]||N,g[w]=S,y[w]=x,k[w]=Dl(p[w],b)};const o="text"===e.kind,r=Wl(e.text,e.isWordLike,e.kind),i=bl(e.text),N=kl(e.text),b=Pl(e.text),S=Ul(e.text),x=Vl(e.text),w=a-1;n.carryCJKAfterClosingQuote&&o&&a>0&&"text"===d[w]&&i&&v[w]&&g[w]||o&&a>0&&"text"===d[w]&&Hl(e.text)&&v[w]||o&&a>0&&"text"===d[w]&&y[w]?t():o&&a>0&&"text"===d[w]&&e.isWordLike&&N&&k[w]?(t(),c[w]=!0):null!==r&&a>0&&"text"===d[w]&&m[w]===r?h[w]=(null!=(l=h[w])?l:1)+1:o&&!e.isWordLike&&a>0&&"text"===d[w]&&!v[w]&&(Ll(e.text)||"-"===e.text&&c[w])?t():(u[a]=e.text,s[a]=[e.text],c[a]=e.isWordLike,d[a]=e.kind,f[a]=e.start,m[a]=r,h[a]=null===r?0:1,v[a]=i,p[a]=N,g[a]=S,y[a]=x,k[a]=Dl(N,b),a++)}for(let w=0;w<a;w++)null===m[w]?u[w]=Jl(s[w]):u[w]=jl(u,m,h,w);for(let w=1;w<a;w++)"text"!==d[w]||c[w]||!$l(u[w])||"text"!==d[w-1]||v[w-1]||(u[w-1]+=u[w],c[w-1]=c[w-1]||c[w],u[w]="");const N=Array.from({length:a},()=>null);let b=-1;for(let w=a-1;w>=0;w--){const e=u[w];if(0!==e.length){if("text"===d[w]&&!c[w]&&b>=0&&"text"===d[b]&&(Al(e)||"-"===e&&Kl(u[b]))){const n=null!=(r=N[b])?r:[];n.push(e),N[b]=n,f[b]=f[w],u[w]="";continue}b=w}}for(let w=0;w<a;w++){const e=N[w];null!=e&&(u[w]=Yl(e,u[w]))}let S=0;for(let w=0;w<a;w++){const e=u[w];0!==e.length&&(S!==w&&(u[S]=e,c[S]=c[w],d[S]=d[w],f[S]=f[w]),S++)}u.length=S,c.length=S,d.length=S,f.length=S;const x=function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let r=0;r<n.length-1;r++){if("text"!==o[r]||"text"!==o[r+1])continue;if(!bl(n[r])||!bl(n[r+1]))continue;const e=zl(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];let r=0;for(;r<e.len;){const i=e.texts[r],a=e.kinds[r],u=e.isWordLike[r];if("text"===a){const a=[i];let s=r+1,c=u;for(;s<e.len&&"text"===e.kinds[s]&&sr(e.texts[s-1],e.isWordLike[s-1],e.texts[s],e.isWordLike[s]);){const n=e.texts[s];a.push(n),c=c||e.isWordLike[s],s++}if(s>r+1){n.push(Jl(a)),t.push(c),o.push("text"),l.push(e.starts[r]),r=s;continue}}n.push(i),t.push(u),o.push(a),l.push(e.starts[r]),r++}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let u=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!u)break;0!==n.length&&cr(n)&&dr(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&&dr(i)&&cr(i)){const a=[i];let u=r+1;for(;u<e.len&&"text"===e.kinds[u]&&dr(e.texts[u]);)a.push(e.texts[u]),u++;n.push(Jl(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]),!tr(i))continue;const a=r+1;if(a>=e.len||Ql(e.kinds[a]))continue;const u=[],s=e.starts[a];let c=a;for(;c<e.len&&!Ql(e.kinds[c]);)u.push(e.texts[c]),c++;u.length>0&&(n.push(Jl(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]||!nr(e,i))continue;const l=[n[i]];let r=i+1;for(;r<e.len&&!Ql(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]=Jl(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=Jl(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=Jl(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(Jl(i)),t.push(a),o.push(u),l.push(s)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:S,texts:u,isWordLike:c,kinds:d,starts:f})))))));for(let w=0;w<x.len-1;w++){const e=ql(x.texts[w]);null!==e&&("space"!==x.kinds[w]&&"preserved-space"!==x.kinds[w]||"text"!==x.kinds[w+1]||!kl(x.texts[w+1])||(x.texts[w]=e.space,x.isWordLike[w]=!1,x.kinds[w]="preserved-space"===x.kinds[w]?"preserved-space":"space",x.texts[w+1]=e.marks+x.texts[w+1],x.starts[w+1]=x.starts[w]+e.space.length))}return x}(r,n,l),u="keep-all"===o?function(e,n,t){if(n.len<=1)return n;const o=[],l=[],r=[],i=[];let a=-1,u=!1;function s(e){o.push(n.texts[e]),l.push(n.isWordLike[e]),r.push("text"),i.push(n.starts[e])}function c(t){if(!(a<0)){if(u)a+1===t?s(a):function(t,a){let u=!1;for(let e=t;e<a;e++)u=u||n.isWordLike[e];const s=n.starts[t],c=a<n.len?n.starts[a]:e.length;o.push(e.slice(s,c)),l.push(u),r.push("text"),i.push(s)}(a,t);else for(let e=a;e<t;e++)s(e);a=-1,u=!1}}for(let d=0;d<n.len;d++){const e=n.texts[d],s=n.kinds[d];"text"!==s?(c(d),o.push(e),l.push(n.isWordLike[d]),r.push(s),i.push(n.starts[d])):(a>=0&&!wl(n.texts[d-1],t)&&c(d),a<0&&(a=d),u=u||bl(e))}return c(n.len),{len:o.length,texts:o,isWordLike:l,kinds:r,starts:i}}(r,i,n.breakKeepAllAfterPunctuation):i;return a({normalized:r,chunks:fr(u,l)},u)}let hr=null;const vr=/* @__PURE__ */new Map;let pr=null;const gr=new RegExp("\\p{Emoji_Presentation}","u"),yr=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let kr=null;const Nr=/* @__PURE__ */new Map;function br(){if(null!==hr)return hr;if("undefined"!=typeof OffscreenCanvas)return hr=new OffscreenCanvas(1,1).getContext("2d"),hr;if("undefined"!=typeof document)return hr=document.createElement("canvas").getContext("2d"),hr;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Sr(e,n){let t=n.get(e);return void 0===t&&(t={width:br().measureText(e).width,containsCJK:bl(e)},n.set(e,t)),t}function xr(){if(null!==pr)return pr;if("undefined"==typeof navigator)return pr={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},pr;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 pr={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},pr}function wr(){return null===kr&&(kr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),kr}function Mr(e){return gr.test(e)||e.includes("️")}function Cr(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=wr();for(const o of t.segment(e))Mr(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Br(e){return"space"===e||"zero-width-break"===e||"soft-hyphen"===e}function _r(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Ir(e,n,t=e.widths.length){for(;n<t&&Br(e.kinds[n]);)n++;return n}function Tr(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function Or(e,n,t){return 0!==e.letterSpacing&&n&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function Lr(e,n){return 0===n?0:e+n}function Hr(e,n,t,o,l){return Lr(o,"tab"===n?l+function(e,n){return 0!==e.letterSpacing&&e.spacingGraphemeCounts[n]>0?e.letterSpacing:0}(e,t):e.lineEndFitAdvances[t])}function Ar(e,n,t,o){return Lr(o,"tab"===n?0:e.lineEndFitAdvances[t])}function $r(e,n,t,o,l){return Lr(o,"tab"===n?l:e.lineEndPaintAdvances[t])}function Rr(e,n,t){return 0!==e.letterSpacing&&n?t+e.letterSpacing:t}function Pr(e,n){return 0===e.letterSpacing?n:n+e.letterSpacing}function Er(e,n,t){let o=n;for(;o<e.length&&e[o]<t;)o++;return o}function Fr(e,n){return function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r}=e;if(0===t.length)return 0;const i=n+xr().lineFitEpsilon;let a=0,u=0,s=!1,c=0,d=0,f=-1,m=0;function h(e=c,n=d,t=u){a++,u=0,s=!1,f=-1,m=0}function v(e,n){s=!0,c=e+1,d=0,u=n}function p(e,n,t){s=!0,c=e,d=n+1,u=t}function g(e,n){s?(u+=n,c=e+1,d=0):v(e,n)}function y(e,n){var t;const o=l[e],a=null!=(t=r[e])?t:null;let f=null===a?-1:Er(a,0,n+1),m=-1,v=0,g=n;for(;g<o.length;){const t=o[g];if(s)if(u+t>i){if(null!==a&&m>n){h(e,m,v),g=m,f=Er(a,f,g+1),m=-1,v=0;continue}h(),p(e,g,t)}else u+=t,c=e,d=g+1;else p(e,g,t);const l=g+1;null!==a&&a[f]===l&&(m=l,v=u,f++),g++}s&&c===e&&d===o.length&&(c=e+1,d=0)}let k=0;for(;k<t.length&&(s||(k=Ir(e,k),!(k>=t.length)));){const e=t[k],n=_r(o[k]);if(s)if(u+e>i){if(n){g(k,e),h(k+1,0,u-e),k++;continue}if(f>=0){if(c>f||c===f&&d>0){h();continue}h(f,0,m);continue}if(e>i&&null!==l[k]){h(),y(k,0),k++;continue}h()}else g(k,e),n&&(f=k+1,m=u-e),k++;else e>i&&null!==l[k]?y(k,0):v(k,e),n&&(f=k+1,m=u-e),k++}return s&&h(),a}(e,n);const{widths:t,kinds:o,breakableFitAdvances:l,breakablePreferredBreaks:r,discretionaryHyphenWidth:i,chunks:a}=e;if(0===t.length||0===a.length)return 0;const u=xr(),s=n+u.lineFitEpsilon;let c=0,d=0,f=!1,m=0,h=0,v=-1,p=0,g=0,y=null;function k(){v=-1,p=0,g=0,y=null}function N(e=m,n=h,t){c++,d=0,f=!1,k()}function b(e,n){f=!0,m=e+1,h=0,d=n}function S(e,n,t){f=!0,m=e,h=n+1,d=t}function x(e,n){f?(d+=n,m=e+1,h=0):b(e,n)}function w(n,t,o,l,r,i){if(!t)return;const a=Ar(e,n,o,r),u=$r(e,n,o,r,l);v=o+1,p=d-i+a,g=d-i+u,y=n}function M(n,t){var o;const i=l[n],a=null!=(o=r[n])?o:null;let u=null===a?-1:Er(a,0,t+1),c=-1,v=t;for(;v<i.length;){const o=i[v];if(f){const l=Rr(e,!0,o),r=d+l;if(Pr(e,r)>s){if(null!==a&&c>t){N(n,c),v=c,u=Er(a,u,v+1),c=-1;continue}N(),S(n,v,o)}else d=r,m=n,h=v+1}else S(n,v,o);const l=v+1;null!==a&&a[u]===l&&(c=l,u++),v++}f&&m===n&&h===i.length&&(m=n+1,h=0)}function C(e){c++,k()}for(let B=0;B<a.length;B++){const n=a[B];if(n.startSegmentIndex===n.endSegmentIndex){C();continue}f=!1,d=0,n.startSegmentIndex,m=n.startSegmentIndex,h=0,k();let r=n.startSegmentIndex;for(;r<n.endSegmentIndex&&(f||(r=Ir(e,r,n.endSegmentIndex),!(r>=n.endSegmentIndex)));){const n=o[r],a=_r(n),c=Or(e,f,r),k="tab"===n?Tr(d+c,e.tabStopAdvance):t[r],S=c+k,C=Hr(e,n,r,c,k);if("soft-hyphen"!==n)if(f){if(d+C>s){const t=d+Ar(e,n,r,c);if($r(e,n,r,c,k),"soft-hyphen"===y&&u.preferEarlySoftHyphenBreak&&p<=s){N(v,0);continue}if(a&&t<=s){x(r,S),N(r+1,0),r++;continue}if(v>=0&&p<=s){if(m>v||m===v&&h>0){N();continue}const e=v;N(e,0),r=e;continue}if(C>s&&null!==l[r]){N(),M(r,0),r++;continue}N();continue}x(r,S),w(n,a,r,k,c,S),r++}else C>s&&null!==l[r]?M(r,0):b(r,k),w(n,a,r,k,c,S),r++;else f&&(m=r+1,h=0,v=r+1,p=d+i,g=d+i,y=n),r++}f&&(n.consumedEndSegmentIndex,N(n.consumedEndSegmentIndex,0))}return c}(e,n)}let Kr=null;function zr(){return null===Kr&&(Kr=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Kr}function Wr(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=Ul(e),a=Cl.has(e)}function c(e,n){o.push(e),r=r||n;const t=Ul(e);i=1===e.length&&_l.has(e)&&i||t,a=!1}for(const d of zr().segment(e)){const e=d.segment,t=bl(e);0!==o.length?a||Ml.has(e)||_l.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 jr(e,n,t){if(n.length<=1)return n;const o=[];let l=-1,r=!1;function i(t){if(!(l<0)){if(r)l+1===t?o.push(n[l]):function(t,l){const r=n[t].start,i=l<n.length?n[l].start:e.length;o.push({text:e.slice(r,i),start:r})}(l,t);else for(let e=l;e<t;e++)o.push(n[e]);l=-1,r=!1}}for(let a=0;a<n.length;a++){const e=n[a];l>=0&&!wl(n[a-1].text,t)&&i(a),l<0&&(l=a),r=r||bl(e.text)}return i(n.length),o}function Dr(e,n){if("zero-width-break"===n||"soft-hyphen"===n||"hard-break"===n)return 0;if("tab"===n)return 1;let t=0;const o=zr();for(const l of o.segment(e))t++;return t}function Vr(e){return"-"===e||"֊"===e||"‐"===e||"‒"===e||"–"===e||"—"===e}function qr(e,n,t,o,l){const r=xr(),{cache:i,emojiCorrection:a}=function(e,n){br().font=e;const t=function(e){let n=vr.get(e);return n||(n=/* @__PURE__ */new Map,vr.set(e,n)),n}(e),o=function(e){const n=e.match(/(\d+(?:\.\d+)?)\s*px/);return n?parseFloat(n[1]):16}(e),l=n?function(e,n){let t=Nr.get(e);if(void 0!==t)return t;const o=br();o.font=e;const l=o.measureText("😀").width;if(t=0,l>n+.5&&"undefined"!=typeof document&&null!==document.body){const n=document.createElement("span");n.style.font=e,n.style.display="inline-block",n.style.visibility="hidden",n.style.position="absolute",n.textContent="😀",document.body.appendChild(n);const o=n.getBoundingClientRect().width;document.body.removeChild(n),l-o>.5&&(t=l-o)}return Nr.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(u=e.normalized,yr.test(u)));var u;const s=Cr("-",Sr("-",i),a)+(0===l?0:2*l),c=8*Cr(" ",Sr(" ",i),a),d=0!==l;if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],m=[],h=[],v=[];let p=e.chunks.length<=1&&!d;const g=t?[]:null,y=[],k=[],N=[],b=t?[]:null,S=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a,u){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(p=!1),f.push(n),m.push(t),h.push(o),v.push(l),null==g||g.push(r),y.push(i),k.push(a),d&&N.push(u),null!==b&&b.push(e)}function w(e,n,t,u,s){const c=Sr(e,i),f=d?Dr(e,n):0,m=function(e,n,t){return n>1?e+(n-1)*t:e}(Cr(e,c,a),f,l),h="space"===n||"preserved-space"===n||"zero-width-break"===n?0:m,v=0===h?0:h+(f>0?l:0),p="space"===n||"zero-width-break"===n?0:m;if(s&&u&&e.length>1){let u="sum-graphemes";0!==l?u="segment-prefixes":dr(e)?u="pair-context":r.preferPrefixWidthsForBreakableRuns&&(u="segment-prefixes");const s=function(e,n,t,o,l){if(void 0!==n.breakableFitAdvances&&n.breakableFitMode===l)return n.breakableFitAdvances;n.breakableFitMode=l;const r=wr(),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=Sr(n,t);e.push(Cr(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=Cr(n,Sr(n,t),o);if(null===l)e.push(i);else{const i=l+n,a=Sr(i,t);e.push(Cr(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=Cr(u,Sr(u,t),o);a.push(e-s),s=e}return n.breakableFitAdvances=a,n.breakableFitAdvances}(e,c,i,a,u),d=null===s||"keep-all"===o?null:function(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const n=[];let t=0;for(const o of zr().segment(e))t++,Vr(o.segment)&&n.push(t);return 0===n.length?null:n}(e);return void x(e,m,v,p,n,t,s,d,f)}x(e,m,v,p,n,t,null,null,f)}for(let B=0;B<e.len;B++){S[B]=f.length;const n=e.texts[B],t=e.isWordLike[B],l=e.kinds[B],a=e.starts[B];if("soft-hyphen"===l){x(n,0,s,s,l,a,null,null,0);continue}if("hard-break"===l){x(n,0,0,0,l,a,null,null,0);continue}if("tab"===l){x(n,0,0,0,l,a,null,null,d?Dr(n,l):0);continue}const u=Sr(n,i);if("text"===l&&u.containsCJK){const e=Wr(n,r),l="keep-all"===o?jr(n,e,r.breakKeepAllAfterPunctuation):e;for(let n=0;n<l.length;n++){const e=l[n];w(e.text,"text",a+e.start,t,"keep-all"===o||!bl(e.text))}continue}w(n,l,a,t,!0)}const M=function(e,n,t){const o=[];for(let l=0;l<e.length;l++){const r=e[l],i=r.startSegmentIndex<n.length?n[r.startSegmentIndex]:t,a=r.endSegmentIndex<n.length?n[r.endSegmentIndex]:t,u=r.consumedEndSegmentIndex<n.length?n[r.consumedEndSegmentIndex]:t;o.push({startSegmentIndex:i,endSegmentIndex:a,consumedEndSegmentIndex:u})}return o}(e.chunks,S,f.length),C=null===g?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=!1;for(let s=0;s<n;){const l=e.charCodeAt(s);let r=l,i=1;if(l>=55296&&l<=56319&&s+1<n){const n=e.charCodeAt(s+1);n>=56320&&n<=57343&&(r=n-56320+(l-55296<<10)+65536,i=2)}const a=fl(r);"R"!==a&&"AL"!==a&&"AN"!==a||(o=!0);for(let e=0;e<i;e++)t[s+e]=a;s+=i}if(!o)return null;let l=0;for(let s=0;s<n;s++){const e=t[s];if("L"===e){l=0;break}if("R"===e||"AL"===e){l=1;break}}const r=new Int8Array(n);for(let s=0;s<n;s++)r[s]=l;const i=1&l?"R":"L",a=i;let u=a;for(let s=0;s<n;s++)"NSM"===t[s]?t[s]=u:u=t[s];u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="AL"===u?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(u=e)}for(let s=0;s<n;s++)"AL"===t[s]&&(t[s]="R");for(let s=1;s<n-1;s++)"ES"===t[s]&&"EN"===t[s-1]&&"EN"===t[s+1]&&(t[s]="EN"),"CS"!==t[s]||"EN"!==t[s-1]&&"AN"!==t[s-1]||t[s+1]!==t[s-1]||(t[s]=t[s-1]);for(let s=0;s<n;s++){if("EN"!==t[s])continue;let e;for(e=s-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=s+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let s=0;s<n;s++){const e=t[s];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[s]="ON")}u=a;for(let s=0;s<n;s++){const e=t[s];"EN"===e?t[s]="L"===u?"L":"EN":"R"!==e&&"L"!==e||(u=e)}for(let s=0;s<n;s++){if("ON"!==t[s])continue;let e=s+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(s>0?t[s-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=s;n<e;n++)t[n]=o;s=e-1}for(let s=0;s<n;s++)"ON"===t[s]&&(t[s]=i);for(let s=0;s<n;s++){const e=t[s];1&r[s]?"L"!==e&&"AN"!==e&&"EN"!==e||r[s]++:"R"===e?r[s]++:"AN"!==e&&"EN"!==e||(r[s]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,g);return null!==b?{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M,segments:b}:{widths:f,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:v,simpleLineWalkFastPath:p,segLevels:C,breakableFitAdvances:y,breakablePreferredBreaks:k,letterSpacing:l,spacingGraphemeCounts:N,discretionaryHyphenWidth:s,tabStopAdvance:c,chunks:M}}const Ur="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Gr=["diff ","index ","--- ","+++ ","@@ "],Xr=(()=>{const e=globalThis;if(e[Ur])return e[Ur];const n={configs:{},controllers:{},revision:$(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Ur]=n,n})();let Jr=null;const Yr=Xr.revision;function Zr(e){var n;return e&&null!=(n=Xr.configs[e])?n:null}function Qr(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function ei(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function ni(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!ei(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 ti(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=Jr)return Jr;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return Jr=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),Jr}catch(n){return Jr=!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=Xr.blockEstimateCache.get(i);if(a)return Xr.blockEstimateCache.delete(i),Xr.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=Xr.preparedCache.get(o);if(l)return Xr.preparedCache.delete(o),Xr.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){var l,r;const i=null!=(l=null==o?void 0:o.wordBreak)?l:"normal",a=null!=(r=null==o?void 0:o.letterSpacing)?r:0;return qr(mr(e,xr(),null==o?void 0:o.whiteSpace,i),n,!1,i,a)}(e,n,0,t)}(e,n,{whiteSpace:t});for(Xr.preparedCache.set(o,{prepared:r});Xr.preparedCache.size>240;){const e=Xr.preparedCache.keys().next().value;if(!e)break;Xr.preparedCache.delete(e)}return r}(e,t.font,u),c=function(e,n,t){const o=Fr(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(Xr.blockEstimateCache.set(i,{height:f,contentHeight:Math.round(d)});Xr.blockEstimateCache.size>4e3;){const e=Xr.blockEstimateCache.keys().next().value;if(!e)break;Xr.blockEstimateCache.delete(e)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch(r){return null}}function oi(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=ni(e.children);return o&&t.paragraph?ti(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=ni(e.children),r=t.headings[o];return l&&r?ti(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=ni(null==(l=r[0])?void 0:l.children);return i?ti(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=oi(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 li(e){if(!e)return 1;const n=String(e).split(/\r\n|\n|\r/);return Math.max(1,n.length)}function ri(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function ii(e,n){return e.diff?gt({diffStyle:n})?function(e){const n=ri(e.raw);if(n){const t=n.split(/\r?\n/);return null!=e.originalCode||null!=e.updatedCode?Math.max(1,t.filter(e=>!Gr.some(n=>e.startsWith(n))).length):Math.max(1,t.length)}return li(ri(e.originalCode))+li(ri(e.updatedCode))}(e):function(e){const n=e.originalCode,t=e.updatedCode;if(null!=n||null!=t)return Math.max(li(ri(n)),li(ri(t)));const o=ri(e.code).split(/\r?\n/);let l=0,r=0;for(const i of o)i.startsWith("+")&&!i.startsWith("+++")?r++:i.startsWith("-")&&!i.startsWith("---")?l++:(l++,r++);return Math.max(1,l,r)}(e):li(ri(e.code,!0===e.loading))}function ai(e,n,t){return Math.max(1,Math.ceil(function(e,n){let t=0;for(const o of e)t+="\t"===o?n-t%n:o>="ᄀ"?2:1;return t}(e,t)/n))}function ui(e,n,t,o,l,r){var i,a,u;const s=e/(r?2:1),c=null==(null==(i=l.codeBlockOptions)?void 0:i.padding)?n:o.padding,d=null!=(u=l.showLineNumbers)?u:!0!==(null==(a=l.codeBlockOptions)?void 0:a.disableLineNumbers),f=Math.max(2,String(Math.max(1,t)).length)*n,m=d?3*n+f+2:0;return Math.max(1,Math.floor((s-m-2*c)/n))}function si(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function ci(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=Qr(o.lineHeight,1.5*Qr(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:si(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}const di=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function fi(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))di.has(i)||l.has(i)||a.enumerable&&"value"in a&&(o[i]=a.value);return o}const mi=!1;function hi(e,n,t,o){var l;const r=function(e){return Math.max(0,Math.ceil(e.scrollHeight||0)-Math.ceil(e.clientHeight||0))}(e),i=function(e,n){return Number.isFinite(e)?Math.min(Math.max(0,e),n):0}(t,r);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=i);const a=Math.max(0,r-i),u=[-a,a];let s=u[0],c=Number.POSITIVE_INFINITY;for(const f of u){e.scrollTop=f;const t=o.getNormalizedScrollTop(e,n,!1),l=Math.abs(t-i);l<c&&(c=l,s=f)}e.scrollTop=s;const d=null!=(l=o.epsilonPx)?l:2;Math.abs(o.getNormalizedScrollTop(e,n,!1)-i)>d&&(e.scrollTop=s)}function vi(e,n){let t=0,o=null,l=null;const r=()=>{const n=l;l=null,o=null,n&&(t=Date.now(),e(...n))};return function(...i){const a=Date.now(),u=n-(a-t);l=i,u<=0?(o&&(clearTimeout(o),o=null),t=a,l=null,e(...i)):o||(o=setTimeout(r,u))}}function pi(e){return"simple"===e?"simple":!0===e||"true"===e||"precise"===e?"precise":"off"}const gi=/* @__PURE__ */Symbol("MarkstreamMathBlockMinHeightCache");function yi(){return R(gi,null)}const ki=/* @__PURE__ */new Set(["text","inline_code","emoji","footnote_reference"]),Ni=/* @__PURE__ */new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function bi(e){const n=Number(e);return!Number.isFinite(n)||n<=0?-1:Math.round(n/32)}function Si(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 xi(e){var n;if(!e||"object"!=typeof e)return!1;const t=e,o=String(null!=(n=t.type)?n:"");if(ki.has(o))return!0;if(!Ni.has(o))return!1;const l=t.children;return!Array.isArray(l)||!l.length||l.every(xi)}function wi(e){var n,t,o,l,r,i,a,u;if(!e||"object"!=typeof e)return"";const s=e,c=String(null!=(n=s.type)?n:"");if("text"===c)return String(null!=(o=null!=(t=s.content)?t:s.raw)?o:"");if("inline_code"===c)return String(null!=(i=null!=(r=null!=(l=s.code)?l:s.content)?r:s.raw)?i:"");if("emoji"===c)return String(null!=(u=null!=(a=s.name)?a:s.raw)?u:"");if("string"==typeof s.text)return s.text;const d=[];for(const f of["children","items","cells","rows"]){const e=s[f];if(Array.isArray(e)){const n=e.map(wi).filter(Boolean).join(" ");n&&d.push(n)}}return d.join(" ").replace(/\s+/g," ").trim()}function Mi(e){if(!e||"object"!=typeof e)return!1;const n=e;return"inline_code"===n.type||["children","items","cells","rows"].some(e=>{const t=n[e];return Array.isArray(t)&&t.some(Mi)})}function Ci(e,n){if(!e)return 30;const t=Math.max(18,Math.floor(Math.max(320,n)/8)),o=e.split(/\r?\n/).length,l=Math.ceil(e.length/t),r=Math.max(1,o,l);return 30+26*Math.max(0,r-1)}function Bi(e,n){var t,o,l,r,i,a,u,s,c,d,f,m,h,v;if(!e||"object"!=typeof e)return 32;const p=e,g=String(null!=(t=p.type)?t:""),y=Number.isFinite(n)&&n>0?n:640;switch(g){case"heading":return function(e){var n;const t=Number(null!=(n=e.level)?n:e.depth);return t>=4?20:3===t?30:2===t?32:44}(p);case"paragraph":return function(e,n){const t=String(null!=e?e:"");if(!t)return 28;const o=Math.max(18,Math.floor(Math.max(320,n)/8)),l=t.split(/\r?\n/).length,r=Math.ceil(t.length/o);return Math.max(1,l,r)<=1?28:Si(t,n,34)}(String(null!=(l=null!=(o=p.raw)?o:p.content)?l:""),y);case"list":return function(e,n){var t;const o=Array.isArray(e.items)?e.items:[];if(!o.length)return 48;const l=Math.max(48,30*o.length+12);let r=12;for(const u of o)r+=Ci(wi(u)||String(null!=(t=u.raw)?t:""),n);const i=Math.max(0,r-l);if(o.length>20){const e=Math.round(2.4*o.length);return Math.round(l+Math.max(e,Math.min(i,3*o.length)))}if(i<=0)return l;const a=o.length>8?8*o.length:i;return Math.round(l+Math.min(i,a))}(p,y);case"list_item":return Si(String(null!=(i=null!=(r=p.raw)?r:p.content)?i:""),y,34);case"blockquote":return Si(String(null!=(u=null!=(a=p.raw)?a:p.content)?u:""),y,56);case"table":return function(e,n){const t=[...e.header?[e.header]:[],...Array.isArray(e.rows)?e.rows:[]];if(!t.length){const n=Array.isArray(e.children)?e.children.length:3;return Math.max(120,38*n+48)}return Math.max(120,Math.round(4+t.reduce((e,t)=>e+function(e,n){const t=Math.max(1,e.length),o=Math.max(80,(n-32)/t),l=Math.max(10,Math.floor(o/8)),r=Math.max(1,...e.map(e=>{var n;const t=wi(e)||String(null!=(n=null==e?void 0:e.raw)?n:"");return Math.ceil(t.length/l)||1}));return 54+34*Math.max(0,r-1)+(t<=3&&e.some(Mi)?14:0)}(function(e){var n;return Array.isArray(null==e?void 0:e.cells)&&null!=(n=e.cells)?n:[]}(t),n),0)))}(p,y);case"code_block":{const e=String(null!=(s=p.language)?s:"").trim().toLowerCase(),n=String(null!=(d=null!=(c=p.code)?c:p.raw)?d:"");return"mermaid"===e?Ae($e(n)):"infographic"===e?Re(Pe(n)):Si(n,y,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return function(e,n){var t,o,l;const r=e.match(/^\s*<details\b([^>]*)>/i);return r&&!/(?:^|\s)open(?:\s|=|$)/i.test(null!=(t=r[1])?t:"")?Si((null==(l=null==(o=e.match(/<summary\b[^>]*>([\s\S]*?)<\/summary>/i))?void 0:o[1])?void 0:l.replace(/<[^>]*>/g,"").trim())||"Details",n,28,28):Si(e,n,96)}(String(null!=(m=null!=(f=p.raw)?f:p.content)?m:""),y);case"thematic_break":return 24;default:return Si(String(null!=(v=null!=(h=p.raw)?h:p.content)?v:""),y,40)}}function _i(e,n,t){return Math.min(Math.max(e,n),t)}const Ii=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],Ti=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","safeMarkdownMs","tokenizeMs","htmlBlockPassesMs","parseMarkdownToStructureTotalMs"],Oi=/* @__PURE__ */new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),Li=["raw","content","code","originalCode","updatedCode"],Hi=/* @__PURE__ */new WeakMap,Ai=/* @__PURE__ */new WeakMap;let $i=1;function Ri(){return"undefined"!=typeof performance?performance.now():Date.now()}function Pi(e){const n=e.stream;return n&&"function"==typeof n.stats?n.stats():null}function Ei(e){if("object"!=typeof e&&"function"!=typeof e||null===e)return"";const n=e;let t=Hi.get(n);return t||(t=$i++,Hi.set(n,t)),String(t)}function Fi(e,n,t,o={}){var l,r;const i=!1!==o.includeFinal,a={md:Ei(n),customMarkdownIt:Ei(t),requireClosingStrong:!0===e.requireClosingStrong,customHtmlTags:null!=(l=e.customHtmlTags)?l:[],includeSourceMap:!0===e.includeSourceMap,streamParse:null!=(r=e.streamParse)?r:"auto",validateLink:Ei(e.validateLink),preTransformTokens:Ei(e.preTransformTokens),postTransformTokens:Ei(e.postTransformTokens),postTransformNodes:Ei(e.postTransformNodes)};return i&&(a.final=!0===e.final),JSON.stringify(a)}function Ki(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 zi(e){const n=Wi(e);return n.length>=2&&n.every(e=>{const n=e.trim();return n.length>=1&&n.replace(/^:/,"").replace(/:$/,"").split("").every(e=>"-"===e)})}function Wi(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function ji(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 Di(e){const n=String(null!=e?e:"");return`${n.length}:${ji(n)}`}function Vi(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?Di(e):`${e.length}:${ji(e.slice(0,8192))}:truncated`}(e)}`;if("function"==typeof e)return`fn:${Ei(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:${Ei(o)}`;const r=Ei(o);if(n.set(o,r),Array.isArray(e)){const o=e.slice(0,200);return`a:${e.length}:${o.map(e=>Vi(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}:${Vi(o[e],n,t+1)}`).join(";")}`}return typeof e}function qi(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"string"==typeof e.raw}function Ui(e,n=/* @__PURE__ */new WeakMap,t=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(e=>qi(e)?Ji(e,n,t+1):Ui(e,n,t+1)).join(",")}`:qi(e)?Ji(e,n,t):Vi(e,n,t)}function Gi(e,n,t){return Object.keys(e).sort().filter(e=>"children"!==e&&!Li.includes(e)).map(o=>{const l=e[o];return"string"==typeof l?`${o}=s:${Di(l)}`:"number"==typeof l||"boolean"==typeof l||null==l?`${o}=${String(l)}`:"function"==typeof l?`${o}=fn:${Ei(l)}`:Oi.has(o)&&(Array.isArray(l)||"object"==typeof l)?`${o}=${Ui(l,n,t+1)}`:l&&"object"==typeof l?`${o}=object:${Ei(l)}`:""}).filter(Boolean).join(";")}function Xi(e){return Li.map(n=>{const t=e[n];return"string"==typeof t?`${n}=s:${Di(t)}`:""}).filter(Boolean).join(";")}function Ji(e,n=/* @__PURE__ */new WeakMap,t=0){const o=Ai.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}:${Ei(l)}`;const i=Ei(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=>Ji(e,n,t+1)).join("|"):"";return[e.type,Xi(o),Gi(o,n,t),l.length,r].join(":")}(e,n,t);return Ai.set(l,a),a}function Yi(e,n){return Ji(e)===Ji(n)}function Zi(e,n,t){const o=Ri(),l="stabilizeSignatureMs"===n?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return t()}finally{e[n]+=Ri()-o,e[l]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function Qi(e,n,t){return Zi(n,t,()=>Ji(e))}function ea(e,n,t){return Qi(e,t,"stabilizeSignatureMs")===Qi(n,t,"stabilizeSignatureMs")}function na(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ta(e,n,t){return e<0?0:Math.max(n.length,t.length)-e}function oa(e){return!0===e.__markstreamHasCustomParserExtensions||function(e){var n;return Number(null!=(n=e.__markstreamRegisteredPluginCount)?n:0)>0}(e)}function la(e,n){return e.length===n.length&&e===n}function ra(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(!la(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(!qi(e)||!qi(n))return null;const o=ra(e,n,t+1);if(null==o)return null;if(!o)return!1}return!0}function ia(e,n){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;const t=ra(e,n);return null!=t?t:Yi(e,n)}function aa(e,n,t){if(!e||!n)return!1;if(e===n)return!0;if(e.type!==n.type)return!1;let o=null;return Zi(t,"stabilizeSignatureMs",()=>{o=ra(e,n)}),null!=o?o:ea(e,n,t)}function ua(e,n){const t={};for(const o of Ii){const l=e[o],r=null==n?void 0:n[o];"number"==typeof l&&(t[o]=l-("number"==typeof r?r:0))}return t}function sa(e,n){var t;const o=_(n.instanceMsgId),l=/* @__PURE__ */new Map,r=null!=(t=n.smoothStreamingEnabled)?t:P(()=>!1),i=G(n.renderContent.value);let s=[],d="",f="",m="",h=!1;const v=function(){let e="",n=0,t=!1,o=!1,l=!1,r=!1;function i(){e="",n=0,t=!1,o=!1,l=!1,r=!1}function a(e){let i=!1;for(let a=0;a<e.length;a++){const u=e.charCodeAt(a);if(10===u||13===u){const e=10===u&&r;r=13===u,t=!1,e||(l||(o=!1,n=0),l=!1);continue}r=!1;const s=9===u||32===u;if(s||(l=!0,o&&(i=!0)),n)if(1!==n)s||(58!==u?n=91===u?1:0:(i=!0,o=!0));else{if(t){t=!1;continue}if(92===u){t=!0;continue}93===u&&(n=2)}else 91===u&&(n=1)}return i}return(n,t)=>{if(!n||!t.startsWith(n)||t.length<=n.length)return i(),[!0,0];let o=0;e!==n&&(i(),a(n),o=n.length);const l=t.slice(n.length),r=a(l);return e=t,[r,o+l.length]}}();let p,y=0,k=0,N=Ri(),b=-1,S=0;function x(e){b=Number.isInteger(e)?e:0,S+=1}function w(){p&&(clearTimeout(p),p=void 0)}function M(){w();const e=n.renderContent.value;i.value!==e&&(i.value=e),N=Ri()}X([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&&(!!zi(Ki(n))||!(!t.includes("\n\n")&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(t))||t.endsWith("\n")&&!function(e){const n=Ki(e);if(zi(n))return!1;const t=Wi(n);return t.length>=2&&t.some(e=>e.trim())}(n))}(i.value,n)?M():function(){if(k+=1,p)return;const n=Math.max(0,function(e){const n=e.parseCoalesceMs;return"number"==typeof n&&Number.isFinite(n)&&n>=0?n:80}(e)-(Ri()-N));n<=0?M():p=setTimeout(M,n)}())},{flush:"sync",immediate:!0}),J(w);const C=P(()=>{var t,o,l,r;return I(e.customHtmlTags,null==(t=e.parseOptions)?void 0:t.customHtmlTags,(r=null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{},Object.entries(r).map(([e,n])=>{const t=c(e);return null==n||!t||Ve(t)||L.has(t)||g.has(t)?"":t}).filter(Boolean)))}),B=P(()=>{const{key:e,tags:t}=T(C.value);if(!e)return o;const r=l.get(e);if(r)return r;const i=_(n.instanceMsgId,{customHtmlTags:t});return l.set(e,i),i}),H=P(()=>{const n=B.value;if(!e.customMarkdownIt)return n;const t=e.customMarkdownIt(n);return n.__markstreamHasCustomParserExtensions=!0,t.__markstreamHasCustomParserExtensions=!0,t}),A=P(()=>{var t,o;const l=null!=(t=e.parseOptions)?t:{},r=n.effectiveFinal.value,i=C.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}),$=P(()=>{var e;return new Set((null!=(e=A.value.customHtmlTags)?e:[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),R=P(()=>Fi(A.value,H.value,e.customMarkdownIt,{includeFinal:!0})),E=P(()=>Fi(A.value,H.value,e.customMarkdownIt,{includeFinal:!1}));X([R,E],([e,n],[t,o])=>{t&&(e===t&&n===o||(M(),n!==o&&(s=[],m="")))},{flush:"sync"});const F=P(()=>{var t,o,l,r,c,p,g,N,S,w,M;if(null==(t=e.nodes)?void 0:t.length)return s=[],m="",x(0),he(e.nodes.slice());const C=i.value;if(!C)return s=[],m="",x(-1),[];const B=n.debugPerformanceEnabled.value,_=B?Ri():0,I=H.value,T=R.value,L=E.value;d&&T!==d&&function(e){var n,t;null==(t=null==(n=e.stream)?void 0:n.reset)||t.call(n)}(I),f&&L!==f&&(s=[],m="");const $=Object.keys(null!=(l=null==(o=n.customComponentsMap)?void 0:o.value)?l:{}).length>0||"function"==typeof A.value.postTransformNodes;$!==h&&(s=[],m="");const P=!$&&s.length>0&&C.startsWith(m)&&L===f,F=B?Pi(I):null,K=B?{}:void 0,z=!oa(I)&&!$,W=a(u(a({},A.value),{reuseStableTopLevelNodes:z}),K?{parserMetrics:K}:{}),j=O(C,I,W),D=B?Ri():0,V=B?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let q,U=B?na(j.length):void 0,G=0,X=0,J=0;if(P){const n=B?Ri():0,[t,o]=function(e){var n,t;const[o,l]=e.scanGlobalReferenceAppend(e.previousContent,e.content),r=e.parseOptions;return[e.previousDirtyStartIndex>0&&!0!==r.final&&!e.customMarkdownIt&&!oa(e.md)&&!o&&"function"!=typeof r.preTransformTokens&&"function"!=typeof r.postTransformTokens&&"function"!=typeof r.postTransformNodes&&0===(null!=(t=null==(n=r.customHtmlTags)?void 0:n.length)?t:0)?e.previousDirtyStartIndex:0,l]}({content:C,previousContent:m,previousDirtyStartIndex:b,parseOptions:A.value,customMarkdownIt:e.customMarkdownIt,md:I,scanGlobalReferenceAppend:v});J=o;const l=t<=0;if(V){const e=function(e,n,t,o={}){var l;if(!n.length)return{nodes:e,metrics:na(e.length)};const r=null!=(l=o.scanStartIndex)?l:0,i=!1!==o.reuseDirtyTail,a=function(e,n,t,o=0){const l=Math.min(e.length,n.length);for(let r=Math.min(l,Math.max(0,o));r<l;r++)if(!aa(n[r],e[r],t))return r;return e.length===n.length?-1:l}(e,n,t,r);if(a<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:a,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const u=e.slice();let s=a;for(let c=0;c<a;c++)u[c]=n[c];if(i)for(let c=a;c<e.length;c++){const o=n[c],l=e[c];o&&ea(o,l,t)&&(u[c]=o,s+=1)}return{nodes:u,metrics:{reusedNodeCount:s,dirtyStartIndex:a,stablePrefixNodeCount:a,dirtyTailNodeCount:ta(a,e,n)}}}(j,s,V,{reuseDirtyTail:l,scanStartIndex:t});q=e.nodes,U=e.metrics}else{const e=function(e,n,t={}){var o;if(!n.length)return{nodes:e,metrics:na(e.length)};const l=null!=(o=t.scanStartIndex)?o:0,r=!1!==t.reuseDirtyTail,i=function(e,n,t=0){const o=Math.min(e.length,n.length);for(let l=Math.min(o,Math.max(0,t));l<o;l++)if(!ia(n[l],e[l]))return l;return e.length===n.length?-1:o}(e,n,l);if(i<0)return{nodes:n,metrics:{reusedNodeCount:e.length,dirtyStartIndex:i,stablePrefixNodeCount:e.length,dirtyTailNodeCount:0}};const a=e.slice();let u=i;for(let s=0;s<i;s++)a[s]=n[s];if(r)for(let s=i;s<e.length;s++){const t=n[s],o=e[s];t&&Yi(t,o)&&(a[s]=t,u+=1)}return{nodes:a,metrics:{reusedNodeCount:u,dirtyStartIndex:i,stablePrefixNodeCount:i,dirtyTailNodeCount:ta(i,e,n)}}}(j,s,{reuseDirtyTail:l,scanStartIndex:t});q=e.nodes,U=e.metrics}G=B?Ri()-n:0,X=l?null==(null==U?void 0:U.dirtyStartIndex)||U.dirtyStartIndex<0?q.length:U.dirtyStartIndex:q.length}else q=j,U=na(q.length);!0!==n.effectiveFinal.value&&(V?function(e,n,t=0){for(let o=Math.max(0,t);o<e.length;o++)Zi(n,"primeSignatureMs",()=>Ji(e[o]))}(q,V,X):function(e,n=0){for(let t=Math.max(0,n);t<e.length;t++)Ji(e[t])}(q,X));const Y=B?Ri()-D:0;if(y+=1,m=C,d=T,f=L,h=$,s=q,x(null!=(r=null==U?void 0:U.dirtyStartIndex)?r:0),B){const e=Pi(I),t="number"==typeof(null==e?void 0:e.total)&&e.total>(null!=(c=null==F?void 0:F.total)?c:0);n.logPerf(t?"parse(stream)":"parse(sync)",a(a(a({rendererId:n.instanceMsgId,ms:Math.round(Ri()-_),nodes:q.length,contentLength:C.length,parseCommitCount:y,parseCoalescedCount:k,nodeReuseMs:Y,referenceDefinitionScanChars:J,signatureMs:null!=(p=null==V?void 0:V.signatureMs)?p:0,stabilizeSignatureMs:null!=(g=null==V?void 0:V.stabilizeSignatureMs)?g:0,primeSignatureMs:null!=(N=null==V?void 0:V.primeSignatureMs)?N:0,signatureCallCount:null!=(S=null==V?void 0:V.signatureCallCount)?S:0,stabilizeSignatureCallCount:null!=(w=null==V?void 0:V.stabilizeSignatureCallCount)?w:0,primeSignatureCallCount:null!=(M=null==V?void 0:V.primeSignatureCallCount)?M:0,stabilizeMs:G},null!=U?U:{}),K?Object.fromEntries(Ti.map(e=>{var n;return[e,null!=(n=K[e])?n:0]})):{}),e?{streamMode:e.lastMode,streamDelta:ua(e,F),streamStats:e}:{}))}return he(q)});return{effectiveCustomHtmlTags:C,effectiveCustomHtmlTagsSet:$,mdBase:B,mdInstance:H,mergedParseOptions:A,getParsedNodesDirtyStartIndex:()=>b,getParsedNodesRevision:()=>S,parsedNodes:F}}function ca(e){const{isClient:n}=e,t=G(/* @__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 da(e={}){const n=G(""),t=G(""),o=G(!1),l=Be(e),r=()=>{const e=l.getSnapshot();n.value=e.source,t.value=e.visible,o.value=e.done},i=l.subscribe(r);r();const a=P(()=>Math.max(0,n.value.length-t.value.length)),u=P(()=>0===a.value),s=P(()=>o.value&&u.value);return ke()&&J(()=>{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 fa={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400};const ma=/auto|scroll|overlay/i;function ha(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return ma.test(n)||ma.test(t)}function va(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 pa={class:"m-0 p-0"},ga=["data-probe"],ya=/* @__PURE__ */tn(/* @__PURE__ */E(u(a({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const n=e;function t(e){var t,o;return null!=(o=null==(t=n.headingNodes)?void 0:t[e])?o:null}return(n,o)=>(F(),K("div",{class:"height-estimation-probes",style:ce({width:`${e.width}px`}),"aria-hidden":"true"},[z("div",{ref:n=>e.setParagraphWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(q(Jo),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),z("div",{ref:n=>e.setListItemWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[z("ul",pa,[V(q(Wo),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),z("div",{ref:n=>e.setListWrapper(n),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(q(jo),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(F(),K(Y,null,de(6,n=>z("div",{key:`probe-heading-${n}`,ref_for:!0,ref:t=>e.setHeadingWrapper(n,t),class:D(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${n}`},[V(q(Po),{node:t(n),"index-key":`probe-heading-${n}`},null,8,["node","index-key"])],10,ga)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),ka=E({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return Re(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:Pe(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),j("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),j("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,j("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"absolute inset-0"},[j("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),Na=E({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const n=P(()=>{var n,t;return Ae(null!=(t=Ee(e.estimatedPreviewHeightPx))?t:$e(String(null!=(n=e.node.code)?n:"")))});return()=>{var t;return j("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?j("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[j("div",{class:"flex items-center gap-x-2 overflow-hidden"},[j("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),j("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>j("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[j("span",{class:"action-icon block"})])))]):null,j("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${n.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[j("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String(null!=(t=e.node.code)?t:"")),j("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),ba={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function Sa(e){if(null==e)return"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(n){return String(e)}}const xa=["data-custom-id"],wa=["data-node-index","data-node-type"],Ma="typewriter-simple-cursor-target",Ca=/* @__PURE__ */tn(/* @__PURE__ */E(u(a({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockOptions:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:n,emit:t}){const o=e,l=t;function r(e){if(!("undefined"!=typeof Event&&e instanceof Event))return"string"==typeof e?(l("copy-code",e),void l("copy",e)):void l("copy",e)}const i=ee(),c=R("markstreamNestedRendererProps",void 0);function d(e){const n=null==i?void 0:i.vnode.props;return!!n&&(Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,String(e).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)))}function f(e){var n,t;const l=o[e];return d(e)?l:null!=(t=null==(n=null==c?void 0:c.value)?void 0:n[e])?t:l}const m=mi,h=P(()=>{return"chat"===(e=f("mode"))||"minimal"===e||"docs"===e?e:"docs";var e}),v=P(()=>pi(f("typewriter"))),p=P(()=>"off"!==v.value),g=P(()=>"minimal"===f("domMode")?"minimal":"full"),y=P(()=>!0===f("renderCodeBlocksAsPre")),k=P(()=>ba[h.value]),N=P(()=>{var e;return null!=(e=f("showTooltips"))?e:k.value.showTooltips}),b=P(()=>{var e;return null!=(e=f("fade"))?e:k.value.fade}),S=P(()=>{var e;return null!=(e=f("batchRendering"))?e:k.value.batchRendering}),x=P(()=>{var e;return null!=(e=f("initialRenderBatchSize"))?e:k.value.initialRenderBatchSize}),w=P(()=>{var e;return null!=(e=f("renderBatchSize"))?e:k.value.renderBatchSize}),M=P(()=>{var e;return null!=(e=f("renderBatchDelay"))?e:k.value.renderBatchDelay}),_=P(()=>{var e;return null!=(e=f("renderBatchBudgetMs"))?e:k.value.renderBatchBudgetMs}),I=P(()=>{var e;return null!=(e=f("renderBatchIdleTimeoutMs"))?e:k.value.renderBatchIdleTimeoutMs}),T=P(()=>{var e;return null!=(e=f("deferNodesUntilVisible"))?e:k.value.deferNodesUntilVisible}),O=P(()=>{var e;return null!=(e=f("maxLiveNodes"))?e:k.value.maxLiveNodes}),L=P(()=>{var e;return null!=(e=f("liveNodeBuffer"))?e:k.value.liveNodeBuffer}),A=P(()=>{var e;return null!=(e=f("nodeVirtual"))?e:k.value.nodeVirtual}),E={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return f("parseOptions")},get customMarkdownIt(){return f("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return f("customHtmlTags")},get mode(){return f("mode")},get domMode(){return g.value},get htmlPolicy(){return f("htmlPolicy")},get viewportPriority(){return f("viewportPriority")},get viewportPriorityOptions(){return f("viewportPriorityOptions")},get codeBlockStream(){return f("codeBlockStream")},get codeBlockDarkTheme(){return f("codeBlockDarkTheme")},get codeBlockLightTheme(){return f("codeBlockLightTheme")},get codeBlockMinWidth(){return f("codeBlockMinWidth")},get codeBlockMaxWidth(){return f("codeBlockMaxWidth")},get codeBlockOptions(){return f("codeBlockOptions")},get codeBlockProps(){return f("codeBlockProps")},get mermaidProps(){return f("mermaidProps")},get d2Props(){return f("d2Props")},get infographicProps(){return f("infographicProps")},get showTooltips(){return N.value},get themes(){return f("themes")},get isDark(){return f("isDark")},get customId(){return f("customId")},get indexKey(){return o.indexKey},get typewriter(){return f("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return f("smoothStreamingOptions")},get parseCoalesceMs(){return f("parseCoalesceMs")},get fade(){return b.value},get batchRendering(){return S.value},get initialRenderBatchSize(){return x.value},get renderBatchSize(){return w.value},get renderBatchDelay(){return M.value},get renderBatchBudgetMs(){return _.value},get renderBatchIdleTimeoutMs(){return I.value},get deferNodesUntilVisible(){return T.value},get maxLiveNodes(){return O.value},get liveNodeBuffer(){return L.value},get nodeVirtual(){return A.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function z(e){l("height-change",e)}function W(e){l("virtual-state-change",e)}function j(e){l("anchor-change",e)}const V=G(),J=G(null),Z=G(null),oe=G(null),fe=ye({1:null,2:null,3:null,4:null,5:null,6:null}),me=G(!1),ve=/* @__PURE__ */new Map,pe=G(0),ke=G(0),we=G({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function Me(e,n){return"string"!=typeof e?n:e.trim()||n}function Ce(e){const n=Number(e);return Number.isFinite(n)&&n>0?Math.max(1,Math.trunc(n)):640}const Be=P(()=>{var e;const n=null!=(e=E.viewportPriorityOptions)?e:{},t=Me(n.rootMargin,et);return{rootMargin:t,heavyBlockMargin:Me(n.heavyBlockMargin,t),maxTargets:Ce(n.maxTargets)}}),Oe=P(()=>{var e;return null!=(e=Be.value.rootMargin)?e:et}),Le=P(()=>{var e;return null!=(e=Be.value.maxTargets)?e:640});function He(){var e,n;if(!0!==(null==(e=o.virtualScroll)?void 0:e.enabled))return null;const t=null==(n=o.virtualScroll)?void 0:n.scrollRoot;return 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}ne(Yn,Be);const{isClient:Ke,renderAsFragment:ze,debugPerformanceEnabled:We,resolvedShowTooltips:je,resolvedHtmlPolicy:De,inheritedSmoothStreaming:qe,ownsTypewriterCursor:Ue}=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=P(()=>!0===e.renderAsFragment),a=P(()=>Boolean(e.debugPerformance&&n&&"undefined"!=typeof console)),u=P(()=>{var n;if("boolean"==typeof e.showTooltips)return e.showTooltips;const o=null!=(n=t.showTooltips)?n:t["show-tooltips"];return""===o||!0===o||"true"===o||!1!==o&&"false"!==o&&void 0}),s=P(()=>{var n,t;return null!=(t=null!=(n=e.htmlPolicy)?n:null==o?void 0:o.value)?t:"safe"}),c=P(()=>!0!==(null==l?void 0:l.value));return{isClient:n,renderAsFragment:i,debugPerformanceEnabled:a,resolvedShowTooltips:u,resolvedHtmlPolicy:s,inheritedSmoothStreaming:r,inheritedTypewriterCursor:l,ownsTypewriterCursor:c}}(E),{resolveViewportRoot:Ge,resolveScrollContainer:Xe,isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:Qe}=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(ha(window.getComputedStyle(a))&&va(a))return a;a=a.parentElement}return null}function l(e){if(!n.isClient)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(t){return!1}}function r(e,n,t){var o,r;if(t)return i(n);const a=e.scrollTop;if(!l(e))return a;const u=a<0?-a:a;return Math.max(0,(null!=(o=e.scrollHeight)?o:0)-(null!=(r=e.clientHeight)?r:0))-u}function i(e){var n,t,o,l,r;const i=Number(null==(n=e.scrollingElement)?void 0:n.scrollTop),a=Number(null!=(o=null==(t=e.documentElement)?void 0:t.scrollTop)?o:0),u=Number(null!=(r=null==(l=e.body)?void 0:l.scrollTop)?r:0);return Math.max(0,Number.isFinite(i)?i:0,Number.isFinite(a)?a:0,Number.isFinite(u)?u:0)}return{resolveViewportRoot:o,resolveScrollContainer:function(n){var l,r,i,a;const u=t();if(u)return u;const s=o(null!=(l=null!=n?n:e.value)?l:null);if(s)return s;const c=null!=(a=null!=(i=null==n?void 0:n.ownerDocument)?i:null==(r=e.value)?void 0:r.ownerDocument)?a:"undefined"!=typeof document?document:null;return(null==c?void 0:c.scrollingElement)||(null==c?void 0:c.documentElement)||null},isReverseFlexScrollRoot:l,getNormalizedScrollTop:r,getOffsetTopWithinRoot:function(e,n){const t=n.ownerDocument||e.ownerDocument||document;if(function(e,n){return e===n.documentElement||e===n.body||e===n.scrollingElement}(n,t))return e.getBoundingClientRect().top+i(t);const o=n.getBoundingClientRect(),l=e.getBoundingClientRect(),a=r(n,t,!1);return l.top-o.top+a}}}(V,{isClient:Ke,scrollRoot:He});ne("markstreamShowTooltips",je),ne("markstreamHtmlPolicy",De),ne("markstreamTypewriter",p),ne("markstreamFade",P(()=>!1!==E.fade)),ne("markstreamTypewriterCursor",P(()=>!0)),ne("markstreamTextStreamState",ve),ne("markstreamStreamVersion",pe),ne("markstreamParseOptions",P(()=>E.parseOptions)),ne("markstreamCustomMarkdownIt",P(()=>E.customMarkdownIt));const{smoothStreamingEnabled:en,renderContent:nn,requestedFinal:tn,effectiveFinal:ln}=function(e,n){const t=da(a(a({},fa),e.smoothStreamingOptions)),o=P(()=>{var t,o,l;return!1!==e.smoothStreaming&&!(null==(t=e.nodes)?void 0:t.length)&&(!0===e.smoothStreaming||!(null==(o=n.inheritedSmoothStreaming)?void 0:o.value))&&(!0===e.smoothStreaming||"off"!==pi(e.typewriter)||(null!=(l=e.maxLiveNodes)?l:0)<=0)}),l=G(!n.isClient||!0===e.smoothStreaming);Ne(()=>{l.value=!0});const r=P(()=>l.value&&o.value),i=P(()=>{var n;return r.value?t.visible.value:null!=(n=e.content)?n:""}),u=P(()=>{var n,t;const o=null!=(n=e.parseOptions)?n:{};return null!=(t=e.final)?t:o.final}),s=P(()=>{const e=u.value;return r.value&&null!=e?!!e&&t.caughtUp.value:e});let c=0,d=!1;function f(){c=0,d=!1}return X([()=>e.content,()=>e.nodes,r,u],([e,n,o,l])=>{if(null==n?void 0:n.length)return f(),void t.reset("");const r=null!=e?e:"";if(!o)return f(),t.reset(r),void(l&&t.finish({flush:!0}));const i=t.source.value;if(r)if(r===i);else if(r.startsWith(i)){const e=r.slice(i.length),n=t.pendingChars.value;e.length<=8?(c++,d||c>=2&&n<=8?(d=!0,t.reset(r)):t.enqueue(e)):(f(),t.enqueue(e))}else f(),t.reset(r);else f(),t.reset("");l&&t.finish()},{immediate:!0}),{smoothStream:t,smoothStreamingEligible:o,smoothStreamingEnabled:r,renderContent:i,requestedFinal:u,effectiveFinal:s}}(E,{isClient:Ke,inheritedSmoothStreaming:qe}),an=!0===tn.value;ne("markstreamSmoothStreaming",en);const un=G(!1),cn=G(!1),dn=G(!1);let fn="",mn=!1,hn=null;function pn(){Ke&&null!=hn&&(window.clearTimeout(hn),hn=null)}function gn(){un.value=!1,pn()}function yn(e,n){if(!We.value)return;const t=function(){if(!We.value)return null;const e=wn(kn),n=wn(Nn),t=Math.max(xn,n);if(e<=0&&t<=0)return null;const o={total:e,maxPerFrame:t,byLabel:(l=kn,Object.fromEntries(Array.from(l.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0]))))};var l;return kn.clear(),Nn.clear(),xn=0,o}();console.info(`[markstream-vue][perf] ${e}`,t?u(a({},n),{layoutReads:t}):n)}X([()=>E.indexKey,()=>E.customId],()=>{var e,n;gn(),cn.value=!1,dn.value=!(null==(e=o.nodes)?void 0:e.length)&&!0!==tn.value&&Boolean(o.content),fn=null!=(n=nn.value)?n:"",mn=fn.length>0},{flush:"sync"}),X([()=>o.content,()=>o.nodes,tn],([e,n,t])=>{!(null==n?void 0:n.length)&&!0!==t&&Boolean(e)&&(dn.value=!0)},{flush:"sync",immediate:!0}),X([nn,()=>o.nodes,tn],([e,n,t])=>{const l=null!=e?e:"";return(null==n?void 0:n.length)||!0===t?(gn(),cn.value=!1,fn=l,void(mn=!0)):(l.length>0&&(dn.value=!0),mn?(fn&&l.length>fn.length&&l.startsWith(fn)?(un.value=!0,cn.value=!0,Ke&&(pn(),hn=window.setTimeout(()=>{var e;hn=null,!0===ln.value||(null==(e=o.nodes)?void 0:e.length)||(Ja(),un.value=!1,Za())},1200))):(l.length<fn.length||!l.startsWith(fn))&&(gn(),cn.value=!1),void(fn=l)):(fn=l,void(mn=!0)))},{flush:"sync",immediate:!0});const kn=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map;let bn=!1,xn=0;function wn(e){let n=0;for(const t of e.values())n+=t;return n}function Cn(){xn=Math.max(xn,wn(Nn)),Nn.clear(),bn=!1}function Bn(e){e.maxPerFrame=Math.max(Number(e.maxPerFrame||0),Number(e.currentFrameTotal||0)),e.currentFrameTotal=0,e.frameScheduled=!1}function _n(e){var n,t;We.value&&(kn.set(e,(null!=(n=kn.get(e))?n:0)+1),Nn.set(e,(null!=(t=Nn.get(e))?t:0)+1),function(e){const n=function(){if(!Ke||"undefined"==typeof window)return null;const e=window;if(e.__markstreamLayoutReadPerformance)return e.__markstreamLayoutReadPerformance;const n={total:0,maxPerFrame:0,byLabel:{}};return e.__markstreamLayoutReadPerformance=n,n}();n&&(n.total=Number(n.total||0)+1,n.byLabel[e]=Number(n.byLabel[e]||0)+1,n.currentFrameTotal=Number(n.currentFrameTotal||0)+1,n.frameScheduled||(n.frameScheduled=!0,"function"!=typeof window.requestAnimationFrame?"function"!=typeof queueMicrotask?setTimeout(()=>Bn(n),0):queueMicrotask(()=>Bn(n)):window.requestAnimationFrame(()=>Bn(n))))}(e),bn||(bn=!0,Ke&&"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(Cn):"function"!=typeof queueMicrotask?setTimeout(Cn,0):queueMicrotask(Cn)))}function In(e,n){return _n(e),n()}const Tn=E.customId?`renderer-${E.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,On=function(e){const n=/* @__PURE__ */new Map;return{scope:e,cache:n,clear:()=>n.clear()}}(Tn),Ln=Tn;ne(gi,On);const Hn=Je(()=>E.customId),{effectiveCustomHtmlTagsSet:An,mergedParseOptions:$n,parsedNodes:Rn,getParsedNodesDirtyStartIndex:Pn,getParsedNodesRevision:En}=sa(E,{instanceMsgId:Tn,renderContent:nn,effectiveFinal:ln,smoothStreamingEnabled:en,debugPerformanceEnabled:We,customComponentsMap:Hn,logPerf:yn});X(Rn,()=>{un.value||On.clear(),pe.value+=1},{immediate:!0});const Fn=P(()=>({customId:E.customId,customHtmlTags:$n.value.customHtmlTags,parseOptions:E.parseOptions,customMarkdownIt:E.customMarkdownIt,htmlPolicy:De.value,viewportPriority:E.viewportPriority,viewportPriorityOptions:Be.value,mode:h.value,domMode:E.domMode,codeBlockStream:E.codeBlockStream,codeBlockDarkTheme:E.codeBlockDarkTheme,codeBlockLightTheme:E.codeBlockLightTheme,renderCodeBlocksAsPre:y.value,codeBlockMinWidth:E.codeBlockMinWidth,codeBlockMaxWidth:E.codeBlockMaxWidth,codeBlockOptions:E.codeBlockOptions,codeBlockProps:E.codeBlockProps,mermaidProps:E.mermaidProps,d2Props:E.d2Props,infographicProps:E.infographicProps,showTooltips:je.value,themes:E.themes,isDark:E.isDark,typewriter:p.value,smoothStreamingOptions:E.smoothStreamingOptions,parseCoalesceMs:E.parseCoalesceMs,fade:E.fade}));ne("markstreamNestedRendererProps",Fn);const Kn=P(()=>Rn.value),zn=P(()=>Rn.value.length),Wn=G(null),jn=G(null),Dn=G(null),Vn=G(null),qn=null!=o.indexKey&&String(o.indexKey).startsWith("list-item-"),Un=!qn&&E.customId?Zr(E.customId):null,Gn=P(()=>Un?(Yr.value,Zr(E.customId)):null),Xn=P(()=>{var e;return Boolean(!ze.value&&E.customId&&!qn&&(null==(e=Gn.value)?void 0:e.enabled))}),Jn=P(()=>Boolean(Ke&&Xn.value)),Qn=P(()=>{var e;return Boolean(!ze.value&&(null==(e=o.virtualScroll)?void 0:e.enabled))}),nt=P(()=>Qn.value),tt=G(!1);Ne(()=>{tt.value=!0});const lt=P(()=>Boolean(Ke&&Qn.value));ne("markstreamHostScrollManaged",lt);const rt=P(()=>Boolean(tt.value&<.value)),it=P(()=>Jn.value||lt.value),at=P(()=>Jn.value||rt.value),ut=P(()=>{var e;return it.value&&!1!==(null==(e=Gn.value)?void 0:e.textEstimation)});function st(){const e=ke.value||In("getMeasuredContainerWidth.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});return Number.isFinite(e)&&e>0?e:0}const ct=P(()=>{const e=st();return e>0?Math.max(1,Math.round(e)):640}),dt=P(()=>{var e,n;return!(!0!==ln.value||Qn.value||"chat"!==h.value&&"minimal"!==h.value||d("maxLiveNodes")||d("liveNodeBuffer")||(null==(e=o.nodes)?void 0:e.length)||dn.value||!((null!=(n=E.maxLiveNodes)?n:0)<=0))}),ft=P(()=>{var e;return dt.value?50:Math.max(1,null!=(e=E.maxLiveNodes)?e:320)}),ht=P(()=>{var e;return dt.value?16:Math.max(0,null!=(e=E.liveNodeBuffer)?e:60)}),vt=P(()=>{var e;return!ze.value&&!1!==E.nodeVirtual&&!((null!=(e=E.maxLiveNodes)?e:0)<=0&&!dt.value)&&(!0===E.nodeVirtual?Rn.value.length>0:Rn.value.length>ft.value)}),pt=P(()=>vt.value||Jn.value||lt.value),yt=P(()=>!1!==E.viewportPriority),kt=P(()=>!!yt.value&&!me.value);var Nt;Nt=P(()=>yt.value),ne(Zn,Nt);const bt=P(()=>{var e;return!(ze.value||!1===E.deferNodesUntilVisible||(null!=(e=E.maxLiveNodes)?e:0)<=0||vt.value||Rn.value.length>900||!1===E.viewportPriority)}),St=ot(e=>{var n;return Ge(null!=(n=null!=e?e:V.value)?n:null)},yt),{requestFrame:xt,cancelFrame:wt,hasIdleCallback:Mt,isTestEnv:Ct}=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:Ke}),Bt=P(()=>!0===ln.value&&!Qn.value),{resolvedBatchSize:_t,resolvedInitialBatch:It,batchingEnabled:Tt,incrementalRenderingActive:Ot,renderedCount:Lt,previousRenderContext:Ht,adaptiveBatchSize:$t,previousBatchConfig:Rt}=function(e,n){var t;const o=P(()=>{var n;const t=Math.trunc(null!=(n=e.renderBatchSize)?n:80);return Number.isFinite(t)?Math.max(0,t):0}),l=P(()=>{var n;const t=Math.trunc(null!=(n=e.initialRenderBatchSize)?n:o.value);return Number.isFinite(t)?Math.max(0,t):o.value}),r=P(()=>!n.renderAsFragment.value&&!1!==e.batchRendering&&o.value>0&&n.isClient&&!n.isTestEnv),i=G(0),a=G({key:e.indexKey,total:0}),u=G(Math.max(1,o.value||1)),s=P(()=>{var t,o,l;return r.value&&!(null==(t=n.continuousStreaming)?void 0:t.value)&&!(null==(o=n.forceFullRenderFinalContent)?void 0:o.value)&&(null!=(l=e.maxLiveNodes)?l:0)<=0}),c=G({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}}(E,{isClient:Ke,isTestEnv:Ct,renderAsFragment:ze,forceFullRenderFinalContent:Bt,continuousStreaming:P(()=>cn.value&&!0!==ln.value)}),Pt=P(()=>{var e;return!ze.value&&!1!==E.batchRendering&&_t.value>0&&!Ct&&(null!=(e=E.maxLiveNodes)?e:0)<=0&&!Bt.value}),Et=P(()=>Pt.value),Ft=P(()=>it.value||Et.value),jt=P(()=>{var e;return Ft.value&&!1!==(null==(e=Gn.value)?void 0:e.codeBlockEstimation)}),Dt=/* @__PURE__ */new Map,Jt=/* @__PURE__ */new Map,Zt=/* @__PURE__ */new WeakMap;let eo=null;const to=/* @__PURE__ */new WeakMap,lo=/* @__PURE__ */new Map,ro=[];let io=[],ao=[],so=-1;const fo=$(ro),ho=/* @__PURE__ */new Set,po=G(0);let yo=0;const ko=G(0),No=P(()=>(ko.value,Array.from(Dt.entries()).sort((e,n)=>e[0]-n[0]))),bo=G(null),So=G(null);let xo,wo=null,Co=0,Bo=null;function _o(){xo.markFallbackHeightPrefixDirty()}function To(e){return xo.getFallbackNodeHeight(e)}function Lo(e,n){return xo.estimateHeightRange(e,n)}function Ho(e){return xo.estimateIndexForOffset(e)}const{activeRestoreAnchor:$o,getRelativeScrollTopWithinContainer:Ro,setRelativeScrollTopWithinContainer:Eo,resolveAnchorOffset:Fo,clearRestoreReconcile:Ko,scheduleRestoreReconcile:zo,captureRestoreAnchor:Do,restoreAnchor:Vo,getAnchorDrift:qo}=function(e){const{isClient:n,containerRef:t,parsedNodeCount:o,requestFrame:l,cancelFrame:r,resolveScrollContainer:i,getNormalizedScrollTop:a,getOffsetTopWithinRoot:u,isReverseFlexScrollRoot:s,estimateIndexForOffset:c,estimateHeightRange:d,getFallbackNodeHeight:f,clamp:m}=e,h=G(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)))}hi(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:Ke,containerRef:V,parsedNodeCount:zn,requestFrame:xt,cancelFrame:wt,resolveScrollContainer:()=>bo.value||Xe(),getNormalizedScrollTop:Ze,getOffsetTopWithinRoot:Qe,isReverseFlexScrollRoot:Ye,estimateIndexForOffset:Ho,estimateHeightRange:Lo,getFallbackNodeHeight:To,clamp:dr}),{nodeHeights:Go,heightStats:Xo,heightTreeSize:Yo,heightSumTree:Zo,heightKnownTree:Qo,averageNodeHeight:el,resetHeightMeasurements:nl,pruneHeightMeasurements:tl,rebuildHeightTrees:ol,recordNodeHeight:rl,removeNodeHeights:al,exportHeightCache:cl,importHeightCache:dl,fenwickRangeSum:fl}=function(e={}){const n=ye({}),t=ye({total:0,count:0}),o=G(0),l=G([]),r=G([]);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=P(()=>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:()=>{_o(),lt.value&&au(),$o.value&&zo(),So.value&&Wi(),Da("node-resize")}});function ml(e){Number.isInteger(e)&&e>=0&&ho.add(e)}function hl(e){for(const n of e)ml(Number(n))}function vl(e){yo++;let n=!0;try{const t=e();return n=!1!==t,t}finally{yo--,0===yo&&n&&po.value++}}function pl(){io=[],ao=[],so=-1,ho.clear(),fo.value=ro}function gl(){pl(),vl(()=>nl()),lo.clear()}function yl(e){!Number.isInteger(e)||e<0||e>=Rn.value.length||lo.set(e,Ai(e))}function kl(e,n,t={}){const o=Go[e];ml(e),rl(e,n,t);const l=Go[e];return Object.is(o,l)?(ho.delete(e),!1):(l&&l>0?yl(e):o&&lo.delete(e),!0)}function Nl(e,n){const t=In("getNodeLayoutHeight.slot.offsetHeight",()=>{var n,t;return null!=(t=null==(n=Dt.get(e))?void 0:n.offsetHeight)?t:0});return t>0?t:In("getNodeLayoutHeight.content.offsetHeight",()=>n.offsetHeight)}function bl(e,n={}){"merge"!==n.mode?pl():hl(e.map(e=>e.index)),vl(()=>dl(e,n)),ia()}const Sl=P(()=>bt.value&&kt.value),xl=P(()=>{var e;return!ze.value&&!1!==E.batchRendering&&_t.value>0&&(null!=(e=E.maxLiveNodes)?e:0)<=0}),wl=P(()=>!ze.value&&an&&!0===ln.value&&!vt.value&&!Qn.value&&!Xn.value&&!Sl.value&&!xl.value),Ml=P(()=>!!St&&Sl.value),Cl=P(()=>vt.value||lt.value),{focusIndex:Bl,liveRange:_l,updateLiveRange:Il}=function(e,n){const{parsedNodeCount:t,virtualizationEnabled:o,maxLiveNodesResolved:l,liveNodeBufferResolved:r,clamp:i}=n,a=null!=r?r:P(()=>{var n;return Math.max(0,null!=(n=e.liveNodeBuffer)?n:60)}),u=G(0),s=ye({start:0,end:0});return{liveNodeBufferResolved:a,focusIndex:u,liveRange:s,updateLiveRange:function(){const e=t.value;if(!o.value||0===e)return s.start=0,void(s.end=e);const n=Math.min(l.value,e),r=a.value,c=i(u.value-r,0,Math.max(0,e-n));s.start=c,s.end=Math.min(e,c+n)}}}(E,{parsedNodeCount:zn,virtualizationEnabled:vt,maxLiveNodesResolved:ft,liveNodeBufferResolved:ht,clamp:dr}),Tl=/* @__PURE__ */new Map,Ol=/* @__PURE__ */new Map,Ll=/* @__PURE__ */new Map,Hl=[],Al=/* @__PURE__ */new Map,$l=/* @__PURE__ */new Set,Rl=G(0);let Pl=!1;const El=P(()=>(Rl.value,$l.size)),Fl=/* @__PURE__ */new Map,Kl=/* @__PURE__ */new Map,zl=G(0),Wl=P(()=>{zl.value;let e=0;for(const n of Fl.values())e+=Math.max(0,n);return e});let jl=null;const Dl=P(()=>{if(!vt.value)return Rn.value.length;const e=ht.value,n=Math.max(_l.end+e,It.value),t=Math.min(Rn.value.length,n);return Math.max(Lt.value,t)});function Vl(){Pl||(Pl=!0,queueMicrotask(()=>{Pl=!1,Rl.value+=1}))}function ql(e,n,t="node-resize"){if(!Ke||"undefined"==typeof window)return null;const o=window.setTimeout(()=>{$l.delete(o)&&Vl();try{n()}finally{Da(t)}},Math.max(0,e));return $l.add(o),Vl(),o}function Ul(e){Ke&&null!=e&&($l.delete(e)&&Vl(),window.clearTimeout(e))}function Gl(){if(Ke&&"undefined"!=typeof window)for(const e of $l)window.clearTimeout(e);$l.size&&($l.clear(),Vl()),Hl.length=0,Ll.clear()}function Xl(e){J.value=e}function Jl(e){Z.value=e}function Yl(e){oe.value=e}const{cancelScheduledFocusSync:Zl,scheduleFocusSync:Ql}=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:Ke,containerRef:V,virtualizationEnabled:vt,requestFrame:xt,cancelFrame:wt,syncFocusToScroll:function(e=!1){var n;if(!vt.value)return;const t=bo.value||Xe();if(!t)return;const o=t.ownerDocument||(null==(n=V.value)?void 0:n.ownerDocument)||document,l=(null==o?void 0:o.defaultView)||("undefined"!=typeof window?window:null),r=t===(null==o?void 0:o.documentElement)||t===(null==o?void 0:o.body),i=Rn.value.length;if(i<=0)return;if(!r&&i>0&&Ye(t)){const n=In("syncFocusToScroll.clientHeight",()=>t.clientHeight||0),o=In("syncFocusToScroll.scrollTop",()=>t.scrollTop),l=o<0?-o:o;return void cr(dr((a=Math.max(0,l)+.5*Math.max(0,n),xo.estimateIndexForOffsetFromEnd(a)),0,Math.max(0,i-1)),e)}var a;const u=function(e,n,t,o){const l=V.value;if(!l)return null;const r=o?0:In("syncFocusToScroll.model.root.getBoundingClientRect",()=>e.getBoundingClientRect().top),i=In("syncFocusToScroll.model.container.getBoundingClientRect",()=>l.getBoundingClientRect().top),a=Math.max(0,r-i),u=o?In("syncFocusToScroll.model.viewport.clientHeight",()=>{var o,l,r,i;return null!=(i=null!=(r=null!=(l=null==t?void 0:t.innerHeight)?l:null==(o=n.documentElement)?void 0:o.clientHeight)?r:e.clientHeight)?i:0}):In("syncFocusToScroll.model.root.clientHeight",()=>e.clientHeight);return dr(Ho(a+.5*Math.max(0,u)),0,Math.max(0,Rn.value.length-1))}(t,o,l,r);if(null!=u)return void cr(u,e);const s=r?null:In("syncFocusToScroll.root.getBoundingClientRect",()=>t.getBoundingClientRect()),c=r?0:s.top,d=r?In("syncFocusToScroll.viewport.clientHeight",()=>{var e,n;return null!=(n=null!=(e=null==l?void 0:l.innerHeight)?e:t.clientHeight)?n:0}):s.bottom,f=No.value;let m=null,h=null;for(const[v,p]of f){if(!p)continue;const e=In("syncFocusToScroll.slot.getBoundingClientRect",()=>p.getBoundingClientRect());e.bottom<=c||e.top>=d||(null==m&&(m=v),h=v)}if(null==m||null==h){const e=V.value;if(!e)return;const n=r?{top:0}:In("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()),i=In("syncFocusToScroll.fallback.scrollTop",()=>Ze(t,o,r)),a=r?(()=>{const t=In("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>e.getBoundingClientRect()),o=(r?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Qe(e,t);return Math.max(0,i-n)})(),u=r?In("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var e,n,r,i;return null!=(i=null!=(r=null!=(n=null==l?void 0:l.innerHeight)?n:null==(e=null==o?void 0:o.documentElement)?void 0:e.clientHeight)?r:t.clientHeight)?i:0}):In("syncFocusToScroll.fallback.root.clientHeight",()=>t.clientHeight);return void cr(dr(Ho(a+.5*Math.max(0,u)),0,Math.max(0,Rn.value.length-1)),!0)}cr(Math.round((m+h)/2),e)}}),{visibleNodeIndices:er,nodeVisibilityHandles:nr,nodeVisibilityWatchStops:tr,nodeVisibilityFallbackTimers:or,clearVisibilityFallback:lr,markNodeVisible:rr,cleanupNodeVisibility:ir,destroyNodeVisibilityState:ar}=ca({isClient:Ke,shouldTrackVisibleNodeIndices:()=>Sl.value,shouldCleanupNodeVisibility:()=>vt.value,onNodeMarkedVisible:e=>{vt.value?Ql():Bl.value=dr(e,0,Math.max(0,Rn.value.length-1))},onNodeVisibilityCleaned:e=>{Dt.delete(e)&&Va()}}),{cleanupScrollListener:ur,setupScrollListener:sr}=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:Ke,virtualizationEnabled:vt,listenerEnabled:Cl,scrollRootElement:bo,resolveScrollContainer:Xe,scheduleFocusSync:Ql,onScroll:function(){const e=So.value;if(!e)return;const n=ki();if(!n)return;if(function(e){if(Ha()>=Co)return Bo=null,!1;const n=Bo;if(null==n)return!0;const t=Math.abs(e.scrollTop-n)<=2;return t||(Bo=null),t}(n))return;const t=Si(n);null!=t?(t<-32||Math.abs(Math.max(0,t)-Math.max(0,e.distanceFromBottomPx))>32)&&zi("restore"):zi("restore")},getScrollTop:e=>{var n;const t=e.ownerDocument||(null==(n=V.value)?void 0:n.ownerDocument)||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement;return In("scrollListener.getScrollTop",()=>Ze(e,t,o))}});function cr(e,n=!1){const t=dr(e,0,Math.max(0,Rn.value.length-1));!n&&Math.abs(t-Bl.value)<=1||(Bl.value=t,Il())}function dr(e,n,t){return Math.min(Math.max(e,n),t)}function fr(e=Rn.value.length){const n=Pn();return!Number.isInteger(n)||n<0?e:dr(n,0,e)}function mr(e){return null==e?void 0:e.firstElementChild}function hr(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function vr(e,n){e<1||e>6||(fe[e]=n)}function pr(){if(!it.value)return void(ke.value=0);const e=In("updateExperimentContainerWidth.clientWidth",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.clientWidth)?n:0});ke.value=e>0?e:0}let gr=null;function yr(){null==gr||gr.disconnect(),gr=null}const kr=P(()=>y.value?Vt:qt);function Nr(){var e;return!1!==(null==(e=E.codeBlockProps)?void 0:e.showHeader)}function br(){var e;return!1!==(null==(e=E.codeBlockProps)?void 0:e.showCopyButton)}function Sr(){var e,n;const t=null==(e=E.codeBlockProps)?void 0:e.showLineNumbers;return"boolean"==typeof t?t:!0!==(null==(n=E.codeBlockOptions)?void 0:n.disableLineNumbers)}function xr(e,n,t){var o;const l=Go[n],r="number"==typeof l&&l>0;if(ut.value&&!r&&!function(e){return!!Hn.value.paragraph&&("paragraph"===e.type||"list_item"===e.type||"list"===e.type)}(e)){const n=oi(e,t,we.value);if(n)return n}if(jt.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=Eu(e,Hu(e));return n===Vt?"pre":n===kr.value||n===qt?"stream-diffs":null}(e);if("stream-diffs"===n||"pre"===n)return function(e,n){if(!e||"code_block"!==e.type)return null;const t=n.rendererKind,o="pre"!==t&&!1!==n.showHeader,l="pre"===t&&!1!==n.showHeader,r=Boolean(e.diff);let i=0,u=500;if("stream-diffs"===t){const t=ii(e,n.diffStyle),o=18,l=function(e){return e?0:16}(r);u=500,i=Math.round(t*o+l)}else{const t=Kt(n.codeBlockOptions),o=function(e,n,t){var o,l;const r=ii(e,n.diffStyle),i=Number(n.width);if("wrap"!==t.overflow||!Number.isFinite(i)||i<=0)return r;const a=Math.max(1,.6*t.fontSize),u=Boolean(e.diff),s=u&>({diffStyle:n.diffStyle});if(!u||s){const o=(u?ri(e.raw)||[ri(e.originalCode),ri(e.updatedCode)].filter(Boolean).join("\n"):ri(e.code,!0===e.loading)).split(/\r\n|\n|\r/),l=ui(i,a,o.length,t,n,!1);return o.reduce((e,n)=>e+ai(n,l,t.tabSize),0)}const c=ri(e.originalCode).split(/\r\n|\n|\r/),d=ri(e.updatedCode).split(/\r\n|\n|\r/);if(null==e.originalCode&&null==e.updatedCode)return r;const f=Math.max(c.length,d.length),m=ui(i,a,f,t,n,!0);let h=0;for(let v=0;v<f;v++)h+=Math.max(ai(null!=(o=c[v])?o:"",m,t.tabSize),ai(null!=(l=d[v])?l:"",m,t.tabSize));return h}(e,n,t);i=Math.round(o*t.lineHeight+t.padding+t.paddingBottom),u=t.maxHeight}const s=Math.max(1,Math.min(i,u));return a({kind:"code-block",height:Math.round(s+("pre"===t?l?37:0:o?40:0)),contentHeight:s,rendererKind:t},r&&"stream-diffs"===t?{diffInline:gt({diffStyle:n.diffStyle})}:{})}(e,{rendererKind:n,codeBlockOptions:E.codeBlockOptions,showHeader:Nr(),showLineNumbers:Sr(),width:t,diffStyle:null==(o=E.codeBlockOptions)?void 0:o.diffStyle})}return null}be(()=>{if(po.value,yo>0)return;const e=Rn.value,n=En();if(!e.length||!Ft.value)return io=[],ao=[],so=-1,ho.clear(),void(fo.value=ro);const t=ke.value||In("estimatedNodeHeights.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0});if(!Number.isFinite(t)||t<=0)return io=[],ao=[],so=-1,ho.clear(),void(fo.value=ro);const o=function(e){var n,t;const o=Kt(E.codeBlockOptions);return[Math.round(e),ut.value,jt.value,we.value,o.fontSize,o.lineHeight,o.fontFamily,o.padding,o.paddingBottom,o.maxHeight,o.tabSize,o.overflow,null!=(t=null==(n=E.codeBlockOptions)?void 0:n.diffStyle)?t:"split",Sr(),Nr(),br(),y.value,Hn.value,Yr.value]}(t),l=io.length<=e.length&&(i=o,(r=ao).length===i.length&&r.every((e,n)=>Object.is(e,i[n])));var r,i;const a=l&&so===n?e.length:l?fr(e.length):0,u=l?Array.from(ho):[];io.length=e.length;for(let s=a;s<e.length;s++)io[s]=xr(e[s],s,t);for(const s of u)s>=0&&s<e.length&&s<a&&(io[s]=xr(e[s],s,t));ho.clear(),ao=o,so=n,fo.value=io,Se(fo)},{flush:"sync"});const wr=P(()=>fo.value);xo=function(e){let n=!0,t=[0],o="";function l(n){var t;const o=e.nodeHeights[n];if(Number.isFinite(o)&&o>0)return o;const l=e.parsedNodes.value[n],r=null==l?void 0:l.type,i=Boolean(null==(t=e.hasCustomParagraphComponent)?void 0:t.call(e)),a=e.estimatedNodeHeights.value[n],u=null==a?void 0:a.height;if(!function(e,n,t){return Boolean(t&&"simple-text"===(null==n?void 0:n.kind)&&("paragraph"===e||"list_item"===e||"list"===e))}(r,a,i)&&Number.isFinite(u)&&u>0)return u;const s=Bi(l,e.getContainerWidth()||640);return"heading"===r||"paragraph"===r&&s<=28&&function(e,n){if(n)return!1;const t=e.children;return!Array.isArray(t)||!t.length||t.every(xi)}(l,i)?s:Math.max(e.averageNodeHeight.value,s)}function r(){var r;const i=e.parsedNodes.value.length,a=e.getPrefixCacheKeyParts().join(":");if(!n&&o===a)return t;const u=new Array(i+1);u[0]=0;for(let n=0;n<i;n++)u[n+1]=u[n]+(e.heightEstimationActive.value?l(n):null!=(r=e.nodeHeights[n])?r:e.averageNodeHeight.value);return t=u,o=a,n=!1,u}function i(n){var t,o;const l=e.parsedNodes.value.length;if(l<=0)return 0;if(n<=0)return 0;const i=r();if(n>=(null!=(t=i[l])?t:0))return l-1;let a=0,u=l-1,s=l-1;for(;a<=u;){const e=a+u>>1;(null!=(o=i[e+1])?o:0)>=n?(s=e,u=e-1):a=e+1}return s}function a(n,t){var o,l;if(n>=t)return 0;if(e.heightEstimationActive.value)return function(n,t){var o,l;const i=e.parsedNodes.value.length,a=_i(Math.trunc(n),0,i),u=_i(Math.trunc(t),a,i);if(a>=u)return 0;const s=r();return(null!=(o=s[u])?o:0)-(null!=(l=s[a])?l:0)}(n,t);if(e.heightTreeSize.value!==e.parsedNodes.value.length){let l=0;for(let r=n;r<t;r++)l+=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;return l}const i=e.heightSumTree.value,a=e.heightKnownTree.value;if(!i.length||!a.length){let o=0;for(let r=n;r<t;r++)o+=null!=(l=e.nodeHeights[r])?l:e.averageNodeHeight.value;return o}return e.fenwickRangeSum(i,n,t)+(t-n-e.fenwickRangeSum(a,n,t))*e.averageNodeHeight.value}function u(n){var t;if(n<=0)return 0;const o=e.parsedNodes.value;if(e.heightEstimationActive.value)return i(n);if(e.heightTreeSize.value===o.length&&e.heightSumTree.value.length&&e.heightKnownTree.value.length){const t=e.averageNodeHeight.value,l=e.heightSumTree.value,r=e.heightKnownTree.value,i=n=>n<=0?0:e.fenwickRangeSum(l,0,n)+(n-e.fenwickRangeSum(r,0,n))*t;let a=0,u=o.length-1,s=o.length-1;for(;a<=u;){const e=a+u>>1;i(e+1)>=n?(s=e,u=e-1):a=e+1}return s}let l=n;for(let r=0;r<o.length;r++){const n=null!=(t=e.nodeHeights[r])?t:e.averageNodeHeight.value;if(l<=n)return r;l-=n}return Math.max(0,o.length-1)}function s(){if(!e.heightEstimationActive.value)return 0;let n=0;const t=e.estimatedNodeHeights.value;for(let o=0;o<t.length;o++){if(!t[o])continue;const l=e.nodeHeights[o];Number.isFinite(l)&&l>0||n++}return n}return{markFallbackHeightPrefixDirty:function(){n=!0},getFallbackNodeHeight:l,estimateHeightRange:a,estimateIndexForOffset:u,estimateIndexForOffsetFromEnd:function(n){var t,o;const l=e.parsedNodes.value;if(!l.length)return 0;if(n<=0)return Math.max(0,l.length-1);if(e.heightEstimationActive.value){const e=null!=(t=r()[l.length])?t:0;return i(Math.max(0,e-n))}if(e.heightTreeSize.value===l.length){const e=a(0,l.length);return u(Math.max(0,e-n))}let s=n;for(let r=l.length-1;r>=0;r--){const n=null!=(o=e.nodeHeights[r])?o:e.averageNodeHeight.value;if(s<=n)return r;s-=n}return 0},getEstimatedNodeHeightCount:s,buildVirtualHeightSummary:function(n){var t;const o=e.parsedNodes.value.length;return{totalNodes:o,measuredCount:e.heightStats.count,estimatedCount:s(),averageNodeHeight:e.averageNodeHeight.value,topSpacerHeight:n.topSpacerHeight,bottomSpacerHeight:n.bottomSpacerHeight,estimatedTotalHeight:a(0,o),width:null!=(t=n.width)?t:e.getContainerWidth()}}}}({parsedNodes:Rn,nodeHeights:Go,heightStats:Xo,heightTreeSize:Yo,heightSumTree:Zo,heightKnownTree:Qo,averageNodeHeight:el,heightEstimationActive:it,estimatedNodeHeights:wr,getContainerWidth:st,hasCustomParagraphComponent:()=>Boolean(Hn.value.paragraph),getPrefixCacheKeyParts:()=>{var e;const n=bi(ke.value||In("getFallbackHeightPrefix.clientWidth",()=>{var e;return(null==(e=V.value)?void 0:e.clientWidth)||0})),t=null==(null==(e=o.virtualScroll)?void 0:e.measurementKey)?"":String(o.virtualScroll.measurementKey);return[Rn.value.length,Xo.count,Math.round(Xo.total),Math.round(100*el.value),t,n,it.value?1:0,Yr.value,pe.value,Hn.value.paragraph?1:0]},fenwickRangeSum:fl}),X(()=>Rn.value.length,e=>{var n;_o(),e<=0?gl():(e<Yo.value&&(n=e,pl(),vl(()=>tl(n))),e!==Yo.value&&ol(e))},{immediate:!0});const Mr=P(()=>{if(!vt.value)return Rn.value.map((e,n)=>({node:e,index:n}));const e=Rn.value.length,n=dr(_l.start,0,e),t=dr(_l.end,n,e);return Rn.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Cr=P(()=>vt.value?Lo(0,Math.min(_l.start,Rn.value.length)):0),Br=P(()=>{if(!vt.value)return 0;const e=Rn.value.length;return Lo(Math.min(_l.end,e),e)});function _r(){return xo.buildVirtualHeightSummary({topSpacerHeight:Cr.value,bottomSpacerHeight:Br.value,width:Pr()})}function Ir(){const e=Rn.value,n=_r();return u(a({},n),{probe:{paragraphReady:Boolean(we.value.paragraph),listItemReady:Boolean(we.value.listItem),listWrapperOverhead:we.value.listWrapperOverhead,headingReadyLevels:Object.entries(we.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=wr.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=wr.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=wr.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(s=null==(u=wr.value[n])?void 0:u.contentHeight)?s:null,measuredHeight:null!=(c=Go[n])?c:null}})})}function Tr(){return null!=o.indexKey?String(o.indexKey):Qn.value?`virtual-${Lr()}`:"markdown-renderer"}function Or(e){const n=String(e),t=`${Tr()}-`;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>=Rn.value.length?null:l}function Lr(){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:E.customId)?t:Tn)}function Hr(){var e;const n=null==(e=o.virtualScroll)?void 0:e.threadKey;return null==n||""===n?void 0:String(n)}const Ar=P(()=>{var e,n,t;return null!=(t=Hr())?t:String(null!=(n=null!=(e=o.indexKey)?e:E.customId)?n:Tn)});function $r(e){var n;return(null!=e?e:"")===(null!=(n=Hr())?n:"")}function Rr(){var e,n,t;return n=null==(e=o.virtualScroll)?void 0:e.measurementKey,t=function(e){const n=e.codeBlockProps,t=e.codeBlockOptions,o=null==t?void 0:t.parseDiffOptions;return[e.isDark?"dark":"light",e.renderCodeBlocksAsPre?"code-pre":"code-rich",!1===e.codeBlockStream?"code-static":"code-stream",Sa(e.codeBlockMinWidth),Sa(e.codeBlockMaxWidth),Sa(null==t?void 0:t.fontSize),Sa(null==t?void 0:t.lineHeight),Sa(null==t?void 0:t.fontFamily),Sa(null==t?void 0:t.maxHeight),Sa(null==t?void 0:t.tabSize),Sa(null==t?void 0:t.padding),Sa(null==t?void 0:t.overflow),Sa(null==t?void 0:t.disableLineNumbers),Sa(null==t?void 0:t.diffStyle),Sa(null==t?void 0:t.diffIndicators),Sa(null==t?void 0:t.hunkSeparators),Sa(null==t?void 0:t.expandUnchanged),Sa(null==t?void 0:t.collapsedContextThreshold),Sa(null==t?void 0:t.expansionLineCount),Sa(null==o?void 0:o.context),Sa(null==n?void 0:n.showHeader),Sa(null==n?void 0:n.showCopyButton),Sa(null==n?void 0:n.showExpandButton),Sa(null==n?void 0:n.showPreviewButton),Sa(null==n?void 0:n.showCollapseButton),Sa(null==n?void 0:n.showFontSizeButtons),Sa(null==n?void 0:n.showLineNumbers)].join("\0")}({renderCodeBlocksAsPre:y.value,isDark:E.isDark,codeBlockStream:E.codeBlockStream,codeBlockMinWidth:E.codeBlockMinWidth,codeBlockMaxWidth:E.codeBlockMaxWidth,codeBlockOptions:E.codeBlockOptions,codeBlockProps:E.codeBlockProps}),[null==n?"":String(n),t].join("\0")}function Pr(){return st()}const Er=P(()=>bi(Pr())),Fr=P(()=>[Rr(),Er.value].join("\0")),Kr=P(()=>{var e;return Qn.value?["virtual",null!=(e=Hr())?e:"",Lr(),Fr.value].join("\0"):o.indexKey});function zr(){zl.value+=1}function Wr(e){return!(!e||!Number.isInteger(e.index)||e.index<0||e.index>=Rn.value.length||e.sessionKey!==Lr()||e.threadKey!==Hr()||e.layoutEpochKey!==Fr.value)}function jr(e){const n=String(e),t=Kl.get(n);return t?Wr(t)?t.index:null:Or(n)}function Dr(e="async-node"){(Fl.size||Kl.size)&&(Fl.clear(),Kl.clear(),zr(),Da(e))}const Vr=R(Ie,null),qr={reportHeight(e,n){if(!lt.value)return;const t=jr(e);if(null==t)return;const o=Tl.get(t);if(!o)return;const l=Number(n),r=Nl(t,o);!function(e,n,t={}){vl(()=>kl(e,n,t))}(t,Number.isFinite(l)&&l>0?Math.max(l,r||0):r)},markPending(e){if(!lt.value)return;const n=Or(e);null!=n&&function(e,n){var t;const o=Kl.get(e);if(o&&Wr(o))return Fl.set(e,Math.max(0,null!=(t=Fl.get(e))?t:0)+1),zr(),void Da("async-node");Fl.set(e,1),Kl.set(e,function(e){return{index:e,sessionKey:Lr(),threadKey:Hr(),layoutEpochKey:Fr.value}}(n)),zr(),Da("async-node")}(String(e),n)},markSettled(e){if(!lt.value)return;const n=String(e),t=jr(e);(null!=t||function(e){return Fl.has(String(e))}(n))&&function(e){var n;const t=null!=(n=Fl.get(e))?n:0;return!(t<=0||(t<=1?(Fl.delete(e),Kl.delete(e)):Fl.set(e,t-1),zr(),1===t&&Da("async-node"),0))}(n)&&null!=t&&Za()}};function Ur(){let e=0;for(const n of Tl.values())e+=In("getVisibleDomHeight.offsetHeight",()=>{var e;return null!=(e=null==n?void 0:n.offsetHeight)?e:0});return Math.ceil(Math.max(0,e))}ne(Ie,{reportHeight(e,n){qr.reportHeight(e,n),null==Vr||Vr.reportHeight(e,n)},markPending(e){qr.markPending(e),null==Vr||Vr.markPending(e)},markSettled(e){qr.markSettled(e),null==Vr||Vr.markSettled(e)}});let Gr,Jr=null,Qr=null;function ei(e){return!1!==e&&null!=e&&""!==e}function ni(){return vt.value?function(){if(!vt.value)return!0;const e=Rn.value.length,n=dr(_l.start,0,e),t=dr(_l.end,n,e);if(n>=t)return!0;for(let o=n;o<t;o++){if(!Dt.has(o))return!1;if(qa(o)&&!Tl.has(o))return!1}return!0}():Lt.value>=Dl.value}function ti(){return!0===ln.value&&!un.value&&0===Wl.value&&0===$l.size&&0===Al.size&&null==jl&&ni()}function li(){var e,n;if("manual"!==(null==(e=o.virtualScroll)?void 0:e.settleMode))return!0;if(Jr===Lr()&&Gr===Hr())return!0;const t=null==(n=o.virtualScroll)?void 0:n.settledToken;return!!ei(t)&&Qr===cu(t)}function si(){return ti()&&li()}function di(e,n){return n.totalNodes<=0?"final"===e?"final":"estimate":n.measuredCount>=n.totalNodes?"final"===e?"final":"measured":n.measuredCount>0||n.estimatedCount>0?"mixed":"estimate"}function yi(e="manual",n){const t=_r(),o=function(e){return e||(!0!==ln.value?Rn.value.length>0?"streaming":"estimating":!ni()||Al.size>0||null!=jl?"measuring":si()?"settled":"settling")}(n);return{sessionKey:Lr(),threadKey:Hr(),phase:o,nodeCount:t.totalNodes,liveRange:{start:_l.start,end:_l.end},renderedCount:Lt.value,measuredCount:t.measuredCount,estimatedCount:t.estimatedCount,averageNodeHeight:t.averageNodeHeight,topSpacerHeight:t.topSpacerHeight,bottomSpacerHeight:t.bottomSpacerHeight,visibleDomHeight:Ur(),totalHeight:Ni(),width:t.width,final:!0===ln.value,stable:si(),confidence:di(o,t),reason:e}}function ki(){const e=bo.value||Xe(),n=V.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document,o=e===t.documentElement||e===t.body||e===t.scrollingElement,l=In("getScrollBox.scrollTop",()=>Ze(e,t,o)),r=In("getScrollBox.scrollHeight",()=>{var n,l,r,i,a;return o?Math.max(null!=(l=null==(n=t.documentElement)?void 0:n.scrollHeight)?l:0,null!=(i=null==(r=t.body)?void 0:r.scrollHeight)?i:0,null!=(a=e.scrollHeight)?a:0):e.scrollHeight}),i=In("getScrollBox.clientHeight",()=>{var n;return o?(null==(n=t.documentElement)?void 0:n.clientHeight)||e.clientHeight||0:e.clientHeight});return{root:e,doc:t,isViewportRoot:o,scrollTop:l,scrollHeight:r,clientHeight:i}}function Ni(){const e=Rn.value.length,n=Math.max(0,Lo(0,e)),t=In("getRendererLogicalHeight.offsetHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.offsetHeight)?n:0}),o=Math.max(0,t>0?t:In("getRendererLogicalHeight.scrollHeight",()=>{var e,n;return null!=(n=null==(e=V.value)?void 0:e.scrollHeight)?n:0}));return e<=0?Math.ceil(t):vt.value?n>0?Math.max(1,Math.ceil(n),function(){let e=Cr.value+Br.value;for(const n of Dt.values())n&&(e+=Math.max(0,In("getVirtualizedDomLogicalHeight.offsetHeight",()=>n.offsetHeight||0)));return Math.ceil(Math.max(0,e))}(),function(e,n){return e<=0||n<=0?0:n<=e+Math.max(512,.05*e)?Math.ceil(n):0}(n,o)):Math.max(1,Math.ceil(o)):lt.value?n>0||Xo.count>0||xo.getEstimatedNodeHeightCount()>0?(Ot.value&&Lt.value,Math.max(1,Math.ceil(o),Math.ceil(n))):Math.ceil(o):Math.max(1,Math.ceil(o),Math.ceil(n))}function Si(e){const n=V.value;if(!n)return null;const t=In("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>n.getBoundingClientRect()),o=function(e){return e.isViewportRoot?e.clientHeight:In("getViewportBottomInRoot.getBoundingClientRect",()=>e.root.getBoundingClientRect().bottom)}(e);return o-t.bottom}function wi(e={}){const n=!1!==e.requireViewport,t=function(e=64){const n=ki(),t=V.value;if(!n||!t)return!1;const o=function(e){if(e.isViewportRoot)return{top:0,bottom:e.clientHeight};const n=In("getVirtualViewportRect.getBoundingClientRect",()=>e.root.getBoundingClientRect());return{top:n.top,bottom:n.bottom}}(n),l=In("isRendererNearVirtualViewport.getBoundingClientRect",()=>t.getBoundingClientRect());return l.bottom>=o.top-e&&l.top<=o.bottom+e}();if(n&&!t)return null;const o=function(){const e=ki(),n=V.value;if(!e||!n)return null;if(Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)>64)return null;const t=Si(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=Do();if(l)return{anchor:{type:"node",nodeIndex:l.nodeIndex,offsetWithinNodePx:l.offsetWithinNodePx},captured:t};if(!0===e.allowFallback){const e=function(){const e=Rn.value.length;return e<=0?null:{type:"node",nodeIndex:dr(Bl.value,0,Math.max(0,e-1)),offsetWithinNodePx:0}}();return e?{anchor:e,captured:!1}:null}return null}function Mi(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 Ci(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 Ii=/* @__PURE__ */new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Ti(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}:${Mi(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(Ti(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=Ti(e[a],n,t+1);i=Ci(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||Ii.has(e))}).sort();return`o:${l.length}:${l.map(e=>`${e}=${Ti(o[e],n,t+1)}`).join(";")}`}finally{n.delete(e)}}let Oi=-1,Li="",Hi=[2166136261];function Ai(e){const n=Rn.value[e];return n?Mi(Ti(n)):""}function $i(e,n){let t=e;for(let o=0;o<n.length;o++)t^=n.charCodeAt(o),t=Math.imul(t,16777619);return t>>>0}function Ri(){var e,n;const t=pe.value;if(Oi===t)return Li;const o=Rn.value.length;let l=fr(o);(Oi!==t-1||l>o||Hi.length<l+1)&&(l=0),0===l?Hi=[2166136261]:Hi.length=l+1;for(let r=l;r<o;r++){const n=Ai(r);Hi[r+1]=$i(null!=(e=Hi[r])?e:2166136261,n)}return Hi.length=o+1,Li=((null!=(n=Hi[o])?n:2166136261)>>>0).toString(36),Oi=t,Li}function Pi(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=Rn.value.length,i=dr(_l.start-2*ht.value,0,r),a=dr(_l.end+2*ht.value,i,r);for(const o of e)o.index>=i&&o.index<a&&l(o);const u=Math.max(1,Math.ceil(e.length/n));for(let o=0;o<e.length&&t.size<n;o+=u)l(e[o]);for(let o=e.length-1;o>=0&&t.size<n;o-=u)l(e[o]);return Array.from(t.values()).sort((e,n)=>e.index-n.index).slice(0,n)}(cl().map(e=>{var n;const t=Rn.value[e.index];return t?u(a({},e),{nodeType:String(null!=(n=t.type)?n:""),signature:Ai(e.index)}):null}).filter(e=>Boolean(e))):[],s=wi({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?Ri():void 0,measurementKey:Rr()||void 0,heightCache:i.length?i:void 0}):null}function Ei(e){var n,t;const o=ki();if(!o)return;const l=function(e){const n=V.value;if(!n)return null;const t=Qe(n,e.root),o=Rn.value.length,l=In("getRendererBottomOffsetWithinRoot.offsetHeight",()=>n.offsetHeight||0),r=Math.max(0,l>0?l:o>0?In("getRendererBottomOffsetWithinRoot.scrollHeight",()=>n.scrollHeight||0):0),i=Ni();return t+Math.max(r,i)}(o);if(null==l)return;const r=Math.max(0,e.distanceFromBottomPx),i=Math.max(0,l-o.clientHeight-r);(function(e){Co=Ha()+120,Bo=e})(i),o.isViewportRoot?null==(t=null==(n=o.doc.defaultView)?void 0:n.scrollTo)||t.call(n,0,i):hi(o.root,o.doc,i,{isReverseFlexScrollRoot:Ye,getNormalizedScrollTop:Ze})}const Fi=[];function Ki(){if(Ke)for(null!=wo&&(null==wt||wt(wo),wo=null);Fi.length;){const e=Fi.pop();null!=e&&window.clearTimeout(e)}}function zi(e){const n=Boolean(So.value);So.value=null,Co=0,Bo=null,Ki(),n&&e&&Da(e)}function Wi(){if(!So.value||!Ke)return;if(null!=wo)return;const e=()=>{wo=null;const e=So.value;e&&Ei(e)};wo=xt?xt(e):null,null==wo&&e()}function ji(e,n={}){const t=Rn.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=Rn.value[e.index];return!(!t||e.nodeType&&e.nodeType!==String(null!=(n=t.type)?n:"")||e.signature&&e.signature!==Ai(e.index))}(e))}function Di(e){const n=bi(Pr()),t=bi(e);return-1!==n&&-1!==t&&n===t}function Vi(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 qi(e){var n;return e.sessionKey===Lr()&&!!$r(e.threadKey)&&(null!=(n=e.measurementKey)?n:"")===Rr()&&!!Di(Vi(e))&&!!function(e){const n=e.heightCache;return!!(null==n?void 0:n.length)&&(Ui(e)?n.some(e=>Boolean(e.nodeType||e.signature)):n.some(e=>Boolean(e.signature)))}(e)}function Ui(e){return Boolean(e.contentHash&&e.contentHash===Ri())}function Gi(e){return!Ui(e)}let Xi=null,Ji=null,Yi=null,Zi=null,Qi=null,ea=!1;function na(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=bi(Pr());return[null!=(n=Hr())?n:"",Lr(),Rr(),Rn.value.length,o,e.length,Mi(t)].join(":")}function ta(e=(e=>null==(e=o.virtualScroll)?void 0:e.heightCache)()){if(!lt.value||!(null==e?void 0:e.length))return!1;if(Rn.value.length<=0)return!1;if(!Di(null==(n=o.virtualScroll)?void 0:n.heightCacheWidth))return!1;var n;const t=ji(e,{requireSignature:!0});if(!t.length)return!ea&&"undefined"!=typeof console&&m&&(ea=!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=na(t);return l===Xi?(Ji="standalone",!0):(bl(t,{mode:"merge"}),_o(),Xi=l,Ji="standalone",Ea(),Da("restore"),!0)}function oa(e,n={}){var t,o,l;if(!lt.value||!e)return!1;if(e.sessionKey!==Lr())return!1;if(!$r(e.threadKey))return!1;if(Rn.value.length<=0)return!1;const r=Boolean(null==(t=e.heightCache)?void 0:t.length)&&!la(),i=!e.anchor||!1===e.anchorCaptured&&!0!==n.allowUncapturedAnchor?null:e.anchor,a=!0===n.restoreAnchor&&Boolean(i)&&!la()&&Number(Vi(e))>0;let u=!1;if((null==(o=e.heightCache)?void 0:o.length)&&qi(e)){const n=ji(e.heightCache,{requireCompatibilityMetadata:!e.contentHash,requireSignature:Gi(e)});n.length&&(bl(n,{mode:"merge"}),_o(),Xi=na(n),Ji="restore",Ea(),u=!0)}if(r||a)return!1;if(!n.restoreAnchor)return u&&Da("restore"),!0;if(!i)return u&&Da("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=Hr())?t:"",Lr(),Rr(),Er.value,n,l].join(":")}(e,null!=(l=n.restoreToken)?l:"imperative");return Yi===s?(u&&Da("restore"),!0):(Yi=s,function(e){const n=()=>{if("node"===e.type)return zi(),void Vo({nodeIndex:e.nodeIndex,offsetWithinNodePx:e.offsetWithinNodePx});if(Ko(),$o.value=null,So.value=e,Ki(),Ei(e),Ke)for(const e of[0,120,280,480])Fi.push(window.setTimeout(()=>{const e=So.value;e&&Ei(e)},e))};!function(e){if(!vt.value)return!1;const n=Rn.value.length;return!(n<=0||(Bl.value="node"===e.type?dr(e.nodeIndex,0,n-1):n-1,Il(),0))}(e)?n():le(n)}(i),Da("restore"),!0)}function la(){const e=Pr();return Number.isFinite(e)&&e>0}function ra(e){var n;return e.sessionKey===Lr()&&!!$r(e.threadKey)&&(Rn.value.length<=0||!(!(null==(n=e.heightCache)?void 0:n.length)||la())||!(!(e.anchor&&Number(Vi(e))>0)||la()))}function ia(){lo.clear();for(const e of Object.keys(Go)){const n=Number(e);Number.isInteger(n)&&n>=0&&n<Rn.value.length&&yl(n)}}function aa(){null!=jl&&(null==wt||wt(jl),jl=null),Xa()}function ua(){return!Ke||Ct?Promise.resolve():new Promise(e=>{let n=!1,t=null;const o=()=>{n||(n=!0,null!=t&&window.clearTimeout(t),e())};if(xt)return xt(o),void(t=window.setTimeout(o,50));t=window.setTimeout(o,0)})}function ma(e,n=Hr(),t=Fr.value){return Lr()===e&&Hr()===n&&Fr.value===t}function pa(){return s(this,arguments,function*(e={}){var n,t,l,r,i;const s=Lr(),c=Hr(),d=Fr.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=yi(h),y=()=>u(a({},g),{phase:g.final?"settling":g.phase,stable:!1,confidence:"final"===g.confidence?"mixed":g.confidence,reason:h}),k=()=>ma(s,c,d)&&(null==v||$a()===v);for(let o=0;o<f;o++){if(yield le(),!k())return y();if(yield ua(),!k())return y();Za(),aa()}if(yield function(e){return!Ke||e<=0?Promise.resolve():new Promise(n=>window.setTimeout(n,e))}(m),!k())return y();if(p&&Gl(),Za(),aa(),!k())return y();const N=ti();N&&(Jr=s,Gr=c,"manual"===(null==(r=o.virtualScroll)?void 0:r.settleMode)&&null!=v&&ei(null==(i=o.virtualScroll)?void 0:i.settledToken)&&$a()===v&&(Qr=cu(o.virtualScroll.settledToken)));const b=k()&&N&&li(),S=yi(h,b?"final":void 0);return za(S,!0),S})}let ga="content",Ca=null,Ba=null,_a=0,Ia=null,Ta=null,Oa=null,La=null;function Ha(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function Aa(e){var n,t;const l=Ia;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 $a(e=(e=>null==(e=o.virtualScroll)?void 0:e.settledToken)()){return Sa(e)}function Pa(e,n){var t,l;return[e,n.sessionKey,null!=(t=n.threadKey)?t:"",Rr(),Ri(),Sa(null==(l=o.virtualScroll)?void 0:l.settledToken),Math.round(n.totalHeight),Math.round(n.width)].join("\0")}function Ea(){Oa=null,La=null,Ta=null}function Fa(e){const n=e.heightCache;return(null==n?void 0:n.length)?na(n):""}function Ka(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:Rr(),null!=(o=e.contentHash)?o:"",Fa(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 za(e,n=!1){if(!lt.value)return;if(function(e=!1){return!e&&Qn.value&&!rt.value}(n))return;const t=n||Aa(e),o=function(e,n=!1){return n||e.stable||"final"===e.phase?{state:Pi(e,{includeHeightCache:!0})}:{state:Pi(e)}}(e,n),r=o.state,i=Boolean(r&&(t||function(e,n=!1){return!!n||Ka(e)!==Ta}(r,n)));if(t&&(z(e),Ia=e,_a=Ha()),r&&i&&(W(r),r.anchor&&j(r.anchor),Ta=Ka(r)),e.stable){const n=Pa("settled",e);if(n!==Oa){Oa=n;const t=Pi(e,{includeHeightCache:!0});t&&(W(t),Ta=Ka(t)),function(e){l("render-settled",e)}(e)}}if("final"===e.phase){const n=Pa("final",e);if(n!==La){La=n;const t=Pi(e,{includeHeightCache:!0});t&&(W(t),Ta=Ka(t)),function(e){l("render-final",e)}(e)}}}function Wa(){null!=Ca&&(null==wt||wt(Ca),Ca=null),null!=Ba&&Ke&&(window.clearTimeout(Ba),Ba=null)}function ja(){Ca=null,Ba=null,function(e){if(Al.size>0||null!=jl)return!0;switch(e){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}}(ga)&&(Za(),aa()),za(yi(ga))}function Da(e){var n,t;if(!lt.value)return;if(ga=e,null!=Ca||null!=Ba)return;const l=Math.max(0,null!=(t=null==(n=o.virtualScroll)?void 0:n.emitIntervalMs)?t:32),r=Math.max(0,l-(Ha()-_a)),i=()=>{Ba=null,Ca=xt?xt(ja):null,null==Ca&&ja()};Ke&&r>0?Ba=window.setTimeout(i,r):i()}function Va(){ko.value+=1}function qa(e){var n;if(Ot.value&&e>=Lt.value){const n=Rn.value[e],t=!0===tn.value&&!0!==ln.value&&e>=Rn.value.length-2,o="code_block"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type)||"mermaid"===(null==n?void 0:n.type)||"infographic"===(null==n?void 0:n.type);if(!t||o)return!1}return!Sl.value||e<It.value||!!(un.value&&!0!==ln.value&&!(null==(n=o.nodes)?void 0:n.length)&&e>=Rn.value.length-ht.value)||er.value.has(e)}function Ua(e){const n=tr.get(e);n&&(n(),tr.delete(e));const t=nr.get(e);t&&(t.destroy(),nr.delete(e)),lr(e)}function Ga(e,n){let t=!1;if(n){const o=Dt.get(e);Dt.set(e,n),o!==n&&(t=!0)}else Dt.delete(e)&&(t=!0);if(t&&Va(),n||lr(e),!Ml.value||!St)return Ua(e),void(n&&Sl.value&&rr(e,!0));if(!vt.value&&Sl.value&&!me.value&&nr.size>=Le.value&&(me.value||(me.value=!0,m&&"undefined"!=typeof console&&console.warn("[markstream-vue] viewportPriority auto-disabled:","too-many-targets"),ar()),!Ml.value||!St))return Ua(e),void(n&&rr(e,!0));if(e<It.value&&!vt.value)return Ua(e),void rr(e,!0);if(er.value.has(e))return Ua(e),void rr(e,!0);if(!n)return void Ua(e);Ua(e);const o=St(n,{rootMargin:Oe.value});if(!o)return;nr.set(e,o),rr(e,o.isVisible.value),Sl.value&&function(e){if(!Ke||!Sl.value)return;lr(e);const n=e%17*23,t=window.setTimeout(()=>{if(or.delete(e),!Sl.value)return;if(er.value.has(e))return;const n=Dt.get(e);if(!n)return;const t=Xe(n),o=n.ownerDocument||document,l=o.defaultView||window,r=!t||t===o.documentElement||t===o.body,i=!r&&t?In("nodeVisibilityFallback.root.getBoundingClientRect",()=>t.getBoundingClientRect()):null,a=r?0:i.top,u=r?In("nodeVisibilityFallback.clientHeight",()=>{var e,n;return null!=(n=null!=(e=l.innerHeight)?e:null==t?void 0:t.clientHeight)?n:0}):i.bottom,s=In("nodeVisibilityFallback.node.getBoundingClientRect",()=>n.getBoundingClientRect());s.bottom>=a-500&&s.top<=u+500&&rr(e,!0)},1800+n);or.set(e,t)}(e);let l=null;l=X(()=>o.isVisible.value,n=>{if(n){lr(e),rr(e,!0),null==l||l(),tr.delete(e),nr.get(e)===o&&nr.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),tr.set(e,l),vt.value&&Ql()}function Xa(){jl=null,vl(()=>{let e=!1;for(const[n,t]of Al)Al.delete(n),Tl.get(n)===t.el&&Ol.get(n)===t.version&&(e=kl(n,t.height,{allowShrink:t.allowShrink})||e);return e})}function Ja(){null!=jl&&(null==wt||wt(jl),jl=null),Al.clear()}function Ya(e,n){!function(e,n,t){var l;if(!Number.isFinite(t)||t<=0)return;if(Tl.get(e)!==n)return;const r=Ol.get(e);if(null==r)return;const i=Rn.value[e],a=un.value&&!0!==ln.value&&!(null==(l=o.nodes)?void 0:l.length)&&e>=Rn.value.length-2,u=!(!0===(null==i?void 0:i.loading)||a),s=Al.get(e),c=s?s.allowShrink&&u:u,d=s&&!c?Math.max(s.height,t):t;Al.set(e,{height:d,allowShrink:c,version:r,el:n}),null==jl&&(jl=xt?xt(Xa):null,null==jl&&Xa())}(e,n,Nl(e,n))}function Za(){for(const[e,n]of Tl)n&&Ya(e,n)}function Qa(){null==eo||eo.disconnect(),eo=null,Jt.clear()}function eu(){for(;Hl.length;)Ul(Hl.pop())}X(rt,e=>{e&&Da("content")},{flush:"post"}),n({getVirtualMetrics:yi,captureVirtualState:function(e={}){var n;return Pi(yi("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);Zi=e,Qi={restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor},!oa(e,{restoreAnchor:t,restoreToken:o,allowUncapturedAnchor:!0===n.allowUncapturedAnchor})&&ra(e)||(Zi=null,Qi=null)},forceMeasure:function(e="manual"){return s(this,null,function*(){yield le(),yield ua(),Za(),aa(),yield le();const n=yi(e);return za(n,!0),n})},settle:pa,scrollToNode:function(e,n="start"){zi(),Ko();const t=Rn.value.length;if(t<=0)return;const o=dr(e,0,t-1),l=()=>{var e;const t=Fo({nodeIndex:o,offsetWithinNodePx:0}),l=To(o),r=ki(),i=null!=(e=null==r?void 0:r.clientHeight)?e:0,a=Ro();let u=t;if("center"===n)u=t-i/2+l/2;else if("end"===n)u=t-i+l;else if("nearest"===n&&null!=a){if(t>=a&&t+l<=a+i)return;u=t<a?t:t-i+l}Eo(Math.max(0,u)),Ql({immediate:!0}),vt.value&&(Bl.value=o,Il())};if(vt.value)return Bl.value=o,Il(),void le(l);l()}}),X(()=>pt.value,e=>{if(!e){Qa();for(const e of Ll.values())for(const n of e)Ul(n);Ll.clear(),Ol.clear(),eu(),Ja()}},{immediate:!0}),X(ln,e=>{e&&function(){if(Ke&&ln.value&&Tl.size){eu();for(const e of[80,240,640]){const n=ql(e,()=>{for(const[e,n]of Tl)n&&Ya(e,n)},"final");null!=n&&Hl.push(n)}}}(),Da(e?"final":"content")});const nu=vi(()=>Da("content"),16),tu=vi(()=>Da("batch"),16);X([()=>Rn.value.length,()=>Lt.value],()=>{So.value&&Wi(),nu()},{flush:"post",immediate:!0}),X([()=>_l.start,()=>_l.end],()=>{tu()},{flush:"post"});const{cleanupBatchScheduler:ou}=function(e){const{props:n,isClient:t,isTestEnv:o,parsedNodesIdentity:l,parsedNodeCount:r,desiredRenderedCount:i,datasetKey:a,batchingEnabled:u,incrementalRenderingActive:s,resolvedBatchSize:c,resolvedInitialBatch:d,renderedCount:f,adaptiveBatchSize:m,previousRenderContext:h,previousBatchConfig:v,requestFrame:p,cancelFrame:g,hasIdleCallback:y,cleanupNodeVisibility:k,onDatasetKeyChanged:N,onDatasetChanged:b}=e;let S=null,x="raf",w=null,M=0,C=!1,B=!1;const _=/* @__PURE__ */new Set,I=/* @__PURE__ */new Set;function T(){if(t){null!=S&&("raf"===x&&g?g(S):"idle"===x&&"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(S):"timeout"===x&&window.clearTimeout(S),S=null),M+=1;for(const e of _)g&&g(e);for(const e of I)window.clearTimeout(e);_.clear(),I.clear(),w=null,C=!1,B=!1}}function O(){return"undefined"!=typeof performance?performance.now():Date.now()}function L(e){!function(e){var t;if(!s.value)return;const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),l=Math.max(1,c.value||1),r=Math.max(1,Math.floor(l/4));e>1.5*o?m.value=Math.max(r,Math.floor(.8*m.value)):e<.6*o&&m.value<l&&(m.value=Math.min(l,Math.ceil(1.2*m.value)))}(e),C=!1;const t=B||f.value<i.value;B=!1,t&&$()}function H(e,l={}){var r,a;if(!s.value)return;const u=i.value;if(f.value>=u)return;const c=Math.max(1,e),d=()=>{const e=O();S=null;const o=null!=w?w:c;w=null;const l=O();f.value=Math.min(u,f.value+o),k(f.value),function(e,o){if(!t)return void L(o);C=!0;const l=++M;le().then(()=>{var t;if(l!==M)return;const r=O(),i=Math.max(o,r-e),a=()=>{l===M&&L(i)};if(p){let e=null,o=null,l=!1;const r=()=>{l||(l=!0,null!==e&&(_.delete(e),e=null),null!==o&&(I.delete(o),window.clearTimeout(o),o=null),a())};return e=p(()=>{r()}),_.add(e),o=window.setTimeout(()=>{null!==e&&g&&g(e),r()},Math.max(32,null!=(t=n.renderBatchIdleTimeoutMs)?t:120)),void I.add(o)}const u=window.setTimeout(()=>{I.delete(u),a()},0);I.add(u)})}(e,O()-l)};if(!t||l.immediate)return void d();const m=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(w=null!=w?Math.max(w,c):c,null==S){if(!o&&y&&window.requestIdleCallback){const e=Math.max(0,null!=(a=n.renderBatchIdleTimeoutMs)?a:120);return x="idle",void(S=window.requestIdleCallback(()=>d(),{timeout:e}))}if(p&&!o)return x="raf",void(S=p(()=>{0===m?d():(x="timeout",S=window.setTimeout(()=>d(),m))}));x="timeout",S=window.setTimeout(()=>d(),m)}}function A(e,n={}){C?B=!0:null==e?$():H(e,n)}function $(){s.value&&H(u.value?Math.max(1,Math.round(m.value)):Math.max(1,c.value))}return X([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,w=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||w||!s.value)&&T(),(y||w)&&(m.value=Math.max(1,c.value||1)),y&&b();const M=i.value;if(!o)return f.value=0,void k(0);if(!s.value)return f.value=M,void k(f.value);const C=p||0===l.total;f.value=C||w?Math.min(M,d.value):Math.min(f.value,M);const B=Math.max(1,d.value||c.value||o);f.value<M?A(B,{immediate:!t}):k(f.value)},{immediate:!0}),X(i,(e,n)=>{s.value&&("number"==typeof n&&e<=n||e>f.value&&A())}),{cleanupBatchScheduler:T}}({props:E,isClient:Ke,isTestEnv:Ct,parsedNodesIdentity:Kn,parsedNodeCount:zn,desiredRenderedCount:Dl,datasetKey:Kr,batchingEnabled:Tt,incrementalRenderingActive:Ot,resolvedBatchSize:_t,resolvedInitialBatch:It,renderedCount:Lt,adaptiveBatchSize:$t,previousRenderContext:Ht,previousBatchConfig:Rt,requestFrame:xt,cancelFrame:wt,hasIdleCallback:Mt,cleanupNodeVisibility:ir,onDatasetKeyChanged:e=>{Ja(),gl(),_o(),Ea(),e>0&&ol(e)},onDatasetChanged:()=>{vt.value&&Ql({immediate:!0})}});X([Cl,vt,()=>V.value,()=>He()],([e,n])=>{if(!e)return ur(),void Zl();sr(),n?Ql({immediate:!0}):Zl()},{flush:"post",immediate:!0}),X([()=>Rn.value.length,()=>vt.value],e=>s(null,[e],function*([e,n]){n&&e&&Ke&&(yield le(),Ql({immediate:!0}))}),{flush:"post"}),X(it,e=>{e&&function(){var e;if(Wn.value&&jn.value&&Dn.value&&(null==(e=Vn.value)?void 0:e[1]))return;const n=he({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=he({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=he({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});Wn.value=n,jn.value=t,Dn.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=he({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});Vn.value=l}()},{immediate:!0}),X([()=>V.value,it],()=>{if(!it.value)return yr(),void(ke.value=0);pr(),yr(),it.value&&V.value&&"undefined"!=typeof ResizeObserver&&(gr=new ResizeObserver(()=>{pr(),$o.value&&zo(),So.value&&Wi(),Da("resize")}),gr.observe(V.value))},{immediate:!0}),X([it,ct,Fr],()=>s(null,null,function*(){if(!it.value)return we.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void _o();yield le(),function(){if(!it.value||"undefined"==typeof window)return we.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void _o();const e={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},n=hr(mr(J.value),".paragraph-node");e.paragraph=ci(J.value,n,"pre-wrap");const t=mr(Z.value),o=null==t?void 0:t.querySelector(".paragraph-node");e.listItem=ci(Z.value,o,"pre-wrap");const l=In("readSimpleTextProbeProfile.list.offsetHeight",()=>{var e,n;return null!=(n=null==(e=oe.value)?void 0:e.offsetHeight)?n:0}),r=In("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var e,n;return null!=(n=null==(e=Z.value)?void 0:e.offsetHeight)?n:0});e.listWrapperOverhead=Math.max(0,l-r);for(let i=1;i<=6;i++){const n=hr(mr(fe[i]),`h${i}`);e.headings[i]=ci(fe[i],n,"pre-wrap")}we.value=e,_o()}()}),{flush:"post",immediate:!0}),X(()=>Rn.value.length,()=>{vt.value&&Ql({immediate:!0})}),X([it,ke],()=>{_o(),vt.value&&Ql({immediate:!0}),$o.value&&zo(),So.value&&Wi(),Da("resize")},{immediate:!1}),X(()=>Sl.value,e=>{if(e)for(const[n,t]of Dt)Ga(n,t);else if(ar(),vt.value)Ql({immediate:!0});else for(const[n,t]of Dt)t&&rr(n,!0)},{immediate:!1}),X([Oe,Le,()=>He()],()=>{var e;null==(e=St.refresh)||e.call(St);for(const[n,t]of Dt)Ga(n,t)},{immediate:!1}),X([()=>E.viewportPriority,()=>Rn.value.length,Le],([e,n,t])=>{if(!1!==e){if(me.value&&(n<=200||n<=t)){me.value=!1;for(const[e,n]of Dt)Ga(e,n)}}else me.value=!1}),X(()=>Lt.value,()=>{vt.value&&Ql({immediate:!0})}),X([Bl,ft,ht,()=>Rn.value.length,vt],()=>{Il()},{immediate:!0});let lu=null,ru=!1,iu=null;function au(){lu=null,Jr=null,Gr=void 0,Qr=null,Ea()}function uu(){Ja(),gl(),_o(),lo.clear();const e=Rn.value.length;e>0&&ol(e),ia()}function su(){Wa(),Gl(),Ia=null,Xi=null,Ji=null,Yi=null,Zi=null,Qi=null,ru=!1,au(),Dr("restore"),Ko(),zi()}function cu(e){var n;return[null!=(n=Hr())?n:"",Lr(),Rr(),Er.value,$a(e),Rn.value.length,Math.round(Lo(0,Rn.value.length)),Math.round(Pr()),Xo.count,Math.round(Xo.total)].join(":")}function du(){return s(this,null,function*(){var e,n,t,l;const r=null==(e=o.virtualScroll)?void 0:e.settledToken,i=$a(r),a=Lr(),u=Hr(),s=Fr.value;if(lt.value&&"manual"===(null==(n=o.virtualScroll)?void 0:n.settleMode)&&ei(r))if(ti()){if(cu(r)!==Qr&&!ru){ru=!0;try{const e=yield pa({reason:"manual",expectedSettledTokenKey:i}),n=$a()===i;ma(a,u,s)&&e.sessionKey===a&&e.threadKey===u&&n&&e.stable&&"final"===e.phase&&(Qr=cu(null==(t=o.virtualScroll)?void 0:t.settledToken))}finally{ru=!1,yield le();const e=null==(l=o.virtualScroll)?void 0:l.settledToken,n=ei(e)?cu(e):"";ma(a,u,s)&&n&&Qr!==n&&du()}}}else Da("manual")})}X(lt,(e,n)=>{if(e!==n){if(!e)return su(),void Wa();su(),uu(),iu=Fr.value,Da("content")}},{flush:"post"}),X([lt,Fr],([e,n])=>{e?null!=iu?iu!==n&&(iu=n,function(e="resize"){Ja(),gl(),_o(),lo.clear();const n=Rn.value.length;n>0&&ol(n),ia(),Xi=null,Ji=null,Yi=null,Ia=null,ru=!1,au(),ta(),le(()=>{Za(),$o.value&&zo(),So.value&&Wi(),Da(e)})}("resize")):iu=n:iu=null},{flush:"post",immediate:!0}),X([lt,()=>Lr(),()=>Hr()],([e])=>{e&&(su(),uu(),Dr("content"),Da("content"))}),X([lt,()=>Lr(),()=>Hr(),Fr,()=>Rn.value.length],([e])=>{e&&function(e="async-node"){let n=!1;for(const[t,o]of Array.from(Kl.entries()))Wr(o)||(Kl.delete(t),Fl.delete(t),n=!0);n&&(zr(),Da(e))}("async-node")},{flush:"post"}),X([lt,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.sessionKey},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.measurementKey},()=>o.indexKey,()=>pe.value],([e])=>{e&&(Ea(),function(e="content"){if(!lt.value)return;const n=[],t=Rn.value.length,o=fr(t);for(const l of Array.from(lo.keys())){if(l>=t){n.push(l);continue}if(l<o)continue;const e=Ai(l),r=lo.get(l);null!=r&&r!==e&&n.push(l),lo.set(l,e)}for(const l of Array.from(lo.keys()))l>=t&&lo.delete(l);n.length&&(function(e,n={}){const t=Array.from(e,Number);hl(t);let o=0;if(vl(()=>(o=al(t,n),o>0)),o>0)!function(e){for(const n of e)lo.delete(n)}(t);else for(const l of t)ho.delete(l)}(n,{notify:!1}),_o(),au(),$o.value&&zo(),So.value&&Wi(),Da(e))}("content"))},{flush:"post",immediate:!0}),X([lt,()=>Rn.value.length,()=>Lr(),()=>Hr()],([e,n,t,o],[l,r,i,a])=>{e&&l&&t===i&&o===a&&n!==r&&au()},{flush:"post"}),X([lt,()=>{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},()=>Rn.value.length,()=>Lr(),ke],()=>{ta()},{flush:"post",immediate:!0}),X([lt,()=>{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},()=>Rn.value.length,()=>Lr(),ke],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)}();oa(n,{restoreAnchor:null!=t,restoreToken:null!=t?t:void 0})}),{flush:"post",immediate:!0}),X([lt,ke,()=>{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&&Xi&&"restore"===Ji&&(qi(t)||(uu(),Xi=null,Ji=null,Da("resize")))},{flush:"post"}),X([lt,()=>Rn.value.length,()=>Lr(),ke],e=>s(null,[e],function*([e]){var n;const t=Zi,o=Qi;e&&t&&(yield le(),!oa(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)})&&ra(t)||(Zi=null,Qi=null))}),{flush:"post",immediate:!0}),X([lt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>Lr(),()=>Hr(),Fr,Wl,El,()=>Lt.value,Dl,()=>Xo.count,()=>Xo.total],([e,n,t])=>{if(!e||!0!==n||"manual"===t)return;if(!si())return;const o=function(){var e;const n=Rn.value.length;return[null!=(e=Hr())?e:"",Lr(),Rr(),Er.value,n,Math.round(Lo(0,n)),Math.round(Pr()),Xo.count,Math.round(Xo.total)].join(":")}();lu!==o&&(lu=o,pa({reason:"final"}).then(e=>{e.stable||lu!==o||(lu=null)}))},{flush:"post",immediate:!0}),X([lt,ln,()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settleMode},()=>{var e;return null==(e=o.virtualScroll)?void 0:e.settledToken},()=>Lr(),()=>Hr(),Fr,Wl,El,()=>Lt.value,Dl,()=>Rn.value.length,()=>Xo.count,()=>Xo.total],()=>{du()},{flush:"post",immediate:!0}),X([()=>Rn.value.length,vt,ft,ht,()=>_l.start,()=>_l.end],([e,n,t,o,l,r])=>{We.value&&yn("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Bl.value,scroll:n?(()=>{const e=bo.value||Xe();return e?{reverse:Ye(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:Lt.value})}),X([()=>E.customId],([e],n,t)=>{if(!e||qn)return;const o=function(e,n){return e?(Xr.controllers[e]=n,()=>{Xr.controllers[e]===n&&delete Xr.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Do,restoreAnchor:Vo,getAnchorDrift:qo,getReport:Ir});t(()=>{o()})},{immediate:!0}),te(()=>{!function(){if(lt.value)try{Za(),aa();const e=yi("manual");Aa(e)&&(z(e),Ia=e,_a=Ha());const n=Pi(e,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});n&&(W(n),n.anchor&&j(n.anchor),Ta=Ka(n))}catch(e){}}(),ou(),ar(),pn(),Qa();for(const e of Ll.values())for(const n of e)Ul(n);Ll.clear(),Ol.clear(),lo.clear(),eu(),Ja(),yr(),Ko(),zi(),Wa(),ur(),Zl()});const fu=Wt("ViewportDeferredMermaidBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./index10.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),At}}),loadingComponent:Na,delay:0}),Na),mu=Wt("ViewportDeferredInfographicBlockNode",re({loader:()=>s(null,null,function*(){try{return(yield import("./index9.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:ka,delay:0}),ka),hu=Wt("ViewportDeferredD2BlockNode",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}})),At),vu={text:zt,paragraph:Jo,heading:Po,code_block:qt,list:jo,list_item:Wo,blockquote:Mo,table:ll,definition_list:Io,footnote:Ao,footnote_reference:sn,footnote_anchor:Oo,admonition:Ra,vmr_container:sl,hardbreak:go,link:uo,image:mt,thematic_break:il,math_inline:Ut,math_block:Gt,strong:no,emphasis:vo,strikethrough:oo,highlight:mo,insert:co,subscript:Qt,superscript:Yt,emoji:rn,checkbox:on,checkbox_input:on,inline_code:Mn,html_inline:Sn,reference:Xt,html_block:Uo},pu=P(()=>Tr()),gu=P(()=>fi(E.codeBlockProps)),yu=P(()=>fi(E.codeBlockProps)),ku=P(()=>u(a(a({stream:E.codeBlockStream,darkTheme:E.codeBlockDarkTheme,lightTheme:E.codeBlockLightTheme,themes:E.themes,minWidth:E.codeBlockMinWidth,maxWidth:E.codeBlockMaxWidth},"boolean"==typeof je.value?{showTooltips:je.value}:{}),yu.value),{codeBlockOptions:E.codeBlockOptions})),Nu=P(()=>u(a(a({},ku.value),gu.value),{codeBlockOptions:E.codeBlockOptions}));function bu(e){return"boolean"==typeof e?e:void 0}const Su=P(()=>{var e,n,t,o,l,r,i;const a=E.codeBlockProps||{},u={},s=bu(a.showLineNumbers);u.showLineNumbers=null!=s?s:!0!==(null==(e=E.codeBlockOptions)?void 0:e.disableLineNumbers),u.showHeader=null==(n=bu(a.showHeader))||n,u.showCopyButton=null==(t=bu(a.showCopyButton))||t;const c=null!=(o=bu(a.showTooltips))?o:je.value;"boolean"==typeof c&&(u.showTooltips=c),u.codeBlockOptions=E.codeBlockOptions,u.isDark=E.isDark,u.darkTheme=null!=(l=a.darkTheme)?l:E.codeBlockDarkTheme,u.lightTheme=null!=(r=a.lightTheme)?r:E.codeBlockLightTheme,u.theme=a.theme,u.themes=null!=(i=a.themes)?i:E.themes;const d=bu(a.diffInline);void 0!==d&&(u.diffInline=d),void 0!==a.diffHideUnchangedRegions&&(u.diffHideUnchangedRegions=a.diffHideUnchangedRegions);const f=function(e){const n=Number(e);return Number.isFinite(n)&&n>0?n:void 0}(a.reservedHeightPx);return void 0!==f&&(u.reservedHeightPx=f),u}),xu=P(()=>a({},E.mermaidProps||{})),wu=P(()=>a({},E.d2Props||{})),Mu=P(()=>a({},E.infographicProps||{})),Cu=P(()=>({typewriter:p.value,fade:E.fade,customHtmlTags:$n.value.customHtmlTags})),Bu=P(()=>a(a({},Cu.value),"boolean"==typeof je.value?{showTooltip:je.value}:{})),_u=P(()=>a(a({},Cu.value),"boolean"==typeof je.value?{showTooltips:je.value}:{})),Iu=P(()=>a(a({},Cu.value),"boolean"==typeof je.value?{showTooltips:je.value}:{})),Tu=P(()=>a(a({},Cu.value),"boolean"==typeof je.value?{showTooltips:je.value}:{}));function Ou(e){return Array.isArray(e.children)&&e.children.length>0}const Lu=P(()=>Mr.value.map(e=>{var n,t,o,l,r,i,s;let c=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=to.get(s);if(d&&d.signature===c)return d.node;const f=a({},s);return to.set(s,{signature:c,node:f}),f}(e.node);const d=Hu(c);let f=Eu(c,d);if(("html_block"===c.type||"html_inline"===c.type)&&f===vu[c.type]){const e=c,r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||C(e.content);if(r){const n=Hn.value[r];if(An.value.has(r)&&n)f=n,c=u(a({},e),{type:r,tag:r,content:H(e.content,r)});else if(B(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===c.type?(f=zt,c={type:"text",content:n,raw:n}):(f=Jo,c={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}const m="code_block"===c.type&&y.value&&f===Vt&&!Au(Hn.value,d);let h=a({},function(e,n,t){const o=null!=n?n:Hu(e);if("code_block"===e.type){const n=o?Au(Hn.value,o):void 0;if(t&&y.value&&!n&&t===Vt)return Su.value;if(t&&o&&t===n)return"mermaid"===o?Ru(e):"infographic"===o?Pu(e):"d2"===o||"d2lang"===o?wu.value:Nu.value;if(t&&t===Hn.value.code_block)return Nu.value}return"mermaid"===o?Ru(e):"infographic"===o?Pu(e):"d2"===o||"d2lang"===o?wu.value:"link"===e.type?Bu.value:"list"===e.type?_u.value:"blockquote"===e.type?Iu.value:"table"===e.type?Tu.value:"code_block"===e.type?ku.value:Cu.value}(c,d,f));const v=it.value?wr.value[e.index]:null;"code_block"===c.type&&"code-block"===(null==v?void 0:v.kind)&&(h=u(a({},h),m?{reservedHeightPx:v.contentHeight}:{estimatedHeightPx:v.height,estimatedContentHeightPx:v.contentHeight,estimatedDiffInline:v.diffInline})),m||"code_block"!==c.type||"mermaid"!==d||null!=Ee(h.estimatedPreviewHeightPx)||(h=u(a({},h),{estimatedPreviewHeightPx:Ae($e(String(null!=(r=c.code)?r:"")))})),m||"code_block"!==c.type||"infographic"!==d||null!=Ee(h.estimatedPreviewHeightPx)||(h=u(a({},h),{estimatedPreviewHeightPx:Re(Pe(String(null!=(i=c.code)?i:"")))})),"math_block"===c.type&&(h=u(a({},h),{cacheScope:Ln}));const p=function(e,n){const t=String(e.type);return!Ve(t)&&Hn.value[t]===n}(c,f),g=p?vn(c,De.value):void 0;return u(a({},e),{node:c,component:f,bindings:h,customBindings:a(a({},null!=g?g:{}),h),rendersCustomNode:p,hasSlotChildren:Ou(c),slotContent:String(null!=(s=c.content)?s:""),isCodeBlock:"code_block"===c.type,indexKey:`${pu.value}-${e.index}`,vnodeKey:`${Ar.value}\0${e.index}\0${c.type}`})}));function Hu(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function Au(e,n){const t=n.trim().toLowerCase();if(t)for(const o of[t,Te(t),_e(t)]){const n=o&&e[o];if(n)return n}}function $u(e,n,t,o){var l,r;const i=a({},e.value);return null==Ee(i.estimatedPreviewHeightPx)&&(i.estimatedPreviewHeightPx=o(t(String(null!=(l=null==n?void 0:n.code)?l:"")),void 0,"none"===i.maxHeight?null:null!=(r=Ee(i.maxHeight))?r:void 0)),i}function Ru(e){return $u(xu,e,$e,Ae)}function Pu(e){return $u(Mu,e,Pe,Re)}function Eu(e,n){if(!e)return ul;const t=Hn.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:Hu(e),r=l?Au(t,l):void 0;if(r)return r;if(y.value)return t.code_block||Vt;if("mermaid"===l)return t.mermaid||fu;if("infographic"===l)return t.infographic||mu;if("d2"===l||"d2lang"===l)return t.d2||hu;if(o)return o;return t.code_block||kr.value}return o||vu[String(e.type)]||ul}function Fu(e){l("click",e)}function Ku(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseover",e)}function zu(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&l("mouseout",e)}function Wu(e){l("mouseover",e)}function ju(e){l("mouseout",e)}const Du=G(null),Vu=G(!1),qu=G(null),Uu=P(()=>!("minimal"!==E.domMode||ze.value||!1!==E.fade||p.value||Vu.value||Pt.value||vt.value||nt.value||Xn.value||bt.value||0!==Object.keys(Hn.value).length));let Gu,Xu=null,Ju=0,Yu=0,Zu=0;const Qu=["code_block","admonition","table","math_block","html_block","image","thematic_break"],es=new Set(Qu),ns=[".typewriter-cursor",".height-estimation-probes",...Qu.map(e=>`[data-node-type="${e}"]`),"script","style"].join(",");function ts(e){if(!e||"object"!=typeof e)return!1;const n=e.type;return"string"==typeof n&&es.has(n)}function os(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+os(n),0);const i=o.items;return Array.isArray(i)?i.reduce((e,n)=>e+os(n),0):0}function ls(){Gu&&(clearTimeout(Gu),Gu=void 0)}function rs(){Ju+=1,null!=Xu&&(null==wt||wt(Xu),Xu=null)}function is(){rs(),cs(),Du.value&&(Du.value.style.visibility="hidden")}function as(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(ns)}function us(e){let n=e.lastChild;for(;n;){if(as(n))return n;if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(!e.matches(ns)&&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 ss(){const e=Lu.value;for(let n=e.length-1;n>=0;n--){const t=e[n];if(!t||ts(t.node)||!qa(t.index))continue;const o=Dt.get(t.index);if(!o)continue;const l=us(o);if(l)return l}return null}function cs(){qu.value&&(qu.value.classList.remove(Ma),qu.value=null)}function ds(){if("simple"!==v.value||!Ke||!Vu.value||!V.value)return void cs();const e=ss(),n=e?function(e){var n;const t=null==(n=e.parentElement)?void 0:n.closest(".text-node");return t instanceof HTMLElement?t:e.parentElement}(e):null;n!==qu.value&&(cs(),n&&(n.classList.add(Ma),qu.value=n))}function fs(){if("precise"!==v.value)return;if(!Ke||!Vu.value)return;if(null!=Xu)return;const e=Ju,n=()=>{Xu=null,e===Ju&&function(){var e,n;if("precise"!==v.value)return;if(!(Ke&&Vu.value&&V.value&&Du.value))return;const t=V.value,o=Du.value;o.style.visibility="hidden";const l=ss();if(!l)return;let r=0,i=0,a=20,u=!1;if(null==l?void 0:l.textContent){const o=l.textContent.length,s=document.createRange();s.setStart(l,Math.max(0,o-1)),s.setEnd(l,o);const c="function"==typeof s.getClientRects?s.getClientRects():void 0,d=null!=(n=null==c?void 0:c[c.length-1])?n:null==(e=l.parentElement)?void 0:e.getBoundingClientRect();if(d){const e=In("typewriterCursor.root.getBoundingClientRect",()=>t.getBoundingClientRect());r=d.right-e.left+t.scrollLeft,i=d.top-e.top+t.scrollTop,a=d.height||a,u=!0}s.detach()}u&&(o.style.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px)`,o.style.height=`${a}px`,o.style.visibility="visible")}()};xt?Xu=xt(n):n()}return X([nn,()=>o.content,()=>o.nodes,()=>E.typewriter,ln],()=>s(null,null,function*(){var e,n;if(!Ke||ze.value||!Ue.value)return;if(ln.value)return Vu.value=!1,ls(),void is();if(null==(e=o.nodes)?void 0:e.length)return Vu.value=!1,ls(),is(),Yu=(null!=(n=o.content)?n:"").length,void(Zu=nn.value.length);const t=function(){var e,n;return(null==(e=o.nodes)?void 0:e.length)?o.nodes.reduce((e,n)=>e+os(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+os(n),0):nn.value.length}(),r=!ts(Rn.value[Rn.value.length-1]),i=t>Yu,a=l>Zu;if(!p.value||!r||!i&&!a)return p.value&&r||(Vu.value=!1,is()),Yu=t,void(Zu=l);Yu=t,Zu=l,Vu.value=!0,"precise"===v.value&&Du.value&&(Du.value.style.visibility="hidden"),ls(),yield le(),"simple"===v.value?ds():(cs(),fs()),Gu=setTimeout(()=>{Gu=void 0,Vu.value=!1},3e3)}),{flush:"post",immediate:!0}),X(Vu,e=>s(null,null,function*(){e?(yield le(),"simple"!==v.value?(cs(),"precise"===v.value&&fs()):ds()):is()}),{flush:"post"}),X(v,()=>s(null,null,function*(){if(Ke&&!ze.value&&Ue.value&&Vu.value){if(yield le(),"simple"===v.value)return rs(),void ds();cs(),"precise"!==v.value?is():fs()}}),{flush:"post"}),X([()=>Lt.value,()=>_l.start,()=>_l.end],()=>s(null,null,function*(){Ke&&!ze.value&&Ue.value&&Vu.value&&(yield le(),"simple"!==v.value?(cs(),"precise"===v.value&&fs()):ds())}),{flush:"post"}),te(()=>{ls(),rs(),cs(),On.clear()}),(e,n)=>{const t=xe("NodeRenderer",!0);return q(ze)?(F(!0),K(Y,{key:0},de(Lu.value,e=>(F(),K(Y,{key:e.vnodeKey},[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onClick:Fu,onMouseover:Wu,onMouseout:ju,onCopy:n[0]||(n[0]=e=>r(e)),onHandleArtifactClick:n[1]||(n[1]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onClick:Fu,onMouseover:Wu,onMouseout:ju,onCopy:n[2]||(n[2]=e=>r(e)),onHandleArtifactClick:n[3]||(n[3]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(F(),K("div",{key:1,ref_key:"containerRef",ref:V,class:D(["markstream-vue markdown-renderer",[{dark:E.isDark},{virtualized:vt.value},{"virtual-scroll-coordinated":rt.value},{"stable-layout":wl.value},{"typewriter-simple-cursor":Vu.value&&"simple"===v.value}]]),"data-custom-id":E.customId,onClick:Fu,onMouseover:Ku,onMouseout:zu},[at.value||vt.value?(F(),K(Y,{key:0},[at.value?(F(),ie(ya,{key:0,width:ct.value,"flow-root":vt.value||rt.value,"paragraph-node":Wn.value,"list-item-node":jn.value,"list-node":Dn.value,"heading-nodes":Vn.value,"set-paragraph-wrapper":Xl,"set-list-item-wrapper":Jl,"set-list-wrapper":Yl,"set-heading-wrapper":vr},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):Q("",!0),vt.value?(F(),K("div",{key:1,class:"node-spacer",style:ce({height:`${Cr.value}px`}),"aria-hidden":"true"},null,4)):Q("",!0)],64)):Q("",!0),Uu.value?(F(!0),K(Y,{key:1},de(Lu.value,e=>(F(),K(Y,{key:e.vnodeKey},[qa(e.index)?(F(),ie(ae(e.component),ue({key:0,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onMouseover:n[4]||(n[4]=e=>l("mouseover",e)),onMouseout:n[5]||(n[5]=e=>l("mouseout",e)),onCopy:n[6]||(n[6]=e=>r(e)),onHandleArtifactClick:n[7]||(n[7]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):Q("",!0)],64))),128)):(F(!0),K(Y,{key:2},de(Lu.value,e=>(F(),K("div",{key:e.vnodeKey,ref_for:!0,ref:n=>Ga(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[qa(e.index)?(F(),K("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;n||function(e){const n=`${Tr()}-${e}`;let t=!1;for(const o of Array.from(Fl.keys())){const l=Kl.get(o);((null==l?void 0:l.index)===e||o===n||o.startsWith(`${n}-`))&&(Fl.delete(o),Kl.delete(o),t=!0)}t&&(zr(),Da("async-node"))}(e),Al.delete(e),function(e){var n;const t=(null!=(n=Ol.get(e))?n:0)+1;Ol.set(e,t)}(e);const o=Ll.get(e);if(o){for(const e of o)Ul(e);Ll.delete(e)}if(function(e){const n=Jt.get(e);n&&(null==eo||eo.unobserve(n),Zt.delete(n),Jt.delete(e))}(e),!n||!pt.value)return Tl.delete(e),void Ol.delete(e);Tl.set(e,n);const l=()=>{Ya(e,n)};queueMicrotask(l);const r=(eo||"undefined"==typeof ResizeObserver||(eo=new ResizeObserver(e=>{if(e.length)for(const n of e){const e=Zt.get(n.target),t=Jt.get(null!=e?e:-1);null!=e&&t&&Ya(e,t)}else Za()})),eo);if(r&&(Jt.set(e,n),Zt.set(n,e),r.observe(n)),"undefined"!=typeof window){const n="code_block"===(null==(t=Rn.value[e])?void 0:t.type)?[16,80,240,800]:ln.value?[80]:[];if(n.length){const t=n.map(e=>ql(e,l,"node-resize")).filter(e=>null!=e);t.length&&Ll.set(e,t)}}}(e.index,n),class:"node-content"},[e.isCodeBlock?e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:1,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[12]||(n[12]=e=>r(e)),onHandleArtifactClick:n[13]||(n[13]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:2,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[14]||(n[14]=e=>r(e)),onHandleArtifactClick:n[15]||(n[15]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ge,{key:0,name:"fade",css:!1!==E.fade,appear:!1!==E.fade},{default:se(()=>[e.rendersCustomNode?(F(),ie(ae(e.component),ue({key:0,ref_for:!0},e.customBindings,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[8]||(n[8]=e=>r(e)),onHandleArtifactClick:n[9]||(n[9]=e=>l("handleArtifactClick",e))}),{default:se(()=>[e.hasSlotChildren?(F(),ie(t,ue({key:0,ref_for:!0},Fn.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):e.slotContent?(F(),ie(t,ue({key:1,ref_for:!0},Fn.value,{content:e.slotContent,final:!e.node.loading,"index-key":`${e.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):Q("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(F(),ie(ae(e.component),ue({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":E.customId,"is-dark":E.isDark,onCopy:n[10]||(n[10]=e=>r(e)),onHandleArtifactClick:n[11]||(n[11]=e=>l("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(F(),K("div",{key:1,class:"node-placeholder",style:ce({height:`${To(e.index)}px`})},null,4))],8,wa))),128)),Vu.value&&"precise"===v.value?(F(),K("span",{key:3,ref_key:"typewriterCursorRef",ref:Du,class:"typewriter-cursor","aria-hidden":"true"},null,512)):Q("",!0),vt.value?(F(),K("div",{key:4,class:"node-spacer",style:ce({height:`${Br.value}px`}),"aria-hidden":"true"},null,4)):Q("",!0)],42,xa))}}})),[["__scopeId","data-v-5107dcb0"]]),Ba=Ca;Ba.install=e=>{const n=new Set(["MarkdownRender","NodeRenderer",Ba.__name,Ba.name].filter(e=>Boolean(e)));for(const t of n)e.component(t,Ca)};const _a=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Ba},Symbol.toStringTag,{value:"Module"})),Ia={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Ta={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"},Oa={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"},La={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"},Ha={class:"admonition-title"},Aa=["aria-expanded","aria-controls"],$a=["id"],Ra=/* @__PURE__ */tn(/* @__PURE__ */E({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r=P(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const e=o.node.kind||"note";return e.charAt(0).toUpperCase()+e.slice(1)}),i=G(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function a(){o.node.collapsible&&(i.value=!i.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(F(),K("div",{class:D(["admonition",[`admonition-${o.node.kind}`]])},[z("div",{id:u,class:"admonition-legend"},["note"===o.node.kind||"info"===o.node.kind?(F(),K("svg",Ia,[...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?(F(),K("svg",Ta,[...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?(F(),K("svg",Oa,[...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?(F(),K("svg",La,[...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)])])):Q("",!0),z("span",Ha,W(r.value),1),o.node.collapsible?(F(),K("button",{key:4,class:"admonition-toggle","aria-expanded":!i.value,"aria-controls":`${u}-content`,onClick:a},[(F(),K("svg",{style:ce({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,Aa)):Q("",!0)]),fe(z("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[V(q(Ba),{"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,$a),[[me,!i.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Ra.install=e=>{e.component(Ra.__name,Ra)};const Pa=()=>import("@terrastruct/d2");let Ea=null,Fa=Pa,Ka=null,za=!1,Wa=!1,ja=0;function Da(e){Fa=e,ja++,Ea=null,Ka=null,za=!1,Wa=!1}function Va(e){Da(null!=e?e:Pa)}function qa(){Da(null)}function Ua(){return"function"==typeof Fa}function Ga(){return s(this,null,function*(){if(Ea)return Ea;const e=Fa,n=ja;return e?e===Pa&&za?null:Ka||(Ka=s(null,null,function*(){let t;try{t=yield e()}catch(o){if(e===Pa)return n===ja&&e===Fa&&(za=!0,function(e){Wa||(Wa=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',e))}(o)),null;throw o}finally{n===ja&&e===Fa&&(Ka=null)}return n!==ja||e!==Fa?null:t?(Ea=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(t),Ea):null}),Ka):null})}let Xa=null,Ja=null,Ya=null,Za=0;function Qa(e){Ja=null!=e?e:null,Xa=null,Ya=null,Za++}function eu(e){if("function"!=typeof e)throw new TypeError("enableInfographic requires a loader function");Qa(e)}function nu(){Qa()}function tu(){return"function"==typeof Ja}function ou(){return s(this,null,function*(){if(Xa)return Xa;const e=Ja,n=Za;return e?Ya||(Ya=s(null,null,function*(){const t=yield e();if(n!==Za||e!==Ja)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!==Za||e!==Ja?null:o?(Xa=o,Xa):null}).finally(()=>{n===Za&&e===Ja&&(Ya=null)}),Ya):null})}function lu(e){const n=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(n)?n:0}function ru(e,n){null==e||e(n)}function iu(e,n){return e?(ru(n,"readElementBoxHeight.offsetHeight"),Math.ceil(Math.max(0,e.offsetHeight||0))):0}function au(e,n){const t=iu(e,n);if(!e||"undefined"==typeof window||"function"!=typeof window.getComputedStyle)return t;ru(n,"readElementOuterHeight.getComputedStyle");const o=window.getComputedStyle(e),l=lu(o.marginTop),r=lu(o.marginBottom);return Math.ceil(Math.max(0,t+l+r))}function uu(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):au(e,n),r=iu(o,n);return Math.max(0,l-r)}function su(e){return"measured"===e||"final"===e}function cu(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 du(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 fu(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 mu(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 hu(e,n,t){var o,l;return null!=(l=null==(o=t.getRevision)?void 0:o.call(t,e,n))?l:e.revision}function vu(e,n,t){const o=du(e,n,t);return"assistant-markdown"===o||"markdown"===o||!o&&fu(e,n,t).length>0}function pu(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=du(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:fu(e,n,t).length>0?360:96}function gu(e){const n=ye(/* @__PURE__ */new Map),t=/* @__PURE__ */new Map,o=ye(/* @__PURE__ */new Map),l=ye(/* @__PURE__ */new Map),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,d=G(!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,w=null;function M(n){var t;!0===e.debug&&y.set(n,(null!=(t=y.get(n))?t:0)+1)}function C(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):(le(e),null)}function B(e){null!=e&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}function _(){return[...Me(e.items)]}function I(){const n=Me(e.threadKey);return null==n?void 0:String(n)}function T(n,t){return cu(n,t,e)}function O(n,t){return vu(n,t,e)}function L(n,t){const o=T(n,t),l=I(),r=hu(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function H(){const n=Me(e.measurementKey);return null==n?void 0:String(n)}function A(){const n=Me(e.markdownMode);return"chat"===n||"minimal"===n||"docs"===n?n:"docs"}function $(){return!0===Me(e.renderCodeBlocksAsPre)}function R(){var e;const n=$()?"pre":"rich";return`${null!=(e=H())?e:""}${A()}${n}`}function P(n,t){if(O(n,t))return L(n,t);const o=T(n,t),l=I(),r=hu(n,t,e);return[null!=l?l:"timeline",o,null==r?"":String(r)].join(":")}function E(e){const n=_();for(let t=0;t<n.length;t++){const o=n[t];if(T(o,t)===e)return{item:o,index:t}}return null}function F(e,n){var t;const o=E(e);if(!o||!n)return!1;if(n.sourceKey!==P(o.item,o.index))return!1;const l=O(o.item,o.index)?R():H();return(null!=(t=n.measurementKey)?t:"")===(null!=l?l:"")}function K(e){if(!F(e,t.get(e)))return 0;const o=n.get(e);return Number.isFinite(o)&&o>0?o:0}function z(e,n){var t,o;const l=E(e);return!!(l&&n&&O(l.item,l.index)&&n.sessionKey===L(l.item,l.index)&&(null!=(t=n.threadKey)?t:"")===(null!=(o=I())?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 D(e,n=o.get(e),t={}){var l;const r=t.trustImportedState?Number(null==(l=null==n?void 0:n.metrics)?void 0:l.totalHeight):function(e,n=o.get(e)){var t;if(!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 V(e){var n;return z(e,r.get(e))?null!=(n=l.get(e))?n:0:D(e)}function q(e){return Number.isFinite(e)&&e>0?e:null}function U(){if(!x)return;x=!1,w=null;const e=N;N=void 0,e&&ue(e)}function X(){if(null!=v&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(v),v=null,"undefined"!=typeof window)for(const e of p)window.clearTimeout(e);p=[]}function Y(o,l,r=function(e){const n=E(e);return n?function(e,n){const t=O(e,n)?R():H();return a({sourceKey:P(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(()=>{se(n,e),null==v&&"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,e)}))})}();const M=!1!==e.preserveScrollAnchor,B=M?ie():void 0,_=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-e.virtualizer.getScrollTop()),I=M&&_<=2,T=M&&_<=function(){var n;const t=Number(null!=(n=e.bottomThresholdPx)?n:48);return Number.isFinite(t)?Math.max(0,t):48}();var L;n.set(o,i),r&&t.set(o,r),e.virtualizer.setItemSize(o,i),M&&((L=I?{type:"bottom",distanceFromBottomPx:0}:T?{type:"bottom",distanceFromBottomPx:_}:B)&&(x||(N=L,x=!0,w=C(U))))}function Z(e){var n;null==(n=c.get(e))||n.disconnect(),c.delete(e),s.delete(e)}function Q(){if(!b)return;b=!1,S=null;const e=Array.from(k.entries());k.clear();for(const[n,t]of e)V(n)===t.logicalHeight&&ne(n,{allowMarkdownShrink:t.allowMarkdownShrink});U()}function ee(){Q(),U()}function ne(n,t={}){const o=function(e){return au(s.get(e),M)}(n),l=K(n);let r=!1;const i=()=>{r||(r=!0,function(n,t){const o=function(){if(!0!==e.debug||0===y.size)return null;let n=0;for(const e of y.values())n+=e;const t={total:n,byLabel:Object.fromEntries(Array.from(y.entries()).sort((e,n)=>n[1]-e[1]||e[0].localeCompare(n[0])))};return y.clear(),t}();o&&console.info("[markstream-vue][virtual-adapter][perf] layout-reads",{label:n,itemKey:t,layoutReads:o})}("reconcileItemSize",n))};if(!function(e){const n=E(e);return!!n&&O(n.item,n.index)}(n))return o>0&&Y(n,o),void i();const a=V(n),u=function(e,n){return uu(s.get(e),M,n)}(n,o);if(a>0){let e=Math.max(o,a+u);return(!t.allowMarkdownShrink||d.value)&&l>0&&(e=Math.max(e,l)),e>0&&Y(n,e),void i()}const c=E(n);return c&&!fu(c.item,c.index,e).trim()?(o>0&&Y(n,o),void i()):l>0?(o>l+1&&Y(n,o),void i()):(o>0&&Y(n,o),void i())}function te(){const e={},n=_();for(let t=0;t<n.length;t++){const o=T(n[t],t),l=K(o);Number.isFinite(l)&&l>0&&(e[o]=l)}return e}function oe(){const e={},n=_();for(let o=0;o<n.length;o++){const l=T(n[o],o),r=t.get(l);F(l,r)&&(e[l]=r)}return e}function re(){const e={};for(const[n,t]of o)e[n]=t;return e}function ie(){const n=e.virtualizer.getScrollTop(),t=e.virtualizer.getViewportHeight(),o=e.virtualizer.getTotalHeight()-t-n;if(o<=2)return{type:"bottom",distanceFromBottomPx:Math.max(0,o)};const l=_();for(let a=0;a<l.length;a++){const t=T(l[a],a),o=e.virtualizer.getItemOffset(t),r=e.virtualizer.getItemSize(t);if(n>=o&&n<o+r)return{type:"item",itemKey:t,offsetWithinItemPx:n-o}}const r=e.virtualizer.getVisibleRange(),i=l[r.start];return i?{type:"item",itemKey:T(i,r.start),offsetWithinItemPx:0}:void 0}function ae(i){var a;if(!i)return n.clear(),t.clear(),o.clear(),l.clear(),void r.clear();(function(o){var l,r;if(n.clear(),t.clear(),function(e){var n,t;return(null!=(n=e.measurementKey)?n:"")===(null!=(t=H())?t:"")}(o))for(const[i,a]of Object.entries(null!=(l=o.itemHeights)?l:{})){const l=q(a),u=null==(r=o.itemSizeSources)?void 0:r[i];null!=l&&F(i,u)&&(n.set(i,l),t.set(i,u),e.virtualizer.setItemSize(i,l))}})(i),function(e){o.clear(),l.clear(),r.clear();for(const[n,t]of Object.entries(e))o.set(n,t),D(n,t,{trustImportedState:!0})}(null!=(a=i.markdownStates)?a:{})}function ue(n){if(!n)return;if("bottom"===n.type){const t=Math.max(0,e.virtualizer.getTotalHeight()-e.virtualizer.getViewportHeight()-n.distanceFromBottomPx);return void e.virtualizer.scrollToOffset(t)}const t=Math.max(0,e.virtualizer.getItemOffset(n.itemKey)+n.offsetWithinItemPx);e.virtualizer.scrollToOffset(t)}function se(e,n){e===h&&ue(n)}function ce(e){e===h&&(d.value=!1,ee(),se(e,m),m=void 0,g=0)}function de(){X(),B(w),x=!1,w=null,N=void 0,B(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 ke()&&J(de),{itemHeights:n,markdownStates:o,getItemKey:T,isMarkdownItem:O,isRestoringThread:()=>d.value,measureItem:function(n,t,o){var l,r;const i=T(n,t),a=function(e){const n=e&&"$el"in e?e.$el:e;return n instanceof HTMLElement?n:null}(o),u=s.get(i);if(!a)return void Z(i);if(u===a)return void ne(i);if(Z(i),s.set(i,a),null==(r=(l=e.virtualizer).measureElement)||r.call(l,i,a),ne(i),"undefined"==typeof ResizeObserver)return;const d=new ResizeObserver(()=>{var n,t;null==(t=(n=e.virtualizer).measureElement)||t.call(n,i,a),ne(i)});d.observe(a),c.set(i,d)},markdownProps:function(n,t){const l=T(n,t),r=mu(n,t,e),a=I(),u=fu(n,t,e),s=L(n,t),c=R(),d=A(),f=$(),m=[l,s,r?"final":"live",c,d,f,!0===e.markdownFade?"fade":"no-fade"].join(":"),h=we(o).get(l),v=i.get(m);if(v&&v.content===u)return v.virtualScroll&&(v.virtualScroll.restoreState=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,renderCodeBlocksAsPre:f,nodeVirtual:!!r&&"auto",maxLiveNodes:r?50:void 0,liveNodeBuffer:r?16:void 0,fade:!0===e.markdownFade,indexKey:s,virtualScroll:p,onHeightChange(e){if(e.sessionKey!==L(n,t))return;j(l,e.totalHeight,{sessionKey:e.sessionKey,threadKey:a,measurementKey:R()});const o=function(e){return"final"===e.phase||!(!0!==e.final||!su(e.confidence))||!!e.stable&&(su(e.confidence)||function(e){var n,t,o,l;const r=Number(e.nodeCount),i=Number(e.measuredCount),a=Math.max(0,Number(null!=(t=null==(n=e.liveRange)?void 0:n.start)?t:0)),u=Math.min(r,Math.max(a,Number(null!=(l=null==(o=e.liveRange)?void 0:o.end)?l:0))),s=Math.max(0,u-a);return!0===e.final&&!0===e.stable&&"mixed"===e.confidence&&r>0&&i>0&&i<r&&(s<=0||i>=s)}(e))}(e),r=Math.ceil(e.totalHeight);var i,u;i=l,u={allowMarkdownShrink:o,logicalHeight:r},k.set(i,u),b||(b=!0,S=C(Q))},onVirtualStateChange(e){e.sessionKey===L(n,t)&&(o.set(l,e),p.restoreState=e,D(l,e))}};return i.set(m,g),g},captureThreadState:function(){ee();const e=H();return u(a({threadKey:I()},null==e?{}:{measurementKey:e}),{outerAnchor:ie(),itemHeights:te(),itemSizeSources:oe(),markdownStates:re()})},preloadThreadState:ae,restoreThreadState:function(e){const n=++h,t=null==e?void 0:e.outerAnchor;if(X(),d.value=Boolean(t),g=n,m=t,ae(e),!t)return d.value=!1,m=void 0,void(g=0);se(n,t),le(()=>{se(n,t),"function"==typeof requestAnimationFrame&&(v=requestAnimationFrame(()=>{v=null,se(n,t)})),"undefined"!=typeof window?f.forEach((e,o)=>{const l=window.setTimeout(()=>{se(n,t),o===f.length-1&&ce(n)},e);p.push(l)}):ce(n)})},dispose:de}}const yu=/* @__PURE__ */Symbol("markstreamLanguageIconResolver");function ku(e){return re(e)}const Nu=ku(()=>import("./index3.js")),bu=ku(()=>import("./index5.js")),Su=ku(()=>import("./index6.js")),xu=ku(()=>import("./index10.js")),wu=ku(()=>import("./index9.js")),Mu=ku(()=>import("./index7.js")),Cu=ku(()=>import("./index4.js")),Bu=ku(()=>import("./index8.js")),_u={MarkdownRender:Ba,NodeRenderer:Ba,AdmonitionNode:Ra,BlockquoteNode:Mo,CheckboxNode:on,CodeBlockNode:Nu,DefinitionListNode:Io,EmojiNode:rn,EmphasisNode:vo,FootnoteNode:Ao,FootnoteReferenceNode:sn,FootnoteAnchorNode:Oo,HardBreakNode:go,HeadingNode:Po,HtmlBlockNode:Uo,HtmlInlineNode:Sn,HighlightNode:mo,ImageNode:mt,D2BlockNode:Mu,InfographicBlockNode:wu,InlineCodeNode:Mn,PreCodeNode:At,InsertNode:co,LinkNode:uo,ListItemNode:Wo,ListNode:jo,MathBlockNode:bu,MathInlineNode:Su,MermaidBlockNode:xu,ParagraphNode:Jo,StrikethroughNode:oo,StrongNode:no,SubscriptNode:Qt,SuperscriptNode:Yt,TableNode:ll,TextNode:zt,ThematicBreakNode:il,VmrContainerNode:sl,ReferenceNode:Xt,MarkstreamVirtualTimeline:Bu,Tooltip:Cu},Iu={install(e,n){var t,o;Object.entries(_u).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.iconTheme)&&Oe(n.iconTheme),n&&"languageIconResolver"in n&&e.provide(yu,null!=(t=n.languageIconResolver)?t:null),(null==n?void 0:n.getLanguageIcon)&&Le(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&A(n.mathOptions),n&&"infographicLoader"in n&&Qa(null!=(o=n.infographicLoader)?o:null),(null==n?void 0:n.defaultI18nMap)&&e.provide(Dn,n.defaultI18nMap),(null==n?void 0:n.components)&&e.provide(je,function(e={}){return $(Ue(e))}(n.components))}};export{ou as $,Ra as A,Mo as B,on as C,Mu as D,rn as E,Oo as F,tn as G,go as H,mt as I,At as J,Ao as K,uo as L,yu as M,Ze as N,qa as O,Jo as P,nu as Q,Xt as R,oo as S,ll as T,Va as U,sl as V,eu as W,pu as X,Xe as Y,Ga as Z,Po as _,Nu as a,uu as a0,fu as a1,mu as a2,cu as a3,du as a4,hu as a5,Wn as a6,Ua as a7,Nt as a8,tu as a9,vu as aa,Rt as ab,au as ac,Ye as ad,bt as ae,pt as af,gt as ag,rt as ah,$t as ai,Kt as aj,Ge as ak,Da as al,Vn as am,Qa as an,zn as ao,gu as ap,yi as aq,tt as ar,Xn as as,da as at,lt as au,nt as av,Pt as b,Et as c,Io as d,vo as e,sn as f,mo as g,Uo as h,Sn as i,wu as j,Mn as k,co as l,Wo as m,jo as n,Bu as o,bu as p,Su as q,xu as r,no as s,Qt as t,Yt as u,zt as v,il as w,Cu as x,Iu as y,Ba as z};
|