remons-render-markdown 2.0.1 → 2.0.2-beta.0
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/components/MermaidRenderer/index.d.ts +1 -1
- package/dist/components/RenderMarkdown/index.d.ts +1 -1
- package/dist/components/RenderMarkdown/utils/render-markdown/render-tab.d.ts +7 -0
- package/dist/hooks/useIncrementalRender.d.ts +7 -2
- package/dist/index.mjs +18 -18
- package/package.json +1 -1
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
* 多实例不再互相抢占第一个 .markdown 容器;增量渲染重建 DOM 后也无需重绑。
|
|
5
5
|
*/
|
|
6
6
|
export declare const tabsName = "markdown-tabs";
|
|
7
|
+
/**
|
|
8
|
+
* 增量 patch 后还原用户点选的 tab。
|
|
9
|
+
* morphdom 会用新 HTML 的 class 整体覆写按钮与面板,未列入保留名单的 active 会被擦掉,
|
|
10
|
+
* 表现为「输入一个字,选中的 tab 就跳回第一个」。
|
|
11
|
+
* 由 RenderMarkdown 在 patch 完成后同步调用(renderTab 的微任务在 patch 之前执行,管不到)。
|
|
12
|
+
*/
|
|
13
|
+
export declare function syncTabState(scope: ParentNode): void;
|
|
7
14
|
declare function renderTab(): void;
|
|
8
15
|
export default renderTab;
|
|
@@ -49,8 +49,13 @@ interface UseIncrementalRenderOptions {
|
|
|
49
49
|
* - 后续渲染:渲染为字符串,然后通过 morphdom patch 容器
|
|
50
50
|
* - 节流 patch 调用(真节流:首次立即执行 + 周期收尾),避免流式输出期间过多 DOM 操作
|
|
51
51
|
* - 渲染序号保证内容变化后,飞行中的渲染结果不会污染新状态
|
|
52
|
-
* - 按"标签 + className"语义 key 匹配节点,保护 customRenderers
|
|
53
|
-
*
|
|
52
|
+
* - 按"标签 + className"语义 key 匹配节点,保护 customRenderers(插件)产出的容器状态;
|
|
53
|
+
* 树内重名 key 会加 [n] 后缀消歧,避免 morphdom 单槽 key 映射让被删节点逃过销毁
|
|
54
|
+
* - 保留节点上 JS 添加的 data-* 属性(初始化守卫位)与运行时 class(折叠态/蒙层),
|
|
55
|
+
* 避免 patch 后被重复初始化或状态被新 HTML 覆写;源码拥有的 data-*(tab 的 data-active 等)
|
|
56
|
+
* 不回填,以新 HTML 为准
|
|
57
|
+
* - 渲染结果为空串、或渲染抛错,都会让 DOM 与源码保持一致(不静默丢弃本轮更新);
|
|
58
|
+
* 空输出同时把 hasContent 置假,与全量模式一样回退到 Empty 占位
|
|
54
59
|
* - 返回 inner 内容 <div> 的 ref 回调
|
|
55
60
|
*
|
|
56
61
|
* 注意:除 content 外的所有选项均为**初始化语义**——仅在挂载时读取一次,
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import e,{createContext as t,forwardRef as n,memo as r,useCallback as o,useContext as i,useEffect as c,useLayoutEffect as s,useMemo as a,useRef as l,useState as d}from"react";import{CaretDownOutlined as u,CaretRightOutlined as m,CheckCircleOutlined as h,CloseCircleOutlined as p,CloseOutlined as f,CodeOutlined as g,CopyFilled as v,DownOutlined as w,DownloadOutlined as y,DragOutlined as b,ExportOutlined as k,FullscreenExitOutlined as _,FullscreenOutlined as E,ImportOutlined as S,InfoCircleOutlined as x,LoadingOutlined as C,MinusOutlined as L,PlusOutlined as N,ReloadOutlined as T,RightOutlined as M,SearchOutlined as A,UnorderedListOutlined as $,UpOutlined as j,WarningOutlined as z}from"@ant-design/icons";import{createRoot as I}from"react-dom/client";import{Fragment as P,jsx as
|
|
1
|
+
import e,{createContext as t,forwardRef as n,memo as r,useCallback as o,useContext as i,useEffect as c,useLayoutEffect as s,useMemo as a,useRef as l,useState as d}from"react";import{CaretDownOutlined as u,CaretRightOutlined as m,CheckCircleOutlined as h,CloseCircleOutlined as p,CloseOutlined as f,CodeOutlined as g,CopyFilled as v,DownOutlined as w,DownloadOutlined as y,DragOutlined as b,ExportOutlined as k,FullscreenExitOutlined as _,FullscreenOutlined as E,ImportOutlined as S,InfoCircleOutlined as x,LoadingOutlined as C,MinusOutlined as L,PlusOutlined as N,ReloadOutlined as T,RightOutlined as M,SearchOutlined as A,UnorderedListOutlined as $,UpOutlined as j,WarningOutlined as z}from"@ant-design/icons";import{createRoot as I}from"react-dom/client";import{Fragment as P,jsx as q,jsxs as D}from"react/jsx-runtime";import F from"classnames";import{IsPC as O,copy as B}from"methods-r";import H from"markdown-it";import W from"markdown-it-anchor";import R from"markdown-it-link-attributes";import G from"highlight.js/lib/core";import{tab as V}from"@mdit/plugin-tab";import U from"markdown-it-github-alerts";import K from"markdown-it-task-lists";import Z from"photoswipe";import X from"morphdom";import Y from"highlight.js/lib/languages/javascript";import J from"highlight.js/lib/languages/typescript";import Q from"highlight.js/lib/languages/css";import ee from"highlight.js/lib/languages/json";import te from"highlight.js/lib/languages/bash";import ne from"highlight.js/lib/languages/xml";import re from"highlight.js/lib/languages/plaintext";import{createPortal as oe}from"react-dom";import ie from"@panzoom/panzoom";import{driver as ce}from"driver.js";var se=Object.create,ae=Object.defineProperty,le=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyNames,ue=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,he=(e,t)=>{let n={};for(var r in e)ae(n,r,{get:e[r],enumerable:!0});return t||ae(n,Symbol.toStringTag,{value:"Module"}),n},pe=/* @__PURE__ */((e,t,n)=>(n=null!=e?se(ue(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var o,i=de(t),c=0,s=i.length;c<s;c++)o=i[c],me.call(e,o)||o===n||ae(e,o,{get:(e=>t[e]).bind(null,o),enumerable:!(r=le(t,o))||r.enumerable});return e})(!t&&e&&e.__esModule&&me.call(e,"default")?n:ae(n,"default",{value:e,enumerable:!0}),e)))(/* @__PURE__ */((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e,t)=>{!function(){var e={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,r.call(this,n)))}return e}function r(t){if("string"==typeof t||"number"==typeof t)return this&&this[t]||t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(this,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var i in t)e.call(t,i)&&t[i]&&(r=o(r,this&&this[i]||i));return r}function o(e,t){return t?e?e+" "+t:e+t:e}void 0!==t&&t.exports?(n.default=n,t.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()})(),1),fe={container:"_container_1a6ji_4",item:"_item_1a6ji_16",toast:"_toast_1a6ji_19",fadeIn:"_fadeIn_1a6ji_1","toast-warning":"_toast-warning_1a6ji_31","toast-info":"_toast-info_1a6ji_34","toast-error":"_toast-error_1a6ji_37","toast-success":"_toast-success_1a6ji_40"},ge=pe.default.bind(fe),ve={warning:/* @__PURE__ */q(z,{style:{color:"#faad14",fontSize:"16px"}}),info:/* @__PURE__ */q(x,{style:{color:"#1890ff",fontSize:"16px"}}),error:/* @__PURE__ */q(p,{style:{color:"#ff4d4f",fontSize:"16px"}}),success:/* @__PURE__ */q(h,{style:{color:"#52c41a",fontSize:"16px"}})},we=({config:e})=>/* @__PURE__ */D("div",{className:ge("toast",`toast-${e.type}`),children:[ve[e.type],/* @__PURE__ */q("span",{children:e.content})]}),ye=()=>{const[e,t]=d([]),n=l(/* @__PURE__ */new Map);return c(()=>{const e=e=>{const{type:r,content:o,duration:i=3e3}=e.detail,c=`message-${Date.now()}-${Math.random()}`,s={key:c,content:o,type:r,duration:i};t(e=>[...e,s]);const a=window.setTimeout(()=>{(e=>{t(t=>t.filter(t=>t.key!==e));const r=n.current.get(e);r&&(clearTimeout(r),n.current.delete(e))})(c)},i);n.current.set(c,a)},r=()=>{t([]),n.current.forEach(e=>clearTimeout(e)),n.current.clear()};return window.addEventListener("custom-message",e),window.addEventListener("custom-message-clear",r),()=>{window.removeEventListener("custom-message",e),window.removeEventListener("custom-message-clear",r),n.current.forEach(e=>clearTimeout(e))}},[]),/* @__PURE__ */q("div",{className:ge("container"),children:e.map(e=>/* @__PURE__ */q("div",{className:ge("item"),children:/* @__PURE__ */q(we,{config:e})},e.key))})},be=!1,ke={dispatch:(e,t,n)=>{(()=>{if(be)return;be=!0;const e=document.createElement("div");e.id="custom-message-container",document.body.appendChild(e),I(e).render(/* @__PURE__ */q(ye,{}))})(),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("custom-message",{detail:{type:e,content:t,duration:n}}))})},warning:(e,t)=>ke.dispatch("warning",e,t),info:(e,t)=>ke.dispatch("info",e,t),error:(e,t)=>ke.dispatch("error",e,t),success:(e,t)=>ke.dispatch("success",e,t),destroy:()=>{window.dispatchEvent(new Event("custom-message-clear"))}},_e=pe.default.bind({"back-top":"_back-top_gdg5d_4"});function Ee(e){return e.current||window}var Se=r(({target:e,visibilityHeight:t=300})=>{const[n,r]=d(!1),o=l(null);c(()=>{if(e)try{o.current=e()}catch{o.current=null}},[e]),c(()=>{const e=Ee(o),n=()=>{r(function(e){return e===window?window.scrollY||document.documentElement.scrollTop:e.scrollTop}(e)>t)};return e.addEventListener("scroll",n,{passive:!0}),n(),()=>{e.removeEventListener("scroll",n)}},[t]);return n?/* @__PURE__ */q("div",{className:`${_e("back-top")} remons-markdown-circle`,onClick:()=>{Ee(o).scrollTo({top:0,behavior:"smooth"})},children:/* @__PURE__ */q(j,{})}):null}),xe="_empty_container_fkmsv_3",Ce="_description_fkmsv_12";function Le({description:e="暂无数据"}){/* @__PURE__ */
|
|
2
2
|
return D("div",{className:xe,children:[/* @__PURE__ */D("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",children:[
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return D("div",{className:Ne.tocItem,ref:u,style:{paddingLeft:14},children:[/* @__PURE__ */D("div",{className:`${Ne.tocItemTitle}${a?` ${Ne.active}`:""}`,children:[s&&/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */D("div",{className:Ne.tocHeader,children:[/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */F("div",{className:Ne.tocBody,ref:o,children:k.length>0?k.map((e,n)=>/* @__PURE__ */F(Te,{item:e,activeId:t,searchText:u},e.href||n)):u&&/* @__PURE__ */F("div",{className:Ne.tocEmpty,children:"未找到匹配项"})})]}):null}),je=/* @__PURE__ */new Set(["[ ]","[x]","[X]"]);function ze(e){e.core.ruler.after("inline","github-task-lists-empty",e=>{const t=e.tokens;for(let n=0;n<t.length;n++){const e=t[n];if("inline"!==e.type)continue;const r=e.content;if(!je.has(r))continue;let o=n-1;if(o>=0&&"paragraph_open"===t[o].type&&(o-=1),o<0||"list_item_open"!==t[o].type)continue;Ie(t[o],"task-list-item");for(let n=o-1;n>=0;n--)if("bullet_list_open"===t[n].type||"ordered_list_open"===t[n].type){Ie(t[n],"contains-task-list");break}const i=new e.constructor("html_inline","",0);i.content="[ ]"===r?'<input class="task-list-item-checkbox" disabled="" type="checkbox">':'<input class="task-list-item-checkbox" checked="" disabled="" type="checkbox">',e.children=[i],e.content=""}})}function Ie(e,t){const n=(e.attrGet("class")||"").split(/\s+/).filter(Boolean);n.includes(t)||e.attrSet("class",[...n,t].join(" "))}var Pe=/(\d\uFE0F?\u20E3)|([\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u3251-\u325F\u32B1-\u32BF])\uFE0F?/g,Fe=[10111,10121,10131],De={base:"mdNum",wide:"mdNumWide",cjk:"mdNumCjk"};function qe(e){const t=Number(e.charAt(0));return 0===t?"⓪":String.fromCharCode(9312+t-1)}function Be(e,t){return function(e){return e>=12881&&e<=12895||e>=12977&&e<=12991}(e)?t.cjk||t.wide:function(e){return e>=9321&&e<=9331||e>=9341&&e<=9351||e>=9361&&e<=9371||e>=9451&&e<=9460||e>=12881&&e<=12895||e>=12977&&e<=12991||Fe.indexOf(e)>=0}(e)?t.wide:t.base}function Oe(e,t){return`<span class="${Be(e.codePointAt(0)||0,t)}">${e}</span>`}function He(e,t=De){e.core.ruler.after("inline","circled-numbers",e=>{for(let n=0;n<e.tokens.length;n++){const r=e.tokens[n];"inline"===r.type&&r.children&&We(e,r.children,t)}})}function We(e,t,n){const r=e.Token;for(let o=0;o<t.length;o++){const e=t[o];if("text"!==e.type||!Pe.test(e.content))continue;Pe.lastIndex=0;const i=[];let c,s=0;for(;c=Pe.exec(e.content);){const t=c[1]?qe(c[1]):c[2];if(c.index>s){const t=new r("text","",0);t.content=e.content.slice(s,c.index),i.push(t)}const o=new r("html_inline","",0);o.content=Oe(t,n),i.push(o),s=c.index+c[0].length}if(s<e.content.length){const t=new r("text","",0);t.content=e.content.slice(s),i.push(t)}t.splice(o,1,...i),o+=i.length-1}}var Re=/^(vbscript|javascript|file|data):/,Ge=/^data:image\/(gif|png|jpeg|webp);/,Ve=/^data:image\/svg\+xml[;,]/i,Ue=/<\s*script|\bon[a-z]+\s*=|<!ENTITY|foreignobject/i;function Ke(e){const t=e.trim().toLowerCase();if(!Re.test(t))return!0;if(Ge.test(t))return!0;if(!Ve.test(t))return!1;const n=function(e){const t=e.indexOf(",");if(t<0)return null;const n=e.slice(0,t),r=e.slice(t+1);try{return/;base64/i.test(n)?"function"==typeof atob?atob(r):null:decodeURIComponent(r)}catch{return null}}(e);return null!==n&&!Ue.test(n)}var Ze={note:"注",tip:"提示",important:"重要",warning:"注意",caution:"警告"},Xe={note:'<i class="iconfont icon-note"></i>',tip:'<i class="iconfont icon-tip"></i>',important:'<i class="iconfont icon-important"></i>',warning:'<i class="iconfont icon-warning"></i>',caution:'<i class="iconfont icon-caution"></i>'};function Ye(e){return e.replace(/[\u{1F000}-\u{1FFFF}\u{200D}\u{FE0F}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2700}-\u{27BF}]/gu,"").trim()}var Je="markdown-tabs",Qe=`.${Je}-tabs-header`,et=!1;var tt=e=>{const t=e.target?.closest(`.${Je}-tab-button`);if(!t)return;const n=t.closest(Qe);if(!n)return;const r=n.closest(`.${Je}-tabs-wrapper`)?.querySelector(`.${Je}-tabs-container`);r&&function(e,t,n){const r=t.querySelectorAll(`.${Je}-tab-button`),o=Array.from(r).indexOf(e),i=n.querySelectorAll(`.${Je}-tab-content`);r.forEach(e=>e.classList.remove("active")),i.forEach(e=>e.classList.remove("active")),e.classList.add("active"),i[o]&&i[o].classList.add("active");const c=e.closest(".markdown"),s=e.offsetParent;c&&s&&c.scrollTop>s.offsetTop&&c.scrollTo({top:s.offsetTop,behavior:"smooth"})}(t,n,r)},nt=e=>{const t=e.target?.closest(Qe);t&&0!==Math.abs(e.deltaY)&&(t.scrollWidth<=t.clientWidth||(e.preventDefault(),t.scrollLeft+=e.deltaY))};function rt(e){if(e.dataset.maskInited)return;e.dataset.maskInited="1";const t=e.parentElement;if(!t)return;const n=()=>{const{scrollLeft:n,scrollWidth:r,clientWidth:o}=e,i=n>1,c=n+o<r-1;t.classList.remove("has-left-mask","has-right-mask","has-both-masks"),i&&c?t.classList.add("has-both-masks"):i?t.classList.add("has-left-mask"):c&&t.classList.add("has-right-mask")};e.addEventListener("scroll",n),n()}var ot=!1;var it=!1;function ct(){et||(et=!0,document.addEventListener("click",tt),document.addEventListener("wheel",nt,{passive:!1,capture:!0})),document.querySelectorAll(Qe).forEach(e=>rt(e)),ot||"undefined"==typeof MutationObserver||(ot=!0,new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1!==e.nodeType)return;const t=e;t.classList.contains("markdown-tabs-tabs-header")&&rt(t),t.querySelectorAll(Qe).forEach(e=>rt(e))})})}).observe(document.body,{childList:!0,subtree:!0})),it||(it=!0,window.addEventListener("resize",()=>{document.querySelectorAll(Qe).forEach(e=>{e.dispatchEvent(new Event("scroll"))})}))}var st="0.18.1",at=`https://registry.npmmirror.com/katex/${st}/files/dist/katex.min.css`,lt=`https://registry.npmmirror.com/katex/${st}/files/dist/katex.min.js`,dt=null;function ut(e,t={}){const n={throwOnError:!1,errorColor:"#cc0000",...t};function r(e,t){try{return function(){if(!window.katex)throw new Error("[katex-loader] KaTeX not loaded. Call ensureKatexLoaded() first.");return window.katex}().renderToString(e,{...n,displayMode:t})}catch(r){const t=r instanceof Error?r.message:String(r);return`<span style="color:${n.errorColor}" title="${o(t)}">${o(e)}</span>`}}function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}"undefined"!=typeof window&&window.katex||console.warn("[markdown-it-katex] KaTeX is not loaded yet. Call `await ensureKatexLoaded()` before using this plugin, or use `renderWithKatex()` helper instead."),e.inline.ruler.before("emphasis","katex_inline",(e,t)=>{if(36!==e.src.charCodeAt(e.pos))return!1;if(36===e.src.charCodeAt(e.pos+1))return!1;if(e.pos>0&&92===e.src.charCodeAt(e.pos-1))return!1;const n=e.pos+1;if(n>=e.posMax)return!1;if(/\s/.test(e.src[n]))return!1;let r=n;for(;r<e.posMax&&(36!==e.src.charCodeAt(r)||92===e.src.charCodeAt(r-1));)r++;if(r>=e.posMax)return!1;if(r===n)return!1;if(/\s/.test(e.src[r-1]))return!1;if(!t){const t=e.push("katex_inline","math",0);t.markup="$",t.content=e.src.slice(n,r)}return e.pos=r+1,!0}),e.block.ruler.after("blockquote","katex_block",(e,t,n,r)=>{const o=e.bMarks[t]+e.tShift[t];if(o+2>e.eMarks[t]||"$$"!==e.src.slice(o,o+2))return!1;if(r)return!0;let i=t+1,c=!1;for(;i<n;){const t=e.bMarks[i]+e.tShift[i];if("$$"===e.src.slice(t,e.eMarks[i]).trim()){c=!0;break}i++}const s=e.bMarks[t+1],a=c?e.bMarks[i]:e.eMarks[n-1];e.line=i+(c?1:0);const l=e.push("katex_block","math",0);return l.block=!0,l.markup="$$",l.content=e.src.slice(s,a).trim(),l.map=[t,e.line],!0}),e.renderer.rules.katex_inline=(e,t)=>r(e[t].content,!1),e.renderer.rules.katex_block=(e,t)=>`<div class="katex-block">${r(e[t].content,!0)}</div>\n`}function mt(e){return"string"!=typeof e?"":e.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g,"-").replace(/^-|-$/g,"").replace(/-+/g,"-")}function ht(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function pt(e){const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];if("heading_open"!==o.type)continue;const i=Number((o.tag||"").slice(1));if(!Number.isInteger(i)||i<1||i>6)continue;const c=e[r+1],s="inline"===c?.type?(c.content||"").trim():"";if(!s)continue;const a=o.attrGet("id"),l={title:s,href:("string"==typeof a?a:"")||mt(s),nodeName:`H${i}`,nodeTitle:`<h${i}>${ht(s)}</h${i}>`,children:[]};for(;n.length&&n[n.length-1].level>=i;)n.pop();const d=n[n.length-1];d?d.item.children.push(l):t.push(l),n.push({level:i,item:l})}return t}async function ft(e,t,n){const r="string"==typeof e?e:null==e?"":String(e);let o=!0;try{await function(e=15e3){return dt||("undefined"==typeof window?Promise.reject(/* @__PURE__ */new Error("[katex-loader] Requires a browser environment.")):window.katex?Promise.resolve():dt=new Promise((t,n)=>{const r=setTimeout(()=>{dt=null,n(/* @__PURE__ */new Error(`[katex-loader] KaTeX CDN timeout after ${e}ms.`))},e),o=document.querySelector(`script[src="${lt}"]`);if(o)return window.katex?(clearTimeout(r),void t()):(o.addEventListener("load",()=>{clearTimeout(r),t()}),void o.addEventListener("error",()=>{clearTimeout(r),dt=null,n(/* @__PURE__ */new Error(`[katex-loader] Failed to load ${lt}`))}));if(!document.querySelector(`link[href="${at}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=at,document.head.appendChild(e)}const i=document.createElement("script");i.src=lt,i.onload=()=>{clearTimeout(r),t()},i.onerror=()=>{clearTimeout(r),dt=null,i.remove(),n(/* @__PURE__ */new Error(`[katex-loader] Failed to load ${lt}`))},document.head.appendChild(i)}))}()}catch(l){o=!1,console.warn("[render-markdown] KaTeX 加载失败,公式将降级为纯文本:",l)}const i=function(){const e=/* @__PURE__ */new Set;return t=>{let n=t,r=1;for(;e.has(n);)n=`${t}-${r}`,r+=1;return e.add(n),n}}(),c=new H({langPrefix:"language-",html:n?.html??!0,highlight:function(e,t){if(t&&G.getLanguage(t))try{return G.highlight(e,{language:t}).value}catch(n){}return""}}).use(V,{name:Je}).use(W,{permalink:W.permalink.linkInsideHeader({class:"header-anchor",symbol:"#",placement:"after"}),slugify:e=>i(mt(e))}).use(R,{matcher:e=>e.match(/^https?:\/\//),attrs:{target:"_blank",rel:"noopener"}}).use(U,{titles:Ze,icons:Xe}).use(K).use(ze).use(He);o&&c.use(ut,{strict:!1,throwOnError:!1}),t&&t.forEach(e=>c.use(e)),c.validateLink=n?.validateLink??Ke;const s=c.parse(r,{});!function(e,t){let n=null;for(let l=e.length-1;l>=0;l--)if("fence"===e[l].type){n=e[l];break}if(!n||!n.map)return;const r=t.split("\n"),o=n.map[0],i=n.markup||"```",c="~"===i[0]?"~":"`",s=Math.max(3,i.length),a=new RegExp("^ {0,3}"+c+"{"+s+",}[ \\t]*$");for(let l=o+1;l<r.length;l++)if(a.test(r[l]))return;n.attrJoin("class","md-fence-open")}(s,r),o||(c.renderer.rules.katex_inline=(e,t)=>ht(e[t].content||""),c.renderer.rules.katex_block=(e,t)=>`<code>${ht(e[t].content||"")}</code>\n`);const a=c.renderer.render(s,c.options,{}).replace(/class="markdown-alert markdown-alert-(\w+)"[\s\S]*?class="markdown-alert-title"[^>]*>([\s\S]*?)<\/p>/g,(e,t,n)=>{const r=Ze[t];if(!r)return e;const o=Ye(n.replace(/<[^>]*>/g,""));if(o.toLowerCase()===t.toLowerCase()){const t=n.lastIndexOf(">");if(-1!==t){const i=n.substring(0,t+1)+Ye(n.substring(t+1)).replace(o,r);return e.replace(n,i)}}return e});return queueMicrotask(()=>ct()),{anchor:pt(s),info:a}}function gt(e){e&&"object"==typeof e?Object.entries(e).forEach(([e,t])=>{G.getLanguage(e)||G.registerLanguage(e,t)}):console.warn("[render-markdown] initHighlighter 需要传入一个语言包对象")}var vt="data-md-persist",wt="mermaid-react-root",yt="data-md-mermaid-src",bt=/* @__PURE__ */new WeakMap,kt=["pre",`.${wt}`];function _t(e){(Array.isArray(e)?e:[e]).forEach(e=>{kt.includes(e)||kt.push(e)})}function Et(e){(Array.isArray(e)?e:[e]).forEach(e=>{const t=kt.indexOf(e);t>=0&&kt.splice(t,1)})}var St=(e,t)=>t.some(t=>null!==e.closest(t))||kt.some(t=>null!==e.closest(t));function xt(e){const t=e.currentSrc||e.src,n={src:t,msrc:t,alt:e.alt||void 0,element:e.isConnected?e:void 0};e.naturalWidth&&e.naturalHeight&&(n.width=e.naturalWidth,n.height=e.naturalHeight);const r=e.getAttribute("srcset")||"";return/\d+w/.test(r)&&(n.srcset=r),n}var Ct=0,Lt=null;function Nt(e,t){if(e.active)return;const n=e.images.indexOf(t);if(n<0)return;const r=new Z({dataSource:e.images.map(xt),index:n,bgOpacity:1,initialZoomLevel:"fit",secondaryZoomLevel:1,maxZoomLevel:2,padding:{top:24,bottom:24,left:24,right:24},showHideAnimationType:"zoom",preload:[1,2],loop:!1,wheelToZoom:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",pinchToClose:!0,closeOnVerticalDrag:!0,clickToCloseNonZoomable:!0,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,mainClass:"md-image-preview",errorMsg:"图片加载失败",closeTitle:"关闭",zoomTitle:"放大 / 缩小",arrowPrevTitle:"上一张",arrowNextTitle:"下一张",counterTitle:"当前图片序号"});e.active=r;let o=!1,i=()=>{};const c=()=>{o||(o=!0,(Ct=Math.max(0,Ct-1))>0||null===Lt||(document.documentElement.style.overflow=Lt,Lt=null),i())};if(r.on("close",c),r.on("destroy",()=>{c(),e.active===r&&(e.active=null)}),!1===r.init())return void(e.active=null);!function(){if("undefined"==typeof document)return;if((Ct+=1)>1)return;const e=document.documentElement;Lt=e.style.overflow,e.style.overflow="hidden"}();const s=()=>{const e=r.currSlide?.zoomLevels;e&&e.fit&&(e.min=Math.min(e.min,.5*e.fit))};r.on("change",s),r.on("loadComplete",s),window.addEventListener("resize",s),s(),i=()=>window.removeEventListener("resize",s)}var Tt=/* @__PURE__ */new Map;function Mt(e,t){const n=Tt.get(e);n?n.push(t):Tt.set(e,[t])}function At(e){const t=Tt.get(e);t&&(t.forEach(e=>{try{e.unmount()}catch{}}),Tt.delete(e))}function $t(e){return Tt.get(e)?.[0]}function jt(){Tt.forEach((e,t)=>{t.isConnected||At(t)})}function zt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return`${t.toString(36)}-${e.length.toString(36)}`}function It(e){return!!e&&e.classList.contains("mermaid-react-root")&&e.hasAttribute("data-md-mermaid-src")}function Pt(e){if(e)return 1===e.nodeType&&e.classList?.contains("mermaid-react-root")?(At(e),void e.remove()):void e.querySelectorAll(`.${wt}`).forEach(e=>{At(e),e.remove()})}var Ft=/* @__PURE__ */new Set(["mermaid-render-noCode","code-collapsed","has-left-mask","has-right-mask","has-both-masks","active"]);function Dt(e){if(1!==e.nodeType)return null;const t=e,n=t.getAttribute("id");if(n)return`id:${n}`;const r=("string"==typeof t.className?t.className:"").split(/\s+/).filter(e=>e&&!e.startsWith("copy-")&&!Ft.has(e)).join(" ");return r?`${t.tagName.toLowerCase()}#${r}`:null}var qt="data-md-mounted",Bt=e=>{const t=e.getAttribute("data-md-key");return`${e.tagName.toLowerCase()}#${t??(e=>("string"==typeof e.className?e.className:"").split(/\s+/).filter(e=>e&&!e.startsWith("copy-")&&!Ft.has(e)).join(" "))(e)}`},Ot=e=>Array.from(e.attributes).some(e=>e.name.endsWith("-placeholder")),Ht=e=>{const t={};for(const n of Array.from(e.attributes))n.name.startsWith("data-")&&"data-md-persist"!==n.name&&"data-md-key"!==n.name&&(n.name.endsWith("-placeholder")||(t[n.name]=n.value));return t},Wt=e=>{const t=e.querySelector(`[${qt}]`);return t||(Array.from(e.querySelectorAll("*")).find(Ot)??null)},Rt=(e,t)=>{if(0===t.length)return;const n=/* @__PURE__ */new Set;Array.from(e.querySelectorAll("*")).filter(e=>Ot(e)).forEach(e=>{const r=e.closest(`[${vt}]`);if(!r)return;const o=Bt(r),i=t.find(t=>t.key===o&&!n.has(t)&&!!t.configEl&&((e,t)=>{const n=Ht(t),r=Ht(e);return Object.keys(n).every(e=>r[e]===n[e])})(t.configEl,e));i&&(n.add(i),r.replaceWith(i.el))});const r=Array.from(e.querySelectorAll(`[${vt}]`));t.forEach(t=>{if(n.has(t)||t.configEl)return;if(t.el.isConnected)return;const o=Bt(t.el),i=Dt(t.el),c=r.find(e=>e!==t.el&&e.isConnected&&!Wt(e)&&(Bt(e)===o||Dt(e)===i));c?c.replaceWith(t.el):e.appendChild(t.el),n.add(t)})};function Gt({content:e,codeType:t,customRenderers:n,throttleMs:r=16,html:i=!0,validateLink:s,onNodeDiscarded:a,onPatched:u}){const[m,h]=d([]),[p,f]=d(!1),g=l(""),v=l(null),w=l(!0),y=l(0),b=l({codeType:t,customRenderers:n,throttleMs:r,html:i,validateLink:s}),k=l({onNodeDiscarded:a,onPatched:u});k.current={onNodeDiscarded:a,onPatched:u};const _=o(async(e,t)=>{const{codeType:n,customRenderers:r,html:o,validateLink:i}=b.current,c=n&&"md"!==n?.toLocaleLowerCase()?"```"+n+"\n"+e+"\n```":e,s=await ft(c,r,{html:o,validateLink:i});if(!s||t!==y.current)return;const a=s.info;if(!a)return;const l=(e=0)=>{if(t!==y.current)return;const n=v.current;if(!n)return void(e<60&&setTimeout(()=>l(e+1),0));if(h(s.anchor||[]),w.current)return n.innerHTML=a,w.current=!1,void(g.current=c);const r=document.createElement("div");r.innerHTML=a;const o=(e=>{const t=[];e.querySelectorAll(`[${vt}]`).forEach(e=>{const n=e;n.classList.contains("pre-handle")||n.classList.contains("mermaid-react-root")||n.parentElement?.closest("[data-md-persist]")||t.push(n)});const n=t.map(e=>{const t=Wt(e);return{el:e,key:Bt(e),configEl:t,mounted:t?.hasAttribute(qt)??!1}});return n.forEach(e=>e.el.remove()),n})(n),i=/* @__PURE__ */new WeakMap;X(n,r,{childrenOnly:!0,getNodeKey:e=>Dt(e),onBeforeElUpdated(e,t){const n=/* @__PURE__ */new Map;for(const r of Array.from(e.attributes))r.name.startsWith("data-")&&!t.hasAttribute(r.name)&&n.set(r.name,r.value);return n.size&&i.set(e,n),!0},onElUpdated(e){const t=i.get(e);t&&(t.forEach((t,n)=>e.setAttribute(n,t)),i.delete(e))},onBeforeNodeAdded:e=>(1!==e.nodeType||!e.classList.contains("pre-handle"))&&e,onBeforeNodeDiscarded:e=>1!==e.nodeType||!e.hasAttribute("data-md-persist"),onNodeDiscarded(e){1===e.nodeType&&k.current.onNodeDiscarded&&k.current.onNodeDiscarded(e)}}),Rt(n,o),g.current=c,k.current.onPatched?.()};l()},[]),E=l(0),S=l(null),x=o((e,t)=>{const n=b.current.throttleMs,r=Date.now()-E.current,o=()=>{E.current=Date.now(),_(e,t)};if(r>=n)return null!=S.current&&(clearTimeout(S.current),S.current=null),void o();null!=S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{S.current=null,t===y.current&&o()},n-r)},[_]);return c(()=>{const{codeType:t}=b.current;if(!e)return y.current+=1,w.current=!0,f(!1),g.current="",void(v.current&&(v.current.innerHTML=""));const n=t&&"md"!==t?.toLocaleLowerCase()?"```"+t+"\n"+e+"\n```":e;if(g.current===n)return;y.current+=1;const r=y.current;f(!0),w.current?_(e,r):x(e,r)},[e,_,x]),c(()=>()=>{y.current+=1,null!=S.current&&(clearTimeout(S.current),S.current=null)},[]),{anchors:m,hasContent:p,setInnerRef:o(e=>{v.current=e},[])}}var Vt="_tocToggle_1egap_1",Ut=/* @__PURE__ */new Map,Kt=e=>{const t=e.querySelector("code");return t?tn(t):""},Zt=e=>{const t=e.querySelector("code");return t?Kt(e)+"\0"+(t.textContent??""):null},Xt=e=>{const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;return e?.querySelectorAll("pre").forEach(e=>{const o=e;if(!o.querySelector("code"))return;const i=(e=>{const t=e.nextElementSibling;return It(t)?t:null})(o);i&&r.set(o,i);const c=Zt(o);if(c){const e=t.get(c);e?e.push(o):t.set(c,[o])}const s=Kt(o),a=n.get(s);a?a.push(o):n.set(s,[o])}),{exact:t,byLanguage:n,charts:r}},Yt=0,Jt=e=>({enableMermaid:e.enableMermaid??e.isSlotMermaid??!0,showCollapseButton:e.showCollapseButton??e.isShowCollapsed??!0,toolbarDebounceMs:e.toolbarDebounceMs??e.mermaidDebounce??Qt,incremental:e.incremental??e.useIncremental??!1,transformSource:e.transformSource??e.chartConfig,html:e.html??!0}),Qt=100;function en({preNode:e}){const[t,n]=d(()=>e.classList.contains("code-collapsed")),r=l(null);c(()=>()=>r.current?.cancel(),[]);/* @__PURE__ */
|
|
12
|
-
return F("span",{className:"code-toggle",onClick:()=>{const t=!e.classList.contains("code-collapsed"),o=e.getBoundingClientRect().height,i=t?32:e.scrollHeight;if(r.current?.cancel(),i===o)return e.classList.toggle("code-collapsed",t),void n(t);t||e.classList.remove("code-collapsed");const c=e.animate([{height:`${o}px`},{height:`${i}px`}],{duration:280,easing:"ease-in-out"});r.current=c,t&&c.finished.then(()=>{r.current===c&&(e.classList.add("code-collapsed"),c.cancel())}),n(t)},children:/* @__PURE__ */F(t?m:u,{})})}var tn=e=>e.className.match(/language-([^\s]+)/)?.[1]??"",nn=(e,t)=>{const{enableMermaid:n,showCollapseButton:r}=Jt(t);e.querySelectorAll('code[class*="language-"]').forEach(e=>{const t=e,o=tn(t),i=n&&"mermaid"===o&&!t.classList.contains("md-fence-open")?"mermaid-render-noCode":"",c=t.parentNode;if(!c)return;const s=c.querySelector(".pre-handle");if(s){const e=s.getAttribute("data-md-copy-id");e&&!t.classList.contains(e)&&t.classList.add(e),i?t.classList.add(i):t.classList.remove("mermaid-render-noCode");const n=s.querySelector("[data-md-lang]");if(n&&n.textContent!==o&&(n.textContent=o),s.getAttribute("data-md-show-collapsed")===String(r))return;Ut.get(s)?.unmount(),Ut.delete(s),s.remove()}const a=(()=>{const e=globalThis.crypto?.randomUUID?.();return e?`copy-${e}`:`copy-${Date.now().toString(36)}-${(Yt++).toString(36)}-${Math.random().toString(36).slice(2,8)}`})();t.classList.add(a),i&&t.classList.add(i);const l=document.createElement("div");l.className="pre-handle",l.setAttribute(vt,""),l.setAttribute("data-md-copy-id",a),l.setAttribute("data-md-show-collapsed",String(r)),c.insertBefore(l,t);const d=/* @__PURE__ */D(P,{children:[/* @__PURE__ */F("img",{src:"https://remons.cn:3008/upload/md_assets/code_icon.png",alt:""}),/* @__PURE__ */F("span",{"data-md-lang":!0,children:o})]}),u=/* @__PURE__ */F("span",{className:"copy",onClick:()=>{const e=c.querySelector("code");e&&(O(e),ke.success("复制成功"))},children:/* @__PURE__ */F(v,{})}),m=I(l);Ut.set(l,m),m.render(/* @__PURE__ */D(P,{children:[/* @__PURE__ */F("span",{children:d}),/* @__PURE__ */D("span",{className:"code-handle",children:[u,r&&/* @__PURE__ */F(en,{preNode:c})]})]}))})};function rn(e){const{content:t,showBackTop:n,showToc:r,footer:i,incrementalThrottleMs:a}=e,u=Jt(e),{incremental:m,toolbarDebounceMs:h}=u,[p,f]=d(""),[g,v]=d([]),[w,y]=d(""),[b,k]=d(!1),_=l(null),E=l(null),S=l(null),x=l(e);x.current=e;const C=l(null);null===C.current&&(C.current=e.backTopTarget??("undefined"!=typeof document?document.body:null));const L=o(()=>k(e=>!e),[]),N=o(()=>k(!1),[]),T=o(()=>C.current,[]),M=o(e=>{const t=[];e.classList?.contains("pre-handle")&&t.push(e),e.querySelectorAll(".pre-handle").forEach(e=>t.push(e)),e.classList?.contains("mermaid-react-root")&&Pt(e),e.querySelectorAll(`.${wt}`).forEach(e=>Pt(e)),t.forEach(e=>{const t=Ut.get(e);t&&(t.unmount(),Ut.delete(e))})},[]),A=o(()=>{_.current&&nn(_.current,x.current)},[]),{anchors:j,hasContent:z,setInnerRef:I}=Gt({content:t,codeType:e.codeType,customRenderers:e.customRenderers,throttleMs:a,html:u.html,validateLink:e.validateLink,onNodeDiscarded:M,onPatched:A}),P=m?j:g,B=m?z:!!p;c(()=>{let e=null,n=!1;return(async()=>{if(!m){S.current=Xt(_.current);const{codeType:e}=x.current;let r="";r=e&&"md"!==e?.toLocaleLowerCase()?"```"+e+"\n"+t+"\n```":t;const o=await ft(r,x.current.customRenderers,{html:Jt(x.current).html,validateLink:x.current.validateLink});if(n)return;f(o?.info),v(o?.anchor||[])}e=setTimeout(async()=>{if(n)return;Jt(x.current).enableMermaid&&jt();const e=_.current;if(!e)return;nn(e,x.current);const{isPrintPreview:t,excludedSelectors:r}=x.current;!function(e,t={}){if(!e)return;const{instanceSelectors:n=[],isPrintPreview:r=!1}=t,o=Array.from(e.querySelectorAll("img"));if(r)return void o.forEach(e=>{e.style.maxHeight="none",e.style.width="auto",e.style.display="block"});let i=bt.get(e);i?i.instanceSelectors=n:(i={images:[],bound:!1,instanceSelectors:n,active:null},bt.set(e,i)),i.images=o.filter(e=>!St(e,n)),i.bound||(i.bound=!0,e.setAttribute("mdImgBound","1"),e.addEventListener("click",t=>{const n=t.target;if(!n||"IMG"!==n.tagName)return;const r=n,o=bt.get(e);o&&!St(r,o.instanceSelectors)&&Nt(o,r)}))}(e,{isPrintPreview:t,instanceSelectors:r});const{enableMermaid:o,transformSource:i}=Jt(x.current),{showDriverGuide:c,defaultCollapsed:s,cdn:a}=x.current;if(o){const{renderMermaidWithControls:n}=await Promise.resolve().then(()=>Wn);await n({showDriverGuide:c,isPrintPreview:t,transformSource:i,defaultCollapsed:s,cdn:a,rootElement:e})}},h)})(),()=>{n=!0,e&&clearTimeout(e)}},[t]),s(()=>{!m&&p&&(((e,t)=>{if(!e||!t)return;const n=Array.from(e.querySelectorAll("pre")),r=/* @__PURE__ */new Set,o=e=>{const n=t.charts.get(e);n&&(t.charts.delete(e),e.after(n))},i=(e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{const n=Kt(e);t.set(n,(t.get(n)??0)+1)}),t})(n),c=/* @__PURE__ */new Map;t.byLanguage.forEach((e,t)=>c.set(t,e.length)),n.forEach(e=>{const n=Zt(e);if(!n)return;const i=t.exact.get(n)?.shift();i&&i!==e&&(r.add(i),e.replaceWith(i),o(i))}),n.forEach(e=>{if(!e.isConnected)return;const n=e.querySelector("code");if(!n)return;const s=Kt(e),a=t.byLanguage.get(s);if(!a?.length)return;if(i.get(s)!==c.get(s))return;let l;for(;a.length;){const t=a.shift();if(t!==e&&!r.has(t)){l=t;break}}if(!l)return;r.add(l);const d=l.querySelector("code");d&&(d.innerHTML=n.innerHTML),e.replaceWith(l),o(l)})})(E.current,S.current),S.current=null,Ut.forEach((e,t)=>{t.isConnected||(e.unmount(),Ut.delete(t))}))},[p,m]);const O=l(null);return O.current=_.current,c(()=>()=>{const e=O.current;e&&(e.querySelectorAll(".pre-handle").forEach(e=>{const t=e,n=Ut.get(t);n&&(n.unmount(),Ut.delete(t))}),Pt(e),function(e){if(!e)return;const t=e,n=bt.get(t);n&&(n.active&&(n.active.destroy(),n.active=null),n.images=[],bt.delete(t))}(e))},[]),c(()=>{if(0===P.length)return;const e=[],t=n=>{n.forEach(n=>{e.push(n.href),n.children?.length&&t(n.children)})};t(P);const n=e.map(e=>document.getElementById(e)).filter(Boolean);if(0===n.length)return;const r=new IntersectionObserver(e=>{const t=e.filter(e=>e.isIntersecting);if(0===t.length)return;const n=t.reduce((e,t)=>t.boundingClientRect.top<e.boundingClientRect.top?t:e);y(n.target.id)},{rootMargin:"0px 0px -90% 0px",threshold:0});return n.forEach(e=>r.observe(e)),()=>r.disconnect()},[P]),c(()=>{const e=()=>{const e=window.location.hash.slice(1);if(!e)return;const t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"start"}),y(e))},t=setTimeout(e,100),n=()=>e();return window.addEventListener("hashchange",n),()=>{clearTimeout(t),window.removeEventListener("hashchange",n)}},[P]),/* @__PURE__ */D("div",{className:"markdown",children:[B?/* @__PURE__ */D("div",{className:"markdown-html",ref:_,children:[/* @__PURE__ */F("div",{style:{width:"100%"},...m?{ref:I}:{ref:E,dangerouslySetInnerHTML:{__html:p}}}),i&&/* @__PURE__ */F("div",{className:"markdown-footer",children:i})]}):/* @__PURE__ */F(Le,{}),n&&/* @__PURE__ */F(Se,{target:T}),r&&P.length>0&&/* @__PURE__ */F("div",{className:q(Vt,"md-toc-toggle","remons-markdown-circle"),onClick:L,children:/* @__PURE__ */F($,{})}),r&&/* @__PURE__ */F($e,{anchors:P,activeId:w,visible:b,onClose:N})]})}var on={javascript:Y,typescript:J,css:Q,json:ee,bash:te,xml:ne,plaintext:re};function cn(e,t){let n,r=!1;if(e instanceof Blob)n=URL.createObjectURL(e),r=!0;else{if("string"!=typeof e)return void ke.error("不支持的下载格式");n=e}const o=document.createElement("a");o.href=n,o.download=t,o.rel="noopener",o.style.display="none",document.body.appendChild(o),o.click(),o.remove(),r&&setTimeout(()=>URL.revokeObjectURL(n),1e3),ke.success(`${t} 已下载`)}function sn(e,t="image",n=2){const{w:r,h:o}=function(e){const t=e.match(/viewBox=["']?([^"'>\s]+(?:[\s,]+[^"'>\s]+){3})["']/i);let n=0,r=0;if(t){const e=t[1].split(/[\s,]+/).map(Number);4===e.length&&(n=e[2],r=e[3])}const o=e.match(/width=["']?\s*([\d.]+)\s*(px|pt|cm|mm|in)["']/i),i=e.match(/height=["']?\s*([\d.]+)\s*(px|pt|cm|mm|in)["']/i),c=o?parseFloat(o[1]):0,s=i?parseFloat(i[1]):0;return c>0&&s>0?{w:c,h:s}:n>0&&r>0?{w:n,h:r}:{w:c||n||800,h:s||r||600}}(e),i=function(e){const t=(new TextEncoder).encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return`data:image/svg+xml;base64,${btoa(n)}`}(e),c=new Image;c.crossOrigin="anonymous",c.src=i,c.onload=()=>{const e=document.createElement("canvas");e.width=Math.max(1,Math.round(r*n)),e.height=Math.max(1,Math.round(o*n));const i=e.getContext("2d");i.fillStyle="#ffffff",i.fillRect(0,0,e.width,e.height),i.scale(n,n),i.drawImage(c,0,0,r,o),e.toBlob(e=>{e?cn(e,`${t}.png`):ke.error("PNG 生成失败")},"image/png")},c.onerror=()=>{ke.error("PNG 生成失败:图片加载失败")}}var an="app-theme-mode",ln="light",dn="dark";function un(e){return"light"===e||"dark"===e||"system"===e}function mn(){try{const e=localStorage.getItem(an);if(un(e))return e}catch{}return"system"}function hn(e){return"system"===e?"undefined"==typeof window?ln:window.matchMedia("(prefers-color-scheme: dark)").matches?dn:ln:e}function pn(e){"undefined"!=typeof document&&(document.documentElement.dataset.theme=e)}function fn(){"undefined"!=typeof window&&pn(hn(mn()))}var gn=t(null);function vn({children:t}){const[n,r]=d(()=>mn()),[i,u]=d(()=>hn(n)),m=l(null),h=o(e=>{m.current=e,pn(e)},[]);s(()=>{h(hn(mn()))},[h]);const p=o(e=>{if(un(e)){r(e);try{localStorage.setItem(an,e),window.dispatchEvent(new Event("storage"))}catch{}}else console.warn(`[render-markdown] 非法的主题模式: ${e},应为 light | dark | system`)},[]);c(()=>{const e=hn(n);u(e),h(e)},[n,h]),c(()=>{if("system"!==n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?dn:ln;u(t),h(t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[n,h]),c(()=>{const e=()=>{const e=mn();e!==n&&r(e)};window.addEventListener("storage",e);const t=new MutationObserver(()=>{const e=document.documentElement.dataset.theme;e!==m.current&&("light"!==e&&"dark"!==e||e===i||u(e))});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{window.removeEventListener("storage",e),t.disconnect()}},[n,i]);const f=i===dn,g=a(()=>({theme:i,mode:n,isDark:f,setMode:p}),[i,n,f,p]);return e.createElement(gn.Provider,{value:g},t)}function wn(){const e=i(gn);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var yn={"modal-mask":"_modal-mask_dzv9e_4","modal-mask-visible":"_modal-mask-visible_dzv9e_18",modal:"_modal_dzv9e_4","modal-header":"_modal-header_dzv9e_34","modal-title":"_modal-title_dzv9e_41","modal-close":"_modal-close_dzv9e_46","modal-body":"_modal-body_dzv9e_62","modal-footer":"_modal-footer_dzv9e_67"},bn=pe.default.bind(yn),kn=({open:e,title:t,width:n=520,onCancel:r,footer:o,className:i="",children:s})=>{const a=()=>{r?.()};if(c(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&a()};return document.addEventListener("keydown",t),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",t),document.body.style.overflow=""}},[e]),!e)return null;const l=/* @__PURE__ */F("div",{className:bn("modal-mask","modal-mask-visible"),onClick:e=>{e.target===e.currentTarget&&a()},children:/* @__PURE__ */D("div",{className:bn("modal",i),style:{width:n},onClick:e=>{e.stopPropagation()},children:[
|
|
13
|
-
/* @__PURE__ */D("div",{className:
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
return D("div",{ref:a,className:
|
|
16
|
-
return
|
|
17
|
-
return
|
|
18
|
-
return D("div",{ref:x,className:pe.default.bind(
|
|
19
|
-
/* @__PURE__ */D("div",{className:`${
|
|
3
|
+
/* @__PURE__ */q("rect",{x:"8",y:"16",width:"48",height:"36",rx:"4",stroke:"#d9d9d9",strokeWidth:"2"}),
|
|
4
|
+
/* @__PURE__ */q("line",{x1:"16",y1:"28",x2:"48",y2:"28",stroke:"#d9d9d9",strokeWidth:"2"}),
|
|
5
|
+
/* @__PURE__ */q("line",{x1:"16",y1:"36",x2:"40",y2:"36",stroke:"#d9d9d9",strokeWidth:"2"}),
|
|
6
|
+
/* @__PURE__ */q("line",{x1:"16",y1:"44",x2:"32",y2:"44",stroke:"#d9d9d9",strokeWidth:"2"})]}),/* @__PURE__ */q("span",{className:Ce,children:e})]})}var Ne={tocSidebar:"_tocSidebar_emxjv_1",open:"_open_emxjv_16",tocHeader:"_tocHeader_emxjv_31",tocTitle:"_tocTitle_emxjv_38",tocActions:"_tocActions_emxjv_43",tocSearchBar:"_tocSearchBar_emxjv_53",tocSearchInput:"_tocSearchInput_emxjv_60",tocSearchClear:"_tocSearchClear_emxjv_78",tocSearchExit:"_tocSearchExit_emxjv_90",tocBody:"_tocBody_emxjv_103",tocItem:"_tocItem_emxjv_109",tocItemTitle:"_tocItemTitle_emxjv_109",active:"_active_emxjv_119",tocLink:"_tocLink_emxjv_122",tocExpandIcon:"_tocExpandIcon_emxjv_126",tocChildren:"_tocChildren_emxjv_153",highlight:"_highlight_emxjv_156",tocEmpty:"_tocEmpty_emxjv_160"};function Te({item:e,depth:t=0,activeId:n,searchText:r}){const[o,i]=d(!0),s=e.children&&e.children.length>0,a=e.href===n,u=l(null),m=s?Ae(e.children,r):[];if(r&&!m.length&&!Me(e.title,r))return null;c(()=>{n&&s&&e.children.some(e=>e.href===n)&&i(!0)},[n,s,e.children]);/* @__PURE__ */
|
|
7
|
+
return D("div",{className:Ne.tocItem,ref:u,style:{paddingLeft:14},children:[/* @__PURE__ */D("div",{className:`${Ne.tocItemTitle}${a?` ${Ne.active}`:""}`,children:[s&&/* @__PURE__ */q("span",{className:Ne.tocExpandIcon,onClick:e=>{e.stopPropagation(),i(!o)},children:/* @__PURE__ */q(o?w:M,{})}),/* @__PURE__ */q("a",{className:Ne.tocLink,href:`#${e.href}`,onClick:t=>{t.preventDefault();const n=e.href,r=document.getElementById(n);r&&(history.pushState(null,"",`#${n}`),r.scrollIntoView({behavior:"smooth",block:"start"}))},children:(e=>{if(!r)return e;const t=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(r),n=new RegExp(`(${t})`,"gi");return e.split(n).map((e,t)=>e.toLowerCase().includes(r.toLowerCase())?/* @__PURE__ */q("span",{className:Ne.highlight,children:e},t):e)})(e.title)})]}),s&&o&&/* @__PURE__ */q("div",{className:Ne.tocChildren,children:r?m.map((e,o)=>/* @__PURE__ */q(Te,{item:e,depth:t+1,activeId:n,searchText:r},e.href||o)):e.children.map((e,o)=>/* @__PURE__ */q(Te,{item:e,depth:t+1,activeId:n,searchText:r},e.href||o))})]})}function Me(e,t){return!t||e.toLowerCase().includes(t.toLowerCase())}function Ae(e,t){return t?e.map(e=>{const n=Ae(e.children,t),r=Me(e.title,t);return r||n.length>0?{...e,children:r?e.children:n}:null}).filter(Boolean):e}var $e=r(function({anchors:e,activeId:t,visible:n,onClose:r}){const o=l(null),i=l(null),s=l(null),a=l(null),[u,m]=d(""),[h,p]=d(!1),[g,v]=d(n),[w,y]=d(n);c(()=>{if(n){v(!0);const e=requestAnimationFrame(()=>y(!0));return()=>cancelAnimationFrame(e)}y(!1);const e=setTimeout(()=>v(!1),220);return()=>clearTimeout(e)},[n]),c(()=>{if(!n)return;const e=e=>{const t=e.target;a.current&&a.current.contains(t)||t.closest(".md-toc-toggle")||r()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n,r]),c(()=>{if(!t||!o.current||!n)return;const e=o.current.querySelector(`.${Ne.active}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})},[t,n]),c(()=>{if(!h)return;const e=e=>{s.current&&!s.current.contains(e.target)&&(p(!1),m(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]);const b=()=>{m(""),p(!1)},k=Ae(e,u);return e&&0!==e.length&&g?/* @__PURE__ */D("div",{ref:a,className:F(Ne.tocSidebar,"md-toc-sidebar",{[Ne.open]:w}),children:[
|
|
8
|
+
/* @__PURE__ */D("div",{className:Ne.tocHeader,children:[/* @__PURE__ */q("span",{className:Ne.tocTitle,children:"目录"}),/* @__PURE__ */D("div",{className:Ne.tocActions,children:[!h&&/* @__PURE__ */q("span",{className:"remons-markdown-circle",onClick:()=>{p(!0),setTimeout(()=>i.current?.focus(),50)},title:"搜索",children:/* @__PURE__ */q(A,{})}),/* @__PURE__ */q("span",{className:F("remons-markdown-circle",Ne.tocClose),onClick:r,children:/* @__PURE__ */q(f,{})})]})]}),h&&/* @__PURE__ */D("div",{ref:s,className:Ne.tocSearchBar,children:[
|
|
9
|
+
/* @__PURE__ */q("input",{ref:i,className:Ne.tocSearchInput,type:"text",placeholder:"搜索目录…",value:u,onChange:e=>{m(e.target.value)}}),u&&/* @__PURE__ */q("span",{className:Ne.tocSearchClear,onClick:b,children:/* @__PURE__ */q(f,{})}),
|
|
10
|
+
/* @__PURE__ */q("span",{className:Ne.tocSearchExit,onClick:b,title:"退出搜索",children:"×"})]}),
|
|
11
|
+
/* @__PURE__ */q("div",{className:Ne.tocBody,ref:o,children:k.length>0?k.map((e,n)=>/* @__PURE__ */q(Te,{item:e,activeId:t,searchText:u},e.href||n)):u&&/* @__PURE__ */q("div",{className:Ne.tocEmpty,children:"未找到匹配项"})})]}):null}),je=/* @__PURE__ */new Set(["[ ]","[x]","[X]"]);function ze(e){e.core.ruler.after("inline","github-task-lists-empty",e=>{const t=e.tokens;for(let n=0;n<t.length;n++){const e=t[n];if("inline"!==e.type)continue;const r=e.content;if(!je.has(r))continue;let o=n-1;if(o>=0&&"paragraph_open"===t[o].type&&(o-=1),o<0||"list_item_open"!==t[o].type)continue;Ie(t[o],"task-list-item");for(let n=o-1;n>=0;n--)if("bullet_list_open"===t[n].type||"ordered_list_open"===t[n].type){Ie(t[n],"contains-task-list");break}const i=new e.constructor("html_inline","",0);i.content="[ ]"===r?'<input class="task-list-item-checkbox" disabled="" type="checkbox">':'<input class="task-list-item-checkbox" checked="" disabled="" type="checkbox">',e.children=[i],e.content=""}})}function Ie(e,t){const n=(e.attrGet("class")||"").split(/\s+/).filter(Boolean);n.includes(t)||e.attrSet("class",[...n,t].join(" "))}var Pe=/(\d\uFE0F?\u20E3)|([\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u3251-\u325F\u32B1-\u32BF])\uFE0F?/g,qe=[10111,10121,10131],De={base:"mdNum",wide:"mdNumWide",cjk:"mdNumCjk"};function Fe(e){const t=Number(e.charAt(0));return 0===t?"⓪":String.fromCharCode(9312+t-1)}function Oe(e,t){return function(e){return e>=12881&&e<=12895||e>=12977&&e<=12991}(e)?t.cjk||t.wide:function(e){return e>=9321&&e<=9331||e>=9341&&e<=9351||e>=9361&&e<=9371||e>=9451&&e<=9460||e>=12881&&e<=12895||e>=12977&&e<=12991||qe.indexOf(e)>=0}(e)?t.wide:t.base}function Be(e,t){return`<span class="${Oe(e.codePointAt(0)||0,t)}">${e}</span>`}function He(e,t=De){e.core.ruler.after("inline","circled-numbers",e=>{for(let n=0;n<e.tokens.length;n++){const r=e.tokens[n];"inline"===r.type&&r.children&&We(e,r.children,t)}})}function We(e,t,n){const r=e.Token;for(let o=0;o<t.length;o++){const e=t[o];if("text"!==e.type||!Pe.test(e.content))continue;Pe.lastIndex=0;const i=[];let c,s=0;for(;c=Pe.exec(e.content);){const t=c[1]?Fe(c[1]):c[2];if(c.index>s){const t=new r("text","",0);t.content=e.content.slice(s,c.index),i.push(t)}const o=new r("html_inline","",0);o.content=Be(t,n),i.push(o),s=c.index+c[0].length}if(s<e.content.length){const t=new r("text","",0);t.content=e.content.slice(s),i.push(t)}t.splice(o,1,...i),o+=i.length-1}}var Re=/^(vbscript|javascript|file|data):/,Ge=/^data:image\/(gif|png|jpeg|webp);/,Ve=/^data:image\/svg\+xml[;,]/i,Ue=/<\s*script|\bon[a-z]+\s*=|<!ENTITY|foreignobject/i;function Ke(e){const t=e.trim().toLowerCase();if(!Re.test(t))return!0;if(Ge.test(t))return!0;if(!Ve.test(t))return!1;const n=function(e){const t=e.indexOf(",");if(t<0)return null;const n=e.slice(0,t),r=e.slice(t+1);try{return/;base64/i.test(n)?"function"==typeof atob?atob(r):null:decodeURIComponent(r)}catch{return null}}(e);return null!==n&&!Ue.test(n)}var Ze={note:"注",tip:"提示",important:"重要",warning:"注意",caution:"警告"},Xe={note:'<i class="iconfont icon-note"></i>',tip:'<i class="iconfont icon-tip"></i>',important:'<i class="iconfont icon-important"></i>',warning:'<i class="iconfont icon-warning"></i>',caution:'<i class="iconfont icon-caution"></i>'};function Ye(e){return e.replace(/[\u{1F000}-\u{1FFFF}\u{200D}\u{FE0F}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2700}-\u{27BF}]/gu,"").trim()}var Je="markdown-tabs",Qe=`.${Je}-tabs-header`,et=`.${Je}-tabs-wrapper`,tt=`.${Je}-tab-button`,nt=`.${Je}-tab-content`,rt="data-md-user-active",ot="data-md-src-active",it="data-md-tabs-count",ct=!1,st=(e,t)=>{const n=e.getAttribute("data-tab");return null!==n&&/^\d+$/.test(n)?Number(n):Array.from(t.querySelectorAll(tt)).indexOf(e)},at=e=>{const t=e.querySelector(Qe);if(!t)return-1;const n=t.querySelector(`${tt}[data-active]`);return n?st(n,t):-1};function lt(e,t,n){const r=t.querySelectorAll(tt),o=n.querySelectorAll(nt);r.forEach(e=>e.classList.remove("active")),o.forEach(e=>e.classList.remove("active"));const i=r[e];if(!i)return;i.classList.add("active");const c=n.querySelector(`${nt}[data-index="${e}"]`)??o[e];c&&c.classList.add("active")}function dt(e){e.querySelectorAll(et).forEach(e=>{const t=e.getAttribute(rt);if(null===t||!/^\d+$/.test(t))return;const n=e.querySelector(Qe),r=e.querySelector(`.${Je}-tabs-container`);if(!n||!r)return;const o=()=>{e.removeAttribute(rt),e.removeAttribute(ot),e.removeAttribute(it)};if(Number(e.getAttribute(ot))!==at(e))return void o();if(Number(e.getAttribute(it))!==n.querySelectorAll(tt).length)return void o();const i=Number(t);if(!n.querySelectorAll(tt)[i])return;const c=n.querySelector(`${tt}.active`);c&&st(c,n)!==i&<(i,n,r)})}var ut=e=>{const t=e.target?.closest(tt);if(!t)return;const n=t.closest(Qe);if(!n)return;const r=n.closest(`.${Je}-tabs-wrapper`)?.querySelector(`.${Je}-tabs-container`);r&&function(e,t,n){const r=st(e,t);lt(r,t,n);const o=e.closest(et);o&&(o.setAttribute(rt,String(r)),o.setAttribute(ot,String(at(o))),o.setAttribute(it,String(t.querySelectorAll(tt).length)));const i=e.closest(".markdown"),c=e.offsetParent;i&&c&&i.scrollTop>c.offsetTop&&i.scrollTo({top:c.offsetTop,behavior:"smooth"})}(t,n,r)},mt=e=>{const t=e.target?.closest(Qe);t&&0!==Math.abs(e.deltaY)&&(t.scrollWidth<=t.clientWidth||(e.preventDefault(),t.scrollLeft+=e.deltaY))};function ht(e){if(e.dataset.maskInited)return;e.dataset.maskInited="1";const t=e.parentElement;if(!t)return;const n=()=>{const{scrollLeft:n,scrollWidth:r,clientWidth:o}=e,i=n>1,c=n+o<r-1;t.classList.remove("has-left-mask","has-right-mask","has-both-masks"),i&&c?t.classList.add("has-both-masks"):i?t.classList.add("has-left-mask"):c&&t.classList.add("has-right-mask")};e.addEventListener("scroll",n),n()}var pt=!1;var ft=!1;function gt(){ct||(ct=!0,document.addEventListener("click",ut),document.addEventListener("wheel",mt,{passive:!1,capture:!0})),document.querySelectorAll(Qe).forEach(e=>ht(e)),pt||"undefined"==typeof MutationObserver||(pt=!0,new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1!==e.nodeType)return;const t=e;t.classList.contains("markdown-tabs-tabs-header")&&ht(t),t.querySelectorAll(Qe).forEach(e=>ht(e))})})}).observe(document.body,{childList:!0,subtree:!0})),ft||(ft=!0,window.addEventListener("resize",()=>{document.querySelectorAll(Qe).forEach(e=>{e.dispatchEvent(new Event("scroll"))})}))}var vt="0.18.1",wt=`https://registry.npmmirror.com/katex/${vt}/files/dist/katex.min.css`,yt=`https://registry.npmmirror.com/katex/${vt}/files/dist/katex.min.js`,bt=null;function kt(e,t={}){const n={throwOnError:!1,errorColor:"#cc0000",...t};function r(e,t){try{return function(){if(!window.katex)throw new Error("[katex-loader] KaTeX not loaded. Call ensureKatexLoaded() first.");return window.katex}().renderToString(e,{...n,displayMode:t})}catch(r){const t=r instanceof Error?r.message:String(r);return`<span style="color:${n.errorColor}" title="${o(t)}">${o(e)}</span>`}}function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}"undefined"!=typeof window&&window.katex||console.warn("[markdown-it-katex] KaTeX is not loaded yet. Call `await ensureKatexLoaded()` before using this plugin, or use `renderWithKatex()` helper instead."),e.inline.ruler.before("emphasis","katex_inline",(e,t)=>{if(36!==e.src.charCodeAt(e.pos))return!1;if(36===e.src.charCodeAt(e.pos+1))return!1;if(e.pos>0&&92===e.src.charCodeAt(e.pos-1))return!1;const n=e.pos+1;if(n>=e.posMax)return!1;if(/\s/.test(e.src[n]))return!1;let r=n;for(;r<e.posMax&&(36!==e.src.charCodeAt(r)||92===e.src.charCodeAt(r-1));)r++;if(r>=e.posMax)return!1;if(r===n)return!1;if(/\s/.test(e.src[r-1]))return!1;if(!t){const t=e.push("katex_inline","math",0);t.markup="$",t.content=e.src.slice(n,r)}return e.pos=r+1,!0}),e.block.ruler.after("blockquote","katex_block",(e,t,n,r)=>{const o=e.bMarks[t]+e.tShift[t];if(o+2>e.eMarks[t]||"$$"!==e.src.slice(o,o+2))return!1;if(r)return!0;let i=t+1,c=!1;for(;i<n;){const t=e.bMarks[i]+e.tShift[i];if("$$"===e.src.slice(t,e.eMarks[i]).trim()){c=!0;break}i++}const s=e.bMarks[t+1],a=c?e.bMarks[i]:e.eMarks[n-1];e.line=i+(c?1:0);const l=e.push("katex_block","math",0);return l.block=!0,l.markup="$$",l.content=e.src.slice(s,a).trim(),l.map=[t,e.line],!0}),e.renderer.rules.katex_inline=(e,t)=>r(e[t].content,!1),e.renderer.rules.katex_block=(e,t)=>`<div class="katex-block">${r(e[t].content,!0)}</div>\n`}function _t(e){return"string"!=typeof e?"":e.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g,"-").replace(/^-|-$/g,"").replace(/-+/g,"-")}function Et(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function St(e){const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];if("heading_open"!==o.type)continue;const i=Number((o.tag||"").slice(1));if(!Number.isInteger(i)||i<1||i>6)continue;const c=e[r+1],s="inline"===c?.type?(c.content||"").trim():"";if(!s)continue;const a=o.attrGet("id"),l={title:s,href:("string"==typeof a?a:"")||_t(s),nodeName:`H${i}`,nodeTitle:`<h${i}>${Et(s)}</h${i}>`,children:[]};for(;n.length&&n[n.length-1].level>=i;)n.pop();const d=n[n.length-1];d?d.item.children.push(l):t.push(l),n.push({level:i,item:l})}return t}async function xt(e,t,n){const r="string"==typeof e?e:null==e?"":String(e);let o=!0;try{await function(e=15e3){return bt||("undefined"==typeof window?Promise.reject(/* @__PURE__ */new Error("[katex-loader] Requires a browser environment.")):window.katex?Promise.resolve():bt=new Promise((t,n)=>{const r=setTimeout(()=>{bt=null,n(/* @__PURE__ */new Error(`[katex-loader] KaTeX CDN timeout after ${e}ms.`))},e),o=document.querySelector(`script[src="${yt}"]`);if(o)return window.katex?(clearTimeout(r),void t()):(o.addEventListener("load",()=>{clearTimeout(r),t()}),void o.addEventListener("error",()=>{clearTimeout(r),bt=null,n(/* @__PURE__ */new Error(`[katex-loader] Failed to load ${yt}`))}));if(!document.querySelector(`link[href="${wt}"]`)){const e=document.createElement("link");e.rel="stylesheet",e.href=wt,document.head.appendChild(e)}const i=document.createElement("script");i.src=yt,i.onload=()=>{clearTimeout(r),t()},i.onerror=()=>{clearTimeout(r),bt=null,i.remove(),n(/* @__PURE__ */new Error(`[katex-loader] Failed to load ${yt}`))},document.head.appendChild(i)}))}()}catch(l){o=!1,console.warn("[render-markdown] KaTeX 加载失败,公式将降级为纯文本:",l)}const i=function(){const e=/* @__PURE__ */new Set;return t=>{let n=t,r=1;for(;e.has(n);)n=`${t}-${r}`,r+=1;return e.add(n),n}}(),c=new H({langPrefix:"language-",html:n?.html??!0,highlight:function(e,t){if(t&&G.getLanguage(t))try{return G.highlight(e,{language:t}).value}catch(n){}return""}}).use(V,{name:Je}).use(W,{permalink:W.permalink.linkInsideHeader({class:"header-anchor",symbol:"#",placement:"after"}),slugify:e=>i(_t(e))}).use(R,{matcher:e=>e.match(/^https?:\/\//),attrs:{target:"_blank",rel:"noopener"}}).use(U,{titles:Ze,icons:Xe}).use(K).use(ze).use(He);o&&c.use(kt,{strict:!1,throwOnError:!1}),t&&t.forEach(e=>c.use(e)),c.validateLink=n?.validateLink??Ke;const s=c.parse(r,{});!function(e,t){let n=null;for(let l=e.length-1;l>=0;l--)if("fence"===e[l].type){n=e[l];break}if(!n||!n.map)return;const r=t.split("\n"),o=n.map[0],i=n.markup||"```",c="~"===i[0]?"~":"`",s=Math.max(3,i.length),a=new RegExp("^ {0,3}"+c+"{"+s+",}[ \\t]*$");for(let l=o+1;l<r.length;l++)if(a.test(r[l]))return;n.attrJoin("class","md-fence-open")}(s,r),o||(c.renderer.rules.katex_inline=(e,t)=>Et(e[t].content||""),c.renderer.rules.katex_block=(e,t)=>`<code>${Et(e[t].content||"")}</code>\n`);const a=c.renderer.render(s,c.options,{}).replace(/class="markdown-alert markdown-alert-(\w+)"[\s\S]*?class="markdown-alert-title"[^>]*>([\s\S]*?)<\/p>/g,(e,t,n)=>{const r=Ze[t];if(!r)return e;const o=Ye(n.replace(/<[^>]*>/g,""));if(o.toLowerCase()===t.toLowerCase()){const t=n.lastIndexOf(">");if(-1!==t){const i=n.substring(0,t+1)+Ye(n.substring(t+1)).replace(o,r);return e.replace(n,i)}}return e});return queueMicrotask(()=>gt()),{anchor:St(s),info:a}}function Ct(e){e&&"object"==typeof e?Object.entries(e).forEach(([e,t])=>{G.getLanguage(e)||G.registerLanguage(e,t)}):console.warn("[render-markdown] initHighlighter 需要传入一个语言包对象")}var Lt="data-md-persist",Nt="mermaid-react-root",Tt="data-md-mermaid-src",Mt=/* @__PURE__ */new WeakMap,At=["pre",`.${Nt}`];function $t(e){(Array.isArray(e)?e:[e]).forEach(e=>{At.includes(e)||At.push(e)})}function jt(e){(Array.isArray(e)?e:[e]).forEach(e=>{const t=At.indexOf(e);t>=0&&At.splice(t,1)})}var zt=(e,t)=>t.some(t=>null!==e.closest(t))||At.some(t=>null!==e.closest(t));function It(e){const t=e.currentSrc||e.src,n={src:t,msrc:t,alt:e.alt||void 0,element:e.isConnected?e:void 0};e.naturalWidth&&e.naturalHeight&&(n.width=e.naturalWidth,n.height=e.naturalHeight);const r=e.getAttribute("srcset")||"";return/\d+w/.test(r)&&(n.srcset=r),n}var Pt=0,qt=null;function Dt(e,t){if(e.active)return;const n=e.images.indexOf(t);if(n<0)return;const r=new Z({dataSource:e.images.map(It),index:n,bgOpacity:1,initialZoomLevel:"fit",secondaryZoomLevel:1,maxZoomLevel:2,padding:{top:24,bottom:24,left:24,right:24},showHideAnimationType:"zoom",preload:[1,2],loop:!1,wheelToZoom:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",pinchToClose:!0,closeOnVerticalDrag:!0,clickToCloseNonZoomable:!0,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,mainClass:"md-image-preview",errorMsg:"图片加载失败",closeTitle:"关闭",zoomTitle:"放大 / 缩小",arrowPrevTitle:"上一张",arrowNextTitle:"下一张",counterTitle:"当前图片序号"});e.active=r;let o=!1,i=()=>{};const c=()=>{o||(o=!0,(Pt=Math.max(0,Pt-1))>0||null===qt||(document.documentElement.style.overflow=qt,qt=null),i())};if(r.on("close",c),r.on("destroy",()=>{c(),e.active===r&&(e.active=null)}),!1===r.init())return void(e.active=null);!function(){if("undefined"==typeof document)return;if((Pt+=1)>1)return;const e=document.documentElement;qt=e.style.overflow,e.style.overflow="hidden"}();const s=()=>{const e=r.currSlide?.zoomLevels;e&&e.fit&&(e.min=Math.min(e.min,.5*e.fit))};r.on("change",s),r.on("loadComplete",s),window.addEventListener("resize",s),s(),i=()=>window.removeEventListener("resize",s)}var Ft=/* @__PURE__ */new Map;function Ot(e,t){const n=Ft.get(e);n?n.push(t):Ft.set(e,[t])}function Bt(e){const t=Ft.get(e);t&&(t.forEach(e=>{try{e.unmount()}catch{}}),Ft.delete(e))}function Ht(e){return Ft.get(e)?.[0]}function Wt(){Ft.forEach((e,t)=>{t.isConnected||Bt(t)})}function Rt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return`${t.toString(36)}-${e.length.toString(36)}`}function Gt(e){return!!e&&e.classList.contains("mermaid-react-root")&&e.hasAttribute("data-md-mermaid-src")}function Vt(e){if(e)return 1===e.nodeType&&e.classList?.contains("mermaid-react-root")?(Bt(e),void e.remove()):void e.querySelectorAll(`.${Nt}`).forEach(e=>{Bt(e),e.remove()})}var Ut=/* @__PURE__ */new Set(["mermaid-render-noCode","code-collapsed","has-left-mask","has-right-mask","has-both-masks","active"]),Kt=["mermaid-render-noCode","code-collapsed","has-left-mask","has-right-mask","has-both-masks"],Zt=/* @__PURE__ */new Set(["data-tab","data-index","data-id","data-active"]),Xt=e=>{const t="string"==typeof e.className?e.className:"";return t?t.split(/\s+/).filter(e=>e&&!e.startsWith("copy-")&&!Ut.has(e)).join(" "):""},Yt=e=>{const t=e.getAttribute("id");return t?`id:${t}`:(e=>{const t=Xt(e);return t?`${e.tagName.toLowerCase()}#${t}`:""})(e)},Jt="data-md-mounted",Qt=e=>{const t=e.getAttribute("data-md-key");return`${e.tagName.toLowerCase()}#${t??Xt(e)}`},en=e=>Array.from(e.attributes).some(e=>e.name.endsWith("-placeholder")),tn=e=>{const t={};for(const n of Array.from(e.attributes))n.name.startsWith("data-")&&"data-md-persist"!==n.name&&"data-md-key"!==n.name&&(n.name.endsWith("-placeholder")||(t[n.name]=n.value));return t},nn=e=>{const t=e.querySelector(`[${Jt}]`);return t||(Array.from(e.querySelectorAll("*")).find(en)??null)},rn=e=>{const t=[];e.querySelectorAll(`[${Lt}]`).forEach(e=>{const n=e;n.classList.contains("pre-handle")||n.classList.contains("mermaid-react-root")||n.parentElement?.closest("[data-md-persist]")||t.push(n)});const n=t.map(e=>{const t=nn(e);return{el:e,key:Qt(e),configEl:t,mounted:t?.hasAttribute(Jt)??!1}});return n.forEach(e=>e.el.remove()),n},on=(e,t,n)=>{if(0===t.length)return;const r=/* @__PURE__ */new Set;Array.from(e.querySelectorAll("*")).filter(e=>en(e)).forEach(e=>{const n=e.closest(`[${Lt}]`);if(!n)return;const o=Qt(n),i=t.find(t=>t.key===o&&!r.has(t)&&!!t.configEl&&((e,t)=>{const n=tn(t),r=tn(e);return Object.keys(n).every(e=>r[e]===n[e])})(t.configEl,e));i&&(r.add(i),n.replaceWith(i.el))});const o=Array.from(e.querySelectorAll(`[${Lt}]`));t.forEach(t=>{if(r.has(t)||t.configEl)return;if(t.el.isConnected)return;const n=Qt(t.el),i=Yt(t.el),c=o.find(e=>e!==t.el&&e.isConnected&&!nn(e)&&(Qt(e)===n||Yt(e)===i));c?c.replaceWith(t.el):e.appendChild(t.el),r.add(t)}),n&&t.forEach(e=>{e.el.isConnected||n(e.el)})},cn=(e,t)=>{const n=Array.from(e.children);e.innerHTML="",t&&n.forEach(e=>t(e))};function sn({content:e,codeType:t,customRenderers:n,throttleMs:r=16,html:i=!0,validateLink:s,onNodeDiscarded:a,onPatched:u}){const[m,h]=d([]),[p,f]=d(!1),g=l(""),v=l(null),w=l(!0),y=l(0),b=l({codeType:t,customRenderers:n,throttleMs:r,html:i,validateLink:s}),k=l({onNodeDiscarded:a,onPatched:u});k.current={onNodeDiscarded:a,onPatched:u};const _=l(null),E=o(async(e,t,n=0)=>{const{codeType:r,customRenderers:o,html:i,validateLink:c}=b.current,s=r&&"md"!==r?.toLocaleLowerCase()?"```"+r+"\n"+e+"\n```":e;let a;const l=()=>{t!==y.current||n>=2||(null!=_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{_.current=null,t===y.current&&E(e,t,n+1)},300))};try{a=await xt(s,o,{html:i,validateLink:c})}catch(m){return console.error("[useIncrementalRender] markdown 渲染失败,保留上一版 DOM:",m),void l()}if(!a||t!==y.current)return;const d=a.info??"",u=(e=0)=>{if(t!==y.current)return;const n=v.current;if(!n)return void(e<60?setTimeout(()=>u(e+1),0):console.warn("[useIncrementalRender] 容器未挂载,放弃本轮 patch(源码与渲染可能不一致)"));if(h(a.anchor||[]),""===d.trim()){const e=rn(n);return cn(n,k.current.onNodeDiscarded),e.forEach(e=>{e.el.isConnected||k.current.onNodeDiscarded?.(e.el)}),g.current=s,w.current=!0,f(!1),void k.current.onPatched?.()}if(w.current)return n.innerHTML=d,w.current=!1,void(g.current=s);const r=document.createElement("div");r.innerHTML=d;const o=rn(n),i=((e,t)=>{const n=/* @__PURE__ */new WeakMap,r=e=>{const t=/* @__PURE__ */new Map,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(let o=r.nextNode();o;o=r.nextNode()){const e=o,r=Yt(e);if(!r)continue;const i=t.get(r);n.set(e,void 0===i?r:`${r}[${i}]`),t.set(r,(i??0)+1)}};return r(e),r(t),n})(n,r),c=/* @__PURE__ */new WeakMap,l=/* @__PURE__ */new WeakMap;X(n,r,{childrenOnly:!0,getNodeKey:e=>1===e.nodeType?i.get(e)??null:null,onBeforeElUpdated(e,t){const n=/* @__PURE__ */new Map;for(const o of Array.from(e.attributes))o.name.startsWith("data-")&&!Zt.has(o.name)&&(t.hasAttribute(o.name)||n.set(o.name,o.value));n.size&&c.set(e,n);const r=Kt.filter(n=>e.classList.contains(n)&&!t.classList.contains(n));return r.length&&l.set(e,r),!0},onElUpdated(e){const t=c.get(e);t&&(t.forEach((t,n)=>e.setAttribute(n,t)),c.delete(e));const n=l.get(e);n&&(n.forEach(t=>e.classList.add(t)),l.delete(e))},onBeforeNodeAdded:e=>(1!==e.nodeType||!e.classList.contains("pre-handle"))&&e,onBeforeNodeDiscarded:e=>1!==e.nodeType||!e.hasAttribute("data-md-persist"),onNodeDiscarded(e){1===e.nodeType&&k.current.onNodeDiscarded&&k.current.onNodeDiscarded(e)}}),on(n,o,k.current.onNodeDiscarded),g.current=s,k.current.onPatched?.()};try{u()}catch(m){console.error("[useIncrementalRender] DOM patch 失败:",m),l()}},[]),S=l(0),x=l(null),C=o((e,t)=>{const n=b.current.throttleMs,r=Date.now()-S.current,o=()=>{S.current=Date.now(),E(e,t)};if(r>=n)return null!=x.current&&(clearTimeout(x.current),x.current=null),void o();null!=x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,t===y.current&&o()},n-r)},[E]);return c(()=>{const{codeType:t}=b.current;if(!e){y.current+=1,null!=_.current&&(clearTimeout(_.current),_.current=null),w.current=!0,f(!1),h([]),g.current="";const e=v.current;return void(e&&cn(e,k.current.onNodeDiscarded))}const n=t&&"md"!==t?.toLocaleLowerCase()?"```"+t+"\n"+e+"\n```":e;if(g.current===n)return;y.current+=1;const r=y.current;f(!0),w.current?E(e,r):C(e,r)},[e,E,C]),c(()=>()=>{y.current+=1,null!=x.current&&(clearTimeout(x.current),x.current=null),null!=_.current&&(clearTimeout(_.current),_.current=null)},[]),{anchors:m,hasContent:p,setInnerRef:o(e=>{v.current=e},[])}}var an="_tocToggle_1egap_1",ln=/* @__PURE__ */new Map,dn=e=>{const t=e.querySelector("code");return t?vn(t):""},un=e=>{const t=e.querySelector("code");return t?dn(e)+"\0"+(t.textContent??""):null},mn=e=>{const t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;return e?.querySelectorAll("pre").forEach(e=>{const o=e;if(!o.querySelector("code"))return;const i=(e=>{const t=e.nextElementSibling;return Gt(t)?t:null})(o);i&&r.set(o,i);const c=un(o);if(c){const e=t.get(c);e?e.push(o):t.set(c,[o])}const s=dn(o),a=n.get(s);a?a.push(o):n.set(s,[o])}),{exact:t,byLanguage:n,charts:r}},hn=0,pn=e=>({enableMermaid:e.enableMermaid??e.isSlotMermaid??!0,showCollapseButton:e.showCollapseButton??e.isShowCollapsed??!0,toolbarDebounceMs:e.toolbarDebounceMs??e.mermaidDebounce??fn,incremental:e.incremental??e.useIncremental??!1,transformSource:e.transformSource??e.chartConfig,html:e.html??!0}),fn=100;function gn({preNode:e}){const[t,n]=d(()=>e.classList.contains("code-collapsed")),r=l(null);c(()=>()=>r.current?.cancel(),[]);/* @__PURE__ */
|
|
12
|
+
return q("span",{className:"code-toggle",onClick:()=>{const t=!e.classList.contains("code-collapsed"),o=e.getBoundingClientRect().height,i=t?32:e.scrollHeight;if(r.current?.cancel(),i===o)return e.classList.toggle("code-collapsed",t),void n(t);t||e.classList.remove("code-collapsed");const c=e.animate([{height:`${o}px`},{height:`${i}px`}],{duration:280,easing:"ease-in-out"});r.current=c,t&&c.finished.then(()=>{r.current===c&&(e.classList.add("code-collapsed"),c.cancel())}),n(t)},children:/* @__PURE__ */q(t?m:u,{})})}var vn=e=>e.className.match(/language-([^\s]+)/)?.[1]??"",wn=(e,t)=>{const{enableMermaid:n,showCollapseButton:r}=pn(t);e.querySelectorAll("pre > code").forEach(e=>{const t=e,o=vn(t),i=o||"text",c=n&&"mermaid"===o&&!t.classList.contains("md-fence-open")?"mermaid-render-noCode":"",s=t.parentNode;if(!s)return;const a=s.querySelector(".pre-handle");if(a){const e=a.getAttribute("data-md-copy-id");e&&!t.classList.contains(e)&&t.classList.add(e),c?t.classList.add(c):t.classList.remove("mermaid-render-noCode");const n=a.querySelector("[data-md-lang]");if(n&&n.textContent!==i&&(n.textContent=i),a.getAttribute("data-md-show-collapsed")===String(r))return;ln.get(a)?.unmount(),ln.delete(a),a.remove()}const l=(()=>{const e=globalThis.crypto?.randomUUID?.();return e?`copy-${e}`:`copy-${Date.now().toString(36)}-${(hn++).toString(36)}-${Math.random().toString(36).slice(2,8)}`})();t.classList.add(l),c&&t.classList.add(c);const d=document.createElement("div");d.className="pre-handle",d.setAttribute(Lt,""),d.setAttribute("data-md-copy-id",l),d.setAttribute("data-md-show-collapsed",String(r)),s.insertBefore(d,t);const u=/* @__PURE__ */D(P,{children:[/* @__PURE__ */q("img",{src:"https://remons.cn:3008/upload/md_assets/code_icon.png",alt:""}),/* @__PURE__ */q("span",{"data-md-lang":!0,children:i})]}),m=/* @__PURE__ */q("span",{className:"copy",onClick:()=>{const e=s.querySelector("code");e&&(B(e),ke.success("复制成功"))},children:/* @__PURE__ */q(v,{})}),h=I(d);ln.set(d,h),h.render(/* @__PURE__ */D(P,{children:[/* @__PURE__ */q("span",{children:u}),/* @__PURE__ */D("span",{className:"code-handle",children:[m,r&&/* @__PURE__ */q(gn,{preNode:s})]})]}))})};function yn(e){const{content:t,showBackTop:n,showToc:r,footer:i,incrementalThrottleMs:a}=e,u=pn(e),{incremental:m,toolbarDebounceMs:h}=u,[p,f]=d(""),[g,v]=d([]),[w,y]=d(""),[b,k]=d(!1),_=l(null),E=l(null),S=l(null),x=l(e);x.current=e;const C=l(null);null===C.current&&(C.current=e.backTopTarget??("undefined"!=typeof document?document.body:null));const L=o(()=>k(e=>!e),[]),N=o(()=>k(!1),[]),T=o(()=>C.current,[]),M=o(e=>{const t=[];e.classList?.contains("pre-handle")&&t.push(e),e.querySelectorAll(".pre-handle").forEach(e=>t.push(e)),e.classList?.contains("mermaid-react-root")&&Vt(e),e.querySelectorAll(`.${Nt}`).forEach(e=>Vt(e)),t.forEach(e=>{const t=ln.get(e);t&&(t.unmount(),ln.delete(e))})},[]),A=o(()=>{const e=_.current;e&&(wn(e,x.current),dt(e),ln.forEach((e,t)=>{t.isConnected||(e.unmount(),ln.delete(t))}))},[]),{anchors:j,hasContent:z,setInnerRef:I}=sn({content:t,codeType:e.codeType,customRenderers:e.customRenderers,throttleMs:a,html:u.html,validateLink:e.validateLink,onNodeDiscarded:M,onPatched:A}),P=m?j:g,O=m?z:!!p;c(()=>{let e=null,n=!1;return(async()=>{if(!m){S.current=mn(_.current);const{codeType:e}=x.current;let o,i="";i=e&&"md"!==e?.toLocaleLowerCase()?"```"+e+"\n"+t+"\n```":t;try{o=await xt(i,x.current.customRenderers,{html:pn(x.current).html,validateLink:x.current.validateLink})}catch(r){return void console.error("[RenderMarkdown] markdown 渲染失败,保留上一版内容:",r)}if(n)return;f(o?.info),v(o?.anchor||[])}e=setTimeout(async()=>{if(n)return;pn(x.current).enableMermaid&&Wt();const e=_.current;if(!e)return;wn(e,x.current),dt(e);const{isPrintPreview:t,excludedSelectors:r}=x.current;!function(e,t={}){if(!e)return;const{instanceSelectors:n=[],isPrintPreview:r=!1}=t,o=Array.from(e.querySelectorAll("img"));if(r)return void o.forEach(e=>{e.style.maxHeight="none",e.style.width="auto",e.style.display="block"});let i=Mt.get(e);i?i.instanceSelectors=n:(i={images:[],bound:!1,instanceSelectors:n,active:null},Mt.set(e,i)),i.images=o.filter(e=>!zt(e,n)),i.bound||(i.bound=!0,e.setAttribute("mdImgBound","1"),e.addEventListener("click",t=>{const n=t.target;if(!n||"IMG"!==n.tagName)return;const r=n,o=Mt.get(e);o&&!zt(r,o.instanceSelectors)&&Dt(o,r)}))}(e,{isPrintPreview:t,instanceSelectors:r});const{enableMermaid:o,transformSource:i}=pn(x.current),{showDriverGuide:c,defaultCollapsed:s,cdn:a}=x.current;if(o){const{renderMermaidWithControls:n}=await Promise.resolve().then(()=>or);await n({showDriverGuide:c,isPrintPreview:t,transformSource:i,defaultCollapsed:s,cdn:a,rootElement:e})}},h)})(),()=>{n=!0,e&&clearTimeout(e)}},[t]),s(()=>{!m&&p&&(((e,t)=>{if(!e||!t)return;const n=Array.from(e.querySelectorAll("pre")),r=/* @__PURE__ */new Set,o=e=>{const n=t.charts.get(e);n&&(t.charts.delete(e),e.after(n))},i=(e=>{const t=/* @__PURE__ */new Map;return e.forEach(e=>{const n=dn(e);t.set(n,(t.get(n)??0)+1)}),t})(n),c=/* @__PURE__ */new Map;t.byLanguage.forEach((e,t)=>c.set(t,e.length)),n.forEach(e=>{const n=un(e);if(!n)return;const i=t.exact.get(n)?.shift();i&&i!==e&&(r.add(i),e.replaceWith(i),o(i))}),n.forEach(e=>{if(!e.isConnected)return;const n=e.querySelector("code");if(!n)return;const s=dn(e),a=t.byLanguage.get(s);if(!a?.length)return;if(i.get(s)!==c.get(s))return;let l;for(;a.length;){const t=a.shift();if(t!==e&&!r.has(t)){l=t;break}}if(!l)return;r.add(l);const d=l.querySelector("code");d&&(d.innerHTML=n.innerHTML),e.replaceWith(l),o(l)})})(E.current,S.current),S.current=null,ln.forEach((e,t)=>{t.isConnected||(e.unmount(),ln.delete(t))}))},[p,m]);const B=l(null);return B.current=_.current,c(()=>()=>{const e=B.current;e&&(e.querySelectorAll(".pre-handle").forEach(e=>{const t=e,n=ln.get(t);n&&(n.unmount(),ln.delete(t))}),Vt(e),function(e){if(!e)return;const t=e,n=Mt.get(t);n&&(n.active&&(n.active.destroy(),n.active=null),n.images=[],Mt.delete(t))}(e))},[]),c(()=>{if(0===P.length)return;const e=[],t=n=>{n.forEach(n=>{e.push(n.href),n.children?.length&&t(n.children)})};t(P);const n=e.map(e=>document.getElementById(e)).filter(Boolean);if(0===n.length)return;const r=new IntersectionObserver(e=>{const t=e.filter(e=>e.isIntersecting);if(0===t.length)return;const n=t.reduce((e,t)=>t.boundingClientRect.top<e.boundingClientRect.top?t:e);y(n.target.id)},{rootMargin:"0px 0px -90% 0px",threshold:0});return n.forEach(e=>r.observe(e)),()=>r.disconnect()},[P]),c(()=>{const e=()=>{const e=window.location.hash.slice(1);if(!e)return;const t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"start"}),y(e))},t=setTimeout(e,100),n=()=>e();return window.addEventListener("hashchange",n),()=>{clearTimeout(t),window.removeEventListener("hashchange",n)}},[P]),/* @__PURE__ */D("div",{className:"markdown",children:[O?/* @__PURE__ */D("div",{className:"markdown-html",ref:_,children:[/* @__PURE__ */q("div",{style:{width:"100%"},...m?{ref:I}:{ref:E,dangerouslySetInnerHTML:{__html:p}}}),i&&/* @__PURE__ */q("div",{className:"markdown-footer",children:i})]}):/* @__PURE__ */q(Le,{}),n&&/* @__PURE__ */q(Se,{target:T}),r&&P.length>0&&/* @__PURE__ */q("div",{className:F(an,"md-toc-toggle","remons-markdown-circle"),onClick:L,children:/* @__PURE__ */q($,{})}),r&&/* @__PURE__ */q($e,{anchors:P,activeId:w,visible:b,onClose:N})]})}var bn={javascript:Y,typescript:J,css:Q,json:ee,bash:te,xml:ne,plaintext:re};function kn(e,t){let n,r=!1;if(e instanceof Blob)n=URL.createObjectURL(e),r=!0;else{if("string"!=typeof e)return void ke.error("不支持的下载格式");n=e}const o=document.createElement("a");o.href=n,o.download=t,o.rel="noopener",o.style.display="none",document.body.appendChild(o),o.click(),o.remove(),r&&setTimeout(()=>URL.revokeObjectURL(n),1e3),ke.success(`${t} 已下载`)}function _n(e,t="image",n=2){const{w:r,h:o}=function(e){const t=e.match(/viewBox=["']?([^"'>\s]+(?:[\s,]+[^"'>\s]+){3})["']/i);let n=0,r=0;if(t){const e=t[1].split(/[\s,]+/).map(Number);4===e.length&&(n=e[2],r=e[3])}const o=e.match(/width=["']?\s*([\d.]+)\s*(px|pt|cm|mm|in)["']/i),i=e.match(/height=["']?\s*([\d.]+)\s*(px|pt|cm|mm|in)["']/i),c=o?parseFloat(o[1]):0,s=i?parseFloat(i[1]):0;return c>0&&s>0?{w:c,h:s}:n>0&&r>0?{w:n,h:r}:{w:c||n||800,h:s||r||600}}(e),i=function(e){const t=(new TextEncoder).encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return`data:image/svg+xml;base64,${btoa(n)}`}(e),c=new Image;c.crossOrigin="anonymous",c.src=i,c.onload=()=>{const e=document.createElement("canvas");e.width=Math.max(1,Math.round(r*n)),e.height=Math.max(1,Math.round(o*n));const i=e.getContext("2d");i.fillStyle="#ffffff",i.fillRect(0,0,e.width,e.height),i.scale(n,n),i.drawImage(c,0,0,r,o),e.toBlob(e=>{e?kn(e,`${t}.png`):ke.error("PNG 生成失败")},"image/png")},c.onerror=()=>{ke.error("PNG 生成失败:图片加载失败")}}var En="app-theme-mode",Sn="light",xn="dark";function Cn(e){return"light"===e||"dark"===e||"system"===e}function Ln(){try{const e=localStorage.getItem(En);if(Cn(e))return e}catch{}return"system"}function Nn(e){return"system"===e?"undefined"==typeof window?Sn:window.matchMedia("(prefers-color-scheme: dark)").matches?xn:Sn:e}function Tn(e){"undefined"!=typeof document&&(document.documentElement.dataset.theme=e)}function Mn(){"undefined"!=typeof window&&Tn(Nn(Ln()))}var An=t(null);function $n({children:t}){const[n,r]=d(()=>Ln()),[i,u]=d(()=>Nn(n)),m=l(null),h=o(e=>{m.current=e,Tn(e)},[]);s(()=>{h(Nn(Ln()))},[h]);const p=o(e=>{if(Cn(e)){r(e);try{localStorage.setItem(En,e),window.dispatchEvent(new Event("storage"))}catch{}}else console.warn(`[render-markdown] 非法的主题模式: ${e},应为 light | dark | system`)},[]);c(()=>{const e=Nn(n);u(e),h(e)},[n,h]),c(()=>{if("system"!==n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?xn:Sn;u(t),h(t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[n,h]),c(()=>{const e=()=>{const e=Ln();e!==n&&r(e)};window.addEventListener("storage",e);const t=new MutationObserver(()=>{const e=document.documentElement.dataset.theme;e!==m.current&&("light"!==e&&"dark"!==e||e===i||u(e))});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{window.removeEventListener("storage",e),t.disconnect()}},[n,i]);const f=i===xn,g=a(()=>({theme:i,mode:n,isDark:f,setMode:p}),[i,n,f,p]);return e.createElement(An.Provider,{value:g},t)}function jn(){const e=i(An);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var zn={"modal-mask":"_modal-mask_dzv9e_4","modal-mask-visible":"_modal-mask-visible_dzv9e_18",modal:"_modal_dzv9e_4","modal-header":"_modal-header_dzv9e_34","modal-title":"_modal-title_dzv9e_41","modal-close":"_modal-close_dzv9e_46","modal-body":"_modal-body_dzv9e_62","modal-footer":"_modal-footer_dzv9e_67"},In=pe.default.bind(zn),Pn=({open:e,title:t,width:n=520,onCancel:r,footer:o,className:i="",children:s})=>{const a=()=>{r?.()};if(c(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&a()};return document.addEventListener("keydown",t),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",t),document.body.style.overflow=""}},[e]),!e)return null;const l=/* @__PURE__ */q("div",{className:In("modal-mask","modal-mask-visible"),onClick:e=>{e.target===e.currentTarget&&a()},children:/* @__PURE__ */D("div",{className:In("modal",i),style:{width:n},onClick:e=>{e.stopPropagation()},children:[
|
|
13
|
+
/* @__PURE__ */D("div",{className:In("modal-header"),children:[/* @__PURE__ */q("span",{className:In("modal-title"),children:t}),/* @__PURE__ */q("div",{className:In("modal-close"),onClick:a,children:"×"})]}),
|
|
14
|
+
/* @__PURE__ */q("div",{className:In("modal-body"),children:s}),null!=o&&/* @__PURE__ */q("div",{className:In("modal-footer"),children:o})]})});return oe(l,document.body)},qn={mermaid:"https://registry.npmmirror.com/mermaid/11.17.2/files/dist/mermaid.min.js"};function Dn(e,t){t?qn[e]=t:delete qn[e]}var Fn=null;function On(e){return Fn||(Fn=new Promise((t,n)=>{if(window.mermaid)return void t(window.mermaid);const r=document.createElement("script");try{r.src=function(e,t){const n=t?.[e]??qn[e];if(!n)throw new Error(`[render-markdown] 未找到名为 "${e}" 的 CDN 配置,请通过 cdn 属性或 registerCdn() 注册`);return n}("mermaid",e)}catch(o){return Fn=null,void n(o)}r.onload=()=>{window.mermaid?t(window.mermaid):(Fn=null,r.remove(),n(/* @__PURE__ */new Error(`Mermaid 脚本已加载但未挂载 window.mermaid:${r.src}`)))},r.onerror=()=>{Fn=null,r.remove(),n(/* @__PURE__ */new Error(`Mermaid 脚本加载失败:${r.src}`))},document.head.appendChild(r)})),Fn}var Bn=0;function Hn({source:e,debounceMs:t=300,isDark:n,transformSource:r,chartConfig:o,cdn:i,securityLevel:s="strict"}){const{mermaid:a,loading:u,error:m}=function(e){const[t,n]=d(null),[r,o]=d(!0),[i,s]=d(null);return c(()=>{let t=!1;return On(e).then(e=>{t||(n(()=>e),o(!1))}).catch(e=>{t||(s(e),o(!1))}),()=>{t=!0}},[]),{mermaid:t,loading:r,error:i}}(i),[h,p]=d(""),[f,g]=d(""),v=l(0),w=l(void 0);return void 0===w.current&&(w.current=r??o),c(()=>{m&&g(m.message?.split("\n")[0]||String(m))},[m]),c(()=>{a&&a.initialize({startOnLoad:!1,theme:n?"dark":"default",securityLevel:s})},[a,n,s]),c(()=>{if(!a)return;const n=(e||"").trim();if(!n)return p(""),void g("");g("");const r=++v.current,o=setTimeout(async()=>{const e="mermaid-render-"+Bn++;try{const t=w.current,o=t?t(n):n,{svg:i}=await a.render(e,o??n);if(r!==v.current)return;p(i),g("")}catch(t){if(r!==v.current)return;console.error("Mermaid render error:",t);const e=t instanceof Error?t.message:String(t);g(e?.split("\n")[0]||e)}finally{const t=document.getElementById(e)||document.getElementById(`d${e}`);t&&t.parentNode&&t.parentNode.removeChild(t)}},t);return()=>clearTimeout(o)},[e,n,a,t]),{svg:h,error:f,loading:u}}var Wn={tooltip:"_tooltip_1kuma_4","tooltip-trigger":"_tooltip-trigger_1kuma_7","tooltip-inner":"_tooltip-inner_1kuma_11","tooltip-inner-visible":"_tooltip-inner-visible_1kuma_27","tooltip-content":"_tooltip-content_1kuma_30","tooltip-arrow":"_tooltip-arrow_1kuma_36"},Rn=pe.default.bind(Wn),Gn=({title:e,children:t,visible:n,onVisibleChange:r})=>{const[o,i]=d(!1),s=l(null),a=l(null),[u,m]=d({top:0,left:0}),h=void 0!==n?n:o,p=()=>{if(a.current){const e=a.current.getBoundingClientRect();m({top:e.top-8,left:e.left+e.width/2})}};c(()=>{if(!h)return;const e=()=>p(),t=()=>p();return window.addEventListener("resize",e,{passive:!0}),window.addEventListener("scroll",t,{passive:!0}),p(),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",t)}},[h]),c(()=>()=>{s.current&&window.clearTimeout(s.current)},[]);const f=h&&e?oe(/* @__PURE__ */D("div",{className:Rn("tooltip-inner","tooltip-inner-visible"),style:{top:u.top,left:u.left},children:[/* @__PURE__ */q("span",{className:Rn("tooltip-content"),children:e}),/* @__PURE__ */q("span",{className:Rn("tooltip-arrow")})]}),document.body):null;/* @__PURE__ */
|
|
15
|
+
return D("div",{ref:a,className:Rn("tooltip"),onMouseEnter:()=>{s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{p(),i(!0),r?.(!0)},150)},onMouseLeave:()=>{s.current&&(window.clearTimeout(s.current),s.current=null),i(!1),r?.(!1)},children:[/* @__PURE__ */q("div",{className:Rn("tooltip-trigger"),children:t}),f]})},Vn={dropdown:"_dropdown_13j0u_4","dropdown-trigger":"_dropdown-trigger_13j0u_8","dropdown-menu":"_dropdown-menu_13j0u_12","dropdown-menu-visible":"_dropdown-menu-visible_13j0u_26","dropdown-item":"_dropdown-item_13j0u_30"},Un=pe.default.bind(Vn),Kn=({items:e,children:t,onClick:n,className:r=""})=>{const[o,i]=d(!1),s=l(null),a=()=>{i(!1)};return c(()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&a()};return o&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o]),/* @__PURE__ */D("div",{ref:s,className:Un("dropdown",r),children:[/* @__PURE__ */q("div",{className:Un("dropdown-trigger"),onClick:()=>{i(e=>!e)},children:t}),o&&/* @__PURE__ */q("div",{className:Un("dropdown-menu","dropdown-menu-visible"),children:e.map(e=>/* @__PURE__ */q("div",{className:Un("dropdown-item"),onClick:()=>(e=>{n({key:e.key}),a()})(e),children:e.label},e.key))})]})};function Zn({showSourceView:e,showCollapse:t,showDownload:n,isFullscreen:r,isCollapsed:o,isMinimize:i,isPanzoomActive:c,isPanzoomAvailable:s,isPanzoomEnabled:a,setIsPanzoomEnabled:l,setIsMinimize:d,setIsCollapsed:u,setShowSource:m,toggleFullscreen:h,downloadMenu:p,panzoomRef:f}){/* @__PURE__ */
|
|
16
|
+
return q("div",{className:"mermaid-toolbar",children:[{isShow:e&&o&&!r,icon:/* @__PURE__ */q(i?k:S,{}),tooltip:i?"缩略图":"最小化",onClick:()=>d(e=>!e),className:"mermaid-minimize-btn"},{isShow:s,icon:/* @__PURE__ */q(b,{}),tooltip:a?"取消拖拽":"启用拖拽",onClick:()=>l(e=>!e),className:a?"mermaid-panzoom-btn active":"mermaid-panzoom-btn"},{isShow:c,icon:/* @__PURE__ */q(N,{}),tooltip:"放大",onClick:()=>f.current?.zoomIn()},{isShow:c,icon:/* @__PURE__ */q(L,{}),tooltip:"缩小",onClick:()=>f.current?.zoomOut()},{isShow:c,icon:/* @__PURE__ */q(T,{}),tooltip:"重置",onClick:()=>f.current?.reset()},{isShow:n&&c,icon:/* @__PURE__ */q(y,{}),tooltip:"下载",dropdown:p},{isShow:!0,icon:/* @__PURE__ */q(r?_:E,{}),tooltip:r?"退出全屏":"全屏",onClick:h,className:"mermaid-fullscreen-btn"},{isShow:e&&!r,icon:/* @__PURE__ */q(g,{}),tooltip:"查看源码",onClick:()=>m(!0),className:"mermaid-showcode-btn"},{isShow:t&&!r,icon:/* @__PURE__ */q(o?w:j,{}),tooltip:o?"展开":"收起",onClick:()=>u(e=>!e),className:"mermaid-collapsed-btn"}].map(e=>{if(!1===e.isShow)return null;const t=e.className||e.tooltip,n=e.dropdown?/* @__PURE__ */q(Kn,{items:e.dropdown.items,onClick:e.dropdown.onClick,children:/* @__PURE__ */q("div",{className:`remons-markdown-circle ${e.className||""}`,children:e.icon})},t):/* @__PURE__ */q("div",{className:`remons-markdown-circle ${e.className||""}`,onClick:e.onClick,children:e.icon},t);return e.tooltip&&O()?/* @__PURE__ */q(Gn,{title:e.tooltip,children:n},`${t}-tooltip`):n})})}var Xn={previewArea:"_previewArea_10gpc_2",previewAreaDisabled:"_previewAreaDisabled_10gpc_22",previewContent:"_previewContent_10gpc_31",errorTip:"_errorTip_10gpc_47",emptyTip:"_emptyTip_10gpc_59"},Yn=null,Jn=/* @__PURE__ */new WeakSet;var Qn="docList-mermaid-driver",er="docList-menu-driver",tr="docList-pc-menu-driver";function nr({source:t,options:n}){/* @__PURE__ */
|
|
17
|
+
return q(e.StrictMode,{children:/* @__PURE__ */q($n,{children:/* @__PURE__ */q(ir,{source:t,enablePanzoom:!0,showDownload:!0,showSourceView:!0,showCollapse:!0,transformSource:n.transformSource??n.chartConfig,defaultCollapsed:n.defaultCollapsed??!1,isPrintPreview:n.isPrintPreview??!1,minHeight:200,showDriverGuide:n.showDriverGuide,cdn:n.cdn})})})}async function rr(e={}){const{rootElement:t=document}=e;Wt();const n=[];t.querySelectorAll("code.language-mermaid").forEach(e=>{const t=e;if(t.classList.contains("md-fence-open"))return void t.classList.remove("mermaid-render-noCode");const r=t.parentElement;if(!r||"PRE"!==r.tagName)return;const o=(t.textContent??"").trim();n.push({pre:r,source:o,srcHash:Rt(o)})});const r=Array.from(t.querySelectorAll(`.${Nt}`)),o=new Map(n.map(e=>[e.pre,e])),i=/* @__PURE__ */new Set;for(const c of n){const e=c.pre.nextElementSibling;Gt(e)&&e.getAttribute("data-md-mermaid-src")===c.srcHash&&i.add(e)}for(const c of n){const e=c.pre.nextElementSibling;if(Gt(e)&&i.has(e))continue;const t=r.find(e=>!i.has(e)&&!o.has(e.previousElementSibling)&&e.getAttribute("data-md-mermaid-src")===c.srcHash);t&&(c.pre.after(t),i.add(t))}for(const c of n){const t=c.pre.nextElementSibling;if(Gt(t)&&i.has(t))continue;const n=Gt(t)&&!i.has(t)?t:null;if(n){n.setAttribute(Tt,c.srcHash),i.add(n);const t=Ht(n);if(t){t.render(/* @__PURE__ */q(nr,{source:c.source,options:e}));continue}Bt(n),n.remove()}const r=document.createElement("div");r.className=Nt,r.setAttribute(Tt,c.srcHash),r.setAttribute(Lt,""),c.pre.after(r),Bt(r);const o=I(r);Ot(r,o),o.render(/* @__PURE__ */q(nr,{source:c.source,options:e}))}for(const c of r)i.has(c)||(Bt(c),c.remove())}var or=/* @__PURE__ */he({MermaidChart:()=>cr,default:()=>ir,renderMermaid:()=>sr,renderMermaidWithControls:()=>rr}),ir=n(function({source:e,debounceMs:t=300,enablePanzoom:n=!0,showDownload:r=!0,showSourceView:i=!1,showCollapse:s=!1,defaultCollapsed:u=!1,className:m="",minHeight:h=200,showDriverGuide:p,isPrintPreview:f=!1,transformSource:g,chartConfig:v,securityLevel:w,cdn:y,driverGuideOnce:b=!0}){const{isDark:k}=jn(),{svg:_,error:E,loading:S}=Hn({source:e,debounceMs:t,isDark:k,transformSource:g,chartConfig:v,securityLevel:w,cdn:y}),x=l(null),L=l(null),{isFullscreen:N,isCollapsed:T,toggleCollapseAnimated:M,showSource:A,setShowSource:$,isMinimize:j,toggleMinimizeAnimated:z,isPanzoomEnabled:I,setIsPanzoomEnabled:F,toggleFullscreen:B}=function({showCollapse:e,showSourceView:t,defaultCollapsed:n,isPrintPreview:r,svg:i,error:s,loading:a,wrapperRef:u}){const[m,h]=d(!1),[p,f]=d(n),[g,v]=d(!1),[w,y]=d(t),[b,k]=d(!1),_=l(!1),E=l(null),S=l(p);c(()=>{S.current=p},[p]);const x=l(w);c(()=>{x.current=w},[w]);const C=o((e,t)=>{const n=u.current;if(!n)return;const r=n.getBoundingClientRect().height,o=t?36:e?200:n.scrollHeight;Math.abs(r-o)<1||n.animate([{maxHeight:`${r}px`},{maxHeight:`${o}px`}],{duration:280,easing:"ease-in-out"})},[u]),L=o(e=>{const t="function"==typeof e?e(S.current):e;t!==S.current&&C(t,x.current),f(t)},[C]),N=o(e=>{const t="function"==typeof e?e(x.current):e;t!==x.current&&C(S.current,t),y(t)},[C]);return c(()=>{r&&i&&!s&&!a&&f(!1)},[r,i,s,a]),c(()=>{if(r)return;const t=()=>{const t=u.current;if(!t)return;const r=document.fullscreenElement,o=!!r&&(r===t||t.contains(r));if(o||_.current){if(o)return _.current=!0,E.current=S.current,h(!0),void f(!1);_.current=!1,h(!1),e&&f(E.current??n),E.current=null}};return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[e,r,n,u]),{isFullscreen:m,setIsFullscreen:h,isCollapsed:p,setIsCollapsed:f,toggleCollapseAnimated:L,toggleMinimizeAnimated:N,showSource:g,setShowSource:v,isMinimize:w,setIsMinimize:y,isPanzoomEnabled:b,setIsPanzoomEnabled:k,toggleFullscreen:o(()=>{const e=u.current;e&&(document.fullscreenElement!==e?e.requestFullscreen?.().catch(()=>{console.warn("[render-markdown] 进入全屏失败(可能被浏览器策略拒绝或非安全上下文)")}):document.exitFullscreen?.().catch(()=>{}))},[u])}}({showCollapse:s,showSourceView:i,defaultCollapsed:u,isPrintPreview:f,svg:_,error:E,loading:S,wrapperRef:x}),H=n&&(N||!T||!s),W=H&&I,R=function({contentRef:e,wrapperRef:t,canUse:n,active:r,isFullscreen:i}){const s=l(null),a=l(null),d=l(null),u=l(r);c(()=>{u.current=r},[r]);const m=o(e=>{d.current?.();const n=t.current;e.bind();const r=e.zoomWithWheel;n?.addEventListener("wheel",r),d.current=()=>{n?.removeEventListener("wheel",r),e.destroy()}},[t]),h=o(()=>{d.current?.(),d.current=null},[]);return c(()=>{const t=e.current;if(!n||!t)return h(),a.current=null,void(s.current=null);const r=ie(t,{maxScale:5,minScale:.1,startScale:1,contain:"outside",noBind:!0});return a.current=r,s.current={destroy:()=>r.destroy(),zoomWithWheel:r.zoomWithWheel,zoomIn:()=>r.zoomIn(),zoomOut:()=>r.zoomOut(),reset:()=>r.reset()},u.current&&m(r),()=>{h(),r.destroy(),a.current===r&&(a.current=null,s.current=null)}},[n,i,e,m,h]),c(()=>{const e=a.current;e&&(r?m(e):h())},[r,m,h]),s}({contentRef:L,wrapperRef:x,canUse:n&&!!_&&!f,active:W,isFullscreen:N});c(()=>{if(!p||f||!_)return;const e=x.current;if(e){if(b){if(e.dataset.mdDriverDone)return;e.dataset.mdDriverDone="1"}!function(e){if(Yn||Jn.has(e))return;const t=n=>{if(n>=e.length)return Yn=null,void Jn.add(e);const r=e[n];if(r.condition&&!r.condition())return void t(n+1);r?.onOpen?.();const o=r.steps.filter(e=>!1!==e.isShow&&!!document.querySelector(e.element));if(0===o.length)return void t(n+1);const i=ce({nextBtnText:"下一步",prevBtnText:"上一步",doneBtnText:"我知道了",showProgress:!0,allowClose:!1,progressText:"第 {{current}} 步,共 {{total}} 步",onDestroyed:()=>{Yn=null,t(n+1)},steps:o});Yn=i,i.drive()};t(0)}(function(e,t){return[{id:er,condition:()=>!localStorage[er]&&e&&!O()&&"true"!==localStorage.docListMenuVisible,onOpen:()=>{localStorage[er]="1"},steps:[{element:".docList-menu-list",popover:{title:"列表",description:"点击此处您可查看当前分类下文章列表"}},{element:".docList-menu-copyHtml",popover:{title:"复制",description:"点击此处您可复制 HTML 渲染的格式内容"}},{element:".docList-menu-copyMarkdown",popover:{title:"复制",description:"点击此处您可复制 markdown 源码"}},{element:".docList-menu-print",popover:{title:"打印",description:"点击此处您可跳转至打印页面,输出为PDF"}}]},{id:tr,condition:()=>!localStorage[tr]&&O()&&e,onOpen:()=>{localStorage[tr]="1"},steps:[{element:".docList-menu-copyHtml",popover:{title:"复制",description:"点击此处您可复制 HTML 渲染的格式内容"}},{element:".docList-menu-copyMarkdown",popover:{title:"复制",description:"点击此处您可复制 markdown 源码"}},{element:".docList-menu-print",popover:{title:"打印",description:"点击此处您可跳转至打印页面,输出为PDF"}},{element:".docList-menu-mermaid-collapse",popover:{title:"展开收起mermaid",description:"点击此处按钮可一键展开收起mermaid图表"},isShow:t}]},{id:Qn,condition:()=>!(!t||localStorage[Qn]||!e),onOpen:()=>{localStorage[Qn]="1"},steps:[{element:".mermaid-react-root",popover:{title:"mermaid",description:"恭喜您解锁 Mermaid 渲染图表"}},{element:".mermaid-react-root .mermaid-minimize-btn",popover:{title:"缩略图",description:"点击此处按钮可查看缩略图"}},{element:".mermaid-react-root .mermaid-fullscreen-btn",popover:{title:"全屏",description:"点击此处按钮可切换为全屏展示"}},{element:".mermaid-react-root .mermaid-showcode-btn",popover:{title:"源码",description:"点击此处按钮查看源码弹窗"}},{element:".mermaid-react-root .mermaid-collapsed-btn",popover:{title:"展开",description:"点击此处按钮展开大图"}}]}]}(i,!!_))}},[_,p,f,i,b]);const G=function(e){const t=e.match(/---\s*\n\s*title:\s*(.+)\s*\n\s*---/);return t?t[1].trim():"mermaid 图表"}(e),V=o(()=>{_?function(e,t="image"){kn(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),`${t}.svg`)}(_,G):ke.warning("暂无图表")},[_,G]),U=o(()=>{_?_n(_,G,2):ke.warning("暂无图表")},[_,G]),K=a(()=>({items:[{key:"svg",label:"下载 SVG"},{key:"png",label:"下载 PNG"}],onClick:({key:e})=>"svg"===e?V():U()}),[V,U]),Z=!!_;/* @__PURE__ */
|
|
18
|
+
return D("div",{ref:x,className:pe.default.bind(Xn)(N?"mermaid-wrapper-fullscreen":"",s?"mermaid-wrapper":"",T&&s&&!j?"mermaid-collapsed":"",m,j&&T&&!N?"mermaid-mini":"",f?"print-preview":""),style:{minHeight:j?0:h,position:"relative",height:"100%"},children:[!f&&/* @__PURE__ */D(P,{children:[i&&/* @__PURE__ */D("div",{className:"mermaid-title",children:[/* @__PURE__ */D("span",{className:"mermaid-title-tag",children:[/* @__PURE__ */q("img",{src:"data:image/svg+xml,%3csvg%20t='1784097187016'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5199'%20width='200'%20height='200'%3e%3cpath%20d='M0%200m125.754386%200l772.491228%200q125.754386%200%20125.754386%20125.754386l0%20772.491228q0%20125.754386-125.754386%20125.754386l-772.491228%200q-125.754386%200-125.754386-125.754386l0-772.491228q0-125.754386%20125.754386-125.754386Z'%20fill='%23FC366E'%20p-id='5200'%3e%3c/path%3e%3cpath%20d='M921.150877%20174.547088a417.091368%20417.091368%200%200%200-409.168842%20274.198456%20417.235088%20417.235088%200%200%200-409.150877-274.198456%20417.360842%20417.360842%200%200%200%20181.625263%20361.992982%20223.914667%20223.914667%200%200%201%2097.010526%20185.038597v128.143719h261.084071v-128.07186a223.914667%20223.914667%200%200%201%2097.010526-185.038596%20417.181193%20417.181193%200%200%200%20181.553403-361.921123z'%20fill='%23FFFFFF'%20p-id='5201'%3e%3c/path%3e%3c/svg%3e",alt:""}),/* @__PURE__ */q("span",{className:"mermaid-title-text",children:"Mermaid"})]}),G]}),!Z&&/* @__PURE__ */D("div",{className:"mermaid-toolbar-loading",children:[/* @__PURE__ */q(C,{})," "]}),Z&&/* @__PURE__ */q(Zn,{showSourceView:i,showCollapse:s,showDownload:r,isFullscreen:N,isCollapsed:T,isMinimize:j,isPanzoomActive:W,isPanzoomAvailable:H,isPanzoomEnabled:I,setIsPanzoomEnabled:F,setIsMinimize:z,setIsCollapsed:M,setShowSource:$,toggleFullscreen:()=>{R.current?.reset(),B()},downloadMenu:K,panzoomRef:R})]}),E&&/* @__PURE__ */D("div",{className:Xn.errorTip,children:["⚠️ ",E]}),
|
|
19
|
+
/* @__PURE__ */D("div",{className:`${Xn.previewArea} ${W?"":Xn.previewAreaDisabled}`,style:{minHeight:Z?"auto":h},children:[/* @__PURE__ */q("div",{ref:L,className:Xn.previewContent,dangerouslySetInnerHTML:{__html:_||""}}),(!Z&&!E||S)&&/* @__PURE__ */q("div",{className:Xn.emptyTip,children:e?.trim()?"渲染中...":"← 输入 Mermaid 源码"})]}),i&&/* @__PURE__ */q(Pn,{open:A,title:"Mermaid 源码",className:"mermaid-code-modal",width:O()?800:"calc(100% - 20px)",onCancel:()=>$(!1),footer:null,children:/* @__PURE__ */q(yn,{showCollapseButton:!1,enableMermaid:!1,codeType:"mermaid",content:e})})]})}),cr=e=>/* @__PURE__ */q($n,{children:/* @__PURE__ */q(ir,{...e})}),sr=e=>/* @__PURE__ */q(cr,{...e}),ar=yn;export{De as DEFAULT_CIRCLED_CLASS,Lt as MD_PERSIST_ATTR,cr as MermaidChart,$n as ThemeProvider,$t as addExcludedSelector,He as circledNumbers,ar as default,Ke as defaultValidateLink,Ct as initHighlighter,Mn as initTheme,bn as languagesCommon,xt as markdownFormat,Dn as registerCdn,jt as removeExcludedSelector,sr as renderMermaid,sn as useIncrementalRender,jn as useTheme};
|
package/package.json
CHANGED