/*!
* Vditor v3.3.6 - 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=75)}([function(e,t,n){"use strict";n.d(t,"h",(function(){return i})),n.d(t,"g",(function(){return o})),n.d(t,"i",(function(){return a})),n.d(t,"b",(function(){return l})),n.d(t,"d",(function(){return s})),n.d(t,"c",(function(){return c})),n.d(t,"f",(function(){return d})),n.d(t,"e",(function(){return u})),n.d(t,"a",(function(){return p}));var r=n(6),i=function(e,t){for(var n=u(e,t),r=!1,i=!1;n&&!n.classList.contains("vditor-reset")&&!i;)(r=u(n.parentElement,t))?n=r:i=!0;return n||!1},o=function(e,t,n){for(var r=s(e,t,n),i=!1,o=!1;r&&!r.classList.contains("vditor-reset")&&!o;)(i=s(r.parentElement,t,n))?r=i:o=!0;return r||!1},a=function(e,t){for(var n=Object(r.b)(e,t),i=!1,o=!1;n&&!n.classList.contains("vditor-reset")&&!o;)(i=Object(r.b)(n.parentElement,t))?n=i:o=!0;return n||!1},l=function(e){var t=a(e,"UL"),n=a(e,"OL"),r=t;return n&&(!t||t&&n.contains(t))&&(r=n),r},s=function(e,t,n){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var r=e,i=!1;r&&!i&&!r.classList.contains("vditor-reset");)r.getAttribute(t)===n?i=!0:r=r.parentElement;return i&&r},c=function(e){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);var t=e,n=!1,r=s(e,"data-block","0");if(r)return r;for(;t&&!n&&!t.classList.contains("vditor-reset");)"H1"===t.tagName||"H2"===t.tagName||"H3"===t.tagName||"H4"===t.tagName||"H5"===t.tagName||"H6"===t.tagName||"P"===t.tagName||"BLOCKQUOTE"===t.tagName||"OL"===t.tagName||"UL"===t.tagName?n=!0:t=t.parentElement;return n&&t},d=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},u=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},p=function(e){for(;e&&e.lastChild;)e=e.lastChild;return e}},function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return l})),n.d(t,"e",(function(){return s})),n.d(t,"h",(function(){return c})),n.d(t,"c",(function(){return d})),n.d(t,"g",(function(){return u})),n.d(t,"f",(function(){return p})),n.d(t,"d",(function(){return h}));var r=n(3),i=n(2),o=n(0),a=function(e){var t;return getSelection().rangeCount>0&&(t=getSelection().getRangeAt(0),e.isEqualNode(t.startContainer)||e.contains(t.startContainer))||(e.focus(),(t=e.ownerDocument.createRange()).setStart(e,0),t.collapse(!0)),t},l=function(e){var t=window.getSelection().getRangeAt(0);if(!e.contains(t.startContainer)&&!Object(o.e)(t.startContainer,"vditor-panel--none"))return{left:0,top:0};var n,r=e.parentElement.getBoundingClientRect();if(0===t.getClientRects().length)if(3===t.startContainer.nodeType){var i=t.startContainer.parentElement;if(!(i&&i.getClientRects().length>0))return{left:0,top:0};n=i.getClientRects()[0]}else{var a=t.startContainer.children;if(a[t.startOffset]&&a[t.startOffset].getClientRects().length>0)n=a[t.startOffset].getClientRects()[0];else if(t.startContainer.childNodes.length>0){var l=t.cloneRange();t.selectNode(t.startContainer.childNodes[Math.max(0,t.startOffset-1)]),n=t.getClientRects()[0],t.setEnd(l.endContainer,l.endOffset),t.setStart(l.startContainer,l.startOffset)}else n=t.startContainer.getClientRects()[0];if(!n){for(var s=t.startContainer.childNodes[t.startOffset];!s.getClientRects||s.getClientRects&&0===s.getClientRects().length;)s=s.parentElement;n=s.getClientRects()[0]}}else n=t.getClientRects()[0];return{left:n.left-r.left,top:n.top-r.top}},s=function(e,t){if(!t){if(0===getSelection().rangeCount)return!1;t=getSelection().getRangeAt(0)}var n=t.commonAncestorContainer;return e.isEqualNode(n)||e.contains(n)},c=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)},d=function(e,t,n){var r={end:0,start:0};if(!n){if(0===getSelection().rangeCount)return r;n=window.getSelection().getRangeAt(0)}if(s(t,n)){var i=n.cloneRange();e.childNodes[0]&&e.childNodes[0].childNodes[0]?i.setStart(e.childNodes[0].childNodes[0],0):i.selectNodeContents(e),i.setEnd(n.startContainer,n.startOffset),r.start=i.toString().length,r.end=r.start+n.toString().length}return r},u=function(e,t,n){var r=0,i=0,o=n.childNodes[i],a=!1,l=!1;e=Math.max(0,e),t=Math.max(0,t);var s=n.ownerDocument.createRange();for(s.setStart(o||n,0),s.collapse(!0);!l&&o;){var d=r+o.textContent.length;if(!a&&e>=r&&e<=d&&(0===e?s.setStart(o,0):3===o.childNodes[0].nodeType?s.setStart(o.childNodes[0],e-r):o.nextSibling?s.setStartBefore(o.nextSibling):s.setStartAfter(o),a=!0,e===t)){l=!0;break}a&&t>=r&&t<=d&&(0===t?s.setEnd(o,0):3===o.childNodes[0].nodeType?s.setEnd(o.childNodes[0],t-r):o.nextSibling?s.setEndBefore(o.nextSibling):s.setEndAfter(o),l=!0),r=d,o=n.childNodes[++i]}return!l&&n.childNodes[i-1]&&s.setStartBefore(n.childNodes[i-1]),c(s),s},p=function(e,t){var n=e.querySelector("wbr");if(n){if(n.previousElementSibling)if(n.previousElementSibling.isSameNode(n.previousSibling)){if(n.previousElementSibling.lastChild)return t.setStartBefore(n),t.collapse(!0),c(t),!Object(i.c)()||"EM"!==n.previousElementSibling.tagName&&"STRONG"!==n.previousElementSibling.tagName&&"S"!==n.previousElementSibling.tagName||(t.insertNode(document.createTextNode(r.a.ZWSP)),t.collapse(!1)),void n.remove();t.setStartAfter(n.previousElementSibling)}else t.setStart(n.previousSibling,n.previousSibling.textContent.length);else n.previousSibling?t.setStart(n.previousSibling,n.previousSibling.textContent.length):n.nextSibling?3===n.nextSibling.nodeType?t.setStart(n.nextSibling,0):t.setStartBefore(n.nextSibling):t.setStart(n.parentElement,0);t.collapse(!0),n.remove(),c(t)}},h=function(e,t){var n=document.createElement("div");n.innerHTML=e;var r="sv"===t.currentMode?n.querySelectorAll('[data-type="p"]'):n.querySelectorAll("p");1===r.length&&!r[0].previousSibling&&!r[0].nextSibling&&t[t.currentMode].element.children.length>0&&("sv"===t.currentMode&&r[0].querySelectorAll('[data-type="newline"]').forEach((function(e){e.remove()})),e=r[0].innerHTML.trim());var i=document.createElement("template");i.innerHTML=e;var l=a(t[t.currentMode].element);""!==l.toString()&&(t[t.currentMode].preventInput=!0,document.execCommand("delete",!1,""));var s=Object(o.c)(l.startContainer);i.content.firstElementChild&&"0"===i.content.firstElementChild.getAttribute("data-block")&&s?s.insertAdjacentHTML("afterend",e):(l.insertNode(i.content.cloneNode(!0)),l.collapse(!1))}},function(e,t,n){"use strict";n.d(t,"f",(function(){return r})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"g",(function(){return s})),n.d(t,"c",(function(){return c}));var r=function(){return navigator.userAgent.indexOf("Safari")>-1&&-1===navigator.userAgent.indexOf("Chrome")},i=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},o=function(){try{return"undefined"!=typeof localStorage}catch(e){return!1}},a=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},l=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!(!e.metaKey||e.ctrlKey):!(e.metaKey||!e.ctrlKey)},s=function(e){return/Mac/.test(navigator.platform)||"iPhone"===navigator.platform?(e=e.replace("ctrl","⌘").replace("shift","⇧").replace("alt","⌥")).indexOf("⇧")>-1&&(e=i()?e.replace(";",":").replace("=","+"):e.replace(":",";").replace("+","=").replace("_","-")):(e=e.replace("⌘","ctrl").replace("⇧","shift").replace("⌥","alt")).indexOf("shift")>-1&&(e=e.replace(";",":").replace("=","+")),e},c=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var r="3.3.6",i=function(){function e(){}return e.ZWSP="",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"],e.CODE_LANGUAGES=["mermaid","echarts","mindmap","abc","graphviz","apache","bash","cs","cpp","css","coffeescript","diff","xml","http","ini","json","java","javascript","js","makefile","markdown","nginx","objectivec","php","perl","properties","python","ruby","sql","shell","dart","erb","go","gradle","julia","kotlin","less","lua","matlab","rust","scss","typescript","ts","yaml"],e.CDN="https://cdn.jsdelivr.net/npm/vditor@3.3.6",e.MARKDOWN_OPTIONS={autoSpace:!1,chinesePunct:!1,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",listStyle:!1,paragraphBeginningSpace:!1,sanitize:!0,setext:!0,toc:!1},e.HLJS_OPTIONS={enable:!0,lineNumber:!1,style:"github"},e.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},e.THEME_OPTIONS={current:"light",list:{dark:"Dark",light:"Light",wechat:"WeChat"},path:e.CDN+"/dist/css/content-theme"},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","code-theme":"Code Block Theme Preview",column:"Column",confirm:"Confirm","content-theme":"Content Theme Preview",copied:"Copied",copy:"Copy","delete-column":"Delete Row","delete-row":"Delete Column",devtools:"DevTools",down:"Down",downloadTip:"The browser does not support the download function",edit:"Edit","edit-mode":"Toggle Edit Mode",emoji:"Emoji",export:"Export",fileTypeError:"file type is error",footnoteRef:"Footnote Ref",fullscreen:"Toggle Fullscreen",generate:"Generating",headings:"Headings",help:"Help",imageURL:"image URL",indent:"Indent",info:"Info","inline-code":"Inline Code","insert-after":"Insert line after","insert-before":"Insert line Before","insert-column":"Insert Column","insert-row":"Insert Row",instantRendering:"Instant Rendering",italic:"Italic",language:"Language",line:"Line",link:"Link",linkRef:"Link Ref",list:"List",more:"More",nameEmpty:"Name is empty","ordered-list":"Order List",outdent:"Outdent",outline:"Outline",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",splitView:"Split View",strike:"Strike",table:"Table",textIsNotEmpty:"text(no empty)",tooltipText:"Tooltip text",undo:"Undo",up:"Up",update:"Update",upload:"Upload image or file",uploadError:"upload error",uploading:"uploading...",wysiwyg:"WYSIWYG"},ko_KR:{alignCenter:"가운데",alignLeft:"왼쪽",alignRight:"오른쪽",alternateText:"이미지 태그",bold:"굵게",both:"에디터 & 미리보기",check:"체크박스",code:"코드블럭삽입","code-theme":"코드블럭테마",column:"행",confirm:"확인","content-theme":"컨텐츠테마",copied:"복사완료",copy:"복사","delete-column":"열 삭제","delete-row":"행 삭제",devtools:"개발툴",down:"다운",downloadTip:"브라우저가 다운로드 기능을 지원하지 않습니다",edit:"수정","edit-mode":"편집모드",emoji:"이모지",export:"내보내기",fileTypeError:"지원하지않습니다.",footnoteRef:"각주참조",fullscreen:"전체화면",generate:"생성",headings:"제목크기",help:"도움말",imageURL:"이미지 URL",indent:"들여쓰기",info:"정보","inline-code":"인라인코드","insert-after":"블락 뒤로 입력","insert-before":"블락 앞으로 입력","insert-column":"열 삽입","insert-row":"행 삽입",instantRendering:"타이포라",italic:"기울임꼴",language:"언어",line:"문단나눔",link:"링크",linkRef:"링크 참조",list:"순서없는 목록",more:"더보기",nameEmpty:"이름이 비어있습니다.","ordered-list":"순서있는 목록",outdent:"내어쓰기",outline:"개요",over:"오버",performanceTip:"실시간 미리보기에는 ${x}ms가 필요하며 에디터/미리보기 버튼을 클릭하여 닫을 수 있습니다.",preview:"미리보기",quote:"인용단락",record:"녹음시작/녹음종료","record-tip":"녹음을 지원하지 않습니다.",recording:"녹음중...",redo:"되돌리기",remove:"삭제",row:"열",splitView:"마크다운",strike:"취소선",table:"표삽입",textIsNotEmpty:"텍스트(no empty)",tooltipText:"툴팁",undo:"취소하기",up:"위로",update:"업데이트",upload:"이미지 업로드하기",uploadError:"업로드 실패",uploading:"업로드중...",wysiwyg:"위지위그"},zh_CN:{alignCenter:"居中",alignLeft:"居左",alignRight:"居右",alternateText:"替代文本",bold:"粗体",both:"编辑 & 预览",check:"任务列表",code:"代码块","code-theme":"代码块主题预览",column:"列",confirm:"确定","content-theme":"内容主题预览",copied:"已复制",copy:"复制","delete-column":"删除列","delete-row":"删除行",devtools:"开发者工具",down:"下",downloadTip:"该浏览器不支持下载功能",edit:"编辑","edit-mode":"切换编辑模式",emoji:"表情",export:"导出",fileTypeError:"文件类型不允许上传",footnoteRef:"脚注标识",fullscreen:"全屏切换",generate:"生成中",headings:"标题",help:"帮助",imageURL:"图片地址",indent:"列表缩进",info:"关于","inline-code":"行内代码","insert-after":"末尾插入行","insert-before":"起始插入行","insert-column":"插入列","insert-row":"插入行",instantRendering:"即时渲染",italic:"斜体",language:"语言",line:"分隔线",link:"链接",linkRef:"引用标识",list:"无序列表",more:"更多",nameEmpty:"文件名不能为空","ordered-list":"有序列表",outdent:"列表反向缩进",outline:"大纲",over:"超过",performanceTip:"实时预览需 ${x}ms,可点击编辑 & 预览按钮进行关闭",preview:"预览",quote:"引用",record:"开始录音/结束录音","record-tip":"该设备不支持录音功能",recording:"录音中...",redo:"重做",remove:"删除",row:"行",splitView:"分屏预览",strike:"删除线",table:"表格",textIsNotEmpty:"文本(不能为空)",tooltipText:"提示文本",undo:"撤销",up:"上",update:"更新",upload:"上传图片或文件",uploadError:"上传错误",uploading:"上传中...",wysiwyg:"所见即所得"}}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));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.onload=function(){if(document.getElementById(t))return i.remove(),n(),!1;i.id=t,n()}}))}},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));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");)0===n.nodeName.indexOf(t)?r=!0:n=n.parentElement;return r&&n},i=function(e){var t=r(e,"H");return!(!t||2!==t.tagName.length||"HR"===t.tagName)&&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 i}));var r=n(7),i=function(e,t){var n=document.getElementById("vditorContentTheme"),i=t+"/"+e+".css";n?n.href!==i&&(n.remove(),Object(r.a)(i,"vditorContentTheme")):Object(r.a)(i,"vditorContentTheme")}},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 o}));var r=n(3),i=n(5),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.a.CDN);var n=e.querySelectorAll(".language-abc");n.length>0&&Object(i.a)(t+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript").then((function(){n.forEach((function(e){var t=document.createElement("div");t.className="language-abc",e.parentNode.replaceChild(t,e),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(3),i=n(5),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.a.CDN);var n=e.querySelectorAll(".language-echarts");n.length>0&&Object(i.a)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){n.forEach((function(e){var t=e.innerText.trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var n=JSON.parse(t);echarts.init(e).setOption(n),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="echarts render error:
"+t}}))}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(25),i=n.n(r),o=n(4),a=n(9),l=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-mindmap")||n.classList.contains("language-abc")||n.classList.contains("language-graphviz")||n.style.maxHeight.indexOf("px")>-1||e.classList.contains("vditor-preview")&&r>5)){var l=n.innerText;if(n.classList.contains("highlight-chroma")){var s=document.createElement("code");s.innerHTML=n.innerHTML,s.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),l=s.innerText}var c=document.createElement("div");c.className="vditor-copy",c.innerHTML='"+i.a+"";var d=document.createElement("textarea");d.value=Object(a.a)(l),c.insertAdjacentElement("afterbegin",d),n.before(c),n.style.maxHeight=window.outerHeight-40+"px"}}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),i=n(5),o=function(e,t){void 0===t&&(t=r.a.CDN);var n=e.querySelectorAll(".language-graphviz");0!==n.length&&Object(i.a)(t+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then((function(){n.forEach((function(e){if("true"!==e.getAttribute("data-processed")){try{var t=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),n=(window.URL||window.webkitURL).createObjectURL(t),r=new Worker(n);new Viz({worker:r}).renderSVGElement(e.textContent).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error:
"+t,e.className="vditor-math vditor-reset--error"}))}catch(e){console.error("graphviz error",e)}e.setAttribute("data-processed","true")}}))}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),i=n(5),o=n(7),a=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n=r.a.CDN);var a=e.style;r.a.CODE_THEME.includes(a)||(a="github");var l=document.getElementById("vditorHljsStyle"),s=n+"/dist/js/highlight.js/styles/"+a+".css";(l&&l.href!==s&&l.remove(),Object(o.a)(n+"/dist/js/highlight.js/styles/"+a+".css","vditorHljsStyle"),!1!==e.enable)&&(0!==t.querySelectorAll("pre > code").length&&Object(i.a)(n+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript").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-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz"))&&(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 l}));var r=n(3),i=n(5),o=n(7),a=n(9),l=function(e,t){var n=e.querySelectorAll(".vditor-math");if(0!==n.length){var l={cdn:r.a.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};t&&t.math&&(t.math=Object.assign({},l.math,t.math)),"KaTeX"===(t=Object.assign({},l,t)).math.engine?(Object(o.a)(t.cdn+"/dist/js/katex/katex.min.css","vditorKatexStyle"),Object(i.a)(t.cdn+"/dist/js/katex/katex.min.js","vditorKatexScript").then((function(){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"))}))}}))}))):"MathJax"===t.math.engine&&(window.MathJax||(window.MathJax={loader:{paths:{mathjax:t.cdn+"/dist/js/mathjax"}},tex:{macros:t.math.macros}}),Object(i.b)(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")}))}}))})))}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),i=n(5),o=function(e,t,n){void 0===t&&(t=".language-mermaid"),void 0===n&&(n=r.a.CDN),0!==e.querySelectorAll(t).length&&Object(i.a)(n+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then((function(){mermaid.init({noteMargin:10},t)}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),i=n(5),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.a.CDN);var n=e.querySelectorAll(".language-mindmap");n.length>0&&Object(i.a)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){n.forEach((function(e){var t=e.getAttribute("data-code");if(t)try{if("true"===e.getAttribute("data-processed"))return;var n={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"}};echarts.init(e).setOption(n),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="mindmap render error:
"+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|flac)$/)?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]+)/),l=t.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),s=t.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),c=t.match(/(?:www\.|\/\/)ted\.com\/talks\/(\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()):l&&l[2]?(e.insertAdjacentHTML("afterend",''),e.remove()):s&&s[1]?(e.insertAdjacentHTML("afterend",''),e.remove()):c&&c[1]&&(e.insertAdjacentHTML("afterend",''),e.remove())}(e,t))}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),i=n(7),o=function(e,t){void 0===t&&(t=r.a.CDN),r.a.CODE_THEME.includes(e)||(e="github");var n=document.getElementById("vditorHljsStyle"),o=t+"/dist/js/highlight.js/styles/"+e+".css";n?n.href!==o&&(n.remove(),Object(i.a)(o,"vditorHljsStyle")):Object(i.a)(o,"vditorHljsStyle")}},function(e,t){e.exports=' '},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(6),i=function(e,t,n){var i="";Array.from(e.children).forEach((function(e,t){if(Object(r.a)(e)){var o=parseInt(e.tagName.substring(1),10),a=new Array(2*(o-1)).fill(" ").join(""),l="";l=n&&"ir"===n.currentMode?e.textContent.substring(o+1).trim():e.textContent.trim();var s=e.id.lastIndexOf("_"),c=e.id.substring(0,-1===s?void 0:s);e.id=c+"_"+t,i+='
'+a+l+"
"}})),t.innerHTML=i,t.querySelectorAll(".vditor-outline__item").forEach((function(r){r.addEventListener("click",(function(i){var o=document.getElementById(r.getAttribute("data-id"));if(o){if(n)if("auto"===n.options.height){var a=o.offsetTop+n.element.offsetTop;n.options.toolbarConfig.pin||(a+=n.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,a)}else n.element.offsetTop '},function(e,t){e.exports=''},function(e,t,n){"use strict";n.r(t);var r=n(10),i=n(11),o=n(12),a=n(13),l=n(14),s=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.naturalHeightwindow.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)})))},c=n(15),d=n(18),u=n(16),p=n(17),h=n(21),f=n(3),m=n(8),v=n(5),g=n(22),b=n(23),y=n(24),w=n.n(y),E=n(20),M=n.n(E),O=n(1),S=function(e,t){if(void 0===t&&(t="zh_CN"),"undefined"!=typeof speechSynthesis&&"undefined"!=typeof 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 i=r();n.onclick=function(){if("vditor-speech"===n.className){var e=new SpeechSynthesisUtterance(n.getAttribute("data-text"));e.voice=i,e.onend=function(){n.className="vditor-speech",speechSynthesis.cancel(),n.innerHTML=M.a},speechSynthesis.speak(e),n.className="vditor-speech vditor-speech--current",n.innerHTML=w.a}else speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),n.innerHTML=w.a):(speechSynthesis.pause(),n.innerHTML=M.a));Object(O.h)(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=M.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")}))}},k=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 l(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,l)}s((r=r.apply(e,t||[])).next())}))},x=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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){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=a.trys,(i=i.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] '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32};n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){void 0===i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var o=i;if(null==e||null==t)throw new Error("Null input. (diff_main)");if(e==t)return e?[new n.Diff(0,e)]:[];void 0===r&&(r=!0);var a=r,l=this.diff_commonPrefix(e,t),s=e.substring(0,l);e=e.substring(l),t=t.substring(l),l=this.diff_commonSuffix(e,t);var c=e.substring(e.length-l);e=e.substring(0,e.length-l),t=t.substring(0,t.length-l);var d=this.diff_compute_(e,t,a,o);return s&&d.unshift(new n.Diff(0,s)),c&&d.push(new n.Diff(0,c)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,r,i){var o;if(!e)return[new n.Diff(1,t)];if(!t)return[new n.Diff(-1,e)];var a=e.length>t.length?e:t,l=e.length>t.length?t:e,s=a.indexOf(l);if(-1!=s)return o=[new n.Diff(1,a.substring(0,s)),new n.Diff(0,l),new n.Diff(1,a.substring(s+l.length))],e.length>t.length&&(o[0][0]=o[2][0]=-1),o;if(1==l.length)return[new n.Diff(-1,e),new n.Diff(1,t)];var c=this.diff_halfMatch_(e,t);if(c){var d=c[0],u=c[1],p=c[2],h=c[3],f=c[4],m=this.diff_main(d,p,r,i),v=this.diff_main(u,h,r,i);return m.concat([new n.Diff(0,f)],v)}return r&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,i):this.diff_bisect_(e,t,i)},n.prototype.diff_lineMode_=function(e,t,r){var i=this.diff_linesToChars_(e,t);e=i.chars1,t=i.chars2;var o=i.lineArray,a=this.diff_main(e,t,!1,r);this.diff_charsToLines_(a,o),this.diff_cleanupSemantic(a),a.push(new n.Diff(0,""));for(var l=0,s=0,c=0,d="",u="";l=1&&c>=1){a.splice(l-s-c,s+c),l=l-s-c;for(var p=this.diff_main(d,u,!1,r),h=p.length-1;h>=0;h--)a.splice(l,0,p[h]);l+=p.length}c=0,s=0,d="",u=""}l++}return a.pop(),a},n.prototype.diff_bisect_=function(e,t,r){for(var i=e.length,o=t.length,a=Math.ceil((i+o)/2),l=a,s=2*a,c=new Array(s),d=new Array(s),u=0;ur);b++){for(var y=-b+f;y<=b-m;y+=2){for(var w=l+y,E=(x=y==-b||y!=b&&c[w-1]i)m+=2;else if(E>o)f+=2;else if(h){if((S=l+p-y)>=0&&S=(O=i-d[S]))return this.diff_bisectSplit_(e,t,x,E,r)}}for(var M=-b+v;M<=b-g;M+=2){for(var O,S=l+M,k=(O=M==-b||M!=b&&d[S-1]i)g+=2;else if(k>o)v+=2;else if(!h){if((w=l+p-M)>=0&&w=(O=i-O))return this.diff_bisectSplit_(e,t,x,E,r)}}}}return[new n.Diff(-1,e),new n.Diff(1,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var o=e.substring(0,n),a=t.substring(0,r),l=e.substring(n),s=t.substring(r),c=this.diff_main(o,a,!1,i),d=this.diff_main(l,s,!1,i);return c.concat(d)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function i(e){for(var t="",i=0,a=-1,l=n.length;ar?e=e.substring(n-r):nt.length?e:t,r=e.length>t.length?t:e;if(n.length<4||2*r.length=e.length?[r,o,a,l,d]:null}var a,l,s,c,d,u=o(n,r,Math.ceil(n.length/4)),p=o(n,r,Math.ceil(n.length/2));return u||p?(a=p?u&&u[4].length>p[4].length?u:p:u,e.length>t.length?(l=a[0],s=a[1],c=a[2],d=a[3]):(c=a[0],d=a[1],l=a[2],s=a[3]),[l,s,c,d,a[4]]):null},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,r=[],i=0,o=null,a=0,l=0,s=0,c=0,d=0;a0?r[i-1]:-1,l=0,s=0,c=0,d=0,o=null,t=!0)),a++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),a=1;a=f?(h>=u.length/2||h>=p.length/2)&&(e.splice(a,0,new n.Diff(0,p.substring(0,h))),e[a-1][1]=u.substring(0,u.length-h),e[a+1][1]=p.substring(h),a++):(f>=u.length/2||f>=p.length/2)&&(e.splice(a,0,new n.Diff(0,u.substring(0,f))),e[a-1][0]=1,e[a-1][1]=p.substring(0,p.length-f),e[a+1][0]=-1,e[a+1][1]=u.substring(f),a++),a++}a++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),o=r.match(n.nonAlphaNumericRegex_),a=i.match(n.nonAlphaNumericRegex_),l=o&&r.match(n.whitespaceRegex_),s=a&&i.match(n.whitespaceRegex_),c=l&&r.match(n.linebreakRegex_),d=s&&i.match(n.linebreakRegex_),u=c&&e.match(n.blanklineEndRegex_),p=d&&t.match(n.blanklineStartRegex_);return u||p?5:c||d?4:o&&!l&&s?3:l||s?2:o||a?1:0}for(var r=1;r=p&&(p=h,c=i,d=o,u=a)}e[r-1][1]!=c&&(c?e[r-1][1]=c:(e.splice(r-1,1),r--),e[r][1]=d,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,r=[],i=0,o=null,a=0,l=!1,s=!1,c=!1,d=!1;a0?r[i-1]:-1,c=d=!1),t=!0)),a++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(0,""));for(var t,r=0,i=0,o=0,a="",l="";r1?(0!==i&&0!==o&&(0!==(t=this.diff_commonPrefix(l,a))&&(r-i-o>0&&0==e[r-i-o-1][0]?e[r-i-o-1][1]+=l.substring(0,t):(e.splice(0,0,new n.Diff(0,l.substring(0,t))),r++),l=l.substring(t),a=a.substring(t)),0!==(t=this.diff_commonSuffix(l,a))&&(e[r][1]=l.substring(l.length-t)+e[r][1],l=l.substring(0,l.length-t),a=a.substring(0,a.length-t))),r-=i+o,e.splice(r,i+o),a.length&&(e.splice(r,0,new n.Diff(-1,a)),r++),l.length&&(e.splice(r,0,new n.Diff(1,l)),r++),r++):0!==r&&0==e[r-1][0]?(e[r-1][1]+=e[r][1],e.splice(r,1)):r++,o=0,i=0,a="",l=""}""===e[e.length-1][1]&&e.pop();var s=!1;for(r=1;rt));n++)o=r,a=i;return e.length!=n&&-1===e[n][0]?a:a+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,r=//g,o=/\n/g,a=0;a");switch(l){case 1:t[a]=''+s+"";break;case-1:t[a]=''+s+"";break;case 0:t[a]=""+s+""}}return t.join("")},n.prototype.diff_text1=function(e){for(var t=[],n=0;nthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),i=this;function o(e,r){var o=e/t.length,a=Math.abs(n-r);return i.Match_Distance?o+a/i.Match_Distance:a?1:o}var a=this.Match_Threshold,l=e.indexOf(t,n);-1!=l&&(a=Math.min(o(0,l),a),-1!=(l=e.lastIndexOf(t,n+t.length))&&(a=Math.min(o(0,l),a)));var s,c,d=1<=f;g--){var b=r[e.charAt(g-1)];if(v[g]=0===h?(v[g+1]<<1|1)&b:(v[g+1]<<1|1)&b|(u[g+1]|u[g])<<1|1|u[g+1],v[g]&d){var y=o(h,g-1);if(y<=a){if(a=y,!((l=g-1)>n))break;f=Math.max(1,2*n-l)}}}if(o(h+1,n)>a)break;u=v}return l},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n2&&(this.diff_cleanupSemantic(o),this.diff_cleanupEfficiency(o));else if(e&&"object"==typeof e&&void 0===t&&void 0===r)o=e,i=this.diff_text1(o);else if("string"==typeof e&&t&&"object"==typeof t&&void 0===r)i=e,o=t;else{if("string"!=typeof e||"string"!=typeof t||!r||"object"!=typeof r)throw new Error("Unknown call format to patch_make.");i=e,o=r}if(0===o.length)return[];for(var a=[],l=new n.patch_obj,s=0,c=0,d=0,u=i,p=i,h=0;h=2*this.Patch_Margin&&s&&(this.patch_addContext_(l,u),a.push(l),l=new n.patch_obj,s=0,u=p,c=d)}1!==f&&(c+=m.length),-1!==f&&(d+=m.length)}return s&&(this.patch_addContext_(l,u),a.push(l)),a},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;rthis.Match_MaxBits?-1!=(a=this.match_main(t,c.substring(0,this.Match_MaxBits),s))&&(-1==(d=this.match_main(t,c.substring(c.length-this.Match_MaxBits),s+c.length-this.Match_MaxBits))||a>=d)&&(a=-1):a=this.match_main(t,c,s),-1==a)i[o]=!1,r-=e[o].length2-e[o].length1;else if(i[o]=!0,r=a-s,c==(l=-1==d?t.substring(a,a+c.length):t.substring(a,d+this.Match_MaxBits)))t=t.substring(0,a)+this.diff_text2(e[o].diffs)+t.substring(a+c.length);else{var u=this.diff_main(c,l,!1);if(c.length>this.Match_MaxBits&&this.diff_levenshtein(u)/c.length>this.Patch_DeleteThreshold)i[o]=!1;else{this.diff_cleanupSemanticLossless(u);for(var p,h=0,f=0;fa[0][1].length){var l=t-a[0][1].length;a[0][1]=r.substring(a[0][1].length)+a[0][1],o.start1-=l,o.start2-=l,o.length1+=l,o.length2+=l}if(0==(a=(o=e[e.length-1]).diffs).length||0!=a[a.length-1][0])a.push(new n.Diff(0,r)),o.length1+=t,o.length2+=t;else if(t>a[a.length-1][1].length){l=t-a[a.length-1][1].length;a[a.length-1][1]+=r.substring(0,l),o.length1+=l,o.length2+=l}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,r=0;r2*t?(s.length1+=u.length,o+=u.length,c=!1,s.diffs.push(new n.Diff(d,u)),i.diffs.shift()):(u=u.substring(0,t-s.length1-this.Patch_Margin),s.length1+=u.length,o+=u.length,0===d?(s.length2+=u.length,a+=u.length):c=!1,s.diffs.push(new n.Diff(d,u)),u==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(u.length))}l=(l=this.diff_text2(s.diffs)).substring(l.length-this.Patch_Margin);var p=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);""!==p&&(s.length1+=p.length,s.length2+=p.length,0!==s.diffs.length&&0===s.diffs[s.diffs.length-1][0]?s.diffs[s.diffs.length-1][1]+=p:s.diffs.push(new n.Diff(0,p))),c||e.splice(++r,0,s)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=''},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t){e.exports=' '},function(e,t,n){"use strict";n.r(t);var r,i,o=n(26),a=n(3),l=n(9),s=function(e){return"sv"===e.currentMode?Object(l.a)((e.sv.element.textContent+"\n").replace(/\n\n$/,"\n")):"wysiwyg"===e.currentMode?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):"ir"===e.currentMode?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},c=n(5),d=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-devtools",this.element.innerHTML=''}return e.prototype.renderEchart=function(e){var t=this;"block"===e.devtools.element.style.display&&Object(c.a)(e.options.cdn+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){t.ASTChart||(t.ASTChart=echarts.init(e.devtools.element.lastElementChild));try{t.element.lastElementChild.style.display="block",t.element.firstElementChild.innerHTML="",t.ASTChart.setOption({series:[{data:JSON.parse(e.lute.RenderEChartsJSON(s(e))),initialTreeDepth:-1,label:{align:"left",fontSize:12,offset:[9,12],position:"top",verticalAlign:"middle"},lineStyle:{color:"#4285f4",type:"curve"},orient:"vertical",roam:!0,type:"tree"}],toolbox:{bottom:25,emphasis:{iconStyle:{color:"#4285f4"}},feature:{restore:{show:!0},saveAsImage:{show:!0}},right:15,show:!0}}),t.ASTChart.resize()}catch(e){t.element.lastElementChild.style.display="none",t.element.firstElementChild.innerHTML=e}}))},e}(),u=n(2),p=n(0),h=n(6),f=function(e,t,n,r){r&&console.log(e+" - "+n+": "+t)},m=n(10),v=n(11),g=n(12),b=n(13),y=n(14),w=n(15),E=n(16),M=n(17),O=function(e,t){if(e){var n=e.querySelector("code");if(n){var r=n.className.replace("language-","");if("abc"===r)Object(m.a)(e,t.options.cdn);else if("mermaid"===r)Object(E.a)(e,".vditor-"+t.currentMode+"__preview .language-mermaid",t.options.cdn);else if("echarts"===r)Object(v.a)(e,t.options.cdn);else if("mindmap"===r)Object(M.a)(e,t.options.cdn);else if("graphviz"===r)Object(b.a)(e,t.options.cdn);else if("math"===r){var i="div";"SPAN"===e.tagName&&(i="span"),e.innerHTML='<'+i+' class="vditor-math">'+e.innerHTML+""+i+">
",Object(w.a)(e.parentElement,{cdn:t.options.cdn,math:t.options.preview.math})}else Object(y.a)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),Object(g.a)(e,t.options.lang);e.setAttribute("data-render","1")}else"html-block"===e.parentElement.getAttribute("data-type")&&(e.style.backgroundColor="var(--preview-background-color)",e.style.padding="0.2em 0.4em",e.setAttribute("data-render","1"))}},S=n(1),k=function(e,t,n){void 0===n&&(n=!1);var r=Object(p.c)(t.startContainer);if(r&&!n){if(ct(r.innerHTML)||dt(r.innerHTML,e.options.preview.markdown.setext))return;for(var i=Object(S.c)(r,e.ir.element,t).start,o=!0,a=i-1;a>r.textContent.substr(0,i).lastIndexOf("\n");a--)if(" "!==r.textContent.charAt(a)&&"\t"!==r.textContent.charAt(a)){o=!1;break}0===i&&(o=!1);var l=!0;for(a=i-1;a
","
")}else r.previousElementSibling&&""!==r.previousElementSibling.textContent&&(m=r.previousElementSibling.outerHTML+m,r.previousElementSibling.remove());(v=e.ir.element.querySelector("[data-type='link-ref-defs-block']"))&&!r.isEqualNode(v)&&(m+=v.outerHTML,v.remove()),(g=e.ir.element.querySelector("[data-type='footnotes-block']"))&&!r.isEqualNode(g)&&(m+=g.outerHTML,g.remove())}if(f("SpinVditorIRDOM",m,"argument",e.options.debugger),m=e.lute.SpinVditorIRDOM(m),f("SpinVditorIRDOM",m,"result",e.options.debugger),d)r.innerHTML=m;else if(r.outerHTML=m,(v=e.ir.element.querySelector("[data-type='link-ref-defs-block']"))&&e.ir.element.insertAdjacentElement("beforeend",v),(g=e.ir.element.querySelector("[data-type='footnotes-block']"))&&e.ir.element.insertAdjacentElement("beforeend",g),u){var E=Object(p.d)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(E){var M=E.textContent,k=M.substring(1,M.indexOf("]:")),x=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+k+'"]');x&&x.setAttribute("aria-label",M.substr(k.length+3).trim())}}Object(S.f)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){O(t,e)})),pt(e),jt(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},x=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&n.classList.contains("vditor-menu--current")&&n.classList.remove("vditor-menu--current")}}))},L=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&!n.classList.contains("vditor-menu--current")&&n.classList.add("vditor-menu--current")}}))},C=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&n.classList.contains(a.a.CLASS_MENU_DISABLED)&&n.classList.remove(a.a.CLASS_MENU_DISABLED)}}))},T=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&!n.classList.contains(a.a.CLASS_MENU_DISABLED)&&n.classList.add(a.a.CLASS_MENU_DISABLED)}}))},j=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="none")}))},_=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="block")}))},A=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach((function(e){n&&e.isEqualNode(n)||(e.style.display="none")})),e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.lastElementChild.style.display="none")),t.includes("hint")&&(e.hint.element.style.display="none"),e.wysiwyg.popover&&t.includes("popover")&&(e.wysiwyg.popover.style.display="none")},N=function(e,t,n,r){n.addEventListener(Object(u.b)(),(function(r){r.preventDefault(),r.stopPropagation(),n.classList.contains(a.a.CLASS_MENU_DISABLED)||(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach((function(e){e.classList.remove("vditor-hint--current")})),"block"===t.style.display?t.style.display="none":(A(e,["subToolbar","hint","popover"],n.parentElement.parentElement),n.classList.contains("vditor-tooltipped")||n.classList.add("vditor-hint--current"),t.style.display="block",e.toolbar.element.getBoundingClientRect().right-n.getBoundingClientRect().right<250?t.classList.add("vditor-panel--left"):t.classList.remove("vditor-panel--left")))}))},H=function(e){Be(e,(function(t){var n=Object(p.f)(t,"LI");n?(n.classList.contains("vditor-task")?L(e.toolbar.elements,["check"]):"OL"===n.parentElement.tagName?L(e.toolbar.elements,["ordered-list"]):"UL"===n.parentElement.tagName&&L(e.toolbar.elements,["list"]),C(e.toolbar.elements,["outdent","indent"])):T(e.toolbar.elements,["outdent","indent"])}))},D=n(27),R=n.n(D),I=n(29),z=n.n(I),P=n(30),q=n.n(P),B=n(31),U=n.n(B),V=n(32),K=n.n(V),W=n(33),F=n.n(W),J=n(34),Z=n.n(J),G=n(35),X=n.n(G),Q=n(36),$=n.n(Q),Y=n(37),ee=n.n(Y),te=n(4),ne=function(e,t){var n=Object(u.g)(e).split("-"),r=n.length>2&&("shift"===n[1]||"⇧"===n[1]),i=(r?n[2]:n[1])||"-";return!r||"-"!==i||!Object(u.e)()&&/Mac/.test(navigator.platform)||(i="_"),!(!Object(u.d)(t)||t.key.toLowerCase()!==i.toLowerCase()||t.altKey||!(!r&&!t.shiftKey||r&&t.shiftKey))},re=function(e,t){var n=getSelection().getRangeAt(0).cloneRange(),r=Object(p.d)(n.startContainer,"data-block","0");if(r&&t&&("deleteContentBackward"===t.inputType||" "===t.data)){for(var i=Object(S.c)(r,e.sv.element,n).start,o=!0,a=i-1;a>r.textContent.substr(0,i).lastIndexOf("\n");a--)if(" "!==r.textContent.charAt(a)&&"\t"!==r.textContent.charAt(a)){o=!1;break}if(0===i&&(o=!1),o)return void Ke(e);var l=Object(p.d)(n.startContainer,"data-type","li");if(l){if(" "===t.data&&(Object(p.d)(n.startContainer,"data-type","li-marker")||Object(p.d)(n.startContainer,"data-type","task-marker")))return void Ke(e);var s=l.querySelector('[data-type="li-marker"]');if("deleteContentBackward"===t.inputType&&Object(S.c)(l,e.sv.element,n).start<=l.getAttribute("data-space").length+(s?s.textContent.length:0)+(l.querySelector('[data-type="task-marker"]')?4:0))return void Ke(e)}if(Object(p.d)(n.startContainer,"data-type","heading-marker")&&(" "===t.data||"deleteContentBackward"===t.inputType))return void Ke(e);if(Object(p.d)(n.startContainer,"data-type","blockquote-marker")&&(" "===t.data||"deleteContentBackward"===t.inputType))return void Ke(e);var c=Object(p.d)(n.startContainer,"data-type","code-block");if(c&&"deleteContentBackward"===t.inputType){var d=Object(S.c)(r,e.sv.element,n).start;if(d<=2||d===c.textContent.length-1)return 1===r.querySelectorAll(".vditor-sv__marker").length&&(r.querySelector(".vditor-sv__marker").remove(),r.setAttribute("data-type","p")),void Ke(e)}}if(r&&"$$"===r.textContent.trimRight())Ke(e);else{r||(r=e.sv.element);var u=Object(p.d)(n.startContainer,"data-type","footnotes-block");u&&(r=u),"link-ref-defs-block"===r.getAttribute("data-type")&&(r=e.sv.element),Object(p.d)(n.startContainer,"data-type","footnotes-link")&&(r=e.sv.element);var h=Object(p.g)(r,"data-type","ol")||Object(p.g)(r,"data-type","ul")||Object(p.g)(r,"data-type","task");h&&(r=h),-1===r.textContent.indexOf(Lute.Caret)&&n.insertNode(document.createTextNode(Lute.Caret)),r.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),r.querySelectorAll("font").forEach((function(e){e.outerHTML=e.innerHTML}));var m=r.textContent;"insertParagraph"===(null==t?void 0:t.inputType)&&r.previousElementSibling&&""!==r.previousElementSibling.textContent.trim()&&(m=r.previousElementSibling.outerHTML+m,r.previousElementSibling.remove());var v,g,b=r.isEqualNode(e.sv.element);if(b)m=r.textContent;else r.previousElementSibling&&(m=r.previousElementSibling.textContent+m,r.previousElementSibling.remove()),r.nextElementSibling&&(m+=r.nextElementSibling.textContent,r.nextElementSibling.remove()),(v=e.sv.element.querySelector("[data-type='link-ref-defs-block']"))&&!r.isEqualNode(v)&&(m+=v.textContent,v.remove()),(g=e.sv.element.querySelector("[data-type='footnotes-block']"))&&!r.isEqualNode(g)&&(m+=g.textContent,g.remove());if(f("SpinVditorSVDOM",m,"argument",e.options.debugger),m=e.lute.SpinVditorSVDOM(m),f("SpinVditorSVDOM",m,"result",e.options.debugger),b)r.innerHTML=m;else r.outerHTML=m,(v=e.sv.element.querySelector("[data-type='link-ref-defs-block']"))&&e.sv.element.insertAdjacentElement("beforeend",v),(g=e.sv.element.querySelector("[data-type='footnotes-block']"))&&e.sv.element.insertAdjacentElement("beforeend",g);Object(S.f)(e.sv.element,n),_e(e),Ke(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})}},ie=n(8),oe=function(e){"dark"===e.options.theme?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},ae=function(e){var t=window.innerWidth<=a.a.MOBILE_WIDTH?10:35;if("none"!==e.wysiwyg.element.parentElement.style.display){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px "+Math.max(t,n)+"px"}if("none"!==e.ir.element.parentElement.style.display){n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px "+Math.max(t,n)+"px"}"block"===e.preview.element.style.display&&"sv"!==e.currentMode||(e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+e.outline.element.offsetWidth)+"px")},le=function(e){if(e.options.typewriterMode){var t=window.innerHeight;"number"==typeof e.options.height&&(t=e.options.height,"number"==typeof e.options.minHeight&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)),e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}},se=function(e,t){le(e),window.addEventListener("resize",(function(){ae(e),le(e)}));var n=Object(u.a)()&&localStorage.getItem(e.options.cache.id);return e.options.cache.enable&&n||(e.options.value?n=e.options.value:e.originalInnerHTML?n=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(n="")),n||""},ce=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout((function(){if(!e.wysiwyg.composingLock){var n=s(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&Object(u.a)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}}),800)},de=function(e,t,n){void 0===n&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){O(t,e),t.previousElementSibling.setAttribute("style","display:none")})),ce(e,n)},ue=function(e){for(var t="",n=e.nextSibling;n;)3===n.nodeType?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},pe=function(e){for(var t="",n=e.previousSibling;n;)t=3===n.nodeType?n.textContent+t:n.outerHTML+t,n=n.previousSibling;return t},he=function(e,t){Array.from(e.wysiwyg.element.childNodes).find((function(n){if(3===n.nodeType){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=3===t.startContainer.nodeType?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),Object(S.h)(t),!0}if(!n.getAttribute("data-block"))return"P"===n.tagName?n.remove():("DIV"===n.tagName?(t.insertNode(document.createElement("wbr")),n.outerHTML=''+n.innerHTML+"
"):"BR"===n.tagName?n.outerHTML=''+n.outerHTML+"
":(t.insertNode(document.createElement("wbr")),n.outerHTML=''+n.outerHTML+"
"),Object(S.f)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0}))},fe=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,o="",l="",s=function(e){var t=pe(e.startContainer),n=ue(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,o="",l="";return(""!==r.substr(0,i)&&r.substr(0,i)!==a.a.ZWSP||t)&&(o=""+t+r.substr(0,i)),(""!==r.substr(i)&&r.substr(i)!==a.a.ZWSP||n)&&(l=""+r.substr(i)+n),{afterHTML:l,beforeHTML:o}}(e),c=s.beforeHTML,d=s.afterHTML;r&&!i;){var u=r.tagName;if("STRIKE"===u&&(u="S"),"I"===u&&(u="EM"),"B"===u&&(u="STRONG"),"S"===u||"STRONG"===u||"EM"===u){var p="",h="",f="";"0"!==r.parentElement.getAttribute("data-block")&&(h=pe(r),f=ue(r)),(c||h)&&(c=p=h+"<"+u+">"+c+""+u+">"),("bold"===n&&"STRONG"===u||"italic"===n&&"EM"===u||"strikeThrough"===n&&"S"===u)&&(p+=""+o+a.a.ZWSP+""+l,i=!0),(d||f)&&(p+=d="<"+u+">"+d+""+u+">"+f),"0"!==r.parentElement.getAttribute("data-block")?(r=r.parentElement).innerHTML=p:(r.outerHTML=p,r=r.parentElement),o="<"+u+">"+o,l=""+u+">"+l}else i=!0}Object(S.f)(t.wysiwyg.element,e)},me=function(e,t){var n,r=this;this.element=document.createElement("div"),t.className&&(n=this.element.classList).add.apply(n,t.className.split(" "));var i=t.hotkey?" <"+Object(u.g)(t.hotkey)+">":"";2===t.level&&(i=t.hotkey?" <"+Object(u.g)(t.hotkey)+">":"");var o=t.tip?t.tip+i:te.a[e.options.lang][t.name]+i,l="upload"===t.name?"div":"button";if(2===t.level)this.element.innerHTML="<"+l+' data-type="'+t.name+'">'+o+""+l+">";else{this.element.classList.add("vditor-toolbar__item");var s=document.createElement(l);s.setAttribute("data-type",t.name),s.className="vditor-tooltipped vditor-tooltipped__"+t.tipPosition,s.setAttribute("aria-label",o),s.innerHTML=t.icon,this.element.appendChild(s)}t.prefix&&this.element.children[0].addEventListener(Object(u.b)(),(function(n){n.preventDefault(),r.element.firstElementChild.classList.contains(a.a.CLASS_MENU_DISABLED)||("wysiwyg"===e.currentMode?function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var o=Object(S.b)(e.wysiwyg.element),l=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if("strike"===l&&(l="strikeThrough"),"quote"===l){var s=Object(p.f)(o.startContainer,"BLOCKQUOTE");s||(s=o.startContainer.childNodes[o.startOffset]),s&&(r=!1,t.classList.remove("vditor-menu--current"),o.insertNode(document.createElement("wbr")),s.outerHTML=""===s.innerHTML.trim()?''+s.innerHTML+"
":s.innerHTML,Object(S.f)(e.wysiwyg.element,o))}else"inline-code"===l?o.collapsed?(o.selectNode(o.startContainer.parentElement),document.execCommand("removeFormat",!1,"")):document.execCommand("removeFormat",!1,""):"link"===l?o.collapsed?(o.selectNode(o.startContainer.parentElement),document.execCommand("unlink",!1,"")):document.execCommand("unlink",!1,""):"check"===l||"list"===l||"ordered-list"===l?(ot(e,o,l),Object(S.f)(e.wysiwyg.element,o),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),""===o.toString()?fe(o,e,l):document.execCommand(l,!1,""));else{0===e.wysiwyg.element.childNodes.length&&(e.wysiwyg.element.innerHTML='
',Object(S.f)(e.wysiwyg.element,o));var c=Object(p.c)(o.startContainer);if("quote"===l){if(c||(c=o.startContainer.childNodes[o.startOffset]),c){r=!1,t.classList.add("vditor-menu--current"),o.insertNode(document.createElement("wbr"));var d=Object(p.f)(o.startContainer,"LI");d&&c.contains(d)?d.innerHTML=''+d.innerHTML+"
":c.outerHTML=''+c.outerHTML+"
",Object(S.f)(e.wysiwyg.element,o)}}else if("check"===l||"list"===l||"ordered-list"===l)ot(e,o,l,!1),Object(S.f)(e.wysiwyg.element,o),r=!1,x(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if("inline-code"===l){if(""===o.toString())(u=document.createElement("code")).textContent=a.a.ZWSP,o.insertNode(u),o.setStart(u.firstChild,1),o.collapse(!0),Object(S.h)(o);else if(3===o.startContainer.nodeType){var u=document.createElement("code");o.surroundContents(u),o.insertNode(u),Object(S.h)(o)}r=!1,L(e.toolbar.elements,["inline-code"])}else if("code"===l)(u=document.createElement("div")).className="vditor-wysiwyg__block",u.setAttribute("data-type","code-block"),u.setAttribute("data-block","0"),u.setAttribute("data-marker","```"),""===o.toString()?u.innerHTML="\n
":(u.innerHTML=""+o.toString()+"
",o.deleteContents()),o.insertNode(u),c&&(c.outerHTML=e.lute.SpinVditorDOM(c.outerHTML)),Object(S.f)(e.wysiwyg.element,o),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){O(t,e)}));else if("link"===l)if(""===o.toString()){var h=document.createElement("a");h.innerText=a.a.ZWSP,o.insertNode(h),o.setStart(h.firstChild,1),o.collapse(!0),qe(e,h);var f=e.wysiwyg.popover.querySelector("input");f.value="",f.focus(),r=!1,i=!1}else(u=document.createElement("a")).setAttribute("href",""),u.innerHTML=o.toString(),o.surroundContents(u),o.insertNode(u),Object(S.h)(o);else if("table"===l){var m='';if(""===o.toString().trim())c&&""===c.innerHTML.trim().replace(a.a.ZWSP,"")?c.outerHTML=m:document.execCommand("insertHTML",!1,m),o.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),Object(S.h)(o);else{m='';var v=o.toString().split("\n"),g=v[0].split(",").length>v[0].split("\t").length?",":"\t";v.forEach((function(e,t){0===t?(e.split(g).forEach((function(e,t){m+=0===t?""+e+" | ":""+e+" | "})),m+="
"):(m+=1===t?"":"
",e.split(g).forEach((function(e){m+=""+e+" | "})),m+="
")})),m+="
",document.execCommand("insertHTML",!1,m),Object(S.f)(e.wysiwyg.element,o)}}else if("line"===l){if(c){var b='
\n
';""===c.innerHTML.trim()?c.outerHTML=b:c.insertAdjacentHTML("afterend",b),Object(S.f)(e.wysiwyg.element,o)}}else if(r=!1,t.classList.add("vditor-menu--current"),"strike"===l&&(l="strikeThrough"),""!==o.toString()||"bold"!==l&&"italic"!==l&&"strikeThrough"!==l)document.execCommand(l,!1,"");else{var y="strong";"italic"===l?y="em":"strikeThrough"===l&&(y="s"),(u=document.createElement(y)).textContent=a.a.ZWSP,o.insertNode(u),u.previousSibling&&u.previousSibling.textContent===a.a.ZWSP&&(u.previousSibling.textContent=""),o.setStart(u.firstChild,1),o.collapse(!0),Object(S.h)(o)}}r&&He(e),i&&ce(e)}}(e,r.element.children[0],n):"ir"===e.currentMode?Nt(e,r.element.children[0],t.prefix||"",t.suffix||""):Je(e,r.element.children[0],t.prefix||"",t.suffix||""))}))},ve=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ge=function(e,t,n){var r;"string"!=typeof n?(A(e,["subToolbar","hint"]),n.preventDefault(),r=s(e)):r=n,e.currentMode===t&&"string"!=typeof n||(e.devtools&&e.devtools.renderEchart(e),"both"===e.options.preview.mode&&"sv"===t?e.preview.element.style.display="block":e.preview.element.style.display="none",C(e.toolbar.elements,a.a.EDIT_TOOLBARS),x(e.toolbar.elements,a.a.EDIT_TOOLBARS),T(e.toolbar.elements,["outdent","indent"]),"ir"===t?(j(e.toolbar.elements,["both"]),_(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="block",e.currentMode="ir",e.ir.element.innerHTML=e.lute.Md2VditorIRDOM(r),jt(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),ae(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){O(t,e)}))):"wysiwyg"===t?(j(e.toolbar.elements,["both"]),_(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="block",e.ir.element.parentElement.style.display="none",e.currentMode="wysiwyg",ae(e),de(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.popover.style.display="none"):"sv"===t&&(_(e.toolbar.elements,["both"]),j(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",("both"===e.options.preview.mode||"editor"===e.options.preview.mode)&&(e.sv.element.style.display="block"),e.currentMode="sv",e.sv.element.innerHTML=e.lute.SpinVditorSVDOM(r),Ke(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),ae(e)),e.undo.resetIcon(e),"string"!=typeof n&&(e[e.currentMode].element.focus(),Ue(e)),"string"==typeof n&&e.outline.render(e),le(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach((function(e){e.classList.remove("vditor-menu--current")})),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'+e.currentMode+'"]').classList.add("vditor-menu--current")),e.outline.toggle(e,"sv"!==e.currentMode&&e.options.outline))},be=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=document.createElement("div");return i.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow"),i.innerHTML='\n\n",r.element.appendChild(i),r._bindEvent(t,i,n),r}return ve(t,e),t.prototype._bindEvent=function(e,t,n){var r=this.element.children[0];N(e,t,r,n.level),t.children.item(0).addEventListener(Object(u.b)(),(function(t){ge(e,"wysiwyg",t),t.preventDefault(),t.stopPropagation()})),t.children.item(1).addEventListener(Object(u.b)(),(function(t){ge(e,"ir",t),t.preventDefault(),t.stopPropagation()})),t.children.item(2).addEventListener(Object(u.b)(),(function(t){ge(e,"sv",t),t.preventDefault(),t.stopPropagation()}))},t}(me),ye=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},we=function(e,t){e.options.upload.setHeaders&&(e.options.upload.headers=e.options.upload.setHeaders()),e.options.upload.headers&&Object.keys(e.options.upload.headers).forEach((function(n){t.setRequestHeader(n,e.options.upload.headers[n])}))},Ee=function(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"},Me=function(e,t,n){for(var r,i=[],o=!0===e.options.upload.multiple?t.length:1,a=0;a"+te.a[o].nameEmpty+"",c=!1),s.size>e.options.upload.max&&(r+=""+s.name+" "+te.a[o].over+" "+e.options.upload.max/1024/1024+"M",c=!1);var d=s.name.lastIndexOf("."),u=s.name.substr(d),p=e.options.upload.filename(s.name.substr(0,d))+u;e.options.upload.accept&&(e.options.upload.accept.split(",").some((function(e){var t=e.trim();if(0===t.indexOf(".")){if(u.toLowerCase()===t.toLowerCase())return!0}else if(s.type.split("/")[0]===t.split("/")[0])return!0;return!1}))||(r+=""+s.name+" "+te.a[o].fileTypeError+"",c=!1));c&&(n.push(s),i+=""+p+" "+te.a[o].uploading+"")},l=t.length,s=0;s"+r+i+""),n}(e,i);if(0!==c.length){for(var d=new FormData,u=(a=0,c.length);a0&&(r="- "+r+"
",n.data.errFiles.forEach((function(e){var n=e.lastIndexOf("."),i=t.options.upload.filename(e.substr(0,n))+e.substr(n);r+="- "+i+" "+te.a[t.options.lang].uploadError+"
"})),r+="
"),r?t.tip.show(r):t.tip.hide();var i="";Object.keys(n.data.succMap).forEach((function(e){var r=n.data.succMap[e],o=e.lastIndexOf("."),a=e.substr(o),l=t.options.upload.filename(e.substr(0,o))+a;".wav"===(a=a.toLowerCase())||".mp3"===a||".ogg"===a?"wysiwyg"===t.currentMode?i+='<audio controls="controls" src="'+r+'"></audio>
':i+='
\n':".apng"===a||".bmp"===a||".gif"===a||".ico"===a||".cur"===a||".jpg"===a||".jpeg"===a||".jfif"===a||".pjp"===a||".pjpeg"===a||".png"===a||".svg"===a||".webp"===a?"wysiwyg"===t.currentMode?i+='
':i+="!["+l+"]("+r+")\n":"wysiwyg"===t.currentMode?i+='
'+l+"":i+="["+l+"]("+r+")\n"})),Object(S.h)(t.upload.range),document.execCommand("insertHTML",!1,i),t.upload.range=getSelection().getRangeAt(0).cloneRange()}(r,e)}else e.options.upload.error?e.options.upload.error(v.responseText):e.tip.show(v.responseText);n&&(n.value=""),e.upload.element.style.display="none"}},v.upload.onprogress=function(t){if(t.lengthComputable){var n=t.loaded/t.total*100;e.upload.element.style.display="block",e.upload.element.style.width=n+"%"}},v.send(d)}else n&&(n.value="")},Oe=function(e,t){var n=Object(S.b)(e.wysiwyg.element),r=Object(p.c)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),r||0!==e.wysiwyg.element.children.length||(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),"
"===r.innerHTML.trim()&&(r.innerHTML="
"),"BLOCKQUOTE"===r.tagName||r.classList.contains("vditor-reset")?r.innerHTML="<"+t+' data-block="0">'+r.innerHTML.trim()+""+t+">":r.outerHTML="<"+t+' data-block="0">'+r.innerHTML.trim()+""+t+">",Object(S.f)(e.wysiwyg.element,n),pt(e))},Se=function(e){var t=getSelection().getRangeAt(0),n=Object(p.c)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML=''+n.innerHTML+"
",Object(S.f)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},ke=function(e,t,n){void 0===n&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();"CODE"===r.tagName?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),Object(S.h)(i),e.firstElementChild.classList.contains("language-mindmap")||_e(t)},xe=function(e,t){if(ne("⌘-⇧-X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');if(n)return n.click(),t.preventDefault(),!0}},Le=function(e,t){return Object(S.e)(e,t)?getSelection().toString():""},Ce=function(e,t){t.addEventListener("focus",(function(){e.options.focus&&e.options.focus(s(e)),A(e,["subToolbar"])}))},Te=function(e,t){t.addEventListener("blur",(function(){e.options.blur&&e.options.blur(s(e))}))},je=function(e,t){(e.options.upload.url||e.options.upload.handler)&&t.addEventListener("drop",(function(t){if("Files"===t.dataTransfer.types[0]){var n=t.dataTransfer.items;n.length>0&&Me(e,n),t.preventDefault()}}))},_e=function(e){if(e.options.typewriterMode){var t=e[e.currentMode].element,n=Object(S.a)(t).top;"string"!=typeof e.options.height||e.element.classList.contains("vditor--fullscreen")||window.scrollTo(window.scrollX,n+e.element.offsetTop+e.toolbar.element.offsetHeight-window.innerHeight/2+10),("number"==typeof e.options.height||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},Ae=function(e,t){t.addEventListener("keydown",(function(t){if(!e.options.hint.at&&!e.toolbar.elements.emoji||!e.hint.select(t,e)){if("sv"===e.currentMode){if(function(e,t){if(e.sv.composingLock=t.isComposing,t.isComposing)return!1;if(-1===t.key.indexOf("Arrow")&&e.undo.recordFirstPosition(e,t),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!Object(u.d)(t)&&"Escape"!==t.key)return!1;var n=Object(S.b)(e.sv.element),r=n.startContainer,i=Object(p.d)(r,"data-type","blockquote-line");if(i){var o=Object(S.c)(i,e.sv.element,n).start;if("Enter"===t.key&&!Object(u.d)(t)&&!t.altKey&&0!==o){var a=0;if(i.querySelectorAll('[data-type="blockquote-marker"').forEach((function(e){a+=e.textContent.length})),o===a&&a>1)return i.firstElementChild.remove(),t.preventDefault(),Ke(e),!0;if(""!==i.textContent.trim())return n.insertNode(document.createTextNode("\n>")),n.collapse(!1),re(e),t.preventDefault(),!0}if("Backspace"===t.key&&!Object(u.d)(t)&&!t.altKey&&!t.shiftKey&&1===o)return n.setStart(r,0),n.extractContents(),""===i.firstElementChild.textContent&&i.firstElementChild.remove(),Ke(e),t.preventDefault(),!0}var l=Object(p.d)(r,"data-type","li");if(l){var s=l.querySelector('[data-type="li-marker"]'),c=(o=Object(S.c)(l,e.sv.element,n).start,l.getAttribute("data-space")),d=l.querySelectorAll('[data-type="task-marker"]');if("Enter"===t.key&&!Object(u.d)(t)&&!t.altKey&&!t.shiftKey&&0!==o){if(s&&o===s.textContent.length+c.length+(d.length>0?4:0)){var h=!0;""===c?s.remove():(s.previousElementSibling.remove(),re(e),h=!1),d.length>0&&l.querySelectorAll('[data-type="task-marker"]').forEach((function(e){e.remove()})),h&&Ke(e)}else{var f="\n";s&&(f+=c+s.textContent),d.length>0&&(f+="[ ] "),n.insertNode(document.createTextNode(f)),n.collapse(!1),re(e)}return t.preventDefault(),!0}if("Backspace"===t.key&&!Object(u.d)(t)&&!t.altKey&&!t.shiftKey){var m=Object(p.d)(r,"data-type","li-marker")||Object(p.d)(r,"data-type","li-space");if(m&&1===o)return n.setStart(r,0),n.extractContents(),""===m.textContent&&m.remove(),Ke(e),t.preventDefault(),!0}if("Tab"===t.key&&s&&o===s.textContent.length+c.length+(d.length>0?d[1].textContent.length+3:0))return/^\d/.test(s.textContent)&&(s.textContent="1. ",n.selectNodeContents(s.firstChild),n.collapse(!1)),s.insertAdjacentHTML("beforebegin",''+s.textContent.replace(/\S/g," ")+""),re(e),t.preventDefault(),!0;if(d.length>0&&ne("⌘-⇧-J",t))return" "===d[1].textContent?d[1].textContent="x":d[1].textContent=" ",Ke(e),t.preventDefault(),!0}if(mt(e,n,t))return!0;var v=Object(p.d)(r,"data-block","0");if("Enter"===t.key&&!Object(u.d)(t)&&!t.altKey){var g=!1;return v&&0===Object(S.c)(v,e.sv.element).start&&(g=!0),n.insertNode(document.createTextNode("\n")),n.collapse(!1),v&&""===(null==v?void 0:v.textContent.trim())||g?Ke(e):re(e),t.preventDefault(),!0}if(v&&"Backspace"===t.key&&!Object(u.d)(t)&&!t.altKey&&!t.shiftKey){if(0===(o=Object(S.c)(v,e.sv.element,n).start)&&v.previousElementSibling&&"newline"===v.previousElementSibling.lastElementChild.getAttribute("data-type"))return v.previousElementSibling.lastElementChild.remove(),n.extractContents(),""!==v.textContent.trim()?re(e):Ke(e),t.preventDefault(),!0;var b=Object(p.d)(r,"data-type","text");if(b&&1===n.startOffset&&b.previousElementSibling&&"newline"===b.previousElementSibling.getAttribute("data-type"))return n.setStart(r,0),n.extractContents(),Ke(e),t.preventDefault(),!0}return!1}(e,t))return}else if("wysiwyg"===e.currentMode){if(function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;-1===t.key.indexOf("Arrow")&&e.undo.recordFirstPosition(e,t);var n=Object(S.b)(e.wysiwyg.element),r=n.startContainer;if(!Xe(t,e,r))return!1;if(Qe(n,e,t),xt(n),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!Object(u.d)(t)&&"Escape"!==t.key)return!1;var i=Object(p.c)(r),o=Object(p.f)(r,"P");if(vt(t,e,o,n))return!0;if(ft(n,e,o,t))return!0;if(Et(e,t,n))return!0;var l=Object(p.e)(r,"vditor-wysiwyg__block");if(l){if("Escape"===t.key&&2===l.children.length)return e.wysiwyg.popover.style.display="none",l.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!Object(u.d)(t)&&!t.shiftKey&&t.altKey&&"Enter"===t.key&&"code-block"===l.getAttribute("data-type")){var s=e.wysiwyg.popover.querySelector(".vditor-input");return s.focus(),s.select(),t.preventDefault(),!0}if("0"===l.getAttribute("data-block")){if(Mt(e,t,l.firstElementChild,n))return!0;if(rt(e,t,n,l.firstElementChild,l))return!0}}if(Ot(e,n,t,o))return!0;var c=Object(p.i)(r,"BLOCKQUOTE");if(c&&!t.shiftKey&&t.altKey&&"Enter"===t.key){Object(u.d)(t)?n.setStartBefore(c):n.setStartAfter(c),Object(S.h)(n);var d=document.createElement("p");return d.setAttribute("data-block","0"),d.innerHTML="\n",n.insertNode(d),n.collapse(!0),Object(S.h)(n),ce(e),_e(e),t.preventDefault(),!0}var f,m=Object(h.a)(r);if(m){if("H6"===m.tagName&&r.textContent.length===n.startOffset&&!Object(u.d)(t)&&!t.shiftKey&&!t.altKey&&"Enter"===t.key){var v=document.createElement("p");return v.textContent="\n",v.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",v),n.setStart(v,0),Object(S.h)(n),ce(e),_e(e),t.preventDefault(),!0}var g;if(ne("⌘-=",t))return(g=parseInt(m.tagName.substr(1),10)-1)>0&&(Oe(e,"h"+g),ce(e)),t.preventDefault(),!0;if(ne("⌘--",t))return(g=parseInt(m.tagName.substr(1),10)+1)<7&&(Oe(e,"h"+g),ce(e)),t.preventDefault(),!0;"Backspace"!==t.key||Object(u.d)(t)||t.shiftKey||t.altKey||""!==m.textContent||Se(e)}if(St(e,n,t))return!0;if(t.altKey&&"Enter"===t.key&&!Object(u.d)(t)&&!t.shiftKey){var b=Object(p.f)(r,"A"),y=Object(p.d)(r,"data-type","link-ref"),w=Object(p.d)(r,"data-type","footnotes-ref");if(b||y||w||m&&2===m.tagName.length){var E=e.wysiwyg.popover.querySelector("input");E.focus(),E.select()}}if(xe(e,t))return!0;if(ne("⌘-⇧-U",t)&&(f=e.wysiwyg.popover.querySelector('[data-type="up"]')))return f.click(),t.preventDefault(),!0;if(ne("⌘-⇧-D",t)&&(f=e.wysiwyg.popover.querySelector('[data-type="down"]')))return f.click(),t.preventDefault(),!0;if(mt(e,n,t))return!0;if(!Object(u.d)(t)&&t.shiftKey&&!t.altKey&&"Enter"===t.key&&"LI"!==r.parentElement.tagName&&"P"!==r.parentElement.tagName)return["STRONG","S","STRONG","I","EM","B"].includes(r.parentElement.tagName)?n.insertNode(document.createTextNode("\n"+a.a.ZWSP)):n.insertNode(document.createTextNode("\n")),n.collapse(!1),Object(S.h)(n),ce(e),_e(e),t.preventDefault(),!0;if("Backspace"===t.key&&!Object(u.d)(t)&&!t.shiftKey&&!t.altKey&&""===n.toString()){if(kt(e,n,t,o))return!0;if(i){if(i.previousElementSibling&&i.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&"0"===i.previousElementSibling.getAttribute("data-block")){var M=Object(S.c)(i,e.wysiwyg.element,n).start;if(0===M||1===M&&i.innerText.startsWith(a.a.ZWSP))return ke(i.previousElementSibling.lastElementChild,e,!1),""===i.innerHTML.trim()&&(i.remove(),ce(e)),t.preventDefault(),!0}var O=n.startOffset;if(""===n.toString()&&3===r.nodeType&&"\n"===r.textContent.charAt(O-2)&&r.textContent.charAt(O-1)!==a.a.ZWSP&&["STRONG","S","STRONG","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,O-1)+a.a.ZWSP,n.setStart(r,O),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===a.a.ZWSP&&1===n.startOffset&&!r.previousSibling&&function(e){for(var t=e.startContainer.nextSibling;t&&""===t.textContent;)t=t.nextSibling;return!(!t||3===t.nodeType||"CODE"!==t.tagName&&"math-inline"!==t.getAttribute("data-type")&&"html-inline"!==t.getAttribute("data-type"))}(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach((function(e){e.firstElementChild.style.display="inline",e.lastElementChild.style.display="none"}))}}if(Object(u.e)()&&1===n.startOffset&&r.textContent.indexOf(a.a.ZWSP)>-1&&r.previousSibling&&3!==r.previousSibling.nodeType&&"CODE"===r.previousSibling.tagName&&("Backspace"===t.key||"ArrowLeft"===t.key))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Lt(t,i,n))return t.preventDefault(),!0;if($e(n,t.key),"ArrowDown"===t.key){var k=r.nextSibling;k&&3!==k.nodeType&&"math-inline"===k.getAttribute("data-type")&&n.setStartAfter(k)}return!1}(e,t))return}else if("ir"===e.currentMode&&function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;-1===t.key.indexOf("Arrow")&&e.undo.recordFirstPosition(e,t);var n=Object(S.b)(e.ir.element),r=n.startContainer;if(!Xe(t,e,r))return!1;if(Qe(n,e,t),xt(n),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!Object(u.d)(t)&&"Escape"!==t.key)return!1;var i=Object(p.d)(r,"data-newline","1");if(!Object(u.d)(t)&&!t.altKey&&!t.shiftKey&&"Enter"===t.key&&i&&n.startOffset-1&&m){var v=et(m);if(v&&it(e,t,n,m,v))return!0;var g=tt(m);if(g&&rt(e,t,n,m,g))return!0}if(Et(e,t,n))return!0;if(St(e,n,t))return!0;if(mt(e,n,t))return!0;if("Backspace"===t.key&&!Object(u.d)(t)&&!t.shiftKey&&!t.altKey&&""===n.toString()){if(kt(e,n,t,l))return!0;var b=Object(h.a)(r);if(b){var y=b.firstElementChild.textContent.length;Object(S.c)(b,e.ir.element).start===y&&(n.setStart(b.firstElementChild.firstChild,y-1),n.collapse(!0))}}var w=Object(p.c)(r);return!("ArrowUp"!==t.key&&"ArrowDown"!==t.key||!w||(w.querySelectorAll(".vditor-ir__node").forEach((function(e){e.contains(r)||e.classList.add("vditor-ir__node--hidden")})),!Lt(t,w,n)))||($e(n,t.key),!1)}(e,t))return;if(e.options.ctrlEnter&&ne("⌘-Enter",t))return e.options.ctrlEnter(s(e)),void t.preventDefault();if(ne("⌘-Z",t)&&!e.toolbar.elements.undo)return e.undo.undo(e),void t.preventDefault();if(ne("⌘-Y",t)&&!e.toolbar.elements.redo)return e.undo.redo(e),void t.preventDefault();if("Escape"===t.key)return"block"===e.hint.element.style.display?e.hint.element.style.display="none":e.options.esc&&e.options.esc(s(e)),void t.preventDefault();if(Object(u.d)(t)&&t.altKey&&!t.shiftKey&&/^Digit[1-6]$/.test(t.code)){if("wysiwyg"===e.currentMode){var n=t.code.replace("Digit","H");Object(p.f)(getSelection().getRangeAt(0).startContainer,n)?Se(e):Oe(e,n),ce(e)}else"sv"===e.currentMode?We(e,"#".repeat(parseInt(t.code.replace("Digit",""),10))+" "):"ir"===e.currentMode&&_t(e,"#".repeat(parseInt(t.code.replace("Digit",""),10))+" ");return t.preventDefault(),!0}if(Object(u.d)(t)&&t.altKey&&!t.shiftKey&&/^Digit[7-9]$/.test(t.code))return"Digit7"===t.code?ge(e,"wysiwyg",t):"Digit8"===t.code?ge(e,"ir",t):"Digit9"===t.code&&ge(e,"sv",t),!0;e.options.toolbar.find((function(n){return!n.hotkey||n.toolbar?!!n.toolbar&&!!n.toolbar.find((function(n){return!!n.hotkey&&(ne(n.hotkey,t)?(e.toolbar.elements[n.name].children[0].dispatchEvent(new CustomEvent(Object(u.b)())),t.preventDefault(),!0):void 0)})):ne(n.hotkey,t)?(e.toolbar.elements[n.name].children[0].dispatchEvent(new CustomEvent(Object(u.b)())),t.preventDefault(),!0):void 0}))}}))},Ne=function(e,t){e.options.select&&t.addEventListener("selectstart",(function(n){t.onmouseup=function(){var t=Le(e[e.currentMode].element);t&&e.options.select(t)}}))},He=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout((function(){var t;if("false"!==e.wysiwyg.element.getAttribute("contenteditable")&&Object(S.e)(e.wysiwyg.element)){x(e.toolbar.elements,a.a.EDIT_TOOLBARS),C(e.toolbar.elements,a.a.EDIT_TOOLBARS);var n=getSelection().getRangeAt(0),r=n.startContainer;3===n.startContainer.nodeType&&(r=n.startContainer.parentElement),r.classList.contains("vditor-reset")&&(r=r.childNodes[n.startOffset]);var i=Object(p.d)(r,"data-type","footnotes-block");if(i)return e.wysiwyg.popover.innerHTML="",ze(i,e),void De(e,i);var o=Object(p.f)(r,"LI");o?(o.classList.contains("vditor-task")?L(e.toolbar.elements,["check"]):"OL"===o.parentElement.tagName?L(e.toolbar.elements,["ordered-list"]):"UL"===o.parentElement.tagName&&L(e.toolbar.elements,["list"]),C(e.toolbar.elements,["outdent","indent"])):T(e.toolbar.elements,["outdent","indent"]),Object(p.f)(r,"BLOCKQUOTE")&&L(e.toolbar.elements,["quote"]),(Object(p.f)(r,"B")||Object(p.f)(r,"STRONG"))&&L(e.toolbar.elements,["bold"]),(Object(p.f)(r,"I")||Object(p.f)(r,"EM"))&&L(e.toolbar.elements,["italic"]),(Object(p.f)(r,"STRIKE")||Object(p.f)(r,"S"))&&L(e.toolbar.elements,["strike"]);var l=Object(p.f)(r,"A");l&&L(e.toolbar.elements,["link"]);var s=Object(p.f)(r,"TABLE"),c=Object(h.a)(r);Object(p.f)(r,"CODE")?Object(p.f)(r,"PRE")?(T(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),L(e.toolbar.elements,["code"])):(T(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),L(e.toolbar.elements,["inline-code"])):c?(T(e.toolbar.elements,["bold"]),L(e.toolbar.elements,["headings"])):s&&T(e.toolbar.elements,["table"]);var d=Object(p.e)(r,"vditor-toc");if(!d)(G=Object(p.d)(r,"data-block","0"))&&(null===(t=G.previousElementSibling)||void 0===t?void 0:t.classList.contains("vditor-toc"))&&(d=G.previousElementSibling);d&&(e.wysiwyg.popover.innerHTML="",ze(d,e),De(e,d));var f=Object(h.b)(r,"BLOCKQUOTE");if(f&&(e.wysiwyg.popover.innerHTML="",Re(n,f,e),Ie(n,f,e),ze(f,e),De(e,f)),o&&(e.wysiwyg.popover.innerHTML="",Re(n,o,e),Ie(n,o,e),ze(o,e),De(e,o)),s){e.wysiwyg.popover.innerHTML="";var m=function(){var e=s.rows.length,t=s.rows[0].cells.length,n=parseInt(N.value,10)||e,r=parseInt(D.value,10)||t;if(n!==e||t!==r){if(t!==r)for(var i=r-t,o=0;o0)for(var a=0;a "):s.rows[o].lastElementChild.insertAdjacentHTML("afterend"," | ");else for(var l=t-1;l>=r;l--)s.rows[o].cells[l].remove();if(e!==n){var c=n-e;if(c>0){for(var d="",u=0;u ";for(var p=0;p")}else for(u=e-1;u>=n;u--)s.rows[u].remove(),1===s.rows.length&&s.querySelector("tbody").remove()}}},v=function(t){st(s,t),"right"===t?(w.classList.remove("vditor-icon--current"),E.classList.remove("vditor-icon--current"),M.classList.add("vditor-icon--current")):"center"===t?(w.classList.remove("vditor-icon--current"),M.classList.remove("vditor-icon--current"),E.classList.add("vditor-icon--current")):(E.classList.remove("vditor-icon--current"),M.classList.remove("vditor-icon--current"),w.classList.add("vditor-icon--current")),Object(S.h)(n),ce(e)},g=Object(p.f)(r,"TD"),b=Object(p.f)(r,"TH"),y="left";g?y=g.getAttribute("align")||"left":b&&(y=b.getAttribute("align")||"center");var w=document.createElement("button");w.setAttribute("aria-label",te.a[e.options.lang].alignLeft+"<"+Object(u.g)("⌘-⇧-L")+">"),w.setAttribute("data-type","left"),w.innerHTML=z.a,w.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("left"===y?" vditor-icon--current":""),w.onclick=function(){v("left")};var E=document.createElement("button");E.setAttribute("aria-label",te.a[e.options.lang].alignCenter+"<"+Object(u.g)("⌘-⇧-C")+">"),E.setAttribute("data-type","center"),E.innerHTML=R.a,E.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("center"===y?" vditor-icon--current":""),E.onclick=function(){v("center")};var M=document.createElement("button");M.setAttribute("aria-label",te.a[e.options.lang].alignRight+"<"+Object(u.g)("⌘-⇧-R")+">"),M.setAttribute("data-type","right"),M.innerHTML=q.a,M.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("right"===y?" vditor-icon--current":""),M.onclick=function(){v("right")};var k=document.createElement("button");k.setAttribute("aria-label",te.a[e.options.lang]["insert-row"]+"<"+Object(u.g)("⌘-=")+">"),k.setAttribute("data-type","insertRow"),k.innerHTML=X.a,k.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",k.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=Object(p.f)(t,"TD")||Object(p.f)(t,"TH");r&>(e,n,r)};var j=document.createElement("button");j.setAttribute("aria-label",te.a[e.options.lang]["insert-column"]+"<"+Object(u.g)("⌘-⇧-=")+">"),j.setAttribute("data-type","insertColumn"),j.innerHTML=Z.a,j.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",j.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,n=Object(p.f)(t,"TD")||Object(p.f)(t,"TH");n&&bt(e,s,n)};var _=document.createElement("button");_.setAttribute("aria-label",te.a[e.options.lang]["delete-row"]+"<"+Object(u.g)("⌘--")+">"),_.setAttribute("data-type","deleteRow"),_.innerHTML=K.a,_.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",_.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=Object(p.f)(t,"TD")||Object(p.f)(t,"TH");r&&yt(e,n,r)};var A=document.createElement("button");A.setAttribute("aria-label",te.a[e.options.lang]["delete-column"]+"<"+Object(u.g)("⌘-⇧--")+">"),A.setAttribute("data-type","deleteColumn"),A.innerHTML=U.a,A.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",A.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=Object(p.f)(t,"TD")||Object(p.f)(t,"TH");r&&wt(e,n,s,r)},(ne=document.createElement("span")).setAttribute("aria-label",te.a[e.options.lang].row),ne.className="vditor-tooltipped vditor-tooltipped__n";var N=document.createElement("input");ne.appendChild(N),N.type="number",N.min="1",N.className="vditor-input",N.style.width="42px",N.style.textAlign="center",N.setAttribute("placeholder",te.a[e.options.lang].row),N.value=s.rows.length.toString(),N.oninput=function(){m()},N.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(D.focus(),D.select(),void t.preventDefault()):void xe(e,t)};var H=document.createElement("span");H.setAttribute("aria-label",te.a[e.options.lang].column),H.className="vditor-tooltipped vditor-tooltipped__n";var D=document.createElement("input");H.appendChild(D),D.type="number",D.min="1",D.className="vditor-input",D.style.width="42px",D.style.textAlign="center",D.setAttribute("placeholder",te.a[e.options.lang].column),D.value=s.rows[0].cells.length.toString(),D.oninput=function(){m()},D.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(N.focus(),N.select(),void t.preventDefault()):void xe(e,t)},Re(n,s,e),Ie(n,s,e),ze(s,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",w),e.wysiwyg.popover.insertAdjacentElement("beforeend",E),e.wysiwyg.popover.insertAdjacentElement("beforeend",M),e.wysiwyg.popover.insertAdjacentElement("beforeend",k),e.wysiwyg.popover.insertAdjacentElement("beforeend",j),e.wysiwyg.popover.insertAdjacentElement("beforeend",_),e.wysiwyg.popover.insertAdjacentElement("beforeend",A),e.wysiwyg.popover.insertAdjacentElement("beforeend",ne),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",H),De(e,s)}var I=Object(p.d)(r,"data-type","link-ref");if(I){e.wysiwyg.popover.innerHTML="";var P=function(){""!==B.value.trim()&&(I.textContent=B.value),""!==W.value.trim()&&I.setAttribute("data-link-label",W.value)};(ne=document.createElement("span")).setAttribute("aria-label",te.a[e.options.lang].textIsNotEmpty),ne.className="vditor-tooltipped vditor-tooltipped__n";var B=document.createElement("input");ne.appendChild(B),B.className="vditor-input",B.setAttribute("placeholder",te.a[e.options.lang].textIsNotEmpty),B.style.width="120px",B.value=I.textContent,B.oninput=function(){P()},B.onkeydown=function(t){xe(e,t)||Pe(e.wysiwyg.element,I,t,W)};var V=document.createElement("span");V.setAttribute("aria-label",te.a[e.options.lang].linkRef),V.className="vditor-tooltipped vditor-tooltipped__n";var W=document.createElement("input");V.appendChild(W),W.className="vditor-input",W.setAttribute("placeholder",te.a[e.options.lang].linkRef),W.value=I.getAttribute("data-link-label"),W.oninput=function(){P()},W.onkeydown=function(t){xe(e,t)||Pe(e.wysiwyg.element,I,t,B)},ze(I,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",ne),e.wysiwyg.popover.insertAdjacentElement("beforeend",V),De(e,I)}var F=Object(p.d)(r,"data-type","footnotes-ref");if(F){e.wysiwyg.popover.innerHTML="",(ne=document.createElement("span")).setAttribute("aria-label",te.a[e.options.lang].footnoteRef+"<"+Object(u.g)("⌥-Enter")+">"),ne.className="vditor-tooltipped vditor-tooltipped__n";var J=document.createElement("input");ne.appendChild(J),J.className="vditor-input",J.setAttribute("placeholder",te.a[e.options.lang].footnoteRef+"<"+Object(u.g)("⌥-Enter")+">"),J.style.width="120px",J.value=F.getAttribute("data-footnotes-label"),J.oninput=function(){""!==J.value.trim()&&F.setAttribute("data-footnotes-label",J.value)},J.onkeydown=function(t){if(!t.isComposing)return Object(u.d)(t)||t.shiftKey||!t.altKey||"Enter"!==t.key?void xe(e,t):(n.selectNodeContents(F),n.collapse(!1),Object(S.h)(n),void t.preventDefault())},ze(F,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",ne),De(e,F)}var G,Q=Object(p.e)(r,"vditor-wysiwyg__block");if(Q&&Q.getAttribute("data-type").indexOf("block")>-1){if(e.wysiwyg.popover.innerHTML="",Re(n,Q,e),Ie(n,Q,e),ze(Q,e),"code-block"===Q.getAttribute("data-type")){var $=document.createElement("span");$.setAttribute("aria-label",te.a[e.options.lang].language+"<"+Object(u.g)("⌥-Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Y=document.createElement("input");$.appendChild(Y);var ee=Q.firstElementChild.firstElementChild;Y.className="vditor-input",Y.setAttribute("placeholder",te.a[e.options.lang].language+"<"+Object(u.g)("⌥-Enter")+">"),Y.value=ee.className.indexOf("language-")>-1?ee.className.split("-")[1].split(" ")[0]:"",Y.oninput=function(){""!==Y.value.trim()?ee.className="language-"+Y.value:(ee.className="",e.hint.recentLanguage=""),Q.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Q.lastElementChild.innerHTML=Q.firstElementChild.innerHTML,O(Q.lastElementChild,e)),ce(e)},Y.onkeydown=function(t){if(!t.isComposing&&!xe(e,t)){if("Escape"===t.key&&"block"===e.hint.element.style.display)return e.hint.element.style.display="none",void t.preventDefault();Object(u.d)(t)||t.shiftKey||!t.altKey||"Enter"!==t.key||(n.setStart(ee.firstChild,0),n.collapse(!0),Object(S.h)(n)),e.hint.select(t,e)}},Y.onkeyup=function(t){if(!t.isComposing&&"Enter"!==t.key&&"ArrowUp"!==t.key&&"Escape"!==t.key&&"ArrowDown"!==t.key){var n=[],r=Y.value.substring(0,Y.selectionStart);a.a.CODE_LANGUAGES.forEach((function(e){e.indexOf(r.toLowerCase())>-1&&n.push({html:e,value:e})})),e.hint.genHTML(n,r,e),t.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",$)}De(e,Q)}else Q||e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach((function(e){e.previousElementSibling.style.display="none"})),Q=void 0;if(c){var ne;e.wysiwyg.popover.innerHTML="",(ne=document.createElement("span")).setAttribute("aria-label","ID<"+Object(u.g)("⌥-Enter")+">"),ne.className="vditor-tooltipped vditor-tooltipped__n";var re=document.createElement("input");ne.appendChild(re),re.className="vditor-input",re.setAttribute("placeholder","ID<"+Object(u.g)("⌥-Enter")+">"),re.style.width="120px",re.value=c.getAttribute("data-id")||"",re.oninput=function(){c.setAttribute("data-id",re.value)},re.onkeydown=function(t){if(!t.isComposing)return Object(u.d)(t)||t.shiftKey||!t.altKey||"Enter"!==t.key?void xe(e,t):(n.selectNodeContents(c),n.collapse(!1),Object(S.h)(n),void t.preventDefault())},Re(n,c,e),Ie(n,c,e),ze(c,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",ne),De(e,c)}if(l&&qe(e,l),!(f||o||s||Q||l||I||F||c||d))(G=Object(p.d)(r,"data-block","0"))&&G.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Re(n,G,e),Ie(n,G,e),ze(G,e),De(e,G)):e.wysiwyg.popover.style.display="none";e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach((function(e){e.style.display="none"}));var ie=Object(p.d)(n.startContainer,"data-type","backslash");ie&&(ie.querySelector("span").style.display="inline")}}),200)},De=function(e,t){var n=t,r=Object(p.f)(t,"TABLE");r&&(n=r),e.wysiwyg.popover.style.left="0",e.wysiwyg.popover.style.display="block",e.wysiwyg.popover.style.top=Math.max(-8,n.offsetTop-21-e.wysiwyg.element.scrollTop)+"px",e.wysiwyg.popover.style.left=Math.min(n.offsetLeft,e.wysiwyg.element.clientWidth-e.wysiwyg.popover.clientWidth)+"px",e.wysiwyg.popover.setAttribute("data-top",(n.offsetTop-21).toString())},Re=function(e,t,n){var r=t.previousElementSibling;if(r&&(t.parentElement.isEqualNode(n.wysiwyg.element)||"LI"===t.tagName)){var i=document.createElement("button");i.setAttribute("data-type","up"),i.setAttribute("aria-label",te.a[n.options.lang].up+"<"+Object(u.g)("⌘-⇧-U")+">"),i.innerHTML=ee.a,i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),Object(S.f)(n.wysiwyg.element,e),ce(n),He(n),_e(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ie=function(e,t,n){var r=t.nextElementSibling;if(r&&(t.parentElement.isEqualNode(n.wysiwyg.element)||"LI"===t.tagName)){var i=document.createElement("button");i.setAttribute("data-type","down"),i.setAttribute("aria-label",te.a[n.options.lang].down+"<"+Object(u.g)("⌘-⇧-D")+">"),i.innerHTML=F.a,i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),Object(S.f)(n.wysiwyg.element,e),ce(n),He(n),_e(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},ze=function(e,t){var n=document.createElement("button");n.setAttribute("data-type","remove"),n.setAttribute("aria-label",te.a[t.options.lang].remove+"<"+Object(u.g)("⌘-⇧-X")+">"),n.innerHTML=$.a,n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var n=Object(S.b)(t.wysiwyg.element);n.setStartAfter(e),Object(S.h)(n),e.remove(),ce(t),He(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},Pe=function(e,t,n,r){if(!n.isComposing){if("Tab"===n.key)return r.focus(),r.select(),void n.preventDefault();if(!Object(u.d)(n)&&!n.shiftKey&&n.altKey&&"Enter"===n.key){var i=Object(S.b)(e);t.insertAdjacentHTML("afterend",a.a.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),Object(S.h)(i),n.preventDefault()}}},qe=function(e,t){e.wysiwyg.popover.innerHTML="";var n=function(){""!==i.value.trim()&&(t.innerHTML=i.value),t.setAttribute("href",a.value),t.setAttribute("title",s.value)};t.querySelectorAll("[data-marker]").forEach((function(e){e.removeAttribute("data-marker")}));var r=document.createElement("span");r.setAttribute("aria-label",te.a[e.options.lang].textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var i=document.createElement("input");r.appendChild(i),i.className="vditor-input",i.setAttribute("placeholder",te.a[e.options.lang].textIsNotEmpty),i.style.width="120px",i.value=t.innerHTML||"",i.oninput=function(){n()},i.onkeydown=function(n){xe(e,n)||Pe(e.wysiwyg.element,t,n,a)};var o=document.createElement("span");o.setAttribute("aria-label",te.a[e.options.lang].link),o.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");o.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",te.a[e.options.lang].link),a.value=t.getAttribute("href")||"",a.oninput=function(){n()},a.onkeydown=function(n){xe(e,n)||Pe(e.wysiwyg.element,t,n,s)};var l=document.createElement("span");l.setAttribute("aria-label",te.a[e.options.lang].tooltipText),l.className="vditor-tooltipped vditor-tooltipped__n";var s=document.createElement("input");l.appendChild(s),s.className="vditor-input",s.setAttribute("placeholder",te.a[e.options.lang].tooltipText),s.style.width="60px",s.value=t.getAttribute("title")||"",s.oninput=function(){n()},s.onkeydown=function(n){xe(e,n)||Pe(e.wysiwyg.element,t,n,i)},ze(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",l),De(e,t)},Be=function(e,t){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout((function(){if("false"!==e[e.currentMode].element.getAttribute("contenteditable")&&Object(S.e)(e[e.currentMode].element)){x(e.toolbar.elements,a.a.EDIT_TOOLBARS),C(e.toolbar.elements,a.a.EDIT_TOOLBARS);var n=Object(S.b)(e[e.currentMode].element),r=n.startContainer;3===n.startContainer.nodeType&&(r=n.startContainer.parentElement),r.classList.contains("vditor-reset")&&(r=r.childNodes[n.startOffset]),("sv"===e.currentMode?Object(p.d)(r,"data-type","heading"):Object(h.a)(r))&&L(e.toolbar.elements,["headings"]),("sv"===e.currentMode?Object(p.d)(r,"data-type","blockquote"):Object(p.f)(r,"BLOCKQUOTE"))&&L(e.toolbar.elements,["quote"]),Object(p.d)(r,"data-type","strong")&&L(e.toolbar.elements,["bold"]),Object(p.d)(r,"data-type","em")&&L(e.toolbar.elements,["italic"]),Object(p.d)(r,"data-type","s")&&L(e.toolbar.elements,["strike"]),Object(p.d)(r,"data-type","a")&&L(e.toolbar.elements,["link"]),t(r),Object(p.d)(r,"data-type","code-block")&&(T(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),L(e.toolbar.elements,["code"])),Object(p.d)(r,"data-type","code")&&(T(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),L(e.toolbar.elements,["inline-code"])),Object(p.d)(r,"data-type","table")&&T(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}}),200)},Ue=function(e){"wysiwyg"===e.currentMode?He(e):"ir"===e.currentMode?H(e):"sv"===e.currentMode&&Ve(e)},Ve=function(e){Be(e,(function(t){Object(p.d)(t,"data-type","ul")?L(e.toolbar.elements,["list"]):Object(p.d)(t,"data-type","ol")?L(e.toolbar.elements,["ordered-list"]):Object(p.d)(t,"data-type","task")&&L(e.toolbar.elements,["check"])}))},Ke=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.sv.processTimeoutId),e.sv.processTimeoutId=window.setTimeout((function(){if(!e.sv.composingLock){var n=s(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&Object(u.a)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),e.preview.render(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}}),800)},We=function(e,t){var n=Object(S.b)(e.sv.element),r=Object(p.d)(n.startContainer,"data-type","heading")||n.startContainer;if(r){var i=r.querySelector(".vditor-sv__marker--heading");i&&n.selectNodeContents(i),""===t?document.execCommand("delete"):document.execCommand("insertHTML",!1,t),Ve(e)}},Fe=function(e,t,n){var r=Object(p.d)(e.startContainer,"data-type",n);r&&(r.firstElementChild.remove(),r.lastElementChild.remove(),e.insertNode(document.createElement("wbr")),r.outerHTML=r.firstElementChild.innerHTML)},Je=function(e,t,n,r){var i=Object(S.b)(e.sv.element),o=t.getAttribute("data-type"),a=i.startContainer;if(3===a.nodeType&&(a=a.parentElement),t.classList.contains("vditor-menu--current")){if("quote"===o){var l=Object(p.d)(i.startContainer,"data-type","blockquote");if(l)return l.querySelectorAll('[data-type="blockquote-line"]').forEach((function(e){e.firstElementChild.remove()})),re(e),void Ve(e)}else if("link"===o){var s=Object(p.d)(i.startContainer,"data-type","a");if(s){var c=Object(p.d)(i.startContainer,"data-type","link-text");c?(i.insertNode(document.createElement("wbr")),s.outerHTML=c.innerHTML):s.outerHTML=s.querySelector('[data-type="link-text"]').innerHTML+""}}else if("italic"===o)Fe(i,0,"em");else if("bold"===o)Fe(i,0,"strong");else if("strike"===o)Fe(i,0,"s");else if("inline-code"===o)Fe(i,0,"code");else if("check"===o||"list"===o||"ordered-list"===o){var d=Object(p.c)(i.startContainer);if(d)return d.querySelectorAll('[data-type="li-marker"').forEach((function(e){e.remove()})),d.querySelectorAll('[data-type="task-marker"').forEach((function(e){e.remove()})),re(e),void Ve(e)}}else{0===e.sv.element.childNodes.length&&(e.sv.element.innerHTML='
\n
',Object(S.f)(e.sv.element,i));var u=Object(p.c)(i.startContainer);if("line"===o){if(u){var h='---\n\n
';""===u.textContent.trim()?u.outerHTML=h:u.insertAdjacentHTML("afterend",h)}}else if("quote"===o){if(u)return u.insertAdjacentText("afterbegin","> "),re(e),void Ve(e)}else{if("link"===o){var f=void 0;return f=""===i.toString()?""+n+Lute.Caret+r:""+n+i.toString()+r.replace(")",Lute.Caret+")"),document.execCommand("insertHTML",!1,f),void Ve(e)}if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o){f=void 0;return f=""===i.toString()?""+n+Lute.Caret+r:""+n+i.toString()+Lute.Caret+r,"table"!==o&&"code"!==o||(f="\n"+f),document.execCommand("insertHTML",!1,f),void Ve(e)}if(("check"===o||"list"===o||"ordered-list"===o)&&u){var m=u.getAttribute("data-type"),v="* ";return"check"===o?v="* [ ] ":"ordered-list"===o&&(v="1. "),"ul"!==m&&"ol"!==m&&"task"!==m?u.insertAdjacentText("afterbegin",v):(u.querySelectorAll('[data-type="li-marker"').forEach((function(e){e.textContent=v})),"check"!==o&&u.querySelectorAll('[data-type="task-marker"').forEach((function(e){e.remove()}))),re(e),void Ve(e)}}}Object(S.f)(e.sv.element,i),Ke(e),Ve(e)},Ze=function(e,t,n){var r=Object(p.c)(t.startContainer);if(r||(r=e.wysiwyg.element),n&&"formatItalic"!==n.inputType&&"deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType&&"formatBold"!==n.inputType&&"formatRemove"!==n.inputType&&"formatStrikeThrough"!==n.inputType&&"insertUnorderedList"!==n.inputType&&"insertOrderedList"!==n.inputType&&"formatOutdent"!==n.inputType&&"formatIndent"!==n.inputType&&""!==n.inputType||!n){var i=function(e){for(var t=e.previousSibling;t;){if(3!==t.nodeType&&"A"===t.tagName&&!t.previousSibling&&""===t.innerHTML.replace(a.a.ZWSP,"")&&t.nextSibling)return t;t=t.previousSibling}return!1}(t.startContainer);i&&i.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach((function(e){e.remove()})),t.insertNode(document.createElement("wbr")),r.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")}));var o="";("link-ref-defs-block"===r.getAttribute("data-type")||ut(r.innerText))&&(r=e.wysiwyg.element);var l=r.isEqualNode(e.wysiwyg.element),s=Object(p.d)(r,"data-type","footnotes-block");if(l)o=r.innerHTML;else{var c,d,u=Object(p.b)(t.startContainer);if(u)r=Object(h.b)(t.startContainer,"BLOCKQUOTE")?Object(p.c)(t.startContainer)||r:u;if(s&&(r=s),o=r.outerHTML,"UL"===r.tagName||"OL"===r.tagName){var m=r.previousElementSibling,v=r.nextElementSibling;!m||"UL"!==m.tagName&&"OL"!==m.tagName||(o=m.outerHTML+o,m.remove()),!v||"UL"!==v.tagName&&"OL"!==v.tagName||(o+=v.outerHTML,v.remove()),o=o.replace("
","
")}(c=e.wysiwyg.element.querySelector("[data-type='link-ref-defs-block']"))&&!r.isEqualNode(c)&&(o+=c.outerHTML,c.remove()),(d=e.wysiwyg.element.querySelector("[data-type='footnotes-block']"))&&!r.isEqualNode(d)&&(o+=d.outerHTML,d.remove())}if('```
'===(o=o.replace(/<\/(strong|b)>/g,"").replace(/<\/(em|i)>/g,"").replace(/<\/(s|strike)>/g,""))&&e.hint.recentLanguage&&(o='```
'.replace("```","```"+e.hint.recentLanguage)),f("SpinVditorDOM",o,"argument",e.options.debugger),o=e.lute.SpinVditorDOM(o),f("SpinVditorDOM",o,"result",e.options.debugger),l)r.innerHTML=o;else if(r.outerHTML=o,(c=e.wysiwyg.element.querySelector("[data-type='link-ref-defs-block']"))&&e.wysiwyg.element.insertAdjacentElement("beforeend",c),(d=e.wysiwyg.element.querySelector("[data-type='footnotes-block']"))&&e.wysiwyg.element.insertAdjacentElement("beforeend",d),s){var g=Object(p.i)(e.wysiwyg.element.querySelector("wbr"),"LI");if(g){var b=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+g.getAttribute("data-marker")+'"]');b&&b.setAttribute("aria-label",g.textContent.trim())}}(Object(h.a)(r)||o.startsWith("-1||Object(u.d)(n)||"Escape"===n.key||n.shiftKey||n.altKey)){var r=Object(p.f)(e.startContainer,"P");if(r&&0===Object(S.c)(r,t[t.currentMode].element,e).start){var i=document.createTextNode(a.a.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},$e=function(e,t){if("ArrowDown"===t||"ArrowUp"===t){var n=Object(p.d)(e.startContainer,"data-type","math-inline");n&&("ArrowDown"===t&&e.setStartAfter(n.parentElement),"ArrowUp"===t&&e.setStartBefore(n.parentElement))}},Ye=function(e,t){var n=Object(S.b)(e[e.currentMode].element),r=Object(p.c)(n.startContainer);r&&(r.insertAdjacentHTML(t,''+a.a.ZWSP+"\n
"),Object(S.f)(e[e.currentMode].element,n),Ue(e),ht(e))},et=function(e){var t=Object(p.f)(e,"TABLE");return!(!t||!t.rows[0].cells[0].isSameNode(e))&&t},tt=function(e){var t=Object(p.f)(e,"TABLE");return!(!t||!t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e))&&t},nt=function(e,t,n){void 0===n&&(n=!0);var r=e.previousElementSibling;return r||(r=e.parentElement.previousElementSibling?e.parentElement.previousElementSibling.lastElementChild:"TBODY"===e.parentElement.parentElement.tagName&&e.parentElement.parentElement.previousElementSibling?e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:null),r&&(t.selectNodeContents(r),n||t.collapse(!1),Object(S.h)(t)),r},rt=function(e,t,n,r,i){var o=Object(S.c)(r,e[e.currentMode].element,n);if("ArrowDown"===t.key&&-1===r.textContent.trimRight().substr(o.start).indexOf("\n")||"ArrowRight"===t.key&&o.start>=r.textContent.trimRight().length){var l=i.nextElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",''+a.a.ZWSP+"
"),Object(S.f)(e[e.currentMode].element,n)):(n.selectNodeContents(l),n.collapse(!0),Object(S.h)(n)),t.preventDefault(),!0}return!1},it=function(e,t,n,r,i){var o=Object(S.c)(r,e[e.currentMode].element,n);if("ArrowUp"===t.key&&-1===r.textContent.substr(o.start).indexOf("\n")||("ArrowLeft"===t.key||"Backspace"===t.key)&&0===o.start){var l=i.previousElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",''+a.a.ZWSP+"
"),Object(S.f)(e.ir.element,n)):(n.selectNodeContents(l),n.collapse(!1),Object(S.h)(n)),t.preventDefault(),!0}return!1},ot=function(e,t,n,r){void 0===r&&(r=!0);var i=Object(p.f)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),t.insertNode(document.createElement("wbr")),r&&i){for(var o="",a=0;a'+i.parentElement.children[a].innerHTML.trimLeft()+""}i.parentElement.insertAdjacentHTML("beforebegin",o),i.parentElement.remove()}else if(i)if("check"===n)i.parentElement.querySelectorAll("li").forEach((function(e){e.insertAdjacentHTML("afterbegin",''+(0===e.textContent.indexOf(" ")?"":" ")),e.classList.add("vditor-task")}));else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach((function(e){e.querySelector("input").remove(),e.classList.remove("vditor-task")}));var s=void 0;(s="list"===n?document.createElement("ul"):document.createElement("ol")).innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(s,i.parentElement)}else{var c=Object(p.d)(t.startContainer,"data-block","0");c||(e[e.currentMode].element.querySelector("wbr").remove(),(c=e[e.currentMode].element.querySelector("p")).innerHTML=""),"check"===n?(c.insertAdjacentHTML("beforebegin",'"),c.remove()):"list"===n?(c.insertAdjacentHTML("beforebegin",'"),c.remove()):"ordered-list"===n&&(c.insertAdjacentHTML("beforebegin",'- '+c.innerHTML+"
"),c.remove())}},at=function(e,t,n){if(t&&t.previousElementSibling){e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr"));var r=t.parentElement,i=t.getAttribute("data-marker");1!==i.length&&(i="1"+i.slice(-1)),t.previousElementSibling.insertAdjacentHTML("beforeend","<"+r.tagName+' data-block="0">'+t.innerHTML+""+r.tagName+">"),t.remove(),"wysiwyg"===e.currentMode?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),Object(S.f)(e[e.currentMode].element,n);var o=Object(p.b)(n.startContainer);o&&o.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){O(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),ht(e),Ue(e)}else e[e.currentMode].element.focus()},lt=function(e,t,n,r){var i=Object(p.f)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr"));var o=t.parentElement,a=o.cloneNode(),l=!1,s="";o.querySelectorAll("li").forEach((function(e){l&&(s+=e.outerHTML,e.nextElementSibling||e.previousElementSibling?e.remove():e.parentElement.remove()),e.isSameNode(t)&&(l=!0)})),i.insertAdjacentElement("afterend",t),s&&(a.innerHTML=s,t.insertAdjacentElement("beforeend",a)),"wysiwyg"===e.currentMode?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),Object(S.f)(e[e.currentMode].element,n);var c=Object(p.b)(n.startContainer);c&&c.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){O(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),ht(e),Ue(e)}else e[e.currentMode].element.focus()},st=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,o=0,a=0;a2&&(!(t.indexOf("-")>-1&&-1===t.trimLeft().indexOf(" ")&&e.trimRight().split("\n").length>1)&&(0!==t.indexOf(" ")&&0!==t.indexOf("\t")))))},dt=function(e,t){if(!t)return!1;var n=e.trimRight().split("\n");return 0!==(e=n.pop()).indexOf(" ")&&0!==e.indexOf("\t")&&(""!==(e=e.trimLeft())&&0!==n.length&&(""===e.replace(/-/g,"")||""===e.replace(/=/g,"")))},ut=function(e){return"[toc]"===e.trim().toLowerCase()},pt=function(e){var t=e[e.currentMode].element;e.outline.render(e);var n=t.querySelector('[data-type="toc-block"]');if(n){var r="";Array.from(t.children).forEach((function(t){if(Object(h.a)(t)){var n=parseInt(t.tagName.substring(1),10),i=new Array(2*(n-1)).fill(" ").join("");"ir"===e.currentMode?r+=i+''+t.textContent.substring(n+1).trim()+"
":r+=i+''+t.textContent.trim()+"
"}})),n.innerHTML=r||"[ToC]"}},ht=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),"wysiwyg"===e.currentMode?ce(e,t):"ir"===e.currentMode?jt(e,t):"sv"===e.currentMode&&Ke(e,t)},ft=function(e,t,n,r){var i=e.startContainer,o=Object(p.f)(i,"LI");if(o){if(!Object(u.d)(r)&&!r.altKey&&"Enter"===r.key&&!r.shiftKey&&n&&o.contains(n)&&n.nextElementSibling)return o&&!o.textContent.endsWith("\n")&&o.insertAdjacentText("beforeend","\n"),e.insertNode(document.createTextNode("\n\n")),e.collapse(!1),ht(t),r.preventDefault(),!0;if(!(Object(u.d)(r)||r.shiftKey||r.altKey||"Backspace"!==r.key||o.previousElementSibling||""!==e.toString()||0!==Object(S.c)(o,t[t.currentMode].element,e).start))return o.nextElementSibling?(o.parentElement.insertAdjacentHTML("beforebegin",''+o.innerHTML+"
"),o.remove()):o.parentElement.outerHTML=''+o.innerHTML+"
",Object(S.f)(t[t.currentMode].element,e),ht(t),r.preventDefault(),!0;if(!Object(u.d)(r)&&!r.altKey&&"Tab"===r.key){var a=!1;if((0===e.startOffset&&(3===i.nodeType&&!i.previousSibling||3!==i.nodeType&&"LI"===i.nodeName)||o.classList.contains("vditor-task")&&1===e.startOffset&&3!==i.previousSibling.nodeType&&"INPUT"===i.previousSibling.tagName)&&(a=!0),a)return r.shiftKey?lt(t,o,e,o.parentElement):at(t,o,e),r.preventDefault(),!0}}return!1},mt=function(e,t,n){if(e.options.tab&&"Tab"===n.key)return n.shiftKey||(""===t.toString()?(t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1)):(t.extractContents(),t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1))),Object(S.h)(t),ht(e),n.preventDefault(),!0},vt=function(e,t,n,r){if(n){if(!Object(u.d)(e)&&!e.altKey&&"Enter"===e.key){var o=String.raw(i||(i=Ge(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),a=o.split("|");if(o.startsWith("|")&&o.endsWith("|")&&a.length>3){var l=a.map((function(){return"---"})).join("|");return l=n.textContent+"\n"+l.substring(3,l.length-3)+"\n|",n.outerHTML=t.lute.SpinVditorDOM(l),Object(S.f)(t[t.currentMode].element,r),ht(t),_e(t),e.preventDefault(),!0}if(ct(n.innerHTML)){var s="",c=n.innerHTML.trimRight().split("\n");return c.length>1&&(c.pop(),s=''+c.join("\n")+"
"),n.insertAdjacentHTML("afterend",s+'
\n
'),n.remove(),Object(S.f)(t[t.currentMode].element,r),ht(t),_e(t),e.preventDefault(),!0}if(dt(n.innerHTML,t.options.preview.markdown.setext))return n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+'\n
'),Object(S.f)(t[t.currentMode].element,r),ht(t),_e(t),e.preventDefault(),!0}if(n.previousElementSibling&&"Backspace"===e.key&&!Object(u.d)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split("\n").length>1&&0===Object(S.c)(n,t[t.currentMode].element,r).start){var d=Object(p.a)(n.previousElementSibling);return d.textContent.endsWith("\n")||(d.textContent=d.textContent+"\n"),d.parentElement.insertAdjacentHTML("beforeend",""+n.innerHTML),n.remove(),Object(S.f)(t[t.currentMode].element,r),!1}return!1}},gt=function(e,t,n){for(var r="",i=0;i"+(0===i?" ":" ")+"";"TH"===n.tagName?n.parentElement.parentElement.insertAdjacentHTML("afterend",""+r+"
"):n.parentElement.insertAdjacentHTML("afterend",""+r+"
"),Object(S.f)(e[e.currentMode].element,t),ht(e),_e(e)},bt=function(e,t,n){for(var r=0,i=n.previousElementSibling;i;)r++,i=i.previousElementSibling;for(var o=0;o "):t.rows[o].cells[r].insertAdjacentHTML("afterend"," | ");ht(e)},yt=function(e,t,n){if("TD"===n.tagName){var r=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(r.previousElementSibling.lastElementChild.lastElementChild),1===r.childElementCount?r.remove():n.parentElement.remove(),t.collapse(!1),Object(S.h)(t),ht(e)}},wt=function(e,t,n,r){for(var i=0,o=r.previousElementSibling;o;)i++,o=o.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var a=0;a");var o=document.createElement("br");return n.insertNode(o),n.setStartAfter(o),ht(e),_e(e),t.preventDefault(),!0}if("Tab"===t.key)return t.shiftKey?(nt(i,n),t.preventDefault(),!0):((d=i.nextElementSibling)||(d=i.parentElement.nextElementSibling?i.parentElement.nextElementSibling.firstElementChild:"THEAD"===i.parentElement.parentElement.tagName&&i.parentElement.parentElement.nextElementSibling?i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:null),d&&(n.selectNodeContents(d),Object(S.h)(n)),t.preventDefault(),!0);var a=i.parentElement.parentElement.parentElement;if("ArrowUp"===t.key){if(t.preventDefault(),"TH"===i.tagName)return a.previousElementSibling?(n.selectNodeContents(a.previousElementSibling),n.collapse(!1),Object(S.h)(n)):Ye(e,"beforebegin"),!0;for(var l=0,s=i.parentElement;l\n',Object(S.f)(e[e.currentMode].element,n)):(n.setStartBefore(a),n.collapse(!0)),ht(e)),t.preventDefault(),!0;if(ne("⌘-=",t))return gt(e,n,i),t.preventDefault(),!0;if(ne("⌘-⇧-=",t))return bt(e,a,i),t.preventDefault(),!0;if(ne("⌘--",t))return yt(e,n,i),t.preventDefault(),!0;if(ne("⌘-⇧--",t))return wt(e,n,a,i),t.preventDefault(),!0;if(ne("⌘-⇧-L",t)){if("ir"===e.currentMode)return st(a,"left"),ht(e),t.preventDefault(),!0;if(f=e.wysiwyg.popover.querySelector('[data-type="left"]'))return f.click(),t.preventDefault(),!0}if(ne("⌘-⇧-C",t)){if("ir"===e.currentMode)return st(a,"center"),ht(e),t.preventDefault(),!0;if(f=e.wysiwyg.popover.querySelector('[data-type="center"]'))return f.click(),t.preventDefault(),!0}if(ne("⌘-⇧-R",t)){if("ir"===e.currentMode)return st(a,"right"),ht(e),t.preventDefault(),!0;var f;if(f=e.wysiwyg.popover.querySelector('[data-type="right"]'))return f.click(),t.preventDefault(),!0}}return!1},Mt=function(e,t,n,r){if("PRE"===n.tagName&&ne("⌘-A",t))return r.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&"Tab"===t.key&&!t.shiftKey&&""===r.toString())return r.insertNode(document.createTextNode(e.options.tab)),r.collapse(!1),ht(e),t.preventDefault(),!0;if("Backspace"===t.key&&!Object(u.d)(t)&&!t.shiftKey&&!t.altKey){var i=Object(S.c)(n,e[e.currentMode].element,r);if((0===i.start||1===i.start&&"\n"===n.innerText)&&""===r.toString())return n.parentElement.outerHTML=''+n.firstElementChild.innerHTML+"
",Object(S.f)(e[e.currentMode].element,r),ht(e),t.preventDefault(),!0}return!Object(u.d)(t)&&!t.altKey&&"Enter"===t.key&&(n.firstElementChild.textContent.endsWith("\n")||n.firstElementChild.insertAdjacentText("beforeend","\n"),r.insertNode(document.createTextNode("\n")),r.collapse(!1),Object(S.h)(r),n.firstElementChild.classList.contains("language-mindmap")?"wysiwyg"===e.currentMode?Ze(e,r):k(e,r):(ht(e),_e(e)),t.preventDefault(),!0)},Ot=function(e,t,n,r){var i=t.startContainer,o=Object(p.f)(i,"BLOCKQUOTE");if(o&&""===t.toString()){if("Backspace"===n.key&&!Object(u.d)(n)&&!n.shiftKey&&!n.altKey&&0===Object(S.c)(o,e[e.currentMode].element,t).start)return t.insertNode(document.createElement("wbr")),o.outerHTML=o.innerHTML,Object(S.f)(e[e.currentMode].element,t),ht(e),n.preventDefault(),!0;if(r&&"Enter"===n.key&&!Object(u.d)(n)&&!n.shiftKey&&!n.altKey&&"BLOCKQUOTE"===r.parentElement.tagName){var l=!1;if("\n"===r.innerHTML.replace(a.a.ZWSP,"")||""===r.innerHTML.replace(a.a.ZWSP,"")?(l=!0,r.remove()):r.innerHTML.endsWith("\n\n")&&Object(S.c)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),l=!0),l)return o.insertAdjacentHTML("afterend",''+a.a.ZWSP+"\n
"),Object(S.f)(e[e.currentMode].element,t),ht(e),n.preventDefault(),!0}var s=Object(p.c)(i);if("wysiwyg"===e.currentMode&&s&&ne("⌘-⇧-:",n))return t.insertNode(document.createElement("wbr")),s.outerHTML=''+s.outerHTML+"
",Object(S.f)(e.wysiwyg.element,t),ce(e),n.preventDefault(),!0}return!1},St=function(e,t,n){var r=t.startContainer,i=Object(p.e)(r,"vditor-task");if(i){if(ne("⌘-⇧-J",n)){var o=i.firstElementChild;return o.checked?o.removeAttribute("checked"):o.setAttribute("checked","checked"),ht(e),n.preventDefault(),!0}if("Backspace"===n.key&&!Object(u.d)(n)&&!n.shiftKey&&!n.altKey&&""===t.toString()&&1===t.startOffset&&(3===r.nodeType&&r.previousSibling&&"INPUT"===r.previousSibling.tagName||3!==r.nodeType)){var a=i.previousElementSibling;if(i.querySelector("input").remove(),a)Object(p.a)(a).parentElement.insertAdjacentHTML("beforeend",""+i.innerHTML.trim()),i.remove();else i.parentElement.insertAdjacentHTML("beforebegin",''+(i.innerHTML.trim()||"\n")+"
"),i.nextElementSibling?i.remove():i.parentElement.remove();return Object(S.f)(e[e.currentMode].element,t),ht(e),n.preventDefault(),!0}if("Enter"===n.key&&!Object(u.d)(n)&&!n.shiftKey&&!n.altKey){if(""===i.textContent.trim())if(Object(p.e)(i.parentElement,"vditor-task")){var l=Object(p.b)(r);l&<(e,i,t,l)}else if(i.nextElementSibling){var s="",c="",d=!1;Array.from(i.parentElement.children).forEach((function(e){i.isSameNode(e)?d=!0:d?s+=e.outerHTML:c+=e.outerHTML}));var h=i.parentElement.tagName,f="OL"===i.parentElement.tagName?"":' data-marker="'+i.parentElement.getAttribute("data-marker")+'"',m="";c&&(m="UL"===i.parentElement.tagName?"":' start="1"',c="<"+h+' data-tight="true"'+f+' data-block="0">'+c+""+h+">"),i.parentElement.outerHTML=c+'\n
<'+h+'\n data-tight="true"'+f+' data-block="0"'+m+">"+s+""+h+">"}else i.parentElement.insertAdjacentHTML("afterend",'\n
'),1===i.parentElement.querySelectorAll("li").length?i.parentElement.remove():i.remove();else 3!==r.nodeType&&0===t.startOffset&&"INPUT"===r.firstChild.tagName?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",' '),document.querySelector("wbr").after(t.extractContents()));return Object(S.f)(e[e.currentMode].element,t),ht(e),_e(e),n.preventDefault(),!0}}return!1},kt=function(e,t,n,r){if(3!==t.startContainer.nodeType){var i=t.startContainer.children[t.startOffset];if(i&&"HR"===i.tagName)return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var o=r.previousElementSibling;if(o&&0===Object(S.c)(r,e[e.currentMode].element,t).start&&(Object(u.e)()&&"HR"===o.tagName||"TABLE"===o.tagName)){if("TABLE"===o.tagName){var a=o.lastElementChild.lastElementChild.lastElementChild;a.innerHTML=a.innerHTML.trimLeft()+""+r.textContent.trim(),r.remove()}else o.remove();return Object(S.f)(e[e.currentMode].element,t),ht(e),n.preventDefault(),!0}}return!1},xt=function(e){Object(u.e)()&&3!==e.startContainer.nodeType&&"HR"===e.startContainer.tagName&&e.setStartBefore(e.startContainer)},Lt=function(e,t,n){var r,i;if(!Object(u.e)())return!1;if("ArrowUp"===e.key&&t&&"TABLE"===(null===(r=t.previousElementSibling)||void 0===r?void 0:r.tagName)){var o=t.previousElementSibling;return n.selectNodeContents(o.rows[o.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return!("ArrowDown"!==e.key||!t||"TABLE"!==(null===(i=t.nextElementSibling)||void 0===i?void 0:i.tagName))&&(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0)},Ct=function(e,t,n){var r;t.stopPropagation(),t.preventDefault();var i=t.clipboardData.getData("text/html"),o=t.clipboardData.getData("text/plain"),l={},s=function(t){var n=t.TokensStr();if(34===t.__internal_object__.Parent.Type&&n&&-1===n.indexOf("file://")&&e.options.upload.linkToImgUrl){var r=new XMLHttpRequest;r.open("POST",e.options.upload.linkToImgUrl),we(e,r),r.onreadystatechange=function(){if(r.readyState===XMLHttpRequest.DONE)if(200===r.status){var t=JSON.parse(r.responseText);if(0!==t.code)return void e.tip.show(t.msg);var n=t.data.originalURL;if("sv"===e.currentMode)e.sv.element.querySelectorAll('[data-type="image"] .vditor-sv__marker--link').forEach((function(e){e.textContent===n&&(e.textContent=t.data.url)}));else{var i=e[e.currentMode].element.querySelector('img[src="'+n+'"]');i.src=t.data.url,"ir"===e.currentMode&&(i.previousElementSibling.previousElementSibling.innerHTML=t.data.url)}ht(e)}else e.tip.show(r.responseText)},r.send(JSON.stringify({url:n}))}return"ir"===e.currentMode?[''+n+"",Lute.WalkStop]:"wysiwyg"===e.currentMode?["",Lute.WalkStop]:[''+n+"",Lute.WalkStop]};i.replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!==''+o+""&&i.replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='\x3c!--StartFragment--\x3e'+o+"\x3c!--EndFragment--\x3e"||(i="");var c=(new DOMParser).parseFromString(i,"text/html");c.body&&(i=c.body.innerHTML);var d=function(e,t,n){void 0===n&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var i=!1;1===r.childElementCount&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(i=!0);var o=r.querySelectorAll("pre");if(1===r.childElementCount&&1===o.length&&"vditor-wysiwyg"!==o[0].className&&"vditor-sv"!==o[0].className&&(i=!0),0===e.indexOf('\n')&&(i=!0),1===r.childElementCount&&"TABLE"===r.firstElementChild.tagName&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var a=t||e;return/\n/.test(a)||1===o.length?"wysiwyg"===n?'
'+a.replace(/&/g,"&").replace(/
":"```\n"+a.replace(/&/g,"&").replace(/"+a.replace(/&/g,"&").replace(/":"`"+a+"`"}return!1}(i,o,e.currentMode),u="sv"===e.currentMode?Object(p.d)(t.target,"data-type","code-block"):Object(p.f)(t.target,"CODE");if(u)if("sv"===e.currentMode)document.execCommand("insertHTML",!1,o);else{var h=Object(S.c)(t.target,e[e.currentMode].element);"PRE"!==u.parentElement.tagName&&(o+=a.a.ZWSP),u.textContent=u.textContent.substring(0,h.start)+o+u.textContent.substring(h.end),Object(S.g)(h.start+o.length,h.start+o.length,u.parentElement),(null===(r=u.parentElement)||void 0===r?void 0:r.nextElementSibling.classList.contains("vditor-"+e.currentMode+"__preview"))&&(u.parentElement.nextElementSibling.innerHTML=u.outerHTML,O(u.parentElement.nextElementSibling,e))}else if(d)n.pasteCode(d);else if(""!==i.trim()){var f=document.createElement("div");f.innerHTML=i,f.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),f.querySelectorAll(".vditor-copy").forEach((function(e){e.remove()})),"ir"===e.currentMode?(l.HTML2VditorIRDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.HTML2VditorIRDOM(f.innerHTML),e)):"wysiwyg"===e.currentMode?(l.HTML2VditorDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.HTML2VditorDOM(f.innerHTML),e)):(l.HTML2VditorSVDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.HTML2VditorSVDOM(f.innerHTML),e)),e.outline.render(e)}else t.clipboardData.files.length>0&&e.options.upload.url?Me(e,t.clipboardData.files):""!==o.trim()&&0===t.clipboardData.files.length&&("ir"===e.currentMode?(l.Md2VditorIRDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.Md2VditorIRDOM(o),e)):"wysiwyg"===e.currentMode?(l.Md2VditorDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.Md2VditorDOM(o),e)):(l.Md2VditorSVDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Object(S.d)(e.lute.Md2VditorSVDOM(o),e)),e.outline.render(e));"sv"!==e.currentMode&&e[e.currentMode].element.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){O(t,e)})),ht(e)},Tt=function(e){e.hint.render(e);var t=Object(S.b)(e.ir.element).startContainer,n=Object(p.d)(t,"data-type","code-block-info");if(n)if(""===n.textContent.replace(a.a.ZWSP,"")&&e.hint.recentLanguage){n.textContent=a.a.ZWSP+e.hint.recentLanguage,Object(S.b)(e.ir.element).selectNodeContents(n)}else{var r=[],i=n.textContent.substring(0,Object(S.c)(n,e.ir.element).start).replace(a.a.ZWSP,"");a.a.CODE_LANGUAGES.forEach((function(e){e.indexOf(i.toLowerCase())>-1&&r.push({html:e,value:e})})),e.hint.genHTML(r,i,e)}},jt=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&Tt(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout((function(){if(!e.ir.composingLock){var n=s(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&Object(u.a)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}}),800)},_t=function(e,t){var n=Object(S.b)(e.ir.element),r=Object(p.c)(n.startContainer)||n.startContainer;if(r){if(""===t){var i=r.querySelector(".vditor-ir__marker--heading");n.selectNodeContents(i),document.execCommand("delete")}else n.selectNodeContents(r),n.collapse(!0),document.execCommand("insertHTML",!1,t);H(e),pt(e)}},At=function(e,t,n){var r=Object(p.d)(e.startContainer,"data-type",n);if(r){r.firstElementChild.remove(),r.lastElementChild.remove(),e.insertNode(document.createElement("wbr"));var i=document.createElement("div");i.innerHTML=t.lute.SpinVditorIRDOM(r.outerHTML),r.outerHTML=i.firstElementChild.innerHTML.trim()}},Nt=function(e,t,n,r){var i=Object(S.b)(e.ir.element),o=t.getAttribute("data-type"),a=i.startContainer;if(3===a.nodeType&&(a=a.parentElement),t.classList.contains("vditor-menu--current"))if("quote"===o){var l=Object(p.f)(a,"BLOCKQUOTE");l&&(i.insertNode(document.createElement("wbr")),l.outerHTML=""===l.innerHTML.trim()?''+l.innerHTML+"
":l.innerHTML)}else if("link"===o){var s=Object(p.d)(i.startContainer,"data-type","a");if(s){var c=Object(p.e)(i.startContainer,"vditor-ir__link");c?(i.insertNode(document.createElement("wbr")),s.outerHTML=c.innerHTML):s.outerHTML=s.querySelector(".vditor-ir__link").innerHTML+""}}else"italic"===o?At(i,e,"em"):"bold"===o?At(i,e,"strong"):"strike"===o?At(i,e,"s"):"inline-code"===o?At(i,e,"code"):"check"!==o&&"list"!==o&&"ordered-list"!==o||ot(e,i,o);else{0===e.ir.element.childNodes.length&&(e.ir.element.innerHTML='
',Object(S.f)(e.ir.element,i));var d=Object(p.c)(i.startContainer);if("line"===o){if(d){var u='
\n
';""===d.innerHTML.trim()?d.outerHTML=u:d.insertAdjacentHTML("afterend",u)}}else if("quote"===o)d&&(i.insertNode(document.createElement("wbr")),d.outerHTML=''+d.outerHTML+"
");else if("link"===o){var h=void 0;h=""===i.toString()?n+""+r:""+n+i.toString()+r.replace(")",")"),document.execCommand("insertHTML",!1,h)}else if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o){h=void 0;h=""===i.toString()?n+""+r:""+n+i.toString()+""+r,"table"!==o&&"code"!==o||(h="\n"+h),document.execCommand("insertHTML",!1,h),"table"===o&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),Object(S.h)(i))}else"check"!==o&&"list"!==o&&"ordered-list"!==o||ot(e,i,o,!1)}Object(S.f)(e.ir.element,i),jt(e),H(e)},Ht=function(){function e(){var e=this;this.fillEmoji=function(t,n){e.element.style.display="none";var r=t.getAttribute("data-value"),i=0===r.indexOf("@")?"@":":",o=window.getSelection().getRangeAt(0);if("ir"===n.currentMode){var l=Object(p.d)(o.startContainer,"data-type","code-block-info");if(l)return l.textContent=a.a.ZWSP+r.trimRight(),o.selectNodeContents(l),o.collapse(!1),jt(n),l.parentElement.querySelectorAll("code").forEach((function(e){e.className="language-"+r.trimRight()})),O(l.parentElement.querySelector(".vditor-ir__preview"),n),void(e.recentLanguage=r.trimRight())}if("wysiwyg"===n.currentMode&&3!==o.startContainer.nodeType&&o.startContainer.firstElementChild.classList.contains("vditor-input")){var s=o.startContainer.firstElementChild;return s.value=r.trimRight(),o.selectNodeContents(s),o.collapse(!1),s.dispatchEvent(new CustomEvent("input")),void(e.recentLanguage=r.trimRight())}if(o.setStart(o.startContainer,o.startContainer.textContent.lastIndexOf(i)),o.deleteContents(),r.indexOf(":")>-1&&"sv"!==n.currentMode?(Object(S.d)(n.lute.SpinVditorDOM(r),n),o.insertNode(document.createTextNode(" "))):o.insertNode(document.createTextNode(r)),o.collapse(!1),Object(S.h)(o),"wysiwyg"===n.currentMode)(c=Object(p.e)(o.startContainer,"vditor-wysiwyg__block"))&&c.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(c.lastElementChild.innerHTML=c.firstElementChild.innerHTML,O(c.lastElementChild,n));else if("ir"===n.currentMode){var c;(c=Object(p.e)(o.startContainer,"vditor-ir__marker--pre"))&&c.nextElementSibling.classList.contains("vditor-ir__preview")&&(c.nextElementSibling.innerHTML=c.innerHTML,O(c.nextElementSibling,n))}ht(n)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage=""}return e.prototype.render=function(e){var t=this;if(window.getSelection().focusNode){var n,r=getSelection().getRangeAt(0);n=r.startContainer.textContent.substring(0,r.startOffset)||"";var i=this.getKey(n,":"),o=!1;if(void 0===i&&(o=!0,i=this.getKey(n,"@")),void 0===i)this.element.style.display="none",clearTimeout(this.timeId);else if(o&&e.options.hint.at&&(clearTimeout(this.timeId),this.timeId=window.setTimeout((function(){t.genHTML(e.options.hint.at(i),i,e)}),e.options.hint.delay)),!o){var a=""===i?e.options.hint.emoji:e.lute.GetEmojis(),l=[];Object.keys(a).forEach((function(e){0===e.indexOf(i.toLowerCase())&&(a[e].indexOf(".")>-1?l.push({html:' :'+e+":",value:":"+e+":"}):l.push({html:''+a[e]+""+e,value:a[e]}))})),this.genHTML(l,i,e)}}},e.prototype.genHTML=function(e,t,n){var r=this;if(0!==e.length){var i=n[n.currentMode].element,o=Object(S.a)(i),a=o.left+n.outline.element.offsetWidth,l=o.top,s="";e.forEach((function(e,n){if(!(n>7)){var r=e.html;if(""!==t){var i=r.lastIndexOf(">")+1,o=r.substr(i),a=o.toLowerCase().indexOf(t.toLowerCase());a>-1&&(o=o.substring(0,a)+""+o.substring(a,a+t.length)+""+o.substring(a+t.length),r=r.substr(0,i)+o)}s+='"}})),this.element.innerHTML=s;var c=parseInt(document.defaultView.getComputedStyle(i,null).getPropertyValue("line-height"),10);this.element.style.top=l+(c||22)+"px",this.element.style.left=a+"px",this.element.style.display="block",this.element.querySelectorAll("button").forEach((function(e){e.addEventListener("click",(function(t){r.fillEmoji(e,n),t.preventDefault()}))})),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top=l-this.element.offsetHeight+"px")}else this.element.style.display="none"},e.prototype.select=function(e,t){if(0===this.element.querySelectorAll("button").length||"none"===this.element.style.display)return!1;var n=this.element.querySelector(".vditor-hint--current");if("ArrowDown"===e.key)return e.preventDefault(),e.stopPropagation(),n.removeAttribute("class"),n.nextElementSibling?n.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if("ArrowUp"===e.key){if(e.preventDefault(),e.stopPropagation(),n.removeAttribute("class"),n.previousElementSibling)n.previousElementSibling.className="vditor-hint--current";else{var r=this.element.children.length;this.element.children[r-1].className="vditor-hint--current"}return!0}return!(Object(u.d)(e)||e.shiftKey||e.altKey||"Enter"!==e.key)&&(e.preventDefault(),e.stopPropagation(),this.fillEmoji(n,t),!0)},e.prototype.getKey=function(e,t){var n,r=e.split(t),i=r[r.length-1];if(r.length>1&&i.trim()===i)if(2===r.length&&""===r[0]&&r[1].length<32)n=r[1];else{var o=r[r.length-2].slice(-1);" "===Object(l.a)(o)&&i.length<32&&(n=i)}return n},e}(),Dt=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach((function(e){e.classList.remove("vditor-ir__node--expand")}));var n=Object(p.h)(e.startContainer,"vditor-ir__node");n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"));var r=function(e){var t=e.startContainer;if(3===t.nodeType&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&""===n.textContent;)n=n.nextSibling;if(!n){var r=Object(p.e)(t,"vditor-ir__marker");if(r&&!r.nextSibling){var i=t.parentElement.parentElement.nextSibling;if(i&&3!==i.nodeType&&i.classList.contains("vditor-ir__node"))return i}return!1}return!(!n||3===n.nodeType||!n.classList.contains("vditor-ir__node")||n.getAttribute("data-block"))&&n}(e);if(r)return r.classList.add("vditor-ir__node--expand"),void r.classList.remove("vditor-ir__node--hidden");var i=function(e){var t=e.startContainer,n=t.previousSibling;return!(3!==t.nodeType||0!==e.startOffset||!n||3===n.nodeType||!n.classList.contains("vditor-ir__node")||n.getAttribute("data-block"))&&n}(e);return i?(i.classList.add("vditor-ir__node--expand"),void i.classList.remove("vditor-ir__node--hidden")):void 0},Rt=function(){function e(e){this.composingLock=!1;var t=document.createElement("div");t.className="vditor-ir",t.innerHTML='',this.element=t.firstElementChild,this.bindEvent(e),Ce(e,this.element),Te(e,this.element),Ae(e,this.element),Ne(e,this.element),je(e,this.element)}return e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("copy",(function(t){var n=getSelection().getRangeAt(0);if(""!==n.toString()){t.stopPropagation(),t.preventDefault();var r=document.createElement("div");r.appendChild(n.cloneContents()),t.clipboardData.setData("text/plain",e.lute.VditorIRDOM2Md(r.innerHTML).trim()),t.clipboardData.setData("text/html","")}})),this.element.addEventListener("paste",(function(t){Ct(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})})),this.element.addEventListener("compositionstart",(function(e){t.composingLock=!0})),this.element.addEventListener("compositionend",(function(n){Object(u.e)()||k(e,getSelection().getRangeAt(0).cloneRange()),t.composingLock=!1})),this.element.addEventListener("input",(function(n){t.preventInput?t.preventInput=!1:t.composingLock||k(e,getSelection().getRangeAt(0).cloneRange())})),this.element.addEventListener("click",(function(n){if("INPUT"===n.target.tagName)return n.target.checked?n.target.setAttribute("checked","checked"):n.target.removeAttribute("checked"),t.preventInput=!0,void jt(e);var r=Object(S.b)(t.element);if(n.target.isEqualNode(t.element)&&t.element.lastElementChild&&r.collapsed){var i=t.element.lastElementChild.getBoundingClientRect();if(n.y>i.top+i.height)return void("P"===t.element.lastElementChild.tagName?(r.selectNodeContents(t.element.lastElementChild),r.collapse(!1)):(t.element.insertAdjacentHTML("beforeend",''+a.a.ZWSP+"
"),Object(S.f)(t.element,r)))}var o=Object(p.e)(n.target,"vditor-ir__preview");o||(o=Object(p.e)(r.startContainer,"vditor-ir__preview")),o&&(o.previousElementSibling.firstElementChild?r.selectNodeContents(o.previousElementSibling.firstElementChild):r.selectNodeContents(o.previousElementSibling),r.collapse(!0),Object(S.h)(r),_e(e)),Dt(r,e),H(e)})),this.element.addEventListener("keyup",(function(n){if(!n.isComposing&&!Object(u.d)(n))if("Enter"===n.key&&_e(e),H(e),"Backspace"!==n.key&&"Delete"!==n.key||""===e.ir.element.innerHTML||1!==e.ir.element.childNodes.length||!e.ir.element.firstElementChild||"P"!==e.ir.element.firstElementChild.tagName||0!==e.ir.element.firstElementChild.childElementCount||""!==e.ir.element.textContent&&"\n"!==e.ir.element.textContent){var r=Object(S.b)(t.element);"Backspace"===n.key?(Object(u.e)()&&"\n"===r.startContainer.textContent&&1===r.startOffset&&(r.startContainer.textContent="",Dt(r,e)),t.element.querySelectorAll(".language-math").forEach((function(e){var t=e.querySelector("br");t&&t.remove()}))):n.key.indexOf("Arrow")>-1?("ArrowLeft"!==n.key&&"ArrowRight"!==n.key||Tt(e),Dt(r,e)):229===n.keyCode&&""===n.code&&"Unidentified"===n.key&&Dt(r,e);var i=Object(p.e)(r.startContainer,"vditor-ir__preview");if(i){if("ArrowUp"===n.key||"ArrowLeft"===n.key)return i.previousElementSibling.firstElementChild?r.selectNodeContents(i.previousElementSibling.firstElementChild):r.selectNodeContents(i.previousElementSibling),r.collapse(!1),n.preventDefault(),!0;if("SPAN"===i.tagName&&("ArrowDown"===n.key||"ArrowRight"===n.key))return r.selectNodeContents(i.parentElement.lastElementChild),r.collapse(!1),n.preventDefault(),!0}}else e.ir.element.innerHTML=""}))},e}(),It=function(e){return"sv"===e.currentMode?e.lute.Md2HTML(s(e)):"wysiwyg"===e.currentMode?e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML):"ir"===e.currentMode?e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML):void 0},zt=n(23),Pt=n(21),qt=function(){function e(e){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML=''+e+'
\n'}return e.prototype.render=function(e){"block"===this.element.style.display&&("block"===e.preview.element.style.display?Object(Pt.a)(e.preview.element.lastElementChild,this.element.lastElementChild,e):Object(Pt.a)(e[e.currentMode].element,this.element.lastElementChild,e))},e.prototype.toggle=function(e,t){var n;void 0===t&&(t=!0);var r=null===(n=e.toolbar.elements.outline)||void 0===n?void 0:n.firstElementChild;t&&window.innerWidth>=a.a.MOBILE_WIDTH?(this.element.style.display="block",this.render(e),null==r||r.classList.add("vditor-menu--current")):(this.element.style.display="none",null==r||r.classList.remove("vditor-menu--current")),ae(e)},e}(),Bt=n(38),Ut=n.n(Bt),Vt=n(39),Kt=n.n(Vt),Wt=n(18),Ft=function(){function e(e){var t=this;this.element=document.createElement("div"),this.element.className="vditor-preview";var n=document.createElement("div");n.className="vditor-reset",e.options.classes.preview&&n.classList.add(e.options.classes.preview),n.style.maxWidth=e.options.preview.maxWidth+"px",n.addEventListener("copy",(function(n){var r=document.createElement("div");r.className="vditor-reset",r.appendChild(getSelection().getRangeAt(0).cloneContents()),t.copyToX(e,r),n.preventDefault()}));var r=document.createElement("div");r.className="vditor-preview__action",r.innerHTML='\n\n\n\n",this.element.appendChild(r),this.element.appendChild(n),r.addEventListener(Object(u.b)(),(function(i){var o=Object(h.b)(i.target,"BUTTON");if(o){var a=o.getAttribute("data-type");a!==r.querySelector(".vditor-preview__action--current").getAttribute("data-type")&&("mp-wechat"!==a&&"zhihu"!==a?(n.style.width="desktop"===a?"auto":"tablet"===a?"780px":"360px",n.scrollWidth>n.parentElement.clientWidth&&(n.style.width="auto"),t.render(e),r.querySelectorAll("button").forEach((function(e){e.classList.remove("vditor-preview__action--current")})),o.classList.add("vditor-preview__action--current")):t.copyToX(e,t.element.lastElementChild.cloneNode(!0),a))}}))}return e.prototype.render=function(e,t){var n=this;if(clearTimeout(this.mdTimeoutId),"none"!==this.element.style.display)if(t)this.element.lastElementChild.innerHTML=t;else if(""!==s(e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")){var r=(new Date).getTime(),i=s(e);this.mdTimeoutId=window.setTimeout((function(){if(e.options.preview.url){var t=new XMLHttpRequest;t.open("POST",e.options.preview.url),t.setRequestHeader("Content-Type","application/json;charset=UTF-8"),t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE)if(200===t.status){var o=JSON.parse(t.responseText);if(0!==o.code)return void e.tip.show(o.msg);e.options.preview.transform&&(o.data=e.options.preview.transform(o.data)),n.element.lastElementChild.innerHTML=o.data,n.afterRender(e,r)}else{var a=e.lute.Md2HTML(i);e.options.preview.transform&&(a=e.options.preview.transform(a)),n.element.lastElementChild.innerHTML=a,n.afterRender(e,r)}},t.send(JSON.stringify({markdownText:i}))}else{var o=e.lute.Md2HTML(i);e.options.preview.transform&&(o=e.options.preview.transform(o)),n.element.lastElementChild.innerHTML=o,n.afterRender(e,r)}}),e.options.preview.delay)}else this.element.lastElementChild.innerHTML="";else"renderPerformance"===this.element.getAttribute("data-type")&&e.tip.hide()},e.prototype.afterRender=function(e,t){e.options.preview.parse&&e.options.preview.parse(this.element);var n=(new Date).getTime()-t;(new Date).getTime()-t>2600?(e.tip.show(te.a[e.options.lang].performanceTip.replace("${x}",n.toString())),e.preview.element.setAttribute("data-type","renderPerformance")):"renderPerformance"===e.preview.element.getAttribute("data-type")&&(e.tip.hide(),e.preview.element.removeAttribute("data-type")),Object(g.a)(e.preview.element.lastElementChild,e.options.lang),Object(y.a)(e.options.preview.hljs,e.preview.element.lastElementChild,e.options.cdn),Object(w.a)(e.preview.element.lastElementChild,{cdn:e.options.cdn,math:e.options.preview.math}),Object(E.a)(e.preview.element.lastElementChild,".language-mermaid",e.options.cdn),Object(b.a)(e.preview.element.lastElementChild,e.options.cdn),Object(v.a)(e.preview.element.lastElementChild,e.options.cdn),Object(M.a)(e.preview.element.lastElementChild,e.options.cdn),Object(m.a)(e.preview.element.lastElementChild,e.options.cdn),Object(Wt.a)(e.preview.element.lastElementChild)},e.prototype.copyToX=function(e,t,n){void 0===n&&(n="mp-wechat"),"zhihu"!==n?t.querySelectorAll(".katex-html .base").forEach((function(e){e.style.display="initial"})):t.querySelectorAll(".vditor-math").forEach((function(e){e.outerHTML=''})),t.style.backgroundColor="#fff",t.querySelectorAll("code").forEach((function(e){e.style.backgroundImage="none"})),this.element.append(t);var r=t.ownerDocument.createRange();r.selectNode(t),Object(S.h)(r),document.execCommand("copy"),this.element.lastElementChild.remove(),e.tip.show("已复制,可到"+("zhihu"===n?"知乎":"微信公众号平台")+"进行粘贴")},e}(),Jt=n(40),Zt=n.n(Jt),Gt=function(){function e(e){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--"+e.options.resize.position,this.element.innerHTML=""+Zt.a+"
",this.bindEvent(e)}return e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("mousedown",(function(n){var r=document,i=n.clientY,o=e.element.offsetHeight,a=63+e.element.querySelector(".vditor-toolbar").clientHeight;r.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),t.element.classList.add("vditor-resize--selected"),r.onmousemove=function(t){"top"===e.options.resize.position?e.element.style.height=Math.max(a,o+(i-t.clientY))+"px":e.element.style.height=Math.max(a,o+(t.clientY-i))+"px",e.options.typewriterMode&&(e.sv.element.style.paddingBottom=e.sv.element.parentElement.offsetHeight/2+"px")},r.onmouseup=function(){e.options.resize.after&&e.options.resize.after(e.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),r.onmousemove=null,r.onmouseup=null,r.ondragstart=null,r.onselectstart=null,r.onselect=null,t.element.classList.remove("vditor-resize--selected")}}))},e}(),Xt=function(){function e(e){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",e.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(e),Ce(e,this.element),Te(e,this.element),Ae(e,this.element),Ne(e,this.element),je(e,this.element)}return e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault(),e.clipboardData.setData("text/plain",Le(t.element))})),this.element.addEventListener("paste",(function(t){Ct(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})})),this.element.addEventListener("scroll",(function(){if("block"===e.preview.element.style.display){var n=t.element.scrollTop,r=t.element.clientHeight,i=t.element.scrollHeight-parseFloat(t.element.style.paddingBottom||"0"),o=e.preview.element;o.scrollTop=n/r>.5?(n+r)*o.scrollHeight/i-r:n*o.scrollHeight/i}})),this.element.addEventListener("compositionstart",(function(e){t.composingLock=!0})),this.element.addEventListener("compositionend",(function(n){Object(u.e)()||re(e,n),t.composingLock=!1})),this.element.addEventListener("input",(function(n){t.composingLock||(t.preventInput?t.preventInput=!1:re(e,n))})),this.element.addEventListener("click",(function(t){Ve(e)})),this.element.addEventListener("keyup",(function(t){t.isComposing||Object(u.d)(t)||(Ve(e),"Backspace"!==t.key&&"Delete"!==t.key||""===e.sv.element.innerHTML||1!==e.sv.element.childNodes.length||!e.sv.element.firstElementChild||"DIV"!==e.sv.element.firstElementChild.tagName||2!==e.sv.element.firstElementChild.childElementCount||""!==e.sv.element.firstElementChild.textContent&&"\n"!==e.sv.element.textContent||(e.sv.element.innerHTML=""))}))},e}(),Qt=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(e,t){var n=this;if(void 0===t&&(t=6e3),this.element.className="vditor-tip vditor-tip--show",0===t)return this.element.innerHTML='',void this.element.querySelector(".vditor-tip__close").addEventListener("click",(function(){n.hide()}));this.element.innerHTML=''+e+"
",setTimeout((function(){n.hide()}),t)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e}(),$t=function(e,t){if(t.options.preview.mode!==e){switch(t.options.preview.mode=e,e){case"both":t.sv.element.style.display="block",t.preview.element.style.display="block",t.preview.render(t),L(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",x(t.toolbar.elements,["both"])}t.devtools&&t.devtools.renderEchart(t)}},Yt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),en=function(e){function t(t,n){var r=e.call(this,t,n)||this;return"both"===t.options.preview.mode&&r.element.children[0].classList.add("vditor-menu--current"),r.element.children[0].addEventListener(Object(u.b)(),(function(e){r.element.firstElementChild.classList.contains(a.a.CLASS_MENU_DISABLED)||(e.preventDefault(),"sv"===t.currentMode&&("both"===t.options.preview.mode?$t("editor",t):$t("both",t)))})),r}return Yt(t,e),t}(me),tn=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"},nn=n(19),rn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),on=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],o=document.createElement("div");o.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow");var l="";return a.a.CODE_THEME.forEach((function(e){l+=""})),o.innerHTML=''+l+"
",o.addEventListener(Object(u.b)(),(function(e){"BUTTON"===e.target.tagName&&(A(t,["subToolbar"]),t.options.preview.hljs.style=e.target.textContent,Object(nn.a)(e.target.textContent,t.options.cdn),e.preventDefault(),e.stopPropagation())})),r.element.appendChild(o),N(t,o,i,n.level),r}return rn(t,e),t}(me),an=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ln=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],o=document.createElement("div");o.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow");var a="";return Object.keys(t.options.preview.theme.list).forEach((function(e){a+='"})),o.innerHTML=''+a+"
",o.addEventListener(Object(u.b)(),(function(e){"BUTTON"===e.target.tagName&&(A(t,["subToolbar"]),t.options.preview.theme.current=e.target.getAttribute("data-type"),Object(ie.a)(t.options.preview.theme.current,t.options.preview.theme.path),e.preventDefault(),e.stopPropagation())})),r.element.appendChild(o),N(t,o,i,n.level),r}return an(t,e),t}(me),sn=function(){function e(e){this.element=document.createElement("span"),this.element.className="vditor-counter vditor-tooltipped vditor-tooltipped__nw",this.render(e,"")}return e.prototype.render=function(e,t){var n=t.endsWith("\n")?t.length-1:t.length;if("text"===e.options.counter.type&&e[e.currentMode]){var r=e[e.currentMode].element.cloneNode(!0);r.querySelectorAll(".vditor-wysiwyg__preview").forEach((function(e){e.remove()})),n=r.textContent.length}"number"==typeof e.options.counter.max?(n>e.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML=n+"/"+e.options.counter.max):this.element.innerHTML=""+n,this.element.setAttribute("aria-label",e.options.counter.type)},e}(),cn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].innerHTML=n.icon,r.element.children[0].addEventListener(Object(u.b)(),(function(e){e.preventDefault(),n.click()})),r}return cn(t,e),t}(me),un=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),pn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.firstElementChild.addEventListener(Object(u.b)(),(function(e){var n=r.element.firstElementChild;n.classList.contains(a.a.CLASS_MENU_DISABLED)||(e.preventDefault(),n.classList.contains("vditor-menu--current")?(n.classList.remove("vditor-menu--current"),t.devtools.element.style.display="none",ae(t)):(n.classList.add("vditor-menu--current"),t.devtools.element.style.display="block",ae(t),t.devtools.renderEchart(t)))})),r}return un(t,e),t}(me),hn=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"},fn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mn=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=document.createElement("div");i.className="vditor-panel vditor-panel--arrow";var o="";Object.keys(t.options.hint.emoji).forEach((function(e){var n=t.options.hint.emoji[e];n.indexOf(".")>-1?o+='':o+='"}));var a='\n '+(t.options.hint.emojiTail||"")+"\n
";return i.innerHTML=''+o+"
"+a,r.element.appendChild(i),N(t,i,r.element.children[0],n.level),r._bindEvent(t,i),r}return fn(t,e),t.prototype._bindEvent=function(e,t){t.querySelectorAll(".vditor-emojis button").forEach((function(n){n.addEventListener(Object(u.b)(),(function(r){r.preventDefault();var i=n.getAttribute("data-value"),o=Object(S.b)(e[e.currentMode].element),a=i;if("wysiwyg"===e.currentMode?a=e.lute.SpinVditorDOM(i):"ir"===e.currentMode&&(a=e.lute.SpinVditorIRDOM(i)),i.indexOf(":")>-1&&"sv"!==e.currentMode){var l=document.createElement("div");l.innerHTML=a,a=l.firstElementChild.firstElementChild.outerHTML+" ",Object(S.d)(a,e)}else o.insertNode(document.createTextNode(i));o.collapse(!1),Object(S.h)(o),t.style.display="none",ht(e)})),n.addEventListener("mouseover",(function(e){"BUTTON"===e.target.tagName&&(t.querySelector(".vditor-emojis__tip").innerHTML=e.target.getAttribute("data-key"))}))}))},t}(me),vn=function(e,t,n){var r=document.createElement("a");"download"in r?(r.download=n,r.style.display="none",r.href=URL.createObjectURL(new Blob([t])),document.body.appendChild(r),r.click(),r.remove()):e.tip.show(te.a[e.options.lang].downloadTip,0)},gn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),bn=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],o=document.createElement("div");return o.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow"),o.innerHTML='\n\n',o.addEventListener(Object(u.b)(),(function(e){var n=e.target;if("BUTTON"===n.tagName){switch(n.getAttribute("data-type")){case"markdown":!function(e){var t=s(e);vn(e,t,t.substr(0,10)+".md")}(t);break;case"pdf":!function(e){e.tip.show(te.a[e.options.lang].generate,3800);var t=document.querySelector("iframe");t.contentDocument.open(),t.contentDocument.write('\n