markstream-react 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Tooltip-plphJdTd.js → Tooltip-Bs7FyYvs.js} +33 -34
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/markstream-react.css +1 -1
- package/dist/next.js +1 -1
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,createContext as l,useContext as a,useRef as c,useEffect as s,useCallback as d,useLayoutEffect as u,useSyncExternalStore as m}from"react";import{sanitizeHtmlTokenAttrs as h,normalizeCustomHtmlTagName as f,convertHtmlAttrsToProps as p,tokenAttrsToRecord as g,NON_STRUCTURING_HTML_TAGS as v,isHtmlTagBlocked as y,sanitizeHtmlContent as w,BLOCKED_HTML_TAGS as x,isHtmlTagHardBlocked as k,sanitizeImageSrc as b,sanitizeHtmlAttrs as C,shouldOpenLinkInNewTab as N,toSafeSvgElement as M,getHtmlTagFromContent as B,stripCustomHtmlWrapper as S,shouldRenderUnknownHtmlTagAsText as T,mergeCustomHtmlTags as L,getMarkdown as E,parseMarkdownToStructure as D}from"stream-markdown-parser";import{D as $,u as P,d as A,L as R,E as F,z as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import r,{useMemo as o,useState as i,createContext as l,useContext as a,useRef as c,useEffect as s,useCallback as d,useLayoutEffect as u,useSyncExternalStore as m}from"react";import{sanitizeHtmlTokenAttrs as h,normalizeCustomHtmlTagName as f,convertHtmlAttrsToProps as p,tokenAttrsToRecord as g,NON_STRUCTURING_HTML_TAGS as v,isHtmlTagBlocked as y,sanitizeHtmlContent as w,BLOCKED_HTML_TAGS as x,isHtmlTagHardBlocked as k,sanitizeImageSrc as b,sanitizeHtmlAttrs as C,shouldOpenLinkInNewTab as N,toSafeSvgElement as M,getHtmlTagFromContent as B,stripCustomHtmlWrapper as S,shouldRenderUnknownHtmlTagAsText as T,mergeCustomHtmlTags as L,getMarkdown as E,parseMarkdownToStructure as D}from"stream-markdown-parser";import{D as $,u as P,d as A,L as R,E as F,z as _,G as I,m as H,q as W,P as O,C as j,K as z,k as K,l as V,M as q,s as X,n as U,v as Y,N as Z,o as G,j as J,H as Q,x as ee,c as te,g as ne,t as re,w as oe,a as ie,h as le,B as ae,p as ce,F as se,i as de,O as ue,r as me}from"./codeBlockExtraProps-C_3No_qp.js";import{createSmoothMarkdownStream as he,normalizeShikiLanguage as fe}from"markstream-core";import{autoUpdate as pe,computePosition as ge,offset as ve,flip as ye,shift as we}from"@floating-ui/dom";import{createPortal as xe}from"react-dom";const ke={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function be(n){const{node:r,ctx:l,renderNode:a,indexKey:c,isDark:s}=n,d=String(r.kind||"note"),u=o(()=>r.title&&String(r.title).trim().length?String(r.title):d.charAt(0).toUpperCase()+d.slice(1),[d,r.title]),[m,h]=i(()=>{var e;return!!r.collapsible&&!(null==(e=r.open)||e)}),f=o(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);/* @__PURE__ */
|
|
2
2
|
return e("div",{className:`admonition admonition-${d}${s?" is-dark":""}`,"data-index-key":c,children:[
|
|
3
3
|
/* @__PURE__ */e("div",{id:f,className:"admonition-header",children:[ke[d]&&/* @__PURE__ */t("span",{className:"admonition-icon",children:ke[d]}),
|
|
4
4
|
/* @__PURE__ */t("span",{className:"admonition-title",children:u}),r.collapsible&&/* @__PURE__ */t("button",{type:"button",className:"admonition-toggle","aria-expanded":!m,"aria-controls":`${f}-content`,title:m?"Expand":"Collapse",onClick:()=>h(e=>!e),children:/* @__PURE__ */t("span",{children:m?"▶":"▼"})})]}),!m&&/* @__PURE__ */t("div",{id:`${f}-content`,className:"admonition-content","aria-labelledby":f,children:l&&a?$(r.children,l,String(null!=c?c:f),a):null})]})}const Ce=l(!1),Ne=l(null);function Me(){return a(Ne)}const Be=l(null);function Se(e,t){var n,r;const o="undefined"!=typeof window&&"undefined"!=typeof document,i=o?null!=(n=window.requestIdleCallback)?n:e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16):null,l=o?null!=(r=window.cancelIdleCallback)?r:e=>window.clearTimeout(e):null;let a=null,c=null;const s=/* @__PURE__ */new Map,d=/* @__PURE__ */new Set;let u=null;const m=()=>{if(!s.size){try{null==a||a.disconnect()}catch{}a=null,c=null,d.size||(()=>{if(null!=u){try{null==l||l(u)}catch{}u=null}})()}},h=e=>{const t=s.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{null==a||a.unobserve(e)}catch{}s.delete(e),d.delete(e),m()}},f=()=>{i&&null==u&&d.size&&(u=i(()=>{u=null;const e=d.values().next().value;e&&(d.delete(e),h(e),d.size&&f())},{timeout:1200}))};return(n,r)=>{var i,l;const u={current:!1};let p,g=!1;const v=new Promise(e=>{p=()=>{g||(g=!0,e())}}),y=()=>{if(s.has(n)){s.delete(n);try{null==a||a.unobserve(n)}catch{}}d.delete(n),m()};if(!o||!t())return u.current=!0,p(),{isVisible:()=>!0,whenVisible:v,destroy:y};const w=((t,n)=>{if(!o)return null;if("undefined"==typeof IntersectionObserver)return null;const r=((t,n)=>{var r;return{root:null!=(r=e())?r:null,rootMargin:t,threshold:n}})(t,n);if(a&&(l=r,(i=c)&&i.root===l.root&&i.rootMargin===l.rootMargin&&i.threshold===l.threshold))return a;var i,l;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(e=>{for(const t of e)(t.isIntersecting||t.intersectionRatio>0)&&h(t.target)},{root:r.root,rootMargin:r.rootMargin,threshold:r.threshold}),c=r;for(const e of s.keys())a.observe(e);return a})(null!=(i=null==r?void 0:r.rootMargin)?i:"300px",null!=(l=null==r?void 0:r.threshold)?l:0);return w?(s.set(n,{resolve:p,state:u}),w.observe(n),d.add(n),f(),{isVisible:()=>u.current,whenVisible:v,destroy:y}):(u.current=!0,p(),{isVisible:()=>!0,whenVisible:v,destroy:y})}}const Te=Se(()=>null,()=>!0);function Le({getRoot:e,enabled:n=!0,children:r}){const i=c(n);i.current=n;const l=c(e);l.current=e;const a=o(()=>Se(()=>{var e,t;return null!=(t=null==(e=l.current)?void 0:e.call(l))?t:null},()=>i.current),[]);/* @__PURE__ */
|
|
5
5
|
return t(Be.Provider,{value:a,children:r})}function Ee(){var e;return null!=(e=a(Be))?e:Te}function De(e={}){const t=c(null);t.current||(t.current=he(e));const n=t.current,[r,l]=i(()=>n.getSnapshot());return s(()=>{const e=n.subscribe(()=>{l(n.getSnapshot())});return n.resume(),l(n.getSnapshot()),()=>{e(),n.pause()}},[n]),o(()=>({...r,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,r])}function $e(e){const{node:n}=e;/* @__PURE__ */
|
|
6
|
-
return t("span",{className:"checkbox-node",children:/* @__PURE__ */t("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const Pe={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.close":"Close","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function Ae(e){Object.assign(Pe,e)}function Re(){return{t:e=>{var t;return null!=(t=Pe[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let Fe=null,
|
|
6
|
+
return t("span",{className:"checkbox-node",children:/* @__PURE__ */t("input",{type:"checkbox",checked:Boolean(n.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const Pe={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.close":"Close","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function Ae(e){Object.assign(Pe,e)}function Re(){return{t:e=>{var t;return null!=(t=Pe[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let Fe=null,_e=null,Ie=null,He=null,We=null,Oe=null;function je(){He&&(clearTimeout(He),He=null),We&&(clearTimeout(We),We=null)}async function ze(e){if(!Fe||!_e)return;const{x:t,y:n}=await ge(_e,Fe,{placement:e,middleware:[ve(8),ye(),we({padding:8})],strategy:"fixed"});Fe.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function Ke(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(Fe||"undefined"==typeof document||(Fe=document.createElement("div"),Fe.className="markstream-react ms-tooltip",Fe.setAttribute("role","tooltip"),Fe.dataset.visible="false",Fe.style.position="fixed",Fe.style.left="0px",Fe.style.top="0px",Fe.style.transform="translate3d(0,0,0)",document.body.appendChild(Fe)),!Fe)return;je();const l=async()=>{if(Fe){_e=e,Fe.textContent=t,Fe.dataset.placement=n,Fe.dataset.dark=function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(i)?"true":"false",Fe.dataset.visible="false",Oe=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Fe.id=Oe;try{e.setAttribute("aria-describedby",Oe)}catch{}await ze(n),Fe.dataset.visible="true",null==Ie||Ie(),Ie=pe(e,Fe,()=>{ze(n)})}};r?l():He=setTimeout(l,80)}function Ve(e=!1){if(!Fe)return;je();const t=()=>{if(Fe){if(Fe.dataset.visible="false",_e&&Oe)try{_e.removeAttribute("aria-describedby")}catch{}_e=null,Oe=null,Ie&&(Ie(),Ie=null)}};e?t():We=setTimeout(t,120)}const qe=void 0!==import.meta&&Boolean(!1);let Xe=null;function Ue(n){const{t:r}=Re(),i=o(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`},[n.code,n.isDark]),l=o(()=>{return e=n.htmlPreviewSandbox,t=n.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!qe||"undefined"==typeof console||Xe===e)return;const t=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);t.has("allow-scripts")&&t.has("allow-same-origin")&&(Xe=e,console.warn("[markstream-react] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===t?"allow-scripts":"";var e,t},[n.htmlPreviewAllowScripts,n.htmlPreviewSandbox]);return s(()=>{const e=e=>{var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)};return"undefined"!=typeof window&&window.addEventListener("keydown",e),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",e)}},[n]),"undefined"==typeof document?null:xe(
|
|
7
7
|
/* @__PURE__ */t("div",{className:"markstream-react html-preview-frame__backdrop"+(n.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var e;return null==(e=n.onClose)?void 0:e.call(n)},children:/* @__PURE__ */e("div",{className:"html-preview-frame"+(n.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
|
|
8
8
|
/* @__PURE__ */e("div",{className:"html-preview-frame__header",children:[
|
|
9
9
|
/* @__PURE__ */e("div",{className:"html-preview-frame__title",children:[
|
|
10
10
|
/* @__PURE__ */t("span",{className:"html-preview-frame__dot"}),
|
|
11
11
|
/* @__PURE__ */t("span",{className:"html-preview-frame__label",children:n.title||`HTML ${r("common.preview")}`})]}),
|
|
12
12
|
/* @__PURE__ */t("button",{type:"button",className:"html-preview-frame__close"+(n.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var e;return null==(e=n.onClose)?void 0:e.call(n)},children:"×"})]}),
|
|
13
|
-
/* @__PURE__ */t("iframe",{className:"html-preview-frame__iframe",sandbox:l,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:i,title:n.title||"Preview"})]})}),document.body)}let Ye=!1,Ze=null,Ge=!1,Je=null;async function Qe(){if(Je)return Je;if(Ze)return Ze;if(Ge)return null;Je=(async()=>{try{const e=function(e){var t,n,r;const o="function"==typeof(null==e?void 0:e.createCodeBlockRuntime)||"function"==typeof(null==e?void 0:e.useMonaco)?e:null==e?void 0:e.default,i=null!=(t=null==o?void 0:o.createCodeBlockRuntime)?t:null==o?void 0:o.useMonaco;return"function"!=typeof i?null:{createCodeBlockRuntime:e=>i.call(o,e),detectLanguage:null==(n=null==o?void 0:o.detectLanguage)?void 0:n.bind(o),preloadStreamDiffs:null==(r=null==o?void 0:o.preloadStreamDiffs)?void 0:r.bind(o)}}(await import("stream-diffs/markstream"));if(e)return await async function(e){Ye||(Ye=!0,(null==e?void 0:e.preloadStreamDiffs)&&await e.preloadStreamDiffs())}(e),Ze=e,Ze}catch{}return Ge=!0,null})();try{return await Je}finally{Je=null}}const et="undefined"!=typeof window?u:s,tt={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function nt(e,t){var n;if(t)try{if(!(await t()))return!1}catch{return!1}if("undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return!1;const r=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let o=0;o<30;o++){await r();const t=null!=(n=e.querySelector([".stream-diffs-shell","[data-stream-diffs-state]"].join(",")))?n:e.firstElementChild;if(!t)continue;const o=t.getBoundingClientRect();if(o.width>0&&o.height>0)return await r(),!0}return!1}function rt(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const r=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},o={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...o,...n,parseDiffOptions:{...o.parseDiffOptions,...r}}}function ot(e){const t=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,r,o]=t.slice(0,3).map(Number);return.2126*n+.7152*r+.0722*o}function it(e){var t,n;const r=String(null!=e?e:"").trim().toLowerCase();if(!r||"transparent"===r)return!0;const o=r.match(/^#([0-9a-f]{8})$/);if(o)return 0===Number.parseInt(o[1].slice(6),16);const i=r.match(/^#([0-9a-f]{4})$/);if(i)return 0===Number.parseInt(i[1][3]+i[1][3],16);const l=null==(n=null==(t=r.match(/^(?:rgba?|hsla?)\(([^)]+)\)/))?void 0:t[1])?void 0:n.split(/[\s,/]+/).filter(Boolean);return 4===(null==l?void 0:l.length)&&0===Number(l[3])}function lt(r){var l,a;const u={...tt,...r},{node:m,isDark:h,loading:f,stream:p,isShowPreview:g,enableFontSizeControl:v,darkTheme:y,lightTheme:w,codeBlockOptions:x,themes:k,minWidth:b,maxWidth:C,showHeader:N,showCopyButton:M,showExpandButton:B,showPreviewButton:S,showCollapseButton:T,showFontSizeButtons:L,showLineNumbers:E,showTooltips:D}=u,$=c(null),j=c(null),z=c(null),K=c(null),V=c(null),q=c(null),X=c(null),U=c(0),Y=c(null),Z=c(null),G=Ee(),J=c(null),Q=c(null),ee=c(x),te=c(null),ne=c([]),re=c(null),oe=c(!1),ie=c(void 0),[le,ae]=i(!1),[ce,se]=i(()=>"undefined"==typeof window),[de,ue]=i(!1),[me,he]=i(!1),[fe,pe]=i(!1),[ge,ve]=i(()=>m.language||"plaintext"),[ye,we]=i(()=>P(m.language)),[xe,ke]=i(!1),[be,Ce]=i(!1),[Ne,Me]=i(!1),[Be,Se]=i(!1),[Te,Le]=i(0),{t:De}=Re();s(()=>{oe.current=be},[be]);const $e=o(()=>rt(Boolean(m.diff),x),[x,m.diff]),[Pe,Ae]=i(()=>{var e;const t=Number(null==(e=rt(Boolean(m.diff),x))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:A}),[Fe,Ie]=i(Pe),_e=o(()=>!1!==D,[D]),He="boolean"==typeof E?E:!0!==$e.disableLineNumbers,We=c(He),Oe=Number(null==(l=ee.current)?void 0:l.fontSize),je=Number(null==x?void 0:x.fontSize),ze=ee.current!==x&&Number.isFinite(Oe)&&Oe>0&&(!Number.isFinite(je)||je<=0),qe=d(()=>{var e;const t=null!=(e=$e.maxHeight)?e:500;return"number"==typeof t&&Number.isFinite(t)?t:500},[$e.maxHeight]);et(()=>{const e=Number($e.fontSize),t=Number.isFinite(e)&&e>0?e:A;Ae(t),Ie(t)},[$e.fontSize]);const Xe=d(e=>{var t,n,r;if(le)return;const o=$.current,i=z.current;if(!o||!i)return;const l="diff"===q.current?null==(t=i.getDiffEditorView)?void 0:t.call(i):null==(n=i.getEditorView)?void 0:n.call(i);if(!l)return;const a=qe(),c="diff"===q.current,s=c?"important":"";e?(o.style.minHeight="0px",o.style.setProperty("max-height","none",s),o.style.overflow="visible"):(o.style.minHeight="0px",o.style.setProperty("max-height",`${Math.ceil(a)}px`,s),o.style.overflow=c?"hidden":"auto");try{const t=Number((()=>{if("function"==typeof l.getContentHeight)return l.getContentHeight();if(c&&"function"==typeof l.getModifiedEditor){const e=l.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,a);o.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,s)}null==(r=l.layout)||r.call(l)}catch{}},[qe,le]),Ye=d(e=>{if(Xe(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Xe(e),window.requestAnimationFrame(()=>Xe(e))});return window.setTimeout(()=>Xe(e),180),()=>window.cancelAnimationFrame(t)},[Xe]),Ze=d(()=>{var e,t;for(const n of ne.current)try{"function"==typeof n?n():null==(e=null==n?void 0:n.dispose)||e.call(n)}catch{}ne.current=[],null==(t=re.current)||t.disconnect(),re.current=null},[]),Ge=d(()=>{var e,t,n;Ze();const r=z.current,o=$.current;if(!r||!o||"diff"!==q.current)return;const i=()=>Ye(oe.current),l=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const r=n.call(e,i);r&&ne.current.push(r)}catch{}},a=null==(e=r.getDiffEditorView)?void 0:e.call(r),c=null==(t=null==a?void 0:a.getOriginalEditor)?void 0:t.call(a),s=null==(n=null==a?void 0:a.getModifiedEditor)?void 0:n.call(a);if(l(a,"onDidUpdateDiff"),l(c,"onDidContentSizeChange"),l(s,"onDidContentSizeChange"),l(c,"onDidLayoutChange"),l(s,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==o)&&i()});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),re.current=e}},[Ze,Ye]);s(()=>R(()=>{Le(e=>e+1)}),[]),s(()=>{we(P(m.language))},[m.language]);const Je=c(m);Je.current=m;const lt=d(()=>{var e;U.current+=1;try{null==(e=K.current)||e.call(K)}catch{}Ze(),V.current=null,q.current=null,X.current=null,pe(!1),he(!1)},[Ze]),at=o(()=>{var e,t;return h?null!=(e=null!=y?y:null==k?void 0:k[0])?e:"vitesse-dark":null!=(t=null!=w?w:null==k?void 0:k[1])?t:"vitesse-light"},[y,h,w,k]),ct=d(()=>at,[at]),st=o(()=>ct(),[ct]),dt=o(()=>function(e,t){var n;const r=null!=(n=function(e){return"string"==typeof e?e:null}(e))?n:"",o=r.toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):t}(st,Boolean(h)),[h,st]),ut=o(()=>m.diff?h?"dark":"light":dt?"dark":"light",[h,m.diff,dt]),mt=o(()=>m.diff?"dark"===ut:dt,[ut,m.diff,dt]),ht=o(()=>{var e;const t=$e,n=F($e,ze?A:Fe),r=function(e){const t="number"==typeof e&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(null==t?void 0:t.padding),o=m.diff?0:8,i="number"==typeof(null==t?void 0:t.padding)&&Number.isFinite(t.padding)&&t.padding>=0,l=null!=(e=I(null==t?void 0:t.tabSize))?e:4;return{...n,paddingBottom:i?r.bottom:o,paddingTop:i?r.top:o,tabSize:l}},[ze,Fe,m.diff,$e]),ft=o(()=>!!m.diff&&"unified"===$e.diffStyle,[m.diff,$e]),pt=o(()=>{var e,t,n;const r=String(m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:"");if(!r)return 1;const o=f?r:r.replace(/\r\n$|\n$|\r$/,"");return Math.max(1,o.split(/\r\n|\r|\n/).length)},[f,m.code,m.diff,m.updatedCode]),gt=o(()=>Math.ceil(pt*ht.lineHeight+ht.paddingTop+ht.paddingBottom),[pt,ht]),vt=o(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${ht.lineHeight}px`,"--markstream-pre-line-number-top":`${ht.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${ht.fontSize}px`,lineHeight:`${ht.lineHeight}px`,maxHeight:`${qe()}px`,overflow:"auto",paddingBottom:`${ht.paddingBottom}px`,paddingTop:`${ht.paddingTop}px`,tabSize:ht.tabSize,whiteSpace:"scroll"===$e.overflow?"pre":"pre-wrap"};return ht.fontFamily&&(e.fontFamily=ht.fontFamily),e},[qe,ht,$e.overflow]),yt=d(()=>{var e,t,n,r,o;const i=$.current,l=j.current;if(!i||!l)return;if(l.style.removeProperty("--vscode-editor-foreground"),l.style.removeProperty("--vscode-editor-background"),l.style.removeProperty("--vscode-editor-selectionBackground"),i.style.setProperty("--diffs-tab-size",String(ht.tabSize)),"number"==typeof $e.padding&&Number.isFinite($e.padding)&&$e.padding>=0?i.style.setProperty("--diffs-gap-block",`${ht.paddingTop}px`):i.style.removeProperty("--diffs-gap-block"),m.diff)return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");const a=i;try{const c="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(a):null,s=String(null!=(e=null==c?void 0:c.getPropertyValue("--vscode-editor-foreground"))?e:"").trim()||String(null!=(t=null==c?void 0:c.color)?t:"").trim(),d=String(null!=(n=null==c?void 0:c.getPropertyValue("--vscode-editor-background"))?n:"").trim(),u=String(null!=(r=null==c?void 0:c.backgroundColor)?r:"").trim(),h=it(d)?it(u)?"":u:d,f=String(null!=(o=null==c?void 0:c.getPropertyValue("--vscode-editor-selectionBackground"))?o:"").trim();if(function(e,t,n,r){if(!n)return!1;const o=ot(e),i=ot(t);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(h,s,"plaintext"===_(String(m.language||ye||ge||"plaintext")),l.classList.contains("is-dark")))return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");s?i.style.setProperty("--vscode-editor-foreground",s):i.style.removeProperty("--vscode-editor-foreground"),h?i.style.setProperty("--vscode-editor-background",h):i.style.removeProperty("--vscode-editor-background"),f?i.style.setProperty("--vscode-editor-selectionBackground",f):i.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ye,ge,m.diff,m.language,ht,$e]),wt=d(()=>{const e=$e.maxHeight,t={...$e||{},...null==e?{}:{MAX_HEIGHT:e},themes:k?[...k]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!He,fontSize:ht.fontSize,lineHeight:ht.lineHeight,...ht.fontFamily?{fontFamily:ht.fontFamily}:{},theme:st,themeType:h?"dark":"light",onThemeChange(){yt()}};delete t.maxHeight,delete t.padding,delete t.tabSize;const n="string"==typeof t.unsafeCSS?t.unsafeCSS:"";return t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }",n].filter(Boolean).join("\n"),t},[He,h,ht,st,$e,yt,k]),xt=d(()=>{const e=wt(),t=J.current;if(!t)return J.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[wt]),kt=d(e=>{const t=e(xt());return z.current=t,K.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[xt]),bt=o(()=>{var e;return JSON.stringify({diffStyle:$e.diffStyle,expandUnchanged:$e.expandUnchanged,collapsedContextThreshold:$e.collapsedContextThreshold,hunkSeparators:$e.hunkSeparators,lineDiffType:$e.lineDiffType,maxLineDiffLength:$e.maxLineDiffLength,expansionLineCount:$e.expansionLineCount,context:null==(e=$e.parseDiffOptions)?void 0:e.context})},[$e]);s(()=>{xt()},[$e,xt]),s(()=>()=>{var e,t,n;U.current+=1,null==(e=K.current)||e.call(K),Ze(),K.current=null,V.current=null,q.current=null,X.current=null,z.current=null,Q.current=null,Y.current=null,null==(n=null==(t=Z.current)?void 0:t.destroy)||n.call(t),Z.current=null},[Ze]),s(()=>{var e,t;if("undefined"==typeof window)return;if(ce)return;const n=j.current;if(!n)return;null==(t=null==(e=Z.current)?void 0:e.destroy)||t.call(e);const r=G(n,{rootMargin:"400px"});return Z.current=r,r.isVisible()&&se(!0),r.whenVisible.then(()=>se(!0)),()=>{r.destroy(),Z.current===r&&(Z.current=null)}},[G,ce]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:z.current?(xt(),()=>{e=!1}):((async()=>{try{const t=await Qe();if(!e)return;if(!t)return void ae(!0);const n=t.createCodeBlockRuntime,r=t.detectLanguage;if("function"==typeof r&&(Y.current=r),"function"!=typeof n)return void ae(!0);Q.current=n,kt(n),ue(!0)}catch{e&&ae(!0)}})(),()=>{e=!1})},[kt,xt]),s(()=>{var e;if(!m.language&&!ye&&Y.current)try{const t=Y.current(String(null!=(e=m.code)?e:""));t&&ve(t)}catch{}},[ye,m.code,m.language]);const Ct=o(()=>String(m.language||ye||ge||"plaintext"),[ye,ge,m.language]),Nt=o(()=>P(Ct),[Ct]),Mt=o(()=>_(Nt),[Nt]),Bt=o(()=>"plaintext"===Mt,[Mt]),St=o(()=>H(Nt),[Nt,Te]),Tt=o(()=>!!g&&("html"===Nt||"svg"===Nt),[Nt,g]),Lt=o(()=>{const e=Nt;return e?W[e]||e.charAt(0).toUpperCase()+e.slice(1):W[""]||"Plain Text"},[Nt]),Et=o(()=>{var e;return function(e,t,n){const r=function(e){const t=function(e){var t,n;const r=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(r.length<3)return"";const o=r[0];if("`"!==o&&"~"!==o||r[1]!==o||r[2]!==o)return"";let i=3;for(;r[i]===o;)i+=1;return r.slice(i).trim()}(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const r="diff"===n[0]?n.slice(1):n;for(const o of r){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:""}}(String(null!=(e=m.raw)?e:""),Lt,Boolean(m.diff))},[Lt,m.diff,m.raw]),Dt=Et.title,$t=Et.caption,Pt=o(()=>{var e,t,n;return m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:""},[m.code,m.diff,m.updatedCode]),At=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(b),r=e(C);return n&&(t.minWidth=n),r&&(t.maxWidth=r),m.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",t.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",t.borderColor="var(--markstream-code-border-color, var(--code-border))"),t},[C,b,m.diff]),Rt=o(()=>{var e,t,n,r;return m.code.length>0||(null!=(t=null==(e=m.originalCode)?void 0:e.length)?t:0)>0||(null!=(r=null==(n=m.updatedCode)?void 0:n.length)?r:0)>0},[m.code,m.originalCode,m.updatedCode]),Ft=!1===p&&f||!1!==p&&f&&!Rt;s(()=>{if(le)return;if(!de)return;if(!me||!ce)return;const e=z.current;xt();const t=()=>{var t;m.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),yt(),Ne||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ye(be)):null)&&Ye(be)};(null==e?void 0:e.setTheme)&&st?Promise.resolve(e.setTheme(st)).then(t).catch(()=>{}):t()},[Ne,me,ut,be,de,m.diff,st,Ye,yt,xt,le,ce]);const It=d(async()=>{var e,t;if(le)return null;if(!ce)return null;if(Ne)return null;if(Ft)return null;const n=z.current,r=$.current;if(!n||!r||!n.createEditor)return null;xt();const o=Je.current,i=o.diff?"diff":"single",l=X.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(q.current===i&&l===r&&a)return null;if(V.current)return V.current;U.current+=1;const c=U.current;he(!0);const s=(async()=>{var e,t,i,l,a,s;try{null==(e=K.current)||e.call(K),q.current=null,X.current=null,pe(!1);const d=Mt;if(o.diff?"function"==typeof n.createDiffEditor?(q.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),d)):(q.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),d)):(q.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),d)),X.current=r,U.current!==c)return;Ge(),yt(),be||Ne||Ye(!1);const u=await Promise.race([nt(r,n.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(U.current!==c)return;if(!u)return;Xe(be),pe(!0)}catch{U.current===c&&(ie.current=Mt,ae(!0))}})().finally(()=>{V.current===s&&(V.current=null)});return V.current=s,s},[Xe,Ge,Ne,be,Mt,Ye,Ft,yt,xt,le,ce]);s(()=>{xt();const e=ee.current!==x;ee.current=x;const t=We.current!==He;We.current=He;const n=te.current;if(te.current=bt,le)return;if(!de)return;let r=!1;if(e||t){const e=Q.current;if(e){lt(),z.current=null,K.current=null;try{kt(e),r=!0}catch{return void ae(!0)}}}const o=Boolean(m.diff&&n!==bt);if(!r&&!o)return;if(!ce||!me&&!r)return;if(Ne||Ft)return;let i=!1;return(async()=>{if(r||lt(),!i)try{await It()}catch{}})(),()=>{i=!0}},[Ne,x,me,He,It,kt,de,bt,m.diff,lt,Ft,xt,le,ce]),s(()=>{if(le){const e=ie.current;if(void 0===e||e===Mt)return;return ie.current=void 0,lt(),void ae(!1)}de&&ce&&(Ne||Ft?lt():It())},[Ne,It,Mt,de,lt,Ft,le,ce]),s(()=>{var e;if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;const t=z.current;if(!t)return;const n=String(null!=(e=m.code)?e:"");(async()=>{var e,r;let o=ye;if(!o&&Y.current)try{o=P(Y.current(n)),o&&we(o)}catch{}const i=_(o||Nt);if(t.createEditor&&$.current){try{await Promise.resolve(It())}catch{}const e=V.current;if(e)try{await e}catch{}}try{m.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=m.originalCode)?e:""),String(null!=(r=m.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}const l=$.current;"true"!==(null==l?void 0:l.getAttribute("data-markstream-enhanced"))&&await nt(l,t.whenVisualReady)&&(Xe(be),pe(!0)),Ye(be)})()},[Xe,Nt,ye,Ne,me,It,be,de,m.code,m.diff,m.originalCode,m.updatedCode,Ye,Ft,le,ce]),s(()=>{if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;if(!be&&f)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ye(be)):null;return null==e&&Ye(be),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ne,be,f,de,Ye,Ft,le,ce]),s(()=>{var e,t,n;if(!v)return;if(le)return;const r=z.current;if(r){try{const o="diff"===q.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Fe})}catch{}Ye(be)}},[v,be,Fe,m.diff,Ye,le]),s(()=>{_e||Ve(!0)},[_e]);const _t=d((e,t)=>{if(!_e)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ke(n,t,"top",!1,0,mt))},[mt,_e]),Ht=d(()=>{_e&&Ve()},[_e]),Wt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Pt)),ke(!0),null==(e=u.onCopy)||e.call(u,String(Pt)),setTimeout(()=>ke(!1),1e3)}catch{}},[u,Pt]),Ot=d(()=>{if(!Tt)return;const e="html"===Nt?"text/html":"image/svg+xml",t="html"===Nt?De("artifacts.htmlPreviewTitle")||"HTML Preview":De("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof u.onPreviewCode?"html"===Nt&&Se(e=>!e):u.onPreviewCode({node:m,artifactType:e,artifactTitle:t,id:`temp-${Nt}-${Date.now()}`})},[Nt,Tt,m,u,De]);/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */t("iframe",{className:"html-preview-frame__iframe",sandbox:l,referrerPolicy:"no-referrer",src:"about:blank",srcDoc:i,title:n.title||"Preview"})]})}),document.body)}let Ye=!1,Ze=null,Ge=!1,Je=null;async function Qe(){if(Je)return Je;if(Ze)return Ze;if(Ge)return null;Je=(async()=>{try{const e=function(e){var t,n,r;const o="function"==typeof(null==e?void 0:e.createCodeBlockRuntime)||"function"==typeof(null==e?void 0:e.useMonaco)?e:null==e?void 0:e.default,i=null!=(t=null==o?void 0:o.createCodeBlockRuntime)?t:null==o?void 0:o.useMonaco;return"function"!=typeof i?null:{createCodeBlockRuntime:e=>i.call(o,e),detectLanguage:null==(n=null==o?void 0:o.detectLanguage)?void 0:n.bind(o),preloadStreamDiffs:null==(r=null==o?void 0:o.preloadStreamDiffs)?void 0:r.bind(o)}}(await import("stream-diffs/markstream"));if(e)return await async function(e){Ye||(Ye=!0,(null==e?void 0:e.preloadStreamDiffs)&&await e.preloadStreamDiffs())}(e),Ze=e,Ze}catch{}return Ge=!0,null})();try{return await Je}finally{Je=null}}const et="undefined"!=typeof window?u:s,tt={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function nt(e,t){var n;if(t)try{if(!(await t()))return!1}catch{return!1}if("undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return!1;const r=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let o=0;o<30;o++){await r();const t=null!=(n=e.querySelector([".stream-diffs-shell","[data-stream-diffs-state]"].join(",")))?n:e.firstElementChild;if(!t)continue;const o=t.getBoundingClientRect();if(o.width>0&&o.height>0)return await r(),!0}return!1}function rt(e,t){const n={...t||{}};for(const i of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix"])delete n[i];if(!e)return{overflow:"wrap",...n};const r=n.parseDiffOptions&&"object"==typeof n.parseDiffOptions?n.parseDiffOptions:{},o={overflow:"wrap",diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return{...o,...n,parseDiffOptions:{...o.parseDiffOptions,...r}}}function ot(e){const t=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;const[n,r,o]=t.slice(0,3).map(Number);return.2126*n+.7152*r+.0722*o}function it(e){var t,n;const r=String(null!=e?e:"").trim().toLowerCase();if(!r||"transparent"===r)return!0;const o=r.match(/^#([0-9a-f]{8})$/);if(o)return 0===Number.parseInt(o[1].slice(6),16);const i=r.match(/^#([0-9a-f]{4})$/);if(i)return 0===Number.parseInt(i[1][3]+i[1][3],16);const l=null==(n=null==(t=r.match(/^(?:rgba?|hsla?)\(([^)]+)\)/))?void 0:t[1])?void 0:n.split(/[\s,/]+/).filter(Boolean);return 4===(null==l?void 0:l.length)&&0===Number(l[3])}function lt(r){var l,a;const u={...tt,...r},{node:m,isDark:h,loading:f,stream:p,isShowPreview:g,enableFontSizeControl:v,darkTheme:y,lightTheme:w,codeBlockOptions:x,themes:k,minWidth:b,maxWidth:C,showHeader:N,showCopyButton:M,showExpandButton:B,showPreviewButton:S,showCollapseButton:T,showFontSizeButtons:L,showLineNumbers:E,showTooltips:D}=u,$=c(null),j=c(null),z=c(null),K=c(null),V=c(null),q=c(null),X=c(null),U=c(0),Y=c(null),Z=c(null),G=Ee(),J=c(null),Q=c(null),ee=c(x),te=c(null),ne=c([]),re=c(null),oe=c(!1),ie=c(void 0),[le,ae]=i(!1),[ce,se]=i(()=>"undefined"==typeof window),[de,ue]=i(!1),[me,he]=i(!1),[fe,pe]=i(!1),[ge,ve]=i(()=>m.language||"plaintext"),[ye,we]=i(()=>P(m.language)),[xe,ke]=i(!1),[be,Ce]=i(!1),[Ne,Me]=i(!1),[Be,Se]=i(!1),[Te,Le]=i(0),{t:De}=Re();s(()=>{oe.current=be},[be]);const $e=o(()=>rt(Boolean(m.diff),x),[x,m.diff]),[Pe,Ae]=i(()=>{var e;const t=Number(null==(e=rt(Boolean(m.diff),x))?void 0:e.fontSize);return Number.isFinite(t)&&t>0?t:A}),[Fe,_e]=i(Pe),Ie=o(()=>!1!==D,[D]),He="boolean"==typeof E?E:!0!==$e.disableLineNumbers,We=c(He),Oe=Number(null==(l=ee.current)?void 0:l.fontSize),je=Number(null==x?void 0:x.fontSize),ze=ee.current!==x&&Number.isFinite(Oe)&&Oe>0&&(!Number.isFinite(je)||je<=0),qe=d(()=>{var e;const t=null!=(e=$e.maxHeight)?e:500;return"number"==typeof t&&Number.isFinite(t)?t:500},[$e.maxHeight]);et(()=>{const e=Number($e.fontSize),t=Number.isFinite(e)&&e>0?e:A;Ae(t),_e(t)},[$e.fontSize]);const Xe=d(e=>{var t,n,r;if(le)return;const o=$.current,i=z.current;if(!o||!i)return;const l="diff"===q.current?null==(t=i.getDiffEditorView)?void 0:t.call(i):null==(n=i.getEditorView)?void 0:n.call(i);if(!l)return;const a=qe(),c="diff"===q.current,s=c?"important":"";e?(o.style.minHeight="0px",o.style.setProperty("max-height","none",s),o.style.overflow="visible"):(o.style.minHeight="0px",o.style.setProperty("max-height",`${Math.ceil(a)}px`,s),o.style.overflow=c?"hidden":"auto");try{const t=Number((()=>{if("function"==typeof l.getContentHeight)return l.getContentHeight();if(c&&"function"==typeof l.getModifiedEditor){const e=l.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,a);o.style.setProperty("height",`${Math.ceil(Math.max(1,n))}px`,s)}null==(r=l.layout)||r.call(l)}catch{}},[qe,le]),Ye=d(e=>{if(Xe(e),"undefined"==typeof window||"function"!=typeof window.requestAnimationFrame)return;const t=window.requestAnimationFrame(()=>{Xe(e),window.requestAnimationFrame(()=>Xe(e))});return window.setTimeout(()=>Xe(e),180),()=>window.cancelAnimationFrame(t)},[Xe]),Ze=d(()=>{var e,t;for(const n of ne.current)try{"function"==typeof n?n():null==(e=null==n?void 0:n.dispose)||e.call(n)}catch{}ne.current=[],null==(t=re.current)||t.disconnect(),re.current=null},[]),Ge=d(()=>{var e,t,n;Ze();const r=z.current,o=$.current;if(!r||!o||"diff"!==q.current)return;const i=()=>Ye(oe.current),l=(e,t)=>{try{const n=null==e?void 0:e[t];if("function"!=typeof n)return;const r=n.call(e,i);r&&ne.current.push(r)}catch{}},a=null==(e=r.getDiffEditorView)?void 0:e.call(r),c=null==(t=null==a?void 0:a.getOriginalEditor)?void 0:t.call(a),s=null==(n=null==a?void 0:a.getModifiedEditor)?void 0:n.call(a);if(l(a,"onDidUpdateDiff"),l(c,"onDidContentSizeChange"),l(s,"onDidContentSizeChange"),l(c,"onDidLayoutChange"),l(s,"onDidLayoutChange"),"undefined"!=typeof window&&"function"==typeof window.MutationObserver){const e=new window.MutationObserver(e=>{e.some(e=>"childList"===e.type||"attributes"===e.type&&e.target!==o)&&i()});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),re.current=e}},[Ze,Ye]);s(()=>R(()=>{Le(e=>e+1)}),[]),s(()=>{we(P(m.language))},[m.language]);const Je=c(m);Je.current=m;const lt=d(()=>{var e;U.current+=1;try{null==(e=K.current)||e.call(K)}catch{}Ze(),V.current=null,q.current=null,X.current=null,pe(!1),he(!1)},[Ze]),at=o(()=>{var e,t;return h?null!=(e=null!=y?y:null==k?void 0:k[0])?e:"vitesse-dark":null!=(t=null!=w?w:null==k?void 0:k[1])?t:"vitesse-light"},[y,h,w,k]),ct=d(()=>at,[at]),st=o(()=>ct(),[ct]),dt=o(()=>function(e,t){var n;const r=null!=(n=function(e){return"string"==typeof e?e:null}(e))?n:"",o=r.toLowerCase();return o?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):t}(st,Boolean(h)),[h,st]),ut=o(()=>m.diff?h?"dark":"light":dt?"dark":"light",[h,m.diff,dt]),mt=o(()=>m.diff?"dark"===ut:dt,[ut,m.diff,dt]),ht=o(()=>{var e;const t=$e,n=F($e,ze?A:Fe),r=function(e){const t="number"==typeof e&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(null==t?void 0:t.padding),o=m.diff?0:8,i="number"==typeof(null==t?void 0:t.padding)&&Number.isFinite(t.padding)&&t.padding>=0,l=null!=(e=_(null==t?void 0:t.tabSize))?e:4;return{...n,paddingBottom:i?r.bottom:o,paddingTop:i?r.top:o,tabSize:l}},[ze,Fe,m.diff,$e]),ft=o(()=>!!m.diff&&"unified"===$e.diffStyle,[m.diff,$e]),pt=o(()=>{var e,t,n;const r=String(m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:"");if(!r)return 1;const o=f?r:r.replace(/\r\n$|\n$|\r$/,"");return Math.max(1,o.split(/\r\n|\r|\n/).length)},[f,m.code,m.diff,m.updatedCode]),gt=o(()=>Math.ceil(pt*ht.lineHeight+ht.paddingTop+ht.paddingBottom),[pt,ht]),vt=o(()=>{const e={"--markstream-code-padding-left":"62px","--markstream-pre-diff-line-height":`${ht.lineHeight}px`,"--markstream-pre-line-number-top":`${ht.paddingTop}px`,"--markstream-pre-line-number-width":"36px","--markstream-pre-line-number-gap":"0px",fontSize:`${ht.fontSize}px`,lineHeight:`${ht.lineHeight}px`,maxHeight:`${qe()}px`,overflow:"auto",paddingBottom:`${ht.paddingBottom}px`,paddingTop:`${ht.paddingTop}px`,tabSize:ht.tabSize,whiteSpace:"scroll"===$e.overflow?"pre":"pre-wrap"};return ht.fontFamily&&(e.fontFamily=ht.fontFamily),e},[qe,ht,$e.overflow]),yt=d(()=>{var e,t,n,r,o;const i=$.current,l=j.current;if(!i||!l)return;if(l.style.removeProperty("--vscode-editor-foreground"),l.style.removeProperty("--vscode-editor-background"),l.style.removeProperty("--vscode-editor-selectionBackground"),i.style.setProperty("--diffs-tab-size",String(ht.tabSize)),"number"==typeof $e.padding&&Number.isFinite($e.padding)&&$e.padding>=0?i.style.setProperty("--diffs-gap-block",`${ht.paddingTop}px`):i.style.removeProperty("--diffs-gap-block"),m.diff)return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");const a=i;try{const c="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(a):null,s=String(null!=(e=null==c?void 0:c.getPropertyValue("--vscode-editor-foreground"))?e:"").trim()||String(null!=(t=null==c?void 0:c.color)?t:"").trim(),d=String(null!=(n=null==c?void 0:c.getPropertyValue("--vscode-editor-background"))?n:"").trim(),u=String(null!=(r=null==c?void 0:c.backgroundColor)?r:"").trim(),h=it(d)?it(u)?"":u:d,f=String(null!=(o=null==c?void 0:c.getPropertyValue("--vscode-editor-selectionBackground"))?o:"").trim();if(function(e,t,n,r){if(!n)return!1;const o=ot(e),i=ot(t);return r?null!=o&&o>170||null!=i&&i<110:null!=o&&o<85||null!=i&&i>190}(h,s,"plaintext"===I(String(m.language||ye||ge||"plaintext")),l.classList.contains("is-dark")))return i.style.removeProperty("--vscode-editor-foreground"),i.style.removeProperty("--vscode-editor-background"),void i.style.removeProperty("--vscode-editor-selectionBackground");s?i.style.setProperty("--vscode-editor-foreground",s):i.style.removeProperty("--vscode-editor-foreground"),h?i.style.setProperty("--vscode-editor-background",h):i.style.removeProperty("--vscode-editor-background"),f?i.style.setProperty("--vscode-editor-selectionBackground",f):i.style.removeProperty("--vscode-editor-selectionBackground")}catch{}},[ye,ge,m.diff,m.language,ht,$e]),wt=d(()=>{const e=$e.maxHeight,t={...$e||{},...null==e?{}:{MAX_HEIGHT:e},themes:k?[...k]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!He,fontSize:ht.fontSize,lineHeight:ht.lineHeight,...ht.fontFamily?{fontFamily:ht.fontFamily}:{},theme:st,themeType:h?"dark":"light",onThemeChange(){yt()}};delete t.maxHeight,delete t.padding,delete t.tabSize;const n="string"==typeof t.unsafeCSS?t.unsafeCSS:"";return t.unsafeCSS=["[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }",n].filter(Boolean).join("\n"),t},[He,h,ht,st,$e,yt,k]),xt=d(()=>{const e=wt(),t=J.current;if(!t)return J.current=e,e;for(const n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[wt]),kt=d(e=>{const t=e(xt());return z.current=t,K.current="function"==typeof t.safeClean?()=>t.safeClean():"function"==typeof t.cleanupEditor?()=>t.cleanupEditor():null,t},[xt]),bt=o(()=>{var e;return JSON.stringify({diffStyle:$e.diffStyle,expandUnchanged:$e.expandUnchanged,collapsedContextThreshold:$e.collapsedContextThreshold,hunkSeparators:$e.hunkSeparators,lineDiffType:$e.lineDiffType,maxLineDiffLength:$e.maxLineDiffLength,expansionLineCount:$e.expansionLineCount,context:null==(e=$e.parseDiffOptions)?void 0:e.context})},[$e]);s(()=>{xt()},[$e,xt]),s(()=>()=>{var e,t,n;U.current+=1,null==(e=K.current)||e.call(K),Ze(),K.current=null,V.current=null,q.current=null,X.current=null,z.current=null,Q.current=null,Y.current=null,null==(n=null==(t=Z.current)?void 0:t.destroy)||n.call(t),Z.current=null},[Ze]),s(()=>{var e,t;if("undefined"==typeof window)return;if(ce)return;const n=j.current;if(!n)return;null==(t=null==(e=Z.current)?void 0:e.destroy)||t.call(e);const r=G(n,{rootMargin:"400px"});return Z.current=r,r.isVisible()&&se(!0),r.whenVisible.then(()=>se(!0)),()=>{r.destroy(),Z.current===r&&(Z.current=null)}},[G,ce]),s(()=>{let e=!0;return"undefined"==typeof window?()=>{e=!1}:z.current?(xt(),()=>{e=!1}):((async()=>{try{const t=await Qe();if(!e)return;if(!t)return void ae(!0);const n=t.createCodeBlockRuntime,r=t.detectLanguage;if("function"==typeof r&&(Y.current=r),"function"!=typeof n)return void ae(!0);Q.current=n,kt(n),ue(!0)}catch{e&&ae(!0)}})(),()=>{e=!1})},[kt,xt]),s(()=>{var e;if(!m.language&&!ye&&Y.current)try{const t=Y.current(String(null!=(e=m.code)?e:""));t&&ve(t)}catch{}},[ye,m.code,m.language]);const Ct=o(()=>String(m.language||ye||ge||"plaintext"),[ye,ge,m.language]),Nt=o(()=>P(Ct),[Ct]),Mt=o(()=>I(Nt),[Nt]),Bt=o(()=>"plaintext"===Mt,[Mt]),St=o(()=>H(Nt),[Nt,Te]),Tt=o(()=>!!g&&("html"===Nt||"svg"===Nt),[Nt,g]),Lt=o(()=>{const e=Nt;return e?W[e]||e.charAt(0).toUpperCase()+e.slice(1):W[""]||"Plain Text"},[Nt]),Et=o(()=>{var e;return function(e,t,n){const r=function(e){const t=function(e){var t,n;const r=null!=(n=null==(t=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:t.trim())?n:"";if(r.length<3)return"";const o=r[0];if("`"!==o&&"~"!==o||r[1]!==o||r[2]!==o)return"";let i=3;for(;r[i]===o;)i+=1;return r.slice(i).trim()}(e);if(!t)return"";const n=t.split(/\s+/).filter(Boolean);if(!n.length)return"";const r="diff"===n[0]?n.slice(1):n;for(const o of r){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:""}}(String(null!=(e=m.raw)?e:""),Lt,Boolean(m.diff))},[Lt,m.diff,m.raw]),Dt=Et.title,$t=Et.caption,Pt=o(()=>{var e,t,n;return m.diff?null!=(t=null!=(e=m.updatedCode)?e:m.code)?t:"":null!=(n=m.code)?n:""},[m.code,m.diff,m.updatedCode]),At=o(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(b),r=e(C);return n&&(t.minWidth=n),r&&(t.maxWidth=r),m.diff?(t.color="var(--markstream-diff-shell-fg)",t.borderColor="var(--markstream-diff-shell-border)"):(t.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",t.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",t.borderColor="var(--markstream-code-border-color, var(--code-border))"),t},[C,b,m.diff]),Rt=o(()=>{var e,t,n,r;return m.code.length>0||(null!=(t=null==(e=m.originalCode)?void 0:e.length)?t:0)>0||(null!=(r=null==(n=m.updatedCode)?void 0:n.length)?r:0)>0},[m.code,m.originalCode,m.updatedCode]),Ft=!1===p&&f||!1!==p&&f&&!Rt;s(()=>{if(le)return;if(!de)return;if(!me||!ce)return;const e=z.current;xt();const t=()=>{var t;m.diff&&(null==(t=null==e?void 0:e.refreshDiffPresentation)||t.call(e)),yt(),Ne||null==("undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ye(be)):null)&&Ye(be)};(null==e?void 0:e.setTheme)&&st?Promise.resolve(e.setTheme(st)).then(t).catch(()=>{}):t()},[Ne,me,ut,be,de,m.diff,st,Ye,yt,xt,le,ce]);const _t=d(async()=>{var e,t;if(le)return null;if(!ce)return null;if(Ne)return null;if(Ft)return null;const n=z.current,r=$.current;if(!n||!r||!n.createEditor)return null;xt();const o=Je.current,i=o.diff?"diff":"single",l=X.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(q.current===i&&l===r&&a)return null;if(V.current)return V.current;U.current+=1;const c=U.current;he(!0);const s=(async()=>{var e,t,i,l,a,s;try{null==(e=K.current)||e.call(K),q.current=null,X.current=null,pe(!1);const d=Mt;if(o.diff?"function"==typeof n.createDiffEditor?(q.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),d)):(q.current="single",await n.createEditor(r,String(null!=(a=null!=(l=o.updatedCode)?l:o.code)?a:""),d)):(q.current="single",await n.createEditor(r,String(null!=(s=o.code)?s:""),d)),X.current=r,U.current!==c)return;Ge(),yt(),be||Ne||Ye(!1);const u=await Promise.race([nt(r,n.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(U.current!==c)return;if(!u)return;Xe(be),pe(!0)}catch{U.current===c&&(ie.current=Mt,ae(!0))}})().finally(()=>{V.current===s&&(V.current=null)});return V.current=s,s},[Xe,Ge,Ne,be,Mt,Ye,Ft,yt,xt,le,ce]);s(()=>{xt();const e=ee.current!==x;ee.current=x;const t=We.current!==He;We.current=He;const n=te.current;if(te.current=bt,le)return;if(!de)return;let r=!1;if(e||t){const e=Q.current;if(e){lt(),z.current=null,K.current=null;try{kt(e),r=!0}catch{return void ae(!0)}}}const o=Boolean(m.diff&&n!==bt);if(!r&&!o)return;if(!ce||!me&&!r)return;if(Ne||Ft)return;let i=!1;return(async()=>{if(r||lt(),!i)try{await _t()}catch{}})(),()=>{i=!0}},[Ne,x,me,He,_t,kt,de,bt,m.diff,lt,Ft,xt,le,ce]),s(()=>{if(le){const e=ie.current;if(void 0===e||e===Mt)return;return ie.current=void 0,lt(),void ae(!1)}de&&ce&&(Ne||Ft?lt():_t())},[Ne,_t,Mt,de,lt,Ft,le,ce]),s(()=>{var e;if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;const t=z.current;if(!t)return;const n=String(null!=(e=m.code)?e:"");(async()=>{var e,r;let o=ye;if(!o&&Y.current)try{o=P(Y.current(n)),o&&we(o)}catch{}const i=I(o||Nt);if(t.createEditor&&$.current){try{await Promise.resolve(_t())}catch{}const e=V.current;if(e)try{await e}catch{}}try{m.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=m.originalCode)?e:""),String(null!=(r=m.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}const l=$.current;"true"!==(null==l?void 0:l.getAttribute("data-markstream-enhanced"))&&await nt(l,t.whenVisualReady)&&(Xe(be),pe(!0)),Ye(be)})()},[Xe,Nt,ye,Ne,me,_t,be,de,m.code,m.diff,m.originalCode,m.updatedCode,Ye,Ft,le,ce]),s(()=>{if(le)return;if(!de)return;if(!ce)return;if(Ne)return;if(Ft)return;if(!be&&f)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ye(be)):null;return null==e&&Ye(be),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ne,be,f,de,Ye,Ft,le,ce]),s(()=>{var e,t,n;if(!v)return;if(le)return;const r=z.current;if(r){try{const o="diff"===q.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:Fe})}catch{}Ye(be)}},[v,be,Fe,m.diff,Ye,le]),s(()=>{Ie||Ve(!0)},[Ie]);const It=d((e,t)=>{if(!Ie)return;const n=e.currentTarget;n&&!n.disabled&&("clientX"in e&&(e.clientX,e.clientY),Ke(n,t,"top",!1,0,mt))},[mt,Ie]),Ht=d(()=>{Ie&&Ve()},[Ie]),Wt=d(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(Pt)),ke(!0),null==(e=u.onCopy)||e.call(u,String(Pt)),setTimeout(()=>ke(!1),1e3)}catch{}},[u,Pt]),Ot=d(()=>{if(!Tt)return;const e="html"===Nt?"text/html":"image/svg+xml",t="html"===Nt?De("artifacts.htmlPreviewTitle")||"HTML Preview":De("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof u.onPreviewCode?"html"===Nt&&Se(e=>!e):u.onPreviewCode({node:m,artifactType:e,artifactTitle:t,id:`temp-${Nt}-${Date.now()}`})},[Nt,Tt,m,u,De]);/* @__PURE__ */
|
|
14
14
|
return e("div",{ref:j,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",mt?"border-gray-700/30":"border-gray-200",f?"is-rendering":"",mt?"is-dark":"",m.diff?"is-diff":"",Bt?"is-plain-text":""].join(" "),style:At,children:[N&&/* @__PURE__ */e("div",{className:"code-block-header",children:[
|
|
15
15
|
/* @__PURE__ */e("div",{className:"code-header-main",children:[
|
|
16
16
|
/* @__PURE__ */t("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:St}}),
|
|
17
17
|
/* @__PURE__ */e("div",{className:"code-header-copy min-w-0",children:[
|
|
18
18
|
/* @__PURE__ */t("div",{className:"code-header-title truncate",children:Dt}),$t&&/* @__PURE__ */t("div",{className:"code-header-caption truncate",children:$t})]})]}),
|
|
19
|
-
/* @__PURE__ */e("div",{className:"code-header-actions",children:[T&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-pressed":Ne,onClick:()=>Me(e=>!e),onMouseEnter:e=>
|
|
20
|
-
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe<=10,onClick:()=>
|
|
21
|
-
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe===Pe,onClick:()=>
|
|
19
|
+
/* @__PURE__ */e("div",{className:"code-header-actions",children:[T&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-pressed":Ne,onClick:()=>Me(e=>!e),onMouseEnter:e=>It(e,Ne?De("common.expand")||"Expand":De("common.collapse")||"Collapse"),onFocus:e=>It(e,Ne?De("common.expand")||"Expand":De("common.collapse")||"Collapse"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",{style:{rotate:Ne?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),L&&v&&/* @__PURE__ */e(n,{children:[
|
|
20
|
+
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe<=10,onClick:()=>_e(e=>Math.max(10,e-1)),onMouseEnter:e=>It(e,De("common.decrease")||"Decrease"),onFocus:e=>It(e,De("common.decrease")||"Decrease"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14"})})}),
|
|
21
|
+
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe===Pe,onClick:()=>_e(Pe),onMouseEnter:e=>It(e,De("common.reset")||"Reset"),onFocus:e=>It(e,De("common.reset")||"Reset"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
22
22
|
/* @__PURE__ */t("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),
|
|
23
23
|
/* @__PURE__ */t("path",{d:"M3 3v5h5"})]})})}),
|
|
24
|
-
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe>=36,onClick:()=>
|
|
24
|
+
/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors",disabled:Fe>=36,onClick:()=>_e(e=>Math.min(36,e+1)),onMouseEnter:e=>It(e,De("common.increase")||"Increase"),onFocus:e=>It(e,De("common.increase")||"Increase"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 12h14m-7-7v14"})})})]}),M&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-label":xe?De("common.copied")||"Copied":De("common.copy")||"Copy",onClick:Wt,onMouseEnter:e=>It(e,xe?De("common.copied")||"Copied":De("common.copy")||"Copy"),onFocus:e=>It(e,xe?De("common.copied")||"Copied":De("common.copy")||"Copy"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",xe?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
25
25
|
/* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
26
|
-
/* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),B&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-pressed":be,onClick:e=>{Ce(e=>!e),
|
|
26
|
+
/* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),B&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-pressed":be,onClick:e=>{Ce(e=>!e),It(e,be?De("common.expand")||"Expand":De("common.collapse")||"Collapse")},onMouseEnter:e=>It(e,be?De("common.collapse")||"Collapse":De("common.expand")||"Expand"),onFocus:e=>It(e,be?De("common.collapse")||"Collapse":De("common.expand")||"Expand"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",be?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"action-icon",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})}),Tt&&S&&/* @__PURE__ */t("button",{type:"button",className:"code-action-btn transition-colors","aria-label":De("common.preview")||"Preview",onClick:Ot,onMouseEnter:e=>It(e,De("common.preview")||"Preview"),onFocus:e=>It(e,De("common.preview")||"Preview"),onMouseLeave:Ht,onBlur:Ht,children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",children:/* @__PURE__ */e("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[
|
|
27
27
|
/* @__PURE__ */t("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),
|
|
28
28
|
/* @__PURE__ */t("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})]})})})]})]}),
|
|
29
29
|
/* @__PURE__ */e("div",{className:`code-block-body${Ne?" code-block-body--collapsed":""}${be?" code-block-body--expanded":""}`,children:[!Ne&&(!!p||!f)&&(le?/* @__PURE__ */t(O,{className:"code-fallback-plain m-0",diffInline:ft,node:m,showLineNumbers:He,style:vt}):/* @__PURE__ */e("div",{className:"code-editor-layer",children:[
|
|
@@ -31,7 +31,7 @@ return e("div",{ref:j,className:["code-block-container my-4 rounded-lg border ov
|
|
|
31
31
|
/* @__PURE__ */t("div",{className:"skeleton-line"}),
|
|
32
32
|
/* @__PURE__ */t("div",{className:"skeleton-line"}),
|
|
33
33
|
/* @__PURE__ */t("div",{className:"skeleton-line short"})]})})]}),Be&&!u.onPreviewCode&&Tt&&"html"===Nt&&/* @__PURE__ */t(Ue,{code:String(null!=(a=m.code)?a:""),htmlPreviewAllowScripts:u.htmlPreviewAllowScripts,htmlPreviewSandbox:u.htmlPreviewSandbox,isDark:h,onClose:()=>Se(!1)}),
|
|
34
|
-
/* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:xe?De("common.copied")||"Copied":""})]})}function at(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=at(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ct(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=at(e))&&(r&&(r+=" "),r+=t);return r}const st=()=>import("@terrastruct/d2");let dt=null,ut=st;function mt(e){ut=e,dt=null}function ht(e){mt(null!=e?e:st)}function ft(){mt(null)}function pt(){return"function"==typeof ut}async function gt(){if(dt)return dt;const e=ut;if(!e)return null;let t;try{t=await e()}catch(n){if(e===st)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(dt=function(e){var t;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),dt):null}const vt={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},yt={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},wt=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],xt=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function kt(e){if(!e)return"";const t=e.trim();return xt.test(t)?t:""}function bt(r){var l,a;const u={...vt,...r},{t:m}=Re(),[h,f]=i(!1),[p,g]=i(!1),[v,y]=i(!1),[w,x]=i(!1),[k,b]=i(null),[C,N]=i(""),[M,B]=i(null),[S,T]=i(!1),[L,E]=i(()=>"undefined"==typeof window),D=c(0),$=c(null),P=c(!1),A=c(!1),R=c(0),F=c(null),
|
|
34
|
+
/* @__PURE__ */t("span",{className:"sr-only","aria-live":"polite",role:"status",children:xe?De("common.copied")||"Copied":""})]})}function at(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=at(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ct(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=at(e))&&(r&&(r+=" "),r+=t);return r}const st=()=>import("@terrastruct/d2");let dt=null,ut=st;function mt(e){ut=e,dt=null}function ht(e){mt(null!=e?e:st)}function ft(){mt(null)}function pt(){return"function"==typeof ut}async function gt(){if(dt)return dt;const e=ut;if(!e)return null;let t;try{t=await e()}catch(n){if(e===st)throw new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.');throw n}return t?(dt=function(e){var t;if(!e)return e;if(e.D2&&"function"==typeof e.D2)return e.D2;if(e.default&&e.default.D2&&"function"==typeof e.default.D2)return e.default.D2;const n=null!=(t=e.default)?t:e;return"function"==typeof n?n:(null==n?void 0:n.D2)&&"function"==typeof n.D2?n.D2:n}(t),dt):null}const vt={maxHeight:"500px",loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},yt={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"},wt=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],xt=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function kt(e){if(!e)return"";const t=e.trim();return xt.test(t)?t:""}function bt(r){var l,a;const u={...vt,...r},{t:m}=Re(),[h,f]=i(!1),[p,g]=i(!1),[v,y]=i(!1),[w,x]=i(!1),[k,b]=i(null),[C,N]=i(""),[M,B]=i(null),[S,T]=i(!1),[L,E]=i(()=>"undefined"==typeof window),D=c(0),$=c(null),P=c(!1),A=c(!1),R=c(0),F=c(null),_=c(!1),I=c(null),H=c(null),W=c(null),O=c(null),j=c(!1),z=c(()=>{}),K=Ee(),V=null!=(a=null==(l=u.node)?void 0:l.code)?a:"",q=v||!w||!C,X=!!C,U=o(()=>{if(u.maxHeight)return{maxHeight:"number"==typeof u.maxHeight?`${u.maxHeight}px`:String(u.maxHeight)}},[u.maxHeight]),Y=o(()=>{if(q&&M)return{minHeight:`${M}px`}},[M,q]);s(()=>{j.current=S},[S]),s(()=>{const e=I.current;if(!e)return;const t=K(e,{rootMargin:"160px"});return H.current=t,t.isVisible()&&E(!0),t.whenVisible.then(()=>E(!0)),()=>{t.destroy(),H.current=null}},[K]);const Z=d(()=>{const e=W.current;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&B(e=>e!==t?t:e)},[]),G=d((e=!1)=>{if(P.current||"undefined"==typeof window)return;if(A.current)return;if(!L)return;if(j.current)return void(_.current=!0);const t=Math.max(120,Number(u.progressiveIntervalMs)||0),n=Date.now()-R.current;if(!e&&n<t)return _.current=!0,void(null==F.current&&(F.current=window.setTimeout(()=>{F.current=null,_.current&&(_.current=!1,G(!0))},Math.max(0,t-n))));P.current=!0;const r=()=>{P.current=!1,R.current=Date.now(),z.current()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)},[u.progressiveIntervalMs,L]),J=d(async()=>{if($.current)return $.current;const e=await gt();if(!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?$.current=t:"function"==typeof e.compile&&($.current=e),$.current}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?($.current=new e.D2,$.current):("function"==typeof e.compile&&($.current=e),$.current)},[]),Q=d(async()=>{var e,t,n,r,o;if("undefined"==typeof window||A.current)return;if(!L)return;if(u.loading&&!u.progressiveRender)return;if(!V)return N(""),void b(null);const i=++D.current;T(!0),b(null);try{const l=await J();if(!l)return x(!1),y(!0),N(""),void b("D2 is not available.");if("function"!=typeof l.compile||"function"!=typeof l.render)throw new Error("D2 instance is missing compile/render methods.");x(!0);const a=await l.compile(V);if(i!==D.current)return;const c=null!=(e=null==a?void 0:a.diagram)?e:a,s=null!=(n=null!=(t=null==a?void 0:a.renderOptions)?t:null==a?void 0:a.options)?n:{},d=null!=(r=u.themeId)?r:s.themeID,m=null!=(o=u.darkThemeId)?o:s.darkThemeID,h={...s};if(h.themeID=u.isDark&&null!=m?m:d,h.darkThemeID=null,h.darkThemeOverrides=null,u.isDark){const e=s.themeOverrides&&"object"==typeof s.themeOverrides?s.themeOverrides:null;h.themeOverrides={...yt,...e||{}}}const f=await l.render(c,h);if(i!==D.current)return;const p=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(f);if(!p)throw new Error("D2 render returned empty output.");const g=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(wt.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=kt(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r.classList.add("markstream-d2-root-svg"),r.outerHTML}(p);N(g||""),u.loading&&y(!1),b(null)}catch(l){if(i!==D.current)return;const e=(null==l?void 0:l.message)?String(l.message):"D2 render failed.";u.loading||b(e),e.includes("@terrastruct/d2")&&(x(!1),y(!0))}finally{i===D.current&&(T(!1),_.current&&(_.current=!1,G()))}},[V,J,u.darkThemeId,u.isDark,u.loading,u.progressiveRender,u.themeId,G,L]);s(()=>{z.current=Q},[Q]);const ee=d(async()=>{var e;try{(null==(e=null==navigator?void 0:navigator.clipboard)?void 0:e.writeText)&&await navigator.clipboard.writeText(V),f(!0),setTimeout(()=>f(!1),1e3)}catch{}},[V]),te=d(()=>{if(C)try{const e=new Blob([C],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}},[C]),ne=d((e,t)=>{var n;(n=e.currentTarget)&&!n.disabled&&Ke(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),u.isDark)},[u.isDark]),re=d(()=>{Ve()},[]);return s(()=>{G()},[V,u.loading,u.isDark,G]),s(()=>{u.loading||G(!0)},[u.loading,G]),s(()=>{const e=requestAnimationFrame(()=>Z());return()=>cancelAnimationFrame(e)},[q,C,V,Z]),s(()=>{A.current=!1,G();const e=requestAnimationFrame(()=>Z());if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{Z()});O.current=e,W.current&&e.observe(W.current)}return()=>{var t;A.current=!0,null!=F.current&&(clearTimeout(F.current),F.current=null),null==(t=O.current)||t.disconnect(),O.current=null,cancelAnimationFrame(e)}},[G,Z]),/* @__PURE__ */e("div",{ref:I,className:ct("d2-block my-4 rounded-lg border overflow-hidden shadow-sm",u.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"),children:[u.showHeader&&/* @__PURE__ */e("div",{className:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
|
|
35
35
|
/* @__PURE__ */t("div",{className:"flex items-center gap-x-2",children:/* @__PURE__ */t("span",{className:"text-sm font-medium font-mono",children:"D2"})}),
|
|
36
36
|
/* @__PURE__ */e("div",{className:"flex items-center gap-x-2",children:[u.showModeToggle&&/* @__PURE__ */e("div",{className:ct("flex items-center gap-x-1 rounded-md p-0.5",u.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
37
37
|
/* @__PURE__ */t("button",{type:"button",className:ct("mode-btn px-2 py-1 text-xs rounded",!v&&"is-active"),onClick:()=>y(!1),onMouseEnter:e=>ne(e,m("common.preview")||"Preview"),onFocus:e=>ne(e,m("common.preview")||"Preview"),onMouseLeave:re,onBlur:re,children:m("common.preview")||"Preview"}),
|
|
@@ -51,10 +51,10 @@ return t("div",{id:`fnref--${n.id}`,className:"footnote-node flex text-sm leadin
|
|
|
51
51
|
return t("sup",{id:`fnref-${r.id}`,className:"footnote-reference",onClick:a,children:/* @__PURE__ */e("span",{...l,title:`查看脚注 ${r.id}`,className:"footnote-link cursor-pointer",children:["[",r.id,"]"]})})}function Lt(e){/* @__PURE__ */
|
|
52
52
|
return t("br",{className:"hard-break"})}function Et(e){const{node:n,ctx:r,renderNode:o,indexKey:i,children:l}=e,a=Math.min(6,Math.max(1,Number(n.level)||1)),c=`h${a}`,s=null==n?void 0:n.attrs,{class:d,className:u,style:m,...h}=null!=s?s:{};/* @__PURE__ */
|
|
53
53
|
return t(c,{dir:"auto",className:ct("heading-node font-semibold",`heading-${a}`,d,u),..."object"==typeof m&&null!=m?{style:m}:{},...h,children:null!=l?l:r&&o?$(n.children,r,String(null!=i?i:`heading-${a}`),o):null})}function Dt(e){/* @__PURE__ */
|
|
54
|
-
return t("mark",{className:"highlight-node",children:e.children})}function $t(l){var a,d,u,x,k,b,C,N;const{node:M,placeholder:B,customId:S}=l,T=null!=(u=null!=(d=l.htmlPolicy)?d:null==(a=l.ctx)?void 0:a.htmlPolicy)?u:"safe",L=Ee(),[E,D]=i(null),P=c(null),[A,R]=i(()=>"undefined"==typeof window),[F,
|
|
54
|
+
return t("mark",{className:"highlight-node",children:e.children})}function $t(l){var a,d,u,x,k,b,C,N;const{node:M,placeholder:B,customId:S}=l,T=null!=(u=null!=(d=l.htmlPolicy)?d:null==(a=l.ctx)?void 0:a.htmlPolicy)?u:"safe",L=Ee(),[E,D]=i(null),P=c(null),[A,R]=i(()=>"undefined"==typeof window),[F,_]=i(M.content),I=Boolean(M.loading),H=m(z,K,K),W=o(()=>{var e,t,n,r,o;return{...null!=(n=null!=(t=l.customComponents)?t:null==(e=l.ctx)?void 0:e.customComponents)?n:V(S),...null!=(o=null==(r=l.ctx)?void 0:r.htmlComponents)?o:{}}},[S,null==(x=l.ctx)?void 0:x.customComponents,null==(k=l.ctx)?void 0:k.htmlComponents,l.customComponents,H]),O=o(()=>{var e,t;return{...W,...null!=(t=null==(e=l.ctx)?void 0:e.streamingComponents)?t:{}}},[W,null==(b=l.ctx)?void 0:b.streamingComponents]);s(()=>{var e;if("undefined"==typeof window)return void R(!0);if(null==(e=P.current)||e.destroy(),P.current=null,!I)return R(!0),void _(M.content);if(!E)return void R(!1);const t=L(E,{rootMargin:"400px"});return P.current=t,t.isVisible()&&R(!0),t.whenVisible.then(()=>R(!0)).catch(()=>{}),()=>{t.destroy(),P.current=null}},[E,I,M.content,L]),s(()=>()=>{var e;null==(e=P.current)||e.destroy(),P.current=null},[]),s(()=>{I&&!A||_(M.content)},[I,M.content,A]);const j=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T));return t?X(t):void 0},[T,M.attrs]),Z=o(()=>{var e;return String(null!=(e=M.tag)?e:"").trim()},[M.tag]),G=o(()=>f(Z),[Z]),J=o(()=>{var e;const t=q(h(null!=(e=M.attrs)?e:void 0,T,Z));return t?X(t):void 0},[T,M.attrs,Z]),Q=o(()=>{var e;return p(g(h(null!=(e=M.attrs)?e:void 0,T,G)))},[T,M.attrs,G]),ee=o(()=>Array.isArray(M.children)?M.children:[],[M.children]),te=ee.length>0&&!!Z&&!v.has(Z.toLowerCase())&&!y(Z,T)&&!!l.ctx&&!!l.renderNode,ne=o(()=>function(e){const t={...e||{}},n="string"==typeof t.className?t.className.trim():"";return t.className=n?`html-block-node ${n}`:"html-block-node",t}(J),[J]),re=o(()=>{var e;return"escape"!==T&&U(null!=(e=M.content)?e:"",O)},[O,T,M.content]),oe=o(()=>{var e,t,n;return re&&M.content?Y(M.content,W,T,{ctx:l.ctx,keyPrefix:String(null!=(e=l.indexKey)?e:"html-block"),nodeComponents:null==(t=l.ctx)?void 0:t.streamingComponents,propComponents:null==(n=l.ctx)?void 0:n.htmlComponents,renderNode:l.renderNode,sourceNode:M}):null},[W,T,M.autoClosed,M.content,M.loading,l.ctx,l.indexKey,l.renderNode,re]),ie=o(()=>w(null!=F?F:"",T),[T,F]),le=o(()=>{var e;return te&&l.ctx&&l.renderNode?$(ee,l.ctx,`${String(null!=(e=l.indexKey)?e:"html-block")}-structured`,l.renderNode):null},[te,l.ctx,l.indexKey,l.renderNode,ee]),ae=G?null==(N=null==(C=l.ctx)?void 0:C.htmlComponents)?void 0:N[G]:void 0,ce=/* @__PURE__ */t("div",{className:"html-block-node__placeholder",children:null!=B?B:/* @__PURE__ */e(n,{children:[
|
|
55
55
|
/* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar"}),
|
|
56
56
|
/* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-4/5"}),
|
|
57
|
-
/* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-2/3"})]})});return te&&ae?r.createElement(ae,Q,le):te?r.createElement(Z,{...ne,ref:D},A?le:ce):/* @__PURE__ */t("div",{ref:D,className:"html-block-node",...j,children:A?re&&oe?/* @__PURE__ */t(n,{children:oe}):/* @__PURE__ */t("div",{dangerouslySetInnerHTML:{__html:ie}}):ce})}const Pt=(()=>{try{return Boolean(!1)}catch{}return!1})();function At(e){Pt&&console.warn(e)}function Rt(e,t,n=!1){const r=Object.entries(null!=t?t:{}),o=r.length>0?r.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function Ft(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function
|
|
57
|
+
/* @__PURE__ */t("span",{className:"html-block-node__placeholder-bar w-2/3"})]})});return te&&ae?r.createElement(ae,Q,le):te?r.createElement(Z,{...ne,ref:D},A?le:ce):/* @__PURE__ */t("div",{ref:D,className:"html-block-node",...j,children:A?re&&oe?/* @__PURE__ */t(n,{children:oe}):/* @__PURE__ */t("div",{dangerouslySetInnerHTML:{__html:ie}}):ce})}const Pt=(()=>{try{return Boolean(!1)}catch{}return!1})();function At(e){Pt&&console.warn(e)}function Rt(e,t,n=!1){const r=Object.entries(null!=t?t:{}),o=r.length>0?r.map(([e,t])=>""===t?` ${e}`:` ${e}="${t}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function Ft(e,t){Array.isArray(t)?e.push(...t):null!=t&&e.push(t)}function _t(e,t){var n;for(const r of Z(e)){if("tag_open"!==r.type&&"self_closing"!==r.type)continue;const e=null!=(n=r.tagName)?n:"";if(!G(e,t))continue;const o=t[e]||t[e.toLowerCase()];if("block"===J(o))return!0}return!1}function It(e,t){var n,r;return(null==(n=t.nodeComponents)?void 0:n[e])||(null==(r=t.nodeComponents)?void 0:r[e.toLowerCase()])}function Ht(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e))return e.map(Ht).join("");if(!r.isValidElement(e))return"";const t=e;if("string"!=typeof t.type)return Ht(t.props.children);const n=Object.entries(t.props).filter(([e,t])=>"children"!==e&&"key"!==e&&"ref"!==e&&null!=t&&"boolean"!=typeof t).map(([e,t])=>` ${"className"===e?"class":e}="${String(t)}"`).join("");return`<${t.type}${n}>${Ht(t.props.children)}</${t.type}>`}function Wt(e){return Object.entries(e).map(([e,t])=>[e,""===t?null:t])}function Ot(e){var t,n;const r=e.sourceNode,o=!0!==(null==(t=e.ctx)?void 0:t.final)&&(!1===(null==(n=e.ctx)?void 0:n.final)||Boolean(null==r?void 0:r.loading));return{loading:o,autoClosed:o||Boolean(null==r?void 0:r.autoClosed)}}function jt(e,t,n,o,i,l,a,c,s,d){const u=G(e,o),m=Boolean(It(e,a));if(x.has(e.toLowerCase())||!u&&!m&&k(e,l))return null;if(!u&&!m&&y(e,l))return[Rt(e,t),...n,`</${e}>`];const h=Q(t,l,e),g=h.key,v=null!=g&&""!==g?g:i;if(m)return function(e,t,n,o,i,l,a,c=Ot(i)){const s=f(e),d=null!=l?l:function(e){return e.map(Ht).join("")}(n),u={type:s,tag:s,attrs:Wt(t),content:d,raw:null!=a?a:`${Rt(e,t)}${d}</${e}>`,loading:c.loading,autoClosed:c.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,o,i.ctx);const m=It(e,i);return m?r.createElement(m,{key:o,node:u}):null}(e,t,n,String(v),a,c,s,d);if(u){const t=o[e]||o[e.toLowerCase()],i=p(h);return r.createElement(t,{...i,key:v},...n)}return r.createElement(e,{...X(h),key:v},...n)}function zt(e){var o,l,a,d,u,m,v,b;const{node:C,customId:N}=e,M=null!=(a=null!=(l=e.htmlPolicy)?l:null==(o=e.ctx)?void 0:o.htmlPolicy)?a:"safe",B=c(null),[S,T]=i(!1);s(()=>{T(!0)},[]);const L=r.useMemo(()=>{var t,n,r,o;return{...null!=(n=null==(t=e.ctx)?void 0:t.customComponents)?n:V(N),...null!=(o=null==(r=e.ctx)?void 0:r.htmlComponents)?o:{}}},[N,null==(d=e.ctx)?void 0:d.customComponents,null==(u=e.ctx)?void 0:u.htmlComponents]),E=r.useMemo(()=>{var t,n;return{...L,...null!=(n=null==(t=e.ctx)?void 0:t.streamingComponents)?n:{}}},[L,null==(m=e.ctx)?void 0:m.streamingComponents]),D=r.useMemo(()=>{var e;return w(null!=(e=C.content)?e:"",M)},[M,C.content]),P=r.useMemo(()=>{var e;return String(null!=(e=C.tag)?e:"").trim()},[C.tag]),A=r.useMemo(()=>f(P),[P]),R=r.useMemo(()=>Array.isArray(C.children)?C.children:[],[C.children]),F=r.useMemo(()=>{var e;return p(g(h(null!=(e=C.attrs)?e:void 0,M,A)))},[M,C.attrs,A]),_=A?null==(b=null==(v=e.ctx)?void 0:v.htmlComponents)?void 0:b[A]:void 0,I=R.length>0&&!!P&&"escape"!==M&&!y(P,M)&&!!e.ctx&&!!e.renderNode&&!!_,H=r.useMemo(()=>{var t;return I&&e.ctx&&e.renderNode?$(R,e.ctx,`${String(null!=(t=e.indexKey)?t:"html-inline")}-structured`,e.renderNode):null},[I,e.ctx,e.indexKey,e.renderNode,R]),W=r.useMemo(()=>{var t,n;const r=C.content;if(!r)return{mode:"html",content:""};if("escape"===M)return{mode:"html",content:r};if(!U(r,E))return{mode:"html",content:r};const o=function(e,t,n="safe",r={}){if(!e)return[];try{const o=function(e,t,n="safe",r={}){var o;let i=0;const l=null!=(o=r.keyPrefix)?o:"ms-html",a=[],c=[];for(const s of e)if("text"===s.type){if(a.length>0&&a[a.length-1].hardBlocked)continue;(a.length>0?a[a.length-1].children:c).push(s.content),a.length>0&&a[a.length-1].sourceParts.push(s.content)}else if("self_closing"===s.type){const e=s.attrs||{},o=Rt(s.tagName,e,!0),d=G(s.tagName,t),u=Boolean(It(s.tagName,r));if(x.has(s.tagName.toLowerCase())||!d&&!u&&k(s.tagName,n))continue;if(!d&&!u&&y(s.tagName,n)){(a.length>0?a[a.length-1].children:c).push(o),a.length>0&&a[a.length-1].sourceParts.push(o);continue}const m=jt(s.tagName,e,[],t,`${l}-${i++}`,n,r,"",o,{loading:!1,autoClosed:!1});Ft(a.length>0?a[a.length-1].children:c,m),a.length>0&&a[a.length-1].sourceParts.push(o)}else if("tag_open"===s.type){const e=a.length>0&&a[a.length-1].hardBlocked,o=G(s.tagName,t),i=Boolean(It(s.tagName,r));a.push({tagName:s.tagName,children:[],attrs:s.attrs,sourceParts:[],customComponent:o||i,hardBlocked:e||x.has(s.tagName.toLowerCase())||!o&&!i&&k(s.tagName,n),softBlocked:!e&&!o&&!i&&y(s.tagName,n)})}else if("tag_close"===s.type){const e=s.tagName.toLowerCase();let o=-1;for(let t=a.length-1;t>=0;t--)if(a[t].tagName.toLowerCase()===e){o=t;break}if(-1!==o)for(;a.length>o;){const s=a.pop(),d=s.sourceParts.join(""),u=`${Rt(s.tagName,s.attrs||{})}${d}</${s.tagName}>`;let m;if(s.hardBlocked)m=null;else if(s.softBlocked)m=[Rt(s.tagName,s.attrs||{}),...s.children,`</${s.tagName}>`];else{const o=s.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Ot(r);m=jt(s.tagName,s.attrs||{},s.children,t,`${l}-${i++}`,n,r,d,u,o)}a.length>0?Ft(a[a.length-1].children,m):Ft(c,m),a.length>0&&!s.hardBlocked&&a[a.length-1].sourceParts.push(u),s.tagName.toLowerCase()!==e&&a.length>o&&At(`Auto-closing unclosed tag: <${s.tagName}>`)}else At(`Ignoring closing tag with no matching opening tag: </${s.tagName}>`)}for(;a.length>0;){const e=a.pop(),o=e.sourceParts.join(""),s=`${Rt(e.tagName,e.attrs||{})}${o}`;let d;d=e.hardBlocked?null:e.softBlocked?[Rt(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:jt(e.tagName,e.attrs||{},e.children,t,`${l}-${i++}`,n,r,o,s,Ot(r)),Ft(c,d),a.length>0&&!e.hardBlocked&&a[a.length-1].sourceParts.push(s),At(`Auto-closing unclosed tag: <${e.tagName}>`)}return c}(Z(e),t,n,r);return o}catch(i){return o=i,Pt&&console.error("Failed to parse HTML to React nodes:",o),null}var o}(r,L,M,{ctx:e.ctx,keyPrefix:String(null!=(t=e.indexKey)?t:"html-inline"),nodeComponents:null==(n=e.ctx)?void 0:n.streamingComponents,renderNode:e.renderNode,sourceNode:C});return null===o?{mode:"html",content:r}:{mode:"dynamic",block:_t(r,E),nodes:o}},[L,E,M,C.autoClosed,C.content,C.loading,e.ctx,e.indexKey,e.renderNode]);return s(()=>{if(!S||!B.current||"html"!==W.mode)return;const e=B.current;e.innerHTML="";const t=document.createElement("template");t.innerHTML=D,e.appendChild(t.content.cloneNode(!0))},[W.mode,S,D]),!C.loading||C.autoClosed||I||"dynamic"===W.mode?I?r.createElement(_,F,H):"dynamic"===W.mode?W.block?/* @__PURE__ */t(n,{children:W.nodes}):/* @__PURE__ */t("span",{className:"html-inline-node",style:{display:"inline"},children:W.nodes}):/* @__PURE__ */t("span",{ref:B,className:"html-inline-node",style:{display:"inline"}}):/* @__PURE__ */t("span",{className:"html-inline-node html-inline-node--loading",children:C.content})}const Kt={fallbackSrc:"",lazy:!0,usePlaceholder:!0};function Vt(e,t,n){return n||e?{src:e,stage:"primary"}:t?{src:t,stage:"fallback"}:{src:"",stage:"failed"}}function qt(r){var o,l,a,c,d,u;const m={...Kt,...r},h=b(m.node.src),f=b(m.fallbackSrc),p=Vt(h,f,m.node.loading),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(p.src),[C,N]=i(p.stage),M=x;s(()=>{const e=Vt(h,f,m.node.loading);k(e.src),N(e.stage),v(!1),w("failed"===e.stage)},[h,f,m.node.loading]);return!m.node.loading&&"failed"!==C&&M?/* @__PURE__ */t("img",{src:M,alt:String(null!=(l=null!=(o=m.node.alt)?o:m.node.title)?l:""),title:String(null!=(c=null!=(a=m.node.title)?a:m.node.alt)?c:""),className:"image-node__img"+(g?" is-loaded":""),loading:m.lazy?"lazy":"eager",decoding:"async",tabIndex:g?0:-1,"aria-label":null!=(d=m.node.alt)?d:"Preview image",onError:()=>{var e;if("primary"===C&&f&&f!==x)return k(f),N("fallback"),v(!1),void w(!1);N("failed"),w(!0),null==(e=m.onError)||e.call(m,x)},onLoad:()=>{var e;v(!0),w(!1),null==(e=m.onLoad)||e.call(m,M)},onClick:e=>{var t;e.preventDefault(),g&&!y&&(null==(t=m.onClick)||t.call(m,[e,M]))}},"image"):m.node.loading&&!y?/* @__PURE__ */t("span",{className:"image-node__placeholder",children:m.usePlaceholder?/* @__PURE__ */e(n,{children:[
|
|
58
58
|
/* @__PURE__ */t("span",{className:"image-node__spinner","aria-hidden":"true"}),
|
|
59
59
|
/* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:"Loading image..."})]}):/* @__PURE__ */t("span",{className:"image-node__placeholder-text",children:null!=(u=m.node.raw)?u:"Loading image…"})},"placeholder"):m.node.loading||"failed"!==C?null:/* @__PURE__ */e("span",{className:"image-node__error",children:[
|
|
60
60
|
/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:/* @__PURE__ */t("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})}),
|
|
@@ -63,9 +63,9 @@ return t("mark",{className:"highlight-node",children:e.children})}function $t(l)
|
|
|
63
63
|
/* @__PURE__ */t("path",{d:"M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z",fill:"#FFCCCC"}),
|
|
64
64
|
/* @__PURE__ */t("path",{d:"M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z",fill:"#FF939F"}),
|
|
65
65
|
/* @__PURE__ */t("path",{d:"M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z",fill:"#FF356A"}),
|
|
66
|
-
/* @__PURE__ */t("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Zt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Gt(r){var l;const a={...Zt,...r},{t:u}=Re(),[m,h]=i(!1),[f,p]=i(!1),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(()=>"undefined"==typeof window),b=a.node.code,C=o(()=>a.maxHeight&&"none"!==a.maxHeight?ee(a.maxHeight):null,[a.maxHeight]),N=o(()=>{var e;return te(null!=(e=ee(a.estimatedPreviewHeightPx))?e:ne(b),void 0,C)},[b,C,a.estimatedPreviewHeightPx]),[M,B]=i(`${N}px`),[S,T]=i(!1),[L,E]=i(
|
|
66
|
+
/* @__PURE__ */t("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Zt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Gt(r){var l;const a={...Zt,...r},{t:u}=Re(),[m,h]=i(!1),[f,p]=i(!1),[g,v]=i(!1),[y,w]=i(!1),[x,k]=i(()=>"undefined"==typeof window),b=a.node.code,C=o(()=>a.maxHeight&&"none"!==a.maxHeight?ee(a.maxHeight):null,[a.maxHeight]),N=o(()=>{var e;return te(null!=(e=ee(a.estimatedPreviewHeightPx))?e:ne(b),void 0,C)},[b,C,a.estimatedPreviewHeightPx]),[M,B]=i(`${N}px`),[S,T]=i(!1),[L,E]=i(1),[D,$]=i({x:0,y:0}),[P,A]=i(!1),R=c(null),F=c(null),_=c(null),I=c(null),H=c(null),W=c({x:0,y:0}),O=c(null),j=Ee(),z=d(e=>{if(!a.maxHeight||"none"===a.maxHeight)return`${Math.max(e,N)}px`;const t=Number.parseFloat(String(a.maxHeight));return Number.isFinite(t)?`${Math.max(Math.min(e,t),N)}px`:`${Math.max(e,N)}px`},[N,a.maxHeight]),K=d(()=>{const e=R.current;if(!e)return;const t=e.scrollHeight;t>0&&B(z(t))},[z]);s(()=>{g||f||B(e=>{const t=ee(e);return null!=t&&t>=N?e:`${N}px`})},[N,f,g]);const V=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(b)),h(!0),null==(t=a.onCopy)||t.call(a,b),setTimeout(()=>h(!1),1e3)}catch{}},[b,a]),q=d(async()=>{var e,t;if(!x)return;if(!R.current)return;const n=R.current;try{const r=await async function(){return Ut||Xt||(Xt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),Ut=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),Xt)}();if(!r)return void console.warn("Infographic library failed to load.");O.current&&(null==(t=(e=O.current).destroy)||t.call(e),O.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});O.current=o,o.render(b),T(!0),setTimeout(()=>{K()},0)}catch(r){console.error("Failed to render infographic:",r),T(!1),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[b,K,x]);s(()=>{const e=F.current;if(!e)return;const t=j(e,{rootMargin:"160px"});return _.current=t,t.isVisible()&&k(!0),t.whenVisible.then(()=>k(!0)),()=>{t.destroy(),_.current=null}},[j]),s(()=>{!x||g||f||q()},[b,f,q,g,x]),s(()=>()=>{var e,t;O.current&&(null==(t=(e=O.current).destroy)||t.call(e),O.current=null)},[]);const X=d(()=>{w(!1),I.current&&(I.current.innerHTML=""),H.current=null,document.body.style.overflow=""},[]),U=d(()=>{w(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!y)return;const e=e=>{"Escape"===e.key&&X()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y,X]),s(()=>{y&&setTimeout(()=>{if(R.current&&I.current){I.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=R.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),I.current.appendChild(e),H.current=e,e.style.transform=`translate(${D.x}px, ${D.y}px) scale(${L})`}},0)},[y]),s(()=>{y&&H.current&&(H.current.style.transform=`translate(${D.x}px, ${D.y}px) scale(${L})`)},[y,D,L]);const Y=d(()=>{var e;const t=null==(e=R.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),Z=e=>{A(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;W.current={x:t-D.x,y:n-D.y}},G=e=>{if(!P)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;$({x:t-W.current.x,y:n-W.current.y})},J=()=>A(!1),Q=a.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",re=g||f;/* @__PURE__ */
|
|
67
67
|
return e(n,{children:[
|
|
68
|
-
/* @__PURE__ */e("div",{ref:
|
|
68
|
+
/* @__PURE__ */e("div",{ref:F,"data-markstream-infographic":"1","data-markstream-mode":g?"source":S?"preview":"pending",className:ct("my-4 rounded-lg border overflow-hidden shadow-sm",a.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":a.loading}),children:[a.showHeader&&/* @__PURE__ */e("div",{className:ct("flex justify-between items-center px-4 py-2.5 border-b",a.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
|
|
69
69
|
/* @__PURE__ */e("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Yt,
|
|
70
70
|
/* @__PURE__ */t("span",{className:ct("text-sm font-medium font-mono truncate",a.isDark?"text-gray-400":"text-gray-600"),children:"Infographic"})]}),a.showModeToggle&&/* @__PURE__ */e("div",{className:ct("flex items-center gap-x-1 rounded-md p-0.5",a.isDark?"bg-gray-700":"bg-gray-100"),children:[
|
|
71
71
|
/* @__PURE__ */t("button",{className:ct("px-2.5 py-1 text-xs rounded transition-colors",g?a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"),onClick:()=>v(!1),onMouseEnter:e=>Ke(e.currentTarget,u("common.preview")||"Preview","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
|
|
@@ -76,23 +76,22 @@ return e(n,{children:[
|
|
|
76
76
|
/* @__PURE__ */t("button",{className:ct("px-2.5 py-1 text-xs rounded transition-colors",g?a.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":a.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>v(!0),onMouseEnter:e=>Ke(e.currentTarget,u("common.source")||"Source","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[
|
|
77
77
|
/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
|
|
78
78
|
/* @__PURE__ */t("span",{children:u("common.source")||"Source"})]})})]}),
|
|
79
|
-
/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[a.showCollapseButton&&/* @__PURE__ */t("button",{className:
|
|
79
|
+
/* @__PURE__ */e("div",{className:"flex items-center gap-x-1",children:[a.showCollapseButton&&/* @__PURE__ */t("button",{className:Q,onClick:()=>p(!f),onMouseEnter:e=>Ke(e.currentTarget,f?u("common.expand")||"Expand":u("common.collapse")||"Collapse","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */t("svg",{style:{rotate:f?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),a.showCopyButton&&/* @__PURE__ */t("button",{className:Q,onClick:V,onMouseEnter:e=>Ke(e.currentTarget,m?u("common.copied")||"Copied":u("common.copy")||"Copy","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */t("svg",m?{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
80
80
|
/* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
81
|
-
/* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),a.showExportButton&&/* @__PURE__ */t("button",{className:ct(
|
|
81
|
+
/* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),a.showExportButton&&/* @__PURE__ */t("button",{className:ct(Q,re&&"opacity-50 cursor-not-allowed"),disabled:re,onClick:Y,onMouseEnter:e=>Ke(e.currentTarget,u("common.export")||"Export","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
82
82
|
/* @__PURE__ */t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
83
|
-
/* @__PURE__ */t("path",{d:"m7 10l5 5l5-5"})]})})}),a.showFullscreenButton&&/* @__PURE__ */t("button",{className:ct(
|
|
84
|
-
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()
|
|
85
|
-
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()
|
|
86
|
-
/* @__PURE__ */e("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */t("div",{className:
|
|
89
|
-
/* @__PURE__ */t("div",{className:"markstream-react fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:Z,role:"dialog","aria-modal":"true",children:/* @__PURE__ */e("div",{className:ct("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",a.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
|
|
83
|
+
/* @__PURE__ */t("path",{d:"m7 10l5 5l5-5"})]})})}),a.showFullscreenButton&&/* @__PURE__ */t("button",{className:ct(Q,re&&"opacity-50 cursor-not-allowed"),disabled:re,onClick:U,onMouseEnter:e=>Ke(e.currentTarget,y?u("common.minimize")||"Minimize":u("common.open")||"Open","top",!1,0,a.isDark),onMouseLeave:()=>Ve(),children:/* @__PURE__ */t("svg",y?{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"})}:{xmlns:"http://www.w3.org/2000/svg",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"})})})]})]}),!f&&/* @__PURE__ */t("div",{children:g?/* @__PURE__ */t("div",{className:ct("p-4",a.isDark?"bg-gray-900":"bg-gray-50"),children:/* @__PURE__ */t("pre",{className:ct("text-sm font-mono whitespace-pre-wrap",a.isDark?"text-gray-300":"text-gray-700"),children:b})}):/* @__PURE__ */e("div",{className:"relative",children:[a.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
84
|
+
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.min(L+.1,3)),children:"+"}),
|
|
85
|
+
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.max(L-.1,.5)),children:"-"}),
|
|
86
|
+
/* @__PURE__ */e("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{E(1),$({x:0,y:0})},children:[Math.round(100*L),"%"]})]})}),
|
|
87
|
+
/* @__PURE__ */t("div",{className:ct("infographic-preview min-h-[360px] relative transition-all duration-100 overflow-hidden block",a.isDark?"bg-gray-900":"bg-gray-50"),style:{height:M,maxHeight:null!=(l=a.maxHeight)?l:void 0},onMouseDown:Z,onMouseMove:G,onMouseUp:J,onMouseLeave:J,onTouchStart:Z,onTouchMove:G,onTouchEnd:J,children:/* @__PURE__ */t("div",{className:ct("absolute inset-0 cursor-grab",P&&"cursor-grabbing"),style:{transform:`translate(${D.x}px, ${D.y}px) scale(${L})`},children:/* @__PURE__ */t("div",{ref:R,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),y&&"undefined"!=typeof document&&xe(
|
|
88
|
+
/* @__PURE__ */t("div",{className:"markstream-react fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:X,role:"dialog","aria-modal":"true",children:/* @__PURE__ */e("div",{className:ct("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",a.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
|
|
90
89
|
/* @__PURE__ */e("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
|
|
91
|
-
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()
|
|
92
|
-
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()
|
|
93
|
-
/* @__PURE__ */e("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{
|
|
94
|
-
/* @__PURE__ */t("button",{className:ct("inline-flex items-center justify-center p-2 rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:
|
|
95
|
-
/* @__PURE__ */t("div",{ref:
|
|
90
|
+
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.min(L+.1,3)),children:"+"}),
|
|
91
|
+
/* @__PURE__ */t("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>E(Math.max(L-.1,.5)),children:"-"}),
|
|
92
|
+
/* @__PURE__ */e("button",{className:ct("p-2 text-xs rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{E(1),$({x:0,y:0})},children:[Math.round(100*L),"%"]}),
|
|
93
|
+
/* @__PURE__ */t("button",{className:ct("inline-flex items-center justify-center p-2 rounded transition-colors",a.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:X,children:"X"})]}),
|
|
94
|
+
/* @__PURE__ */t("div",{ref:I,className:ct("w-full h-full flex items-center justify-center p-4 overflow-hidden",!P&&"cursor-grab",P&&"cursor-grabbing"),onMouseDown:Z,onMouseMove:G,onMouseUp:J,onMouseLeave:J,onTouchStart:Z,onTouchMove:G,onTouchEnd:J})]})}),document.body)]})}function Jt(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function Qt(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.code)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Me(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?Jt(e):e);else g(e=>{var t;return 1!==e.length||(null==(t=e[0])?void 0:t.fading)||e[0].content!==m?m?[{id:w.current++,content:m,fading:!1}]:[]:e});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:l||p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ct("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?Jt(e,t):e);var t}:void 0,children:e.content},e.id))})}function en(e){/* @__PURE__ */
|
|
96
95
|
return t("ins",{className:"insert-node",children:e.children})}function tn(e,t){return e.reduce((e,n)=>{const r=null==t||n.id===t?{...n,fading:!1}:n,o=e[e.length-1];return!o||o.fading||r.fading?e.push(r):e[e.length-1]={...o,content:o.content+r.content},e},[])}function nn({content:e}){const n=c(e),r=c(n.current),o=c(null);return s(()=>{const t=o.current;if(t)if(e.startsWith(r.current)){const n=e.slice(r.current.length);n&&t.appendChild(document.createTextNode(n)),r.current=e}else t.textContent=e,r.current=e},[e]),/* @__PURE__ */t("span",{ref:o,children:n.current})}function rn(e){var n,r;const{node:o,children:l,ctx:a,indexKey:d,fade:u}=e,m=String(null!=(n=o.content)?n:""),h=null==(r=null!=u?u:null==a?void 0:a.fade)||r,f=null==d||""===d?"":String(d),[p,g]=i(m?[{id:0,content:m,fading:!1}]:[]),v=Me(),y=c(m),w=c(1),x=c(void 0);return s(()=>{var e,t;const n=null!=(e=null==v?void 0:v.getStreamRenderVersion())?e:null==a?void 0:a.streamRenderVersion,r=n!==x.current;if(null!=l)return y.current="",g([]),void(x.current=n);const o=null!=(t=null==v?void 0:v.textStreamState)?t:null==a?void 0:a.textStreamState,i=f?null==o?void 0:o.get(f):void 0;let c=y.current;const s=Boolean(c===m&&i&&m.startsWith(i)&&m.length>i.length);if(s&&(c=i),h)if(m!==c)if(c&&m.startsWith(c)){const e=m.slice(c.length);g(t=>{if(s)return[{id:w.current++,content:c,fading:!1},{id:w.current++,content:e,fading:!0}];const n=t[t.length-1];return(null==n?void 0:n.fading)?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:w.current++,content:e,fading:!0}]})}else g(m?[{id:w.current++,content:m,fading:!1}]:[]);else r&&g(e=>e.some(e=>e.fading)?tn(e):e);else g(e=>{if(!m)return[];const t=e.reduce((e,t)=>e+t.content,"");return m===t?e:m.startsWith(t)?[...e,{id:w.current++,content:m.slice(t.length),fading:!1}]:[{id:w.current++,content:m,fading:!1}]});y.current=m,x.current=n,f&&(null==o||o.set(f,m))},[l,m,v,null==a?void 0:a.textStreamState,null==a?void 0:a.streamRenderVersion,f,h]),/* @__PURE__ */t("span",null!=l?{className:ct("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:l}:{className:ct("text-node whitespace-pre-wrap break-words",o.center&&"text-node-center"),children:p.map(e=>/* @__PURE__ */t("span",{className:e.fading?ct("text-node-stream-delta",e.id%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b"):void 0,onAnimationEnd:e.fading?()=>{return t=e.id,void g(e=>e.some(e=>e.id===t&&e.fading)?tn(e,t):e);var t}:void 0,children:e.fading?e.content:/* @__PURE__ */t(nn,{content:e.content})},e.id))})}function on(n){var r,i,l;const{node:a,ctx:c,renderNode:s,indexKey:u}=n,m=!1!==n.showTooltip,h=null!=(r=n.isDark)?r:null==c?void 0:c.isDark,f=o(()=>{var e,t,r,o,i,l;const a=void 0!==n.underlineBottom?"number"==typeof n.underlineBottom?`${n.underlineBottom}px`:String(n.underlineBottom):"-3px",c=null!=(e=n.animationOpacity)?e:.35,s=Math.max(.12,Math.min(.5*c,c));return{"--link-color":null!=(t=n.color)?t:"#0366d6","--underline-height":`${null!=(r=n.underlineHeight)?r:2}px`,"--underline-bottom":a,"--underline-opacity":String(c),"--underline-rest-opacity":String(s),"--underline-duration":`${null!=(o=n.animationDuration)?o:1.6}s`,"--underline-timing":null!=(i=n.animationTiming)?i:"ease-in-out","--underline-iteration":"number"==typeof n.animationIteration?String(n.animationIteration):null!=(l=n.animationIteration)?l:"infinite"}},[n.animationDuration,n.animationIteration,n.animationOpacity,n.animationTiming,n.color,n.underlineBottom,n.underlineHeight]),p=o(()=>{var e;return C({href:String(null!=(e=a.href)?e:"")}).href},[a.href]),g="string"==typeof a.title&&a.title.trim().length>0?a.title:String(null!=p?p:""),v=N(p),y=d(e=>{m&&Ke(e.currentTarget,String(a.title||p||a.text||""),"top",!1,(e.clientX,e.clientY),h)},[h,a.text,a.title,p,m]),w=d(()=>{m&&Ve()},[m]);return a.loading?/* @__PURE__ */t("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:f,children:/* @__PURE__ */e("span",{className:"link-text-wrapper relative inline-flex",children:[
|
|
97
96
|
/* @__PURE__ */t("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */t(rn,{node:{type:"text",content:String(null!=(i=a.text)?i:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-loading`,typewriter:n.typewriter})}),
|
|
98
97
|
/* @__PURE__ */t("span",{className:"link-loading-indicator","aria-hidden":"true"})]})}):/* @__PURE__ */t("a",{className:"link-node",href:p||void 0,title:m?"":g,"aria-label":`Link: ${g}`,target:v?"_blank":void 0,rel:v?"noopener noreferrer":void 0,style:f,onMouseEnter:y,onMouseLeave:w,children:c&&s?$(a.children,c,String(null!=u?u:"link"),s):/* @__PURE__ */t(rn,{node:{type:"text",content:String(null!=(l=a.text)?l:"")},ctx:c,indexKey:`${String(null!=u?u:"link")}-fallback`,typewriter:n.typewriter})})}function ln(e){const{node:n,ctx:r,renderNode:o,value:i,indexKey:l,children:a}=e;/* @__PURE__ */
|
|
@@ -101,7 +100,7 @@ return t(a,{className:ct("list-node my-5 pl-[calc(13/8*1em)]",r.ordered?"list-de
|
|
|
101
100
|
return t(s,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,renderNode:i,indexKey:`${String(null!=l?l:"list")}-${n}`,customId:null==o?void 0:o.customId,isDark:null==o?void 0:o.isDark,typewriter:null==o?void 0:o.typewriter},`${String(null!=l?l:"list")}-${n}`)})})}let cn=null,sn=null,dn=!1;const un=/* @__PURE__ */new Map,mn=/* @__PURE__ */new Map;let hn=5;const fn=/* @__PURE__ */new Set;function pn(){if(un.size<hn&&fn.size){const e=Array.from(fn);fn.clear();for(const t of e)try{t()}catch{}}}function gn(e){cn=e,sn=null,cn.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=un.get(t);if(o)if(un.delete(t),clearTimeout(o.timeoutId),pn(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(mn.set(e,n),mn.size>200){const e=mn.keys().next().value;mn.delete(e)}}o.resolve(n)}},cn.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of un.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));un.clear(),pn()}}function vn(){var e;cn&&(null==(e=cn.terminate)||e.call(cn)),cn=null,sn=null}function yn(e){dn=!!e,cn&&cn.postMessage({type:"init",debug:dn})}const wn="WORKER_BUSY";async function xn(e,t=!0,n=2e3,r){performance.now();const o=re(e);if(sn)return Promise.reject(sn);const i=`${t?"d":"i"}:${o}`,l=mn.get(i);if(l)return Promise.resolve(l);const a=cn||(sn=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),sn.name="WORKER_INIT_ERROR",sn.code="WORKER_INIT_ERROR",null);if(!a)return Promise.reject(sn);if(un.size>=hn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=wn,e.busy=!0,e.inFlight=un.size,e.max=hn,Promise.reject(e)}return new Promise((e,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const l=Math.random().toString(36).slice(2),c=setTimeout(()=>{un.delete(l);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),pn()},n),s=()=>{},d=()=>{un.delete(l),clearTimeout(c),fn.delete(s);const e=new Error("Aborted");e.name="AbortError",i(e),pn()};r&&r.addEventListener("abort",d,{once:!0}),un.set(l,{resolve:t=>{r&&r.removeEventListener("abort",d),e(t)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:c});try{a.postMessage({id:l,content:o,displayMode:t,debug:dn})}catch(u){un.delete(l),clearTimeout(c),r&&r.removeEventListener("abort",d),i(u),pn()}})}function kn(e,t,n){const r=`${t?"d":"i"}:${re(e)}`;if(mn.set(r,n),mn.size>200){const e=mn.keys().next().value;mn.delete(e)}}function bn(){mn.clear()}function Cn(e){hn=Math.max(1,Math.floor(e)),pn()}function Nn(e=1500,t){return un.size<hn?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){fn.delete(l),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function l(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),fn.add(l)})}const Mn={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Bn(e){null!=e.timeout&&(Mn.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Mn.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Mn.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Mn.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Sn(){return{...Mn}}async function Tn(e,t=!0,n={}){var r,o,i,l;const a=null!=(r=n.timeout)?r:Mn.timeout,c=null!=(o=n.waitTimeout)?o:Mn.waitTimeout,s=null!=(i=n.backoffMs)?i:Mn.backoffMs,d=null!=(l=n.maxRetries)?l:Mn.maxRetries,u=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Mn.maxRetries,m=n.signal;let h=0;for(;;){if(null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await xn(e,t,a,m)}catch(f){if((null==f?void 0:f.code)!==wn||h>=u)throw f;if(h++,await Nn(c,m).catch(()=>{}),null==m?void 0:m.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}s>0&&await new Promise(e=>setTimeout(e,s*h))}}}let Ln=null,En=!1;async function Dn(){if(Ln)return Ln;if(En)return null;try{return Ln=await import("katex"),await import("katex/contrib/mhchem"),Ln}catch{return En=!0,null}}function $n({node:e}){const n=c(null),r=c(null),o=c(null),l=Ee(),[a,d]=i(!0),[u,m]=i(()=>"undefined"==typeof window),h=c(0);return s(()=>{const e=n.current;if(!e)return;const t=l(e,{rootMargin:"400px"});return o.current=t,t.isVisible()&&m(!0),t.whenVisible.then(()=>m(!0)),()=>{t.destroy(),o.current=null}},[l]),s(()=>{var t;const n=re(null!=(t=e.content)?t:"");if(!n)return r.current&&(r.current.innerHTML=""),void d(!1);if(!u)return void d(!0);let o=!1;const i=new AbortController,l=++h.current;return Tn(n,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{o||l!==h.current||(r.current&&(r.current.innerHTML=e),d(!1))}).catch(async t=>{if(o||l!==h.current)return;if(!r.current)return;const i=(null==t?void 0:t.code)||(null==t?void 0:t.name);if("WORKER_INIT_ERROR"===i||(null==t?void 0:t.fallbackToRenderer)||i===wn||"WORKER_TIMEOUT"===i){const t=await Dn();if(t)try{const i=t.renderToString(n,{throwOnError:e.loading,displayMode:!0});return void(!o&&l===h.current&&r.current&&(r.current.innerHTML=i,d(!1),kn(n,!0,i)))}catch{}}e.loading||(r.current.textContent=e.raw,d(!1))}),()=>{o=!0,i.abort()}},[e.content,e.loading,e.raw,u]),/* @__PURE__ */t("div",{ref:n,className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */t("div",{ref:r,className:a?"math-rendering":void 0})})}function Pn({node:n}){const r=c(null),o=c(null),l=c(null),a=Ee(),[d,u]=i(!0),[m,h]=i(()=>"undefined"==typeof window),f=c(0);return s(()=>{const e=r.current;if(!e)return;const t=a(e,{rootMargin:"400px"});return l.current=t,t.isVisible()&&h(!0),t.whenVisible.then(()=>h(!0)),()=>{t.destroy(),l.current=null}},[a]),s(()=>{var e;const t=re(null!=(e=n.content)?e:"");if(!t)return o.current&&(o.current.innerHTML=""),void u(!1);if(!m)return void u(!0);let r=!1;const i=new AbortController,l=++f.current,a="$$"===n.markup;return Tn(t,a,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||l!==f.current||o.current&&(o.current.innerHTML=e,u(!1))}).catch(async e=>{if(r||l!==f.current)return;if(!o.current)return;const i=(null==e?void 0:e.code)||(null==e?void 0:e.name);if("WORKER_INIT_ERROR"===i||(null==e?void 0:e.fallbackToRenderer)||i===wn||"WORKER_TIMEOUT"===i){const e=await Dn();if(e)try{const i=e.renderToString(t,{throwOnError:n.loading,displayMode:a});return void(!r&&l===f.current&&o.current&&(o.current.innerHTML=i,u(!1),kn(t,a,i)))}catch{}}n.loading||(o.current.textContent=n.raw,u(!1))}),()=>{r=!0,i.abort()}},[n.content,n.loading,n.raw,n.markup,m]),/* @__PURE__ */e("span",{ref:r,className:"math-inline-wrapper",children:[
|
|
102
101
|
/* @__PURE__ */t("span",{ref:o,className:"math-inline"+(d?" math-inline--hidden":"")}),d&&/* @__PURE__ */e("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
|
|
103
102
|
/* @__PURE__ */t("span",{className:"math-inline__spinner","aria-hidden":"true"}),
|
|
104
|
-
/* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function An(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let Rn=null,Fn=null;const In=/* @__PURE__ */new Map;let _n=5,Hn=!1;function Wn(e){Hn=!!e}function On(e){Number.isFinite(e)&&e>0&&(_n=Math.floor(e))}function jn(){return{inFlight:In.size,max:_n}}const zn="WORKER_BUSY";function Kn(e){Rn=e,Fn=null;const t=e;Rn.onmessage=e=>{if(Rn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=In.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Rn.onerror=e=>{var n,r;if(Rn===t)if(0!==In.size){try{Hn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of In.entries())n.reject(new Error(`Worker error: ${e.message}`));In.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Rn.onmessageerror=e=>{var n,r;if(Rn===t)if(0!==In.size){try{Hn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of In.entries())t.reject(new Error("Worker messageerror"));In.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Vn(){var e;if(Rn)try{for(const[e,t]of In.entries())t.reject(new Error("Worker cleared"));In.clear(),null==(e=Rn.terminate)||e.call(Rn)}catch{}Rn=null,Fn=null}function qn(e,t,n=1400){if(Fn)return Promise.reject(Fn);const r=Rn||(Fn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Fn.name="WORKER_INIT_ERROR",Fn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Fn);if(In.size>=_n){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=zn,e.inFlight=In.size,e.max=_n,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),In.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};In.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return In.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=In.get(l);null==t||t.reject(e)},n)})}async function Xn(e,t,n=1400){return qn("canParse",{code:e,theme:t},n)}async function Un(e,t,n=2400){return qn("findPrefix",{code:e,theme:t},n)}function Yn(){var e;null==(e=null==Rn?void 0:Rn.terminate)||e.call(Rn),Rn=null,Fn=null,In.clear()}let Zn=null,Gn=!1,Jn=null,Qn=null;function er(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"strict")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(Jn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Jn=r}catch{}}const tr="undefined"!=typeof window?u:s,nr={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function rr(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function or(e,t,n={}){if(!e)return"";const r=function(e,t){if(!e)return"";const n=M(t);return n?(rr(e),e.appendChild(n),e.innerHTML):""}(e,t);return r||n.keepPreviousOnFailure||rr(e),r}function ir(e,t,n){if(n&&(null==e?void 0:e.querySelector("svg")))try{null==t||t(e)}catch{}}const lr={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function ar(r){var l,a,m,h,f,p,g,v,y,w;const x={...lr,...r},{t:k}=Re(),b=o(()=>H("mermaid"),[]),C=null!=(a=null==(l=x.node)?void 0:l.code)?a:"",N=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),M=null!=(m=x.workerTimeoutMs)?m:lr.workerTimeoutMs,B=null!=(h=x.parseTimeoutMs)?h:lr.parseTimeoutMs,S=null!=(f=x.renderTimeoutMs)?f:lr.renderTimeoutMs,T=null!=(p=x.fullRenderTimeoutMs)?p:lr.fullRenderTimeoutMs,L=Math.max(0,null!=(g=x.renderDebounceMs)?g:lr.renderDebounceMs),E=o(()=>x.maxHeight&&"none"!==x.maxHeight?oe(x.maxHeight):null,[x.maxHeight]),D=o(()=>{var e;return ie(null!=(e=oe(x.estimatedPreviewHeightPx))?e:le(N),void 0,E)},[N,E,x.estimatedPreviewHeightPx]),[$,P]=i(!1),[A,R]=i(!1),[F,I]=i(!1),[_,W]=i(!1),[O,j]=i(1),[z,K]=i({x:0,y:0}),[V,q]=i(!1),[X,U]=i(!1),[Y,Z]=i(!1),[G,J]=i(null),[Q,ee]=i(!1),[te,ne]=i(`${D}px`),[re,ae]=i("undefined"==typeof window),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c(null),he=c(null),fe=c(null),pe=c({x:0,y:0}),ge=c(0),ve=c({}),ye=c(null),we=c(""),ke=c(!1),be=c(null),Ce=c(!1),Ne=c({zoom:1,translateX:0,translateY:0,containerHeight:te||"360px"}),Me=Ee(),Be=Boolean(null!=(y=null==(v=x.node)?void 0:v.loading)?y:x.loading),Se=x.isDark?"dark":"light",Te=Boolean(x.isStrict),Le=!0===x.enableMermaidInteractions,De=o(()=>Te?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:nr,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Te]);s(()=>{Ce.current=Y},[Y]),s(()=>{A||F||ne(e=>{const t=oe(e);return null!=t&&t>=D?e:`${D}px`})},[D,F,A]),s(()=>{ve.current={}},[Se,N,Te]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Zn)return er(Zn,e),Zn;if(Qn){const t=await Qn;return t&&er(t,e),t}if(Gn)return null;try{Gn=!0,Qn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Zn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Zn)throw new Error("Mermaid module did not export expected API");return er(Zn,null!=e?e:{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Zn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Qn=null}})();const t=await Qn;return t&&er(t,e),t}catch{return null}}(De);e||(ce.current=t,P(Boolean(t)),ke.current||R(!t))})(),()=>{e=!0}},[De]),s(()=>{const e=se.current;if(!e)return;const t=Me(e,{rootMargin:"400px"});return be.current=t,t.isVisible()&&ae(!0),t.whenVisible.then(()=>ae(!0)),()=>{t.destroy(),be.current=null}},[Me]),s(()=>{if("undefined"==typeof document)return;if(!Q)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Q]);const $e=d(()=>E,[E]),Pe=d(e=>{const t=se.current,n=ue.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i,s=$e(),d=null==s?c:Math.min(c,s);ne(`${"none"===x.maxHeight?d:Math.max(d,D)}px`)},[D,x.maxHeight,$e]);s(()=>{if(!se.current||"undefined"==typeof ResizeObserver)return;if(A||F)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;An(()=>Pe(t))});return e.observe(se.current),()=>e.disconnect()},[F,A,Pe]),s(()=>{A||F||Pe()},[F,x.maxHeight,A,Pe]),s(()=>()=>{Yn()},[]),u(()=>{var e;const t=ve.current[Se];!A&&ue.current&&(null==t?void 0:t.svg)&&(or(ue.current,t.svg)&&(ye.current=null!=(e=t.bindFunctions)?e:null,ir(ue.current,t.bindFunctions,Le)),An(()=>Pe()))},[Le,A,Se,Pe]);const Ae=d(async(e,t,n)=>{var r;if(!ce.current||!ue.current)return!1;U(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=dr(e,t),l=await fr(()=>ce.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=or(ue.current,l.svg);return!!a&&(ye.current=null!=(r=l.bindFunctions)?r:null,ir(ue.current,l.bindFunctions,Le),Pe(),ve.current[t]={svg:a,bindFunctions:l.bindFunctions},Z(!0),J(null),!0)}catch(o){if(!Be){if("function"==typeof x.onRenderError&&ue.current&&!0===x.onRenderError(o,N,ue.current))return!1;J(o instanceof Error?o.message:String(o))}return!1}finally{U(!1)}},[Le,T,Be,Pe]),Fe=d(async(e,t,n)=>{var r;if(ce.current&&ue.current){U(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=dr(hr(e)||e,t),l=await fr(()=>ce.current.render(o,i),{timeoutMs:S,signal:n});if(null==l?void 0:l.svg){const e=or(ue.current,l.svg,{keepPreviousOnFailure:!0});e&&(ye.current=null!=(r=l.bindFunctions)?r:null,ir(ue.current,l.bindFunctions,Le)),e&&Pe()}}catch{}finally{U(!1)}}},[Le,S,Be,Pe]),Ie=d(async(e,t)=>{if(!e.trim())return rr(ue.current),Z(!1),void(we.current="");const n=e.replace(/\s+/g,"");if(n===we.current&&Ce.current)return;const r=++ge.current;if("gantt"===ur(e)){const i=hr(e);if(!i.trim())return;try{if(await sr(i,Se,{workerTimeout:M,parseTimeout:B,mermaid:ce.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;i===e?await Ae(e,Se,t)&&(we.current=n):await Fe(i,Se,t)}catch(o){if("AbortError"===(null==o?void 0:o.name))return}return}try{if(await sr(e,Se,{workerTimeout:M,parseTimeout:B,mermaid:ce.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;return void(await Ae(e,Se,t)&&(we.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await Un(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return hr(e)}(e,Se,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||ge.current!==r)return;await Fe(n,Se,t)}catch{}},[B,Ae,Fe,Se,M]),_e=d(()=>re&&!A&&!F,[F,A,re]);s(()=>{if(!_e())return;if(!ce.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&_e()&&Ie(N,e.signal)},L);return()=>{e.abort(),window.clearTimeout(t)}},[N,_e,$,Ie,L]);const He=d((e,t)=>{e.clientX,e.clientY,Ke(e.currentTarget,t,"top",!1,0,x.isDark)},[x.isDark]),We=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),W(!0),null==(t=x.onCopy)||t.call(x,N),setTimeout(()=>W(!1),1e3)}catch{}},[N,x]),Oe=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=pr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onExport)||n.call(x,i),i.defaultPrevented||function(e,t){const n=null!=t?t:pr(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[x]),je=d(()=>{fe.current=null,rr(he.current)},[]),ze=d(()=>{ee(!1),je()},[je]),qe=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null,o=r?pr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onOpenModal)||n.call(x,i),i.defaultPrevented||ee(!0)},[x]);s(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&ze()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[ze,Q]),tr(()=>{var e,t;if(!Q)return;const n=he.current,r=se.current;if(!n||!r)return;const o=`translate(${z.x}px, ${z.y}px) scale(${O})`,i=r.cloneNode(!0);i.classList.add("fullscreen"),i.style.height="100%",i.style.maxHeight="100%";const l=i.querySelector("[data-mermaid-wrapper]");l&&(fe.current=l,l.style.transform=o),rr(n),n.appendChild(i),ir(n,null!=(t=ye.current)?t:null==(e=ve.current[Se])?void 0:e.bindFunctions,Le)},[Le,Q,Se]),s(()=>{Q&&fe.current&&(fe.current.style.transform=`translate(${z.x}px, ${z.y}px) scale(${O})`)},[Q,z.x,z.y,O]);const Xe=A||X||F,Ue=o(()=>x.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[x.isDark]),Ye=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=x.onToggleMode)||t.call(x,e,n),!n.defaultPrevented)if(ke.current=!0,"preview"===e){R(!1);const e=Ne.current;j(e.zoom),K({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else Ne.current={zoom:O,translateX:z.x,translateY:z.y,containerHeight:te},R(!0)},[N,te,Ie,x,Se,z.x,z.y,Pe,O]),Ze=d(e=>{if(!1===x.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=se.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-z.x,o=e.clientY-n.top-z.y,i=.01*-e.deltaY,l=cr(O+i,.5,3);if(l===O)return;const a=l/O;K({x:z.x-r*(a-1),y:z.y-o*(a-1)}),j(l)},[z,O]),Ge=d((e,t)=>{q(!0),pe.current={x:e-z.x,y:t-z.y}},[z.x,z.y]),Je=d((e,t)=>{V&&K({x:e-pe.current.x,y:t-pe.current.y})},[V]),Qe=d(()=>{q(!1)},[]),et=/* @__PURE__ */e("div",{className:"relative",children:[x.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
103
|
+
/* @__PURE__ */t("span",{className:"sr-only",children:"Loading"})]})]})}function An(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}let Rn=null,Fn=null;const _n=/* @__PURE__ */new Map;let In=5,Hn=!1;function Wn(e){Hn=!!e}function On(e){Number.isFinite(e)&&e>0&&(In=Math.floor(e))}function jn(){return{inFlight:_n.size,max:In}}const zn="WORKER_BUSY";function Kn(e){Rn=e,Fn=null;const t=e;Rn.onmessage=e=>{if(Rn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,l=_n.get(n);l&&(!1===r||i?l.reject(new Error(i||"Unknown error")):l.resolve(o))},Rn.onerror=e=>{var n,r;if(Rn===t)if(0!==_n.size){try{Hn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of _n.entries())n.reject(new Error(`Worker error: ${e.message}`));_n.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},Rn.onmessageerror=e=>{var n,r;if(Rn===t)if(0!==_n.size){try{Hn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of _n.entries())t.reject(new Error("Worker messageerror"));_n.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function Vn(){var e;if(Rn)try{for(const[e,t]of _n.entries())t.reject(new Error("Worker cleared"));_n.clear(),null==(e=Rn.terminate)||e.call(Rn)}catch{}Rn=null,Fn=null}function qn(e,t,n=1400){if(Fn)return Promise.reject(Fn);const r=Rn||(Fn=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Fn.name="WORKER_INIT_ERROR",Fn.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(Fn);if(_n.size>=In){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=zn,e.inFlight=_n.size,e.max=In,Promise.reject(e)}return new Promise((o,i)=>{const l=Math.random().toString(36).slice(2);let a=!1,c=null;const s=()=>{a||(a=!0,null!=c&&clearTimeout(c),_n.delete(l))},d={resolve:e=>{s(),o(e)},reject:e=>{s(),i(e)}};_n.set(l,d);try{r.postMessage({id:l,action:e,payload:t})}catch(u){return _n.delete(l),void i(u)}c=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=_n.get(l);null==t||t.reject(e)},n)})}async function Xn(e,t,n=1400){return qn("canParse",{code:e,theme:t},n)}async function Un(e,t,n=2400){return qn("findPrefix",{code:e,theme:t},n)}function Yn(){var e;null==(e=null==Rn?void 0:Rn.terminate)||e.call(Rn),Rn=null,Fn=null,_n.clear()}let Zn=null,Gn=!1,Jn=null,Qn=null;function er(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"strict")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(Jn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),Jn=r}catch{}}const tr="undefined"!=typeof window?u:s,nr={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0};function rr(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function or(e,t,n={}){if(!e)return"";const r=function(e,t){if(!e)return"";const n=M(t);return n?(rr(e),e.appendChild(n),e.innerHTML):""}(e,t);return r||n.keepPreviousOnFailure||rr(e),r}function ir(e,t,n){if(n&&(null==e?void 0:e.querySelector("svg")))try{null==t||t(e)}catch{}}const lr={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function ar(r){var l,a,m,h,f,p,g,v,y,w;const x={...lr,...r},{t:k}=Re(),b=o(()=>H("mermaid"),[]),C=null!=(a=null==(l=x.node)?void 0:l.code)?a:"",N=o(()=>C.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[C]),M=null!=(m=x.workerTimeoutMs)?m:lr.workerTimeoutMs,B=null!=(h=x.parseTimeoutMs)?h:lr.parseTimeoutMs,S=null!=(f=x.renderTimeoutMs)?f:lr.renderTimeoutMs,T=null!=(p=x.fullRenderTimeoutMs)?p:lr.fullRenderTimeoutMs,L=Math.max(0,null!=(g=x.renderDebounceMs)?g:lr.renderDebounceMs),E=o(()=>x.maxHeight&&"none"!==x.maxHeight?oe(x.maxHeight):null,[x.maxHeight]),D=o(()=>{var e;return ie(null!=(e=oe(x.estimatedPreviewHeightPx))?e:le(N),void 0,E)},[N,E,x.estimatedPreviewHeightPx]),[$,P]=i(!1),[A,R]=i(!1),[F,_]=i(!1),[I,W]=i(!1),[O,j]=i(1),[z,K]=i({x:0,y:0}),[V,q]=i(!1),[X,U]=i(!1),[Y,Z]=i(!1),[G,J]=i(null),[Q,ee]=i(!1),[te,ne]=i(`${D}px`),[re,ae]=i("undefined"==typeof window),ce=c(null),se=c(null),de=c(null),ue=c(null),me=c(null),he=c(null),fe=c(null),pe=c({x:0,y:0}),ge=c(0),ve=c({}),ye=c(null),we=c(""),ke=c(!1),be=c(null),Ce=c(!1),Ne=c({zoom:1,translateX:0,translateY:0,containerHeight:te||"360px"}),Me=Ee(),Be=Boolean(null!=(y=null==(v=x.node)?void 0:v.loading)?y:x.loading),Se=x.isDark?"dark":"light",Te=Boolean(x.isStrict),Le=!0===x.enableMermaidInteractions,De=o(()=>Te?{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,dompurifyConfig:nr,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose",suppressErrorRendering:!0},[Te]);s(()=>{Ce.current=Y},[Y]),s(()=>{A||F||ne(e=>{const t=oe(e);return null!=t&&t>=D?e:`${D}px`})},[D,F,A]),s(()=>{ve.current={}},[Se,N,Te]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(Zn)return er(Zn,e),Zn;if(Qn){const t=await Qn;return t&&er(t,e),t}if(Gn)return null;try{Gn=!0,Qn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(Zn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!Zn)throw new Error("Mermaid module did not export expected API");return er(Zn,null!=e?e:{startOnLoad:!1,securityLevel:"strict",flowchart:{htmlLabels:!1}}),Zn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Qn=null}})();const t=await Qn;return t&&er(t,e),t}catch{return null}}(De);e||(ce.current=t,P(Boolean(t)),ke.current||R(!t))})(),()=>{e=!0}},[De]),s(()=>{const e=se.current;if(!e)return;const t=Me(e,{rootMargin:"400px"});return be.current=t,t.isVisible()&&ae(!0),t.whenVisible.then(()=>ae(!0)),()=>{t.destroy(),be.current=null}},[Me]),s(()=>{if("undefined"==typeof document)return;if(!Q)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[Q]);const $e=d(()=>E,[E]),Pe=d(e=>{const t=se.current,n=ue.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const l=r.getAttribute("viewBox");if(l){const e=l.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),c=Number.isFinite(a)&&a>0?a:i,s=$e(),d=null==s?c:Math.min(c,s);ne(`${"none"===x.maxHeight?d:Math.max(d,D)}px`)},[D,x.maxHeight,$e]);s(()=>{if(!se.current||"undefined"==typeof ResizeObserver)return;if(A||F)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;An(()=>Pe(t))});return e.observe(se.current),()=>e.disconnect()},[F,A,Pe]),s(()=>{A||F||Pe()},[F,x.maxHeight,A,Pe]),s(()=>()=>{Yn()},[]),u(()=>{var e;const t=ve.current[Se];!A&&ue.current&&(null==t?void 0:t.svg)&&(or(ue.current,t.svg)&&(ye.current=null!=(e=t.bindFunctions)?e:null,ir(ue.current,t.bindFunctions,Le)),An(()=>Pe()))},[Le,A,Se,Pe]);const Ae=d(async(e,t,n)=>{var r;if(!ce.current||!ue.current)return!1;U(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=dr(e,t),l=await fr(()=>ce.current.render(o,i),{timeoutMs:T,signal:n});if(!(null==l?void 0:l.svg))return!1;const a=or(ue.current,l.svg);return!!a&&(ye.current=null!=(r=l.bindFunctions)?r:null,ir(ue.current,l.bindFunctions,Le),Pe(),ve.current[t]={svg:a,bindFunctions:l.bindFunctions},Z(!0),J(null),!0)}catch(o){if(!Be){if("function"==typeof x.onRenderError&&ue.current&&!0===x.onRenderError(o,N,ue.current))return!1;J(o instanceof Error?o.message:String(o))}return!1}finally{U(!1)}},[Le,T,Be,Pe]),Fe=d(async(e,t,n)=>{var r;if(ce.current&&ue.current){U(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=dr(hr(e)||e,t),l=await fr(()=>ce.current.render(o,i),{timeoutMs:S,signal:n});if(null==l?void 0:l.svg){const e=or(ue.current,l.svg,{keepPreviousOnFailure:!0});e&&(ye.current=null!=(r=l.bindFunctions)?r:null,ir(ue.current,l.bindFunctions,Le)),e&&Pe()}}catch{}finally{U(!1)}}},[Le,S,Be,Pe]),_e=d(async(e,t)=>{if(!e.trim())return rr(ue.current),Z(!1),void(we.current="");const n=e.replace(/\s+/g,"");if(n===we.current&&Ce.current)return;const r=++ge.current;if("gantt"===ur(e)){const i=hr(e);if(!i.trim())return;try{if(await sr(i,Se,{workerTimeout:M,parseTimeout:B,mermaid:ce.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;i===e?await Ae(e,Se,t)&&(we.current=n):await Fe(i,Se,t)}catch(o){if("AbortError"===(null==o?void 0:o.name))return}return}try{if(await sr(e,Se,{workerTimeout:M,parseTimeout:B,mermaid:ce.current,signal:t}),(null==t?void 0:t.aborted)||ge.current!==r)return;return void(await Ae(e,Se,t)&&(we.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await Un(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return hr(e)}(e,Se,{workerTimeout:M,signal:t});if(!n||(null==t?void 0:t.aborted)||ge.current!==r)return;await Fe(n,Se,t)}catch{}},[B,Ae,Fe,Se,M]),Ie=d(()=>re&&!A&&!F,[F,A,re]);s(()=>{if(!Ie())return;if(!ce.current)return;const e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Ie()&&_e(N,e.signal)},L);return()=>{e.abort(),window.clearTimeout(t)}},[N,Ie,$,_e,L]);const He=d((e,t)=>{e.clientX,e.clientY,Ke(e.currentTarget,t,"top",!1,0,x.isDark)},[x.isDark]),We=d(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(N)),W(!0),null==(t=x.onCopy)||t.call(x,N),setTimeout(()=>W(!1),1e3)}catch{}},[N,x]),Oe=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=pr(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onExport)||n.call(x,i),i.defaultPrevented||function(e,t){const n=null!=t?t:pr(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[x]),je=d(()=>{fe.current=null,rr(he.current)},[]),ze=d(()=>{ee(!1),je()},[je]),qe=d(()=>{var e,t,n;const r=null!=(t=null==(e=ue.current)?void 0:e.querySelector("svg"))?t:null,o=r?pr(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=x.onOpenModal)||n.call(x,i),i.defaultPrevented||ee(!0)},[x]);s(()=>{if(!Q)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&ze()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[ze,Q]),tr(()=>{var e,t;if(!Q)return;const n=he.current,r=se.current;if(!n||!r)return;const o=`translate(${z.x}px, ${z.y}px) scale(${O})`,i=r.cloneNode(!0);i.classList.add("fullscreen"),i.style.height="100%",i.style.maxHeight="100%";const l=i.querySelector("[data-mermaid-wrapper]");l&&(fe.current=l,l.style.transform=o),rr(n),n.appendChild(i),ir(n,null!=(t=ye.current)?t:null==(e=ve.current[Se])?void 0:e.bindFunctions,Le)},[Le,Q,Se]),s(()=>{Q&&fe.current&&(fe.current.style.transform=`translate(${z.x}px, ${z.y}px) scale(${O})`)},[Q,z.x,z.y,O]);const Xe=A||X||F,Ue=o(()=>x.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[x.isDark]),Ye=d(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=x.onToggleMode)||t.call(x,e,n),!n.defaultPrevented)if(ke.current=!0,"preview"===e){R(!1);const e=Ne.current;j(e.zoom),K({x:e.translateX,y:e.translateY}),ne(e.containerHeight)}else Ne.current={zoom:O,translateX:z.x,translateY:z.y,containerHeight:te},R(!0)},[N,te,_e,x,Se,z.x,z.y,Pe,O]),Ze=d(e=>{if(!1===x.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=se.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-z.x,o=e.clientY-n.top-z.y,i=.01*-e.deltaY,l=cr(O+i,.5,3);if(l===O)return;const a=l/O;K({x:z.x-r*(a-1),y:z.y-o*(a-1)}),j(l)},[z,O]),Ge=d((e,t)=>{q(!0),pe.current={x:e-z.x,y:t-z.y}},[z.x,z.y]),Je=d((e,t)=>{V&&K({x:e-pe.current.x,y:t-pe.current.y})},[V]),Qe=d(()=>{q(!1)},[]),et=/* @__PURE__ */e("div",{className:"relative",children:[x.showZoomControls&&/* @__PURE__ */t("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */e("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
105
104
|
/* @__PURE__ */t("button",{type:"button",className:ct("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>He(e,k("common.zoomIn")),onMouseLeave:()=>Ve(),onClick:()=>j(cr(O+.1,.5,3)),children:"+"}),
|
|
106
105
|
/* @__PURE__ */t("button",{type:"button",className:ct("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>He(e,k("common.zoomOut")),onMouseLeave:()=>Ve(),onClick:()=>j(cr(O-.1,.5,3)),children:"−"}),
|
|
107
106
|
/* @__PURE__ */e("button",{type:"button",className:ct("p-2 text-xs rounded transition-colors",x.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>He(e,k("common.resetZoom")),onMouseLeave:()=>Ve(),onClick:()=>{j(1),K({x:0,y:0})},children:[Math.round(100*O),"%"]})]})}),
|
|
@@ -120,7 +119,7 @@ return t(s,{node:e,value:r.ordered?(null!=(a=r.start)?a:1)+n:void 0,ctx:o,render
|
|
|
120
119
|
/* @__PURE__ */t("button",{type:"button",className:ct("px-2.5 py-1 text-xs rounded transition-colors",A?x.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":x.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"),onClick:()=>Ye("source"),onMouseEnter:e=>He(e,k("common.source")),onFocus:e=>He(e,k("common.source")),onMouseLeave:()=>Ve(),onBlur:()=>Ve(),children:/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[
|
|
121
120
|
/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})}),
|
|
122
121
|
/* @__PURE__ */t("span",{children:k("common.source")})]})})]}),
|
|
123
|
-
/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[x.showCollapseButton&&/* @__PURE__ */t("button",{type:"button",className:Ue,"aria-pressed":F,onClick:()=>
|
|
122
|
+
/* @__PURE__ */e("div",{className:"flex items-center space-x-1",children:[x.showCollapseButton&&/* @__PURE__ */t("button",{type:"button",className:Ue,"aria-pressed":F,onClick:()=>_(e=>!e),onMouseEnter:e=>He(e,k(F?"common.expand":"common.collapse")),onFocus:e=>He(e,k(F?"common.expand":"common.collapse")),onMouseLeave:()=>Ve(),onBlur:()=>Ve(),children:/* @__PURE__ */t("svg",{style:{rotate:F?"0deg":"90deg"},xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 18l6-6l-6-6"})})}),x.showCopyButton&&/* @__PURE__ */t("button",{type:"button",className:Ue,onClick:We,onMouseEnter:e=>He(e,k(I?"common.copied":"common.copy")),onFocus:e=>He(e,k(I?"common.copied":"common.copy")),onMouseLeave:()=>Ve(),onBlur:()=>Ve(),children:/* @__PURE__ */t("svg",I?{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */t("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M20 6L9 17l-5-5"})}:{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
124
123
|
/* @__PURE__ */t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),
|
|
125
124
|
/* @__PURE__ */t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})}),x.showExportButton&&$&&/* @__PURE__ */t("button",{type:"button",className:ct(Ue,Xe?"opacity-50 cursor-not-allowed":""),disabled:Xe,onClick:Oe,onMouseEnter:e=>He(e,k("common.export")),onFocus:e=>He(e,k("common.export")),onMouseLeave:()=>Ve(),onBlur:()=>Ve(),children:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",className:"w-3 h-3",children:/* @__PURE__ */e("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[
|
|
126
125
|
/* @__PURE__ */t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),
|
|
@@ -154,7 +153,7 @@ return t(rn,{node:e,ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);cas
|
|
|
154
153
|
return t(rn,{node:{type:"text",content:null!=(w=e.content)?w:"",center:e.center},ctx:o,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"paragraph":/* @__PURE__ */
|
|
155
154
|
return t(wr,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"heading":/* @__PURE__ */
|
|
156
155
|
return t(Et,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"blockquote":/* @__PURE__ */
|
|
157
|
-
return t(
|
|
156
|
+
return t(Ir,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list":/* @__PURE__ */
|
|
158
157
|
return t(an,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"list_item":/* @__PURE__ */
|
|
159
158
|
return t(ln,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"table":/* @__PURE__ */
|
|
160
159
|
return t(Mr,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"definition_list":/* @__PURE__ */
|
|
@@ -184,7 +183,7 @@ return t(Pn,{node:e},n);case"math_block":/* @__PURE__ */
|
|
|
184
183
|
return t($n,{node:e},n);case"reference":/* @__PURE__ */
|
|
185
184
|
return t(xr,{node:e,ctx:o,typewriter:o.typewriter,fade:o.fade},n);case"html_block":case"html_inline":return"html_block"===e.type?/* @__PURE__ */t($t,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n):/* @__PURE__ */t(zt,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade,customId:o.customId},n);case"vmr_container":/* @__PURE__ */
|
|
186
185
|
return t(Sr,{node:e,ctx:o,renderNode:Er,indexKey:n,typewriter:o.typewriter,fade:o.fade},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
187
|
-
return t(gr,{node:e},n)}}const Dr={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},$r=E();function Pr(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,r=t;return n.startLine===r.startLine&&n.endLine===r.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function Ar(e){const t=o(()=>me(e),[e]),n=c(t);return function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}const Rr=r.memo(({node:e,nodeKey:t,renderCtx:n})=>Er(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Fr=r.memo(({props:n,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u,showTypewriterCursor:m,typewriterCursorRef:h})=>{var f,p,g,v,y,w,x;const k=Ee(),b="undefined"!=typeof window,C="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,N=Math.max(0,Math.trunc(null!=(f=n.renderBatchSize)?f:80)),M=Math.max(0,Math.trunc(null!=(p=n.initialRenderBatchSize)?p:N||r.length)),B=!1!==n.batchRendering&&N>0&&b,S=Math.max(0,null!=(g=n.liveNodeBuffer)?g:60),T=Math.max(1,null!=(v=n.maxLiveNodes)?v:320),L=(null!=(y=n.maxLiveNodes)?y:0)>0&&r.length>T,E=!1!==n.viewportPriority,D=B&&(null!=(w=n.maxLiveNodes)?w:0)<=0,$=o(()=>{var e;return!1!==n.deferNodesUntilVisible&&!((null!=(e=n.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&E},[r.length,n.deferNodesUntilVisible,n.maxLiveNodes,E,L]),[P,A]=i(()=>D?Math.min(r.length,M):r.length),R=c(P);s(()=>{R.current=P},[P]);const F=D?P:r.length,[I
|
|
188
|
-
return e("div",{ref:u,className:`markstream-react markdown-renderer${n.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":n.customId,onClick:n.onClick,onMouseOver:Ne(n.onMouseOver),onMouseOut:Ne(n.onMouseOut),children:[Me,ce.map(({node:e,index:r})=>{var o;const i=Ce(r),c=null!=(o=O.current.get(r))?o:ae,s=!1!==n.fade&&"code_block"!==e.type&&!Y.current.has(r)&&i;return s&&Y.current.add(r),/* @__PURE__ */t("div",{ref:xe(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */t("div",i?{ref:be(r),className:"node-content"+(s?" fade-node typewriter-node":""),children:/* @__PURE__ */t(Rr,{node:e,nodeKey:`${a}-${r}`,renderCtx:l})}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Be,m&&/* @__PURE__ */t("span",{ref:h,className:"typewriter-cursor","aria-hidden":"true"})]})},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,r=t.parsedNodes;if(n===r)return!0;if(n.length!==r.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==r[l])return!1;const o=e.props,i=t.props;return o.isDark===i.isDark&&o.typewriter===i.typewriter&&o.fade===i.fade&&o.batchRendering===i.batchRendering&&o.initialRenderBatchSize===i.initialRenderBatchSize&&o.renderBatchSize===i.renderBatchSize&&o.renderBatchDelay===i.renderBatchDelay&&o.renderBatchBudgetMs===i.renderBatchBudgetMs&&o.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&o.deferNodesUntilVisible===i.deferNodesUntilVisible&&o.maxLiveNodes===i.maxLiveNodes&&o.liveNodeBuffer===i.liveNodeBuffer&&o.viewportPriority===i.viewportPriority&&o.indexKey===i.indexKey&&o.onClick===i.onClick&&o.onMouseOver===i.onMouseOver&&o.onMouseOut===i.onMouseOut});function
|
|
189
|
-
return t("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:c&&s?/* @__PURE__ */t(
|
|
190
|
-
/* @__PURE__ */t("div",{id:null!=(n=e.id)?n:void 0,ref:r,style:d,className:["markstream-react ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{xn as $,be as A,
|
|
186
|
+
return t(gr,{node:e},n)}}const Dr={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:"auto",batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},$r=E();function Pr(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=e,r=t;return n.startLine===r.startLine&&n.endLine===r.endLine}(e.sourceMap,t.sourceMap)&&("code_block"!==e.type&&"code_block"!==t.type||e.diff===t.diff)}function Ar(e){const t=o(()=>me(e),[e]),n=c(t);return function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}const Rr=r.memo(({node:e,nodeKey:t,renderCtx:n})=>Er(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),Fr=r.memo(({props:n,parsedNodes:r,renderCtx:l,indexPrefix:a,containerRef:u,showTypewriterCursor:m,typewriterCursorRef:h})=>{var f,p,g,v,y,w,x;const k=Ee(),b="undefined"!=typeof window,C="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,N=Math.max(0,Math.trunc(null!=(f=n.renderBatchSize)?f:80)),M=Math.max(0,Math.trunc(null!=(p=n.initialRenderBatchSize)?p:N||r.length)),B=!1!==n.batchRendering&&N>0&&b,S=Math.max(0,null!=(g=n.liveNodeBuffer)?g:60),T=Math.max(1,null!=(v=n.maxLiveNodes)?v:320),L=(null!=(y=n.maxLiveNodes)?y:0)>0&&r.length>T,E=!1!==n.viewportPriority,D=B&&(null!=(w=n.maxLiveNodes)?w:0)<=0,$=o(()=>{var e;return!1!==n.deferNodesUntilVisible&&!((null!=(e=n.maxLiveNodes)?e:0)<=0)&&!L&&!(r.length>900)&&E},[r.length,n.deferNodesUntilVisible,n.maxLiveNodes,E,L]),[P,A]=i(()=>D?Math.min(r.length,M):r.length),R=c(P);s(()=>{R.current=P},[P]);const F=D?P:r.length,[_,I]=i(0),[H,W]=i({start:0,end:r.length}),O=c(/* @__PURE__ */new Map),[j,z]=i(0),K=c({}),V=c(/* @__PURE__ */new Map),q=c(/* @__PURE__ */new Map),X=c(/* @__PURE__ */new Map),U=c(/* @__PURE__ */new Map),Y=c(/* @__PURE__ */new Set),Z=c(P),G=c(null),J=c(null),Q=c(null),ee=c(!1),te=c(null),ne=c(Math.max(1,N||1)),re=c(r.length),oe=c({key:n.indexKey,total:r.length}),ie=c({batchSize:N,initial:M,delay:null!=(x=n.renderBatchDelay)?x:16,enabled:D}),le=$||L,ae=o(()=>{const e=O.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[j]),ce=o(()=>{if(!L)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(H.start,e)),n=Math.max(t,Math.min(H.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,H,L]),se=o(()=>{if(!L)return r.length;const e=Math.max(H.end+S,M),t=Math.min(r.length,e);return Math.max(P,t)},[r.length,L,H.end,S,M,P]);re.current=se;const de=d((e,t)=>{var n;if(e>=t)return 0;const r=O.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:ae;return o},[ae]),ue=L?de(0,Math.min(H.start,r.length)):0,me=L?de(Math.min(H.end,r.length),r.length):0,he=d(()=>{null!=G.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(G.current),G.current=null),null!=J.current&&(window.clearTimeout(J.current),J.current=null),null!=Q.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Q.current),Q.current=null),ee.current=!1,te.current=null},[]),fe=d(e=>{var t;if(!D)return;const r=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6),o=Math.max(1,N||1),i=Math.max(1,Math.floor(o/4));e>1.2*r?ne.current=Math.max(i,Math.floor(.7*ne.current)):e<.5*r&&ne.current<o&&(ne.current=Math.min(o,Math.ceil(1.2*ne.current)))},[D,n.renderBatchBudgetMs,N]),pe=d((e,t={})=>{var r,o;if(!D)return;const i=re.current;if(R.current>=i)return;const l=Math.max(1,e),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();A(t=>{const n=Math.min(re.current,t+Math.max(1,e));return R.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();fe(n-t)},c=()=>{const e=Math.max(1,Math.round(ne.current));pe(e)},s=e=>{var t;G.current=null,J.current=null,Q.current=null,ee.current=!1;const r=te.current;if(te.current=null,a(null!=r?r:l),R.current>=re.current)return;if(!e)return void c();const o=Math.max(2,null!=(t=n.renderBatchBudgetMs)?t:6);for(;R.current<re.current&&!(("function"==typeof e.timeRemaining?e.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(ne.current)));R.current<re.current&&c()};if(!b||t.immediate)return void s();const d=Math.max(0,null!=(r=n.renderBatchDelay)?r:16);if(te.current=null!=te.current?Math.max(te.current,l):l,!ee.current){if(ee.current=!0,C){const e=Math.max(0,null!=(o=n.renderBatchIdleTimeoutMs)?o:120);return void(Q.current=window.requestIdleCallback(e=>s(e),{timeout:e}))}"function"==typeof requestAnimationFrame?G.current=requestAnimationFrame(()=>{0!==d?J.current=window.setTimeout(()=>s(),d):s()}):J.current=window.setTimeout(()=>s(),d)}},[fe,C,D,b,n.renderBatchDelay,n.renderBatchBudgetMs,n.renderBatchIdleTimeoutMs]);s(()=>{var e;const t=n.indexKey,o=r.length,i=oe.current,l=void 0!==t?t!==i.key:o!==i.total;oe.current={key:t,total:o};const a=ie.current,c=null!=(e=n.renderBatchDelay)?e:16,s=a.batchSize!==N||a.initial!==M||a.delay!==c||a.enabled!==D;if(ie.current={batchSize:N,initial:M,delay:c,enabled:D},(l||s||!D)&&he(),(l||s)&&(ne.current=Math.max(1,N||1),Y.current.clear()),!o)return R.current=0,void A(0);const d=re.current;if(!D)return R.current=d,void A(d);if(l||s){const e=Math.min(d,M);return R.current=e,A(e),void(e<d&&pe(Math.max(1,M),{immediate:!b}))}const u=Math.min(R.current,d);u!==R.current&&(R.current=u,A(u)),R.current<d&&pe(Math.max(1,N||1))},[he,D,b,r.length,n.indexKey,n.renderBatchDelay,N,M,pe]),s(()=>{if(!L)return void W({start:0,end:r.length});const e=r.length;if(!e)return void W({start:0,end:0});const t=Math.max(0,Math.min(_,e-1));let n=Math.max(0,t-S),o=Math.min(e,t+S+1);const i=o-n;if(i>T){const e=i-T;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<T){const t=T-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}W({start:n,end:o})},[_,S,T,r.length,L]),s(()=>()=>{he();for(const e of V.current.values())e.destroy();V.current.clear()},[he]);const ge=d(e=>{for(const[t,n]of V.current.entries())t>=e&&(n.destroy(),V.current.delete(t),delete K.current[t],q.current.delete(t),X.current.delete(t),U.current.delete(t))},[]);s(()=>{ge(F)},[ge,F]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(O.current.keys()))n>=e&&(O.current.delete(n),t=!0);t&&z(e=>e+1);for(const n of Object.keys(K.current))Number(n)>=e&&delete K.current[n];for(const n of Array.from(Y.current))n>=e&&Y.current.delete(n)},[r.length]);const ve=d((e,t)=>{$&&t&&(K.current[e]=!0),t&&L&&I(t=>e>t?e:t)},[$,L]),ye=d(e=>{const t=V.current.get(e);t&&(t.destroy(),V.current.delete(e))},[]),we=d((e,t)=>{const n=q.current;if(t?n.set(e,t):n.delete(e),!le||!t)return ye(e),$&&!t&&delete K.current[e],void(t&&ve(e,!0));if(e<M&&!L)return ye(e),void ve(e,!0);ye(e);const r=k(t,{rootMargin:"400px"});V.current.set(e,r),r.isVisible()&&ve(e,!0),r.whenVisible.then(()=>ve(e,!0)).catch(()=>{})},[$,ye,ve,k,M,le,L]),xe=d(e=>{const t=X.current.get(e);if(t)return t;const n=t=>we(e,t);return X.current.set(e,n),n},[we]),ke=d((e,t)=>{if(!t)return void(O.current.has(e)&&(O.current.delete(e),z(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&O.current.get(e)!==n&&(O.current.set(e,n),z(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),be=d(e=>{const t=U.current.get(e);if(t)return t;const n=t=>ke(e,t);return U.current.set(e,n),n},[ke]),Ce=d(e=>!(D&&e>=R.current)&&(!$||e<M||!0===K.current[e]),[$,D,M]),Ne=d(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of q.current.entries())t&&we(e,t)},[we]),s(()=>{L&&P>Z.current&&I(P-1),Z.current=P},[P,L]);const Me=L?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${ue}px`},"aria-hidden":"true"}):null,Be=L?/* @__PURE__ */t("div",{className:"node-spacer",style:{height:`${me}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
|
|
187
|
+
return e("div",{ref:u,className:`markstream-react markdown-renderer${n.isDark?" dark":""}${L?" virtualized":""}`,"data-custom-id":n.customId,onClick:n.onClick,onMouseOver:Ne(n.onMouseOver),onMouseOut:Ne(n.onMouseOut),children:[Me,ce.map(({node:e,index:r})=>{var o;const i=Ce(r),c=null!=(o=O.current.get(r))?o:ae,s=!1!==n.fade&&"code_block"!==e.type&&!Y.current.has(r)&&i;return s&&Y.current.add(r),/* @__PURE__ */t("div",{ref:xe(r),className:"node-slot","data-node-index":r,"data-node-type":e.type,children:/* @__PURE__ */t("div",i?{ref:be(r),className:"node-content"+(s?" fade-node typewriter-node":""),children:/* @__PURE__ */t(Rr,{node:e,nodeKey:`${a}-${r}`,renderCtx:l})}:{className:"node-placeholder",style:{height:`${c}px`}})},`${a}-${r}`)}),Be,m&&/* @__PURE__ */t("span",{ref:h,className:"typewriter-cursor","aria-hidden":"true"})]})},function(e,t){if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;if(e.showTypewriterCursor!==t.showTypewriterCursor)return!1;const n=e.parsedNodes,r=t.parsedNodes;if(n===r)return!0;if(n.length!==r.length)return!1;for(let l=0;l<n.length;l++)if(n[l]!==r[l])return!1;const o=e.props,i=t.props;return o.isDark===i.isDark&&o.typewriter===i.typewriter&&o.fade===i.fade&&o.batchRendering===i.batchRendering&&o.initialRenderBatchSize===i.initialRenderBatchSize&&o.renderBatchSize===i.renderBatchSize&&o.renderBatchDelay===i.renderBatchDelay&&o.renderBatchBudgetMs===i.renderBatchBudgetMs&&o.renderBatchIdleTimeoutMs===i.renderBatchIdleTimeoutMs&&o.deferNodesUntilVisible===i.deferNodesUntilVisible&&o.maxLiveNodes===i.maxLiveNodes&&o.liveNodeBuffer===i.liveNodeBuffer&&o.viewportPriority===i.viewportPriority&&o.indexKey===i.indexKey&&o.onClick===i.onClick&&o.onMouseOver===i.onMouseOver&&o.onMouseOut===i.onMouseOut});function _r(e){var n,l;const a={...Dr,...e},u=c(null),h=c(/* @__PURE__ */new Map),f=c(0),p=c(null),g=De(a.smoothStreamingOptions),v=r.useContext(Ce),y=c(/* @__PURE__ */new Set),[w,x]=i(()=>!0===a.smoothStreaming);s(()=>{x(!0)},[]);const k=Array.isArray(a.nodes)&&a.nodes.length>0,b=o(()=>{var e;return!1!==a.smoothStreaming&&!k&&(!0===a.smoothStreaming||!v)&&(!0===a.smoothStreaming||!0===a.typewriter||(null!=(e=a.maxLiveNodes)?e:0)<=0)},[k,v,a.maxLiveNodes,a.smoothStreaming,a.typewriter]),C=w&&b,N=C?g.visible:null!=(n=a.content)?n:"",M=o(()=>{var e,t;const n=null!=(e=a.parseOptions)?e:{};return null!=(t=a.final)?t:n.final},[a.final,a.parseOptions]),B=null!=(l=a.content)?l:"",S=k||g.source===B,T=o(()=>C&&null!=M?Boolean(M&&S&&g.caughtUp):M,[M,S,g.caughtUp,C]),$=c(null),[A,R]=i(!1),F=c(void 0),_=c(0),I=o(()=>/* @__PURE__ */new Set(["code_block","admonition","table","math_block","html_block","image"]),[]),H=d(e=>{if(!e||"object"!=typeof e)return!1;const t=e.type;return"string"==typeof t&&I.has(t)},[I]),W=d(e=>{var t,n;if(!e||"object"!=typeof e)return 0;const r=e,o=null!=(n=null!=(t=r.raw)?t:r.content)?n:r.code;if("string"==typeof o)return o.length;const i=r.children;if(Array.isArray(i))return i.reduce((e,t)=>e+W(t),0);const l=r.items;return Array.isArray(l)?l.reduce((e,t)=>e+W(t),0):0},[]),O=d(()=>{var e,t;return(null==(e=a.nodes)?void 0:e.length)?a.nodes.reduce((e,t)=>e+W(t),0):(null!=(t=a.content)?t:"").length},[a.nodes,a.content,W]),j=d(()=>{F.current&&(clearTimeout(F.current),F.current=void 0)},[]),q=d(e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){var t;if(!(null!=(t=e.textContent)?t:"").trim())return NodeFilter.FILTER_REJECT;const n=e.parentElement;return n?n.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style')?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});let n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n},[]),X=d(()=>{var e,t;if("undefined"==typeof window||!A||!u.current||!$.current)return;const n=u.current,r=$.current,o=q(n),i=n.getBoundingClientRect();let l=0,a=0,c=20;if(null==o?void 0:o.textContent){const r=document.createRange(),s=o.textContent.length;r.setStart(o,Math.max(0,s-1)),r.setEnd(o,s);const d="function"==typeof r.getClientRects?r.getClientRects():void 0,u=null!=(t=null==d?void 0:d[d.length-1])?t:null==(e=o.parentElement)?void 0:e.getBoundingClientRect();u&&(l=u.right-i.left+n.scrollLeft,a=u.top-i.top+n.scrollTop,c=u.height||c),r.detach()}r.style.transform=`translate(${Math.max(0,l)}px, ${Math.max(0,a)}px)`,r.style.height=`${c}px`},[A,u,q]);s(()=>{A&&requestAnimationFrame(()=>{X()})},[A,X]),s(()=>()=>{j()},[j]);const U=k?a.nodes:N;p.current!==U&&(f.current+=1,p.current=U);const Y=m(z,K,K),Z=o(()=>V(a.customId),[a.customId,Y]),G=Ar(a.streamingComponents),J=Ar(a.htmlComponents);s(()=>{ue(G,J,y.current)},[J,G]);const Q=o(()=>a.customId?`renderer-${a.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[a.customId]),ee=o(()=>{var e,t;const n=null!=(t=(null!=(e=a.parseOptions)?e:{}).customHtmlTags)?t:[];return L(a.customHtmlTags,Array.isArray(n)?n:[],Object.keys(G))},[a.customId,a.customHtmlTags,a.parseOptions,Y,G]),te=o(()=>{const e=ee;return e&&0!==e.length?E(Q,{customHtmlTags:e}):E(Q)},[Q,ee]),ne=o(()=>{const e=te;return a.customMarkdownIt?a.customMarkdownIt(e):e},[te,a.customMarkdownIt]),re=o(()=>{var e;const t=null!=(e=a.parseOptions)?e:{},n=T,r=null!=n,o=ee.length>0;return r||o?{...t,...r?{final:n}:{},...o?{customHtmlTags:ee}:{}}:t},[ee,T,a.parseOptions]),oe=o(()=>{const e=Boolean(a.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,t=e?performance.now():0;let n=[];return k?n=a.nodes.map(e=>({...e})):N&&(n=D(N,null!=ne?ne:$r,re)),e&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-t),nodes:n.length,contentLength:N.length}),n},[a.debugPerformance,N,k,a.nodes,re,ne,a.customId,Y,ee]),ie=d(()=>{const e=oe[oe.length-1];return!H(e)},[oe,H]);s(()=>{if("undefined"==typeof window||k)return;if(T)return R(!1),void j();const e=O(),t=ie();return!1===a.typewriter||!t||e<=_.current?(!1!==a.typewriter&&t||R(!1),void(_.current=e)):(_.current=e,R(!0),j(),requestAnimationFrame(()=>{X()}),F.current=setTimeout(()=>{R(!1)},3e3),()=>{j()})},[N,a.nodes,a.typewriter,a.content,T,oe.length,k,O,ie,j,X]);const le=c([]),ae=null==re?void 0:re.postTransformNodes,ce=c(ae);ce.current!==ae&&(le.current=[],ce.current=ae);const se=function(e,t){if(!t.length)return e;const n=new Array(e.length);let r=e.length===t.length;for(let o=0;o<e.length;o++){const i=o<t.length?t[o]:null;i&&Pr(i,e[o])?n[o]=i:(n[o]=e[o],r=!1)}return r?t:n}(oe,le.current);le.current=se,s(()=>{var e;if(k)return void g.reset("");const t=null!=(e=a.content)?e:"";if(!C)return g.reset(t),void(M&&g.finish({flush:!0}));const n=g.getSnapshot().source;t?t===n||(t.startsWith(n)?g.enqueue(t.slice(n.length)):g.reset(t)):g.reset(""),M&&g.finish()},[k,a.content,M,C]),s(()=>{var e,t;if("undefined"==typeof window)return;if(a.renderCodeBlocksAsPre)return;if(!se.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==P(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const n=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},r=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),o=n(()=>{Qe()},{timeout:900});return()=>r(o)},[se,a.renderCodeBlocksAsPre]);const de=o(()=>null!=a.indexKey?String(a.indexKey):"markdown-renderer",[a.indexKey]),me=o(()=>({..."boolean"==typeof a.showTooltips?{showTooltips:a.showTooltips}:{},...a.codeBlockProps||{}}),[a.codeBlockProps,a.showTooltips]),he=o(()=>({...a.mermaidProps||{}}),[a.mermaidProps]),fe=o(()=>({...a.d2Props||{}}),[a.d2Props]),pe=o(()=>({...a.infographicProps||{}}),[a.infographicProps]),ge=o(()=>{var e;return{customId:a.customId,isDark:a.isDark,final:T,indexKey:de,typewriter:a.typewriter,fade:a.fade,textStreamState:h.current,streamRenderVersion:f.current,customComponents:Z,streamingComponents:G,htmlComponents:J,customHtmlTags:ee,htmlPolicy:null!=(e=a.htmlPolicy)?e:"safe",showTooltips:a.showTooltips,renderCodeBlocksAsPre:a.renderCodeBlocksAsPre,codeBlockStream:a.codeBlockStream,codeBlockOptions:a.codeBlockOptions,codeBlockProps:me,mermaidProps:he,d2Props:fe,infographicProps:pe,codeBlockThemes:{themes:a.themes,darkTheme:a.codeBlockDarkTheme,lightTheme:a.codeBlockLightTheme,minWidth:a.codeBlockMinWidth,maxWidth:a.codeBlockMaxWidth},events:{onCopy:a.onCopy,onHandleArtifactClick:a.onHandleArtifactClick}}},[a.customId,a.isDark,T,de,a.typewriter,a.fade,a.showTooltips,a.htmlPolicy,a.renderCodeBlocksAsPre,a.codeBlockStream,a.codeBlockOptions,ee,me,he,fe,pe,a.themes,a.codeBlockDarkTheme,a.codeBlockLightTheme,a.codeBlockMinWidth,a.codeBlockMaxWidth,a.onCopy,a.onHandleArtifactClick,Z,G,J]);ge.streamRenderVersion=f.current,ge.textStreamState=h.current;const ve=c(null);return ve.current||(ve.current={textStreamState:h.current,getStreamRenderVersion:()=>f.current}),/* @__PURE__ */t(Ne.Provider,{value:ve.current,children:/* @__PURE__ */t(Ce.Provider,{value:C,children:/* @__PURE__ */t(Le,{getRoot:()=>u.current,enabled:!1!==a.viewportPriority,children:/* @__PURE__ */t(Fr,{props:a,parsedNodes:se,renderCtx:ge,indexPrefix:de,containerRef:u,showTypewriterCursor:A,typewriterCursorRef:$})})})})}function Ir(e){var n,r,o,i,l;const{node:a,ctx:c,renderNode:s,indexKey:d,children:u}=e;/* @__PURE__ */
|
|
188
|
+
return t("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:c&&s?/* @__PURE__ */t(_r,{nodes:a.children||[],indexKey:`blockquote-${String(null!=d?d:"blockquote")}`,customId:c.customId,isDark:c.isDark,typewriter:c.typewriter,viewportPriority:!0,codeBlockStream:c.codeBlockStream,renderCodeBlocksAsPre:c.renderCodeBlocksAsPre,codeBlockOptions:c.codeBlockOptions,codeBlockProps:c.codeBlockProps,themes:null==(n=c.codeBlockThemes)?void 0:n.themes,codeBlockDarkTheme:null==(r=c.codeBlockThemes)?void 0:r.darkTheme,codeBlockLightTheme:null==(o=c.codeBlockThemes)?void 0:o.lightTheme,codeBlockMinWidth:null==(i=c.codeBlockThemes)?void 0:i.minWidth,codeBlockMaxWidth:null==(l=c.codeBlockThemes)?void 0:l.maxWidth,htmlPolicy:c.htmlPolicy,showTooltips:c.showTooltips,onCopy:c.events.onCopy,onHandleArtifactClick:c.events.onHandleArtifactClick}):null})}function Hr(e){var n;const r=c(null),[l,a]=i(!1),[d,u]=i({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),m=o(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(e.isDark),[e.isDark]);return s(()=>{if(!e.visible)return void a(!1);if(!e.anchorEl||!r.current)return void a(!0);let t=null,n=!1;const o=async()=>{var t,o;if(!e.anchorEl||!r.current)return;const{x:i,y:l}=await ge(e.anchorEl,r.current,{placement:null!=(t=e.placement)?t:"top",middleware:[ve(null!=(o=e.offset)?o:8),ye(),we({padding:8})],strategy:"fixed"});n||u({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(l)}px, 0)`})};return o().then(()=>{n||a(!0)}),t=pe(e.anchorEl,r.current,o),()=>{n=!0,null==t||t()}},[e.anchorEl,e.offset,e.placement,e.visible,l]),"undefined"==typeof document?null:e.visible&&l?xe(
|
|
189
|
+
/* @__PURE__ */t("div",{id:null!=(n=e.id)?n:void 0,ref:r,style:d,className:["markstream-react ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",m?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{xn as $,be as A,Ir as B,$e as C,bt as D,Nt as E,gr as F,bn as G,Lt as H,qt as I,vn as J,Vn as K,on as L,zn as M,_r as N,ft as O,wr as P,ht as Q,xr as R,kr as S,Mr as T,Un as U,Sr as V,wn as W,gt as X,Sn as Y,jn as Z,pt as _,lt as a,Tn as a0,Er as a1,mt as a2,Ae as a3,Bn as a4,kn as a5,Cn as a6,gn as a7,yn as a8,Kn as a9,Wn as aa,On as ab,Yn as ac,Re as ad,De as ae,Nn as af,Ct as b,Mt as c,Bt as d,St as e,Tt as f,Et as g,Dt as h,$t as i,zt as j,Ue as k,Gt as l,Qt as m,en as n,ln as o,an as p,$n as q,Pn as r,ar as s,br as t,Cr as u,Nr as v,rn as w,Br as x,Hr as y,Xn as z};
|