markstream-react 0.0.49 → 0.0.50
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/Tooltip-D786qxIk.js +207 -0
- package/dist/codeBlockExtraProps-7n9FWJXk.js +3 -0
- package/dist/index-o_DISWz2.js +85 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/markstream-react.css +1 -1
- package/dist/next.d.ts +39 -12
- package/dist/next.js +1 -1
- package/dist/server.d.ts +39 -12
- package/dist/server.js +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/PreCodeNode.d.ts +1 -1
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.d.ts +2 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/renderers/codeBlockExtraProps.d.ts +4 -0
- package/dist/types/types/component-props.d.ts +20 -4
- package/dist/types/types.d.ts +19 -2
- package/dist/types/utils/devEnv.d.ts +1 -0
- package/package.json +9 -8
- package/dist/Tooltip-DOyIMYde.js +0 -204
- package/dist/customHtmlTag-BRT4eqd8.js +0 -3
- package/dist/index-DI8pPos8.js +0 -86
|
@@ -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 C(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 M(t){if(t===d)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete w.scopedComponents[t],v()}function b(){delete w.scopedComponents[d],v()}function j(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",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",d2lang:"d2",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"},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 F(t){return A.add(t),()=>{A.delete(t)}}function W(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 D={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 G(t){return t.startsWith("--")?t:t.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function P(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=G(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,{...P(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,{...P(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,{...P(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:j(m)}}function rt(t,n,e){var o;return"block"===(null==(o=st(t,n,e))?void 0:o.display)}export{Q as A,u as B,k as C,y as D,J as E,I as F,q as G,R as H,C as a,W as b,b as c,V as d,E as e,F as f,j as g,tt as h,g as i,m as j,Z as k,D as l,rt as m,$ as n,st as o,z as p,P as q,M as r,x as s,p as t,nt as u,ot as v,N as w,et as x,K as y,Y as z};
|
package/dist/index-DI8pPos8.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n,Fragment as r}from"react/jsx-runtime";import t from"react";import{NON_STRUCTURING_HTML_TAGS as l,isHtmlTagBlocked as i,sanitizeHtmlAttrs as o,mergeCustomHtmlTags as a,getMarkdown as d,parseMarkdownToStructure as c,stripCustomHtmlWrapper as s,shouldRenderUnknownHtmlTagAsText as u,sanitizeHtmlTokenAttrs as m}from"stream-markdown-parser";import{h,i as p,j as g,a as y,k as f,B as x,m as k,t as v,o as w,q as b,n as N,u as $,v as S,x as K,y as _,z as I,A as B}from"./customHtmlTag-BRT4eqd8.js";let D,T=!1;function H(e,n,r){const t=h(e);if(!t)return null;if(globalThis.__MARKSTREAM_REACT_DISABLE_SYNC_KATEX__)return null;const l=function(){if(D)return D;if(T)return null;T=!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 A=d();function P(e){var n;return String(null!=(n=String(null!=e?e:"").split(/\s+/g)[0])?n:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function C(r,t,l){var i,o;const a=P(t.language),d=String(null!=(o=null!=(i=t.code)?i:t.raw)?o:""),c=function(e){const n=N(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 M(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 E(e){var n;return"text"===(null==e?void 0:e.type)&&""===String(null!=(n=null==e?void 0:e.content)?n:"").trim()}function L(e,r,l,i){const o=e.filter(e=>!E(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=>!E(e)):[]}(e);return 1===r.length&&"image"===(null==(n=r[0])?void 0:n.type)}(e));if(!a||o.length<=1)return p(e,l,i,r);const d=[];for(let n=0;n<e.length;n++){const r=e[n];if(!E(r)){d.push(r);continue}const t=d.length>0,l=e.slice(n+1).some(e=>!E(e));t&&l&&d.push({...r,content:" ",raw:" "})}return d.map((e,o)=>{var d;return a&&E(e)?/* @__PURE__ */n(t.Fragment,{children:String(null!=(d=null==e?void 0:e.content)?d:"")},`${i}-${o}`):r(e,`${i}-${o}`,l)})}function W(e){var l,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!=(l=o.children)?l:[],m=null!=(i=a.customComponents)?i:y(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:L(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)=>{x.has(e.type)||k(e,m,a.customHtmlTags)?(g(),h.push(
|
|
7
|
-
/* @__PURE__ */n(t.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:L(u,d,a,String(null!=c?c:"paragraph"))})}function j(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:{},g=["heading-node","font-semibold",`heading-${a}`,s,u].filter(Boolean).join(" ");/* @__PURE__ */
|
|
8
|
-
return n(d,{dir:"auto",className:g,..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=o?o:t&&l?p(r.children,t,String(null!=i?i:`heading-${a}`),l):null})}function q(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?p(r.children,t,String(null!=i?i:"blockquote"),l):null})}function O(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?p(r.children,t,String(null!=o?o:"list-item"),l):null})}function R(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&&y(l.customId).list_item||O;/* @__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 z(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?g(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?g(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 F(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?g(r.term,l,`${String(null!=o?o:"definition")}-term-${t}`,i):null}),
|
|
22
|
-
/* @__PURE__ */n("dd",{className:"definition-desc ml-4",children:l&&i?g(r.definition,l,`${String(null!=o?o:"definition")}-desc-${t}`,i):null})]},`${String(null!=o?o:"definition")}-${t}`))})}function U(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?p(r.children,t,String(null!=i?i:`footnote-${r.id}`),l):null})})}function G(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 V(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 X(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?p(l.children,i,String(null!=a?a:u),o):null})]})}function Y(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 J(e){var r;const{node:t}=e;/* @__PURE__ */
|
|
30
|
-
return n("span",{className:"emoji-node",children:null!=(r=t.name)?r:t.markup})}function Q(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?p(r.children,l,`${String(null!=o?o:"strong")}-strong`,i):null})}function Z(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?p(r.children,l,`${String(null!=o?o:"emphasis")}-emphasis`,i):null})}function ee(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?p(r.children,l,`${String(null!=o?o:"strikethrough")}-strikethrough`,i):null})}function ne(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?p(r.children,l,`${String(null!=o?o:"highlight")}-highlight`,i):null})}function re(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?p(r.children,l,`${String(null!=o?o:"insert")}-insert`,i):null})}function te(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?p(r.children,l,`${String(null!=o?o:"subscript")}-subscript`,i):null})}function le(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?p(r.children,l,`${String(null!=o?o:"superscript")}-superscript`,i):null})}function ie(e){/* @__PURE__ */
|
|
38
|
-
return n("br",{})}function oe(e){/* @__PURE__ */
|
|
39
|
-
return n("hr",{className:"thematic-break-node"})}function ae(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 de(r){var t,l,i,a,d,c,s,u,m;const{node:h,ctx:g,renderNode:y,indexKey:f}=r,x=void 0!==r.underlineBottom?"number"==typeof r.underlineBottom?`${r.underlineBottom}px`:String(r.underlineBottom):"-3px",k=null!=(t=r.animationOpacity)?t:.35,v=Math.max(.12,Math.min(.5*k,k)),w={"--link-color":null!=(l=r.color)?l:"#0366d6","--underline-height":`${null!=(i=r.underlineHeight)?i:2}px`,"--underline-bottom":x,"--underline-opacity":String(k),"--underline-rest-opacity":String(v),"--underline-duration":`${null!=(a=r.animationDuration)?a:1.6}s`,"--underline-timing":null!=(d=r.animationTiming)?d:"ease-in-out","--underline-iteration":"number"==typeof r.animationIteration?String(r.animationIteration):null!=(c=r.animationIteration)?c:"infinite"},b=o({href:String(null!=(s=h.href)?s:"")}).href,N="string"==typeof h.title&&h.title.trim().length>0?h.title:String(null!=b?b:"");return h.loading?/* @__PURE__ */n("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:w,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
|
|
41
|
-
/* @__PURE__ */n("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */n(M,{node:{type:"text",content:String(null!=(u=h.text)?u:"")},ctx:g,indexKey:`${String(null!=f?f:"link")}-loading`,typewriter:r.typewriter})}),
|
|
42
|
-
/* @__PURE__ */n("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */n("a",{className:"link-node",href:b,title:N,"aria-label":`Link: ${N}`,target:"_blank",rel:"noopener noreferrer",style:w,children:g&&y?p(h.children,g,String(null!=f?f:"link"),y):/* @__PURE__ */n(M,{node:{type:"text",content:String(null!=(m=h.text)?m:"")},ctx:g,indexKey:`${String(null!=f?f:"link")}-fallback`,typewriter:r.typewriter})})}function ce(e){var r,t,l,i,o;const a=e;/* @__PURE__ */
|
|
43
|
-
return n("img",{src:a.node.src,alt:String(null!=(t=null!=(r=a.node.alt)?r:a.node.title)?t:""),title:String(null!=(i=null!=(l=a.node.title)?l:a.node.alt)?i:""),className:"image-node__img is-loaded",loading:!1===a.lazy?"eager":"lazy",decoding:"async",tabIndex:0,"aria-label":null!=(o=a.node.alt)?o:"Preview image"})}function se({node:e}){var r;const t=P(null==e?void 0:e.language),l=`Code block: ${t}`;/* @__PURE__ */
|
|
44
|
-
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 ue(e){return C("code-block-node",e.node,{showHeader:e.showHeader,fallback:"code-block"})}function me(e){return C("markdown-code-block-node",e.node,{showHeader:e.showHeader,fallback:"markdown-code-block"})}function he(e){return C("mermaid-block-node",e.node,{showHeader:e.showHeader,fallback:"mermaid"})}function pe(e){return C("d2-block-node",e.node,{showHeader:e.showHeader,fallback:"d2"})}function ge(e){return C("infographic-block-node",e.node,{showHeader:e.showHeader,fallback:"infographic"})}function ye({node:e}){var r,t,l;const i=H(String(null!=(r=e.content)?r:""),!0,Boolean(e.loading));/* @__PURE__ */
|
|
45
|
-
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 fe({node:e}){var r,t,l;const i="$$"===e.markup,o=H(String(null!=(r=e.content)?r:""),i,Boolean(e.loading));/* @__PURE__ */
|
|
46
|
-
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 xe(e){const{node:r}=e;/* @__PURE__ */
|
|
47
|
-
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 ke(e){var o,a,d,c,s,u,h,g,x,k,w,N,$,S;const K=String(null!=(a=null==(o=e.node)?void 0:o.tag)?a:"").trim().toLowerCase(),_=Array.isArray(null==(d=e.node)?void 0:d.children)?e.node.children:[];if(_.length>0&&K&&!l.has(K)&&!i(K,null!=(s=null==(c=e.ctx)?void 0:c.htmlPolicy)?s:"safe")&&e.ctx&&e.renderNode)return t.createElement(K,function(e,n="safe",r){const t={...b(v(m(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!=(h=null==(u=e.node)?void 0:u.attrs)?h:null,null!=(x=null==(g=e.ctx)?void 0:g.htmlPolicy)?x:"safe",K),p(_,e.ctx,`${String(null!=(k=e.indexKey)?k:"html-block")}-structured`,e.renderNode));const I=y(e.customId),B=f(String(null!=(w=e.node.content)?w:""),I,null!=($=null==(N=e.ctx)?void 0:N.htmlPolicy)?$:"safe");/* @__PURE__ */
|
|
48
|
-
return n(r,null==B?{children:String(null!=(S=e.node.content)?S:"")}:{children:B})}function ve(e){var t,l,i,o;const a=y(e.customId),d=f(String(null!=(t=e.node.content)?t:""),a,null!=(i=null==(l=e.ctx)?void 0:l.htmlPolicy)?i:"safe");/* @__PURE__ */
|
|
49
|
-
return n(r,null==d?{children:String(null!=(o=e.node.content)?o:"")}:{children:d})}function we(e){const{node:r,ctx:l,renderNode:i,indexKey:o}=e,a=r.attrs?Array.isArray(r.attrs)?v(r.attrs):r.attrs:void 0;/* @__PURE__ */
|
|
50
|
-
return n("div",{className:`vmr-container vmr-container-${r.name}`,...a,children:l&&i&&Array.isArray(r.children)?r.children.map((e,r)=>/* @__PURE__ */n(t.Fragment,{children:i(e,`${String(null!=o?o:"vmr-container")}-${r}`,l)},`${String(null!=o?o:"vmr-container")}-${r}`)):null})}function be(e){return null}function Ne(e){return null}function $e(n){const{node:r}=n;/* @__PURE__ */
|
|
51
|
-
return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==r?void 0:r.type)]})}function Se(e,r,l){var i,o,a,d,c,m,h;const g=null!=(i=l.customComponents)?i:y(l.customId),f="code_block"===e.type?null:g[e.type];if(f)return t.createElement(f,{key:r,node:e,customId:l.customId,isDark:l.isDark,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter});if("html_block"===e.type||"html_inline"===e.type){const i=w(e,g,l.customHtmlTags),h=null!=(o=null==i?void 0:i.tag)?o:"",p=null!=(a=null==i?void 0:i.isWhitelisted)&&a,y=null!=(d=null==i?void 0:i.component)?d:null;if(p&&y){const n={...e,type:h,tag:h,content:s(e.content,h)};return t.createElement(y,{key:r,node:n,customId:l.customId,isDark:l.isDark,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter})}const f=String(null!=(m=null!=(c=e.content)?c:e.raw)?m:"");if(!p&&u(f,h))return"html_inline"===e.type?/* @__PURE__ */n(M,{node:{type:"text",content:f,raw:f},ctx:l,indexKey:r,typewriter:l.typewriter},r):/* @__PURE__ */n(W,{node:{type:"paragraph",children:[{type:"text",content:f,raw:f}],raw:f},ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r)}switch(e.type){case"text":/* @__PURE__ */
|
|
52
|
-
return n(M,{node:e,ctx:l,indexKey:r,typewriter:l.typewriter},r);case"text_special":/* @__PURE__ */
|
|
53
|
-
return n(M,{node:{type:"text",content:null!=(h=e.content)?h:"",center:e.center},ctx:l,indexKey:r,typewriter:l.typewriter},r);case"paragraph":/* @__PURE__ */
|
|
54
|
-
return n(W,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"heading":/* @__PURE__ */
|
|
55
|
-
return n(j,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"blockquote":/* @__PURE__ */
|
|
56
|
-
return n(q,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"list":/* @__PURE__ */
|
|
57
|
-
return n(R,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"list_item":/* @__PURE__ */
|
|
58
|
-
return n(O,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"table":/* @__PURE__ */
|
|
59
|
-
return n(z,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"definition_list":/* @__PURE__ */
|
|
60
|
-
return n(F,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"footnote":/* @__PURE__ */
|
|
61
|
-
return n(U,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"footnote_reference":/* @__PURE__ */
|
|
62
|
-
return n(G,{node:e},r);case"footnote_anchor":/* @__PURE__ */
|
|
63
|
-
return n(V,{node:e},r);case"admonition":/* @__PURE__ */
|
|
64
|
-
return n(X,{node:e,ctx:l,renderNode:Se,indexKey:r,isDark:l.isDark,typewriter:l.typewriter},r);case"hardbreak":/* @__PURE__ */
|
|
65
|
-
return n(ie,{node:e,typewriter:l.typewriter},r);case"link":/* @__PURE__ */
|
|
66
|
-
return n(de,{node:e,ctx:l,renderNode:Se,indexKey:r,isDark:l.isDark,showTooltip:"boolean"==typeof l.showTooltips?l.showTooltips:void 0,typewriter:l.typewriter},r);case"image":/* @__PURE__ */
|
|
67
|
-
return n(ce,{node:e},r);case"inline_code":/* @__PURE__ */
|
|
68
|
-
return n(ae,{node:e,ctx:l,indexKey:r,typewriter:l.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=N(m),p=m?i[m]:null;if("mermaid"===h){const o=function(e,n){var r,t;const l={...n.mermaidProps||{}};return null==$(l.estimatedPreviewHeightPx)&&(l.estimatedPreviewHeightPx=S(K(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),a=p||i.mermaid;return a?t.createElement(a,{key:r,node:e,isDark:l.isDark,...o}):/* @__PURE__ */n(he,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...o},r)}if("infographic"===h){const o=function(e,n){var r,t;const l={...n.infographicProps||{}};return null==_(l.estimatedPreviewHeightPx)&&(l.estimatedPreviewHeightPx=I(B(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),a=p||i.infographic;return a?t.createElement(a,{key:r,node:e,isDark:l.isDark,...o}):/* @__PURE__ */n(ge,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...o},r)}if("d2"===h||"d2lang"===h){const o=p||i.d2;return o?t.createElement(o,{key:r,node:e,isDark:l.isDark,...l.d2Props||{}}):/* @__PURE__ */n(pe,{node:e,isDark:l.isDark,loading:Boolean(e.loading),...l.d2Props||{}},r)}if(p)return t.createElement(p,{key:r,node:e,customId:l.customId,isDark:l.isDark,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter});const g=i.code_block;return g?t.createElement(g,{key:r,node:e,customId:l.customId,isDark:l.isDark,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter}):l.renderCodeBlocksAsPre?/* @__PURE__ */n(se,{node:e},r):/* @__PURE__ */n(ue,{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,...l.codeBlockProps||{}},r)}(e,r,l,g);case"strong":/* @__PURE__ */
|
|
69
|
-
return n(Q,{node:e,children:p(e.children,l,`${String(r)}-strong`,Se)},r);case"emphasis":/* @__PURE__ */
|
|
70
|
-
return n(Z,{node:e,children:p(e.children,l,`${String(r)}-em`,Se)},r);case"strikethrough":/* @__PURE__ */
|
|
71
|
-
return n(ee,{node:e,children:p(e.children,l,`${String(r)}-strike`,Se)},r);case"highlight":/* @__PURE__ */
|
|
72
|
-
return n(ne,{node:e,children:p(e.children,l,`${String(r)}-highlight`,Se)},r);case"insert":/* @__PURE__ */
|
|
73
|
-
return n(re,{node:e,children:p(e.children,l,`${String(r)}-insert`,Se)},r);case"subscript":/* @__PURE__ */
|
|
74
|
-
return n(te,{node:e,children:p(e.children,l,`${String(r)}-sub`,Se)},r);case"superscript":/* @__PURE__ */
|
|
75
|
-
return n(le,{node:e,children:p(e.children,l,`${String(r)}-sup`,Se)},r);case"checkbox":case"checkbox_input":/* @__PURE__ */
|
|
76
|
-
return n(Y,{node:e,typewriter:l.typewriter},r);case"emoji":/* @__PURE__ */
|
|
77
|
-
return n(J,{node:e,typewriter:l.typewriter},r);case"thematic_break":/* @__PURE__ */
|
|
78
|
-
return n(oe,{node:e},r);case"math_inline":/* @__PURE__ */
|
|
79
|
-
return n(fe,{node:e},r);case"math_block":/* @__PURE__ */
|
|
80
|
-
return n(ye,{node:e},r);case"reference":/* @__PURE__ */
|
|
81
|
-
return n(xe,{node:e,ctx:l,typewriter:l.typewriter},r);case"html_block":/* @__PURE__ */
|
|
82
|
-
return n(ke,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter,customId:l.customId},r);case"html_inline":/* @__PURE__ */
|
|
83
|
-
return n(ve,{node:e,ctx:l,typewriter:l.typewriter,customId:l.customId},r);case"vmr_container":/* @__PURE__ */
|
|
84
|
-
return n(we,{node:e,ctx:l,renderNode:Se,indexKey:r,typewriter:l.typewriter},r);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
85
|
-
return n($e,{node:e},r)}}function Ke(e){var r,t,l;const i=y(e.customId),o=null!=(r=e.parseOptions)?r:{},s=null!=(t=o.customHtmlTags)?t:[],u=a(e.customHtmlTags,Array.isArray(s)?s:[]),m=e.customId?`server-renderer-${e.customId}`:"server-renderer",h=u.length>0?d(m,{customHtmlTags:u}):d(m),p=e.customMarkdownIt?e.customMarkdownIt(h):h,g=null!=(l=e.final)?l:o.final,f=null==g&&0===u.length?o:{...o,...null!=g?{final:g}:{},...u.length>0?{customHtmlTags:u}:{}},x=Array.isArray(e.nodes)&&e.nodes.length?e.nodes.map(e=>({...e})):e.content?c(e.content,null!=p?p:A,f):[],k=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,darkTheme:e.codeBlockDarkTheme,lightTheme:e.codeBlockLightTheme,monacoOptions:e.codeBlockMonacoOptions,minWidth:e.codeBlockMinWidth,maxWidth:e.codeBlockMaxWidth},events:{onCopy:e.onCopy,onHandleArtifactClick:e.onHandleArtifactClick}}}(e,i,k,u);/* @__PURE__ */
|
|
86
|
-
return n("div",{className:"markstream-react markdown-renderer"+(e.isDark?" dark":""),"data-custom-id":e.customId,children:x.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:Se(e,`${k}-${r}`,v)})},`${k}-${r}`))})}export{X as A,q as B,Y as C,pe as D,J as E,$e as F,Se as G,ie as H,ce as I,de as L,me as M,Ke as N,W as P,xe as R,ee as S,z as T,we as V,ue as a,F as b,Z as c,V as d,U as e,G as f,j as g,ne as h,ke as i,ve as j,Ne as k,ge as l,ae as m,re as n,O as o,R as p,ye as q,fe as r,he as s,se as t,Q as u,te as v,le as w,M as x,oe as y,be as z};
|