vditor 3.10.4 → 3.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +2 -0
  2. package/dist/index.css +27 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +15672 -0
  5. package/dist/index.min.js +1 -1
  6. package/dist/js/icons/material.js +2 -2
  7. package/dist/method.d.ts +2 -3
  8. package/dist/method.js +2535 -0
  9. package/dist/method.min.js +1 -1
  10. package/dist/ts/export/index.d.ts +0 -1
  11. package/dist/ts/ir/expandMarker.d.ts +0 -1
  12. package/dist/ts/ir/highlightToolbarIR.d.ts +0 -1
  13. package/dist/ts/ir/input.d.ts +0 -1
  14. package/dist/ts/ir/process.d.ts +0 -1
  15. package/dist/ts/ir/processKeydown.d.ts +0 -1
  16. package/dist/ts/markdown/codeRender.d.ts +0 -1
  17. package/dist/ts/markdown/getHTML.d.ts +0 -1
  18. package/dist/ts/markdown/getMarkdown.d.ts +0 -1
  19. package/dist/ts/markdown/highlightRender.d.ts +0 -1
  20. package/dist/ts/markdown/mathRender.d.ts +0 -1
  21. package/dist/ts/markdown/outlineRender.d.ts +0 -1
  22. package/dist/ts/markdown/previewRender.d.ts +0 -1
  23. package/dist/ts/markdown/setLute.d.ts +0 -1
  24. package/dist/ts/markdown/speechRender.d.ts +0 -1
  25. package/dist/ts/preview/image.d.ts +0 -1
  26. package/dist/ts/sv/inputEvent.d.ts +0 -1
  27. package/dist/ts/sv/process.d.ts +0 -1
  28. package/dist/ts/sv/processKeydown.d.ts +0 -1
  29. package/dist/ts/toolbar/index.d.ts +1 -0
  30. package/dist/ts/toolbar/setToolbar.d.ts +0 -1
  31. package/dist/ts/ui/initUI.d.ts +0 -6
  32. package/dist/ts/ui/setPreviewMode.d.ts +0 -1
  33. package/dist/ts/ui/setTheme.d.ts +0 -1
  34. package/dist/ts/upload/getElement.d.ts +0 -1
  35. package/dist/ts/upload/index.d.ts +0 -1
  36. package/dist/ts/upload/setHeaders.d.ts +0 -1
  37. package/dist/ts/util/editorCommonEvent.d.ts +0 -1
  38. package/dist/ts/util/fixBrowserBehavior.d.ts +0 -1
  39. package/dist/ts/util/highlightToolbar.d.ts +0 -1
  40. package/dist/ts/util/processCode.d.ts +0 -1
  41. package/dist/ts/util/selection.d.ts +0 -1
  42. package/dist/ts/util/toc.d.ts +0 -1
  43. package/dist/ts/wysiwyg/afterRenderEvent.d.ts +0 -1
  44. package/dist/ts/wysiwyg/highlightToolbarWYSIWYG.d.ts +0 -1
  45. package/dist/ts/wysiwyg/inlineTag.d.ts +0 -1
  46. package/dist/ts/wysiwyg/input.d.ts +0 -1
  47. package/dist/ts/wysiwyg/processKeydown.d.ts +0 -1
  48. package/dist/ts/wysiwyg/renderDomByMd.d.ts +0 -1
  49. package/dist/ts/wysiwyg/setHeading.d.ts +0 -1
  50. package/dist/ts/wysiwyg/showCode.d.ts +0 -1
  51. package/dist/ts/wysiwyg/toolbarEvent.d.ts +0 -1
  52. package/dist/types/index.d.ts +4 -0
  53. package/package.json +6 -6
  54. package/src/index.ts +4 -0
  55. package/src/ts/sv/processKeydown.ts +8 -2
  56. package/src/ts/toolbar/Upload.ts +1 -1
  57. package/src/ts/toolbar/index.ts +17 -0
  58. package/src/ts/ui/initUI.ts +0 -6
  59. package/src/ts/util/addScript.ts +3 -3
  60. package/src/ts/util/fixBrowserBehavior.ts +5 -1
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Vditor=t():e.Vditor=t()}(this,(()=>(()=>{"use strict";var e={54:(e,t,n)=>{n.d(t,{g:()=>r});var r=function(){function e(){}return e.ZWSP="​",e.DROP_EDITOR="application/editor",e.MOBILE_WIDTH=520,e.CLASS_MENU_DISABLED="vditor-menu--disabled",e.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],e.CODE_THEME=["abap","algol","algol_nu","arduino","autumn","borland","bw","colorful","dracula","emacs","friendly","fruity","github","igor","lovelace","manni","monokai","monokailight","murphy","native","paraiso-dark","paraiso-light","pastie","perldoc","pygments","rainbow_dash","rrt","solarized-dark","solarized-dark256","solarized-light","swapoff","tango","trac","vim","vs","xcode","ant-design"],e.CODE_LANGUAGES=["mermaid","echarts","mindmap","plantuml","abc","graphviz","flowchart","apache","js","ts","html","markmap","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica","solidity","yul"],e.CDN="https://unpkg.com/vditor@3.10.4",e.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},e.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},e.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},e.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:e.CDN+"/dist/css/content-theme"},e}()},478:(e,t,n)=>{n.d(t,{Q:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=a.abcRenderAdapter.getElements(e);n.length>0&&(0,i.G)(t+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript").then((function(){n.forEach((function(e){e.parentElement.classList.contains("vditor-wysiwyg__pre")||e.parentElement.classList.contains("vditor-ir__marker--pre")||"true"!==e.getAttribute("data-processed")&&(ABCJS.renderAbc(e,a.abcRenderAdapter.getCode(e).trim()),e.style.overflowX="auto",e.setAttribute("data-processed","true"))}))}))}},156:(e,t,n)=>{n.r(t),n.d(t,{abcRenderAdapter:()=>c,chartRenderAdapter:()=>s,flowchartRenderAdapter:()=>d,graphvizRenderAdapter:()=>l,markmapRenderAdapter:()=>a,mathRenderAdapter:()=>r,mermaidRenderAdapter:()=>i,mindmapRenderAdapter:()=>o,plantumlRenderAdapter:()=>u});var r={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-math")}},i={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-mermaid")}},a={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-markmap")}},o={getCode:function(e){return e.getAttribute("data-code")},getElements:function(e){return e.querySelectorAll(".language-mindmap")}},s={getCode:function(e){return e.innerText},getElements:function(e){return e.querySelectorAll(".language-echarts")}},c={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-abc")}},l={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-graphviz")}},d={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-flowchart")}},u={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-plantuml")}}},314:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=a.chartRenderAdapter.getElements(e);o.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=a.chartRenderAdapter.getCode(e).trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var r=JSON.parse(t);echarts.init(e,"dark"===n?"dark":void 0).setOption(r),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="echarts render error: <br>"+t}}}))}))}},730:(e,t,n)=>{n.d(t,{O:()=>a});var r=n(51),i=n(54),a=function(e,t){Array.from(e.querySelectorAll("pre > code")).filter((function(t,n){return!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!t.parentElement.classList.contains("vditor-ir__marker--pre")&&(!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-markmap")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(!(t.style.maxHeight.indexOf("px")>-1)&&!(e.classList.contains("vditor-preview")&&n>5)))})).forEach((function(e){var n,a,o,s=e.innerText;if(e.classList.contains("highlight-chroma")){var c=e.cloneNode(!0);c.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),s=c.innerText}else s.endsWith("\n")&&(s=s.substr(0,s.length-1));var l='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(l='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var d=document.createElement("div");d.className="vditor-copy",d.innerHTML='<span aria-label="'+((null===(n=window.VditorI18n)||void 0===n?void 0:n.copy)||"复制")+"\"\nonmouseover=\"this.setAttribute('aria-label', '"+((null===(a=window.VditorI18n)||void 0===a?void 0:a.copy)||"复制")+"')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '"+((null===(o=window.VditorI18n)||void 0===o?void 0:o.copied)||"已复制")+"');this.previousElementSibling.blur()\">"+l+"</span>";var u=document.createElement("textarea");u.value=(0,r.X)(s),d.insertAdjacentElement("afterbegin",u),t&&t.renderMenu&&t.renderMenu(e,d),e.before(d),e.style.maxHeight=window.outerHeight-40+"px",e.insertAdjacentHTML("afterend",'<span style="position: absolute">'+i.g.ZWSP+"</span>")}))}},66:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=a.flowchartRenderAdapter.getElements(e);0!==n.length&&(0,i.G)(t+"/dist/js/flowchart.js/flowchart.min.js","vditorFlowchartScript").then((function(){n.forEach((function(e){if("true"!==e.getAttribute("data-processed")){var t=flowchart.parse(a.flowchartRenderAdapter.getCode(e));e.innerHTML="",t.drawSVG(e),e.setAttribute("data-processed","true")}}))}))}},218:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=a.graphvizRenderAdapter.getElements(e);0!==n.length&&(0,i.G)(t+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then((function(){n.forEach((function(e){var t=a.graphvizRenderAdapter.getCode(e);if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&"true"!==e.getAttribute("data-processed")&&""!==t.trim()){try{var n=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(n),i=new Worker(r);new Viz({worker:i}).renderSVGElement(t).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error: <br>"+t,e.className="vditor-reset--error"}))}catch(e){console.error("graphviz error",e)}e.setAttribute("data-processed","true")}}))}))}},702:(e,t,n)=>{n.d(t,{s:()=>o});var r=n(54),i=n(526),a=n(578),o=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n=r.g.CDN);var o=e.style;r.g.CODE_THEME.includes(o)||(o="github");var s=document.getElementById("vditorHljsStyle"),c=n+"/dist/js/highlight.js/styles/"+o+".css";(s&&s.getAttribute("href")!==c&&s.remove(),(0,a.c)(n+"/dist/js/highlight.js/styles/"+o+".css","vditorHljsStyle"),!1!==e.enable)&&(0!==t.querySelectorAll("pre > code").length&&(0,i.G)(n+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript").then((function(){(0,i.G)(n+"/dist/js/highlight.js/solidity.min.js","vditorHljsSolidityScript").then((function(){(0,i.G)(n+"/dist/js/highlight.js/yul.min.js","vditorHljsYulScript").then((function(){t.querySelectorAll("pre > code").forEach((function(t){if(!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(""!==e.defaultLang&&-1===t.className.indexOf("language-")&&t.classList.add("language-"+e.defaultLang),hljs.highlightElement(t),e.lineNumber)){t.classList.add("vditor-linenumber");var n=t.querySelector(".vditor-linenumber__temp");n||((n=document.createElement("div")).className="vditor-linenumber__temp",t.insertAdjacentElement("beforeend",n));var r=getComputedStyle(t).whiteSpace,i=!1;"pre-wrap"!==r&&"pre-line"!==r||(i=!0);var a="",o=t.textContent.split(/\r\n|\r|\n/g);o.pop(),o.map((function(e){var t="";i&&(n.textContent=e||"\n",t=' style="height:'+n.getBoundingClientRect().height+'px"'),a+="<span"+t+"></span>"})),n.style.display="none",a='<span class="vditor-linenumber__rows">'+a+"</span>",t.insertAdjacentHTML("beforeend",a)}}))}))}))})))}},563:(e,t,n)=>{n.d(t,{K:()=>c});var r=n(54),i=n(526),a=n(156),o={},s=function(e,t){var n=window.markmap,r=n.Transformer,i=n.Markmap,a=n.deriveOptions,s=(n.globalCSS,new r);e.innerHTML='<svg style="width:100%"></svg>';var c=e.firstChild,l=i.create(c,null),d=function(e,t){var n=e.transform(t),r=Object.keys(n.features).filter((function(e){return!o[e]}));r.forEach((function(e){o[e]=!0}));var i=e.getAssets(r),a=i.styles,s=i.scripts,c=window.markmap;return a&&c.loadCSS(a),s&&c.loadJS(s),n}(s,t),u=d.root,m=d.frontmatter,p=a(null==m?void 0:m.markmap);l.setData(u,p),l.fit()},c=function(e,t,n){void 0===t&&(t=r.g.CDN);var o=a.markmapRenderAdapter.getElements(e);0!==o.length&&(0,i.G)(t+"/dist/js/markmap/markmap.min.js","vditorMermaidScript").then((function(){o.forEach((function(e){var t=a.markmapRenderAdapter.getCode(e);if("true"!==e.getAttribute("data-processed")&&""!==t.trim()){var n=document.createElement("div");n.className="language-markmap",e.parentNode.appendChild(n),s(n,t),"CODE"==e.parentNode.childNodes[0].nodeName&&e.parentNode.removeChild(e.parentNode.childNodes[0])}}))}))}},466:(e,t,n)=>{n.d(t,{H:()=>c});var r=n(54),i=n(526),a=n(578),o=n(51),s=n(156),c=function(e,t){var n=s.mathRenderAdapter.getElements(e);if(0!==n.length){var c={cdn:r.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(t&&t.math&&(t.math=Object.assign({},c.math,t.math)),"KaTeX"===(t=Object.assign({},c,t)).math.engine)(0,a.c)(t.cdn+"/dist/js/katex/katex.min.css?v=0.16.9","vditorKatexStyle"),(0,i.G)(t.cdn+"/dist/js/katex/katex.min.js?v=0.16.9","vditorKatexScript").then((function(){(0,i.G)(t.cdn+"/dist/js/katex/mhchem.min.js?v=0.16.9","vditorKatexChemScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&!e.getAttribute("data-math")){var n=(0,o.X)(s.mathRenderAdapter.getCode(e));e.setAttribute("data-math",n);try{e.innerHTML=katex.renderToString(n,{displayMode:"DIV"===e.tagName,output:"html",macros:t.math.macros})}catch(t){e.innerHTML=t.message,e.className="language-math vditor-reset--error"}e.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault();var t=e.currentTarget.closest(".language-math");e.clipboardData.setData("text/html",t.innerHTML),e.clipboardData.setData("text/plain",t.getAttribute("data-math"))}))}}))}))}));else if("MathJax"===t.math.engine){window.MathJax||(window.MathJax={loader:{paths:{mathjax:t.cdn+"/dist/js/mathjax"}},startup:{typeset:!1},tex:{macros:t.math.macros}},Object.assign(window.MathJax,t.math.mathJaxOptions)),(0,i.J)(t.cdn+"/dist/js/mathjax/tex-svg-full.js","protyleMathJaxScript");var l=function(e,t){var n=(0,o.X)(e.textContent).trim(),r=window.MathJax.getMetricsFor(e);r.display="DIV"===e.tagName,window.MathJax.tex2svgPromise(n,r).then((function(r){e.innerHTML="",e.setAttribute("data-math",n),e.append(r),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var i=r.querySelector('[data-mml-node="merror"]');i&&""!==i.textContent.trim()&&(e.innerHTML=i.textContent.trim(),e.className="vditor-reset--error"),t&&t()}))};window.MathJax.startup.promise.then((function(){for(var e=[],t=function(t){var r=n[t];r.parentElement.classList.contains("vditor-wysiwyg__pre")||r.parentElement.classList.contains("vditor-ir__marker--pre")||r.getAttribute("data-math")||!(0,o.X)(r.textContent).trim()||e.push((function(e){t===n.length-1?l(r):l(r,e)}))},r=0;r<n.length;r++)t(r);!function(e){if(0!==e.length){var t=0,n=e[e.length-1],r=function(){var i=e[t++];i===n?i():i(r)};r()}}(e)}))}}}},554:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(835),i=function(e){e&&e.querySelectorAll("a").forEach((function(e){var t=e.getAttribute("href");t&&(t.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<video controls="controls" src="'+t+'"></video>'),e.remove()}(e,t):t.match(/^.+.(mp3|wav|flac)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<audio controls="controls" src="'+t+'"></audio>'),e.remove()}(e,t):function(e,t){var n=t.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),i=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),a=t.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),o=t.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),s=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),c=t.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),l=t.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),d=t.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(n&&11===n[1].length)e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'+n[1]+(n[2]?"?start="+n[2]:"")+'"></iframe>'),e.remove();else if(i&&i[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'+i[1]+'"></iframe>'),e.remove();else if(a&&a[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='+a[1]+'"></iframe>'),e.remove();else if(o&&o[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="//coub.com/embed/'+o[1]+'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>'),e.remove();else if(s&&s[0])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.facebook.com/plugins/video.php?href='+encodeURIComponent(s[0])+'"></iframe>'),e.remove();else if(c&&c[2])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.dailymotion.com/embed/video/'+c[2]+'"></iframe>'),e.remove();else if(t.indexOf("bilibili.com")>-1&&(t.indexOf("bvid=")>-1||l&&l[1])){var u={bvid:(0,r.o)("bvid",t)||l&&l[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(t.startsWith("http")?t:"https:"+t).search.split("&").forEach((function(e,t){if(e){0===t&&(e=e.substr(1));var n=e.split("=");u[n[0]]=n[1]}}));var m="https://player.bilibili.com/player.html?",p=Object.keys(u);p.forEach((function(e,t){m+=e+"="+u[e],t<p.length-1&&(m+="&")})),e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'+m+'"></iframe>'),e.remove()}else d&&d[1]&&(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'+d[1]+'"></iframe>'),e.remove())}(e,t))}))}},40:(e,t,n)=>{n.d(t,{i:()=>l});var r=n(54),i=n(526),a=n(156),o=n(835),s=function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))},c=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},l=function(e,t,n){void 0===t&&(t=r.g.CDN);var l=a.mermaidRenderAdapter.getElements(e);0!==l.length&&(0,i.G)(t+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then((function(){var e={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8,showSequenceNumbers:!0},gantt:{leftPadding:75,rightPadding:20}};"dark"===n&&(e.theme="dark"),mermaid.initialize(e),l.forEach((function(e){return s(void 0,void 0,void 0,(function(){var t,n,r,i,s;return c(this,(function(c){switch(c.label){case 0:if(t=a.mermaidRenderAdapter.getCode(e),"true"===e.getAttribute("data-processed")||""===t.trim())return[2];n="mermaid"+(0,o.W)(),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,mermaid.render(n,e.textContent)];case 2:return r=c.sent(),e.innerHTML=r.svg,[3,4];case 3:return i=c.sent(),s=document.querySelector("#"+n),e.innerHTML=s.outerHTML+'<br>\n<div style="text-align: left"><small>'+i.message.replace(/\n/,"<br>")+"</small></div>",s.parentElement.remove(),[3,4];case 4:return e.setAttribute("data-processed","true"),[2]}}))}))}))}))}},749:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=a.mindmapRenderAdapter.getElements(e);o.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=a.mindmapRenderAdapter.getCode(e);if(t)try{if("true"===e.getAttribute("data-processed"))return;echarts.init(e,"dark"===n?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(t))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(e,t){var n;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.children)?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="mindmap render error: <br>"+t}}}))}))}},818:(e,t,n)=>{n.d(t,{k:()=>a});var r=n(64),i=n(466),a=function(e,t,n){var a="",o=[];if(Array.from(e.children).forEach((function(e,t){if((0,r.W)(e)){if(n){var i=e.id.lastIndexOf("_");e.id=e.id.substring(0,-1===i?void 0:i)+"_"+t}o.push(e.id),a+=e.outerHTML.replace("<wbr>","")}})),""===a)return t.innerHTML="","";var s=document.createElement("div");if(n)n.lute.SetToC(!0),"wysiwyg"!==n.currentMode||n.preview.element.contains(e)?"ir"!==n.currentMode||n.preview.element.contains(e)?s.innerHTML=n.lute.HTML2VditorDOM("<p>[ToC]</p>"+a):s.innerHTML=n.lute.SpinVditorIRDOM("<p>[ToC]</p>"+a):s.innerHTML=n.lute.SpinVditorDOM("<p>[ToC]</p>"+a),n.lute.SetToC(n.options.preview.markdown.toc);else{t.classList.add("vditor-outline");var c=Lute.New();c.SetToC(!0),s.innerHTML=c.HTML2VditorDOM("<p>[ToC]</p>"+a)}var l=s.firstElementChild.querySelectorAll("li > span[data-target-id]");return l.forEach((function(e,t){if(e.nextElementSibling&&"UL"===e.nextElementSibling.tagName){var n="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(n='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),e.innerHTML=n+"<span>"+e.innerHTML+"</span>"}else e.innerHTML="<svg></svg><span>"+e.innerHTML+"</span>";e.setAttribute("data-target-id",o[t])})),a=s.firstElementChild.innerHTML,0===l.length?(t.innerHTML="",a):(t.innerHTML=a,n&&(0,i.H)(t,{cdn:n.options.cdn,math:n.options.preview.math}),t.firstElementChild.addEventListener("click",(function(r){for(var i=r.target;i&&!i.isEqualNode(t);){if(i.classList.contains("vditor-outline__action")){i.classList.contains("vditor-outline__action--close")?(i.classList.remove("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:block")):(i.classList.add("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:none")),r.preventDefault(),r.stopPropagation();break}if(i.getAttribute("data-target-id")){r.preventDefault(),r.stopPropagation();var a=document.getElementById(i.getAttribute("data-target-id"));if(!a)return;if(n)if("auto"===n.options.height){var o=a.offsetTop+n.element.offsetTop;n.options.toolbarConfig.pin||(o+=n.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,o)}else n.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,n.element.offsetTop),n.preview.element.contains(e)?e.parentElement.scrollTop=a.offsetTop:e.scrollTop=a.offsetTop;else window.scrollTo(window.scrollX,a.offsetTop);break}i=i.parentElement}})),a)}},408:(e,t,n)=>{n.d(t,{B:()=>o});var r=n(54),i=n(526),a=n(156),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=a.plantumlRenderAdapter.getElements(e);0!==n.length&&(0,i.G)(t+"/dist/js/plantuml/plantuml-encoder.min.js","vditorPlantumlScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=a.plantumlRenderAdapter.getCode(e).trim();if(t)try{e.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'+plantumlEncoder.encode(t)+'"/>'}catch(t){e.className="vditor-reset--error",e.innerHTML="plantuml render error: <br>"+t}}}))}))}},895:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){var t=Lute.New();return t.PutEmojis(e.emojis),t.SetEmojiSite(e.emojiSite),t.SetHeadingAnchor(e.headingAnchor),t.SetInlineMathAllowDigitAfterOpenMarker(e.inlineMathDigit),t.SetAutoSpace(e.autoSpace),t.SetToC(e.toc),t.SetFootnotes(e.footnotes),t.SetFixTermTypo(e.fixTermTypo),t.SetVditorCodeBlockPreview(e.codeBlockPreview),t.SetVditorMathBlockPreview(e.mathBlockPreview),t.SetSanitize(e.sanitize),t.SetChineseParagraphBeginningSpace(e.paragraphBeginningSpace),t.SetRenderListStyle(e.listStyle),t.SetLinkBase(e.linkBase),t.SetLinkPrefix(e.linkPrefix),t.SetMark(e.mark),t.SetGFMAutoLink(e.gfmAutoLink),e.lazyLoadImage&&t.SetImageLazyLoading(e.lazyLoadImage),t}},863:(e,t,n)=>{n.d(t,{E:()=>r});var r=function(e,t,n){void 0===t&&(t="zh_CN"),void 0===n&&(n="classic");var r=e.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'+("dark"===n?" vditor--dark":"")+'">\n <div class="vditor-img__bar">\n <span class="vditor-img__btn" data-deg="0">\n <svg><use xlink:href="#vditor-icon-redo"></use></svg>\n '+window.VditorI18n.spin+"\n </span>\n <span class=\"vditor-img__btn\" onclick=\"this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n X &nbsp;"+window.VditorI18n.close+'\n </span>\n </div>\n <div class="vditor-img__img" onclick="this.parentElement.outerHTML = \'\';document.body.style.overflow = \'\'">\n <img style="width: '+e.width+"px;height:"+e.height+"px;transform: translate3d("+r.left+"px, "+(r.top-36)+'px, 0)" src="'+e.getAttribute("src")+'">\n </div>\n</div>'),document.body.style.overflow="hidden";var i=document.querySelector(".vditor-img img"),a="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+Math.max(0,window.innerHeight-36-e.naturalHeight)/2+"px, 0)";setTimeout((function(){i.setAttribute("style","transition: transform .3s ease-in-out;transform: "+a),setTimeout((function(){i.parentElement.scrollTo((i.parentElement.scrollWidth-i.parentElement.clientWidth)/2,(i.parentElement.scrollHeight-i.parentElement.clientHeight)/2)}),400)}));var o=document.querySelector(".vditor-img__btn");o.addEventListener("click",(function(){var t=parseInt(o.getAttribute("data-deg"),10)+90;t/90%2==1&&e.naturalWidth>i.parentElement.clientHeight?i.style.transform="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+(e.naturalWidth/2-e.naturalHeight/2)+"px, 0) rotateZ("+t+"deg)":i.style.transform=a+" rotateZ("+t+"deg)",o.setAttribute("data-deg",t.toString()),setTimeout((function(){i.parentElement.scrollTo((i.parentElement.scrollWidth-i.parentElement.clientWidth)/2,(i.parentElement.scrollHeight-i.parentElement.clientHeight)/2)}),400)}))}},312:(e,t,n)=>{n.d(t,{Y:()=>a});var r=n(54),i=n(578),a=function(e,t){void 0===t&&(t=r.g.CDN),r.g.CODE_THEME.includes(e)||(e="github");var n=document.getElementById("vditorHljsStyle"),a=t+"/dist/js/highlight.js/styles/"+e+".css";n?n.getAttribute("href")!==a&&(n.remove(),(0,i.c)(a,"vditorHljsStyle")):(0,i.c)(a,"vditorHljsStyle")}},227:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(578),i=function(e,t){if(e&&t){var n=document.getElementById("vditorContentTheme"),i=t+"/"+e+".css";n?n.getAttribute("href")!==i&&(n.remove(),(0,r.c)(i,"vditorContentTheme")):(0,r.c)(i,"vditorContentTheme")}}},526:(e,t,n)=>{n.d(t,{G:()=>i,J:()=>r});var r=function(e,t){if(document.getElementById(t))return!1;var n=new XMLHttpRequest;n.open("GET",e,!1),n.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),n.send("");var r=document.createElement("script");r.type="text/javascript",r.text=n.responseText,r.id=t,document.head.appendChild(r)},i=function(e,t){return new Promise((function(n,r){if(document.getElementById(t))return n(),!1;var i=document.createElement("script");i.src=e,i.async=!0,document.head.appendChild(i),i.onerror=function(e){r(e)},i.onload=function(){if(document.getElementById(t))return i.remove(),n(),!1;i.id=t,n()}}))}},578:(e,t,n)=>{n.d(t,{c:()=>r});var r=function(e,t){if(!document.getElementById(t)){var n=document.createElement("link");n.id=t,n.rel="stylesheet",n.type="text/css",n.href=e,document.getElementsByTagName("head")[0].appendChild(n)}}},51:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){return e.replace(/\u00a0/g," ")}},835:(e,t,n)=>{n.d(t,{W:()=>r,o:()=>i});var r=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(parseInt(e,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(e,10)/4).toString(16)}))},i=function(e,t){void 0===t&&(t=window.location.search);var n=t.substring(t.indexOf("?")),r=n.indexOf("#");return new URLSearchParams(n.substring(0,r>=0?r:void 0)).get(e)}},827:(e,t,n)=>{n.d(t,{fb:()=>i,lG:()=>r});var r=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.nodeName===t?r=!0:n=n.parentElement;return r&&n},i=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.classList.contains(t)?r=!0:n=n.parentElement;return r&&n}},64:(e,t,n)=>{n.d(t,{W:()=>r});var r=function(e){var t=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)0===n.nodeName.indexOf(t)?r=!0:n=n.parentElement;return r&&n}(e,"H");return!(!t||2!==t.tagName.length||"HR"===t.tagName)&&t}},640:(e,t,n)=>{n.d(t,{T:()=>r});var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n={},i=function(e){for(var t in e)e.hasOwnProperty(t)&&("[object Object]"===Object.prototype.toString.call(e[t])?n[t]=r(n[t],e[t]):n[t]=e[t])},a=0;a<e.length;a++)i(e[a]);return n}},393:(e,t,n)=>{n.d(t,{Hc:()=>r});n(54);var r=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.d(r,{default:()=>C});var e=n(478),t=n(156),i=n(314),a=n(730),o=n(66),s=n(218),c=n(702),l=function(e){void 0===e&&(e=document);var t=function(e){var t=document.createElement("img");t.src=e.getAttribute("data-src"),t.addEventListener("load",(function(){e.getAttribute("style")||e.getAttribute("class")||e.getAttribute("width")||e.getAttribute("height")||t.naturalHeight>t.naturalWidth&&t.naturalWidth/t.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&t.naturalHeight>window.innerHeight-40&&(e.style.height=window.innerHeight-40+"px"),e.src=t.src})),e.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return e.querySelectorAll("img").forEach((function(e){e.getAttribute("data-src")&&t(e)})),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)}))):(window.vditorImageIntersectionObserver=new IntersectionObserver((function(e){e.forEach((function(e){(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)&&e.target.getAttribute("data-src")&&t(e.target)}))})),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)})))},d=n(466),u=n(554),m=n(40),p=n(563),h=n(749),v=n(818),g=n(408),f=n(54),w=n(227),y=n(526),b=n(827),S=n(640),E=n(895),L=n(393),T=function(e,t){if(void 0===t&&(t="zh_CN"),"undefined"!=typeof speechSynthesis&&"undefined"!=typeof SpeechSynthesisUtterance){var n=function(){var e,n;return speechSynthesis.getVoices().forEach((function(r){r.lang===t.replace("_","-")&&(e=r),r.default&&(n=r)})),e||(e=n),e},r='<svg><use xlink:href="#vditor-icon-play"></use></svg>',i='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(r='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',i='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var a=document.querySelector(".vditor-speech");a||((a=document.createElement("button")).className="vditor-speech",e.insertAdjacentElement("beforeend",a),void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=n));var o=n(),s=new SpeechSynthesisUtterance;s.voice=o,s.onend=s.onerror=function(){a.style.display="none",speechSynthesis.cancel(),a.classList.remove("vditor-speech--current"),a.innerHTML=r},e.addEventListener(void 0!==window.ontouchstart?"touchend":"click",(function(t){var n=t.target;if(n.classList.contains("vditor-speech")||n.parentElement.classList.contains("vditor-speech"))return a.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),a.innerHTML=i):(speechSynthesis.pause(),a.innerHTML=r)):(s.text=a.getAttribute("data-text"),speechSynthesis.speak(s),a.classList.add("vditor-speech--current"),a.innerHTML=i),(0,L.Hc)(window.vditorSpeechRange),void e.focus();if(a.style.display="none",speechSynthesis.cancel(),a.classList.remove("vditor-speech--current"),a.innerHTML=r,0!==getSelection().rangeCount){var o=getSelection().getRangeAt(0),c=o.toString().trim();if(c){window.vditorSpeechRange=o.cloneRange();var l=o.getBoundingClientRect();a.innerHTML=r,a.style.display="block",a.style.top=l.top+l.height+document.querySelector("html").scrollTop-20+"px",void 0!==window.ontouchstart?a.style.left=t.changedTouches[t.changedTouches.length-1].pageX+2+"px":a.style.left=t.clientX+2+"px",a.setAttribute("data-text",c)}}}))}},k=function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))},A=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},x=function(e){var t,n={anchor:0,cdn:f.g.CDN,customEmoji:{},emojiPath:f.g.CDN+"/dist/images/emoji",hljs:f.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:f.g.MARKDOWN_OPTIONS,math:f.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:f.g.THEME_OPTIONS};return e.cdn&&((null===(t=e.theme)||void 0===t?void 0:t.path)||(n.theme.path=e.cdn+"/dist/css/content-theme"),e.emojiPath||(n.emojiPath=e.cdn+"/dist/images/emoji")),(0,S.T)(n,e)},j=function(e,t){var n=x(t);return(0,y.G)(n.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then((function(){var r=(0,E.X)({autoSpace:n.markdown.autoSpace,gfmAutoLink:n.markdown.gfmAutoLink,codeBlockPreview:n.markdown.codeBlockPreview,emojiSite:n.emojiPath,emojis:n.customEmoji,fixTermTypo:n.markdown.fixTermTypo,footnotes:n.markdown.footnotes,headingAnchor:0!==n.anchor,inlineMathDigit:n.math.inlineDigit,lazyLoadImage:n.lazyLoadImage,linkBase:n.markdown.linkBase,linkPrefix:n.markdown.linkPrefix,listStyle:n.markdown.listStyle,mark:n.markdown.mark,mathBlockPreview:n.markdown.mathBlockPreview,paragraphBeginningSpace:n.markdown.paragraphBeginningSpace,sanitize:n.markdown.sanitize,toc:n.markdown.toc});return(null==t?void 0:t.renderers)&&r.SetJSRenderers({renderers:{Md2HTML:t.renderers}}),r.SetHeadingID(!0),r.Md2HTML(e)}))},_=function(t,n,r){return k(void 0,void 0,void 0,(function(){var v,f,S;return A(this,(function(E){switch(E.label){case 0:return v=x(r),[4,j(n,v)];case 1:if(f=E.sent(),v.transform&&(f=v.transform(f)),t.innerHTML=f,t.classList.add("vditor-reset"),v.i18n)return[3,5];if(["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(v.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return S="vditorI18nScript"+v.lang,document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach((function(e){e.id!==S&&document.head.removeChild(e)})),[4,(0,y.G)(v.cdn+"/dist/js/i18n/"+v.lang+".js",S)];case 3:E.sent(),E.label=4;case 4:return[3,6];case 5:window.VditorI18n=v.i18n,E.label=6;case 6:return v.icon?[4,(0,y.G)(v.cdn+"/dist/js/icons/"+v.icon+".js","vditorIconScript")]:[3,8];case 7:E.sent(),E.label=8;case 8:return(0,w.Z)(v.theme.current,v.theme.path),1===v.anchor&&t.classList.add("vditor-reset--anchor"),(0,a.O)(t,v.hljs),(0,c.s)(v.hljs,t,v.cdn),(0,d.H)(t,{cdn:v.cdn,math:v.math}),(0,m.i)(t,v.cdn,v.mode),(0,p.K)(t,v.cdn,v.mode),(0,o.P)(t,v.cdn),(0,s.v)(t,v.cdn),(0,i.p)(t,v.cdn,v.mode),(0,h.P)(t,v.cdn,v.mode),(0,g.B)(t,v.cdn),(0,e.Q)(t,v.cdn),v.render.media.enable&&(0,u.Y)(t),v.speech.enable&&T(t),0!==v.anchor&&(L=v.anchor,document.querySelectorAll(".vditor-anchor").forEach((function(e){1===L&&e.classList.add("vditor-anchor--left"),e.onclick=function(){var t=e.getAttribute("href").substr(1),n=document.getElementById("vditorAnchor-"+t).offsetTop;document.querySelector("html").scrollTop=n}})),window.onhashchange=function(){var e=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));e&&(document.querySelector("html").scrollTop=e.offsetTop)}),v.after&&v.after(),v.lazyLoadImage&&l(t),t.addEventListener("click",(function(e){var n=(0,b.lG)(e.target,"SPAN");if(n&&(0,b.fb)(n,"vditor-toc")){var r=t.querySelector("#"+n.getAttribute("data-target-id"));r&&window.scrollTo(window.scrollX,r.offsetTop)}else;})),[2]}var L}))}))},M=n(863),H=n(312);const C=function(){function n(){}return n.adapterRender=t,n.previewImage=M.E,n.codeRender=a.O,n.graphvizRender=s.v,n.highlightRender=c.s,n.mathRender=d.H,n.mermaidRender=m.i,n.markmapRender=p.K,n.flowchartRender=o.P,n.chartRender=i.p,n.abcRender=e.Q,n.mindmapRender=h.P,n.plantumlRender=g.B,n.outlineRender=v.k,n.mediaRender=u.Y,n.speechRender=T,n.lazyLoadImageRender=l,n.md2html=j,n.preview=_,n.setCodeTheme=H.Y,n.setContentTheme=w.Z,n}()})(),r=r.default})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Vditor=t():e.Vditor=t()}(this,(()=>(()=>{"use strict";var e={793:(e,t,n)=>{n.d(t,{g:()=>r});var r=function(){function e(){}return e.ZWSP="​",e.DROP_EDITOR="application/editor",e.MOBILE_WIDTH=520,e.CLASS_MENU_DISABLED="vditor-menu--disabled",e.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],e.CODE_THEME=["abap","algol","algol_nu","arduino","autumn","borland","bw","colorful","dracula","emacs","friendly","fruity","github","igor","lovelace","manni","monokai","monokailight","murphy","native","paraiso-dark","paraiso-light","pastie","perldoc","pygments","rainbow_dash","rrt","solarized-dark","solarized-dark256","solarized-light","swapoff","tango","trac","vim","vs","xcode","ant-design"],e.CODE_LANGUAGES=["mermaid","echarts","mindmap","plantuml","abc","graphviz","flowchart","apache","js","ts","html","markmap","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica","solidity","yul"],e.CDN="https://unpkg.com/vditor@".concat("3.10.5"),e.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},e.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},e.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},e.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(e.CDN,"/dist/css/content-theme")},e}()},386:(e,t,n)=>{n.d(t,{Q:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=i.abcRenderAdapter.getElements(e);n.length>0&&(0,a.G)("".concat(t,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then((function(){n.forEach((function(e){e.parentElement.classList.contains("vditor-wysiwyg__pre")||e.parentElement.classList.contains("vditor-ir__marker--pre")||"true"!==e.getAttribute("data-processed")&&(ABCJS.renderAbc(e,i.abcRenderAdapter.getCode(e).trim()),e.style.overflowX="auto",e.setAttribute("data-processed","true"))}))}))}},781:(e,t,n)=>{n.r(t),n.d(t,{abcRenderAdapter:()=>s,chartRenderAdapter:()=>c,flowchartRenderAdapter:()=>d,graphvizRenderAdapter:()=>l,markmapRenderAdapter:()=>i,mathRenderAdapter:()=>r,mermaidRenderAdapter:()=>a,mindmapRenderAdapter:()=>o,plantumlRenderAdapter:()=>u});var r={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-math")}},a={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-mermaid")}},i={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-markmap")}},o={getCode:function(e){return e.getAttribute("data-code")},getElements:function(e){return e.querySelectorAll(".language-mindmap")}},c={getCode:function(e){return e.innerText},getElements:function(e){return e.querySelectorAll(".language-echarts")}},s={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-abc")}},l={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-graphviz")}},d={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-flowchart")}},u={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-plantuml")}}},379:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=i.chartRenderAdapter.getElements(e);o.length>0&&(0,a.G)("".concat(t,"/dist/js/echarts/echarts.min.js"),"vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=i.chartRenderAdapter.getCode(e).trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var r=JSON.parse(t);echarts.init(e,"dark"===n?"dark":void 0).setOption(r),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="echarts render error: <br>".concat(t)}}}))}))}},895:(e,t,n)=>{n.d(t,{O:()=>i});var r=n(528),a=n(793),i=function(e,t){Array.from(e.querySelectorAll("pre > code")).filter((function(t,n){return!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!t.parentElement.classList.contains("vditor-ir__marker--pre")&&(!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-markmap")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(!(t.style.maxHeight.indexOf("px")>-1)&&!(e.classList.contains("vditor-preview")&&n>5)))})).forEach((function(e){var n,i,o,c=e.innerText;if(e.classList.contains("highlight-chroma")){var s=e.cloneNode(!0);s.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),c=s.innerText}else c.endsWith("\n")&&(c=c.substr(0,c.length-1));var l='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(l='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var d=document.createElement("div");d.className="vditor-copy",d.innerHTML='<span aria-label="'.concat((null===(n=window.VditorI18n)||void 0===n?void 0:n.copy)||"复制","\"\nonmouseover=\"this.setAttribute('aria-label', '").concat((null===(i=window.VditorI18n)||void 0===i?void 0:i.copy)||"复制","')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '").concat((null===(o=window.VditorI18n)||void 0===o?void 0:o.copied)||"已复制","');this.previousElementSibling.blur()\">").concat(l,"</span>");var u=document.createElement("textarea");u.value=(0,r.X)(c),d.insertAdjacentElement("afterbegin",u),t&&t.renderMenu&&t.renderMenu(e,d),e.before(d),e.style.maxHeight=window.outerHeight-40+"px",e.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(a.g.ZWSP,"</span>"))}))}},169:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=i.flowchartRenderAdapter.getElements(e);0!==n.length&&(0,a.G)("".concat(t,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then((function(){n.forEach((function(e){if("true"!==e.getAttribute("data-processed")){var t=flowchart.parse(i.flowchartRenderAdapter.getCode(e));e.innerHTML="",t.drawSVG(e),e.setAttribute("data-processed","true")}}))}))}},572:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=i.graphvizRenderAdapter.getElements(e);0!==n.length&&(0,a.G)("".concat(t,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then((function(){n.forEach((function(e){var t=i.graphvizRenderAdapter.getCode(e);if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&"true"!==e.getAttribute("data-processed")&&""!==t.trim()){try{var n=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(n),a=new Worker(r);new Viz({worker:a}).renderSVGElement(t).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error: <br>".concat(t),e.className="vditor-reset--error"}))}catch(e){console.error("graphviz error",e)}e.setAttribute("data-processed","true")}}))}))}},702:(e,t,n)=>{n.d(t,{s:()=>o});var r=n(793),a=n(998),i=n(296),o=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n=r.g.CDN);var o=e.style;r.g.CODE_THEME.includes(o)||(o="github");var c=document.getElementById("vditorHljsStyle"),s="".concat(n,"/dist/js/highlight.js/styles/").concat(o,".css");(c&&c.getAttribute("href")!==s&&c.remove(),(0,i.c)("".concat(n,"/dist/js/highlight.js/styles/").concat(o,".css"),"vditorHljsStyle"),!1!==e.enable)&&(0!==t.querySelectorAll("pre > code").length&&(0,a.G)("".concat(n,"/dist/js/highlight.js/highlight.pack.js"),"vditorHljsScript").then((function(){(0,a.G)("".concat(n,"/dist/js/highlight.js/solidity.min.js"),"vditorHljsSolidityScript").then((function(){(0,a.G)("".concat(n,"/dist/js/highlight.js/yul.min.js"),"vditorHljsYulScript").then((function(){t.querySelectorAll("pre > code").forEach((function(t){if(!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(""!==e.defaultLang&&-1===t.className.indexOf("language-")&&t.classList.add("language-"+e.defaultLang),hljs.highlightElement(t),e.lineNumber)){t.classList.add("vditor-linenumber");var n=t.querySelector(".vditor-linenumber__temp");n||((n=document.createElement("div")).className="vditor-linenumber__temp",t.insertAdjacentElement("beforeend",n));var r=getComputedStyle(t).whiteSpace,a=!1;"pre-wrap"!==r&&"pre-line"!==r||(a=!0);var i="",o=t.textContent.split(/\r\n|\r|\n/g);o.pop(),o.map((function(e){var t="";a&&(n.textContent=e||"\n",t=' style="height:'.concat(n.getBoundingClientRect().height,'px"')),i+="<span".concat(t,"></span>")})),n.style.display="none",i='<span class="vditor-linenumber__rows">'.concat(i,"</span>"),t.insertAdjacentHTML("beforeend",i)}}))}))}))})))}},593:(e,t,n)=>{n.d(t,{K:()=>s});var r=n(793),a=n(998),i=n(781),o={},c=function(e,t){var n=window.markmap,r=n.Transformer,a=n.Markmap,i=n.deriveOptions,c=(n.globalCSS,new r);e.innerHTML='<svg style="width:100%"></svg>';var s=e.firstChild,l=a.create(s,null),d=function(e,t){var n=e.transform(t),r=Object.keys(n.features).filter((function(e){return!o[e]}));r.forEach((function(e){o[e]=!0}));var a=e.getAssets(r),i=a.styles,c=a.scripts,s=window.markmap;return i&&s.loadCSS(i),c&&s.loadJS(c),n}(c,t),u=d.root,m=d.frontmatter,p=i(null==m?void 0:m.markmap);l.setData(u,p),l.fit()},s=function(e,t,n){void 0===t&&(t=r.g.CDN);var o=i.markmapRenderAdapter.getElements(e);0!==o.length&&(0,a.G)("".concat(t,"/dist/js/markmap/markmap.min.js"),"vditorMermaidScript").then((function(){o.forEach((function(e){var t=i.markmapRenderAdapter.getCode(e);if("true"!==e.getAttribute("data-processed")&&""!==t.trim()){var n=document.createElement("div");n.className="language-markmap",e.parentNode.appendChild(n),c(n,t),"CODE"==e.parentNode.childNodes[0].nodeName&&e.parentNode.removeChild(e.parentNode.childNodes[0])}}))}))}},982:(e,t,n)=>{n.d(t,{H:()=>s});var r=n(793),a=n(998),i=n(296),o=n(528),c=n(781),s=function(e,t){var n=c.mathRenderAdapter.getElements(e);if(0!==n.length){var s={cdn:r.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(t&&t.math&&(t.math=Object.assign({},s.math,t.math)),"KaTeX"===(t=Object.assign({},s,t)).math.engine)(0,i.c)("".concat(t.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,a.G)("".concat(t.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then((function(){(0,a.G)("".concat(t.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&!e.getAttribute("data-math")){var n=(0,o.X)(c.mathRenderAdapter.getCode(e));e.setAttribute("data-math",n);try{e.innerHTML=katex.renderToString(n,{displayMode:"DIV"===e.tagName,output:"html",macros:t.math.macros})}catch(t){e.innerHTML=t.message,e.className="language-math vditor-reset--error"}e.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault();var t=e.currentTarget.closest(".language-math");e.clipboardData.setData("text/html",t.innerHTML),e.clipboardData.setData("text/plain",t.getAttribute("data-math"))}))}}))}))}));else if("MathJax"===t.math.engine){window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(t.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:t.math.macros}},Object.assign(window.MathJax,t.math.mathJaxOptions)),(0,a.J)("".concat(t.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var l=function(e,t){var n=(0,o.X)(e.textContent).trim(),r=window.MathJax.getMetricsFor(e);r.display="DIV"===e.tagName,window.MathJax.tex2svgPromise(n,r).then((function(r){e.innerHTML="",e.setAttribute("data-math",n),e.append(r),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var a=r.querySelector('[data-mml-node="merror"]');a&&""!==a.textContent.trim()&&(e.innerHTML=a.textContent.trim(),e.className="vditor-reset--error"),t&&t()}))};window.MathJax.startup.promise.then((function(){for(var e=[],t=function(t){var r=n[t];r.parentElement.classList.contains("vditor-wysiwyg__pre")||r.parentElement.classList.contains("vditor-ir__marker--pre")||r.getAttribute("data-math")||!(0,o.X)(r.textContent).trim()||e.push((function(e){t===n.length-1?l(r):l(r,e)}))},r=0;r<n.length;r++)t(r);!function(e){if(0!==e.length){var t=0,n=e[e.length-1],r=function(){var a=e[t++];a===n?a():a(r)};r()}}(e)}))}}}},431:(e,t,n)=>{n.d(t,{Y:()=>a});var r=n(446),a=function(e){e&&e.querySelectorAll("a").forEach((function(e){var t=e.getAttribute("href");t&&(t.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(t,'"></video>')),e.remove()}(e,t):t.match(/^.+.(mp3|wav|flac)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(t,'"></audio>')),e.remove()}(e,t):function(e,t){var n=t.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),a=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),i=t.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),o=t.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),c=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),s=t.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),l=t.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),d=t.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(n&&11===n[1].length)e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(n[1]+(n[2]?"?start="+n[2]:""),'"></iframe>')),e.remove();else if(a&&a[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(a[1],'"></iframe>')),e.remove();else if(i&&i[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(i[1],'"></iframe>')),e.remove();else if(o&&o[1])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="//coub.com/embed/'.concat(o[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),e.remove();else if(c&&c[0])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.facebook.com/plugins/video.php?href='.concat(encodeURIComponent(c[0]),'"></iframe>')),e.remove();else if(s&&s[2])e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.dailymotion.com/embed/video/'.concat(s[2],'"></iframe>')),e.remove();else if(t.indexOf("bilibili.com")>-1&&(t.indexOf("bvid=")>-1||l&&l[1])){var u={bvid:(0,r.o)("bvid",t)||l&&l[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(t.startsWith("http")?t:"https:"+t).search.split("&").forEach((function(e,t){if(e){0===t&&(e=e.substr(1));var n=e.split("=");u[n[0]]=n[1]}}));var m="https://player.bilibili.com/player.html?",p=Object.keys(u);p.forEach((function(e,t){m+="".concat(e,"=").concat(u[e]),t<p.length-1&&(m+="&")})),e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(m,'"></iframe>')),e.remove()}else d&&d[1]&&(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(d[1],'"></iframe>')),e.remove())}(e,t))}))}},570:(e,t,n)=>{n.d(t,{i:()=>l});var r=n(793),a=n(998),i=n(781),o=n(446),c=function(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,c)}s((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},l=function(e,t,n){void 0===t&&(t=r.g.CDN);var l=i.mermaidRenderAdapter.getElements(e);0!==l.length&&(0,a.G)("".concat(t,"/dist/js/mermaid/mermaid.min.js"),"vditorMermaidScript").then((function(){var e={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8,showSequenceNumbers:!0},gantt:{leftPadding:75,rightPadding:20}};"dark"===n&&(e.theme="dark"),mermaid.initialize(e),l.forEach((function(e){return c(void 0,void 0,void 0,(function(){var t,n,r,a,c;return s(this,(function(s){switch(s.label){case 0:if(t=i.mermaidRenderAdapter.getCode(e),"true"===e.getAttribute("data-processed")||""===t.trim())return[2];n="mermaid"+(0,o.W)(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,mermaid.render(n,e.textContent)];case 2:return r=s.sent(),e.innerHTML=r.svg,[3,4];case 3:return a=s.sent(),c=document.querySelector("#"+n),e.innerHTML="".concat(c.outerHTML,'<br>\n<div style="text-align: left"><small>').concat(a.message.replace(/\n/,"<br>"),"</small></div>"),c.parentElement.remove(),[3,4];case 4:return e.setAttribute("data-processed","true"),[2]}}))}))}))}))}},558:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=i.mindmapRenderAdapter.getElements(e);o.length>0&&(0,a.G)("".concat(t,"/dist/js/echarts/echarts.min.js"),"vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=i.mindmapRenderAdapter.getCode(e);if(t)try{if("true"===e.getAttribute("data-processed"))return;echarts.init(e,"dark"===n?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(t))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(e,t){var n;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.children)?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="mindmap render error: <br>".concat(t)}}}))}))}},182:(e,t,n)=>{n.d(t,{k:()=>i});var r=n(946),a=n(982),i=function(e,t,n){var i="",o=[];if(Array.from(e.children).forEach((function(e,t){if((0,r.W)(e)){if(n){var a=e.id.lastIndexOf("_");e.id=e.id.substring(0,-1===a?void 0:a)+"_"+t}o.push(e.id),i+=e.outerHTML.replace("<wbr>","")}})),""===i)return t.innerHTML="","";var c=document.createElement("div");if(n)n.lute.SetToC(!0),"wysiwyg"!==n.currentMode||n.preview.element.contains(e)?"ir"!==n.currentMode||n.preview.element.contains(e)?c.innerHTML=n.lute.HTML2VditorDOM("<p>[ToC]</p>"+i):c.innerHTML=n.lute.SpinVditorIRDOM("<p>[ToC]</p>"+i):c.innerHTML=n.lute.SpinVditorDOM("<p>[ToC]</p>"+i),n.lute.SetToC(n.options.preview.markdown.toc);else{t.classList.add("vditor-outline");var s=Lute.New();s.SetToC(!0),c.innerHTML=s.HTML2VditorDOM("<p>[ToC]</p>"+i)}var l=c.firstElementChild.querySelectorAll("li > span[data-target-id]");return l.forEach((function(e,t){if(e.nextElementSibling&&"UL"===e.nextElementSibling.tagName){var n="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(n='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),e.innerHTML="".concat(n,"<span>").concat(e.innerHTML,"</span>")}else e.innerHTML="<svg></svg><span>".concat(e.innerHTML,"</span>");e.setAttribute("data-target-id",o[t])})),i=c.firstElementChild.innerHTML,0===l.length?(t.innerHTML="",i):(t.innerHTML=i,n&&(0,a.H)(t,{cdn:n.options.cdn,math:n.options.preview.math}),t.firstElementChild.addEventListener("click",(function(r){for(var a=r.target;a&&!a.isEqualNode(t);){if(a.classList.contains("vditor-outline__action")){a.classList.contains("vditor-outline__action--close")?(a.classList.remove("vditor-outline__action--close"),a.parentElement.nextElementSibling.setAttribute("style","display:block")):(a.classList.add("vditor-outline__action--close"),a.parentElement.nextElementSibling.setAttribute("style","display:none")),r.preventDefault(),r.stopPropagation();break}if(a.getAttribute("data-target-id")){r.preventDefault(),r.stopPropagation();var i=document.getElementById(a.getAttribute("data-target-id"));if(!i)return;if(n)if("auto"===n.options.height){var o=i.offsetTop+n.element.offsetTop;n.options.toolbarConfig.pin||(o+=n.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,o)}else n.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,n.element.offsetTop),n.preview.element.contains(e)?e.parentElement.scrollTop=i.offsetTop:e.scrollTop=i.offsetTop;else window.scrollTo(window.scrollX,i.offsetTop);break}a=a.parentElement}})),i)}},931:(e,t,n)=>{n.d(t,{B:()=>o});var r=n(793),a=n(998),i=n(781),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=i.plantumlRenderAdapter.getElements(e);0!==n.length&&(0,a.G)("".concat(t,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=i.plantumlRenderAdapter.getCode(e).trim();if(t)try{e.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(t),'"/>')}catch(t){e.className="vditor-reset--error",e.innerHTML="plantuml render error: <br>".concat(t)}}}))}))}},65:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){var t=Lute.New();return t.PutEmojis(e.emojis),t.SetEmojiSite(e.emojiSite),t.SetHeadingAnchor(e.headingAnchor),t.SetInlineMathAllowDigitAfterOpenMarker(e.inlineMathDigit),t.SetAutoSpace(e.autoSpace),t.SetToC(e.toc),t.SetFootnotes(e.footnotes),t.SetFixTermTypo(e.fixTermTypo),t.SetVditorCodeBlockPreview(e.codeBlockPreview),t.SetVditorMathBlockPreview(e.mathBlockPreview),t.SetSanitize(e.sanitize),t.SetChineseParagraphBeginningSpace(e.paragraphBeginningSpace),t.SetRenderListStyle(e.listStyle),t.SetLinkBase(e.linkBase),t.SetLinkPrefix(e.linkPrefix),t.SetMark(e.mark),t.SetGFMAutoLink(e.gfmAutoLink),e.lazyLoadImage&&t.SetImageLazyLoading(e.lazyLoadImage),t}},971:(e,t,n)=>{n.d(t,{E:()=>r});var r=function(e,t,n){void 0===t&&(t="zh_CN"),void 0===n&&(n="classic");var r=e.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat("dark"===n?" vditor--dark":"",'">\n <div class="vditor-img__bar">\n <span class="vditor-img__btn" data-deg="0">\n <svg><use xlink:href="#vditor-icon-redo"></use></svg>\n ').concat(window.VditorI18n.spin,"\n </span>\n <span class=\"vditor-img__btn\" onclick=\"this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n X &nbsp;").concat(window.VditorI18n.close,'\n </span>\n </div>\n <div class="vditor-img__img" onclick="this.parentElement.outerHTML = \'\';document.body.style.overflow = \'\'">\n <img style="width: ').concat(e.width,"px;height:").concat(e.height,"px;transform: translate3d(").concat(r.left,"px, ").concat(r.top-36,'px, 0)" src="').concat(e.getAttribute("src"),'">\n </div>\n</div>')),document.body.style.overflow="hidden";var a=document.querySelector(".vditor-img img"),i="translate3d(".concat(Math.max(0,window.innerWidth-e.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-36-e.naturalHeight)/2,"px, 0)");setTimeout((function(){a.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(i)),setTimeout((function(){a.parentElement.scrollTo((a.parentElement.scrollWidth-a.parentElement.clientWidth)/2,(a.parentElement.scrollHeight-a.parentElement.clientHeight)/2)}),400)}));var o=document.querySelector(".vditor-img__btn");o.addEventListener("click",(function(){var t=parseInt(o.getAttribute("data-deg"),10)+90;t/90%2==1&&e.naturalWidth>a.parentElement.clientHeight?a.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-e.naturalWidth)/2,"px, ").concat(e.naturalWidth/2-e.naturalHeight/2,"px, 0) rotateZ(").concat(t,"deg)"):a.style.transform="".concat(i," rotateZ(").concat(t,"deg)"),o.setAttribute("data-deg",t.toString()),setTimeout((function(){a.parentElement.scrollTo((a.parentElement.scrollWidth-a.parentElement.clientWidth)/2,(a.parentElement.scrollHeight-a.parentElement.clientHeight)/2)}),400)}))}},34:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(793),a=n(296),i=function(e,t){void 0===t&&(t=r.g.CDN),r.g.CODE_THEME.includes(e)||(e="github");var n=document.getElementById("vditorHljsStyle"),i="".concat(t,"/dist/js/highlight.js/styles/").concat(e,".css");n?n.getAttribute("href")!==i&&(n.remove(),(0,a.c)(i,"vditorHljsStyle")):(0,a.c)(i,"vditorHljsStyle")}},652:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(296),a=function(e,t){if(e&&t){var n=document.getElementById("vditorContentTheme"),a="".concat(t,"/").concat(e,".css");n?n.getAttribute("href")!==a&&(n.remove(),(0,r.c)(a,"vditorContentTheme")):(0,r.c)(a,"vditorContentTheme")}}},998:(e,t,n)=>{n.d(t,{G:()=>a,J:()=>r});var r=function(e,t){if(document.getElementById(t))return!1;var n=new XMLHttpRequest;n.open("GET",e,!1),n.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),n.send("");var r=document.createElement("script");r.type="text/javascript",r.text=n.responseText,r.id=t,document.head.appendChild(r)},a=function(e,t){return new Promise((function(n,r){if(document.getElementById(t))return n(!0),!1;var a=document.createElement("script");a.src=e,a.async=!0,document.head.appendChild(a),a.onerror=function(e){r(e)},a.onload=function(){if(document.getElementById(t))return a.remove(),n(!0),!1;a.id=t,n(!0)}}))}},296:(e,t,n)=>{n.d(t,{c:()=>r});var r=function(e,t){if(!document.getElementById(t)){var n=document.createElement("link");n.id=t,n.rel="stylesheet",n.type="text/css",n.href=e,document.getElementsByTagName("head")[0].appendChild(n)}}},528:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){return e.replace(/\u00a0/g," ")}},446:(e,t,n)=>{n.d(t,{W:()=>r,o:()=>a});var r=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(parseInt(e,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(e,10)/4).toString(16)}))},a=function(e,t){void 0===t&&(t=window.location.search);var n=t.substring(t.indexOf("?")),r=n.indexOf("#");return new URLSearchParams(n.substring(0,r>=0?r:void 0)).get(e)}},118:(e,t,n)=>{n.d(t,{fb:()=>a,lG:()=>r});var r=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.nodeName===t?r=!0:n=n.parentElement;return r&&n},a=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.classList.contains(t)?r=!0:n=n.parentElement;return r&&n}},946:(e,t,n)=>{n.d(t,{W:()=>r});var r=function(e){var t=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)0===n.nodeName.indexOf(t)?r=!0:n=n.parentElement;return r&&n}(e,"H");return!(!t||2!==t.tagName.length||"HR"===t.tagName)&&t}},2:(e,t,n)=>{n.d(t,{T:()=>r});var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n={},a=function(e){for(var t in e)e.hasOwnProperty(t)&&("[object Object]"===Object.prototype.toString.call(e[t])?n[t]=r(n[t],e[t]):n[t]=e[t])},i=0;i<e.length;i++)a(e[i]);return n}},307:(e,t,n)=>{n.d(t,{Hc:()=>r});n(793);var r=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.d(r,{default:()=>C});var e=n(386),t=n(781),a=n(379),i=n(895),o=n(169),c=n(572),s=n(702),l=function(e){void 0===e&&(e=document);var t=function(e){var t=document.createElement("img");t.src=e.getAttribute("data-src"),t.addEventListener("load",(function(){e.getAttribute("style")||e.getAttribute("class")||e.getAttribute("width")||e.getAttribute("height")||t.naturalHeight>t.naturalWidth&&t.naturalWidth/t.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&t.naturalHeight>window.innerHeight-40&&(e.style.height=window.innerHeight-40+"px"),e.src=t.src})),e.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return e.querySelectorAll("img").forEach((function(e){e.getAttribute("data-src")&&t(e)})),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)}))):(window.vditorImageIntersectionObserver=new IntersectionObserver((function(e){e.forEach((function(e){(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)&&e.target.getAttribute("data-src")&&t(e.target)}))})),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)})))},d=n(982),u=n(431),m=n(570),p=n(593),h=n(558),v=n(182),g=n(931),f=n(793),w=n(652),y=n(998),b=n(118),S=n(2),E=n(65),L=n(307),T=function(e,t){if(void 0===t&&(t="zh_CN"),"undefined"!=typeof speechSynthesis&&"undefined"!=typeof SpeechSynthesisUtterance){var n=function(){var e,n;return speechSynthesis.getVoices().forEach((function(r){r.lang===t.replace("_","-")&&(e=r),r.default&&(n=r)})),e||(e=n),e},r='<svg><use xlink:href="#vditor-icon-play"></use></svg>',a='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(r='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',a='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var i=document.querySelector(".vditor-speech");i||((i=document.createElement("button")).className="vditor-speech",e.insertAdjacentElement("beforeend",i),void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=n));var o=n(),c=new SpeechSynthesisUtterance;c.voice=o,c.onend=c.onerror=function(){i.style.display="none",speechSynthesis.cancel(),i.classList.remove("vditor-speech--current"),i.innerHTML=r},e.addEventListener(void 0!==window.ontouchstart?"touchend":"click",(function(t){var n=t.target;if(n.classList.contains("vditor-speech")||n.parentElement.classList.contains("vditor-speech"))return i.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),i.innerHTML=a):(speechSynthesis.pause(),i.innerHTML=r)):(c.text=i.getAttribute("data-text"),speechSynthesis.speak(c),i.classList.add("vditor-speech--current"),i.innerHTML=a),(0,L.Hc)(window.vditorSpeechRange),void e.focus();if(i.style.display="none",speechSynthesis.cancel(),i.classList.remove("vditor-speech--current"),i.innerHTML=r,0!==getSelection().rangeCount){var o=getSelection().getRangeAt(0),s=o.toString().trim();if(s){window.vditorSpeechRange=o.cloneRange();var l=o.getBoundingClientRect();i.innerHTML=r,i.style.display="block",i.style.top=l.top+l.height+document.querySelector("html").scrollTop-20+"px",void 0!==window.ontouchstart?i.style.left=t.changedTouches[t.changedTouches.length-1].pageX+2+"px":i.style.left=t.clientX+2+"px",i.setAttribute("data-text",s)}}}))}},k=function(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,c)}s((r=r.apply(e,t||[])).next())}))},A=function(e,t){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},x=function(e){var t,n={anchor:0,cdn:f.g.CDN,customEmoji:{},emojiPath:"".concat(f.g.CDN,"/dist/images/emoji"),hljs:f.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:f.g.MARKDOWN_OPTIONS,math:f.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:f.g.THEME_OPTIONS};return e.cdn&&((null===(t=e.theme)||void 0===t?void 0:t.path)||(n.theme.path="".concat(e.cdn,"/dist/css/content-theme")),e.emojiPath||(n.emojiPath="".concat(e.cdn,"/dist/images/emoji"))),(0,S.T)(n,e)},j=function(e,t){var n=x(t);return(0,y.G)("".concat(n.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then((function(){var r=(0,E.X)({autoSpace:n.markdown.autoSpace,gfmAutoLink:n.markdown.gfmAutoLink,codeBlockPreview:n.markdown.codeBlockPreview,emojiSite:n.emojiPath,emojis:n.customEmoji,fixTermTypo:n.markdown.fixTermTypo,footnotes:n.markdown.footnotes,headingAnchor:0!==n.anchor,inlineMathDigit:n.math.inlineDigit,lazyLoadImage:n.lazyLoadImage,linkBase:n.markdown.linkBase,linkPrefix:n.markdown.linkPrefix,listStyle:n.markdown.listStyle,mark:n.markdown.mark,mathBlockPreview:n.markdown.mathBlockPreview,paragraphBeginningSpace:n.markdown.paragraphBeginningSpace,sanitize:n.markdown.sanitize,toc:n.markdown.toc});return(null==t?void 0:t.renderers)&&r.SetJSRenderers({renderers:{Md2HTML:t.renderers}}),r.SetHeadingID(!0),r.Md2HTML(e)}))},_=function(t,n,r){return k(void 0,void 0,void 0,(function(){var v,f,S,E;return A(this,(function(L){switch(L.label){case 0:return v=x(r),[4,j(n,v)];case 1:if(f=L.sent(),v.transform&&(f=v.transform(f)),t.innerHTML=f,t.classList.add("vditor-reset"),v.i18n)return[3,5];if(["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(v.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return E=(S="vditorI18nScript")+v.lang,document.querySelectorAll('head script[id^="'.concat(S,'"]')).forEach((function(e){e.id!==E&&document.head.removeChild(e)})),[4,(0,y.G)("".concat(v.cdn,"/dist/js/i18n/").concat(v.lang,".js"),E)];case 3:L.sent(),L.label=4;case 4:return[3,6];case 5:window.VditorI18n=v.i18n,L.label=6;case 6:return v.icon?[4,(0,y.G)("".concat(v.cdn,"/dist/js/icons/").concat(v.icon,".js"),"vditorIconScript")]:[3,8];case 7:L.sent(),L.label=8;case 8:return(0,w.Z)(v.theme.current,v.theme.path),1===v.anchor&&t.classList.add("vditor-reset--anchor"),(0,i.O)(t,v.hljs),(0,s.s)(v.hljs,t,v.cdn),(0,d.H)(t,{cdn:v.cdn,math:v.math}),(0,m.i)(t,v.cdn,v.mode),(0,p.K)(t,v.cdn,v.mode),(0,o.P)(t,v.cdn),(0,c.v)(t,v.cdn),(0,a.p)(t,v.cdn,v.mode),(0,h.P)(t,v.cdn,v.mode),(0,g.B)(t,v.cdn),(0,e.Q)(t,v.cdn),v.render.media.enable&&(0,u.Y)(t),v.speech.enable&&T(t),0!==v.anchor&&(k=v.anchor,document.querySelectorAll(".vditor-anchor").forEach((function(e){1===k&&e.classList.add("vditor-anchor--left"),e.onclick=function(){var t=e.getAttribute("href").substr(1),n=document.getElementById("vditorAnchor-"+t).offsetTop;document.querySelector("html").scrollTop=n}})),window.onhashchange=function(){var e=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));e&&(document.querySelector("html").scrollTop=e.offsetTop)}),v.after&&v.after(),v.lazyLoadImage&&l(t),t.addEventListener("click",(function(e){var n=(0,b.lG)(e.target,"SPAN");if(n&&(0,b.fb)(n,"vditor-toc")){var r=t.querySelector("#"+n.getAttribute("data-target-id"));r&&window.scrollTo(window.scrollX,r.offsetTop)}else;})),[2]}var k}))}))},M=n(971),H=n(34);const C=function(){function n(){}return n.adapterRender=t,n.previewImage=M.E,n.codeRender=i.O,n.graphvizRender=c.v,n.highlightRender=s.s,n.mathRender=d.H,n.mermaidRender=m.i,n.markmapRender=p.K,n.flowchartRender=o.P,n.chartRender=a.p,n.abcRender=e.Q,n.mindmapRender=h.P,n.plantumlRender=g.B,n.outlineRender=v.k,n.mediaRender=u.Y,n.speechRender=T,n.lazyLoadImageRender=l,n.md2html=j,n.preview=_,n.setCodeTheme=H.Y,n.setContentTheme=w.Z,n}()})(),r=r.default})()));
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const download: (vditor: IVditor, content: string, filename: string) => void;
3
2
  export declare const exportMarkdown: (vditor: IVditor) => void;
4
3
  export declare const exportPDF: (vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const expandMarker: (range: Range, vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const highlightToolbarIR: (vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const input: (vditor: IVditor, range: Range, ignoreSpace?: boolean, event?: InputEvent) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const processHint: (vditor: IVditor) => void;
3
2
  export declare const processAfterRender: (vditor: IVditor, options?: {
4
3
  enableAddUndoStack: boolean;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const processKeydown: (vditor: IVditor, event: KeyboardEvent) => boolean;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const codeRender: (element: HTMLElement, option?: IHljs) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const getHTML: (vditor: IVditor) => string;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const getMarkdown: (vditor: IVditor) => string;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const highlightRender: (hljsOption?: IHljs, element?: HTMLElement | Document, cdn?: string) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  declare global {
3
2
  interface Window {
4
3
  MathJax: any;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const outlineRender: (contentElement: HTMLElement, targetElement: Element, vditor?: IVditor) => string;
@@ -1,3 +1,2 @@
1
- /// <reference types="./types" />
2
1
  export declare const md2html: (mdText: string, options?: IPreviewOptions) => Promise<string>;
3
2
  export declare const previewRender: (previewElement: HTMLDivElement, markdown: string, options?: IPreviewOptions) => Promise<void>;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const setLute: (options: ILuteOptions) => Lute;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  declare global {
3
2
  interface Window {
4
3
  vditorSpeechRange: Range;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const previewImage: (oldImgElement: HTMLImageElement, lang?: keyof II18n, theme?: string) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const inputEvent: (vditor: IVditor, event?: InputEvent) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const processPaste: (vditor: IVditor, text: string) => void;
3
2
  export declare const getSideByType: (spanNode: Node, type: string, isPrevious?: boolean) => false | Element;
4
3
  export declare const processSpinVditorSVDOM: (html: string, vditor: IVditor) => string;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const processKeydown: (vditor: IVditor, event: KeyboardEvent) => boolean;
@@ -5,5 +5,6 @@ export declare class Toolbar {
5
5
  };
6
6
  element: HTMLElement;
7
7
  constructor(vditor: IVditor);
8
+ updateConfig(vditor: IVditor, options: IToolbarConfig): void;
8
9
  private genItem;
9
10
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const removeCurrentToolbar: (toolbar: {
3
2
  [key: string]: HTMLElement;
4
3
  }, names: string[]) => void;
@@ -1,9 +1,3 @@
1
- /// <reference types="./types" />
2
- declare global {
3
- interface Window {
4
- visualViewport: HTMLElement;
5
- }
6
- }
7
1
  export declare const initUI: (vditor: IVditor) => void;
8
2
  export declare const setPadding: (vditor: IVditor) => void;
9
3
  export declare const setTypewriterPosition: (vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const setPreviewMode: (mode: "both" | "editor", vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const setTheme: (vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const getElement: (vditor: IVditor) => HTMLPreElement;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  declare class Upload {
3
2
  element: HTMLElement;
4
3
  isUploading: boolean;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const setHeaders: (vditor: IVditor, xhr: XMLHttpRequest) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const focusEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
3
2
  export declare const dblclickEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
4
3
  export declare const blurEvent: (vditor: IVditor, editorElement: HTMLElement) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const fixGSKeyBackspace: (event: KeyboardEvent, vditor: IVditor, startContainer: Node) => boolean;
3
2
  export declare const fixCJKPosition: (range: Range, vditor: IVditor, event: KeyboardEvent) => void;
4
3
  export declare const fixCursorDownInlineMath: (range: Range, key: string) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const highlightToolbar: (vditor: IVditor) => void;
@@ -1,3 +1,2 @@
1
- /// <reference types="./types" />
2
1
  export declare const processPasteCode: (html: string, text: string, type?: string) => string | false;
3
2
  export declare const processCodeRender: (previewPanel: HTMLElement, vditor: IVditor) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const getEditorRange: (vditor: IVditor) => Range;
3
2
  export declare const getCursorPosition: (editor: HTMLElement) => {
4
3
  left: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const renderToc: (vditor: IVditor) => void;
3
2
  export declare const clickToc: (event: MouseEvent & {
4
3
  target: HTMLElement;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const afterRenderEvent: (vditor: IVditor, options?: {
3
2
  enableAddUndoStack: boolean;
4
3
  enableHint: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const highlightToolbarWYSIWYG: (vditor: IVditor) => void;
3
2
  export declare const genLinkRefPopover: (vditor: IVditor, linkRefElement: HTMLElement, range?: Range) => void;
4
3
  export declare const genAPopover: (vditor: IVditor, aElement: HTMLElement, range: Range) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const previoueIsEmptyA: (node: Node) => false | HTMLElement;
3
2
  export declare const nextIsCode: (range: Range) => boolean;
4
3
  export declare const getNextHTML: (node: Node) => string;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const input: (vditor: IVditor, range: Range, event?: InputEvent) => void;
@@ -1,3 +1,2 @@
1
- /// <reference types="./types" />
2
1
  export declare const processKeydown: (vditor: IVditor, event: KeyboardEvent) => boolean;
3
2
  export declare const removeBlockElement: (vditor: IVditor, event: KeyboardEvent) => boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="./types" />
2
1
  export declare const renderDomByMd: (vditor: IVditor, md: string, options?: {
3
2
  enableAddUndoStack: boolean;
4
3
  enableHint: boolean;
@@ -1,3 +1,2 @@
1
- /// <reference types="./types" />
2
1
  export declare const setHeading: (vditor: IVditor, tagName: string) => void;
3
2
  export declare const removeHeading: (vditor: IVditor) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const showCode: (previewElement: HTMLElement, vditor: IVditor, first?: boolean) => void;
@@ -1,2 +1 @@
1
- /// <reference types="./types" />
2
1
  export declare const toolbarEvent: (vditor: IVditor, actionBtn: Element, event: Event) => void;
@@ -350,6 +350,8 @@ interface IUpload {
350
350
  max?: number;
351
351
  /** 剪切板中包含图片地址时,使用此 url 重新上传 */
352
352
  linkToImgUrl?: string;
353
+ /** 剪切板中包含图片地址时,使用此方法进行自定义 */
354
+ renderLinkDest?(vditor: IVditor, node: ILuteNode, entering: boolean): [string, number];
353
355
  /** CORS 上传验证,头为 X-Upload-Token */
354
356
  token?: string;
355
357
  /** 文件上传类型,同 [input accept](https://www.w3schools.com/tags/att_input_accept.asp) */
@@ -503,6 +505,7 @@ interface IPreview {
503
505
  /** @link https://ld246.com/article/1549638745630#options-preview-actions */
504
506
  actions?: Array<IPreviewAction | IPreviewActionCustom>;
505
507
  render?: IPreviewRender
508
+
506
509
  /** 预览回调 */
507
510
  parse?(element: HTMLElement): void;
508
511
 
@@ -786,6 +789,7 @@ interface IVditor {
786
789
  toolbar?: {
787
790
  elements?: { [key: string]: HTMLElement },
788
791
  element?: HTMLElement,
792
+ updateConfig(vditor: IVditor, options: IToolbarConfig): void,
789
793
  };
790
794
  preview?: {
791
795
  element: HTMLElement,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "vditor",
3
- "version": "3.10.4",
3
+ "version": "3.10.5",
4
4
  "description": "♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生",
5
5
  "author": "Vanessa <v@b3log.org> (http://vanessa.b3log.org)",
6
6
  "homepage": "https://b3log.org/vditor",
7
7
  "jsdelivr": "dist/index.min.js",
8
- "main": "dist/index.min.js",
8
+ "main": "dist/index.js",
9
9
  "funding": "https://ld246.com/sponsor",
10
10
  "files": [
11
11
  "dist/*",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "types": "dist/index.d.ts",
21
21
  "devDependencies": {
22
- "@babel/core": "^7.14.2",
22
+ "@babel/core": "^7.25.2",
23
23
  "@babel/preset-env": "^7.14.2",
24
24
  "@types/diff-match-patch": "^1.0.32",
25
25
  "@types/jest": "^26.0.23",
@@ -45,14 +45,14 @@
45
45
  "postcss": "^8.4.12",
46
46
  "postcss-loader": "^5.2.0",
47
47
  "prettier": "^2.5.1",
48
- "puppeteer": "^1.20.0",
48
+ "puppeteer": "^23.0.2",
49
49
  "style-loader": "^1.3.0",
50
50
  "terser-webpack-plugin": "^5.3.0",
51
51
  "ts-jest": "^26.5.6",
52
52
  "ts-loader": "^6.2.2",
53
- "typescript": "^3.9.9",
53
+ "typescript": "^4.9.5",
54
54
  "webpack": "^5.66.0",
55
- "webpack-bundle-analyzer": "^3.9.0",
55
+ "webpack-bundle-analyzer": "^4.10.2",
56
56
  "webpack-cli": "^4.9.1",
57
57
  "webpack-dev-server": "^4.1.0"
58
58
  },
package/src/index.ts CHANGED
@@ -102,6 +102,10 @@ class Vditor extends VditorMethod {
102
102
  tip.show(error, 0)
103
103
  }
104
104
 
105
+ public updateToolbarConfig(options: IToolbarConfig) {
106
+ this.vditor.toolbar.updateConfig(this.vditor, options);
107
+ }
108
+
105
109
  /** 设置主题 */
106
110
  public setTheme(
107
111
  theme: "dark" | "classic",
@@ -95,8 +95,14 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
95
95
  }
96
96
  // 第一个 marker 后 tab 进行缩进
97
97
  if (event.key === "Tab") {
98
- listFirstMarkerElement.insertAdjacentHTML("beforebegin",
99
- `<span data-type="padding">${listFirstMarkerElement.textContent.replace(/\S/g, " ")}</span>`);
98
+ if (event.shiftKey) {
99
+ if (listFirstMarkerElement.previousElementSibling.getAttribute("data-type") === "padding") {
100
+ listFirstMarkerElement.previousElementSibling.remove();
101
+ }
102
+ } else {
103
+ listFirstMarkerElement.insertAdjacentHTML("beforebegin",
104
+ `<span data-type="padding">${listFirstMarkerElement.textContent.replace(/\S/g, " ")}</span>`);
105
+ }
100
106
  if (/^\d/.test(listFirstMarkerElement.textContent)) {
101
107
  listFirstMarkerElement.textContent = listFirstMarkerElement.textContent.replace(/^\d{1,}/, "1");
102
108
  range.selectNodeContents(listLastMarkerElement.firstChild);
@@ -1,5 +1,5 @@
1
1
  import {Constants} from "../constants";
2
- import {uploadFiles} from "../upload";
2
+ import {uploadFiles} from "../upload/index";
3
3
  import {getEventName} from "../util/compatibility";
4
4
  import {MenuItem} from "./MenuItem";
5
5
 
@@ -69,6 +69,23 @@ export class Toolbar {
69
69
  }
70
70
  }
71
71
 
72
+ public updateConfig(vditor: IVditor, options: IToolbarConfig) {
73
+ vditor.options.toolbarConfig = Object.assign({
74
+ hide: false,
75
+ pin: false,
76
+ }, options);
77
+ if (vditor.options.toolbarConfig.hide) {
78
+ this.element.classList.add("vditor-toolbar--hide");
79
+ } else {
80
+ this.element.classList.remove("vditor-toolbar--hide");
81
+ }
82
+ if (vditor.options.toolbarConfig.pin) {
83
+ this.element.classList.add("vditor-toolbar--pin");
84
+ } else {
85
+ this.element.classList.remove("vditor-toolbar--pin");
86
+ }
87
+ }
88
+
72
89
  private genItem(vditor: IVditor, menuItem: IMenuItem, index: number) {
73
90
  let menuItemObj;
74
91
  switch (menuItem.name) {
@@ -5,12 +5,6 @@ import {accessLocalStorage} from "../util/compatibility";
5
5
  import {setContentTheme} from "./setContentTheme";
6
6
  import {setTheme} from "./setTheme";
7
7
 
8
- declare global {
9
- interface Window {
10
- visualViewport: HTMLElement;
11
- }
12
- }
13
-
14
8
  export const initUI = (vditor: IVditor) => {
15
9
  vditor.element.innerHTML = "";
16
10
  vditor.element.classList.add("vditor");