/*!
* Vditor v2.2.0 - A markdown editor written in TypeScript.
*
* MIT License
*
* Copyright (c) 2018-present B3log 开源, b3log.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
!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()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=53)}([function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var r="2.2.0",i=function(){function e(){}return e.WYSIWYG_EMPTY_P='
\n
',e.ZWSP="",e}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r={en_US:{alignCenter:"Center",alignLeft:"Left",alignRight:"Right",alternateText:"Alternate text",bold:"Blod",both:"editor & preview",check:"Task List",code:"Code Block",column:"Column",confirm:"Confirm",copied:"Copied",copy:"Copy",devtools:"DevTools",edit:"Edit",emoji:"Emoji",fileTypeError:"file type is error",format:"Format",fullscreen:"Fullscreen",headings:"Headings",help:"Help",imageURL:"image URL",indent:"Indent",info:"Info","inline-code":"Inline Code",insertAfter:"Insert line after",insertBefore:"Insert line Before",italic:"Italic",language:"Language",line:"Line",link:"Link",list:"List",nameEmpty:"Name is empty","ordered-list":"Order List",over:"over",performanceTip:"Real-time preview requires ${x}ms, you can close it",preview:"Preview",quote:"Quote",record:"Start Record/End Record","record-tip":"The device does not support recording",recording:"recording...",redo:"Redo",remove:"Remove",row:"Row",strike:"Strike",table:"Table",textIsNotEmpty:"text(no empty)",tooltipText:"Tooltip text",undo:"Undo",unindent:"Unindent",update:"Update",upload:"Upload image or file",uploadError:"upload error",uploading:"uploading...",wysiwyg:"WYSIWYG"},zh_CN:{alignCenter:"居中",alignLeft:"居左",alignRight:"居右",alternateText:"替代文本",bold:"粗体",both:"编辑 & 预览",check:"任务列表",code:"代码块",column:"列",confirm:"确定",copied:"已复制",copy:"复制",devtools:"开发者工具",edit:"编辑",emoji:"表情",fileTypeError:"文件类型不允许上传",format:"格式化",fullscreen:"全屏",headings:"标题",help:"帮助",imageURL:"图片地址",indent:"增加缩进",info:"关于","inline-code":"行内代码",insertAfter:"末尾插入行",insertBefore:"起始插入行",italic:"斜体",language:"语言",line:"分隔线",link:"链接",list:"无序列表",nameEmpty:"文件名不能为空","ordered-list":"有序列表",over:"超过",performanceTip:"实时预览需 ${x}ms,可点击编辑 & 预览按钮进行关闭",preview:"预览",quote:"引用",record:"开始录音/结束录音","record-tip":"该设备不支持录音功能",recording:"录音中...",redo:"重做",remove:"删除",row:"行",strike:"删除线",table:"表格",textIsNotEmpty:"文本(不能为空)",tooltipText:"提示文本",undo:"撤销",unindent:"减少缩进",update:"更新",upload:"上传图片或文件",uploadError:"上传错误",uploading:"上传中...",wysiwyg:"所见即所得"}}},function(e,t,n){"use strict";n.d(t,"c",(function(){return r})),n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return o}));var r=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)},i=function(e,t,n){var i=0,o=0,a=n.childNodes[o],c=!1,s=!1;e=Math.max(0,e),t=Math.max(0,t);var l=n.ownerDocument.createRange();for(l.setStart(a||n,0),l.collapse(!0);!s&&a;){var d=i+a.textContent.length;if(!c&&e>=i&&e<=d&&(0===e?l.setStart(a,0):3===a.childNodes[0].nodeType?l.setStart(a.childNodes[0],e-i):a.nextSibling?l.setStartBefore(a.nextSibling):l.setStartAfter(a),c=!0,e===t)){s=!0;break}c&&t>=i&&t<=d&&(0===t?l.setEnd(a,0):3===a.childNodes[0].nodeType?l.setEnd(a.childNodes[0],t-i):a.nextSibling?l.setEndBefore(a.nextSibling):l.setEndAfter(a),s=!0),i=d,a=n.childNodes[++o]}return!s&&n.childNodes[o-1]&&l.setStartBefore(n.childNodes[o-1]),r(l),l},o=function(e,t){var n=0,i=0;if(Array.from(t).some((function(r,o){if((i=r.textContent.indexOf(e))>-1&&3===t[o].childNodes[0].nodeType)return n=o,!0})),!(i<0)){var o=document.createRange();o.setStart(t[n].childNodes[0],i),o.setEnd(t[n].childNodes[0],i+e.length),r(o)}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return 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.getElementsByTagName("head")[0].appendChild(r)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(e){return e.replace(/\u00a0/g," ")}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return l}));var r=n(0),i=n(3),o=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&(Object(i.a)(t+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript"),n.forEach((function(e){var t=document.createElement("div");t.style.backgroundColor="var(--code-background-color)",e.parentNode.parentNode.replaceChild(t,e.parentNode),ABCJS.renderAbc(t,e.textContent.trim()),t.style.overflowX="auto"})))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),i=n(3),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t="https://cdn.jsdelivr.net/npm/vditor@"+r.b);var n=e.querySelectorAll(".language-echarts");n.length>0&&(Object(i.a)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript"),n.forEach((function(e){try{if("true"===e.getAttribute("data-processed"))return;var t=JSON.parse(e.innerText.trim());echarts.init(e).setOption(t),e.setAttribute("data-processed","true")}catch(t){e.className="hljs",e.innerHTML="echarts render error: "+t}})))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(17),i=n.n(r),o=n(1),a=n(4),c=function(e,t){void 0===t&&(t="zh_CN"),e.querySelectorAll("pre > code").forEach((function(n,r){if(!(n.classList.contains("language-mermaid")||n.classList.contains("language-echarts")||n.classList.contains("language-abc")||n.style.maxHeight.indexOf("px")>-1||e.classList.contains("vditor-preview")&&r>5)){var c=document.createElement("div");c.className="vditor-copy",c.innerHTML='"+i.a+" ";var s=document.createElement("textarea");s.value=Object(a.a)(n.innerText),c.insertAdjacentElement("afterbegin",s),n.before(c),n.style.maxHeight=window.outerHeight-40+"px"}}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),i=n(3),o=n(13),a=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n="https://cdn.jsdelivr.net/npm/vditor@"+r.b);(["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"].includes(e.style)||(e.style="github"),Object(o.a)(n+"/dist/js/highlight.js/styles/"+e.style+".css","vditorHljsStyle"),e.enable)&&(0!==t.querySelectorAll("pre > code").length&&(Object(i.a)(n+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript"),t.querySelectorAll("pre > code").forEach((function(t){if(!(t.classList.contains("language-mermaid")||t.classList.contains("language-echarts")||t.classList.contains("language-abc"))&&(hljs.highlightBlock(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 o="",a=t.textContent.split(/\r\n|\r|\n/g);a.pop(),a.map((function(e){var t="";i&&(n.textContent=e||"\n",t=' style="height:'+n.getBoundingClientRect().height+'px"'),o+=" "})),n.style.display="none",o=''+o+" ",t.insertAdjacentHTML("beforeend",o)}}))))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),i=n(3),o=n(13),a=n(4),c=function(e,t){var n=e.querySelectorAll(".vditor-math");if(0!==n.length){var c={cdn:"https://cdn.jsdelivr.net/npm/vditor@"+r.b,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)Object(i.a)(t.cdn+"/dist/js/katex/katex.min.js","vditorKatexScript"),Object(o.a)(t.cdn+"/dist/js/katex/katex.min.css","vditorKatexStyle"),n.forEach((function(e){if(!e.getAttribute("data-math")){var t=Object(a.a)(e.textContent);e.setAttribute("data-math",t);try{e.innerHTML=katex.renderToString(t,{displayMode:"DIV"===e.tagName,output:"html"})}catch(t){e.innerHTML=t.message,e.className="vditor-math vditor-reset--error"}e.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault();var t=e.currentTarget.closest(".vditor-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={tex:{macros:t.math.macros}},Object(i.a)(t.cdn+"/dist/js/mathjax/tex-svg.js","vditorMathJaxScript")),setTimeout((function(){n.forEach((function(e){if(!e.getAttribute("data-math")){var t=Object(a.a)(e.textContent);e.setAttribute("data-math",t),window.MathJax.texReset();var n=window.MathJax.getMetricsFor(e);n.display="DIV"===e.tagName,window.MathJax.tex2svgPromise(t,n).then((function(t){e.innerHTML="",e.append(t),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var n=e.querySelector("mjx-container").textContent.trim();""!==n&&(e.innerHTML=n,e.className="vditor-math vditor-reset--error")}))}}))}),0)}}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),i=n(3),o=function(e,t,n){void 0===t&&(t=".language-mermaid"),void 0===n&&(n="https://cdn.jsdelivr.net/npm/vditor@"+r.b),0!==e.querySelectorAll(t).length&&(Object(i.a)(n+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript"),mermaid.init({noteMargin:10},t))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=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",' '),e.remove()}(e,t):t.match(/^.+.(mp3|wav)$/)?function(e,t){e.insertAdjacentHTML("afterend",' '),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+))?$/),r=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+)/),a=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),c=t.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/);n&&11===n[1].length?(e.insertAdjacentHTML("afterend",''),e.remove()):r&&r[1]?(e.insertAdjacentHTML("afterend",''),e.remove()):i&&i[1]?(e.insertAdjacentHTML("afterend",''),e.remove()):o&&o[1]?(e.insertAdjacentHTML("afterend",''),e.remove()):a&&a[0]?(e.insertAdjacentHTML("afterend",''),e.remove()):c&&c[2]&&(e.insertAdjacentHTML("afterend",''),e.remove())}(e,t))}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return 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)}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(16),i=n.n(r),o=n(15),a=n.n(o),c=n(2),s=function(e,t){if(void 0===t&&(t="zh_CN"),speechSynthesis&&SpeechSynthesisUtterance){var n=document.querySelector(".vditor-speech");if(!n){(n=document.createElement("div")).className="vditor-speech",document.body.insertAdjacentElement("beforeend",n);var r=function(){var e,n;return speechSynthesis.getVoices().forEach((function(r){r.lang===t.replace("_","-")&&(e=r),r.default&&(n=r)})),e||(e=n),e};void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=r);var o=r();n.onclick=function(){if("vditor-speech"===n.className){var e=new SpeechSynthesisUtterance(n.getAttribute("data-text"));e.voice=o,e.onend=function(){n.className="vditor-speech",speechSynthesis.cancel(),n.innerHTML=a.a},speechSynthesis.speak(e),n.className="vditor-speech vditor-speech--current",n.innerHTML=i.a}else speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),n.innerHTML=i.a):(speechSynthesis.pause(),n.innerHTML=a.a));Object(c.c)(window.vditorSpeechRange)},document.body.addEventListener("click",(function(){""===getSelection().toString().trim()&&"block"===n.style.display&&(n.className="vditor-speech",speechSynthesis.cancel(),n.style.display="none")}))}e.addEventListener("mouseup",(function(e){var t=getSelection().toString().trim();if(speechSynthesis.cancel(),""!==getSelection().toString().trim()){window.vditorSpeechRange=getSelection().getRangeAt(0).cloneRange();var r=getSelection().getRangeAt(0).getBoundingClientRect();n.innerHTML=a.a,n.style.display="block",n.style.top=r.top+r.height+document.querySelector("html").scrollTop-20+"px",n.style.left=e.screenX+2+"px",n.setAttribute("data-text",t)}else"block"===n.style.display&&(n.className="vditor-speech",n.style.display="none")}))}}},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t,n){"use strict";var r=n(0),i=n(6),o=n(7),a=n(8),c=n(9),s=n(10),l=n(5),d=n(12),u=n(11),p=n(14);n.d(t,"a",(function(){return f}));var m=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function c(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]