markstream-react 2.0.13 → 2.0.15

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.
@@ -31,7 +31,7 @@ return e("div",{ref:j,className:["code-block-container my-4 rounded-lg border ov
31
31
  /* @__PURE__ */t("div",{className:"skeleton-line"}),
32
32
  /* @__PURE__ */t("div",{className:"skeleton-line"}),
33
33
  /* @__PURE__ */t("div",{className:"skeleton-line short"})]})})]}),Be&&!u.onPreviewCode&&Tt&&"html"===Nt&&/* @__PURE__ */t(Ge,{code:String(null!=(a=m.code)?a:""),htmlPreviewAllowScripts:u.htmlPreviewAllowScripts,htmlPreviewSandbox:u.htmlPreviewSandbox,isDark:h,onClose:()=>Se(!1)}),
34
- /* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:xe?Le("common.copied")||"Copied":""})]})}function dt(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=dt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ut(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=dt(e))&&(r&&(r+=" "),r+=t);return r}const mt=()=>import("@terrastruct/d2");let ht=null,ft=mt;function pt(e){ft=e,ht=null}function gt(e){pt(null!=e?e:mt)}function vt(){pt(null)}function yt(){return"function"==typeof ft}async function wt(){if(ht)return ht;const e=ft;if(!e)return null;let t;try{t=await e()}catch(n){if(e===mt)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(ht=function(e){var t;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 n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),ht):null}const xt={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},kt={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},bt=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Ct=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Nt(e){if(!e)return"";const t=e.trim();return Ct.test(t)?t:""}function Mt(r){var l,a;const u={...xt,...r},{t:m}=_e(),[h,f]=i(!1),[p,g]=i(!1),[v,y]=i(!1),[w,x]=i(!1),[k,b]=i(null),[C,N]=i(""),[M,B]=i(null),[S,T]=i(!1),[E,L]=i(()=>"undefined"==typeof window),D=c(0),$=c(null),P=c(!1),A=c(!1),R=c(0),F=c(null),I=c(!1),_=c(null),H=c(null),W=c(null),O=c(null),j=c(!1),z=c(()=>{}),K=Pe(),V=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",q=v||!w||!C,U=!!C,X=o(()=>{if(!u.maxHeight)return;const e="number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[u.maxHeight]),Z=o(()=>{if(q&&M)return{minHeight:`${M}px`}},[M,q]);s(()=>{j.current=S},[S]),s(()=>{const e=_.current;if(!e)return;const t=K(e,{rootMargin:"160px"});return H.current=t,t.isVisible()&&L(!0),t.whenVisible.then(()=>L(!0)),()=>{t.destroy(),H.current=null}},[K]);const Y=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),G=d((e=!1)=>{if(P.current||"undefined"==typeof window)return;if(A.current)return;if(!E)return;if(j.current)return void(I.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-R.current;if(!e&&n<t)return I.current=!0,void(null==F.current&&(F.current=window.setTimeout(()=>{F.current=null,I.current&&(I.current=!1,G(!0))},Math.max(0,t-n))));P.current=!0;const r=()=>{P.current=!1,R.current=Date.now(),z.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs,E]),J=d(async()=>{if($.current)return $.current;const e=await wt();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?$.current=t:"function"==typeof e.compile&&($.current=e),$.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?($.current=new e.D2,$.current):("function"==typeof e.compile&&($.current=e),$.current)},[]),Q=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||A.current)return;if(!E)return;if(u.loading&&!u.progressiveRender)return;if(!V)return N(""),void b(null);const i=++D.current;T(!0),b(null);try{const l=await J();if(!l)return x(!1),y(!0),N(""),void b("D2 is not available.");if("function"!=typeof l.compile||"function"!=typeof l.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const a=await l.compile(V);if(i!==D.current)return;const c=null!=(e=null==a?void 0:a.diagram)?e:a,s=null!=(n=null!=(t=null==a?void 0:a.renderOptions)?t:null==a?void 0:a.options)?n:{},d=null!=(r=u.themeId)?r:s.themeID,m=null!=(o=u.darkThemeId)?o:s.darkThemeID,h={...s};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=s.themeOverrides&&"object"==typeof s.themeOverrides?s.themeOverrides:null;h.themeOverrides={...kt,...e||{}}}const f=await l.render(c,h);if(i!==D.current)return;const p=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(f);if(!p)throw new Error("D2 render returned empty output.");const g=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(bt.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Nt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.classList.add("markstream-d2-root-svg"),r.outerHTML}(p);N(g||""),u.loading&&y(!1),b(null)}catch(l){if(i!==D.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),y(!0))}finally{i===D.current&&(T(!1),I.current&&(I.current=!1,G()))}},[V,J,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,G,E]);s(()=>{z.current=Q},[Q]);const ee=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(V),f(!0),setTimeout(()=>f(!1),1e3)}catch{}},[V]),te=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}},[C]),ne=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&Ue(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),re=d(()=>{Xe()},[]);return s(()=>{G()},[V,u.loading,u.isDark,G]),s(()=>{u.loading||G(!0)},[u.loading,G]),s(()=>{const e=requestAnimationFrame(()=>Y());return()=>cancelAnimationFrame(e)},[q,C,V,Y]),s(()=>{A.current=!1,G();const e=requestAnimationFrame(()=>Y());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{Y()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;A.current=!0,null!=F.current&&(clearTimeout(F.current),F.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[G,Y]),/* @__PURE__ */e("div",{ref:_,className:ut("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */e("div",{className:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
34
+ /* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:xe?Le("common.copied")||"Copied":""})]})}function dt(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=dt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ut(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=dt(e))&&(r&&(r+=" "),r+=t);return r}let mt=0;const ht=()=>import("@terrastruct/d2");let ft=null,pt=ht;function gt(e){pt=e,ft=null}function vt(e){gt(null!=e?e:ht)}function yt(){gt(null)}function wt(){return"function"==typeof pt}async function xt(){if(ft)return ft;const e=pt;if(!e)return null;let t;try{t=await e()}catch(n){if(e===ht)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(ft=function(e){var t;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 n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),ft):null}const kt={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},bt={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},Ct=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Nt=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Mt(e){if(!e)return"";const t=e.trim();return Nt.test(t)?t:""}function Bt(r){var l,a;const u={...kt,...r},{t:m}=_e(),[h,f]=i(!1),[p,g]=i(!1),[v,y]=i(!1),[w,x]=i(!1),[k,b]=i(null),[C,N]=i(""),[M,B]=i(null),[S,T]=i(!1),[E,L]=i(()=>"undefined"==typeof window),D=c(0),$=c(null),P=c(!1),A=c(!1),R=c(0),F=c(null),I=c(!1),_=c(null),H=c(null),W=c(null),O=c(null),j=c(!1),z=c(()=>{}),K=Pe(),V=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",q=v||!w||!C,U=!!C,X=o(()=>{if(!u.maxHeight)return;const e="number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[u.maxHeight]),Z=o(()=>{if(q&&M)return{minHeight:`${M}px`}},[M,q]);s(()=>{j.current=S},[S]),s(()=>{const e=_.current;if(!e)return;const t=K(e,{rootMargin:"160px"});return H.current=t,t.isVisible()&&L(!0),t.whenVisible.then(()=>L(!0)),()=>{t.destroy(),H.current=null}},[K]);const Y=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),G=d((e=!1)=>{if(P.current||"undefined"==typeof window)return;if(A.current)return;if(!E)return;if(j.current)return void(I.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-R.current;if(!e&&n<t)return I.current=!0,void(null==F.current&&(F.current=window.setTimeout(()=>{F.current=null,I.current&&(I.current=!1,G(!0))},Math.max(0,t-n))));P.current=!0;const r=()=>{P.current=!1,R.current=Date.now(),z.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs,E]),J=d(async()=>{if($.current)return $.current;const e=await xt();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?$.current=t:"function"==typeof e.compile&&($.current=e),$.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?($.current=new e.D2,$.current):("function"==typeof e.compile&&($.current=e),$.current)},[]),Q=d(async()=>{var e,t,n,r,o,i;if("undefined"==typeof window||A.current)return;if(!E)return;if(u.loading&&!u.progressiveRender)return;if(!V)return N(""),void b(null);const l=++D.current;T(!0),b(null);try{const a=await J();if(!a)return x(!1),y(!0),N(""),void b("D2 is not available.");if("function"!=typeof a.compile||"function"!=typeof a.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const c=await a.compile(V);if(l!==D.current)return;const s=null!=(e=null==c?void 0:c.diagram)?e:c,d=null!=(n=null!=(t=null==c?void 0:c.renderOptions)?t:null==c?void 0:c.options)?n:{},m=null!=(r=u.themeId)?r:d.themeID,h=null!=(o=u.darkThemeId)?o:d.darkThemeID,f={...d};if(f.themeID=u.isDark&&null!=h?h:m,f.darkThemeID=null,f.darkThemeOverrides=null,u.isDark){const e=d.themeOverrides&&"object"==typeof d.themeOverrides?d.themeOverrides:null;f.themeOverrides={...bt,...e||{}}}f.salt=null!=(i=f.salt)?i:function(e="markstream-react-d2"){return mt+=1,`${e}-${mt}`}();const p=await a.render(s,f);if(l!==D.current)return;const g=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(p);if(!g)throw new Error("D2 render returned empty output.");const v=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ct.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Mt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.classList.add("markstream-d2-root-svg"),r.outerHTML}(g);N(v||""),u.loading&&y(!1),b(null)}catch(a){if(l!==D.current)return;const e=(null==a?void 0:a.message)?String(a.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),y(!0))}finally{l===D.current&&(T(!1),I.current&&(I.current=!1,G()))}},[V,J,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,G,E]);s(()=>{z.current=Q},[Q]);const ee=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(V),f(!0),setTimeout(()=>f(!1),1e3)}catch{}},[V]),te=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}},[C]),ne=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&Ue(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),re=d(()=>{Xe()},[]);return s(()=>{G()},[V,u.loading,u.isDark,G]),s(()=>{u.loading||G(!0)},[u.loading,G]),s(()=>{const e=requestAnimationFrame(()=>Y());return()=>cancelAnimationFrame(e)},[q,C,V,Y]),s(()=>{A.current=!1,G();const e=requestAnimationFrame(()=>Y());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{Y()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;A.current=!0,null!=F.current&&(clearTimeout(F.current),F.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[G,Y]),/* @__PURE__ */e("div",{ref:_,className:ut("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */e("div",{className:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
35
35
  /* @__PURE__ */t("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */t("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
36
36
  /* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */e("div",{className:ut("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
37
37
  /* @__PURE__ */t("button",{type:"button",className:ut("mode-btn px-2 py-1 text-xs rounded",!v&&"is-active"),onClick:()=>y(!1),onMouseEnter:e=>ne(e,m("common.preview")||"Preview"),onFocus:e=>ne(e,m("common.preview")||"Preview"),onMouseLeave:re,onBlur:re,children:m("common.preview")||"Preview"}),
@@ -40,33 +40,33 @@ return e("div",{ref:j,className:["code-block-container my-4 rounded-lg border ov
40
40
  /* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),u.showExportButton&&C&&/* @__PURE__ */t("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":m("common.export")||"Export",onClick:te,onMouseEnter:e=>ne(e,m("common.export")||"Export"),onFocus:e=>ne(e,m("common.export")||"Export"),onMouseLeave:re,onBlur:re,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})})}),u.showCollapseButton&&/* @__PURE__ */t("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":p,onClick:()=>g(e=>!e),onMouseEnter:e=>ne(e,p?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>ne(e,p?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:re,onBlur:re,children:/* @__PURE__ */t("svg",{style:{transform:`rotate(${p?0:90}deg)`},xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})})]})]}),!p&&/* @__PURE__ */t("div",{ref:W,className:"d2-block-body",style:Z,children:u.loading&&!U?/* @__PURE__ */e("div",{className:"d2-source px-4 py-4",children:[
41
41
  /* @__PURE__ */t("pre",{className:"d2-code",children:/* @__PURE__ */t("code",{children:V})}),k&&/* @__PURE__ */t("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */t(n,{children:/* @__PURE__ */e("div",q?{className:"d2-source px-4 py-4",children:[
42
42
  /* @__PURE__ */t("pre",{className:"d2-code",children:/* @__PURE__ */t("code",{children:V})}),k&&/* @__PURE__ */t("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:X,children:[
43
- /* @__PURE__ */t("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */t("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function Bt(n){const{node:r,ctx:o,renderNode:i,indexKey:l}=n,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
43
+ /* @__PURE__ */t("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */t("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function St(n){const{node:r,ctx:o,renderNode:i,indexKey:l}=n,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
44
44
  return t("dl",{className:"definition-list","data-index-key":l,children:a.map((n,r)=>/* @__PURE__ */e("div",{className:"mb-4",children:[
45
45
  /* @__PURE__ */t("dt",{className:"definition-term font-semibold",children:o&&i?j(n.term,o,`${String(null!=l?l:"definition")}-term-${r}`,i):null}),
46
- /* @__PURE__ */t("dd",{className:"definition-desc ml-4",children:o&&i?j(n.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function St(e){var n;const{node:r}=e;/* @__PURE__ */
47
- return t("span",{className:"emoji-node",children:null!=(n=r.name)?n:r.markup})}function Tt(e){/* @__PURE__ */
48
- return t("em",{className:"emphasis-node",children:e.children})}function Et(e){const{node:n}=e,r=d(e=>{var t;if(e.preventDefault(),"undefined"==typeof document)return;const r=document.getElementById(`fnref-${String(null!=(t=n.id)?t:"")}`);r&&r.scrollIntoView({behavior:"smooth"})},[n.id]);/* @__PURE__ */
49
- return t("a",{className:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${n.id}`,title:`返回引用 ${n.id}`,onClick:r,children:"↩︎"})}function Lt(e){const{node:n,ctx:r,renderNode:o,indexKey:i}=e;/* @__PURE__ */
50
- return t("div",{id:`fnref--${n.id}`,className:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2",children:/* @__PURE__ */t("div",{className:"flex-1",children:r&&o?$(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function Dt(n){const{node:r}=n,i=o(()=>`#fnref--${r.id}`,[r.id]),l=o(()=>({href:i}),[i]),a=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(i);t&&t.scrollIntoView({behavior:"smooth"})},[i]);/* @__PURE__ */
51
- return t("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:a,children:/* @__PURE__ */e("span",{...l,title:`查看脚注 ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function $t(e){/* @__PURE__ */
52
- return t("br",{className:"hard-break"})}function Pt(e){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=e,a=Math.min(6,Math.max(1,Number(n.level)||1)),c=`h${a}`,s=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=s?s:{};/* @__PURE__ */
53
- return t(c,{dir:"auto",className:ut("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?$(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function At(e){/* @__PURE__ */
54
- return t("mark",{className:"highlight-node",children:e.children})}function Rt(l){var a,d,u,x,k,b,C,N;const{node:M,placeholder:B,customId:S}=l,T=null!=(u=null!=(d=l.htmlPolicy)?d:null==(a=l.ctx)?void 0:a.htmlPolicy)?u:"safe",E=Pe(),[L,D]=i(null),P=c(null),[A,R]=i(()=>"undefined"==typeof window),[F,I]=i(M.content),_=Boolean(M.loading),H=m(z,K,K),W=o(()=>{var e,t,n,r,o;return{...null!=(n=null!=(t=l.customComponents)?t:null==(e=l.ctx)?void 0:e.customComponents)?n:V(S),...null!=(o=null==(r=l.ctx)?void 0:r.htmlComponents)?o:{}}},[S,null==(x=l.ctx)?void 0:x.customComponents,null==(k=l.ctx)?void 0:k.htmlComponents,l.customComponents,H]),O=o(()=>{var e,t;return{...W,...null!=(t=null==(e=l.ctx)?void 0:e.streamingComponents)?t:{}}},[W,null==(b=l.ctx)?void 0:b.streamingComponents]);s(()=>{var e;if("undefined"==typeof window)return void R(!0);if(null==(e=P.current)||e.destroy(),P.current=null,!_)return R(!0),void I(M.content);if(!L)return void R(!1);const t=E(L,{rootMargin:"400px"});return P.current=t,t.isVisible()&&R(!0),t.whenVisible.then(()=>R(!0)).catch(()=>{}),()=>{t.destroy(),P.current=null}},[L,_,M.content,E]),s(()=>()=>{var e;null==(e=P.current)||e.destroy(),P.current=null},[]),s(()=>{_&&!A||I(M.content)},[_,M.content,A]);const j=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T));return t?U(t):void 0},[T,M.attrs]),Y=o(()=>{var e;return String(null!=(e=M.tag)?e:"").trim()},[M.tag]),G=o(()=>f(Y),[Y]),J=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T,Y));return t?U(t):void 0},[T,M.attrs,Y]),Q=o(()=>{var e;return p(g(h(null!=(e=M.attrs)?e:void 0,T,G)))},[T,M.attrs,G]),ee=o(()=>Array.isArray(M.children)?M.children:[],[M.children]),te=ee.length>0&&!!Y&&!v.has(Y.toLowerCase())&&!y(Y,T)&&!!l.ctx&&!!l.renderNode,ne=o(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(J),[J]),re=o(()=>{var e;return"escape"!==T&&X(null!=(e=M.content)?e:"",O)},[O,T,M.content]),oe=o(()=>{var e,t,n;return re&&M.content?Z(M.content,W,T,{ctx:l.ctx,keyPrefix:String(null!=(e=l.indexKey)?e:"html-block"),nodeComponents:null==(t=l.ctx)?void 0:t.streamingComponents,propComponents:null==(n=l.ctx)?void 0:n.htmlComponents,renderNode:l.renderNode,sourceNode:M}):null},[W,T,M.autoClosed,M.content,M.loading,l.ctx,l.indexKey,l.renderNode,re]),ie=o(()=>w(null!=F?F:"",T),[T,F]),le=o(()=>{var e;return te&&l.ctx&&l.renderNode?$(ee,l.ctx,`${String(null!=(e=l.indexKey)?e:"html-block")}-structured`,l.renderNode):null},[te,l.ctx,l.indexKey,l.renderNode,ee]),ae=G?null==(N=null==(C=l.ctx)?void 0:C.htmlComponents)?void 0:N[G]:void 0,ce=/* @__PURE__ */t("div",{className:"html-block-node__placeholder",children:null!=B?B:/* @__PURE__ */e(n,{children:[
46
+ /* @__PURE__ */t("dd",{className:"definition-desc ml-4",children:o&&i?j(n.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function Tt(e){var n;const{node:r}=e;/* @__PURE__ */
47
+ return t("span",{className:"emoji-node",children:null!=(n=r.name)?n:r.markup})}function Et(e){/* @__PURE__ */
48
+ return t("em",{className:"emphasis-node",children:e.children})}const Lt=".markdown-renderer";function Dt(e,t){var n,r;if("undefined"==typeof document||"undefined"==typeof Element)return null;const o=function(e){return`[id="${e.replace(/["\\]/g,"\\$&")}"]`}(t);let i=e instanceof Element?e.closest(Lt):null;for(;i;){const e=i.querySelector(o);if(e)return e;i=null!=(r=null==(n=i.parentElement)?void 0:n.closest(Lt))?r:null}return document.querySelector(o)}function $t(e){const{node:n}=e,r=d(e=>{var t;if(e.preventDefault(),"undefined"==typeof document)return;const r=Dt(e.currentTarget,`fnref-${String(null!=(t=n.id)?t:"")}`);r&&r.scrollIntoView({behavior:"smooth"})},[n.id]);/* @__PURE__ */
49
+ return t("a",{className:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${n.id}`,title:`返回引用 ${n.id}`,onClick:r,children:"↩︎"})}function Pt(e){const{node:n,ctx:r,renderNode:o,indexKey:i}=e;/* @__PURE__ */
50
+ return t("div",{id:`fnref--${n.id}`,className:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2",children:/* @__PURE__ */t("div",{className:"flex-1",children:r&&o?$(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function At(n){const{node:r}=n,i=o(()=>`#fnref--${r.id}`,[r.id]),l=o(()=>({href:i}),[i]),a=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=Dt(e.currentTarget,`fnref--${r.id}`);t&&t.scrollIntoView({behavior:"smooth"})},[r.id]);/* @__PURE__ */
51
+ return t("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:a,children:/* @__PURE__ */e("span",{...l,title:`查看脚注 ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function Rt(e){/* @__PURE__ */
52
+ return t("br",{className:"hard-break"})}function Ft(e){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=e,a=Math.min(6,Math.max(1,Number(n.level)||1)),c=`h${a}`,s=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=s?s:{};/* @__PURE__ */
53
+ return t(c,{dir:"auto",className:ut("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?$(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function It(e){/* @__PURE__ */
54
+ return t("mark",{className:"highlight-node",children:e.children})}function _t(l){var a,d,u,x,k,b,C,N;const{node:M,placeholder:B,customId:S}=l,T=null!=(u=null!=(d=l.htmlPolicy)?d:null==(a=l.ctx)?void 0:a.htmlPolicy)?u:"safe",E=Pe(),[L,D]=i(null),P=c(null),[A,R]=i(()=>"undefined"==typeof window),[F,I]=i(M.content),_=Boolean(M.loading),H=m(z,K,K),W=o(()=>{var e,t,n,r,o;return{...null!=(n=null!=(t=l.customComponents)?t:null==(e=l.ctx)?void 0:e.customComponents)?n:V(S),...null!=(o=null==(r=l.ctx)?void 0:r.htmlComponents)?o:{}}},[S,null==(x=l.ctx)?void 0:x.customComponents,null==(k=l.ctx)?void 0:k.htmlComponents,l.customComponents,H]),O=o(()=>{var e,t;return{...W,...null!=(t=null==(e=l.ctx)?void 0:e.streamingComponents)?t:{}}},[W,null==(b=l.ctx)?void 0:b.streamingComponents]);s(()=>{var e;if("undefined"==typeof window)return void R(!0);if(null==(e=P.current)||e.destroy(),P.current=null,!_)return R(!0),void I(M.content);if(!L)return void R(!1);const t=E(L,{rootMargin:"400px"});return P.current=t,t.isVisible()&&R(!0),t.whenVisible.then(()=>R(!0)).catch(()=>{}),()=>{t.destroy(),P.current=null}},[L,_,M.content,E]),s(()=>()=>{var e;null==(e=P.current)||e.destroy(),P.current=null},[]),s(()=>{_&&!A||I(M.content)},[_,M.content,A]);const j=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T));return t?U(t):void 0},[T,M.attrs]),Y=o(()=>{var e;return String(null!=(e=M.tag)?e:"").trim()},[M.tag]),G=o(()=>f(Y),[Y]),J=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T,Y));return t?U(t):void 0},[T,M.attrs,Y]),Q=o(()=>{var e;return p(g(h(null!=(e=M.attrs)?e:void 0,T,G)))},[T,M.attrs,G]),ee=o(()=>Array.isArray(M.children)?M.children:[],[M.children]),te=ee.length>0&&!!Y&&!v.has(Y.toLowerCase())&&!y(Y,T)&&!!l.ctx&&!!l.renderNode,ne=o(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(J),[J]),re=o(()=>{var e;return"escape"!==T&&X(null!=(e=M.content)?e:"",O)},[O,T,M.content]),oe=o(()=>{var e,t,n;return re&&M.content?Z(M.content,W,T,{ctx:l.ctx,keyPrefix:String(null!=(e=l.indexKey)?e:"html-block"),nodeComponents:null==(t=l.ctx)?void 0:t.streamingComponents,propComponents:null==(n=l.ctx)?void 0:n.htmlComponents,renderNode:l.renderNode,sourceNode:M}):null},[W,T,M.autoClosed,M.content,M.loading,l.ctx,l.indexKey,l.renderNode,re]),ie=o(()=>w(null!=F?F:"",T),[T,F]),le=o(()=>{var e;return te&&l.ctx&&l.renderNode?$(ee,l.ctx,`${String(null!=(e=l.indexKey)?e:"html-block")}-structured`,l.renderNode):null},[te,l.ctx,l.indexKey,l.renderNode,ee]),ae=G?null==(N=null==(C=l.ctx)?void 0:C.htmlComponents)?void 0:N[G]:void 0,ce=/* @__PURE__ */t("div",{className:"html-block-node__placeholder",children:null!=B?B:/* @__PURE__ */e(n,{children:[
55
55
  /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar"}),
56
56
  /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-4/5"}),
57
- /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-2/3"})]})});return te&&ae?r.createElement(ae,Q,le):te?r.createElement(Y,{...ne,ref:D},A?le:ce):/* @__PURE__ */t("div",{ref:D,className:"html-block-node",...j,children:A?re&&oe?/* @__PURE__ */t(n,{children:oe}):/* @__PURE__ */t("div",{dangerouslySetInnerHTML:{__html:ie}}):ce})}const Ft=(()=>{try{return Boolean(!1)}catch{}return!1})();function It(e){Ft&&console.warn(e)}function _t(e,t,n=!1){const r=Object.entries(null!=t?t:{}),o=r.length>0?r.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function Ht(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function Wt(e,t){var n;for(const r of Y(e)){if("tag_open"!==r.type&&"self_closing"!==r.type)continue;const e=null!=(n=r.tagName)?n:"";if(!G(e,t))continue;const o=t[e]||t[e.toLowerCase()];if("block"===J(o))return!0}return!1}function Ot(e,t){var n,r;return(null==(n=t.nodeComponents)?void 0:n[e])||(null==(r=t.nodeComponents)?void 0:r[e.toLowerCase()])}function jt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e))return e.map(jt).join("");if(!r.isValidElement(e))return"";const t=e;if("string"!=typeof t.type)return jt(t.props.children);const n=Object.entries(t.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${t.type}${n}>${jt(t.props.children)}</${t.type}>`}function zt(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Kt(e){var t,n;const r=e.sourceNode,o=!0!==(null==(t=e.ctx)?void 0:t.final)&&(!1===(null==(n=e.ctx)?void 0:n.final)||Boolean(null==r?void 0:r.loading));return{loading:o,autoClosed:o||Boolean(null==r?void 0:r.autoClosed)}}function Vt(e,t,n,o,i,l,a,c,s,d){const u=G(e,o),m=Boolean(Ot(e,a));if(x.has(e.toLowerCase())||!u&&!m&&k(e,l))return null;if(!u&&!m&&y(e,l))return[_t(e,t),...n,`</${e}>`];const h=Q(t,l,e),g=h.key,v=null!=g&&""!==g?g:i;if(m)return function(e,t,n,o,i,l,a,c=Kt(i)){const s=f(e),d=null!=l?l:function(e){return e.map(jt).join("")}(n),u={type:s,tag:s,attrs:zt(t),content:d,raw:null!=a?a:`${_t(e,t)}${d}</${e}>`,loading:c.loading,autoClosed:c.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,o,i.ctx);const m=Ot(e,i);return m?r.createElement(m,{key:o,node:u}):null}(e,t,n,String(v),a,c,s,d);if(u){const t=o[e]||o[e.toLowerCase()],i=p(h);return r.createElement(t,{...i,key:v},...n)}return r.createElement(e,{...U(h),key:v},...n)}function qt(e){var o,l,a,d,u,m,v,b;const{node:C,customId:N}=e,M=null!=(a=null!=(l=e.htmlPolicy)?l:null==(o=e.ctx)?void 0:o.htmlPolicy)?a:"safe",B=c(null),[S,T]=i(!1);s(()=>{T(!0)},[]);const E=r.useMemo(()=>{var t,n,r,o;return{...null!=(n=null==(t=e.ctx)?void 0:t.customComponents)?n:V(N),...null!=(o=null==(r=e.ctx)?void 0:r.htmlComponents)?o:{}}},[N,null==(d=e.ctx)?void 0:d.customComponents,null==(u=e.ctx)?void 0:u.htmlComponents]),L=r.useMemo(()=>{var t,n;return{...E,...null!=(n=null==(t=e.ctx)?void 0:t.streamingComponents)?n:{}}},[E,null==(m=e.ctx)?void 0:m.streamingComponents]),D=r.useMemo(()=>{var e;return w(null!=(e=C.content)?e:"",M)},[M,C.content]),P=r.useMemo(()=>{var e;return String(null!=(e=C.tag)?e:"").trim()},[C.tag]),A=r.useMemo(()=>f(P),[P]),R=r.useMemo(()=>Array.isArray(C.children)?C.children:[],[C.children]),F=r.useMemo(()=>{var e;return p(g(h(null!=(e=C.attrs)?e:void 0,M,A)))},[M,C.attrs,A]),I=A?null==(b=null==(v=e.ctx)?void 0:v.htmlComponents)?void 0:b[A]:void 0,_=R.length>0&&!!P&&"escape"!==M&&!y(P,M)&&!!e.ctx&&!!e.renderNode&&!!I,H=r.useMemo(()=>{var t;return _&&e.ctx&&e.renderNode?$(R,e.ctx,`${String(null!=(t=e.indexKey)?t:"html-inline")}-structured`,e.renderNode):null},[_,e.ctx,e.indexKey,e.renderNode,R]),W=r.useMemo(()=>{var t,n;const r=C.content;if(!r)return{mode:"html",content:""};if("escape"===M)return{mode:"html",content:r};if(!X(r,L))return{mode:"html",content:r};const o=function(e,t,n="safe",r={}){if(!e)return[];try{const o=function(e,t,n="safe",r={}){var o;let i=0;const l=null!=(o=r.keyPrefix)?o:"ms-html",a=[],c=[];for(const s of e)if("text"===s.type){if(a.length>0&&a[a.length-1].hardBlocked)continue;(a.length>0?a[a.length-1].children:c).push(s.content),a.length>0&&a[a.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},o=_t(s.tagName,e,!0),d=G(s.tagName,t),u=Boolean(Ot(s.tagName,r));if(x.has(s.tagName.toLowerCase())||!d&&!u&&k(s.tagName,n))continue;if(!d&&!u&&y(s.tagName,n)){(a.length>0?a[a.length-1].children:c).push(o),a.length>0&&a[a.length-1].sourceParts.push(o);continue}const m=Vt(s.tagName,e,[],t,`${l}-${i++}`,n,r,"",o,{loading:!1,autoClosed:!1});Ht(a.length>0?a[a.length-1].children:c,m),a.length>0&&a[a.length-1].sourceParts.push(o)}else if("tag_open"===s.type){const e=a.length>0&&a[a.length-1].hardBlocked,o=G(s.tagName,t),i=Boolean(Ot(s.tagName,r));a.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:o||i,hardBlocked:e||x.has(s.tagName.toLowerCase())||!o&&!i&&k(s.tagName,n),softBlocked:!e&&!o&&!i&&y(s.tagName,n)})}else if("tag_close"===s.type){const e=s.tagName.toLowerCase();let o=-1;for(let t=a.length-1;t>=0;t--)if(a[t].tagName.toLowerCase()===e){o=t;break}if(-1!==o)for(;a.length>o;){const s=a.pop(),d=s.sourceParts.join(""),u=`${_t(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[_t(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const o=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Kt(r);m=Vt(s.tagName,s.attrs||{},s.children,t,`${l}-${i++}`,n,r,d,u,o)}a.length>0?Ht(a[a.length-1].children,m):Ht(c,m),a.length>0&&!s.hardBlocked&&a[a.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&a.length>o&&It(`Auto-closing unclosed tag: <${s.tagName}>`)}else It(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;a.length>0;){const e=a.pop(),o=e.sourceParts.join(""),s=`${_t(e.tagName,e.attrs||{})}${o}`;let d;d=e.hardBlocked?null:e.softBlocked?[_t(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Vt(e.tagName,e.attrs||{},e.children,t,`${l}-${i++}`,n,r,o,s,Kt(r)),Ht(c,d),a.length>0&&!e.hardBlocked&&a[a.length-1].sourceParts.push(s),It(`Auto-closing unclosed tag: <${e.tagName}>`)}return c}(Y(e),t,n,r);return o}catch(i){return o=i,Ft&&console.error("Failed to parse HTML to React nodes:",o),null}var o}(r,E,M,{ctx:e.ctx,keyPrefix:String(null!=(t=e.indexKey)?t:"html-inline"),nodeComponents:null==(n=e.ctx)?void 0:n.streamingComponents,renderNode:e.renderNode,sourceNode:C});return null===o?{mode:"html",content:r}:{mode:"dynamic",block:Wt(r,L),nodes:o}},[E,L,M,C.autoClosed,C.content,C.loading,e.ctx,e.indexKey,e.renderNode]);return s(()=>{if(!S||!B.current||"html"!==W.mode)return;const e=B.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=D,e.appendChild(t.content.cloneNode(!0))},[W.mode,S,D]),!C.loading||C.autoClosed||_||"dynamic"===W.mode?_?r.createElement(I,F,H):"dynamic"===W.mode?W.block?/* @__PURE__ */t(n,{children:W.nodes}):/* @__PURE__ */t("span",{className:"html-inline-node",style:{display:"inline"},children:W.nodes}):/* @__PURE__ */t("span",{ref:B,className:"html-inline-node",style:{display:"inline"}}):/* @__PURE__ */t("span",{className:"html-inline-node html-inline-node--loading",children:C.content})}const Ut={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Xt(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function Zt(r){var o,l,a,c,d,u;const m={...Ut,...r},h=b(m.node.src),f=b(m.fallbackSrc),p=Xt(h,f,m.node.loading),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(p.src),[C,N]=i(p.stage),M=x;s(()=>{const e=Xt(h,f,m.node.loading);k(e.src),N(e.stage),v(!1),w("failed"===e.stage)},[h,f,m.node.loading]);return!m.node.loading&&"failed"!==C&&M?/* @__PURE__ */t("img",{src:M,alt:String(null!=(l=null!=(o=m.node.alt)?o:m.node.title)?l:""),title:String(null!=(c=null!=(a=m.node.title)?a:m.node.alt)?c:""),className:"image-node__img"+(g?" is-loaded":""),loading:m.lazy?"lazy":"eager",decoding:"async",tabIndex:g?0:-1,"aria-label":null!=(d=m.node.alt)?d:"Preview image",onError:()=>{var e;if("primary"===C&&f&&f!==x)return k(f),N("fallback"),v(!1),void w(!1);N("failed"),w(!0),null==(e=m.onError)||e.call(m,x)},onLoad:()=>{var e;v(!0),w(!1),null==(e=m.onLoad)||e.call(m,M)},onClick:e=>{var t;e.preventDefault(),g&&!y&&(null==(t=m.onClick)||t.call(m,[e,M]))}},"image"):m.node.loading&&!y?/* @__PURE__ */t("span",{className:"image-node__placeholder",children:m.usePlaceholder?/* @__PURE__ */e(n,{children:[
57
+ /* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-2/3"})]})});return te&&ae?r.createElement(ae,Q,le):te?r.createElement(Y,{...ne,ref:D},A?le:ce):/* @__PURE__ */t("div",{ref:D,className:"html-block-node",...j,children:A?re&&oe?/* @__PURE__ */t(n,{children:oe}):/* @__PURE__ */t("div",{dangerouslySetInnerHTML:{__html:ie}}):ce})}const Ht=(()=>{try{return Boolean(!1)}catch{}return!1})();function Wt(e){Ht&&console.warn(e)}function Ot(e,t,n=!1){const r=Object.entries(null!=t?t:{}),o=r.length>0?r.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function jt(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function zt(e,t){var n;for(const r of Y(e)){if("tag_open"!==r.type&&"self_closing"!==r.type)continue;const e=null!=(n=r.tagName)?n:"";if(!G(e,t))continue;const o=t[e]||t[e.toLowerCase()];if("block"===J(o))return!0}return!1}function Kt(e,t){var n,r;return(null==(n=t.nodeComponents)?void 0:n[e])||(null==(r=t.nodeComponents)?void 0:r[e.toLowerCase()])}function Vt(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Vt).join("");if(!r.isValidElement(e))return"";const t=e;if("string"!=typeof t.type)return Vt(t.props.children);const n=Object.entries(t.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${t.type}${n}>${Vt(t.props.children)}</${t.type}>`}function qt(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Ut(e){var t,n;const r=e.sourceNode,o=!0!==(null==(t=e.ctx)?void 0:t.final)&&(!1===(null==(n=e.ctx)?void 0:n.final)||Boolean(null==r?void 0:r.loading));return{loading:o,autoClosed:o||Boolean(null==r?void 0:r.autoClosed)}}function Xt(e,t,n,o,i,l,a,c,s,d){const u=G(e,o),m=Boolean(Kt(e,a));if(x.has(e.toLowerCase())||!u&&!m&&k(e,l))return null;if(!u&&!m&&y(e,l))return[Ot(e,t),...n,`</${e}>`];const h=Q(t,l,e),g=h.key,v=null!=g&&""!==g?g:i;if(m)return function(e,t,n,o,i,l,a,c=Ut(i)){const s=f(e),d=null!=l?l:function(e){return e.map(Vt).join("")}(n),u={type:s,tag:s,attrs:qt(t),content:d,raw:null!=a?a:`${Ot(e,t)}${d}</${e}>`,loading:c.loading,autoClosed:c.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,o,i.ctx);const m=Kt(e,i);return m?r.createElement(m,{key:o,node:u}):null}(e,t,n,String(v),a,c,s,d);if(u){const t=o[e]||o[e.toLowerCase()],i=p(h);return r.createElement(t,{...i,key:v},...n)}return r.createElement(e,{...U(h),key:v},...n)}function Zt(e){var o,l,a,d,u,m,v,b;const{node:C,customId:N}=e,M=null!=(a=null!=(l=e.htmlPolicy)?l:null==(o=e.ctx)?void 0:o.htmlPolicy)?a:"safe",B=c(null),[S,T]=i(!1);s(()=>{T(!0)},[]);const E=r.useMemo(()=>{var t,n,r,o;return{...null!=(n=null==(t=e.ctx)?void 0:t.customComponents)?n:V(N),...null!=(o=null==(r=e.ctx)?void 0:r.htmlComponents)?o:{}}},[N,null==(d=e.ctx)?void 0:d.customComponents,null==(u=e.ctx)?void 0:u.htmlComponents]),L=r.useMemo(()=>{var t,n;return{...E,...null!=(n=null==(t=e.ctx)?void 0:t.streamingComponents)?n:{}}},[E,null==(m=e.ctx)?void 0:m.streamingComponents]),D=r.useMemo(()=>{var e;return w(null!=(e=C.content)?e:"",M)},[M,C.content]),P=r.useMemo(()=>{var e;return String(null!=(e=C.tag)?e:"").trim()},[C.tag]),A=r.useMemo(()=>f(P),[P]),R=r.useMemo(()=>Array.isArray(C.children)?C.children:[],[C.children]),F=r.useMemo(()=>{var e;return p(g(h(null!=(e=C.attrs)?e:void 0,M,A)))},[M,C.attrs,A]),I=A?null==(b=null==(v=e.ctx)?void 0:v.htmlComponents)?void 0:b[A]:void 0,_=R.length>0&&!!P&&"escape"!==M&&!y(P,M)&&!!e.ctx&&!!e.renderNode&&!!I,H=r.useMemo(()=>{var t;return _&&e.ctx&&e.renderNode?$(R,e.ctx,`${String(null!=(t=e.indexKey)?t:"html-inline")}-structured`,e.renderNode):null},[_,e.ctx,e.indexKey,e.renderNode,R]),W=r.useMemo(()=>{var t,n;const r=C.content;if(!r)return{mode:"html",content:""};if("escape"===M)return{mode:"html",content:r};if(!X(r,L))return{mode:"html",content:r};const o=function(e,t,n="safe",r={}){if(!e)return[];try{const o=function(e,t,n="safe",r={}){var o;let i=0;const l=null!=(o=r.keyPrefix)?o:"ms-html",a=[],c=[];for(const s of e)if("text"===s.type){if(a.length>0&&a[a.length-1].hardBlocked)continue;(a.length>0?a[a.length-1].children:c).push(s.content),a.length>0&&a[a.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},o=Ot(s.tagName,e,!0),d=G(s.tagName,t),u=Boolean(Kt(s.tagName,r));if(x.has(s.tagName.toLowerCase())||!d&&!u&&k(s.tagName,n))continue;if(!d&&!u&&y(s.tagName,n)){(a.length>0?a[a.length-1].children:c).push(o),a.length>0&&a[a.length-1].sourceParts.push(o);continue}const m=Xt(s.tagName,e,[],t,`${l}-${i++}`,n,r,"",o,{loading:!1,autoClosed:!1});jt(a.length>0?a[a.length-1].children:c,m),a.length>0&&a[a.length-1].sourceParts.push(o)}else if("tag_open"===s.type){const e=a.length>0&&a[a.length-1].hardBlocked,o=G(s.tagName,t),i=Boolean(Kt(s.tagName,r));a.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:o||i,hardBlocked:e||x.has(s.tagName.toLowerCase())||!o&&!i&&k(s.tagName,n),softBlocked:!e&&!o&&!i&&y(s.tagName,n)})}else if("tag_close"===s.type){const e=s.tagName.toLowerCase();let o=-1;for(let t=a.length-1;t>=0;t--)if(a[t].tagName.toLowerCase()===e){o=t;break}if(-1!==o)for(;a.length>o;){const s=a.pop(),d=s.sourceParts.join(""),u=`${Ot(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Ot(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const o=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Ut(r);m=Xt(s.tagName,s.attrs||{},s.children,t,`${l}-${i++}`,n,r,d,u,o)}a.length>0?jt(a[a.length-1].children,m):jt(c,m),a.length>0&&!s.hardBlocked&&a[a.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&a.length>o&&Wt(`Auto-closing unclosed tag: <${s.tagName}>`)}else Wt(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;a.length>0;){const e=a.pop(),o=e.sourceParts.join(""),s=`${Ot(e.tagName,e.attrs||{})}${o}`;let d;d=e.hardBlocked?null:e.softBlocked?[Ot(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Xt(e.tagName,e.attrs||{},e.children,t,`${l}-${i++}`,n,r,o,s,Ut(r)),jt(c,d),a.length>0&&!e.hardBlocked&&a[a.length-1].sourceParts.push(s),Wt(`Auto-closing unclosed tag: <${e.tagName}>`)}return c}(Y(e),t,n,r);return o}catch(i){return o=i,Ht&&console.error("Failed to parse HTML to React nodes:",o),null}var o}(r,E,M,{ctx:e.ctx,keyPrefix:String(null!=(t=e.indexKey)?t:"html-inline"),nodeComponents:null==(n=e.ctx)?void 0:n.streamingComponents,renderNode:e.renderNode,sourceNode:C});return null===o?{mode:"html",content:r}:{mode:"dynamic",block:zt(r,L),nodes:o}},[E,L,M,C.autoClosed,C.content,C.loading,e.ctx,e.indexKey,e.renderNode]);return s(()=>{if(!S||!B.current||"html"!==W.mode)return;const e=B.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=D,e.appendChild(t.content.cloneNode(!0))},[W.mode,S,D]),!C.loading||C.autoClosed||_||"dynamic"===W.mode?_?r.createElement(I,F,H):"dynamic"===W.mode?W.block?/* @__PURE__ */t(n,{children:W.nodes}):/* @__PURE__ */t("span",{className:"html-inline-node",style:{display:"inline"},children:W.nodes}):/* @__PURE__ */t("span",{ref:B,className:"html-inline-node",style:{display:"inline"}}):/* @__PURE__ */t("span",{className:"html-inline-node html-inline-node--loading",children:C.content})}const Yt={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Gt(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function Jt(r){var o,l,a,c,d,u;const m={...Yt,...r},h=b(m.node.src),f=b(m.fallbackSrc),p=Gt(h,f,m.node.loading),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(p.src),[C,N]=i(p.stage),M=x;s(()=>{const e=Gt(h,f,m.node.loading);k(e.src),N(e.stage),v(!1),w("failed"===e.stage)},[h,f,m.node.loading]);return!m.node.loading&&"failed"!==C&&M?/* @__PURE__ */t("img",{src:M,alt:String(null!=(l=null!=(o=m.node.alt)?o:m.node.title)?l:""),title:String(null!=(c=null!=(a=m.node.title)?a:m.node.alt)?c:""),className:"image-node__img"+(g?" is-loaded":""),loading:m.lazy?"lazy":"eager",decoding:"async",tabIndex:g?0:-1,"aria-label":null!=(d=m.node.alt)?d:"Preview image",onError:()=>{var e;if("primary"===C&&f&&f!==x)return k(f),N("fallback"),v(!1),void w(!1);N("failed"),w(!0),null==(e=m.onError)||e.call(m,x)},onLoad:()=>{var e;v(!0),w(!1),null==(e=m.onLoad)||e.call(m,M)},onClick:e=>{var t;e.preventDefault(),g&&!y&&(null==(t=m.onClick)||t.call(m,[e,M]))}},"image"):m.node.loading&&!y?/* @__PURE__ */t("span",{className:"image-node__placeholder",children:m.usePlaceholder?/* @__PURE__ */e(n,{children:[
58
58
  /* @__PURE__ */t("span",{className:"image-node__spinner","aria-hidden":"true"}),
59
59
  /* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:null!=(u=m.node.raw)?u:"Loading image…"})},"placeholder"):m.node.loading||"failed"!==C?null:/* @__PURE__ */e("span",{className:"image-node__error",children:[
60
60
  /* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */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"})}),
61
- /* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]})}let Yt=null,Gt=null;const Jt=/* @__PURE__ */t("svg",{width:"1em",height:"1em",viewBox:"0 0 291 300",fill:"none",className:"w-4 h-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */e("g",{children:[
61
+ /* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]})}let Qt=null,en=null;const tn=/* @__PURE__ */t("svg",{width:"1em",height:"1em",viewBox:"0 0 291 300",fill:"none",className:"w-4 h-4 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */e("g",{children:[
62
62
  /* @__PURE__ */t("path",{d:"M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.69C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z",fill:"#FF6376"}),
63
63
  /* @__PURE__ */t("path",{d:"M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z",fill:"#FFCCCC"}),
64
64
  /* @__PURE__ */t("path",{d:"M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z",fill:"#FF939F"}),
65
65
  /* @__PURE__ */t("path",{d:"M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z",fill:"#FF356A"}),
66
- /* @__PURE__ */t("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Qt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function en(r){var l;const a={...Qt,...r},{t:u}=_e(),[m,h]=i(!1),[f,p]=i(!1),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(()=>"undefined"==typeof window),b=a.node.code,C=o(()=>a.maxHeight&&"none"!==a.maxHeight?ee(a.maxHeight):null,[a.maxHeight]),N=o(()=>{var e;return null!=(e=ee(a.estimatedPreviewHeightPx))?e:te(b)},[b,a.estimatedPreviewHeightPx]),[M,B]=i(()=>`${ne(N,re,C)}px`),[S,T]=i(!1),[E,L]=i(!1),[D,$]=i(1),[P,A]=i({x:0,y:0}),[R,F]=i(!1),I=c(null),_=c(null),H=c(null),W=c(null),O=c(null),j=c(null),z=c(null),K=c(0),V=c(P);V.current=P;const q=c(D);q.current=D;const U=c(y);U.current=y;const X=c(S);X.current=S;const Z=Pe(),Y=d(()=>{var e;const t=I.current,n=t?getComputedStyle(t).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=ee(n))?e:re},[]),G=d(()=>ne(N,Y(),C),[N,C,Y]),J=d(e=>{const t=G();if(!a.maxHeight||"none"===a.maxHeight)return`${Math.max(e,t)}px`;const n=Number.parseFloat(String(a.maxHeight));return Number.isFinite(n)?`${Math.max(Math.min(e,n),t)}px`:`${Math.max(e,t)}px`},[a.maxHeight,G]),Q=d(()=>{const e=I.current;if(!e)return;const t=e.scrollHeight;t>0&&B(J(t))},[J]);s(()=>{g||f||B(e=>{const t=ee(e),n=G();return null!=t&&t>=n?e:`${n}px`})},[f,G,g]);const oe=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(b)),h(!0),null==(t=a.onCopy)||t.call(a,b),setTimeout(()=>h(!1),1e3)}catch{}},[b,a]),ie=d(async()=>{var e,t,n,r,o,i,l,c;if(!x)return;if(!I.current)return;const s=I.current,d=b,u=!1===a.loading,m=++K.current;let h=null,f=null;try{const o=await async function(){return Gt||Yt||(Yt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),Gt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Yt)}();if(m!==K.current||s!==I.current)return;if(!o)throw new Error("Infographic library failed to load.");f=Array.from(s.childNodes),h=new o({container:s,width:"100%",height:"100%"});let i="",l=!1;if(null==(e=h.on)||e.call(h,"error",e=>{const t=Array.isArray(e)?e:[e];i=t.map(e=>{var t;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(t=e.message)?t:"":null!=e?e:"")}).filter(Boolean).join("; ")}),null==(t=h.on)||t.call(h,"rendered",()=>{l=!0}),h.render(d),i)throw new Error(i);const a=Array.from(s.childNodes),c=a.length>0&&(a.length!==f.length||a.some((e,t)=>e!==(null==f?void 0:f[t])));if(!l&&!c)throw new Error("Infographic render returned empty output.");null==(r=null==(n=z.current)?void 0:n.destroy)||r.call(n),z.current=h,h=null,T(!0),L(!1),setTimeout(()=>{Q()},0)}catch(p){if(m!==K.current||s!==I.current)return;null==(o=null==h?void 0:h.destroy)||o.call(h),h=null,u&&!1===a.loading&&d===b?(console.error("Failed to render infographic:",p),null==(l=null==(i=z.current)?void 0:i.destroy)||l.call(i),z.current=null,T(!1),L(!0),s.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`):f&&s.replaceChildren(...f)}finally{null==(c=null==h?void 0:h.destroy)||c.call(h)}},[b,a.loading,Q,x]);s(()=>{const e=_.current;if(!e)return;const t=Z(e,{rootMargin:"160px"});return H.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),H.current=null}},[Z]),s(()=>{!x||g||f||ie()},[b,f,ie,g,x]),s(()=>()=>{var e,t;K.current+=1,z.current&&(null==(t=(e=z.current).destroy)||t.call(e),z.current=null)},[]);const le=d(()=>{w(!1),W.current&&(W.current.innerHTML=""),O.current=null,document.body.style.overflow=""},[]),ae=d(()=>{w(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!y)return;const e=e=>{"Escape"===e.key&&le()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,le]),s(()=>{y&&setTimeout(()=>{if(I.current&&W.current){W.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=I.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),W.current.appendChild(e),O.current=e,e.style.transform=`translate(${P.x}px, ${P.y}px) scale(${D})`}},0)},[y]),s(()=>{y&&O.current&&(O.current.style.transform=`translate(${P.x}px, ${P.y}px) scale(${D})`)},[y,P,D]);const ce=d(()=>{var e;const t=null==(e=I.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]);j.current||(j.current=ge({getTranslate:()=>V.current,setTranslate:e=>A(e),canStart:e=>!!X.current&&("touch"!==e.pointerType||U.current||q.current>1),onActiveChange:e=>F(e)}));const se=j.current;s(()=>()=>se.stop(),[se]);const de=a.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",ue=g||f,me=y||D>1;/* @__PURE__ */
66
+ /* @__PURE__ */t("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),nn={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function rn(r){var l;const a={...nn,...r},{t:u}=_e(),[m,h]=i(!1),[f,p]=i(!1),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(()=>"undefined"==typeof window),b=a.node.code,C=o(()=>a.maxHeight&&"none"!==a.maxHeight?ee(a.maxHeight):null,[a.maxHeight]),N=o(()=>{var e;return null!=(e=ee(a.estimatedPreviewHeightPx))?e:te(b)},[b,a.estimatedPreviewHeightPx]),[M,B]=i(()=>`${ne(N,re,C)}px`),[S,T]=i(!1),[E,L]=i(!1),[D,$]=i(1),[P,A]=i({x:0,y:0}),[R,F]=i(!1),I=c(null),_=c(null),H=c(null),W=c(null),O=c(null),j=c(null),z=c(null),K=c(0),V=c(P);V.current=P;const q=c(D);q.current=D;const U=c(y);U.current=y;const X=c(S);X.current=S;const Z=Pe(),Y=d(()=>{var e;const t=I.current,n=t?getComputedStyle(t).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=ee(n))?e:re},[]),G=d(()=>ne(N,Y(),C),[N,C,Y]),J=d(e=>{const t=G();if(!a.maxHeight||"none"===a.maxHeight)return`${Math.max(e,t)}px`;const n=Number.parseFloat(String(a.maxHeight));return Number.isFinite(n)?`${Math.max(Math.min(e,n),t)}px`:`${Math.max(e,t)}px`},[a.maxHeight,G]),Q=d(()=>{const e=I.current;if(!e)return;const t=e.scrollHeight;t>0&&B(J(t))},[J]);s(()=>{g||f||B(e=>{const t=ee(e),n=G();return null!=t&&t>=n?e:`${n}px`})},[f,G,g]);const oe=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(b)),h(!0),null==(t=a.onCopy)||t.call(a,b),setTimeout(()=>h(!1),1e3)}catch{}},[b,a]),ie=d(async()=>{var e,t,n,r,o,i,l,c;if(!x)return;if(!I.current)return;const s=I.current,d=b,u=!1===a.loading,m=++K.current;let h=null,f=null;try{const o=await async function(){return en||Qt||(Qt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),en=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Qt)}();if(m!==K.current||s!==I.current)return;if(!o)throw new Error("Infographic library failed to load.");f=Array.from(s.childNodes),h=new o({container:s,width:"100%",height:"100%"});let i="",l=!1;if(null==(e=h.on)||e.call(h,"error",e=>{const t=Array.isArray(e)?e:[e];i=t.map(e=>{var t;return e instanceof Error?e.message:"string"==typeof e?e:String(e&&"object"==typeof e&&"message"in e?null!=(t=e.message)?t:"":null!=e?e:"")}).filter(Boolean).join("; ")}),null==(t=h.on)||t.call(h,"rendered",()=>{l=!0}),h.render(d),i)throw new Error(i);const a=Array.from(s.childNodes),c=a.length>0&&(a.length!==f.length||a.some((e,t)=>e!==(null==f?void 0:f[t])));if(!l&&!c)throw new Error("Infographic render returned empty output.");null==(r=null==(n=z.current)?void 0:n.destroy)||r.call(n),z.current=h,h=null,T(!0),L(!1),setTimeout(()=>{Q()},0)}catch(p){if(m!==K.current||s!==I.current)return;null==(o=null==h?void 0:h.destroy)||o.call(h),h=null,u&&!1===a.loading&&d===b?(console.error("Failed to render infographic:",p),null==(l=null==(i=z.current)?void 0:i.destroy)||l.call(i),z.current=null,T(!1),L(!0),s.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`):f&&s.replaceChildren(...f)}finally{null==(c=null==h?void 0:h.destroy)||c.call(h)}},[b,a.loading,Q,x]);s(()=>{const e=_.current;if(!e)return;const t=Z(e,{rootMargin:"160px"});return H.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),H.current=null}},[Z]),s(()=>{!x||g||f||ie()},[b,f,ie,g,x]),s(()=>()=>{var e,t;K.current+=1,z.current&&(null==(t=(e=z.current).destroy)||t.call(e),z.current=null)},[]);const le=d(()=>{w(!1),W.current&&(W.current.innerHTML=""),O.current=null,document.body.style.overflow=""},[]),ae=d(()=>{w(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!y)return;const e=e=>{"Escape"===e.key&&le()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,le]),s(()=>{y&&setTimeout(()=>{if(I.current&&W.current){W.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=I.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),W.current.appendChild(e),O.current=e,e.style.transform=`translate(${P.x}px, ${P.y}px) scale(${D})`}},0)},[y]),s(()=>{y&&O.current&&(O.current.style.transform=`translate(${P.x}px, ${P.y}px) scale(${D})`)},[y,P,D]);const ce=d(()=>{var e;const t=null==(e=I.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]);j.current||(j.current=ge({getTranslate:()=>V.current,setTranslate:e=>A(e),canStart:e=>!!X.current&&("touch"!==e.pointerType||U.current||q.current>1),onActiveChange:e=>F(e)}));const se=j.current;s(()=>()=>se.stop(),[se]);const de=a.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",ue=g||f,me=y||D>1;/* @__PURE__ */
67
67
  return e(n,{children:[
68
68
  /* @__PURE__ */e("div",{ref:_,"data-markstream-infographic":"1","data-markstream-mode":g?"source":E?"error":S?"preview":"pending",className:ut("my-4 rounded-lg border overflow-hidden shadow-sm",a.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":a.loading}),children:[a.showHeader&&/* @__PURE__ */e("div",{className:ut("flex justify-between items-center px-4 py-2.5 border-b",a.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
69
- /* @__PURE__ */e("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Jt,
69
+ /* @__PURE__ */e("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[tn,
70
70
  /* @__PURE__ */t("span",{className:ut("text-sm font-medium font-mono truncate",a.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),a.showModeToggle&&/* @__PURE__ */e("div",{className:ut("flex items-center gap-x-1 rounded-md p-0.5",a.isDark?"bg-gray-700":"bg-gray-100"),children:[
71
71
  /* @__PURE__ */t("button",{className:ut("px-2.5 py-1 text-xs rounded transition-colors",g?a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>v(!1),onMouseEnter:e=>Ue(e.currentTarget,u("common.preview")||"Preview","top",!1,0,a.isDark),onMouseLeave:()=>Xe(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
72
72
  /* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
@@ -92,18 +92,18 @@ return e(n,{children:[
92
92
  /* @__PURE__ */t("button",{className:ut("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>$(Math.max(D-.1,.5)),children:"-"}),
93
93
  /* @__PURE__ */e("button",{className:ut("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{$(1),A({x:0,y:0})},children:[Math.round(100*D),"%"]}),
94
94
  /* @__PURE__ */t("button",{className:ut("inline-flex items-center justify-center p-2 rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:le,children:"X"})]}),
95
- /* @__PURE__ */t("div",{ref:W,className:ut("w-full h-full flex items-center justify-center p-4 overflow-hidden",!R&&"cursor-grab",R&&"cursor-grabbing"),style:{touchAction:me?"none":void 0},onPointerDown:e=>se.start(e.nativeEvent)})]})}),document.body)]})}function tn(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function nn(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.code)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Te(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?tn(e):e);else g(e=>{var t;return 1!==e.length||(null==(t=e[0])?void 0:t.fading)||e[0].content!==m?m?[{id:w.current++,content:m,fading:!1}]:[]:e});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:l||p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ut("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?tn(e,t):e);var t}:void 0,children:e.content},e.id))})}function rn(e){/* @__PURE__ */
96
- return t("ins",{className:"insert-node",children:e.children})}function on(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function ln({content:e}){const n=c(e),r=c(n.current),o=c(null);return s(()=>{const t=o.current;if(t)if(e.startsWith(r.current)){const n=e.slice(r.current.length);n&&t.appendChild(document.createTextNode(n)),r.current=e}else t.textContent=e,r.current=e},[e]),/* @__PURE__ */t("span",{ref:o,children:n.current})}function an(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.content)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Te(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?on(e):e);else g(e=>{if(!m)return[];const t=e.reduce((e,t)=>e+t.content,"");return m===t?e:m.startsWith(t)?[...e,{id:w.current++,content:m.slice(t.length),fading:!1}]:[{id:w.current++,content:m,fading:!1}]});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("span",null!=l?{className:ut("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:l}:{className:ut("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ut("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?on(e,t):e);var t}:void 0,children:e.fading?e.content:/* @__PURE__ */t(ln,{content:e.content})},e.id))})}function cn(n){var r,i,l;const{node:a,ctx:c,renderNode:s,indexKey:u}=n,m=!1!==n.showTooltip,h=null!=(r=n.isDark)?r:null==c?void 0:c.isDark,f=o(()=>{var e,t,r,o,i,l;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",c=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*c,c));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(r=n.underlineHeight)?r:2}px`,"--underline-bottom":a,"--underline-opacity":String(c),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(i=n.animationTiming)?i:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(l=n.animationIteration)?l:"infinite"}},[n.animationDuration,n.animationIteration,n.animationOpacity,n.animationTiming,n.color,n.underlineBottom,n.underlineHeight]),p=o(()=>{var e;return C({href:String(null!=(e=a.href)?e:"")}).href},[a.href]),g="string"==typeof a.title&&a.title.trim().length>0?a.title:String(null!=p?p:""),v=N(p),y=d(e=>{m&&Ue(e.currentTarget,String(a.title||p||a.text||""),"top",!1,(e.clientX,e.clientY),h)},[h,a.text,a.title,p,m]),w=d(()=>{m&&Xe()},[m]);return a.loading?/* @__PURE__ */t("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
97
- /* @__PURE__ */t("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */t(an,{node:{type:"text",content:String(null!=(i=a.text)?i:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-loading`,typewriter:n.typewriter})}),
98
- /* @__PURE__ */t("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */t("a",{className:"link-node",href:p||void 0,title:m?"":g,"aria-label":`Link: ${g}`,target:v?"_blank":void 0,rel:v?"noopener noreferrer":void 0,style:f,onMouseEnter:y,onMouseLeave:w,children:c&&s?$(a.children,c,String(null!=u?u:"link"),s):/* @__PURE__ */t(an,{node:{type:"text",content:String(null!=(l=a.text)?l:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-fallback`,typewriter:n.typewriter})})}function sn(e){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=e;/* @__PURE__ */
99
- return t("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?$(n.children,r,String(null!=l?l:"list-item"),o):null})}function dn(e){var n;const{node:r,ctx:o,renderNode:i,indexKey:l}=e,a=r.ordered?"ol":"ul",c=r.ordered&&r.start?r.start:void 0,s=o&&V(o.customId).list_item||sn;/* @__PURE__ */
95
+ /* @__PURE__ */t("div",{ref:W,className:ut("w-full h-full flex items-center justify-center p-4 overflow-hidden",!R&&"cursor-grab",R&&"cursor-grabbing"),style:{touchAction:me?"none":void 0},onPointerDown:e=>se.start(e.nativeEvent)})]})}),document.body)]})}function on(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function ln(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.code)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Te(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?on(e):e);else g(e=>{var t;return 1!==e.length||(null==(t=e[0])?void 0:t.fading)||e[0].content!==m?m?[{id:w.current++,content:m,fading:!1}]:[]:e});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:l||p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ut("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?on(e,t):e);var t}:void 0,children:e.content},e.id))})}function an(e){/* @__PURE__ */
96
+ return t("ins",{className:"insert-node",children:e.children})}function cn(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function sn({content:e}){const n=c(e),r=c(n.current),o=c(null);return s(()=>{const t=o.current;if(t)if(e.startsWith(r.current)){const n=e.slice(r.current.length);n&&t.appendChild(document.createTextNode(n)),r.current=e}else t.textContent=e,r.current=e},[e]),/* @__PURE__ */t("span",{ref:o,children:n.current})}function dn(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.content)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Te(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?cn(e):e);else g(e=>{if(!m)return[];const t=e.reduce((e,t)=>e+t.content,"");return m===t?e:m.startsWith(t)?[...e,{id:w.current++,content:m.slice(t.length),fading:!1}]:[{id:w.current++,content:m,fading:!1}]});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("span",null!=l?{className:ut("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:l}:{className:ut("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ut("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?cn(e,t):e);var t}:void 0,children:e.fading?e.content:/* @__PURE__ */t(sn,{content:e.content})},e.id))})}function un(n){var r,i,l;const{node:a,ctx:c,renderNode:s,indexKey:u}=n,m=!1!==n.showTooltip,h=null!=(r=n.isDark)?r:null==c?void 0:c.isDark,f=o(()=>{var e,t,r,o,i,l;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",c=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*c,c));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(r=n.underlineHeight)?r:2}px`,"--underline-bottom":a,"--underline-opacity":String(c),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(i=n.animationTiming)?i:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(l=n.animationIteration)?l:"infinite"}},[n.animationDuration,n.animationIteration,n.animationOpacity,n.animationTiming,n.color,n.underlineBottom,n.underlineHeight]),p=o(()=>{var e;return C({href:String(null!=(e=a.href)?e:"")}).href},[a.href]),g="string"==typeof a.title&&a.title.trim().length>0?a.title:String(null!=p?p:""),v=N(p),y=d(e=>{m&&Ue(e.currentTarget,String(a.title||p||a.text||""),"top",!1,(e.clientX,e.clientY),h)},[h,a.text,a.title,p,m]),w=d(()=>{m&&Xe()},[m]);return a.loading?/* @__PURE__ */t("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
97
+ /* @__PURE__ */t("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */t(dn,{node:{type:"text",content:String(null!=(i=a.text)?i:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-loading`,typewriter:n.typewriter})}),
98
+ /* @__PURE__ */t("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */t("a",{className:"link-node",href:p||void 0,title:m?"":g,"aria-label":`Link: ${g}`,target:v?"_blank":void 0,rel:v?"noopener noreferrer":void 0,style:f,onMouseEnter:y,onMouseLeave:w,children:c&&s?$(a.children,c,String(null!=u?u:"link"),s):/* @__PURE__ */t(dn,{node:{type:"text",content:String(null!=(l=a.text)?l:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-fallback`,typewriter:n.typewriter})})}function mn(e){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=e;/* @__PURE__ */
99
+ return t("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?$(n.children,r,String(null!=l?l:"list-item"),o):null})}function hn(e){var n;const{node:r,ctx:o,renderNode:i,indexKey:l}=e,a=r.ordered?"ol":"ul",c=r.ordered&&r.start?r.start:void 0,s=o&&V(o.customId).list_item||mn;/* @__PURE__ */
100
100
  return t(a,{className:ut("list-node my-5 pl-[calc(13/8*1em)]",r.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:c,children:null==(n=r.items)?void 0:n.map((e,n)=>{var a;/* @__PURE__ */
101
- return t(s,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${n}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${n}`)})})}let un=null,mn=null,hn=!1;const fn=/* @__PURE__ */new Map,pn=/* @__PURE__ */new Map;let gn=5;const vn=/* @__PURE__ */new Set;function yn(){if(fn.size<gn&&vn.size){const e=Array.from(vn);vn.clear();for(const t of e)try{t()}catch{}}}function wn(e){un=e,mn=null,un.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=fn.get(t);if(o)if(fn.delete(t),clearTimeout(o.timeoutId),yn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(pn.set(e,n),pn.size>200){const e=pn.keys().next().value;pn.delete(e)}}o.resolve(n)}},un.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of fn.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));fn.clear(),yn()}}function xn(){var e;un&&(null==(e=un.terminate)||e.call(un)),un=null,mn=null}function kn(e){hn=!!e,un&&un.postMessage({type:"init",debug:hn})}const bn="WORKER_BUSY";async function Cn(e,t=!0,n=2e3,r){performance.now();const o=oe(e);if(mn)return Promise.reject(mn);const i=`${t?"d":"i"}:${o}`,l=pn.get(i);if(l)return Promise.resolve(l);const a=un||(mn=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),mn.name="WORKER_INIT_ERROR",mn.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(mn);if(fn.size>=gn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=bn,e.busy=!0,e.inFlight=fn.size,e.max=gn,Promise.reject(e)}return new Promise((e,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),c=setTimeout(()=>{fn.delete(l);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),yn()},n),s=()=>{},d=()=>{fn.delete(l),clearTimeout(c),vn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),yn()};r&&r.addEventListener("abort",d,{once:!0}),fn.set(l,{resolve:t=>{r&&r.removeEventListener("abort",d),e(t)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{a.postMessage({id:l,content:o,displayMode:t,debug:hn})}catch(u){fn.delete(l),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),yn()}})}function Nn(e,t,n){const r=`${t?"d":"i"}:${oe(e)}`;if(pn.set(r,n),pn.size>200){const e=pn.keys().next().value;pn.delete(e)}}function Mn(){pn.clear()}function Bn(e){gn=Math.max(1,Math.floor(e)),yn()}function Sn(e=1500,t){return fn.size<gn?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){vn.delete(l),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),vn.add(l)})}const Tn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function En(e){null!=e.timeout&&(Tn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Tn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Tn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Tn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Ln(){return{...Tn}}async function Dn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:Tn.timeout,c=null!=(o=n.waitTimeout)?o:Tn.waitTimeout,s=null!=(i=n.backoffMs)?i:Tn.backoffMs,d=null!=(l=n.maxRetries)?l:Tn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Tn.maxRetries,m=n.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await Cn(e,t,a,m)}catch(f){if((null==f?void 0:f.code)!==bn||h>=u)throw f;if(h++,await Sn(c,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*h))}}}let $n=null,Pn=!1;async function An(){if($n)return $n;if(Pn)return null;try{return $n=await import("katex"),await import("katex/contrib/mhchem"),$n}catch{return Pn=!0,null}}function Rn({node:e}){const n=c(null),r=c(null),o=c(null),l=Pe(),[a,d]=i(!0),[u,m]=i(()=>"undefined"==typeof window),h=c(0);return s(()=>{const e=n.current;if(!e)return;const t=l(e,{rootMargin:"400px"});return o.current=t,t.isVisible()&&m(!0),t.whenVisible.then(()=>m(!0)),()=>{t.destroy(),o.current=null}},[l]),s(()=>{var t;const n=oe(null!=(t=e.content)?t:"");if(!n)return r.current&&(r.current.innerHTML=""),void d(!1);if(!u)return void d(!0);let o=!1;const i=new AbortController,l=++h.current;return Dn(n,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{o||l!==h.current||(r.current&&(r.current.innerHTML=e),d(!1))}).catch(async t=>{if(o||l!==h.current)return;if(!r.current)return;const i=(null==t?void 0:t.code)||(null==t?void 0:t.name);if("WORKER_INIT_ERROR"===i||(null==t?void 0:t.fallbackToRenderer)||i===bn||"WORKER_TIMEOUT"===i){const t=await An();if(t)try{const i=t.renderToString(n,{throwOnError:e.loading,displayMode:!0});return void(!o&&l===h.current&&r.current&&(r.current.innerHTML=i,d(!1),Nn(n,!0,i)))}catch{}}e.loading||(r.current.textContent=e.raw,d(!1))}),()=>{o=!0,i.abort()}},[e.content,e.loading,e.raw,u]),/* @__PURE__ */t("div",{ref:n,className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */t("div",{ref:r,className:a?"math-rendering":void 0})})}function Fn({node:n}){const r=c(null),o=c(null),l=c(null),a=Pe(),[d,u]=i(!0),[m,h]=i(()=>"undefined"==typeof window),f=c(0);return s(()=>{const e=r.current;if(!e)return;const t=a(e,{rootMargin:"400px"});return l.current=t,t.isVisible()&&h(!0),t.whenVisible.then(()=>h(!0)),()=>{t.destroy(),l.current=null}},[a]),s(()=>{var e;const t=oe(null!=(e=n.content)?e:"");if(!t)return o.current&&(o.current.innerHTML=""),void u(!1);if(!m)return void u(!0);let r=!1;const i=new AbortController,l=++f.current,a="$$"===n.markup;return Dn(t,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||l!==f.current||o.current&&(o.current.innerHTML=e,u(!1))}).catch(async e=>{if(r||l!==f.current)return;if(!o.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===bn||"WORKER_TIMEOUT"===i){const e=await An();if(e)try{const i=e.renderToString(t,{throwOnError:n.loading,displayMode:a});return void(!r&&l===f.current&&o.current&&(o.current.innerHTML=i,u(!1),Nn(t,a,i)))}catch{}}n.loading||(o.current.textContent=n.raw,u(!1))}),()=>{r=!0,i.abort()}},[n.content,n.loading,n.raw,n.markup,m]),/* @__PURE__ */e("span",{ref:r,className:"math-inline-wrapper",children:[
101
+ return t(s,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${n}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${n}`)})})}let fn=null,pn=null,gn=!1;const vn=/* @__PURE__ */new Map,yn=/* @__PURE__ */new Map;let wn=5;const xn=/* @__PURE__ */new Set;function kn(){if(vn.size<wn&&xn.size){const e=Array.from(xn);xn.clear();for(const t of e)try{t()}catch{}}}function bn(e){fn=e,pn=null,fn.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=vn.get(t);if(o)if(vn.delete(t),clearTimeout(o.timeoutId),kn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(yn.set(e,n),yn.size>200){const e=yn.keys().next().value;yn.delete(e)}}o.resolve(n)}},fn.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of vn.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));vn.clear(),kn()}}function Cn(){var e;fn&&(null==(e=fn.terminate)||e.call(fn)),fn=null,pn=null}function Nn(e){gn=!!e,fn&&fn.postMessage({type:"init",debug:gn})}const Mn="WORKER_BUSY";async function Bn(e,t=!0,n=2e3,r){performance.now();const o=oe(e);if(pn)return Promise.reject(pn);const i=`${t?"d":"i"}:${o}`,l=yn.get(i);if(l)return Promise.resolve(l);const a=fn||(pn=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),pn.name="WORKER_INIT_ERROR",pn.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(pn);if(vn.size>=wn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Mn,e.busy=!0,e.inFlight=vn.size,e.max=wn,Promise.reject(e)}return new Promise((e,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),c=setTimeout(()=>{vn.delete(l);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),kn()},n),s=()=>{},d=()=>{vn.delete(l),clearTimeout(c),xn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),kn()};r&&r.addEventListener("abort",d,{once:!0}),vn.set(l,{resolve:t=>{r&&r.removeEventListener("abort",d),e(t)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{a.postMessage({id:l,content:o,displayMode:t,debug:gn})}catch(u){vn.delete(l),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),kn()}})}function Sn(e,t,n){const r=`${t?"d":"i"}:${oe(e)}`;if(yn.set(r,n),yn.size>200){const e=yn.keys().next().value;yn.delete(e)}}function Tn(){yn.clear()}function En(e){wn=Math.max(1,Math.floor(e)),kn()}function Ln(e=1500,t){return vn.size<wn?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){xn.delete(l),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),xn.add(l)})}const Dn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function $n(e){null!=e.timeout&&(Dn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Dn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Dn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Dn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Pn(){return{...Dn}}async function An(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:Dn.timeout,c=null!=(o=n.waitTimeout)?o:Dn.waitTimeout,s=null!=(i=n.backoffMs)?i:Dn.backoffMs,d=null!=(l=n.maxRetries)?l:Dn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Dn.maxRetries,m=n.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await Bn(e,t,a,m)}catch(f){if((null==f?void 0:f.code)!==Mn||h>=u)throw f;if(h++,await Ln(c,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*h))}}}let Rn=null,Fn=!1;async function In(){if(Rn)return Rn;if(Fn)return null;try{return Rn=await import("katex"),await import("katex/contrib/mhchem"),Rn}catch{return Fn=!0,null}}function _n({node:e}){const n=c(null),r=c(null),o=c(null),l=Pe(),[a,d]=i(!0),[u,m]=i(()=>"undefined"==typeof window),h=c(0);return s(()=>{const e=n.current;if(!e)return;const t=l(e,{rootMargin:"400px"});return o.current=t,t.isVisible()&&m(!0),t.whenVisible.then(()=>m(!0)),()=>{t.destroy(),o.current=null}},[l]),s(()=>{var t;const n=oe(null!=(t=e.content)?t:"");if(!n)return r.current&&(r.current.innerHTML=""),void d(!1);if(!u)return void d(!0);let o=!1;const i=new AbortController,l=++h.current;return An(n,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{o||l!==h.current||(r.current&&(r.current.innerHTML=e),d(!1))}).catch(async t=>{if(o||l!==h.current)return;if(!r.current)return;const i=(null==t?void 0:t.code)||(null==t?void 0:t.name);if("WORKER_INIT_ERROR"===i||(null==t?void 0:t.fallbackToRenderer)||i===Mn||"WORKER_TIMEOUT"===i){const t=await In();if(t)try{const i=t.renderToString(n,{throwOnError:e.loading,displayMode:!0});return void(!o&&l===h.current&&r.current&&(r.current.innerHTML=i,d(!1),Sn(n,!0,i)))}catch{}}e.loading||(r.current.textContent=e.raw,d(!1))}),()=>{o=!0,i.abort()}},[e.content,e.loading,e.raw,u]),/* @__PURE__ */t("div",{ref:n,className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */t("div",{ref:r,className:a?"math-rendering":void 0})})}function Hn({node:n}){const r=c(null),o=c(null),l=c(null),a=Pe(),[d,u]=i(!0),[m,h]=i(()=>"undefined"==typeof window),f=c(0);return s(()=>{const e=r.current;if(!e)return;const t=a(e,{rootMargin:"400px"});return l.current=t,t.isVisible()&&h(!0),t.whenVisible.then(()=>h(!0)),()=>{t.destroy(),l.current=null}},[a]),s(()=>{var e;const t=oe(null!=(e=n.content)?e:"");if(!t)return o.current&&(o.current.innerHTML=""),void u(!1);if(!m)return void u(!0);let r=!1;const i=new AbortController,l=++f.current,a="$$"===n.markup;return An(t,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||l!==f.current||o.current&&(o.current.innerHTML=e,u(!1))}).catch(async e=>{if(r||l!==f.current)return;if(!o.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===Mn||"WORKER_TIMEOUT"===i){const e=await In();if(e)try{const i=e.renderToString(t,{throwOnError:n.loading,displayMode:a});return void(!r&&l===f.current&&o.current&&(o.current.innerHTML=i,u(!1),Sn(t,a,i)))}catch{}}n.loading||(o.current.textContent=n.raw,u(!1))}),()=>{r=!0,i.abort()}},[n.content,n.loading,n.raw,n.markup,m]),/* @__PURE__ */e("span",{ref:r,className:"math-inline-wrapper",children:[
102
102
  /* @__PURE__ */t("span",{ref:o,className:"math-inline"+(d?" math-inline--hidden":"")}),d&&/* @__PURE__ */e("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
103
103
  /* @__PURE__ */t("span",{className:"math-inline__spinner","aria-hidden":"true"}),
104
- /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function In(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let _n=null,Hn=null;const Wn=/* @__PURE__ */new Map;let On=5,jn=!1;function zn(e){jn=!!e}function Kn(e){Number.isFinite(e)&&e>0&&(On=Math.floor(e))}function Vn(){return{inFlight:Wn.size,max:On}}const qn="WORKER_BUSY";function Un(e){_n=e,Hn=null;const t=e;_n.onmessage=e=>{if(_n!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=Wn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},_n.onerror=e=>{var n,r;if(_n===t)if(0!==Wn.size){try{jn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of Wn.entries())n.reject(new Error(`Worker error: ${e.message}`));Wn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},_n.onmessageerror=e=>{var n,r;if(_n===t)if(0!==Wn.size){try{jn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Wn.entries())t.reject(new Error("Worker messageerror"));Wn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Xn(){var e;if(_n)try{for(const[e,t]of Wn.entries())t.reject(new Error("Worker cleared"));Wn.clear(),null==(e=_n.terminate)||e.call(_n)}catch{}_n=null,Hn=null}function Zn(e,t,n=1400){if(Hn)return Promise.reject(Hn);const r=_n||(Hn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Hn.name="WORKER_INIT_ERROR",Hn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Hn);if(Wn.size>=On){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=qn,e.inFlight=Wn.size,e.max=On,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),Wn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};Wn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return Wn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=Wn.get(l);null==t||t.reject(e)},n)})}async function Yn(e,t,n=1400){return Zn("canParse",{code:e,theme:t},n)}async function Gn(e,t,n=2400){return Zn("findPrefix",{code:e,theme:t},n)}function Jn(){var e;null==(e=null==_n?void 0:_n.terminate)||e.call(_n),_n=null,Hn=null,Wn.clear()}let Qn=null,er=!1,tr=null,nr=null;function rr(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"strict")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(tr!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),tr=r}catch{}}const or="undefined"!=typeof window?u:s,ir={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function lr(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function ar(e,t,n={}){if(!e)return"";const r=function(e,t){if(!e)return"";const n=M(t);return n?(lr(e),e.appendChild(n),e.innerHTML):""}(e,t);return r||n.keepPreviousOnFailure||lr(e),r}function cr(e,t,n){if(n&&(null==e?void 0:e.querySelector("svg")))try{null==t||t(e)}catch{}}const sr={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function dr(r){var l,a,m,h,f,p,g,v,y,w;const x={...sr,...r},{t:k}=_e(),b=o(()=>H("mermaid"),[]),C=null!=(a=null==(l=x.node)?void 0:l.code)?a:"",N=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),M=null!=(m=x.workerTimeoutMs)?m:sr.workerTimeoutMs,B=null!=(h=x.parseTimeoutMs)?h:sr.parseTimeoutMs,S=null!=(f=x.renderTimeoutMs)?f:sr.renderTimeoutMs,T=null!=(p=x.fullRenderTimeoutMs)?p:sr.fullRenderTimeoutMs,E=Math.max(0,null!=(g=x.renderDebounceMs)?g:sr.renderDebounceMs),L=o(()=>x.maxHeight&&"none"!==x.maxHeight?ie(x.maxHeight):null,[x.maxHeight]),D=o(()=>{var e;return null!=(e=ie(x.estimatedPreviewHeightPx))?e:le(N)},[N,x.estimatedPreviewHeightPx]),[$,P]=i(!1),[A,R]=i(!1),[F,I]=i(!1),[_,W]=i(!1),[O,j]=i(1),[z,K]=i({x:0,y:0}),[V,q]=i(!1),[U,X]=i(!1),[Z,Y]=i(!1),[G,J]=i(null),[Q,ee]=i(!1),[te,ne]=i(()=>`${ae(D,ce,L)}px`),[re,oe]=i("undefined"==typeof window),se=c(null),de=c(null),ue=c(null),me=c(null),he=c(null),fe=c(null),pe=c(null),ve=c(null),ye=c(0),we=c({}),xe=c(null),ke=c(""),be=c(!1),Ne=c(null),Me=c(!1),Be=c({zoom:1,translateX:0,translateY:0,containerHeight:te||"360px"}),Se=c(z);Se.current=z;const Te=c(O);Te.current=O;const Ee=c(Q);Ee.current=Q;const Le=Pe(),De=Boolean(null!=(y=null==(v=x.node)?void 0:v.loading)?y:x.loading),$e=x.isDark?"dark":"light",Ae=Boolean(x.isStrict),Re=!0===x.enableMermaidInteractions,Fe=o(()=>Ae?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:ir,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Ae]);s(()=>{Me.current=Z},[Z]);const Ie=d(()=>{var e;const t=de.current,n=t?getComputedStyle(t).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=ie(n))?e:ce},[]),He=d(()=>ae(D,Ie(),L),[D,L,Ie]);s(()=>{A||F||ne(e=>{const t=ie(e),n=He();return null!=t&&t>=n?e:`${n}px`})},[F,He,A]),s(()=>{we.current={}},[$e,N,Ae]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Qn)return rr(Qn,e),Qn;if(nr){const t=await nr;return t&&rr(t,e),t}if(er)return null;try{er=!0,nr=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Qn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Qn)throw new Error("Mermaid module did not export expected API");return rr(Qn,null!=e?e:{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Qn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{nr=null}})();const t=await nr;return t&&rr(t,e),t}catch{return null}}(Fe);e||(se.current=t,P(Boolean(t)),be.current||R(!t))})(),()=>{e=!0}},[Fe]),s(()=>{const e=de.current;if(!e)return;const t=Le(e,{rootMargin:"400px"});return Ne.current=t,t.isVisible()&&oe(!0),t.whenVisible.then(()=>oe(!0)),()=>{t.destroy(),Ne.current=null}},[Le]),s(()=>{if("undefined"==typeof document)return;if(!Q)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Q]);const We=d(()=>L,[L]),Oe=d(e=>{const t=de.current,n=me.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i,s=We(),d=null==s?c:Math.min(c,s),u=He();ne(`${"none"===x.maxHeight?d:Math.max(d,u)}px`)},[x.maxHeight,He,We]);s(()=>{if(!de.current||"undefined"==typeof ResizeObserver)return;if(A||F)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;In(()=>Oe(t))});return e.observe(de.current),()=>e.disconnect()},[F,A,Oe]),s(()=>{A||F||Oe()},[F,x.maxHeight,A,Oe]),s(()=>()=>{Jn()},[]),u(()=>{var e;const t=we.current[$e];!A&&me.current&&(null==t?void 0:t.svg)&&(ar(me.current,t.svg)&&(xe.current=null!=(e=t.bindFunctions)?e:null,cr(me.current,t.bindFunctions,Re)),In(()=>Oe()))},[Re,A,$e,Oe]);const je=d(async(e,t,n)=>{var r;if(!se.current||!me.current)return!1;X(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=hr(e,t),l=await vr(()=>se.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=ar(me.current,l.svg);return!!a&&(xe.current=null!=(r=l.bindFunctions)?r:null,cr(me.current,l.bindFunctions,Re),Oe(),we.current[t]={svg:a,bindFunctions:l.bindFunctions},Y(!0),J(null),!0)}catch(o){if(!De){if("function"==typeof x.onRenderError&&me.current&&!0===x.onRenderError(o,N,me.current))return!1;J(o instanceof Error?o.message:String(o))}return!1}finally{X(!1)}},[Re,T,De,Oe]),ze=d(async(e,t,n)=>{var r;if(se.current&&me.current){X(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=hr(gr(e)||e,t),l=await vr(()=>se.current.render(o,i),{timeoutMs:S,signal:n});if(null==l?void 0:l.svg){const e=ar(me.current,l.svg,{keepPreviousOnFailure:!0});e&&(xe.current=null!=(r=l.bindFunctions)?r:null,cr(me.current,l.bindFunctions,Re)),e&&Oe()}}catch{}finally{X(!1)}}},[Re,S,De,Oe]),Ke=d(async(e,t)=>{if(!e.trim())return lr(me.current),Y(!1),void(ke.current="");const n=e.replace(/\s+/g,"");if(n===ke.current&&Me.current)return;const r=++ye.current;if("gantt"===fr(e)){const i=gr(e);if(!i.trim())return;try{if(await mr(i,$e,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:t}),(null==t?void 0:t.aborted)||ye.current!==r)return;i===e?await je(e,$e,t)&&(ke.current=n):await ze(i,$e,t)}catch(o){if("AbortError"===(null==o?void 0:o.name))return}return}try{if(await mr(e,$e,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:t}),(null==t?void 0:t.aborted)||ye.current!==r)return;return void(await je(e,$e,t)&&(ke.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await Gn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return gr(e)}(e,$e,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||ye.current!==r)return;await ze(n,$e,t)}catch{}},[B,je,ze,$e,M]),Ve=d(()=>re&&!A&&!F,[F,A,re]);s(()=>{if(!Ve())return;if(!se.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Ve()&&Ke(N,e.signal)},E);return()=>{e.abort(),window.clearTimeout(t)}},[N,Ve,$,Ke,E]);const qe=d((e,t)=>{e.clientX,e.clientY,Ue(e.currentTarget,t,"top",!1,0,x.isDark)},[x.isDark]),Ze=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),W(!0),null==(t=x.onCopy)||t.call(x,N),setTimeout(()=>W(!1),1e3)}catch{}},[N,x]),Ye=d(()=>{var e,t,n;const r=null!=(t=null==(e=me.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=yr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onExport)||n.call(x,i),i.defaultPrevented||function(e,t){const n=null!=t?t:yr(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[x]),Ge=d(()=>{pe.current=null,lr(fe.current)},[]),Je=d(()=>{ee(!1),Ge()},[Ge]),Qe=d(()=>{var e,t,n;const r=null!=(t=null==(e=me.current)?void 0:e.querySelector("svg"))?t:null,o=r?yr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onOpenModal)||n.call(x,i),i.defaultPrevented||ee(!0)},[x]);s(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Je()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Je,Q]),or(()=>{var e,t;if(!Q)return;const n=fe.current,r=de.current;if(!n||!r)return;const o=`translate(${z.x}px, ${z.y}px) scale(${O})`,i=r.cloneNode(!0);i.classList.add("fullscreen"),i.style.height="100%",i.style.maxHeight="100%";const l=i.querySelector("[data-mermaid-wrapper]");l&&(pe.current=l,l.style.transform=o),lr(n),n.appendChild(i),cr(n,null!=(t=xe.current)?t:null==(e=we.current[$e])?void 0:e.bindFunctions,Re)},[Re,Q,$e]),s(()=>{Q&&pe.current&&(pe.current.style.transform=`translate(${z.x}px, ${z.y}px) scale(${O})`)},[Q,z.x,z.y,O]);const et=A||U||F,tt=o(()=>x.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[x.isDark]),nt=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=x.onToggleMode)||t.call(x,e,n),!n.defaultPrevented)if(be.current=!0,"preview"===e){R(!1);const e=Be.current;j(e.zoom),K({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else Be.current={zoom:O,translateX:z.x,translateY:z.y,containerHeight:te},R(!0)},[N,te,Ke,x,$e,z.x,z.y,Oe,O]),rt=d(e=>{if(!1===x.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=de.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-z.x,o=e.clientY-n.top-z.y,i=.01*-e.deltaY,l=ur(O+i,.5,3);if(l===O)return;const a=l/O;K({x:z.x-r*(a-1),y:z.y-o*(a-1)}),j(l)},[z,O]);ve.current||(ve.current=ge({getTranslate:()=>Se.current,setTranslate:e=>K(e),canStart:e=>{var t;return!!(null==(t=me.current)?void 0:t.querySelector("svg"))&&("touch"!==e.pointerType||Ee.current||Te.current>1)},onActiveChange:e=>q(e)}));const ot=ve.current;s(()=>()=>ot.stop(),[ot]);const it=Q||O>1,lt=/* @__PURE__ */e("div",{className:"relative",children:[x.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
105
- /* @__PURE__ */t("button",{type:"button",className:ut("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>qe(e,k("common.zoomIn")),onMouseLeave:()=>Xe(),onClick:()=>j(ur(O+.1,.5,3)),children:"+"}),
106
- /* @__PURE__ */t("button",{type:"button",className:ut("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>qe(e,k("common.zoomOut")),onMouseLeave:()=>Xe(),onClick:()=>j(ur(O-.1,.5,3)),children:"−"}),
104
+ /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function Wn(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let On=null,jn=null;const zn=/* @__PURE__ */new Map;let Kn=5,Vn=!1;function qn(e){Vn=!!e}function Un(e){Number.isFinite(e)&&e>0&&(Kn=Math.floor(e))}function Xn(){return{inFlight:zn.size,max:Kn}}const Zn="WORKER_BUSY";function Yn(e){On=e,jn=null;const t=e;On.onmessage=e=>{if(On!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=zn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},On.onerror=e=>{var n,r;if(On===t)if(0!==zn.size){try{Vn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of zn.entries())n.reject(new Error(`Worker error: ${e.message}`));zn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},On.onmessageerror=e=>{var n,r;if(On===t)if(0!==zn.size){try{Vn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of zn.entries())t.reject(new Error("Worker messageerror"));zn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Gn(){var e;if(On)try{for(const[e,t]of zn.entries())t.reject(new Error("Worker cleared"));zn.clear(),null==(e=On.terminate)||e.call(On)}catch{}On=null,jn=null}function Jn(e,t,n=1400){if(jn)return Promise.reject(jn);const r=On||(jn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),jn.name="WORKER_INIT_ERROR",jn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(jn);if(zn.size>=Kn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Zn,e.inFlight=zn.size,e.max=Kn,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),zn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};zn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return zn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=zn.get(l);null==t||t.reject(e)},n)})}async function Qn(e,t,n=1400){return Jn("canParse",{code:e,theme:t},n)}async function er(e,t,n=2400){return Jn("findPrefix",{code:e,theme:t},n)}function tr(){var e;null==(e=null==On?void 0:On.terminate)||e.call(On),On=null,jn=null,zn.clear()}let nr=null,rr=!1,or=null,ir=null;function lr(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"strict")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(or!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),or=r}catch{}}const ar="undefined"!=typeof window?u:s,cr={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function sr(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function dr(e,t,n={}){if(!e)return"";const r=function(e,t){if(!e)return"";const n=M(t);return n?(sr(e),e.appendChild(n),e.innerHTML):""}(e,t);return r||n.keepPreviousOnFailure||sr(e),r}function ur(e,t,n){if(n&&(null==e?void 0:e.querySelector("svg")))try{null==t||t(e)}catch{}}const mr={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function hr(r){var l,a,m,h,f,p,g,v,y,w;const x={...mr,...r},{t:k}=_e(),b=o(()=>H("mermaid"),[]),C=null!=(a=null==(l=x.node)?void 0:l.code)?a:"",N=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),M=null!=(m=x.workerTimeoutMs)?m:mr.workerTimeoutMs,B=null!=(h=x.parseTimeoutMs)?h:mr.parseTimeoutMs,S=null!=(f=x.renderTimeoutMs)?f:mr.renderTimeoutMs,T=null!=(p=x.fullRenderTimeoutMs)?p:mr.fullRenderTimeoutMs,E=Math.max(0,null!=(g=x.renderDebounceMs)?g:mr.renderDebounceMs),L=o(()=>x.maxHeight&&"none"!==x.maxHeight?ie(x.maxHeight):null,[x.maxHeight]),D=o(()=>{var e;return null!=(e=ie(x.estimatedPreviewHeightPx))?e:le(N)},[N,x.estimatedPreviewHeightPx]),[$,P]=i(!1),[A,R]=i(!1),[F,I]=i(!1),[_,W]=i(!1),[O,j]=i(1),[z,K]=i({x:0,y:0}),[V,q]=i(!1),[U,X]=i(!1),[Z,Y]=i(!1),[G,J]=i(null),[Q,ee]=i(!1),[te,ne]=i(()=>`${ae(D,ce,L)}px`),[re,oe]=i("undefined"==typeof window),se=c(null),de=c(null),ue=c(null),me=c(null),he=c(null),fe=c(null),pe=c(null),ve=c(null),ye=c(0),we=c({}),xe=c(null),ke=c(""),be=c(!1),Ne=c(null),Me=c(!1),Be=c({zoom:1,translateX:0,translateY:0,containerHeight:te||"360px"}),Se=c(z);Se.current=z;const Te=c(O);Te.current=O;const Ee=c(Q);Ee.current=Q;const Le=Pe(),De=Boolean(null!=(y=null==(v=x.node)?void 0:v.loading)?y:x.loading),$e=x.isDark?"dark":"light",Ae=Boolean(x.isStrict),Re=!0===x.enableMermaidInteractions,Fe=o(()=>Ae?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:cr,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Ae]);s(()=>{Me.current=Z},[Z]);const Ie=d(()=>{var e;const t=de.current,n=t?getComputedStyle(t).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=ie(n))?e:ce},[]),He=d(()=>ae(D,Ie(),L),[D,L,Ie]);s(()=>{A||F||ne(e=>{const t=ie(e),n=He();return null!=t&&t>=n?e:`${n}px`})},[F,He,A]),s(()=>{we.current={}},[$e,N,Ae]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(nr)return lr(nr,e),nr;if(ir){const t=await ir;return t&&lr(t,e),t}if(rr)return null;try{rr=!0,ir=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(nr=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!nr)throw new Error("Mermaid module did not export expected API");return lr(nr,null!=e?e:{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),nr}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{ir=null}})();const t=await ir;return t&&lr(t,e),t}catch{return null}}(Fe);e||(se.current=t,P(Boolean(t)),be.current||R(!t))})(),()=>{e=!0}},[Fe]),s(()=>{const e=de.current;if(!e)return;const t=Le(e,{rootMargin:"400px"});return Ne.current=t,t.isVisible()&&oe(!0),t.whenVisible.then(()=>oe(!0)),()=>{t.destroy(),Ne.current=null}},[Le]),s(()=>{if("undefined"==typeof document)return;if(!Q)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Q]);const We=d(()=>L,[L]),Oe=d(e=>{const t=de.current,n=me.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i,s=We(),d=null==s?c:Math.min(c,s),u=He();ne(`${"none"===x.maxHeight?d:Math.max(d,u)}px`)},[x.maxHeight,He,We]);s(()=>{if(!de.current||"undefined"==typeof ResizeObserver)return;if(A||F)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Wn(()=>Oe(t))});return e.observe(de.current),()=>e.disconnect()},[F,A,Oe]),s(()=>{A||F||Oe()},[F,x.maxHeight,A,Oe]),s(()=>()=>{tr()},[]),u(()=>{var e;const t=we.current[$e];!A&&me.current&&(null==t?void 0:t.svg)&&(dr(me.current,t.svg)&&(xe.current=null!=(e=t.bindFunctions)?e:null,ur(me.current,t.bindFunctions,Re)),Wn(()=>Oe()))},[Re,A,$e,Oe]);const je=d(async(e,t,n)=>{var r;if(!se.current||!me.current)return!1;X(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=gr(e,t),l=await xr(()=>se.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=dr(me.current,l.svg);return!!a&&(xe.current=null!=(r=l.bindFunctions)?r:null,ur(me.current,l.bindFunctions,Re),Oe(),we.current[t]={svg:a,bindFunctions:l.bindFunctions},Y(!0),J(null),!0)}catch(o){if(!De){if("function"==typeof x.onRenderError&&me.current&&!0===x.onRenderError(o,N,me.current))return!1;J(o instanceof Error?o.message:String(o))}return!1}finally{X(!1)}},[Re,T,De,Oe]),ze=d(async(e,t,n)=>{var r;if(se.current&&me.current){X(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=gr(wr(e)||e,t),l=await xr(()=>se.current.render(o,i),{timeoutMs:S,signal:n});if(null==l?void 0:l.svg){const e=dr(me.current,l.svg,{keepPreviousOnFailure:!0});e&&(xe.current=null!=(r=l.bindFunctions)?r:null,ur(me.current,l.bindFunctions,Re)),e&&Oe()}}catch{}finally{X(!1)}}},[Re,S,De,Oe]),Ke=d(async(e,t)=>{if(!e.trim())return sr(me.current),Y(!1),void(ke.current="");const n=e.replace(/\s+/g,"");if(n===ke.current&&Me.current)return;const r=++ye.current;if("gantt"===vr(e)){const i=wr(e);if(!i.trim())return;try{if(await pr(i,$e,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:t}),(null==t?void 0:t.aborted)||ye.current!==r)return;i===e?await je(e,$e,t)&&(ke.current=n):await ze(i,$e,t)}catch(o){if("AbortError"===(null==o?void 0:o.name))return}return}try{if(await pr(e,$e,{workerTimeout:M,parseTimeout:B,mermaid:se.current,signal:t}),(null==t?void 0:t.aborted)||ye.current!==r)return;return void(await je(e,$e,t)&&(ke.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await er(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return wr(e)}(e,$e,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||ye.current!==r)return;await ze(n,$e,t)}catch{}},[B,je,ze,$e,M]),Ve=d(()=>re&&!A&&!F,[F,A,re]);s(()=>{if(!Ve())return;if(!se.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Ve()&&Ke(N,e.signal)},E);return()=>{e.abort(),window.clearTimeout(t)}},[N,Ve,$,Ke,E]);const qe=d((e,t)=>{e.clientX,e.clientY,Ue(e.currentTarget,t,"top",!1,0,x.isDark)},[x.isDark]),Ze=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),W(!0),null==(t=x.onCopy)||t.call(x,N),setTimeout(()=>W(!1),1e3)}catch{}},[N,x]),Ye=d(()=>{var e,t,n;const r=null!=(t=null==(e=me.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=kr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onExport)||n.call(x,i),i.defaultPrevented||function(e,t){const n=null!=t?t:kr(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[x]),Ge=d(()=>{pe.current=null,sr(fe.current)},[]),Je=d(()=>{ee(!1),Ge()},[Ge]),Qe=d(()=>{var e,t,n;const r=null!=(t=null==(e=me.current)?void 0:e.querySelector("svg"))?t:null,o=r?kr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onOpenModal)||n.call(x,i),i.defaultPrevented||ee(!0)},[x]);s(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Je()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Je,Q]),ar(()=>{var e,t;if(!Q)return;const n=fe.current,r=de.current;if(!n||!r)return;const o=`translate(${z.x}px, ${z.y}px) scale(${O})`,i=r.cloneNode(!0);i.classList.add("fullscreen"),i.style.height="100%",i.style.maxHeight="100%";const l=i.querySelector("[data-mermaid-wrapper]");l&&(pe.current=l,l.style.transform=o),sr(n),n.appendChild(i),ur(n,null!=(t=xe.current)?t:null==(e=we.current[$e])?void 0:e.bindFunctions,Re)},[Re,Q,$e]),s(()=>{Q&&pe.current&&(pe.current.style.transform=`translate(${z.x}px, ${z.y}px) scale(${O})`)},[Q,z.x,z.y,O]);const et=A||U||F,tt=o(()=>x.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[x.isDark]),nt=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=x.onToggleMode)||t.call(x,e,n),!n.defaultPrevented)if(be.current=!0,"preview"===e){R(!1);const e=Be.current;j(e.zoom),K({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else Be.current={zoom:O,translateX:z.x,translateY:z.y,containerHeight:te},R(!0)},[N,te,Ke,x,$e,z.x,z.y,Oe,O]),rt=d(e=>{if(!1===x.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=de.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-z.x,o=e.clientY-n.top-z.y,i=.01*-e.deltaY,l=fr(O+i,.5,3);if(l===O)return;const a=l/O;K({x:z.x-r*(a-1),y:z.y-o*(a-1)}),j(l)},[z,O]);ve.current||(ve.current=ge({getTranslate:()=>Se.current,setTranslate:e=>K(e),canStart:e=>{var t;return!!(null==(t=me.current)?void 0:t.querySelector("svg"))&&("touch"!==e.pointerType||Ee.current||Te.current>1)},onActiveChange:e=>q(e)}));const ot=ve.current;s(()=>()=>ot.stop(),[ot]);const it=Q||O>1,lt=/* @__PURE__ */e("div",{className:"relative",children:[x.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
105
+ /* @__PURE__ */t("button",{type:"button",className:ut("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>qe(e,k("common.zoomIn")),onMouseLeave:()=>Xe(),onClick:()=>j(fr(O+.1,.5,3)),children:"+"}),
106
+ /* @__PURE__ */t("button",{type:"button",className:ut("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>qe(e,k("common.zoomOut")),onMouseLeave:()=>Xe(),onClick:()=>j(fr(O-.1,.5,3)),children:"−"}),
107
107
  /* @__PURE__ */e("button",{type:"button",className:ut("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>qe(e,k("common.resetZoom")),onMouseLeave:()=>Xe(),onClick:()=>{j(1),K({x:0,y:0})},children:[Math.round(100*O),"%"]})]})}),
108
108
  /* @__PURE__ */e("div",{ref:de,className:ut("relative overflow-hidden block transition-[height] duration-150 ease-out",x.isDark?"bg-gray-900":"bg-gray-50"),style:{height:te,maxHeight:null!=(w=x.maxHeight)?w:void 0,minHeight:"var(--ms-size-diagram-min-height, 360px)",touchAction:it?"none":void 0},onWheel:rt,onPointerDown:e=>ot.start(e.nativeEvent),children:[
109
109
  /* @__PURE__ */t("div",{ref:ue,"data-mermaid-wrapper":!0,className:ut("absolute inset-0 cursor-grab",{"cursor-grabbing":V}),style:{transform:`translate(${z.x}px, ${z.y}px) scale(${O})`},children:/* @__PURE__ */t("div",{ref:me,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(U||De)&&/* @__PURE__ */e("div",{className:"mermaid-loading",children:[
@@ -132,59 +132,59 @@ return e(n,{children:[
132
132
  /* @__PURE__ */e("div",{className:"mermaid-modal-header",children:[
133
133
  /* @__PURE__ */t("span",{className:"mermaid-modal-title",children:`Mermaid ${k("common.preview")}`}),
134
134
  /* @__PURE__ */t("button",{type:"button",className:"mermaid-modal-close",onClick:Je,children:k("common.close")})]}),
135
- /* @__PURE__ */t("div",{className:"mermaid-modal-body",children:/* @__PURE__ */t("div",{ref:fe,className:"mermaid-modal-content"})})]})}),document.body)]})}function ur(e,t,n){return Math.min(Math.max(e,t),n)}async function mr(e,t,n){try{if(await Yn(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===(null==l?void 0:l.name))throw l}if(!n.mermaid)throw new Error("Mermaid not available");const r=hr(e,t),o=n.mermaid;if("function"==typeof o.parse)return await vr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await vr(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function hr(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function fr(e){var t;for(const n of e.split(/\r?\n/)){const e=n.trim();if(!e||e.startsWith("%%"))continue;const r=e.match(/^([A-Z][\w-]*)\b/i);return(null==(t=null==r?void 0:r[1])?void 0:t.toLowerCase())||""}return""}function pr(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function gr(e){if("gantt"===fr(e))return function(e){var t;const n=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&n.length>0&&n.pop();n.length>0;){const e=null==(t=n[n.length-1])?void 0:t.trim();if(e&&!e.startsWith("%%")){if(pr(e))break;n.pop()}else n.pop()}return n.some(pr)?n.join("\n"):""}(e);const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function vr(e,t={}){const{timeoutMs:n,signal:r}=t;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,o)=>{let i=!1,l=null;function a(){i||(i=!0,c(),o(new DOMException("Aborted","AbortError")))}function c(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,c(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,c(),t(e))}).catch(e=>{i||(i=!0,c(),o(e))})})}function yr(e){return(new XMLSerializer).serializeToString(e)}function wr(t){const{node:n}=t;/* @__PURE__ */
136
- return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==n?void 0:n.type)]})}function xr(e){var t;return"text"===(null==e?void 0:e.type)&&""===String(null!=(t=null==e?void 0:e.content)?t:"").trim()}function kr(e,n,o,i){const l=e.filter(e=>!xr(e)),a=l.length>0&&l.every(e=>"image"===e.type||function(e){var t;const n=function(e){return"link"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.children)?e.children.filter(e=>!xr(e)):[]}(e);return 1===n.length&&"image"===(null==(t=n[0])?void 0:t.type)}(e));if(!a||l.length<=1)return $(e,o,i,n);const c=[];for(let t=0;t<e.length;t++){const n=e[t];if(!xr(n)){c.push(n);continue}const r=c.length>0,o=e.slice(t+1).some(e=>!xr(e));r&&o&&c.push({...n,content:" ",raw:" "})}return c.map((e,l)=>{var c;return a&&xr(e)?/* @__PURE__ */t(r.Fragment,{children:String(null!=(c=null==e?void 0:e.content)?c:"")},`${i}-${l}`):n(e,`${i}-${l}`,o)})}function br(e){var o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=e;if(!s||!d)/* @__PURE__ */
135
+ /* @__PURE__ */t("div",{className:"mermaid-modal-body",children:/* @__PURE__ */t("div",{ref:fe,className:"mermaid-modal-content"})})]})}),document.body)]})}function fr(e,t,n){return Math.min(Math.max(e,t),n)}async function pr(e,t,n){try{if(await Qn(e,t,n.workerTimeout))return!0}catch(l){if("AbortError"===(null==l?void 0:l.name))throw l}if(!n.mermaid)throw new Error("Mermaid not available");const r=gr(e,t),o=n.mermaid;if("function"==typeof o.parse)return await xr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await xr(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function gr(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function vr(e){var t;for(const n of e.split(/\r?\n/)){const e=n.trim();if(!e||e.startsWith("%%"))continue;const r=e.match(/^([A-Z][\w-]*)\b/i);return(null==(t=null==r?void 0:r[1])?void 0:t.toLowerCase())||""}return""}function yr(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function wr(e){if("gantt"===vr(e))return function(e){var t;const n=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&n.length>0&&n.pop();n.length>0;){const e=null==(t=n[n.length-1])?void 0:t.trim();if(e&&!e.startsWith("%%")){if(yr(e))break;n.pop()}else n.pop()}return n.some(yr)?n.join("\n"):""}(e);const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function xr(e,t={}){const{timeoutMs:n,signal:r}=t;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,o)=>{let i=!1,l=null;function a(){i||(i=!0,c(),o(new DOMException("Aborted","AbortError")))}function c(){null!=l&&clearTimeout(l),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(l=setTimeout(()=>{i||(i=!0,c(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,c(),t(e))}).catch(e=>{i||(i=!0,c(),o(e))})})}function kr(e){return(new XMLSerializer).serializeToString(e)}function br(t){const{node:n}=t;/* @__PURE__ */
136
+ return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==n?void 0:n.type)]})}function Cr(e){var t;return"text"===(null==e?void 0:e.type)&&""===String(null!=(t=null==e?void 0:e.content)?t:"").trim()}function Nr(e,n,o,i){const l=e.filter(e=>!Cr(e)),a=l.length>0&&l.every(e=>"image"===e.type||function(e){var t;const n=function(e){return"link"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.children)?e.children.filter(e=>!Cr(e)):[]}(e);return 1===n.length&&"image"===(null==(t=n[0])?void 0:t.type)}(e));if(!a||l.length<=1)return $(e,o,i,n);const c=[];for(let t=0;t<e.length;t++){const n=e[t];if(!Cr(n)){c.push(n);continue}const r=c.length>0,o=e.slice(t+1).some(e=>!Cr(e));r&&o&&c.push({...n,content:" ",raw:" "})}return c.map((e,l)=>{var c;return a&&Cr(e)?/* @__PURE__ */t(r.Fragment,{children:String(null!=(c=null==e?void 0:e.content)?c:"")},`${i}-${l}`):n(e,`${i}-${l}`,o)})}function Mr(e){var o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=e;if(!s||!d)/* @__PURE__ */
137
137
  return t("p",{dir:"auto",className:"paragraph-node",children:m});const h=null!=(o=c.children)?o:[],f={...null!=(i=s.customComponents)?i:V(s.customId),...null!=(l=s.htmlComponents)?l:{},...null!=(a=s.streamingComponents)?a:{}},p=[],g=[],v=()=>{if(!g.length)return;const e=p.length;p.push(
138
- /* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:kr(g.slice(),d,s,`${String(null!=u?u:"paragraph")}-${e}`)},`${String(null!=u?u:"paragraph")}-inline-${e}`)),g.length=0};return h.forEach((e,n)=>{var o;const i="escape"!==(null!=(o=s.htmlPolicy)?o:"safe")||"html_inline"!==e.type&&"html_block"!==e.type;se.has(e.type)||i&&de(e,f,s.customHtmlTags)?(v(),p.push(
139
- /* @__PURE__ */t(r.Fragment,{children:d(e,`${String(null!=u?u:"paragraph")}-block-${n}`,s)},`${String(null!=u?u:"paragraph")}-block-${n}`))):g.push(e)}),v(),p.length?/* @__PURE__ */t(n,{children:p}):/* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:kr(h,d,s,String(null!=u?u:"paragraph"))})}function Cr(e){const{node:n}=e,r=d(t=>{var r;null==(r=e.onClick)||r.call(e,t,n.id,e.messageId,e.threadId)},[n.id,e]);/* @__PURE__ */
140
- return t("span",{className:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabIndex:0,onClick:r,onMouseEnter:t=>{var r;null==(r=e.onMouseEnter)||r.call(e,t,n.id,e.messageId,e.threadId)},onMouseLeave:t=>{var r;null==(r=e.onMouseLeave)||r.call(e,t,n.id,e.messageId,e.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function Nr(e){/* @__PURE__ */
141
- return t("s",{className:"strikethrough-node",children:e.children})}function Mr(e){/* @__PURE__ */
142
- return t("strong",{className:"strong-node",children:e.children})}function Br(e){/* @__PURE__ */
143
- return t("sub",{className:"subscript-node",children:e.children})}function Sr(e){/* @__PURE__ */
144
- return t("sup",{className:"superscript-node",children:e.children})}function Tr(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c}=n,s=Array.isArray(null==(o=null==i?void 0:i.header)?void 0:o.cells)?i.header.cells:[],d=Boolean(null==i?void 0:i.loading),u=Array.isArray(null==i?void 0:i.rows)?i.rows:[],m=r.useRef(null),h=r.useRef(null),f=r.useRef(null),[p,g]=r.useState([]),v=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",y=()=>{const e=f.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),f.current=null),h.current=null};return r.useEffect(()=>(y(),g([]),y),[s.length]),/* @__PURE__ */e("div",{className:"table-node-wrapper","data-index-key":c,children:[
138
+ /* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:Nr(g.slice(),d,s,`${String(null!=u?u:"paragraph")}-${e}`)},`${String(null!=u?u:"paragraph")}-inline-${e}`)),g.length=0};return h.forEach((e,n)=>{var o;const i="escape"!==(null!=(o=s.htmlPolicy)?o:"safe")||"html_inline"!==e.type&&"html_block"!==e.type;se.has(e.type)||i&&de(e,f,s.customHtmlTags)?(v(),p.push(
139
+ /* @__PURE__ */t(r.Fragment,{children:d(e,`${String(null!=u?u:"paragraph")}-block-${n}`,s)},`${String(null!=u?u:"paragraph")}-block-${n}`))):g.push(e)}),v(),p.length?/* @__PURE__ */t(n,{children:p}):/* @__PURE__ */t("p",{dir:"auto",className:"paragraph-node",children:Nr(h,d,s,String(null!=u?u:"paragraph"))})}function Br(e){const{node:n}=e,r=d(t=>{var r;null==(r=e.onClick)||r.call(e,t,n.id,e.messageId,e.threadId)},[n.id,e]);/* @__PURE__ */
140
+ return t("span",{className:"reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]",role:"button",tabIndex:0,onClick:r,onMouseEnter:t=>{var r;null==(r=e.onMouseEnter)||r.call(e,t,n.id,e.messageId,e.threadId)},onMouseLeave:t=>{var r;null==(r=e.onMouseLeave)||r.call(e,t,n.id,e.messageId,e.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function Sr(e){/* @__PURE__ */
141
+ return t("s",{className:"strikethrough-node",children:e.children})}function Tr(e){/* @__PURE__ */
142
+ return t("strong",{className:"strong-node",children:e.children})}function Er(e){/* @__PURE__ */
143
+ return t("sub",{className:"subscript-node",children:e.children})}function Lr(e){/* @__PURE__ */
144
+ return t("sup",{className:"superscript-node",children:e.children})}function Dr(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c}=n,s=Array.isArray(null==(o=null==i?void 0:i.header)?void 0:o.cells)?i.header.cells:[],d=Boolean(null==i?void 0:i.loading),u=Array.isArray(null==i?void 0:i.rows)?i.rows:[],m=r.useRef(null),h=r.useRef(null),f=r.useRef(null),[p,g]=r.useState([]),v=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left",y=()=>{const e=f.current;e&&(window.removeEventListener("pointermove",e.move),window.removeEventListener("pointerup",e.stop),window.removeEventListener("pointercancel",e.stop),f.current=null),h.current=null};return r.useEffect(()=>(y(),g([]),y),[s.length]),/* @__PURE__ */e("div",{className:"table-node-wrapper","data-index-key":c,children:[
145
145
  /* @__PURE__ */e("table",{ref:m,className:ut("my-8 text-sm table-node",d&&"table-node--loading"),"aria-busy":d,children:[p.length>0&&/* @__PURE__ */t("colgroup",{children:s.map((e,n)=>/* @__PURE__ */t("col",{style:p[n]>0?{width:`${p[n]}px`}:void 0},`col-${n}`))}),
146
146
  /* @__PURE__ */t("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */t("tr",{className:"border-b",children:s.map((n,r)=>/* @__PURE__ */e("th",{className:ut("font-semibold p-[calc(4/7*1em)]",v(n.align)),dir:"auto",children:[l&&a?j(n.children,l,`${String(null!=c?c:"table")}-th-${r}`,a):null,r<s.length-1&&/* @__PURE__ */t("button",{type:"button",className:"table-node__resize-handle","aria-label":`Resize columns ${r+1} and ${r+2}`,onPointerDown:e=>((e,t)=>{if(0!==t.button)return;const n=(()=>{var e;const t=null==(e=m.current)?void 0:e.querySelectorAll("thead th");return Array.from(null!=t?t:[],e=>Math.round(e.getBoundingClientRect().width))})(),r=n[e],o=n[e+1];if(!r||!o)return;t.preventDefault(),y(),h.current={index:e,startX:t.clientX,startWidth:r,nextStartWidth:o,widths:n},g(n);const i=e=>{const t=h.current;if(!t)return;e.preventDefault();const n=t.startWidth+t.nextStartWidth,r=Math.min(48,Math.floor(n/2)),o=Math.max(r,Math.min(n-r,Math.round(t.startWidth+e.clientX-t.startX))),i=[...t.widths];i[t.index]=o,i[t.index+1]=n-o,g(i)},l=()=>{y()};f.current={move:i,stop:l},window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)})(r,e)})]},`header-${r}`))})}),
147
147
  /* @__PURE__ */t("tbody",{children:u.map((e,n)=>{var r;/* @__PURE__ */
148
148
  return t("tr",{className:ut("border-[var(--table-border,#cbd5e1)]",n<u.length-1&&"border-b"),children:null==(r=e.cells)?void 0:r.map((e,r)=>/* @__PURE__ */t("td",{className:ut("p-[calc(4/7*1em)]",v(e.align)),dir:"auto",children:l&&a?j(e.children,l,`${String(null!=c?c:"table")}-row-${n}-${r}`,a):null},`cell-${n}-${r}`))},`row-${n}`)})})]}),d&&/* @__PURE__ */e("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
149
149
  /* @__PURE__ */t("span",{className:"table-node__spinner","aria-hidden":"true"}),
150
- /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function Er(){/* @__PURE__ */
151
- return t("hr",{className:"hr-node thematic-break"})}function Lr(e){const{node:n,ctx:i,renderNode:l,indexKey:a}=e,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?q(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
152
- return t("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((e,n)=>/* @__PURE__ */t(r.Fragment,{children:l(e,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function Dr(e,t,n,o,i={}){var l,a,c,s,d;const u=me(o.codeBlockProps),m=o.events.onHandleArtifactClick?e=>{var r,i;const l="image/svg+xml"===e.type?"image/svg+xml":"text/html";null==(i=(r=o.events).onHandleArtifactClick)||i.call(r,{node:null==e.content?t:{...t,code:e.content},artifactType:l,artifactTitle:e.title||("image/svg+xml"===l?"SVG Preview":"HTML Preview"),id:String(n)})}:void 0;return r.createElement(e,{key:n,node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,customId:o.customId,isDark:o.isDark,darkTheme:null==(l=o.codeBlockThemes)?void 0:l.darkTheme,lightTheme:null==(a=o.codeBlockThemes)?void 0:a.lightTheme,themes:null==(c=o.codeBlockThemes)?void 0:c.themes,minWidth:null==(s=o.codeBlockThemes)?void 0:s.minWidth,maxWidth:null==(d=o.codeBlockThemes)?void 0:d.maxWidth,onCopy:o.events.onCopy,onPreviewCode:m,...u,codeBlockOptions:o.codeBlockOptions,...i,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade})}function $r(e,t,n,o,i={}){return r.createElement(e,{key:n,node:t,isDark:o.isDark,...i})}function Pr(e,n,o){var i,l,a,c,s,d,u,m,v,y,w;const x=null!=(i=o.customComponents)?i:V(o.customId),k=null!=(l=o.streamingComponents)?l:{},b=null!=(a=o.htmlComponents)?a:{},C=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const t=f(e.type),n=f(e.tag);return t&&n&&t===n?t:""}(e),N=C?k[C]:null,M=C&&!N?b[C]:null,E="code_block"===e.type?null:x[e.type];if(N)return r.createElement(N,{key:n,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(M)return function(e,t,n,o,i){var l,a,c;const s=h(null!=(l=t.attrs)?l:void 0,null!=(a=o.htmlPolicy)?a:"safe",i),d=p(g(s)),u=Array.isArray(t.children)?$(t.children,o,`${String(n)}-html`,Pr):null!=(c=t.content)?c:null;return r.createElement(e,{...d,key:n},u)}(M,e,n,o,C);if(E)return r.createElement(E,{key:n,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===e.type||"html_inline"===e.type){const i={...x,...k},l=ue(e,i,o.customHtmlTags),a=String(null!=(c=e.tag)?c:"").trim().toLowerCase()||B(e.content),h=null!=(s=null==l?void 0:l.tag)?s:a;if(h){const i=null!=(d=null==l?void 0:l.component)?d:x[h],a=null!=(m=null==l?void 0:l.isWhitelisted)?m:(null!=(u=o.customHtmlTags)?u:[]).some(e=>e.toLowerCase()===h);if(a&&i){const t={...e,type:h,tag:h,content:S(e.content,h)};return r.createElement(i,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(null!=(y=null!=(v=e.content)?v:e.raw)?y:"");if(!a&&T(c,h))return"html_inline"===e.type?/* @__PURE__ */t(an,{node:{type:"text",content:c,raw:c},ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n):/* @__PURE__ */t(br,{node:{type:"paragraph",children:[{type:"text",content:c,raw:c}],raw:c},ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n)}}switch(e.type){case"text":/* @__PURE__ */
153
- return t(an,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"text_special":/* @__PURE__ */
154
- return t(an,{node:{type:"text",content:null!=(w=e.content)?w:"",center:e.center},ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"paragraph":/* @__PURE__ */
155
- return t(br,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"heading":/* @__PURE__ */
156
- return t(Pt,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"blockquote":/* @__PURE__ */
157
- return t(Or,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list":/* @__PURE__ */
158
- return t(dn,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list_item":/* @__PURE__ */
159
- return t(sn,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"table":/* @__PURE__ */
160
- return t(Tr,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"definition_list":/* @__PURE__ */
161
- return t(Bt,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"footnote":/* @__PURE__ */
162
- return t(Lt,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"footnote_reference":/* @__PURE__ */
163
- return t(Dt,{node:e},n);case"footnote_anchor":/* @__PURE__ */
164
- return t(Et,{node:e},n);case"admonition":/* @__PURE__ */
165
- return t(Me,{node:e,ctx:o,renderNode:Pr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade},n);case"hardbreak":/* @__PURE__ */
166
- return t($t,{node:e,typewriter:o.typewriter,fade:o.fade},n);case"link":/* @__PURE__ */
167
- return t(cn,{node:e,ctx:o,renderNode:Pr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade},n);case"image":/* @__PURE__ */
168
- return t(Zt,{node:e},n);case"inline_code":/* @__PURE__ */
169
- return t(nn,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"code_block":return function(e,n,r,o){var i,l,a,c,s,d,u,m;const h=function(e){const t=String((null==e?void 0:e.language)||"").trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e),f=P(h),p=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const r of[n,P(n),ve(n)]){const t=r&&e[r];if(t)return t}return null}(o,h);if("mermaid"===f){const i=function(e,t){var n,r;const o={...t.mermaidProps||{}};return null==ie(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=ae(le(String(null!=(n=null==e?void 0:e.code)?n:"")),void 0,"none"===o.maxHeight?null:null!=(r=ie(o.maxHeight))?r:void 0)),o}(e,r),l=p||o.mermaid;if(l)return $r(l,e,n,r,i);if(!r.renderCodeBlocksAsPre)/* @__PURE__ */
170
- return t(dr,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},n)}if("infographic"===f){const i=function(e,t){var n,r;const o={...t.infographicProps||{}};return null==ee(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=ne(te(String(null!=(n=null==e?void 0:e.code)?n:"")),void 0,"none"===o.maxHeight?null:null!=(r=ee(o.maxHeight))?r:void 0)),o}(e,r),l=p||o.infographic;return l?$r(l,e,n,r,i):/* @__PURE__ */t(en,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},n)}if("d2"===f||"d2lang"===f){const i=p||o.d2;return i?$r(i,e,n,r,r.d2Props||{}):/* @__PURE__ */t(Mt,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...r.d2Props||{}},n)}if(p)return Dr(p,e,n,r);const g=o.code_block;if(g)return Dr(g,e,n,r);if(r.renderCodeBlocksAsPre||"mermaid"===f){const o=null==(i=r.codeBlockProps)?void 0:i.showLineNumbers,c=null==(l=r.codeBlockOptions)?void 0:l.disableLineNumbers,s=null==(a=r.codeBlockOptions)?void 0:a.overflow;/* @__PURE__ */
150
+ /* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function $r(){/* @__PURE__ */
151
+ return t("hr",{className:"hr-node thematic-break"})}function Pr(e){const{node:n,ctx:i,renderNode:l,indexKey:a}=e,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?q(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
152
+ return t("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((e,n)=>/* @__PURE__ */t(r.Fragment,{children:l(e,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function Ar(e,t,n,o,i={}){var l,a,c,s,d;const u=me(o.codeBlockProps),m=o.events.onHandleArtifactClick?e=>{var r,i;const l="image/svg+xml"===e.type?"image/svg+xml":"text/html";null==(i=(r=o.events).onHandleArtifactClick)||i.call(r,{node:null==e.content?t:{...t,code:e.content},artifactType:l,artifactTitle:e.title||("image/svg+xml"===l?"SVG Preview":"HTML Preview"),id:String(n)})}:void 0;return r.createElement(e,{key:n,node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,customId:o.customId,isDark:o.isDark,darkTheme:null==(l=o.codeBlockThemes)?void 0:l.darkTheme,lightTheme:null==(a=o.codeBlockThemes)?void 0:a.lightTheme,themes:null==(c=o.codeBlockThemes)?void 0:c.themes,minWidth:null==(s=o.codeBlockThemes)?void 0:s.minWidth,maxWidth:null==(d=o.codeBlockThemes)?void 0:d.maxWidth,onCopy:o.events.onCopy,onPreviewCode:m,...u,codeBlockOptions:o.codeBlockOptions,...i,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade})}function Rr(e,t,n,o,i={}){return r.createElement(e,{key:n,node:t,isDark:o.isDark,...i})}function Fr(e,n,o){var i,l,a,c,s,d,u,m,v,y,w;const x=null!=(i=o.customComponents)?i:V(o.customId),k=null!=(l=o.streamingComponents)?l:{},b=null!=(a=o.htmlComponents)?a:{},C=function(e){if("html_block"===e.type||"html_inline"===e.type)return"";const t=f(e.type),n=f(e.tag);return t&&n&&t===n?t:""}(e),N=C?k[C]:null,M=C&&!N?b[C]:null,E="code_block"===e.type?null:x[e.type];if(N)return r.createElement(N,{key:n,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade});if(M)return function(e,t,n,o,i){var l,a,c;const s=h(null!=(l=t.attrs)?l:void 0,null!=(a=o.htmlPolicy)?a:"safe",i),d=p(g(s)),u=Array.isArray(t.children)?$(t.children,o,`${String(n)}-html`,Fr):null!=(c=t.content)?c:null;return r.createElement(e,{...d,key:n},u)}(M,e,n,o,C);if(E)return r.createElement(E,{key:n,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade});if("html_block"===e.type||"html_inline"===e.type){const i={...x,...k},l=ue(e,i,o.customHtmlTags),a=String(null!=(c=e.tag)?c:"").trim().toLowerCase()||B(e.content),h=null!=(s=null==l?void 0:l.tag)?s:a;if(h){const i=null!=(d=null==l?void 0:l.component)?d:x[h],a=null!=(m=null==l?void 0:l.isWhitelisted)?m:(null!=(u=o.customHtmlTags)?u:[]).some(e=>e.toLowerCase()===h);if(a&&i){const t={...e,type:h,tag:h,content:S(e.content,h)};return r.createElement(i,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade})}const c=String(null!=(y=null!=(v=e.content)?v:e.raw)?y:"");if(!a&&T(c,h))return"html_inline"===e.type?/* @__PURE__ */t(dn,{node:{type:"text",content:c,raw:c},ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n):/* @__PURE__ */t(Mr,{node:{type:"paragraph",children:[{type:"text",content:c,raw:c}],raw:c},ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n)}}switch(e.type){case"text":/* @__PURE__ */
153
+ return t(dn,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"text_special":/* @__PURE__ */
154
+ return t(dn,{node:{type:"text",content:null!=(w=e.content)?w:"",center:e.center},ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"paragraph":/* @__PURE__ */
155
+ return t(Mr,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"heading":/* @__PURE__ */
156
+ return t(Ft,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"blockquote":/* @__PURE__ */
157
+ return t(Kr,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list":/* @__PURE__ */
158
+ return t(hn,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list_item":/* @__PURE__ */
159
+ return t(mn,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"table":/* @__PURE__ */
160
+ return t(Dr,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"definition_list":/* @__PURE__ */
161
+ return t(St,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"footnote":/* @__PURE__ */
162
+ return t(Pt,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"footnote_reference":/* @__PURE__ */
163
+ return t(At,{node:e},n);case"footnote_anchor":/* @__PURE__ */
164
+ return t($t,{node:e},n);case"admonition":/* @__PURE__ */
165
+ return t(Me,{node:e,ctx:o,renderNode:Fr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter,fade:o.fade},n);case"hardbreak":/* @__PURE__ */
166
+ return t(Rt,{node:e,typewriter:o.typewriter,fade:o.fade},n);case"link":/* @__PURE__ */
167
+ return t(un,{node:e,ctx:o,renderNode:Fr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter,fade:o.fade},n);case"image":/* @__PURE__ */
168
+ return t(Jt,{node:e},n);case"inline_code":/* @__PURE__ */
169
+ return t(ln,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"code_block":return function(e,n,r,o){var i,l,a,c,s,d,u,m;const h=function(e){const t=String((null==e?void 0:e.language)||"").trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e),f=P(h),p=function(e,t){const n=t.trim().toLowerCase();if(!n)return null;for(const r of[n,P(n),ve(n)]){const t=r&&e[r];if(t)return t}return null}(o,h);if("mermaid"===f){const i=function(e,t){var n,r;const o={...t.mermaidProps||{}};return null==ie(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=ae(le(String(null!=(n=null==e?void 0:e.code)?n:"")),void 0,"none"===o.maxHeight?null:null!=(r=ie(o.maxHeight))?r:void 0)),o}(e,r),l=p||o.mermaid;if(l)return Rr(l,e,n,r,i);if(!r.renderCodeBlocksAsPre)/* @__PURE__ */
170
+ return t(hr,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},n)}if("infographic"===f){const i=function(e,t){var n,r;const o={...t.infographicProps||{}};return null==ee(o.estimatedPreviewHeightPx)&&(o.estimatedPreviewHeightPx=ne(te(String(null!=(n=null==e?void 0:e.code)?n:"")),void 0,"none"===o.maxHeight?null:null!=(r=ee(o.maxHeight))?r:void 0)),o}(e,r),l=p||o.infographic;return l?Rr(l,e,n,r,i):/* @__PURE__ */t(rn,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...i},n)}if("d2"===f||"d2lang"===f){const i=p||o.d2;return i?Rr(i,e,n,r,r.d2Props||{}):/* @__PURE__ */t(Bt,{node:e,isDark:r.isDark,loading:Boolean(e.loading),...r.d2Props||{}},n)}if(p)return Ar(p,e,n,r);const g=o.code_block;if(g)return Ar(g,e,n,r);if(r.renderCodeBlocksAsPre||"mermaid"===f){const o=null==(i=r.codeBlockProps)?void 0:i.showLineNumbers,c=null==(l=r.codeBlockOptions)?void 0:l.disableLineNumbers,s=null==(a=r.codeBlockOptions)?void 0:a.overflow;/* @__PURE__ */
171
171
  return t(O,{node:e,style:s?{whiteSpace:"scroll"===s?"pre":"pre-wrap"}:void 0,showLineNumbers:"boolean"==typeof o?o:"boolean"==typeof c&&!c},n)}/* @__PURE__ */
172
172
  return t(st,{node:e,loading:Boolean(e.loading),stream:r.codeBlockStream,themes:null==(c=r.codeBlockThemes)?void 0:c.themes,darkTheme:null==(s=r.codeBlockThemes)?void 0:s.darkTheme,lightTheme:null==(d=r.codeBlockThemes)?void 0:d.lightTheme,minWidth:null==(u=r.codeBlockThemes)?void 0:u.minWidth,maxWidth:null==(m=r.codeBlockThemes)?void 0:m.maxWidth,isDark:r.isDark,onCopy:r.events.onCopy,...me(r.codeBlockProps),codeBlockOptions:r.codeBlockOptions},n)}(e,n,o,x);case"strong":/* @__PURE__ */
173
- return t(Mr,{node:e,children:$(e.children,o,`${String(n)}-strong`,Pr)},n);case"emphasis":/* @__PURE__ */
174
- return t(Tt,{node:e,children:$(e.children,o,`${String(n)}-em`,Pr)},n);case"strikethrough":/* @__PURE__ */
175
- return t(Nr,{node:e,children:$(e.children,o,`${String(n)}-strike`,Pr)},n);case"highlight":/* @__PURE__ */
176
- return t(At,{node:e,children:$(e.children,o,`${String(n)}-highlight`,Pr)},n);case"insert":/* @__PURE__ */
177
- return t(rn,{node:e,children:$(e.children,o,`${String(n)}-insert`,Pr)},n);case"subscript":/* @__PURE__ */
178
- return t(Br,{node:e,children:$(e.children,o,`${String(n)}-sub`,Pr)},n);case"superscript":/* @__PURE__ */
179
- return t(Sr,{node:e,children:$(e.children,o,`${String(n)}-sup`,Pr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
173
+ return t(Tr,{node:e,children:$(e.children,o,`${String(n)}-strong`,Fr)},n);case"emphasis":/* @__PURE__ */
174
+ return t(Et,{node:e,children:$(e.children,o,`${String(n)}-em`,Fr)},n);case"strikethrough":/* @__PURE__ */
175
+ return t(Sr,{node:e,children:$(e.children,o,`${String(n)}-strike`,Fr)},n);case"highlight":/* @__PURE__ */
176
+ return t(It,{node:e,children:$(e.children,o,`${String(n)}-highlight`,Fr)},n);case"insert":/* @__PURE__ */
177
+ return t(an,{node:e,children:$(e.children,o,`${String(n)}-insert`,Fr)},n);case"subscript":/* @__PURE__ */
178
+ return t(Er,{node:e,children:$(e.children,o,`${String(n)}-sub`,Fr)},n);case"superscript":/* @__PURE__ */
179
+ return t(Lr,{node:e,children:$(e.children,o,`${String(n)}-sup`,Fr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
180
180
  return t(Re,{node:e,typewriter:o.typewriter,fade:o.fade},n);case"emoji":/* @__PURE__ */
181
- return t(St,{node:e,typewriter:o.typewriter,fade:o.fade},n);case"thematic_break":/* @__PURE__ */
182
- return t(Er,{},n);case"math_inline":/* @__PURE__ */
183
- return t(Fn,{node:e},n);case"math_block":/* @__PURE__ */
184
- return t(Rn,{node:e},n);case"reference":/* @__PURE__ */
185
- return t(Cr,{node:e,ctx:o,typewriter:o.typewriter,fade:o.fade},n);case"html_block":case"html_inline":return"html_block"===e.type?/* @__PURE__ */t(Rt,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n):/* @__PURE__ */t(qt,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
186
- return t(Lr,{node:e,ctx:o,renderNode:Pr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
187
- return t(wr,{node:e},n)}}const Ar={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},Rr=L();function Fr(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,r=t;return n.startLine===r.startLine&&n.endLine===r.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function Ir(e){const t=o(()=>fe(e),[e]),n=c(t);return function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}const _r=r.memo(({node:e,nodeKey:t,renderCtx:n})=>Pr(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Hr=r.memo(({props:n,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u,showTypewriterCursor:m,typewriterCursorRef:h})=>{var f,p,g,v,y,w,x;const k=Pe(),b="undefined"!=typeof window,C="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,N=Math.max(0,Math.trunc(null!=(f=n.renderBatchSize)?f:80)),M=Math.max(0,Math.trunc(null!=(p=n.initialRenderBatchSize)?p:N||r.length)),B=!1!==n.batchRendering&&N>0&&b,S=Math.max(0,null!=(g=n.liveNodeBuffer)?g:60),T=Math.max(1,null!=(v=n.maxLiveNodes)?v:320),E=(null!=(y=n.maxLiveNodes)?y:0)>0&&r.length>T,L=!1!==n.viewportPriority,D=B&&(null!=(w=n.maxLiveNodes)?w:0)<=0,$=o(()=>{var e;return!1!==n.deferNodesUntilVisible&&!((null!=(e=n.maxLiveNodes)?e:0)<=0)&&!E&&!(r.length>900)&&L},[r.length,n.deferNodesUntilVisible,n.maxLiveNodes,L,E]),[P,A]=i(()=>D?Math.min(r.length,M):r.length),R=c(P);s(()=>{R.current=P},[P]);const F=D?P:r.length,[I,_]=i(0),[H,W]=i({start:0,end:r.length}),O=c(/* @__PURE__ */new Map),[j,z]=i(0),K=c({}),V=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),Z=c(/* @__PURE__ */new Set),Y=c(P),G=c(null),J=c(null),Q=c(null),ee=c(!1),te=c(null),ne=c(Math.max(1,N||1)),re=c(r.length),oe=c({key:n.indexKey,total:r.length}),ie=c(r),le=c({batchSize:N,initial:M,delay:null!=(x=n.renderBatchDelay)?x:16,enabled:D}),ae=$||E,ce=o(()=>{const e=O.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[j]),se=o(()=>{if(!E)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(H.start,e)),n=Math.max(t,Math.min(H.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,H,E]),de=o(()=>{if(!E)return r.length;const e=Math.max(H.end+S,M),t=Math.min(r.length,e);return Math.max(P,t)},[r.length,E,H.end,S,M,P]);re.current=de;const ue=d((e,t)=>{var n;if(e>=t)return 0;const r=O.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:ce;return o},[ce]),me=E?ue(0,Math.min(H.start,r.length)):0,he=E?ue(Math.min(H.end,r.length),r.length):0,fe=d(()=>{null!=G.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(G.current),G.current=null),null!=J.current&&(window.clearTimeout(J.current),J.current=null),null!=Q.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Q.current),Q.current=null),ee.current=!1,te.current=null},[]),pe=d(e=>{var t;if(!D)return;const r=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),o=Math.max(1,N||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?ne.current=Math.max(i,Math.floor(.7*ne.current)):e<.5*r&&ne.current<o&&(ne.current=Math.min(o,Math.ceil(1.2*ne.current)))},[D,n.renderBatchBudgetMs,N]),ge=d((e,t={})=>{var r,o;if(!D)return;const i=re.current;if(R.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();A(t=>{const n=Math.min(re.current,t+Math.max(1,e));return R.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();pe(n-t)},c=()=>{const e=Math.max(1,Math.round(ne.current));ge(e)},s=e=>{var t;G.current=null,J.current=null,Q.current=null,ee.current=!1;const r=te.current;if(te.current=null,a(null!=r?r:l),R.current>=re.current)return;if(!e)return void c();const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6);for(;R.current<re.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(ne.current)));R.current<re.current&&c()};if(!b||t.immediate)return void s();const d=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(te.current=null!=te.current?Math.max(te.current,l):l,!ee.current){if(ee.current=!0,C){const e=Math.max(0,null!=(o=n.renderBatchIdleTimeoutMs)?o:120);return void(Q.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?G.current=requestAnimationFrame(()=>{0!==d?J.current=window.setTimeout(()=>s(),d):s()}):J.current=window.setTimeout(()=>s(),d)}},[pe,C,D,b,n.renderBatchDelay,n.renderBatchBudgetMs,n.renderBatchIdleTimeoutMs]);s(()=>{var e;const t=n.indexKey,o=r.length,i=oe.current,l=void 0!==t?t!==i.key:o!==i.total,a=ie.current,c=Math.min(a.length,r.length);let s=0;for(;s<c&&a[s]===r[s];)s+=1;oe.current={key:t,total:o};const d=le.current,u=null!=(e=n.renderBatchDelay)?e:16,m=d.batchSize!==N||d.initial!==M||d.delay!==u||d.enabled!==D;if(le.current={batchSize:N,initial:M,delay:u,enabled:D},(l||m||!D)&&fe(),(l||m)&&(ne.current=Math.max(1,N||1)),t!==i.key)Z.current.clear();else if(l)for(const n of Z.current)n>=s&&Z.current.delete(n);if(!o)return R.current=0,void A(0);const h=re.current;if(!D)return R.current=h,void A(h);if(l||m){const e=Math.min(h,M);return R.current=e,A(e),void(e<h&&ge(Math.max(1,M),{immediate:!b}))}const f=Math.min(R.current,h);f!==R.current&&(R.current=f,A(f)),R.current<h&&ge(Math.max(1,N||1))},[fe,D,b,r.length,n.indexKey,n.renderBatchDelay,N,M,ge]),s(()=>{ie.current=r},[r]),s(()=>{if(!E)return void W({start:0,end:r.length});const e=r.length;if(!e)return void W({start:0,end:0});const t=Math.max(0,Math.min(I,e-1));let n=Math.max(0,t-S),o=Math.min(e,t+S+1);const i=o-n;if(i>T){const e=i-T;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<T){const t=T-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}W({start:n,end:o})},[I,S,T,r.length,E]),s(()=>()=>{fe();for(const e of V.current.values())e.destroy();V.current.clear()},[fe]);const ve=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete K.current[t],q.current.delete(t),U.current.delete(t),X.current.delete(t))},[]);s(()=>{ve(F)},[ve,F]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(O.current.keys()))n>=e&&(O.current.delete(n),t=!0);t&&z(e=>e+1);for(const n of Object.keys(K.current))Number(n)>=e&&delete K.current[n];for(const n of Array.from(Z.current))n>=e&&Z.current.delete(n)},[r.length]);const ye=d((e,t)=>{$&&t&&(K.current[e]=!0),t&&E&&_(t=>e>t?e:t)},[$,E]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),xe=d((e,t)=>{const n=q.current;if(t?n.set(e,t):n.delete(e),!ae||!t)return we(e),$&&!t&&delete K.current[e],void(t&&ye(e,!0));if(e<M&&!E)return we(e),void ye(e,!0);we(e);const r=k(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ye(e,!0),r.whenVisible.then(()=>ye(e,!0)).catch(()=>{})},[$,we,ye,k,M,ae,E]),ke=d(e=>{const t=U.current.get(e);if(t)return t;const n=t=>xe(e,t);return U.current.set(e,n),n},[xe]),be=d((e,t)=>{if(!t)return void(O.current.has(e)&&(O.current.delete(e),z(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&O.current.get(e)!==n&&(O.current.set(e,n),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),Ce=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>be(e,t);return X.current.set(e,n),n},[be]),Ne=d(e=>!(D&&e>=R.current)&&(!$||e<M||!0===K.current[e]),[$,D,M]),Me=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of q.current.entries())t&&xe(e,t)},[xe]),s(()=>{E&&P>Y.current&&_(P-1),Y.current=P},[P,E]);const Be=E?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${me}px`},"aria-hidden":"true"}):null,Se=E?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${he}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
188
- return e("div",{ref:u,className:`markstream-react markdown-renderer${n.isDark?" dark":""}${E?" virtualized":""}`,"data-custom-id":n.customId,onClick:n.onClick,onMouseOver:Me(n.onMouseOver),onMouseOut:Me(n.onMouseOut),children:[Be,se.map(({node:e,index:r})=>{var o;const i=Ne(r),c=null!=(o=O.current.get(r))?o:ce,s=!1!==n.fade&&"code_block"!==e.type&&!Z.current.has(r)&&i;return s&&Z.current.add(r),/* @__PURE__ */t("div",{ref:ke(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */t("div",i?{ref:Ce(r),className:"node-content"+(s?" fade-node typewriter-node":""),children:/* @__PURE__ */t(_r,{node:e,nodeKey:`${a}-${r}`,renderCtx:l})}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Se,m&&/* @__PURE__ */t("span",{ref:h,className:"typewriter-cursor","aria-hidden":"true"})]})},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,r=t.parsedNodes;if(n===r)return!0;if(n.length!==r.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==r[l])return!1;const o=e.props,i=t.props;return o.isDark===i.isDark&&o.typewriter===i.typewriter&&o.fade===i.fade&&o.batchRendering===i.batchRendering&&o.initialRenderBatchSize===i.initialRenderBatchSize&&o.renderBatchSize===i.renderBatchSize&&o.renderBatchDelay===i.renderBatchDelay&&o.renderBatchBudgetMs===i.renderBatchBudgetMs&&o.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&o.deferNodesUntilVisible===i.deferNodesUntilVisible&&o.maxLiveNodes===i.maxLiveNodes&&o.liveNodeBuffer===i.liveNodeBuffer&&o.viewportPriority===i.viewportPriority&&o.indexKey===i.indexKey&&o.onClick===i.onClick&&o.onMouseOver===i.onMouseOver&&o.onMouseOut===i.onMouseOut});function Wr(e){var n,l;const a={...Ar,...e},u=c(null),h=c(/* @__PURE__ */new Map),f=c(0),p=c(null),g=Ae(a.smoothStreamingOptions),v=r.useContext(Be),y=c(/* @__PURE__ */new Set),[w,x]=i(()=>!0===a.smoothStreaming);s(()=>{x(!0)},[]);const k=Array.isArray(a.nodes)&&a.nodes.length>0,b=o(()=>{var e;return!1!==a.smoothStreaming&&!k&&(!0===a.smoothStreaming||!v)&&(!0===a.smoothStreaming||!0===a.typewriter||(null!=(e=a.maxLiveNodes)?e:0)<=0)},[k,v,a.maxLiveNodes,a.smoothStreaming,a.typewriter]),C=w&&b,N=C?g.visible:null!=(n=a.content)?n:"",M=o(()=>{var e,t;const n=null!=(e=a.parseOptions)?e:{};return null!=(t=a.final)?t:n.final},[a.final,a.parseOptions]),B=null!=(l=a.content)?l:"",S=k||g.source===B,T=o(()=>C&&null!=M?Boolean(M&&S&&g.caughtUp):M,[M,S,g.caughtUp,C]),$=c(null),[A,R]=i(!1),F=c(void 0),I=c(0),_=o(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[]),H=d(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&_.has(t)},[_]),W=d(e=>{var t,n;if(!e||"object"!=typeof e)return 0;const r=e,o=null!=(n=null!=(t=r.raw)?t:r.content)?n:r.code;if("string"==typeof o)return o.length;const i=r.children;if(Array.isArray(i))return i.reduce((e,t)=>e+W(t),0);const l=r.items;return Array.isArray(l)?l.reduce((e,t)=>e+W(t),0):0},[]),O=d(()=>{var e,t;return(null==(e=a.nodes)?void 0:e.length)?a.nodes.reduce((e,t)=>e+W(t),0):(null!=(t=a.content)?t:"").length},[a.nodes,a.content,W]),j=d(()=>{F.current&&(clearTimeout(F.current),F.current=void 0)},[]),q=d(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){var t;if(!(null!=(t=e.textContent)?t:"").trim())return NodeFilter.FILTER_REJECT;const n=e.parentElement;return n?n.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n},[]),U=d(()=>{var e,t;if("undefined"==typeof window||!A||!u.current||!$.current)return;const n=u.current,r=$.current,o=q(n),i=n.getBoundingClientRect();let l=0,a=0,c=20;if(null==o?void 0:o.textContent){const r=document.createRange(),s=o.textContent.length;r.setStart(o,Math.max(0,s-1)),r.setEnd(o,s);const d="function"==typeof r.getClientRects?r.getClientRects():void 0,u=null!=(t=null==d?void 0:d[d.length-1])?t:null==(e=o.parentElement)?void 0:e.getBoundingClientRect();u&&(l=u.right-i.left+n.scrollLeft,a=u.top-i.top+n.scrollTop,c=u.height||c),r.detach()}r.style.transform=`translate(${Math.max(0,l)}px, ${Math.max(0,a)}px)`,r.style.height=`${c}px`},[A,u,q]);s(()=>{A&&requestAnimationFrame(()=>{U()})},[A,U]),s(()=>()=>{j()},[j]);const X=k?a.nodes:N;p.current!==X&&(f.current+=1,p.current=X);const Z=m(z,K,K),Y=o(()=>V(a.customId),[a.customId,Z]),G=Ir(a.streamingComponents),J=Ir(a.htmlComponents);s(()=>{he(G,J,y.current)},[J,G]);const Q=o(()=>a.customId?`renderer-${a.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[a.customId]),ee=o(()=>{var e,t;const n=null!=(t=(null!=(e=a.parseOptions)?e:{}).customHtmlTags)?t:[];return E(a.customHtmlTags,Array.isArray(n)?n:[],Object.keys(G))},[a.customId,a.customHtmlTags,a.parseOptions,Z,G]),te=o(()=>{const e=ee;return e&&0!==e.length?L(Q,{customHtmlTags:e}):L(Q)},[Q,ee]),ne=o(()=>{const e=te;return a.customMarkdownIt?a.customMarkdownIt(e):e},[te,a.customMarkdownIt]),re=o(()=>{var e;const t=null!=(e=a.parseOptions)?e:{},n=T,r=null!=n,o=ee.length>0;return r||o?{...t,...r?{final:n}:{},...o?{customHtmlTags:ee}:{}}:t},[ee,T,a.parseOptions]),oe=o(()=>{const e=Boolean(a.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let n=[];return k?n=a.nodes.map(e=>({...e})):N&&(n=D(N,null!=ne?ne:Rr,re)),e&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:n.length,contentLength:N.length}),n},[a.debugPerformance,N,k,a.nodes,re,ne,a.customId,Z,ee]),ie=d(()=>{const e=oe[oe.length-1];return!H(e)},[oe,H]);s(()=>{if("undefined"==typeof window||k)return;if(T)return R(!1),void j();const e=O(),t=ie();return!1===a.typewriter||!t||e<=I.current?(!1!==a.typewriter&&t||R(!1),void(I.current=e)):(I.current=e,R(!0),j(),requestAnimationFrame(()=>{U()}),F.current=setTimeout(()=>{R(!1)},3e3),()=>{j()})},[N,a.nodes,a.typewriter,a.content,T,oe.length,k,O,ie,j,U]);const le=c([]),ae=null==re?void 0:re.postTransformNodes,ce=c(ae);ce.current!==ae&&(le.current=[],ce.current=ae);const se=function(e,t){if(!t.length)return e;const n=new Array(e.length);let r=e.length===t.length;for(let o=0;o<e.length;o++){const i=o<t.length?t[o]:null;i&&Fr(i,e[o])?n[o]=i:(n[o]=e[o],r=!1)}return r?t:n}(oe,le.current);le.current=se,s(()=>{var e;if(k)return void g.reset("");const t=null!=(e=a.content)?e:"";if(!C)return g.reset(t),void(M&&g.finish({flush:!0}));const n=g.getSnapshot().source;t?t===n||(t.startsWith(n)?g.enqueue(t.slice(n.length)):g.reset(t)):g.reset(""),M&&g.finish()},[k,a.content,M,C]),s(()=>{var e,t;if("undefined"==typeof window)return;if(a.renderCodeBlocksAsPre)return;if(!se.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==P(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const n=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},r=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),o=n(()=>{nt()},{timeout:900});return()=>r(o)},[se,a.renderCodeBlocksAsPre]);const de=o(()=>null!=a.indexKey?String(a.indexKey):"markdown-renderer",[a.indexKey]),ue=o(()=>({..."boolean"==typeof a.showTooltips?{showTooltips:a.showTooltips}:{},...a.codeBlockProps||{}}),[a.codeBlockProps,a.showTooltips]),me=o(()=>({...a.mermaidProps||{}}),[a.mermaidProps]),fe=o(()=>({...a.d2Props||{}}),[a.d2Props]),pe=o(()=>({...a.infographicProps||{}}),[a.infographicProps]),ge=o(()=>{var e;return{customId:a.customId,isDark:a.isDark,final:T,indexKey:de,typewriter:a.typewriter,fade:a.fade,textStreamState:h.current,streamRenderVersion:f.current,customComponents:Y,streamingComponents:G,htmlComponents:J,customHtmlTags:ee,htmlPolicy:null!=(e=a.htmlPolicy)?e:"safe",showTooltips:a.showTooltips,renderCodeBlocksAsPre:a.renderCodeBlocksAsPre,codeBlockStream:a.codeBlockStream,codeBlockOptions:a.codeBlockOptions,codeBlockProps:ue,mermaidProps:me,d2Props:fe,infographicProps:pe,codeBlockThemes:{themes:a.themes,darkTheme:a.codeBlockDarkTheme,lightTheme:a.codeBlockLightTheme,minWidth:a.codeBlockMinWidth,maxWidth:a.codeBlockMaxWidth},events:{onCopy:a.onCopy,onHandleArtifactClick:a.onHandleArtifactClick}}},[a.customId,a.isDark,T,de,a.typewriter,a.fade,a.showTooltips,a.htmlPolicy,a.renderCodeBlocksAsPre,a.codeBlockStream,a.codeBlockOptions,ee,ue,me,fe,pe,a.themes,a.codeBlockDarkTheme,a.codeBlockLightTheme,a.codeBlockMinWidth,a.codeBlockMaxWidth,a.onCopy,a.onHandleArtifactClick,Y,G,J]);ge.streamRenderVersion=f.current,ge.textStreamState=h.current;const ve=c(null);return ve.current||(ve.current={textStreamState:h.current,getStreamRenderVersion:()=>f.current}),/* @__PURE__ */t(Se.Provider,{value:ve.current,children:/* @__PURE__ */t(Be.Provider,{value:C,children:/* @__PURE__ */t($e,{getRoot:()=>u.current,enabled:!1!==a.viewportPriority,children:/* @__PURE__ */t(Hr,{props:a,parsedNodes:se,renderCtx:ge,indexPrefix:de,containerRef:u,showTypewriterCursor:A,typewriterCursorRef:$})})})})}function Or(e){var n,r,o,i,l;const{node:a,ctx:c,renderNode:s,indexKey:d,children:u}=e;/* @__PURE__ */
189
- return t("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:c&&s?/* @__PURE__ */t(Wr,{nodes:a.children||[],indexKey:`blockquote-${String(null!=d?d:"blockquote")}`,customId:c.customId,isDark:c.isDark,typewriter:c.typewriter,viewportPriority:!0,codeBlockStream:c.codeBlockStream,renderCodeBlocksAsPre:c.renderCodeBlocksAsPre,codeBlockOptions:c.codeBlockOptions,codeBlockProps:c.codeBlockProps,themes:null==(n=c.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=c.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=c.codeBlockThemes)?void 0:o.lightTheme,codeBlockMinWidth:null==(i=c.codeBlockThemes)?void 0:i.minWidth,codeBlockMaxWidth:null==(l=c.codeBlockThemes)?void 0:l.maxWidth,htmlPolicy:c.htmlPolicy,showTooltips:c.showTooltips,onCopy:c.events.onCopy,onHandleArtifactClick:c.events.onHandleArtifactClick}):null})}function jr(e){var n;const r=c(null),[l,a]=i(!1),[d,u]=i({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),m=o(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(e.isDark),[e.isDark]);return s(()=>{if(!e.visible)return void a(!1);if(!e.anchorEl||!r.current)return void a(!0);let t=null,n=!1;const o=async()=>{var t,o;if(!e.anchorEl||!r.current)return;const{x:i,y:l}=await we(e.anchorEl,r.current,{placement:null!=(t=e.placement)?t:"top",middleware:[xe(null!=(o=e.offset)?o:8),ke(),be({padding:8})],strategy:"fixed"});n||u({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(l)}px, 0)`})};return o().then(()=>{n||a(!0)}),t=ye(e.anchorEl,r.current,o),()=>{n=!0,null==t||t()}},[e.anchorEl,e.offset,e.placement,e.visible,l]),"undefined"==typeof document?null:e.visible&&l?Ce(
190
- /* @__PURE__ */t("div",{id:null!=(n=e.id)?n:void 0,ref:r,style:d,className:["markstream-react ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{Cn as $,Me as A,Or as B,Re as C,Mt as D,St as E,wr as F,Mn as G,$t as H,Zt as I,xn as J,Xn as K,cn as L,qn as M,Wr as N,vt as O,br as P,gt as Q,Cr as R,Nr as S,Tr as T,Gn as U,Lr as V,bn as W,wt as X,Ln as Y,Vn as Z,yt as _,st as a,Dn as a0,Pr as a1,pt as a2,Ie as a3,En as a4,Nn as a5,Bn as a6,wn as a7,kn as a8,Un as a9,zn as aa,Kn as ab,Jn as ac,_e as ad,Ae as ae,Sn as af,Bt as b,Tt as c,Et as d,Lt as e,Dt as f,Pt as g,At as h,Rt as i,qt as j,Ge as k,en as l,nn as m,rn as n,sn as o,dn as p,Rn as q,Fn as r,dr as s,Mr as t,Br as u,Sr as v,an as w,Er as x,jr as y,Yn as z};
181
+ return t(Tt,{node:e,typewriter:o.typewriter,fade:o.fade},n);case"thematic_break":/* @__PURE__ */
182
+ return t($r,{},n);case"math_inline":/* @__PURE__ */
183
+ return t(Hn,{node:e},n);case"math_block":/* @__PURE__ */
184
+ return t(_n,{node:e},n);case"reference":/* @__PURE__ */
185
+ return t(Br,{node:e,ctx:o,typewriter:o.typewriter,fade:o.fade},n);case"html_block":case"html_inline":return"html_block"===e.type?/* @__PURE__ */t(_t,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n):/* @__PURE__ */t(Zt,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
186
+ return t(Pr,{node:e,ctx:o,renderNode:Fr,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
187
+ return t(br,{node:e},n)}}const Ir={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},_r=L();function Hr(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,r=t;return n.startLine===r.startLine&&n.endLine===r.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function Wr(e){const t=o(()=>fe(e),[e]),n=c(t);return function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}const Or=r.memo(({node:e,nodeKey:t,renderCtx:n})=>Fr(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),jr=r.memo(({props:n,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u,showTypewriterCursor:m,typewriterCursorRef:h})=>{var f,p,g,v,y,w,x;const k=Pe(),b="undefined"!=typeof window,C="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,N=Math.max(0,Math.trunc(null!=(f=n.renderBatchSize)?f:80)),M=Math.max(0,Math.trunc(null!=(p=n.initialRenderBatchSize)?p:N||r.length)),B=!1!==n.batchRendering&&N>0&&b,S=Math.max(0,null!=(g=n.liveNodeBuffer)?g:60),T=Math.max(1,null!=(v=n.maxLiveNodes)?v:320),E=(null!=(y=n.maxLiveNodes)?y:0)>0&&r.length>T,L=!1!==n.viewportPriority,D=B&&(null!=(w=n.maxLiveNodes)?w:0)<=0,$=o(()=>{var e;return!1!==n.deferNodesUntilVisible&&!((null!=(e=n.maxLiveNodes)?e:0)<=0)&&!E&&!(r.length>900)&&L},[r.length,n.deferNodesUntilVisible,n.maxLiveNodes,L,E]),[P,A]=i(()=>D?Math.min(r.length,M):r.length),R=c(P);s(()=>{R.current=P},[P]);const F=D?P:r.length,[I,_]=i(0),[H,W]=i({start:0,end:r.length}),O=c(/* @__PURE__ */new Map),[j,z]=i(0),K=c({}),V=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),Z=c(/* @__PURE__ */new Set),Y=c(P),G=c(null),J=c(null),Q=c(null),ee=c(!1),te=c(null),ne=c(Math.max(1,N||1)),re=c(r.length),oe=c({key:n.indexKey,total:r.length}),ie=c(r),le=c({batchSize:N,initial:M,delay:null!=(x=n.renderBatchDelay)?x:16,enabled:D}),ae=$||E,ce=o(()=>{const e=O.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[j]),se=o(()=>{if(!E)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(H.start,e)),n=Math.max(t,Math.min(H.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,H,E]),de=o(()=>{if(!E)return r.length;const e=Math.max(H.end+S,M),t=Math.min(r.length,e);return Math.max(P,t)},[r.length,E,H.end,S,M,P]);re.current=de;const ue=d((e,t)=>{var n;if(e>=t)return 0;const r=O.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:ce;return o},[ce]),me=E?ue(0,Math.min(H.start,r.length)):0,he=E?ue(Math.min(H.end,r.length),r.length):0,fe=d(()=>{null!=G.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(G.current),G.current=null),null!=J.current&&(window.clearTimeout(J.current),J.current=null),null!=Q.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Q.current),Q.current=null),ee.current=!1,te.current=null},[]),pe=d(e=>{var t;if(!D)return;const r=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),o=Math.max(1,N||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?ne.current=Math.max(i,Math.floor(.7*ne.current)):e<.5*r&&ne.current<o&&(ne.current=Math.min(o,Math.ceil(1.2*ne.current)))},[D,n.renderBatchBudgetMs,N]),ge=d((e,t={})=>{var r,o;if(!D)return;const i=re.current;if(R.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();A(t=>{const n=Math.min(re.current,t+Math.max(1,e));return R.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();pe(n-t)},c=()=>{const e=Math.max(1,Math.round(ne.current));ge(e)},s=e=>{var t;G.current=null,J.current=null,Q.current=null,ee.current=!1;const r=te.current;if(te.current=null,a(null!=r?r:l),R.current>=re.current)return;if(!e)return void c();const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6);for(;R.current<re.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(ne.current)));R.current<re.current&&c()};if(!b||t.immediate)return void s();const d=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(te.current=null!=te.current?Math.max(te.current,l):l,!ee.current){if(ee.current=!0,C){const e=Math.max(0,null!=(o=n.renderBatchIdleTimeoutMs)?o:120);return void(Q.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?G.current=requestAnimationFrame(()=>{0!==d?J.current=window.setTimeout(()=>s(),d):s()}):J.current=window.setTimeout(()=>s(),d)}},[pe,C,D,b,n.renderBatchDelay,n.renderBatchBudgetMs,n.renderBatchIdleTimeoutMs]);s(()=>{var e;const t=n.indexKey,o=r.length,i=oe.current,l=void 0!==t?t!==i.key:o!==i.total,a=ie.current,c=Math.min(a.length,r.length);let s=0;for(;s<c&&a[s]===r[s];)s+=1;oe.current={key:t,total:o};const d=le.current,u=null!=(e=n.renderBatchDelay)?e:16,m=d.batchSize!==N||d.initial!==M||d.delay!==u||d.enabled!==D;if(le.current={batchSize:N,initial:M,delay:u,enabled:D},(l||m||!D)&&fe(),(l||m)&&(ne.current=Math.max(1,N||1)),t!==i.key)Z.current.clear();else if(l)for(const n of Z.current)n>=s&&Z.current.delete(n);if(!o)return R.current=0,void A(0);const h=re.current;if(!D)return R.current=h,void A(h);if(l||m){const e=Math.min(h,M);return R.current=e,A(e),void(e<h&&ge(Math.max(1,M),{immediate:!b}))}const f=Math.min(R.current,h);f!==R.current&&(R.current=f,A(f)),R.current<h&&ge(Math.max(1,N||1))},[fe,D,b,r.length,n.indexKey,n.renderBatchDelay,N,M,ge]),s(()=>{ie.current=r},[r]),s(()=>{if(!E)return void W({start:0,end:r.length});const e=r.length;if(!e)return void W({start:0,end:0});const t=Math.max(0,Math.min(I,e-1));let n=Math.max(0,t-S),o=Math.min(e,t+S+1);const i=o-n;if(i>T){const e=i-T;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<T){const t=T-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}W({start:n,end:o})},[I,S,T,r.length,E]),s(()=>()=>{fe();for(const e of V.current.values())e.destroy();V.current.clear()},[fe]);const ve=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete K.current[t],q.current.delete(t),U.current.delete(t),X.current.delete(t))},[]);s(()=>{ve(F)},[ve,F]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(O.current.keys()))n>=e&&(O.current.delete(n),t=!0);t&&z(e=>e+1);for(const n of Object.keys(K.current))Number(n)>=e&&delete K.current[n];for(const n of Array.from(Z.current))n>=e&&Z.current.delete(n)},[r.length]);const ye=d((e,t)=>{$&&t&&(K.current[e]=!0),t&&E&&_(t=>e>t?e:t)},[$,E]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),xe=d((e,t)=>{const n=q.current;if(t?n.set(e,t):n.delete(e),!ae||!t)return we(e),$&&!t&&delete K.current[e],void(t&&ye(e,!0));if(e<M&&!E)return we(e),void ye(e,!0);we(e);const r=k(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ye(e,!0),r.whenVisible.then(()=>ye(e,!0)).catch(()=>{})},[$,we,ye,k,M,ae,E]),ke=d(e=>{const t=U.current.get(e);if(t)return t;const n=t=>xe(e,t);return U.current.set(e,n),n},[xe]),be=d((e,t)=>{if(!t)return void(O.current.has(e)&&(O.current.delete(e),z(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&O.current.get(e)!==n&&(O.current.set(e,n),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),Ce=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>be(e,t);return X.current.set(e,n),n},[be]),Ne=d(e=>!(D&&e>=R.current)&&(!$||e<M||!0===K.current[e]),[$,D,M]),Me=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of q.current.entries())t&&xe(e,t)},[xe]),s(()=>{E&&P>Y.current&&_(P-1),Y.current=P},[P,E]);const Be=E?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${me}px`},"aria-hidden":"true"}):null,Se=E?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${he}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
188
+ return e("div",{ref:u,className:`markstream-react markdown-renderer${n.isDark?" dark":""}${E?" virtualized":""}`,"data-custom-id":n.customId,onClick:n.onClick,onMouseOver:Me(n.onMouseOver),onMouseOut:Me(n.onMouseOut),children:[Be,se.map(({node:e,index:r})=>{var o;const i=Ne(r),c=null!=(o=O.current.get(r))?o:ce,s=!1!==n.fade&&"code_block"!==e.type&&!Z.current.has(r)&&i;return s&&Z.current.add(r),/* @__PURE__ */t("div",{ref:ke(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */t("div",i?{ref:Ce(r),className:"node-content"+(s?" fade-node typewriter-node":""),children:/* @__PURE__ */t(Or,{node:e,nodeKey:`${a}-${r}`,renderCtx:l})}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Se,m&&/* @__PURE__ */t("span",{ref:h,className:"typewriter-cursor","aria-hidden":"true"})]})},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,r=t.parsedNodes;if(n===r)return!0;if(n.length!==r.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==r[l])return!1;const o=e.props,i=t.props;return o.isDark===i.isDark&&o.typewriter===i.typewriter&&o.fade===i.fade&&o.batchRendering===i.batchRendering&&o.initialRenderBatchSize===i.initialRenderBatchSize&&o.renderBatchSize===i.renderBatchSize&&o.renderBatchDelay===i.renderBatchDelay&&o.renderBatchBudgetMs===i.renderBatchBudgetMs&&o.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&o.deferNodesUntilVisible===i.deferNodesUntilVisible&&o.maxLiveNodes===i.maxLiveNodes&&o.liveNodeBuffer===i.liveNodeBuffer&&o.viewportPriority===i.viewportPriority&&o.indexKey===i.indexKey&&o.onClick===i.onClick&&o.onMouseOver===i.onMouseOver&&o.onMouseOut===i.onMouseOut});function zr(e){var n,l;const a={...Ir,...e},u=c(null),h=c(/* @__PURE__ */new Map),f=c(0),p=c(null),g=Ae(a.smoothStreamingOptions),v=r.useContext(Be),y=c(/* @__PURE__ */new Set),[w,x]=i(()=>!0===a.smoothStreaming);s(()=>{x(!0)},[]);const k=Array.isArray(a.nodes)&&a.nodes.length>0,b=o(()=>{var e;return!1!==a.smoothStreaming&&!k&&(!0===a.smoothStreaming||!v)&&(!0===a.smoothStreaming||!0===a.typewriter||(null!=(e=a.maxLiveNodes)?e:0)<=0)},[k,v,a.maxLiveNodes,a.smoothStreaming,a.typewriter]),C=w&&b,N=C?g.visible:null!=(n=a.content)?n:"",M=o(()=>{var e,t;const n=null!=(e=a.parseOptions)?e:{};return null!=(t=a.final)?t:n.final},[a.final,a.parseOptions]),B=null!=(l=a.content)?l:"",S=k||g.source===B,T=o(()=>C&&null!=M?Boolean(M&&S&&g.caughtUp):M,[M,S,g.caughtUp,C]),$=c(null),[A,R]=i(!1),F=c(void 0),I=c(0),_=o(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[]),H=d(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&_.has(t)},[_]),W=d(e=>{var t,n;if(!e||"object"!=typeof e)return 0;const r=e,o=null!=(n=null!=(t=r.raw)?t:r.content)?n:r.code;if("string"==typeof o)return o.length;const i=r.children;if(Array.isArray(i))return i.reduce((e,t)=>e+W(t),0);const l=r.items;return Array.isArray(l)?l.reduce((e,t)=>e+W(t),0):0},[]),O=d(()=>{var e,t;return(null==(e=a.nodes)?void 0:e.length)?a.nodes.reduce((e,t)=>e+W(t),0):(null!=(t=a.content)?t:"").length},[a.nodes,a.content,W]),j=d(()=>{F.current&&(clearTimeout(F.current),F.current=void 0)},[]),q=d(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){var t;if(!(null!=(t=e.textContent)?t:"").trim())return NodeFilter.FILTER_REJECT;const n=e.parentElement;return n?n.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n},[]),U=d(()=>{var e,t;if("undefined"==typeof window||!A||!u.current||!$.current)return;const n=u.current,r=$.current,o=q(n),i=n.getBoundingClientRect();let l=0,a=0,c=20;if(null==o?void 0:o.textContent){const r=document.createRange(),s=o.textContent.length;r.setStart(o,Math.max(0,s-1)),r.setEnd(o,s);const d="function"==typeof r.getClientRects?r.getClientRects():void 0,u=null!=(t=null==d?void 0:d[d.length-1])?t:null==(e=o.parentElement)?void 0:e.getBoundingClientRect();u&&(l=u.right-i.left+n.scrollLeft,a=u.top-i.top+n.scrollTop,c=u.height||c),r.detach()}r.style.transform=`translate(${Math.max(0,l)}px, ${Math.max(0,a)}px)`,r.style.height=`${c}px`},[A,u,q]);s(()=>{A&&requestAnimationFrame(()=>{U()})},[A,U]),s(()=>()=>{j()},[j]);const X=k?a.nodes:N;p.current!==X&&(f.current+=1,p.current=X);const Z=m(z,K,K),Y=o(()=>V(a.customId),[a.customId,Z]),G=Wr(a.streamingComponents),J=Wr(a.htmlComponents);s(()=>{he(G,J,y.current)},[J,G]);const Q=o(()=>a.customId?`renderer-${a.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[a.customId]),ee=o(()=>{var e,t;const n=null!=(t=(null!=(e=a.parseOptions)?e:{}).customHtmlTags)?t:[];return E(a.customHtmlTags,Array.isArray(n)?n:[],Object.keys(G))},[a.customId,a.customHtmlTags,a.parseOptions,Z,G]),te=o(()=>{const e=ee;return e&&0!==e.length?L(Q,{customHtmlTags:e}):L(Q)},[Q,ee]),ne=o(()=>{const e=te;return a.customMarkdownIt?a.customMarkdownIt(e):e},[te,a.customMarkdownIt]),re=o(()=>{var e;const t=null!=(e=a.parseOptions)?e:{},n=T,r=null!=n,o=ee.length>0;return r||o?{...t,...r?{final:n}:{},...o?{customHtmlTags:ee}:{}}:t},[ee,T,a.parseOptions]),oe=o(()=>{const e=Boolean(a.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let n=[];return k?n=a.nodes.map(e=>({...e})):N&&(n=D(N,null!=ne?ne:_r,re)),e&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:n.length,contentLength:N.length}),n},[a.debugPerformance,N,k,a.nodes,re,ne,a.customId,Z,ee]),ie=d(()=>{const e=oe[oe.length-1];return!H(e)},[oe,H]);s(()=>{if("undefined"==typeof window||k)return;if(T)return R(!1),void j();const e=O(),t=ie();return!1===a.typewriter||!t||e<=I.current?(!1!==a.typewriter&&t||R(!1),void(I.current=e)):(I.current=e,R(!0),j(),requestAnimationFrame(()=>{U()}),F.current=setTimeout(()=>{R(!1)},3e3),()=>{j()})},[N,a.nodes,a.typewriter,a.content,T,oe.length,k,O,ie,j,U]);const le=c([]),ae=null==re?void 0:re.postTransformNodes,ce=c(ae);ce.current!==ae&&(le.current=[],ce.current=ae);const se=function(e,t){if(!t.length)return e;const n=new Array(e.length);let r=e.length===t.length;for(let o=0;o<e.length;o++){const i=o<t.length?t[o]:null;i&&Hr(i,e[o])?n[o]=i:(n[o]=e[o],r=!1)}return r?t:n}(oe,le.current);le.current=se,s(()=>{var e;if(k)return void g.reset("");const t=null!=(e=a.content)?e:"";if(!C)return g.reset(t),void(M&&g.finish({flush:!0}));const n=g.getSnapshot().source;t?t===n||(t.startsWith(n)?g.enqueue(t.slice(n.length)):g.reset(t)):g.reset(""),M&&g.finish()},[k,a.content,M,C]),s(()=>{var e,t;if("undefined"==typeof window)return;if(a.renderCodeBlocksAsPre)return;if(!se.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==P(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const n=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},r=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),o=n(()=>{nt()},{timeout:900});return()=>r(o)},[se,a.renderCodeBlocksAsPre]);const de=o(()=>null!=a.indexKey?String(a.indexKey):"markdown-renderer",[a.indexKey]),ue=o(()=>({..."boolean"==typeof a.showTooltips?{showTooltips:a.showTooltips}:{},...a.codeBlockProps||{}}),[a.codeBlockProps,a.showTooltips]),me=o(()=>({...a.mermaidProps||{}}),[a.mermaidProps]),fe=o(()=>({...a.d2Props||{}}),[a.d2Props]),pe=o(()=>({...a.infographicProps||{}}),[a.infographicProps]),ge=o(()=>{var e;return{customId:a.customId,isDark:a.isDark,final:T,indexKey:de,typewriter:a.typewriter,fade:a.fade,textStreamState:h.current,streamRenderVersion:f.current,customComponents:Y,streamingComponents:G,htmlComponents:J,customHtmlTags:ee,htmlPolicy:null!=(e=a.htmlPolicy)?e:"safe",showTooltips:a.showTooltips,renderCodeBlocksAsPre:a.renderCodeBlocksAsPre,codeBlockStream:a.codeBlockStream,codeBlockOptions:a.codeBlockOptions,codeBlockProps:ue,mermaidProps:me,d2Props:fe,infographicProps:pe,codeBlockThemes:{themes:a.themes,darkTheme:a.codeBlockDarkTheme,lightTheme:a.codeBlockLightTheme,minWidth:a.codeBlockMinWidth,maxWidth:a.codeBlockMaxWidth},events:{onCopy:a.onCopy,onHandleArtifactClick:a.onHandleArtifactClick}}},[a.customId,a.isDark,T,de,a.typewriter,a.fade,a.showTooltips,a.htmlPolicy,a.renderCodeBlocksAsPre,a.codeBlockStream,a.codeBlockOptions,ee,ue,me,fe,pe,a.themes,a.codeBlockDarkTheme,a.codeBlockLightTheme,a.codeBlockMinWidth,a.codeBlockMaxWidth,a.onCopy,a.onHandleArtifactClick,Y,G,J]);ge.streamRenderVersion=f.current,ge.textStreamState=h.current;const ve=c(null);return ve.current||(ve.current={textStreamState:h.current,getStreamRenderVersion:()=>f.current}),/* @__PURE__ */t(Se.Provider,{value:ve.current,children:/* @__PURE__ */t(Be.Provider,{value:C,children:/* @__PURE__ */t($e,{getRoot:()=>u.current,enabled:!1!==a.viewportPriority,children:/* @__PURE__ */t(jr,{props:a,parsedNodes:se,renderCtx:ge,indexPrefix:de,containerRef:u,showTypewriterCursor:A,typewriterCursorRef:$})})})})}function Kr(e){var n,r,o,i,l;const{node:a,ctx:c,renderNode:s,indexKey:d,children:u}=e;/* @__PURE__ */
189
+ return t("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:c&&s?/* @__PURE__ */t(zr,{nodes:a.children||[],indexKey:`blockquote-${String(null!=d?d:"blockquote")}`,customId:c.customId,isDark:c.isDark,typewriter:c.typewriter,viewportPriority:!0,codeBlockStream:c.codeBlockStream,renderCodeBlocksAsPre:c.renderCodeBlocksAsPre,codeBlockOptions:c.codeBlockOptions,codeBlockProps:c.codeBlockProps,themes:null==(n=c.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=c.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=c.codeBlockThemes)?void 0:o.lightTheme,codeBlockMinWidth:null==(i=c.codeBlockThemes)?void 0:i.minWidth,codeBlockMaxWidth:null==(l=c.codeBlockThemes)?void 0:l.maxWidth,htmlPolicy:c.htmlPolicy,showTooltips:c.showTooltips,onCopy:c.events.onCopy,onHandleArtifactClick:c.events.onHandleArtifactClick}):null})}function Vr(e){var n;const r=c(null),[l,a]=i(!1),[d,u]=i({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),m=o(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(e.isDark),[e.isDark]);return s(()=>{if(!e.visible)return void a(!1);if(!e.anchorEl||!r.current)return void a(!0);let t=null,n=!1;const o=async()=>{var t,o;if(!e.anchorEl||!r.current)return;const{x:i,y:l}=await we(e.anchorEl,r.current,{placement:null!=(t=e.placement)?t:"top",middleware:[xe(null!=(o=e.offset)?o:8),ke(),be({padding:8})],strategy:"fixed"});n||u({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(l)}px, 0)`})};return o().then(()=>{n||a(!0)}),t=ye(e.anchorEl,r.current,o),()=>{n=!0,null==t||t()}},[e.anchorEl,e.offset,e.placement,e.visible,l]),"undefined"==typeof document?null:e.visible&&l?Ce(
190
+ /* @__PURE__ */t("div",{id:null!=(n=e.id)?n:void 0,ref:r,style:d,className:["markstream-react ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{Bn as $,Me as A,Kr as B,Re as C,Bt as D,Tt as E,br as F,Tn as G,Rt as H,Jt as I,Cn as J,Gn as K,un as L,Zn as M,zr as N,yt as O,Mr as P,vt as Q,Br as R,Sr as S,Dr as T,er as U,Pr as V,Mn as W,xt as X,Pn as Y,Xn as Z,wt as _,st as a,An as a0,Fr as a1,gt as a2,Ie as a3,$n as a4,Sn as a5,En as a6,bn as a7,Nn as a8,Yn as a9,qn as aa,Un as ab,tr as ac,_e as ad,Ae as ae,Ln as af,St as b,Et as c,$t as d,Pt as e,At as f,Ft as g,It as h,_t as i,Zt as j,Ge as k,rn as l,ln as m,an as n,mn as o,hn as p,_n as q,Hn as r,hr as s,Tr as t,Er as u,Lr as v,dn as w,$r as x,Vr as y,Qn as z};