markstream-react 0.0.52 → 0.0.53

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.
@@ -1,3 +0,0 @@
1
- import{jsx as t,Fragment as n}from"react/jsx-runtime";import e from"react";import{hasCustomHtmlComponents as o,tokenizeHtml as s,BLOCKED_HTML_TAGS as r,isHtmlTagHardBlocked as a,isHtmlTagBlocked as i,sanitizeHtmlAttrs as l,isCustomHtmlComponentTag as c,getHtmlTagFromContent as h}from"stream-markdown-parser";const u=/* @__PURE__ */new Set(["table","code_block","html_block","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function p(t){if(Array.isArray(t)&&0!==t.length)return t.reduce((t,[n,e])=>n?(t["for"===n?"htmlFor":"class"===n?"className":n]=null==e||e,t):t,{})}function g(n,e,o,s){if(!Array.isArray(n)||0===n.length)return null;const r=[];for(let a=0;a<n.length;a++){const i=n[a];if(i){if("label_open"===i.type){const l=[];for(a++;a<n.length;){const t=n[a];if("label_close"===(null==t?void 0:t.type))break;t&&l.push(t),a++}const c=`${o}-label-${a}`;r.push(
2
- /* @__PURE__ */t("label",{...p(i.attrs),children:g(l,e,`${c}-child`,s)},c));continue}"label_close"!==i.type&&r.push(s(i,`${o}-${a}`,e))}}return r}function m(e,o,s,r){/* @__PURE__ */
3
- return t(n,{children:g(e,o,`${s}-inline`,r)})}const d="__global__",f="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",w=(()=>{const t=globalThis;if(t[f])return t[f];const n={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return t[f]=n,n})();function v(){w.revision++;for(const t of Array.from(w.listeners))try{t()}catch{}}function k(t){return w.listeners.add(t),()=>{w.listeners.delete(t)}}function y(){return w.revision}function x(t,n){"string"==typeof t?w.scopedComponents[t]={...n||{}}:w.scopedComponents[d]={...t},v()}function b(t){const n=w.scopedComponents[d]||{};if(!t)return n;const e=w.scopedComponents[t]||{};return n&&0!==Object.keys(n).length?e&&0!==Object.keys(e).length?{...n,...e}:n:e}function C(t){if(t===d)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete w.scopedComponents[t],v()}function j(){delete w.scopedComponents[d],v()}function M(t){return null==t?void 0:t.markstreamDisplay}function N(t,n){return t.markstreamDisplay=n,t}const _='<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 S=null,B=null,L=null;const A=/* @__PURE__ */new Set;function E(t){S=null!=t?t:null}const H={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",d2lang:"d2",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"},O={"":_,plain:_,text:_,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 $(t){var n;const e=function(t){if(!t)return"";const n=t.trim();if(!n)return"";const[e]=n.split(/\s+/),[o]=e.split(":");return o.toLowerCase()}(t);return null!=(n=H[e])?n:e}function V(t){const n=$(t);if(!n)return"plaintext";switch(n){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return n}}async function T(){return B||(L||(L=import("./languageIconExtended-B1nZmPQn.js").then(t=>(B=t.EXTENDED_LANGUAGE_ICON_MAP,function(){for(const t of A)try{t()}catch{}}(),B)).catch(()=>null)),L)}async function z(){await T()}function D(t){return A.add(t),()=>{A.delete(t)}}function F(t){if(S){const n=S(t);if(null!=n&&""!==n)return n}const n=$(t),e=O[n];if(e)return e;return(null==B?void 0:B[n])||(T(),'<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 W={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",csharp:"C#",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid",d2:"D2"};function P(t){return t.startsWith("--")?t:t.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function G(t){const n={...t};if(Object.prototype.hasOwnProperty.call(n,"class")&&(n.className=n.class,delete n.class),Object.prototype.hasOwnProperty.call(n,"for")&&(n.htmlFor=n.for,delete n.for),"string"==typeof n.style){const t=function(t){const n=t.trim();if(!n)return;const e={};for(const o of n.split(";")){const t=o.trim();if(!t)continue;const n=t.indexOf(":");if(-1===n)continue;const s=P(t.slice(0,n).trim()),r=t.slice(n+1).trim();s&&(e[s]=r)}return Object.keys(e).length?e:void 0}(n.style);t?n.style=t:delete n.style}return n}const I=s,R=l;function q(t,n){return c(t,n)}function J(t,n){return o(t,n)}function U(t,n,e=!1){const o=Object.entries(null!=n?n:{}),s=o.length>0?o.map(([t,n])=>""===n?` ${t}`:` ${t}="${n}"`).join(""):"";return e?`<${t}${s} />`:`<${t}${s}>`}function X(t,n){Array.isArray(n)?t.push(...n):null!=n&&t.push(n)}function Z(t,n,o="safe"){var s;if(!t)return[];if("escape"===o)return[t];try{const l=I(t);let c=0;const h=[],u=[];for(const t of l){if("text"===t.type){if(h.length>0&&h[h.length-1].hardBlocked)continue;(h.length>0?h[h.length-1].children:u).push(null!=(s=t.content)?s:"");continue}if("self_closing"===t.type){const s=q(t.tagName,n);if(r.has(t.tagName.toLowerCase())||!s&&a(t.tagName,o))continue;if(!s&&i(t.tagName,o)){(h.length>0?h[h.length-1].children:u).push(U(t.tagName,t.attrs,!0));continue}const l=R(t.attrs||{},o,t.tagName),p=l.key,g=null!=p&&""!==p?p:"ms-html-"+c++,m=s?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0,d=h.length>0?h[h.length-1].children:u;m?d.push(e.createElement(m,{...l,key:g})):d.push(e.createElement(t.tagName,{...G(l),key:g,suppressHydrationWarning:!0}));continue}if("tag_open"===t.type){const e=h.length>0&&h[h.length-1].hardBlocked,s=q(t.tagName,n);h.push({tagName:t.tagName,children:[],attrs:t.attrs,customComponent:s,hardBlocked:e||r.has(t.tagName.toLowerCase())||!s&&a(t.tagName,o),softBlocked:!e&&!s&&i(t.tagName,o)});continue}const l=h.pop();if(!l||l.hardBlocked)continue;if(l.softBlocked){const t=[U(l.tagName,l.attrs),...l.children,`</${l.tagName}>`];h.length>0?X(h[h.length-1].children,t):X(u,t);continue}const p=R(l.attrs||{},o,l.tagName),g=p.key,m=null!=g&&""!==g?g:"ms-html-"+c++,d=l.customComponent?n[l.tagName]||n[l.tagName.toLowerCase()]:void 0,f=d?e.createElement(d,{...p,key:m},...l.children):e.createElement(l.tagName,{...G(p),key:m,suppressHydrationWarning:!0},...l.children);h.length>0?h[h.length-1].children.push(f):u.push(f)}for(;h.length>0;){const t=h.pop();if(!t||t.hardBlocked)continue;if(t.softBlocked){X(u,[U(t.tagName,t.attrs),...t.children,`</${t.tagName}>`]);continue}const s=R(t.attrs||{},o,t.tagName),r=s.key,a=null!=r&&""!==r?r:"ms-html-"+c++,i=t.customComponent?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0,l=i?e.createElement(i,{...s,key:a},...t.children):e.createElement(t.tagName,{...G(s),key:a,suppressHydrationWarning:!0},...t.children);u.push(l)}return u}catch{return null}}function K(t){const n="number"==typeof t?t:Number.parseFloat(String(null!=t?t:""));return Number.isFinite(n)&&n>0?n:null}function Q(t){const n=t.split(/\r?\n/).filter(t=>/^\s*-\s+/.test(t)).length;return n>=3?500:n>0?280+60*n:360}function Y(t,n=360,e=500){return null==e?Math.max(n,t):Math.min(Math.max(n,t),e)}function tt(t){return t?t.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}function nt(t){const n="number"==typeof t?t:Number.parseFloat(String(null!=t?t:""));return Number.isFinite(n)&&n>0?n:null}function et(t){const n=t.split(/\r?\n/).map(t=>t.trim()).filter(t=>t&&!t.startsWith("%%")),e=Math.max(1,n.length),o=function(t){var n;for(const e of t.split(/\r?\n/)){const t=e.trim();if(!t||t.startsWith("%%"))continue;const o=t.match(/^([A-Z][\w-]*)\b/i);return(null==(n=null==o?void 0:o[1])?void 0:n.toLowerCase())||""}return""}(t);return"gantt"===o?220+28*e:"sequencediagram"===o?180+26*e:"classdiagram"===o||"statediagram"===o||"erdiagram"===o?180+24*e:"flowchart"===o||"graph"===o?170+28*e:200+22*e}function ot(t,n=360,e=500){return null==e?Math.max(n,t):Math.min(Math.max(n,t),e)}function st(t,n,e){var o,s,r,a,i;const l=String(null!=(o=t.type)?o:"").trim().toLowerCase(),c=(null!=e?e:[]).map(t=>t.toLowerCase()),u="html_inline"===l||"html_block"===l;if(!u&&!c.includes(l))return null;const p=u?String(null!=(s=t.tag)?s:"").trim().toLowerCase()||h(t.content):String(null!=(r=t.tag)?r:"").trim().toLowerCase()||l;if(!p)return null;const g=c.includes(p),m=g&&null!=(i=null!=(a=n[p])?a:n[l])?i:null;return{tag:p,isWhitelisted:g,component:m,display:M(m)}}function rt(t,n,e){var o;return"block"===(null==(o=st(t,n,e))?void 0:o.display)}const at=/* @__PURE__ */new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function it(t,n={}){var e;const o={},s=new Set(null!=(e=n.omit)?e:[]);if(!t||"object"!=typeof t)return o;const r=Object.getOwnPropertyDescriptors(t);for(const[a,i]of Object.entries(r))at.has(a)||s.has(a)||i.enumerable&&"value"in i&&(o[a]=i.value);return o}export{R as A,u as B,x as C,E as D,k as E,D as F,p as G,I as H,N as I,ot as a,j as b,Y as c,et as d,Q as e,M as f,it as g,y as h,b as i,F as j,J as k,q as l,rt as m,W as n,G as o,tt as p,$ as q,Z as r,nt as s,K as t,z as u,C as v,m as w,g as x,st as y,V as z};
@@ -1,85 +0,0 @@
1
- import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import{normalizeShikiLanguage as t}from"markstream-core";import l from"react";import{NON_STRUCTURING_HTML_TAGS as i,isHtmlTagBlocked as o,sanitizeImageSrc as a,sanitizeHtmlAttrs as d,shouldOpenLinkInNewTab as c,mergeCustomHtmlTags as s,getMarkdown as u,parseMarkdownToStructure as m,stripCustomHtmlWrapper as h,shouldRenderUnknownHtmlTagAsText as p,sanitizeHtmlTokenAttrs as g}from"stream-markdown-parser";import{p as y,x as f,w as x,i as k,r as v,B as w,m as b,G as N,y as $,o as S,q as B,g as K,s as _,a as T,d as I,t as P,c as H,e as A}from"./codeBlockExtraProps-NhTjbA1T.js";let D,C=!1;function M(e,n,r){const t=y(e);if(!t)return null;if(globalThis.__MARKSTREAM_REACT_DISABLE_SYNC_KATEX__)return null;const l=function(){if(D)return D;if(C)return null;C=!0;try{const e=function(){try{const e=Reflect.get(globalThis,"process"),n="function"==typeof(null==e?void 0:e.getBuiltinModule)?e.getBuiltinModule("module"):null;return"function"==typeof(null==n?void 0:n.createRequire)?n.createRequire(import.meta.url):null}catch{return null}}();if(!e)return null;const n=e("katex");try{e("katex/contrib/mhchem")}catch{}return D=n,D}catch{return null}}();if(!l)return null;try{return l.renderToString(t,{displayMode:n,throwOnError:r})}catch{return null}}const E=u();function W(e){var n;return String(null!=(n=String(null!=e?e:"").split(/\s+/g)[0])?n:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function L(r,t,l){var i,o;const a=W(t.language),d=String(null!=(o=null!=(i=t.code)?i:t.raw)?o:""),c=function(e){const n=B(String(null!=e?e:""));return n&&"plaintext"!==n?n.charAt(0).toUpperCase()+n.slice(1):"Text"}(t.language);/* @__PURE__ */
2
- return e("div",{className:`${r} ${r}--ssr`,"data-ssr-fallback":l.fallback,children:[!1!==l.showHeader&&/* @__PURE__ */n("div",{className:`${r}__header`,children:/* @__PURE__ */n("span",{className:`${r}__language`,children:c})}),
3
- /* @__PURE__ */n("div",{className:`${r}__body`,children:/* @__PURE__ */n("pre",{className:`language-${a}`,"aria-busy":!0===t.loading,"aria-label":`Code block: ${a}`,"data-language":a,tabIndex:0,children:/* @__PURE__ */n("code",{translate:"no",children:d})})})]})}function q(e,n,r,t,i={}){var o,a,d,c,s,u;const m=K(t.codeBlockProps);return l.createElement(e,{key:r,node:n,loading:Boolean(n.loading),stream:t.codeBlockStream,customId:t.customId,isDark:t.isDark,darkTheme:null==(o=t.codeBlockThemes)?void 0:o.darkTheme,lightTheme:null==(a=t.codeBlockThemes)?void 0:a.lightTheme,themes:null==(d=t.codeBlockThemes)?void 0:d.themes,langs:null==(c=t.codeBlockThemes)?void 0:c.langs,minWidth:null==(s=t.codeBlockThemes)?void 0:s.minWidth,maxWidth:null==(u=t.codeBlockThemes)?void 0:u.maxWidth,onCopy:t.events.onCopy,...m,...i,ctx:t,renderNode:Pe,indexKey:r,typewriter:t.typewriter})}function O(e,n,r,t,i={}){return l.createElement(e,{key:r,node:n,isDark:t.isDark,...i})}function j(e){const{node:r,children:t}=e;/* @__PURE__ */
4
- return n("span",{className:"text-node whitespace-pre-wrap break-words"+(r.center?" text-node-center":""),children:null!=t?t:r.content})}function R(e){var n;return"text"===(null==e?void 0:e.type)&&""===String(null!=(n=null==e?void 0:e.content)?n:"").trim()}function F(e,r,t,i){const o=e.filter(e=>!R(e)),a=o.length>0&&o.every(e=>"image"===e.type||function(e){var n;const r=function(e){return"link"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.children)?e.children.filter(e=>!R(e)):[]}(e);return 1===r.length&&"image"===(null==(n=r[0])?void 0:n.type)}(e));if(!a||o.length<=1)return f(e,t,i,r);const d=[];for(let n=0;n<e.length;n++){const r=e[n];if(!R(r)){d.push(r);continue}const t=d.length>0,l=e.slice(n+1).some(e=>!R(e));t&&l&&d.push({...r,content:" ",raw:" "})}return d.map((e,o)=>{var d;return a&&R(e)?/* @__PURE__ */n(l.Fragment,{children:String(null!=(d=null==e?void 0:e.content)?d:"")},`${i}-${o}`):r(e,`${i}-${o}`,t)})}function z(e){var t,i;const{node:o,ctx:a,renderNode:d,indexKey:c,children:s}=e;if(!a||!d)/* @__PURE__ */
5
- return n("p",{dir:"auto",className:"paragraph-node",children:s});const u=null!=(t=o.children)?t:[],m=null!=(i=a.customComponents)?i:k(a.customId),h=[],p=[],g=()=>{if(!p.length)return;const e=h.length;h.push(
6
- /* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:F(p.slice(),d,a,`${String(null!=c?c:"paragraph")}-${e}`)},`${String(null!=c?c:"paragraph")}-inline-${e}`)),p.length=0};return u.forEach((e,r)=>{w.has(e.type)||b(e,m,a.customHtmlTags)?(g(),h.push(
7
- /* @__PURE__ */n(l.Fragment,{children:d(e,`${String(null!=c?c:"paragraph")}-block-${r}`,a)},`${String(null!=c?c:"paragraph")}-block-${r}`))):p.push(e)}),g(),h.length?/* @__PURE__ */n(r,{children:h}):/* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:F(u,d,a,String(null!=c?c:"paragraph"))})}function U(e){const{node:r,ctx:t,renderNode:l,indexKey:i,children:o}=e,a=Math.min(6,Math.max(1,Number(r.level)||1)),d=`h${a}`,c=null==r?void 0:r.attrs,{class:s,className:u,style:m,...h}=null!=c?c:{},p=["heading-node","font-semibold",`heading-${a}`,s,u].filter(Boolean).join(" ");/* @__PURE__ */
8
- return n(d,{dir:"auto",className:p,..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=o?o:t&&l?f(r.children,t,String(null!=i?i:`heading-${a}`),l):null})}function G(e){const{node:r,ctx:t,renderNode:l,indexKey:i,children:o}=e;/* @__PURE__ */
9
- return n("blockquote",{className:"blockquote-node",dir:"auto",cite:r.cite,children:null!=o?o:t&&l?f(r.children,t,String(null!=i?i:"blockquote"),l):null})}function V(e){const{node:r,ctx:t,renderNode:l,value:i,indexKey:o,children:a}=e;/* @__PURE__ */
10
- return n("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=a?a:t&&l?f(r.children,t,String(null!=o?o:"list-item"),l):null})}function X(e){var r;const{node:t,ctx:l,renderNode:i,indexKey:o}=e,a=t.ordered?"ol":"ul",d=t.ordered&&t.start?t.start:void 0,c=l&&k(l.customId).list_item||V;/* @__PURE__ */
11
- return n(a,{className:t.ordered?"list-node my-5 pl-[calc(13/8*1em)] list-decimal":"list-node my-5 pl-[calc(13/8*1em)] list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]",start:d,children:null==(r=t.items)?void 0:r.map((e,r)=>{var a;/* @__PURE__ */
12
- return n(c,{node:e,value:t.ordered?(null!=(a=t.start)?a:1)+r:void 0,ctx:l,renderNode:i,indexKey:`${String(null!=o?o:"list")}-${r}`,customId:null==l?void 0:l.customId,isDark:null==l?void 0:l.isDark,typewriter:null==l?void 0:l.typewriter},`${String(null!=o?o:"list")}-${r}`)})})}function Y(r){var t;const{node:l,ctx:i,renderNode:o,indexKey:a}=r,d=Array.isArray(null==(t=null==l?void 0:l.header)?void 0:t.cells)?l.header.cells:[],c=Boolean(null==l?void 0:l.loading),s=Array.isArray(null==l?void 0:l.rows)?l.rows:[],u=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
13
- return e("div",{className:"table-node-wrapper","data-index-key":a,children:[
14
- /* @__PURE__ */e("table",{className:"my-8 text-sm table-node"+(c?" table-node--loading":""),"aria-busy":c,children:[
15
- /* @__PURE__ */n("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */n("tr",{className:"border-b",children:d.map((e,r)=>/* @__PURE__ */n("th",{className:`font-semibold p-[calc(4/7*1em)] ${u(e.align)}`,dir:"auto",children:i&&o?x(e.children,i,`${String(null!=a?a:"table")}-th-${r}`,o):null},`header-${r}`))})}),
16
- /* @__PURE__ */n("tbody",{children:s.map((e,r)=>{var t;/* @__PURE__ */
17
- return n("tr",{className:r<s.length-1?"border-[var(--table-border,#cbd5e1)] border-b":"border-[var(--table-border,#cbd5e1)]",children:null==(t=e.cells)?void 0:t.map((e,t)=>/* @__PURE__ */n("td",{className:`p-[calc(4/7*1em)] ${u(e.align)}`,dir:"auto",children:i&&o?x(e.children,i,`${String(null!=a?a:"table")}-row-${r}-${t}`,o):null},`cell-${r}-${t}`))},`row-${r}`)})})]}),c&&/* @__PURE__ */e("div",{className:"table-node__loading",role:"status","aria-live":"polite",children:[
18
- /* @__PURE__ */n("span",{className:"table-node__spinner","aria-hidden":"true"}),
19
- /* @__PURE__ */n("span",{className:"sr-only",children:"Loading"})]})]})}function J(r){const{node:t,ctx:l,renderNode:i,indexKey:o}=r,a=Array.isArray(t.items)?t.items:[];/* @__PURE__ */
20
- return n("dl",{className:"definition-list","data-index-key":o,children:a.map((r,t)=>/* @__PURE__ */e("div",{className:"mb-4",children:[
21
- /* @__PURE__ */n("dt",{className:"definition-term font-semibold",children:l&&i?x(r.term,l,`${String(null!=o?o:"definition")}-term-${t}`,i):null}),
22
- /* @__PURE__ */n("dd",{className:"definition-desc ml-4",children:l&&i?x(r.definition,l,`${String(null!=o?o:"definition")}-desc-${t}`,i):null})]},`${String(null!=o?o:"definition")}-${t}`))})}function Q(e){const{node:r,ctx:t,renderNode:l,indexKey:i}=e;/* @__PURE__ */
23
- return n("div",{id:`fnref--${r.id}`,className:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2",children:/* @__PURE__ */n("div",{className:"flex-1",children:t&&l?f(r.children,t,String(null!=i?i:`footnote-${r.id}`),l):null})})}function Z(r){const{node:t}=r,l=`#fnref--${t.id}`;/* @__PURE__ */
24
- return n("sup",{id:`fnref-${t.id}`,className:"footnote-reference",children:/* @__PURE__ */e("span",{href:l,title:`查看脚注 ${t.id}`,className:"footnote-link cursor-pointer",children:["[",t.id,"]"]})})}function ee(e){const{node:r}=e;/* @__PURE__ */
25
- return n("a",{className:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${r.id}`,title:`返回引用 ${r.id}`,children:"↩︎"})}function ne(r){var t;const{node:l,ctx:i,renderNode:o,indexKey:a,isDark:d}=r,c=String(l.kind||"note"),s=l.title&&String(l.title).trim().length?String(l.title):c.charAt(0).toUpperCase()+c.slice(1),u=`admonition-${String(null!=a?a:c)}`,m=!l.collapsible||null==(t=l.open)||t,h={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};/* @__PURE__ */
26
- return e("div",{className:`admonition admonition-${c}${d?" is-dark":""}`,"data-index-key":a,children:[
27
- /* @__PURE__ */e("div",{id:u,className:"admonition-header",children:[h[c]&&/* @__PURE__ */n("span",{className:"admonition-icon",children:h[c]}),
28
- /* @__PURE__ */n("span",{className:"admonition-title",children:s}),l.collapsible&&/* @__PURE__ */n("span",{className:"admonition-toggle","aria-expanded":m,"aria-controls":`${u}-content`,children:/* @__PURE__ */n("span",{children:m?"▼":"▶"})})]}),m&&/* @__PURE__ */n("div",{id:`${u}-content`,className:"admonition-content","aria-labelledby":u,children:i&&o?f(l.children,i,String(null!=a?a:u),o):null})]})}function re(e){const{node:r}=e;/* @__PURE__ */
29
- return n("span",{className:"checkbox-node",children:/* @__PURE__ */n("input",{type:"checkbox",checked:Boolean(r.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}function te(e){var r;const{node:t}=e;/* @__PURE__ */
30
- return n("span",{className:"emoji-node",children:null!=(r=t.name)?r:t.markup})}function le(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
31
- return n("strong",{className:"strong-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"strong")}-strong`,i):null})}function ie(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
32
- return n("em",{className:"emphasis-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"emphasis")}-emphasis`,i):null})}function oe(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
33
- return n("del",{className:"strikethrough-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"strikethrough")}-strikethrough`,i):null})}function ae(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
34
- return n("mark",{className:"highlight-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"highlight")}-highlight`,i):null})}function de(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
35
- return n("ins",{className:"insert-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"insert")}-insert`,i):null})}function ce(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
36
- return n("sub",{className:"subscript-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"subscript")}-subscript`,i):null})}function se(e){const{node:r,children:t,ctx:l,renderNode:i,indexKey:o}=e;/* @__PURE__ */
37
- return n("sup",{className:"superscript-node",children:null!=t?t:l&&i?f(r.children,l,`${String(null!=o?o:"superscript")}-superscript`,i):null})}function ue(e){/* @__PURE__ */
38
- return n("br",{})}function me(e){/* @__PURE__ */
39
- return n("hr",{className:"thematic-break-node"})}function he(e){const{node:r,children:t}=e;/* @__PURE__ */
40
- return n("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:null!=t?t:r.code})}function pe(r){var t,l,i,o,a,s,u,m,h;const{node:p,ctx:g,renderNode:y,indexKey:x}=r,k=void 0!==r.underlineBottom?"number"==typeof r.underlineBottom?`${r.underlineBottom}px`:String(r.underlineBottom):"-3px",v=null!=(t=r.animationOpacity)?t:.35,w=Math.max(.12,Math.min(.5*v,v)),b={"--link-color":null!=(l=r.color)?l:"#0366d6","--underline-height":`${null!=(i=r.underlineHeight)?i:2}px`,"--underline-bottom":k,"--underline-opacity":String(v),"--underline-rest-opacity":String(w),"--underline-duration":`${null!=(o=r.animationDuration)?o:1.6}s`,"--underline-timing":null!=(a=r.animationTiming)?a:"ease-in-out","--underline-iteration":"number"==typeof r.animationIteration?String(r.animationIteration):null!=(s=r.animationIteration)?s:"infinite"},N=d({href:String(null!=(u=p.href)?u:"")}).href,$="string"==typeof p.title&&p.title.trim().length>0?p.title:String(null!=N?N:""),S=c(N);return p.loading?/* @__PURE__ */n("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:b,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
41
- /* @__PURE__ */n("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */n(j,{node:{type:"text",content:String(null!=(m=p.text)?m:"")},ctx:g,indexKey:`${String(null!=x?x:"link")}-loading`,typewriter:r.typewriter})}),
42
- /* @__PURE__ */n("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */n("a",{className:"link-node",href:N||void 0,title:$,"aria-label":`Link: ${$}`,target:S?"_blank":void 0,rel:S?"noopener noreferrer":void 0,style:b,children:g&&y?f(p.children,g,String(null!=x?x:"link"),y):/* @__PURE__ */n(j,{node:{type:"text",content:String(null!=(h=p.text)?h:"")},ctx:g,indexKey:`${String(null!=x?x:"link")}-fallback`,typewriter:r.typewriter})})}function ge(e){var r,t,l,i,o;const d=e,c=a(d.node.src)||a(d.fallbackSrc);return c?/* @__PURE__ */n("img",{src:c,alt:String(null!=(t=null!=(r=d.node.alt)?r:d.node.title)?t:""),title:String(null!=(i=null!=(l=d.node.title)?l:d.node.alt)?i:""),className:"image-node__img is-loaded",loading:!1===d.lazy?"eager":"lazy",decoding:"async",tabIndex:0,"aria-label":null!=(o=d.node.alt)?o:"Preview image"}):null}function ye({node:e}){var r;const t=W(null==e?void 0:e.language),l=`Code block: ${t}`;/* @__PURE__ */
43
- return n("pre",{className:`language-${t}`,"aria-busy":!0===(null==e?void 0:e.loading),"aria-label":l,"data-language":t,tabIndex:0,children:/* @__PURE__ */n("code",{translate:"no",children:String(null!=(r=null==e?void 0:e.code)?r:"")})})}function fe(e){return L("code-block-node",e.node,{showHeader:e.showHeader,fallback:"code-block"})}function xe(e){return L("markdown-code-block-node",e.node,{showHeader:e.showHeader,fallback:"markdown-code-block"})}function ke(e){return L("mermaid-block-node",e.node,{showHeader:e.showHeader,fallback:"mermaid"})}function ve(e){return L("d2-block-node",e.node,{showHeader:e.showHeader,fallback:"d2"})}function we(e){return L("infographic-block-node",e.node,{showHeader:e.showHeader,fallback:"infographic"})}function be({node:e}){var r,t,l;const i=M(String(null!=(r=e.content)?r:""),!0,Boolean(e.loading));/* @__PURE__ */
44
- return n("div",i?{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */n("div",{dangerouslySetInnerHTML:{__html:i}})}:{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */n("div",{children:String(null!=(l=null!=(t=e.raw)?t:e.content)?l:"")})})}function Ne({node:e}){var r,t,l;const i="$$"===e.markup,o=M(String(null!=(r=e.content)?r:""),i,Boolean(e.loading));/* @__PURE__ */
45
- return n("span",o?{className:"math-inline-wrapper",children:/* @__PURE__ */n("span",{className:"math-inline",dangerouslySetInnerHTML:{__html:o}})}:{className:"math-inline-wrapper",children:/* @__PURE__ */n("span",{className:"math-inline",children:String(null!=(l=null!=(t=e.raw)?t:e.content)?l:"")})})}function $e(e){const{node:r}=e;/* @__PURE__ */
46
- return n("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,"data-reference-id":r.id,children:r.id})}function Se(e){var t,a,d,c,s,u,m,h,p,y,x,w,b,$;const B=String(null!=(a=null==(t=e.node)?void 0:t.tag)?a:"").trim().toLowerCase(),K=Array.isArray(null==(d=e.node)?void 0:d.children)?e.node.children:[];if(K.length>0&&B&&!i.has(B)&&!o(B,null!=(s=null==(c=e.ctx)?void 0:c.htmlPolicy)?s:"safe")&&e.ctx&&e.renderNode)return l.createElement(B,function(e,n="safe",r){const t={...S(N(g(null!=e?e:void 0,n,r))||{})},l="string"==typeof t.className?t.className.trim():"";return t.className=l?`html-block-node ${l}`:"html-block-node",t}(null!=(m=null==(u=e.node)?void 0:u.attrs)?m:null,null!=(p=null==(h=e.ctx)?void 0:h.htmlPolicy)?p:"safe",B),f(K,e.ctx,`${String(null!=(y=e.indexKey)?y:"html-block")}-structured`,e.renderNode));const _=k(e.customId),T=v(String(null!=(x=e.node.content)?x:""),_,null!=(b=null==(w=e.ctx)?void 0:w.htmlPolicy)?b:"safe");/* @__PURE__ */
47
- return n(r,null==T?{children:String(null!=($=e.node.content)?$:"")}:{children:T})}function Be(e){var t,l,i,o;const a=k(e.customId),d=v(String(null!=(t=e.node.content)?t:""),a,null!=(i=null==(l=e.ctx)?void 0:l.htmlPolicy)?i:"safe");/* @__PURE__ */
48
- return n(r,null==d?{children:String(null!=(o=e.node.content)?o:"")}:{children:d})}function Ke(e){const{node:r,ctx:t,renderNode:i,indexKey:o}=e,a=r.attrs?Array.isArray(r.attrs)?N(r.attrs):r.attrs:void 0;/* @__PURE__ */
49
- return n("div",{className:`vmr-container vmr-container-${r.name}`,...a,children:t&&i&&Array.isArray(r.children)?r.children.map((e,r)=>/* @__PURE__ */n(l.Fragment,{children:i(e,`${String(null!=o?o:"vmr-container")}-${r}`,t)},`${String(null!=o?o:"vmr-container")}-${r}`)):null})}function _e(e){return null}function Te(e){return null}function Ie(n){const{node:r}=n;/* @__PURE__ */
50
- return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==r?void 0:r.type)]})}function Pe(e,r,i){var o,a,d,c,s,u,m;const g=null!=(o=i.customComponents)?o:k(i.customId),y="code_block"===e.type?null:g[e.type];if(y)return l.createElement(y,{key:r,node:e,customId:i.customId,isDark:i.isDark,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter});if("html_block"===e.type||"html_inline"===e.type){const t=$(e,g,i.customHtmlTags),o=null!=(a=null==t?void 0:t.tag)?a:"",m=null!=(d=null==t?void 0:t.isWhitelisted)&&d,y=null!=(c=null==t?void 0:t.component)?c:null;if(m&&y){const n={...e,type:o,tag:o,content:h(e.content,o)};return l.createElement(y,{key:r,node:n,customId:i.customId,isDark:i.isDark,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter})}const f=String(null!=(u=null!=(s=e.content)?s:e.raw)?u:"");if(!m&&p(f,o))return"html_inline"===e.type?/* @__PURE__ */n(j,{node:{type:"text",content:f,raw:f},ctx:i,indexKey:r,typewriter:i.typewriter},r):/* @__PURE__ */n(z,{node:{type:"paragraph",children:[{type:"text",content:f,raw:f}],raw:f},ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r)}switch(e.type){case"text":/* @__PURE__ */
51
- return n(j,{node:e,ctx:i,indexKey:r,typewriter:i.typewriter},r);case"text_special":/* @__PURE__ */
52
- return n(j,{node:{type:"text",content:null!=(m=e.content)?m:"",center:e.center},ctx:i,indexKey:r,typewriter:i.typewriter},r);case"paragraph":/* @__PURE__ */
53
- return n(z,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"heading":/* @__PURE__ */
54
- return n(U,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"blockquote":/* @__PURE__ */
55
- return n(G,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"list":/* @__PURE__ */
56
- return n(X,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"list_item":/* @__PURE__ */
57
- return n(V,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"table":/* @__PURE__ */
58
- return n(Y,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"definition_list":/* @__PURE__ */
59
- return n(J,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"footnote":/* @__PURE__ */
60
- return n(Q,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"footnote_reference":/* @__PURE__ */
61
- return n(Z,{node:e},r);case"footnote_anchor":/* @__PURE__ */
62
- return n(ee,{node:e},r);case"admonition":/* @__PURE__ */
63
- return n(ne,{node:e,ctx:i,renderNode:Pe,indexKey:r,isDark:i.isDark,typewriter:i.typewriter},r);case"hardbreak":/* @__PURE__ */
64
- return n(ue,{node:e,typewriter:i.typewriter},r);case"link":/* @__PURE__ */
65
- return n(pe,{node:e,ctx:i,renderNode:Pe,indexKey:r,isDark:i.isDark,showTooltip:"boolean"==typeof i.showTooltips?i.showTooltips:void 0,typewriter:i.typewriter},r);case"image":/* @__PURE__ */
66
- return n(ge,{node:e},r);case"inline_code":/* @__PURE__ */
67
- return n(he,{node:e,ctx:i,indexKey:r,typewriter:i.typewriter},r);case"code_block":return function(e,r,l,i){var o,a,d,c,s;const u=String((null==e?void 0:e.language)||"").trim(),m=u?String(null!=(o=u.split(/\s+/)[0])?o:"").split(":")[0].toLowerCase():"",h=B(m),p=function(e,n){const r=n.trim().toLowerCase();if(!r)return null;for(const l of[r,B(r),t(r)]){const n=l&&e[l];if(n)return n}return null}(i,m);if("mermaid"===h){const t=function(e,n){var r,t;const l={...n.mermaidProps||{}};return null==_(l.estimatedPreviewHeightPx)&&(l.estimatedPreviewHeightPx=T(I(String(null!=(r=null==e?void 0:e.code)?r:"")),void 0,"none"===l.maxHeight?null:null!=(t=_(l.maxHeight))?t:void 0)),l}(e,l),o=p||i.mermaid;return o?O(o,e,r,l,t):/* @__PURE__ */n(ke,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...t},r)}if("infographic"===h){const t=function(e,n){var r,t;const l={...n.infographicProps||{}};return null==P(l.estimatedPreviewHeightPx)&&(l.estimatedPreviewHeightPx=H(A(String(null!=(r=null==e?void 0:e.code)?r:"")),void 0,"none"===l.maxHeight?null:null!=(t=P(l.maxHeight))?t:void 0)),l}(e,l),o=p||i.infographic;return o?O(o,e,r,l,t):/* @__PURE__ */n(we,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...t},r)}if("d2"===h||"d2lang"===h){const t=p||i.d2;return t?O(t,e,r,l,l.d2Props||{}):/* @__PURE__ */n(ve,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...l.d2Props||{}},r)}if(p)return q(p,e,r,l);const g=i.code_block;return g?q(g,e,r,l):l.renderCodeBlocksAsPre?/* @__PURE__ */n(ye,{node:e},r):/* @__PURE__ */n(fe,{node:e,loading:Boolean(e.loading),stream:l.codeBlockStream,monacoOptions:null==(a=l.codeBlockThemes)?void 0:a.monacoOptions,themes:null==(d=l.codeBlockThemes)?void 0:d.themes,minWidth:null==(c=l.codeBlockThemes)?void 0:c.minWidth,maxWidth:null==(s=l.codeBlockThemes)?void 0:s.maxWidth,isDark:l.isDark,...K(l.codeBlockProps,{omit:["langs"]})},r)}(e,r,i,g);case"strong":/* @__PURE__ */
68
- return n(le,{node:e,children:f(e.children,i,`${String(r)}-strong`,Pe)},r);case"emphasis":/* @__PURE__ */
69
- return n(ie,{node:e,children:f(e.children,i,`${String(r)}-em`,Pe)},r);case"strikethrough":/* @__PURE__ */
70
- return n(oe,{node:e,children:f(e.children,i,`${String(r)}-strike`,Pe)},r);case"highlight":/* @__PURE__ */
71
- return n(ae,{node:e,children:f(e.children,i,`${String(r)}-highlight`,Pe)},r);case"insert":/* @__PURE__ */
72
- return n(de,{node:e,children:f(e.children,i,`${String(r)}-insert`,Pe)},r);case"subscript":/* @__PURE__ */
73
- return n(ce,{node:e,children:f(e.children,i,`${String(r)}-sub`,Pe)},r);case"superscript":/* @__PURE__ */
74
- return n(se,{node:e,children:f(e.children,i,`${String(r)}-sup`,Pe)},r);case"checkbox":case"checkbox_input":/* @__PURE__ */
75
- return n(re,{node:e,typewriter:i.typewriter},r);case"emoji":/* @__PURE__ */
76
- return n(te,{node:e,typewriter:i.typewriter},r);case"thematic_break":/* @__PURE__ */
77
- return n(me,{node:e},r);case"math_inline":/* @__PURE__ */
78
- return n(Ne,{node:e},r);case"math_block":/* @__PURE__ */
79
- return n(be,{node:e},r);case"reference":/* @__PURE__ */
80
- return n($e,{node:e,ctx:i,typewriter:i.typewriter},r);case"html_block":/* @__PURE__ */
81
- return n(Se,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter,customId:i.customId},r);case"html_inline":/* @__PURE__ */
82
- return n(Be,{node:e,ctx:i,typewriter:i.typewriter,customId:i.customId},r);case"vmr_container":/* @__PURE__ */
83
- return n(Ke,{node:e,ctx:i,renderNode:Pe,indexKey:r,typewriter:i.typewriter},r);case"label_open":case"label_close":return null;default:/* @__PURE__ */
84
- return n(Ie,{node:e},r)}}function He(e){var r,t,l;const i=k(e.customId),o=null!=(r=e.parseOptions)?r:{},a=null!=(t=o.customHtmlTags)?t:[],d=s(e.customHtmlTags,Array.isArray(a)?a:[]),c=e.customId?`server-renderer-${e.customId}`:"server-renderer",h=d.length>0?u(c,{customHtmlTags:d}):u(c),p=e.customMarkdownIt?e.customMarkdownIt(h):h,g=null!=(l=e.final)?l:o.final,y=null==g&&0===d.length?o:{...o,...null!=g?{final:g}:{},...d.length>0?{customHtmlTags:d}:{}},f=Array.isArray(e.nodes)&&e.nodes.length?e.nodes.map(e=>({...e})):e.content?m(e.content,null!=p?p:E,y):[],x=null!=e.indexKey?String(e.indexKey):"markdown-renderer",v=function(e,n,r,t){var l;return{customId:e.customId,customComponents:n,customHtmlTags:t,htmlPolicy:null!=(l=e.htmlPolicy)?l:"safe",isDark:e.isDark,indexKey:r,typewriter:e.typewriter,showTooltips:e.showTooltips,renderCodeBlocksAsPre:e.renderCodeBlocksAsPre,codeBlockStream:e.codeBlockStream,codeBlockProps:{..."boolean"==typeof e.showTooltips?{showTooltips:e.showTooltips}:{},...e.codeBlockProps||{}},mermaidProps:{...e.mermaidProps||{}},d2Props:{...e.d2Props||{}},infographicProps:{...e.infographicProps||{}},codeBlockThemes:{themes:e.themes,langs:e.langs,darkTheme:e.codeBlockDarkTheme,lightTheme:e.codeBlockLightTheme,monacoOptions:e.codeBlockMonacoOptions,minWidth:e.codeBlockMinWidth,maxWidth:e.codeBlockMaxWidth},events:{onCopy:e.onCopy,onHandleArtifactClick:e.onHandleArtifactClick}}}(e,i,x,d);/* @__PURE__ */
85
- return n("div",{className:"markstream-react markdown-renderer"+(e.isDark?" dark":""),"data-custom-id":e.customId,children:f.map((e,r)=>/* @__PURE__ */n("div",{className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */n("div",{className:"node-content",children:Pe(e,`${x}-${r}`,v)})},`${x}-${r}`))})}export{ne as A,G as B,re as C,ve as D,te as E,Ie as F,Pe as G,ue as H,ge as I,pe as L,xe as M,He as N,z as P,$e as R,oe as S,Y as T,Ke as V,fe as a,J as b,ie as c,ee as d,Q as e,Z as f,U as g,ae as h,Se as i,Be as j,Te as k,we as l,he as m,de as n,V as o,X as p,be as q,Ne as r,ke as s,ye as t,le as u,ce as v,se as w,j as x,me as y,_e as z};