markstream-react 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,45 +1,44 @@
1
- import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,useContext as l,createContext as a,useRef as c,useEffect as s,useCallback as d,useSyncExternalStore as u,useLayoutEffect as m}from"react";import{getMarkdown as h,parseMarkdownToStructure as p}from"stream-markdown-parser";import{autoUpdate as g,computePosition as f,offset as w,flip as v,shift as y}from"@floating-ui/dom";import{createPortal as x}from"react-dom";const k=/* @__PURE__ */new Set(["image","table","code_block","html_block","html_inline","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function b(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=null==n||n,e):e,{})}function C(t,n,r,o){if(!Array.isArray(t)||0===t.length)return null;const i=[];for(let l=0;l<t.length;l++){const a=t[l];if(a){if("label_open"===a.type){const c=[];for(l++;l<t.length;){const e=t[l];if("label_close"===(null==e?void 0:e.type))break;e&&c.push(e),l++}const s=`${r}-label-${l}`;i.push(
1
+ import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,useContext as l,useRef as a,createContext as c,useEffect as s,useCallback as d,useSyncExternalStore as u,useLayoutEffect as m}from"react";import{getMarkdown as h,parseMarkdownToStructure as p}from"stream-markdown-parser";import{autoUpdate as g,computePosition as f,offset as w,flip as v,shift as y}from"@floating-ui/dom";import{createPortal as x}from"react-dom";const k=/* @__PURE__ */new Set(["image","table","code_block","html_block","html_inline","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function b(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=null==n||n,e):e,{})}function C(t,n,r,o){if(!Array.isArray(t)||0===t.length)return null;const i=[];for(let l=0;l<t.length;l++){const a=t[l];if(a){if("label_open"===a.type){const c=[];for(l++;l<t.length;){const e=t[l];if("label_close"===(null==e?void 0:e.type))break;e&&c.push(e),l++}const s=`${r}-label-${l}`;i.push(
2
2
  /* @__PURE__ */e("label",{...b(a.attrs),children:C(c,n,`${s}-child`,o)},s));continue}"label_close"!==a.type&&i.push(o(a,`${r}-${l}`,n))}}return i}function M(n,r,o,i){/* @__PURE__ */
3
3
  return e(t,{children:C(n,r,`${o}-inline`,i)})}const N={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function B(t){const{node:r,ctx:l,renderNode:a,indexKey:c,isDark:s}=t,d=String(r.kind||"note"),u=o(()=>r.title&&String(r.title).trim().length?String(r.title):d.charAt(0).toUpperCase()+d.slice(1),[d,r.title]),[m,h]=i(()=>{var e;return!!r.collapsible&&!(null==(e=r.open)||e)}),p=o(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);/* @__PURE__ */
4
4
  return n("div",{className:`admonition admonition-${d}${s?" is-dark":""}`,"data-index-key":c,children:[
5
5
  /* @__PURE__ */n("div",{id:p,className:"admonition-header",children:[N[d]&&/* @__PURE__ */e("span",{className:"admonition-icon",children:N[d]}),
6
- /* @__PURE__ */e("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */e("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${p}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */e("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */e("div",{id:`${p}-content`,className:"admonition-content","aria-labelledby":p,children:l&&a?C(r.children,l,String(null!=c?c:p),a):null})]})}const L=a(null);function T(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,r=/* @__PURE__ */new Map;return(o,i)=>{var l,a;const c={current:!1};let s,d=!1;const u=new Promise(e=>{s=()=>{d||(d=!0,e())}}),m=()=>{for(const e of r.values())if(e.targets.has(o)){e.targets.delete(o);try{e.observer.unobserve(o)}catch{}}};if(!n||!t())return c.current=!0,s(),{isVisible:()=>!0,whenVisible:u,destroy:m};const h=((t,o)=>{var i,l;if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const a=null!=(i=e())?i:null,c=`${t}::${o}`,s=r.get(c);if(s&&s.root===a)return s;if(s){try{s.observer.disconnect()}catch{}r.delete(c)}const d=null!=(l=null==s?void 0:s.targets)?l:/* @__PURE__ */new Map,u=new IntersectionObserver(e=>{for(const t of e){const e=d.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){e.state.current=!0;try{e.resolve()}catch{}try{u.unobserve(t.target)}catch{}d.delete(t.target)}}},{root:a,rootMargin:t,threshold:o}),m={observer:u,root:a,rootMargin:t,threshold:o,targets:d};r.set(c,m);for(const e of d.keys())u.observe(e);return m})(null!=(l=null==i?void 0:i.rootMargin)?l:"300px",null!=(a=null==i?void 0:i.threshold)?a:0);return h?(h.targets.set(o,{resolve:s,state:c}),h.observer.observe(o),{isVisible:()=>c.current,whenVisible:u,destroy:m}):(c.current=!0,s(),{isVisible:()=>!0,whenVisible:u,destroy:m})}}const E=T(()=>null,()=>!0);function S({getRoot:t,enabled:n=!0,children:r}){const i=c(n);i.current=n;const l=c(t);l.current=t;const a=o(()=>T(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
7
- return e(L.Provider,{value:a,children:r})}function D(){var e;return null!=(e=l(L))?e:E}const $="__global__",_="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",j=(()=>{const e=globalThis;if(e[_])return e[_];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[_]=t,t})();function A(){j.revision++;for(const e of Array.from(j.listeners))try{e()}catch{}}function W(e){return j.listeners.add(e),()=>{j.listeners.delete(e)}}function O(){return j.revision}function P(e,t){"string"==typeof e?j.scopedComponents[e]={...t||{}}:j.scopedComponents[$]={...e},A()}function I(e){const t=j.scopedComponents[$]||{};if(!e)return t;const n=j.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function R(e){if(e===$)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete j.scopedComponents[e],A()}function F(){delete j.scopedComponents[$],A()}function H(t){const{node:n}=t;/* @__PURE__ */
8
- return e("span",{className:"checkbox-node",children:/* @__PURE__ */e("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const z={"common.copy":"Copy","common.copySuccess":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.close":"Close","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function V(e){Object.assign(z,e)}function X(){return{t:e=>{var t;return null!=(t=z[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let K=null,q=null,U=null,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=null)}async function Q(e){if(!K||!q)return;const{x:t,y:n}=await f(q,K,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});K.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function ee(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(K||"undefined"==typeof document||(K=document.createElement("div"),K.className="ms-tooltip",K.setAttribute("role","tooltip"),K.dataset.visible="false",K.style.position="fixed",K.style.left="0px",K.style.top="0px",K.style.transform="translate3d(0,0,0)",document.body.appendChild(K)),!K)return;J();const l=async()=>{if(K){q=e,K.textContent=t,K.dataset.placement=n,K.dataset.dark=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}(i)?"true":"false",K.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,K.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),K.dataset.visible="true",null==U||U(),U=g(e,K,()=>{Q(n)})}};r?l():Y=setTimeout(l,80)}function te(e=!1){if(!K)return;J();const t=()=>{if(K){if(K.dataset.visible="false",q&&G)try{q.removeAttribute("aria-describedby")}catch{}q=null,G=null,U&&(U(),U=null)}};e?t():Z=setTimeout(t,120)}const ne='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n\n';let re=null,oe=null,ie=null;const le=/* @__PURE__ */new Set;function ae(e){re=null!=e?e:null}const ce={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",d2lang:"d2",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"},se={"":ne,plain:ne,text:ne,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n\n',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n\n'};function de(e){var t;const n=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e);return null!=(t=ce[n])?t:n}function ue(e){const t=de(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}async function me(){return oe||(ie||(ie=import("./languageIconExtended-B1nZmPQn.js").then(e=>(oe=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of le)try{e()}catch{}}(),oe)).catch(()=>null)),ie)}async function he(){await me()}function pe(e){return le.add(e),()=>{le.delete(e)}}function ge(e){if(re){const t=re(e);if(null!=t&&""!==t)return t}const t=de(e),n=se[t];if(n)return n;return(null==oe?void 0:oe[t])||(me(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n\n')}const fe={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"};function we(t){const{t:r}=X(),i=o(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`},[t.code,t.isDark]);return s(()=>{const e=e=>{var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[t]),"undefined"==typeof document?null:x(
6
+ /* @__PURE__ */e("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */e("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${p}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */e("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */e("div",{id:`${p}-content`,className:"admonition-content","aria-labelledby":p,children:l&&a?C(r.children,l,String(null!=c?c:p),a):null})]})}const L=c(null);function T(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document;let r=null,o=null;const i=/* @__PURE__ */new Map;return(l,a)=>{var c,s;const d={current:!1};let u,m=!1;const h=new Promise(e=>{u=()=>{m||(m=!0,e())}}),p=()=>{if(i.has(l)){i.delete(l);try{null==r||r.unobserve(l)}catch{}}if(!i.size){try{null==r||r.disconnect()}catch{}r=null,o=null}};if(!n||!t())return d.current=!0,u(),{isVisible:()=>!0,whenVisible:h,destroy:p};const g=((t,l)=>{if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const a=((t,n)=>{var r;return{root:null!=(r=e())?r:null,rootMargin:t,threshold:n}})(t,l);if(r&&(s=a,(c=o)&&c.root===s.root&&c.rootMargin===s.rootMargin&&c.threshold===s.threshold))return r;var c,s;if(r)try{r.disconnect()}catch{}r=new IntersectionObserver(e=>{for(const t of e){const e=i.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){e.state.current=!0;try{e.resolve()}catch{}try{r.unobserve(t.target)}catch{}i.delete(t.target)}}},{root:a.root,rootMargin:a.rootMargin,threshold:a.threshold}),o=a;for(const e of i.keys())r.observe(e);return r})(null!=(c=null==a?void 0:a.rootMargin)?c:"300px",null!=(s=null==a?void 0:a.threshold)?s:0);return g?(i.set(l,{resolve:u,state:d}),g.observe(l),{isVisible:()=>d.current,whenVisible:h,destroy:p}):(d.current=!0,u(),{isVisible:()=>!0,whenVisible:h,destroy:p})}}const E=T(()=>null,()=>!0);function S({getRoot:t,enabled:n=!0,children:r}){const i=a(n);i.current=n;const l=a(t);l.current=t;const c=o(()=>T(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
7
+ return e(L.Provider,{value:c,children:r})}function D(){var e;return null!=(e=l(L))?e:E}const $="__global__",_="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",j=(()=>{const e=globalThis;if(e[_])return e[_];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[_]=t,t})();function A(){j.revision++;for(const e of Array.from(j.listeners))try{e()}catch{}}function P(e){return j.listeners.add(e),()=>{j.listeners.delete(e)}}function W(){return j.revision}function O(e,t){"string"==typeof e?j.scopedComponents[e]={...t||{}}:j.scopedComponents[$]={...e},A()}function I(e){const t=j.scopedComponents[$]||{};if(!e)return t;const n=j.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function R(e){if(e===$)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete j.scopedComponents[e],A()}function F(){delete j.scopedComponents[$],A()}function H(t){const{node:n}=t;/* @__PURE__ */
8
+ return e("span",{className:"checkbox-node",children:/* @__PURE__ */e("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const z={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.close":"Close","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function V(e){Object.assign(z,e)}function X(){return{t:e=>{var t;return null!=(t=z[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let K=null,q=null,U=null,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=null)}async function Q(e){if(!K||!q)return;const{x:t,y:n}=await f(q,K,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});K.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function ee(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(K||"undefined"==typeof document||(K=document.createElement("div"),K.className="ms-tooltip",K.setAttribute("role","tooltip"),K.dataset.visible="false",K.style.position="fixed",K.style.left="0px",K.style.top="0px",K.style.transform="translate3d(0,0,0)",document.body.appendChild(K)),!K)return;J();const l=async()=>{if(K){q=e,K.textContent=t,K.dataset.placement=n,K.dataset.dark=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}(i)?"true":"false",K.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,K.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),K.dataset.visible="true",null==U||U(),U=g(e,K,()=>{Q(n)})}};r?l():Y=setTimeout(l,80)}function te(e=!1){if(!K)return;J();const t=()=>{if(K){if(K.dataset.visible="false",q&&G)try{q.removeAttribute("aria-describedby")}catch{}q=null,G=null,U&&(U(),U=null)}};e?t():Z=setTimeout(t,120)}const ne='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n\n';let re=null,oe=null,ie=null;const le=/* @__PURE__ */new Set;function ae(e){re=null!=e?e:null}const ce={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",d2lang:"d2",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"},se={"":ne,plain:ne,text:ne,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n\n',typescript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n\n',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n\n',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n\n',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n\n',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n\n',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n\n',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n\n',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n\n'};function de(e){var t;const n=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e);return null!=(t=ce[n])?t:n}function ue(e){const t=de(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}async function me(){return oe||(ie||(ie=import("./languageIconExtended-B1nZmPQn.js").then(e=>(oe=e.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const e of le)try{e()}catch{}}(),oe)).catch(()=>null)),ie)}async function he(){await me()}function pe(e){return le.add(e),()=>{le.delete(e)}}function ge(e){if(re){const t=re(e);if(null!=t&&""!==t)return t}const t=de(e),n=se[t];if(n)return n;return(null==oe?void 0:oe[t])||(me(),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n\n')}const fe={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"};function we(t){const{t:r}=X(),i=o(()=>{const e=t.code||"",n=e.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?"#020617":"#ffffff"};\n color: ${t.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`},[t.code,t.isDark]);return s(()=>{const e=e=>{var n;"Escape"!==e.key&&"Esc"!==e.key||null==(n=t.onClose)||n.call(t)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[t]),"undefined"==typeof document?null:x(
9
9
  /* @__PURE__ */e("div",{className:"html-preview-frame__backdrop"+(t.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:/* @__PURE__ */n("div",{className:"html-preview-frame"+(t.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
10
10
  /* @__PURE__ */n("div",{className:"html-preview-frame__header",children:[
11
11
  /* @__PURE__ */n("div",{className:"html-preview-frame__title",children:[
12
12
  /* @__PURE__ */e("span",{className:"html-preview-frame__dot"}),
13
13
  /* @__PURE__ */e("span",{className:"html-preview-frame__label",children:t.title||`HTML ${r("common.preview")}`})]}),
14
14
  /* @__PURE__ */e("button",{type:"button",className:"html-preview-frame__close"+(t.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=t.onClose)?void 0:e.call(t)},children:"×"})]}),
15
- /* @__PURE__ */e("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:i,title:t.title||"Preview"})]})}),document.body)}let ve=!1,ye=null,xe=!1;async function ke(){if(ye)return ye;if(xe)return null;try{return ye=await import("stream-monaco"),await async function(e){if(ve)return;ve=!0;const t=null==globalThis?void 0:globalThis.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&(null==e?void 0:e.preloadMonacoWorkers)&&await e.preloadMonacoWorkers()}(ye),ye}catch{return xe=!0,null}}let be=null,Ce=!1,Me=null,Ne=null,Be=null,Le=null,Te=null;const Ee=/* @__PURE__ */new WeakMap;let Se=0;function De(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Ee.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Ee.set(e,t),t}catch{}const n="__theme_"+ ++Se;return Ee.set(e,n),n}return String(e)}(e);return n?(be!==t&&(be=t),Ce||Te!==n?!Me||Le!==n&&Ne!==n?(Be=e,Le=n,Me||(Ce=!0,Me=(async()=>{for(;null!=Be&&null!=Le;){const e=Be,t=Le;if(Be=null,Le=null,Te===t)continue;const n=be;if(!n)break;try{Ne=t,await Promise.resolve(n(e)),Te=t}catch{}}})().finally(()=>{Ce=!1,Me=null,Ne=null}),Me)):Me:Promise.resolve()):Promise.resolve()}let $e=null,_e=null,je=null;const Ae=/* @__PURE__ */new Set,We=/* @__PURE__ */new WeakMap;let Oe=0;function Pe(){for(const e of Array.from(Ae))try{e()}catch{}}function Ie({node:t}){var n;const r=o(()=>function(e){var t;return String(null!=(t=String(null!=e?e:"").split(/\s+/g)[0])?t:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}(null==t?void 0:t.language),[t]),i=r?`Code block: ${r}`:"Code block";/* @__PURE__ */
16
- return e("pre",{className:`language-${r}`,"aria-busy":!0===(null==t?void 0:t.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(null!=(n=null==t?void 0:t.code)?n:"")})})}const Re={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function Fe(r){var l;const a={...Re,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:g,enableFontSizeControl:f,darkTheme:w,lightTheme:v,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:M,showExpandButton:N,showPreviewButton:B,showFontSizeButtons:L,showTooltips:T}=a,E=c(null),S=c(null),$=c(null),_=c(null),j=c(null),A=c(null),W=c(null),O=c(0),P=c(null),I=c(null),R=D(),F=c(y),H=c(x),z=c(y),[V,K]=i(!1),[q,U]=i(()=>"undefined"==typeof window),[Y,Z]=i(!1),[G,J]=i(!1),[Q,ne]=i(!1),[re,oe]=i(()=>u.language||"plaintext"),[ie,le]=i(()=>de(u.language)),[ae,ce]=i(!1),[se,me]=i(!1),[he,ve]=i(!1),[ye,xe]=i(!1),[be,Ce]=i(0),{t:Me}=X(),[Ne,Be]=i(()=>{const e=Number(null==y?void 0:y.fontSize);return Number.isFinite(e)&&e>0?e:14}),[Le,Te]=i(Ne),Ee=o(()=>!1!==T,[T]),Se=d(()=>{var e,t;const n=null!=(t=null==(e=F.current)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n&&Number.isFinite(n))return Math.max(80,n);const r=String(n).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),We=d(e=>{var t,n,r,o;if(V)return;const i=E.current,l=$.current;if(!i||!l)return;const a="diff"===A.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=Se();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}e?(i.style.maxHeight="none",i.style.overflow="visible"):(i.style.maxHeight=`${Math.ceil(c)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===A.current&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,c);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[Se,V]);s(()=>{F.current=y},[y]),s(()=>pe(()=>{Ce(e=>e+1)}),[]),s(()=>{le(de(u.language))},[u.language]);const Oe=c(u);Oe.current=u;const Fe=d(()=>{var e;O.current+=1;try{null==(e=_.current)||e.call(_)}catch{}j.current=null,A.current=null,W.current=null,ne(!1),J(!1)},[]),He=d(()=>{var e,t,n,r,o,i;const l=E.current,a=S.current;if(!l||!a)return;const c=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(c):null,l=String(null!=(t=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?t:"").trim()||String(null!=(n=null==e?void 0:e.color)?n:"").trim(),s=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();l&&a.style.setProperty("--vscode-editor-foreground",l),s&&a.style.setProperty("--vscode-editor-background",s),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[]);s(()=>()=>{var e,t,n;O.current+=1,null==(e=_.current)||e.call(_),_.current=null,j.current=null,A.current=null,W.current=null,P.current=null,null==(n=null==(t=I.current)?void 0:t.destroy)||n.call(t),I.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(q)return;const n=S.current;if(!n)return;null==(t=null==(e=I.current)?void 0:e.destroy)||t.call(e);const r=R(n,{rootMargin:"400px"});return I.current=r,r.isVisible()&&U(!0),r.whenVisible.then(()=>U(!0)),()=>{r.destroy(),I.current===r&&(I.current=null)}},[R,q]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await ke();if(!e)return;if(!r)return void K(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(P.current=i),"function"!=typeof o)return void K(!0);const l=null!=(t=m?w:v)?t:$e,a={...z.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:H.current,theme:l,...a,onThemeChange(){He()}});$.current=c,"function"==typeof(n=c.setTheme)&&(je=n,null!=$e&&null!=_e&&De($e,je).then(()=>Pe()).catch(()=>{})),_.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,Z(!0)}catch{e&&K(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!ie&&P.current)try{const t=P.current(String(null!=(e=u.code)?e:""));t&&oe(t)}catch{}},[ie,u.code,u.language]);const ze=o(()=>String(u.language||ie||re||"plaintext"),[ie,re,u.language]),Ve=o(()=>de(ze),[ze]),Xe=o(()=>ue(Ve),[Ve]),Ke=o(()=>ge(Ve),[Ve,be]),qe=o(()=>!!g&&("html"===Ve||"svg"===Ve),[Ve,g]),Ue=o(()=>{const e=Ve;return e?fe[e]||e.charAt(0).toUpperCase()+e.slice(1):fe[""]||"Plain Text"},[Ve]),Ye=o(()=>{var e,t,n;return u.diff?null!=(t=null!=(e=u.updatedCode)?e:u.code)?t:"":null!=(n=u.code)?n:""},[u.code,u.diff,u.updatedCode]),Ze=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(k),r=e(b);return n&&(t.minWidth=n),r&&(t.maxWidth=r),t},[k,b]),Ge=!1===p&&h,Je=o(()=>m?w:v,[w,m,v]);s(()=>{if(V)return;if(!G||!q)return;const e=$.current;(null==e?void 0:e.setTheme)&&Je&&De(Je,e.setTheme).then(He).catch(()=>{})},[G,Je,He,V,q]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{He()},Ae.add(e),()=>{Ae.delete(e)}},[He]);const Qe=d(async()=>{var e,t;if(V)return null;if(!q)return null;if(he)return null;if(Ge)return null;const n=$.current,r=E.current;if(!n||!r||!n.createEditor)return null;const o=Oe.current,i=o.diff?"diff":"single",l=W.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(A.current===i&&l===r&&a)return null;if(j.current)return j.current;O.current+=1;const c=O.current;J(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=_.current)||e.call(_),A.current=null,W.current=null,ne(!1);const p=Xe;if(o.diff?"function"==typeof n.createDiffEditor?(A.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(A.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(A.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),W.current=r,O.current!==c)return;const g=Number(null==(d=F.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){Be(g),Te(g);try{const e="diff"===A.current?null==(u=n.getDiffEditorView)?void 0:u.call(n):null==(m=n.getEditorView)?void 0:m.call(n);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:g,automaticLayout:!1})}catch{}}He(),se||he||We(!1),ne(!0)}catch{O.current===c&&K(!0)}})().finally(()=>{j.current===s&&(j.current=null)});return j.current=s,s},[We,he,se,Xe,Ge,He,V,q]);s(()=>{V||Y&&q&&(he||Ge?Fe():Qe())},[he,Qe,Y,Fe,Ge,V,q]),s(()=>{var e;if(V)return;if(!Y)return;if(!q)return;if(he)return;if(Ge)return;const t=$.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=ie;if(!o&&P.current)try{o=de(P.current(n)),o&&le(o)}catch{}const i=ue(o||Ve);if(t.createEditor&&E.current){try{await Promise.resolve(Qe())}catch{}const e=j.current;if(e)try{await e}catch{}}try{u.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=u.originalCode)?e:""),String(null!=(r=u.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}se&&We(!0)})()},[We,Ve,ie,he,G,Qe,se,Y,u.code,u.diff,u.originalCode,u.updatedCode,Ge,V,q]),s(()=>{if(V)return;if(!Y)return;if(!q)return;if(he)return;if(Ge)return;if(!se&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>We(se)):null;return null==e&&We(se),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[We,he,se,h,Y,Ge,V,q]),s(()=>{var e,t,n;if(!f)return;if(V)return;const r=$.current;if(r){try{const o="diff"===A.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Le})}catch{}We(se)}},[We,f,se,Le,u.diff,V]),s(()=>{Ee||te(!0)},[Ee]);const et=d((e,t)=>{if(!Ee)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,m))},[m,Ee]),tt=d(()=>{Ee&&te()},[Ee]),nt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Ye)),ce(!0),null==(e=a.onCopy)||e.call(a,String(Ye)),setTimeout(()=>ce(!1),1e3)}catch{}},[a,Ye]),rt=d(()=>{if(!qe)return;const e="html"===Ve?"text/html":"image/svg+xml",t="html"===Ve?Me("artifacts.htmlPreviewTitle")||"HTML Preview":Me("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof a.onPreviewCode?"html"===Ve&&xe(e=>!e):a.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${Ve}-${Date.now()}`})},[Ve,qe,u,a,Me]);return V?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n("div",{ref:S,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",m?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",m?"is-dark":""].join(" "),style:Ze,children:[C&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:`var(--vscode-editor-foreground, ${m?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${m?"#111827":"#ffffff"})`},children:[
15
+ /* @__PURE__ */e("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:i,title:t.title||"Preview"})]})}),document.body)}let ve=!1,ye=null,xe=!1;async function ke(){if(ye)return ye;if(xe)return null;try{return ye=await import("stream-monaco"),await async function(e){if(ve)return;ve=!0;const t=null==globalThis?void 0:globalThis.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&(null==e?void 0:e.preloadMonacoWorkers)&&await e.preloadMonacoWorkers()}(ye),ye}catch{return xe=!0,null}}let be=null,Ce=!1,Me=null,Ne=null,Be=null,Le=null,Te=null;const Ee=/* @__PURE__ */new WeakMap;let Se=0;function De(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Ee.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Ee.set(e,t),t}catch{}const n="__theme_"+ ++Se;return Ee.set(e,n),n}return String(e)}(e);return n?(be!==t&&(be=t),Ce||Te!==n?!Me||Le!==n&&Ne!==n?(Be=e,Le=n,Me||(Ce=!0,Me=(async()=>{for(;null!=Be&&null!=Le;){const e=Be,t=Le;if(Be=null,Le=null,Te===t)continue;const n=be;if(!n)break;try{Ne=t,await Promise.resolve(n(e)),Te=t}catch{}}})().finally(()=>{Ce=!1,Me=null,Ne=null}),Me)):Me:Promise.resolve()):Promise.resolve()}let $e=null,_e=null,je=null;const Ae=/* @__PURE__ */new Set,Pe=/* @__PURE__ */new WeakMap;let We=0;function Oe(){for(const e of Array.from(Ae))try{e()}catch{}}function Ie({node:t}){var n;const r=o(()=>function(e){var t;return String(null!=(t=String(null!=e?e:"").split(/\s+/g)[0])?t:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}(null==t?void 0:t.language),[t]),i=r?`Code block: ${r}`:"Code block";/* @__PURE__ */
16
+ return e("pre",{className:`language-${r}`,"aria-busy":!0===(null==t?void 0:t.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(null!=(n=null==t?void 0:t.code)?n:"")})})}const Re={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};function Fe(r){var l;const c={...Re,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:g,enableFontSizeControl:f,darkTheme:w,lightTheme:v,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:M,showExpandButton:N,showPreviewButton:B,showCollapseButton:L,showFontSizeButtons:T,showTooltips:E}=c,S=a(null),$=a(null),_=a(null),j=a(null),A=a(null),P=a(null),W=a(null),O=a(0),I=a(null),R=a(null),F=D(),H=a(y),z=a(x),V=a(y),[K,q]=i(!1),[U,Y]=i(()=>"undefined"==typeof window),[Z,G]=i(!1),[J,Q]=i(!1),[ne,re]=i(!1),[oe,ie]=i(()=>u.language||"plaintext"),[le,ae]=i(()=>de(u.language)),[ce,se]=i(!1),[me,he]=i(!1),[ve,ye]=i(!1),[xe,be]=i(!1),[Ce,Me]=i(0),{t:Ne}=X(),[Be,Le]=i(()=>{const e=Number(null==y?void 0:y.fontSize);return Number.isFinite(e)&&e>0?e:14}),[Te,Ee]=i(Be),Se=o(()=>!1!==E,[E]),Pe=d(()=>{var e,t;const n=null!=(t=null==(e=H.current)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n&&Number.isFinite(n))return Math.max(80,n);const r=String(n).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),We=d(e=>{var t,n,r,o;if(K)return;const i=S.current,l=_.current;if(!i||!l)return;const a="diff"===P.current?null==(t=l.getDiffEditorView)?void 0:t.call(l):null==(n=l.getEditorView)?void 0:n.call(l);if(!a)return;const c=Pe();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}e?(i.style.maxHeight="none",i.style.overflow="visible"):(i.style.maxHeight=`${Math.ceil(c)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===P.current&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,c);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[Pe,K]);s(()=>{H.current=y},[y]),s(()=>pe(()=>{Me(e=>e+1)}),[]),s(()=>{ae(de(u.language))},[u.language]);const Fe=a(u);Fe.current=u;const He=d(()=>{var e;O.current+=1;try{null==(e=j.current)||e.call(j)}catch{}A.current=null,P.current=null,W.current=null,re(!1),Q(!1)},[]),ze=d(()=>{var e,t,n,r,o,i;const l=S.current,a=$.current;if(!l||!a)return;const c=null!=(e=l.querySelector(".monaco-editor"))?e:l;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(c):null,l=String(null!=(t=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?t:"").trim()||String(null!=(n=null==e?void 0:e.color)?n:"").trim(),s=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();l&&a.style.setProperty("--vscode-editor-foreground",l),s&&a.style.setProperty("--vscode-editor-background",s),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[]);s(()=>()=>{var e,t,n;O.current+=1,null==(e=j.current)||e.call(j),j.current=null,A.current=null,P.current=null,W.current=null,I.current=null,null==(n=null==(t=R.current)?void 0:t.destroy)||n.call(t),R.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(U)return;const n=$.current;if(!n)return;null==(t=null==(e=R.current)?void 0:e.destroy)||t.call(e);const r=F(n,{rootMargin:"400px"});return R.current=r,r.isVisible()&&Y(!0),r.whenVisible.then(()=>Y(!0)),()=>{r.destroy(),R.current===r&&(R.current=null)}},[F,U]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await ke();if(!e)return;if(!r)return void q(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(I.current=i),"function"!=typeof o)return void q(!0);const l=null!=(t=m?w:v)?t:$e,a={...V.current||{}},c=o({wordWrap:"on",wrappingIndent:"same",themes:z.current,theme:l,...a,onThemeChange(){ze()}});_.current=c,"function"==typeof(n=c.setTheme)&&(je=n,null!=$e&&null!=_e&&De($e,je).then(()=>Oe()).catch(()=>{})),j.current="function"==typeof c.safeClean?()=>c.safeClean():"function"==typeof c.cleanupEditor?()=>c.cleanupEditor():null,G(!0)}catch{e&&q(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!u.language&&!le&&I.current)try{const t=I.current(String(null!=(e=u.code)?e:""));t&&ie(t)}catch{}},[le,u.code,u.language]);const Ve=o(()=>String(u.language||le||oe||"plaintext"),[le,oe,u.language]),Xe=o(()=>de(Ve),[Ve]),Ke=o(()=>ue(Xe),[Xe]),qe=o(()=>ge(Xe),[Xe,Ce]),Ue=o(()=>!!g&&("html"===Xe||"svg"===Xe),[Xe,g]),Ye=o(()=>{const e=Xe;return e?fe[e]||e.charAt(0).toUpperCase()+e.slice(1):fe[""]||"Plain Text"},[Xe]),Ze=o(()=>{var e,t,n;return u.diff?null!=(t=null!=(e=u.updatedCode)?e:u.code)?t:"":null!=(n=u.code)?n:""},[u.code,u.diff,u.updatedCode]),Ge=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(k),r=e(b);return n&&(t.minWidth=n),r&&(t.maxWidth=r),t},[k,b]),Je=!1===p&&h,Qe=o(()=>m?w:v,[w,m,v]);s(()=>{if(K)return;if(!J||!U)return;const e=_.current;(null==e?void 0:e.setTheme)&&Qe&&De(Qe,e.setTheme).then(ze).catch(()=>{})},[J,Qe,ze,K,U]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{ze()},Ae.add(e),()=>{Ae.delete(e)}},[ze]);const et=d(async()=>{var e,t;if(K)return null;if(!U)return null;if(ve)return null;if(Je)return null;const n=_.current,r=S.current;if(!n||!r||!n.createEditor)return null;const o=Fe.current,i=o.diff?"diff":"single",l=W.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(P.current===i&&l===r&&a)return null;if(A.current)return A.current;O.current+=1;const c=O.current;Q(!0);const s=(async()=>{var e,t,i,l,a,s,d,u,m,h;try{null==(e=j.current)||e.call(j),P.current=null,W.current=null,re(!1);const p=Ke;if(o.diff?"function"==typeof n.createDiffEditor?(P.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(P.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(P.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),W.current=r,O.current!==c)return;const g=Number(null==(d=H.current)?void 0:d.fontSize);if(Number.isFinite(g)&&g>0){Le(g),Ee(g);try{const e="diff"===P.current?null==(u=n.getDiffEditorView)?void 0:u.call(n):null==(m=n.getEditorView)?void 0:m.call(n);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:g,automaticLayout:!1})}catch{}}ze(),me||ve||We(!1),re(!0)}catch{O.current===c&&q(!0)}})().finally(()=>{A.current===s&&(A.current=null)});return A.current=s,s},[We,ve,me,Ke,Je,ze,K,U]);s(()=>{K||Z&&U&&(ve||Je?He():et())},[ve,et,Z,He,Je,K,U]),s(()=>{var e;if(K)return;if(!Z)return;if(!U)return;if(ve)return;if(Je)return;const t=_.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=le;if(!o&&I.current)try{o=de(I.current(n)),o&&ae(o)}catch{}const i=ue(o||Xe);if(t.createEditor&&S.current){try{await Promise.resolve(et())}catch{}const e=A.current;if(e)try{await e}catch{}}try{u.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=u.originalCode)?e:""),String(null!=(r=u.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}me&&We(!0)})()},[We,Xe,le,ve,J,et,me,Z,u.code,u.diff,u.originalCode,u.updatedCode,Je,K,U]),s(()=>{if(K)return;if(!Z)return;if(!U)return;if(ve)return;if(Je)return;if(!me&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>We(me)):null;return null==e&&We(me),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[We,ve,me,h,Z,Je,K,U]),s(()=>{var e,t,n;if(!f)return;if(K)return;const r=_.current;if(r){try{const o="diff"===P.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Te})}catch{}We(me)}},[We,f,me,Te,u.diff,K]),s(()=>{Se||te(!0)},[Se]);const tt=d((e,t)=>{if(!Se)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,m))},[m,Se]),nt=d(()=>{Se&&te()},[Se]),rt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Ze)),se(!0),null==(e=c.onCopy)||e.call(c,String(Ze)),setTimeout(()=>se(!1),1e3)}catch{}},[c,Ze]),ot=d(()=>{if(!Ue)return;const e="html"===Xe?"text/html":"image/svg+xml",t="html"===Xe?Ne("artifacts.htmlPreviewTitle")||"HTML Preview":Ne("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof c.onPreviewCode?"html"===Xe&&be(e=>!e):c.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${Xe}-${Date.now()}`})},[Xe,Ue,u,c,Ne]);return K?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n("div",{ref:$,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",m?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",m?"is-dark":""].join(" "),style:Ge,children:[C&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:`var(--vscode-editor-foreground, ${m?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${m?"#111827":"#ffffff"})`},children:[
17
17
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
18
- /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:Ke}}),
19
- /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:Ue})]}),
20
- /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
21
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":he,onClick:()=>ve(e=>!e),onMouseEnter:e=>et(e,he?Me("common.expand")||"Expand":Me("common.collapse")||"Collapse"),onFocus:e=>et(e,he?Me("common.expand")||"Expand":Me("common.collapse")||"Collapse"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{style:{rotate:he?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),L&&f&&/* @__PURE__ */n(t,{children:[
22
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le<=10,onClick:()=>Te(e=>Math.max(10,e-1)),onMouseEnter:e=>et(e,Me("common.decrease")||"Decrease"),onFocus:e=>et(e,Me("common.decrease")||"Decrease"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
23
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le===Ne,onClick:()=>Te(Ne),onMouseEnter:e=>et(e,Me("common.reset")||"Reset"),onFocus:e=>et(e,Me("common.reset")||"Reset"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
18
+ /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:qe}}),
19
+ /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:Ye})]}),
20
+ /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[L&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":ve,onClick:()=>ye(e=>!e),onMouseEnter:e=>tt(e,ve?Ne("common.expand")||"Expand":Ne("common.collapse")||"Collapse"),onFocus:e=>tt(e,ve?Ne("common.expand")||"Expand":Ne("common.collapse")||"Collapse"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",{style:{rotate:ve?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),T&&f&&/* @__PURE__ */n(t,{children:[
21
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Te<=10,onClick:()=>Ee(e=>Math.max(10,e-1)),onMouseEnter:e=>tt(e,Ne("common.decrease")||"Decrease"),onFocus:e=>tt(e,Ne("common.decrease")||"Decrease"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
22
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Te===Be,onClick:()=>Ee(Be),onMouseEnter:e=>tt(e,Ne("common.reset")||"Reset"),onFocus:e=>tt(e,Ne("common.reset")||"Reset"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
24
23
  /* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
25
24
  /* @__PURE__ */e("path",{d:"M3 3v5h5"})]})})}),
26
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Le>=36,onClick:()=>Te(e=>Math.min(36,e+1)),onMouseEnter:e=>et(e,Me("common.increase")||"Increase"),onFocus:e=>et(e,Me("common.increase")||"Increase"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),M&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy",onClick:nt,onMouseEnter:e=>et(e,ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy"),onFocus:e=>et(e,ae?Me("common.copied")||"Copied":Me("common.copy")||"Copy"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",ae?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
25
+ /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Te>=36,onClick:()=>Ee(e=>Math.min(36,e+1)),onMouseEnter:e=>tt(e,Ne("common.increase")||"Increase"),onFocus:e=>tt(e,Ne("common.increase")||"Increase"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),M&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":ce?Ne("common.copied")||"Copied":Ne("common.copy")||"Copy",onClick:rt,onMouseEnter:e=>tt(e,ce?Ne("common.copied")||"Copied":Ne("common.copy")||"Copy"),onFocus:e=>tt(e,ce?Ne("common.copied")||"Copied":Ne("common.copy")||"Copy"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",ce?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
27
26
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
28
- /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),N&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":se,onClick:()=>me(e=>!e),onMouseEnter:e=>et(e,se?Me("common.collapse")||"Collapse":Me("common.expand")||"Expand"),onFocus:e=>et(e,se?Me("common.collapse")||"Collapse":Me("common.expand")||"Expand"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",se?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})})}),qe&&B&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Me("common.preview")||"Preview",onClick:rt,onMouseEnter:e=>et(e,Me("common.preview")||"Preview"),onFocus:e=>et(e,Me("common.preview")||"Preview"),onMouseLeave:tt,onBlur:tt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */n("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
27
+ /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),N&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":me,onClick:()=>he(e=>!e),onMouseEnter:e=>tt(e,me?Ne("common.collapse")||"Collapse":Ne("common.expand")||"Expand"),onFocus:e=>tt(e,me?Ne("common.collapse")||"Collapse":Ne("common.expand")||"Expand"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",me?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})})}),Ue&&B&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":Ne("common.preview")||"Preview",onClick:ot,onMouseEnter:e=>tt(e,Ne("common.preview")||"Preview"),onFocus:e=>tt(e,Ne("common.preview")||"Preview"),onMouseLeave:nt,onBlur:nt,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */n("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
29
28
  /* @__PURE__ */e("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),
30
29
  /* @__PURE__ */e("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})]})})})]})]}),
31
- /* @__PURE__ */n("div",{className:`code-block-body${he?" code-block-body--collapsed":""}${se?" code-block-body--expanded":""}`,children:[!he&&(!!p||!h)&&(V?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n(t,{children:[
32
- /* @__PURE__ */e("div",{ref:E,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:Q?"visible":"hidden"},"aria-hidden":!Q}),!Q&&/* @__PURE__ */e("div",{style:{position:"absolute",inset:0,overflow:"auto",padding:"1rem"},children:/* @__PURE__ */e("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${Ue}`,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(Ye)})})})]})),!p&&h&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
30
+ /* @__PURE__ */n("div",{className:`code-block-body${ve?" code-block-body--collapsed":""}${me?" code-block-body--expanded":""}`,children:[!ve&&(!!p||!h)&&(K?/* @__PURE__ */e(Ie,{node:u}):/* @__PURE__ */n(t,{children:[
31
+ /* @__PURE__ */e("div",{ref:S,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:ne?"visible":"hidden"},"aria-hidden":!ne}),!ne&&/* @__PURE__ */e("div",{style:{position:"absolute",inset:0,overflow:"auto",padding:"1rem"},children:/* @__PURE__ */e("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${Ye}`,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(Ze)})})})]})),!p&&h&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
33
32
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
34
33
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
35
- /* @__PURE__ */e("div",{className:"skeleton-line short"})]})})]}),ye&&!a.onPreviewCode&&qe&&"html"===Ve&&/* @__PURE__ */e(we,{code:String(null!=(l=u.code)?l:""),isDark:m,onClose:()=>xe(!1)}),
36
- /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:ae?Me("common.copied")||"Copied":""})]})}function He(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=He(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ze(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=He(e))&&(r&&(r+=" "),r+=t);return r}const Ve=()=>import("@terrastruct/d2");let Xe=null,Ke=Ve;function qe(e){Ke=e,Xe=null}function Ue(e){qe(null!=e?e:Ve)}function Ye(){qe(null)}function Ze(){return"function"==typeof Ke}const Ge={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Je={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"},Qe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],et=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function tt(e){if(!e)return"";const t=e.trim();return et.test(t)?t:""}function nt(r){var l,a;const u={...Ge,...r},{t:m}=X(),[h,p]=i(!1),[g,f]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,M]=i(""),[N,B]=i(null),[L,T]=i(!1),E=c(0),S=c(null),D=c(!1),$=c(!1),_=c(0),j=c(null),A=c(!1),W=c(null),O=c(null),P=c(!1),I=c(()=>{}),R=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",F=w||!y||!C,H=!!C,z=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),V=o(()=>{if(N)return{minHeight:`${N}px`}},[N]);s(()=>{P.current=L},[L]);const K=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),q=d((e=!1)=>{if(D.current||"undefined"==typeof window)return;if($.current)return;if(P.current)return void(A.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-_.current;if(!e&&n<t)return A.current=!0,void(null==j.current&&(j.current=window.setTimeout(()=>{j.current=null,A.current&&(A.current=!1,q(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,_.current=Date.now(),I.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs]),U=d(async()=>{if(S.current)return S.current;const e=await async function(){if(Xe)return Xe;const e=Ke;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Ve)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Xe=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),Xe):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?S.current=t:"function"==typeof e.compile&&(S.current=e),S.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(S.current=new e.D2,S.current):("function"==typeof e.compile&&(S.current=e),S.current)},[]),Y=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||$.current)return;if(u.loading&&!u.progressiveRender)return;if(!R)return M(""),void b(null);const i=++E.current;T(!0),b(null);try{const l=await U();if(!l)return x(!1),v(!0),M(""),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(R);if(i!==E.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={...Je,...e||{}}}const p=await l.render(c,h);if(i!==E.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 f=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(Qe.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=tt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.outerHTML}(g);M(f||""),u.loading&&v(!1),b(null)}catch(l){if(i!==E.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),v(!0))}finally{i===E.current&&(T(!1),A.current&&(A.current=!1,q()))}},[R,U,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,q]);s(()=>{I.current=Y},[Y]);const Z=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(R),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[R]),G=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]),J=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),Q=d(()=>{te()},[]);return s(()=>{q()},[R,u.loading,u.isDark,q]),s(()=>{u.loading||q(!0)},[u.loading,q]),s(()=>{const e=requestAnimationFrame(()=>K());return()=>cancelAnimationFrame(e)},[F,C,R,K]),s(()=>{q();const e=requestAnimationFrame(()=>K());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{K()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;$.current=!0,null!=j.current&&(clearTimeout(j.current),j.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[q,K]),/* @__PURE__ */n("div",{className:ze("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__ */n("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__ */e("div",{className:"skeleton-line short"})]})})]}),xe&&!c.onPreviewCode&&Ue&&"html"===Xe&&/* @__PURE__ */e(we,{code:String(null!=(l=u.code)?l:""),isDark:m,onClose:()=>be(!1)}),
35
+ /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:ce?Ne("common.copied")||"Copied":""})]})}function He(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=He(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ze(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=He(e))&&(r&&(r+=" "),r+=t);return r}const Ve=()=>import("@terrastruct/d2");let Xe=null,Ke=Ve;function qe(e){Ke=e,Xe=null}function Ue(e){qe(null!=e?e:Ve)}function Ye(){qe(null)}function Ze(){return"function"==typeof Ke}const Ge={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Je={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"},Qe=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],et=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function tt(e){if(!e)return"";const t=e.trim();return et.test(t)?t:""}function nt(r){var l,c;const u={...Ge,...r},{t:m}=X(),[h,p]=i(!1),[g,f]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,M]=i(""),[N,B]=i(null),[L,T]=i(!1),E=a(0),S=a(null),D=a(!1),$=a(!1),_=a(0),j=a(null),A=a(!1),P=a(null),W=a(null),O=a(!1),I=a(()=>{}),R=null!=(c=null==(l=u.node)?void 0:l.code)?c:"",F=w||!y||!C,H=!!C,z=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),V=o(()=>{if(N)return{minHeight:`${N}px`}},[N]);s(()=>{O.current=L},[L]);const K=d(()=>{const e=P.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),q=d((e=!1)=>{if(D.current||"undefined"==typeof window)return;if($.current)return;if(O.current)return void(A.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-_.current;if(!e&&n<t)return A.current=!0,void(null==j.current&&(j.current=window.setTimeout(()=>{j.current=null,A.current&&(A.current=!1,q(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,_.current=Date.now(),I.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs]),U=d(async()=>{if(S.current)return S.current;const e=await async function(){if(Xe)return Xe;const e=Ke;if(!e)return null;let t;try{t=await e()}catch(n){if(e===Ve)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Xe=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),Xe):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?S.current=t:"function"==typeof e.compile&&(S.current=e),S.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(S.current=new e.D2,S.current):("function"==typeof e.compile&&(S.current=e),S.current)},[]),Y=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||$.current)return;if(u.loading&&!u.progressiveRender)return;if(!R)return M(""),void b(null);const i=++E.current;T(!0),b(null);try{const l=await U();if(!l)return x(!1),v(!0),M(""),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(R);if(i!==E.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={...Je,...e||{}}}const p=await l.render(c,h);if(i!==E.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 f=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(Qe.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=tt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.outerHTML}(g);M(f||""),u.loading&&v(!1),b(null)}catch(l){if(i!==E.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),v(!0))}finally{i===E.current&&(T(!1),A.current&&(A.current=!1,q()))}},[R,U,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,q]);s(()=>{I.current=Y},[Y]);const Z=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(R),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[R]),G=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]),J=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&ee(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),Q=d(()=>{te()},[]);return s(()=>{q()},[R,u.loading,u.isDark,q]),s(()=>{u.loading||q(!0)},[u.loading,q]),s(()=>{const e=requestAnimationFrame(()=>K());return()=>cancelAnimationFrame(e)},[F,C,R,K]),s(()=>{q();const e=requestAnimationFrame(()=>K());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{K()});W.current=e,P.current&&e.observe(P.current)}return()=>{var t;$.current=!0,null!=j.current&&(clearTimeout(j.current),j.current=null),null==(t=W.current)||t.disconnect(),W.current=null,cancelAnimationFrame(e)}},[q,K]),/* @__PURE__ */n("div",{className:ze("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__ */n("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:[
37
36
  /* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
38
37
  /* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */n("div",{className:ze("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
39
38
  /* @__PURE__ */e("button",{type:"button",className:ze("mode-btn px-2 py-1 text-xs rounded",!w&&"is-active"),onClick:()=>v(!1),onMouseEnter:e=>J(e,m("common.preview")||"Preview"),onFocus:e=>J(e,m("common.preview")||"Preview"),onMouseLeave:Q,onBlur:Q,children:m("common.preview")||"Preview"}),
40
39
  /* @__PURE__ */e("button",{type:"button",className:ze("mode-btn px-2 py-1 text-xs rounded",w&&"is-active"),onClick:()=>v(!0),onMouseEnter:e=>J(e,m("common.source")||"Source"),onFocus:e=>J(e,m("common.source")||"Source"),onMouseLeave:Q,onBlur:Q,children:m("common.source")||"Source"})]}),u.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":h?m("common.copied")||"Copied":m("common.copy")||"Copy",onClick:Z,onMouseEnter:e=>J(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onFocus:e=>J(e,h?m("common.copied")||"Copied":m("common.copy")||"Copy"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",h?{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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{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__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
41
40
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
42
- /* @__PURE__ */e("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__ */e("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:G,onMouseEnter:e=>J(e,m("common.export")||"Export"),onFocus:e=>J(e,m("common.export")||"Export"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("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__ */e("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__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":g,onClick:()=>f(e=>!e),onMouseEnter:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${g?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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})})]})]}),!g&&/* @__PURE__ */e("div",{ref:W,className:"d2-block-body",style:V,children:u.loading&&!H?/* @__PURE__ */n("div",{className:"d2-source px-4 py-4",children:[
41
+ /* @__PURE__ */e("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__ */e("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:G,onMouseEnter:e=>J(e,m("common.export")||"Export"),onFocus:e=>J(e,m("common.export")||"Export"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("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__ */e("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__ */e("button",{type:"button",className:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":g,onClick:()=>f(e=>!e),onMouseEnter:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>J(e,g?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${g?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__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})})]})]}),!g&&/* @__PURE__ */e("div",{ref:P,className:"d2-block-body",style:V,children:u.loading&&!H?/* @__PURE__ */n("div",{className:"d2-source px-4 py-4",children:[
43
42
  /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:R})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */e(t,{children:/* @__PURE__ */n("div",F?{className:"d2-source px-4 py-4",children:[
44
43
  /* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:R})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:z,children:[
45
44
  /* @__PURE__ */e("div",{className:"d2-svg",dangerouslySetInnerHTML:{__html:C}}),k&&/* @__PURE__ */e("p",{className:"d2-error px-4 pb-3 text-xs",children:k})]})})})]})}function rt(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
@@ -53,22 +52,22 @@ return e("div",{id:`footnote-${n.id}`,className:"footnote-node flex mt-2 mb-2 te
53
52
  return e("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:l,children:/* @__PURE__ */n("a",{href:i,title:`View footnote ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function st(t){/* @__PURE__ */
54
53
  return e("br",{className:"hard-break"})}function dt(t){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=t,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__ */
55
54
  return e(c,{dir:"auto",className:ze("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?C(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function ut(t){/* @__PURE__ */
56
- return e("mark",{className:"highlight-node",children:t.children})}const mt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),ht=/* @__PURE__ */new Set(["script"]),pt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function gt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const ft=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),wt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function vt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function yt(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=vt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function xt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();mt.has(e)||pt.has(e)&&r&&gt(r)||(t[n]=r)}return t}function kt(e,t){const n=e.toLowerCase();return!ft.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function bt(l){const{node:a,placeholder:d,customId:m}=l,h=D(),[p,g]=i(null),f=c(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(a.content),k=Boolean(a.loading),C=u(W,O,O),M=o(()=>{var e;return null!=(e=l.customComponents)?e:I(m)},[m,l.customComponents,C]);s(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=f.current)||e.destroy(),f.current=null,!k)return v(!0),void x(a.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return f.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),f.current=null}},[p,k,a.content,h]),s(()=>()=>{var e;null==(e=f.current)||e.destroy(),f.current=null},[]),s(()=>{k&&!w||x(a.content)},[k,a.content,w]);const N=o(()=>{var e;return b(null!=(e=a.attrs)?e:void 0)},[a.attrs]),B=o(()=>{var e;return function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(kt(r[1],t))return!0;return!1}(null!=(e=a.content)?e:"",M)},[M,a.content]),L=o(()=>B&&a.content?function(e,t){if(!e)return[];try{const n=function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){i<e.length&&e.slice(i).trim()&&o.push({type:"text",content:e.slice(i)});break}if(l>i){const t=e.slice(i,l);t.trim()&&o.push({type:"text",content:t})}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s)o.push({type:"tag_close",tagName:c.slice(1).trim()});else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||wt.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e);let o=0;const i=[],l=[];for(const e of n)if("text"===e.type){if(i.length>0&&i[i.length-1].blocked)continue;(i.length>0?i[i.length-1].children:l).push(e.content)}else if("self_closing"===e.type){if(ht.has(e.tagName.toLowerCase()))continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;s?(i.length>0?i[i.length-1].children:l).push(r.createElement(s,{...n,key:c})):(i.length>0?i[i.length-1].children:l).push(r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:ht.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);i.length>0?i[i.length-1].children.push(d):l.push(d)}}for(;i.length>0;){const e=i.pop();if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(a.content,M):null,[M,a.content,B]);/* @__PURE__ */
55
+ return e("mark",{className:"highlight-node",children:t.children})}const mt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),ht=/* @__PURE__ */new Set(["script"]),pt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function gt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const ft=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),wt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function vt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function yt(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=vt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function xt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();mt.has(e)||pt.has(e)&&r&&gt(r)||(t[n]=r)}return t}function kt(e,t){const n=e.toLowerCase();return!ft.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function bt(l){const{node:c,placeholder:d,customId:m}=l,h=D(),[p,g]=i(null),f=a(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(c.content),k=Boolean(c.loading),C=u(P,W,W),M=o(()=>{var e;return null!=(e=l.customComponents)?e:I(m)},[m,l.customComponents,C]);s(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=f.current)||e.destroy(),f.current=null,!k)return v(!0),void x(c.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return f.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),f.current=null}},[p,k,c.content,h]),s(()=>()=>{var e;null==(e=f.current)||e.destroy(),f.current=null},[]),s(()=>{k&&!w||x(c.content)},[k,c.content,w]);const N=o(()=>{var e;return b(null!=(e=c.attrs)?e:void 0)},[c.attrs]),B=o(()=>{var e;return function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(kt(r[1],t))return!0;return!1}(null!=(e=c.content)?e:"",M)},[M,c.content]),L=o(()=>B&&c.content?function(e,t){if(!e)return[];try{const n=function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){i<e.length&&e.slice(i).trim()&&o.push({type:"text",content:e.slice(i)});break}if(l>i){const t=e.slice(i,l);t.trim()&&o.push({type:"text",content:t})}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s)o.push({type:"tag_close",tagName:c.slice(1).trim()});else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||wt.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e);let o=0;const i=[],l=[];for(const e of n)if("text"===e.type){if(i.length>0&&i[i.length-1].blocked)continue;(i.length>0?i[i.length-1].children:l).push(e.content)}else if("self_closing"===e.type){if(ht.has(e.tagName.toLowerCase()))continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;s?(i.length>0?i[i.length-1].children:l).push(r.createElement(s,{...n,key:c})):(i.length>0?i[i.length-1].children:l).push(r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:ht.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);i.length>0?i[i.length-1].children.push(d):l.push(d)}}for(;i.length>0;){const e=i.pop();if(e.blocked)continue;const n=xt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=kt(e.tagName,t)?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...n,key:c},...e.children):r.createElement(e.tagName,{...yt(n),key:c,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(c.content,M):null,[M,c.content,B]);/* @__PURE__ */
57
56
  return e("div",{ref:g,className:"html-block-node",...N,children:w?B&&L?/* @__PURE__ */e(t,{children:L}):/* @__PURE__ */e("div",{dangerouslySetInnerHTML:{__html:null!=y?y:""}}):/* @__PURE__ */e("div",{className:"html-block-node__placeholder",children:null!=d?d:/* @__PURE__ */n(t,{children:[
58
57
  /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar"}),
59
58
  /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-4/5"}),
60
- /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const Ct=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),Mt=/* @__PURE__ */new Set(["script"]),Nt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Bt=(()=>{try{return Boolean(!1)}catch{}return!1})();function Lt(e){Bt&&console.warn(e)}function Tt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const Et=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),St=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Dt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function $t(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=Dt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function _t(e,t){const n=e.toLowerCase();return!St.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function jt(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return"true"===e||""===e||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const t=Number(e);if(""!==e&&!Number.isNaN(t))return t}return e}function At(e){return e.trim().length>0}function Wt(e,t,n,o,i){if(Mt.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();Ct.has(e)||Nt.has(e)&&r&&Tt(r)||(t[n]=r)}return t}(t),a=l.key,c=null!=a&&""!==a?a:i;if(_t(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=jt(r,n);return t}(l);return r.createElement(t,{...i,key:c},...n)}return r.createElement(e,{...$t(l),key:c},...n)}function Ot(t){const{node:n,customId:o}=t,l=c(null),[a,d]=i(!1);s(()=>{d(!0)},[]);const u=I(o),m=r.useMemo(()=>{const e=n.content;if(!e)return{mode:"html",content:""};if(!function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(_t(r[1],t))return!0;return!1}(e,u))return{mode:"html",content:e};const t=function(e,t){if(!e)return[];try{const n=function(e,t){let n=0;const r=[],o=[];for(const i of e)if("text"===i.type)(r.length>0?r[r.length-1].children:o).push(i.content);else if("self_closing"===i.type){const e=Wt(i.tagName,i.attrs||{},[],t,"ms-html-"+n++),l=r.length>0?r[r.length-1].children:o;null!=e&&l.push(e)}else if("tag_open"===i.type)r.push({tagName:i.tagName,children:[],attrs:i.attrs});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let l=-1;for(let t=r.length-1;t>=0;t--)if(r[t].tagName.toLowerCase()===e){l=t;break}if(-1!==l)for(;r.length>l;){const i=r.pop(),a=Wt(i.tagName,i.attrs||{},i.children,t,"ms-html-"+n++);r.length>0?null!=a&&r[r.length-1].children.push(a):null!=a&&o.push(a),i.tagName.toLowerCase()!==e&&r.length>l&&Lt(`Auto-closing unclosed tag: <${i.tagName}>`)}else Lt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=Wt(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),Lt(`Auto-closing unclosed tag: <${e.tagName}>`)}return o}(function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){if(i<e.length){const t=e.slice(i);At(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);At(t)&&o.push({type:"text",content:t})}if(e.startsWith("![CDATA[",l+1)){const t=e.indexOf("]]>",l);if(-1!==t){o.push({type:"text",content:e.slice(l,t+3)}),i=t+3;continue}break}if(e.startsWith("!",l+1)){const t=e.indexOf(">",l);if(-1!==t){i=t+1;continue}break}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s){const e=c.slice(1).trim();o.push({type:"tag_close",tagName:e})}else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||Et.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e),t);return n}catch(r){return n=r,Bt&&console.error("Failed to parse HTML to React nodes:",n),null}var n}(e,u);return null===t?{mode:"html",content:e}:{mode:"dynamic",nodes:t}},[n.content,u]);return s(()=>{var e;if(!a||!l.current||"html"!==m.mode)return;const t=l.current;t.innerHTML="";const r=document.createElement("template");r.innerHTML=null!=(e=n.content)?e:"",t.appendChild(r.content.cloneNode(!0))},[n.content,m.mode,a]),n.loading&&!n.autoClosed?/* @__PURE__ */e("span",{className:"html-inline-node html-inline-node--loading",children:n.content}):"dynamic"===m.mode?/* @__PURE__ */e("span",{className:"html-inline-node",style:{display:"inline"},children:m.nodes}):/* @__PURE__ */e("span",{ref:l,className:"html-inline-node",style:{display:"inline"}})}const Pt={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function It(r){var l,a,d,u,m,h;const p={...Pt,...r},g=D(),[f,w]=i(null),v=c(null),[y,x]=i(()=>"undefined"==typeof window||!1===p.lazy),[k,b]=i(!1),[C,M]=i(!1),[N,B]=i(!1);s(()=>{var e;if(!p.lazy)return;const t=f;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=g(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[f,g,p.lazy]),s(()=>()=>{var e;null==(e=v.current)||e.destroy(),v.current=null},[]);const L=o(()=>C&&p.fallbackSrc?p.fallbackSrc:p.node.src,[C,p.fallbackSrc,p.node.src]);s(()=>{b(!1),M(!1)},[L]),s(()=>{B(!1)},[p.node.src]);const T=o(()=>/\.svg(?:\?|$)/i.test(String(L)),[L]),E=!p.lazy||y,S=T?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
59
+ /* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const Ct=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onreset","onsearch","onsubmit"]),Mt=/* @__PURE__ */new Set(["script"]),Nt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Bt=(()=>{try{return Boolean(!1)}catch{}return!1})();function Lt(e){Bt&&console.warn(e)}function Tt(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const Et=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),St=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Dt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function $t(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=Dt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function _t(e,t){const n=e.toLowerCase();return!St.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function jt(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return"true"===e||""===e||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const t=Number(e);if(""!==e&&!Number.isNaN(t))return t}return e}function At(e){return e.trim().length>0}function Pt(e,t,n,o,i){if(Mt.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();Ct.has(e)||Nt.has(e)&&r&&Tt(r)||(t[n]=r)}return t}(t),a=l.key,c=null!=a&&""!==a?a:i;if(_t(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=jt(r,n);return t}(l);return r.createElement(t,{...i,key:c},...n)}return r.createElement(e,{...$t(l),key:c},...n)}function Wt(t){const{node:n,customId:o}=t,l=a(null),[c,d]=i(!1);s(()=>{d(!0)},[]);const u=I(o),m=r.useMemo(()=>{const e=n.content;if(!e)return{mode:"html",content:""};if(!function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(_t(r[1],t))return!0;return!1}(e,u))return{mode:"html",content:e};const t=function(e,t){if(!e)return[];try{const n=function(e,t){let n=0;const r=[],o=[];for(const i of e)if("text"===i.type)(r.length>0?r[r.length-1].children:o).push(i.content);else if("self_closing"===i.type){const e=Pt(i.tagName,i.attrs||{},[],t,"ms-html-"+n++),l=r.length>0?r[r.length-1].children:o;null!=e&&l.push(e)}else if("tag_open"===i.type)r.push({tagName:i.tagName,children:[],attrs:i.attrs});else if("tag_close"===i.type){const e=i.tagName.toLowerCase();let l=-1;for(let t=r.length-1;t>=0;t--)if(r[t].tagName.toLowerCase()===e){l=t;break}if(-1!==l)for(;r.length>l;){const i=r.pop(),a=Pt(i.tagName,i.attrs||{},i.children,t,"ms-html-"+n++);r.length>0?null!=a&&r[r.length-1].children.push(a):null!=a&&o.push(a),i.tagName.toLowerCase()!==e&&r.length>l&&Lt(`Auto-closing unclosed tag: <${i.tagName}>`)}else Lt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=Pt(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),Lt(`Auto-closing unclosed tag: <${e.tagName}>`)}return o}(function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const l=e.indexOf("<",i);if(-1===l){if(i<e.length){const t=e.slice(i);At(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);At(t)&&o.push({type:"text",content:t})}if(e.startsWith("![CDATA[",l+1)){const t=e.indexOf("]]>",l);if(-1!==t){o.push({type:"text",content:e.slice(l,t+3)}),i=t+3;continue}break}if(e.startsWith("!",l+1)){const t=e.indexOf(">",l);if(-1!==t){i=t+1;continue}break}const a=e.indexOf(">",l);if(-1===a)break;const c=e.slice(l+1,a).trim(),s=c.startsWith("/"),d=c.endsWith("/");if(s){const e=c.slice(1).trim();o.push({type:"tag_close",tagName:e})}else{const e=c.indexOf(" ");let i,l="";-1===e?i=d?c.slice(0,-1).trim():c.trim():(i=c.slice(0,e).trim(),l=c.slice(e+1));const a={};if(l){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(l));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||Et.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e),t);return n}catch(r){return n=r,Bt&&console.error("Failed to parse HTML to React nodes:",n),null}var n}(e,u);return null===t?{mode:"html",content:e}:{mode:"dynamic",nodes:t}},[n.content,u]);return s(()=>{var e;if(!c||!l.current||"html"!==m.mode)return;const t=l.current;t.innerHTML="";const r=document.createElement("template");r.innerHTML=null!=(e=n.content)?e:"",t.appendChild(r.content.cloneNode(!0))},[n.content,m.mode,c]),n.loading&&!n.autoClosed?/* @__PURE__ */e("span",{className:"html-inline-node html-inline-node--loading",children:n.content}):"dynamic"===m.mode?/* @__PURE__ */e("span",{className:"html-inline-node",style:{display:"inline"},children:m.nodes}):/* @__PURE__ */e("span",{ref:l,className:"html-inline-node",style:{display:"inline"}})}const Ot={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function It(r){var l,c,d,u,m,h;const p={...Ot,...r},g=D(),[f,w]=i(null),v=a(null),[y,x]=i(()=>"undefined"==typeof window||!1===p.lazy),[k,b]=i(!1),[C,M]=i(!1),[N,B]=i(!1);s(()=>{var e;if(!p.lazy)return;const t=f;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=g(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[f,g,p.lazy]),s(()=>()=>{var e;null==(e=v.current)||e.destroy(),v.current=null},[]);const L=o(()=>C&&p.fallbackSrc?p.fallbackSrc:p.node.src,[C,p.fallbackSrc,p.node.src]);s(()=>{b(!1),M(!1)},[L]),s(()=>{B(!1)},[p.node.src]);const T=o(()=>/\.svg(?:\?|$)/i.test(String(L)),[L]),E=!p.lazy||y,S=T?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
61
60
  return n("figure",{ref:w,className:"image-node",children:[
62
61
  /* @__PURE__ */e("div",{className:"image-node__inner",children:p.node.loading||C||!E?C?/* @__PURE__ */n("div",{className:"image-node__error",children:[
63
62
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */e("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"})}),
64
63
  /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]}):/* @__PURE__ */e("div",{className:"image-node__placeholder",style:S,children:p.usePlaceholder?/* @__PURE__ */n(t,{children:[
65
64
  /* @__PURE__ */e("span",{className:"image-node__spinner","aria-hidden":"true"}),
66
- /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:null!=(h=p.node.raw)?h:"Loading image…"})},"placeholder"):/* @__PURE__ */e("img",{src:L,alt:String(null!=(a=null!=(l=p.node.alt)?l:p.node.title)?a:""),title:String(null!=(u=null!=(d=p.node.title)?d:p.node.alt)?u:""),className:"image-node__img"+(k?" is-loaded":""),style:T?{minHeight:p.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:p.lazy?"lazy":"eager",decoding:"async",tabIndex:k?0:-1,"aria-label":null!=(m=p.node.alt)?m:"Preview image",onError:()=>{var e;p.fallbackSrc&&!N?(B(!0),M(!0)):(M(!0),null==(e=p.onError)||e.call(p,p.node.src))},onLoad:()=>{var e;b(!0),M(!1),null==(e=p.onLoad)||e.call(p,L)},onClick:e=>{var t;e.preventDefault(),k&&!C&&(null==(t=p.onClick)||t.call(p,[e,L]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */e("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let Rt=null,Ft=null;const Ht=/* @__PURE__ */e("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__ */n("g",{children:[
65
+ /* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:null!=(h=p.node.raw)?h:"Loading image…"})},"placeholder"):/* @__PURE__ */e("img",{src:L,alt:String(null!=(c=null!=(l=p.node.alt)?l:p.node.title)?c:""),title:String(null!=(u=null!=(d=p.node.title)?d:p.node.alt)?u:""),className:"image-node__img"+(k?" is-loaded":""),style:T?{minHeight:p.svgMinHeight,width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:p.lazy?"lazy":"eager",decoding:"async",tabIndex:k?0:-1,"aria-label":null!=(m=p.node.alt)?m:"Preview image",onError:()=>{var e;p.fallbackSrc&&!N?(B(!0),M(!0)):(M(!0),null==(e=p.onError)||e.call(p,p.node.src))},onLoad:()=>{var e;b(!0),M(!1),null==(e=p.onLoad)||e.call(p,L)},onClick:e=>{var t;e.preventDefault(),k&&!C&&(null==(t=p.onClick)||t.call(p,[e,L]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */e("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let Rt=null,Ft=null;const Ht=/* @__PURE__ */e("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__ */n("g",{children:[
67
66
  /* @__PURE__ */e("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"}),
68
67
  /* @__PURE__ */e("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"}),
69
68
  /* @__PURE__ */e("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"}),
70
69
  /* @__PURE__ */e("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"}),
71
- /* @__PURE__ */e("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"})]})}),zt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Vt(r){const o={...zt,...r},{t:l}=X(),[a,u]=i(!1),[m,h]=i(!1),[p,g]=i(!1),[f,w]=i("360px"),[v,y]=i(!1),[k,b]=i(1),[C,M]=i({x:0,y:0}),[N,B]=i(!1),L=c(null),T=c(null),E=c(null),S=c({x:0,y:0}),D=c(null),$=o.node.code,_=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText($)),u(!0),null==(t=o.onCopy)||t.call(o,$),setTimeout(()=>u(!1),1e3)}catch{}},[$,o]),j=d(async()=>{var e,t;if(!L.current)return;const n=L.current;try{const r=await async function(){return Ft||Rt||(Rt=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),Ft=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Rt)}();if(!r)return void console.warn("Infographic library failed to load.");D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});D.current=o,o.render($),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&w(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[$]);s(()=>{p||m||j()},[$,p,m,j]),s(()=>()=>{var e,t;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const A=d(()=>{y(!1),T.current&&(T.current.innerHTML=""),E.current=null,document.body.style.overflow=""},[]),W=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&A()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,A]),s(()=>{v&&setTimeout(()=>{if(L.current&&T.current){T.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=L.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),T.current.appendChild(e),E.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&E.current&&(E.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const O=d(()=>{var e;const t=null==(e=L.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)},[]),P=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;S.current={x:t-C.x,y:n-C.y}},I=e=>{if(!N)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;M({x:t-S.current.x,y:n-S.current.y})},R=()=>B(!1),F=o.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",H=p||m;/* @__PURE__ */
70
+ /* @__PURE__ */e("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"})]})}),zt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Vt(r){const o={...zt,...r},{t:l}=X(),[c,u]=i(!1),[m,h]=i(!1),[p,g]=i(!1),[f,w]=i("360px"),[v,y]=i(!1),[k,b]=i(1),[C,M]=i({x:0,y:0}),[N,B]=i(!1),L=a(null),T=a(null),E=a(null),S=a({x:0,y:0}),D=a(null),$=o.node.code,_=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText($)),u(!0),null==(t=o.onCopy)||t.call(o,$),setTimeout(()=>u(!1),1e3)}catch{}},[$,o]),j=d(async()=>{var e,t;if(!L.current)return;const n=L.current;try{const r=await async function(){return Ft||Rt||(Rt=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),Ft=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Rt)}();if(!r)return void console.warn("Infographic library failed to load.");D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});D.current=o,o.render($),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&w(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[$]);s(()=>{p||m||j()},[$,p,m,j]),s(()=>()=>{var e,t;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const A=d(()=>{y(!1),T.current&&(T.current.innerHTML=""),E.current=null,document.body.style.overflow=""},[]),P=d(()=>{y(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!v)return;const e=e=>{"Escape"===e.key&&A()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,A]),s(()=>{v&&setTimeout(()=>{if(L.current&&T.current){T.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=L.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),T.current.appendChild(e),E.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&E.current&&(E.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const W=d(()=>{var e;const t=null==(e=L.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)},[]),O=e=>{B(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;S.current={x:t-C.x,y:n-C.y}},I=e=>{if(!N)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;M({x:t-S.current.x,y:n-S.current.y})},R=()=>B(!1),F=o.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",H=p||m;/* @__PURE__ */
72
71
  return n(t,{children:[
73
72
  /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":o.loading}),children:[o.showHeader&&/* @__PURE__ */n("div",{className:ze("flex justify-between items-center px-4 py-2.5 border-b",o.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
74
73
  /* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Ht,
@@ -81,123 +80,122 @@ return n(t,{children:[
81
80
  /* @__PURE__ */e("button",{className:ze("px-2.5 py-1 text-xs rounded transition-colors",p?o.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":o.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>g(!0),onMouseEnter:e=>ee(e.currentTarget,l("common.source")||"Source","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[
82
81
  /* @__PURE__ */e("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("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
83
82
  /* @__PURE__ */e("span",{children:l("common.source")||"Source"})]})})]}),
84
- /* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:F,onClick:()=>h(!m),onMouseEnter:e=>ee(e.currentTarget,m?l("common.expand")||"Expand":l("common.collapse")||"Collapse","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:m?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),o.showCopyButton&&/* @__PURE__ */e("button",{className:F,onClick:_,onMouseEnter:e=>ee(e.currentTarget,a?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",a?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
83
+ /* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:F,onClick:()=>h(!m),onMouseEnter:e=>ee(e.currentTarget,m?l("common.expand")||"Expand":l("common.collapse")||"Collapse","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:m?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),o.showCopyButton&&/* @__PURE__ */e("button",{className:F,onClick:_,onMouseEnter:e=>ee(e.currentTarget,c?l("common.copied")||"Copied":l("common.copy")||"Copy","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",c?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
85
84
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
86
- /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),o.showExportButton&&/* @__PURE__ */e("button",{className:ze(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:O,onMouseEnter:e=>ee(e.currentTarget,l("common.export")||"Export","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
85
+ /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),o.showExportButton&&/* @__PURE__ */e("button",{className:ze(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:W,onMouseEnter:e=>ee(e.currentTarget,l("common.export")||"Export","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
87
86
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
88
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:ze(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:W,onMouseEnter:e=>ee(e.currentTarget,v?l("common.minimize")||"Minimize":l("common.open")||"Open","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",v?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!m&&/* @__PURE__ */e("div",{children:p?/* @__PURE__ */e("div",{className:ze("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:ze("text-sm font-mono whitespace-pre-wrap",o.isDark?"text-gray-300":"text-gray-700"),children:$})}):/* @__PURE__ */n("div",{className:"relative",children:[o.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
87
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:ze(F,H&&"opacity-50 cursor-not-allowed"),disabled:H,onClick:P,onMouseEnter:e=>ee(e.currentTarget,v?l("common.minimize")||"Minimize":l("common.open")||"Open","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */e("svg",v?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!m&&/* @__PURE__ */e("div",{children:p?/* @__PURE__ */e("div",{className:ze("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:ze("text-sm font-mono whitespace-pre-wrap",o.isDark?"text-gray-300":"text-gray-700"),children:$})}):/* @__PURE__ */n("div",{className:"relative",children:[o.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
89
88
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.min(k+.1,3)),children:"+"}),
90
89
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.max(k-.1,.5)),children:"-"}),
91
90
  /* @__PURE__ */n("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{b(1),M({x:0,y:0})},children:[Math.round(100*k),"%"]})]})}),
92
- /* @__PURE__ */e("div",{className:ze("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:f},onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R,children:/* @__PURE__ */e("div",{className:ze("absolute inset-0 cursor-grab",N&&"cursor-grabbing"),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${k})`},children:/* @__PURE__ */e("div",{ref:L,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&x(
91
+ /* @__PURE__ */e("div",{className:ze("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:f},onMouseDown:O,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:O,onTouchMove:I,onTouchEnd:R,children:/* @__PURE__ */e("div",{className:ze("absolute inset-0 cursor-grab",N&&"cursor-grabbing"),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${k})`},children:/* @__PURE__ */e("div",{ref:L,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&x(
93
92
  /* @__PURE__ */e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:A,role:"dialog","aria-modal":"true",children:/* @__PURE__ */n("div",{className:ze("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",o.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
94
93
  /* @__PURE__ */n("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
95
94
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.min(k+.1,3)),children:"+"}),
96
95
  /* @__PURE__ */e("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>b(Math.max(k-.1,.5)),children:"-"}),
97
96
  /* @__PURE__ */n("button",{className:ze("p-2 text-xs rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{b(1),M({x:0,y:0})},children:[Math.round(100*k),"%"]}),
98
97
  /* @__PURE__ */e("button",{className:ze("inline-flex items-center justify-center p-2 rounded transition-colors",o.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:A,children:"X"})]}),
99
- /* @__PURE__ */e("div",{ref:T,className:ze("w-full h-full flex items-center justify-center p-4 overflow-hidden",!N&&"cursor-grab",N&&"cursor-grabbing"),onMouseDown:P,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:I,onTouchEnd:R})]})}),document.body)]})}function Xt(t){const{node:n}=t;/* @__PURE__ */
98
+ /* @__PURE__ */e("div",{ref:T,className:ze("w-full h-full flex items-center justify-center p-4 overflow-hidden",!N&&"cursor-grab",N&&"cursor-grabbing"),onMouseDown:O,onMouseMove:I,onMouseUp:R,onMouseLeave:R,onTouchStart:O,onTouchMove:I,onTouchEnd:R})]})}),document.body)]})}function Xt(t){const{node:n}=t;/* @__PURE__ */
100
99
  return e("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:n.code})}function Kt(t){/* @__PURE__ */
101
- return e("ins",{className:"insert-node",children:t.children})}function qt(t){var r,i,l,a,c;const{node:s,ctx:u,renderNode:m,indexKey:h}=t,p=!1!==t.showTooltip,g=null!=(r=t.isDark)?r:null==u?void 0:u.isDark,f=o(()=>{var e,n,r,o,i,l;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px";return{"--link-color":null!=(e=t.color)?e:"#0366d6","--underline-height":`${null!=(n=t.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(r=t.animationOpacity)?r:.9),"--underline-duration":`${null!=(o=t.animationDuration)?o:.8}s`,"--underline-timing":null!=(i=t.animationTiming)?i:"linear","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(l=t.animationIteration)?l:"infinite"}},[t.animationDuration,t.animationIteration,t.animationOpacity,t.animationTiming,t.color,t.underlineBottom,t.underlineHeight]),w=String(null!=(l=null!=(i=s.title)?i:s.href)?l:""),v=d(e=>{p&&ee(e.currentTarget,String(s.title||s.href||s.text||""),"top",!1,(e.clientX,e.clientY),g)},[g,s.href,s.text,s.title,p]),y=d(()=>{p&&te()},[p]);return s.loading?/* @__PURE__ */e("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */n("span",{className:"link-text-wrapper relative inline-flex",children:[
102
- /* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:null!=(a=s.text)?a:""})}),
103
- /* @__PURE__ */e("span",{className:"underline-anim","aria-hidden":"true"})]})}):/* @__PURE__ */e("a",{className:"link-node",href:s.href,title:p?"":w,"aria-label":`Link: ${w}`,target:"_blank",rel:"noopener noreferrer",style:f,onMouseEnter:v,onMouseLeave:y,children:u&&m?C(s.children,u,String(null!=h?h:"link"),m):null!=(c=s.text)?c:null})}function Ut(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
100
+ return e("ins",{className:"insert-node",children:t.children})}function qt(t){var r,i,l,a;const{node:c,ctx:s,renderNode:u,indexKey:m}=t,h=!1!==t.showTooltip,p=null!=(r=t.isDark)?r:null==s?void 0:s.isDark,g=o(()=>{var e,n,r,o,i,l;const a=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px";return{"--link-color":null!=(e=t.color)?e:"#0366d6","--underline-height":`${null!=(n=t.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(r=t.animationOpacity)?r:.9),"--underline-duration":`${null!=(o=t.animationDuration)?o:.8}s`,"--underline-timing":null!=(i=t.animationTiming)?i:"linear","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(l=t.animationIteration)?l:"infinite"}},[t.animationDuration,t.animationIteration,t.animationOpacity,t.animationTiming,t.color,t.underlineBottom,t.underlineHeight]),f="string"==typeof c.title&&c.title.trim().length>0?c.title:String(null!=(i=c.href)?i:""),w=d(e=>{h&&ee(e.currentTarget,String(c.title||c.href||c.text||""),"top",!1,(e.clientX,e.clientY),p)},[p,c.href,c.text,c.title,h]),v=d(()=>{h&&te()},[h]);return c.loading?/* @__PURE__ */e("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:g,children:/* @__PURE__ */n("span",{className:"link-text-wrapper relative inline-flex",children:[
101
+ /* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:null!=(l=c.text)?l:""})}),
102
+ /* @__PURE__ */e("span",{className:"underline-anim","aria-hidden":"true"})]})}):/* @__PURE__ */e("a",{className:"link-node",href:c.href,title:h?"":f,"aria-label":`Link: ${f}`,target:"_blank",rel:"noopener noreferrer",style:g,onMouseEnter:w,onMouseLeave:v,children:s&&u?C(c.children,s,String(null!=m?m:"link"),u):null!=(a=c.text)?a:null})}function Ut(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
104
103
  return e("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:r&&o?C(n.children,r,String(null!=l?l:"list-item"),o):null})}function Yt(t){var n;const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=r.ordered?"ol":"ul",c=r.ordered&&r.start?r.start:void 0,s=o&&I(o.customId).list_item||Ut;/* @__PURE__ */
105
104
  return e(a,{className:ze("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((t,n)=>{var a;/* @__PURE__ */
106
- return e(s,{node:t,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 Zt=null,Gt=null,Jt=!1;const Qt=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map;let tn=5;const nn=/* @__PURE__ */new Set;function rn(){if(Qt.size<tn&&nn.size){const e=Array.from(nn);nn.clear();for(const t of e)try{t()}catch{}}}function on(e){Zt=e,Gt=null,Zt.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Qt.get(t);if(o)if(Qt.delete(t),clearTimeout(o.timeoutId),rn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(en.set(e,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}o.resolve(n)}},Zt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Qt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Qt.clear(),rn()}}function ln(){var e;Zt&&(null==(e=Zt.terminate)||e.call(Zt)),Zt=null,Gt=null}function an(e){Jt=!!e,Zt&&Zt.postMessage({type:"init",debug:Jt})}const cn="WORKER_BUSY";async function sn(e,t=!0,n=2e3,r){if(performance.now(),Gt)return Promise.reject(Gt);const o=`${t?"d":"i"}:${e}`,i=en.get(o);if(i)return Promise.resolve(i);const l=Zt||(Gt=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Gt.name="WORKER_INIT_ERROR",Gt.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Gt);if(Qt.size>=tn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=cn,e.busy=!0,e.inFlight=Qt.size,e.max=tn,Promise.reject(e)}return new Promise((o,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const a=Math.random().toString(36).slice(2),c=setTimeout(()=>{Qt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),rn()},n),s=()=>{},d=()=>{Qt.delete(a),clearTimeout(c),nn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),rn()};r&&r.addEventListener("abort",d,{once:!0}),Qt.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{l.postMessage({id:a,content:e,displayMode:t,debug:Jt})}catch(u){Qt.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),rn()}})}function dn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(en.set(r,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}function un(){en.clear()}function mn(e){tn=Math.max(1,Math.floor(e)),rn()}function hn(e=1500,t){return Qt.size<tn?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(){nn.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}),nn.add(l)})}const pn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function gn(e){null!=e.timeout&&(pn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(pn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(pn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(pn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function fn(){return{...pn}}async function wn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:pn.timeout,c=null!=(o=n.waitTimeout)?o:pn.waitTimeout,s=null!=(i=n.backoffMs)?i:pn.backoffMs,d=null!=(l=n.maxRetries)?l:pn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):pn.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 sn(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==cn||h>=u)throw p;if(h++,await hn(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 vn=null,yn=!1;async function xn(){if(vn)return vn;if(yn)return null;try{return vn=await import("katex"),await import("katex/contrib/mhchem"),vn}catch{return yn=!0,null}}function kn({node:t}){const n=c(null),[r,o]=i(!0),l=c(0);return s(()=>{var e;let r=!1;const i=new AbortController,a=++l.current,c=null!=(e=t.content)?e:"";return c?(wn(c,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async e=>{if(r||a!==l.current)return;if(!n.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===cn||"WORKER_TIMEOUT"===i){const e=await xn();if(e)try{const i=e.renderToString(c,{throwOnError:t.loading,displayMode:!0});return void(!r&&a===l.current&&n.current&&(n.current.innerHTML=i,o(!1),dn(c,!0,i)))}catch{}}t.loading||(n.current.textContent=t.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[t.content,t.loading,t.raw]),/* @__PURE__ */e("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */e("div",{ref:n,className:r?"math-rendering":void 0})})}function bn({node:t}){const r=c(null),o=c(null),[l,a]=i(!0),d=c(0);return s(()=>{var e;let n=!1;const r=new AbortController,i=++d.current,l=null!=(e=t.content)?e:"";if(!l)return a(!1),()=>r.abort();const c="$$"===t.markup;return wn(l,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{n||i!==d.current||o.current&&(o.current.innerHTML=e,a(!1))}).catch(async e=>{if(n||i!==d.current)return;if(!o.current)return;const r=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===r||(null==e?void 0:e.fallbackToRenderer)||r===cn||"WORKER_TIMEOUT"===r){const e=await xn();if(e)try{const r=e.renderToString(l,{throwOnError:t.loading,displayMode:c});return void(!n&&i===d.current&&o.current&&(o.current.innerHTML=r,a(!1),dn(l,c,r)))}catch{}}t.loading||(o.current.textContent=t.raw,a(!1))}),()=>{n=!0,r.abort()}},[t.content,t.loading,t.raw,t.markup]),/* @__PURE__ */n("span",{ref:r,className:"math-inline-wrapper",children:[
105
+ return e(s,{node:t,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 Zt=null,Gt=null,Jt=!1;const Qt=/* @__PURE__ */new Map,en=/* @__PURE__ */new Map;let tn=5;const nn=/* @__PURE__ */new Set;function rn(){if(Qt.size<tn&&nn.size){const e=Array.from(nn);nn.clear();for(const t of e)try{t()}catch{}}}function on(e){Zt=e,Gt=null,Zt.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Qt.get(t);if(o)if(Qt.delete(t),clearTimeout(o.timeoutId),rn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(en.set(e,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}o.resolve(n)}},Zt.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Qt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Qt.clear(),rn()}}function ln(){var e;Zt&&(null==(e=Zt.terminate)||e.call(Zt)),Zt=null,Gt=null}function an(e){Jt=!!e,Zt&&Zt.postMessage({type:"init",debug:Jt})}const cn="WORKER_BUSY";async function sn(e,t=!0,n=2e3,r){if(performance.now(),Gt)return Promise.reject(Gt);const o=`${t?"d":"i"}:${e}`,i=en.get(o);if(i)return Promise.resolve(i);const l=Zt||(Gt=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Gt.name="WORKER_INIT_ERROR",Gt.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Gt);if(Qt.size>=tn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=cn,e.busy=!0,e.inFlight=Qt.size,e.max=tn,Promise.reject(e)}return new Promise((o,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const a=Math.random().toString(36).slice(2),c=setTimeout(()=>{Qt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),rn()},n),s=()=>{},d=()=>{Qt.delete(a),clearTimeout(c),nn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),rn()};r&&r.addEventListener("abort",d,{once:!0}),Qt.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{l.postMessage({id:a,content:e,displayMode:t,debug:Jt})}catch(u){Qt.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),rn()}})}function dn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(en.set(r,n),en.size>200){const e=en.keys().next().value;en.delete(e)}}function un(){en.clear()}function mn(e){tn=Math.max(1,Math.floor(e)),rn()}function hn(e=1500,t){return Qt.size<tn?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(){nn.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}),nn.add(l)})}const pn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function gn(e){null!=e.timeout&&(pn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(pn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(pn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(pn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function fn(){return{...pn}}async function wn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:pn.timeout,c=null!=(o=n.waitTimeout)?o:pn.waitTimeout,s=null!=(i=n.backoffMs)?i:pn.backoffMs,d=null!=(l=n.maxRetries)?l:pn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):pn.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 sn(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==cn||h>=u)throw p;if(h++,await hn(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 vn=null,yn=!1;async function xn(){if(vn)return vn;if(yn)return null;try{return vn=await import("katex"),await import("katex/contrib/mhchem"),vn}catch{return yn=!0,null}}function kn({node:t}){const n=a(null),[r,o]=i(!0),l=a(0);return s(()=>{var e;let r=!1;const i=new AbortController,a=++l.current,c=null!=(e=t.content)?e:"";return c?(wn(c,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async e=>{if(r||a!==l.current)return;if(!n.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===cn||"WORKER_TIMEOUT"===i){const e=await xn();if(e)try{const i=e.renderToString(c,{throwOnError:t.loading,displayMode:!0});return void(!r&&a===l.current&&n.current&&(n.current.innerHTML=i,o(!1),dn(c,!0,i)))}catch{}}t.loading||(n.current.textContent=t.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[t.content,t.loading,t.raw]),/* @__PURE__ */e("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */e("div",{ref:n,className:r?"math-rendering":void 0})})}function bn({node:t}){const r=a(null),o=a(null),[l,c]=i(!0),d=a(0);return s(()=>{var e;let n=!1;const r=new AbortController,i=++d.current,l=null!=(e=t.content)?e:"";if(!l)return c(!1),()=>r.abort();const a="$$"===t.markup;return wn(l,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:r.signal}).then(e=>{n||i!==d.current||o.current&&(o.current.innerHTML=e,c(!1))}).catch(async e=>{if(n||i!==d.current)return;if(!o.current)return;const r=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===r||(null==e?void 0:e.fallbackToRenderer)||r===cn||"WORKER_TIMEOUT"===r){const e=await xn();if(e)try{const r=e.renderToString(l,{throwOnError:t.loading,displayMode:a});return void(!n&&i===d.current&&o.current&&(o.current.innerHTML=r,c(!1),dn(l,a,r)))}catch{}}t.loading||(o.current.textContent=t.raw,c(!1))}),()=>{n=!0,r.abort()}},[t.content,t.loading,t.raw,t.markup]),/* @__PURE__ */n("span",{ref:r,className:"math-inline-wrapper",children:[
107
106
  /* @__PURE__ */e("span",{ref:o,className:"math-inline"+(l?" math-inline--hidden":"")}),l&&/* @__PURE__ */n("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
108
107
  /* @__PURE__ */e("span",{className:"math-inline__spinner","aria-hidden":"true"}),
109
- /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}let Cn=null,Mn=null;const Nn=/* @__PURE__ */new Map;let Bn=5,Ln=!1;function Tn(e){Ln=!!e}function En(e){Number.isFinite(e)&&e>0&&(Bn=Math.floor(e))}function Sn(){return{inFlight:Nn.size,max:Bn}}const Dn="WORKER_BUSY";function $n(e){Cn=e,Mn=null;const t=e;Cn.onmessage=e=>{if(Cn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=Nn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Cn.onerror=e=>{var n,r;if(Cn===t)if(0!==Nn.size){try{Ln?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 Nn.entries())n.reject(new Error(`Worker error: ${e.message}`));Nn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Cn.onmessageerror=e=>{var n,r;if(Cn===t)if(0!==Nn.size){try{Ln?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Nn.entries())t.reject(new Error("Worker messageerror"));Nn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function _n(){var e;if(Cn)try{for(const[e,t]of Nn.entries())t.reject(new Error("Worker cleared"));Nn.clear(),null==(e=Cn.terminate)||e.call(Cn)}catch{}Cn=null,Mn=null}function jn(e,t,n=1400){if(Mn)return Promise.reject(Mn);const r=Cn||(Mn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Mn.name="WORKER_INIT_ERROR",Mn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Mn);if(Nn.size>=Bn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Dn,e.inFlight=Nn.size,e.max=Bn,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),Nn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};Nn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return Nn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=Nn.get(l);null==t||t.reject(e)},n)})}async function An(e,t,n=1400){return jn("canParse",{code:e,theme:t},n)}async function Wn(e,t,n=2400){return jn("findPrefix",{code:e,theme:t},n)}function On(){var e;null==(e=null==Cn?void 0:Cn.terminate)||e.call(Cn),Cn=null,Mn=null,Nn.clear()}let Pn=null,In=!1,Rn=null,Fn=null;function Hn(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:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(Rn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Rn=r}catch{}}const zn="undefined"!=typeof window?m:s,Vn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Xn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Kn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function qn(e){if(!e)return"";const t=e.trim();return Kn.test(t)?t:""}function Un(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Yn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Un(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;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 null;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(Xn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=qn(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Un(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Zn={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function Gn(r){var l,a,u,h,p,g,f,w,v;const y={...Zn,...r},{t:k}=X(),b=o(()=>ge("mermaid"),[]),C=null!=(a=null==(l=y.node)?void 0:l.code)?a:"",M=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),N=null!=(u=y.workerTimeoutMs)?u:Zn.workerTimeoutMs,B=null!=(h=y.parseTimeoutMs)?h:Zn.parseTimeoutMs,L=null!=(p=y.renderTimeoutMs)?p:Zn.renderTimeoutMs,T=null!=(g=y.fullRenderTimeoutMs)?g:Zn.fullRenderTimeoutMs,[E,S]=i(!1),[$,_]=i(!1),[j,A]=i(!1),[W,O]=i(!1),[P,I]=i(1),[R,F]=i({x:0,y:0}),[H,z]=i(!1),[V,K]=i(!1),[q,U]=i(!1),[Y,Z]=i(null),[G,J]=i(!1),[Q,ne]=i(()=>null==y.maxHeight?"360px":y.maxHeight),[re,oe]=i("undefined"==typeof window),ie=c(null),le=c(null),ae=c(null),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c({x:0,y:0}),he=c(0),pe=c({}),fe=c(""),we=c(!1),ve=c(null),ye=c(!1),xe=c({zoom:1,translateX:0,translateY:0,containerHeight:Q||"360px"}),ke=D(),be=Boolean(null!=(w=null==(f=y.node)?void 0:f.loading)?w:y.loading),Ce=y.isDark?"dark":"light",Me=Boolean(y.isStrict),Ne=o(()=>Me?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Vn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Me]);s(()=>{ye.current=q},[q]),s(()=>{pe.current={}},[Ce,M,Me]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Pn)return Hn(Pn,e),Pn;if(Fn){const t=await Fn;return t&&Hn(t,e),t}if(In)return null;try{In=!0,Fn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Pn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Pn)throw new Error("Mermaid module did not export expected API");return Hn(Pn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),Pn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Fn=null}})();const t=await Fn;return t&&Hn(t,e),t}catch{return null}}(Ne);e||(ie.current=t,S(Boolean(t)),we.current||_(!t))})(),()=>{e=!0}},[Ne]),s(()=>{const e=le.current;if(!e)return;const t=ke(e,{rootMargin:"400px"});return ve.current=t,t.isVisible()&&oe(!0),t.whenVisible.then(()=>oe(!0)),()=>{t.destroy(),ve.current=null}},[ke]),s(()=>{if("undefined"==typeof document)return;if(!G)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[G]);const Be=d(e=>{const t=le.current,n=ce.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;ne(`${Math.min(c,i)}px`)},[]);s(()=>{if(!le.current||"undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;!function(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}globalThis.setTimeout(e,0)}(()=>Be(t))});return e.observe(le.current),()=>e.disconnect()},[Be]),s(()=>()=>{On()},[]),m(()=>{!$&&ce.current&&pe.current[Ce]&&(ce.current.innerHTML=pe.current[Ce],Be())},[$,Ce,Be]);const Le=d(async(e,t,n)=>{var r;if(!ie.current||!ce.current)return!1;K(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Qn(e,t),l=await tr(()=>ie.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Yn(ce.current,l.svg,Me);return null==(r=l.bindFunctions)||r.call(l,ce.current),Be(),pe.current[t]=a,U(!0),Z(null),!0}catch(o){return be||Z(o instanceof Error?o.message:String(o)),!1}finally{K(!1)}},[T,be,Me,Be]),Te=d(async(e,t,n)=>{var r;if(ie.current&&ce.current){K(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Qn(er(e)||e,t),l=await tr(()=>ie.current.render(o,i),{timeoutMs:L,signal:n});(null==l?void 0:l.svg)&&(Yn(ce.current,l.svg,Me),null==(r=l.bindFunctions)||r.call(l,ce.current),Be())}catch{}finally{K(!1)}}},[L,be,Me,Be]),Ee=d(async(e,t)=>{if(!e.trim())return Un(ce.current),U(!1),void(fe.current="");const n=e.replace(/\s+/g,"");if(n===fe.current&&ye.current)return;const r=++he.current;try{if(await async function(e,t,n){try{if(await An(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=Qn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await tr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await tr(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ce,{workerTimeout:N,parseTimeout:B,mermaid:ie.current,signal:t}),(null==t?void 0:t.aborted)||he.current!==r)return;return void(await Le(e,Ce,t)&&(fe.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 Wn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return er(e)}(e,Ce,{workerTimeout:N,signal:t});if(!n||(null==t?void 0:t.aborted)||he.current!==r)return;await Te(n,Ce,t)}catch{}},[B,Le,Te,Ce,N]);s(()=>{if(!re||$||j)return;if(!ie.current)return;const e=new AbortController;return Ee(M,e.signal),()=>e.abort()},[M,j,Ee,$,re,E]);const Se=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,y.isDark)},[y.isDark]),De=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(M)),O(!0),null==(t=y.onCopy)||t.call(y,M),setTimeout(()=>O(!1),1e3)}catch{}},[M,y]),$e=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=nr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onExport)||n.call(y,i),i.defaultPrevented||function(e,t){const n=null!=t?t:nr(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)},[y]),_e=d(()=>{ue.current=null,Un(de.current)},[]),je=d(()=>{J(!1),_e()},[_e]),Ae=d(()=>{var e,t,n;const r=null!=(t=null==(e=ce.current)?void 0:e.querySelector("svg"))?t:null,o=r?nr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=y.onOpenModal)||n.call(y,i),i.defaultPrevented||J(!0)},[y]);s(()=>{if(!G)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,G]),zn(()=>{if(!G)return;const e=de.current,t=le.current;if(!e||!t)return;const n=`translate(${R.x}px, ${R.y}px) scale(${P})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(ue.current=o,o.style.transform=n),Un(e),e.appendChild(r)},[G]),s(()=>{G&&ue.current&&(ue.current.style.transform=`translate(${R.x}px, ${R.y}px) scale(${P})`)},[G,R.x,R.y,P]);const We=$||V||j,Oe=o(()=>y.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",[y.isDark]),Pe=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=y.onToggleMode)||t.call(y,e,n),!n.defaultPrevented)if(we.current=!0,"preview"===e){_(!1);const e=xe.current;I(e.zoom),F({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else xe.current={zoom:P,translateX:R.x,translateY:R.y,containerHeight:Q},_(!0)},[M,Q,Ee,y,Ce,R.x,R.y,Be,P]),Ie=d(e=>{if(!1===y.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=le.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-R.x,o=e.clientY-n.top-R.y,i=.01*-e.deltaY,l=Jn(P+i,.5,3);if(l===P)return;const a=l/P;F({x:R.x-r*(a-1),y:R.y-o*(a-1)}),I(l)},[R,P]),Re=d((e,t)=>{z(!0),me.current={x:e-R.x,y:t-R.y}},[R.x,R.y]),Fe=d((e,t)=>{H&&F({x:e-me.current.x,y:t-me.current.y})},[H]),He=d(()=>{z(!1)},[]),Ve=/* @__PURE__ */n("div",{className:"relative",children:[y.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
110
- /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>I(Jn(P+.1,.5,3)),children:"+"}),
111
- /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>I(Jn(P-.1,.5,3)),children:"−"}),
112
- /* @__PURE__ */n("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",y.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,k("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{I(1),F({x:0,y:0})},children:[Math.round(100*P),"%"]})]})}),
113
- /* @__PURE__ */n("div",{ref:le,className:ze("min-h-[360px] relative transition-all duration-100 overflow-hidden block",y.isDark?"bg-gray-900":"bg-gray-50"),style:{height:Q,maxHeight:null!=(v=y.maxHeight)?v:void 0},onWheel:Ie,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Re(e.clientX,e.clientY))},onMouseMove:e=>Fe(e.clientX,e.clientY),onMouseUp:He,onMouseLeave:He,onTouchStart:e=>{const t=e.touches[0];t&&Re(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Fe(t.clientX,t.clientY)},onTouchEnd:He,children:[
114
- /* @__PURE__ */e("div",{ref:ae,"data-mermaid-wrapper":!0,className:ze("absolute inset-0 cursor-grab",{"cursor-grabbing":H}),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${P})`},children:/* @__PURE__ */e("div",{ref:ce,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(V||be)&&/* @__PURE__ */n("div",{className:"mermaid-loading",children:[
108
+ /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function Cn(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let Mn=null,Nn=null;const Bn=/* @__PURE__ */new Map;let Ln=5,Tn=!1;function En(e){Tn=!!e}function Sn(e){Number.isFinite(e)&&e>0&&(Ln=Math.floor(e))}function Dn(){return{inFlight:Bn.size,max:Ln}}const $n="WORKER_BUSY";function _n(e){Mn=e,Nn=null;const t=e;Mn.onmessage=e=>{if(Mn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=Bn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Mn.onerror=e=>{var n,r;if(Mn===t)if(0!==Bn.size){try{Tn?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 Bn.entries())n.reject(new Error(`Worker error: ${e.message}`));Bn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Mn.onmessageerror=e=>{var n,r;if(Mn===t)if(0!==Bn.size){try{Tn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Bn.entries())t.reject(new Error("Worker messageerror"));Bn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function jn(){var e;if(Mn)try{for(const[e,t]of Bn.entries())t.reject(new Error("Worker cleared"));Bn.clear(),null==(e=Mn.terminate)||e.call(Mn)}catch{}Mn=null,Nn=null}function An(e,t,n=1400){if(Nn)return Promise.reject(Nn);const r=Mn||(Nn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Nn.name="WORKER_INIT_ERROR",Nn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Nn);if(Bn.size>=Ln){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=$n,e.inFlight=Bn.size,e.max=Ln,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),Bn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};Bn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return Bn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=Bn.get(l);null==t||t.reject(e)},n)})}async function Pn(e,t,n=1400){return An("canParse",{code:e,theme:t},n)}async function Wn(e,t,n=2400){return An("findPrefix",{code:e,theme:t},n)}function On(){var e;null==(e=null==Mn?void 0:Mn.terminate)||e.call(Mn),Mn=null,Nn=null,Bn.clear()}let In=null,Rn=!1,Fn=null,Hn=null;function zn(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:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(Fn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Fn=r}catch{}}const Vn="undefined"!=typeof window?m:s,Xn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Kn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Un(e){if(!e)return"";const t=e.trim();return qn.test(t)?t:""}function Yn(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Zn(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Yn(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;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 null;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(Kn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Un(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Yn(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const Gn={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:!1};function Jn(r){var l,c,u,h,p,g,f,w,v,y;const k={...Gn,...r},{t:b}=X(),C=o(()=>ge("mermaid"),[]),M=null!=(c=null==(l=k.node)?void 0:l.code)?c:"",N=o(()=>M.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[M]),B=null!=(u=k.workerTimeoutMs)?u:Gn.workerTimeoutMs,L=null!=(h=k.parseTimeoutMs)?h:Gn.parseTimeoutMs,T=null!=(p=k.renderTimeoutMs)?p:Gn.renderTimeoutMs,E=null!=(g=k.fullRenderTimeoutMs)?g:Gn.fullRenderTimeoutMs,S=Math.max(0,null!=(f=k.renderDebounceMs)?f:Gn.renderDebounceMs),[$,_]=i(!1),[j,A]=i(!1),[P,W]=i(!1),[O,I]=i(!1),[R,F]=i(1),[H,z]=i({x:0,y:0}),[V,K]=i(!1),[q,U]=i(!1),[Y,Z]=i(!1),[G,J]=i(null),[Q,ne]=i(!1),[re,oe]=i(()=>null==k.maxHeight?"360px":k.maxHeight),[ie,le]=i("undefined"==typeof window),ae=a(null),ce=a(null),se=a(null),de=a(null),ue=a(null),me=a(null),he=a(null),pe=a({x:0,y:0}),fe=a(0),we=a({}),ve=a(""),ye=a(!1),xe=a(null),ke=a(!1),be=a({zoom:1,translateX:0,translateY:0,containerHeight:re||"360px"}),Ce=D(),Me=Boolean(null!=(v=null==(w=k.node)?void 0:w.loading)?v:k.loading),Ne=k.isDark?"dark":"light",Be=Boolean(k.isStrict),Le=o(()=>Be?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Xn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Be]);s(()=>{ke.current=Y},[Y]),s(()=>{we.current={}},[Ne,N,Be]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(In)return zn(In,e),In;if(Hn){const t=await Hn;return t&&zn(t,e),t}if(Rn)return null;try{Rn=!0,Hn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(In=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!In)throw new Error("Mermaid module did not export expected API");return zn(In,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),In}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Hn=null}})();const t=await Hn;return t&&zn(t,e),t}catch{return null}}(Le);e||(ae.current=t,_(Boolean(t)),ye.current||A(!t))})(),()=>{e=!0}},[Le]),s(()=>{const e=ce.current;if(!e)return;const t=Ce(e,{rootMargin:"400px"});return xe.current=t,t.isVisible()&&le(!0),t.whenVisible.then(()=>le(!0)),()=>{t.destroy(),xe.current=null}},[Ce]),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 Te=d(e=>{const t=ce.current,n=de.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;oe(`${Math.min(c,i)}px`)},[]);s(()=>{if(!ce.current||"undefined"==typeof ResizeObserver)return;if(j||P)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Cn(()=>Te(t))});return e.observe(ce.current),()=>e.disconnect()},[P,j,Te]),s(()=>()=>{On()},[]),m(()=>{!j&&de.current&&we.current[Ne]&&(Zn(de.current,we.current[Ne],Be),Cn(()=>Te()))},[j,Be,Ne,Te]);const Ee=d(async(e,t,n)=>{var r;if(!ae.current||!de.current)return!1;U(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=er(e,t),l=await nr(()=>ae.current.render(o,i),{timeoutMs:E,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=Zn(de.current,l.svg,Be);return null==(r=l.bindFunctions)||r.call(l,de.current),Te(),we.current[t]=a,Z(!0),J(null),!0}catch(o){return Me||J(o instanceof Error?o.message:String(o)),!1}finally{U(!1)}},[E,Me,Be,Te]),Se=d(async(e,t,n)=>{var r;if(ae.current&&de.current){U(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=er(tr(e)||e,t),l=await nr(()=>ae.current.render(o,i),{timeoutMs:T,signal:n});(null==l?void 0:l.svg)&&(Zn(de.current,l.svg,Be),null==(r=l.bindFunctions)||r.call(l,de.current),Te())}catch{}finally{U(!1)}}},[T,Me,Be,Te]),De=d(async(e,t)=>{if(!e.trim())return Yn(de.current),Z(!1),void(ve.current="");const n=e.replace(/\s+/g,"");if(n===ve.current&&ke.current)return;const r=++fe.current;try{if(await async function(e,t,n){try{if(await Pn(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=er(e,t),o=n.mermaid;if("function"==typeof o.parse)return await nr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await nr(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ne,{workerTimeout:B,parseTimeout:L,mermaid:ae.current,signal:t}),(null==t?void 0:t.aborted)||fe.current!==r)return;return void(await Ee(e,Ne,t)&&(ve.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 Wn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return tr(e)}(e,Ne,{workerTimeout:B,signal:t});if(!n||(null==t?void 0:t.aborted)||fe.current!==r)return;await Se(n,Ne,t)}catch{}},[L,Ee,Se,Ne,B]),$e=d(()=>ie&&!j&&!P,[P,j,ie]);s(()=>{if(!$e())return;if(!ae.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&$e()&&De(N,e.signal)},S);return()=>{e.abort(),window.clearTimeout(t)}},[N,$e,$,De,S]);const _e=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,k.isDark)},[k.isDark]),je=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),I(!0),null==(t=k.onCopy)||t.call(k,N),setTimeout(()=>I(!1),1e3)}catch{}},[N,k]),Ae=d(()=>{var e,t,n;const r=null!=(t=null==(e=de.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=rr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=k.onExport)||n.call(k,i),i.defaultPrevented||function(e,t){const n=null!=t?t:rr(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)},[k]),Pe=d(()=>{he.current=null,Yn(me.current)},[]),We=d(()=>{ne(!1),Pe()},[Pe]),Oe=d(()=>{var e,t,n;const r=null!=(t=null==(e=de.current)?void 0:e.querySelector("svg"))?t:null,o=r?rr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=k.onOpenModal)||n.call(k,i),i.defaultPrevented||ne(!0)},[k]);s(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&We()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[We,Q]),Vn(()=>{if(!Q)return;const e=me.current,t=ce.current;if(!e||!t)return;const n=`translate(${H.x}px, ${H.y}px) scale(${R})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(he.current=o,o.style.transform=n),Yn(e),e.appendChild(r)},[Q]),s(()=>{Q&&he.current&&(he.current.style.transform=`translate(${H.x}px, ${H.y}px) scale(${R})`)},[Q,H.x,H.y,R]);const Ie=j||q||P,Re=o(()=>k.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",[k.isDark]),Fe=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=k.onToggleMode)||t.call(k,e,n),!n.defaultPrevented)if(ye.current=!0,"preview"===e){A(!1);const e=be.current;F(e.zoom),z({x:e.translateX,y:e.translateY}),oe(e.containerHeight)}else be.current={zoom:R,translateX:H.x,translateY:H.y,containerHeight:re},A(!0)},[N,re,De,k,Ne,H.x,H.y,Te,R]),He=d(e=>{if(!1===k.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=ce.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-H.x,o=e.clientY-n.top-H.y,i=.01*-e.deltaY,l=Qn(R+i,.5,3);if(l===R)return;const a=l/R;z({x:H.x-r*(a-1),y:H.y-o*(a-1)}),F(l)},[H,R]),Ve=d((e,t)=>{K(!0),pe.current={x:e-H.x,y:t-H.y}},[H.x,H.y]),Xe=d((e,t)=>{V&&z({x:e-pe.current.x,y:t-pe.current.y})},[V]),Ke=d(()=>{K(!1)},[]),qe=/* @__PURE__ */n("div",{className:"relative",children:[k.showZoomControls&&/* @__PURE__ */e("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */n("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
109
+ /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",k.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>_e(e,b("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>F(Qn(R+.1,.5,3)),children:"+"}),
110
+ /* @__PURE__ */e("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",k.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>_e(e,b("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>F(Qn(R-.1,.5,3)),children:"−"}),
111
+ /* @__PURE__ */n("button",{type:"button",className:ze("p-2 text-xs rounded transition-colors",k.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>_e(e,b("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{F(1),z({x:0,y:0})},children:[Math.round(100*R),"%"]})]})}),
112
+ /* @__PURE__ */n("div",{ref:ce,className:ze("min-h-[360px] relative overflow-hidden block transition-[height] duration-150 ease-out",k.isDark?"bg-gray-900":"bg-gray-50"),style:{height:re,maxHeight:null!=(y=k.maxHeight)?y:void 0},onWheel:He,onMouseDown:e=>{0===e.button&&(e.preventDefault(),Ve(e.clientX,e.clientY))},onMouseMove:e=>Xe(e.clientX,e.clientY),onMouseUp:Ke,onMouseLeave:Ke,onTouchStart:e=>{const t=e.touches[0];t&&Ve(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Xe(t.clientX,t.clientY)},onTouchEnd:Ke,children:[
113
+ /* @__PURE__ */e("div",{ref:se,"data-mermaid-wrapper":!0,className:ze("absolute inset-0 cursor-grab",{"cursor-grabbing":V}),style:{transform:`translate(${H.x}px, ${H.y}px) scale(${R})`},children:/* @__PURE__ */e("div",{ref:de,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(q||Me)&&/* @__PURE__ */n("div",{className:"mermaid-loading",children:[
115
114
  /* @__PURE__ */e("span",{className:"mermaid-spinner"}),
116
- /* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),Xe=y.showHeader&&/* @__PURE__ */n("div",{className:ze("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",y.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
115
+ /* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),Ue=k.showHeader&&/* @__PURE__ */n("div",{className:ze("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",k.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
117
116
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
118
- /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:b}}),
119
- /* @__PURE__ */e("span",{className:ze("text-sm font-medium font-mono truncate",y.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),y.showModeToggle&&E&&/* @__PURE__ */n("div",{className:ze("flex items-center space-x-1 rounded-md p-0.5",y.isDark?"bg-gray-700":"bg-gray-100"),children:[
120
- /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Pe("preview"),onMouseEnter:e=>Se(e,k("common.preview")),onFocus:e=>Se(e,k("common.preview")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
117
+ /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:C}}),
118
+ /* @__PURE__ */e("span",{className:ze("text-sm font-medium font-mono truncate",k.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),k.showModeToggle&&$&&/* @__PURE__ */n("div",{className:ze("flex items-center space-x-1 rounded-md p-0.5",k.isDark?"bg-gray-700":"bg-gray-100"),children:[
119
+ /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",j?k.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":k.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>Fe("preview"),onMouseEnter:e=>_e(e,b("common.preview")),onFocus:e=>_e(e,b("common.preview")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
121
120
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
122
121
  /* @__PURE__ */e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
123
122
  /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})}),
124
- /* @__PURE__ */e("span",{children:k("common.preview")})]})}),
125
- /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",$?y.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":y.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Pe("source"),onMouseEnter:e=>Se(e,k("common.source")),onFocus:e=>Se(e,k("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
123
+ /* @__PURE__ */e("span",{children:b("common.preview")})]})}),
124
+ /* @__PURE__ */e("button",{type:"button",className:ze("px-2.5 py-1 text-xs rounded transition-colors",j?k.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":k.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Fe("source"),onMouseEnter:e=>_e(e,b("common.source")),onFocus:e=>_e(e,b("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
126
125
  /* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
127
- /* @__PURE__ */e("span",{children:k("common.source")})]})})]}),
128
- /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[y.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Oe,"aria-pressed":j,onClick:()=>A(e=>!e),onMouseEnter:e=>Se(e,k(j?"common.expand":"common.collapse")),onFocus:e=>Se(e,k(j?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:j?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),y.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Oe,onClick:De,onMouseEnter:e=>Se(e,k(W?"common.copySuccess":"common.copy")),onFocus:e=>Se(e,k(W?"common.copySuccess":"common.copy")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",W?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
126
+ /* @__PURE__ */e("span",{children:b("common.source")})]})})]}),
127
+ /* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[k.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Re,"aria-pressed":P,onClick:()=>W(e=>!e),onMouseEnter:e=>_e(e,b(P?"common.expand":"common.collapse")),onFocus:e=>_e(e,b(P?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:P?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),k.showCopyButton&&/* @__PURE__ */e("button",{type:"button",className:Re,onClick:je,onMouseEnter:e=>_e(e,b(O?"common.copied":"common.copy")),onFocus:e=>_e(e,b(O?"common.copied":"common.copy")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",O?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
129
128
  /* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
130
- /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),y.showExportButton&&E&&/* @__PURE__ */e("button",{type:"button",className:ze(Oe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:$e,onMouseEnter:e=>Se(e,k("common.export")),onFocus:e=>Se(e,k("common.export")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
129
+ /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),k.showExportButton&&$&&/* @__PURE__ */e("button",{type:"button",className:ze(Re,Ie?"opacity-50 cursor-not-allowed":""),disabled:Ie,onClick:Ae,onMouseEnter:e=>_e(e,b("common.export")),onFocus:e=>_e(e,b("common.export")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
131
130
  /* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
132
- /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),y.showFullscreenButton&&E&&/* @__PURE__ */e("button",{type:"button",className:ze(Oe,We?"opacity-50 cursor-not-allowed":""),disabled:We,onClick:G?je:Ae,onMouseEnter:e=>Se(e,k(G?"common.minimize":"common.open")),onFocus:e=>Se(e,k(G?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",G?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),Ke=/* @__PURE__ */n("div",{children:[$?/* @__PURE__ */e("div",{className:ze("p-4",y.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */e("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:M})}):Ve,Y&&/* @__PURE__ */e("div",{className:"mermaid-error",children:Y})]});/* @__PURE__ */
131
+ /* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),k.showFullscreenButton&&$&&/* @__PURE__ */e("button",{type:"button",className:ze(Re,Ie?"opacity-50 cursor-not-allowed":""),disabled:Ie,onClick:Q?We:Oe,onMouseEnter:e=>_e(e,b(Q?"common.minimize":"common.open")),onFocus:e=>_e(e,b(Q?"common.minimize":"common.open")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",Q?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),Ye=/* @__PURE__ */n("div",{children:[j?/* @__PURE__ */e("div",{className:ze("p-4",k.isDark?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-700"),children:/* @__PURE__ */e("pre",{className:"text-sm font-mono whitespace-pre-wrap",children:N})}):qe,G&&/* @__PURE__ */e("div",{className:"mermaid-error",children:G})]});/* @__PURE__ */
133
132
  return n(t,{children:[
134
- /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",y.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":be}),children:[Xe,
135
- /* @__PURE__ */e("div",{ref:se,style:{display:j?"none":""},children:Ke})]}),G&&"undefined"!=typeof document&&x(
136
- /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>je(),children:/* @__PURE__ */n("div",{className:ze("mermaid-modal-panel",{"is-dark":y.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
133
+ /* @__PURE__ */n("div",{className:ze("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",k.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Me}),children:[Ue,
134
+ /* @__PURE__ */e("div",{ref:ue,style:{display:P?"none":""},children:Ye})]}),Q&&"undefined"!=typeof document&&x(
135
+ /* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>We(),children:/* @__PURE__ */n("div",{className:ze("mermaid-modal-panel",{"is-dark":k.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
137
136
  /* @__PURE__ */n("div",{className:"mermaid-modal-header",children:[
138
- /* @__PURE__ */e("span",{className:"mermaid-modal-title",children:`Mermaid ${k("common.preview")}`}),
139
- /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:je,children:k("common.close")})]}),
140
- /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:de,className:"mermaid-modal-content"})})]})}),document.body)]})}function Jn(e,t,n){return Math.min(Math.max(e,t),n)}function Qn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function er(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 tr(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 nr(e){return(new XMLSerializer).serializeToString(e)}function rr(e){const{node:t}=e;/* @__PURE__ */
141
- return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function or(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
137
+ /* @__PURE__ */e("span",{className:"mermaid-modal-title",children:`Mermaid ${b("common.preview")}`}),
138
+ /* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:We,children:b("common.close")})]}),
139
+ /* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:me,className:"mermaid-modal-content"})})]})}),document.body)]})}function Qn(e,t,n){return Math.min(Math.max(e,t),n)}function er(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function tr(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 nr(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 rr(e){return(new XMLSerializer).serializeToString(e)}function or(e){const{node:t}=e;/* @__PURE__ */
140
+ return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function ir(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
142
141
  return e("p",{dir:"auto",className:"paragraph-node",children:s});const d=null!=(o=i.children)?o:[],u=[],m=[],h=()=>{if(!m.length)return;const t=u.length;u.push(
143
142
  /* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(m.slice(),l,`${String(null!=c?c:"paragraph")}-${t}`,a)},`${String(null!=c?c:"paragraph")}-inline-${t}`)),m.length=0};return d.forEach((t,n)=>{k.has(t.type)?(h(),u.push(
144
- /* @__PURE__ */e(r.Fragment,{children:a(t,`${String(null!=c?c:"paragraph")}-block-${n}`,l)},`${String(null!=c?c:"paragraph")}-block-${n}`))):m.push(t)}),h(),u.length?/* @__PURE__ */e(t,{children:u}):/* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(d,l,String(null!=c?c:"paragraph"),a)})}function ir(t){const{node:n}=t,r=d(e=>{var r;null==(r=t.onClick)||r.call(t,e,n.id,t.messageId,t.threadId)},[n.id,t]);/* @__PURE__ */
145
- return e("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:e=>{var r;null==(r=t.onMouseEnter)||r.call(t,e,n.id,t.messageId,t.threadId)},onMouseLeave:e=>{var r;null==(r=t.onMouseLeave)||r.call(t,e,n.id,t.messageId,t.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function lr(t){/* @__PURE__ */
146
- return e("s",{className:"strikethrough-node",children:t.children})}function ar(t){/* @__PURE__ */
147
- return e("strong",{className:"strong-node",children:t.children})}function cr(t){/* @__PURE__ */
148
- return e("sub",{className:"subscript-node",children:t.children})}function sr(t){/* @__PURE__ */
149
- return e("sup",{className:"superscript-node",children:t.children})}function dr(t){var r;const{node:o,ctx:i,renderNode:l,indexKey:a}=t,c=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],s=Boolean(null==o?void 0:o.loading),d=Array.isArray(null==o?void 0:o.rows)?o.rows:[],u=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
143
+ /* @__PURE__ */e(r.Fragment,{children:a(t,`${String(null!=c?c:"paragraph")}-block-${n}`,l)},`${String(null!=c?c:"paragraph")}-block-${n}`))):m.push(t)}),h(),u.length?/* @__PURE__ */e(t,{children:u}):/* @__PURE__ */e("p",{dir:"auto",className:"paragraph-node",children:C(d,l,String(null!=c?c:"paragraph"),a)})}function lr(t){const{node:n}=t,r=d(e=>{var r;null==(r=t.onClick)||r.call(t,e,n.id,t.messageId,t.threadId)},[n.id,t]);/* @__PURE__ */
144
+ return e("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:e=>{var r;null==(r=t.onMouseEnter)||r.call(t,e,n.id,t.messageId,t.threadId)},onMouseLeave:e=>{var r;null==(r=t.onMouseLeave)||r.call(t,e,n.id,t.messageId,t.threadId)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||r(e)},children:n.id})}function ar(t){/* @__PURE__ */
145
+ return e("s",{className:"strikethrough-node",children:t.children})}function cr(t){/* @__PURE__ */
146
+ return e("strong",{className:"strong-node",children:t.children})}function sr(t){/* @__PURE__ */
147
+ return e("sub",{className:"subscript-node",children:t.children})}function dr(t){/* @__PURE__ */
148
+ return e("sup",{className:"superscript-node",children:t.children})}function ur(t){var r;const{node:o,ctx:i,renderNode:l,indexKey:a}=t,c=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],s=Boolean(null==o?void 0:o.loading),d=Array.isArray(null==o?void 0:o.rows)?o.rows:[],u=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
150
149
  return n("div",{className:"table-node-wrapper","data-index-key":a,children:[
151
150
  /* @__PURE__ */n("table",{className:ze("my-8 text-sm table-node",s&&"table-node--loading"),"aria-busy":s,children:[
152
151
  /* @__PURE__ */e("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */e("tr",{className:"border-b",children:c.map((t,n)=>/* @__PURE__ */e("th",{className:ze("font-semibold p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-th-${n}`,l):null},`header-${n}`))})}),
153
152
  /* @__PURE__ */e("tbody",{children:d.map((t,n)=>{var r;/* @__PURE__ */
154
153
  return e("tr",{className:ze("border-[var(--table-border,#cbd5e1)]",n<d.length-1&&"border-b"),children:null==(r=t.cells)?void 0:r.map((t,r)=>/* @__PURE__ */e("td",{className:ze("p-[calc(4/7*1em)]",u(t.align)),dir:"auto",children:i&&l?M(t.children,i,`${String(null!=a?a:"table")}-row-${n}-${r}`,l):null},`cell-${n}-${r}`))},`row-${n}`)})})]}),s&&/* @__PURE__ */n("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
155
154
  /* @__PURE__ */e("span",{className:"table-node__spinner","aria-hidden":"true"}),
156
- /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function ur(t){const{node:n,children:r}=t;/* @__PURE__ */
157
- return e("span",{className:ze("text-node whitespace-pre-wrap break-words",n.center&&"text-node-center"),children:null!=r?r:n.content})}function mr(){/* @__PURE__ */
158
- return e("hr",{className:"hr-node thematic-break"})}function hr(t){const{node:n,ctx:i,renderNode:l,indexKey:a}=t,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?b(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
159
- return e("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((t,n)=>/* @__PURE__ */e(r.Fragment,{children:l(t,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function pr(e,t){const n=String(null!=e?e:"");if(!t)return n;const r=new RegExp(String.raw`^\s*<\s*${t}(?:\s[^>]*)?>\s*`,"i"),o=new RegExp(String.raw`\s*<\s*\/\s*${t}\s*>\s*$`,"i");return n.replace(r,"").replace(o,"")}function gr(t,n,o){var i,l,a;const c=null!=(i=o.customComponents)?i:I(o.customId),s=c[t.type];if(s)return r.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter});if("html_block"===t.type||"html_inline"===t.type){const e=String(null!=(l=t.tag)?l:"").trim().toLowerCase()||function(e){const t=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return t?t[1].toLowerCase():""}(t.content),i=e?c[e]:null;if(i){const l={...t,type:e,tag:e,content:pr(t.content,e)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter})}}switch(t.type){case"text":/* @__PURE__ */
160
- return e(ur,{node:t,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
161
- return e(ur,{node:{type:"text",content:null!=(a=t.content)?a:"",center:t.center},typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
162
- return e(or,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
163
- return e(dt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
164
- return e(br,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
165
- return e(Yt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
166
- return e(Ut,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
167
- return e(dr,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
168
- return e(rt,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
169
- return e(at,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
155
+ /* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function mr(t){const{node:n,children:r}=t;/* @__PURE__ */
156
+ return e("span",{className:ze("text-node whitespace-pre-wrap break-words",n.center&&"text-node-center"),children:null!=r?r:n.content})}function hr(){/* @__PURE__ */
157
+ return e("hr",{className:"hr-node thematic-break"})}function pr(t){const{node:n,ctx:i,renderNode:l,indexKey:a}=t,c=`vmr-container vmr-container-${n.name}`,s=o(()=>{if(n.attrs)return Array.isArray(n.attrs)?b(n.attrs):n.attrs},[n.attrs]);/* @__PURE__ */
158
+ return e("div",{className:c,...s,children:i&&l&&Array.isArray(n.children)?n.children.map((t,n)=>/* @__PURE__ */e(r.Fragment,{children:l(t,`${String(null!=a?a:"vmr-container")}-${n}`,i)},`${String(null!=a?a:"vmr-container")}-${n}`)):null})}function gr(e,t){const n=String(null!=e?e:"");if(!t)return n;const r=new RegExp(String.raw`^\s*<\s*${t}(?:\s[^>]*)?>\s*`,"i"),o=new RegExp(String.raw`\s*<\s*\/\s*${t}\s*>\s*$`,"i");return n.replace(r,"").replace(o,"")}function fr(t,n,o){var i,l,a;const c=null!=(i=o.customComponents)?i:I(o.customId),s=c[t.type];if(s)return r.createElement(s,{key:n,node:t,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter});if("html_block"===t.type||"html_inline"===t.type){const e=String(null!=(l=t.tag)?l:"").trim().toLowerCase()||function(e){const t=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return t?t[1].toLowerCase():""}(t.content),i=e?c[e]:null;if(i){const l={...t,type:e,tag:e,content:gr(t.content,e)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter})}}switch(t.type){case"text":/* @__PURE__ */
159
+ return e(mr,{node:t,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
160
+ return e(mr,{node:{type:"text",content:null!=(a=t.content)?a:"",center:t.center},typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
161
+ return e(ir,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
162
+ return e(dt,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
163
+ return e(Cr,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
164
+ return e(Yt,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
165
+ return e(Ut,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
166
+ return e(ur,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
167
+ return e(rt,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
168
+ return e(at,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
170
169
  return e(ct,{node:t},n);case"footnote_anchor":/* @__PURE__ */
171
170
  return e(lt,{node:t},n);case"admonition":/* @__PURE__ */
172
- return e(B,{node:t,ctx:o,renderNode:gr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
171
+ return e(B,{node:t,ctx:o,renderNode:fr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
173
172
  return e(st,{node:t,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
174
- return e(qt,{node:t,ctx:o,renderNode:gr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
173
+ return e(qt,{node:t,ctx:o,renderNode:fr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
175
174
  return e(It,{node:t},n);case"inline_code":/* @__PURE__ */
176
- return e(Xt,{node:t,typewriter:o.typewriter},n);case"code_block":return function(t,n,o,i){var l,a,c,s;const d=de(String(t.language||""));if("mermaid"===d){const l=i.mermaid;if(l)return r.createElement(l,{key:n,node:t,isDark:o.isDark});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
177
- return e(Gn,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(Vt,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark}):/* @__PURE__ */e(nt,{node:t,isDark:o.isDark,loading:Boolean(t.loading)},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */e(Ie,{node:t},n):/* @__PURE__ */e(Fe,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(l=o.codeBlockThemes)?void 0:l.monacoOptions,themes:null==(a=o.codeBlockThemes)?void 0:a.themes,minWidth:null==(c=o.codeBlockThemes)?void 0:c.minWidth,maxWidth:null==(s=o.codeBlockThemes)?void 0:s.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o,c);case"strong":/* @__PURE__ */
178
- return e(ar,{node:t,children:C(t.children,o,`${String(n)}-strong`,gr)},n);case"emphasis":/* @__PURE__ */
179
- return e(it,{node:t,children:C(t.children,o,`${String(n)}-em`,gr)},n);case"strikethrough":/* @__PURE__ */
180
- return e(lr,{node:t,children:C(t.children,o,`${String(n)}-strike`,gr)},n);case"highlight":/* @__PURE__ */
181
- return e(ut,{node:t,children:C(t.children,o,`${String(n)}-highlight`,gr)},n);case"insert":/* @__PURE__ */
182
- return e(Kt,{node:t,children:C(t.children,o,`${String(n)}-insert`,gr)},n);case"subscript":/* @__PURE__ */
183
- return e(cr,{node:t,children:C(t.children,o,`${String(n)}-sub`,gr)},n);case"superscript":/* @__PURE__ */
184
- return e(sr,{node:t,children:C(t.children,o,`${String(n)}-sup`,gr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
175
+ return e(Xt,{node:t,typewriter:o.typewriter},n);case"code_block":return function(t,n,o,i){var l,a,c,s;const d=de(String(t.language||""));if("mermaid"===d){const l=i.mermaid;if(l)return r.createElement(l,{key:n,node:t,isDark:o.isDark,...o.mermaidProps||{}});if(!o.renderCodeBlocksAsPre)/* @__PURE__ */
176
+ return e(Jn,{node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.mermaidProps||{}},n)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark,...o.infographicProps||{}}):/* @__PURE__ */e(Vt,{node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.infographicProps||{}},n)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:n,node:t,isDark:o.isDark,...o.d2Props||{}}):/* @__PURE__ */e(nt,{node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */e(Ie,{node:t},n):/* @__PURE__ */e(Fe,{node:t,loading:Boolean(t.loading),stream:o.codeBlockStream,monacoOptions:null==(l=o.codeBlockThemes)?void 0:l.monacoOptions,themes:null==(a=o.codeBlockThemes)?void 0:a.themes,minWidth:null==(c=o.codeBlockThemes)?void 0:c.minWidth,maxWidth:null==(s=o.codeBlockThemes)?void 0:s.maxWidth,isDark:o.isDark,onCopy:o.events.onCopy,...o.codeBlockProps||{}},n)}(t,n,o,c);case"strong":/* @__PURE__ */
177
+ return e(cr,{node:t,children:C(t.children,o,`${String(n)}-strong`,fr)},n);case"emphasis":/* @__PURE__ */
178
+ return e(it,{node:t,children:C(t.children,o,`${String(n)}-em`,fr)},n);case"strikethrough":/* @__PURE__ */
179
+ return e(ar,{node:t,children:C(t.children,o,`${String(n)}-strike`,fr)},n);case"highlight":/* @__PURE__ */
180
+ return e(ut,{node:t,children:C(t.children,o,`${String(n)}-highlight`,fr)},n);case"insert":/* @__PURE__ */
181
+ return e(Kt,{node:t,children:C(t.children,o,`${String(n)}-insert`,fr)},n);case"subscript":/* @__PURE__ */
182
+ return e(sr,{node:t,children:C(t.children,o,`${String(n)}-sub`,fr)},n);case"superscript":/* @__PURE__ */
183
+ return e(dr,{node:t,children:C(t.children,o,`${String(n)}-sup`,fr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
185
184
  return e(H,{node:t,typewriter:o.typewriter},n);case"emoji":/* @__PURE__ */
186
185
  return e(ot,{node:t,typewriter:o.typewriter},n);case"thematic_break":/* @__PURE__ */
187
- return e(mr,{},n);case"math_inline":/* @__PURE__ */
186
+ return e(hr,{},n);case"math_inline":/* @__PURE__ */
188
187
  return e(bn,{node:t},n);case"math_block":/* @__PURE__ */
189
188
  return e(kn,{node:t},n);case"reference":/* @__PURE__ */
190
- return e(ir,{node:t,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */e(bt,{node:t,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */e(Ot,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
191
- return e(hr,{node:t,ctx:o,renderNode:gr,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
192
- return e(rr,{node:t},n)}}const fr={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},wr=h();function vr(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function yr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const xr=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u})=>{var m,h,p,g,f,w,v;const y=D(),x="undefined"!=typeof window,k="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,b=Math.max(0,Math.trunc(null!=(m=t.renderBatchSize)?m:80)),C=Math.max(0,Math.trunc(null!=(h=t.initialRenderBatchSize)?h:b||r.length)),M=!1!==t.batchRendering&&b>0&&x,N=Math.max(0,null!=(p=t.liveNodeBuffer)?p:60),B=Math.max(1,null!=(g=t.maxLiveNodes)?g:320),L=(null!=(f=t.maxLiveNodes)?f:0)>0&&r.length>B,T=!1!==t.viewportPriority,E=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,S=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&T},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,T,L]),[$,_]=i(()=>E?Math.min(r.length,C):r.length),j=c($);s(()=>{j.current=$},[$]);const A=E?$:r.length,[W,O]=i(0),[P,I]=i({start:0,end:r.length}),R=c(/* @__PURE__ */new Map),[F,H]=i(0),z=c({}),V=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),K=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Set),Y=c($),Z=c(null),G=c(null),J=c(null),Q=c(!1),ee=c(null),te=c(Math.max(1,b||1)),ne=c(r.length),re=c({key:t.indexKey,total:r.length}),oe=c({batchSize:b,initial:C,delay:null!=(v=t.renderBatchDelay)?v:16,enabled:E}),ie=S||L,le=o(()=>{const e=R.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[F]),ae=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(P.start,e)),n=Math.max(t,Math.min(P.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,P,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(P.end+N,C),t=Math.min(r.length,e);return Math.max($,t)},[r.length,L,P.end,N,C,$]);ne.current=ce;const se=d((e,t)=>{var n;if(e>=t)return 0;const r=R.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:le;return o},[le]),de=L?se(0,Math.min(P.start,r.length)):0,ue=L?se(Math.min(P.end,r.length),r.length):0,me=d(()=>{null!=Z.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(Z.current),Z.current=null),null!=G.current&&(window.clearTimeout(G.current),G.current=null),null!=J.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(J.current),J.current=null),Q.current=!1,ee.current=null},[]),he=d(e=>{var n;if(!E)return;const r=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6),o=Math.max(1,b||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?te.current=Math.max(i,Math.floor(.7*te.current)):e<.5*r&&te.current<o&&(te.current=Math.min(o,Math.ceil(1.2*te.current)))},[E,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!E)return;const i=ne.current;if(j.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();_(t=>{const n=Math.min(ne.current,t+Math.max(1,e));return j.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();he(n-t)},c=()=>{const e=Math.max(1,Math.round(te.current));pe(e)},s=e=>{var n;Z.current=null,G.current=null,J.current=null,Q.current=!1;const r=ee.current;if(ee.current=null,a(null!=r?r:l),j.current>=ne.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;j.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));j.current<ne.current&&c()};if(!x||n.immediate)return void s();const d=Math.max(0,null!=(r=t.renderBatchDelay)?r:16);if(ee.current=null!=ee.current?Math.max(ee.current,l):l,!Q.current){if(Q.current=!0,k){const e=Math.max(0,null!=(o=t.renderBatchIdleTimeoutMs)?o:120);return void(J.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?Z.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>s(),d):s()}):G.current=window.setTimeout(()=>s(),d)}},[he,k,E,x,t.renderBatchDelay,t.renderBatchBudgetMs,t.renderBatchIdleTimeoutMs]);s(()=>{var e;const n=t.indexKey,o=r.length,i=re.current,l=void 0!==n?n!==i.key:o!==i.total;re.current={key:n,total:o};const a=oe.current,c=null!=(e=t.renderBatchDelay)?e:16,s=a.batchSize!==b||a.initial!==C||a.delay!==c||a.enabled!==E;if(oe.current={batchSize:b,initial:C,delay:c,enabled:E},(l||s||!E)&&me(),(l||s)&&(te.current=Math.max(1,b||1),U.current.clear()),!o)return j.current=0,void _(0);const d=ne.current;if(!E)return j.current=d,void _(d);if(l||s){const e=Math.min(d,C);return j.current=e,_(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(j.current,d);u!==j.current&&(j.current=u,_(u)),j.current<d&&pe(Math.max(1,b||1))},[me,E,x,r.length,t.indexKey,t.renderBatchDelay,b,C,pe]),s(()=>{if(!L)return void I({start:0,end:r.length});const e=r.length;if(!e)return void I({start:0,end:0});const t=Math.max(0,Math.min(W,e-1));let n=Math.max(0,t-N),o=Math.min(e,t+N+1);const i=o-n;if(i>B){const e=i-B;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<B){const t=B-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}I({start:n,end:o})},[W,N,B,r.length,L]),s(()=>()=>{me();for(const e of V.current.values())e.destroy();V.current.clear()},[me]);const ge=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete z.current[t],X.current.delete(t),K.current.delete(t),q.current.delete(t))},[]);s(()=>{ge(A)},[ge,A]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(R.current.keys()))n>=e&&(R.current.delete(n),t=!0);t&&H(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(U.current))n>=e&&U.current.delete(n)},[r.length]);const fe=d((e,t)=>{S&&t&&(z.current[e]=!0),t&&L&&O(t=>e>t?e:t)},[S,L]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),ve=d((e,t)=>{const n=X.current;if(t?n.set(e,t):n.delete(e),!ie||!t)return we(e),S&&!t&&delete z.current[e],void(t&&fe(e,!0));if(e<C&&!L)return we(e),void fe(e,!0);we(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&fe(e,!0),r.whenVisible.then(()=>fe(e,!0)).catch(()=>{})},[S,we,fe,y,C,ie,L]),ye=d(e=>{const t=K.current.get(e);if(t)return t;const n=t=>ve(e,t);return K.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(R.current.has(e)&&(R.current.delete(e),H(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),H(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),ke=d(e=>{const t=q.current.get(e);if(t)return t;const n=t=>xe(e,t);return q.current.set(e,n),n},[xe]),be=d(e=>!(E&&e>=j.current)&&(!S||e<C||!0===z.current[e]),[S,E,C]),Ce=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 X.current.entries())t&&ve(e,t)},[ve]),s(()=>{L&&$>Y.current&&O($-1),Y.current=$},[$,L]);const Me=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${de}px`},"aria-hidden":"true"}):null,Ne=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
193
- return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":t.customId,onClick:t.onClick,onMouseOver:Ce(t.onMouseOver),onMouseOut:Ce(t.onMouseOut),children:[Me,ae.map(({node:n,index:r})=>{var o;const i=be(r),c=null!=(o=R.current.get(r))?o:le,s=!1!==t.typewriter&&"code_block"!==n.type&&!U.current.has(r)&&i;return s&&U.current.add(r),/* @__PURE__ */e("div",{ref:ye(r),className:"node-slot","data-node-index":r,"data-node-type":n.type,children:/* @__PURE__ */e("div",i?{ref:ke(r),className:"node-content"+(s?" typewriter-node":""),children:gr(n,`${a}-${r}`,l)}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Ne]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),kr=t=>{const n={...fr,...t},r=c(null),i=c(null),l=u(W,O,O),a=o(()=>I(n.customId),[n.customId,l]),d=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=o(()=>Object.keys(a).map(String).map(e=>e.trim().toLowerCase()).filter(yr),[a]),g=o(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...m].map(vr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,l]),f=o(()=>{const e=g;return e&&0!==e.length?h(d,{customHtmlTags:e}):h(d)},[d,g]),w=o(()=>{const e=f;return n.customMarkdownIt?n.customMarkdownIt(e):e},[f,n.customMarkdownIt]),v=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=g.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:g}:{}}:r},[g,n.final,n.parseOptions]),y=o(()=>{var e,t;const r=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,o=r?performance.now():0;let i=[];return Array.isArray(n.nodes)&&n.nodes.length?i=n.nodes.map(e=>({...e})):n.content&&(i=p(n.content,null!=w?w:wr,v)),r&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-o),nodes:i.length,contentLength:null!=(t=null==(e=n.content)?void 0:e.length)?t:0}),i},[n.content,n.debugPerformance,n.nodes,v,w,n.customId,l,g]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!y.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==de(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const r=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)},o=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),i=r(()=>{ke()},{timeout:900});return()=>o(i)},[y,n.renderCodeBlocksAsPre]),s(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&i.current!==t&&(i.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=We.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return We.set(e,t),t}catch{}const n="__theme_"+ ++Oe;return We.set(e,n),n}return String(e)}(e);t&&_e!==t&&($e=e,_e=t,je&&De($e,je).then(()=>Pe()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const x=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),k=o(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips]),b=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:x,typewriter:n.typewriter,customComponents:a,showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:k,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,x,n.typewriter,n.showTooltips,n.renderCodeBlocksAsPre,n.codeBlockStream,k,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,a]);/* @__PURE__ */
194
- return e(S,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(xr,{props:n,parsedNodes:y,renderCtx:b,indexPrefix:x,containerRef:r})})};function br(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
195
- return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(kr,{nodes:c.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:s.customId,isDark:s.isDark,typewriter:s.typewriter,viewportPriority:!0,codeBlockStream:s.codeBlockStream,renderCodeBlocksAsPre:s.renderCodeBlocksAsPre,codeBlockProps:s.codeBlockProps,themes:null==(n=s.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=s.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=s.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=s.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=s.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=s.codeBlockThemes)?void 0:a.maxWidth,onCopy:s.events.onCopy,onHandleArtifactClick:s.events.onHandleArtifactClick}):null})}function Cr(r){const l={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0,...r},a=o(()=>{var e;return String(null!=(e=l.node.language)?e:"")},[l.node.language]),u=o(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(a),[a]),m=o(()=>de(a),[a]),[h,p]=i(0);s(()=>pe(()=>{p(e=>e+1)}),[]);const g=o(()=>{const e=fe[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),f=o(()=>ge(m),[m,h]),{t:w}=X(),v=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),y=o(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),r=t(l.maxWidth);return n&&(e.minWidth=n),r&&(e.maxWidth=r),e},[l.maxWidth,l.minWidth]),[x,k]=i(!1),[b,C]=i(!1),[M,N]=i(!1),[B,L]=i(""),[T,E]=i(!1),[S,D]=i(14),[$,_]=i(S),j=o(()=>!1!==l.showTooltips,[l.showTooltips]),A=c(null),W=c(null),O=c(null),P=c(null),I=c(!1),R=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),F=d(e=>{if(!e)return L(""),void E(!1);var t;L(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`),E(!1)},[]),H=d(()=>{L(""),E(!0)},[]),z=d(async()=>{if(!P.current&&!I.current){I.current=!0;try{const e=await import("stream-markdown");P.current=e.createShikiStreamRenderer}catch{}}},[]),V=d(async()=>{if(await z(),A.current&&W.current)if(!O.current&&P.current&&(O.current=P.current(W.current,{theme:R(),themes:l.themes}),E(!0)),O.current)if(!1===l.stream&&l.loading)F(l.node.code);else{F(l.node.code);try{await O.current.updateCode(l.node.code,u),H()}catch{}}else F(l.node.code);else F(l.node.code)},[H,z,R,u,l.loading,l.node.code,l.stream,l.themes,F]);s(()=>(V(),()=>{var e;null==(e=O.current)||e.dispose(),O.current=null}),[V]),s(()=>{O.current&&O.current.setTheme(R())},[R]),s(()=>{O.current&&(!1===l.stream&&l.loading||(F(l.node.code),Promise.resolve(O.current.updateCode(l.node.code,u)).then(()=>H()).catch(()=>{})))},[H,u,l.loading,l.node.code,l.stream,F]),s(()=>{j||te(!0)},[j]);const K=d((e,t)=>{if(!j)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,l.isDark))},[l.isDark,j]),q=d(()=>{j&&te()},[j]),U=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),k(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>k(!1),1e3)}catch{}},[l]),Y=d(()=>{var e;if(!v)return;const t="html"===u?"text/html":"image/svg+xml",n="html"===u?"HTML Preview":"SVG Preview";null==(e=l.onPreviewCode)||e.call(l,{type:t,content:l.node.code,title:n})},[v,u,l]),Z=o(()=>({fontSize:`${$}px`}),[$]);return s(()=>{D(14),_(14)},[]),/* @__PURE__ */n("div",{className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",l.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:y,children:[l.showHeader&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
189
+ return e(lr,{node:t,ctx:o,typewriter:o.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */e(bt,{node:t,typewriter:o.typewriter,customId:o.customId},n):/* @__PURE__ */e(Wt,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
190
+ return e(pr,{node:t,ctx:o,renderNode:fr,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
191
+ return e(or,{node:t},n)}}const wr={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},vr=h();function yr(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function xr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const kr=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:c,containerRef:u})=>{var m,h,p,g,f,w,v;const y=D(),x="undefined"!=typeof window,k="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,b=Math.max(0,Math.trunc(null!=(m=t.renderBatchSize)?m:80)),C=Math.max(0,Math.trunc(null!=(h=t.initialRenderBatchSize)?h:b||r.length)),M=!1!==t.batchRendering&&b>0&&x,N=Math.max(0,null!=(p=t.liveNodeBuffer)?p:60),B=Math.max(1,null!=(g=t.maxLiveNodes)?g:320),L=(null!=(f=t.maxLiveNodes)?f:0)>0&&r.length>B,T=!1!==t.viewportPriority,E=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,S=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&T},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,T,L]),[$,_]=i(()=>E?Math.min(r.length,C):r.length),j=a($);s(()=>{j.current=$},[$]);const A=E?$:r.length,[P,W]=i(0),[O,I]=i({start:0,end:r.length}),R=a(/* @__PURE__ */new Map),[F,H]=i(0),z=a({}),V=a(/* @__PURE__ */new Map),X=a(/* @__PURE__ */new Map),K=a(/* @__PURE__ */new Map),q=a(/* @__PURE__ */new Map),U=a(/* @__PURE__ */new Set),Y=a($),Z=a(null),G=a(null),J=a(null),Q=a(!1),ee=a(null),te=a(Math.max(1,b||1)),ne=a(r.length),re=a({key:t.indexKey,total:r.length}),oe=a({batchSize:b,initial:C,delay:null!=(v=t.renderBatchDelay)?v:16,enabled:E}),ie=S||L,le=o(()=>{const e=R.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[F]),ae=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(O.start,e)),n=Math.max(t,Math.min(O.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,O,L]),ce=o(()=>{if(!L)return r.length;const e=Math.max(O.end+N,C),t=Math.min(r.length,e);return Math.max($,t)},[r.length,L,O.end,N,C,$]);ne.current=ce;const se=d((e,t)=>{var n;if(e>=t)return 0;const r=R.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:le;return o},[le]),de=L?se(0,Math.min(O.start,r.length)):0,ue=L?se(Math.min(O.end,r.length),r.length):0,me=d(()=>{null!=Z.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(Z.current),Z.current=null),null!=G.current&&(window.clearTimeout(G.current),G.current=null),null!=J.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(J.current),J.current=null),Q.current=!1,ee.current=null},[]),he=d(e=>{var n;if(!E)return;const r=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6),o=Math.max(1,b||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?te.current=Math.max(i,Math.floor(.7*te.current)):e<.5*r&&te.current<o&&(te.current=Math.min(o,Math.ceil(1.2*te.current)))},[E,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!E)return;const i=ne.current;if(j.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();_(t=>{const n=Math.min(ne.current,t+Math.max(1,e));return j.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();he(n-t)},c=()=>{const e=Math.max(1,Math.round(te.current));pe(e)},s=e=>{var n;Z.current=null,G.current=null,J.current=null,Q.current=!1;const r=ee.current;if(ee.current=null,a(null!=r?r:l),j.current>=ne.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;j.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));j.current<ne.current&&c()};if(!x||n.immediate)return void s();const d=Math.max(0,null!=(r=t.renderBatchDelay)?r:16);if(ee.current=null!=ee.current?Math.max(ee.current,l):l,!Q.current){if(Q.current=!0,k){const e=Math.max(0,null!=(o=t.renderBatchIdleTimeoutMs)?o:120);return void(J.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?Z.current=requestAnimationFrame(()=>{0!==d?G.current=window.setTimeout(()=>s(),d):s()}):G.current=window.setTimeout(()=>s(),d)}},[he,k,E,x,t.renderBatchDelay,t.renderBatchBudgetMs,t.renderBatchIdleTimeoutMs]);s(()=>{var e;const n=t.indexKey,o=r.length,i=re.current,l=void 0!==n?n!==i.key:o!==i.total;re.current={key:n,total:o};const a=oe.current,c=null!=(e=t.renderBatchDelay)?e:16,s=a.batchSize!==b||a.initial!==C||a.delay!==c||a.enabled!==E;if(oe.current={batchSize:b,initial:C,delay:c,enabled:E},(l||s||!E)&&me(),(l||s)&&(te.current=Math.max(1,b||1),U.current.clear()),!o)return j.current=0,void _(0);const d=ne.current;if(!E)return j.current=d,void _(d);if(l||s){const e=Math.min(d,C);return j.current=e,_(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(j.current,d);u!==j.current&&(j.current=u,_(u)),j.current<d&&pe(Math.max(1,b||1))},[me,E,x,r.length,t.indexKey,t.renderBatchDelay,b,C,pe]),s(()=>{if(!L)return void I({start:0,end:r.length});const e=r.length;if(!e)return void I({start:0,end:0});const t=Math.max(0,Math.min(P,e-1));let n=Math.max(0,t-N),o=Math.min(e,t+N+1);const i=o-n;if(i>B){const e=i-B;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<B){const t=B-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}I({start:n,end:o})},[P,N,B,r.length,L]),s(()=>()=>{me();for(const e of V.current.values())e.destroy();V.current.clear()},[me]);const ge=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete z.current[t],X.current.delete(t),K.current.delete(t),q.current.delete(t))},[]);s(()=>{ge(A)},[ge,A]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(R.current.keys()))n>=e&&(R.current.delete(n),t=!0);t&&H(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(U.current))n>=e&&U.current.delete(n)},[r.length]);const fe=d((e,t)=>{S&&t&&(z.current[e]=!0),t&&L&&W(t=>e>t?e:t)},[S,L]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),ve=d((e,t)=>{const n=X.current;if(t?n.set(e,t):n.delete(e),!ie||!t)return we(e),S&&!t&&delete z.current[e],void(t&&fe(e,!0));if(e<C&&!L)return we(e),void fe(e,!0);we(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&fe(e,!0),r.whenVisible.then(()=>fe(e,!0)).catch(()=>{})},[S,we,fe,y,C,ie,L]),ye=d(e=>{const t=K.current.get(e);if(t)return t;const n=t=>ve(e,t);return K.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(R.current.has(e)&&(R.current.delete(e),H(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&R.current.get(e)!==n&&(R.current.set(e,n),H(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),ke=d(e=>{const t=q.current.get(e);if(t)return t;const n=t=>xe(e,t);return q.current.set(e,n),n},[xe]),be=d(e=>!(E&&e>=j.current)&&(!S||e<C||!0===z.current[e]),[S,E,C]),Ce=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 X.current.entries())t&&ve(e,t)},[ve]),s(()=>{L&&$>Y.current&&W($-1),Y.current=$},[$,L]);const Me=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${de}px`},"aria-hidden":"true"}):null,Ne=L?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
192
+ return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":t.customId,onClick:t.onClick,onMouseOver:Ce(t.onMouseOver),onMouseOut:Ce(t.onMouseOut),children:[Me,ae.map(({node:n,index:r})=>{var o;const i=be(r),a=null!=(o=R.current.get(r))?o:le,s=!1!==t.typewriter&&"code_block"!==n.type&&!U.current.has(r)&&i;return s&&U.current.add(r),/* @__PURE__ */e("div",{ref:ye(r),className:"node-slot","data-node-index":r,"data-node-type":n.type,children:/* @__PURE__ */e("div",i?{ref:ke(r),className:"node-content"+(s?" typewriter-node":""),children:fr(n,`${c}-${r}`,l)}:{className:"node-placeholder",style:{height:`${a}px`}})},`${c}-${r}`)}),Ne]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),br=t=>{const n={...wr,...t},r=a(null),i=a(null),l=u(P,W,W),c=o(()=>I(n.customId),[n.customId,l]),d=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=o(()=>Object.keys(c).map(String).map(e=>e.trim().toLowerCase()).filter(xr),[c]),g=o(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...m].map(yr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,l]),f=o(()=>{const e=g;return e&&0!==e.length?h(d,{customHtmlTags:e}):h(d)},[d,g]),w=o(()=>{const e=f;return n.customMarkdownIt?n.customMarkdownIt(e):e},[f,n.customMarkdownIt]),v=o(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,l=g.length>0;return i||l?{...r,...i?{final:o}:{},...l?{customHtmlTags:g}:{}}:r},[g,n.final,n.parseOptions]),y=o(()=>{var e,t;const r=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,o=r?performance.now():0;let i=[];return Array.isArray(n.nodes)&&n.nodes.length?i=n.nodes.map(e=>({...e})):n.content&&(i=p(n.content,null!=w?w:vr,v)),r&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-o),nodes:i.length,contentLength:null!=(t=null==(e=n.content)?void 0:e.length)?t:0}),i},[n.content,n.debugPerformance,n.nodes,v,w,n.customId,l,g]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!y.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==de(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const r=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)},o=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),i=r(()=>{ke()},{timeout:900});return()=>o(i)},[y,n.renderCodeBlocksAsPre]),s(()=>{if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&i.current!==t&&(i.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Pe.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Pe.set(e,t),t}catch{}const n="__theme_"+ ++We;return Pe.set(e,n),n}return String(e)}(e);t&&_e!==t&&($e=e,_e=t,je&&De($e,je).then(()=>Oe()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const x=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),k=o(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips]),b=o(()=>({...n.mermaidProps||{}}),[n.mermaidProps]),C=o(()=>({...n.d2Props||{}}),[n.d2Props]),M=o(()=>({...n.infographicProps||{}}),[n.infographicProps]),N=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:x,typewriter:n.typewriter,customComponents:c,showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:k,mermaidProps:b,d2Props:C,infographicProps:M,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,x,n.typewriter,n.showTooltips,n.renderCodeBlocksAsPre,n.codeBlockStream,k,b,C,M,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,c]);/* @__PURE__ */
193
+ return e(S,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(kr,{props:n,parsedNodes:y,renderCtx:N,indexPrefix:x,containerRef:r})})};function Cr(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
194
+ return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,children:null!=m?m:s&&d?/* @__PURE__ */e(br,{nodes:c.children||[],indexKey:`blockquote-${String(null!=u?u:"blockquote")}`,customId:s.customId,isDark:s.isDark,typewriter:s.typewriter,viewportPriority:!0,codeBlockStream:s.codeBlockStream,renderCodeBlocksAsPre:s.renderCodeBlocksAsPre,codeBlockProps:s.codeBlockProps,themes:null==(n=s.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=s.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=s.codeBlockThemes)?void 0:o.lightTheme,codeBlockMonacoOptions:null==(i=s.codeBlockThemes)?void 0:i.monacoOptions,codeBlockMinWidth:null==(l=s.codeBlockThemes)?void 0:l.minWidth,codeBlockMaxWidth:null==(a=s.codeBlockThemes)?void 0:a.maxWidth,showTooltips:s.showTooltips,onCopy:s.events.onCopy,onHandleArtifactClick:s.events.onHandleArtifactClick}):null})}function Mr(r){const l={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0,...r},c=o(()=>{var e;return String(null!=(e=l.node.language)?e:"")},[l.node.language]),u=o(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(c),[c]),m=o(()=>de(c),[c]),[h,p]=i(0);s(()=>pe(()=>{p(e=>e+1)}),[]);const g=o(()=>{const e=fe[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),f=o(()=>ge(m),[m,h]),{t:w}=X(),v=o(()=>!!l.isShowPreview&&("html"===m||"svg"===m),[m,l.isShowPreview]),y=o(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(l.minWidth),r=t(l.maxWidth);return n&&(e.minWidth=n),r&&(e.maxWidth=r),e},[l.maxWidth,l.minWidth]),[x,k]=i(!1),[b,C]=i(!1),[M,N]=i(!1),[B,L]=i(""),[T,E]=i(!1),[S,D]=i(14),[$,_]=i(S),j=o(()=>!1!==l.showTooltips,[l.showTooltips]),A=a(null),P=a(null),W=a(null),O=a(null),I=a(!1),R=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),F=d(e=>{if(!e)return L(""),void E(!1);var t;L(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code></pre>`),E(!1)},[]),H=d(()=>{L(""),E(!0)},[]),z=d(async()=>{if(!O.current&&!I.current){I.current=!0;try{const e=await import("stream-markdown");O.current=e.createShikiStreamRenderer}catch{}}},[]),V=d(async()=>{if(await z(),A.current&&P.current)if(!W.current&&O.current&&(W.current=O.current(P.current,{theme:R(),themes:l.themes}),E(!0)),W.current)if(!1===l.stream&&l.loading)F(l.node.code);else{F(l.node.code);try{await W.current.updateCode(l.node.code,u),H()}catch{}}else F(l.node.code);else F(l.node.code)},[H,z,R,u,l.loading,l.node.code,l.stream,l.themes,F]);s(()=>(V(),()=>{var e;null==(e=W.current)||e.dispose(),W.current=null}),[V]),s(()=>{W.current&&W.current.setTheme(R())},[R]),s(()=>{W.current&&(!1===l.stream&&l.loading||(F(l.node.code),Promise.resolve(W.current.updateCode(l.node.code,u)).then(()=>H()).catch(()=>{})))},[H,u,l.loading,l.node.code,l.stream,F]),s(()=>{j||te(!0)},[j]);const K=d((e,t)=>{if(!j)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,l.isDark))},[l.isDark,j]),q=d(()=>{j&&te()},[j]),U=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(l.node.code),k(!0),null==(e=l.onCopy)||e.call(l,l.node.code),setTimeout(()=>k(!1),1e3)}catch{}},[l]),Y=d(()=>{var e;if(!v)return;const t="html"===u?"text/html":"image/svg+xml",n="html"===u?"HTML Preview":"SVG Preview";null==(e=l.onPreviewCode)||e.call(l,{type:t,content:l.node.code,title:n})},[v,u,l]),Z=o(()=>({fontSize:`${$}px`}),[$]);return s(()=>{D(14),_(14)},[]),/* @__PURE__ */n("div",{className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",l.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:y,children:[l.showHeader&&/* @__PURE__ */n("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
196
195
  /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
197
196
  /* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:f}}),
198
197
  /* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:g})]}),
199
- /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
200
- /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":M,onClick:()=>N(e=>!e),onMouseEnter:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onFocus:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{style:{rotate:M?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */n(t,{children:[
198
+ /* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[l.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":M,onClick:()=>N(e=>!e),onMouseEnter:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onFocus:e=>K(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{style:{rotate:M?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),l.showFontSizeButtons&&l.enableFontSizeControl&&/* @__PURE__ */n(t,{children:[
201
199
  /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$<=10,onClick:()=>_(e=>Math.max(10,e-1)),onMouseEnter:e=>K(e,w("common.decrease")||"Decrease"),onFocus:e=>K(e,w("common.decrease")||"Decrease"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
202
200
  /* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$===S,onClick:()=>_(S),onMouseEnter:e=>K(e,w("common.reset")||"Reset"),onFocus:e=>K(e,w("common.reset")||"Reset"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
203
201
  /* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
@@ -207,9 +205,9 @@ return e("blockquote",{className:"blockquote-node",dir:"auto",cite:c.cite,childr
207
205
  /* @__PURE__ */e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),l.showExpandButton&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":b,onClick:()=>C(e=>!e),onMouseEnter:e=>K(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onFocus:e=>K(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",b?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})})}),v&&l.showPreviewButton&&/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":w("common.preview")||"Preview",onClick:Y,onMouseEnter:e=>K(e,w("common.preview")||"Preview"),onFocus:e=>K(e,w("common.preview")||"Preview"),onMouseLeave:q,onBlur:q,children:/* @__PURE__ */e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */n("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
208
206
  /* @__PURE__ */e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),
209
207
  /* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!M&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:A,className:"code-block-content",style:{...Z,maxHeight:b?"none":"500px",overflowY:b?"visible":"auto",overflowX:"auto"},children:[
210
- /* @__PURE__ */e("div",{ref:W,className:"code-block-render"}),!T&&B&&/* @__PURE__ */e("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:B}})]}),!l.stream&&l.loading&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
208
+ /* @__PURE__ */e("div",{ref:P,className:"code-block-render"}),!T&&B&&/* @__PURE__ */e("div",{className:"code-fallback-plain",dangerouslySetInnerHTML:{__html:B}})]}),!l.stream&&l.loading&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
211
209
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
212
210
  /* @__PURE__ */e("div",{className:"skeleton-line"}),
213
211
  /* @__PURE__ */e("div",{className:"skeleton-line short"})]})}),
214
- /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:x?w("common.copied")||"Copied":""})]})}function Mr(t){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}(t.isDark),[t.isDark]);return s(()=>{if(!t.visible)return void a(!1);if(!t.anchorEl||!r.current)return void a(!0);let e=null,n=!1;const o=async()=>{var e,o;if(!t.anchorEl||!r.current)return;const{x:i,y:l}=await f(t.anchorEl,r.current,{placement:null!=(e=t.placement)?e:"top",middleware:[w(null!=(o=t.offset)?o:8),v(),y({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)}),e=g(t.anchorEl,r.current,o),()=>{n=!0,null==e||e()}},[t.anchorEl,t.offset,t.placement,t.visible]),"undefined"==typeof document?null:t.visible&&l?x(
215
- /* @__PURE__ */e("div",{id:null!=(n=t.id)?n:void 0,ref:r,style:d,className:["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:t.content}),document.body):null}export{B as AdmonitionNode,br as BlockquoteNode,H as CheckboxNode,Fe as CodeBlockNode,nt as D2BlockNode,rt as DefinitionListNode,ot as EmojiNode,it as EmphasisNode,rr as FallbackComponent,lt as FootnoteAnchorNode,at as FootnoteNode,ct as FootnoteReferenceNode,st as HardBreakNode,dt as HeadingNode,ut as HighlightNode,bt as HtmlBlockNode,Ot as HtmlInlineNode,we as HtmlPreviewFrame,It as ImageNode,Vt as InfographicBlockNode,Xt as InlineCodeNode,Kt as InsertNode,qt as LinkNode,Ut as ListItemNode,Yt as ListNode,Dn as MERMAID_WORKER_BUSY_CODE,Cr as MarkdownCodeBlockNode,kn as MathBlockNode,bn as MathInlineNode,Gn as MermaidBlockNode,kr as NodeRenderer,or as ParagraphNode,Ie as PreCodeNode,Fe as ReactCodeBlockNode,ir as ReferenceNode,lr as StrikethroughNode,ar as StrongNode,cr as SubscriptNode,sr as SuperscriptNode,dr as TableNode,ur as TextNode,mr as ThematicBreakNode,Mr as Tooltip,hr as VmrContainerNode,cn as WORKER_BUSY_CODE,An as canParseOffthread,F as clearGlobalCustomComponents,un as clearKaTeXCache,ln as clearKaTeXWorker,_n as clearMermaidWorker,kr as default,Ye as disableD2,Ue as enableD2,Wn as findPrefixOffthread,I as getCustomNodeComponents,fn as getKaTeXBackpressureDefaults,ge as getLanguageIcon,Sn as getMermaidWorkerLoad,Ze as isD2Enabled,fe as languageMap,de as normalizeLanguageIdentifier,he as preloadExtendedLanguageIcons,R as removeCustomComponents,sn as renderKaTeXInWorker,wn as renderKaTeXWithBackpressure,gr as renderNode,ue as resolveMonacoLanguageId,P as setCustomComponents,qe as setD2Loader,V as setDefaultI18nMap,gn as setKaTeXBackpressureDefaults,dn as setKaTeXCache,mn as setKaTeXConcurrencyLimit,on as setKaTeXWorker,an as setKaTeXWorkerDebug,ae as setLanguageIconResolver,$n as setMermaidWorker,Tn as setMermaidWorkerClientDebug,En as setMermaidWorkerMaxConcurrency,pe as subscribeLanguageIconsRevision,On as terminateWorker,X as useSafeI18n,hn as waitForKaTeXWorkerSlot};
212
+ /* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:x?w("common.copied")||"Copied":""})]})}function Nr(t){var n;const r=a(null),[l,c]=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}(t.isDark),[t.isDark]);return s(()=>{if(!t.visible)return void c(!1);if(!t.anchorEl||!r.current)return void c(!0);let e=null,n=!1;const o=async()=>{var e,o;if(!t.anchorEl||!r.current)return;const{x:i,y:l}=await f(t.anchorEl,r.current,{placement:null!=(e=t.placement)?e:"top",middleware:[w(null!=(o=t.offset)?o:8),v(),y({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||c(!0)}),e=g(t.anchorEl,r.current,o),()=>{n=!0,null==e||e()}},[t.anchorEl,t.offset,t.placement,t.visible]),"undefined"==typeof document?null:t.visible&&l?x(
213
+ /* @__PURE__ */e("div",{id:null!=(n=t.id)?n:void 0,ref:r,style:d,className:["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:t.content}),document.body):null}export{B as AdmonitionNode,Cr as BlockquoteNode,H as CheckboxNode,Fe as CodeBlockNode,nt as D2BlockNode,rt as DefinitionListNode,ot as EmojiNode,it as EmphasisNode,or as FallbackComponent,lt as FootnoteAnchorNode,at as FootnoteNode,ct as FootnoteReferenceNode,st as HardBreakNode,dt as HeadingNode,ut as HighlightNode,bt as HtmlBlockNode,Wt as HtmlInlineNode,we as HtmlPreviewFrame,It as ImageNode,Vt as InfographicBlockNode,Xt as InlineCodeNode,Kt as InsertNode,qt as LinkNode,Ut as ListItemNode,Yt as ListNode,$n as MERMAID_WORKER_BUSY_CODE,Mr as MarkdownCodeBlockNode,kn as MathBlockNode,bn as MathInlineNode,Jn as MermaidBlockNode,br as NodeRenderer,ir as ParagraphNode,Ie as PreCodeNode,Fe as ReactCodeBlockNode,lr as ReferenceNode,ar as StrikethroughNode,cr as StrongNode,sr as SubscriptNode,dr as SuperscriptNode,ur as TableNode,mr as TextNode,hr as ThematicBreakNode,Nr as Tooltip,pr as VmrContainerNode,cn as WORKER_BUSY_CODE,Pn as canParseOffthread,F as clearGlobalCustomComponents,un as clearKaTeXCache,ln as clearKaTeXWorker,jn as clearMermaidWorker,br as default,Ye as disableD2,Ue as enableD2,Wn as findPrefixOffthread,I as getCustomNodeComponents,fn as getKaTeXBackpressureDefaults,ge as getLanguageIcon,Dn as getMermaidWorkerLoad,Ze as isD2Enabled,fe as languageMap,de as normalizeLanguageIdentifier,he as preloadExtendedLanguageIcons,R as removeCustomComponents,sn as renderKaTeXInWorker,wn as renderKaTeXWithBackpressure,fr as renderNode,ue as resolveMonacoLanguageId,O as setCustomComponents,qe as setD2Loader,V as setDefaultI18nMap,gn as setKaTeXBackpressureDefaults,dn as setKaTeXCache,mn as setKaTeXConcurrencyLimit,on as setKaTeXWorker,an as setKaTeXWorkerDebug,ae as setLanguageIconResolver,_n as setMermaidWorker,En as setMermaidWorkerClientDebug,Sn as setMermaidWorkerMaxConcurrency,pe as subscribeLanguageIconsRevision,On as terminateWorker,X as useSafeI18n,hn as waitForKaTeXWorkerSlot};