markdown-flow-ui 0.3.8 → 0.3.9

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.
Files changed (42) hide show
  1. package/dist/_virtual/index6.cjs +1 -1
  2. package/dist/_virtual/index6.es.js +3 -5
  3. package/dist/_virtual/index6.es.js.map +1 -1
  4. package/dist/_virtual/index7.cjs +1 -1
  5. package/dist/_virtual/index7.es.js +5 -3
  6. package/dist/_virtual/index7.es.js.map +1 -1
  7. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  8. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  9. package/dist/components/ContentRender/ContentRender.d.ts +0 -2
  10. package/dist/components/ContentRender/ContentRender.es.js +361 -365
  11. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  12. package/dist/components/ContentRender/IframeSandbox.cjs +4 -4
  13. package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
  14. package/dist/components/ContentRender/IframeSandbox.d.ts +0 -2
  15. package/dist/components/ContentRender/IframeSandbox.es.js +299 -296
  16. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  17. package/dist/components/ContentRender/SandboxApp.cjs +2 -2
  18. package/dist/components/ContentRender/SandboxApp.cjs.map +1 -1
  19. package/dist/components/ContentRender/SandboxApp.d.ts +4 -3
  20. package/dist/components/ContentRender/SandboxApp.es.js +110 -141
  21. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  22. package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
  23. package/dist/components/ContentRender/contentRenderI18n.d.ts +0 -2
  24. package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
  25. package/dist/components/ContentRender/locales/contentRender.json.cjs +1 -1
  26. package/dist/components/ContentRender/locales/contentRender.json.d.ts +0 -22
  27. package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -11
  28. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  29. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  30. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-6MUBBAK2.cjs +1 -1
  31. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-6MUBBAK2.es.js +1 -1
  32. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-HFQBQIA3.cjs +1 -1
  33. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-HFQBQIA3.es.js +1 -1
  34. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-MALGAFMO.cjs +1 -1
  35. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-MALGAFMO.es.js +1 -1
  36. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-23REXITY.cjs +1 -1
  37. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-23REXITY.es.js +1 -1
  38. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-5NDRBG5M.cjs +1 -1
  39. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-5NDRBG5M.es.js +1 -1
  40. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-OMPLPG4O.cjs +1 -1
  41. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-OMPLPG4O.es.js +1 -1
  42. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./_commonjsHelpers.cjs"),r=require("../node_modules/style-to-js/cjs/index.cjs");var t=r.__require();const o=e.getDefaultExportFromCjs(t);exports.default=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../node_modules/@braintree/sanitize-url/dist/index.cjs");var r=e.__require();exports.distExports=r;
2
2
  //# sourceMappingURL=index6.cjs.map
@@ -1,8 +1,6 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
2
- import { __require as o } from "../node_modules/style-to-js/cjs/index.es.js";
3
- var t = o();
4
- const a = /* @__PURE__ */ r(t);
1
+ import { __require as r } from "../node_modules/@braintree/sanitize-url/dist/index.es.js";
2
+ var i = r();
5
3
  export {
6
- a as default
4
+ i as d
7
5
  };
8
6
  //# sourceMappingURL=index6.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index6.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index6.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../node_modules/@braintree/sanitize-url/dist/index.cjs");var r=e.__require();exports.distExports=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./_commonjsHelpers.cjs"),r=require("../node_modules/style-to-js/cjs/index.cjs");var t=r.__require();const o=e.getDefaultExportFromCjs(t);exports.default=o;
2
2
  //# sourceMappingURL=index7.cjs.map
@@ -1,6 +1,8 @@
1
- import { __require as r } from "../node_modules/@braintree/sanitize-url/dist/index.es.js";
2
- var i = r();
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
2
+ import { __require as o } from "../node_modules/style-to-js/cjs/index.es.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
3
5
  export {
4
- i as d
6
+ a as default
5
7
  };
6
8
  //# sourceMappingURL=index7.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index7.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index7.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),We=require("../../_virtual/index.cjs"),r=require("react"),mt=require("./utils/sanitize-invalid-tag-name.cjs"),pt=require("./utils/strip-svg-text-line-breaks.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const Ue=require("./CodeBlock.cjs"),ft=require("./plugins/CustomVariable.cjs"),we=require("./plugins/MermaidChart.cjs"),Ge=require("./utils/custom-variable-props.cjs"),Fe=require("./utils/highlight-languages.cjs"),ke=require("./utils/mermaid-parse.cjs"),$e=require("./utils/inline-code-ranges.cjs"),Ke=require("./utils/markdown-plugins.cjs"),ye=require("./utils/normalize-inline-html.cjs"),Ce=require("./utils/escape-typed-metadata.cjs"),ht=require("./IframeSandbox.cjs"),_=require("./utils/typewriter-pacing.cjs"),He=require("./utils/split-content.cjs"),gt=require("../../lib/interaction-defaults.cjs"),_e=require("../../lib/locale.cjs"),be=require("./contentRenderI18n.cjs"),ee=require("./utils/video-markdown-run.cjs"),Qe=require("../../node_modules/unified/lib/index.cjs"),xt=require("../../node_modules/remark-rehype/lib/index.cjs"),vt=require("../../node_modules/rehype-raw/lib/index.cjs"),yt=require("../../node_modules/rehype-highlight/lib/index.cjs"),wt=require("../../node_modules/rehype-katex/lib/index.cjs"),Ye=require("../../node_modules/react-markdown/lib/index.cjs"),kt=2,Te=({svg:t,inline:o=!1})=>{const i=r.useRef(null),a=o?"span":"div";return r.useEffect(()=>{const l=i.current;if(!l)return;const p=l.shadowRoot??l.attachShadow({mode:"open"}),y="content-render-svg-style";let g=p.getElementById(y);g||(g=document.createElement("style"),g.id=y,g.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),De=require("../../_virtual/index.cjs"),r=require("react"),lt=require("./utils/sanitize-invalid-tag-name.cjs"),dt=require("./utils/strip-svg-text-line-breaks.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const Qe=require("./CodeBlock.cjs"),mt=require("./plugins/CustomVariable.cjs"),ye=require("./plugins/MermaidChart.cjs"),ze=require("./utils/custom-variable-props.cjs"),We=require("./utils/highlight-languages.cjs"),we=require("./utils/mermaid-parse.cjs"),Ge=require("./utils/inline-code-ranges.cjs"),Oe=require("./utils/markdown-plugins.cjs"),ve=require("./utils/normalize-inline-html.cjs"),ke=require("./utils/escape-typed-metadata.cjs"),pt=require("./IframeSandbox.cjs"),_=require("./utils/typewriter-pacing.cjs"),Fe=require("./utils/split-content.cjs"),ft=require("../../lib/interaction-defaults.cjs"),$e=require("../../lib/locale.cjs"),Re=require("./contentRenderI18n.cjs"),te=require("./utils/video-markdown-run.cjs"),He=require("../../node_modules/unified/lib/index.cjs"),ht=require("../../node_modules/remark-rehype/lib/index.cjs"),gt=require("../../node_modules/rehype-raw/lib/index.cjs"),xt=require("../../node_modules/rehype-highlight/lib/index.cjs"),vt=require("../../node_modules/rehype-katex/lib/index.cjs"),Ue=require("../../node_modules/react-markdown/lib/index.cjs"),yt=2,Ce=({svg:t,inline:o=!1})=>{const i=r.useRef(null),a=o?"span":"div";return r.useEffect(()=>{const l=i.current;if(!l)return;const p=l.shadowRoot??l.attachShadow({mode:"open"}),y="content-render-svg-style";let g=p.getElementById(y);g||(g=document.createElement("style"),g.id=y,g.textContent=`
2
2
  svg { height: auto; display: inline-block; }
3
3
  svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
4
4
  svg.content-render-svg-el--fixed { max-width: none; }
5
- `,p.appendChild(g)),Array.from(p.childNodes).filter(u=>u!==g).forEach(u=>p.removeChild(u));const Q=document.createElement("template"),h=pt.stripSvgTextLineBreaks(t);Q.innerHTML=h,p.append(Q.content.cloneNode(!0));let R=!1,M=!1;p.querySelectorAll("svg").forEach(u=>{const q=u.getAttribute("viewBox");if(!q)return;const I=q.trim().split(/[\s,]+/).map(w=>Number(w));if(I.length!==4||I.some(Number.isNaN))return;const[,,E,k]=I,O=u.getAttribute("width"),V=u.getAttribute("height"),U=w=>{if(!w)return!1;const L=w.trim().toLowerCase();return L==="auto"||L.endsWith("%")},te=w=>{if(!w)return null;const L=w.trim().toLowerCase();if(L==="auto"||L.endsWith("%"))return null;const F=Number.parseFloat(L);return Number.isNaN(F)?null:F},ce=U(O),ie=U(V),ne=!O||O==="0",re=!V||V==="0",ue=te(O),le=te(V);if(ce||ie||ne&&re||ue===E&&le===k){R=!0,u.classList.add("content-render-svg-el--responsive"),u.classList.remove("content-render-svg-el--fixed"),u.style.width="100%",u.style.height="auto",!u.style.aspectRatio&&k>0&&(u.style.aspectRatio=`${E} / ${k}`);return}M=!0,u.classList.add("content-render-svg-el--fixed"),u.classList.remove("content-render-svg-el--responsive"),ne&&E>0&&u.setAttribute("width",`${E}`),re&&k>0&&u.setAttribute("height",`${k}`)});const d=R&&!M;l.classList.toggle("content-render-svg--responsive",d),l.classList.toggle("content-render-svg--fixed",!d)},[t]),s.jsx(a,{className:"content-render-svg-scroll",children:s.jsx(a,{className:"content-render-svg",ref:l=>{i.current=l}})})},ae=r.createContext(null),Xe=t=>{const{receivedTree:o,...i}=t,a=r.useContext(ae),l=r.useContext(Ue.CodeBlockContext);if(!a)throw new Error("Markdown code renderer requires ContentRender context.");const{className:p,children:y,...g}=i;if(/language-(\w+)/.exec(p||"")?.[1]==="mermaid"){const h=y?.toString().replace(/\n$/,"")||"",R=ke.mermaidBlockIsComplete(a.current.renderContent,h),M=o?!R:R;return s.jsx(we.default,{chart:h,frozen:M,messages:a.current.mermaidMessages})}return s.jsx("code",{className:p,...g,dir:g.dir??(l?void 0:"ltr"),children:y})},Ze=[Ge.preserveCustomVariableProperties,vt.default,mt.sanitizeInvalidTagName,Ge.restoreCustomVariableProperties],Je=[[yt.default,{languages:Fe.highlightLanguages,subset:Fe.subsetLanguages}],wt.default],Ct=[...Ze,...Je],Re=({content:t,components:o,locale:i})=>{const a=be.getContentRenderLocaleTexts(i);return s.jsx("div",{className:"markdown-renderer",children:s.jsx(Ye.Markdown,{remarkPlugins:Ke.remarkPlugins,rehypePlugins:Ct,remarkRehypeOptions:{footnoteLabel:a.footnoteLabel,footnoteBackLabel:(l,p)=>{const y=String(l+1)+(p>1?`-${p}`:"");return a.footnoteBackLabel.replace("{reference}",y)}},components:o,children:t})})},Tt=function(){this.parser=()=>({type:"root",children:[]})},Rt=({plan:t,renderedSegments:o,components:i,locale:a})=>{const l=r.useMemo(()=>{const h=be.getContentRenderLocaleTexts(a),R=Qe.unified().use(Ke.remarkPlugins).use(xt.default,{allowDangerousHtml:!0,footnoteLabel:h.footnoteLabel,footnoteBackLabel:(u,q)=>h.footnoteBackLabel.replace("{reference}",String(u+1)+(q>1?`-${q}`:""))}).use(Ze),M=Qe.unified().use(Je),d=R.runSync(ee.cloneVideoMarkdownSourceTree(t),t.markdownSource);return ee.prepareVideoMarkdownRun(t,d,u=>M.runSync(u,t.fullSource))},[t,a]),p=r.useMemo(()=>ee.projectVideoMarkdownRun(l,o),[l,o]),y=r.useRef(i);y.current=i;const g=r.useRef(new Map),Z=r.useMemo(()=>{const h=new Set,R=d=>{d.type==="element"&&h.add(d.tagName),"children"in d&&d.children.forEach(R)};R(l.tree);const M={};for(const d of h){if(!g.current.has(d)){const u=({node:q,children:I,...E})=>{const k=ee.getVideoMarkdownNodeState(q);if(k?.svg)return k.svgSource?s.jsx(Te,{svg:k.svgSource,inline:!0}):null;if(k?.atomic)return k.active?s.jsx(s.Fragment,{children:I}):null;if(k?.active===!1&&d!=="a")return null;const V=y.current[d],U=k?.active===!1?{...E,href:void 0,tabIndex:-1}:E;return V?r.createElement(V,{...U,node:q,...V===Xe?{receivedTree:!0}:{}},I):r.createElement(d,U,I)};u.displayName=`StableMarkdown(${d})`,g.current.set(d,u)}M[d]=g.current.get(d)}return M},[l]),Q=r.useMemo(()=>[()=>()=>p],[p]);return s.jsx("div",{className:"markdown-renderer",children:s.jsx(Ye.Markdown,{remarkPlugins:[Tt],rehypePlugins:Q,components:Z,children:""})})},G=t=>t.type==="markdown"&&t.immediate===!0,bt=t=>{if(t.length<=1)return t;const o=[];return t.forEach(i=>{if(i.type==="sandbox"||G(i)){o.push(i);return}const a=o[o.length-1];if(a&&a.type!=="sandbox"&&!G(a)){o[o.length-1]={type:"markdown",value:`${a.value}${i.value}`};return}o.push({type:"markdown",value:i.value})}),o},St=(t,o,i)=>{if(t.length>=o.length)return t;const a=i.find(({start:y,end:g})=>y<t.length&&t.length<g);if(!a)return t;const l=/^`+/.exec(o.slice(a.start))?.[0];if(!l||t.length<a.start+l.length)return t;const p=a.end-l.length;return t.length>p?t+l.slice(t.length-p):t+(t.endsWith("`")?" ":"")+l},Oe=(t,o,i,a,l=0)=>{const p=St(t,o,i);return Ce.escapeTypedMarkdownMetadata(t,a,l)+p.slice(t.length)},Mt=(t,o)=>{const i=Math.max(1,o),a=Array.from(t);return{chunk:a.slice(0,i).join(""),rest:a.slice(i).join("")}},jt=(t,o)=>t===o?!0:!t||!o||t.length!==o.length?!1:t.every((i,a)=>i===o[a]),Bt=t=>{const o=r.useRef(t);return jt(o.current,t)||(o.current=t),o.current},Nt=({onPlaceholderAccepted:t,content:o,contentType:i,locale:a,lang:l,dir:p,customRenderBar:y,onSend:g,typingSpeed:Z=30,enableTypewriter:Q=!1,typewriterPacing:h="fixed",onTypeFinished:R,onTypewriterStateChange:M,userInput:d,interactionDefaultValueOptions:u,defaultButtonText:q,defaultInputText:I,defaultSelectedValues:E,readonly:k=!1,confirmButtonText:O,copyButtonText:V,copiedButtonText:U,sandboxLoadingText:te,sandboxStyleLoadingText:ce,sandboxScriptLoadingText:ie,disableSandboxLoadingOverlay:ne=!1,sandboxFullscreenButtonText:re,sandboxExitFullscreenButtonText:ue,sandboxMode:le="content",onClickCustomButtonAfterContent:de,beforeSend:me})=>{const w=be.getContentRenderLocaleTexts(a),L=r.useMemo(()=>({loading:w.mermaidLoadingText,emptyChart:w.mermaidEmptyChartText,error:w.mermaidErrorText}),[w]),F=p??_e.getMarkdownFlowDirection(a),J=l??_e.getMarkdownFlowLanguage(a),Se=O||w.confirmButtonText,Me=V||w.copyButtonText,je=U||w.copiedButtonText,et=re||w.sandboxFullscreenButtonText,tt=ue||w.sandboxExitFullscreenButtonText,f=!!Q&&(!i||i==="text"),b=r.useMemo(()=>He.normalizeWrappedSandboxContent(o),[o]),j=r.useMemo(()=>$e.getMarkdownSourceAnalysis(b),[b]),C=r.useMemo(()=>{const e=bt(He.splitContentSegments(b,!0,!0,j));return b!==o&&e.length&&(e[0].type==="sandbox"||G(e[0]))?[{type:"text",value:""},...e]:e},[o,b,j]),K=C.some(e=>e.type==="sandbox"||G(e)),x=K?C.filter(e=>e.type!=="sandbox"&&!G(e)).map(e=>e.value).join(""):b,Be=Math.max(0,Z),nt=h==="fixed"?x:void 0,[A,Ne]=r.useState(()=>f?"":x),oe=r.useRef(A),B=r.useRef(""),P=r.useRef({tokens:[],head:0,trailingGrapheme:""}),$=r.useRef(0),qe=r.useRef(f),Le=r.useRef(h),Ae=r.useRef(x),pe=r.useRef(o),fe=r.useRef(!1),[rt,ot]=r.useState(0);r.useEffect(()=>{const e=qe.current,n=Le.current,c=Ae.current,m=!!B.current,T=pe.current!==o,ve=T&&o.startsWith(pe.current);pe.current=o,qe.current=f,Le.current=h,Ae.current=x,(T||f!==e)&&(fe.current=!1);const Y=()=>{B.current="",P.current={tokens:[],head:0,trailingGrapheme:""},$.current=0},X=S=>{oe.current=S,Ne(S)};if(!f){Y(),X(x);return}e||(Y(),X(""));let N=e?oe.current:"";if(!x.startsWith(N)){if(Y(),!ve){X(x),h==="content-aware"&&(P.current={tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(x)});return}let S=0;for(;S<N.length&&S<x.length&&N[S]===x[S];)S+=1;N=N.slice(0,S),X(N)}let H=x.slice(N.length);if(!H){B.current="",$.current=0,P.current=h==="content-aware"?{tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(N)}:{tokens:[],head:0,trailingGrapheme:""};return}if(h==="content-aware"){const S=c.slice(N.length);if(e&&n==="content-aware"&&x.startsWith(c)&&B.current===S){const W=_.appendContentAwareTypewriterQueue(P.current,x.slice(c.length));P.current=W.queue,W.immediateChunk&&(H=H.slice(W.immediateChunk.length),X(`${N}${W.immediateChunk}`))}else{const W=_.appendContentAwareTypewriterQueue({tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(N)},H);P.current=W.queue,W.immediateChunk&&(H=H.slice(W.immediateChunk.length),X(`${N}${W.immediateChunk}`)),$.current=0}}else P.current={tokens:[],head:0,trailingGrapheme:""},$.current=0;B.current=H,!m&&H&&ot(S=>S+1)},[o,x,f,h]),r.useEffect(()=>{f&&(fe.current||B.current||A!==x||(fe.current=!0,R?.()))},[o,x,A,f,R]),r.useEffect(()=>{if(!f||!B.current)return;const e=window.setTimeout(()=>{if(!B.current)return;let n="";if(h==="content-aware"){const m=_.consumeContentAwareTypewriterQueue(P.current,$.current+_.CONTENT_AWARE_TYPEWRITER_TICK_BUDGET);n=m.chunk,P.current=m.queue,_.isContentAwareTypewriterQueueEmpty(m.queue)?$.current=0:$.current=m.remainingBudget}else n=Mt(B.current,kt).chunk;if(!n)return;B.current=B.current.slice(n.length),B.current||(P.current=h==="content-aware"?{tokens:[],head:0,trailingGrapheme:P.current.trailingGrapheme}:{tokens:[],head:0,trailingGrapheme:""},$.current=0);const c=`${oe.current}${n}`;oe.current=c,Ne(c)},Be);return()=>window.clearTimeout(e)},[A,nt,f,h,Be,rt]);const D=r.useMemo(()=>{let e=0;return C.map(n=>{if(!f)return n;if(n.type==="sandbox"||G(n))return A.length>=e?n:{...n,value:""};const c=A.slice(e,e+n.value.length);return e+=n.value.length,{...n,value:c}})},[C,A,f]),Pe=r.useMemo(()=>({isTypewriterEnabled:f,isTyping:f&&A!==x,isComplete:A===x,renderedLength:o.length-C.reduce((e,n,c)=>e+n.value.length-D[c].value.length,0),totalLength:o.length}),[o,x,A,f,C,D]);r.useEffect(()=>{M?.(Pe)},[M,Pe]);const he=r.useMemo(()=>{let e=0;return C.map(n=>{const c=e;return e+=n.value.length,c})},[C]),se=r.useMemo(()=>f?C.map(e=>e.type==="sandbox"||G(e)?[]:e.value===b?j.inline:$e.getInlineCodeRanges(e.value)):[],[f,C,b,j]),st=r.useMemo(()=>K?D.map((e,n)=>e.type==="sandbox"||G(e)?e.value:f?Oe(e.value,C[n].value,se[n]??[],j.metadata,he[n]):Ce.escapeTypedMarkdownMetadata(e.value,j.metadata,he[n])):[],[K,f,D,se,C,j.metadata,he]),at=r.useMemo(()=>{const e=[];C.forEach((n,c)=>{const m=e.at(-1);n.type!=="sandbox"&&m&&!m.sandbox?m.indices.push(c):e.push({indices:[c],sandbox:n.type==="sandbox"})});for(const n of e)if(!n.sandbox&&n.indices.some(c=>G(C[c]))){const c=n.indices.map(T=>C[T]),m=c.map(T=>T.value).join("");n.plan=ee.createVideoMarkdownRunPlan(c,m===b?j:void 0)}return e},[C,b,j]),z=K?D.map(e=>e.value).join(""):f?A:b,ct=r.useMemo(()=>y?ye.normalizeInlineHtml(z):"",[y,z]),Ee=r.useMemo(()=>K?"":ye.normalizeInlineHtml(f?Oe(z,b,se[0]??[],j.metadata):Ce.escapeTypedMarkdownMetadata(z,j.metadata)),[b,K,f,z,se,j.metadata]),ge=r.useMemo(()=>gt.getInteractionDefaultValues(z,d,u),[u,z,d]),Ve=(q?We.distExports.trimVariablePadding(q):void 0)||ge.buttonText,Ie=I?.trim()||ge.inputText,it=r.useMemo(()=>d?d.split(",").map(e=>We.distExports.trimVariablePadding(e)).filter(Boolean):void 0,[d]),ut=E?.length?E:ge.selectedValues||it,De=Bt(ut),v=r.useRef({onPlaceholderAccepted:t,direction:F,language:J,mermaidMessages:L,beforeSend:me,locale:a,onClickCustomButtonAfterContent:de,onSend:g,readonly:k,renderContent:z,resolvedConfirmButtonText:Se,resolvedCopiedButtonText:je,resolvedCopyButtonText:Me,resolvedDefaultButtonText:Ve,resolvedDefaultInputText:Ie,resolvedDefaultSelectedValues:De});v.current={onPlaceholderAccepted:t,direction:F,language:J,mermaidMessages:L,beforeSend:me,locale:a,onClickCustomButtonAfterContent:de,onSend:g,readonly:k,renderContent:z,resolvedConfirmButtonText:Se,resolvedCopiedButtonText:je,resolvedCopyButtonText:Me,resolvedDefaultButtonText:Ve,resolvedDefaultInputText:Ie,resolvedDefaultSelectedValues:De};const xe=r.useMemo(()=>({"custom-button-after-content":({children:e})=>s.jsx("button",{className:"content-render-custom-button-after-content",onClick:v.current.onClickCustomButtonAfterContent,children:s.jsx("span",{className:"content-render-custom-button-after-content-inner",children:e})}),"custom-variable":e=>s.jsx(ft.default,{...e,readonly:v.current.readonly,defaultButtonText:v.current.resolvedDefaultButtonText,defaultInputText:v.current.resolvedDefaultInputText,defaultSelectedValues:v.current.resolvedDefaultSelectedValues,onSend:v.current.onSend,onPlaceholderAccepted:v.current.onPlaceholderAccepted,beforeSend:v.current.beforeSend,locale:v.current.locale,dir:v.current.direction,lang:v.current.language,confirmButtonText:v.current.resolvedConfirmButtonText}),code:Xe,table:({...e})=>s.jsx("div",{className:"content-render-table-container",children:s.jsx("table",{className:"content-render-table",...e})}),th:({...e})=>s.jsx("th",{className:"content-render-th",...e}),td:({...e})=>s.jsx("td",{className:"content-render-td",...e}),tr:({...e})=>s.jsx("tr",{className:"content-render-tr",...e}),li:({node:e,...n})=>{const c=e?.properties?.className;return typeof c=="string"&&c.includes("task-list-item")||Array.isArray(c)&&c.includes("task-list-item")?s.jsx("li",{className:"content-render-task-list-item",...n}):s.jsx("li",{...n})},ol:({...e})=>s.jsx("ol",{className:"content-render-ol",...e}),ul:({...e})=>s.jsx("ul",{className:"content-render-ul",...e}),input:({...e})=>e.type==="checkbox"?s.jsx("input",{type:"checkbox",className:"content-render-checkbox",disabled:!0,...e}):s.jsx("input",{...e}),a:({children:e,...n})=>s.jsx("a",{target:"_blank",rel:"noopener noreferrer",...n,children:e}),pre:e=>s.jsx(Ue.default,{...e,copyButtonText:v.current.resolvedCopyButtonText,copiedButtonText:v.current.resolvedCopiedButtonText})}),[]),lt=r.useMemo(()=>ke.parseMarkdownSegments(Ee),[Ee]),dt=(e,n)=>{const c=ye.normalizeInlineHtml(e);return ke.parseMarkdownSegments(c).map((T,ve)=>{const Y=`${n}-${T.type}-${ve}`;return T.type==="text"?s.jsx(ae.Provider,{value:v,children:s.jsx(Re,{locale:a,components:xe,content:T.value})},Y):T.type==="mermaid"?s.jsx(we.default,{chart:T.value,frozen:!T.complete,messages:L},Y):T.type==="svg"?s.jsx(Te,{svg:T.value},Y):null})},ze=y?s.jsx("div",{className:"content-render-custom-bar",children:r.createElement(y,{content:o,displayContent:ct,onSend:g})}):null;return K?s.jsxs("div",{className:"content-render markdown-body",dir:F,lang:J,children:[at.map(e=>{const n=e.indices[0],c=D[n];return e.sandbox?c.type==="sandbox"&&c.value&&!c.pending?s.jsx(ht.default,{hideFullScreen:!0,type:"sandbox",content:c.value,className:"content-render-iframe",locale:a,dir:F,lang:J,loadingText:te,styleLoadingText:ce,scriptLoadingText:ie,disableLoadingOverlay:ne,fullScreenButtonText:et,exitFullScreenButtonText:tt,mode:le},`sandbox-${n}`):null:e.plan?s.jsx(ae.Provider,{value:v,children:s.jsx(Rt,{locale:a,components:xe,plan:e.plan,renderedSegments:e.indices.map(m=>D[m])})},`md-${n}`):e.indices.map(m=>s.jsx(r.Fragment,{children:D[m].type==="markdown"&&D[m].pending?null:dt(st[m],`md-${m}`)},`md-${m}`))}),ze]}):s.jsxs("div",{className:"content-render markdown-body",dir:F,lang:J,children:[lt.map((e,n)=>{if(e.type==="text")return s.jsx(ae.Provider,{value:v,children:s.jsx(Re,{locale:a,components:xe,content:e.value})},n);if(e.type==="mermaid")return s.jsx(we.default,{chart:e.value,frozen:!e.complete,messages:L},n);if(e.type==="svg")return s.jsx(Te,{svg:e.value},n)}),ze]})};exports.MarkdownRenderer=Re;exports.default=Nt;
5
+ `,p.appendChild(g)),Array.from(p.childNodes).filter(u=>u!==g).forEach(u=>p.removeChild(u));const Q=document.createElement("template"),h=dt.stripSvgTextLineBreaks(t);Q.innerHTML=h,p.append(Q.content.cloneNode(!0));let T=!1,M=!1;p.querySelectorAll("svg").forEach(u=>{const L=u.getAttribute("viewBox");if(!L)return;const D=L.trim().split(/[\s,]+/).map(R=>Number(R));if(D.length!==4||D.some(Number.isNaN))return;const[,,E,w]=D,O=u.getAttribute("width"),V=u.getAttribute("height"),U=R=>{if(!R)return!1;const j=R.trim().toLowerCase();return j==="auto"||j.endsWith("%")},ne=R=>{if(!R)return null;const j=R.trim().toLowerCase();if(j==="auto"||j.endsWith("%"))return null;const ee=Number.parseFloat(j);return Number.isNaN(ee)?null:ee},le=U(O),de=U(V),re=!O||O==="0",oe=!V||V==="0",se=ne(O),ae=ne(V);if(le||de||re&&oe||se===E&&ae===w){T=!0,u.classList.add("content-render-svg-el--responsive"),u.classList.remove("content-render-svg-el--fixed"),u.style.width="100%",u.style.height="auto",!u.style.aspectRatio&&w>0&&(u.style.aspectRatio=`${E} / ${w}`);return}M=!0,u.classList.add("content-render-svg-el--fixed"),u.classList.remove("content-render-svg-el--responsive"),re&&E>0&&u.setAttribute("width",`${E}`),oe&&w>0&&u.setAttribute("height",`${w}`)});const d=T&&!M;l.classList.toggle("content-render-svg--responsive",d),l.classList.toggle("content-render-svg--fixed",!d)},[t]),s.jsx(a,{className:"content-render-svg-scroll",children:s.jsx(a,{className:"content-render-svg",ref:l=>{i.current=l}})})},ue=r.createContext(null),Ke=t=>{const{receivedTree:o,...i}=t,a=r.useContext(ue),l=r.useContext(Qe.CodeBlockContext);if(!a)throw new Error("Markdown code renderer requires ContentRender context.");const{className:p,children:y,...g}=i;if(/language-(\w+)/.exec(p||"")?.[1]==="mermaid"){const h=y?.toString().replace(/\n$/,"")||"",T=we.mermaidBlockIsComplete(a.current.renderContent,h),M=o?!T:T;return s.jsx(ye.default,{chart:h,frozen:M,messages:a.current.mermaidMessages})}return s.jsx("code",{className:p,...g,dir:g.dir??(l?void 0:"ltr"),children:y})},Ye=[ze.preserveCustomVariableProperties,gt.default,lt.sanitizeInvalidTagName,ze.restoreCustomVariableProperties],Xe=[[xt.default,{languages:We.highlightLanguages,subset:We.subsetLanguages}],vt.default],wt=[...Ye,...Xe],Te=({content:t,components:o,locale:i})=>{const a=Re.getContentRenderLocaleTexts(i);return s.jsx("div",{className:"markdown-renderer",children:s.jsx(Ue.Markdown,{remarkPlugins:Oe.remarkPlugins,rehypePlugins:wt,remarkRehypeOptions:{footnoteLabel:a.footnoteLabel,footnoteBackLabel:(l,p)=>{const y=String(l+1)+(p>1?`-${p}`:"");return a.footnoteBackLabel.replace("{reference}",y)}},components:o,children:t})})},kt=function(){this.parser=()=>({type:"root",children:[]})},Ct=({plan:t,renderedSegments:o,components:i,locale:a})=>{const l=r.useMemo(()=>{const h=Re.getContentRenderLocaleTexts(a),T=He.unified().use(Oe.remarkPlugins).use(ht.default,{allowDangerousHtml:!0,footnoteLabel:h.footnoteLabel,footnoteBackLabel:(u,L)=>h.footnoteBackLabel.replace("{reference}",String(u+1)+(L>1?`-${L}`:""))}).use(Ye),M=He.unified().use(Xe),d=T.runSync(te.cloneVideoMarkdownSourceTree(t),t.markdownSource);return te.prepareVideoMarkdownRun(t,d,u=>M.runSync(u,t.fullSource))},[t,a]),p=r.useMemo(()=>te.projectVideoMarkdownRun(l,o),[l,o]),y=r.useRef(i);y.current=i;const g=r.useRef(new Map),Z=r.useMemo(()=>{const h=new Set,T=d=>{d.type==="element"&&h.add(d.tagName),"children"in d&&d.children.forEach(T)};T(l.tree);const M={};for(const d of h){if(!g.current.has(d)){const u=({node:L,children:D,...E})=>{const w=te.getVideoMarkdownNodeState(L);if(w?.svg)return w.svgSource?s.jsx(Ce,{svg:w.svgSource,inline:!0}):null;if(w?.atomic)return w.active?s.jsx(s.Fragment,{children:D}):null;if(w?.active===!1&&d!=="a")return null;const V=y.current[d],U=w?.active===!1?{...E,href:void 0,tabIndex:-1}:E;return V?r.createElement(V,{...U,node:L,...V===Ke?{receivedTree:!0}:{}},D):r.createElement(d,U,D)};u.displayName=`StableMarkdown(${d})`,g.current.set(d,u)}M[d]=g.current.get(d)}return M},[l]),Q=r.useMemo(()=>[()=>()=>p],[p]);return s.jsx("div",{className:"markdown-renderer",children:s.jsx(Ue.Markdown,{remarkPlugins:[kt],rehypePlugins:Q,components:Z,children:""})})},F=t=>t.type==="markdown"&&t.immediate===!0,Tt=t=>{if(t.length<=1)return t;const o=[];return t.forEach(i=>{if(i.type==="sandbox"||F(i)){o.push(i);return}const a=o[o.length-1];if(a&&a.type!=="sandbox"&&!F(a)){o[o.length-1]={type:"markdown",value:`${a.value}${i.value}`};return}o.push({type:"markdown",value:i.value})}),o},Rt=(t,o,i)=>{if(t.length>=o.length)return t;const a=i.find(({start:y,end:g})=>y<t.length&&t.length<g);if(!a)return t;const l=/^`+/.exec(o.slice(a.start))?.[0];if(!l||t.length<a.start+l.length)return t;const p=a.end-l.length;return t.length>p?t+l.slice(t.length-p):t+(t.endsWith("`")?" ":"")+l},_e=(t,o,i,a,l=0)=>{const p=Rt(t,o,i);return ke.escapeTypedMarkdownMetadata(t,a,l)+p.slice(t.length)},bt=(t,o)=>{const i=Math.max(1,o),a=Array.from(t);return{chunk:a.slice(0,i).join(""),rest:a.slice(i).join("")}},St=(t,o)=>t===o?!0:!t||!o||t.length!==o.length?!1:t.every((i,a)=>i===o[a]),Mt=t=>{const o=r.useRef(t);return St(o.current,t)||(o.current=t),o.current},jt=({onPlaceholderAccepted:t,content:o,contentType:i,locale:a,lang:l,dir:p,customRenderBar:y,onSend:g,typingSpeed:Z=30,enableTypewriter:Q=!1,typewriterPacing:h="fixed",onTypeFinished:T,onTypewriterStateChange:M,userInput:d,interactionDefaultValueOptions:u,defaultButtonText:L,defaultInputText:D,defaultSelectedValues:E,readonly:w=!1,confirmButtonText:O,copyButtonText:V,copiedButtonText:U,sandboxLoadingText:ne,disableSandboxLoadingOverlay:le=!1,sandboxFullscreenButtonText:de,sandboxExitFullscreenButtonText:re,sandboxMode:oe="content",onClickCustomButtonAfterContent:se,beforeSend:ae})=>{const I=Re.getContentRenderLocaleTexts(a),J=r.useMemo(()=>({loading:I.mermaidLoadingText,emptyChart:I.mermaidEmptyChartText,error:I.mermaidErrorText}),[I]),R=p??$e.getMarkdownFlowDirection(a),j=l??$e.getMarkdownFlowLanguage(a),ee=O||I.confirmButtonText,be=V||I.copyButtonText,Se=U||I.copiedButtonText,Ze=de||I.sandboxFullscreenButtonText,Je=re||I.sandboxExitFullscreenButtonText,f=!!Q&&(!i||i==="text"),b=r.useMemo(()=>Fe.normalizeWrappedSandboxContent(o),[o]),B=r.useMemo(()=>Ge.getMarkdownSourceAnalysis(b),[b]),k=r.useMemo(()=>{const e=Tt(Fe.splitContentSegments(b,!0,!0,B));return b!==o&&e.length&&(e[0].type==="sandbox"||F(e[0]))?[{type:"text",value:""},...e]:e},[o,b,B]),K=k.some(e=>e.type==="sandbox"||F(e)),x=K?k.filter(e=>e.type!=="sandbox"&&!F(e)).map(e=>e.value).join(""):b,Me=Math.max(0,Z),et=h==="fixed"?x:void 0,[A,je]=r.useState(()=>f?"":x),ce=r.useRef(A),N=r.useRef(""),P=r.useRef({tokens:[],head:0,trailingGrapheme:""}),$=r.useRef(0),Be=r.useRef(f),Ne=r.useRef(h),qe=r.useRef(x),me=r.useRef(o),pe=r.useRef(!1),[tt,nt]=r.useState(0);r.useEffect(()=>{const e=Be.current,n=Ne.current,c=qe.current,m=!!N.current,C=me.current!==o,xe=C&&o.startsWith(me.current);me.current=o,Be.current=f,Ne.current=h,qe.current=x,(C||f!==e)&&(pe.current=!1);const Y=()=>{N.current="",P.current={tokens:[],head:0,trailingGrapheme:""},$.current=0},X=S=>{ce.current=S,je(S)};if(!f){Y(),X(x);return}e||(Y(),X(""));let q=e?ce.current:"";if(!x.startsWith(q)){if(Y(),!xe){X(x),h==="content-aware"&&(P.current={tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(x)});return}let S=0;for(;S<q.length&&S<x.length&&q[S]===x[S];)S+=1;q=q.slice(0,S),X(q)}let H=x.slice(q.length);if(!H){N.current="",$.current=0,P.current=h==="content-aware"?{tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(q)}:{tokens:[],head:0,trailingGrapheme:""};return}if(h==="content-aware"){const S=c.slice(q.length);if(e&&n==="content-aware"&&x.startsWith(c)&&N.current===S){const G=_.appendContentAwareTypewriterQueue(P.current,x.slice(c.length));P.current=G.queue,G.immediateChunk&&(H=H.slice(G.immediateChunk.length),X(`${q}${G.immediateChunk}`))}else{const G=_.appendContentAwareTypewriterQueue({tokens:[],head:0,trailingGrapheme:_.getTrailingTypewriterGrapheme(q)},H);P.current=G.queue,G.immediateChunk&&(H=H.slice(G.immediateChunk.length),X(`${q}${G.immediateChunk}`)),$.current=0}}else P.current={tokens:[],head:0,trailingGrapheme:""},$.current=0;N.current=H,!m&&H&&nt(S=>S+1)},[o,x,f,h]),r.useEffect(()=>{f&&(pe.current||N.current||A!==x||(pe.current=!0,T?.()))},[o,x,A,f,T]),r.useEffect(()=>{if(!f||!N.current)return;const e=window.setTimeout(()=>{if(!N.current)return;let n="";if(h==="content-aware"){const m=_.consumeContentAwareTypewriterQueue(P.current,$.current+_.CONTENT_AWARE_TYPEWRITER_TICK_BUDGET);n=m.chunk,P.current=m.queue,_.isContentAwareTypewriterQueueEmpty(m.queue)?$.current=0:$.current=m.remainingBudget}else n=bt(N.current,yt).chunk;if(!n)return;N.current=N.current.slice(n.length),N.current||(P.current=h==="content-aware"?{tokens:[],head:0,trailingGrapheme:P.current.trailingGrapheme}:{tokens:[],head:0,trailingGrapheme:""},$.current=0);const c=`${ce.current}${n}`;ce.current=c,je(c)},Me);return()=>window.clearTimeout(e)},[A,et,f,h,Me,tt]);const z=r.useMemo(()=>{let e=0;return k.map(n=>{if(!f)return n;if(n.type==="sandbox"||F(n))return A.length>=e?n:{...n,value:""};const c=A.slice(e,e+n.value.length);return e+=n.value.length,{...n,value:c}})},[k,A,f]),Le=r.useMemo(()=>({isTypewriterEnabled:f,isTyping:f&&A!==x,isComplete:A===x,renderedLength:o.length-k.reduce((e,n,c)=>e+n.value.length-z[c].value.length,0),totalLength:o.length}),[o,x,A,f,k,z]);r.useEffect(()=>{M?.(Le)},[M,Le]);const fe=r.useMemo(()=>{let e=0;return k.map(n=>{const c=e;return e+=n.value.length,c})},[k]),ie=r.useMemo(()=>f?k.map(e=>e.type==="sandbox"||F(e)?[]:e.value===b?B.inline:Ge.getInlineCodeRanges(e.value)):[],[f,k,b,B]),rt=r.useMemo(()=>K?z.map((e,n)=>e.type==="sandbox"||F(e)?e.value:f?_e(e.value,k[n].value,ie[n]??[],B.metadata,fe[n]):ke.escapeTypedMarkdownMetadata(e.value,B.metadata,fe[n])):[],[K,f,z,ie,k,B.metadata,fe]),ot=r.useMemo(()=>{const e=[];k.forEach((n,c)=>{const m=e.at(-1);n.type!=="sandbox"&&m&&!m.sandbox?m.indices.push(c):e.push({indices:[c],sandbox:n.type==="sandbox"})});for(const n of e)if(!n.sandbox&&n.indices.some(c=>F(k[c]))){const c=n.indices.map(C=>k[C]),m=c.map(C=>C.value).join("");n.plan=te.createVideoMarkdownRunPlan(c,m===b?B:void 0)}return e},[k,b,B]),W=K?z.map(e=>e.value).join(""):f?A:b,st=r.useMemo(()=>y?ve.normalizeInlineHtml(W):"",[y,W]),Ae=r.useMemo(()=>K?"":ve.normalizeInlineHtml(f?_e(W,b,ie[0]??[],B.metadata):ke.escapeTypedMarkdownMetadata(W,B.metadata)),[b,K,f,W,ie,B.metadata]),he=r.useMemo(()=>ft.getInteractionDefaultValues(W,d,u),[u,W,d]),Pe=(L?De.distExports.trimVariablePadding(L):void 0)||he.buttonText,Ee=D?.trim()||he.inputText,at=r.useMemo(()=>d?d.split(",").map(e=>De.distExports.trimVariablePadding(e)).filter(Boolean):void 0,[d]),ct=E?.length?E:he.selectedValues||at,Ve=Mt(ct),v=r.useRef({onPlaceholderAccepted:t,direction:R,language:j,mermaidMessages:J,beforeSend:ae,locale:a,onClickCustomButtonAfterContent:se,onSend:g,readonly:w,renderContent:W,resolvedConfirmButtonText:ee,resolvedCopiedButtonText:Se,resolvedCopyButtonText:be,resolvedDefaultButtonText:Pe,resolvedDefaultInputText:Ee,resolvedDefaultSelectedValues:Ve});v.current={onPlaceholderAccepted:t,direction:R,language:j,mermaidMessages:J,beforeSend:ae,locale:a,onClickCustomButtonAfterContent:se,onSend:g,readonly:w,renderContent:W,resolvedConfirmButtonText:ee,resolvedCopiedButtonText:Se,resolvedCopyButtonText:be,resolvedDefaultButtonText:Pe,resolvedDefaultInputText:Ee,resolvedDefaultSelectedValues:Ve};const ge=r.useMemo(()=>({"custom-button-after-content":({children:e})=>s.jsx("button",{className:"content-render-custom-button-after-content",onClick:v.current.onClickCustomButtonAfterContent,children:s.jsx("span",{className:"content-render-custom-button-after-content-inner",children:e})}),"custom-variable":e=>s.jsx(mt.default,{...e,readonly:v.current.readonly,defaultButtonText:v.current.resolvedDefaultButtonText,defaultInputText:v.current.resolvedDefaultInputText,defaultSelectedValues:v.current.resolvedDefaultSelectedValues,onSend:v.current.onSend,onPlaceholderAccepted:v.current.onPlaceholderAccepted,beforeSend:v.current.beforeSend,locale:v.current.locale,dir:v.current.direction,lang:v.current.language,confirmButtonText:v.current.resolvedConfirmButtonText}),code:Ke,table:({...e})=>s.jsx("div",{className:"content-render-table-container",children:s.jsx("table",{className:"content-render-table",...e})}),th:({...e})=>s.jsx("th",{className:"content-render-th",...e}),td:({...e})=>s.jsx("td",{className:"content-render-td",...e}),tr:({...e})=>s.jsx("tr",{className:"content-render-tr",...e}),li:({node:e,...n})=>{const c=e?.properties?.className;return typeof c=="string"&&c.includes("task-list-item")||Array.isArray(c)&&c.includes("task-list-item")?s.jsx("li",{className:"content-render-task-list-item",...n}):s.jsx("li",{...n})},ol:({...e})=>s.jsx("ol",{className:"content-render-ol",...e}),ul:({...e})=>s.jsx("ul",{className:"content-render-ul",...e}),input:({...e})=>e.type==="checkbox"?s.jsx("input",{type:"checkbox",className:"content-render-checkbox",disabled:!0,...e}):s.jsx("input",{...e}),a:({children:e,...n})=>s.jsx("a",{target:"_blank",rel:"noopener noreferrer",...n,children:e}),pre:e=>s.jsx(Qe.default,{...e,copyButtonText:v.current.resolvedCopyButtonText,copiedButtonText:v.current.resolvedCopiedButtonText})}),[]),it=r.useMemo(()=>we.parseMarkdownSegments(Ae),[Ae]),ut=(e,n)=>{const c=ve.normalizeInlineHtml(e);return we.parseMarkdownSegments(c).map((C,xe)=>{const Y=`${n}-${C.type}-${xe}`;return C.type==="text"?s.jsx(ue.Provider,{value:v,children:s.jsx(Te,{locale:a,components:ge,content:C.value})},Y):C.type==="mermaid"?s.jsx(ye.default,{chart:C.value,frozen:!C.complete,messages:J},Y):C.type==="svg"?s.jsx(Ce,{svg:C.value},Y):null})},Ie=y?s.jsx("div",{className:"content-render-custom-bar",children:r.createElement(y,{content:o,displayContent:st,onSend:g})}):null;return K?s.jsxs("div",{className:"content-render markdown-body",dir:R,lang:j,children:[ot.map(e=>{const n=e.indices[0],c=z[n];return e.sandbox?c.type==="sandbox"&&c.value&&!c.pending?s.jsx(pt.default,{hideFullScreen:!0,type:"sandbox",content:c.value,className:"content-render-iframe",locale:a,dir:R,lang:j,loadingText:ne,disableLoadingOverlay:le,fullScreenButtonText:Ze,exitFullScreenButtonText:Je,mode:oe},`sandbox-${n}`):null:e.plan?s.jsx(ue.Provider,{value:v,children:s.jsx(Ct,{locale:a,components:ge,plan:e.plan,renderedSegments:e.indices.map(m=>z[m])})},`md-${n}`):e.indices.map(m=>s.jsx(r.Fragment,{children:z[m].type==="markdown"&&z[m].pending?null:ut(rt[m],`md-${m}`)},`md-${m}`))}),Ie]}):s.jsxs("div",{className:"content-render markdown-body",dir:R,lang:j,children:[it.map((e,n)=>{if(e.type==="text")return s.jsx(ue.Provider,{value:v,children:s.jsx(Te,{locale:a,components:ge,content:e.value})},n);if(e.type==="mermaid")return s.jsx(ye.default,{chart:e.value,frozen:!e.complete,messages:J},n);if(e.type==="svg")return s.jsx(Ce,{svg:e.value},n)}),Ie]})};exports.MarkdownRenderer=Te;exports.default=jt;
6
6
  //# sourceMappingURL=ContentRender.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n onPlaceholderAccepted?: () => void;\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n onPlaceholderAccepted,\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n onPlaceholderAccepted={\n componentRuntimeValuesRef.current.onPlaceholderAccepted\n }\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className: unknown = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","frozen","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","onPlaceholderAccepted","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":"wjDA4EMA,GAA8B,EA8E9BC,GAAgE,CAAC,CACrE,IAAAC,EACA,OAAAC,EAAS,EACX,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAA2B,IAAI,EACzCC,EAAUH,EAAS,OAAS,MAElCI,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAOJ,EAAQ,QACrB,GAAI,CAACI,EAAM,OACX,MAAMC,EAAaD,EAAK,YAAcA,EAAK,aAAa,CAAE,KAAM,OAAQ,EAClEE,EAAU,2BAChB,IAAIC,EAAUF,EAAW,eAAeC,CAAO,EAE1CC,IACHA,EAAU,SAAS,cAAc,OAAO,EACxCA,EAAQ,GAAKD,EAEbC,EAAQ,YAAc;AAAA;AAAA;AAAA;AAAA,QAKtBF,EAAW,YAAYE,CAAO,GAGV,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ACf,OACEjO,EAAAA,IAACiB,GAAAA,QAAA,CAEC,MAAOgN,EAAI,MACX,OAAQ,CAACA,EAAI,SACb,SAAU5F,CAAA,EAHLpC,CAAA,EAQX,GAAIgI,EAAI,OAAS,MACf,OAAOjO,EAAAA,IAACpC,GAAA,CAA6B,IAAKqQ,EAAI,OAAhBhI,CAAuB,CAEzD,CAAC,EAEAkI,EAAA,CAAA,CAAA,CAGP"}
1
+ {"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import { trimVariablePadding } from \"remark-flow\";\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport { unified, type PluggableList, type Plugin } from \"unified\";\nimport remarkRehype from \"remark-rehype\";\nimport type { Element, Root } from \"hast\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport {\n getInlineCodeRanges,\n getMarkdownSourceAnalysis,\n} from \"./utils/inline-code-ranges\";\nimport { remarkPlugins } from \"./utils/markdown-plugins\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport {\n escapeTypedMarkdownMetadata,\n type MarkdownMetadataRange,\n} from \"./utils/escape-typed-metadata\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n getTrailingTypewriterGrapheme,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n normalizeWrappedSandboxContent,\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport {\n createVideoMarkdownRunPlan,\n cloneVideoMarkdownSourceTree,\n projectVideoMarkdownRun,\n prepareVideoMarkdownRun,\n getVideoMarkdownNodeState,\n type VideoMarkdownRunPlan,\n} from \"./utils/video-markdown-run\";\n\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n /** Observes an accepted Tab completion without receiving authored text. */\n onPlaceholderAccepted?: () => void;\n typingSpeed?: number;\n /** Types prose only; following HTML renders progressively once preceding prose is displayed. */\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n /** Received source units already displayed, including unpaced HTML. */\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string; inline?: boolean }> = ({\n svg,\n inline = false,\n}) => {\n const hostRef = useRef<HTMLElement | null>(null);\n const Wrapper = inline ? \"span\" : \"div\";\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <Wrapper className=\"content-render-svg-scroll\">\n <Wrapper\n className=\"content-render-svg\"\n ref={(node) => {\n hostRef.current = node;\n }}\n />\n </Wrapper>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n onPlaceholderAccepted?: () => void;\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (\n props: React.ComponentProps<\"code\"> & { receivedTree?: boolean }\n) => {\n const { receivedTree, ...codeProps } = props;\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = codeProps as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const complete = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n // The received-tree path replaces standalone Mermaid segments, whose\n // unfinished charts freeze until the closing fence reaches the prose budget.\n const frozen = receivedTree ? !complete : complete;\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst sourceRehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n];\nconst formattingRehypePlugins: PluggableList = [\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\nconst rehypePlugins: PluggableList = [\n ...sourceRehypePlugins,\n ...formattingRehypePlugins,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\n// ReactMarkdown still owns URL handling and JSX conversion. Its parser is\n// bypassed because the received source was already parsed and transformed.\nconst usePreparedTree: Plugin = function () {\n this.parser = () => ({ type: \"root\", children: [] });\n};\n\nconst StableVideoMarkdownRenderer: React.FC<{\n plan: VideoMarkdownRunPlan;\n renderedSegments: readonly RenderSegment[];\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ plan, renderedSegments, components, locale }) => {\n const prepared = useMemo(() => {\n const texts = getContentRenderLocaleTexts(locale);\n const sourceProcessor = unified()\n .use(remarkPlugins)\n .use(remarkRehype, {\n allowDangerousHtml: true,\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) =>\n texts.footnoteBackLabel.replace(\n \"{reference}\",\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\")\n ),\n })\n .use(sourceRehypePlugins);\n const formattingProcessor = unified().use(formattingRehypePlugins);\n const tree = sourceProcessor.runSync(\n cloneVideoMarkdownSourceTree(plan),\n plan.markdownSource\n ) as Root;\n return prepareVideoMarkdownRun(\n plan,\n tree,\n (value) => formattingProcessor.runSync(value, plan.fullSource) as Root\n );\n }, [plan, locale]);\n const projected = useMemo(\n () => projectVideoMarkdownRun(prepared, renderedSegments),\n [prepared, renderedSegments]\n );\n const originalComponents = useRef(components);\n originalComponents.current = components;\n const wrappers = useRef(\n new Map<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n >()\n );\n const stableComponents = useMemo(() => {\n const tags = new Set<string>();\n const collect = (node: Root | Root[\"children\"][number]) => {\n if (node.type === \"element\") tags.add(node.tagName);\n if (\"children\" in node) node.children.forEach(collect);\n };\n collect(prepared.tree!);\n const result: Record<\n string,\n React.ComponentType<{\n node: Element;\n children?: React.ReactNode;\n }>\n > = {};\n for (const tag of tags) {\n if (!wrappers.current.has(tag)) {\n const Component = ({\n node,\n children,\n ...props\n }: {\n node: Element;\n children?: React.ReactNode;\n }) => {\n const state = getVideoMarkdownNodeState(node);\n if (state?.svg) {\n return state.svgSource ? (\n <SvgBlockInShadow svg={state.svgSource} inline />\n ) : null;\n }\n if (state?.atomic) {\n return state.active ? <>{children}</> : null;\n }\n if (state?.active === false && tag !== \"a\") return null;\n const current = originalComponents.current as Record<\n string,\n React.ElementType\n >;\n const Original = current[tag];\n const visibleProps =\n state?.active === false\n ? { ...props, href: undefined, tabIndex: -1 }\n : props;\n return Original\n ? React.createElement(\n Original,\n {\n ...visibleProps,\n node,\n ...(Original === MarkdownCode ? { receivedTree: true } : {}),\n },\n children\n )\n : React.createElement(tag, visibleProps, children);\n };\n Component.displayName = `StableMarkdown(${tag})`;\n wrappers.current.set(tag, Component);\n }\n result[tag] = wrappers.current.get(tag)!;\n }\n return result as CustomComponents;\n }, [prepared]);\n const preparedPlugins = useMemo<PluggableList>(\n () => [() => () => projected],\n [projected]\n );\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={[usePreparedTree]}\n rehypePlugins={preparedPlugins}\n components={stableComponents}\n >\n {\"\"}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst isImmediateSegment = (segment: RenderSegment) =>\n segment.type === \"markdown\" && segment.immediate === true;\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\" && !isImmediateSegment(last)) {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst closeTypedInlineCode = (\n visible: string,\n source: string,\n ranges: ReturnType<typeof getInlineCodeRanges>\n) => {\n if (visible.length >= source.length) return visible;\n const range = ranges.find(\n ({ start, end }) => start < visible.length && visible.length < end\n );\n if (!range) return visible;\n const delimiter = /^`+/.exec(source.slice(range.start))?.[0];\n if (!delimiter || visible.length < range.start + delimiter.length) {\n return visible;\n }\n const closingStart = range.end - delimiter.length;\n if (visible.length > closingStart) {\n return visible + delimiter.slice(visible.length - closingStart);\n }\n // Close only the render copy so a typed prefix cannot activate code as HTML.\n return visible + (visible.endsWith(\"`\") ? \" \" : \"\") + delimiter;\n};\n\nconst protectTypedMarkdownPrefix = (\n visible: string,\n source: string,\n inlineCodeRanges: ReturnType<typeof getInlineCodeRanges>,\n metadataRanges: readonly MarkdownMetadataRange[],\n sourceOffset = 0\n) => {\n // Both protections use raw coordinates. Append any synthetic code delimiter\n // after escaping so encoded '<' characters cannot shift the typing budget.\n const closed = closeTypedInlineCode(visible, source, inlineCodeRanges);\n return (\n escapeTypedMarkdownMetadata(visible, metadataRanges, sourceOffset) +\n closed.slice(visible.length)\n );\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n onPlaceholderAccepted,\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 30,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const sourceContent = useMemo(\n () => normalizeWrappedSandboxContent(content),\n [content]\n );\n const sourceAnalysis = useMemo(\n () => getMarkdownSourceAnalysis(sourceContent),\n [sourceContent]\n );\n // Parse the received source, never a typewriter-truncated HTML string.\n const sourceSegments = useMemo(() => {\n const segments = mergeNonSandboxSegments(\n splitContentSegments(sourceContent, true, true, sourceAnalysis)\n );\n if (\n sourceContent !== content &&\n segments.length &&\n (segments[0].type === \"sandbox\" || isImmediateSegment(segments[0]))\n ) {\n // The removed opening quote occupied a prose slot before the wrapper\n // completed. Retain its empty slot so the existing iframe keeps its key.\n return [{ type: \"text\" as const, value: \"\" }, ...segments];\n }\n return segments;\n }, [content, sourceContent, sourceAnalysis]);\n const hasRichSegments = sourceSegments.some(\n (segment) => segment.type === \"sandbox\" || isImmediateSegment(segment)\n );\n const typewriterContent = hasRichSegments\n ? sourceSegments\n .filter(\n (segment) =>\n segment.type !== \"sandbox\" && !isImmediateSegment(segment)\n )\n .map((segment) => segment.value)\n .join(\"\")\n : sourceContent;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? typewriterContent : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : typewriterContent\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(typewriterContent);\n const previousReceivedContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n const receivedContentChanged =\n previousReceivedContentRef.current !== content;\n const receivedContentAppended =\n receivedContentChanged &&\n content.startsWith(previousReceivedContentRef.current);\n previousReceivedContentRef.current = content;\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = typewriterContent;\n\n if (\n receivedContentChanged ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(typewriterContent);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n let visibleContent = !wasTypewriterEnabled ? \"\" : displayContentRef.current;\n\n if (!typewriterContent.startsWith(visibleContent)) {\n clearPendingContent();\n if (!receivedContentAppended) {\n updateDisplayContent(typewriterContent);\n if (typewriterPacing === \"content-aware\") {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(typewriterContent),\n };\n }\n return;\n }\n // A newly recognized HTML tag can replace a previously literal prefix.\n // Keep the shared prose visible and pace only the newly received prose.\n let sharedLength = 0;\n while (\n sharedLength < visibleContent.length &&\n sharedLength < typewriterContent.length &&\n visibleContent[sharedLength] === typewriterContent[sharedLength]\n ) {\n sharedLength += 1;\n }\n visibleContent = visibleContent.slice(0, sharedLength);\n updateDisplayContent(visibleContent);\n }\n\n let nextPendingContent = typewriterContent.slice(visibleContent.length);\n if (!nextPendingContent) {\n pendingContentRef.current = \"\";\n contentAwareBudgetRef.current = 0;\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n typewriterContent.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n const appended = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n typewriterContent.slice(previousSourceContent.length)\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n } else {\n const appended = appendContentAwareTypewriterQueue(\n {\n tokens: [],\n head: 0,\n trailingGrapheme: getTrailingTypewriterGrapheme(visibleContent),\n },\n nextPendingContent\n );\n contentAwareQueueRef.current = appended.queue;\n\n if (appended.immediateChunk) {\n nextPendingContent = nextPendingContent.slice(\n appended.immediateChunk.length\n );\n updateDisplayContent(`${visibleContent}${appended.immediateChunk}`);\n }\n\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = {\n tokens: [],\n head: 0,\n trailingGrapheme: \"\",\n };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending && nextPendingContent) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, typewriterContent, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== typewriterContent\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n onTypeFinished,\n ]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current =\n typewriterPacing === \"content-aware\"\n ? {\n tokens: [],\n head: 0,\n trailingGrapheme: contentAwareQueueRef.current.trailingGrapheme,\n }\n : { tokens: [], head: 0, trailingGrapheme: \"\" };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const mergedRenderSegments = useMemo(() => {\n let textOffset = 0;\n return sourceSegments.map((segment) => {\n if (!isTypewriterEnabled) return segment;\n if (segment.type === \"sandbox\" || isImmediateSegment(segment)) {\n // HTML skips the prose budget only after earlier prose has caught up.\n // Retain its source slot so later updates keep the same render key.\n return displayContent.length >= textOffset\n ? segment\n : { ...segment, value: \"\" };\n }\n const value = displayContent.slice(\n textOffset,\n textOffset + segment.value.length\n );\n textOffset += segment.value.length;\n // Keep empty prose slots so an existing sandbox never changes its key.\n return { ...segment, value };\n });\n }, [sourceSegments, displayContent, isTypewriterEnabled]);\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== typewriterContent,\n isComplete: displayContent === typewriterContent,\n renderedLength:\n content.length -\n sourceSegments.reduce(\n (remaining, segment, index) =>\n remaining +\n segment.value.length -\n mergedRenderSegments[index].value.length,\n 0\n ),\n totalLength: content.length,\n }),\n [\n content,\n typewriterContent,\n displayContent,\n isTypewriterEnabled,\n sourceSegments,\n mergedRenderSegments,\n ]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n const sourceSegmentOffsets = useMemo(() => {\n let offset = 0;\n return sourceSegments.map((segment) => {\n const start = offset;\n offset += segment.value.length;\n return start;\n });\n }, [sourceSegments]);\n const sourceInlineCodeRanges = useMemo(\n () =>\n isTypewriterEnabled\n ? sourceSegments.map((segment) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? []\n : segment.value === sourceContent\n ? sourceAnalysis.inline\n : getInlineCodeRanges(segment.value)\n )\n : [],\n [isTypewriterEnabled, sourceSegments, sourceContent, sourceAnalysis]\n );\n const safeRichMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? mergedRenderSegments.map((segment, index) =>\n segment.type === \"sandbox\" || isImmediateSegment(segment)\n ? segment.value\n : isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n segment.value,\n sourceSegments[index].value,\n sourceInlineCodeRanges[index] ?? [],\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n : escapeTypedMarkdownMetadata(\n segment.value,\n sourceAnalysis.metadata,\n sourceSegmentOffsets[index]\n )\n )\n : [],\n [\n hasRichSegments,\n isTypewriterEnabled,\n mergedRenderSegments,\n sourceInlineCodeRanges,\n sourceSegments,\n sourceAnalysis.metadata,\n sourceSegmentOffsets,\n ]\n );\n const richRenderRuns = useMemo(() => {\n const runs: Array<{\n indices: number[];\n sandbox: boolean;\n plan?: ReturnType<typeof createVideoMarkdownRunPlan>;\n }> = [];\n sourceSegments.forEach((segment, index) => {\n const previous = runs.at(-1);\n if (segment.type !== \"sandbox\" && previous && !previous.sandbox) {\n previous.indices.push(index);\n } else {\n runs.push({ indices: [index], sandbox: segment.type === \"sandbox\" });\n }\n });\n for (const run of runs) {\n if (\n !run.sandbox &&\n run.indices.some((index) => isImmediateSegment(sourceSegments[index]))\n ) {\n const segments = run.indices.map((index) => sourceSegments[index]);\n const fullSource = segments.map((segment) => segment.value).join(\"\");\n run.plan = createVideoMarkdownRunPlan(\n segments,\n fullSource === sourceContent ? sourceAnalysis : undefined\n );\n }\n }\n return runs;\n }, [sourceSegments, sourceContent, sourceAnalysis]);\n const renderContent = hasRichSegments\n ? mergedRenderSegments.map((segment) => segment.value).join(\"\")\n : isTypewriterEnabled\n ? displayContent\n : sourceContent;\n const normalizedContent = useMemo(\n () => (customRenderBar ? normalizeInlineHtml(renderContent) : \"\"),\n [customRenderBar, renderContent]\n );\n\n const safeMarkdownContent = useMemo(\n () =>\n hasRichSegments\n ? \"\"\n : normalizeInlineHtml(\n isTypewriterEnabled\n ? protectTypedMarkdownPrefix(\n renderContent,\n sourceContent,\n sourceInlineCodeRanges[0] ?? [],\n sourceAnalysis.metadata\n )\n : escapeTypedMarkdownMetadata(\n renderContent,\n sourceAnalysis.metadata\n )\n ),\n [\n sourceContent,\n hasRichSegments,\n isTypewriterEnabled,\n renderContent,\n sourceInlineCodeRanges,\n sourceAnalysis.metadata,\n ]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n (defaultButtonText ? trimVariablePadding(defaultButtonText) : undefined) ||\n interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => trimVariablePadding(value))\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n onPlaceholderAccepted,\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n onPlaceholderAccepted={\n componentRuntimeValuesRef.current.onPlaceholderAccepted\n }\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className: unknown = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(safeMarkdownContent),\n [safeMarkdownContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n const customBar = customRenderBar ? (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n ) : null;\n\n if (hasRichSegments) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {richRenderRuns.map((run) => {\n const idx = run.indices[0];\n const segment = mergedRenderSegments[idx];\n if (run.sandbox)\n return segment.type === \"sandbox\" &&\n segment.value &&\n !segment.pending ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={\n resolvedSandboxExitFullscreenButtonText\n }\n mode={sandboxMode}\n />\n ) : null;\n if (run.plan)\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={`md-${idx}`}\n value={componentRuntimeValuesRef}\n >\n <StableVideoMarkdownRenderer\n locale={locale}\n components={components}\n plan={run.plan}\n renderedSegments={run.indices.map(\n (index) => mergedRenderSegments[index]\n )}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n return run.indices.map((index) => (\n <React.Fragment key={`md-${index}`}>\n {mergedRenderSegments[index].type === \"markdown\" &&\n mergedRenderSegments[index].pending\n ? null\n : renderMarkdownSegments(\n safeRichMarkdownContent[index],\n `md-${index}`\n )}\n </React.Fragment>\n ));\n })}\n {customBar}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customBar}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","inline","hostRef","useRef","Wrapper","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","receivedTree","codeProps","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","complete","mermaidBlockIsComplete","frozen","MermaidChart","sourceRehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","formattingRehypePlugins","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","rehypePlugins","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","remarkPlugins","referenceIndex","rereferenceIndex","reference","usePreparedTree","StableVideoMarkdownRenderer","plan","renderedSegments","prepared","useMemo","sourceProcessor","unified","remarkRehype","formattingProcessor","tree","cloneVideoMarkdownSourceTree","prepareVideoMarkdownRun","projected","projectVideoMarkdownRun","originalComponents","wrappers","stableComponents","tags","collect","result","tag","Component","state","getVideoMarkdownNodeState","Fragment","Original","visibleProps","preparedPlugins","isImmediateSegment","segment","mergeNonSandboxSegments","segments","merged","last","closeTypedInlineCode","visible","source","ranges","range","start","end","delimiter","closingStart","protectTypedMarkdownPrefix","inlineCodeRanges","metadataRanges","sourceOffset","closed","escapeTypedMarkdownMetadata","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","onPlaceholderAccepted","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","sourceContent","normalizeWrappedSandboxContent","sourceAnalysis","getMarkdownSourceAnalysis","sourceSegments","splitContentSegments","hasRichSegments","typewriterContent","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","previousReceivedContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","receivedContentChanged","receivedContentAppended","clearPendingContent","updateDisplayContent","nextContent","visibleContent","getTrailingTypewriterGrapheme","sharedLength","nextPendingContent","previousPendingContent","appended","appendContentAwareTypewriterQueue","version","typewriterTimer","chunk","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","mergedRenderSegments","textOffset","typewriterState","remaining","sourceSegmentOffsets","offset","sourceInlineCodeRanges","getInlineCodeRanges","safeRichMarkdownContent","richRenderRuns","runs","previous","run","fullSource","createVideoMarkdownRunPlan","renderContent","normalizedContent","normalizeInlineHtml","safeMarkdownContent","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","trimVariablePadding","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","customBar","jsxs","idx","IframeSandbox"],"mappings":"wjDA4EMA,GAA8B,EA0E9BC,GAAgE,CAAC,CACrE,IAAAC,EACA,OAAAC,EAAS,EACX,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAA2B,IAAI,EACzCC,EAAUH,EAAS,OAAS,MAElCI,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAOJ,EAAQ,QACrB,GAAI,CAACI,EAAM,OACX,MAAMC,EAAaD,EAAK,YAAcA,EAAK,aAAa,CAAE,KAAM,OAAQ,EAClEE,EAAU,2BAChB,IAAIC,EAAUF,EAAW,eAAeC,CAAO,EAE1CC,IACHA,EAAU,SAAS,cAAc,OAAO,EACxCA,EAAQ,GAAKD,EAEbC,EAAQ,YAAc;AAAA;AAAA;AAAA;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,IAACiB,GAAAA,QAAA,CAEC,MAAO8M,EAAI,MACX,OAAQ,CAACA,EAAI,SACb,SAAU5F,CAAA,EAHLlC,CAAA,EAQX,GAAI8H,EAAI,OAAS,MACf,OAAO/N,EAAAA,IAACpC,GAAA,CAA6B,IAAKmQ,EAAI,OAAhB9H,CAAuB,CAEzD,CAAC,EAEAgI,EAAA,CAAA,CAAA,CAGP"}
@@ -47,8 +47,6 @@ export interface ContentRenderProps {
47
47
  copiedButtonText?: string;
48
48
  dynamicInteractionFormat?: string;
49
49
  sandboxLoadingText?: string;
50
- sandboxStyleLoadingText?: string;
51
- sandboxScriptLoadingText?: string;
52
50
  disableSandboxLoadingOverlay?: boolean;
53
51
  sandboxFullscreenButtonText?: string;
54
52
  sandboxExitFullscreenButtonText?: string;