import{container as w}from"@mdit/plugin-container";import{utoa as v,deepMerge as E,Logger as je,getLocales as ke,getBundlerName as we,mergeViteConfig as Oe,addViteSsrNoExternal as xe,addCustomElement as T,addViteOptimizeDepsExclude as M,addViteSsrExternal as P,addViteOptimizeDepsInclude as V,chainWebpack as Re}from"vuepress-shared/node";import{tab as B}from"@mdit/plugin-tab";import{ensureLeadingSlash as W,resolveLocalePath as q,ensureEndingSlash as Se}from"@vuepress/shared";import{hash as Pe,getDirname as Ie,path as De,logger as Me,colors as I}from"@vuepress/utils";import{uml as H}from"@mdit/plugin-uml";import{align as _e}from"@mdit/plugin-align";import{attrs as Ee}from"@mdit/plugin-attrs";import{figure as Te}from"@mdit/plugin-figure";import{footnote as Ne}from"@mdit/plugin-footnote";import{imgLazyload as Ae}from"@mdit/plugin-img-lazyload";import{imgMark as Le}from"@mdit/plugin-img-mark";import{imgSize as Ue}from"@mdit/plugin-img-size";import{include as Fe}from"@mdit/plugin-include";import{katex as ze}from"@mdit/plugin-katex";import{generateMathjaxStyle as Ge,createMathjaxInstance as Je,mathjax as Ve}from"@mdit/plugin-mathjax";import{mark as Be}from"@mdit/plugin-mark";import{stylize as We}from"@mdit/plugin-stylize";import{sub as qe}from"@mdit/plugin-sub";import{sup as He}from"@mdit/plugin-sup";import{tasklist as Ye}from"@mdit/plugin-tasklist";import{useSassPalettePlugin as Ke}from"vuepress-plugin-sass-palette";const Y=n=>{w(n,{name:"chart",openRender:(e,a)=>{const t=e[a].info.trimStart().slice(5).trim(),o=`chart-${a}`;let r="{}",s="";for(let i=a;i<e.length;i++){const{type:l,content:y,info:d}=e[i];if(l==="container_chart_close")break;y&&(l==="fence"&&(d==="json"?(r=v(y),s="json"):(d==="js"||d==="javascript")&&(r=v(y),s="js")),e[i].type="chart_empty",e[i].hidden=!0)}return`<ChartJS id="${o}" config="${r}" ${t?`title="${encodeURIComponent(t)}" `:""}type="${s}">`},closeRender:()=>"</ChartJS>"})},K={useBabel:!1,jsLib:[],cssLib:[],codepenLayout:"left",codepenEditors:"101",babel:"https://unpkg.com/@babel/standalone/babel.min.js",vue:"https://unpkg.com/vue/dist/vue.global.prod.js",react:"https://unpkg.com/react/umd/react.production.min.js",reactDOM:"https://unpkg.com/react-dom/umd/react-dom.production.min.js"},N=n=>e=>w(e,{name:n,openRender:(a,t)=>{const o=a[t].info.trimStart().slice(n.length).trim();let r="";const s={};for(let i=t;i<a.length;i++){const{type:l,content:y,info:d}=a[i];if(l===`container_${n}_close`)break;y&&l==="fence"&&(d==="json"?r=v(y):s[d]=y)}return`
<CodeDemo id="code-demo-${t}" type="${n.split("-")[0]}"${o?` title="${encodeURIComponent(o)}"`:""}${r?` config="${r}"`:""} code="${v(JSON.stringify(s))}">
`},closeRender:()=>"</CodeDemo>"}),Q=N("normal-demo"),X=N("vue-demo"),Z=N("react-demo"),ee=n=>{B(n,{name:"code-tabs",tabsOpenRenderer:({active:e,data:a},t,o)=>{const{meta:r}=t[o],s=a.map(({title:i,id:l})=>({title:i,...l?{id:l}:{}}));return`<CodeTabs id="${o}" :data='${JSON.stringify(s).replace(/'/g,"&#39")}'${e!==-1?` :active="${e}"`:""}${r.id?` tab-id="${r.id}"`:""}>
`},tabsCloseRenderer:()=>`</CodeTabs>
`,tabOpenRenderer:({index:e},a,t)=>{let o=!1;for(let r=t;r<a.length;r++){const{block:s,type:i}=a[r];if(s){if(i==="code-tabs_tab_close")break;if(i==="fence"&&!o){o=!0;continue}a[r].type="code_tab_empty",a[r].hidden=!0}}return`<template #tab${e}="{ title, value, isActive }">
`},tabCloseRenderer:()=>`</template>
`})},te=(n,e)=>{const a=n[e],t=`echarts-${e}`,{content:o,info:r}=a,s=r.trim().split(":",2)[1];return`<ECharts id="${t}" config="${v(o)}"${s?` title="${encodeURIComponent(s)}"`:""}></ECharts>`},ne=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...a)=>{const[t,o]=a,{info:r}=t[o];return r.split(":",2)[0]==="echarts"?te(t,o):e(...a)},n.renderer.rules.echarts=te,w(n,{name:"echarts",openRender:(a,t)=>{const o=a[t].info.trimStart().slice(7).trim(),r=`echarts-${t}`;let s="{}",i=!1;for(let l=t;l<a.length;l++){const{type:y,content:d,info:c}=a[l];if(y==="container_echarts_close")break;d&&(y==="fence"&&(c==="json"?s=d:(c==="js"||c==="javascript")&&(s=d,i=!0)),a[l].type="echarts_empty",a[l].hidden=!0)}return`<ECharts id="${r}" config="${v(s)}"${o?` title="${encodeURIComponent(o)}"`:""}${i?' type="js"':""}>`},closeRender:()=>"</ECharts>"})},oe=(n,e)=>{const a=n[e],t=`flowchart-${e}`,{content:o,info:r}=a;return`<FlowChart id="${t}" code="${v(o)}" preset="${r.trim().split(":",2)[1]||"vue"}"></FlowChart>`},ae=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...a)=>{const[t,o]=a,{info:r}=t[o],s=r.split(":",2)[0];return s==="flow"||s==="flowchart"?oe(t,o):e(...a)},n.renderer.rules.flowchart=oe},re=(n,e={})=>{["info","note","tip","warning","danger"].forEach(a=>{n.use(w,{name:a,openRender:(t,o,r,s)=>{var i;let l=t[o].info.trim().slice(a.length).trim();if(!l){const{filePathRelative:y}=s,d=W(y??""),c=q(e,d);l=(i=e[c])==null?void 0:i[a]}return`<div class="hint-container ${a}">
<p class="hint-container-title">${l||a}</p>
`},closeRender:()=>`</div>
`})}),n.use(a=>w(a,{name:"details",openRender:(t,o,r,s)=>{var i;let l=t[o].info.trim().slice(7).trim();if(!l){const{filePathRelative:y}=s,d=W(y??""),c=q(e,d);l=(i=e[c])==null?void 0:i.details}return`<details class="hint-container details"><summary>${l||"Details"}</summary>
`},closeRender:()=>`</details>
`}))},se=(n,e)=>{const a=n[e],t=`mermaid-${e}`,{content:o}=a;return`<Mermaid id="${t}" code="${v(o)}"></Mermaid>`},j=(n,e,a)=>`<Mermaid id="mermaid-${a}" code="${v(`${n}
${e.split(`
`).map(t=>t?`  ${t}`:"").join(`
`)}`)}"></Mermaid>`,ie=n=>{const e=n.renderer.rules.fence;n.renderer.rules.fence=(...a)=>{const[t,o]=a,{content:r,info:s}=t[o];return s.trim()==="mermaid"?se(...a):s.trim()==="sequence"?j("sequenceDiagram",r,o):s.trim()==="class"?j("classDiagram",r,o):s.trim()==="state"?j("stateDiagram-v2",r,o):s.trim()==="er"?j("erDiagram",r,o):s.trim()==="journey"?j("journey",r,o):s.trim()==="gantt"?j("gantt",r,o):s.trim()==="pie"?j("pie",r,o):s.trim()==="git-graph"?j("gitGraph",r,o):s.trim()==="c4c"?j("C4Context",r,o):s.trim()==="mindmap"?j("mindmap",r,o):e(...a)},n.renderer.rules.mermaid=se},Qe=n=>n.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#039;"),le="@",Xe=["file","import","setting"],Ze=n=>(e,a,t,o)=>{let r=e.bMarks[a]+e.tShift[a],s=e.eMarks[a];if(e.src[r]!==":")return!1;let i=r+1;for(;i<=s&&e.src[i]===":";)i+=1;const l=i-r;if(l<3)return!1;const y=e.src.slice(r,i),d=e.src.slice(i,s),c=d.trimStart().split(" ",2)[0],$=d.trimStart().slice(n.length).trim();if(c.trim()!==n)return!1;if(o)return!0;let u=a,g=!1;for(;u<t&&(u+=1,r=e.bMarks[u]+e.tShift[u],s=e.eMarks[u],!(r<s&&e.sCount[u]<e.blkIndent));)if(e.src[r]===":"&&e.sCount[u]-e.blkIndent<4){for(i=r+1;i<=s&&e.src[i]===":";i++);if(i-r>=l&&(i=e.skipSpaces(i),i>=s)){g=!0;break}}const m=e.parentType,f=e.lineMax;e.parentType=`${n}`,e.lineMax=u-(g?1:0);const C=e.push(`${n}_open`,"template",1);C.markup=y,C.block=!0,C.info=$,C.map=[a,u-(g?1:0)],e.md.block.tokenize(e,a+1,u-(g?1:0));const R=e.push(`${n}_close`,"template",-1);return R.markup=e.src.slice(r,i),R.block=!0,e.parentType=m,e.lineMax=f,e.line=u+(g?1:0),!0},et=n=>(e,a,t,o)=>{let r=e.bMarks[a]+e.tShift[a],s=e.eMarks[a];const i=`${le}${n}`;if(e.src.charAt(r)!=="@")return!1;let l;for(l=0;l<i.length;l++)if(i[l]!==e.src[r+l])return!1;const y=e.src.slice(r,r+l),d=e.src.slice(r+l,s);if(o)return!0;let c=a,$=!1;for(;c<t&&(c+=1,r=e.bMarks[c]+e.tShift[c],s=e.eMarks[c],!(r<s&&e.sCount[c]<e.blkIndent));)if(e.src[r]===le&&e.sCount[c]<=e.sCount[a]){let C=!0;for(l=0;l<i.length;l++)if(i[l]!==e.src[r+l]){C=!1;break}if(C){$=!0,c-=1;break}}const u=e.parentType,g=e.lineMax;e.parentType=`${n}`,e.lineMax=c;const m=e.push(`${n}_open`,"template",1);m.block=!0,m.markup=y,m.info=d.trim(),m.map=[a,c],e.md.block.tokenize(e,a+1,c);const f=e.push(`${n}_close`,"template",-1);return f.block=!0,f.markup="",e.parentType=u,e.lineMax=g,e.line=c+($?1:0),!0},D=(n,{name:e="playground",component:a="Playground",propsGetter:t}={name:"playground",component:"Playground",propsGetter:o=>({key:o.key,title:o.title||"",files:encodeURIComponent(JSON.stringify(o.files)),settings:encodeURIComponent(JSON.stringify(o.settings||{}))})})=>{n.block.ruler.before("fence",`${e}`,Ze(e),{alt:["paragraph","reference","blockquote","list"]}),Xe.forEach(o=>{n.block.ruler.__rules__.find(({name:r})=>r==="marker")||n.block.ruler.before("fence","tab",et(o),{alt:["paragraph","reference","blockquote","list"]})}),n.renderer.rules[`${e}_open`]=(o,r)=>{const{info:s}=o[r],i={key:Pe(`playground${r}-${s}`),title:encodeURIComponent(s),settings:{},files:{}};let l=null,y=!1;for(let c=r;c<o.length;c++){const{block:$,type:u,info:g,content:m}=o[c];if($){if(u===`${e}_close`)break;if(u===`${e}_open`)continue;if(u==="file_open"){if(!g)continue;l=g}else u==="import_open"&&(i.importMap=l=g||"import-map.json");if(u==="setting_open"&&(y=!0),u==="setting_close"&&(y=!1),u==="file_close"||u==="import_close"||u==="setting_close"||!m){o[c].type=`${e}_empty`,o[c].hidden=!0;continue}y?u==="fence"&&g==="json"&&(i.settings=JSON.parse(m.trim())):u==="fence"&&l&&(i.files[l]={ext:g,content:m}),o[c].type=`${e}_empty`,o[c].hidden=!0}}const d=t(i);return`<${a} ${Object.entries(d).map(([c,$])=>`${c}="${Qe($)}"`).join(" ")}>
`},n.renderer.rules[`${e}_close`]=()=>`</${a}>
`},tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",nt=(n,e,a)=>{if(n==null)return"";let t,o,r,s={},i={},l="",y="",d="",c=2,$=3,u=2,g=[],m=0,f=0;for(r=0;r<n.length;r+=1)if(l=n.charAt(r),Object.prototype.hasOwnProperty.call(s,l)||(s[l]=$++,i[l]=!0),y=d+l,Object.prototype.hasOwnProperty.call(s,y))d=y;else{if(Object.prototype.hasOwnProperty.call(i,d)){if(d.charCodeAt(0)<256){for(t=0;u>t;t++)m<<=1,f==e-1?(f=0,g.push(a(m)),m=0):f++;for(o=d.charCodeAt(0),t=0;8>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1}else{for(o=1,t=0;u>t;t++)m=m<<1|o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o=0;for(o=d.charCodeAt(0),t=0;16>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1}c--,c==0&&(c=Math.pow(2,u),u++),delete i[d]}else for(o=s[d],t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1;c--,c==0&&(c=Math.pow(2,u),u++),s[y]=$++,d=String(l)}if(d!==""){if(Object.prototype.hasOwnProperty.call(i,d)){if(d.charCodeAt(0)<256){for(t=0;u>t;t++)m<<=1,f==e-1?(f=0,g.push(a(m)),m=0):f++;for(o=d.charCodeAt(0),t=0;8>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1}else{for(o=1,t=0;u>t;t++)m=m<<1|o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o=0;for(o=d.charCodeAt(0),t=0;16>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1}c--,c==0&&(c=Math.pow(2,u),u++),delete i[d]}else for(o=s[d],t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1;c--,c==0&&(c=Math.pow(2,u),u++)}for(o=2,t=0;u>t;t++)m=m<<1|1&o,f==e-1?(f=0,g.push(a(m)),m=0):f++,o>>=1;for(;;){if(m<<=1,f==e-1){g.push(a(m));break}f++}return g.join("")},ot=n=>nt(n,6,e=>tt.charAt(e)),at=[{name:"help",type:"boolean"},{name:"help",type:"boolean"},{name:"watch",type:"boolean"},{name:"preserveWatchOutput",type:"boolean"},{name:"listFiles",type:"boolean"},{name:"explainFiles",type:"boolean"},{name:"listEmittedFiles",type:"boolean"},{name:"pretty",type:"boolean"},{name:"traceResolution",type:"boolean"},{name:"diagnostics",type:"boolean"},{name:"extendedDiagnostics",type:"boolean"},{name:"generateCpuProfile",type:"string"},{name:"generateTrace",type:"string"},{name:"incremental",type:"boolean"},{name:"assumeChangesOnlyAffectDirectDependencies",type:"boolean"},{name:"locale",type:"string"},{name:"all",type:"boolean"},{name:"version",type:"boolean"},{name:"init",type:"boolean"},{name:"project",type:"string"},{name:"build",type:"boolean"},{name:"showConfig",type:"boolean"},{name:"listFilesOnly",type:"boolean"},{name:"target",type:{es3:0,es5:1,es6:2,es2015:2,es2016:3,es2017:4,es2018:5,es2019:6,es2020:7,es2021:8,es2022:9,esnext:99}},{name:"module",type:{none:0,commonjs:1,amd:2,system:4,umd:3,es6:5,es2015:5,es2020:6,es2022:7,esnext:99,node16:100,nodenext:199}},{name:"lib",type:"list"},{name:"allowJs",type:"boolean"},{name:"checkJs",type:"boolean"},{name:"jsx",type:{preserve:1,"react-native":3,react:2,"react-jsx":4,"react-jsxdev":5}},{name:"declaration",type:"boolean"},{name:"declarationMap",type:"boolean"},{name:"emitDeclarationOnly",type:"boolean"},{name:"sourceMap",type:"boolean"},{name:"outFile",type:"string"},{name:"outDir",type:"string"},{name:"rootDir",type:"string"},{name:"composite",type:"boolean"},{name:"tsBuildInfoFile",type:"string"},{name:"removeComments",type:"boolean"},{name:"noEmit",type:"boolean"},{name:"importHelpers",type:"boolean"},{name:"importsNotUsedAsValues",type:{remove:0,preserve:1,error:2}},{name:"downlevelIteration",type:"boolean"},{name:"isolatedModules",type:"boolean"},{name:"strict",type:"boolean"},{name:"noImplicitAny",type:"boolean"},{name:"strictNullChecks",type:"boolean"},{name:"strictFunctionTypes",type:"boolean"},{name:"strictBindCallApply",type:"boolean"},{name:"strictPropertyInitialization",type:"boolean"},{name:"noImplicitThis",type:"boolean"},{name:"useUnknownInCatchVariables",type:"boolean"},{name:"alwaysStrict",type:"boolean"},{name:"noUnusedLocals",type:"boolean"},{name:"noUnusedParameters",type:"boolean"},{name:"exactOptionalPropertyTypes",type:"boolean"},{name:"noImplicitReturns",type:"boolean"},{name:"noFallthroughCasesInSwitch",type:"boolean"},{name:"noUncheckedIndexedAccess",type:"boolean"},{name:"noImplicitOverride",type:"boolean"},{name:"noPropertyAccessFromIndexSignature",type:"boolean"},{name:"moduleResolution",type:{node:2,classic:1,node16:3,nodenext:99}},{name:"baseUrl",type:"string"},{name:"paths",type:"object"},{name:"rootDirs",type:"list"},{name:"typeRoots",type:"list"},{name:"types",type:"list"},{name:"allowSyntheticDefaultImports",type:"boolean"},{name:"esModuleInterop",type:"boolean"},{name:"preserveSymlinks",type:"boolean"},{name:"allowUmdGlobalAccess",type:"boolean"},{name:"moduleSuffixes",type:"list"},{name:"sourceRoot",type:"string"},{name:"mapRoot",type:"string"},{name:"inlineSourceMap",type:"boolean"},{name:"inlineSources",type:"boolean"},{name:"experimentalDecorators",type:"boolean"},{name:"emitDecoratorMetadata",type:"boolean"},{name:"jsxFactory",type:"string"},{name:"jsxFragmentFactory",type:"string"},{name:"jsxImportSource",type:"string"},{name:"resolveJsonModule",type:"boolean"},{name:"out",type:"string"},{name:"reactNamespace",type:"string"},{name:"skipDefaultLibCheck",type:"boolean"},{name:"charset",type:"string"},{name:"emitBOM",type:"boolean"},{name:"newLine",type:{crlf:0,lf:1}},{name:"noErrorTruncation",type:"boolean"},{name:"noLib",type:"boolean"},{name:"noResolve",type:"boolean"},{name:"stripInternal",type:"boolean"},{name:"disableSizeLimit",type:"boolean"},{name:"disableSourceOfProjectReferenceRedirect",type:"boolean"},{name:"disableSolutionSearching",type:"boolean"},{name:"disableReferencedProjectLoad",type:"boolean"},{name:"noImplicitUseStrict",type:"boolean"},{name:"noEmitHelpers",type:"boolean"},{name:"noEmitOnError",type:"boolean"},{name:"preserveConstEnums",type:"boolean"},{name:"declarationDir",type:"string"},{name:"skipLibCheck",type:"boolean"},{name:"allowUnusedLabels",type:"boolean"},{name:"allowUnreachableCode",type:"boolean"},{name:"suppressExcessPropertyErrors",type:"boolean"},{name:"suppressImplicitAnyIndexErrors",type:"boolean"},{name:"forceConsistentCasingInFileNames",type:"boolean"},{name:"maxNodeModuleJsDepth",type:"number"},{name:"noStrictGenericChecks",type:"boolean"},{name:"useDefineForClassFields",type:"boolean"},{name:"preserveValueImports",type:"boolean"},{name:"keyofStringsOnly",type:"boolean"},{name:"plugins",type:"list"},{name:"moduleDetection",type:{auto:2,legacy:1,force:3}}],pe=(n,e={})=>{const a=`#code/${ot(n)}`,t=Object.entries(e).map(([o,r])=>{const s=at.find(l=>l.name===o);if(!s||r===null||r===void 0)return"";const{type:i}=s;if(typeof i=="object"){const l=i[r];return(l==null?void 0:l.toString())||""}return`${o}=${encodeURIComponent(r)}`}).filter(o=>o.length).join("&");return`${t?`?${t}`:""}${a}`},me=({service:n="https://www.typescriptlang.org/play",...e}={})=>({name:"playground#ts",propsGetter:({title:a="",files:t,settings:o,key:r})=>{const s=Object.keys(t).filter(l=>l.endsWith(".ts"));s.length!==1&&console.error("TS playground only support 1 ts file");const i=`${n}${pe(t[s[0]].content,E({},o||{},e))}`;return{key:r,title:a,link:encodeURIComponent(i)}}}),rt=["html","js","ts","vue","jsx","tsx","json"],ce="https://sfc.vuejs.org/vue.runtime.esm-browser.js",de="https://sfc.vuejs.org/server-renderer.esm-browser.js",ue=(n={})=>({name:"playground#vue",propsGetter:e=>{const{title:a="",files:t,settings:o,key:r}=e,s={service:"https://sfc.vuejs.org/",dev:!1,ssr:!1,...n,...o},i=Object.fromEntries(Object.entries(t).filter(([,{ext:l}])=>rt.includes(l)).map(([l,{content:y}])=>{if(l==="import-map.json"){const d=JSON.parse(y);return[l,JSON.stringify(E({imports:{vue:ce,...s.ssr?{"vue/server-renderer":de}:{}}},d))]}return[l,y]}));return s.ssr&&!i["import-map.json"]&&(i["import-map.json"]=JSON.stringify({imports:{vue:ce,"vue/server-renderer":de}},null,2)),{key:r,title:a,link:encodeURIComponent(`${s.service}#${s.dev?"__DEV__":""}${s.ssr?"__SSR__":""}${Buffer.from(JSON.stringify(i)).toString("base64")}`)}}}),fe=n=>{n.use(H,{name:"presentation",open:"slidestart",close:"slideend",render:(e,a)=>{const t=e[a],o=`presentation-${a}`,{content:r,info:s}=t;return`<Presentation id="${o}" code="${v(r)}" theme="${s.trim()||"auto"}"></Presentation>`}})},ye=n=>{B(n,{name:"tabs",tabsOpenRenderer:({active:e,data:a},t,o)=>{const{meta:r}=t[o],s=a.map(({title:i,id:l})=>({title:i,...l?{id:l}:{}}));return`<Tabs id="${o}" :data='${JSON.stringify(s).replace(/'/g,"&#39")}'${e!==-1?` :active="${e}"`:""}${r.id?` tab-id="${r.id}"`:""}>
`},tabsCloseRenderer:()=>`</Tabs>
`,tabOpenRenderer:({index:e})=>`<template #tab${e}="{ title, value, isActive }">
`,tabCloseRenderer:()=>`</template>
`})},ge=n=>{w(n,{name:"v-pre",openRender:()=>`<div v-pre>
`,closeRender:()=>`</div>
`})},A={autoResize:!0,showCode:!1,showCompileOutput:!1,showImportMap:!0,clearConsole:!1,layout:"vertical",ssr:!1},st=["html","js","ts","vue","jsx","tsx","json"],it=n=>Buffer.from(JSON.stringify(Object.fromEntries(Object.entries(n).filter(([,{ext:e}])=>st.includes(e)).map(([e,a])=>[e,a.content])))).toString("base64"),be=n=>{n.use(D,{name:"vue-playground",component:"VuePlayground",propsGetter:({title:e="",key:a,files:t,settings:o})=>({title:e,key:a,settings:encodeURIComponent(JSON.stringify(o||{})),files:encodeURIComponent(it(t))})})},he={"/en/":{info:"Info",note:"Note",tip:"Tips",warning:"Note",danger:"Warning",details:"Details"},"/zh/":{info:"相关信息",note:"注",tip:"提示",warning:"注意",danger:"警告",details:"详情"},"/zh-tw/":{info:"相關信息",note:"注",tip:"提示",warning:"注意",danger:"警告",details:"詳情"},"/de-at/":{info:"Information",note:"Note",tip:"Tips",warning:"Notiz",danger:"Warnung",details:"Details"},"/vi/":{info:"Thông tin",note:"Note",tip:"Tips",warning:"Lưu ý",danger:"Cẩn thận",details:"Chi tiết"},"/uk/":{info:"Інформація",note:"Note",tip:"Поради",warning:"Примітка",danger:"Увага",details:"Деталь"},"/ru/":{info:"Инфо",note:"Заметка",tip:"Совет",warning:"Примечание",danger:"Предупреждение",details:"Подробности"},"/br/":{info:"Informativo",note:"Note",tip:"Dicas",warning:"Avisos",danger:"Cuidado",details:"Detalhe"},"/pl/":{info:"Info",note:"Notatka",tip:"Porady",warning:"Notatka",danger:"Ostrzeżenie",details:"Dane"},"/sk/":{info:"Info",note:"Poznámka",tip:"Tip",warning:"Upozornenie",danger:"Pozor",details:"Podrobnosti"},"/fr/":{info:"Info",note:"Note",tip:"Conseil",warning:"Note",danger:"Avertissement",details:"Details"},"/es/":{info:"Información",note:"Nota",tip:"Consejos",warning:"Aviso",danger:"Advertencia",details:"Detalles"},"/ja/":{info:"関連情報",note:"注",tip:"ヒント",warning:"注意",danger:"警告",details:"詳細"},"/tr/":{info:"Bilgi",note:"Not",tip:"Tavsiye",warning:"Uyarı",danger:"Tehlike",details:"Detay"},"/ko/":{info:"정보",note:"노트",tip:"팁",warning:"경고",danger:"위험",details:"세부사항"}},lt=Ie(import.meta.url),$e=["math","maction","maligngroup","malignmark","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mlongdiv","mmutiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mscarries","mscarry","msgroup","msline","mspace","msqrt","msrow","mstack","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","semantics","annotation","annotation-xml"],_=new je("vuepress-plugin-md-enhance"),h=Se(De.resolve(lt,"../client")),pt=(n,e)=>{const{linkCheck:a="dev"}=e;return typeof a=="boolean"?a:a==="always"||n.env.isDev&&a==="dev"||n.env.isBuild&&a==="build"||!1},ve=(n,e)=>{const a=n.filePathRelative||n.path,{pages:t}=e,o=n.links.filter(({raw:s})=>s.match(/.md((?:\?|#).*)?$/)),r=[...o.filter(({raw:s})=>!s.startsWith("/")).filter(({relative:s})=>t.every(({filePathRelative:i})=>i!==decodeURI(s))),...o.filter(({raw:s})=>s.startsWith("/")).filter(({absolute:s})=>t.every(({filePathRelative:i})=>!i||`${e.options.base}${i}`!==decodeURI(s)))].map(({raw:s})=>s);r.length&&Me.warn(`Broken links found in ${a}: ${r.join(", ")}`)},O=({options:n,deprecatedOption:e,newOption:a,msg:t="",scope:o=""})=>{if(e in n){if(_.warn(`${I.magenta(e)} is ${I.yellow("deprecated")}${o?` in ${o}`:""}, please use "${I.magenta(a)}" instead.${t?`
${t}`:""}`),a.includes(".")){const r=a.split(".");let s=n;r.forEach((i,l)=>{l!==r.length-1?(s[i]=s[i]||{},s=s[i]):s[i]=n[e]})}else n[a]=n[e];delete n[e]}},L=(n,e,a="",t="")=>{e in n&&(_.error(`"${I.magenta(e)}" is ${I.red("removed")}${t?`, please use ${I.magenta(t)} instead.`:" and no longer supported"}${a?`
${a}`:""}`),t||delete n[e])},mt=n=>{O({options:n,deprecatedOption:"codegroup",newOption:"codetabs"}),O({options:n,deprecatedOption:"lazyload",newOption:"imgLazyload"}),O({options:n,deprecatedOption:"imageLazyload",newOption:"imgLazyload"}),O({options:n,deprecatedOption:"imageMark",newOption:"imgMark"}),O({options:n,deprecatedOption:"imageSize",newOption:"imgSize"}),O({options:n,deprecatedOption:"mdImport",newOption:"include"}),O({options:n,deprecatedOption:"tex",newOption:"katex"}),O({options:n,deprecatedOption:"vpre",newOption:"vPre"}),O({options:n,deprecatedOption:"imageTitle",newOption:"figure"}),L(n,"enableAll"),L(n,"lineNumbers"),L(n,"imageFix")},ct=n=>{n.use(w,{name:"demo",openRender:(e,a)=>{const{info:t}=e[a],o=/\[(.*)\]/u.exec(t),r=/^ demo\s*(?:\[.*?\])?\s*(.*)\s*$/u.exec(t);let s="";const i={};for(let l=a;l<e.length;l++){const{type:y,content:d,info:c}=e[l];if(y==="container_demo_close")break;d&&y==="fence"&&(c==="json"?s=v(d):i[c]=d)}return`
<CodeDemo id="code-demo-${a}" type="${(o==null?void 0:o[1])||"normal"}"${r?` title="${encodeURIComponent(r[1])}"`:""}${s?` config="${s}"`:""} code="${v(JSON.stringify(i))}">
`},closeRender:()=>"</CodeDemo>"})},dt=n=>{n.use(w,{name:"code-group",openRender:(e,a,t,o)=>(_.warn(`Deprecated code-group syntax found${o.filePathRelative?`in ${o.filePathRelative}`:""}`),`<CodeGroup>
`),closeRender:()=>`</CodeGroup>
`}),n.use(w,{name:"code-group-item",openRender:(e,a)=>{const{info:t}=e[a],o=t.split(":").pop()==="active";return`<CodeGroupItem title="${o?t.replace(/:active$/,""):t}"${o?" active":""}>
`},closeRender:()=>`</CodeGroupItem>
`})},ut=n=>{H(n,{name:"flowchart",open:"flowstart",close:"flowend",render:(e,a)=>{console.warn('"@flowstart ... @flowend" is deprecated, you should use ```flow ... ``` instead.');const t=e[a],o=`flowchart-${a}`,{content:r,info:s}=t;return`<FlowChart id="${o}" code="${v(r)}" preset="${s.trim()||"vue"}"></FlowChart>`}})},ft=async(n,e,a=!1)=>{let t="",o="";const r=(s,i=!1)=>s in e?Boolean(e[s]):i&&"gfm"in e&&e.gfm||!1;return r("chart")&&(t+=`import ChartJS from "${h}components/ChartJS.js";
`,o+=`app.component("ChartJS", ChartJS);
`),r("codetabs")&&(t+=`import CodeTabs from "${h}components/CodeTabs.js";
`,o+=`app.component("CodeTabs", CodeTabs);
`,a&&(t+=`import { CodeGroup, CodeGroupItem } from "${h}compact/index.js";
`,o+=`app.component("CodeGroup", CodeGroup);
app.component("CodeGroupItem", CodeGroupItem);
`)),r("container")&&(t+=`import "${h}styles/container/index.scss";
`),r("demo")&&(t+=`import CodeDemo from "${h}components/CodeDemo.js";
`,o+=`app.component("CodeDemo", CodeDemo);
`),r("echarts")&&(t+=`import ECharts from "${h}components/ECharts.js";
`,o+=`app.component("ECharts", ECharts);
`),r("figure",!0)&&(t+=`import "${h}styles/figure.scss";
`),r("flowchart")&&(t+=`import FlowChart from "${h}components/FlowChart.js";
`,o+=`app.component("FlowChart", FlowChart);
`),r("footnote",!0)&&(t+=`import "${h}styles/footnote.scss";
`),r("imgMark",!0)&&(t+=`import "${h}styles/image-mark.scss";
`),r("mermaid")&&(t+=`import Mermaid from "${h}components/Mermaid.js";
`,o+=`app.component("Mermaid", Mermaid);
`),r("presentation")&&(t+=`import Presentation from "${h}components/Presentation.js";
`,o+=`app.component("Presentation", Presentation);
`),r("playground")&&(t+=`import Playground from "${h}components/Playground.js";
`,o+=`app.component("Playground", Playground);
`),r("tabs")&&(t+=`import Tabs from "${h}components/Tabs.js";
`,o+=`app.component("Tabs", Tabs);
`),r("tasklist",!0)&&(t+=`import "${h}styles/tasklist.scss";
`),r("katex")&&(t+=`import "${h}styles/katex.scss";
`),r("vuePlayground")&&(t+=`import { defineAsyncComponent } from "vue";
`,o+=`app.component("VuePlayground", defineAsyncComponent(() => import("${h}components/VuePlayground.js")));
    `),r("mathjax")&&(t+=`import "./mathjax.css";
`),n.writeTemp("md-enhance/config.js",`import { defineClientConfig } from "@vuepress/client";
${t}

export default defineClientConfig({
  enhance: ({ app }) => {
${o.split(`
`).map(s=>`    ${s}`).join(`
`)}
  },
});
`)},yt=`mjx-container {
  overflow-x: auto;
}
`,gt=async(n,e)=>{await n.writeTemp("md-enhance/mathjax.css",`${Ge(e)}
${yt}`)},bt=async(n,e)=>{const a=["reveal","revealMarkdown",...e.map(t=>`reveal${t[0].toUpperCase()}${t.substring(1)}`)];await n.writeTemp("md-enhance/reveal.js",`import { ${a.join(", ")} } from "${h}reveal/index.js";

export const useReveal = () => [${a.map(t=>`${t}()`).join(", ")}];
`)},ht=(n={gfm:!0},e=!1)=>a=>{e&&mt(n),a.env.isDebug&&_.info("Options:",n);const t=(p,b=!1)=>p in n?Boolean(n[p]):b&&"gfm"in n&&n.gfm||!1,o=ke({app:a,name:"md-enhance",default:he,config:n.locales}),r=t("chart"),s=t("echarts"),i=t("flowchart"),l=t("footnote",!0),y=t("imgMark",!0),d=t("tasklist",!0),c=t("mermaid"),$=t("presentation"),u=t("katex"),g=t("mathjax"),m=t("vuePlayground"),f=pt(a,n),C={macros:{"\\liiiint":"\\int\\!\\!\\!\\iiint","\\iiiint":"\\int\\!\\!\\!\\!\\iiint","\\idotsint":"\\int\\!\\cdots\\!\\int"},...typeof n.katex=="object"?n.katex:{}},R=n.mathjax===!1?null:Je(typeof n.mathjax=="object"?n.mathjax:{}),U=typeof n.presentation=="object"&&Array.isArray(n.presentation.plugins)?n.presentation.plugins:[];Ke(a,{id:"hope"});let F=!1;return{name:"vuepress-plugin-md-enhance",define:()=>({MARKDOWN_ENHANCE_DELAY:n.delay||800,CODE_DEMO_OPTIONS:{...K,...typeof n.demo=="object"?n.demo:{}},MERMAID_OPTIONS:typeof n.mermaid=="object"?n.mermaid:{},REVEAL_CONFIG:typeof n.presentation=="object"&&typeof n.presentation.revealConfig=="object"?n.presentation.revealConfig:{},VUE_PLAYGROUND_OPTIONS:typeof n.vuePlayground=="object"?E({},A,n.vuePlayground):A}),extendsBundlerOptions:(p,b)=>{var x,S,z;if(we(b)==="vite"){const k=p,G=(z=(S=(x=k.viteOptions)==null?void 0:x.build)==null?void 0:S.rollupOptions)==null?void 0:z.onwarn;k.viteOptions=Oe(k.viteOptions||{},{build:{rollupOptions:{onwarn(J,Ce){J.message.includes("Use of eval")||G==null||G(J,Ce)}}}})}xe({app:b,config:p},["fflate","vuepress-shared"]),u&&C.output!=="html"?T({app:b,config:p},$e):g&&(T({app:b,config:p},/^mjx-/),R!=null&&R.documentOptions.enableAssistiveMml&&T({app:b,config:p},$e)),r&&(M({app:b,config:p},"chart.js/auto/auto.mjs"),P({app:b,config:p},"chart.js")),s&&(M({app:b,config:p},"echarts"),P({app:b,config:p},"echarts")),i&&(V({app:b,config:p},"flowchart.js/src/flowchart.parse.js"),P({app:b,config:p},"flowchart.js")),c&&(M({app:b,config:p},"mermaid"),P({app:b,config:p},"mermaid")),$&&(M({app:b,config:p},["reveal.js/dist/reveal.esm.js","reveal.js/plugin/markdown/markdown.esm.js",...U.map(k=>`reveal.js/plugin/${k}/${k}.esm.js`)]),P({app:b,config:p},"reveal.js")),m&&(V({app:b,config:p},"@vue/repl"),P({app:b,config:p},"@vue/repl"),Re({app:b,config:p},k=>{k.module.set("exprContextCritical",!1),k.module.set("unknownContextCritical",!1)}))},extendsMarkdown:p=>{if(t("gfm")&&(p.options.linkify=!0),t("attrs")&&p.use(Ee,typeof n.attrs=="object"?n.attrs:{}),t("align")&&p.use(_e),t("container")&&p.use(re,o),t("imgLazyload")&&p.use(Ae),t("figure")&&p.use(Te),y&&p.use(Le,typeof n.imgMark=="object"?n.imgMark:{}),t("imgSize")&&p.use(Ue),t("sup")&&p.use(He),t("sub")&&p.use(qe),l&&p.use(Ne),t("mark")&&p.use(Be),d&&p.use(Ye,[typeof n.tasklist=="object"?n.tasklist:{}]),(t("vPre")||e)&&p.use(ge),u?p.use(ze,C):g&&p.use(Ve,R),t("include")&&p.use(Fe,{currentPath:b=>b.filePath,...typeof n.include=="object"?n.include:{}}),t("stylize")&&p.use(We,{config:n.stylize,localConfigGetter:b=>{var x;return((x=b.frontmatter)==null?void 0:x.stylize)||null}}),t("codetabs")&&(p.use(ee),e&&p.use(dt)),t("tabs")&&p.use(ye),i&&(p.use(ae),e&&p.use(ut)),r&&p.use(Y),s&&p.use(ne),t("demo")&&(p.use(Q),p.use(X),p.use(Z),e&&p.use(ct)),c&&p.use(ie),$&&p.use(fe),typeof n.playground=="object"){const{presets:b=[],config:x={}}=n.playground;b.forEach(S=>{S==="ts"?p.use(D,me(x.ts||{})):S==="vue"?p.use(D,ue(x.vue||{})):typeof S=="object"&&p.use(D,S)})}m&&p.use(be)},extendsPage:(p,b)=>{f&&F&&ve(p,b)},onInitialized:p=>{F=!0,f&&p.pages.forEach(b=>ve(b,p))},onPrepared:async p=>Promise.all([g?gt(p,R):Promise.resolve(),bt(p,U)]).then(()=>{}),clientConfigFile:p=>ft(p,n,e)}};export{K as CODE_DEMO_DEFAULT_SETTING,A as DEFAULT_VUE_PLAYGROUND_OPTIONS,Y as chart,ee as codeTabs,ne as echarts,ae as flowchart,me as getTSPlaygroundPreset,pe as getURL,ue as getVuePlaygroundPreset,re as hint,he as markdownEnhanceLocales,ht as mdEnhancePlugin,ie as mermaid,Q as normalDemo,D as playground,fe as presentation,Z as reactDemo,ye as tabs,ge as vPre,X as vueDemo,be as vuePlayground};
//# sourceMappingURL=index.js.map
