markstream-react 0.0.33 → 0.0.35
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-CgreNSxF.js +211 -0
- package/dist/index-DzmDCKan.js +89 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/{languageIcon-BiAQ6aSb.js → languageIcon-CEJktwcf.js} +1 -1
- package/dist/markstream-react.css +1 -1
- package/dist/next.d.ts +2 -0
- package/dist/next.js +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/SoftBreakNode/SoftBreakNode.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/server-renderer/index.d.ts +3 -0
- package/dist/types/types/component-props.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +2 -2
- package/dist/Tooltip-CjIRU2iQ.js +0 -209
- package/dist/index-BQw8Blc5.js +0 -87
package/dist/index-BQw8Blc5.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import r from"react";import{getMarkdown as o,parseMarkdownToStructure as i}from"stream-markdown-parser";import{f as l,h as a,g as c,B as s,t as d,n as u}from"./languageIcon-BiAQ6aSb.js";const h=/* @__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","onsearch"]),m=/* @__PURE__ */new Set(["script"]),p=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]),g=/* @__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"]),f=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function y(e){const n=function(e){let n="";for(const t of e){const e=t.charCodeAt(0);e<=31||127===e||/\s/u.test(t)||(n+=t)}return n}(e).toLowerCase();return!(!n.startsWith("javascript:")&&!n.startsWith("vbscript:"))||!!n.startsWith("data:")&&!(n.startsWith("data:image/")||n.startsWith("data:video/")||n.startsWith("data:audio/"))}function k(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function x(e){const n={...e};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 e=function(e){const n=e.trim();if(!n)return;const t={};for(const r of n.split(";")){const e=r.trim();if(!e)continue;const n=e.indexOf(":");if(-1===n)continue;const o=k(e.slice(0,n).trim()),i=e.slice(n+1).trim();o&&(t[o]=i)}return Object.keys(t).length?t:void 0}(n.style);e?n.style=e:delete n.style}return n}function b(e){const n={};for(const[t,r]of Object.entries(e)){const e=t.toLowerCase();h.has(e)||p.has(e)&&r&&y(r)||(n[t]=r)}return n}function w(e,n){const t=e.toLowerCase();return!g.has(t)&&(Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,e))}function N(e,n){var t;if(!e)return[];try{const o=function(e){var n,t,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const n=e.indexOf("--\x3e",i);if(-1!==n){i=n+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 n=e.slice(i,l);n.trim()&&o.push({type:"text",content:n})}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!=(t=null!=(n=o[2])?n:o[3])?t:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||f.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(e);let i=0;const l=[],a=[];for(const e of o){if("text"===e.type){if(l.length>0&&l[l.length-1].blocked)continue;(l.length>0?l[l.length-1].children:a).push(null!=(t=e.content)?t:"");continue}if("self_closing"===e.type){if(m.has(e.tagName.toLowerCase()))continue;const t=b(e.attrs||{}),o=t.key,c=null!=o&&""!==o?o:"ms-html-"+i++,s=w(e.tagName,n)?n[e.tagName]||n[e.tagName.toLowerCase()]:void 0,d=l.length>0?l[l.length-1].children:a;s?d.push(r.createElement(s,{...t,key:c})):d.push(r.createElement(e.tagName,{...x(t),key:c,suppressHydrationWarning:!0}));continue}if("tag_open"===e.type){l.push({tagName:e.tagName,children:[],attrs:e.attrs,blocked:m.has(e.tagName.toLowerCase())});continue}const o=l.pop();if(!o||o.blocked)continue;const c=b(o.attrs||{}),s=c.key,d=null!=s&&""!==s?s:"ms-html-"+i++,u=w(o.tagName,n)?n[o.tagName]||n[o.tagName.toLowerCase()]:void 0,h=u?r.createElement(u,{...c,key:d},...o.children):r.createElement(o.tagName,{...x(c),key:d,suppressHydrationWarning:!0},...o.children);l.length>0?l[l.length-1].children.push(h):a.push(h)}for(;l.length>0;){const e=l.pop();if(!e||e.blocked)continue;const t=b(e.attrs||{}),o=t.key,c=null!=o&&""!==o?o:"ms-html-"+i++,s=w(e.tagName,n)?n[e.tagName]||n[e.tagName.toLowerCase()]:void 0,d=s?r.createElement(s,{...t,key:c},...e.children):r.createElement(e.tagName,{...x(t),key:c,suppressHydrationWarning:!0},...e.children);a.push(d)}return a}catch{return null}}let v,S=!1;function $(e,n,t){if(!e)return null;if(globalThis.__MARKSTREAM_REACT_DISABLE_SYNC_KATEX__)return null;const r=function(){if(v)return v;if(S)return null;S=!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 v=n,v}catch{return null}}();if(!r)return null;try{return r.renderToString(e,{displayMode:n,throwOnError:t})}catch{return null}}const _=o();function K(e){const n=String(null!=e?e:"").trim();if(!n)return"";const t=n.match(/^[<\s/]*([A-Z][\w-]*)/i);return t?t[1].toLowerCase():""}function B(e){return/^[a-z][a-z0-9-]*$/.test(e)}function C(e,n){const t=String(null!=e?e:"");if(!n)return t;const r=new RegExp(String.raw`^\s*<\s*${n}(?:\s[^>]*)?>\s*`,"i"),o=new RegExp(String.raw`\s*<\s*\/\s*${n}\s*>\s*$`,"i");return t.replace(r,"").replace(o,"")}function I(e){var n;return String(null!=(n=String(null!=e?e:"").split(/\s+/g)[0])?n:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}function D(t,r,o){var i,l;const a=I(r.language),c=String(null!=(l=null!=(i=r.code)?i:r.raw)?l:""),s=function(e){const n=u(String(null!=e?e:""));return n&&"plaintext"!==n?n.charAt(0).toUpperCase()+n.slice(1):"Text"}(r.language);/* @__PURE__ */
|
|
2
|
-
return e("div",{className:`${t} ${t}--ssr`,"data-ssr-fallback":o.fallback,children:[!1!==o.showHeader&&/* @__PURE__ */n("div",{className:`${t}__header`,children:/* @__PURE__ */n("span",{className:`${t}__language`,children:s})}),
|
|
3
|
-
/* @__PURE__ */n("div",{className:`${t}__body`,children:/* @__PURE__ */n("pre",{className:`language-${a}`,"aria-busy":!0===r.loading,"aria-label":`Code block: ${a}`,"data-language":a,tabIndex:0,children:/* @__PURE__ */n("code",{translate:"no",children:c})})})]})}function T(e){const{node:t,children:r}=e;/* @__PURE__ */
|
|
4
|
-
return n("span",{className:"text-node whitespace-pre-wrap break-words"+(t.center?" text-node-center":""),children:null!=r?r:t.content})}function A(e){var o;const{node:i,ctx:a,renderNode:c,indexKey:d,children:u}=e;if(!a||!c)/* @__PURE__ */
|
|
5
|
-
return n("p",{dir:"auto",className:"paragraph-node",children:u});const h=null!=(o=i.children)?o:[],m=[],p=[],g=()=>{if(!p.length)return;const e=m.length;m.push(
|
|
6
|
-
/* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:l(p.slice(),a,`${String(null!=d?d:"paragraph")}-${e}`,c)},`${String(null!=d?d:"paragraph")}-inline-${e}`)),p.length=0};return h.forEach((e,t)=>{s.has(e.type)?(g(),m.push(
|
|
7
|
-
/* @__PURE__ */n(r.Fragment,{children:c(e,`${String(null!=d?d:"paragraph")}-block-${t}`,a)},`${String(null!=d?d:"paragraph")}-block-${t}`))):p.push(e)}),g(),m.length?/* @__PURE__ */n(t,{children:m}):/* @__PURE__ */n("p",{dir:"auto",className:"paragraph-node",children:l(h,a,String(null!=d?d:"paragraph"),c)})}function H(e){const{node:t,ctx:r,renderNode:o,indexKey:i,children:a}=e,c=Math.min(6,Math.max(1,Number(t.level)||1)),s=`h${c}`,d=null==t?void 0:t.attrs,{class:u,className:h,style:m,...p}=null!=d?d:{},g=["heading-node","font-semibold",`heading-${c}`,u,h].filter(Boolean).join(" ");/* @__PURE__ */
|
|
8
|
-
return n(s,{dir:"auto",className:g,..."object"==typeof m&&null!=m?{style:m}:{},...p,children:null!=a?a:r&&o?l(t.children,r,String(null!=i?i:`heading-${c}`),o):null})}function O(e){const{node:t,ctx:r,renderNode:o,indexKey:i,children:a}=e;/* @__PURE__ */
|
|
9
|
-
return n("blockquote",{className:"blockquote-node",dir:"auto",cite:t.cite,children:null!=a?a:r&&o?l(t.children,r,String(null!=i?i:"blockquote"),o):null})}function P(e){const{node:t,ctx:r,renderNode:o,value:i,indexKey:a,children:c}=e;/* @__PURE__ */
|
|
10
|
-
return n("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:null==i?void 0:i,children:null!=c?c:r&&o?l(t.children,r,String(null!=a?a:"list-item"),o):null})}function W(e){var t;const{node:r,ctx:o,renderNode:i,indexKey:l}=e,a=r.ordered?"ol":"ul",s=r.ordered&&r.start?r.start:void 0,d=o&&c(o.customId).list_item||P;/* @__PURE__ */
|
|
11
|
-
return n(a,{className:r.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:s,children:null==(t=r.items)?void 0:t.map((e,t)=>{var a;/* @__PURE__ */
|
|
12
|
-
return n(d,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+t:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${t}`,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")}-${t}`)})})}function L(t){var r;const{node:o,ctx:i,renderNode:l,indexKey:c}=t,s=Array.isArray(null==(r=null==o?void 0:o.header)?void 0:r.cells)?o.header.cells:[],d=Boolean(null==o?void 0:o.loading),u=Array.isArray(null==o?void 0:o.rows)?o.rows:[],h=e=>"right"===e?"text-right":"center"===e?"text-center":"text-left";/* @__PURE__ */
|
|
13
|
-
return e("div",{className:"table-node-wrapper","data-index-key":c,children:[
|
|
14
|
-
/* @__PURE__ */e("table",{className:"my-8 text-sm table-node"+(d?" table-node--loading":""),"aria-busy":d,children:[
|
|
15
|
-
/* @__PURE__ */n("thead",{className:"border-[var(--table-border,#cbd5e1)]",children:/* @__PURE__ */n("tr",{className:"border-b",children:s.map((e,t)=>/* @__PURE__ */n("th",{className:`font-semibold p-[calc(4/7*1em)] ${h(e.align)}`,dir:"auto",children:i&&l?a(e.children,i,`${String(null!=c?c:"table")}-th-${t}`,l):null},`header-${t}`))})}),
|
|
16
|
-
/* @__PURE__ */n("tbody",{children:u.map((e,t)=>{var r;/* @__PURE__ */
|
|
17
|
-
return n("tr",{className:t<u.length-1?"border-[var(--table-border,#cbd5e1)] border-b":"border-[var(--table-border,#cbd5e1)]",children:null==(r=e.cells)?void 0:r.map((e,r)=>/* @__PURE__ */n("td",{className:`p-[calc(4/7*1em)] ${h(e.align)}`,dir:"auto",children:i&&l?a(e.children,i,`${String(null!=c?c:"table")}-row-${t}-${r}`,l):null},`cell-${t}-${r}`))},`row-${t}`)})})]}),d&&/* @__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 E(t){const{node:r,ctx:o,renderNode:i,indexKey:l}=t,c=Array.isArray(r.items)?r.items:[];/* @__PURE__ */
|
|
20
|
-
return n("dl",{className:"definition-list","data-index-key":l,children:c.map((t,r)=>/* @__PURE__ */e("div",{className:"mb-4",children:[
|
|
21
|
-
/* @__PURE__ */n("dt",{className:"definition-term font-semibold",children:o&&i?a(t.term,o,`${String(null!=l?l:"definition")}-term-${r}`,i):null}),
|
|
22
|
-
/* @__PURE__ */n("dd",{className:"definition-desc ml-4",children:o&&i?a(t.definition,o,`${String(null!=l?l:"definition")}-desc-${r}`,i):null})]},`${String(null!=l?l:"definition")}-${r}`))})}function M(e){const{node:t,ctx:r,renderNode:o,indexKey:i}=e;/* @__PURE__ */
|
|
23
|
-
return n("div",{id:`footnote-${t.id}`,className:"footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2",children:/* @__PURE__ */n("div",{className:"flex-1",children:r&&o?l(t.children,r,String(null!=i?i:`footnote-${t.id}`),o):null})})}function j(t){const{node:r}=t,o=`#footnote-${r.id}`;/* @__PURE__ */
|
|
24
|
-
return n("sup",{id:`fnref-${r.id}`,className:"footnote-reference",children:/* @__PURE__ */e("a",{href:o,title:`View footnote ${r.id}`,className:"footnote-link",children:["[",r.id,"]"]})})}function q(e){const{node:t}=e;/* @__PURE__ */
|
|
25
|
-
return n("a",{className:"footnote-anchor text-sm text-[#0366d6] hover:underline",href:`#fnref-${t.id}`,title:`Back to reference ${t.id}`,children:"↩︎"})}function R(t){var r;const{node:o,ctx:i,renderNode:a,indexKey:c,isDark:s}=t,d=String(o.kind||"note"),u=o.title&&String(o.title).trim().length?String(o.title):d.charAt(0).toUpperCase()+d.slice(1),h=`admonition-${String(null!=c?c:d)}`,m=!o.collapsible||null==(r=o.open)||r,p={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};/* @__PURE__ */
|
|
26
|
-
return e("div",{className:`admonition admonition-${d}${s?" is-dark":""}`,"data-index-key":c,children:[
|
|
27
|
-
/* @__PURE__ */e("div",{id:h,className:"admonition-header",children:[p[d]&&/* @__PURE__ */n("span",{className:"admonition-icon",children:p[d]}),
|
|
28
|
-
/* @__PURE__ */n("span",{className:"admonition-title",children:u}),o.collapsible&&/* @__PURE__ */n("span",{className:"admonition-toggle","aria-expanded":m,"aria-controls":`${h}-content`,children:/* @__PURE__ */n("span",{children:m?"▼":"▶"})})]}),m&&/* @__PURE__ */n("div",{id:`${h}-content`,className:"admonition-content","aria-labelledby":h,children:i&&a?l(o.children,i,String(null!=c?c:h),a):null})]})}function z(e){const{node:t}=e;/* @__PURE__ */
|
|
29
|
-
return n("span",{className:"checkbox-node",children:/* @__PURE__ */n("input",{type:"checkbox",checked:Boolean(t.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}function F(e){var t;const{node:r}=e;/* @__PURE__ */
|
|
30
|
-
return n("span",{className:"emoji-node",children:null!=(t=r.name)?t:r.markup})}function U(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
31
|
-
return n("strong",{className:"strong-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"strong")}-strong`,i):null})}function V(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
32
|
-
return n("em",{className:"emphasis-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"emphasis")}-emphasis`,i):null})}function Z(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
33
|
-
return n("del",{className:"strikethrough-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"strikethrough")}-strikethrough`,i):null})}function G(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
34
|
-
return n("mark",{className:"highlight-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"highlight")}-highlight`,i):null})}function X(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
35
|
-
return n("ins",{className:"insert-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"insert")}-insert`,i):null})}function Y(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
36
|
-
return n("sub",{className:"subscript-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"subscript")}-subscript`,i):null})}function J(e){const{node:t,children:r,ctx:o,renderNode:i,indexKey:a}=e;/* @__PURE__ */
|
|
37
|
-
return n("sup",{className:"superscript-node",children:null!=r?r:o&&i?l(t.children,o,`${String(null!=a?a:"superscript")}-superscript`,i):null})}function Q(e){/* @__PURE__ */
|
|
38
|
-
return n("br",{})}function ee(e){/* @__PURE__ */
|
|
39
|
-
return n("hr",{className:"thematic-break-node"})}function ne(e){const{node:t,children:r}=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!=r?r:t.code})}function te(t){var r,o,i,a,c,s,d,u,h;const{node:m,ctx:p,renderNode:g,indexKey:f}=t,y=void 0!==t.underlineBottom?"number"==typeof t.underlineBottom?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",k=null!=(r=t.animationOpacity)?r:.35,x=Math.max(.12,Math.min(.5*k,k)),b={"--link-color":null!=(o=t.color)?o:"#0366d6","--underline-height":`${null!=(i=t.underlineHeight)?i:2}px`,"--underline-bottom":y,"--underline-opacity":String(k),"--underline-rest-opacity":String(x),"--underline-duration":`${null!=(a=t.animationDuration)?a:1.6}s`,"--underline-timing":null!=(c=t.animationTiming)?c:"ease-in-out","--underline-iteration":"number"==typeof t.animationIteration?String(t.animationIteration):null!=(s=t.animationIteration)?s:"infinite"},w="string"==typeof m.title&&m.title.trim().length>0?m.title:String(null!=(d=m.href)?d:"");return m.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(T,{node:{type:"text",content:String(null!=(u=m.text)?u:"")},ctx:p,indexKey:`${String(null!=f?f:"link")}-loading`,typewriter:t.typewriter})}),
|
|
42
|
-
/* @__PURE__ */n("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */n("a",{className:"link-node",href:m.href,title:w,"aria-label":`Link: ${w}`,target:"_blank",rel:"noopener noreferrer",style:b,children:p&&g?l(m.children,p,String(null!=f?f:"link"),g):/* @__PURE__ */n(T,{node:{type:"text",content:String(null!=(h=m.text)?h:"")},ctx:p,indexKey:`${String(null!=f?f:"link")}-fallback`,typewriter:t.typewriter})})}function re(t){var r,o,i,l,a,c;const s={showCaption:!1,...t};/* @__PURE__ */
|
|
43
|
-
return e("figure",{className:"image-node",children:[
|
|
44
|
-
/* @__PURE__ */n("div",{className:"image-node__inner",children:/* @__PURE__ */n("img",{src:s.node.src,alt:String(null!=(o=null!=(r=s.node.alt)?r:s.node.title)?o:""),title:String(null!=(l=null!=(i=s.node.title)?i:s.node.alt)?l:""),className:"image-node__img is-loaded",style:/\.svg(?:\?|$)/i.test(String(s.node.src))?{minHeight:null!=(a=s.svgMinHeight)?a:"12rem",width:"100%",height:"auto",objectFit:"contain"}:void 0,loading:!1===s.lazy?"eager":"lazy",decoding:"async",tabIndex:0,"aria-label":null!=(c=s.node.alt)?c:"Preview image"})}),s.showCaption&&s.node.alt&&/* @__PURE__ */n("figcaption",{className:"image-node__caption",children:s.node.alt})]})}function oe({node:e}){var t;const r=I(null==e?void 0:e.language),o=`Code block: ${r}`;/* @__PURE__ */
|
|
45
|
-
return n("pre",{className:`language-${r}`,"aria-busy":!0===(null==e?void 0:e.loading),"aria-label":o,"data-language":r,tabIndex:0,children:/* @__PURE__ */n("code",{translate:"no",children:String(null!=(t=null==e?void 0:e.code)?t:"")})})}function ie(e){return D("code-block-node",e.node,{showHeader:e.showHeader,fallback:"code-block"})}function le(e){return D("markdown-code-block-node",e.node,{showHeader:e.showHeader,fallback:"markdown-code-block"})}function ae(e){return D("mermaid-block-node",e.node,{showHeader:e.showHeader,fallback:"mermaid"})}function ce(e){return D("d2-block-node",e.node,{showHeader:e.showHeader,fallback:"d2"})}function se(e){return D("infographic-block-node",e.node,{showHeader:e.showHeader,fallback:"infographic"})}function de({node:e}){var t,r,o;const i=$(String(null!=(t=e.content)?t:""),!0,Boolean(e.loading));/* @__PURE__ */
|
|
46
|
-
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!=(o=null!=(r=e.raw)?r:e.content)?o:"")})})}function ue({node:e}){var t,r,o;const i="$$"===e.markup,l=$(String(null!=(t=e.content)?t:""),i,Boolean(e.loading));/* @__PURE__ */
|
|
47
|
-
return n("span",l?{className:"math-inline-wrapper",children:/* @__PURE__ */n("span",{className:"math-inline",dangerouslySetInnerHTML:{__html:l}})}:{className:"math-inline-wrapper",children:/* @__PURE__ */n("span",{className:"math-inline",children:String(null!=(o=null!=(r=e.raw)?r:e.content)?o:"")})})}function he(e){const{node:t}=e;/* @__PURE__ */
|
|
48
|
-
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":t.id,children:t.id})}function me(e){var r,o;const i=c(e.customId),l=N(String(null!=(r=e.node.content)?r:""),i);/* @__PURE__ */
|
|
49
|
-
return n(t,null==l?{children:String(null!=(o=e.node.content)?o:"")}:{children:l})}function pe(e){var r,o;const i=c(e.customId),l=N(String(null!=(r=e.node.content)?r:""),i);/* @__PURE__ */
|
|
50
|
-
return n(t,null==l?{children:String(null!=(o=e.node.content)?o:"")}:{children:l})}function ge(e){const{node:t,ctx:o,renderNode:i,indexKey:l}=e,a=t.attrs?Array.isArray(t.attrs)?d(t.attrs):t.attrs:void 0;/* @__PURE__ */
|
|
51
|
-
return n("div",{className:`vmr-container vmr-container-${t.name}`,...a,children:o&&i&&Array.isArray(t.children)?t.children.map((e,t)=>/* @__PURE__ */n(r.Fragment,{children:i(e,`${String(null!=l?l:"vmr-container")}-${t}`,o)},`${String(null!=l?l:"vmr-container")}-${t}`)):null})}function fe(e){return null}function ye(e){return null}function ke(n){const{node:t}=n;/* @__PURE__ */
|
|
52
|
-
return e("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function xe(e,t,o){var i,a,s;const d=null!=(i=o.customComponents)?i:c(o.customId),h=d[e.type];if(h)return r.createElement(h,{key:t,node:e,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter});if("html_block"===e.type||"html_inline"===e.type){const n=String(null!=(a=e.tag)?a:"").trim().toLowerCase()||function(e){const n=String(null!=e?e:"").match(/^\s*<\s*([A-Z][\w:-]*)/i);return n?n[1].toLowerCase():""}(e.content),i=n?d[n]:null;if(i){const l={...e,type:n,tag:n,content:C(e.content,n)};return r.createElement(i,{key:t,node:l,customId:o.customId,isDark:o.isDark,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter})}}switch(e.type){case"text":/* @__PURE__ */
|
|
53
|
-
return n(T,{node:e,ctx:o,indexKey:t,typewriter:o.typewriter},t);case"text_special":/* @__PURE__ */
|
|
54
|
-
return n(T,{node:{type:"text",content:null!=(s=e.content)?s:"",center:e.center},ctx:o,indexKey:t,typewriter:o.typewriter},t);case"paragraph":/* @__PURE__ */
|
|
55
|
-
return n(A,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"heading":/* @__PURE__ */
|
|
56
|
-
return n(H,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"blockquote":/* @__PURE__ */
|
|
57
|
-
return n(O,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"list":/* @__PURE__ */
|
|
58
|
-
return n(W,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"list_item":/* @__PURE__ */
|
|
59
|
-
return n(P,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"table":/* @__PURE__ */
|
|
60
|
-
return n(L,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"definition_list":/* @__PURE__ */
|
|
61
|
-
return n(E,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"footnote":/* @__PURE__ */
|
|
62
|
-
return n(M,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"footnote_reference":/* @__PURE__ */
|
|
63
|
-
return n(j,{node:e},t);case"footnote_anchor":/* @__PURE__ */
|
|
64
|
-
return n(q,{node:e},t);case"admonition":/* @__PURE__ */
|
|
65
|
-
return n(R,{node:e,ctx:o,renderNode:xe,indexKey:t,isDark:o.isDark,typewriter:o.typewriter},t);case"hardbreak":/* @__PURE__ */
|
|
66
|
-
return n(Q,{node:e,typewriter:o.typewriter},t);case"link":/* @__PURE__ */
|
|
67
|
-
return n(te,{node:e,ctx:o,renderNode:xe,indexKey:t,isDark:o.isDark,showTooltip:"boolean"==typeof o.showTooltips?o.showTooltips:void 0,typewriter:o.typewriter},t);case"image":/* @__PURE__ */
|
|
68
|
-
return n(re,{node:e},t);case"inline_code":/* @__PURE__ */
|
|
69
|
-
return n(ne,{node:e,ctx:o,indexKey:t,typewriter:o.typewriter},t);case"code_block":return function(e,t,o,i){var l,a,c,s;const d=u(String(e.language||""));if("mermaid"===d){const l=i.mermaid;return l?r.createElement(l,{key:t,node:e,isDark:o.isDark,...o.mermaidProps||{}}):/* @__PURE__ */n(ae,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.mermaidProps||{}},t)}if("infographic"===d){const l=i.infographic;return l?r.createElement(l,{key:t,node:e,isDark:o.isDark,...o.infographicProps||{}}):/* @__PURE__ */n(se,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.infographicProps||{}},t)}if("d2"===d||"d2lang"===d){const l=i.d2;return l?r.createElement(l,{key:t,node:e,isDark:o.isDark,...o.d2Props||{}}):/* @__PURE__ */n(ce,{node:e,isDark:o.isDark,loading:Boolean(e.loading),...o.d2Props||{}},t)}return o.renderCodeBlocksAsPre?/* @__PURE__ */n(oe,{node:e},t):/* @__PURE__ */n(ie,{node:e,loading:Boolean(e.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,...o.codeBlockProps||{}},t)}(e,t,o,d);case"strong":/* @__PURE__ */
|
|
70
|
-
return n(U,{node:e,children:l(e.children,o,`${String(t)}-strong`,xe)},t);case"emphasis":/* @__PURE__ */
|
|
71
|
-
return n(V,{node:e,children:l(e.children,o,`${String(t)}-em`,xe)},t);case"strikethrough":/* @__PURE__ */
|
|
72
|
-
return n(Z,{node:e,children:l(e.children,o,`${String(t)}-strike`,xe)},t);case"highlight":/* @__PURE__ */
|
|
73
|
-
return n(G,{node:e,children:l(e.children,o,`${String(t)}-highlight`,xe)},t);case"insert":/* @__PURE__ */
|
|
74
|
-
return n(X,{node:e,children:l(e.children,o,`${String(t)}-insert`,xe)},t);case"subscript":/* @__PURE__ */
|
|
75
|
-
return n(Y,{node:e,children:l(e.children,o,`${String(t)}-sub`,xe)},t);case"superscript":/* @__PURE__ */
|
|
76
|
-
return n(J,{node:e,children:l(e.children,o,`${String(t)}-sup`,xe)},t);case"checkbox":case"checkbox_input":/* @__PURE__ */
|
|
77
|
-
return n(z,{node:e,typewriter:o.typewriter},t);case"emoji":/* @__PURE__ */
|
|
78
|
-
return n(F,{node:e,typewriter:o.typewriter},t);case"thematic_break":/* @__PURE__ */
|
|
79
|
-
return n(ee,{node:e},t);case"math_inline":/* @__PURE__ */
|
|
80
|
-
return n(ue,{node:e},t);case"math_block":/* @__PURE__ */
|
|
81
|
-
return n(de,{node:e},t);case"reference":/* @__PURE__ */
|
|
82
|
-
return n(he,{node:e,ctx:o,typewriter:o.typewriter},t);case"html_block":/* @__PURE__ */
|
|
83
|
-
return n(me,{node:e,typewriter:o.typewriter,customId:o.customId},t);case"html_inline":/* @__PURE__ */
|
|
84
|
-
return n(pe,{node:e,typewriter:o.typewriter,customId:o.customId},t);case"vmr_container":/* @__PURE__ */
|
|
85
|
-
return n(ge,{node:e,ctx:o,renderNode:xe,indexKey:t,typewriter:o.typewriter},t);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
86
|
-
return n(ke,{node:e},t)}}function be(e){var t,r,l,a;const s=c(e.customId),d=Object.keys(s).map(String).map(e=>e.trim().toLowerCase()).filter(B),u=null!=(t=e.parseOptions)?t:{},h=null!=(r=u.customHtmlTags)?r:[],m=Array.from(new Set([...null!=(l=e.customHtmlTags)?l:[],...Array.isArray(h)?h:[],...d].map(K).filter(Boolean))),p=e.customId?`server-renderer-${e.customId}`:"server-renderer",g=m.length>0?o(p,{customHtmlTags:m}):o(p),f=e.customMarkdownIt?e.customMarkdownIt(g):g,y=null!=(a=e.final)?a:u.final,k=null==y&&0===m.length?u:{...u,...null!=y?{final:y}:{},...m.length>0?{customHtmlTags:m}:{}},x=Array.isArray(e.nodes)&&e.nodes.length?e.nodes.map(e=>({...e})):e.content?i(e.content,null!=f?f:_,k):[],b=null!=e.indexKey?String(e.indexKey):"markdown-renderer",w=function(e,n,t){return{customId:e.customId,customComponents:n,isDark:e.isDark,indexKey:t,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,s,b);/* @__PURE__ */
|
|
87
|
-
return n("div",{className:"markstream-react markdown-renderer"+(e.isDark?" dark":""),"data-custom-id":e.customId,children:x.map((e,t)=>/* @__PURE__ */n("div",{className:"node-slot","data-node-index":t,"data-node-type":e.type,children:/* @__PURE__ */n("div",{className:"node-content",children:xe(e,`${b}-${t}`,w)})},`${b}-${t}`))})}export{R as A,O as B,z as C,ce as D,F as E,ke as F,xe as G,Q as H,re as I,te as L,le as M,be as N,A as P,he as R,Z as S,L as T,ge as V,ie as a,E as b,V as c,q as d,M as e,j as f,H as g,G as h,me as i,pe as j,ye as k,se as l,ne as m,X as n,P as o,W as p,de as q,ue as r,ae as s,oe as t,U as u,Y as v,J as w,T as x,ee as y,fe as z};
|