markstream-vue 0.0.10-beta.6 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index3.js +1 -1
- package/dist/tailwind.ts +0 -0
- package/dist/types/components/ParagraphNode/ParagraphNode.vue.d.ts +1 -0
- package/dist/types/utils/htmlRenderer.d.ts +3 -24
- package/package.json +2 -2
package/dist/exports.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),d=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{DANGEROUS_HTML_ATTRS as c,URL_HTML_ATTRS as m,isUnsafeHtmlUrl as h,VOID_HTML_TAGS as f,EXTENDED_STANDARD_HTML_TAGS as p,BLOCKED_HTML_TAGS as v,getMarkdown as g,parseMarkdownToStructure as y,setDefaultMathOptions as w}from"stream-markdown-parser";import{defineComponent as k,openBlock as x,createElementBlock as b,createVNode as L,unref as M,createElementVNode as _,Fragment as N,renderList as A,toDisplayString as S,shallowRef as B,h as C,computed as T,normalizeClass as E,useAttrs as I,inject as $,ref as W,watch as O,createCommentVNode as H,nextTick as j,onBeforeUnmount as P,createBlock as R,Teleport as z,Transition as D,withCtx as K,withDirectives as F,normalizeStyle as V,vShow as U,createApp as X,renderSlot as q,readonly as G,defineAsyncComponent as Y,resolveDynamicComponent as J,mergeProps as Z,provide as Q,createTextVNode as ee,onMounted as ne,reactive as te,markRaw as oe}from"vue";import{autoUpdate as le,offset as re,flip as ie,shift as ae,computePosition as se}from"@floating-ui/dom";const ue=["cite"],de=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},ce=/* @__PURE__ */de(/* @__PURE__ */k({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(x(),b("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[L(M(dr),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,ue))}}),[["__scopeId","data-v-6d8bbd17"]]);ce.install=e=>{e.component(ce.__name,ce)};const me={class:"checkbox-node"},he=["checked"],fe=/* @__PURE__ */de(/* @__PURE__ */k({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(x(),b("span",me,[_("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,he)]))}),[["__scopeId","data-v-8dc6c46f"]]);fe.install=e=>{e.component(fe.__name,fe)};const pe={class:"definition-list"},ve={class:"definition-term"},ge={class:"definition-desc"},ye=/* @__PURE__ */de(/* @__PURE__ */k({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(x(),b("dl",pe,[(x(!0),b(N,null,A(n.node.items,(o,l)=>(x(),b(N,{key:l},[_("dt",ve,[L(M(dr),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),_("dd",ge,[L(M(dr),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-f88691d6"]]);ye.install=e=>{e.component(ye.__name,ye)};const we={class:"emoji-node"},ke=/* @__PURE__ */de(/* @__PURE__ */k({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(x(),b("span",we,S(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ke.install=e=>{e.component(ke.__name,ke)};const xe="__global__",be="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Le=(()=>{const e=globalThis;if(e[be])return e[be];const n={scopedCustomComponents:{},revision:B(0)};return e[be]=n,n})(),Me=Le.revision;function _e(e,n){"string"==typeof e?Le.scopedCustomComponents[e]=n||{}:Le.scopedCustomComponents[xe]=e||{},Me.value++}function Ne(e){const n=Le.scopedCustomComponents[xe]||{};if(!e)return n;const t=Le.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ae(e){if(e===xe)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete Le.scopedCustomComponents[e],Me.value++}function Se(){delete Le.scopedCustomComponents[xe],Me.value++}const Be=["id"],Ce=["title"],Te=/* @__PURE__ */de(/* @__PURE__ */k({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(x(),b("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[_("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+S(e.node.id)+"]",9,Ce)],8,Be))}}),[["__scopeId","data-v-01af0fee"]]);Te.install=e=>{e.component(Te.__name,Te)};const Ee=/<([a-z][a-z0-9-]*)\b[^>]*>/gi,Ie=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function $e(e){Ie&&console.warn(e)}function We(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function Oe(e,n){const t=e.toLowerCase();return!p.has(t)&&(We(n,t)||We(n,e))}function He(e){const n={};for(const[t,o]of Object.entries(e)){const e=t.toLowerCase();c.has(e)||m.has(e)&&o&&h(o)||(n[t]=o)}return n}function je(e,n){const t=n.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(t))return"true"===e||""===e||e===n;if(["value","min","max","step","width","height","size","maxlength"].includes(t)){const n=Number(e);if(""!==e&&!Number.isNaN(n))return n}return e}function Pe(e){return e.trim().length>0}function Re(e,n,t,o,l){if(v.has(e.toLowerCase()))return null;const r=He(n),i=r.key,u=null!=i&&""!==i?i:l;if(Oe(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){const n={};for(const[t,o]of Object.entries(e))n[t]=je(o,t);return n}(r);return C(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return C(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function ze(e,n){if(!e||!e.includes("<"))return!1;if(!n||0===Object.keys(n).length)return!1;let t;for(Ee.lastIndex=0;null!==(t=Ee.exec(e));)if(Oe(t[1],n))return!0;return!1}function De(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],l=[];for(const r of e)if("text"===r.type)(o.length>0?o[o.length-1].children:l).push(r.content);else if("self_closing"===r.type){const e=Re(r.tagName,r.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:l;null!=e&&i.push(e)}else if("tag_open"===r.type)o.push({tagName:r.tagName,children:[],attrs:r.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===r.type){const e=r.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const r=o.pop(),i=Re(r.tagName,r.attrs||{},r.children,n,r.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&l.push(i),r.tagName.toLowerCase()!==e&&o.length>t&&$e(`Auto-closing unclosed tag: <${r.tagName}>`)}else $e(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=Re(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&l.push(t),$e(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(function(e){var n,t,o;const l=[];let r=0;for(;r<e.length;){if(e.startsWith("\x3c!--",r)){const n=e.indexOf("--\x3e",r);if(-1!==n){r=n+3;continue}break}const i=e.indexOf("<",r);if(-1===i){if(r<e.length){const n=e.slice(r);Pe(n)&&l.push({type:"text",content:n})}break}if(i>r){const n=e.slice(r,i);Pe(n)&&l.push({type:"text",content:n})}if(e.startsWith("![CDATA[",i+1)){const n=e.indexOf("]]>",i);if(-1!==n){l.push({type:"text",content:e.slice(i,n+3)}),r=n+3;continue}break}if(e.startsWith("!",i+1)){const n=e.indexOf(">",i);if(-1!==n){r=n+1;continue}break}const a=e.indexOf(">",i);if(-1===a)break;const s=e.slice(i+1,a).trim(),u=s.startsWith("/"),d=s.endsWith("/");if(u){const e=s.slice(1).trim();l.push({type:"tag_close",tagName:e})}else{const e=s.indexOf(" ");let r,i="";-1===e?r=d?s.slice(0,-1).trim():s.trim():(r=s.slice(0,e).trim(),i=s.slice(e+1));const a={};if(i){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let l;for(;null!==(l=e.exec(i));){const e=l[1],r=null!=(o=null!=(t=null!=(n=l[2])?n:l[3])?t:l[4])?o:"";e&&!e.endsWith("/")&&(a[e]=r)}}l.push({type:d||f.has(r.toLowerCase())?"self_closing":"tag_open",tagName:r,attrs:a})}r=a+1}return l}(e),n);return t}catch(o){return t=o,Ie&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Ke=["innerHTML"],Fe=/* @__PURE__ */de(/* @__PURE__ */k({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=T(()=>(Me.value,Ne(n.customId))),o=k({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=T(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=De(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!ze(e,t.value))return{mode:"html",content:e};const o=De(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(x(),b("span",{key:0,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[L(M(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(x(),b("span",{key:1,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},S(l.value.content),3)):(x(),b("span",{key:2,class:E(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,Ke))}}),[["__scopeId","data-v-71cd1a9f"]]);Fe.install=e=>{e.component(Fe.__name,Fe)};const Ve={class:"inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']"},Ue={key:0},Xe=/* @__PURE__ */de(/* @__PURE__ */k({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=I(),o=$("markstreamTypewriter",void 0),l=$("markstreamTextStreamState",void 0),r=T(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=T(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=T(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=W(n.node.code),u=W(""),d=W(0);function c(){return s.value+u.value}function m(e){s.value=e,u.value=""}function h(){u.value&&(s.value=c(),u.value="")}O([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,h=null!=r?r:t;return i.value?n===h?(m(n),void(o&&(null==l||l.set(o,n)))):h&&n.startsWith(h)&&n.length>h.length?(s.value=h,u.value=n.slice(h.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),O(i,e=>{e||m(c())});const f=T(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(x(),b("code",Ve,[s.value?(x(),b("span",Ue,S(s.value),1)):H("",!0),u.value?(x(),b("span",{key:1,class:E(["inline-code-stream-delta",[f.value]]),onAnimationend:h},S(u.value),35)):H("",!0)]))}}),[["__scopeId","data-v-ffb68151"]]);Xe.install=e=>{e.component(Xe.__name,Xe)};const qe={class:"markstream-vue"},Ge=["id"],Ye=/* @__PURE__ */de(/* @__PURE__ */k({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){const n=e,t=T(()=>{if(void 0!==n.isDark&&null!==n.isDark)return Boolean(n.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(e){}return!1}),o=W(null),l=W({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),r=W(!1);let i=null;function a(){return d(this,null,function*(){var e,t;if(!n.anchorEl||!o.value)return;const r=[re(null!=(e=n.offset)?e:8),ie(),ae({padding:8})],{x:i,y:a}=yield se(n.anchorEl,o.value,{placement:null!=(t=n.placement)?t:"top",middleware:r,strategy:"fixed"});l.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,l.value.left="0px",l.value.top="0px"})}return O(()=>n.visible,e=>d(null,null,function*(){if(e)if(r.value=!1,yield j(),n.anchorEl&&o.value)try{const e=n.anchorEl.getBoundingClientRect();yield a();const t=l.value.transform;if(null!=n.originX&&null!=n.originY){const o=Math.abs(Number(n.originX)-e.left),i=Math.abs(Number(n.originY)-e.top);Math.hypot(o,i)>120?(l.value.transform=`translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`,yield j(),r.value=!0,yield j(),l.value.transform=t):r.value=!0}else r.value=!0;i=le(n.anchorEl,o.value,a)}catch(t){yield a(),r.value=!0,i=le(n.anchorEl,o.value,a)}else r.value=!0;else r.value=!1,i&&(i(),i=null)})),O([()=>n.anchorEl,()=>n.placement,()=>n.content],()=>d(null,null,function*(){n.visible&&n.anchorEl&&o.value&&(yield j(),yield a())})),P(()=>{i&&i()}),(i,a)=>(x(),R(z,{to:"body"},[_("div",qe,[L(D,{name:"tooltip",appear:""},{default:K(()=>[F(_("div",{id:n.id,ref_key:"tooltip",ref:o,style:V({position:"fixed",left:l.value.left,top:l.value.top,transform:l.value.transform}),class:E(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",[t.value?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"]]),role:"tooltip"},S(e.content),15,Ge),[[U,e.visible&&r.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),Je=W(!1),Ze=W(""),Qe=W("top"),en=W(null),nn=W(null),tn=W(null),on=W(null),ln=W(null);let rn=null,an=null;function sn(){rn&&(clearTimeout(rn),rn=null),an&&(clearTimeout(an),an=null)}let un=!1;function dn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!un&&"undefined"!=typeof document)try{un=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),X({setup:()=>()=>{var e;return C(Ye,{visible:Je.value,"anchor-el":en.value,content:Ze.value,placement:Qe.value,id:nn.value,originX:tn.value,originY:on.value,isDark:null!=(e=ln.value)?e:void 0})}}).mount(e)}catch(e){un=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),sn();const i=()=>{var o,i;nn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,en.value=e,Ze.value=n,Qe.value=t,tn.value=null!=(o=null==l?void 0:l.x)?o:null,on.value=null!=(i=null==l?void 0:l.y)?i:null,ln.value="boolean"==typeof r?r:null,Je.value=!0;try{e.setAttribute("aria-describedby",nn.value)}catch(a){}};o?i():rn=setTimeout(i,80)}function cn(e=!1){sn();const n=()=>{if(en.value&&nn.value)try{en.value.removeAttribute("aria-describedby")}catch(e){}Je.value=!1,en.value=null,nn.value=null,tn.value=null,on.value=null};e?n():an=setTimeout(n,120)}const mn={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function hn(e){Object.assign(mn,e)}function fn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return d(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=mn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}const pn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],vn={key:"placeholder",class:"placeholder-layer placeholder-layer--inline inline-flex items-center justify-center gap-2"},gn={class:"text-sm whitespace-nowrap"},yn={key:1,class:"text-sm text-gray-500"},wn={key:"error",class:"image-node__error image-node__error--inline px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},kn={class:"text-sm whitespace-nowrap"},xn=/* @__PURE__ */de(/* @__PURE__ */k({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=W(!1),r=W(!1),i=W(!1),a=T(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=T(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:m}=fn();return O(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(x(),R(D,{name:"img-switch",mode:"out-in"},{default:K(()=>{var i,h,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?H("",!0):(x(),b("span",wn,[q(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[_("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),_("span",kn,S(M(m)("image.loadError")),1)],!0)])):(x(),b("span",vn,[t.usePlaceholder?q(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=_("div",{class:"w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin","aria-hidden":"true"},null,-1)),_("span",gn,S(M(m)("image.loading")),1)],!0):(x(),b("span",yn,S(e.node.raw),1))])):(x(),b("img",{key:"image",src:a.value,alt:String(null!=(h=null!=(i=t.node.alt)?i:t.node.title)?h:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:E(["image-node__img h-auto rounded-lg image-node__img--inline",{"transition-opacity duration-200 ease-in-out":!s.value,"opacity-0":!s.value&&!l.value,"opacity-100":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:M(m)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,pn))]}),_:3}))}}),[["__scopeId","data-v-03adbc6f"]]);xn.install=e=>{e.component(xn.__name,xn)};let bn=null,Ln=!1,Mn=An;function _n(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function Nn(){try{const e=globalThis;return _n(null==e?void 0:e.katex)}catch(e){return null}}function An(){return d(null,null,function*(){const e=Nn();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return _n(n)})}function Sn(e){Mn=e,bn=null,Ln=!1}function Bn(e){Sn(null!=e?e:An)}function Cn(){Sn(null)}function Tn(){return"function"==typeof Mn}function En(){var e;const n=Nn();if(n)return bn=n,bn;if(bn)return bn;const t=Mn;if(!t||t===An)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(bn=null!=(e=_n(n))?e:n,bn):null}catch(o){return null}}function In(){return d(this,null,function*(){var e;const n=Nn();if(n)return bn=n,bn;if(bn)return bn;if(Ln)return null;const t=Mn;if(!t)return Ln=!0,null;try{const n=yield t();if(n)return bn=null!=(e=_n(n))?e:n,bn}catch(o){}return Ln=!0,null})}const $n=B(!1);let Wn=null;const On={key:0},Hn=/* @__PURE__ */de(/* @__PURE__ */k({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(Wn||(Wn=In().then(e=>{$n.value=!!e}).catch(()=>{$n.value=!1})),G($n)),o=I(),l=$("markstreamTypewriter",void 0),r=$("markstreamTextStreamState",void 0),i=$("markstreamStreamVersion",void 0),a=T(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=T(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=T(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=W(n.node.content),c=W(""),m=W(0);function h(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=h(),c.value="")}O([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=h(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),m.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),O(s,e=>{e||f(h())});const v=T(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(x(),b("span",{class:E([[M(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(x(),b("span",On,S(d.value),1)):H("",!0),c.value?(x(),b("span",{key:1,class:E(["text-node-stream-delta",[v.value]]),onAnimationend:p},S(c.value),35)):H("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Hn.install=e=>{e.component(Hn.__name,Hn)};const jn=Y(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return C(Hn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield In())return(yield import("./index2.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var n,t,o,l;return C(Hn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Pn=Y(()=>d(null,null,function*(){try{if(yield In())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t,o,l;return C(Hn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),Rn=/* @__PURE__ */k({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(x(),b("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",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))},S(e.node.id),33))});Rn.install=e=>{e.component(Rn.__name,Rn)};const zn={class:"superscript-node"},Dn={key:1},Kn=/* @__PURE__ */de(/* @__PURE__ */k({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,emphasis:at,footnote_reference:Te,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,emoji:ke,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("sup",zn,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),b(N,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(x(),R(J(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(x(),b("span",Dn,S(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Kn.install=e=>{e.component(Kn.__name,Kn)};const Fn={class:"subscript-node"},Vn={key:1},Un=/* @__PURE__ */de(/* @__PURE__ */k({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,emphasis:at,footnote_reference:Te,strikethrough:Yn,highlight:rt,insert:ot,superscript:Kn,emoji:ke,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("sub",Fn,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),b(N,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(x(),R(J(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(x(),b("span",Vn,S(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Un.install=e=>{e.component(Un.__name,Un)};const Xn={class:"strong-node"},qn=/* @__PURE__ */de(/* @__PURE__ */k({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,emphasis:at,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,superscript:Kn,emoji:ke,footnote_reference:Te,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("strong",Xn,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);qn.install=e=>{e.component(qn.__name,qn)};const Gn={class:"strikethrough-node"},Yn=/* @__PURE__ */de(/* @__PURE__ */k({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,emphasis:at,highlight:rt,insert:ot,subscript:Un,superscript:Kn,emoji:ke,footnote_reference:Te,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("del",Gn,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);Yn.install=e=>{e.component(Yn.__name,Yn)};const Jn=["href","title","aria-label","aria-hidden"],Zn=["aria-hidden"],Qn={class:"link-text-wrapper relative inline-flex"},et={class:"leading-[normal] link-text"},nt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const n=e,t=$("markstreamShowTooltips",void 0),o=T(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=T(()=>{var e,t,o,l,r,i;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",s=null!=(e=n.animationOpacity)?e:.35,u=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(o=n.underlineHeight)?o:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(u),"--underline-duration":`${null!=(l=n.animationDuration)?l:1.6}s`,"--underline-timing":null!=(r=n.animationTiming)?r:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),r={text:Hn,strong:qn,strikethrough:Yn,emphasis:at,image:xn,html_inline:Fe,inline_code:Xe},i=T(()=>(Me.value,Ne(n.customId))),s=I(),u=T(()=>{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 He(l)}),d=T(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&cn()}const m=T(()=>{var e,t,o;const l=null==(e=n.node)?void 0:e.title;return"string"==typeof l&&l.trim().length>0?l:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var u,h;return e.node.loading?(x(),b("span",Z({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},M(s),{style:l.value}),[_("span",Qn,[_("span",et,[L(M(Hn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(h=e.node.text)?h:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=_("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Zn)):(x(),b("a",Z({key:0,class:"link-node",href:e.node.href,title:o.value?"":m.value,"aria-label":`Link: ${m.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(l=n.node)?void 0:l.href)||(null==(r=n.node)?void 0:r.text)||"";dn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(x(!0),b(N,null,A(e.node.children,(t,o)=>(x(),R(J(function(e){return i.value[e.type]||r[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,Jn))}}}),[["__scopeId","data-v-a4831c9e"]]);nt.install=e=>{e.component(nt.__name,nt)};const tt={class:"insert-node"},ot=/* @__PURE__ */de(/* @__PURE__ */k({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,emphasis:at,strikethrough:Yn,highlight:rt,subscript:Un,superscript:Kn,emoji:ke,footnote_reference:Te,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("ins",tt,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"insert"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);ot.install=e=>{e.component(ot.__name,ot)};const lt={class:"highlight-node"},rt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,emphasis:at,strikethrough:Yn,insert:ot,subscript:Un,superscript:Kn,emoji:ke,footnote_reference:Te,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("mark",lt,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-38e31bf6"]]);rt.install=e=>{e.component(rt.__name,rt)};const it={class:"emphasis-node"},at=/* @__PURE__ */de(/* @__PURE__ */k({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,html_inline:Fe,strong:qn,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,superscript:Kn,emoji:ke,footnote_reference:Te,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),b("em",it,[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);at.install=e=>{e.component(at.__name,at)};const st=["href","title"],ut=/* @__PURE__ */de(/* @__PURE__ */k({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(n,o)=>(x(),b("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,st))}}),[["__scopeId","data-v-4756ce0d"]]);ut.install=e=>{e.component(ut.__name,ut)};const dt=["id"],ct={class:"flex-1"},mt=/* @__PURE__ */k({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(x(),b("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[_("div",ct,[L(M(dr),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,dt))}});mt.install=e=>{e.component(mt.__name,mt)};const ht={class:"hard-break"},ft=/* @__PURE__ */de(/* @__PURE__ */k({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(x(),b("br",ht))}),[["__scopeId","data-v-50c58f70"]]);ft.install=e=>{e.component(ft.__name,ft)};const pt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId),o=a({text:Hn,inline_code:Xe,link:nt,image:xn,strong:qn,emphasis:at,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,superscript:Kn,emoji:ke,checkbox:fe,checkbox_input:fe,footnote_reference:Te,hardbreak:ft,math_inline:jn,reference:Rn},t);return(t,l)=>(x(),R(J(`h${e.node.level}`),Z({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:K(()=>[(x(!0),b(N,null,A(e.node.children,(t,l)=>(x(),R(J(o[t.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-ffb7cf51"]]),vt=pt;vt.install=e=>{e.component(pt.__name,pt)};const gt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=T(()=>{var e;return null!=(e=n.node)?e:n.item}),o=T(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return x(),b("li",Z({class:"list-item pl-1.5 my-2",dir:"auto"},o.value),[L(M(dr),Z({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:l[0]||(l[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])],16)}}}),[["__scopeId","data-v-ce59e808"]]);gt.install=e=>{e.component(gt.__name,gt)};const yt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=T(()=>(Me.value,Ne(e.customId).list_item||gt));return(t,o)=>(x(),R(J(e.node.ordered?"ol":"ul"),{class:E(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:K(()=>[(x(!0),b(N,null,A(e.node.items,(l,r)=>{var i;return x(),R(J(n.value),Z({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-8e81cbc8"]]);yt.install=e=>{e.component(yt.__name,yt)};const wt=/* @__PURE__ */Symbol("ViewportPriority");function kt(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?W(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let m=null;function h(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),h()}}function p(){i&&null==m&&c.size&&(m=i(()=>{m=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=W(!1);let i,a=!1;const m=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),h()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:m,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v})};return Q(wt,v),v}function xt(){var e,n;const t=$(wt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=W(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},m=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return m?(o.set(e,{resolve:t,visible:n}),m.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const bt={key:1,class:"html-block-node__raw"},Lt=["innerHTML"],Mt={key:1,class:"html-block-node__placeholder"},_t=/* @__PURE__ */de(/* @__PURE__ */k({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=T(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=T(()=>(Me.value,Ne(n.customId))),l=k({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=W(null),i=W("undefined"==typeof window),a=W(n.node.content),s=T(()=>{var e,t,l;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const r=null!=(t=a.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=De(r,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!ze(r,o.value))return{mode:"html",content:r};const s=De(r,o.value);return null===s?{mode:"html",content:r}:{mode:"dynamic",nodes:s}}),u=xt(),d=W(null),c=!!n.node.loading;return"undefined"!=typeof window?(O(r,e=>{var t,o;if(null==(o=null==(t=d.value)?void 0:t.destroy)||o.call(t),d.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const l=u(e,{rootMargin:"400px"});d.value=l,i.value=l.isVisible.value,l.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),O(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,P(()=>{var e,n;null==(n=null==(e=d.value)?void 0:e.destroy)||n.call(e),d.value=null}),(n,o)=>(x(),b("div",Z({ref_key:"htmlRef",ref:r,class:"html-block-node"},t.value),[i.value?(x(),b(N,{key:0},["dynamic"===s.value.mode?(x(),R(M(l),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(x(),b("pre",bt,S(s.value.content),1)):(x(),b("div",{key:2,innerHTML:a.value},null,8,Lt))],64)):(x(),b("div",Mt,[q(n.$slots,"placeholder",{node:e.node},()=>[o[0]||(o[0]=_("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[1]||(o[1]=_("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[2]||(o[2]=_("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-b7cace40"]]);_t.install=e=>{e.component(_t.__name,_t)};const Nt={dir:"auto",class:"paragraph-node"},At=/* @__PURE__ */de(/* @__PURE__ */k({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ne(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=T(()=>n.node.children.filter(e=>!o(e))),i=T(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=T(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function d(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId}}const c=a({inline_code:Xe,image:xn,link:nt,hardbreak:ft,emphasis:at,strong:qn,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,superscript:Kn,html_inline:Fe,html_block:_t,emoji:ke,checkbox:fe,math_inline:jn,checkbox_input:fe,reference:Rn,footnote_anchor:ut,footnote_reference:Te,text:Hn},t);return(n,t)=>(x(),b("p",Nt,[(x(!0),b(N,null,A(u.value,(n,t)=>(x(),b(N,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(x(),b(N,{key:0},[ee(S(l(n)),1)],64)):(x(),R(J(c[n.type]),Z({key:1,ref_for:!0},d(n,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-c4fdb7c8"]]);At.install=e=>{e.component(At.__name,At)};const St=["aria-busy","aria-label","data-language"],Bt=["textContent"],Ct=/* @__PURE__ */k({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=T(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=T(()=>`language-${t.value}`),l=T(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(x(),b("pre",{class:E([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[_("code",{translate:"no",textContent:S(e.node.code)},null,8,Bt)],10,St))}});Ct.install=e=>{e.component(Ct.__name,Ct)};const Tt={class:"table-node-wrapper"},Et=["aria-busy"],It={class:"border-[var(--table-border,#cbd5e1)]"},$t={class:"border-b"},Wt={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Ot=/* @__PURE__ */de(/* @__PURE__ */k({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=T(()=>{var e;return null!=(e=n.node.loading)&&e}),o=T(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(l,r)=>(x(),b("div",Tt,[_("table",{class:E(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[_("thead",It,[_("tr",$t,[(x(!0),b(N,null,A(e.node.header.cells,(e,t)=>(x(),b("th",{key:`header-${t}`,dir:"auto",class:E(["font-semibold p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]])},[L(M(dr),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[0]||(r[0]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),_("tbody",null,[(x(!0),b(N,null,A(o.value,(e,t)=>(x(),b("tr",{key:`row-${t}`,class:E(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(x(!0),b(N,null,A(e.cells,(e,o)=>(x(),b("td",{key:`cell-${t}-${o}`,class:E(["p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]]),dir:"auto"},[L(M(dr),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[1]||(r[1]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))],2))),128))])],10,Et),L(D,{name:"table-node-fade"},{default:K(()=>[t.value?(x(),b("div",Wt,[q(l.$slots,"loading",{isLoading:t.value},()=>[r[2]||(r[2]=_("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),r[3]||(r[3]=_("span",{class:"sr-only"},"Loading",-1))],!0)])):H("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);Ot.install=e=>{e.component(Ot.__name,Ot)};const Ht={class:"hr-node"},jt=/* @__PURE__ */de({},[["render",function(e,n){return x(),b("hr",Ht)}],["__scopeId","data-v-639cbad9"]]);jt.install=e=>{e.component(jt.__name,jt)};const Pt={class:"unknown-node"},Rt=/* @__PURE__ */k({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(x(),b("div",Pt,S(e.node.raw),1))}),zt=/* @__PURE__ */de(/* @__PURE__ */k({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=T(()=>`vmr-container vmr-container-${n.node.name}`),o=Ne(n.customId),l=a({text:Hn,paragraph:At,heading:vt,inline_code:Xe,link:nt,image:xn,strong:qn,emphasis:at,strikethrough:Yn,insert:ot,subscript:Un,superscript:Kn,checkbox:fe,checkbox_input:fe,hardbreak:ft,math_inline:jn,reference:Rn,list:yt,math_block:Pn,table:Ot},o);return(o,r)=>(x(),b("div",Z({class:t.value},e.node.attrs),[(x(!0),b(N,null,A(e.node.children,(t,o)=>{return x(),R(J((r=t.type,l[r]||Rt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]);var r}),128))],16))}}),[["__scopeId","data-v-a88d22ce"]]);zt.install=e=>{e.component(zt.__name,zt)};const Dt=["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","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","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","ON","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"],Kt=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"];function Ft(e){return e<=255?Dt[e]:1424<=e&&e<=1524?"R":1536<=e&&e<=1791?Kt[255&e]:1792<=e&&e<=2220?"AL":"L"}const Vt=/[ \t\n\r\f]+/g,Ut=/[\t\n\r\f]| {2,}|^ | $/;let Xt=null;const qt=new RegExp("\\p{Script=Arabic}","u"),Gt=new RegExp("\\p{M}","u"),Yt=new RegExp("\\p{Nd}","u");function Jt(e){return qt.test(e)}function Zt(e){for(const n of e){const e=n.codePointAt(0);if(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>=196608&&e<=201551||e>=63744&&e<=64255||e>=194560&&e<=195103||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519)return!0}return!1}const Qt=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),eo=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),no=/* @__PURE__ */new Set(["'","’"]),to=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),oo=/* @__PURE__ */new Set([":",".","،","؛"]),lo=/* @__PURE__ */new Set(["၏"]),ro=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function io(e){if(uo(e))return!0;let n=!1;for(const t of e)if(to.has(t))n=!0;else if(!n||!Gt.test(t))return!1;return n}function ao(e){for(const n of e)if(!Qt.has(n)&&!to.has(n))return!1;return e.length>0}function so(e){if(uo(e))return!0;for(const n of e)if(!eo.has(n)&&!no.has(n)&&!Gt.test(n))return!1;return e.length>0}function uo(e){let n=!1;for(const t of e)if("\\"!==t&&!Gt.test(t)){if(!(eo.has(t)||to.has(t)||no.has(t)))return!1;n=!0}return n}function co(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Gt.test(e))t--;else{if(!eo.has(e)&&!no.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function mo(e,n){if(0===e.length)return!1;for(const t of e)if(t!==n)return!1;return!0}function ho(e){return!(!Jt(e)||0===e.length)&&oo.has(e[e.length-1])}function fo(e){return 0!==e.length&&lo.has(e[e.length-1])}function po(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 vo(e){for(let n=e.length-1;n>=0;n--){const t=e[n];if(ro.has(t))return!0;if(!to.has(t))return!1}return!1}function go(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"}function yo(e,n,t,o){const l=[];let r=null,i="",a=t,s=!1,u=0;for(const d of e){const e=go(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),r=e,i=d,a=t+u,s=c,u+=d.length):(i+=d,u+=d.length)}return null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),l}function wo(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const ko=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function xo(e,n){const t=e.texts[n];return!!t.startsWith("www.")||ko.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function bo(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Lo=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),Mo=/^[A-Za-z0-9_]+[,:;]*$/,_o=/[,:;]+$/;function No(e){for(const n of e)if(Yt.test(n))return!0;return!1}function Ao(e){if(0===e.length)return!1;for(const n of e)if(!Yt.test(n)&&!Lo.has(n))return!1;return!0}function So(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 Bo(e,n,t="normal"){const o=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),l="pre-wrap"===o.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!Ut.test(e))return e;let n=e.replace(Vt," ");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===l.length)return{normalized:l,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=function(e,n,t){var o;const l=(null===Xt&&(Xt=new Intl.Segmenter(void 0,{granularity:"word"})),Xt);let r=0;const i=[],a=[],s=[],u=[];for(const m of l.segment(e))for(const e of yo(m.segment,null!=(o=m.isWordLike)&&o,m.index,t)){const t="text"===e.kind;n.carryCJKAfterClosingQuote&&t&&r>0&&"text"===s[r-1]&&Zt(e.text)&&Zt(i[r-1])&&vo(i[r-1])||t&&r>0&&"text"===s[r-1]&&ao(e.text)&&Zt(i[r-1])||t&&r>0&&"text"===s[r-1]&&fo(i[r-1])?(i[r-1]+=e.text,a[r-1]=a[r-1]||e.isWordLike):t&&r>0&&"text"===s[r-1]&&e.isWordLike&&Jt(e.text)&&ho(i[r-1])?(i[r-1]+=e.text,a[r-1]=!0):t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&1===e.text.length&&"-"!==e.text&&"—"!==e.text&&mo(i[r-1],e.text)||t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&(io(e.text)||"-"===e.text&&a[r-1])?i[r-1]+=e.text:(i[r]=e.text,a[r]=e.isWordLike,s[r]=e.kind,u[r]=e.start,r++)}for(let m=1;m<r;m++)"text"===s[m]&&!a[m]&&uo(i[m])&&"text"===s[m-1]&&(i[m-1]+=i[m],a[m-1]=a[m-1]||a[m],i[m]="");for(let m=r-2;m>=0;m--)if("text"===s[m]&&!a[m]&&so(i[m])){let e=m+1;for(;e<r&&""===i[e];)e++;e<r&&"text"===s[e]&&(i[e]=i[m]+i[e],u[e]=u[m],i[m]="")}let d=0;for(let m=0;m<r;m++){const e=i[m];0!==e.length&&(d!==m&&(i[d]=e,a[d]=a[m],s[d]=s[m],u[d]=u[m]),d++)}i.length=d,a.length=d,s.length=d,u.length=d;const c=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(!Zt(n[r])||!Zt(n[r+1]))continue;const e=co(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&Mo.test(i)){let a=i,s=r+1;for(;_o.test(a)&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&Mo.test(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&No(n)&&Ao(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&Ao(i)&&No(i)){let a=i,s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&Ao(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!bo(i))continue;const a=r+1;if(a>=e.len||wo(e.kinds[a]))continue;let s="";const u=e.starts[a];let d=a;for(;d<e.len&&!wo(e.kinds[d]);)s+=e.texts[d],d++;s.length>0&&(n.push(s),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!xo(e,i))continue;let l=i+1;for(;l<e.len&&!wo(o[l]);){n[i]+=n[l],t[i]=!0;const e=n[l].includes("?");if(o[l]="text",n[l]="",l++,e)break}}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;){let i=e.texts[r],a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){let d=i;const c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d+=e.texts[r],r++;if(!(r<e.len&&"text"===e.kinds[r])){n.push(d),t.push(!1),o.push("glue"),l.push(c);continue}i=d+e.texts[r],a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){let n="";for(;r<e.len&&"glue"===e.kinds[r];)n+=e.texts[r],r++;r<e.len&&"text"===e.kinds[r]?(i+=n+e.texts[r],a=a||e.isWordLike[r],r++):i+=n}n.push(i),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:d,texts:i,isWordLike:a,kinds:s,starts:u})))))));for(let m=0;m<c.len-1;m++){const e=po(c.texts[m]);null!==e&&("space"!==c.kinds[m]&&"preserved-space"!==c.kinds[m]||"text"!==c.kinds[m+1]||!Jt(c.texts[m+1])||(c.texts[m]=e.space,c.isWordLike[m]=!1,c.kinds[m]="preserved-space"===c.kinds[m]?"preserved-space":"space",c.texts[m+1]=e.marks+c.texts[m+1],c.starts[m+1]=c.starts[m]+e.space.length))}return c}(l,n,o);return a({normalized:l,chunks:So(r,o)},r)}let Co=null;const To=/* @__PURE__ */new Map;let Eo=null;const Io=new RegExp("\\p{Emoji_Presentation}","u"),$o=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Wo=null;const Oo=/* @__PURE__ */new Map;function Ho(){if(null!==Co)return Co;if("undefined"!=typeof OffscreenCanvas)return Co=new OffscreenCanvas(1,1).getContext("2d"),Co;if("undefined"!=typeof document)return Co=document.createElement("canvas").getContext("2d"),Co;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function jo(e,n){let t=n.get(e);return void 0===t&&(t={width:Ho().measureText(e).width,containsCJK:Zt(e)},n.set(e,t)),t}function Po(){if(null!==Eo)return Eo;if("undefined"==typeof navigator)return Eo={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Eo;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 Eo={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Eo}function Ro(){return null===Wo&&(Wo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Wo}function zo(e){return Io.test(e)||e.includes("️")}function Do(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=Ro();for(const o of t.segment(e))zo(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Ko(e,n,t,o){if(void 0!==n.graphemeWidths)return n.graphemeWidths;const l=[],r=Ro();for(const i of r.segment(e)){const e=jo(i.segment,t);l.push(Do(i.segment,e,o))}return n.graphemeWidths=l.length>1?l:null,n.graphemeWidths}function Fo(e,n,t,o){if(void 0!==n.graphemePrefixWidths)return n.graphemePrefixWidths;const l=[],r=Ro();let i="";for(const a of r.segment(e)){i+=a.segment;const e=jo(i,t);l.push(Do(i,e,o))}return n.graphemePrefixWidths=l.length>1?l:null,n.graphemePrefixWidths}function Vo(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Uo(e){return"space"===e}function Xo(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function qo(e,n,t,o){return o&&null!==n?n[t]-(t>0?n[t-1]:0):e[t]}function Go(e,n){return e.simpleLineWalkFastPath?function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Po(),a=i.lineFitEpsilon;let s=0,u=0,d=!1;function c(e){var o;const c=t[e];if(c>n&&null!==l[e]){const t=l[e],d=null!=(o=r[e])?o:null;u=0;for(let e=0;e<t.length;e++){const o=qo(t,d,e,i.preferPrefixWidthsForBreakableRuns);u>0&&u+o>n+a?(s++,u=o):(0===u&&s++,u+=o)}}else u=c,s++;d=!0}for(let m=0;m<t.length;m++){const e=t[m],l=o[m];if(!d){c(m);continue}const r=u+e;if(r>n+a){if(Uo(l))continue;u=0,d=!1,c(m)}else u=r}return d?s:s+1}(e,n):function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Po(),a=i.lineFitEpsilon;let s=0,u=0,d=!1,c=0,m=0,h=-1,f=0;function p(e=c,n=m,t=u){s++,u=0,d=!1,h=-1,f=0}function v(e,n){d=!0,c=e+1,m=0,u=n}function g(e,n,t){d=!0,c=e,m=n+1,u=t}function y(e,n){d?(u+=n,c=e+1,m=0):v(e,n)}function w(e,n){Vo(o[e])&&(h=e+1,f=u-n)}function k(e){!function(e,t){var o;const s=l[e],h=null!=(o=r[e])?o:null;for(let l=t;l<s.length;l++){const t=qo(s,h,l,i.preferPrefixWidthsForBreakableRuns);d?u+t>n+a?(p(),g(e,l,t)):(u+=t,c=e,m=l+1):g(e,l,t)}d&&c===e&&m===s.length&&(c=e+1,m=0)}(e,0)}let x=0;for(;x<t.length;){const e=t[x],r=o[x];if(d)if(u+e>n+a){if(Vo(r)){y(x,e),p(x+1,0,u-e),x++;continue}if(h>=0){p(h,0,f);continue}if(e>n&&null!==l[x]){p(),k(x),x++;continue}p()}else y(x,e),w(x,e),x++;else e>n&&null!==l[x]?k(x):v(x,e),w(x,e),x++}return d&&p(),s}(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableWidths:i,breakablePrefixWidths:a,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(0===t.length||0===d.length)return 0;const c=Po(),m=c.lineFitEpsilon;let h=0,f=0,p=!1,v=0,g=0,y=-1,w=0,k=0,x=null;function b(){y=-1,w=0,k=0,x=null}function L(e=v,n=g,t=f){h++,f=0,p=!1,b()}function M(e,n){p=!0,v=e+1,g=0,f=n}function _(e,n,t){p=!0,v=e,g=n+1,f=t}function N(e,n){p?(f+=n,v=e+1,g=0):M(e,n)}function A(e,n){if(!Vo(r[e]))return;const t="tab"===r[e]?0:o[e],i="tab"===r[e]?n:l[e];y=e+1,w=f-n+t,k=f-n+i,x=r[e]}function S(e){B(e,0)}function B(e,t){var o;const l=i[e],r=null!=(o=a[e])?o:null;for(let i=t;i<l.length;i++){const t=qo(l,r,i,c.preferPrefixWidthsForBreakableRuns);p?f+t>n+m?(L(),_(e,i,t)):(f+=t,v=e,g=i+1):_(e,i,t)}p&&v===e&&g===l.length&&(v=e+1,g=0)}function C(e){var t;if("soft-hyphen"!==x)return!1;const o=i[e];if(null===o)return!1;const l=c.preferPrefixWidthsForBreakableRuns&&null!=(t=a[e])?t:o,r=l!==o,{fitCount:u,fittedWidth:d}=function(e,n,t,o,l,r){let i=0,a=n;for(;i<e.length;){const s=r?n+e[i]:a+e[i];if((i+1<e.length?s+l:s)>t+o)break;a=s,i++}return{fitCount:i,fittedWidth:a}}(l,f,n,m,s,r);return 0!==u&&(f=d,v=e,g=u,b(),u===o.length?(v=e+1,g=0,!0):(L(e,u,d+s),B(e,u),!0))}function T(e){h++,b()}for(let E=0;E<d.length;E++){const e=d[E];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,b();let a=e.startSegmentIndex;for(;a<e.endSegmentIndex;){const e=r[a],d="tab"===e?Xo(f,u):t[a];if("soft-hyphen"!==e)if(p){if(f+d>n+m){const t=f+("tab"===e?0:o[a]),r=f+("tab"===e?d:l[a]);if("soft-hyphen"===x&&c.preferEarlySoftHyphenBreak&&w<=n+m){L(y,0,k);continue}if("soft-hyphen"===x&&C(a)){a++;continue}if(Vo(e)&&t<=n+m){N(a,d),L(a+1,0,r),a++;continue}if(y>=0&&w<=n+m){L(y,0,k);continue}if(d>n&&null!==i[a]){L(),S(a),a++;continue}L();continue}N(a,d),A(a,d),a++}else d>n&&null!==i[a]?S(a):M(a,d),A(a,d),a++;else p&&(v=a+1,g=0,y=a+1,w=f+s,k=f+s,x=e),a++}if(p){const n=y===e.consumedEndSegmentIndex?k:f;L(e.consumedEndSegmentIndex,0,n)}}return h}(e,n)}let Yo=null;function Jo(e,n,t){const o=(null===Yo&&(Yo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Yo),l=Po(),{cache:r,emojiCorrection:i}=function(e,n){Ho().font=e;const t=function(e){let n=To.get(e);return n||(n=/* @__PURE__ */new Map,To.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=Oo.get(e);if(void 0!==t)return t;const o=Ho();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 Oo.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,$o.test(a)));var a;const s=Do("-",jo("-",r),i),u=8*Do(" ",jo(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],m=[],h=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=[],y=t?[]:null,w=Array.from({length:e.len}),k=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),m.push(o),h.push(l),null==p||p.push(r),v.push(i),g.push(a),null!==y&&y.push(e)}for(let M=0;M<e.len;M++){w[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],a=e.kinds[M],u=e.starts[M];if("soft-hyphen"===a){x(n,0,s,s,a,u,null,null),k[M]=d.length;continue}if("hard-break"===a){x(n,0,0,0,a,u,null,null),k[M]=d.length;continue}if("tab"===a){x(n,0,0,0,a,u,null,null),k[M]=d.length;continue}const c=jo(n,r);if("text"===a&&c.containsCJK){let e="",t=0;for(const a of o.segment(n)){const n=a.segment;if(0===e.length){e=n,t=a.index;continue}if(eo.has(e)||Qt.has(n)||to.has(n)||l.carryCJKAfterClosingQuote&&Zt(n)&&vo(e)){e+=n;continue}const o=Do(e,jo(e,r),i);x(e,o,o,o,"text",u+t,null,null),e=n,t=a.index}if(e.length>0){const n=Do(e,jo(e,r),i);x(e,n,n,n,"text",u+t,null,null)}k[M]=d.length;continue}const m=Do(n,c,i),h="space"===a||"preserved-space"===a||"zero-width-break"===a?0:m,f="space"===a||"zero-width-break"===a?0:m;t&&n.length>1?x(n,m,h,f,a,u,Ko(n,c,r,i),l.preferPrefixWidthsForBreakableRuns?Fo(n,c,r,i):null):x(n,m,h,f,a,u,null,null),k[M]=d.length}const b=function(e,n,t){var o,l,r;const i=[];for(let a=0;a<e.length;a++){const s=e[a],u=s.startSegmentIndex<n.length?n[s.startSegmentIndex]:null!=(o=t[t.length-1])?o:0,d=s.endSegmentIndex<n.length?n[s.endSegmentIndex]:null!=(l=t[t.length-1])?l:0,c=s.consumedEndSegmentIndex<n.length?n[s.consumedEndSegmentIndex]:null!=(r=t[t.length-1])?r:0;i.push({startSegmentIndex:u,endSegmentIndex:d,consumedEndSegmentIndex:c})}return i}(e.chunks,w,k),L=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=0;for(let u=0;u<n;u++){const n=Ft(e.charCodeAt(u));"R"!==n&&"AL"!==n&&"AN"!==n||o++,t[u]=n}if(0===o)return null;const l=n/o<.3?0:1,r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==y?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b,segments:y}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b}}const Zo="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",Qo=(()=>{const e=globalThis;if(e[Zo])return e[Zo];const n={configs:{},controllers:{},revision:B(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Zo]=n,n})();let el=null;const nl=Qo.revision;function tl(e){var n;return e&&null!=(n=Qo.configs[e])?n:null}function ol(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function ll(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function rl(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!ll(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 il(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=el)return el;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return el=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),el}catch(n){return el=!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=Qo.blockEstimateCache.get(i);if(a)return Qo.blockEstimateCache.delete(i),Qo.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=Qo.preparedCache.get(o);if(l)return Qo.preparedCache.delete(o),Qo.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){return Jo(Bo(e,Po(),null==o?void 0:o.whiteSpace),n,!1)}(e,n,0,t)}(e,n,{whiteSpace:t});for(Qo.preparedCache.set(o,{prepared:r});Qo.preparedCache.size>240;){const e=Qo.preparedCache.keys().next().value;if(!e)break;Qo.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=Go(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),m=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(Qo.blockEstimateCache.set(i,{height:m,contentHeight:Math.round(c)});Qo.blockEstimateCache.size>4e3;){const e=Qo.blockEstimateCache.keys().next().value;if(!e)break;Qo.blockEstimateCache.delete(e)}return{kind:"simple-text",height:m,contentHeight:Math.round(c)}}catch(r){return null}}function al(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=rl(e.children);return o&&t.paragraph?il(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=rl(e.children),r=t.headings[o];return l&&r?il(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=rl(null==(l=r[0])?void 0:l.children);return i?il(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=al(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 sl(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function ul(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function dl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=ol(o.lineHeight,1.5*ol(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:ul(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let cl=!1,ml=null,hl=!1,fl=null;function pl(){return d(this,null,function*(){return ml||fl||(hl?null:(fl=d(null,null,function*(){try{return ml=yield import("stream-monaco"),yield function(e){return d(this,null,function*(){if(cl)return;cl=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(ml),ml}catch(e){return hl=!0,null}finally{fl=null}}),fl))})}function vl({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function gl(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function yl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function wl(e,n){var t,o;let l=0;for(const r of e){const e=yl(gl(r));e>l&&(l=e)}return vl({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const kl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n',xl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',bl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';let Ll=null,Ml=null,_l=null;const Nl=B(0),Al={"":bl,plain:bl,text:bl,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 4.0559072,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441188,0 l -1.789955,-1.782586 c -1.75742,1.750224 -4.6067879,1.750224 -6.3642294,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642294,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.746003,-2.73472867 -7.1981359,-2.73472867 -9.944119,0 -2.7459858,2.7347089 -2.7459858,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n</svg>\n',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n',cs:kl,csharp:kl,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n',shell:xl,powershell:xl,sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'},Sl={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function Bl(){return d(this,null,function*(){return Ml||(_l||(_l=import("./languageIconExtended.js").then(e=>(Ml=e.EXTENDED_LANGUAGE_ICON_MAP,Nl.value++,Ml)).catch(()=>null)),_l)})}function Cl(e){Ll=null!=e?e:null}function Tl(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=Sl[t])?n:t}function El(e){const n=Tl(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function Il(){return d(this,null,function*(){yield Bl()})}function $l(e){if(Ll){const n=Ll(e);if(null!=n&&""!==n)return n}const n=Tl(e),t=Al[n];if(t)return t;return(null==Ml?void 0:Ml[n])||(Bl(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>')}const Wl={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},Ol=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,l=t.length,r=l/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,u=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function Hl(){Ol.enable()}function jl(){Ol.disable()}function Pl(){return Ol.printReport()}function Rl(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function zl(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=Pl,window.__katexPerfMonitor=Ol);const Dl={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Kl={class:"flex items-center gap-x-2"},Fl=["innerHTML"],Vl={class:"text-sm font-medium font-mono"},Ul={class:"flex items-center gap-x-2"},Xl=["aria-pressed"],ql=["disabled"],Gl=["disabled"],Yl=["disabled"],Jl=["aria-label"],Zl={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ql={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},er=["aria-pressed"],nr={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},tr={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},or=["aria-label"],lr=["innerHTML"],rr=/* @__PURE__ */de(/* @__PURE__ */k({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=fn(),r=W(Tl(t.node.language)),i=W(!1),s=W(!1),u=W(!1),c=W(null),m=W(null),h=W(null),f=W(""),p=W(!1);let v;const g=xt(),y=W(null),w=W("undefined"==typeof window);"undefined"!=typeof window&&O(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const k=W(!0),L=W(0),A=W(14),B=W(A.value),C=T(()=>{const e=A.value,n=B.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),I=T(()=>{const e=r.value.trim().toLowerCase();return Wl[e]||e.charAt(0).toUpperCase()+e.slice(1)}),$=T(()=>(Nl.value,$l(r.value.trim().toLowerCase().split(":")[0]))),R=T(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),z=T(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),D=T(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),K=T(()=>null!=D.value&&!p.value),X=T(()=>a({fontSize:`${B.value}px`},K.value?{minHeight:`${D.value}px`}:{})),G=T(()=>{if(null!=D.value)return{minHeight:`${D.value}px`}}),Y=T(()=>!1!==t.showTooltips);function J(){return t.isDark?t.darkTheme:t.lightTheme}function Z(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`,p.value=!1}function Q(){f.value="",p.value=!0}function ee(){var e;const n=h.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function te(){return d(this,null,function*(){if(yield j(),ee())return void Q();const e=h.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{ee()&&(Q(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let oe,le,re,ie,ae=null;const se=/* @__PURE__ */new Set,ue=/* @__PURE__ */new Set,de=void 0!==import.meta&&Boolean(!1);let ce=null;function me(e,n){return d(this,null,function*(){if(!oe)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),l=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return l?!ie||ie.has(l)?l:(n&&de&&!se.has(l)&&(se.add(l),console.warn(`[MarkdownCodeBlockNode] Language "${l}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield oe.updateCode(e,t)}catch(o){"plaintext"!==t?(de&&!ue.has(t)&&(ue.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield oe.updateCode(e,"plaintext")):de&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function he(e){if(!re)return;const n=Array.isArray(e)?e.join("\0"):"";ae!==n&&(re({themes:e}),ae=n)}function fe(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!le)return ce||(ce=d(null,null,function*(){try{const e=yield import("stream-markdown");le=e.createShikiStreamRenderer,re=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;ie=n?new Set(n.map(e=>e.toLowerCase())):void 0,he(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ce=null}}),ce)})}(),m.value&&h.value?(he(t.themes),!oe&&le&&(oe=le(h.value,{theme:J()}),p.value=!0),oe?!1===t.stream&&t.loading?Z(t.node.code):(Z(t.node.code),yield me(t.node.code,r.value),yield te()):Z(t.node.code)):Z(t.node.code)):Z(t.node.code)})}function pe(){const e=m.value;if(!e||s.value)return;const n=e.scrollTop;n<L.value?k.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(k.value=!0),L.value=n}function ve(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function ye(e,n,o="top"){if(!Y.value)return;const l=ge(e);if(!l)return;const r=e;dn(l,n,o,!1,null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0,t.isDark)}function we(){Y.value&&cn()}function ke(e){if(!Y.value)return;const n=ge(e);if(!n)return;const o=e;dn(n,i.value?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0,t.isDark)}function xe(){u.value=!u.value}function be(){if(!R.value)return;const e=(r.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return ne(()=>{w.value?fe():Z(t.node.code)}),P(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),O(()=>t.themes,()=>d(null,null,function*(){he(t.themes)})),O(()=>t.loading,e=>{e||(w.value?fe():Z(t.node.code))}),O(()=>w.value,e=>{e&&fe()}),O(Y,e=>{e||cn()}),O(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=Tl(n);o!==r.value&&(r.value=o),w.value&&m.value&&h.value?(oe||(Z(e),yield fe()),oe&&e&&(!1===t.stream&&t.loading||(Z(e),yield me(e,n),yield te()))):Z(e)})),O(()=>[t.darkTheme,t.lightTheme],()=>d(null,null,function*(){w.value&&m.value&&h.value&&(oe||(yield fe()),null==oe||oe.setTheme(J()))})),O(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!k.value)return;yield j();const e=m.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(x(),b("div",{ref_key:"container",ref:c,style:V(z.value),class:E(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[t.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",t.isDark?"is-dark":""]])},[t.showHeader?(x(),b("div",Dl,[q(n.$slots,"header-left",{},()=>[_("div",Kl,[_("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:$.value},null,8,Fl),_("span",Vl,S(I.value),1)])],!0),q(n.$slots,"header-right",{},()=>[_("div",Ul,[t.showCollapseButton?(x(),b("button",{key:0,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":u.value,onClick:xe,onMouseenter:o[0]||(o[0]=e=>ye(e,u.value?M(l)("common.expand")||"Expand":M(l)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>ye(e,u.value?M(l)("common.expand")||"Expand":M(l)("common.collapse")||"Collapse")),onMouseleave:we,onBlur:we},[(x(),b("svg",{style:V({rotate:u.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[18]||(o[18]=[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Xl)):H("",!0),t.showFontSizeButtons&&t.enableFontSizeControl?(x(),b(N,{key:1},[_("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(B.value)&&B.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=Math.max(10,B.value-1);B.value=e}()),onMouseenter:o[3]||(o[3]=e=>ye(e,M(l)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>ye(e,M(l)("common.decrease")||"Decrease")),onMouseleave:we,onBlur:we},[...o[19]||(o[19]=[_("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,ql),_("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!C.value||B.value===A.value,onClick:o[5]||(o[5]=e=>{B.value=A.value}),onMouseenter:o[6]||(o[6]=e=>ye(e,M(l)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>ye(e,M(l)("common.reset")||"Reset")),onMouseleave:we,onBlur:we},[...o[20]||(o[20]=[_("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[_("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[_("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),_("path",{d:"M3 3v5h5"})])],-1)])],40,Gl),_("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(B.value)&&B.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=Math.min(36,B.value+1);B.value=e}()),onMouseenter:o[9]||(o[9]=e=>ye(e,M(l)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>ye(e,M(l)("common.increase")||"Increase")),onMouseleave:we,onBlur:we},[...o[21]||(o[21]=[_("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Yl)],64)):H("",!0),t.showCopyButton?(x(),b("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":i.value?M(l)("common.copied")||"Copied":M(l)("common.copy")||"Copy",onClick:ve,onMouseenter:o[11]||(o[11]=e=>ke(e)),onFocus:o[12]||(o[12]=e=>ke(e)),onMouseleave:we,onBlur:we},[i.value?(x(),b("svg",Ql,[...o[23]||(o[23]=[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(x(),b("svg",Zl,[...o[22]||(o[22]=[_("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[_("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),_("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Jl)):H("",!0),t.showExpandButton?(x(),b("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":s.value,onClick:o[13]||(o[13]=e=>function(e){if(s.value=!s.value,e&&Y.value){const n=ge(e);n&&dn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=m.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="500px",n.style.overflow="auto",k.value=!0,j(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}(e)),onMouseenter:o[14]||(o[14]=e=>ye(e,s.value?M(l)("common.collapse")||"Collapse":M(l)("common.expand")||"Expand")),onFocus:o[15]||(o[15]=e=>ye(e,s.value?M(l)("common.collapse")||"Collapse":M(l)("common.expand")||"Expand")),onMouseleave:we,onBlur:we},[s.value?(x(),b("svg",nr,[...o[24]||(o[24]=[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(x(),b("svg",tr,[...o[25]||(o[25]=[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],40,er)):H("",!0),R.value&&t.showPreviewButton?(x(),b("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":M(l)("common.preview")||"Preview",onClick:be,onMouseenter:o[16]||(o[16]=e=>ye(e,M(l)("common.preview")||"Preview")),onFocus:o[17]||(o[17]=e=>ye(e,M(l)("common.preview")||"Preview")),onMouseleave:we,onBlur:we},[...o[26]||(o[26]=[_("svg",{"data-v-3d59cc65":"",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[_("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[_("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),_("circle",{cx:"12",cy:"12",r:"3"})])],-1)])],40,or)):H("",!0)])],!0)])):H("",!0),F(_("div",{ref_key:"codeBlockContent",ref:m,class:"code-block-content",style:V(X.value),onScroll:pe},[_("div",{ref_key:"rendererTarget",ref:h,class:"code-block-render"},null,512),p.value?H("",!0):(x(),b("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,lr))],36),[[U,!(u.value||!e.stream&&e.loading)]]),F(_("div",{class:"code-loading-placeholder",style:V(G.value)},[q(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[27]||(o[27]=_("div",{class:"loading-skeleton"},[_("div",{class:"skeleton-line"}),_("div",{class:"skeleton-line"}),_("div",{class:"skeleton-line short"})],-1))],!0)],4),[[U,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-2e273ed5"]]);rr.install=e=>{e.component(rr.__name,rr)};const ir=["data-custom-id"],ar={class:"m-0 p-0"},sr=["data-probe"],ur=["data-node-index","data-node-type"],dr=/* @__PURE__ */de(/* @__PURE__ */k({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=W(),u=W(null),c=W(null),m=W(null),h=te({1:null,2:null,3:null,4:null,5:null,6:null}),f=W(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,w=T(()=>l.debugPerformance&&v&&"undefined"!=typeof console),k=I(),S=/* @__PURE__ */new Map,B=W(0),C=W(0),$=W({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),z=T(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=k.showTooltips)?e:k["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function F(e,n){w.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function U(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function X(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function q(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let l=n;for(;l&&l!==t.body&&l!==o;){if(U(window.getComputedStyle(l))&&X(l))return l;l=l.parentElement}return null}Q("markstreamShowTooltips",z),Q("markstreamTypewriter",T(()=>!1!==l.typewriter)),Q("markstreamTextStreamState",S),Q("markstreamStreamVersion",B),O([()=>l.content,()=>l.nodes],()=>{B.value+=1},{immediate:!0});const G=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,ee=g(G),ne=/* @__PURE__ */new Map,le=T(()=>{const{key:e,tags:n}=function(e){if(!e||0===e.length)return{key:"",tags:[]};const n=/* @__PURE__ */new Set,t=[];for(const o of e){const e=ie(o);e&&!n.has(e)&&(n.add(e),t.push(e))}return 0===t.length?{key:"",tags:[]}:{key:t.join(","),tags:t}}(l.customHtmlTags);if(!e)return ee;const t=ne.get(e);if(t)return t;const o=g(G,{customHtmlTags:n});return ne.set(e,o),o}),re=T(()=>{const e=le.value;return l.customMarkdownIt?l.customMarkdownIt(e):e});function ie(e){const n=String(null!=e?e:"").trim();if(!n)return"";const t=n.match(/^[<\s/]*([A-Z][\w-]*)/i);return t?t[1].toLowerCase():""}const ae=T(()=>{var e,n,t,o;const r=null!=(e=l.parseOptions)?e:{},i=null!=(n=l.final)?n:r.final,s=[...null!=(t=l.customHtmlTags)?t:[],...null!=(o=r.customHtmlTags)?o:[]].map(ie).filter(Boolean),u=null!=i,d=s.length>0;return u||d?a(a(a({},r),u?{final:i}:{}),d?{customHtmlTags:Array.from(new Set(s))}:{}):r}),se=T(()=>{var e;const n=null!=(e=ae.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),ue=T(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return oe(l.nodes.slice());if(l.content){const e=w.value?performance.now():0,n=y(l.content,re.value,ae.value);return w.value&&F("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),oe(n)}return[]}),de=W(null),me=W(null),he=W(null),pe=W(null),ve=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),ge=!ve&&l.customId?tl(l.customId):null,we=T(()=>ge?(nl.value,tl(l.customId)):null),xe=T(()=>{var e;return Boolean(v&&l.customId&&!ve&&(null==(e=we.value)?void 0:e.enabled))}),be=T(()=>{var e;return xe.value&&!1!==(null==(e=we.value)?void 0:e.textEstimation)}),Le=T(()=>{var e;return xe.value&&!1!==(null==(e=we.value)?void 0:e.codeBlockEstimation)}),_e=T(()=>{var e;return Math.max(320,C.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ae=T(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),Se=T(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&ue.value.length>Ae.value}),Be=T(()=>Se.value||xe.value),Ce=T(()=>!1!==l.viewportPriority&&!f.value),Ee=kt(e=>{var n;return q(null!=(n=null!=e?e:i.value)?n:null)},Ce),Ie=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,$e=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,We="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,Oe="test"===(null==We?void 0:We.NODE_ENV),He=v&&"function"==typeof window.requestIdleCallback,je=T(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Pe=T(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:je.value);return Number.isFinite(n)?Math.max(0,n):je.value}),Re=T(()=>!1!==l.batchRendering&&je.value>0&&v&&!Oe),ze=W(0),De=W({key:l.indexKey,total:0}),Ke=W(Math.max(1,je.value||1)),Ve=W(/* @__PURE__ */new Set),Ue=/* @__PURE__ */new Map,qe=/* @__PURE__ */new Map,Ge=/* @__PURE__ */new Map,Ye=/* @__PURE__ */new Map,Je=/* @__PURE__ */new Map,Ze=/* @__PURE__ */new WeakMap,Qe=W(0),en=T(()=>(Qe.value,Array.from(Ye.entries()).sort((e,n)=>e[0]-n[0]))),nn=W(0),tn=W([]),on=W([]),ln=W(null),rn=W(null);let an=null,sn=[],un=null,dn=null;const cn=T(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!Se.value&&!(ue.value.length>900)&&Ce.value}),mn=T(()=>{var e;return Re.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),hn=W({batchSize:je.value,initial:Pe.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:mn.value}),fn=T(()=>!!Ee&&(cn.value||Se.value)),pn=T(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),vn=W(0),gn=te({start:0,end:0}),yn=/* @__PURE__ */new Map,wn=/* @__PURE__ */new Map,kn=T(()=>{if(!Se.value)return ue.value.length;const e=pn.value,n=Math.max(gn.end+e,Pe.value),t=Math.min(ue.value.length,n);return Math.max(ze.value,t)});function bn(e){var n,t;return null!=(t=null==(n=pe.value)?void 0:n[e])?t:null}function Ln(e){var n,t,o,l;const r=q(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Mn(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function _n(e,n,t){var o,l,r,i,a,s;if(t)return null!=(i=null!=(r=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?r:null==(l=null==n?void 0:n.body)?void 0:l.scrollTop)?i:0;const u=e.scrollTop;if(!Mn(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function Nn(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function An(){un&&(un(),un=null),ln.value=null}function Sn(){if(!v||!Se.value)return;const e=Ln();if(!e||ln.value===e)return;An();const n=()=>Cn();e.addEventListener("scroll",n,{passive:!0}),ln.value=e,un=()=>{e.removeEventListener("scroll",n)}}function Bn(){var e,n,t;if(!dn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;dn.viaTimeout?o?o.clearTimeout(dn.id):clearTimeout(dn.id):null==$e||$e(dn.id),dn=null}function Cn(e={}){var n,t,o;if(!Se.value)return;if(!v)return void Tn(!0);if(e.immediate)return Bn(),void Tn(!0);if(dn)return;const l=()=>{dn=null,Tn()};if(Ie)dn={id:Ie(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);dn={id:r,viaTimeout:!0}}}function Tn(e=!1){var n,t,o,l,r,a,s;if(!Se.value)return;const u=ln.value||Ln();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),m=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),h=ue.value.length;if(!m&&h>0&&Mn(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=ue.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(xe.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=st(e);if(n<=t)return e;n-=t}return 0}if(nn.value===t.length){const n=Mt(0,t.length);return Et(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=In[l])?n:Vn.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=En(l,0,Math.max(0,h-1));return void((e||Math.abs(r-vn.value)>1)&&(vn.value=r))}const f=m?null:u.getBoundingClientRect(),p=m?0:f.top,v=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=en.value;let y=null,w=null;for(const[i,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=m?{top:0}:u.getBoundingClientRect(),t=_n(u,d,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=Nn(e,u);return Math.max(0,t-n)})(),h=m?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=Et(o+.5*Math.max(0,h));return void(vn.value=En(f,0,Math.max(0,ue.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-vn.value)<=1||(vn.value=En(k,0,Math.max(0,ue.value.length-1)))}function En(e,n,t){return Math.min(Math.max(e,n),t)}const In=te({}),$n=te({total:0,count:0});function Wn(){for(const e of Object.keys(In))delete In[Number(e)];$n.total=0,$n.count=0,nn.value=0,tn.value=[],on.value=[]}function On(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function zn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Dn(e,n,t){if(t<=n)return 0;const o=zn(e,t-1);return n<=0?o:o-zn(e,n-1)}function Fn(e){nn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(In)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(On(n,r,i),On(t,r,1))}tn.value=n,on.value=t}const Vn=T(()=>$n.count>0?Math.max(12,$n.total/$n.count):32);function Xn(e){return null==e?void 0:e.firstElementChild}function Gn(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function Jn(){var e,n;if(!xe.value)return void(C.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;C.value=t>0?t:0}let Zn=null;function Qn(){null==Zn||Zn.disconnect(),Zn=null}const et=Y(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),Ct}})),tt=T(()=>l.renderCodeBlocksAsPre?Ct:et);function lt(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const it=T(()=>{var e;const n=ue.value;if(!n.length||!xe.value)return n.map(()=>null);const t=C.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=In[n],r="number"==typeof o&&o>0;if(be.value&&!r){const n=al(e,t,$.value);if(n)return n}if(Le.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=vo(e,po(e));return n===rr?"markdown":n===Ct?"pre":n===tt.value||n===et?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(sl(String(null!=(n=e.originalCode)?n:"")),sl(String(null!=(t=e.updatedCode)?t:"")),sl(String(null!=(o=e.code)?o:""))):sl(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:lt()})}return null})});function st(e){var n,t,o;return null!=(o=null!=(t=In[e])?t:null==(n=it.value[e])?void 0:n.height)?o:Vn.value}function dt(){const e=ln.value||Ln(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,_n(e,t,!1)-Nn(n,e))}function ct(e){return Mt(0,En(e.nodeIndex,0,Math.max(0,ue.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function ht(){if(null!=an&&(null==$e||$e(an),an=null),v)for(const e of sn)window.clearTimeout(e);sn=[]}function pt(e){!function(e){var n;const t=ln.value||Ln(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=_n(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=Nn(o,t)+l}(ct(e))}function wt(){rn.value&&v&&null==an&&(an=Ie?Ie(()=>{an=null,rn.value&&pt(rn.value)}):null,null==an&&rn.value&&pt(rn.value))}function xt(){const e=dt(),n=ue.value.length;if(null==e||n<=0)return null;const t=En(Et(e+1),0,n-1),o=Mt(0,t),l=st(t);return{nodeIndex:t,offsetWithinNodePx:En(e-o,0,Math.max(0,l-1))}}function bt(e){if(rn.value={nodeIndex:En(e.nodeIndex,0,Math.max(0,ue.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},ht(),pt(rn.value),v)for(const n of[0,120,280,480])sn.push(window.setTimeout(()=>{rn.value&&pt(rn.value)},n))}function Lt(e){const n=dt();return null==n?null:n-ct(e)}function Mt(e,n){var t,o;if(e>=n)return 0;if(xe.value){let t=0;for(let o=e;o<n;o++)t+=st(o);return t}if(nn.value!==ue.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=In[l])?t:Vn.value;return o}const l=tn.value,r=on.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=In[l])?o:Vn.value;return t}return Dn(l,e,n)+(n-e-Dn(r,e,n))*Vn.value}O(()=>ue.value.length,e=>{e<=0?Wn():(e<nn.value&&function(e){if(e<=0)return void Wn();let n=0,t=0;for(const[o,l]of Object.entries(In)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete In[r]:(n+=i,t++)}$n.total=n,$n.count=t}(e),e!==nn.value&&Fn(e))},{immediate:!0});const Nt=T(()=>{if(!Se.value)return ue.value.map((e,n)=>({node:e,index:n}));const e=ue.value.length,n=En(gn.start,0,e),t=En(gn.end,n,e);return ue.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),St=T(()=>Se.value?Mt(0,Math.min(gn.start,ue.value.length)):0),Bt=T(()=>{if(!Se.value)return 0;const e=ue.value.length;return Mt(Math.min(gn.end,e),e)});function Tt(){var e;const n=ue.value;return{totalNodes:n.length,measuredCount:$n.count,estimatedCount:it.value.filter(Boolean).length,averageNodeHeight:Vn.value,topSpacerHeight:St.value,bottomSpacerHeight:Bt.value,estimatedTotalHeight:Mt(0,n.length),width:C.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean($.value.paragraph),listItemReady:Boolean($.value.listItem),listWrapperOverhead:$.value.listWrapperOverhead,headingReadyLevels:Object.entries($.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=it.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=it.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=it.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=it.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=In[n])?d:null}})}}function Et(e){var n;if(e<=0)return 0;const t=ue.value;if(xe.value){let n=e;for(let e=0;e<t.length;e++){const t=st(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(nn.value===t.length&&tn.value.length&&on.value.length){const n=Vn.value,o=tn.value,l=on.value,r=e=>e<=0?0:zn(o,e-1)+(e-zn(l,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=In[l])?n:Vn.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function It(){Qe.value+=1}function $t(e,n){const t=Ve.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ve.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ve.value=l}function Wt(){0!==Ve.value.size&&(Ve.value=/* @__PURE__ */new Set)}function Ht(e){if(!Ue.size)return;if(!Se.value)return;let n=!1;for(const[t,o]of Ue)t>=e&&(o.destroy(),Ue.delete(t),cn.value&&$t(t,!1),Yt(t),Ye.delete(t)&&(n=!0));n&&It()}function Pt(e,n){cn.value&&$t(e,n),n&&(Se.value?Cn():vn.value=En(e,0,Math.max(0,ue.value.length-1)))}function Dt(e){const n=qe.get(e);n&&(n(),qe.delete(e));const t=Ue.get(e);t&&(t.destroy(),Ue.delete(e)),Yt(e)}function Kt(e,n){let t=!1;if(n){const o=Ye.get(e);Ye.set(e,n),o!==n&&(t=!0)}else Ye.delete(e)&&(t=!0);if(t&&It(),n||Yt(e),!fn.value||!Ee)return Dt(e),void(n&&Pt(e,!0));if(!Se.value&&cn.value&&!f.value&&Ue.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Ue.values())e.destroy();if(Ue.clear(),v)for(const e of Ge.values())window.clearTimeout(e);Ge.clear(),Wt()}}(),!fn.value||!Ee))return Dt(e),void(n&&Pt(e,!0));if(e<Pe.value&&!Se.value)return Dt(e),void Pt(e,!0);if(Ve.value.has(e))return Dt(e),void Pt(e,!0);if(!n)return void Dt(e);Dt(e);const o=Ee(n,{rootMargin:"400px"});if(!o)return;Ue.set(e,o),Pt(e,o.isVisible.value),cn.value&&function(e){if(!v||!cn.value)return;Yt(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(Ge.delete(e),!cn.value)return;if(Ve.value.has(e))return;const o=Ye.get(e);if(!o)return;const l=Ln(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&Pt(e,!0)},1800+n);Ge.set(e,t)}(e);let l=null;l=O(()=>o.isVisible.value,n=>{if(n){Yt(e),Pt(e,!0),null==l||l(),qe.delete(e),Ue.get(e)===o&&Ue.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),qe.set(e,l),Se.value&&Cn()}O(()=>Be.value,e=>{if(!e){for(const e of Je.values())e.disconnect();Je.clear();for(const e of wn.values())for(const n of e)window.clearTimeout(n);wn.clear()}},{immediate:!0});let Ft=null,Vt=null,Ut=!1,Xt=null,qt=null;function Gt(){v&&(null!=Ft&&(null==$e||$e(Ft),Ft=null),null!=Vt&&(window.clearTimeout(Vt),Vt=null),null!=qt&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(qt),qt=null),Ut=!1,Xt=null)}function Yt(e){if(!v)return;const n=Ge.get(e);null!=n&&(window.clearTimeout(n),Ge.delete(e))}function Jt(e,n={}){var t,o;if(!mn.value)return;const r=kn.value;if(ze.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Ft=null,Vt=null,qt=null,Ut=!1;const t=null!=Xt?Xt:i;Xt=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();ze.value=Math.min(r,ze.value+Math.max(1,e)),Ht(ze.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!mn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,je.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Ke.value=Math.max(r,Math.floor(.7*Ke.value)):e<.5*t&&Ke.value<o&&(Ke.value=Math.min(o,Math.ceil(1.2*Ke.value)))}(t),t};let s=t;for(;(a(s),!(ze.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Ke.value));ze.value<r&&Zt()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Xt=null!=Xt?Math.max(Xt,i):i,!Ut){if(Ut=!0,!Oe&&He&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(qt=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}Ie&&!Oe?Ft=Ie(()=>{0!==s?Vt=window.setTimeout(()=>a(),s):a()}):Vt=window.setTimeout(()=>a(),s)}}function Zt(){mn.value&&Jt(Re.value?Math.max(1,Math.round(Ke.value)):Math.max(1,je.value))}O([()=>ue.value,()=>ue.value.length,()=>mn.value,()=>je.value,()=>Pe.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=ue.value.length,t=De.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;De.value={key:o,total:n};const s=hn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==je.value||s.initial!==Pe.value||s.delay!==u||s.enabled!==mn.value;hn.value={batchSize:je.value,initial:Pe.value,delay:u,enabled:mn.value},r&&(Wn(),n>0&&Fn(n)),(a||d||!mn.value)&&Gt(),(a||d)&&(Ke.value=Math.max(1,je.value||1)),a&&Se.value&&Cn({immediate:!0});const c=kn.value;if(!n)return ze.value=0,void Ht(0);if(!mn.value)return ze.value=c,void Ht(ze.value);const m=r||0===t.total;ze.value=m||d?Math.min(c,Pe.value):Math.min(ze.value,c);const h=Math.max(1,Pe.value||je.value||n);ze.value<c?Jt(h,{immediate:!v}):Ht(ze.value)},{immediate:!0}),O(()=>Se.value,e=>{if(!e)return An(),void Bn();Sn(),Cn({immediate:!0})},{immediate:!0}),O([()=>ue.value.length,()=>Se.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield j(),Cn({immediate:!0}))}),{flush:"post"}),O(()=>i.value,()=>{Se.value&&(Sn(),Cn({immediate:!0}))}),O(xe,e=>{e&&function(){var e;if(de.value&&me.value&&he.value&&(null==(e=pe.value)?void 0:e[1]))return;const n=oe({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=oe({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=oe({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});de.value=n,me.value=t,he.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]=oe({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});pe.value=l}()},{immediate:!0}),O([()=>i.value,xe],()=>{if(!xe.value)return Qn(),void(C.value=0);Jn(),Qn(),xe.value&&i.value&&"undefined"!=typeof ResizeObserver&&(Zn=new ResizeObserver(()=>{Jn(),rn.value&&wt()}),Zn.observe(i.value))},{immediate:!0}),O([xe,_e],()=>d(null,null,function*(){xe.value?(yield j(),function(){var e,n,t,o;if(!xe.value||"undefined"==typeof window)return void($.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=Gn(Xn(u.value),".paragraph-node");l.paragraph=dl(u.value,r,"pre-wrap");const i=Xn(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=dl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=m.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=Gn(Xn(h[u]),`h${u}`);l.headings[u]=dl(h[u],e,"pre-wrap")}$.value=l}()):$.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),O(()=>ue.value.length,()=>{Se.value&&Cn({immediate:!0})}),O([xe,C],()=>{Se.value&&Cn({immediate:!0}),rn.value&&wt()},{immediate:!1}),O(()=>cn.value,e=>{if(e)for(const[n,t]of Ye)Kt(n,t);else{for(const e of Ue.values())e.destroy();Ue.clear();for(const e of Array.from(Ge.keys()))Yt(e);Wt();for(const[e,n]of Ye)n&&Pt(e,!0)}},{immediate:!1}),O([()=>l.viewportPriority,()=>ue.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),O(()=>ze.value,()=>{Se.value&&Cn({immediate:!0})}),O([vn,Ae,pn,()=>ue.value.length,Se],()=>{!function(){const e=ue.value.length;if(!Se.value||0===e)return gn.start=0,void(gn.end=e);const n=Math.min(Ae.value,e),t=pn.value,o=En(vn.value-t,0,Math.max(0,e-n));gn.start=o,gn.end=Math.min(e,o+n)}()},{immediate:!0}),O([()=>ue.value.length,Se,Ae,pn,()=>gn.start,()=>gn.end],([e,n,t,o,l,r])=>{w.value&&F("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:vn.value,scroll:n?(()=>{const e=ln.value||Ln();return e?{reverse:Mn(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:ze.value})}),O(()=>kn.value,(e,n)=>{mn.value&&("number"==typeof n&&e<=n||e>ze.value&&Zt())}),O([()=>l.customId],([e],n,t)=>{if(!e||ve)return;const o=function(e,n){return e?(Qo.controllers[e]=n,()=>{Qo.controllers[e]===n&&delete Qo.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:xt,restoreAnchor:bt,getAnchorDrift:Lt,getReport:Tt});t(()=>{o()})},{immediate:!0}),P(()=>{Gt();for(const e of Ue.values())e.destroy();Ue.clear();for(const e of Je.values())e.disconnect();Je.clear();for(const e of wn.values())for(const n of e)window.clearTimeout(n);wn.clear();for(const e of qe.values())e();qe.clear();for(const e of Array.from(Ge.keys()))Yt(e);Qn(),ht(),An(),Bn()});const Qt=Y(()=>d(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),Ct}})),eo=Y(()=>d(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),Ct}})),no=Y(()=>d(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),Ct}})),to={text:Hn,paragraph:At,heading:vt,code_block:et,list:yt,list_item:gt,blockquote:ce,table:Ot,definition_list:ye,footnote:mt,footnote_reference:Te,footnote_anchor:ut,admonition:gr,vmr_container:zt,hardbreak:ft,link:nt,image:xn,thematic_break:jt,math_inline:jn,math_block:Pn,strong:qn,emphasis:at,strikethrough:Yn,highlight:rt,insert:ot,subscript:Un,superscript:Kn,emoji:ke,checkbox:fe,checkbox_input:fe,inline_code:Xe,html_inline:Fe,reference:Rn,html_block:_t},oo=T(()=>(Me.value,Ne(l.customId))),lo=T(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),ro=T(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof z.value?{showTooltips:z.value}:{}),l.codeBlockProps||{})),io=T(()=>a({},l.mermaidProps||{})),ao=T(()=>a({},l.d2Props||{})),so=T(()=>a({},l.infographicProps||{})),uo=T(()=>({typewriter:l.typewriter})),co=T(()=>a(a({},uo.value),"boolean"==typeof z.value?{showTooltip:z.value}:{})),mo=T(()=>a(a({},uo.value),"boolean"==typeof z.value?{showTooltips:z.value}:{})),ho=T(()=>Nt.value.map(e=>{var n;let t=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=Ze.get(u);if(c&&c.signature===d)return c.node;const m=a({},u);return Ze.set(u,{signature:d,node:m}),m}(e.node);const o=po(t);let l=vo(t,o);if(("html_block"===t.type||"html_inline"===t.type)&&l===to[t.type]){const e=t,o=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||function(e){const n=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return n?n[1].toLowerCase():""}(e.content);if(o&&se.value.has(o)){const n=oo.value[o];n&&(l=n,t=s(a({},e),{type:o,tag:o,content:fo(e.content,o)}))}}let r=a({},function(e,n){const t=null!=n?n:po(e);return"mermaid"===t?io.value:"infographic"===t?so.value:"d2"===t||"d2lang"===t?ao.value:"link"===e.type?co.value:"list"===e.type?mo.value:"code_block"===e.type?ro.value:uo.value}(t,o));const i=it.value[e.index];return"code_block"===t.type&&"code-block"===(null==i?void 0:i.kind)&&(r=s(a({},r),{estimatedHeightPx:i.height,estimatedContentHeightPx:i.contentHeight})),s(a({},e),{node:t,component:l,bindings:r,isCodeBlock:"code_block"===t.type,indexKey:`${lo.value}-${e.index}`})}));function fo(e,n){const t=String(null!=e?e:"");if(!n)return t;const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(String.raw`^\s*<\s*${o}(?:\s[^>]*)?>\s*`,"i"),r=new RegExp(String.raw`\s*<\s*\/\s*${o}\s*>\s*$`,"i");return t.replace(l,"").replace(r,"")}function po(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function vo(e,n){if(!e)return Rt;const t=oo.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:po(e);if("mermaid"===l)return t.mermaid||Qt;if("infographic"===l)return t.infographic||eo;if("d2"===l||"d2lang"===l)return t.d2||no;if(o)return o;return t.code_block||tt.value}return o||to[String(e.type)]||Rt}function go(e){r("click",e)}function yo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function wo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}return(e,n)=>(x(),b("div",{ref_key:"containerRef",ref:i,class:E(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:Se.value}]]),"data-custom-id":l.customId,onClick:go,onMouseover:yo,onMouseout:wo},[xe.value||Se.value?(x(),b(N,{key:0},[xe.value?(x(),b("div",{key:0,class:"height-estimation-probes",style:V({width:`${_e.value}px`}),"aria-hidden":"true"},[_("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[L(M(At),{node:de.value,"index-key":"probe-paragraph"},null,8,["node"])],512),_("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[_("ul",ar,[L(M(gt),{node:me.value,"index-key":"probe-list-item"},null,8,["node"])])],512),_("div",{ref_key:"listProbeWrapperRef",ref:m,class:"node-content","data-probe":"list"},[L(M(yt),{node:he.value,"index-key":"probe-list"},null,8,["node"])],512),(x(),b(N,null,A(6,e=>_("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(h[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[L(M(vt),{node:bn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,sr)),64))],4)):H("",!0),Se.value?(x(),b("div",{key:1,class:"node-spacer",style:V({height:`${St.value}px`}),"aria-hidden":"true"},null,4)):H("",!0)],64)):H("",!0),(x(!0),b(N,null,A(ho.value,e=>{return x(),b("div",{key:e.index,ref_for:!0,ref:n=>Kt(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,mn.value&&t>=ze.value||!(!cn.value||t<Pe.value||Ve.value.has(t))?(x(),b("div",{key:1,class:"node-placeholder",style:V({height:`${st(e.index)}px`})},null,4)):(x(),b("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=wn.get(e);if(o){for(const e of o)window.clearTimeout(e);wn.delete(e)}const l=Je.get(e);if(l&&(l.disconnect(),Je.delete(e)),!n||!Be.value)return void yn.delete(e);yn.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=In[e];if(In[e]=n,t?$n.total+=n-t:($n.total+=n,$n.count++),nn.value>e){const o=tn.value,l=on.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&On(o,e,l)}else On(o,e,n),On(l,e,1)}rn.value&&wt()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),Je.set(e,t)}"code_block"===(null==(t=ue.value[e])?void 0:t.type)&&"undefined"!=typeof window&&wn.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(x(),R(J(e.component),Z({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(x(),R(D,{key:0,name:"typewriter",appear:""},{default:K(()=>[(x(),R(J(e.component),Z({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,ur);var t}),128)),Se.value?(x(),b("div",{key:1,class:"node-spacer",style:V({height:`${Bt.value}px`}),"aria-hidden":"true"},null,4)):H("",!0)],42,ir))}}),[["__scopeId","data-v-d81d311f"]]);dr.install=e=>{var n,t;const o=null!=(t=null!=(n=dr.__name)?n:dr.name)?t:"NodeRenderer";e.component(o,dr)};const cr={key:0,class:"admonition-icon"},mr={class:"admonition-title"},hr=["aria-expanded","aria-controls","title"],fr={key:0},pr={key:1},vr=["id"],gr=/* @__PURE__ */de(/* @__PURE__ */k({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"},i=T(()=>{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)}),a=W(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function s(){o.node.collapsible&&(a.value=!a.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(x(),b("div",{class:E(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[_("div",{id:u,class:"admonition-header"},[r[o.node.kind]?(x(),b("span",cr,S(r[o.node.kind]),1)):H("",!0),_("span",mr,S(i.value),1),o.node.collapsible?(x(),b("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${u}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(x(),b("span",fr,"▶")):(x(),b("span",pr,"▼"))],8,hr)):H("",!0)]),F(_("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[L(M(dr),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,vr),[[U,!a.value]])],2))}}),[["__scopeId","data-v-ee240a2a"]]);gr.install=e=>{e.component(gr.__name,gr)};const yr=()=>import("@terrastruct/d2");let wr=null,kr=yr;function xr(e){kr=e,wr=null}function br(e){xr(null!=e?e:yr)}function Lr(){xr(null)}function Mr(){return"function"==typeof kr}function _r(){return d(this,null,function*(){if(wr)return wr;const e=kr;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===yr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(wr=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),wr):null})}const Nr=()=>import("mermaid");let Ar=null,Sr=Nr;function Br(e){Sr=e,Ar=null}function Cr(e){Br(null!=e?e:Nr)}function Tr(){Br(null)}function Er(){return"function"==typeof Sr}function Ir(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function $r(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function Wr(){return d(this,null,function*(){if(Ar)return Ar;const e=function(){try{const e=globalThis;return Ir(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return Ar=e,$r(Ar),Ar;const n=Sr;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Nr)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(Ar=Ir(t),$r(Ar),Ar):null})}function Or(e){return JSON.stringify(e)}function Hr(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=Or(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=Or(o),s=l?Or(l):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function jr(e){var n,t;const o=Hr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}Ye.install=e=>{e.component(Ye.__name,Ye)};let Pr=null,Rr=null,zr=!1;const Dr=/* @__PURE__ */new Map,Kr=/* @__PURE__ */new Map;let Fr=5;const Vr=/* @__PURE__ */new Set;function Ur(){if(Dr.size<Fr&&Vr.size){const n=Array.from(Vr);Vr.clear();for(const t of n)try{t()}catch(e){}}}function Xr(e){Pr=e,Rr=null,Pr.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=Dr.get(n);if(l)if(Dr.delete(n),clearTimeout(l.timeoutId),Ur(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(Kr.set(e,t),Kr.size>200){const e=Kr.keys().next().value;Kr.delete(e)}}l.resolve(t)}},Pr.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of Dr.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));Dr.clear(),Ur()}}function qr(){var e;Pr&&(null==(e=Pr.terminate)||e.call(Pr)),Pr=null,Rr=null}function Gr(e){zr=!!e,Pr&&Pr.postMessage({type:"init",debug:zr})}function Yr(e,n=!0,t=2e3,o){return d(this,null,function*(){if(performance.now(),!Tn()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(Rr)return Promise.reject(Rr);const l=`${n?"d":"i"}:${e}`,r=Kr.get(l);if(r)return Promise.resolve(r);const i=Pr||(Rr=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Rr.name="WorkerInitError",Rr.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(Rr);if(Dr.size>=Fr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=Dr.size,e.max=Fr,Promise.reject(e)}return new Promise((l,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{Dr.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),Ur()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),Dr.has(a)&&Dr.delete(a);const e=new Error("Aborted");e.name="AbortError",r(e),Ur()},{once:!0});const u=l,d=r;Dr.set(a,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Jr(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(Kr.set(o,t),Kr.size>200){const e=Kr.keys().next().value;Kr.delete(e)}}function Zr(){return{inFlight:Dr.size,max:Fr}}function Qr(e){Number.isFinite(e)&&e>0&&(Fr=Math.floor(e))}const ei="WORKER_BUSY";function ni(){return Dr.size>=Fr}function ti(e=2e3,n){return Dr.size<Fr?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Vr.delete(i),t())};if(Vr.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Vr.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>Ur()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),Vr.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const oi={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function li(e){null!=e.timeout&&(oi.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(oi.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(oi.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(oi.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ri(){return a({},oi)}function ii(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!Tn()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:oi.timeout,s=null!=(l=t.waitTimeout)?l:oi.waitTimeout,u=null!=(r=t.backoffMs)?r:oi.backoffMs,d=null!=(i=t.maxRetries)?i:oi.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):oi.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Yr(e,n,a,m)}catch(f){if((null==f?void 0:f.code)!==ei||h>=c)throw f;if(h++,yield ti(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*h)))}}})}function ai(e){return JSON.stringify(e)}function si(e){var n;const t=null!=(n=e.mode)?n:"module",o=ai(e.mermaidUrl),l=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${ai(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${l}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${l}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function ui(e){var n,t;const o=si(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let di=null,ci=null;const mi=/* @__PURE__ */new Map;let hi=5,fi=!1;function pi(e){fi=!!e}function vi(e){Number.isFinite(e)&&e>0&&(hi=Math.floor(e))}function gi(){return{inFlight:mi.size,max:hi}}const yi="WORKER_BUSY",wi="MERMAID_DISABLED";function ki(e){di=e,ci=null;const n=e;di.onmessage=e=>{if(di!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=mi.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},di.onerror=e=>{var t,o;if(di===n)if(0!==mi.size){try{fi?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(l){}for(const[n,t]of mi.entries())t.reject(new Error(`Worker error: ${e.message}`));mi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},di.onmessageerror=e=>{var t,o;if(di===n)if(0!==mi.size){try{fi?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of mi.entries())n.reject(new Error("Worker messageerror"));mi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function xi(){var e;if(di)try{for(const[e,n]of mi.entries())n.reject(new Error("Worker cleared"));mi.clear(),null==(e=di.terminate)||e.call(di)}catch(n){}di=null,ci=null}function bi(e,n,t=1400){if(!Er()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=wi,Promise.reject(e)}if(ci)return Promise.reject(ci);const o=di||(ci=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),ci.name="WorkerInitError",ci.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(ci);if(mi.size>=hi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=yi,e.inFlight=mi.size,e.max=hi,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),mi.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};mi.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return mi.delete(i),void r(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=mi.get(i);n&&n.reject(e)},t)})}function Li(e,n,t=1400){return d(this,null,function*(){try{return yield bi("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Mi(e,n,t=1400){return d(this,null,function*(){try{return yield bi("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function _i(){if(di)try{for(const[e,n]of mi.entries())n.reject(new Error("Worker terminated"));mi.clear(),di.terminate()}finally{di=null}}const Ni=Y(()=>import("./index7.js")),Ai=Y(()=>import("./index3.js")),Si=Y(()=>import("./index2.js")),Bi=Y(()=>import("./index4.js")),Ci=Y(()=>import("./index5.js")),Ti=Y(()=>import("./index6.js")),Ei={AdmonitionNode:gr,BlockquoteNode:ce,CheckboxNode:fe,CodeBlockNode:Ni,DefinitionListNode:ye,EmojiNode:ke,EmphasisNode:at,FootnoteNode:mt,FootnoteReferenceNode:Te,FootnoteAnchorNode:ut,HardBreakNode:ft,HeadingNode:vt,HtmlBlockNode:_t,HtmlInlineNode:Fe,HighlightNode:rt,ImageNode:xn,D2BlockNode:Ti,InfographicBlockNode:Ci,InlineCodeNode:Xe,PreCodeNode:Ct,InsertNode:ot,LinkNode:nt,ListItemNode:gt,ListNode:yt,MathBlockNode:Ai,MathInlineNode:Si,MermaidBlockNode:Bi,ParagraphNode:At,StrikethroughNode:Yn,StrongNode:qn,SubscriptNode:Un,SuperscriptNode:Kn,TableNode:Ot,TextNode:Hn,ThematicBreakNode:jt,VmrContainerNode:zt,ReferenceNode:Rn,MarkdownCodeBlockNode:rr},Ii={install(e,n){Object.entries(Ei).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&Cl(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&w(n.mathOptions)}};export{Bi as $,gr as A,ce as B,fe as C,Ti as D,ke as E,ut as F,Te as G,ft as H,vt as I,rt as J,_t as K,Fe as L,xn as M,Ci as N,Xe as O,ot as P,nt as Q,gt as R,yt as S,wi as T,yi as U,rr as V,ei as W,dr as X,Ai as Y,Si as Z,de as _,In as a,At as a0,Rn as a1,Yn as a2,qn as a3,Un as a4,Kn as a5,Ot as a6,Hn as a7,jt as a8,Ye as a9,Tn as aA,Er as aB,Ol as aC,Il as aD,wl as aE,vl as aF,Ae as aG,Yr as aH,_e as aI,xr as aJ,hn as aK,li as aL,Xr as aM,Gr as aN,Qr as aO,Sn as aP,Cl as aQ,Br as aR,ki as aS,pi as aT,vi as aU,ti as aV,zt as aa,Ii as ab,Hr as ac,si as ad,Se as ae,qr as af,xi as ag,jr as ah,ui as ai,yl as aj,Lr as ak,Cn as al,Tr as am,jl as an,br as ao,Bn as ap,Cr as aq,Hl as ar,gl as as,Ne as at,ri as au,Zr as av,gi as aw,Pl as ax,Mr as ay,ni as az,fn as b,Rl as c,Wr as d,dn as e,Li as f,En as g,cn as h,Mi as i,_r as j,El as k,pl as l,Wl as m,Tl as n,Nl as o,$l as p,Ct as q,ii as r,Jr as s,_i as t,xt as u,zl as v,Ni as w,ye as x,at as y,mt as z};
|
|
1
|
+
var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,i=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&i(e,t,n[t]);if(o)for(var t of o(n))r.call(n,t)&&i(e,t,n[t]);return e},s=(e,o)=>n(e,t(o)),u=(e,n,t)=>i(e,"symbol"!=typeof n?n+"":n,t),d=(e,n,t)=>new Promise((o,l)=>{var r=e=>{try{a(t.next(e))}catch(n){l(n)}},i=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,i);a((t=t.apply(e,n)).next())});import{tokenizeHtml as c,hasCustomHtmlComponents as m,sanitizeHtmlAttrs as h,BLOCKED_HTML_TAGS as f,isCustomHtmlComponentTag as p,convertHtmlAttrsToProps as v,normalizeCustomHtmlTags as g,getHtmlTagFromContent as y,shouldRenderUnknownHtmlTagAsText as w,getMarkdown as k,mergeCustomHtmlTags as x,resolveCustomHtmlTags as b,parseMarkdownToStructure as L,stripCustomHtmlWrapper as M,setDefaultMathOptions as _}from"stream-markdown-parser";import{defineComponent as N,openBlock as A,createElementBlock as S,createVNode as B,unref as C,createElementVNode as T,Fragment as E,renderList as I,toDisplayString as $,shallowRef as W,h as O,computed as H,normalizeClass as P,useAttrs as j,inject as R,ref as z,watch as K,createCommentVNode as D,nextTick as F,onBeforeUnmount as V,createBlock as U,Teleport as X,Transition as q,withCtx as G,withDirectives as Y,normalizeStyle as J,vShow as Z,createApp as Q,renderSlot as ee,readonly as ne,defineAsyncComponent as te,resolveDynamicComponent as oe,mergeProps as le,provide as re,createTextVNode as ie,onMounted as ae,reactive as se,markRaw as ue}from"vue";import{autoUpdate as de,offset as ce,flip as me,shift as he,computePosition as fe}from"@floating-ui/dom";const pe=["cite"],ve=(e,n)=>{const t=e.__vccOpts||e;for(const[o,l]of n)t[o]=l;return t},ge=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(A(),S("blockquote",{class:"blockquote",dir:"auto",cite:e.node.cite},[B(C(cr),{"index-key":`blockquote-${n.indexKey}`,nodes:n.node.children||[],"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,pe))}}),[["__scopeId","data-v-6d8bbd17"]]);ge.install=e=>{e.component(ge.__name,ge)};const ye={class:"checkbox-node"},we=["checked"],ke=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"CheckboxNode",props:{node:{}},setup:e=>(n,t)=>(A(),S("span",ye,[T("input",{type:"checkbox",checked:e.node.checked,disabled:"",class:"checkbox-input"},null,8,we)]))}),[["__scopeId","data-v-8dc6c46f"]]);ke.install=e=>{e.component(ke.__name,ke)};const xe={class:"definition-list"},be={class:"definition-term"},Le={class:"definition-desc"},Me=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(e,t)=>(A(),S("dl",xe,[(A(!0),S(E,null,I(n.node.items,(o,l)=>(A(),S(E,{key:l},[T("dt",be,[B(C(cr),{"index-key":`definition-term-${n.indexKey}-${l}`,nodes:o.term,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[0]||(t[0]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])]),T("dd",Le,[B(C(cr),{"index-key":`definition-desc-${n.indexKey}-${l}`,nodes:o.definition,"custom-id":n.customId,typewriter:n.typewriter,onCopy:t[1]||(t[1]=n=>e.$emit("copy",n))},null,8,["index-key","nodes","custom-id","typewriter"])])],64))),128))]))}}),[["__scopeId","data-v-f88691d6"]]);Me.install=e=>{e.component(Me.__name,Me)};const _e={class:"emoji-node"},Ne=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"EmojiNode",props:{node:{}},setup:e=>(n,t)=>(A(),S("span",_e,$(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Ne.install=e=>{e.component(Ne.__name,Ne)};const Ae="__global__",Se="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Be=(()=>{const e=globalThis;if(e[Se])return e[Se];const n={scopedCustomComponents:{},revision:W(0)};return e[Se]=n,n})(),Ce=Be.revision;function Te(e,n){"string"==typeof e?Be.scopedCustomComponents[e]=n||{}:Be.scopedCustomComponents[Ae]=e||{},Ce.value++}function Ee(e){const n=Be.scopedCustomComponents[Ae]||{};if(!e)return n;const t=Be.scopedCustomComponents[e]||{};return n&&0!==Object.keys(n).length?t&&0!==Object.keys(t).length?a(a({},n),t):n:t}function Ie(e){if(e===Ae)throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");delete Be.scopedCustomComponents[e],Ce.value++}function $e(){delete Be.scopedCustomComponents[Ae],Ce.value++}const We=["id"],Oe=["title"],He=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const n=`#footnote-${e.node.id}`;function t(){if("undefined"==typeof document)return;const e=document.querySelector(n);e?e.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${n} not found`)}return(o,l)=>(A(),S("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:t},[T("span",{href:n,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+$(e.node.id)+"]",9,Oe)],8,We))}}),[["__scopeId","data-v-01af0fee"]]);He.install=e=>{e.component(He.__name,He)};const Pe=(()=>{try{return Boolean(!1)}catch(e){}return!1})();function je(e){Pe&&console.warn(e)}function Re(e){return h(e)}function ze(e,n,t,o,l){if(f.has(e.toLowerCase()))return null;const r=Re(n),i=r.key,u=null!=i&&""!==i?i:l;if(function(e,n){return p(e,n)}(e,o)){const n=o[e]||o[e.toLowerCase()],l=function(e){return v(e)}(r);return O(n,s(a({},l),{key:u}),t.length>0?t:void 0)}return O(e,s(a({},r),{innerHTML:void 0,key:u}),t.length>0?t:void 0)}function Ke(e,n){return m(e,n)}function De(e,n){if(!e)return[];try{const t=function(e,n){let t=0;const o=[],l=[];for(const r of e)if("text"===r.type)(o.length>0?o[o.length-1].children:l).push(r.content);else if("self_closing"===r.type){const e=ze(r.tagName,r.attrs||{},[],n,"ms-html-"+t++),i=o.length>0?o[o.length-1].children:l;null!=e&&i.push(e)}else if("tag_open"===r.type)o.push({tagName:r.tagName,children:[],attrs:r.attrs,autoKey:"ms-html-"+t++});else if("tag_close"===r.type){const e=r.tagName.toLowerCase();let t=-1;for(let n=o.length-1;n>=0;n--)if(o[n].tagName.toLowerCase()===e){t=n;break}if(-1!==t)for(;o.length>t;){const r=o.pop(),i=ze(r.tagName,r.attrs||{},r.children,n,r.autoKey);o.length>0?null!=i&&o[o.length-1].children.push(i):null!=i&&l.push(i),r.tagName.toLowerCase()!==e&&o.length>t&&je(`Auto-closing unclosed tag: <${r.tagName}>`)}else je(`Ignoring closing tag with no matching opening tag: </${r.tagName}>`)}for(;o.length>0;){const e=o.pop(),t=ze(e.tagName,e.attrs||{},e.children,n,e.autoKey);o.length>0?null!=t&&o[o.length-1].children.push(t):null!=t&&l.push(t),je(`Auto-closing unclosed tag: <${e.tagName}>`)}return l}(c(e),n);return t}catch(o){return t=o,Pe&&console.error("Failed to parse HTML to VNodes:",t),null}var t}const Fe=["innerHTML"],Ve=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"HtmlInlineNode",props:{node:{},customId:{}},setup(e){const n=e,t=H(()=>(Ce.value,Ee(n.customId))),o=N({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),l=H(()=>{const e=n.node.content;if(!e)return{mode:"html",content:""};if(n.node.loading&&!n.node.autoClosed)return{mode:"text",content:e};if(n.node.loading&&n.node.autoClosed){const n=De(e,t.value);if(null!==n)return{mode:"dynamic",nodes:n}}if(!Ke(e,t.value))return{mode:"html",content:e};const o=De(e,t.value);return null===o?{mode:"html",content:e}:{mode:"dynamic",nodes:o}});return(e,t)=>"dynamic"===l.value.mode?(A(),S("span",{key:0,class:P(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},[B(C(o),{nodes:l.value.nodes},null,8,["nodes"])],2)):"text"===l.value.mode?(A(),S("span",{key:1,class:P(["html-inline-node",{"html-inline-node--loading":n.node.loading}])},$(l.value.content),3)):(A(),S("span",{key:2,class:P(["html-inline-node",{"html-inline-node--loading":n.node.loading}]),innerHTML:l.value.content},null,10,Fe))}}),[["__scopeId","data-v-71cd1a9f"]]);Ve.install=e=>{e.component(Ve.__name,Ve)};const Ue={class:"inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']"},Xe={key:0},qe=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"InlineCodeNode",props:{node:{}},setup(e){const n=e,t=j(),o=R("markstreamTypewriter",void 0),l=R("markstreamTextStreamState",void 0),r=H(()=>{const e=t.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),i=H(()=>"boolean"==typeof r.value?r.value:"boolean"!=typeof(null==o?void 0:o.value)||o.value),a=H(()=>{var e;const n=null!=(e=t["index-key"])?e:t.indexKey;return null==n||""===n?"":String(n)}),s=z(n.node.code),u=z(""),d=z(0);function c(){return s.value+u.value}function m(e){s.value=e,u.value=""}function h(){u.value&&(s.value=c(),u.value="")}K([()=>n.node.code,a,i],([e])=>{const n=String(null!=e?e:""),t=c(),o=a.value,r=o?null==l?void 0:l.get(o):void 0,h=null!=r?r:t;return i.value?n===h?(m(n),void(o&&(null==l||l.set(o,n)))):h&&n.startsWith(h)&&n.length>h.length?(s.value=h,u.value=n.slice(h.length),d.value+=1,void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n)))):(m(n),void(o&&(null==l||l.set(o,n))))},{immediate:!0}),K(i,e=>{e||m(c())});const f=H(()=>d.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(e,n)=>(A(),S("code",Ue,[s.value?(A(),S("span",Xe,$(s.value),1)):D("",!0),u.value?(A(),S("span",{key:1,class:P(["inline-code-stream-delta",[f.value]]),onAnimationend:h},$(u.value),35)):D("",!0)]))}}),[["__scopeId","data-v-ffb68151"]]);qe.install=e=>{e.component(qe.__name,qe)};const Ge={class:"markstream-vue"},Ye=["id"],Je=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(e){const n=e,t=H(()=>{if(void 0!==n.isDark&&null!==n.isDark)return Boolean(n.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(e){}return!1}),o=z(null),l=z({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),r=z(!1);let i=null;function a(){return d(this,null,function*(){var e,t;if(!n.anchorEl||!o.value)return;const r=[ce(null!=(e=n.offset)?e:8),me(),he({padding:8})],{x:i,y:a}=yield fe(n.anchorEl,o.value,{placement:null!=(t=n.placement)?t:"top",middleware:r,strategy:"fixed"});l.value.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,l.value.left="0px",l.value.top="0px"})}return K(()=>n.visible,e=>d(null,null,function*(){if(e)if(r.value=!1,yield F(),n.anchorEl&&o.value)try{const e=n.anchorEl.getBoundingClientRect();yield a();const t=l.value.transform;if(null!=n.originX&&null!=n.originY){const o=Math.abs(Number(n.originX)-e.left),i=Math.abs(Number(n.originY)-e.top);Math.hypot(o,i)>120?(l.value.transform=`translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`,yield F(),r.value=!0,yield F(),l.value.transform=t):r.value=!0}else r.value=!0;i=de(n.anchorEl,o.value,a)}catch(t){yield a(),r.value=!0,i=de(n.anchorEl,o.value,a)}else r.value=!0;else r.value=!1,i&&(i(),i=null)})),K([()=>n.anchorEl,()=>n.placement,()=>n.content],()=>d(null,null,function*(){n.visible&&n.anchorEl&&o.value&&(yield F(),yield a())})),V(()=>{i&&i()}),(i,a)=>(A(),U(X,{to:"body"},[T("div",Ge,[B(q,{name:"tooltip",appear:""},{default:G(()=>[Y(T("div",{id:n.id,ref_key:"tooltip",ref:o,style:J({position:"fixed",left:l.value.left,top:l.value.top,transform:l.value.transform}),class:P(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",[t.value?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"]]),role:"tooltip"},$(e.content),15,Ye),[[Z,e.visible&&r.value]])]),_:1})])]))}}),[["__scopeId","data-v-d524cc01"]]),Ze=z(!1),Qe=z(""),en=z("top"),nn=z(null),tn=z(null),on=z(null),ln=z(null),rn=z(null);let an=null,sn=null;function un(){an&&(clearTimeout(an),an=null),sn&&(clearTimeout(sn),sn=null)}let dn=!1;function cn(e,n,t="top",o=!1,l,r){if(!e)return;!function(){if(!dn&&"undefined"!=typeof document)try{dn=!0;const e=document.createElement("div");e.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(e),Q({setup:()=>()=>{var e;return O(Je,{visible:Ze.value,"anchor-el":nn.value,content:Qe.value,placement:en.value,id:tn.value,originX:on.value,originY:ln.value,isDark:null!=(e=rn.value)?e:void 0})}}).mount(e)}catch(e){dn=!1,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",e)}}(),un();const i=()=>{var o,i;tn.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,nn.value=e,Qe.value=n,en.value=t,on.value=null!=(o=null==l?void 0:l.x)?o:null,ln.value=null!=(i=null==l?void 0:l.y)?i:null,rn.value="boolean"==typeof r?r:null,Ze.value=!0;try{e.setAttribute("aria-describedby",tn.value)}catch(a){}};o?i():an=setTimeout(i,80)}function mn(e=!1){un();const n=()=>{if(nn.value&&tn.value)try{nn.value.removeAttribute("aria-describedby")}catch(e){}Ze.value=!1,nn.value=null,tn.value=null,on.value=null,ln.value=null};e?n():sn=setTimeout(n,120)}const hn={"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.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function fn(e){Object.assign(hn,e)}function pn(){try{const n=globalThis.$vueI18nUse||null;if(n&&"function"==typeof n)try{const e=n();if(e&&"function"==typeof e.t)return{t:e.t.bind(e)}}catch(e){}}catch(e){}return d(null,null,function*(){try{const n=yield import("vue-i18n"),t=n.useI18n||n.default&&n.default.useI18n;if(t&&"function"==typeof t)try{const n=t();if(n&&"function"==typeof n.t)try{globalThis.$vueI18nUse=()=>n}catch(e){}}catch(e){}}catch(e){}}),{t:e=>{var n;return null!=(n=hn[e])?n:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}const vn=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],gn={key:"placeholder",class:"placeholder-layer placeholder-layer--inline inline-flex items-center justify-center gap-2"},yn={class:"text-sm whitespace-nowrap"},wn={key:1,class:"text-sm text-gray-500"},kn={key:"error",class:"image-node__error image-node__error--inline px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"},xn={class:"text-sm whitespace-nowrap"},bn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:n}){const t=e,o=n,l=z(!1),r=z(!1),i=z(!1),a=H(()=>r.value&&t.fallbackSrc?t.fallbackSrc:t.node.src),s=H(()=>!t.lazy);function u(){t.fallbackSrc&&!i.value?(i.value=!0,r.value=!0):(r.value=!0,o("error",t.node.src))}function d(){l.value=!0,r.value=!1,o("load",a.value)}function c(e){e.preventDefault(),l.value&&!r.value&&o("click",[e,a.value])}const{t:m}=pn();return K(a,()=>{l.value=!1,r.value=!1}),(n,o)=>(A(),U(q,{name:"img-switch",mode:"out-in"},{default:G(()=>{var i,h,f,p,v;return[e.node.loading||r.value?r.value?e.node.loading||t.fallbackSrc?D("",!0):(A(),S("span",kn,[ee(n.$slots,"error",{node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[1]||(o[1]=T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[T("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)),T("span",xn,$(C(m)("image.loadError")),1)],!0)])):(A(),S("span",gn,[t.usePlaceholder?ee(n.$slots,"placeholder",{key:0,node:t.node,displaySrc:a.value,imageLoaded:l.value,hasError:r.value,fallbackSrc:t.fallbackSrc,lazy:t.lazy},()=>[o[0]||(o[0]=T("div",{class:"w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin","aria-hidden":"true"},null,-1)),T("span",yn,$(C(m)("image.loading")),1)],!0):(A(),S("span",wn,$(e.node.raw),1))])):(A(),S("img",{key:"image",src:a.value,alt:String(null!=(h=null!=(i=t.node.alt)?i:t.node.title)?h:""),title:String(null!=(p=null!=(f=t.node.title)?f:t.node.alt)?p:""),class:P(["image-node__img h-auto rounded-lg image-node__img--inline",{"transition-opacity duration-200 ease-in-out":!s.value,"opacity-0":!s.value&&!l.value,"opacity-100":s.value||l.value,"cursor-pointer":l.value}]),loading:t.lazy?"lazy":void 0,fetchpriority:s.value?"high":void 0,decoding:s.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":null!=(v=t.node.alt)?v:C(m)("image.preview"),onError:u,onLoad:d,onClick:c},null,42,vn))]}),_:3}))}}),[["__scopeId","data-v-03adbc6f"]]);bn.install=e=>{e.component(bn.__name,bn)};let Ln=null,Mn=!1,_n=Sn;function Nn(e){var n;const t=null!=(n=null==e?void 0:e.default)?n:e;return t&&"function"==typeof t.renderToString?t:null}function An(){try{const e=globalThis;return Nn(null==e?void 0:e.katex)}catch(e){return null}}function Sn(){return d(null,null,function*(){const e=An();if(e)return e;const n=yield import("katex");try{yield import("katex/dist/contrib/mhchem")}catch(t){}return Nn(n)})}function Bn(e){_n=e,Ln=null,Mn=!1}function Cn(e){Bn(null!=e?e:Sn)}function Tn(){Bn(null)}function En(){return"function"==typeof _n}function In(){var e;const n=An();if(n)return Ln=n,Ln;if(Ln)return Ln;const t=_n;if(!t||t===Sn)return null;try{const n=t();return n&&"function"!=typeof(null==n?void 0:n.then)?(Ln=null!=(e=Nn(n))?e:n,Ln):null}catch(o){return null}}function $n(){return d(this,null,function*(){var e;const n=An();if(n)return Ln=n,Ln;if(Ln)return Ln;if(Mn)return null;const t=_n;if(!t)return Mn=!0,null;try{const n=yield t();if(n)return Ln=null!=(e=Nn(n))?e:n,Ln}catch(o){}return Mn=!0,null})}const Wn=W(!1);let On=null;const Hn={key:0},Pn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const n=e,t=(On||(On=$n().then(e=>{Wn.value=!!e}).catch(()=>{Wn.value=!1})),ne(Wn)),o=j(),l=R("markstreamTypewriter",void 0),r=R("markstreamTextStreamState",void 0),i=R("markstreamStreamVersion",void 0),a=H(()=>{const e=o.typewriter;return""===e||!0===e||"true"===e||!1!==e&&"false"!==e&&void 0}),s=H(()=>"boolean"==typeof a.value?a.value:"boolean"!=typeof(null==l?void 0:l.value)||l.value),u=H(()=>{var e;const n=null!=(e=o["index-key"])?e:o.indexKey;return null==n||""===n?"":String(n)}),d=z(n.node.content),c=z(""),m=z(0);function h(){return d.value+c.value}function f(e){d.value=e,c.value=""}function p(){c.value&&(d.value=h(),c.value="")}K([()=>n.node.content,u,s,()=>null==i?void 0:i.value],([e])=>{const n=String(null!=e?e:""),t=h(),o=u.value,l=o?null==r?void 0:r.get(o):void 0,i=null!=l?l:t;return s.value?n===i?(c.value?p():t!==n&&f(n),void(o&&(null==r||r.set(o,n)))):i&&n.startsWith(i)&&n.length>i.length?(d.value=i,c.value=n.slice(i.length),m.value+=1,void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n)))):(f(n),void(o&&(null==r||r.set(o,n))))},{immediate:!0}),K(s,e=>{e||f(h())});const v=H(()=>m.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(n,o)=>(A(),S("span",{class:P([[C(t)&&e.node.center?"text-node-center":""],"whitespace-pre-wrap break-words text-node"])},[d.value?(A(),S("span",Hn,$(d.value),1)):D("",!0),c.value?(A(),S("span",{key:1,class:P(["text-node-stream-delta",[v.value]]),onAnimationend:p},$(c.value),35)):D("",!0)],2))}}),[["__scopeId","data-v-03641323"]]);Pn.install=e=>{e.component(Pn.__name,Pn)};const jn=te(()=>d(null,null,function*(){var e;if("test"===(null==(e=function(){const e=Reflect.get(globalThis,"process");return null==e?void 0:e.env}())?void 0:e.NODE_ENV)&&"undefined"!=typeof window)return e=>{var n,t,o,l;return O(Pn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))};try{if(yield $n())return(yield import("./index2.js")).default}catch(n){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',n)}return e=>{var n,t,o,l;return O(Pn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$${null!=(n=e.node.content)?n:""}$`,raw:null!=(l=e.node.raw)?l:`$${null!=(o=e.node.content)?o:""}$`}}))}})),Rn=te(()=>d(null,null,function*(){try{if(yield $n())return(yield import("./index3.js")).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var n,t,o,l;return O(Pn,s(a({},e),{node:{type:"text",content:null!=(t=e.node.raw)?t:`$$${null!=(n=e.node.content)?n:""}$$`,raw:null!=(l=e.node.raw)?l:`$$${null!=(o=e.node.content)?o:""}$$`}}))}})),zn=/* @__PURE__ */N({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(n,t)=>(A(),S("span",{class:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",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))},$(e.node.id),33))});zn.install=e=>{e.component(zn.__name,zn)};const Kn={class:"superscript-node"},Dn={key:1},Fn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,emphasis:st,footnote_reference:He,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,emoji:Ne,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("sup",Kn,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),S(E,{key:`${e.indexKey||"superscript"}-${l}`},[o[t.type]?(A(),U(oe(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"superscript"}-${l}`},null,8,["node","custom-id","index-key"])):(A(),S("span",Dn,$(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-6dc1e3ba"]]);Fn.install=e=>{e.component(Fn.__name,Fn)};const Vn={class:"subscript-node"},Un={key:1},Xn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,emphasis:st,footnote_reference:He,strikethrough:Jn,highlight:it,insert:lt,superscript:Fn,emoji:Ne,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("sub",Vn,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),S(E,{key:`${e.indexKey||"subscript"}-${l}`},[o[t.type]?(A(),U(oe(o[t.type]),{key:0,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"subscript"}-${l}`},null,8,["node","custom-id","index-key"])):(A(),S("span",Un,$(t.content||t.raw),1))],64))),128))]))}}),[["__scopeId","data-v-69de9b81"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const qn={class:"strong-node"},Gn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,emphasis:st,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,footnote_reference:He,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("strong",qn,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"strong"}-${l}`,"index-key":`${e.indexKey||"strong"}-${l}`,node:t,"custom-id":n.customId},null,8,["index-key","node","custom-id"]))),128))]))}}),[["__scopeId","data-v-af3ce037"]]);Gn.install=e=>{e.component(Gn.__name,Gn)};const Yn={class:"strikethrough-node"},Jn=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,emphasis:st,highlight:it,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,footnote_reference:He,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("del",Yn,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"strikethrough"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-904d5bd1"]]);Jn.install=e=>{e.component(Jn.__name,Jn)};const Zn=["href","title","aria-label","aria-hidden"],Qn=["aria-hidden"],et={class:"link-text-wrapper relative inline-flex"},nt={class:"leading-[normal] link-text"},tt=/* @__PURE__ */ve(/* @__PURE__ */N({__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=H(()=>{const e=null==t?void 0:t.value;return"boolean"==typeof e?e:n.showTooltip}),l=H(()=>{var e,t,o,l,r,i;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",s=null!=(e=n.animationOpacity)?e:.35,u=Math.max(.12,Math.min(.5*s,s));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(o=n.underlineHeight)?o:2}px`,"--underline-bottom":a,"--underline-opacity":String(s),"--underline-rest-opacity":String(u),"--underline-duration":`${null!=(l=n.animationDuration)?l:1.6}s`,"--underline-timing":null!=(r=n.animationTiming)?r:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(i=n.animationIteration)?i:"infinite"}}),r={text:Pn,strong:Gn,strikethrough:Jn,emphasis:st,image:bn,html_inline:Ve,inline_code:qe},i=H(()=>(Ce.value,Ee(n.customId))),s=j(),u=H(()=>{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 Re(l)}),d=H(()=>{const e=a(a({},s),u.value);return delete e.title,e});function c(){o.value&&mn()}const m=H(()=>{var e,t,o;const l=null==(e=n.node)?void 0:e.title;return"string"==typeof l&&l.trim().length>0?l:String(null!=(o=null==(t=n.node)?void 0:t.href)?o:"")});return(t,a)=>{var u,h;return e.node.loading?(A(),S("span",le({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},C(s),{style:l.value}),[T("span",et,[T("span",nt,[B(C(Pn),{class:"leading-[normal] link-text",node:{type:"text",content:String(null!=(u=e.node.text)?u:""),raw:String(null!=(h=e.node.text)?h:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),a[1]||(a[1]=T("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Qn)):(A(),S("a",le({key:0,class:"link-node",href:e.node.href,title:o.value?"":m.value,"aria-label":`Link: ${m.value}`,"aria-hidden":e.node.loading?"true":"false",target:"_blank",rel:"noopener noreferrer"},d.value,{style:l.value,onMouseenter:a[0]||(a[0]=e=>function(e){var t,l,r;if(!o.value)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0,s=(null==(t=n.node)?void 0:t.title)||(null==(l=n.node)?void 0:l.href)||(null==(r=n.node)?void 0:r.text)||"";cn(e.currentTarget,s,"top",!1,a)}(e)),onMouseleave:c}),[(A(!0),S(E,null,I(e.node.children,(t,o)=>(A(),U(oe(function(e){return i.value[e.type]||r[e.type]||null}(t)),{key:`${e.indexKey||"emphasis"}-${o}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"link-text"}-${o}`},null,8,["node","custom-id","index-key"]))),128))],16,Zn))}}}),[["__scopeId","data-v-a4831c9e"]]);tt.install=e=>{e.component(tt.__name,tt)};const ot={class:"insert-node"},lt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,emphasis:st,strikethrough:Jn,highlight:it,subscript:Xn,superscript:Fn,emoji:Ne,footnote_reference:He,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("ins",ot,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"insert"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-ab1ec9bc"]]);lt.install=e=>{e.component(lt.__name,lt)};const rt={class:"highlight-node"},it=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,emphasis:st,strikethrough:Jn,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,footnote_reference:He,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("mark",rt,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"highlight"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-38e31bf6"]]);it.install=e=>{e.component(it.__name,it)};const at={class:"emphasis-node"},st=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,html_inline:Ve,strong:Gn,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,footnote_reference:He,math_inline:jn,reference:zn},t);return(t,l)=>(A(),S("em",at,[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"emphasis"}-${l}`,node:t,"custom-id":n.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-8264674d"]]);st.install=e=>{e.component(st.__name,st)};const ut=["href","title"],dt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const n=e;function t(e){var t;if(e.preventDefault(),"undefined"==typeof document)return;const o=`fnref-${String(null!=(t=n.node.id)?t:"")}`,l=document.getElementById(o);l&&l.scrollIntoView({behavior:"smooth"})}return(n,o)=>(A(),S("a",{class:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:t}," ↩︎ ",8,ut))}}),[["__scopeId","data-v-4756ce0d"]]);dt.install=e=>{e.component(dt.__name,dt)};const ct=["id"],mt={class:"flex-1"},ht=/* @__PURE__ */N({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e;return(t,o)=>(A(),S("div",{id:`fnref--${e.node.id}`,class:"flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"},[T("div",mt,[B(C(cr),{"index-key":`footnote-${n.indexKey}`,nodes:n.node.children,"custom-id":n.customId,typewriter:n.typewriter,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])])],8,ct))}});ht.install=e=>{e.component(ht.__name,ht)};const ft={class:"hard-break"},pt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"HardBreakNode",props:{node:{}},setup:e=>(e,n)=>(A(),S("br",ft))}),[["__scopeId","data-v-50c58f70"]]);pt.install=e=>{e.component(pt.__name,pt)};const vt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const n=e,t=Ee(n.customId),o=a({text:Pn,inline_code:qe,link:tt,image:bn,strong:Gn,emphasis:st,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,checkbox:ke,checkbox_input:ke,footnote_reference:He,hardbreak:pt,math_inline:jn,reference:zn},t);return(t,l)=>(A(),U(oe(`h${e.node.level}`),le({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:G(()=>[(A(!0),S(E,null,I(e.node.children,(t,l)=>(A(),U(oe(o[t.type]),{key:`${e.indexKey||"heading"}-${l}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"heading"}-${l}`},null,8,["custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-ffb7cf51"]]),gt=vt;gt.install=e=>{e.component(vt.__name,vt)};const yt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},value:{},customId:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=e,t=H(()=>{var e;return null!=(e=n.node)?e:n.item}),o=H(()=>null==n.value?{}:{value:n.value});return(e,l)=>{var r,i;return A(),S("li",le({class:"list-item pl-1.5 my-2",dir:"auto"},o.value),[B(C(cr),le({showTooltips:n.showTooltips},{"index-key":`list-item-${n.indexKey}`,nodes:null!=(i=null==(r=t.value)?void 0:r.children)?i:[],"custom-id":n.customId,typewriter:n.typewriter,"batch-rendering":!1,onCopy:l[0]||(l[0]=n=>e.$emit("copy",n))}),null,16,["index-key","nodes","custom-id","typewriter"])],16)}}}),[["__scopeId","data-v-ce59e808"]]);yt.install=e=>{e.component(yt.__name,yt)};const wt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const n=H(()=>(Ce.value,Ee(e.customId).list_item||yt));return(t,o)=>(A(),U(oe(e.node.ordered?"ol":"ul"),{class:P(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:G(()=>[(A(!0),S(E,null,I(e.node.items,(l,r)=>{var i;return A(),U(oe(n.value),le({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:l,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,value:e.node.ordered?(null!=(i=e.node.start)?i:1)+r:void 0,onCopy:o[0]||(o[0]=e=>t.$emit("copy",e))}),null,16,["node","custom-id","index-key","typewriter","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-8e81cbc8"]]);wt.install=e=>{e.component(wt.__name,wt)};const kt=/* @__PURE__ */Symbol("ViewportPriority");function xt(e,n){var t,o;const l="undefined"!=typeof window&&"undefined"!=typeof document,r="boolean"==typeof n?z(n):n,i=l?null!=(t=window.requestIdleCallback)?t:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,a=l?null!=(o=window.cancelIdleCallback)?o:e=>window.clearTimeout(e):null;let s=null,u=null;const d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set;let m=null;function h(){if(!d.size){try{null==s||s.disconnect()}catch(e){}s=null,u=null,c.size||function(){if(null!=m){try{null==a||a(m)}catch(e){}m=null}}()}}function f(e){const n=d.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==s||s.unobserve(e)}catch(t){}d.delete(e),c.delete(e),h()}}function p(){i&&null==m&&c.size&&(m=i(()=>{m=null;const e=c.values().next().value;e&&(c.delete(e),f(e),c.size&&p())},{timeout:1200}))}const v=(n,t)=>{const o=z(!1);let i,a=!1;const m=new Promise(e=>{i=()=>{a||(a=!0,e())}}),v=()=>{try{null==s||s.unobserve(n)}catch(e){}d.delete(n),c.delete(n),h()};if(!l||!r.value)return o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v};const g=function(n,t){if(!l)return s;if("undefined"==typeof IntersectionObserver)return null;const o=function(n,t){var o,l,r;return{root:null!=(o=null==e?void 0:e(null!=n?n:null))?o:null,rootMargin:null!=(l=null==t?void 0:t.rootMargin)?l:"300px",threshold:null!=(r=null==t?void 0:t.threshold)?r:0}}(n,t);if(s&&(i=o,(r=u)&&r.root===i.root&&r.rootMargin===i.rootMargin&&r.threshold===i.threshold))return s;var r,i;if(s)try{s.disconnect()}catch(a){}s=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&f(n.target)},{root:o.root,rootMargin:o.rootMargin,threshold:o.threshold}),u=o;for(const e of d.keys())s.observe(e);return s}(n,t);return g?(d.set(n,{resolve:i,visible:o}),g.observe(n),c.add(n),p(),{isVisible:o,whenVisible:m,destroy:v}):(o.value=!0,i(),{isVisible:o,whenVisible:m,destroy:v})};return re(kt,v),v}function bt(){var e,n;const t=R(kt,void 0);if(t)return t;const o=/* @__PURE__ */new WeakMap;let l=null;const r=/* @__PURE__ */new Set;let i=null;const a="undefined"!=typeof window?null!=(e=window.requestIdleCallback)?e:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,s="undefined"!=typeof window?null!=(n=window.cancelIdleCallback)?n:e=>window.clearTimeout(e):null,u=()=>{if(null!=i){try{null==s||s(i)}catch(e){}i=null}},d=e=>{const n=o.get(e);if(n){if(!n.visible.value){n.visible.value=!0;try{n.resolve()}catch(t){}}try{null==l||l.unobserve(e)}catch(t){}o.delete(e),r.delete(e),r.size||u()}},c=()=>{a&&null==i&&r.size&&(i=a(()=>{i=null;const e=r.values().next().value;e&&(r.delete(e),d(e),r.size&&c())},{timeout:1200}))};return e=>{const n=z(!1);let t,i=!1;const a=new Promise(e=>{t=()=>{i||(i=!0,e())}}),s=()=>{try{null==l||l.unobserve(e)}catch(n){}o.delete(e),r.delete(e),r.size||u()},m=l||("undefined"==typeof window||"undefined"==typeof IntersectionObserver?null:(l=new IntersectionObserver(e=>{for(const n of e)(n.isIntersecting||n.intersectionRatio>0)&&d(n.target)},{root:null,rootMargin:"300px",threshold:0}),l));return m?(o.set(e,{resolve:t,visible:n}),m.observe(e),r.add(e),c(),{isVisible:n,whenVisible:a,destroy:s}):(n.value=!0,t(),{isVisible:n,whenVisible:a,destroy:s})}}const Lt={key:1,class:"html-block-node__raw"},Mt=["innerHTML"],_t={key:1,class:"html-block-node__placeholder"},Nt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"HtmlBlockNode",props:{node:{},customId:{}},setup(e){const n=e,t=H(()=>{const e=n.node.attrs;if(e){if(Array.isArray(e)){const n={};for(const t of e){if(!t||t.length<2)continue;const[e,o]=t;null!=e&&(n[String(e)]=null==o?"":String(o))}return n}return e}}),o=H(()=>(Ce.value,Ee(n.customId))),l=N({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=z(null),i=z("undefined"==typeof window),a=z(n.node.content),s=H(()=>{var e,t,l;if(!i.value)return{mode:"html",content:null!=(e=a.value)?e:""};const r=null!=(t=a.value)?t:n.node.content;if(!r)return{mode:"html",content:""};if(n.node.loading){const e=De(r,o.value);return null===e?{mode:"text",content:null!=(l=n.node.raw)?l:r}:{mode:"dynamic",nodes:e}}if(!Ke(r,o.value))return{mode:"html",content:r};const s=De(r,o.value);return null===s?{mode:"html",content:r}:{mode:"dynamic",nodes:s}}),u=bt(),d=z(null),c=!!n.node.loading;return"undefined"!=typeof window?(K(r,e=>{var t,o;if(null==(o=null==(t=d.value)?void 0:t.destroy)||o.call(t),d.value=null,!c)return i.value=!0,void(a.value=n.node.content);if(!e)return void(i.value=!1);const l=u(e,{rootMargin:"400px"});d.value=l,i.value=l.isVisible.value,l.whenVisible.then(()=>{i.value=!0})},{immediate:!0}),K(()=>n.node.content,e=>{c&&!i.value||(a.value=e)})):i.value=!0,V(()=>{var e,n;null==(n=null==(e=d.value)?void 0:e.destroy)||n.call(e),d.value=null}),(n,o)=>(A(),S("div",le({ref_key:"htmlRef",ref:r,class:"html-block-node"},t.value),[i.value?(A(),S(E,{key:0},["dynamic"===s.value.mode?(A(),U(C(l),{key:0,nodes:s.value.nodes},null,8,["nodes"])):"text"===s.value.mode?(A(),S("pre",Lt,$(s.value.content),1)):(A(),S("div",{key:2,innerHTML:a.value},null,8,Mt))],64)):(A(),S("div",_t,[ee(n.$slots,"placeholder",{node:e.node},()=>[o[0]||(o[0]=T("span",{class:"html-block-node__placeholder-bar"},null,-1)),o[1]||(o[1]=T("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),o[2]||(o[2]=T("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))],16))}}),[["__scopeId","data-v-b7cace40"]]);Nt.install=e=>{e.component(Nt.__name,Nt)};const At={dir:"auto",class:"paragraph-node"},St=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{}},setup(e){const n=e,t=Ee(n.customId);function o(e){var n;return"text"===e.type&&""===String(null!=(n=e.content)?n:"").trim()}function l(e){var n;return String(null!=(n=e.content)?n:"")}const r=H(()=>n.node.children.filter(e=>!o(e))),i=H(()=>r.value.length>0&&r.value.every(e=>"image"===e.type||function(e){var n;const t=function(e){return"link"===e.type&&Array.isArray(e.children)?e.children.filter(e=>!o(e)):[]}(e);return 1===t.length&&"image"===(null==(n=t[0])?void 0:n.type)}(e))),u=H(()=>new Set(g(n.customHtmlTags))),d=H(()=>{if(!i.value||r.value.length<=1)return n.node.children;const e=[];for(let t=0;t<n.node.children.length;t++){const l=n.node.children[t];if(!o(l)){e.push(l);continue}const r=e.length>0,i=n.node.children.slice(t+1).some(e=>!o(e));r&&i&&e.push(s(a({},l),{content:" ",raw:" "}))}return e});function c(e,t){return{node:e,"index-key":`${n.indexKey}-${t}`,"custom-id":n.customId,"custom-html-tags":n.customHtmlTags}}const m=a({inline_code:qe,image:bn,link:tt,hardbreak:pt,emphasis:st,strong:Gn,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,superscript:Fn,html_inline:Ve,html_block:Nt,emoji:Ne,checkbox:ke,math_inline:jn,checkbox_input:ke,reference:zn,footnote_anchor:dt,footnote_reference:He,text:Pn},t);function h(e){var n,t,o,l;if("html_block"===e.type||"html_inline"===e.type){const r=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(r&&!u.value.has(r)&&w(null!=(t=e.content)?t:e.raw,r)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");return{child:{type:"text",content:n,raw:n},component:Pn}}}return{child:e,component:m[e.type]}}return(n,t)=>(A(),S("p",At,[(A(!0),S(E,null,I(d.value,(n,t)=>(A(),S(E,{key:`${e.indexKey||"paragraph"}-${t}`},[i.value&&o(n)?(A(),S(E,{key:0},[ie($(l(n)),1)],64)):(A(),U(oe(h(n).component),le({key:1,ref_for:!0},c(h(n).child,t)),null,16))],64))),128))]))}}),[["__scopeId","data-v-944f1fd5"]]);St.install=e=>{e.component(St.__name,St)};const Bt=["aria-busy","aria-label","data-language"],Ct=["textContent"],Tt=/* @__PURE__ */N({__name:"PreCodeNode",props:{node:{}},setup(e){const n=e,t=H(()=>{var e,t,o;const l=String(null!=(t=null==(e=n.node)?void 0:e.language)?t:"");return String(null!=(o=String(l).split(/\s+/g)[0])?o:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),o=H(()=>`language-${t.value}`),l=H(()=>{const e=t.value;return e?`Code block: ${e}`:"Code block"});return(n,r)=>(A(),S("pre",{class:P([o.value]),"aria-busy":!0===e.node.loading,"aria-label":l.value,"data-language":t.value,"data-markstream-pre":"1",tabindex:"0"},[T("code",{translate:"no",textContent:$(e.node.code)},null,8,Ct)],10,Bt))}});Tt.install=e=>{e.component(Tt.__name,Tt)};const Et={class:"table-node-wrapper"},It=["aria-busy"],$t={class:"border-[var(--table-border,#cbd5e1)]"},Wt={class:"border-b"},Ot={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},Ht=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e){const n=e,t=H(()=>{var e;return null!=(e=n.node.loading)&&e}),o=H(()=>{var e;return null!=(e=n.node.rows)?e:[]});return(l,r)=>(A(),S("div",Et,[T("table",{class:P(["my-8 text-sm table-node",{"table-node--loading":t.value}]),"aria-busy":t.value},[T("thead",$t,[T("tr",Wt,[(A(!0),S(E,null,I(e.node.header.cells,(e,t)=>(A(),S("th",{key:`header-${t}`,dir:"auto",class:P(["font-semibold p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]])},[B(C(cr),{nodes:e.children,"index-key":`table-th-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[0]||(r[0]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))])]),T("tbody",null,[(A(!0),S(E,null,I(o.value,(e,t)=>(A(),S("tr",{key:`row-${t}`,class:P(["border-[var(--table-border,#cbd5e1)]",[t<o.value.length-1?"border-b":""]])},[(A(!0),S(E,null,I(e.cells,(e,o)=>(A(),S("td",{key:`cell-${t}-${o}`,class:P(["p-[calc(4/7*1em)]",["right"===e.align?"text-right":"center"===e.align?"text-center":"text-left"]]),dir:"auto"},[B(C(cr),{nodes:e.children,"index-key":`table-td-${n.indexKey}`,"custom-id":n.customId,typewriter:n.typewriter,onCopy:r[1]||(r[1]=e=>l.$emit("copy",e))},null,8,["nodes","index-key","custom-id","typewriter"])],2))),128))],2))),128))])],10,It),B(q,{name:"table-node-fade"},{default:G(()=>[t.value?(A(),S("div",Ot,[ee(l.$slots,"loading",{isLoading:t.value},()=>[r[2]||(r[2]=T("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),r[3]||(r[3]=T("span",{class:"sr-only"},"Loading",-1))],!0)])):D("",!0)]),_:3})]))}}),[["__scopeId","data-v-369096fa"]]);Ht.install=e=>{e.component(Ht.__name,Ht)};const Pt={class:"hr-node"},jt=/* @__PURE__ */ve({},[["render",function(e,n){return A(),S("hr",Pt)}],["__scopeId","data-v-639cbad9"]]);jt.install=e=>{e.component(jt.__name,jt)};const Rt={class:"unknown-node"},zt=/* @__PURE__ */N({__name:"FallbackComponent",props:{node:{}},setup:e=>(n,t)=>(A(),S("div",Rt,$(e.node.raw),1))}),Kt=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},setup(e){const n=e,t=H(()=>`vmr-container vmr-container-${n.node.name}`),o=Ee(n.customId),l=a({text:Pn,paragraph:St,heading:gt,inline_code:qe,link:tt,image:bn,strong:Gn,emphasis:st,strikethrough:Jn,insert:lt,subscript:Xn,superscript:Fn,checkbox:ke,checkbox_input:ke,hardbreak:pt,math_inline:jn,reference:zn,list:wt,math_block:Rn,table:Ht},o);return(o,r)=>(A(),S("div",le({class:t.value},e.node.attrs),[(A(!0),S(E,null,I(e.node.children,(t,o)=>{return A(),U(oe((r=t.type,l[r]||zt)),{key:`${e.indexKey||"vmr-container"}-${o}`,"custom-id":n.customId,node:t,"index-key":`${e.indexKey||"vmr-container"}-${o}`},null,8,["custom-id","node","index-key"]);var r}),128))],16))}}),[["__scopeId","data-v-a88d22ce"]]);Kt.install=e=>{e.component(Kt.__name,Kt)};const Dt=["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","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","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","ON","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"],Ft=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"];function Vt(e){return e<=255?Dt[e]:1424<=e&&e<=1524?"R":1536<=e&&e<=1791?Ft[255&e]:1792<=e&&e<=2220?"AL":"L"}const Ut=/[ \t\n\r\f]+/g,Xt=/[\t\n\r\f]| {2,}|^ | $/;let qt=null;const Gt=new RegExp("\\p{Script=Arabic}","u"),Yt=new RegExp("\\p{M}","u"),Jt=new RegExp("\\p{Nd}","u");function Zt(e){return Gt.test(e)}function Qt(e){for(const n of e){const e=n.codePointAt(0);if(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>=196608&&e<=201551||e>=63744&&e<=64255||e>=194560&&e<=195103||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519)return!0}return!1}const eo=/* @__PURE__ */new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),no=/* @__PURE__ */new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),to=/* @__PURE__ */new Set(["'","’"]),oo=/* @__PURE__ */new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),lo=/* @__PURE__ */new Set([":",".","،","؛"]),ro=/* @__PURE__ */new Set(["၏"]),io=/* @__PURE__ */new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function ao(e){if(co(e))return!0;let n=!1;for(const t of e)if(oo.has(t))n=!0;else if(!n||!Yt.test(t))return!1;return n}function so(e){for(const n of e)if(!eo.has(n)&&!oo.has(n))return!1;return e.length>0}function uo(e){if(co(e))return!0;for(const n of e)if(!no.has(n)&&!to.has(n)&&!Yt.test(n))return!1;return e.length>0}function co(e){let n=!1;for(const t of e)if("\\"!==t&&!Yt.test(t)){if(!(no.has(t)||oo.has(t)||to.has(t)))return!1;n=!0}return n}function mo(e){const n=Array.from(e);let t=n.length;for(;t>0;){const e=n[t-1];if(Yt.test(e))t--;else{if(!no.has(e)&&!to.has(e))break;t--}}return t<=0||t===n.length?null:{head:n.slice(0,t).join(""),tail:n.slice(t).join("")}}function ho(e,n){if(0===e.length)return!1;for(const t of e)if(t!==n)return!1;return!0}function fo(e){return!(!Zt(e)||0===e.length)&&lo.has(e[e.length-1])}function po(e){return 0!==e.length&&ro.has(e[e.length-1])}function vo(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 go(e){for(let n=e.length-1;n>=0;n--){const t=e[n];if(io.has(t))return!0;if(!oo.has(t))return!1}return!1}function yo(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"}function wo(e,n,t,o){const l=[];let r=null,i="",a=t,s=!1,u=0;for(const d of e){const e=yo(d,o),c="text"===e&&n;null===r||e!==r||c!==s?(null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),r=e,i=d,a=t+u,s=c,u+=d.length):(i+=d,u+=d.length)}return null!==r&&l.push({text:i,isWordLike:s,kind:r,start:a}),l}function ko(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}const xo=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function bo(e,n){const t=e.texts[n];return!!t.startsWith("www.")||xo.test(t)&&n+1<e.len&&"text"===e.kinds[n+1]&&"//"===e.texts[n+1]}function Lo(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const Mo=/* @__PURE__ */new Set([":","-","/","×",",",".","+","–","—"]),_o=/^[A-Za-z0-9_]+[,:;]*$/,No=/[,:;]+$/;function Ao(e){for(const n of e)if(Jt.test(n))return!0;return!1}function So(e){if(0===e.length)return!1;for(const n of e)if(!Jt.test(n)&&!Mo.has(n))return!1;return!0}function Bo(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 Co(e,n,t="normal"){const o=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),l="pre-wrap"===o.mode?function(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n")}(e):function(e){if(!Xt.test(e))return e;let n=e.replace(Ut," ");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===l.length)return{normalized:l,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=function(e,n,t){var o;const l=(null===qt&&(qt=new Intl.Segmenter(void 0,{granularity:"word"})),qt);let r=0;const i=[],a=[],s=[],u=[];for(const m of l.segment(e))for(const e of wo(m.segment,null!=(o=m.isWordLike)&&o,m.index,t)){const t="text"===e.kind;n.carryCJKAfterClosingQuote&&t&&r>0&&"text"===s[r-1]&&Qt(e.text)&&Qt(i[r-1])&&go(i[r-1])||t&&r>0&&"text"===s[r-1]&&so(e.text)&&Qt(i[r-1])||t&&r>0&&"text"===s[r-1]&&po(i[r-1])?(i[r-1]+=e.text,a[r-1]=a[r-1]||e.isWordLike):t&&r>0&&"text"===s[r-1]&&e.isWordLike&&Zt(e.text)&&fo(i[r-1])?(i[r-1]+=e.text,a[r-1]=!0):t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&1===e.text.length&&"-"!==e.text&&"—"!==e.text&&ho(i[r-1],e.text)||t&&!e.isWordLike&&r>0&&"text"===s[r-1]&&(ao(e.text)||"-"===e.text&&a[r-1])?i[r-1]+=e.text:(i[r]=e.text,a[r]=e.isWordLike,s[r]=e.kind,u[r]=e.start,r++)}for(let m=1;m<r;m++)"text"===s[m]&&!a[m]&&co(i[m])&&"text"===s[m-1]&&(i[m-1]+=i[m],a[m-1]=a[m-1]||a[m],i[m]="");for(let m=r-2;m>=0;m--)if("text"===s[m]&&!a[m]&&uo(i[m])){let e=m+1;for(;e<r&&""===i[e];)e++;e<r&&"text"===s[e]&&(i[e]=i[m]+i[e],u[e]=u[m],i[m]="")}let d=0;for(let m=0;m<r;m++){const e=i[m];0!==e.length&&(d!==m&&(i[d]=e,a[d]=a[m],s[d]=s[m],u[d]=u[m]),d++)}i.length=d,a.length=d,s.length=d,u.length=d;const c=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(!Qt(n[r])||!Qt(n[r+1]))continue;const e=mo(n[r]);null!==e&&(n[r]=e.head,n[r+1]=e.tail+n[r+1],l[r+1]=l[r]+e.head.length)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r],s=e.isWordLike[r];if("text"===a&&s&&_o.test(i)){let a=i,s=r+1;for(;No.test(a)&&s<e.len&&"text"===e.kinds[s]&&e.isWordLike[s]&&_o.test(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(s),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if("text"===e.kinds[r]&&i.includes("-")){const a=i.split("-");let s=a.length>1;for(let e=0;e<a.length;e++){const n=a[e];if(!s)break;0!==n.length&&Ao(n)&&So(n)||(s=!1)}if(s){let i=0;for(let s=0;s<a.length;s++){const u=a[s],d=s<a.length-1?`${u}-`:u;n.push(d),t.push(!0),o.push("text"),l.push(e.starts[r]+i),i+=d.length}continue}}n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r],a=e.kinds[r];if("text"===a&&So(i)&&Ao(i)){let a=i,s=r+1;for(;s<e.len&&"text"===e.kinds[s]&&So(e.texts[s]);)a+=e.texts[s],s++;n.push(a),t.push(!0),o.push("text"),l.push(e.starts[r]),r=s-1;continue}n.push(i),t.push(e.isWordLike[r]),o.push(a),l.push(e.starts[r])}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=[],t=[],o=[],l=[];for(let r=0;r<e.len;r++){const i=e.texts[r];if(n.push(i),t.push(e.isWordLike[r]),o.push(e.kinds[r]),l.push(e.starts[r]),!Lo(i))continue;const a=r+1;if(a>=e.len||ko(e.kinds[a]))continue;let s="";const u=e.starts[a];let d=a;for(;d<e.len&&!ko(e.kinds[d]);)s+=e.texts[d],d++;s.length>0&&(n.push(s),t.push(!0),o.push("text"),l.push(u),r=d-1)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}(function(e){const n=e.texts.slice(),t=e.isWordLike.slice(),o=e.kinds.slice(),l=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==o[i]||!bo(e,i))continue;let l=i+1;for(;l<e.len&&!ko(o[l]);){n[i]+=n[l],t[i]=!0;const e=n[l].includes("?");if(o[l]="text",n[l]="",l++,e)break}}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;){let i=e.texts[r],a=e.isWordLike[r],s=e.kinds[r],u=e.starts[r];if("glue"===s){let d=i;const c=u;for(r++;r<e.len&&"glue"===e.kinds[r];)d+=e.texts[r],r++;if(!(r<e.len&&"text"===e.kinds[r])){n.push(d),t.push(!1),o.push("glue"),l.push(c);continue}i=d+e.texts[r],a=e.isWordLike[r],s="text",u=c,r++}else r++;if("text"===s)for(;r<e.len&&"glue"===e.kinds[r];){let n="";for(;r<e.len&&"glue"===e.kinds[r];)n+=e.texts[r],r++;r<e.len&&"text"===e.kinds[r]?(i+=n+e.texts[r],a=a||e.isWordLike[r],r++):i+=n}n.push(i),t.push(a),o.push(s),l.push(u)}return{len:n.length,texts:n,isWordLike:t,kinds:o,starts:l}}({len:d,texts:i,isWordLike:a,kinds:s,starts:u})))))));for(let m=0;m<c.len-1;m++){const e=vo(c.texts[m]);null!==e&&("space"!==c.kinds[m]&&"preserved-space"!==c.kinds[m]||"text"!==c.kinds[m+1]||!Zt(c.texts[m+1])||(c.texts[m]=e.space,c.isWordLike[m]=!1,c.kinds[m]="preserved-space"===c.kinds[m]?"preserved-space":"space",c.texts[m+1]=e.marks+c.texts[m+1],c.starts[m+1]=c.starts[m]+e.space.length))}return c}(l,n,o);return a({normalized:l,chunks:Bo(r,o)},r)}let To=null;const Eo=/* @__PURE__ */new Map;let Io=null;const $o=new RegExp("\\p{Emoji_Presentation}","u"),Wo=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Oo=null;const Ho=/* @__PURE__ */new Map;function Po(){if(null!==To)return To;if("undefined"!=typeof OffscreenCanvas)return To=new OffscreenCanvas(1,1).getContext("2d"),To;if("undefined"!=typeof document)return To=document.createElement("canvas").getContext("2d"),To;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function jo(e,n){let t=n.get(e);return void 0===t&&(t={width:Po().measureText(e).width,containsCJK:Qt(e)},n.set(e,t)),t}function Ro(){if(null!==Io)return Io;if("undefined"==typeof navigator)return Io={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Io;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 Io={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:t,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Io}function zo(){return null===Oo&&(Oo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Oo}function Ko(e){return $o.test(e)||e.includes("️")}function Do(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=zo();for(const o of t.segment(e))Ko(o.segment)&&n++;return n}(e)),n.emojiCount}(e,n)*t}function Fo(e,n,t,o){if(void 0!==n.graphemeWidths)return n.graphemeWidths;const l=[],r=zo();for(const i of r.segment(e)){const e=jo(i.segment,t);l.push(Do(i.segment,e,o))}return n.graphemeWidths=l.length>1?l:null,n.graphemeWidths}function Vo(e,n,t,o){if(void 0!==n.graphemePrefixWidths)return n.graphemePrefixWidths;const l=[],r=zo();let i="";for(const a of r.segment(e)){i+=a.segment;const e=jo(i,t);l.push(Do(i,e,o))}return n.graphemePrefixWidths=l.length>1?l:null,n.graphemePrefixWidths}function Uo(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function Xo(e){return"space"===e}function qo(e,n){if(n<=0)return 0;const t=e%n;return Math.abs(t)<=1e-6?n:n-t}function Go(e,n,t,o){return o&&null!==n?n[t]-(t>0?n[t-1]:0):e[t]}function Yo(e,n){return e.simpleLineWalkFastPath?function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Ro(),a=i.lineFitEpsilon;let s=0,u=0,d=!1;function c(e){var o;const c=t[e];if(c>n&&null!==l[e]){const t=l[e],d=null!=(o=r[e])?o:null;u=0;for(let e=0;e<t.length;e++){const o=Go(t,d,e,i.preferPrefixWidthsForBreakableRuns);u>0&&u+o>n+a?(s++,u=o):(0===u&&s++,u+=o)}}else u=c,s++;d=!0}for(let m=0;m<t.length;m++){const e=t[m],l=o[m];if(!d){c(m);continue}const r=u+e;if(r>n+a){if(Xo(l))continue;u=0,d=!1,c(m)}else u=r}return d?s:s+1}(e,n):function(e,n){if(e.simpleLineWalkFastPath)return function(e,n){const{widths:t,kinds:o,breakableWidths:l,breakablePrefixWidths:r}=e;if(0===t.length)return 0;const i=Ro(),a=i.lineFitEpsilon;let s=0,u=0,d=!1,c=0,m=0,h=-1,f=0;function p(e=c,n=m,t=u){s++,u=0,d=!1,h=-1,f=0}function v(e,n){d=!0,c=e+1,m=0,u=n}function g(e,n,t){d=!0,c=e,m=n+1,u=t}function y(e,n){d?(u+=n,c=e+1,m=0):v(e,n)}function w(e,n){Uo(o[e])&&(h=e+1,f=u-n)}function k(e){!function(e,t){var o;const s=l[e],h=null!=(o=r[e])?o:null;for(let l=t;l<s.length;l++){const t=Go(s,h,l,i.preferPrefixWidthsForBreakableRuns);d?u+t>n+a?(p(),g(e,l,t)):(u+=t,c=e,m=l+1):g(e,l,t)}d&&c===e&&m===s.length&&(c=e+1,m=0)}(e,0)}let x=0;for(;x<t.length;){const e=t[x],r=o[x];if(d)if(u+e>n+a){if(Uo(r)){y(x,e),p(x+1,0,u-e),x++;continue}if(h>=0){p(h,0,f);continue}if(e>n&&null!==l[x]){p(),k(x),x++;continue}p()}else y(x,e),w(x,e),x++;else e>n&&null!==l[x]?k(x):v(x,e),w(x,e),x++}return d&&p(),s}(e,n);const{widths:t,lineEndFitAdvances:o,lineEndPaintAdvances:l,kinds:r,breakableWidths:i,breakablePrefixWidths:a,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:d}=e;if(0===t.length||0===d.length)return 0;const c=Ro(),m=c.lineFitEpsilon;let h=0,f=0,p=!1,v=0,g=0,y=-1,w=0,k=0,x=null;function b(){y=-1,w=0,k=0,x=null}function L(e=v,n=g,t=f){h++,f=0,p=!1,b()}function M(e,n){p=!0,v=e+1,g=0,f=n}function _(e,n,t){p=!0,v=e,g=n+1,f=t}function N(e,n){p?(f+=n,v=e+1,g=0):M(e,n)}function A(e,n){if(!Uo(r[e]))return;const t="tab"===r[e]?0:o[e],i="tab"===r[e]?n:l[e];y=e+1,w=f-n+t,k=f-n+i,x=r[e]}function S(e){B(e,0)}function B(e,t){var o;const l=i[e],r=null!=(o=a[e])?o:null;for(let i=t;i<l.length;i++){const t=Go(l,r,i,c.preferPrefixWidthsForBreakableRuns);p?f+t>n+m?(L(),_(e,i,t)):(f+=t,v=e,g=i+1):_(e,i,t)}p&&v===e&&g===l.length&&(v=e+1,g=0)}function C(e){var t;if("soft-hyphen"!==x)return!1;const o=i[e];if(null===o)return!1;const l=c.preferPrefixWidthsForBreakableRuns&&null!=(t=a[e])?t:o,r=l!==o,{fitCount:u,fittedWidth:d}=function(e,n,t,o,l,r){let i=0,a=n;for(;i<e.length;){const s=r?n+e[i]:a+e[i];if((i+1<e.length?s+l:s)>t+o)break;a=s,i++}return{fitCount:i,fittedWidth:a}}(l,f,n,m,s,r);return 0!==u&&(f=d,v=e,g=u,b(),u===o.length?(v=e+1,g=0,!0):(L(e,u,d+s),B(e,u),!0))}function T(e){h++,b()}for(let E=0;E<d.length;E++){const e=d[E];if(e.startSegmentIndex===e.endSegmentIndex){T();continue}p=!1,f=0,e.startSegmentIndex,v=e.startSegmentIndex,g=0,b();let a=e.startSegmentIndex;for(;a<e.endSegmentIndex;){const e=r[a],d="tab"===e?qo(f,u):t[a];if("soft-hyphen"!==e)if(p){if(f+d>n+m){const t=f+("tab"===e?0:o[a]),r=f+("tab"===e?d:l[a]);if("soft-hyphen"===x&&c.preferEarlySoftHyphenBreak&&w<=n+m){L(y,0,k);continue}if("soft-hyphen"===x&&C(a)){a++;continue}if(Uo(e)&&t<=n+m){N(a,d),L(a+1,0,r),a++;continue}if(y>=0&&w<=n+m){L(y,0,k);continue}if(d>n&&null!==i[a]){L(),S(a),a++;continue}L();continue}N(a,d),A(a,d),a++}else d>n&&null!==i[a]?S(a):M(a,d),A(a,d),a++;else p&&(v=a+1,g=0,y=a+1,w=f+s,k=f+s,x=e),a++}if(p){const n=y===e.consumedEndSegmentIndex?k:f;L(e.consumedEndSegmentIndex,0,n)}}return h}(e,n)}let Jo=null;function Zo(e,n,t){const o=(null===Jo&&(Jo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Jo),l=Ro(),{cache:r,emojiCorrection:i}=function(e,n){Po().font=e;const t=function(e){let n=Eo.get(e);return n||(n=/* @__PURE__ */new Map,Eo.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=Ho.get(e);if(void 0!==t)return t;const o=Po();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 Ho.set(e,t),t}(e,o):0;return{cache:t,fontSize:o,emojiCorrection:l}}(n,(a=e.normalized,Wo.test(a)));var a;const s=Do("-",jo("-",r),i),u=8*Do(" ",jo(" ",r),i);if(0===e.len)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const d=[],c=[],m=[],h=[];let f=e.chunks.length<=1;const p=t?[]:null,v=[],g=[],y=t?[]:null,w=Array.from({length:e.len}),k=Array.from({length:e.len});function x(e,n,t,o,l,r,i,a){"text"!==l&&"space"!==l&&"zero-width-break"!==l&&(f=!1),d.push(n),c.push(t),m.push(o),h.push(l),null==p||p.push(r),v.push(i),g.push(a),null!==y&&y.push(e)}for(let M=0;M<e.len;M++){w[M]=d.length;const n=e.texts[M],t=e.isWordLike[M],a=e.kinds[M],u=e.starts[M];if("soft-hyphen"===a){x(n,0,s,s,a,u,null,null),k[M]=d.length;continue}if("hard-break"===a){x(n,0,0,0,a,u,null,null),k[M]=d.length;continue}if("tab"===a){x(n,0,0,0,a,u,null,null),k[M]=d.length;continue}const c=jo(n,r);if("text"===a&&c.containsCJK){let e="",t=0;for(const a of o.segment(n)){const n=a.segment;if(0===e.length){e=n,t=a.index;continue}if(no.has(e)||eo.has(n)||oo.has(n)||l.carryCJKAfterClosingQuote&&Qt(n)&&go(e)){e+=n;continue}const o=Do(e,jo(e,r),i);x(e,o,o,o,"text",u+t,null,null),e=n,t=a.index}if(e.length>0){const n=Do(e,jo(e,r),i);x(e,n,n,n,"text",u+t,null,null)}k[M]=d.length;continue}const m=Do(n,c,i),h="space"===a||"preserved-space"===a||"zero-width-break"===a?0:m,f="space"===a||"zero-width-break"===a?0:m;t&&n.length>1?x(n,m,h,f,a,u,Fo(n,c,r,i),l.preferPrefixWidthsForBreakableRuns?Vo(n,c,r,i):null):x(n,m,h,f,a,u,null,null),k[M]=d.length}const b=function(e,n,t){var o,l,r;const i=[];for(let a=0;a<e.length;a++){const s=e[a],u=s.startSegmentIndex<n.length?n[s.startSegmentIndex]:null!=(o=t[t.length-1])?o:0,d=s.endSegmentIndex<n.length?n[s.endSegmentIndex]:null!=(l=t[t.length-1])?l:0,c=s.consumedEndSegmentIndex<n.length?n[s.consumedEndSegmentIndex]:null!=(r=t[t.length-1])?r:0;i.push({startSegmentIndex:u,endSegmentIndex:d,consumedEndSegmentIndex:c})}return i}(e.chunks,w,k),L=null===p?null:function(e,n){const t=function(e){const n=e.length;if(0===n)return null;const t=new Array(n);let o=0;for(let u=0;u<n;u++){const n=Vt(e.charCodeAt(u));"R"!==n&&"AL"!==n&&"AN"!==n||o++,t[u]=n}if(0===o)return null;const l=n/o<.3?0:1,r=new Int8Array(n);for(let u=0;u<n;u++)r[u]=l;const i=1&l?"R":"L",a=i;let s=a;for(let u=0;u<n;u++)"NSM"===t[u]?t[u]=s:s=t[u];s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="AL"===s?"AN":"EN":"R"!==e&&"L"!==e&&"AL"!==e||(s=e)}for(let u=0;u<n;u++)"AL"===t[u]&&(t[u]="R");for(let u=1;u<n-1;u++)"ES"===t[u]&&"EN"===t[u-1]&&"EN"===t[u+1]&&(t[u]="EN"),"CS"!==t[u]||"EN"!==t[u-1]&&"AN"!==t[u-1]||t[u+1]!==t[u-1]||(t[u]=t[u-1]);for(let u=0;u<n;u++){if("EN"!==t[u])continue;let e;for(e=u-1;e>=0&&"ET"===t[e];e--)t[e]="EN";for(e=u+1;e<n&&"ET"===t[e];e++)t[e]="EN"}for(let u=0;u<n;u++){const e=t[u];"WS"!==e&&"ES"!==e&&"ET"!==e&&"CS"!==e||(t[u]="ON")}s=a;for(let u=0;u<n;u++){const e=t[u];"EN"===e?t[u]="L"===s?"L":"EN":"R"!==e&&"L"!==e||(s=e)}for(let u=0;u<n;u++){if("ON"!==t[u])continue;let e=u+1;for(;e<n&&"ON"===t[e];)e++;const o="L"!==(u>0?t[u-1]:a)?"R":"L";if(o===("L"!==(e<n?t[e]:a)?"R":"L"))for(let n=u;n<e;n++)t[n]=o;u=e-1}for(let u=0;u<n;u++)"ON"===t[u]&&(t[u]=i);for(let u=0;u<n;u++){const e=t[u];1&r[u]?"L"!==e&&"AN"!==e&&"EN"!==e||r[u]++:"R"===e?r[u]++:"AN"!==e&&"EN"!==e||(r[u]+=2)}return r}(e);if(null===t)return null;const o=new Int8Array(n.length);for(let l=0;l<n.length;l++)o[l]=t[n[l]];return o}(e.normalized,p);return null!==y?{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b,segments:y}:{widths:d,lineEndFitAdvances:c,lineEndPaintAdvances:m,kinds:h,simpleLineWalkFastPath:f,segLevels:L,breakableWidths:v,breakablePrefixWidths:g,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:b}}const Qo="__MARKSTREAM_VUE_HEIGHT_ESTIMATION_EXPERIMENT__",el=(()=>{const e=globalThis;if(e[Qo])return e[Qo];const n={configs:{},controllers:{},revision:W(0),preparedCache:/* @__PURE__ */new Map,blockEstimateCache:/* @__PURE__ */new Map};return e[Qo]=n,n})();let nl=null;const tl=el.revision;function ol(e){var n;return e&&null!=(n=el.configs[e])?n:null}function ll(e,n){const t=Number.parseFloat(String(null!=e?e:""));return Number.isFinite(t)&&t>0?t:n}function rl(e){return"text"===(null==e?void 0:e.type)||"emoji"===(null==e?void 0:e.type)||"hardbreak"===(null==e?void 0:e.type)}function il(e){var n,t,o;if(!Array.isArray(e)||0===e.length)return null;let l="";for(const r of e){if(!rl(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 al(e,n,t){var o,l;if(!e||!Number.isFinite(n)||n<=0||!function(){var e;if(null!=nl)return nl;if("undefined"==typeof document)return!1;try{const n=document.createElement("canvas");return nl=!!(null==(e=n.getContext)?void 0:e.call(n,"2d")),nl}catch(n){return nl=!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=el.blockEstimateCache.get(i);if(a)return el.blockEstimateCache.delete(i),el.blockEstimateCache.set(i,a),{kind:"simple-text",height:a.height,contentHeight:a.contentHeight};const s=null!=(l=t.whiteSpace)?l:"pre-wrap",u=function(e,n,t){const o=`${t}\0${n}\0${e}`,l=el.preparedCache.get(o);if(l)return el.preparedCache.delete(o),el.preparedCache.set(o,l),l.prepared;const r=function(e,n,t){return function(e,n,t,o){return Zo(Co(e,Ro(),null==o?void 0:o.whiteSpace),n,!1)}(e,n,0,t)}(e,n,{whiteSpace:t});for(el.preparedCache.set(o,{prepared:r});el.preparedCache.size>240;){const e=el.preparedCache.keys().next().value;if(!e)break;el.preparedCache.delete(e)}return r}(e,t.font,s),d=function(e,n,t){const o=Yo(e,n);return{lineCount:o,height:o*t}}(u,Math.max(24,r-t.widthAdjustment),t.lineHeight),c=Math.max(t.lineHeight,d.height),m=Math.max(t.lineHeight,Math.round(c+t.wrapperOverhead));for(el.blockEstimateCache.set(i,{height:m,contentHeight:Math.round(c)});el.blockEstimateCache.size>4e3;){const e=el.blockEstimateCache.keys().next().value;if(!e)break;el.blockEstimateCache.delete(e)}return{kind:"simple-text",height:m,contentHeight:Math.round(c)}}catch(r){return null}}function sl(e,n,t){var o,l;if(!t||!e||!Number.isFinite(n)||n<=0)return null;if("paragraph"===e.type){const o=il(e.children);return o&&t.paragraph?al(o,n,t.paragraph):null}if("heading"===e.type){const o=Number(e.level||0),l=il(e.children),r=t.headings[o];return l&&r?al(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=il(null==(l=r[0])?void 0:l.children);return i?al(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=sl(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 ul(e){if(!e)return 1;const n=String(e).split(/\r?\n/);return Math.max(1,n.length)}function dl(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function cl(e,n,t="pre-wrap"){if(!e||!n||"undefined"==typeof window)return null;const o=window.getComputedStyle(n),l=e.offsetHeight,r=ll(o.lineHeight,1.5*ll(o.fontSize,16)),i=e.getBoundingClientRect().width,a=n.getBoundingClientRect().width;return{font:dl(o),lineHeight:r,wrapperOverhead:Math.max(0,l-r),widthAdjustment:Math.max(0,i-a),whiteSpace:t}}let ml=!1,hl=null,fl=!1,pl=null;function vl(){return d(this,null,function*(){return hl||pl||(fl?null:(pl=d(null,null,function*(){try{return hl=yield import("stream-monaco"),yield function(e){return d(this,null,function*(){if(ml)return;ml=!0;const n=null==globalThis?void 0:globalThis.MonacoEnvironment;return!n||"function"!=typeof n.getWorker&&"function"!=typeof n.getWorkerUrl?e.preloadMonacoWorkers():void 0})}(hl),hl}catch(e){return fl=!0,null}finally{pl=null}}),pl))})}function gl({R:e,H:n=0,B:t=50}){const o=e*(1-n)||1e-6;return Math.max(1,Math.floor(t/o))}function yl(e){const n=e.length+10*(e.match(/\\/g)||[]).length;return n<10?"simple":n<40?"medium":"complex"}function wl(e){switch(e){case"simple":return 3;case"medium":return 10;case"complex":return 30}}function kl(e,n){var t,o;let l=0;for(const r of e){const e=wl(yl(r));e>l&&(l=e)}return gl({R:l,H:null!=(t=null==n?void 0:n.H)?t:0,B:null!=(o=null==n?void 0:n.B)?o:50})}const xl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n',bl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n',Ll='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';let Ml=null,_l=null,Nl=null;const Al=W(0),Sl={"":Ll,plain:Ll,text:Ll,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 4.0559072,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441188,0 l -1.789955,-1.782586 c -1.75742,1.750224 -4.6067879,1.750224 -6.3642294,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642294,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.746003,-2.73472867 -7.1981359,-2.73472867 -9.944119,0 -2.7459858,2.7347089 -2.7459858,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n</svg>\n',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n',cs:xl,csharp:xl,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n',shell:bl,powershell:bl,sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n'},Bl={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain","c++":"cpp","c#":"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function Cl(){return d(this,null,function*(){return _l||(Nl||(Nl=import("./languageIconExtended.js").then(e=>(_l=e.EXTENDED_LANGUAGE_ICON_MAP,Al.value++,_l)).catch(()=>null)),Nl)})}function Tl(e){Ml=null!=e?e:null}function El(e){var n;const t=function(e){if(!e)return"";const n=e.trim();if(!n)return"";const[t]=n.split(/\s+/),[o]=t.split(":");return o.toLowerCase()}(e);return null!=(n=Bl[t])?n:t}function Il(e){const n=El(e);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}function $l(){return d(this,null,function*(){yield Cl()})}function Wl(e){if(Ml){const n=Ml(e);if(null!=n&&""!==n)return n}const n=El(e),t=Sl[n];if(t)return t;return(null==_l?void 0:_l[n])||(Cl(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>')}const Ol={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"},Hl=new class{constructor(){u(this,"metrics",[]),u(this,"enabled",!1),u(this,"maxMetrics",1e3)}enable(){this.enabled=!0}disable(){this.enabled=!1}recordRender(e){this.enabled&&(this.metrics.push(e),this.metrics.length>this.maxMetrics&&this.metrics.shift())}getStats(){if(0===this.metrics.length)return{totalRenders:0,cacheHitRate:0,averageWorkerTime:0,averageDirectTime:0,averageCacheHitTime:0,workerSavings:0,recommendation:"Insufficient data"};const e=this.metrics.filter(e=>"worker"===e.type&&e.success),n=this.metrics.filter(e=>"direct"===e.type&&e.success),t=this.metrics.filter(e=>"cache-hit"===e.type),o=this.metrics.length,l=t.length,r=l/o*100,i=e.length>0?e.reduce((e,n)=>e+n.duration,0)/e.length:0,a=n.length>0?n.reduce((e,n)=>e+n.duration,0)/n.length:0,s=t.length>0?t.reduce((e,n)=>e+n.duration,0)/t.length:0,u=o*a-(e.reduce((e,n)=>e+n.duration,0)+n.reduce((e,n)=>e+n.duration,0)+t.reduce((e,n)=>e+n.duration,0));let d="";return d=r>70&&i<2*a?"✅ Worker + Cache is highly beneficial":r>50?"✅ Worker + Cache is beneficial":i>3*a?"⚠️ Worker overhead too high, consider direct rendering":a<5?"⚠️ Formulas too simple, Worker overhead may not be worth it":"✅ Worker prevents main thread blocking",{totalRenders:o,cacheHits:l,cacheHitRate:r.toFixed(1),workerCalls:e.length,directCalls:n.length,averageWorkerTime:i.toFixed(2),averageDirectTime:a.toFixed(2),averageCacheHitTime:s.toFixed(3),workerSavings:u.toFixed(2),recommendation:d}}printReport(){const e=this.getStats();return console.group("📊 KaTeX Rendering Performance Report"),e.totalRenders,e.cacheHits,e.cacheHitRate,e.workerCalls,e.directCalls,e.averageWorkerTime,e.averageDirectTime,e.averageCacheHitTime,e.workerSavings,e.recommendation,console.groupEnd(),e}reset(){this.metrics=[]}exportMetrics(){return{metrics:[...this.metrics],stats:this.getStats(),timestamp:Date.now()}}};function Pl(){Hl.enable()}function jl(){Hl.disable()}function Rl(){return Hl.printReport()}function zl(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch(n){}return globalThis.setTimeout(e,0)}function Kl(e){try{if(null==e)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(e)}catch(n){}try{globalThis.clearTimeout(e)}catch(n){}}"undefined"!=typeof window&&(window.__katexPerfReport=Rl,window.__katexPerfMonitor=Hl);const Dl={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},Fl={class:"flex items-center gap-x-2"},Vl=["innerHTML"],Ul={class:"text-sm font-medium font-mono"},Xl={class:"flex items-center gap-x-2"},ql=["aria-pressed"],Gl=["disabled"],Yl=["disabled"],Jl=["disabled"],Zl=["aria-label"],Ql={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},er={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},nr=["aria-pressed"],tr={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},or={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},lr=["aria-label"],rr=["innerHTML"],ir=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){const t=e,o=n,{t:l}=pn(),r=z(El(t.node.language)),i=z(!1),s=z(!1),u=z(!1),c=z(null),m=z(null),h=z(null),f=z(""),p=z(!1);let v;const g=bt(),y=z(null),w=z("undefined"==typeof window);"undefined"!=typeof window&&K(()=>c.value,e=>{var n;if(null==(n=y.value)||n.destroy(),y.value=null,!e)return void(w.value=!1);const t=g(e,{rootMargin:"400px"});y.value=t,w.value=t.isVisible.value,t.whenVisible.then(()=>{w.value=!0})},{immediate:!0});const k=z(!0),x=z(0),b=z(14),L=z(b.value),M=H(()=>{const e=b.value,n=L.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),_=H(()=>{const e=r.value.trim().toLowerCase();return Ol[e]||e.charAt(0).toUpperCase()+e.slice(1)}),N=H(()=>(Al.value,Wl(r.value.trim().toLowerCase().split(":")[0]))),B=H(()=>{const e=r.value.trim().toLowerCase();return t.isShowPreview&&("html"===e||"svg"===e)}),I=H(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},o=n(t.minWidth),l=n(t.maxWidth);return o&&(e.minWidth=o),l&&(e.maxWidth=l),e}),W=H(()=>{const e=t.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),O=H(()=>null!=W.value&&!p.value),j=H(()=>a({fontSize:`${L.value}px`},O.value?{minHeight:`${W.value}px`}:{})),R=H(()=>{if(null!=W.value)return{minHeight:`${W.value}px`}}),U=H(()=>!1!==t.showTooltips);function X(){return t.isDark?t.darkTheme:t.lightTheme}function q(e){if(null==v||v.disconnect(),v=void 0,!e)return f.value="",void(p.value=!1);var n;f.value=`<pre class="shiki shiki-fallback"><code>${n=e,n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`,p.value=!1}function G(){f.value="",p.value=!0}function Q(){var e;const n=h.value;return!!n&&(n.childNodes.length>0||Boolean(null==(e=n.textContent)?void 0:e.trim().length))}function ne(){return d(this,null,function*(){if(yield F(),Q())return void G();const e=h.value;e&&(null==v||v.disconnect(),v=new MutationObserver(()=>{Q()&&(G(),null==v||v.disconnect(),v=void 0)}),v.observe(e,{childList:!0,subtree:!0}))})}let te,oe,le,re,ie=null;const se=/* @__PURE__ */new Set,ue=/* @__PURE__ */new Set,de=void 0!==import.meta&&Boolean(!1);let ce=null;function me(e,n){return d(this,null,function*(){if(!te)return;const t=function(e,n=!1){var t;const[o]=String(null!=e?e:"").split(":"),l=null!=(t=null==o?void 0:o.trim().toLowerCase())?t:"";return l?!re||re.has(l)?l:(n&&de&&!se.has(l)&&(se.add(l),console.warn(`[MarkdownCodeBlockNode] Language "${l}" not preloaded in stream-markdown; falling back to plaintext.`)),"plaintext"):"plaintext"}(n,Boolean(e&&e.length));try{yield te.updateCode(e,t)}catch(o){"plaintext"!==t?(de&&!ue.has(t)&&(ue.add(t),console.warn(`[MarkdownCodeBlockNode] Failed to render language "${t}", retrying as plaintext.`,o)),yield te.updateCode(e,"plaintext")):de&&console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.",o)}})}function he(e){if(!le)return;const n=Array.isArray(e)?e.join("\0"):"";ie!==n&&(le({themes:e}),ie=n)}function fe(){return d(this,null,function*(){w.value?(yield function(){return d(this,null,function*(){if(!oe)return ce||(ce=d(null,null,function*(){try{const e=yield import("stream-markdown");oe=e.createShikiStreamRenderer,le=e.registerHighlight;const n=Array.isArray(e.defaultLanguages)?e.defaultLanguages:void 0;re=n?new Set(n.map(e=>e.toLowerCase())):void 0,he(t.themes)}catch(e){console.warn("[MarkdownCodeBlockNode] stream-markdown not available:",e)}finally{ce=null}}),ce)})}(),m.value&&h.value?(he(t.themes),!te&&oe&&(te=oe(h.value,{theme:X()}),p.value=!0),te?!1===t.stream&&t.loading?q(t.node.code):(q(t.node.code),yield me(t.node.code,r.value),yield ne()):q(t.node.code)):q(t.node.code)):q(t.node.code)})}function pe(){const e=m.value;if(!e||s.value)return;const n=e.scrollTop;n<x.value?k.value=!1:function(e,n=50){return e.scrollHeight-e.scrollTop-e.clientHeight<=n}(e)&&(k.value=!0),x.value=n}function ve(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(t.node.code)),i.value=!0,o("copy",t.node.code),setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function ye(e,n,o="top"){if(!U.value)return;const l=ge(e);if(!l)return;const r=e;cn(l,n,o,!1,null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0,t.isDark)}function we(){U.value&&mn()}function ke(e){if(!U.value)return;const n=ge(e);if(!n)return;const o=e;cn(n,i.value?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0,t.isDark)}function xe(){u.value=!u.value}function be(){if(!B.value)return;const e=(r.value||t.node.language).toLowerCase(),n="html"===e?"HTML Preview":"SVG Preview";o("previewCode",{type:"html"===e?"text/html":"image/svg+xml",content:t.node.code,title:n})}return ae(()=>{w.value?fe():q(t.node.code)}),V(()=>{var e;null==(e=y.value)||e.destroy(),y.value=null,null==v||v.disconnect(),v=void 0}),K(()=>t.themes,()=>d(null,null,function*(){he(t.themes)})),K(()=>t.loading,e=>{e||(w.value?fe():q(t.node.code))}),K(()=>w.value,e=>{e&&fe()}),K(U,e=>{e||mn()}),K(()=>[t.node.code,t.node.language],e=>d(null,[e],function*([e,n]){const o=El(n);o!==r.value&&(r.value=o),w.value&&m.value&&h.value?(te||(q(e),yield fe()),te&&e&&(!1===t.stream&&t.loading||(q(e),yield me(e,n),yield ne()))):q(e)})),K(()=>[t.darkTheme,t.lightTheme],()=>d(null,null,function*(){w.value&&m.value&&h.value&&(te||(yield fe()),null==te||te.setTheme(X()))})),K(()=>t.node.code,()=>d(null,null,function*(){if(s.value||!k.value)return;yield F();const e=m.value;e&&e.scrollHeight>e.clientHeight&&(e.scrollTop=e.scrollHeight)})),(n,o)=>(A(),S("div",{ref_key:"container",ref:c,style:J(I.value),class:P(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[t.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",t.isDark?"is-dark":""]])},[t.showHeader?(A(),S("div",Dl,[ee(n.$slots,"header-left",{},()=>[T("div",Fl,[T("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:N.value},null,8,Vl),T("span",Ul,$(_.value),1)])],!0),ee(n.$slots,"header-right",{},()=>[T("div",Xl,[t.showCollapseButton?(A(),S("button",{key:0,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":u.value,onClick:xe,onMouseenter:o[0]||(o[0]=e=>ye(e,u.value?C(l)("common.expand")||"Expand":C(l)("common.collapse")||"Collapse")),onFocus:o[1]||(o[1]=e=>ye(e,u.value?C(l)("common.expand")||"Expand":C(l)("common.collapse")||"Collapse")),onMouseleave:we,onBlur:we},[(A(),S("svg",{style:J({rotate:u.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[18]||(o[18]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ql)):D("",!0),t.showFontSizeButtons&&t.enableFontSizeControl?(A(),S(E,{key:1},[T("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(L.value)&&L.value<=10,onClick:o[2]||(o[2]=e=>function(){const e=Math.max(10,L.value-1);L.value=e}()),onMouseenter:o[3]||(o[3]=e=>ye(e,C(l)("common.decrease")||"Decrease")),onFocus:o[4]||(o[4]=e=>ye(e,C(l)("common.decrease")||"Decrease")),onMouseleave:we,onBlur:we},[...o[19]||(o[19]=[T("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,Gl),T("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!M.value||L.value===b.value,onClick:o[5]||(o[5]=e=>{L.value=b.value}),onMouseenter:o[6]||(o[6]=e=>ye(e,C(l)("common.reset")||"Reset")),onFocus:o[7]||(o[7]=e=>ye(e,C(l)("common.reset")||"Reset")),onMouseleave:we,onBlur:we},[...o[20]||(o[20]=[T("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),T("path",{d:"M3 3v5h5"})])],-1)])],40,Yl),T("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(L.value)&&L.value>=36,onClick:o[8]||(o[8]=e=>function(){const e=Math.min(36,L.value+1);L.value=e}()),onMouseenter:o[9]||(o[9]=e=>ye(e,C(l)("common.increase")||"Increase")),onFocus:o[10]||(o[10]=e=>ye(e,C(l)("common.increase")||"Increase")),onMouseleave:we,onBlur:we},[...o[21]||(o[21]=[T("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,Jl)],64)):D("",!0),t.showCopyButton?(A(),S("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":i.value?C(l)("common.copied")||"Copied":C(l)("common.copy")||"Copy",onClick:ve,onMouseenter:o[11]||(o[11]=e=>ke(e)),onFocus:o[12]||(o[12]=e=>ke(e)),onMouseleave:we,onBlur:we},[i.value?(A(),S("svg",er,[...o[23]||(o[23]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(A(),S("svg",Ql,[...o[22]||(o[22]=[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),T("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Zl)):D("",!0),t.showExpandButton?(A(),S("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":s.value,onClick:o[13]||(o[13]=e=>function(e){if(s.value=!s.value,e&&U.value){const n=ge(e);n&&cn(n,s.value?l("common.collapse")||"Collapse":l("common.expand")||"Expand","top",!1,void 0,t.isDark)}const n=m.value;n&&(s.value?(n.style.maxHeight="none",n.style["overflow-y"]="visible",n.style["overflow-x"]="auto"):(n.style.maxHeight="500px",n.style.overflow="auto",k.value=!0,F(()=>{n.scrollHeight>n.clientHeight&&(n.scrollTop=n.scrollHeight)})))}(e)),onMouseenter:o[14]||(o[14]=e=>ye(e,s.value?C(l)("common.collapse")||"Collapse":C(l)("common.expand")||"Expand")),onFocus:o[15]||(o[15]=e=>ye(e,s.value?C(l)("common.collapse")||"Collapse":C(l)("common.expand")||"Expand")),onMouseleave:we,onBlur:we},[s.value?(A(),S("svg",tr,[...o[24]||(o[24]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(A(),S("svg",or,[...o[25]||(o[25]=[T("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],40,nr)):D("",!0),B.value&&t.showPreviewButton?(A(),S("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":C(l)("common.preview")||"Preview",onClick:be,onMouseenter:o[16]||(o[16]=e=>ye(e,C(l)("common.preview")||"Preview")),onFocus:o[17]||(o[17]=e=>ye(e,C(l)("common.preview")||"Preview")),onMouseleave:we,onBlur:we},[...o[26]||(o[26]=[T("svg",{"data-v-3d59cc65":"",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[T("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[T("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),T("circle",{cx:"12",cy:"12",r:"3"})])],-1)])],40,lr)):D("",!0)])],!0)])):D("",!0),Y(T("div",{ref_key:"codeBlockContent",ref:m,class:"code-block-content",style:J(j.value),onScroll:pe},[T("div",{ref_key:"rendererTarget",ref:h,class:"code-block-render"},null,512),p.value?D("",!0):(A(),S("div",{key:0,class:"code-fallback-plain",innerHTML:f.value},null,8,rr))],36),[[Z,!(u.value||!e.stream&&e.loading)]]),Y(T("div",{class:"code-loading-placeholder",style:J(R.value)},[ee(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[o[27]||(o[27]=T("div",{class:"loading-skeleton"},[T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line"}),T("div",{class:"skeleton-line short"})],-1))],!0)],4),[[Z,!e.stream&&e.loading]])],6))}}),[["__scopeId","data-v-2e273ed5"]]);ir.install=e=>{e.component(ir.__name,ir)};const ar=["data-custom-id"],sr={class:"m-0 p-0"},ur=["data-probe"],dr=["data-node-index","data-node-type"],cr=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},renderCodeBlocksAsPre:{type:Boolean},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:!0},themes:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!0},batchRendering:{type:Boolean,default:!0},initialRenderBatchSize:{default:40},renderBatchSize:{default:80},renderBatchDelay:{default:16},renderBatchBudgetMs:{default:6},renderBatchIdleTimeoutMs:{default:120},deferNodesUntilVisible:{type:Boolean,default:!0},maxLiveNodes:{default:320},liveNodeBuffer:{default:60}},emits:["copy","handleArtifactClick","click","mouseover","mouseout"],setup(e,{emit:n}){var t,o;const l=e,r=n,i=z(),u=z(null),c=z(null),m=z(null),h=se({1:null,2:null,3:null,4:null,5:null,6:null}),f=z(!1),p=/auto|scroll|overlay/i,v="undefined"!=typeof window,g=H(()=>l.debugPerformance&&v&&"undefined"!=typeof console),_=j(),N=/* @__PURE__ */new Map,$=z(0),W=z(0),O=z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}),R=H(()=>{var e;if("boolean"==typeof l.showTooltips)return l.showTooltips;const n=null!=(e=_.showTooltips)?e:_["show-tooltips"];return""===n||!0===n||"true"===n||!1!==n&&"false"!==n&&void 0});function X(e,n){g.value&&console.info(`[markstream-vue][perf] ${e}`,n)}function Y(e){if(!e)return!1;const n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();return p.test(n)||p.test(t)}function Z(e){const n=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,t=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return n||t}function Q(e){if("undefined"==typeof window)return null;const n=null!=e?e:i.value;if(!n)return null;const t=n.ownerDocument||document,o=t.scrollingElement||t.documentElement;let l=n;for(;l&&l!==t.body&&l!==o;){if(Y(window.getComputedStyle(l))&&Z(l))return l;l=l.parentElement}return null}re("markstreamShowTooltips",R),re("markstreamTypewriter",H(()=>!1!==l.typewriter)),re("markstreamTextStreamState",N),re("markstreamStreamVersion",$),K([()=>l.content,()=>l.nodes],()=>{$.value+=1},{immediate:!0});const ee=l.customId?`renderer-${l.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,ne=k(ee),ie=/* @__PURE__ */new Map,ae=H(()=>(Ce.value,Ee(l.customId))),de=H(()=>{var e;return x(l.customHtmlTags,null==(e=l.parseOptions)?void 0:e.customHtmlTags)}),ce=H(()=>{const{key:e,tags:n}=b(de.value);if(!e)return ne;const t=ie.get(e);if(t)return t;const o=k(ee,{customHtmlTags:n});return ie.set(e,o),o}),me=H(()=>{const e=ce.value;return l.customMarkdownIt?l.customMarkdownIt(e):e}),he=H(()=>{var e,n;const t=null!=(e=l.parseOptions)?e:{},o=null!=(n=l.final)?n:t.final,r=de.value,i=null!=o,s=r.length>0;return i||s?a(a(a({},t),i?{final:o}:{}),s?{customHtmlTags:r}:{}):t}),fe=H(()=>{var e;const n=null!=(e=he.value.customHtmlTags)?e:[];return new Set(n.map(e=>String(e).trim().toLowerCase()).filter(Boolean))}),pe=H(()=>{var e;if(null==(e=l.nodes)?void 0:e.length)return ue(l.nodes.slice());if(l.content){const e=g.value?performance.now():0,n=L(l.content,me.value,he.value);return g.value&&X("parse(sync)",{ms:Math.round(performance.now()-e),nodes:n.length,contentLength:l.content.length}),ue(n)}return[]}),ve=z(null),ye=z(null),we=z(null),xe=z(null),be=null!=l.indexKey&&String(l.indexKey).startsWith("list-item-"),Le=!be&&l.customId?ol(l.customId):null,_e=H(()=>Le?(tl.value,ol(l.customId)):null),Ae=H(()=>{var e;return Boolean(v&&l.customId&&!be&&(null==(e=_e.value)?void 0:e.enabled))}),Se=H(()=>{var e;return Ae.value&&!1!==(null==(e=_e.value)?void 0:e.textEstimation)}),Be=H(()=>{var e;return Ae.value&&!1!==(null==(e=_e.value)?void 0:e.codeBlockEstimation)}),Te=H(()=>{var e;return Math.max(320,W.value||(null==(e=i.value)?void 0:e.clientWidth)||640)}),Ie=H(()=>{var e;return Math.max(1,null!=(e=l.maxLiveNodes)?e:320)}),$e=H(()=>{var e;return!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&pe.value.length>Ie.value}),We=H(()=>$e.value||Ae.value),Oe=H(()=>!1!==l.viewportPriority&&!f.value),Pe=xt(e=>{var n;return Q(null!=(n=null!=e?e:i.value)?n:null)},Oe),je=v&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):null,Re=v&&"function"==typeof window.cancelAnimationFrame?window.cancelAnimationFrame.bind(window):null,ze="undefined"!=typeof globalThis&&"process"in globalThis?null==(t=globalThis.process)?void 0:t.env:void 0,Ke="test"===(null==ze?void 0:ze.NODE_ENV),De=v&&"function"==typeof window.requestIdleCallback,Fe=H(()=>{var e;const n=Math.trunc(null!=(e=l.renderBatchSize)?e:80);return Number.isFinite(n)?Math.max(0,n):0}),Ue=H(()=>{var e;const n=Math.trunc(null!=(e=l.initialRenderBatchSize)?e:Fe.value);return Number.isFinite(n)?Math.max(0,n):Fe.value}),Xe=H(()=>!1!==l.batchRendering&&Fe.value>0&&v&&!Ke),Ge=z(0),Ye=z({key:l.indexKey,total:0}),Je=z(Math.max(1,Fe.value||1)),Ze=z(/* @__PURE__ */new Set),Qe=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map,nn=/* @__PURE__ */new Map,tn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new WeakMap,rn=z(0),an=H(()=>(rn.value,Array.from(tn.entries()).sort((e,n)=>e[0]-n[0]))),sn=z(0),un=z([]),dn=z([]),cn=z(null),mn=z(null);let hn=null,fn=[],pn=null,vn=null;const gn=H(()=>{var e;return!1!==l.deferNodesUntilVisible&&!((null!=(e=l.maxLiveNodes)?e:0)<=0)&&!$e.value&&!(pe.value.length>900)&&Oe.value}),yn=H(()=>{var e;return Xe.value&&(null!=(e=l.maxLiveNodes)?e:0)<=0}),wn=z({batchSize:Fe.value,initial:Ue.value,delay:null!=(o=l.renderBatchDelay)?o:16,enabled:yn.value}),kn=H(()=>!!Pe&&(gn.value||$e.value)),xn=H(()=>{var e;return Math.max(0,null!=(e=l.liveNodeBuffer)?e:60)}),Ln=z(0),Mn=se({start:0,end:0}),_n=/* @__PURE__ */new Map,Nn=/* @__PURE__ */new Map,An=H(()=>{if(!$e.value)return pe.value.length;const e=xn.value,n=Math.max(Mn.end+e,Ue.value),t=Math.min(pe.value.length,n);return Math.max(Ge.value,t)});function Sn(e){var n,t;return null!=(t=null==(n=xe.value)?void 0:n[e])?t:null}function Bn(e){var n,t,o,l;const r=Q(null!=(n=null!=e?e:i.value)?n:null);if(r)return r;const a=null!=(l=null!=(o=null==e?void 0:e.ownerDocument)?o:null==(t=i.value)?void 0:t.ownerDocument)?l:"undefined"!=typeof document?document:null;return(null==a?void 0:a.scrollingElement)||(null==a?void 0:a.documentElement)||null}function Cn(e){if(!v)return!1;try{const n=window.getComputedStyle(e);return!!(n.display||"").toLowerCase().includes("flex")&&(n.flexDirection||"").toLowerCase().endsWith("reverse")}catch(n){return!1}}function Tn(e,n,t){var o,l,r,i,a,s;if(t)return null!=(i=null!=(r=null==(o=null==n?void 0:n.documentElement)?void 0:o.scrollTop)?r:null==(l=null==n?void 0:n.body)?void 0:l.scrollTop)?i:0;const u=e.scrollTop;if(!Cn(e))return u;const d=u<0?-u:u;return Math.max(0,(null!=(a=e.scrollHeight)?a:0)-(null!=(s=e.clientHeight)?s:0))-d}function En(e,n){let t=e,o=0,l=0;for(;t&&t!==n&&l++<64;)o+=t.offsetTop||0,t=t.offsetParent;return o}function In(){pn&&(pn(),pn=null),cn.value=null}function $n(){if(!v||!$e.value)return;const e=Bn();if(!e||cn.value===e)return;In();const n=()=>On();e.addEventListener("scroll",n,{passive:!0}),cn.value=e,pn=()=>{e.removeEventListener("scroll",n)}}function Wn(){var e,n,t;if(!vn)return;const o=null!=(t=null==(n=null==(e=i.value)?void 0:e.ownerDocument)?void 0:n.defaultView)?t:"undefined"!=typeof window?window:null;vn.viaTimeout?o?o.clearTimeout(vn.id):clearTimeout(vn.id):null==Re||Re(vn.id),vn=null}function On(e={}){var n,t,o;if(!$e.value)return;if(!v)return void Hn(!0);if(e.immediate)return Wn(),void Hn(!0);if(vn)return;const l=()=>{vn=null,Hn()};if(je)vn={id:je(l),viaTimeout:!1};else{const e=null!=(o=null==(t=null==(n=i.value)?void 0:n.ownerDocument)?void 0:t.defaultView)?o:"undefined"!=typeof window?window:null,r=e?e.setTimeout(l,16):setTimeout(l,16);vn={id:r,viaTimeout:!0}}}function Hn(e=!1){var n,t,o,l,r,a,s;if(!$e.value)return;const u=cn.value||Bn();if(!u)return;const d=u.ownerDocument||(null==(n=i.value)?void 0:n.ownerDocument)||document,c=(null==d?void 0:d.defaultView)||("undefined"!=typeof window?window:null),m=u===(null==d?void 0:d.documentElement)||u===(null==d?void 0:d.body),h=pe.value.length;if(!m&&h>0&&Cn(u)){const n=u.clientHeight||0,t=u.scrollTop,o=t<0?-t:t,l=function(e){var n;const t=pe.value;if(!t.length)return 0;if(e<=0)return Math.max(0,t.length-1);if(Ae.value){let n=e;for(let e=t.length-1;e>=0;e--){const t=kt(e);if(n<=t)return e;n-=t}return 0}if(sn.value===t.length){const n=It(0,t.length);return Rt(Math.max(0,n-e))}let o=e;for(let l=t.length-1;l>=0;l--){const e=null!=(n=Dn[l])?n:et.value;if(o<=e)return l;o-=e}return 0}(Math.max(0,o)+.5*Math.max(0,n)),r=Kn(l,0,Math.max(0,h-1));return void((e||Math.abs(r-Ln.value)>1)&&(Ln.value=r))}const f=m?null:u.getBoundingClientRect(),p=m?0:f.top,v=m?null!=(o=null!=(t=null==c?void 0:c.innerHeight)?t:u.clientHeight)?o:0:f.bottom,g=an.value;let y=null,w=null;for(const[i,x]of g){if(!x)continue;const e=x.getBoundingClientRect();e.bottom<=p||e.top>=v||(null==y&&(y=i),w=i)}if(null==y||null==w){const e=i.value;if(!e)return;const n=m?{top:0}:u.getBoundingClientRect(),t=Tn(u,d,m),o=m?(()=>{const t=e.getBoundingClientRect(),o=(m?0:n.top)-t.top;return Math.max(0,o)})():(()=>{const n=En(e,u);return Math.max(0,t-n)})(),h=m?null!=(s=null!=(a=null!=(r=null==c?void 0:c.innerHeight)?r:null==(l=null==d?void 0:d.documentElement)?void 0:l.clientHeight)?a:u.clientHeight)?s:0:u.clientHeight,f=Rt(o+.5*Math.max(0,h));return void(Ln.value=Kn(f,0,Math.max(0,pe.value.length-1)))}const k=Math.round((y+w)/2);!e&&Math.abs(k-Ln.value)<=1||(Ln.value=Kn(k,0,Math.max(0,pe.value.length-1)))}function Kn(e,n,t){return Math.min(Math.max(e,n),t)}const Dn=se({}),Vn=se({total:0,count:0});function Un(){for(const e of Object.keys(Dn))delete Dn[Number(e)];Vn.total=0,Vn.count=0,sn.value=0,un.value=[],dn.value=[]}function qn(e,n,t){for(let o=n+1;o<e.length;o+=o&-o)e[o]+=t}function Yn(e,n){let t=0;for(let o=n+1;o>0;o-=o&-o)t+=e[o];return t}function Zn(e,n,t){if(t<=n)return 0;const o=Yn(e,t-1);return n<=0?o:o-Yn(e,n-1)}function Qn(e){sn.value=e;const n=new Array(e+1).fill(0),t=new Array(e+1).fill(0);for(const[o,l]of Object.entries(Dn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0||(qn(n,r,i),qn(t,r,1))}un.value=n,dn.value=t}const et=H(()=>Vn.count>0?Math.max(12,Vn.total/Vn.count):32);function nt(e){return null==e?void 0:e.firstElementChild}function ot(e,n){var t;return e?(null==(t=e.matches)?void 0:t.call(e,n))?e:e.querySelector(n):null}function rt(){var e,n;if(!Ae.value)return void(W.value=0);const t=null!=(n=null==(e=i.value)?void 0:e.clientWidth)?n:0;W.value=t>0?t:0}let at=null;function ut(){null==at||at.disconnect(),at=null}const ct=te(()=>d(null,null,function*(){try{return(yield import("./CodeBlockNode.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to inline-code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),Tt}})),mt=H(()=>l.renderCodeBlocksAsPre?Tt:ct);function ft(){var e;return!1!==(null==(e=l.codeBlockProps)?void 0:e.showHeader)}const vt=H(()=>{var e;const n=pe.value;if(!n.length||!Ae.value)return n.map(()=>null);const t=W.value||(null==(e=i.value)?void 0:e.clientWidth)||0;return!Number.isFinite(t)||t<=0?n.map(()=>null):n.map((e,n)=>{const o=Dn[n],r="number"==typeof o&&o>0;if(Se.value&&!r){const n=sl(e,t,O.value);if(n)return n}if(Be.value&&"code_block"===e.type){const n=function(e){if("code_block"!==e.type)return null;const n=ko(e,wo(e));return n===ir?"markdown":n===Tt?"pre":n===mt.value||n===ct?"monaco":null}(e);if("monaco"===n||"markdown"===n)return function(e,n){var t;if(!e||"code_block"!==e.type)return null;const o=n.rendererKind,l=!1!==n.showHeader,r=function(e){var n,t,o,l;return e.diff?Math.max(ul(String(null!=(n=e.originalCode)?n:"")),ul(String(null!=(t=e.updatedCode)?t:"")),ul(String(null!=(o=e.code)?o:""))):ul(String(null!=(l=e.code)?l:""))}(e),i=Boolean(e.diff);let a=0,s=500;if("monaco"===o){const e=null!=(t=n.monacoOptions)?t:{},o=function(e,n){const t="number"==typeof(null==e?void 0:e.fontSize)&&e.fontSize>0?e.fontSize:n?13:12;return"number"==typeof(null==e?void 0:e.lineHeight)&&e.lineHeight>0?e.lineHeight:n?30:Math.round(1.5*t)}(e,i),l=function(e,n){var t,o;if(!n)return 0;const l="number"==typeof(null==(t=null==e?void 0:e.padding)?void 0:t.top)?e.padding.top:10,r="number"==typeof(null==(o=null==e?void 0:e.padding)?void 0:o.bottom)?e.padding.bottom:22;return Math.max(0,l)+Math.max(0,r)}(e,i);s="number"==typeof e.MAX_HEIGHT&&e.MAX_HEIGHT>0?e.MAX_HEIGHT:500,a=i?Math.round(r*o+l):Math.round(r*(o+1.5))}else"markdown"===o?a=Math.round(21*r+32):(a=Math.round(21*r+32),s=Number.POSITIVE_INFINITY);const u=Math.max(1,Math.min(a,s));return{kind:"code-block",height:Math.round(u+(l?40:0)),contentHeight:u,rendererKind:o}}(e,{rendererKind:n,monacoOptions:l.codeBlockMonacoOptions,showHeader:ft()})}return null})});function kt(e){var n,t,o;return null!=(o=null!=(t=Dn[e])?t:null==(n=vt.value[e])?void 0:n.height)?o:et.value}function bt(){const e=cn.value||Bn(),n=i.value;if(!e||!n)return null;const t=e.ownerDocument||n.ownerDocument||document;if(e===t.documentElement||e===t.body||e===t.scrollingElement){const e=n.getBoundingClientRect();return Math.max(0,-e.top)}return Math.max(0,Tn(e,t,!1)-En(n,e))}function Lt(e){return It(0,Kn(e.nodeIndex,0,Math.max(0,pe.value.length-1)))+Math.max(0,e.offsetWithinNodePx)}function Mt(){if(null!=hn&&(null==Re||Re(hn),hn=null),v)for(const e of fn)window.clearTimeout(e);fn=[]}function _t(e){!function(e){var n;const t=cn.value||Bn(),o=i.value;if(!t||!o)return;const l=Math.max(0,e),r=t.ownerDocument||o.ownerDocument||document,a=r.defaultView||("undefined"!=typeof window?window:null);if(t===r.documentElement||t===r.body||t===r.scrollingElement){const e=Tn(t,r,!0)+o.getBoundingClientRect().top;return void(null==(n=null==a?void 0:a.scrollTo)||n.call(a,0,Math.max(0,e+l)))}t.scrollTop=En(o,t)+l}(Lt(e))}function At(){mn.value&&v&&null==hn&&(hn=je?je(()=>{hn=null,mn.value&&_t(mn.value)}):null,null==hn&&mn.value&&_t(mn.value))}function Bt(){const e=bt(),n=pe.value.length;if(null==e||n<=0)return null;const t=Kn(Rt(e+1),0,n-1),o=It(0,t),l=kt(t);return{nodeIndex:t,offsetWithinNodePx:Kn(e-o,0,Math.max(0,l-1))}}function Ct(e){if(mn.value={nodeIndex:Kn(e.nodeIndex,0,Math.max(0,pe.value.length-1)),offsetWithinNodePx:Math.max(0,e.offsetWithinNodePx)},Mt(),_t(mn.value),v)for(const n of[0,120,280,480])fn.push(window.setTimeout(()=>{mn.value&&_t(mn.value)},n))}function Et(e){const n=bt();return null==n?null:n-Lt(e)}function It(e,n){var t,o;if(e>=n)return 0;if(Ae.value){let t=0;for(let o=e;o<n;o++)t+=kt(o);return t}if(sn.value!==pe.value.length){let o=0;for(let l=e;l<n;l++)o+=null!=(t=Dn[l])?t:et.value;return o}const l=un.value,r=dn.value;if(!l.length||!r.length){let t=0;for(let l=e;l<n;l++)t+=null!=(o=Dn[l])?o:et.value;return t}return Zn(l,e,n)+(n-e-Zn(r,e,n))*et.value}K(()=>pe.value.length,e=>{e<=0?Un():(e<sn.value&&function(e){if(e<=0)return void Un();let n=0,t=0;for(const[o,l]of Object.entries(Dn)){const r=Number(o),i=Number(l);!Number.isFinite(r)||r<0||r>=e||!Number.isFinite(i)||i<=0?delete Dn[r]:(n+=i,t++)}Vn.total=n,Vn.count=t}(e),e!==sn.value&&Qn(e))},{immediate:!0});const $t=H(()=>{if(!$e.value)return pe.value.map((e,n)=>({node:e,index:n}));const e=pe.value.length,n=Kn(Mn.start,0,e),t=Kn(Mn.end,n,e);return pe.value.slice(n,t).map((e,t)=>({node:e,index:n+t}))}),Wt=H(()=>$e.value?It(0,Math.min(Mn.start,pe.value.length)):0),Ot=H(()=>{if(!$e.value)return 0;const e=pe.value.length;return It(Math.min(Mn.end,e),e)});function Pt(){var e;const n=pe.value;return{totalNodes:n.length,measuredCount:Vn.count,estimatedCount:vt.value.filter(Boolean).length,averageNodeHeight:et.value,topSpacerHeight:Wt.value,bottomSpacerHeight:Ot.value,estimatedTotalHeight:It(0,n.length),width:W.value||(null==(e=i.value)?void 0:e.clientWidth)||0,probe:{paragraphReady:Boolean(O.value.paragraph),listItemReady:Boolean(O.value.listItem),listWrapperOverhead:O.value.listWrapperOverhead,headingReadyLevels:Object.entries(O.value.headings).filter(([,e])=>Boolean(e)).map(([e])=>Number(e))},nodes:n.map((e,n)=>{var t,o,l,r,i,a,s,u,d;return{index:n,type:e.type,estimateKind:null!=(o=null==(t=vt.value[n])?void 0:t.kind)?o:null,rendererKind:null!=(r=null==(l=vt.value[n])?void 0:l.rendererKind)?r:null,estimatedHeight:null!=(a=null==(i=vt.value[n])?void 0:i.height)?a:null,estimatedContentHeight:null!=(u=null==(s=vt.value[n])?void 0:s.contentHeight)?u:null,measuredHeight:null!=(d=Dn[n])?d:null}})}}function Rt(e){var n;if(e<=0)return 0;const t=pe.value;if(Ae.value){let n=e;for(let e=0;e<t.length;e++){const t=kt(e);if(n<=t)return e;n-=t}return Math.max(0,t.length-1)}if(sn.value===t.length&&un.value.length&&dn.value.length){const n=et.value,o=un.value,l=dn.value,r=e=>e<=0?0:Yn(o,e-1)+(e-Yn(l,e-1))*n;let i=0,a=t.length-1,s=t.length-1;for(;i<=a;){const n=i+a>>1;r(n+1)>=e?(s=n,a=n-1):i=n+1}return s}let o=e;for(let l=0;l<t.length;l++){const e=null!=(n=Dn[l])?n:et.value;if(o<=e)return l;o-=e}return Math.max(0,t.length-1)}function Dt(){rn.value+=1}function Ft(e,n){const t=Ze.value,o=t.has(e);if(n){if(o)return;const n=new Set(t);return n.add(e),void(Ze.value=n)}if(!o)return;const l=new Set(t);l.delete(e),Ze.value=l}function Vt(){0!==Ze.value.size&&(Ze.value=/* @__PURE__ */new Set)}function Ut(e){if(!Qe.size)return;if(!$e.value)return;let n=!1;for(const[t,o]of Qe)t>=e&&(o.destroy(),Qe.delete(t),gn.value&&Ft(t,!1),to(t),tn.delete(t)&&(n=!0));n&&Dt()}function Xt(e,n){gn.value&&Ft(e,n),n&&($e.value?On():Ln.value=Kn(e,0,Math.max(0,pe.value.length-1)))}function qt(e){const n=en.get(e);n&&(n(),en.delete(e));const t=Qe.get(e);t&&(t.destroy(),Qe.delete(e)),to(e)}function Gt(e,n){let t=!1;if(n){const o=tn.get(e);tn.set(e,n),o!==n&&(t=!0)}else tn.delete(e)&&(t=!0);if(t&&Dt(),n||to(e),!kn.value||!Pe)return qt(e),void(n&&Xt(e,!0));if(!$e.value&&gn.value&&!f.value&&Qe.size>=640&&(function(){if(!f.value){f.value=!0;for(const e of Qe.values())e.destroy();if(Qe.clear(),v)for(const e of nn.values())window.clearTimeout(e);nn.clear(),Vt()}}(),!kn.value||!Pe))return qt(e),void(n&&Xt(e,!0));if(e<Ue.value&&!$e.value)return qt(e),void Xt(e,!0);if(Ze.value.has(e))return qt(e),void Xt(e,!0);if(!n)return void qt(e);qt(e);const o=Pe(n,{rootMargin:"400px"});if(!o)return;Qe.set(e,o),Xt(e,o.isVisible.value),gn.value&&function(e){if(!v||!gn.value)return;to(e);const n=e%17*23,t=window.setTimeout(()=>{var n,t;if(nn.delete(e),!gn.value)return;if(Ze.value.has(e))return;const o=tn.get(e);if(!o)return;const l=Bn(o),r=o.ownerDocument||document,i=r.defaultView||window,a=!l||l===r.documentElement||l===r.body,s=!a&&l?l.getBoundingClientRect():null,u=a?0:s.top,d=a?null!=(t=null!=(n=i.innerHeight)?n:null==l?void 0:l.clientHeight)?t:0:s.bottom,c=o.getBoundingClientRect();c.bottom>=u-500&&c.top<=d+500&&Xt(e,!0)},1800+n);nn.set(e,t)}(e);let l=null;l=K(()=>o.isVisible.value,n=>{if(n){to(e),Xt(e,!0),null==l||l(),en.delete(e),Qe.get(e)===o&&Qe.delete(e);try{o.destroy()}catch(t){}}},{immediate:!0}),en.set(e,l),$e.value&&On()}K(()=>We.value,e=>{if(!e){for(const e of on.values())e.disconnect();on.clear();for(const e of Nn.values())for(const n of e)window.clearTimeout(n);Nn.clear()}},{immediate:!0});let Yt=null,Jt=null,Zt=!1,Qt=null,eo=null;function no(){v&&(null!=Yt&&(null==Re||Re(Yt),Yt=null),null!=Jt&&(window.clearTimeout(Jt),Jt=null),null!=eo&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(eo),eo=null),Zt=!1,Qt=null)}function to(e){if(!v)return;const n=nn.get(e);null!=n&&(window.clearTimeout(n),nn.delete(e))}function oo(e,n={}){var t,o;if(!yn.value)return;const r=An.value;if(Ge.value>=r)return;const i=Math.max(1,e),a=e=>{var n;Yt=null,Jt=null,eo=null,Zt=!1;const t=null!=Qt?Qt:i;Qt=null;const o=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),a=e=>{const n="undefined"!=typeof performance?performance.now():Date.now();Ge.value=Math.min(r,Ge.value+Math.max(1,e)),Ut(Ge.value);const t=("undefined"!=typeof performance?performance.now():Date.now())-n;return function(e){var n;if(!yn.value)return;const t=Math.max(2,null!=(n=l.renderBatchBudgetMs)?n:6),o=Math.max(1,Fe.value||1),r=Math.max(1,Math.floor(o/4));e>1.2*t?Je.value=Math.max(r,Math.floor(.7*Je.value)):e<.5*t&&Je.value<o&&(Je.value=Math.min(o,Math.ceil(1.2*Je.value)))}(t),t};let s=t;for(;(a(s),!(Ge.value>=r)&&e)&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)s=Math.max(1,Math.round(Je.value));Ge.value<r&&lo()};if(!v||n.immediate)return void a();const s=Math.max(0,null!=(t=l.renderBatchDelay)?t:16);if(Qt=null!=Qt?Math.max(Qt,i):i,!Zt){if(Zt=!0,!Ke&&De&&window.requestIdleCallback){const e=Math.max(0,null!=(o=l.renderBatchIdleTimeoutMs)?o:120);return void(eo=window.requestIdleCallback(e=>{a(e)},{timeout:e}))}je&&!Ke?Yt=je(()=>{0!==s?Jt=window.setTimeout(()=>a(),s):a()}):Jt=window.setTimeout(()=>a(),s)}}function lo(){yn.value&&oo(Xe.value?Math.max(1,Math.round(Je.value)):Math.max(1,Fe.value))}K([()=>pe.value,()=>pe.value.length,()=>yn.value,()=>Fe.value,()=>Ue.value,()=>l.renderBatchDelay,()=>l.indexKey],()=>{var e;const n=pe.value.length,t=Ye.value,o=l.indexKey,r=void 0!==o&&o!==t.key,i=n!==t.total,a=r||i;Ye.value={key:o,total:n};const s=wn.value,u=null!=(e=l.renderBatchDelay)?e:16,d=s.batchSize!==Fe.value||s.initial!==Ue.value||s.delay!==u||s.enabled!==yn.value;wn.value={batchSize:Fe.value,initial:Ue.value,delay:u,enabled:yn.value},r&&(Un(),n>0&&Qn(n)),(a||d||!yn.value)&&no(),(a||d)&&(Je.value=Math.max(1,Fe.value||1)),a&&$e.value&&On({immediate:!0});const c=An.value;if(!n)return Ge.value=0,void Ut(0);if(!yn.value)return Ge.value=c,void Ut(Ge.value);const m=r||0===t.total;Ge.value=m||d?Math.min(c,Ue.value):Math.min(Ge.value,c);const h=Math.max(1,Ue.value||Fe.value||n);Ge.value<c?oo(h,{immediate:!v}):Ut(Ge.value)},{immediate:!0}),K(()=>$e.value,e=>{if(!e)return In(),void Wn();$n(),On({immediate:!0})},{immediate:!0}),K([()=>pe.value.length,()=>$e.value],e=>d(null,[e],function*([e,n]){n&&e&&v&&(yield F(),On({immediate:!0}))}),{flush:"post"}),K(()=>i.value,()=>{$e.value&&($n(),On({immediate:!0}))}),K(Ae,e=>{e&&function(){var e;if(ve.value&&ye.value&&we.value&&(null==(e=xe.value)?void 0:e[1]))return;const n=ue({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),t=ue({type:"list_item",children:[n],raw:"- Probe paragraph text"}),o=ue({type:"list",ordered:!1,items:[t],raw:"- Probe paragraph text"});ve.value=n,ye.value=t,we.value=o;const l={1:null,2:null,3:null,4:null,5:null,6:null};for(let r=1;r<=6;r++)l[r]=ue({type:"heading",level:r,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(r)} Probe heading`});xe.value=l}()},{immediate:!0}),K([()=>i.value,Ae],()=>{if(!Ae.value)return ut(),void(W.value=0);rt(),ut(),Ae.value&&i.value&&"undefined"!=typeof ResizeObserver&&(at=new ResizeObserver(()=>{rt(),mn.value&&At()}),at.observe(i.value))},{immediate:!0}),K([Ae,Te],()=>d(null,null,function*(){Ae.value?(yield F(),function(){var e,n,t,o;if(!Ae.value||"undefined"==typeof window)return void(O.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});const l={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},r=ot(nt(u.value),".paragraph-node");l.paragraph=cl(u.value,r,"pre-wrap");const i=nt(c.value),a=null==i?void 0:i.querySelector(".paragraph-node");l.listItem=cl(c.value,a,"pre-wrap");const s=null!=(n=null==(e=m.value)?void 0:e.offsetHeight)?n:0,d=null!=(o=null==(t=c.value)?void 0:t.offsetHeight)?o:0;l.listWrapperOverhead=Math.max(0,s-d);for(let u=1;u<=6;u++){const e=ot(nt(h[u]),`h${u}`);l.headings[u]=cl(h[u],e,"pre-wrap")}O.value=l}()):O.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}}}),{flush:"post",immediate:!0}),K(()=>pe.value.length,()=>{$e.value&&On({immediate:!0})}),K([Ae,W],()=>{$e.value&&On({immediate:!0}),mn.value&&At()},{immediate:!1}),K(()=>gn.value,e=>{if(e)for(const[n,t]of tn)Gt(n,t);else{for(const e of Qe.values())e.destroy();Qe.clear();for(const e of Array.from(nn.keys()))to(e);Vt();for(const[e,n]of tn)n&&Xt(e,!0)}},{immediate:!1}),K([()=>l.viewportPriority,()=>pe.value.length],([e,n])=>{!1!==e?f.value&&n<=200&&(f.value=!1):f.value=!1}),K(()=>Ge.value,()=>{$e.value&&On({immediate:!0})}),K([Ln,Ie,xn,()=>pe.value.length,$e],()=>{!function(){const e=pe.value.length;if(!$e.value||0===e)return Mn.start=0,void(Mn.end=e);const n=Math.min(Ie.value,e),t=xn.value,o=Kn(Ln.value-t,0,Math.max(0,e-n));Mn.start=o,Mn.end=Math.min(e,o+n)}()},{immediate:!0}),K([()=>pe.value.length,$e,Ie,xn,()=>Mn.start,()=>Mn.end],([e,n,t,o,l,r])=>{g.value&&X("virtualization",{nodes:e,virtualization:n,maxLiveNodes:t,buffer:o,focusIndex:Ln.value,scroll:n?(()=>{const e=cn.value||Bn();return e?{reverse:Cn(e),scrollTop:Math.round(e.scrollTop),scrollTopAbs:Math.round(Math.abs(e.scrollTop)),scrollHeight:Math.round(e.scrollHeight),clientHeight:Math.round(e.clientHeight)}:null})():null,liveRange:{start:l,end:r},rendered:Ge.value})}),K(()=>An.value,(e,n)=>{yn.value&&("number"==typeof n&&e<=n||e>Ge.value&&lo())}),K([()=>l.customId],([e],n,t)=>{if(!e||be)return;const o=function(e,n){return e?(el.controllers[e]=n,()=>{el.controllers[e]===n&&delete el.controllers[e]}):()=>{}}(e,{captureRestoreAnchor:Bt,restoreAnchor:Ct,getAnchorDrift:Et,getReport:Pt});t(()=>{o()})},{immediate:!0}),V(()=>{no();for(const e of Qe.values())e.destroy();Qe.clear();for(const e of on.values())e.disconnect();on.clear();for(const e of Nn.values())for(const n of e)window.clearTimeout(n);Nn.clear();for(const e of en.values())e();en.clear();for(const e of Array.from(nn.keys()))to(e);ut(),Mt(),In(),Wn()});const ro=te(()=>d(null,null,function*(){try{return(yield import("./index4.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',e),Tt}})),io=te(()=>d(null,null,function*(){try{return(yield import("./index5.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for InfographicBlockNode are missing. Falling back to preformatted code rendering. To enable Infographic rendering, please install "@antv/infographic".',e),Tt}})),ao=te(()=>d(null,null,function*(){try{return(yield import("./index6.js")).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',e),Tt}})),so={text:Pn,paragraph:St,heading:gt,code_block:ct,list:wt,list_item:yt,blockquote:ge,table:Ht,definition_list:Me,footnote:ht,footnote_reference:He,footnote_anchor:dt,admonition:yr,vmr_container:Kt,hardbreak:pt,link:tt,image:bn,thematic_break:jt,math_inline:jn,math_block:Rn,strong:Gn,emphasis:st,strikethrough:Jn,highlight:it,insert:lt,subscript:Xn,superscript:Fn,emoji:Ne,checkbox:ke,checkbox_input:ke,inline_code:qe,html_inline:Ve,reference:zn,html_block:Nt},uo=H(()=>null!=l.indexKey?String(l.indexKey):"markdown-renderer"),co=H(()=>a(a({stream:l.codeBlockStream,darkTheme:l.codeBlockDarkTheme,lightTheme:l.codeBlockLightTheme,monacoOptions:l.codeBlockMonacoOptions,themes:l.themes,minWidth:l.codeBlockMinWidth,maxWidth:l.codeBlockMaxWidth},"boolean"==typeof R.value?{showTooltips:R.value}:{}),l.codeBlockProps||{})),mo=H(()=>a({},l.mermaidProps||{})),ho=H(()=>a({},l.d2Props||{})),fo=H(()=>a({},l.infographicProps||{})),po=H(()=>({typewriter:l.typewriter,customHtmlTags:he.value.customHtmlTags})),vo=H(()=>a(a({},po.value),"boolean"==typeof R.value?{showTooltip:R.value}:{})),go=H(()=>a(a({},po.value),"boolean"==typeof R.value?{showTooltips:R.value}:{})),yo=H(()=>$t.value.map(e=>{var n,t,o,l;let r=function(e){var n,t,o,l,r,i,s;if("code_block"!==e.type)return e;const u=e,d=[String(null!=(n=u.language)?n:""),String(null!=(t=u.loading)?t:""),String(null!=(o=u.diff)?o:""),String(null!=(l=u.code)?l:""),String(null!=(r=u.originalCode)?r:""),String(null!=(i=u.updatedCode)?i:""),String(null!=(s=u.raw)?s:"")].join("\0"),c=ln.get(u);if(c&&c.signature===d)return c.node;const m=a({},u);return ln.set(u,{signature:d,node:m}),m}(e.node);const i=wo(r);let u=ko(r,i);if(("html_block"===r.type||"html_inline"===r.type)&&u===so[r.type]){const e=r,i=String(null!=(n=e.tag)?n:"").trim().toLowerCase()||y(e.content);if(i){const n=ae.value[i];if(fe.value.has(i)&&n)u=n,r=s(a({},e),{type:i,tag:i,content:M(e.content,i)});else if(w(null!=(t=e.content)?t:e.raw,i)){const n=String(null!=(l=null!=(o=e.content)?o:e.raw)?l:"");"html_inline"===r.type?(u=Pn,r={type:"text",content:n,raw:n}):(u=St,r={type:"paragraph",children:[{type:"text",content:n,raw:n}],raw:n})}}}let d=a({},function(e,n){const t=null!=n?n:wo(e);return"mermaid"===t?mo.value:"infographic"===t?fo.value:"d2"===t||"d2lang"===t?ho.value:"link"===e.type?vo.value:"list"===e.type?go.value:"code_block"===e.type?co.value:po.value}(r,i));const c=vt.value[e.index];return"code_block"===r.type&&"code-block"===(null==c?void 0:c.kind)&&(d=s(a({},d),{estimatedHeightPx:c.height,estimatedContentHeightPx:c.contentHeight})),s(a({},e),{node:r,component:u,bindings:d,isCodeBlock:"code_block"===r.type,indexKey:`${uo.value}-${e.index}`})}));function wo(e){var n;return"code_block"===(null==e?void 0:e.type)?String(null!=(n=e.language)?n:"").trim().toLowerCase():""}function ko(e,n){if(!e)return zt;const t=ae.value,o=t[String(e.type)];if("code_block"===e.type){const l=null!=n?n:wo(e);if("mermaid"===l)return t.mermaid||ro;if("infographic"===l)return t.infographic||io;if("d2"===l||"d2lang"===l)return t.d2||ao;if(o)return o;return t.code_block||mt.value}return o||so[String(e.type)]||zt}function xo(e){r("click",e)}function bo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseover",e)}function Lo(e){var n;(null==(n=e.target)?void 0:n.closest("[data-node-index]"))&&r("mouseout",e)}return(e,n)=>(A(),S("div",{ref_key:"containerRef",ref:i,class:P(["markstream-vue markdown-renderer",[{dark:l.isDark},{virtualized:$e.value}]]),"data-custom-id":l.customId,onClick:xo,onMouseover:bo,onMouseout:Lo},[Ae.value||$e.value?(A(),S(E,{key:0},[Ae.value?(A(),S("div",{key:0,class:"height-estimation-probes",style:J({width:`${Te.value}px`}),"aria-hidden":"true"},[T("div",{ref_key:"paragraphProbeWrapperRef",ref:u,class:"node-content","data-probe":"paragraph"},[B(C(St),{node:ve.value,"index-key":"probe-paragraph"},null,8,["node"])],512),T("div",{ref_key:"listItemProbeWrapperRef",ref:c,class:"node-content","data-probe":"list-item"},[T("ul",sr,[B(C(yt),{node:ye.value,"index-key":"probe-list-item"},null,8,["node"])])],512),T("div",{ref_key:"listProbeWrapperRef",ref:m,class:"node-content","data-probe":"list"},[B(C(wt),{node:we.value,"index-key":"probe-list"},null,8,["node"])],512),(A(),S(E,null,I(6,e=>T("div",{key:`probe-heading-${e}`,ref_for:!0,ref:n=>function(e,n){e<1||e>6||(h[e]=n)}(e,n),class:"node-content","data-probe":`heading-${e}`},[B(C(gt),{node:Sn(e),"index-key":`probe-heading-${e}`},null,8,["node","index-key"])],8,ur)),64))],4)):D("",!0),$e.value?(A(),S("div",{key:1,class:"node-spacer",style:J({height:`${Wt.value}px`}),"aria-hidden":"true"},null,4)):D("",!0)],64)):D("",!0),(A(!0),S(E,null,I(yo.value,e=>{return A(),S("div",{key:e.index,ref_for:!0,ref:n=>Gt(e.index,n),class:"node-slot","data-node-index":e.index,"data-node-type":e.node.type},[(t=e.index,yn.value&&t>=Ge.value||!(!gn.value||t<Ue.value||Ze.value.has(t))?(A(),S("div",{key:1,class:"node-placeholder",style:J({height:`${kt(e.index)}px`})},null,4)):(A(),S("div",{key:0,ref_for:!0,ref:n=>function(e,n){var t;const o=Nn.get(e);if(o){for(const e of o)window.clearTimeout(e);Nn.delete(e)}const l=on.get(e);if(l&&(l.disconnect(),on.delete(e)),!n||!We.value)return void _n.delete(e);_n.set(e,n);const r=()=>{!function(e,n){if(!Number.isFinite(n)||n<=0)return;const t=Dn[e];if(Dn[e]=n,t?Vn.total+=n-t:(Vn.total+=n,Vn.count++),sn.value>e){const o=un.value,l=dn.value;if(o.length&&l.length)if(t){const l=n-t;0!==l&&qn(o,e,l)}else qn(o,e,n),qn(l,e,1)}mn.value&&At()}(e,n.offsetHeight)};if(queueMicrotask(r),"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(()=>{r()});t.observe(n),on.set(e,t)}"code_block"===(null==(t=pe.value[e])?void 0:t.type)&&"undefined"!=typeof window&&Nn.set(e,[window.setTimeout(r,16),window.setTimeout(r,80),window.setTimeout(r,240),window.setTimeout(r,800)])}(e.index,n),class:"node-content"},[e.isCodeBlock||!1===l.typewriter?(A(),U(oe(e.component),le({key:1,node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[2]||(n[2]=e=>r("copy",e)),onHandleArtifactClick:n[3]||(n[3]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(A(),U(q,{key:0,name:"typewriter",appear:""},{default:G(()=>[(A(),U(oe(e.component),le({node:e.node,loading:e.node.loading,"index-key":e.indexKey},{ref_for:!0},e.bindings,{"custom-id":l.customId,"is-dark":l.isDark,onCopy:n[0]||(n[0]=e=>r("copy",e)),onHandleArtifactClick:n[1]||(n[1]=e=>r("handleArtifactClick",e))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1024))],512)))],8,dr);var t}),128)),$e.value?(A(),S("div",{key:1,class:"node-spacer",style:J({height:`${Ot.value}px`}),"aria-hidden":"true"},null,4)):D("",!0)],42,ar))}}),[["__scopeId","data-v-7e76e4d7"]]);cr.install=e=>{var n,t;const o=null!=(t=null!=(n=cr.__name)?n:cr.name)?t:"NodeRenderer";e.component(o,cr)};const mr={key:0,class:"admonition-icon"},hr={class:"admonition-title"},fr=["aria-expanded","aria-controls","title"],pr={key:0},vr={key:1},gr=["id"],yr=/* @__PURE__ */ve(/* @__PURE__ */N({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:n}){var t;const o=e,l=n,r={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"},i=H(()=>{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)}),a=z(!!o.node.collapsible&&!(null==(t=o.node.open)||t));function s(){o.node.collapsible&&(a.value=!a.value)}const u=`admonition-${Math.random().toString(36).slice(2,9)}`;return(n,t)=>(A(),S("div",{class:P(["admonition",[`admonition-${o.node.kind}`,o.isDark?"is-dark":""]])},[T("div",{id:u,class:"admonition-header"},[r[o.node.kind]?(A(),S("span",mr,$(r[o.node.kind]),1)):D("",!0),T("span",hr,$(i.value),1),o.node.collapsible?(A(),S("button",{key:1,class:"admonition-toggle","aria-expanded":!a.value,"aria-controls":`${u}-content`,title:a.value?"Expand":"Collapse",onClick:s},[a.value?(A(),S("span",pr,"▶")):(A(),S("span",vr,"▼"))],8,fr)):D("",!0)]),Y(T("div",{id:`${u}-content`,class:"admonition-content","aria-labelledby":u},[B(C(cr),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,onCopy:t[0]||(t[0]=e=>l("copy",e))},null,8,["index-key","nodes","custom-id","typewriter"])],8,gr),[[Z,!a.value]])],2))}}),[["__scopeId","data-v-ee240a2a"]]);yr.install=e=>{e.component(yr.__name,yr)};const wr=()=>import("@terrastruct/d2");let kr=null,xr=wr;function br(e){xr=e,kr=null}function Lr(e){br(null!=e?e:wr)}function Mr(){br(null)}function _r(){return"function"==typeof xr}function Nr(){return d(this,null,function*(){if(kr)return kr;const e=xr;if(!e)return null;let n;try{n=yield e()}catch(t){if(e===wr)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw t}return n?(kr=function(e){var n;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const t=null!=(n=e.default)?n:e;return"function"==typeof t?t:(null==t?void 0:t.D2)&&"function"==typeof t.D2?t.D2:t}(n),kr):null})}const Ar=()=>import("mermaid");let Sr=null,Br=Ar;function Cr(e){Br=e,Sr=null}function Tr(e){Cr(null!=e?e:Ar)}function Er(){Cr(null)}function Ir(){return"function"==typeof Br}function $r(e){if(!e)return e;const n=e&&e.default?e.default:e;if(n&&("function"==typeof n.render||"function"==typeof n.parse||"function"==typeof n.initialize))return n;if(n&&n.mermaidAPI&&("function"==typeof n.mermaidAPI.render||"function"==typeof n.mermaidAPI.parse)){const e=n.mermaidAPI;return s(a({},n),{render:e.render.bind(e),parse:e.parse?e.parse.bind(e):void 0,initialize:t=>"function"==typeof n.initialize?n.initialize(t):e.initialize?e.initialize(t):void 0})}return e.mermaid&&"function"==typeof e.mermaid.render?e.mermaid:n}function Wr(e){if(e)try{const n=null==e?void 0:e.initialize;e.initialize=t=>{const o=a({suppressErrorRendering:!0},t||{});return"function"==typeof n?n.call(e,o):(null==e?void 0:e.mermaidAPI)&&"function"==typeof e.mermaidAPI.initialize?e.mermaidAPI.initialize(o):void 0}}catch(n){}}function Or(){return d(this,null,function*(){if(Sr)return Sr;const e=function(){try{const e=globalThis;return $r(null==e?void 0:e.mermaid)}catch(e){return null}}();if(e)return Sr=e,Wr(Sr),Sr;const n=Br;if(!n)return null;let t;try{t=yield n()}catch(o){if(n===Ar)throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');throw o}return t?(Sr=$r(t),Wr(Sr),Sr):null})}function Hr(e){return JSON.stringify(e)}function Pr(e){var n;const t=null!=(n=e.mode)?n:"classic",o=e.katexUrl,l=e.mhchemUrl,r=Hr(a({throwOnError:!0,displayMode:!0,output:"html",strict:"ignore"},e.renderOptions||{})),i=Hr(o),s=l?Hr(l):'""';return"module"===t?`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\nlet loadPromise = null\n\nfunction normalizeKaTeX(mod) {\n const resolved = (mod && mod.default) ? mod.default : mod\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nasync function loadKaTeX() {\n if (katex || katexLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${i})\n katex = normalizeKaTeX(mod) || null\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n await import(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n }\n catch (e) {\n katexLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n await loadKaTeX()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart():`\nlet DEBUG = false\nlet katex = null\nlet katexLoadError = null\n\nfunction normalizeKaTeX(val) {\n const resolved = (val && val.default) ? val.default : val\n if (resolved && typeof resolved.renderToString === 'function')\n return resolved\n return null\n}\n\nfunction loadKaTeXClassic() {\n if (katex || katexLoadError)\n return\n try {\n importScripts(${i})\n const mhchemUrl = ${s}\n if (mhchemUrl) {\n try {\n importScripts(mhchemUrl)\n }\n catch (e) {\n // ignore optional mhchem load failures\n if (DEBUG)\n console.warn('[katex-cdn-worker] failed to load mhchem', e)\n }\n }\n katex = normalizeKaTeX(globalThis.katex)\n }\n catch (e) {\n katexLoadError = e\n }\n}\n\nloadKaTeXClassic()\n\nglobalThis.addEventListener('message', (ev) => {\n const data = ev.data || {}\n if (data.type === 'init') {\n DEBUG = !!data.debug\n if (DEBUG)\n console.debug('[katex-cdn-worker] debug enabled')\n return\n }\n const id = data.id ?? ''\n const content = data.content ?? ''\n const displayMode = data.displayMode ?? true\n\n if (!katex && !katexLoadError)\n loadKaTeXClassic()\n\n if (!katex) {\n const reason = katexLoadError ? String(katexLoadError?.message || katexLoadError) : 'KaTeX is not available in worker'\n globalThis.postMessage({ id, error: reason, content, displayMode })\n return\n }\n\n try {\n const opts = ${r}\n const html = katex.renderToString(content, { ...opts, displayMode: !!displayMode })\n globalThis.postMessage({ id, html, content, displayMode })\n }\n catch (err) {\n const msg = String(err?.message || err)\n globalThis.postMessage({ id, error: msg, content, displayMode })\n }\n})\n`.trimStart()}function jr(e){var n,t;const o=Pr(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"classic")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}Je.install=e=>{e.component(Je.__name,Je)};let Rr=null,zr=null,Kr=!1;const Dr=/* @__PURE__ */new Map,Fr=/* @__PURE__ */new Map;let Vr=5;const Ur=/* @__PURE__ */new Set;function Xr(){if(Dr.size<Vr&&Ur.size){const n=Array.from(Ur);Ur.clear();for(const t of n)try{t()}catch(e){}}}function qr(e){Rr=e,zr=null,Rr.onmessage=e=>{const{id:n,html:t,error:o}=e.data,l=Dr.get(n);if(l)if(Dr.delete(n),clearTimeout(l.timeoutId),Xr(),o)l.reject(new Error(o));else{const{content:n,displayMode:o}=e.data;if(n){const e=`${o?"d":"i"}:${n}`;if(Fr.set(e,t),Fr.size>200){const e=Fr.keys().next().value;Fr.delete(e)}}l.resolve(t)}},Rr.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[n,t]of Dr.entries())clearTimeout(t.timeoutId),t.reject(new Error(`Worker error: ${e.message}`));Dr.clear(),Xr()}}function Gr(){var e;Rr&&(null==(e=Rr.terminate)||e.call(Rr)),Rr=null,zr=null}function Yr(e){Kr=!!e,Rr&&Rr.postMessage({type:"init",debug:Kr})}function Jr(e,n=!0,t=2e3,o){return d(this,null,function*(){if(performance.now(),!En()){const e=new Error("KaTeX rendering disabled");return e.name="KaTeXDisabled",e.code="KATEX_DISABLED",Promise.reject(e)}if(zr)return Promise.reject(zr);const l=`${n?"d":"i"}:${e}`,r=Fr.get(l);if(r)return Promise.resolve(r);const i=Rr||(zr=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),zr.name="WorkerInitError",zr.code="WORKER_INIT_ERROR",null);if(!i)return Promise.reject(zr);if(Dr.size>=Vr){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code="WORKER_BUSY",e.busy=!0,e.inFlight=Dr.size,e.max=Vr,Promise.reject(e)}return new Promise((l,r)=>{if(null==o?void 0:o.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}const a=Math.random().toString(36).slice(2),s=globalThis.setTimeout(()=>{Dr.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",r(e),Xr()},t);o&&o.addEventListener("abort",()=>{globalThis.clearTimeout(s),Dr.has(a)&&Dr.delete(a);const e=new Error("Aborted");e.name="AbortError",r(e),Xr()},{once:!0});const u=l,d=r;Dr.set(a,{resolve:e=>{u(e)},reject:e=>{d(e)},timeoutId:s}),i.postMessage({id:a,content:e,displayMode:n})})})}function Zr(e,n=!0,t){const o=`${n?"d":"i"}:${e}`;if(Fr.set(o,t),Fr.size>200){const e=Fr.keys().next().value;Fr.delete(e)}}function Qr(){return{inFlight:Dr.size,max:Vr}}function ei(e){Number.isFinite(e)&&e>0&&(Vr=Math.floor(e))}const ni="WORKER_BUSY";function ti(){return Dr.size>=Vr}function oi(e=2e3,n){return Dr.size<Vr?Promise.resolve():new Promise((t,o)=>{let l,r=!1;const i=()=>{r||(r=!0,l&&globalThis.clearTimeout(l),Ur.delete(i),t())};if(Ur.add(i),l=globalThis.setTimeout(()=>{if(r)return;r=!0,Ur.delete(i);const e=new Error("Wait for worker slot timed out");e.name="WorkerBusyTimeout",e.code="WORKER_BUSY_TIMEOUT",o(e)},e),queueMicrotask(()=>Xr()),n){const e=()=>{if(r)return;r=!0,l&&globalThis.clearTimeout(l),Ur.delete(i);const e=new Error("Aborted");e.name="AbortError",o(e)};n.aborted?e():n.addEventListener("abort",e,{once:!0})}})}const li={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function ri(e){null!=e.timeout&&(li.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(li.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(li.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(li.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function ii(){return a({},li)}function ai(e){return d(this,arguments,function*(e,n=!0,t={}){var o,l,r,i;if(!En()){const e=new Error("KaTeX rendering disabled");throw e.name="KaTeXDisabled",e.code="KATEX_DISABLED",e}const a=null!=(o=t.timeout)?o:li.timeout,s=null!=(l=t.waitTimeout)?l:li.waitTimeout,u=null!=(r=t.backoffMs)?r:li.backoffMs,d=null!=(i=t.maxRetries)?i:li.maxRetries,c=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):li.maxRetries,m=t.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return yield Jr(e,n,a,m)}catch(f){if((null==f?void 0:f.code)!==ni||h>=c)throw f;if(h++,yield oi(s,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}u>0&&(yield new Promise(e=>globalThis.setTimeout(e,u*h)))}}})}function si(e){return JSON.stringify(e)}function ui(e){var n;const t=null!=(n=e.mode)?n:"module",o=si(e.mermaidUrl),l=`\nlet DEBUG = false\nlet mermaid = null\nlet mermaidLoadError = null\n\nfunction normalizeMermaidModule(mod) {\n if (!mod)\n return mod\n const candidate = (mod && mod.default) ? mod.default : mod\n if (candidate && (typeof candidate.render === 'function' || typeof candidate.parse === 'function' || typeof candidate.initialize === 'function'))\n return candidate\n if (candidate && candidate.mermaidAPI && (typeof candidate.mermaidAPI.render === 'function' || typeof candidate.mermaidAPI.parse === 'function')) {\n const api = candidate.mermaidAPI\n return {\n ...candidate,\n render: api.render ? api.render.bind(api) : undefined,\n parse: api.parse ? api.parse.bind(api) : undefined,\n initialize: (opts) => {\n if (typeof candidate.initialize === 'function')\n return candidate.initialize(opts)\n return api.initialize ? api.initialize(opts) : undefined\n },\n }\n }\n if (mod && mod.mermaid && typeof mod.mermaid.parse === 'function')\n return mod.mermaid\n return candidate\n}\n\nfunction applyThemeTo(code, theme) {\n const themeValue = theme === 'dark' ? 'dark' : 'default'\n const themeConfig = \`%%{init: {"theme": "\${themeValue}"}}%%\\n\`\n const trimmed = (code || '').trimStart()\n if (trimmed.startsWith('%%{'))\n return code\n return themeConfig + code\n}\n\nfunction findHeaderIndex(lines) {\n const headerRe = /^(?:graph|flowchart|flowchart\\s+tb|flowchart\\s+lr|sequenceDiagram|gantt|classDiagram|stateDiagram(?:-v2)?|erDiagram|journey|pie|quadrantChart|timeline|xychart(?:-beta)?)\\b/\n for (let i = 0; i < lines.length; i++) {\n const l = (lines[i] || '').trim()\n if (!l)\n continue\n if (l.startsWith('%%'))\n continue\n if (headerRe.test(l))\n return i\n }\n return -1\n}\n\nasync function canParse(code, theme) {\n const themed = applyThemeTo(code, theme)\n const anyMermaid = mermaid\n if (anyMermaid && typeof anyMermaid.parse === 'function') {\n await anyMermaid.parse(themed)\n return true\n }\n throw new Error('mermaid.parse not available in worker')\n}\n\nasync function findLastRenderablePrefix(baseCode, theme) {\n const lines = String(baseCode || '').split('\\n')\n const headerIdx = findHeaderIndex(lines)\n if (headerIdx === -1)\n return null\n const head = lines.slice(0, headerIdx + 1)\n await canParse(head.join('\\n'), theme)\n\n let low = headerIdx + 1\n let high = lines.length\n let lastGood = headerIdx + 1\n let tries = 0\n const MAX_TRIES = 12\n\n while (low <= high && tries < MAX_TRIES) {\n const mid = Math.floor((low + high) / 2)\n const candidate = [...head, ...lines.slice(headerIdx + 1, mid)].join('\\n')\n tries++\n try {\n await canParse(candidate, theme)\n lastGood = mid\n low = mid + 1\n }\n catch {\n high = mid - 1\n }\n }\n\n return [...head, ...lines.slice(headerIdx + 1, lastGood)].join('\\n')\n}\n\nfunction initMermaidOnce() {\n if (!mermaid)\n return\n try {\n if (typeof mermaid.initialize === 'function')\n mermaid.initialize(${si(a({startOnLoad:!1,securityLevel:"loose"},e.initializeOptions||{}))})\n }\n catch (e) {\n if (DEBUG)\n console.warn('[mermaid-cdn-worker] initialize failed', e)\n }\n}\n\nglobalThis.addEventListener('message', async (ev) => {\n const msg = ev.data || {}\n if (msg.type === 'init') {\n DEBUG = !!msg.debug\n if (DEBUG)\n console.debug('[mermaid-cdn-worker] debug enabled')\n return\n }\n\n const id = msg.id\n const action = msg.action\n const payload = msg.payload || {}\n\n if (!mermaid) {\n const errMsg = mermaidLoadError ? String(mermaidLoadError?.message || mermaidLoadError) : 'Mermaid is not available in worker'\n globalThis.postMessage({ id, ok: false, error: errMsg })\n return\n }\n\n try {\n if (action === 'canParse') {\n const ok = await canParse(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: ok })\n return\n }\n if (action === 'findPrefix') {\n const res = await findLastRenderablePrefix(payload.code, payload.theme)\n globalThis.postMessage({ id, ok: true, result: res })\n return\n }\n globalThis.postMessage({ id, ok: false, error: 'Unknown action' })\n }\n catch (e) {\n globalThis.postMessage({ id, ok: false, error: String(e?.message || e) })\n }\n})\n`.trimStart();return"module"===t?`\n${l}\n\nlet loadPromise = null\nasync function loadMermaid() {\n if (mermaid || mermaidLoadError)\n return\n if (!loadPromise) {\n loadPromise = (async () => {\n try {\n const mod = await import(${o})\n mermaid = normalizeMermaidModule(mod) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n })()\n }\n await loadPromise\n}\n\n// Load immediately; failures are reported per-request\nawait loadMermaid()\n`.trimStart():`\n${l}\n\nfunction loadMermaidClassic() {\n if (mermaid || mermaidLoadError)\n return\n try {\n importScripts(${o})\n mermaid = normalizeMermaidModule(globalThis.mermaid) || null\n initMermaidOnce()\n }\n catch (e) {\n mermaidLoadError = e\n }\n}\n\nloadMermaidClassic()\n`.trimStart()}function di(e){var n,t;const o=ui(e);if("undefined"==typeof Worker||"undefined"==typeof URL||"undefined"==typeof Blob)return{worker:null,dispose:()=>{},source:o};const l=new Blob([o],{type:"text/javascript"}),r=URL.createObjectURL(l);let i=!1;const u="module"===(null!=(n=e.mode)?n:"module")?s(a({},null!=(t=e.workerOptions)?t:{}),{type:"module"}):e.workerOptions,d=new Worker(r,u);if(e.debug)try{d.postMessage({type:"init",debug:!0})}catch(c){}return{worker:d,dispose:()=>{if(!i){i=!0;try{URL.revokeObjectURL(r)}catch(c){}}},source:o}}let ci=null,mi=null;const hi=/* @__PURE__ */new Map;let fi=5,pi=!1;function vi(e){pi=!!e}function gi(e){Number.isFinite(e)&&e>0&&(fi=Math.floor(e))}function yi(){return{inFlight:hi.size,max:fi}}const wi="WORKER_BUSY",ki="MERMAID_DISABLED";function xi(e){ci=e,mi=null;const n=e;ci.onmessage=e=>{if(ci!==n)return;const{id:t,ok:o,result:l,error:r}=e.data,i=hi.get(t);i&&(!1===o||r?i.reject(new Error(r||"Unknown error")):i.resolve(l))},ci.onerror=e=>{var t,o;if(ci===n)if(0!==hi.size){try{pi?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch(l){}for(const[n,t]of hi.entries())t.reject(new Error(`Worker error: ${e.message}`));hi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},ci.onmessageerror=e=>{var t,o;if(ci===n)if(0!==hi.size){try{pi?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(o=console.debug)||o.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch(l){}for(const[e,n]of hi.entries())n.reject(new Error("Worker messageerror"));hi.clear()}else null==(t=console.debug)||t.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function bi(){var e;if(ci)try{for(const[e,n]of hi.entries())n.reject(new Error("Worker cleared"));hi.clear(),null==(e=ci.terminate)||e.call(ci)}catch(n){}ci=null,mi=null}function Li(e,n,t=1400){if(!Ir()){const e=new Error("Mermaid rendering disabled");return e.name="MermaidDisabled",e.code=ki,Promise.reject(e)}if(mi)return Promise.reject(mi);const o=ci||(mi=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),mi.name="WorkerInitError",mi.code="WORKER_INIT_ERROR",null);if(!o)return Promise.reject(mi);if(hi.size>=fi){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=wi,e.inFlight=hi.size,e.max=fi,Promise.reject(e)}return new Promise((l,r)=>{const i=Math.random().toString(36).slice(2);let a,s=!1;const u=()=>{s||(s=!0,null!=a&&globalThis.clearTimeout(a),hi.delete(i))},d={resolve:e=>{u(),l(e)},reject:e=>{u(),r(e)}};hi.set(i,d);try{o.postMessage({id:i,action:e,payload:n})}catch(c){return hi.delete(i),void r(c)}a=globalThis.setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const n=hi.get(i);n&&n.reject(e)},t)})}function Mi(e,n,t=1400){return d(this,null,function*(){try{return yield Li("canParse",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function _i(e,n,t=1400){return d(this,null,function*(){try{return yield Li("findPrefix",{code:e,theme:n},t)}catch(o){return Promise.reject(o)}})}function Ni(){if(ci)try{for(const[e,n]of hi.entries())n.reject(new Error("Worker terminated"));hi.clear(),ci.terminate()}finally{ci=null}}const Ai=te(()=>import("./index7.js")),Si=te(()=>import("./index3.js")),Bi=te(()=>import("./index2.js")),Ci=te(()=>import("./index4.js")),Ti=te(()=>import("./index5.js")),Ei=te(()=>import("./index6.js")),Ii={AdmonitionNode:yr,BlockquoteNode:ge,CheckboxNode:ke,CodeBlockNode:Ai,DefinitionListNode:Me,EmojiNode:Ne,EmphasisNode:st,FootnoteNode:ht,FootnoteReferenceNode:He,FootnoteAnchorNode:dt,HardBreakNode:pt,HeadingNode:gt,HtmlBlockNode:Nt,HtmlInlineNode:Ve,HighlightNode:it,ImageNode:bn,D2BlockNode:Ei,InfographicBlockNode:Ti,InlineCodeNode:qe,PreCodeNode:Tt,InsertNode:lt,LinkNode:tt,ListItemNode:yt,ListNode:wt,MathBlockNode:Si,MathInlineNode:Bi,MermaidBlockNode:Ci,ParagraphNode:St,StrikethroughNode:Jn,StrongNode:Gn,SubscriptNode:Xn,SuperscriptNode:Fn,TableNode:Ht,TextNode:Pn,ThematicBreakNode:jt,VmrContainerNode:Kt,ReferenceNode:zn,MarkdownCodeBlockNode:ir},$i={install(e,n){Object.entries(Ii).forEach(([n,t])=>{e.component(n,t)}),(null==n?void 0:n.getLanguageIcon)&&Tl(n.getLanguageIcon),(null==n?void 0:n.mathOptions)&&_(n.mathOptions)}};export{Ci as $,yr as A,ge as B,ke as C,Ei as D,Ne as E,dt as F,He as G,pt as H,gt as I,it as J,Nt as K,Ve as L,bn as M,Ti as N,qe as O,lt as P,tt as Q,yt as R,wt as S,ki as T,wi as U,ir as V,ni as W,cr as X,Si as Y,Bi as Z,ve as _,$n as a,St as a0,zn as a1,Jn as a2,Gn as a3,Xn as a4,Fn as a5,Ht as a6,Pn as a7,jt as a8,Je as a9,En as aA,Ir as aB,Hl as aC,$l as aD,kl as aE,gl as aF,Ie as aG,Jr as aH,Te as aI,br as aJ,fn as aK,ri as aL,qr as aM,Yr as aN,ei as aO,Bn as aP,Tl as aQ,Cr as aR,xi as aS,vi as aT,gi as aU,oi as aV,Kt as aa,$i as ab,Pr as ac,ui as ad,$e as ae,Gr as af,bi as ag,jr as ah,di as ai,wl as aj,Mr as ak,Tn as al,Er as am,jl as an,Lr as ao,Cn as ap,Tr as aq,Pl as ar,yl as as,Ee as at,ii as au,Qr as av,yi as aw,Rl as ax,_r as ay,ti as az,pn as b,zl as c,Or as d,cn as e,Mi as f,In as g,mn as h,_i as i,Nr as j,Il as k,vl as l,Ol as m,El as n,Al as o,Wl as p,Tt as q,ai as r,Zr as s,Ni as t,bt as u,Kl as v,Ai as w,Me as x,st as y,ht as z};
|