markstream-react 0.0.27 → 0.0.28
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.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +105 -107
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,42 +3,42 @@ import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import r,{useMem
|
|
|
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
|
|
7
|
-
return e(
|
|
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 U(){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 X=null,K=null,q=null,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=null)}async function Q(e){if(!X||!K)return;const{x:t,y:n}=await g(K,X,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});X.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(X||"undefined"==typeof document||(X=document.createElement("div"),X.className="ms-tooltip",X.setAttribute("role","tooltip"),X.dataset.visible="false",X.style.position="fixed",X.style.left="0px",X.style.top="0px",X.style.transform="translate3d(0,0,0)",document.body.appendChild(X)),!X)return;J();const l=async()=>{if(X){K=e,X.textContent=t,X.dataset.placement=n,X.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",X.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,X.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),X.dataset.visible="true",null==q||q(),q=f(e,X,()=>{Q(n)})}};r?l():Y=setTimeout(l,80)}function te(e=!1){if(!X)return;J();const t=()=>{if(X){if(X.dataset.visible="false",K&&G)try{K.removeAttribute("aria-describedby")}catch{}K=null,G=null,q&&(q(),q=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 fe(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 ge={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}=U(),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 S=c(null);function L(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 f=((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 f?(i.set(l,{resolve:u,state:d}),f.observe(l),{isVisible:()=>d.current,whenVisible:h,destroy:p}):(d.current=!0,u(),{isVisible:()=>!0,whenVisible:h,destroy:p})}}const T=L(()=>null,()=>!0);function E({getRoot:t,enabled:n=!0,children:r}){const i=a(n);i.current=n;const l=a(t);l.current=t;const c=o(()=>L(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
|
|
7
|
+
return e(S.Provider,{value:c,children:r})}function D(){var e;return null!=(e=l(S))?e:T}const $="__global__",j="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",A=(()=>{const e=globalThis;if(e[j])return e[j];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[j]=t,t})();function _(){A.revision++;for(const e of Array.from(A.listeners))try{e()}catch{}}function W(e){return A.listeners.add(e),()=>{A.listeners.delete(e)}}function P(){return A.revision}function O(e,t){"string"==typeof e?A.scopedComponents[e]={...t||{}}:A.scopedComponents[$]={...e},_()}function R(e){const t=A.scopedComponents[$]||{};if(!e)return t;const n=A.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function I(e){if(e===$)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete A.scopedComponents[e],_()}function H(){delete A.scopedComponents[$],_()}function F(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 K(){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 U=null,X=null,q=null,Y=null,Z=null,G=null;function J(){Y&&(clearTimeout(Y),Y=null),Z&&(clearTimeout(Z),Z=null)}async function Q(e){if(!U||!X)return;const{x:t,y:n}=await g(X,U,{placement:e,middleware:[w(8),v(),y({padding:8})],strategy:"fixed"});U.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(U||"undefined"==typeof document||(U=document.createElement("div"),U.className="ms-tooltip",U.setAttribute("role","tooltip"),U.dataset.visible="false",U.style.position="fixed",U.style.left="0px",U.style.top="0px",U.style.transform="translate3d(0,0,0)",document.body.appendChild(U)),!U)return;J();const l=async()=>{if(U){X=e,U.textContent=t,U.dataset.placement=n,U.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",U.dataset.visible="false",G=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,U.id=G;try{e.setAttribute("aria-describedby",G)}catch{}await Q(n),U.dataset.visible="true",null==q||q(),q=f(e,U,()=>{Q(n)})}};r?l():Y=setTimeout(l,80)}function te(e=!1){if(!U)return;J();const t=()=>{if(U){if(U.dataset.visible="false",X&&G)try{X.removeAttribute("aria-describedby")}catch{}X=null,G=null,q&&(q(),q=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 fe(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 ge={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}=K(),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,
|
|
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 Ie={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},He=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Fe(e){var t;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const n=e;return{...He,...n,enabled:null==(t=n.enabled)||t}}return{...He}}function ze(e,t){var n;const r=t?{...t}:{};if(!e)return r;const o=void 0===r.diffHideUnchangedRegions?{...He}:Fe(r.diffHideUnchangedRegions),i=void 0===r.hideUnchangedRegions?void 0:Fe(r.hideUnchangedRegions),l=null!=(n=r.diffUnchangedRegionStyle)?n:"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:12,lineNumbersMinChars:2,glyphMargin:!1,fontSize:13,lineHeight:30,renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,padding:{top:10,bottom:"line-info"===l||"line-info-basic"===l||"metadata"===l?22:14},diffHideUnchangedRegions:o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:l,diffHunkActionsOnHover:!0,diffHunkHoverHideDelayMs:160,...r,...void 0===i?{}:{hideUnchangedRegions:i},diffHideUnchangedRegions:o}}function Ve(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Ue(r){var l;const c={...Ie,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:f,enableFontSizeControl:g,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:S}=c,E=a(null),$=a(null),A=a(null),_=a(null),j=a(null),P=a(null),W=a(null),O=a(0),R=a(null),I=a(null),H=D(),F=a(y),z=a(null),V=a(null),[X,K]=i(!1),[q,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}=U(),Be=o(()=>ze(Boolean(u.diff),y),[y,u.diff]),[Le,Te]=i(()=>{var e;const t=Number(null==(e=ze(Boolean(u.diff),y))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:14}),[Se,Ee]=i(Le),Pe=o(()=>!1!==S,[S]),We=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},[]),He=d(e=>{var t,n,r,o;if(X)return;const i=E.current,l=A.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=We();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{}},[We,X]);s(()=>pe(()=>{Me(e=>e+1)}),[]),s(()=>{ae(de(u.language))},[u.language]);const Fe=a(u);Fe.current=u;const Ue=d(()=>{var e;O.current+=1;try{null==(e=_.current)||e.call(_)}catch{}j.current=null,P.current=null,W.current=null,re(!1),Q(!1)},[]),Xe=d(()=>{var e,t,n,r,o,i;const l=E.current,a=$.current;if(!l||!a)return;if(u.diff)return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");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{}},[u.diff]),Ke=o(()=>m?w:v,[w,m,v]),qe=d(()=>{var e;const t=null==Be?void 0:Be.theme,n=null!=(e=null!=Ke?Ke:t)?e:$e,r=Array.isArray(x)?x:[];if(!r.length||null==n)return n;const o=Ve(n),i=r.map(e=>Ve(e)).filter(e=>!!e);if(!o||i.includes(o))return n;const l=Ve(t);return null!=t&&l&&i.includes(l)?t:r[0]},[Ke,Be,x]),Ye=o(()=>qe(),[qe]),Ze=o(()=>function(e,t){var n;const r=(null!=(n=Ve(e))?n:"").toLowerCase();return r?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>r.includes(e))&&!["light","latte","dawn","lotus"].some(e=>r.includes(e)):t}(Ye,Boolean(m)),[m,Ye]),Ge=o(()=>{if(!u.diff)return Ze?"dark":"light";const e=null==Be?void 0:Be.diffAppearance;return"light"===e||"dark"===e?e:m?"dark":"light"},[m,u.diff,Ze,Be]),Je=o(()=>u.diff?"dark"===Ge:Ze,[Ge,u.diff,Ze]),Qe=d(()=>({wordWrap:"on",wrappingIndent:"same",themes:x,...Be||{},theme:Ye,...u.diff?{diffAppearance:Ge}:{},onThemeChange(){Xe()}}),[Ge,u.diff,Ye,Be,Xe,x]),et=d(()=>{const e=Qe(),t=z.current;if(!t)return z.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[Qe]),tt=o(()=>{var e,t,n,r,o,i,l;return JSON.stringify({diffLineStyle:null!=(e=null==Be?void 0:Be.diffLineStyle)?e:"background",diffUnchangedRegionStyle:null!=(t=null==Be?void 0:Be.diffUnchangedRegionStyle)?t:"line-info",diffHideUnchangedRegions:null==(n=null==Be?void 0:Be.diffHideUnchangedRegions)||n,renderSideBySide:null==(r=null==Be?void 0:Be.renderSideBySide)||r,enableSplitViewResizing:null==(o=null==Be?void 0:Be.enableSplitViewResizing)||o,ignoreTrimWhitespace:null==(i=null==Be?void 0:Be.ignoreTrimWhitespace)||i,originalEditable:null!=(l=null==Be?void 0:Be.originalEditable)&&l})},[Be]);s(()=>{F.current=Be,et()},[Be,et]),s(()=>()=>{var e,t,n;O.current+=1,null==(e=_.current)||e.call(_),_.current=null,j.current=null,P.current=null,W.current=null,R.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=$.current;if(!n)return;null==(t=null==(e=I.current)?void 0:e.destroy)||t.call(e);const r=H(n,{rootMargin:"400px"});return I.current=r,r.isVisible()&&Y(!0),r.whenVisible.then(()=>Y(!0)),()=>{r.destroy(),I.current===r&&(I.current=null)}},[H,q]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:A.current?(et(),()=>{e=!1}):((async()=>{try{const n=await ke();if(!e)return;if(!n)return void K(!0);const r=n.useMonaco,o=n.detectLanguage;if("function"==typeof o&&(R.current=o),"function"!=typeof r)return void K(!0);const i=r(et());A.current=i,"function"==typeof(t=i.setTheme)&&(_e=t,null!=$e&&null!=Ae&&De($e,_e).then(()=>Oe()).catch(()=>{})),_.current="function"==typeof i.safeClean?()=>i.safeClean():"function"==typeof i.cleanupEditor?()=>i.cleanupEditor():null,G(!0)}catch{e&&K(!0)}var t})(),()=>{e=!1})},[et]),s(()=>{var e;if(!u.language&&!le&&R.current)try{const t=R.current(String(null!=(e=u.code)?e:""));t&&ie(t)}catch{}},[le,u.code,u.language]);const nt=o(()=>String(u.language||le||oe||"plaintext"),[le,oe,u.language]),rt=o(()=>de(nt),[nt]),ot=o(()=>ue(rt),[rt]),it=o(()=>fe(rt),[rt,Ce]),lt=o(()=>!!f&&("html"===rt||"svg"===rt),[rt,f]),at=o(()=>{const e=rt;return e?ge[e]||e.charAt(0).toUpperCase()+e.slice(1):ge[""]||"Plain Text"},[rt]),ct=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]),st=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),u.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color=`var(--vscode-editor-foreground, ${Je?"#e5e7eb":"#111827"})`,t.backgroundColor=`var(--vscode-editor-background, ${Je?"#111827":"#ffffff"})`,t.borderColor=Je?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[b,k,u.diff,Je]),dt=o(()=>{if(!u.diff)return{color:`var(--vscode-editor-foreground, ${Je?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${Je?"#111827":"#ffffff"})`}},[u.diff,Je]),ut=!1===p&&h;s(()=>{if(X)return;if(!Z)return;if(!J||!q)return;const e=A.current;et();const t=()=>{var t;u.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),Xe(),ve||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>He(me)):null)&&He(me)};(null==e?void 0:e.setTheme)&&Ye?De(Ye,e.setTheme).then(t).catch(()=>{}):t()},[He,ve,J,Ge,me,Z,u.diff,Ye,Xe,et,X,q]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{Xe()},je.add(e),()=>{je.delete(e)}},[Xe]);const mt=d(async()=>{var e,t;if(X)return null;if(!q)return null;if(ve)return null;if(ut)return null;const n=A.current,r=E.current;if(!n||!r||!n.createEditor)return null;et();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(j.current)return j.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=_.current)||e.call(_),P.current=null,W.current=null,re(!1);const p=ot;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 f=Number(null==(d=F.current)?void 0:d.fontSize);if(Number.isFinite(f)&&f>0){Te(f),Ee(f);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:f,automaticLayout:!1})}catch{}}Xe(),me||ve||He(!1),re(!0)}catch{O.current===c&&K(!0)}})().finally(()=>{j.current===s&&(j.current=null)});return j.current=s,s},[He,ve,me,ot,ut,Xe,et,X,q]);s(()=>{et();const e=V.current;if(V.current=tt,!u.diff)return;if(X)return;if(!Z||!q||!J)return;if(ve||ut)return;if(e===tt)return;let t=!1;return(async()=>{if(Ue(),!t)try{await mt()}catch{}})(),()=>{t=!0}},[ve,J,mt,Z,tt,u.diff,Ue,ut,et,X,q]),s(()=>{X||Z&&q&&(ve||ut?Ue():mt())},[ve,mt,Z,Ue,ut,X,q]),s(()=>{var e;if(X)return;if(!Z)return;if(!q)return;if(ve)return;if(ut)return;const t=A.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=le;if(!o&&R.current)try{o=de(R.current(n)),o&&ae(o)}catch{}const i=ue(o||rt);if(t.createEditor&&E.current){try{await Promise.resolve(mt())}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{}me&&He(!0)})()},[He,rt,le,ve,J,mt,me,Z,u.code,u.diff,u.originalCode,u.updatedCode,ut,X,q]),s(()=>{if(X)return;if(!Z)return;if(!q)return;if(ve)return;if(ut)return;if(!me&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>He(me)):null;return null==e&&He(me),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[He,ve,me,h,Z,ut,X,q]),s(()=>{var e,t,n;if(!g)return;if(X)return;const r=A.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:Se})}catch{}He(me)}},[He,g,me,Se,u.diff,X]),s(()=>{Pe||te(!0)},[Pe]);const ht=d((e,t)=>{if(!Pe)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,Je))},[Je,Pe]),pt=d(()=>{Pe&&te()},[Pe]),ft=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(ct)),se(!0),null==(e=c.onCopy)||e.call(c,String(ct)),setTimeout(()=>se(!1),1e3)}catch{}},[c,ct]),gt=d(()=>{if(!lt)return;const e="html"===rt?"text/html":"image/svg+xml",t="html"===rt?Ne("artifacts.htmlPreviewTitle")||"HTML Preview":Ne("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof c.onPreviewCode?"html"===rt&&be(e=>!e):c.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${rt}-${Date.now()}`})},[rt,lt,u,c,Ne]);return X?/* @__PURE__ */e(Re,{node:u}):/* @__PURE__ */n("div",{ref:$,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Je?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",Je?"is-dark":"",u.diff?"is-diff":""].join(" "),style:st,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:dt,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,Se=null,Le=null;const Te=/* @__PURE__ */new WeakMap;let Ee=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=Te.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Te.set(e,t),t}catch{}const n="__theme_"+ ++Ee;return Te.set(e,n),n}return String(e)}(e);return n?(be!==t&&(be=t),Ce||Le!==n?!Me||Se!==n&&Ne!==n?(Be=e,Se=n,Me||(Ce=!0,Me=(async()=>{for(;null!=Be&&null!=Se;){const e=Be,t=Se;if(Be=null,Se=null,Le===t)continue;const n=be;if(!n)break;try{Ne=t,await Promise.resolve(n(e)),Le=t}catch{}}})().finally(()=>{Ce=!1,Me=null,Ne=null}),Me)):Me:Promise.resolve()):Promise.resolve()}let $e=null,je=null,Ae=null;const _e=/* @__PURE__ */new Set,We=/* @__PURE__ */new WeakMap;let Pe=0;function Oe(){for(const e of Array.from(_e))try{e()}catch{}}function Re({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 Ie={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0},He=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Fe(e){var t;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const n=e;return{...He,...n,enabled:null==(t=n.enabled)||t}}return{...He}}function ze(e,t){var n;const r=t?{...t}:{};if(!e)return r;const o=void 0===r.diffHideUnchangedRegions?{...He}:Fe(r.diffHideUnchangedRegions),i=void 0===r.hideUnchangedRegions?void 0:Fe(r.hideUnchangedRegions),l=null!=(n=r.diffUnchangedRegionStyle)?n:"line-info";return{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:12,lineNumbersMinChars:2,glyphMargin:!1,fontSize:13,lineHeight:30,renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,padding:{top:10,bottom:"line-info"===l||"line-info-basic"===l||"metadata"===l?22:14},diffHideUnchangedRegions:o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:l,diffHunkActionsOnHover:!0,diffHunkHoverHideDelayMs:160,...r,...void 0===i?{}:{hideUnchangedRegions:i},diffHideUnchangedRegions:o}}function Ve(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Ke(r){var l;const c={...Ie,...r},{node:u,isDark:m,loading:h,stream:p,isShowPreview:f,enableFontSizeControl:g,darkTheme:w,lightTheme:v,monacoOptions:y,themes:x,minWidth:k,maxWidth:b,showHeader:C,showCopyButton:M,showExpandButton:N,showPreviewButton:B,showCollapseButton:S,showFontSizeButtons:L,showTooltips:T}=c,E=a(null),$=a(null),j=a(null),A=a(null),_=a(null),W=a(null),P=a(null),O=a(0),R=a(null),I=a(null),H=D(),F=a(y),z=a(null),V=a(null),[U,X]=i(!1),[q,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}=K(),Be=o(()=>ze(Boolean(u.diff),y),[y,u.diff]),[Se,Le]=i(()=>{var e;const t=Number(null==(e=ze(Boolean(u.diff),y))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:14}),[Te,Ee]=i(Se),We=o(()=>!1!==T,[T]),Pe=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},[]),He=d(e=>{var t,n,r,o;if(U)return;const i=E.current,l=j.current;if(!i||!l)return;const a="diff"===W.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"===W.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,U]);s(()=>pe(()=>{Me(e=>e+1)}),[]),s(()=>{ae(de(u.language))},[u.language]);const Fe=a(u);Fe.current=u;const Ke=d(()=>{var e;O.current+=1;try{null==(e=A.current)||e.call(A)}catch{}_.current=null,W.current=null,P.current=null,re(!1),Q(!1)},[]),Ue=d(()=>{var e,t,n,r,o,i;const l=E.current,a=$.current;if(!l||!a)return;if(u.diff)return a.style.removeProperty("--vscode-editor-foreground"),a.style.removeProperty("--vscode-editor-background"),void a.style.removeProperty("--vscode-editor-selectionBackground");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{}},[u.diff]),Xe=o(()=>m?w:v,[w,m,v]),qe=d(()=>{var e;const t=null==Be?void 0:Be.theme,n=null!=(e=null!=Xe?Xe:t)?e:$e,r=Array.isArray(x)?x:[];if(!r.length||null==n)return n;const o=Ve(n),i=r.map(e=>Ve(e)).filter(e=>!!e);if(!o||i.includes(o))return n;const l=Ve(t);return null!=t&&l&&i.includes(l)?t:r[0]},[Xe,Be,x]),Ye=o(()=>qe(),[qe]),Ze=o(()=>function(e,t){var n;const r=(null!=(n=Ve(e))?n:"").toLowerCase();return r?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>r.includes(e))&&!["light","latte","dawn","lotus"].some(e=>r.includes(e)):t}(Ye,Boolean(m)),[m,Ye]),Ge=o(()=>{if(!u.diff)return Ze?"dark":"light";const e=null==Be?void 0:Be.diffAppearance;return"light"===e||"dark"===e?e:m?"dark":"light"},[m,u.diff,Ze,Be]),Je=o(()=>u.diff?"dark"===Ge:Ze,[Ge,u.diff,Ze]),Qe=d(()=>({wordWrap:"on",wrappingIndent:"same",themes:x,...Be||{},theme:Ye,...u.diff?{diffAppearance:Ge}:{},onThemeChange(){Ue()}}),[Ge,u.diff,Ye,Be,Ue,x]),et=d(()=>{const e=Qe(),t=z.current;if(!t)return z.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[Qe]),tt=o(()=>{var e,t,n,r,o,i,l;return JSON.stringify({diffLineStyle:null!=(e=null==Be?void 0:Be.diffLineStyle)?e:"background",diffUnchangedRegionStyle:null!=(t=null==Be?void 0:Be.diffUnchangedRegionStyle)?t:"line-info",diffHideUnchangedRegions:null==(n=null==Be?void 0:Be.diffHideUnchangedRegions)||n,renderSideBySide:null==(r=null==Be?void 0:Be.renderSideBySide)||r,enableSplitViewResizing:null==(o=null==Be?void 0:Be.enableSplitViewResizing)||o,ignoreTrimWhitespace:null==(i=null==Be?void 0:Be.ignoreTrimWhitespace)||i,originalEditable:null!=(l=null==Be?void 0:Be.originalEditable)&&l})},[Be]);s(()=>{F.current=Be,et()},[Be,et]),s(()=>()=>{var e,t,n;O.current+=1,null==(e=A.current)||e.call(A),A.current=null,_.current=null,W.current=null,P.current=null,R.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=$.current;if(!n)return;null==(t=null==(e=I.current)?void 0:e.destroy)||t.call(e);const r=H(n,{rootMargin:"400px"});return I.current=r,r.isVisible()&&Y(!0),r.whenVisible.then(()=>Y(!0)),()=>{r.destroy(),I.current===r&&(I.current=null)}},[H,q]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:j.current?(et(),()=>{e=!1}):((async()=>{try{const n=await ke();if(!e)return;if(!n)return void X(!0);const r=n.useMonaco,o=n.detectLanguage;if("function"==typeof o&&(R.current=o),"function"!=typeof r)return void X(!0);const i=r(et());j.current=i,"function"==typeof(t=i.setTheme)&&(Ae=t,null!=$e&&null!=je&&De($e,Ae).then(()=>Oe()).catch(()=>{})),A.current="function"==typeof i.safeClean?()=>i.safeClean():"function"==typeof i.cleanupEditor?()=>i.cleanupEditor():null,G(!0)}catch{e&&X(!0)}var t})(),()=>{e=!1})},[et]),s(()=>{var e;if(!u.language&&!le&&R.current)try{const t=R.current(String(null!=(e=u.code)?e:""));t&&ie(t)}catch{}},[le,u.code,u.language]);const nt=o(()=>String(u.language||le||oe||"plaintext"),[le,oe,u.language]),rt=o(()=>de(nt),[nt]),ot=o(()=>ue(rt),[rt]),it=o(()=>fe(rt),[rt,Ce]),lt=o(()=>!!f&&("html"===rt||"svg"===rt),[rt,f]),at=o(()=>{const e=rt;return e?ge[e]||e.charAt(0).toUpperCase()+e.slice(1):ge[""]||"Plain Text"},[rt]),ct=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]),st=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),u.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color=`var(--vscode-editor-foreground, ${Je?"#e5e7eb":"#111827"})`,t.backgroundColor=`var(--vscode-editor-background, ${Je?"#111827":"#ffffff"})`,t.borderColor=Je?"rgb(55 65 81 / 0.3)":"rgb(229 231 235)"),t},[b,k,u.diff,Je]),dt=o(()=>{if(!u.diff)return{color:`var(--vscode-editor-foreground, ${Je?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${Je?"#111827":"#ffffff"})`}},[u.diff,Je]),ut=!1===p&&h;s(()=>{if(U)return;if(!Z)return;if(!J||!q)return;const e=j.current;et();const t=()=>{var t;u.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),Ue(),ve||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>He(me)):null)&&He(me)};(null==e?void 0:e.setTheme)&&Ye?De(Ye,e.setTheme).then(t).catch(()=>{}):t()},[He,ve,J,Ge,me,Z,u.diff,Ye,Ue,et,U,q]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{Ue()},_e.add(e),()=>{_e.delete(e)}},[Ue]);const mt=d(async()=>{var e,t;if(U)return null;if(!q)return null;if(ve)return null;if(ut)return null;const n=j.current,r=E.current;if(!n||!r||!n.createEditor)return null;et();const o=Fe.current,i=o.diff?"diff":"single",l=P.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(W.current===i&&l===r&&a)return null;if(_.current)return _.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=A.current)||e.call(A),W.current=null,P.current=null,re(!1);const p=ot;if(o.diff?"function"==typeof n.createDiffEditor?(W.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(W.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),p)):(W.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),p)),P.current=r,O.current!==c)return;const f=Number(null==(d=F.current)?void 0:d.fontSize);if(Number.isFinite(f)&&f>0){Le(f),Ee(f);try{const e="diff"===W.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:f,automaticLayout:!1})}catch{}}Ue(),me||ve||He(!1),re(!0)}catch{O.current===c&&X(!0)}})().finally(()=>{_.current===s&&(_.current=null)});return _.current=s,s},[He,ve,me,ot,ut,Ue,et,U,q]);s(()=>{et();const e=V.current;if(V.current=tt,!u.diff)return;if(U)return;if(!Z||!q||!J)return;if(ve||ut)return;if(e===tt)return;let t=!1;return(async()=>{if(Ke(),!t)try{await mt()}catch{}})(),()=>{t=!0}},[ve,J,mt,Z,tt,u.diff,Ke,ut,et,U,q]),s(()=>{U||Z&&q&&(ve||ut?Ke():mt())},[ve,mt,Z,Ke,ut,U,q]),s(()=>{var e;if(U)return;if(!Z)return;if(!q)return;if(ve)return;if(ut)return;const t=j.current;if(!t)return;const n=String(null!=(e=u.code)?e:"");(async()=>{var e,r;let o=le;if(!o&&R.current)try{o=de(R.current(n)),o&&ae(o)}catch{}const i=ue(o||rt);if(t.createEditor&&E.current){try{await Promise.resolve(mt())}catch{}const e=_.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&&He(!0)})()},[He,rt,le,ve,J,mt,me,Z,u.code,u.diff,u.originalCode,u.updatedCode,ut,U,q]),s(()=>{if(U)return;if(!Z)return;if(!q)return;if(ve)return;if(ut)return;if(!me&&h)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>He(me)):null;return null==e&&He(me),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[He,ve,me,h,Z,ut,U,q]),s(()=>{var e,t,n;if(!g)return;if(U)return;const r=j.current;if(r){try{const o="diff"===W.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{}He(me)}},[He,g,me,Te,u.diff,U]),s(()=>{We||te(!0)},[We]);const ht=d((e,t)=>{if(!We)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),ee(n,t,"top",!1,0,Je))},[Je,We]),pt=d(()=>{We&&te()},[We]),ft=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(ct)),se(!0),null==(e=c.onCopy)||e.call(c,String(ct)),setTimeout(()=>se(!1),1e3)}catch{}},[c,ct]),gt=d(()=>{if(!lt)return;const e="html"===rt?"text/html":"image/svg+xml",t="html"===rt?Ne("artifacts.htmlPreviewTitle")||"HTML Preview":Ne("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof c.onPreviewCode?"html"===rt&&be(e=>!e):c.onPreviewCode({node:u,artifactType:e,artifactTitle:t,id:`temp-${rt}-${Date.now()}`})},[rt,lt,u,c,Ne]);return U?/* @__PURE__ */e(Re,{node:u}):/* @__PURE__ */n("div",{ref:$,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",Je?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",h?"is-rendering":"",Je?"is-dark":"",u.diff?"is-diff":""].join(" "),style:st,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:dt,children:[
|
|
17
17
|
/* @__PURE__ */n("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
|
|
18
18
|
/* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:it}}),
|
|
19
19
|
/* @__PURE__ */e("span",{className:"text-sm font-medium font-mono truncate",children:at})]}),
|
|
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)]",disabled:
|
|
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:Se
|
|
20
|
+
/* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[S&&/* @__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=>ht(e,ve?Ne("common.expand")||"Expand":Ne("common.collapse")||"Collapse"),onFocus:e=>ht(e,ve?Ne("common.expand")||"Expand":Ne("common.collapse")||"Collapse"),onMouseLeave:pt,onBlur:pt,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"})})}),L&&g&&/* @__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=>ht(e,Ne("common.decrease")||"Decrease"),onFocus:e=>ht(e,Ne("common.decrease")||"Decrease"),onMouseLeave:pt,onBlur:pt,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===Se,onClick:()=>Ee(Se),onMouseEnter:e=>ht(e,Ne("common.reset")||"Reset"),onFocus:e=>ht(e,Ne("common.reset")||"Reset"),onMouseLeave:pt,onBlur:pt,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:[
|
|
23
23
|
/* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
|
|
24
24
|
/* @__PURE__ */e("path",{d:"M3 3v5h5"})]})})}),
|
|
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:
|
|
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=>ht(e,Ne("common.increase")||"Increase"),onFocus:e=>ht(e,Ne("common.increase")||"Increase"),onMouseLeave:pt,onBlur:pt,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:ft,onMouseEnter:e=>ht(e,ce?Ne("common.copied")||"Copied":Ne("common.copy")||"Copy"),onFocus:e=>ht(e,ce?Ne("common.copied")||"Copied":Ne("common.copy")||"Copy"),onMouseLeave:pt,onBlur:pt,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:[
|
|
26
26
|
/* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
27
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=>ht(e,me?Ne("common.collapse")||"Collapse":Ne("common.expand")||"Expand"),onFocus:e=>ht(e,me?Ne("common.collapse")||"Collapse":Ne("common.expand")||"Expand"),onMouseLeave:pt,onBlur:pt,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"})})}),lt&&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:gt,onMouseEnter:e=>ht(e,Ne("common.preview")||"Preview"),onFocus:e=>ht(e,Ne("common.preview")||"Preview"),onMouseLeave:pt,onBlur:pt,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:[
|
|
28
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"}),
|
|
29
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"})]})})})]})]}),
|
|
30
|
-
/* @__PURE__ */n("div",{className:`code-block-body${ve?" code-block-body--collapsed":""}${me?" code-block-body--expanded":""}`,children:[!ve&&(!!p||!h)&&(
|
|
30
|
+
/* @__PURE__ */n("div",{className:`code-block-body${ve?" code-block-body--collapsed":""}${me?" code-block-body--expanded":""}`,children:[!ve&&(!!p||!h)&&(U?/* @__PURE__ */e(Re,{node:u}):/* @__PURE__ */n("div",{className:"code-editor-layer",children:[
|
|
31
31
|
/* @__PURE__ */e("div",{ref:E,className:"code-editor-container"+(p?"":" code-height-placeholder"),style:{visibility:ne?"visible":"hidden"},"aria-hidden":!ne}),!ne&&/* @__PURE__ */e("div",{className:"code-editor-fallback-surface",children:/* @__PURE__ */e("pre",{className:"code-fallback-plain m-0","aria-busy":h,"aria-label":`Code block: ${at}`,tabIndex:0,children:/* @__PURE__ */e("code",{translate:"no",children:String(ct)})})})]})),!p&&h&&/* @__PURE__ */e("div",{className:"code-loading-placeholder",children:/* @__PURE__ */n("div",{className:"loading-skeleton",children:[
|
|
32
32
|
/* @__PURE__ */e("div",{className:"skeleton-line"}),
|
|
33
33
|
/* @__PURE__ */e("div",{className:"skeleton-line"}),
|
|
34
34
|
/* @__PURE__ */e("div",{className:"skeleton-line short"})]})})]}),xe&&!c.onPreviewCode&<&&"html"===rt&&/* @__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
|
|
35
|
+
/* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:ce?Ne("common.copied")||"Copied":""})]})}function Ue(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=Ue(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Xe(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ue(e))&&(r&&(r+=" "),r+=t);return r}const qe=()=>import("@terrastruct/d2");let Ye=null,Ze=qe;function Ge(e){Ze=e,Ye=null}function Je(e){Ge(null!=e?e:qe)}function Qe(){Ge(null)}function et(){return"function"==typeof Ze}const tt={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},nt={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"},rt=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],ot=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function it(e){if(!e)return"";const t=e.trim();return ot.test(t)?t:""}function lt(r){var l,c;const u={...tt,...r},{t:m}=K(),[h,p]=i(!1),[f,g]=i(!1),[w,v]=i(!1),[y,x]=i(!1),[k,b]=i(null),[C,M]=i(""),[N,B]=i(null),[S,L]=i(!1),T=a(0),E=a(null),D=a(!1),$=a(!1),j=a(0),A=a(null),_=a(!1),W=a(null),P=a(null),O=a(!1),R=a(()=>{}),I=null!=(c=null==(l=u.node)?void 0:l.code)?c:"",H=w||!y||!C,F=!!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=S},[S]);const U=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),X=d((e=!1)=>{if(D.current||"undefined"==typeof window)return;if($.current)return;if(O.current)return void(_.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-j.current;if(!e&&n<t)return _.current=!0,void(null==A.current&&(A.current=window.setTimeout(()=>{A.current=null,_.current&&(_.current=!1,X(!0))},Math.max(0,t-n))));D.current=!0;const r=()=>{D.current=!1,j.current=Date.now(),R.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs]),q=d(async()=>{if(E.current)return E.current;const e=await async function(){if(Ye)return Ye;const e=Ze;if(!e)return null;let t;try{t=await e()}catch(n){if(e===qe)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(Ye=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),Ye):null}();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?E.current=t:"function"==typeof e.compile&&(E.current=e),E.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(E.current=new e.D2,E.current):("function"==typeof e.compile&&(E.current=e),E.current)},[]),Y=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||$.current)return;if(u.loading&&!u.progressiveRender)return;if(!I)return M(""),void b(null);const i=++T.current;L(!0),b(null);try{const l=await q();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(I);if(i!==T.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={...nt,...e||{}}}const p=await l.render(c,h);if(i!==T.current)return;const f=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(p);if(!f)throw new Error("D2 render returned empty output.");const g=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(rt.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=it(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.outerHTML}(f);M(g||""),u.loading&&v(!1),b(null)}catch(l){if(i!==T.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===T.current&&(L(!1),_.current&&(_.current=!1,X()))}},[I,q,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,X]);s(()=>{R.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(I),p(!0),setTimeout(()=>p(!1),1e3)}catch{}},[I]),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(()=>{X()},[I,u.loading,u.isDark,X]),s(()=>{u.loading||X(!0)},[u.loading,X]),s(()=>{const e=requestAnimationFrame(()=>U());return()=>cancelAnimationFrame(e)},[H,C,I,U]),s(()=>{X();const e=requestAnimationFrame(()=>U());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{U()});P.current=e,W.current&&e.observe(W.current)}return()=>{var t;$.current=!0,null!=A.current&&(clearTimeout(A.current),A.current=null),null==(t=P.current)||t.disconnect(),P.current=null,cancelAnimationFrame(e)}},[X,U]),/* @__PURE__ */n("div",{className:Xe("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:[
|
|
36
36
|
/* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
|
|
37
|
-
/* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */n("div",{className:
|
|
38
|
-
/* @__PURE__ */e("button",{type:"button",className:
|
|
39
|
-
/* @__PURE__ */e("button",{type:"button",className:
|
|
37
|
+
/* @__PURE__ */n("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */n("div",{className:Xe("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
38
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("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"}),
|
|
39
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("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:[
|
|
40
40
|
/* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
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":f,onClick:()=>g(e=>!e),onMouseEnter:e=>J(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>J(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${f?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"})})})]})]}),!f&&/* @__PURE__ */e("div",{ref:
|
|
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":f,onClick:()=>g(e=>!e),onMouseEnter:e=>J(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onFocus:e=>J(e,f?m("common.expand")||"Expand":m("common.collapse")||"Collapse"),onMouseLeave:Q,onBlur:Q,children:/* @__PURE__ */e("svg",{style:{transform:`rotate(${f?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"})})})]})]}),!f&&/* @__PURE__ */e("div",{ref:W,className:"d2-block-body",style:V,children:u.loading&&!F?/* @__PURE__ */n("div",{className:"d2-source px-4 py-4",children:[
|
|
42
42
|
/* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:I})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}):/* @__PURE__ */e(t,{children:/* @__PURE__ */n("div",H?{className:"d2-source px-4 py-4",children:[
|
|
43
43
|
/* @__PURE__ */e("pre",{className:"d2-code",children:/* @__PURE__ */e("code",{children:I})}),k&&/* @__PURE__ */e("p",{className:"d2-error mt-2 text-xs",children:k})]}:{className:"d2-render",style:z,children:[
|
|
44
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 at(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,a=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
|
|
@@ -51,163 +51,161 @@ return e("a",{className:"footnote-anchor text-sm text-[#0366d6] hover:underline
|
|
|
51
51
|
return e("div",{id:`footnote-${n.id}`,className:"footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2",children:/* @__PURE__ */e("div",{className:"flex-1",children:r&&o?C(n.children,r,String(null!=i?i:`footnote-${n.id}`),o):null})})}function mt(t){const{node:r}=t,i=o(()=>`#footnote-${r.id}`,[r.id]),l=d(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(i);t&&t.scrollIntoView({behavior:"smooth"})},[i]);/* @__PURE__ */
|
|
52
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 ht(t){/* @__PURE__ */
|
|
53
53
|
return e("br",{className:"hard-break"})}function pt(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__ */
|
|
54
|
-
return e(c,{dir:"auto",className:
|
|
55
|
-
return e("mark",{className:"highlight-node",children:t.children})}const gt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),wt=/* @__PURE__ */new Set(["script"]),vt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function yt(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 xt=/* @__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"]),kt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function bt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Ct(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=bt(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 Mt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();gt.has(e)||vt.has(e)&&r&&yt(r)||(t[n]=r)}return t}function Nt(e,t){const n=e.toLowerCase();return!xt.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,f]=i(null),g=a(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(c.content),k=Boolean(c.loading),C=u(P,
|
|
56
|
-
return e("div",{ref:f,className:"html-block-node",...N,children:w?B&&
|
|
54
|
+
return e(c,{dir:"auto",className:Xe("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 ft(t){/* @__PURE__ */
|
|
55
|
+
return e("mark",{className:"highlight-node",children:t.children})}const gt=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),wt=/* @__PURE__ */new Set(["script"]),vt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function yt(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 xt=/* @__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"]),kt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function bt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Ct(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=bt(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 Mt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();gt.has(e)||vt.has(e)&&r&&yt(r)||(t[n]=r)}return t}function Nt(e,t){const n=e.toLowerCase();return!xt.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,f]=i(null),g=a(null),[w,v]=i(()=>"undefined"==typeof window),[y,x]=i(c.content),k=Boolean(c.loading),C=u(W,P,P),M=o(()=>{var e;return null!=(e=l.customComponents)?e:R(m)},[m,l.customComponents,C]);s(()=>{var e;if("undefined"==typeof window)return void v(!0);if(null==(e=g.current)||e.destroy(),g.current=null,!k)return v(!0),void x(c.content);if(!p)return void v(!1);const t=h(p,{rootMargin:"400px"});return g.current=t,t.isVisible()&&v(!0),t.whenVisible.then(()=>v(!0)).catch(()=>{}),()=>{t.destroy(),g.current=null}},[p,k,c.content,h]),s(()=>()=>{var e;null==(e=g.current)||e.destroy(),g.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(Nt(r[1],t))return!0;return!1}(null!=(e=c.content)?e:"",M)},[M,c.content]),S=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||kt.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(wt.has(e.tagName.toLowerCase()))continue;const n=Mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=Nt(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,{...Ct(n),key:c,suppressHydrationWarning:!0}))}else if("tag_open"===e.type)i.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:wt.has(e.tagName.toLowerCase())});else if("tag_close"===e.type){const e=i.pop();if(e){if(e.blocked)continue;const n=Mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=Nt(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,{...Ct(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=Mt(e.attrs||{}),a=n.key,c=null!=a&&""!==a?a:"ms-html-"+o++,s=Nt(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,{...Ct(n),key:c,suppressHydrationWarning:!0},...e.children);l.push(d)}return l}catch{return null}}(c.content,M):null,[M,c.content,B]);/* @__PURE__ */
|
|
56
|
+
return e("div",{ref:f,className:"html-block-node",...N,children:w?B&&S?/* @__PURE__ */e(t,{children:S}):/* @__PURE__ */e("div",{dangerouslySetInnerHTML:{__html:null!=y?y:""}}):/* @__PURE__ */e("div",{className:"html-block-node__placeholder",children:null!=d?d:/* @__PURE__ */n(t,{children:[
|
|
57
57
|
/* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar"}),
|
|
58
58
|
/* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-4/5"}),
|
|
59
|
-
/* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const
|
|
59
|
+
/* @__PURE__ */e("span",{className:"html-block-node__placeholder-bar w-2/3"})]})})})}const St=/* @__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"]),Lt=/* @__PURE__ */new Set(["script"]),Tt=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),Et=(()=>{try{return Boolean(!1)}catch{}return!1})();function Dt(e){Et&&console.warn(e)}function $t(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 jt=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),At=/* @__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 _t(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Wt(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=_t(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 Pt(e,t){const n=e.toLowerCase();return!At.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function Ot(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 Rt(e){return e.trim().length>0}function It(e,t,n,o,i){if(Lt.has(e.toLowerCase()))return null;const l=function(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();St.has(e)||Tt.has(e)&&r&&$t(r)||(t[n]=r)}return t}(t),a=l.key,c=null!=a&&""!==a?a:i;if(Pt(e,o)){const t=o[e]||o[e.toLowerCase()],i=function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Ot(r,n);return t}(l);return r.createElement(t,{...i,key:c},...n)}return r.createElement(e,{...Wt(l),key:c},...n)}function Ht(t){const{node:n,customId:o}=t,l=a(null),[c,d]=i(!1);s(()=>{d(!0)},[]);const u=R(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(Pt(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=It(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=It(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&&Dt(`Auto-closing unclosed tag: <${i.tagName}>`)}else Dt(`Ignoring closing tag with no matching opening tag: </${i.tagName}>`)}for(;r.length>0;){const e=r.pop(),i=It(e.tagName,e.attrs||{},e.children,t,"ms-html-"+n++);null!=i&&o.push(i),Dt(`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);Rt(t)&&o.push({type:"text",content:t})}break}if(l>i){const t=e.slice(i,l);Rt(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||jt.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,Et&&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 Ft={fallbackSrc:"",showCaption:!1,lazy:!0,svgMinHeight:"12rem",usePlaceholder:!0};function zt(r){var l,c,d,u,m,h;const p={...Ft,...r},f=D(),[g,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=g;if(null==(e=v.current)||e.destroy(),v.current=null,!t)return void x(!1);const n=f(t,{rootMargin:"400px"});return v.current=n,n.isVisible()&&x(!0),n.whenVisible.then(()=>x(!0)).catch(()=>{}),()=>{n.destroy(),v.current=null}},[g,f,p.lazy]),s(()=>()=>{var e;null==(e=v.current)||e.destroy(),v.current=null},[]);const S=o(()=>C&&p.fallbackSrc?p.fallbackSrc:p.node.src,[C,p.fallbackSrc,p.node.src]);s(()=>{b(!1),M(!1)},[S]),s(()=>{B(!1)},[p.node.src]);const L=o(()=>/\.svg(?:\?|$)/i.test(String(S)),[S]),T=!p.lazy||y,E=L?{minHeight:p.svgMinHeight,width:"100%"}:{minHeight:"6rem"};/* @__PURE__ */
|
|
60
60
|
return n("figure",{ref:w,className:"image-node",children:[
|
|
61
|
-
/* @__PURE__ */e("div",{className:"image-node__inner",children:p.node.loading||C||!
|
|
61
|
+
/* @__PURE__ */e("div",{className:"image-node__inner",children:p.node.loading||C||!T?C?/* @__PURE__ */n("div",{className:"image-node__error",children:[
|
|
62
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"})}),
|
|
63
63
|
/* @__PURE__ */e("span",{className:"image-node__placeholder-text",children:"Image failed to load"})]}):/* @__PURE__ */e("div",{className:"image-node__placeholder",style:E,children:p.usePlaceholder?/* @__PURE__ */n(t,{children:[
|
|
64
64
|
/* @__PURE__ */e("span",{className:"image-node__spinner","aria-hidden":"true"}),
|
|
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:
|
|
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:S,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:L?{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,S)},onClick:e=>{var t;e.preventDefault(),k&&!C&&(null==(t=p.onClick)||t.call(p,[e,S]))}},"image")}),p.showCaption&&p.node.alt&&/* @__PURE__ */e("figcaption",{className:"image-node__caption",children:p.node.alt})]})}let Vt=null,Kt=null;const Ut=/* @__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:[
|
|
66
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"}),
|
|
67
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"}),
|
|
68
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"}),
|
|
69
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"}),
|
|
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"})]})}),
|
|
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"})]})}),Xt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function qt(r){const o={...Xt,...r},{t:l}=K(),[c,u]=i(!1),[m,h]=i(!1),[p,f]=i(!1),[g,w]=i("360px"),[v,y]=i(!1),[k,b]=i(1),[C,M]=i({x:0,y:0}),[N,B]=i(!1),S=a(null),L=a(null),T=a(null),E=a({x:0,y:0}),D=a(null),$=o.node.code,j=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]),A=d(async()=>{var e,t;if(!S.current)return;const n=S.current;try{const r=await async function(){return Kt||Vt||(Vt=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),Kt=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Vt)}();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||A()},[$,p,m,A]),s(()=>()=>{var e,t;D.current&&(null==(t=(e=D.current).destroy)||t.call(e),D.current=null)},[]);const _=d(()=>{y(!1),L.current&&(L.current.innerHTML=""),T.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&&_()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,_]),s(()=>{v&&setTimeout(()=>{if(S.current&&L.current){L.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=S.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),L.current.appendChild(e),T.current=e,e.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`}},0)},[v]),s(()=>{v&&T.current&&(T.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${k})`)},[v,C,k]);const P=d(()=>{var e;const t=null==(e=S.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;E.current={x:t-C.x,y:n-C.y}},R=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-E.current.x,y:n-E.current.y})},I=()=>B(!1),H=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",F=p||m;/* @__PURE__ */
|
|
71
71
|
return n(t,{children:[
|
|
72
|
-
/* @__PURE__ */n("div",{className:
|
|
73
|
-
/* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[
|
|
74
|
-
/* @__PURE__ */e("span",{className:
|
|
75
|
-
/* @__PURE__ */e("button",{className:
|
|
72
|
+
/* @__PURE__ */n("div",{className:Xe("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:Xe("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:[
|
|
73
|
+
/* @__PURE__ */n("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Ut,
|
|
74
|
+
/* @__PURE__ */e("span",{className:Xe("text-sm font-medium font-mono truncate",o.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),o.showModeToggle&&/* @__PURE__ */n("div",{className:Xe("flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
75
|
+
/* @__PURE__ */e("button",{className:Xe("px-2.5 py-1 text-xs rounded transition-colors",p?o.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":o.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>f(!1),onMouseEnter:e=>ee(e.currentTarget,l("common.preview")||"Preview","top",!1,0,o.isDark),onMouseLeave:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[
|
|
76
76
|
/* @__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:[
|
|
77
77
|
/* @__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"}),
|
|
78
78
|
/* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})}),
|
|
79
79
|
/* @__PURE__ */e("span",{children:l("common.preview")||"Preview"})]})}),
|
|
80
|
-
/* @__PURE__ */e("button",{className:
|
|
80
|
+
/* @__PURE__ */e("button",{className:Xe("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:()=>f(!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:[
|
|
81
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"})}),
|
|
82
82
|
/* @__PURE__ */e("span",{children:l("common.source")||"Source"})]})})]}),
|
|
83
|
-
/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:H,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:H,onClick:
|
|
83
|
+
/* @__PURE__ */n("div",{className:"flex items-center gap-x-1",children:[o.showCollapseButton&&/* @__PURE__ */e("button",{className:H,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:H,onClick:j,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:[
|
|
84
84
|
/* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
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:
|
|
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:Xe(H,F&&"opacity-50 cursor-not-allowed"),disabled:F,onClick:P,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:[
|
|
86
86
|
/* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
87
|
-
/* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:
|
|
88
|
-
/* @__PURE__ */e("button",{className:
|
|
89
|
-
/* @__PURE__ */e("button",{className:
|
|
90
|
-
/* @__PURE__ */n("button",{className:
|
|
91
|
-
/* @__PURE__ */e("div",{className:
|
|
92
|
-
/* @__PURE__ */e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:
|
|
87
|
+
/* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),o.showFullscreenButton&&/* @__PURE__ */e("button",{className:Xe(H,F&&"opacity-50 cursor-not-allowed"),disabled:F,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:Xe("p-4",o.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */e("pre",{className:Xe("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:[
|
|
88
|
+
/* @__PURE__ */e("button",{className:Xe("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:"+"}),
|
|
89
|
+
/* @__PURE__ */e("button",{className:Xe("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:"-"}),
|
|
90
|
+
/* @__PURE__ */n("button",{className:Xe("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),"%"]})]})}),
|
|
91
|
+
/* @__PURE__ */e("div",{className:Xe("min-h-[360px] relative transition-all duration-100 overflow-hidden block",o.isDark?"bg-gray-900":"bg-gray-50"),style:{height:g},onMouseDown:O,onMouseMove:R,onMouseUp:I,onMouseLeave:I,onTouchStart:O,onTouchMove:R,onTouchEnd:I,children:/* @__PURE__ */e("div",{className:Xe("absolute inset-0 cursor-grab",N&&"cursor-grabbing"),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${k})`},children:/* @__PURE__ */e("div",{ref:S,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),v&&"undefined"!=typeof document&&x(
|
|
92
|
+
/* @__PURE__ */e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:_,role:"dialog","aria-modal":"true",children:/* @__PURE__ */n("div",{className:Xe("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:[
|
|
93
93
|
/* @__PURE__ */n("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
|
|
94
|
-
/* @__PURE__ */e("button",{className:
|
|
95
|
-
/* @__PURE__ */e("button",{className:
|
|
96
|
-
/* @__PURE__ */n("button",{className:
|
|
97
|
-
/* @__PURE__ */e("button",{className:
|
|
98
|
-
/* @__PURE__ */e("div",{ref:
|
|
99
|
-
return e("
|
|
100
|
-
|
|
101
|
-
/* @__PURE__ */e("span",{className:"
|
|
102
|
-
|
|
103
|
-
return e(
|
|
104
|
-
return e(a,{
|
|
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 en=null,tn=null,nn=!1;const rn=/* @__PURE__ */new Map,on=/* @__PURE__ */new Map;let ln=5;const an=/* @__PURE__ */new Set;function cn(){if(rn.size<ln&&an.size){const e=Array.from(an);an.clear();for(const t of e)try{t()}catch{}}}function sn(e){en=e,tn=null,en.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=rn.get(t);if(o)if(rn.delete(t),clearTimeout(o.timeoutId),cn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(on.set(e,n),on.size>200){const e=on.keys().next().value;on.delete(e)}}o.resolve(n)}},en.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of rn.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));rn.clear(),cn()}}function dn(){var e;en&&(null==(e=en.terminate)||e.call(en)),en=null,tn=null}function un(e){nn=!!e,en&&en.postMessage({type:"init",debug:nn})}const mn="WORKER_BUSY";async function hn(e,t=!0,n=2e3,r){if(performance.now(),tn)return Promise.reject(tn);const o=`${t?"d":"i"}:${e}`,i=on.get(o);if(i)return Promise.resolve(i);const l=en||(tn=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),tn.name="WORKER_INIT_ERROR",tn.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(tn);if(rn.size>=ln){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=mn,e.busy=!0,e.inFlight=rn.size,e.max=ln,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(()=>{rn.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),cn()},n),s=()=>{},d=()=>{rn.delete(a),clearTimeout(c),an.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),cn()};r&&r.addEventListener("abort",d,{once:!0}),rn.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:nn})}catch(u){rn.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),cn()}})}function pn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(on.set(r,n),on.size>200){const e=on.keys().next().value;on.delete(e)}}function fn(){on.clear()}function gn(e){ln=Math.max(1,Math.floor(e)),cn()}function wn(e=1500,t){return rn.size<ln?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(){an.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}),an.add(l)})}const vn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function yn(e){null!=e.timeout&&(vn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(vn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(vn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(vn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function xn(){return{...vn}}async function kn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:vn.timeout,c=null!=(o=n.waitTimeout)?o:vn.waitTimeout,s=null!=(i=n.backoffMs)?i:vn.backoffMs,d=null!=(l=n.maxRetries)?l:vn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):vn.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 hn(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==mn||h>=u)throw p;if(h++,await wn(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 bn=null,Cn=!1;async function Mn(){if(bn)return bn;if(Cn)return null;try{return bn=await import("katex"),await import("katex/contrib/mhchem"),bn}catch{return Cn=!0,null}}function Nn({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?(kn(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===mn||"WORKER_TIMEOUT"===i){const e=await Mn();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),pn(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 kn(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===mn||"WORKER_TIMEOUT"===r){const e=await Mn();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),pn(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:[
|
|
94
|
+
/* @__PURE__ */e("button",{className:Xe("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:"+"}),
|
|
95
|
+
/* @__PURE__ */e("button",{className:Xe("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:"-"}),
|
|
96
|
+
/* @__PURE__ */n("button",{className:Xe("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),"%"]}),
|
|
97
|
+
/* @__PURE__ */e("button",{className:Xe("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:_,children:"X"})]}),
|
|
98
|
+
/* @__PURE__ */e("div",{ref:L,className:Xe("w-full h-full flex items-center justify-center p-4 overflow-hidden",!N&&"cursor-grab",N&&"cursor-grabbing"),onMouseDown:O,onMouseMove:R,onMouseUp:I,onMouseLeave:I,onTouchStart:O,onTouchMove:R,onTouchEnd:I})]})}),document.body)]})}function Yt(r){var o,l;const{node:c,children:d,ctx:u,indexKey:m,typewriter:h}=r,p=String(null!=(o=c.code)?o:""),f=null==(l=null!=h?h:null==u?void 0:u.typewriter)||l,g=null==m||""===m?"":String(m),[w,v]=i(p),[y,x]=i([]),k=a(0),b=a({settledContent:p,streamedSegments:[]}),C=(e,t)=>{b.current={settledContent:e,streamedSegments:t},v(e),x(t)},M=e=>(k.current+=1,{id:k.current,text:e});return s(()=>{if(null!=d)return void C("",[]);const e=null==u?void 0:u.textStreamState,t=b.current,n=(()=>{const{settledContent:e,streamedSegments:t}=b.current;return e+t.map(e=>e.text).join("")})();if(!f)return C(p,[]),void(g&&(null==e||e.set(g,p)));if(p===n)return void(g&&(null==e||e.set(g,p)));if(p.startsWith(n)&&p.length>n.length)return C(t.settledContent,[...t.streamedSegments,M(p.slice(n.length))]),void(g&&(null==e||e.set(g,p)));const r=g?null==e?void 0:e.get(g):void 0;if(!t.streamedSegments.length&&r&&p.startsWith(r)&&p.length>r.length)return C(r,[M(p.slice(r.length))]),void(g&&(null==e||e.set(g,p)));C(p,[]),g&&(null==e||e.set(g,p))},[d,p,null==u?void 0:u.textStreamState,g,f]),/* @__PURE__ */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:d||/* @__PURE__ */n(t,{children:[w?/* @__PURE__ */e("span",{children:w}):null,y.map(t=>/* @__PURE__ */e("span",{className:Xe("text-node-stream-delta",t.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>(e=>{const t=b.current,n=t.streamedSegments.findIndex(t=>t.id===e);if(n<0)return;const r=t.streamedSegments.slice(0,n+1);C(t.settledContent+r.map(e=>e.text).join(""),t.streamedSegments.slice(n+1))})(t.id),children:t.text},t.id))]})})}function Zt(t){/* @__PURE__ */
|
|
99
|
+
return e("ins",{className:"insert-node",children:t.children})}function Gt(t){var r,o;const{node:l,children:c,ctx:d,indexKey:u,typewriter:m}=t,h=String(null!=(r=l.content)?r:""),p=null==(o=null!=m?m:null==d?void 0:d.typewriter)||o,f=null==u||""===u?"":String(u),[g,w]=i(h),[v,y]=i([]),x=a(0),k=a({settledContent:h,streamedSegments:[]}),b=(e,t)=>{k.current={settledContent:e,streamedSegments:t},w(e),y(t)},C=e=>(x.current+=1,{id:x.current,text:e});return s(()=>{if(null!=c)return void b("",[]);const e=null==d?void 0:d.textStreamState,t=k.current,n=(()=>{const{settledContent:e,streamedSegments:t}=k.current;return e+t.map(e=>e.text).join("")})();if(!p)return b(h,[]),void(f&&(null==e||e.set(f,h)));if(h===n)return void(f&&(null==e||e.set(f,h)));if(h.startsWith(n)&&h.length>n.length)return b(t.settledContent,[...t.streamedSegments,C(h.slice(n.length))]),void(f&&(null==e||e.set(f,h)));const r=f?null==e?void 0:e.get(f):void 0;if(!t.streamedSegments.length&&r&&h.startsWith(r)&&h.length>r.length)return b(r,[C(h.slice(r.length))]),void(f&&(null==e||e.set(f,h)));b(h,[]),f&&(null==e||e.set(f,h))},[c,h,null==d?void 0:d.textStreamState,f,p]),null!=c?/* @__PURE__ */e("span",{className:Xe("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:c}):/* @__PURE__ */n("span",{className:Xe("text-node whitespace-pre-wrap break-words",l.center&&"text-node-center"),children:[g?/* @__PURE__ */e("span",{children:g}):null,v.map(t=>/* @__PURE__ */e("span",{className:Xe("text-node-stream-delta",t.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"),onAnimationEnd:()=>(e=>{const t=k.current,n=t.streamedSegments.findIndex(t=>t.id===e);if(n<0)return;const r=t.streamedSegments.slice(0,n+1);b(t.settledContent+r.map(e=>e.text).join(""),t.streamedSegments.slice(n+1))})(t.id),children:t.text},t.id))]})}function Jt(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,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]),g="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:f,children:/* @__PURE__ */n("span",{className:"link-text-wrapper relative inline-flex",children:[
|
|
100
|
+
/* @__PURE__ */e("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */e(Gt,{node:{type:"text",content:String(null!=(l=c.text)?l:"")},ctx:s,indexKey:`${String(null!=m?m:"link")}-loading`,typewriter:t.typewriter})}),
|
|
101
|
+
/* @__PURE__ */e("span",{className:"underline-anim","aria-hidden":"true"})]})}):/* @__PURE__ */e("a",{className:"link-node",href:c.href,title:h?"":g,"aria-label":`Link: ${g}`,target:"_blank",rel:"noopener noreferrer",style:f,onMouseEnter:w,onMouseLeave:v,children:s&&u?C(c.children,s,String(null!=m?m:"link"),u):/* @__PURE__ */e(Gt,{node:{type:"text",content:String(null!=(a=c.text)?a:"")},ctx:s,indexKey:`${String(null!=m?m:"link")}-fallback`,typewriter:t.typewriter})})}function Qt(t){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=t;/* @__PURE__ */
|
|
102
|
+
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 en(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&&R(o.customId).list_item||Qt;/* @__PURE__ */
|
|
103
|
+
return e(a,{className:Xe("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__ */
|
|
104
|
+
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 tn=null,nn=null,rn=!1;const on=/* @__PURE__ */new Map,ln=/* @__PURE__ */new Map;let an=5;const cn=/* @__PURE__ */new Set;function sn(){if(on.size<an&&cn.size){const e=Array.from(cn);cn.clear();for(const t of e)try{t()}catch{}}}function dn(e){tn=e,nn=null,tn.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=on.get(t);if(o)if(on.delete(t),clearTimeout(o.timeoutId),sn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(ln.set(e,n),ln.size>200){const e=ln.keys().next().value;ln.delete(e)}}o.resolve(n)}},tn.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of on.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));on.clear(),sn()}}function un(){var e;tn&&(null==(e=tn.terminate)||e.call(tn)),tn=null,nn=null}function mn(e){rn=!!e,tn&&tn.postMessage({type:"init",debug:rn})}const hn="WORKER_BUSY";async function pn(e,t=!0,n=2e3,r){if(performance.now(),nn)return Promise.reject(nn);const o=`${t?"d":"i"}:${e}`,i=ln.get(o);if(i)return Promise.resolve(i);const l=tn||(nn=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),nn.name="WORKER_INIT_ERROR",nn.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(nn);if(on.size>=an){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=hn,e.busy=!0,e.inFlight=on.size,e.max=an,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(()=>{on.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),sn()},n),s=()=>{},d=()=>{on.delete(a),clearTimeout(c),cn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),sn()};r&&r.addEventListener("abort",d,{once:!0}),on.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:rn})}catch(u){on.delete(a),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),sn()}})}function fn(e,t,n){const r=`${t?"d":"i"}:${e}`;if(ln.set(r,n),ln.size>200){const e=ln.keys().next().value;ln.delete(e)}}function gn(){ln.clear()}function wn(e){an=Math.max(1,Math.floor(e)),sn()}function vn(e=1500,t){return on.size<an?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(){cn.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}),cn.add(l)})}const yn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function xn(e){null!=e.timeout&&(yn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(yn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(yn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(yn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function kn(){return{...yn}}async function bn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:yn.timeout,c=null!=(o=n.waitTimeout)?o:yn.waitTimeout,s=null!=(i=n.backoffMs)?i:yn.backoffMs,d=null!=(l=n.maxRetries)?l:yn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):yn.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 pn(e,t,a,m)}catch(p){if((null==p?void 0:p.code)!==hn||h>=u)throw p;if(h++,await vn(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 Cn=null,Mn=!1;async function Nn(){if(Cn)return Cn;if(Mn)return null;try{return Cn=await import("katex"),await import("katex/contrib/mhchem"),Cn}catch{return Mn=!0,null}}function Bn({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?(bn(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===hn||"WORKER_TIMEOUT"===i){const e=await Nn();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),fn(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 Sn({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 bn(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===hn||"WORKER_TIMEOUT"===r){const e=await Nn();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),fn(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:[
|
|
106
105
|
/* @__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:[
|
|
107
106
|
/* @__PURE__ */e("span",{className:"math-inline__spinner","aria-hidden":"true"}),
|
|
108
|
-
/* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function Ln(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let Tn=null,Sn=null;const En=/* @__PURE__ */new Map;let Dn=5,$n=!1;function An(e){$n=!!e}function _n(e){Number.isFinite(e)&&e>0&&(Dn=Math.floor(e))}function jn(){return{inFlight:En.size,max:Dn}}const Pn="WORKER_BUSY";function Wn(e){Tn=e,Sn=null;const t=e;Tn.onmessage=e=>{if(Tn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=En.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Tn.onerror=e=>{var n,r;if(Tn===t)if(0!==En.size){try{$n?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 En.entries())n.reject(new Error(`Worker error: ${e.message}`));En.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Tn.onmessageerror=e=>{var n,r;if(Tn===t)if(0!==En.size){try{$n?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of En.entries())t.reject(new Error("Worker messageerror"));En.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function On(){var e;if(Tn)try{for(const[e,t]of En.entries())t.reject(new Error("Worker cleared"));En.clear(),null==(e=Tn.terminate)||e.call(Tn)}catch{}Tn=null,Sn=null}function Rn(e,t,n=1400){if(Sn)return Promise.reject(Sn);const r=Tn||(Sn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Sn.name="WORKER_INIT_ERROR",Sn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Sn);if(En.size>=Dn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Pn,e.inFlight=En.size,e.max=Dn,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),En.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};En.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return En.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=En.get(l);null==t||t.reject(e)},n)})}async function In(e,t,n=1400){return Rn("canParse",{code:e,theme:t},n)}async function Hn(e,t,n=2400){return Rn("findPrefix",{code:e,theme:t},n)}function Fn(){var e;null==(e=null==Tn?void 0:Tn.terminate)||e.call(Tn),Tn=null,Sn=null,En.clear()}let zn=null,Vn=!1,Un=null,Xn=null;function Kn(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(Un!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Un=r}catch{}}const qn="undefined"!=typeof window?m:s,Yn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Zn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Gn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Jn(e){if(!e)return"";const t=e.trim();return Gn.test(t)?t:""}function Qn(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function er(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Qn(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(Zn.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Jn(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(Qn(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const tr={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 nr(r){var l,c,u,h,p,f,g,w,v,y;const k={...tr,...r},{t:b}=U(),C=o(()=>fe("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:tr.workerTimeoutMs,L=null!=(h=k.parseTimeoutMs)?h:tr.parseTimeoutMs,T=null!=(p=k.renderTimeoutMs)?p:tr.renderTimeoutMs,S=null!=(f=k.fullRenderTimeoutMs)?f:tr.fullRenderTimeoutMs,E=Math.max(0,null!=(g=k.renderDebounceMs)?g:tr.renderDebounceMs),[$,A]=i(!1),[_,j]=i(!1),[P,W]=i(!1),[O,R]=i(!1),[I,H]=i(1),[F,z]=i({x:0,y:0}),[V,X]=i(!1),[K,q]=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}),ge=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:Yn,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(zn)return Kn(zn,e),zn;if(Xn){const t=await Xn;return t&&Kn(t,e),t}if(Vn)return null;try{Vn=!0,Xn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(zn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!zn)throw new Error("Mermaid module did not export expected API");return Kn(zn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),zn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Xn=null}})();const t=await Xn;return t&&Kn(t,e),t}catch{return null}}(Le);e||(ae.current=t,A(Boolean(t)),ye.current||j(!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(_||P)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Ln(()=>Te(t))});return e.observe(ce.current),()=>e.disconnect()},[P,_,Te]),s(()=>()=>{Fn()},[]),m(()=>{!_&&de.current&&we.current[Ne]&&(er(de.current,we.current[Ne],Be),Ln(()=>Te()))},[_,Be,Ne,Te]);const Se=d(async(e,t,n)=>{var r;if(!ae.current||!de.current)return!1;q(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=or(e,t),l=await lr(()=>ae.current.render(o,i),{timeoutMs:S,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=er(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{q(!1)}},[S,Me,Be,Te]),Ee=d(async(e,t,n)=>{var r;if(ae.current&&de.current){q(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=or(ir(e)||e,t),l=await lr(()=>ae.current.render(o,i),{timeoutMs:T,signal:n});(null==l?void 0:l.svg)&&(er(de.current,l.svg,Be),null==(r=l.bindFunctions)||r.call(l,de.current),Te())}catch{}finally{q(!1)}}},[T,Me,Be,Te]),De=d(async(e,t)=>{if(!e.trim())return Qn(de.current),Z(!1),void(ve.current="");const n=e.replace(/\s+/g,"");if(n===ve.current&&ke.current)return;const r=++ge.current;try{if(await async function(e,t,n){try{if(await In(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=or(e,t),o=n.mermaid;if("function"==typeof o.parse)return await lr(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await lr(()=>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)||ge.current!==r)return;return void(await Se(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 Hn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return ir(e)}(e,Ne,{workerTimeout:B,signal:t});if(!n||(null==t?void 0:t.aborted)||ge.current!==r)return;await Ee(n,Ne,t)}catch{}},[L,Se,Ee,Ne,B]),$e=d(()=>ie&&!_&&!P,[P,_,ie]);s(()=>{if(!$e())return;if(!ae.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&$e()&&De(N,e.signal)},E);return()=>{e.abort(),window.clearTimeout(t)}},[N,$e,$,De,E]);const Ae=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,k.isDark)},[k.isDark]),_e=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),R(!0),null==(t=k.onCopy)||t.call(k,N),setTimeout(()=>R(!1),1e3)}catch{}},[N,k]),je=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=ar(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:ar(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,Qn(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?ar(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]),qn(()=>{if(!Q)return;const e=me.current,t=ce.current;if(!e||!t)return;const n=`translate(${F.x}px, ${F.y}px) scale(${I})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(he.current=o,o.style.transform=n),Qn(e),e.appendChild(r)},[Q]),s(()=>{Q&&he.current&&(he.current.style.transform=`translate(${F.x}px, ${F.y}px) scale(${I})`)},[Q,F.x,F.y,I]);const Re=_||K||P,Ie=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]),He=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){j(!1);const e=be.current;H(e.zoom),z({x:e.translateX,y:e.translateY}),oe(e.containerHeight)}else be.current={zoom:I,translateX:F.x,translateY:F.y,containerHeight:re},j(!0)},[N,re,De,k,Ne,F.x,F.y,Te,I]),Fe=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-F.x,o=e.clientY-n.top-F.y,i=.01*-e.deltaY,l=rr(I+i,.5,3);if(l===I)return;const a=l/I;z({x:F.x-r*(a-1),y:F.y-o*(a-1)}),H(l)},[F,I]),ze=d((e,t)=>{X(!0),pe.current={x:e-F.x,y:t-F.y}},[F.x,F.y]),Ve=d((e,t)=>{V&&z({x:e-pe.current.x,y:t-pe.current.y})},[V]),Ue=d(()=>{X(!1)},[]),Xe=/* @__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:
|
|
110
|
-
/* @__PURE__ */e("button",{type:"button",className:
|
|
111
|
-
/* @__PURE__ */n("button",{type:"button",className:
|
|
112
|
-
/* @__PURE__ */n("div",{ref:ce,className:
|
|
113
|
-
/* @__PURE__ */e("div",{ref:se,"data-mermaid-wrapper":!0,className:
|
|
107
|
+
/* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function Ln(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let Tn=null,En=null;const Dn=/* @__PURE__ */new Map;let $n=5,jn=!1;function An(e){jn=!!e}function _n(e){Number.isFinite(e)&&e>0&&($n=Math.floor(e))}function Wn(){return{inFlight:Dn.size,max:$n}}const Pn="WORKER_BUSY";function On(e){Tn=e,En=null;const t=e;Tn.onmessage=e=>{if(Tn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=Dn.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Tn.onerror=e=>{var n,r;if(Tn===t)if(0!==Dn.size){try{jn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of Dn.entries())n.reject(new Error(`Worker error: ${e.message}`));Dn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Tn.onmessageerror=e=>{var n,r;if(Tn===t)if(0!==Dn.size){try{jn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of Dn.entries())t.reject(new Error("Worker messageerror"));Dn.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Rn(){var e;if(Tn)try{for(const[e,t]of Dn.entries())t.reject(new Error("Worker cleared"));Dn.clear(),null==(e=Tn.terminate)||e.call(Tn)}catch{}Tn=null,En=null}function In(e,t,n=1400){if(En)return Promise.reject(En);const r=Tn||(En=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),En.name="WORKER_INIT_ERROR",En.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(En);if(Dn.size>=$n){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Pn,e.inFlight=Dn.size,e.max=$n,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),Dn.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};Dn.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return Dn.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=Dn.get(l);null==t||t.reject(e)},n)})}async function Hn(e,t,n=1400){return In("canParse",{code:e,theme:t},n)}async function Fn(e,t,n=2400){return In("findPrefix",{code:e,theme:t},n)}function zn(){var e;null==(e=null==Tn?void 0:Tn.terminate)||e.call(Tn),Tn=null,En=null,Dn.clear()}let Vn=null,Kn=!1,Un=null,Xn=null;function qn(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(Un!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Un=r}catch{}}const Yn="undefined"!=typeof window?m:s,Zn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Gn=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Jn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Qn(e){if(!e)return"";const t=e.trim();return Jn.test(t)?t:""}function er(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function tr(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";er(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(Gn.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(er(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const nr={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 rr(r){var l,c,u,h,p,f,g,w,v,y;const k={...nr,...r},{t:b}=K(),C=o(()=>fe("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:nr.workerTimeoutMs,S=null!=(h=k.parseTimeoutMs)?h:nr.parseTimeoutMs,L=null!=(p=k.renderTimeoutMs)?p:nr.renderTimeoutMs,T=null!=(f=k.fullRenderTimeoutMs)?f:nr.fullRenderTimeoutMs,E=Math.max(0,null!=(g=k.renderDebounceMs)?g:nr.renderDebounceMs),[$,j]=i(!1),[A,_]=i(!1),[W,P]=i(!1),[O,R]=i(!1),[I,H]=i(1),[F,z]=i({x:0,y:0}),[V,U]=i(!1),[X,q]=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}),ge=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),Se=o(()=>Be?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:Zn,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(Vn)return qn(Vn,e),Vn;if(Xn){const t=await Xn;return t&&qn(t,e),t}if(Kn)return null;try{Kn=!0,Xn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Vn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Vn)throw new Error("Mermaid module did not export expected API");return qn(Vn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),Vn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Xn=null}})();const t=await Xn;return t&&qn(t,e),t}catch{return null}}(Se);e||(ae.current=t,j(Boolean(t)),ye.current||_(!t))})(),()=>{e=!0}},[Se]),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 Le=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(A||W)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;Ln(()=>Le(t))});return e.observe(ce.current),()=>e.disconnect()},[W,A,Le]),s(()=>()=>{zn()},[]),m(()=>{!A&&de.current&&we.current[Ne]&&(tr(de.current,we.current[Ne],Be),Ln(()=>Le()))},[A,Be,Ne,Le]);const Te=d(async(e,t,n)=>{var r;if(!ae.current||!de.current)return!1;q(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=ir(e,t),l=await ar(()=>ae.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=tr(de.current,l.svg,Be);return null==(r=l.bindFunctions)||r.call(l,de.current),Le(),we.current[t]=a,Z(!0),J(null),!0}catch(o){return Me||J(o instanceof Error?o.message:String(o)),!1}finally{q(!1)}},[T,Me,Be,Le]),Ee=d(async(e,t,n)=>{var r;if(ae.current&&de.current){q(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=ir(lr(e)||e,t),l=await ar(()=>ae.current.render(o,i),{timeoutMs:L,signal:n});(null==l?void 0:l.svg)&&(tr(de.current,l.svg,Be),null==(r=l.bindFunctions)||r.call(l,de.current),Le())}catch{}finally{q(!1)}}},[L,Me,Be,Le]),De=d(async(e,t)=>{if(!e.trim())return er(de.current),Z(!1),void(ve.current="");const n=e.replace(/\s+/g,"");if(n===ve.current&&ke.current)return;const r=++ge.current;try{if(await async function(e,t,n){try{if(await Hn(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=ir(e,t),o=n.mermaid;if("function"==typeof o.parse)return await ar(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await ar(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,Ne,{workerTimeout:B,parseTimeout:S,mermaid:ae.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;return void(await Te(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 Fn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return lr(e)}(e,Ne,{workerTimeout:B,signal:t});if(!n||(null==t?void 0:t.aborted)||ge.current!==r)return;await Ee(n,Ne,t)}catch{}},[S,Te,Ee,Ne,B]),$e=d(()=>ie&&!A&&!W,[W,A,ie]);s(()=>{if(!$e())return;if(!ae.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&$e()&&De(N,e.signal)},E);return()=>{e.abort(),window.clearTimeout(t)}},[N,$e,$,De,E]);const je=d((e,t)=>{e.clientX,e.clientY,ee(e.currentTarget,t,"top",!1,0,k.isDark)},[k.isDark]),Ae=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),R(!0),null==(t=k.onCopy)||t.call(k,N),setTimeout(()=>R(!1),1e3)}catch{}},[N,k]),_e=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=cr(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:cr(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]),We=d(()=>{he.current=null,er(me.current)},[]),Pe=d(()=>{ne(!1),We()},[We]),Oe=d(()=>{var e,t,n;const r=null!=(t=null==(e=de.current)?void 0:e.querySelector("svg"))?t:null,o=r?cr(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&&Pe()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Pe,Q]),Yn(()=>{if(!Q)return;const e=me.current,t=ce.current;if(!e||!t)return;const n=`translate(${F.x}px, ${F.y}px) scale(${I})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(he.current=o,o.style.transform=n),er(e),e.appendChild(r)},[Q]),s(()=>{Q&&he.current&&(he.current.style.transform=`translate(${F.x}px, ${F.y}px) scale(${I})`)},[Q,F.x,F.y,I]);const Re=A||X||W,Ie=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]),He=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){_(!1);const e=be.current;H(e.zoom),z({x:e.translateX,y:e.translateY}),oe(e.containerHeight)}else be.current={zoom:I,translateX:F.x,translateY:F.y,containerHeight:re},_(!0)},[N,re,De,k,Ne,F.x,F.y,Le,I]),Fe=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-F.x,o=e.clientY-n.top-F.y,i=.01*-e.deltaY,l=or(I+i,.5,3);if(l===I)return;const a=l/I;z({x:F.x-r*(a-1),y:F.y-o*(a-1)}),H(l)},[F,I]),ze=d((e,t)=>{U(!0),pe.current={x:e-F.x,y:t-F.y}},[F.x,F.y]),Ve=d((e,t)=>{V&&z({x:e-pe.current.x,y:t-pe.current.y})},[V]),Ke=d(()=>{U(!1)},[]),Ue=/* @__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:[
|
|
108
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("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=>je(e,b("common.zoomIn")),onMouseLeave:()=>te(),onClick:()=>H(or(I+.1,.5,3)),children:"+"}),
|
|
109
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("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=>je(e,b("common.zoomOut")),onMouseLeave:()=>te(),onClick:()=>H(or(I-.1,.5,3)),children:"−"}),
|
|
110
|
+
/* @__PURE__ */n("button",{type:"button",className:Xe("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=>je(e,b("common.resetZoom")),onMouseLeave:()=>te(),onClick:()=>{H(1),z({x:0,y:0})},children:[Math.round(100*I),"%"]})]})}),
|
|
111
|
+
/* @__PURE__ */n("div",{ref:ce,className:Xe("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:Fe,onMouseDown:e=>{0===e.button&&(e.preventDefault(),ze(e.clientX,e.clientY))},onMouseMove:e=>Ve(e.clientX,e.clientY),onMouseUp:Ke,onMouseLeave:Ke,onTouchStart:e=>{const t=e.touches[0];t&&ze(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Ve(t.clientX,t.clientY)},onTouchEnd:Ke,children:[
|
|
112
|
+
/* @__PURE__ */e("div",{ref:se,"data-mermaid-wrapper":!0,className:Xe("absolute inset-0 cursor-grab",{"cursor-grabbing":V}),style:{transform:`translate(${F.x}px, ${F.y}px) scale(${I})`},children:/* @__PURE__ */e("div",{ref:de,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(X||Me)&&/* @__PURE__ */n("div",{className:"mermaid-loading",children:[
|
|
114
113
|
/* @__PURE__ */e("span",{className:"mermaid-spinner"}),
|
|
115
|
-
/* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),qe=k.showHeader&&/* @__PURE__ */n("div",{className:
|
|
114
|
+
/* @__PURE__ */e("span",{children:"Rendering diagram…"})]})]})]}),qe=k.showHeader&&/* @__PURE__ */n("div",{className:Xe("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:[
|
|
116
115
|
/* @__PURE__ */n("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
|
|
117
116
|
/* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:C}}),
|
|
118
|
-
/* @__PURE__ */e("span",{className:
|
|
119
|
-
/* @__PURE__ */e("button",{type:"button",className:
|
|
117
|
+
/* @__PURE__ */e("span",{className:Xe("text-sm font-medium font-mono truncate",k.isDark?"text-gray-400":"text-gray-600"),children:"Mermaid"})]}),k.showModeToggle&&$&&/* @__PURE__ */n("div",{className:Xe("flex items-center space-x-1 rounded-md p-0.5",k.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
118
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("px-2.5 py-1 text-xs rounded transition-colors",A?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:()=>He("preview"),onMouseEnter:e=>je(e,b("common.preview")),onFocus:e=>je(e,b("common.preview")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
|
|
120
119
|
/* @__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:[
|
|
121
120
|
/* @__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"}),
|
|
122
121
|
/* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})}),
|
|
123
122
|
/* @__PURE__ */e("span",{children:b("common.preview")})]})}),
|
|
124
|
-
/* @__PURE__ */e("button",{type:"button",className:
|
|
123
|
+
/* @__PURE__ */e("button",{type:"button",className:Xe("px-2.5 py-1 text-xs rounded transition-colors",A?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:()=>He("source"),onMouseEnter:e=>je(e,b("common.source")),onFocus:e=>je(e,b("common.source")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[
|
|
125
124
|
/* @__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"})}),
|
|
126
125
|
/* @__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:Ie,"aria-pressed":
|
|
126
|
+
/* @__PURE__ */n("div",{className:"flex items-center space-x-1",children:[k.showCollapseButton&&/* @__PURE__ */e("button",{type:"button",className:Ie,"aria-pressed":W,onClick:()=>P(e=>!e),onMouseEnter:e=>je(e,b(W?"common.expand":"common.collapse")),onFocus:e=>je(e,b(W?"common.expand":"common.collapse")),onMouseLeave:()=>te(),onBlur:()=>te(),children:/* @__PURE__ */e("svg",{style:{rotate:W?"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:Ie,onClick:Ae,onMouseEnter:e=>je(e,b(O?"common.copied":"common.copy")),onFocus:e=>je(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:[
|
|
128
127
|
/* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
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:
|
|
128
|
+
/* @__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:Xe(Ie,Re?"opacity-50 cursor-not-allowed":""),disabled:Re,onClick:_e,onMouseEnter:e=>je(e,b("common.export")),onFocus:e=>je(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:[
|
|
130
129
|
/* @__PURE__ */e("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
131
|
-
/* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),k.showFullscreenButton&&$&&/* @__PURE__ */e("button",{type:"button",className:
|
|
130
|
+
/* @__PURE__ */e("path",{d:"m7 10l5 5l5-5"})]})})}),k.showFullscreenButton&&$&&/* @__PURE__ */e("button",{type:"button",className:Xe(Ie,Re?"opacity-50 cursor-not-allowed":""),disabled:Re,onClick:Q?Pe:Oe,onMouseEnter:e=>je(e,b(Q?"common.minimize":"common.open")),onFocus:e=>je(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:[A?/* @__PURE__ */e("div",{className:Xe("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})}):Ue,G&&/* @__PURE__ */e("div",{className:"mermaid-error",children:G})]});/* @__PURE__ */
|
|
132
131
|
return n(t,{children:[
|
|
133
|
-
/* @__PURE__ */n("div",{className:
|
|
134
|
-
/* @__PURE__ */e("div",{ref:ue,style:{display:
|
|
135
|
-
/* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>
|
|
132
|
+
/* @__PURE__ */n("div",{className:Xe("my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block",k.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Me}),children:[qe,
|
|
133
|
+
/* @__PURE__ */e("div",{ref:ue,style:{display:W?"none":""},children:Ye})]}),Q&&"undefined"!=typeof document&&x(
|
|
134
|
+
/* @__PURE__ */e("div",{className:"mermaid-modal-overlay",onClick:()=>Pe(),children:/* @__PURE__ */n("div",{className:Xe("mermaid-modal-panel",{"is-dark":k.isDark}),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),children:[
|
|
136
135
|
/* @__PURE__ */n("div",{className:"mermaid-modal-header",children:[
|
|
137
136
|
/* @__PURE__ */e("span",{className:"mermaid-modal-title",children:`Mermaid ${b("common.preview")}`}),
|
|
138
|
-
/* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:
|
|
139
|
-
/* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:me,className:"mermaid-modal-content"})})]})}),document.body)]})}function
|
|
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
|
|
137
|
+
/* @__PURE__ */e("button",{type:"button",className:"mermaid-modal-close",onClick:Pe,children:b("common.close")})]}),
|
|
138
|
+
/* @__PURE__ */e("div",{className:"mermaid-modal-body",children:/* @__PURE__ */e("div",{ref:me,className:"mermaid-modal-content"})})]})}),document.body)]})}function or(e,t,n){return Math.min(Math.max(e,t),n)}function ir(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function lr(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 ar(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 cr(e){return(new XMLSerializer).serializeToString(e)}function sr(e){const{node:t}=e;/* @__PURE__ */
|
|
139
|
+
return n("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function dr(n){var o;const{node:i,ctx:l,renderNode:a,indexKey:c,children:s}=n;if(!l||!a)/* @__PURE__ */
|
|
141
140
|
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(
|
|
142
141
|
/* @__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(
|
|
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
|
|
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
|
|
145
|
-
return e("s",{className:"strikethrough-node",children:t.children})}function
|
|
146
|
-
return e("strong",{className:"strong-node",children:t.children})}function
|
|
147
|
-
return e("sub",{className:"subscript-node",children:t.children})}function
|
|
148
|
-
return e("sup",{className:"superscript-node",children:t.children})}function
|
|
142
|
+
/* @__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 ur(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__ */
|
|
143
|
+
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 mr(t){/* @__PURE__ */
|
|
144
|
+
return e("s",{className:"strikethrough-node",children:t.children})}function hr(t){/* @__PURE__ */
|
|
145
|
+
return e("strong",{className:"strong-node",children:t.children})}function pr(t){/* @__PURE__ */
|
|
146
|
+
return e("sub",{className:"subscript-node",children:t.children})}function fr(t){/* @__PURE__ */
|
|
147
|
+
return e("sup",{className:"superscript-node",children:t.children})}function gr(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__ */
|
|
149
148
|
return n("div",{className:"table-node-wrapper","data-index-key":a,children:[
|
|
150
|
-
/* @__PURE__ */n("table",{className:
|
|
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:
|
|
149
|
+
/* @__PURE__ */n("table",{className:Xe("my-8 text-sm table-node",s&&"table-node--loading"),"aria-busy":s,children:[
|
|
150
|
+
/* @__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:Xe("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}`))})}),
|
|
152
151
|
/* @__PURE__ */e("tbody",{children:d.map((t,n)=>{var r;/* @__PURE__ */
|
|
153
|
-
return e("tr",{className:
|
|
152
|
+
return e("tr",{className:Xe("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:Xe("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:[
|
|
154
153
|
/* @__PURE__ */e("span",{className:"table-node__spinner","aria-hidden":"true"}),
|
|
155
|
-
/* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function
|
|
156
|
-
return e("span",{className:Ke("text-node whitespace-pre-wrap break-words",n.center&&"text-node-center"),children:null!=r?r:n.content})}function wr(){/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */e("span",{className:"sr-only",children:"Loading"})]})]})}function wr(){/* @__PURE__ */
|
|
157
155
|
return e("hr",{className:"hr-node thematic-break"})}function vr(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
156
|
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 yr(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 xr(t,n,o){var i,l,a;const c=null!=(i=o.customComponents)?i:R(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:xr,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:yr(t.content,e)};return r.createElement(i,{key:n,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter})}}switch(t.type){case"text":/* @__PURE__ */
|
|
159
|
-
return e(
|
|
160
|
-
return e(
|
|
161
|
-
return e(
|
|
157
|
+
return e(Gt,{node:t,ctx:o,indexKey:n,typewriter:o.typewriter},n);case"text_special":/* @__PURE__ */
|
|
158
|
+
return e(Gt,{node:{type:"text",content:null!=(a=t.content)?a:"",center:t.center},ctx:o,indexKey:n,typewriter:o.typewriter},n);case"paragraph":/* @__PURE__ */
|
|
159
|
+
return e(dr,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"heading":/* @__PURE__ */
|
|
162
160
|
return e(pt,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"blockquote":/* @__PURE__ */
|
|
163
|
-
return e(
|
|
164
|
-
return e(
|
|
165
|
-
return e(
|
|
166
|
-
return e(
|
|
161
|
+
return e(Sr,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"list":/* @__PURE__ */
|
|
162
|
+
return e(en,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"list_item":/* @__PURE__ */
|
|
163
|
+
return e(Qt,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"table":/* @__PURE__ */
|
|
164
|
+
return e(gr,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"definition_list":/* @__PURE__ */
|
|
167
165
|
return e(at,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"footnote":/* @__PURE__ */
|
|
168
166
|
return e(ut,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"footnote_reference":/* @__PURE__ */
|
|
169
167
|
return e(mt,{node:t},n);case"footnote_anchor":/* @__PURE__ */
|
|
170
168
|
return e(dt,{node:t},n);case"admonition":/* @__PURE__ */
|
|
171
169
|
return e(B,{node:t,ctx:o,renderNode:xr,indexKey:n,isDark:o.isDark,typewriter:o.typewriter},n);case"hardbreak":/* @__PURE__ */
|
|
172
170
|
return e(ht,{node:t,typewriter:o.typewriter},n);case"link":/* @__PURE__ */
|
|
173
|
-
return e(
|
|
171
|
+
return e(Jt,{node:t,ctx:o,renderNode:xr,indexKey:n,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},n);case"image":/* @__PURE__ */
|
|
174
172
|
return e(zt,{node:t},n);case"inline_code":/* @__PURE__ */
|
|
175
|
-
return e(Yt,{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(
|
|
177
|
-
return e(
|
|
173
|
+
return e(Yt,{node:t,ctx:o,indexKey:n,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__ */
|
|
174
|
+
return e(rr,{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(qt,{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(lt,{node:t,isDark:o.isDark,loading:Boolean(t.loading),...o.d2Props||{}},n)}return o.renderCodeBlocksAsPre||"mermaid"===d?/* @__PURE__ */e(Re,{node:t},n):/* @__PURE__ */e(Ke,{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__ */
|
|
175
|
+
return e(hr,{node:t,children:C(t.children,o,`${String(n)}-strong`,xr)},n);case"emphasis":/* @__PURE__ */
|
|
178
176
|
return e(st,{node:t,children:C(t.children,o,`${String(n)}-em`,xr)},n);case"strikethrough":/* @__PURE__ */
|
|
179
|
-
return e(
|
|
177
|
+
return e(mr,{node:t,children:C(t.children,o,`${String(n)}-strike`,xr)},n);case"highlight":/* @__PURE__ */
|
|
180
178
|
return e(ft,{node:t,children:C(t.children,o,`${String(n)}-highlight`,xr)},n);case"insert":/* @__PURE__ */
|
|
181
179
|
return e(Zt,{node:t,children:C(t.children,o,`${String(n)}-insert`,xr)},n);case"subscript":/* @__PURE__ */
|
|
182
|
-
return e(
|
|
183
|
-
return e(
|
|
180
|
+
return e(pr,{node:t,children:C(t.children,o,`${String(n)}-sub`,xr)},n);case"superscript":/* @__PURE__ */
|
|
181
|
+
return e(fr,{node:t,children:C(t.children,o,`${String(n)}-sup`,xr)},n);case"checkbox":case"checkbox_input":/* @__PURE__ */
|
|
184
182
|
return e(F,{node:t,typewriter:o.typewriter},n);case"emoji":/* @__PURE__ */
|
|
185
183
|
return e(ct,{node:t,typewriter:o.typewriter},n);case"thematic_break":/* @__PURE__ */
|
|
186
184
|
return e(wr,{},n);case"math_inline":/* @__PURE__ */
|
|
187
|
-
return e(
|
|
188
|
-
return e(
|
|
189
|
-
return e(
|
|
185
|
+
return e(Sn,{node:t},n);case"math_block":/* @__PURE__ */
|
|
186
|
+
return e(Bn,{node:t},n);case"reference":/* @__PURE__ */
|
|
187
|
+
return e(ur,{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(Ht,{node:t,typewriter:o.typewriter,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
|
|
190
188
|
return e(vr,{node:t,ctx:o,renderNode:xr,indexKey:n,typewriter:o.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
191
|
-
return e(
|
|
192
|
-
return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${
|
|
193
|
-
return e(E,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(Nr,{props:n,parsedNodes:
|
|
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
|
|
189
|
+
return e(sr,{node:t},n)}}const kr={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},br=h();function Cr(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 Mr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const Nr=r.memo(({props:t,parsedNodes:r,renderCtx:l,indexPrefix:c,containerRef:u})=>{var m,h,p,f,g,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!=(f=t.maxLiveNodes)?f:320),S=(null!=(g=t.maxLiveNodes)?g:0)>0&&r.length>B,L=!1!==t.viewportPriority,T=M&&(null!=(w=t.maxLiveNodes)?w:0)<=0,E=o(()=>{var e;return!1!==t.deferNodesUntilVisible&&!((null!=(e=t.maxLiveNodes)?e:0)<=0)&&!S&&!(r.length>900)&&L},[r.length,t.deferNodesUntilVisible,t.maxLiveNodes,L,S]),[$,j]=i(()=>T?Math.min(r.length,C):r.length),A=a($);s(()=>{A.current=$},[$]);const _=T?$:r.length,[W,P]=i(0),[O,R]=i({start:0,end:r.length}),I=a(/* @__PURE__ */new Map),[H,F]=i(0),z=a({}),V=a(/* @__PURE__ */new Map),K=a(/* @__PURE__ */new Map),U=a(/* @__PURE__ */new Map),X=a(/* @__PURE__ */new Map),q=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:T}),ie=E||S,le=o(()=>{const e=I.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[H]),ae=o(()=>{if(!S)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,S]),ce=o(()=>{if(!S)return r.length;const e=Math.max(O.end+N,C),t=Math.min(r.length,e);return Math.max($,t)},[r.length,S,O.end,N,C,$]);ne.current=ce;const se=d((e,t)=>{var n;if(e>=t)return 0;const r=I.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:le;return o},[le]),de=S?se(0,Math.min(O.start,r.length)):0,ue=S?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(!T)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)))},[T,t.renderBatchBudgetMs,b]),pe=d((e,n={})=>{var r,o;if(!T)return;const i=ne.current;if(A.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();j(t=>{const n=Math.min(ne.current,t+Math.max(1,e));return A.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),A.current>=ne.current)return;if(!e)return void c();const o=Math.max(2,null!=(n=t.renderBatchBudgetMs)?n:6);for(;A.current<ne.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(te.current)));A.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,T,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!==T;if(oe.current={batchSize:b,initial:C,delay:c,enabled:T},(l||s||!T)&&me(),(l||s)&&(te.current=Math.max(1,b||1),q.current.clear()),!o)return A.current=0,void j(0);const d=ne.current;if(!T)return A.current=d,void j(d);if(l||s){const e=Math.min(d,C);return A.current=e,j(e),void(e<d&&pe(Math.max(1,C),{immediate:!x}))}const u=Math.min(A.current,d);u!==A.current&&(A.current=u,j(u)),A.current<d&&pe(Math.max(1,b||1))},[me,T,x,r.length,t.indexKey,t.renderBatchDelay,b,C,pe]),s(()=>{if(!S)return void R({start:0,end:r.length});const e=r.length;if(!e)return void R({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))}R({start:n,end:o})},[W,N,B,r.length,S]),s(()=>()=>{me();for(const e of V.current.values())e.destroy();V.current.clear()},[me]);const fe=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete z.current[t],K.current.delete(t),U.current.delete(t),X.current.delete(t))},[]);s(()=>{fe(_)},[fe,_]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(I.current.keys()))n>=e&&(I.current.delete(n),t=!0);t&&F(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(q.current))n>=e&&q.current.delete(n)},[r.length]);const ge=d((e,t)=>{E&&t&&(z.current[e]=!0),t&&S&&P(t=>e>t?e:t)},[E,S]),we=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),ve=d((e,t)=>{const n=K.current;if(t?n.set(e,t):n.delete(e),!ie||!t)return we(e),E&&!t&&delete z.current[e],void(t&&ge(e,!0));if(e<C&&!S)return we(e),void ge(e,!0);we(e);const r=y(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ge(e,!0),r.whenVisible.then(()=>ge(e,!0)).catch(()=>{})},[E,we,ge,y,C,ie,S]),ye=d(e=>{const t=U.current.get(e);if(t)return t;const n=t=>ve(e,t);return U.current.set(e,n),n},[ve]),xe=d((e,t)=>{if(!t)return void(I.current.has(e)&&(I.current.delete(e),F(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&I.current.get(e)!==n&&(I.current.set(e,n),F(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),ke=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>xe(e,t);return X.current.set(e,n),n},[xe]),be=d(e=>!(T&&e>=A.current)&&(!E||e<C||!0===z.current[e]),[E,T,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 K.current.entries())t&&ve(e,t)},[ve]),s(()=>{S&&$>Y.current&&P($-1),Y.current=$},[$,S]);const Me=S?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${de}px`},"aria-hidden":"true"}):null,Ne=S?/* @__PURE__ */e("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
|
|
190
|
+
return n("div",{ref:u,className:`markstream-react markdown-renderer${t.isDark?" dark":""}${S?" 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=I.current.get(r))?o:le,s=!1!==t.typewriter&&"code_block"!==n.type&&!q.current.has(r)&&i;return s&&q.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:xr(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={...kr,...t},r=a(null),i=a(null),l=a(/* @__PURE__ */new Map),c=u(W,P,P),d=o(()=>R(n.customId),[n.customId,c]),m=o(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),f=o(()=>Object.keys(d).map(String).map(e=>e.trim().toLowerCase()).filter(Mr),[d]),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:[],...f].map(Cr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,f,c]),w=o(()=>{const e=g;return e&&0!==e.length?h(m,{customHtmlTags:e}):h(m)},[m,g]),v=o(()=>{const e=w;return n.customMarkdownIt?n.customMarkdownIt(e):e},[w,n.customMarkdownIt]),y=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]),x=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!=v?v:br,y)),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,y,v,n.customId,c,g]);s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!x.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)},[x,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_"+ ++Pe;return We.set(e,n),n}return String(e)}(e);t&&je!==t&&($e=e,je=t,Ae&&De($e,Ae).then(()=>Oe()).catch(()=>{}))}(e))},[n.codeBlockDarkTheme,n.codeBlockLightTheme,n.isDark,n.renderCodeBlocksAsPre]);const k=o(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),b=o(()=>({..."boolean"==typeof n.showTooltips?{showTooltips:n.showTooltips}:{},...n.codeBlockProps||{}}),[n.codeBlockProps,n.showTooltips]),C=o(()=>({...n.mermaidProps||{}}),[n.mermaidProps]),M=o(()=>({...n.d2Props||{}}),[n.d2Props]),N=o(()=>({...n.infographicProps||{}}),[n.infographicProps]),B=o(()=>({customId:n.customId,isDark:n.isDark,indexKey:k,typewriter:n.typewriter,textStreamState:l.current,customComponents:d,showTooltips:n.showTooltips,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:b,mermaidProps:C,d2Props:M,infographicProps:N,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,k,n.typewriter,n.showTooltips,n.renderCodeBlocksAsPre,n.codeBlockStream,b,C,M,N,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick,d]);/* @__PURE__ */
|
|
191
|
+
return e(E,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */e(Nr,{props:n,parsedNodes:x,renderCtx:B,indexPrefix:k,containerRef:r})})};function Sr(t){var n,r,o,i,l,a;const{node:c,ctx:s,renderNode:d,indexKey:u,children:m}=t;/* @__PURE__ */
|
|
192
|
+
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 Lr(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 f=o(()=>{const e=ge[m]||m;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[m]),g=o(()=>fe(m),[m,h]),{t:w}=K(),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,S]=i(""),[L,T]=i(!1),[E,D]=i(14),[$,j]=i(E),A=o(()=>!1!==l.showTooltips,[l.showTooltips]),_=a(null),W=a(null),P=a(null),O=a(null),R=a(!1),I=d(()=>l.isDark?l.darkTheme:l.lightTheme,[l.darkTheme,l.isDark,l.lightTheme]),H=d(e=>{if(!e)return S(""),void T(!1);var t;S(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`),T(!1)},[]),F=d(()=>{S(""),T(!0)},[]),z=d(async()=>{if(!O.current&&!R.current){R.current=!0;try{const e=await import("stream-markdown");O.current=e.createShikiStreamRenderer}catch{}}},[]),V=d(async()=>{if(await z(),_.current&&W.current)if(!P.current&&O.current&&(P.current=O.current(W.current,{theme:I(),themes:l.themes}),T(!0)),P.current)if(!1===l.stream&&l.loading)H(l.node.code);else{H(l.node.code);try{await P.current.updateCode(l.node.code,u),F()}catch{}}else H(l.node.code);else H(l.node.code)},[F,z,I,u,l.loading,l.node.code,l.stream,l.themes,H]);s(()=>(V(),()=>{var e;null==(e=P.current)||e.dispose(),P.current=null}),[V]),s(()=>{P.current&&P.current.setTheme(I())},[I]),s(()=>{P.current&&(!1===l.stream&&l.loading||(H(l.node.code),Promise.resolve(P.current.updateCode(l.node.code,u)).then(()=>F()).catch(()=>{})))},[F,u,l.loading,l.node.code,l.stream,H]),s(()=>{A||te(!0)},[A]);const U=d((e,t)=>{if(!A)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,A]),X=d(()=>{A&&te()},[A]),q=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),j(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:[
|
|
195
193
|
/* @__PURE__ */n("div",{className:"flex items-center space-x-2",children:[
|
|
196
194
|
/* @__PURE__ */e("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:g}}),
|
|
197
195
|
/* @__PURE__ */e("span",{className:"text-sm font-medium font-mono",children:f})]}),
|
|
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=>
|
|
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:()=>
|
|
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:$===E,onClick:()=>
|
|
196
|
+
/* @__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=>U(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onFocus:e=>U(e,M?w("common.expand")||"Expand":w("common.collapse")||"Collapse"),onMouseLeave:X,onBlur:X,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:[
|
|
197
|
+
/* @__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:()=>j(e=>Math.max(10,e-1)),onMouseEnter:e=>U(e,w("common.decrease")||"Decrease"),onFocus:e=>U(e,w("common.decrease")||"Decrease"),onMouseLeave:X,onBlur:X,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"})})}),
|
|
198
|
+
/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$===E,onClick:()=>j(E),onMouseEnter:e=>U(e,w("common.reset")||"Reset"),onFocus:e=>U(e,w("common.reset")||"Reset"),onMouseLeave:X,onBlur:X,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:[
|
|
201
199
|
/* @__PURE__ */e("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
|
|
202
200
|
/* @__PURE__ */e("path",{d:"M3 3v5h5"})]})})}),
|
|
203
|
-
/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$>=36,onClick:()=>
|
|
201
|
+
/* @__PURE__ */e("button",{type:"button",className:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:$>=36,onClick:()=>j(e=>Math.min(36,e+1)),onMouseEnter:e=>U(e,w("common.increase")||"Increase"),onFocus:e=>U(e,w("common.increase")||"Increase"),onMouseLeave:X,onBlur:X,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"})})})]}),l.showCopyButton&&/* @__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":x?w("common.copied")||"Copied":w("common.copy")||"Copy",onClick:q,onMouseEnter:e=>U(e,x?w("common.copied")||"Copied":w("common.copy")||"Copy"),onFocus:e=>U(e,x?w("common.copied")||"Copied":w("common.copy")||"Copy"),onMouseLeave:X,onBlur:X,children:/* @__PURE__ */e("svg",x?{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:[
|
|
204
202
|
/* @__PURE__ */e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
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=>
|
|
203
|
+
/* @__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=>U(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onFocus:e=>U(e,b?w("common.collapse")||"Collapse":w("common.expand")||"Expand"),onMouseLeave:X,onBlur:X,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=>U(e,w("common.preview")||"Preview"),onFocus:e=>U(e,w("common.preview")||"Preview"),onMouseLeave:X,onBlur:X,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:[
|
|
206
204
|
/* @__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"}),
|
|
207
|
-
/* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!M&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:
|
|
208
|
-
/* @__PURE__ */e("div",{ref:
|
|
205
|
+
/* @__PURE__ */e("circle",{cx:"12",cy:"12",r:"3"})]})})})]})]}),!M&&(!!l.stream||!l.loading)&&/* @__PURE__ */n("div",{ref:_,className:"code-block-content",style:{...Z,maxHeight:b?"none":"500px",overflowY:b?"visible":"auto",overflowX:"auto"},children:[
|
|
206
|
+
/* @__PURE__ */e("div",{ref:W,className:"code-block-render"}),!L&&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:[
|
|
209
207
|
/* @__PURE__ */e("div",{className:"skeleton-line"}),
|
|
210
208
|
/* @__PURE__ */e("div",{className:"skeleton-line"}),
|
|
211
209
|
/* @__PURE__ */e("div",{className:"skeleton-line short"})]})}),
|
|
212
|
-
/* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:x?w("common.copied")||"Copied":""})]})}function
|
|
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,
|
|
210
|
+
/* @__PURE__ */e("span",{className:"sr-only","aria-live":"polite",role:"status",children:x?w("common.copied")||"Copied":""})]})}function Tr(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 g(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=f(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(
|
|
211
|
+
/* @__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,Sr as BlockquoteNode,F as CheckboxNode,Ke as CodeBlockNode,lt as D2BlockNode,at as DefinitionListNode,ct as EmojiNode,st as EmphasisNode,sr as FallbackComponent,dt as FootnoteAnchorNode,ut as FootnoteNode,mt as FootnoteReferenceNode,ht as HardBreakNode,pt as HeadingNode,ft as HighlightNode,Bt as HtmlBlockNode,Ht as HtmlInlineNode,we as HtmlPreviewFrame,zt as ImageNode,qt as InfographicBlockNode,Yt as InlineCodeNode,Zt as InsertNode,Jt as LinkNode,Qt as ListItemNode,en as ListNode,Pn as MERMAID_WORKER_BUSY_CODE,Lr as MarkdownCodeBlockNode,Bn as MathBlockNode,Sn as MathInlineNode,rr as MermaidBlockNode,Br as NodeRenderer,dr as ParagraphNode,Re as PreCodeNode,Ke as ReactCodeBlockNode,ur as ReferenceNode,mr as StrikethroughNode,hr as StrongNode,pr as SubscriptNode,fr as SuperscriptNode,gr as TableNode,Gt as TextNode,wr as ThematicBreakNode,Tr as Tooltip,vr as VmrContainerNode,hn as WORKER_BUSY_CODE,Hn as canParseOffthread,H as clearGlobalCustomComponents,gn as clearKaTeXCache,un as clearKaTeXWorker,Rn as clearMermaidWorker,Br as default,Qe as disableD2,Je as enableD2,Fn as findPrefixOffthread,R as getCustomNodeComponents,kn as getKaTeXBackpressureDefaults,fe as getLanguageIcon,Wn as getMermaidWorkerLoad,et as isD2Enabled,ge as languageMap,de as normalizeLanguageIdentifier,he as preloadExtendedLanguageIcons,I as removeCustomComponents,pn as renderKaTeXInWorker,bn as renderKaTeXWithBackpressure,xr as renderNode,ue as resolveMonacoLanguageId,O as setCustomComponents,Ge as setD2Loader,V as setDefaultI18nMap,xn as setKaTeXBackpressureDefaults,fn as setKaTeXCache,wn as setKaTeXConcurrencyLimit,dn as setKaTeXWorker,mn as setKaTeXWorkerDebug,ae as setLanguageIconResolver,On as setMermaidWorker,An as setMermaidWorkerClientDebug,_n as setMermaidWorkerMaxConcurrency,pe as subscribeLanguageIconsRevision,zn as terminateWorker,K as useSafeI18n,vn as waitForKaTeXWorkerSlot};
|