diff --git a/README-CN.md b/README-CN.md index e9bb5d6..9d21900 100644 --- a/README-CN.md +++ b/README-CN.md @@ -26,9 +26,9 @@ 快捷键: 基于[Vditor快捷键](shortcut.md)以及更多: -- 将列表上移一行: `Ctrl Alt I` / `⌘ ^ I` -- 将列表下移一行: `Ctrl Alt J` / `⌘ ^ J` -- 在VS Code中编辑: `Ctrl Alt E` / `⌘ ^ E` +- 将列表上移一行: `Ctrl Alt I` / `⌥ ⇧ I` +- 将列表下移一行: `Ctrl Alt J` / `⌥ ⇧ J` +- 在VS Code中编辑: `Ctrl Alt E` / `⌥ ⇧ E` ## 其他功能 diff --git a/README-TW.md b/README-TW.md index d8d976d..a085576 100644 --- a/README-TW.md +++ b/README-TW.md @@ -26,9 +26,9 @@ 快捷鍵: 基於[Vditor快捷鍵](shortcut.md)以及更多: -- 將清單上移一行: `Ctrl Alt I` / `⌘ ^ I` -- 將清單下移一行: `Ctrl Alt J` / `⌘ ^ J` -- 在VS Code中編輯: `Ctrl Alt E` / `⌘ ^ E` +- 將清單上移一行: `Ctrl Alt I` / `⌥ ⇧ I` +- 將清單下移一行: `Ctrl Alt J` / `⌥ ⇧ J` +- 在VS Code中編輯: `Ctrl Alt E` / `⌥ ⇧ E` ## 其他功能 diff --git a/README.md b/README.md index 41a9079..b26d1ef 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ If you want to use the original vscode editor, insert this in your `settings.jso Shortcuts: Base on [Vditor shortcuts](shortcut.md) and more: -- Move list up: `Ctrl Alt I` / `⌘ ^ I` -- Move list down: `Ctrl Alt J` / `⌘ ^ J` -- Edit in VS Code: `Ctrl Alt E` / `⌘ ^ E` +- Move list up: `Ctrl Alt I` / `⌥ ⇧ I` +- Move list down: `Ctrl Alt J` / `⌥ ⇧ J` +- Edit in VS Code: `Ctrl Alt E` / `⌥ ⇧ E` Tips: diff --git a/resource/vditor/vditor.js b/resource/vditor/vditor.js index ce58fb1..1d799f9 100644 --- a/resource/vditor/vditor.js +++ b/resource/vditor/vditor.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Vditor=t():e.Vditor=t()}(this,(()=>(()=>{var e={998:e=>{var t=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=-1;t.Diff=function(e,t){return[e,t]},t.prototype.diff_main=function(e,n,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==n)throw new Error("Null input. (diff_main)");if(e==n)return e?[new t.Diff(0,e)]:[];void 0===r&&(r=!0);var a=r,l=this.diff_commonPrefix(e,n),s=e.substring(0,l);e=e.substring(l),n=n.substring(l),l=this.diff_commonSuffix(e,n);var d=e.substring(e.length-l);e=e.substring(0,e.length-l),n=n.substring(0,n.length-l);var c=this.diff_compute_(e,n,a,o);return s&&c.unshift(new t.Diff(0,s)),d&&c.push(new t.Diff(0,d)),this.diff_cleanupMerge(c),c},t.prototype.diff_compute_=function(e,r,i,o){var a;if(!e)return[new t.Diff(1,r)];if(!r)return[new t.Diff(n,e)];var l=e.length>r.length?e:r,s=e.length>r.length?r:e,d=l.indexOf(s);if(-1!=d)return a=[new t.Diff(1,l.substring(0,d)),new t.Diff(0,s),new t.Diff(1,l.substring(d+s.length))],e.length>r.length&&(a[0][0]=a[2][0]=n),a;if(1==s.length)return[new t.Diff(n,e),new t.Diff(1,r)];var c=this.diff_halfMatch_(e,r);if(c){var u=c[0],p=c[1],m=c[2],f=c[3],h=c[4],v=this.diff_main(u,m,i,o),g=this.diff_main(p,f,i,o);return v.concat([new t.Diff(0,h)],g)}return i&&e.length>100&&r.length>100?this.diff_lineMode_(e,r,o):this.diff_bisect_(e,r,o)},t.prototype.diff_lineMode_=function(e,r,i){var o=this.diff_linesToChars_(e,r);e=o.chars1,r=o.chars2;var a=o.lineArray,l=this.diff_main(e,r,!1,i);this.diff_charsToLines_(l,a),this.diff_cleanupSemantic(l),l.push(new t.Diff(0,""));for(var s=0,d=0,c=0,u="",p="";s=1&&c>=1){l.splice(s-d-c,d+c),s=s-d-c;for(var m=this.diff_main(u,p,!1,i),f=m.length-1;f>=0;f--)l.splice(s,0,m[f]);s+=m.length}c=0,d=0,u="",p=""}s++}return l.pop(),l},t.prototype.diff_bisect_=function(e,r,i){for(var o=e.length,a=r.length,l=Math.ceil((o+a)/2),s=l,d=2*l,c=new Array(d),u=new Array(d),p=0;pi);b++){for(var w=-b+h;w<=b-v;w+=2){for(var E=s+w,k=(L=w==-b||w!=b&&c[E-1]o)v+=2;else if(k>a)h+=2;else if(f){if((C=s+m-w)>=0&&C=(T=o-u[C]))return this.diff_bisectSplit_(e,r,L,k,i)}}for(var S=-b+g;S<=b-y;S+=2){for(var T,C=s+S,_=(T=S==-b||S!=b&&u[C-1]o)y+=2;else if(_>a)g+=2;else if(!f){if((E=s+m-S)>=0&&E=(T=o-T))return this.diff_bisectSplit_(e,r,L,k,i)}}}}return[new t.Diff(n,e),new t.Diff(1,r)]},t.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),d=this.diff_main(o,a,!1,i),c=this.diff_main(l,s,!1,i);return d.concat(c)},t.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,c]:null}var a,l,s,d,c,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],d=a[2],c=a[3]):(d=a[0],c=a[1],l=a[2],s=a[3]),[l,s,d,c,a[4]]):null},t.prototype.diff_cleanupSemantic=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=0,d=0,c=0,u=0;l0?i[o-1]:-1,s=0,d=0,c=0,u=0,a=null,r=!0)),l++;for(r&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l=h?(f>=p.length/2||f>=m.length/2)&&(e.splice(l,0,new t.Diff(0,m.substring(0,f))),e[l-1][1]=p.substring(0,p.length-f),e[l+1][1]=m.substring(f),l++):(h>=p.length/2||h>=m.length/2)&&(e.splice(l,0,new t.Diff(0,p.substring(0,h))),e[l-1][0]=1,e[l-1][1]=m.substring(0,m.length-h),e[l+1][0]=n,e[l+1][1]=p.substring(h),l++),l++}l++}},t.prototype.diff_cleanupSemanticLossless=function(e){function n(e,n){if(!e||!n)return 6;var r=e.charAt(e.length-1),i=n.charAt(0),o=r.match(t.nonAlphaNumericRegex_),a=i.match(t.nonAlphaNumericRegex_),l=o&&r.match(t.whitespaceRegex_),s=a&&i.match(t.whitespaceRegex_),d=l&&r.match(t.linebreakRegex_),c=s&&i.match(t.linebreakRegex_),u=d&&e.match(t.blanklineEndRegex_),p=c&&n.match(t.blanklineStartRegex_);return u||p?5:d||c?4:o&&!l&&s?3:l||s?2:o||a?1:0}for(var r=1;r=p&&(p=m,d=i,c=o,u=a)}e[r-1][1]!=d&&(d?e[r-1][1]=d:(e.splice(r-1,1),r--),e[r][1]=c,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=!1,d=!1,c=!1,u=!1;l0?i[o-1]:-1,c=u=!1),r=!0)),l++;r&&this.diff_cleanupMerge(e)},t.prototype.diff_cleanupMerge=function(e){e.push(new t.Diff(0,""));for(var r,i=0,o=0,a=0,l="",s="";i1?(0!==o&&0!==a&&(0!==(r=this.diff_commonPrefix(s,l))&&(i-o-a>0&&0==e[i-o-a-1][0]?e[i-o-a-1][1]+=s.substring(0,r):(e.splice(0,0,new t.Diff(0,s.substring(0,r))),i++),s=s.substring(r),l=l.substring(r)),0!==(r=this.diff_commonSuffix(s,l))&&(e[i][1]=s.substring(s.length-r)+e[i][1],s=s.substring(0,s.length-r),l=l.substring(0,l.length-r))),i-=o+a,e.splice(i,o+a),l.length&&(e.splice(i,0,new t.Diff(n,l)),i++),s.length&&(e.splice(i,0,new t.Diff(1,s)),i++),i++):0!==i&&0==e[i-1][0]?(e[i-1][1]+=e[i][1],e.splice(i,1)):i++,a=0,o=0,l="",s=""}""===e[e.length-1][1]&&e.pop();var d=!1;for(i=1;it));r++)a=i,l=o;return e.length!=r&&e[r][0]===n?l:l+(t-a)},t.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,i=//g,a=/\n/g,l=0;l");switch(s){case 1:t[l]=''+d+"";break;case n:t[l]=''+d+"";break;case 0:t[l]=""+d+""}}return t.join("")},t.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,d,c=1<=f;g--){var y=r[e.charAt(g-1)];if(v[g]=0===m?(v[g+1]<<1|1)&y:(v[g+1]<<1|1)&y|(u[g+1]|u[g])<<1|1|u[g+1],v[g]&c){var b=o(m,g-1);if(b<=a){if(a=b,!((l=g-1)>n))break;f=Math.max(1,2*n-l)}}}if(o(m+1,n)>a)break;u=v}return l},t.prototype.match_alphabet_=function(e){for(var t={},n=0;n2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&"object"==typeof e&&void 0===r&&void 0===i)a=e,o=this.diff_text1(a);else if("string"==typeof e&&r&&"object"==typeof r&&void 0===i)o=e,a=r;else{if("string"!=typeof e||"string"!=typeof r||!i||"object"!=typeof i)throw new Error("Unknown call format to patch_make.");o=e,a=i}if(0===a.length)return[];for(var l=[],s=new t.patch_obj,d=0,c=0,u=0,p=o,m=o,f=0;f=2*this.Patch_Margin&&d&&(this.patch_addContext_(s,p),l.push(s),s=new t.patch_obj,d=0,p=m,c=u)}1!==h&&(c+=v.length),h!==n&&(u+=v.length)}return d&&(this.patch_addContext_(s,p),l.push(s)),l},t.prototype.patch_deepCopy=function(e){for(var n=[],r=0;rthis.Match_MaxBits?-1!=(l=this.match_main(t,c.substring(0,this.Match_MaxBits),d))&&(-1==(u=this.match_main(t,c.substring(c.length-this.Match_MaxBits),d+c.length-this.Match_MaxBits))||l>=u)&&(l=-1):l=this.match_main(t,c,d),-1==l)o[a]=!1,i-=e[a].length2-e[a].length1;else if(o[a]=!0,i=l-d,c==(s=-1==u?t.substring(l,l+c.length):t.substring(l,u+this.Match_MaxBits)))t=t.substring(0,l)+this.diff_text2(e[a].diffs)+t.substring(l+c.length);else{var p=this.diff_main(c,s,!1);if(c.length>this.Match_MaxBits&&this.diff_levenshtein(p)/c.length>this.Patch_DeleteThreshold)o[a]=!1;else{this.diff_cleanupSemanticLossless(p);for(var m,f=0,h=0;ha[0][1].length){var l=n-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 t.Diff(0,r)),o.length1+=n,o.length2+=n;else if(n>a[a.length-1][1].length){l=n-a[a.length-1][1].length;a[a.length-1][1]+=r.substring(0,l),o.length1+=l,o.length2+=l}return r},t.prototype.patch_splitMax=function(e){for(var r=this.Match_MaxBits,i=0;i2*r?(d.length1+=p.length,a+=p.length,c=!1,d.diffs.push(new t.Diff(u,p)),o.diffs.shift()):(p=p.substring(0,r-d.length1-this.Patch_Margin),d.length1+=p.length,a+=p.length,0===u?(d.length2+=p.length,l+=p.length):c=!1,d.diffs.push(new t.Diff(u,p)),p==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(p.length))}s=(s=this.diff_text2(d.diffs)).substring(s.length-this.Patch_Margin);var m=this.diff_text1(o.diffs).substring(0,this.Patch_Margin);""!==m&&(d.length1+=m.length,d.length2+=m.length,0!==d.diffs.length&&0===d.diffs[d.diffs.length-1][0]?d.diffs[d.diffs.length-1][1]+=m:d.diffs.push(new t.Diff(0,m))),c||e.splice(++i,0,d)}}},t.prototype.patch_toText=function(e){for(var t=[],n=0;n{"use strict";n.d(t,{default:()=>H});var r=n(108),i=n(687),o=n(900),a=n(663),l=n(600),s=n(407),d=n(376),c=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)})))},u=n(876),p=n(924),m=n(512),f=n(430),h=n(442),v=n(667),g=n(357),y=n(557),b=n(901),w=n(514),E=n(29),k=n(136),S=n(183),T=function(e,t){if(void 0===t&&(t="zh_CN"),"undefined"!=typeof speechSynthesis&&"undefined"!=typeof SpeechSynthesisUtterance){var n='',r='';document.getElementById("vditorIconScript")||(n='',r='');var i=document.querySelector(".vditor-speech");if(!i){(i=document.createElement("div")).className="vditor-speech",document.body.insertAdjacentElement("beforeend",i);var o=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=o);var a=o();i.onclick=function(){if("vditor-speech"===i.className){var e=new SpeechSynthesisUtterance(i.getAttribute("data-text"));e.voice=a,e.onend=function(){i.className="vditor-speech",speechSynthesis.cancel(),i.innerHTML=n},speechSynthesis.speak(e),i.className="vditor-speech vditor-speech--current",i.innerHTML=r}else speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),i.innerHTML=r):(speechSynthesis.pause(),i.innerHTML=n));(0,S.jl)(window.vditorSpeechRange)},document.body.addEventListener("click",(function(){""===getSelection().toString().trim()&&"block"===i.style.display&&(i.className="vditor-speech",speechSynthesis.cancel(),i.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();i.innerHTML=n,i.style.display="block",i.style.top=r.top+r.height+document.querySelector("html").scrollTop-20+"px",i.style.left=e.screenX+2+"px",i.setAttribute("data-text",t)}else"block"===i.style.display&&(i.className="vditor-speech",i.style.display="none")}))}},C=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())}))},_=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]{"use strict";n.d(t,{Y:()=>i,g:()=>r});var r="3.8.19",i=function(){function e(){}return e.ZWSP="​",e.DROP_EDITOR="application/editor",e.MOBILE_WIDTH=520,e.CLASS_MENU_DISABLED="vditor-menu--disabled",e.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],e.CODE_THEME=["abap","algol","algol_nu","arduino","autumn","borland","bw","colorful","dracula","emacs","friendly","fruity","github","igor","lovelace","manni","monokai","monokailight","murphy","native","paraiso-dark","paraiso-light","pastie","perldoc","pygments","rainbow_dash","rrt","solarized-dark","solarized-dark256","solarized-light","swapoff","tango","trac","vim","vs","xcode","ant-design"],e.CODE_LANGUAGES=["mermaid","echarts","mindmap","plantuml","abc","graphviz","flowchart","apache","js","ts","html","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica","solidity","yul"],e.CDN="https://unpkg.com/vscode-vditor@3.8.19",e.MARKDOWN_OPTIONS={autoSpace:!1,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},e.HLJS_OPTIONS={enable:!0,lineNumber:!1,style:"github"},e.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},e.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"css/content-theme"},e}()},108:(e,t,n)=>{"use strict";n.d(t,{$:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.Y.CDN);var n=o.abcRenderAdapter.getElements(e);n.length>0&&(0,i.Z)(t+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript").then((function(){n.forEach((function(e){e.parentElement.classList.contains("vditor-wysiwyg__pre")||e.parentElement.classList.contains("vditor-ir__marker--pre")||"true"!==e.getAttribute("data-processed")&&(ABCJS.renderAbc(e,o.abcRenderAdapter.getCode(e).trim()),e.style.overflowX="auto",e.setAttribute("data-processed","true"))}))}))}},687:(e,t,n)=>{"use strict";n.r(t),n.d(t,{abcRenderAdapter:()=>l,chartRenderAdapter:()=>a,flowchartRenderAdapter:()=>d,graphvizRenderAdapter:()=>s,mathRenderAdapter:()=>r,mermaidRenderAdapter:()=>i,mindmapRenderAdapter:()=>o,plantumlRenderAdapter:()=>c});var r={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-math")}},i={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-mermaid")}},o={getCode:function(e){return e.getAttribute("data-code")},getElements:function(e){return e.querySelectorAll(".language-mindmap")}},a={getCode:function(e){return e.innerText},getElements:function(e){return e.querySelectorAll(".language-echarts")}},l={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-abc")}},s={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-graphviz")}},d={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-flowchart")}},c={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-plantuml")}}},900:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.Y.CDN);var a=o.chartRenderAdapter.getElements(e);a.length>0&&(0,i.Z)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){a.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=o.chartRenderAdapter.getCode(e).trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var r=JSON.parse(t);echarts.init(e,"dark"===n?"dark":void 0).setOption(r),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="echarts render error:
"+t}}}))}))}},663:(e,t,n)=>{"use strict";n.d(t,{o:()=>i});var r=n(435),i=function(e){e.querySelectorAll("pre > code").forEach((function(t,n){var i,o,a;if(!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math")||t.style.maxHeight.indexOf("px")>-1||e.classList.contains("vditor-preview")&&n>5)){var l=t.innerText;if(t.classList.contains("highlight-chroma")){var s=document.createElement("code");s.innerHTML=t.innerHTML,s.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),l=s.innerText}var d='';document.getElementById("vditorIconScript")||(d='');var c=document.createElement("div");c.className="vditor-copy",c.innerHTML='"+d+"";var u=document.createElement("textarea");u.value=(0,r.p)(l),c.insertAdjacentElement("afterbegin",u),t.before(c),t.style.maxHeight=window.outerHeight-40+"px"}}))}},600:(e,t,n)=>{"use strict";n.d(t,{D:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t){void 0===t&&(t=r.Y.CDN);var n=o.flowchartRenderAdapter.getElements(e);0!==n.length&&(0,i.Z)(t+"/dist/js/flowchart.js/flowchart.min.js","vditorFlowchartScript").then((function(){n.forEach((function(e){if("true"!==e.getAttribute("data-processed")){var t=flowchart.parse(o.flowchartRenderAdapter.getCode(e));e.innerHTML="",t.drawSVG(e),e.setAttribute("data-processed","true")}}))}))}},407:(e,t,n)=>{"use strict";n.d(t,{m:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t){void 0===t&&(t=r.Y.CDN);var n=o.graphvizRenderAdapter.getElements(e);0!==n.length&&(0,i.Z)(t+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then((function(){n.forEach((function(e){var t=o.graphvizRenderAdapter.getCode(e);if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&"true"!==e.getAttribute("data-processed")&&""!==t.trim()){try{var n=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(n),i=new Worker(r);new Viz({worker:i}).renderSVGElement(t).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error:
"+t,e.className="vditor-reset--error"}))}catch(e){console.error("graphviz error",e)}e.setAttribute("data-processed","true")}}))}))}},376:(e,t,n)=>{"use strict";n.d(t,{$:()=>a});var r=n(357),i=n(901),o=n(477),a=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n=r.Y.CDN);var a=e.style;r.Y.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(),(0,o.T)(n+"/dist/js/highlight.js/styles/"+a+".css","vditorHljsStyle"),!1!==e.enable)&&(0!==t.querySelectorAll("pre > code").length&&(0,i.Z)(n+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript").then((function(){(0,i.Z)(n+"/dist/js/highlight.js/solidity.min.js","vditorHljsSolidityScript").then((function(){(0,i.Z)(n+"/dist/js/highlight.js/yul.min.js","vditorHljsYulScript").then((function(){t.querySelectorAll("pre > code").forEach((function(t){if(!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(hljs.highlightElement(t),e.lineNumber)){t.classList.add("vditor-linenumber");var n=t.querySelector(".vditor-linenumber__temp");n||((n=document.createElement("div")).className="vditor-linenumber__temp",t.insertAdjacentElement("beforeend",n));var r=getComputedStyle(t).whiteSpace,i=!1;"pre-wrap"!==r&&"pre-line"!==r||(i=!0);var 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)}}))}))}))})))}},876:(e,t,n)=>{"use strict";n.d(t,{T:()=>s});var r=n(357),i=n(901),o=n(477),a=n(435),l=n(687),s=function(e,t){var n=l.mathRenderAdapter.getElements(e);if(0!==n.length){var s={cdn:r.Y.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(t&&t.math&&(t.math=Object.assign({},s.math,t.math)),"KaTeX"===(t=Object.assign({},s,t)).math.engine){var d=t.extPath||t.cdn;(0,o.T)(d+"/dist/js/katex/katex.min.css","vditorKatexStyle"),(0,i.Z)(d+"/dist/js/katex/katex.min.js","vditorKatexScript").then((function(){(0,i.Z)(d+"/dist/js/katex/mhchem.min.js","vditorKatexChemScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&!e.getAttribute("data-math")){var t=(0,a.p)(l.mathRenderAdapter.getCode(e));e.setAttribute("data-math",t);try{e.innerHTML=katex.renderToString(t,{displayMode:"DIV"===e.tagName,strict:!1,throwOnError:!1,output:"html"})}catch(t){e.innerHTML=t.message,e.className="language-math vditor-reset--error"}e.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault();var t=e.currentTarget.closest(".language-math");e.clipboardData.setData("text/html",t.innerHTML),e.clipboardData.setData("text/plain",t.getAttribute("data-math"))}))}}))}))}))}else if("MathJax"===t.math.engine){window.MathJax||(window.MathJax={loader:{paths:{mathjax:t.cdn+"/dist/js/mathjax"}},startup:{typeset:!1},tex:{macros:t.math.macros}}),(0,i.U)(t.cdn+"/dist/js/mathjax/tex-svg-full.js","protyleMathJaxScript");var c=function(e,t){var n=(0,a.p)(e.textContent).trim(),r=window.MathJax.getMetricsFor(e);r.display="DIV"===e.tagName,window.MathJax.tex2svgPromise(n,r).then((function(r){e.innerHTML="",e.setAttribute("data-math",n),e.append(r),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var i=r.querySelector('[data-mml-node="merror"]');i&&""!==i.textContent.trim()&&(e.innerHTML=i.textContent.trim(),e.className="vditor-reset--error"),t&&t()}))};window.MathJax.startup.promise.then((function(){for(var e=[],t=function(t){var r=n[t];r.parentElement.classList.contains("vditor-wysiwyg__pre")||r.parentElement.classList.contains("vditor-ir__marker--pre")||r.getAttribute("data-math")||!(0,a.p)(r.textContent).trim()||e.push((function(e){t===n.length-1?c(r):c(r,e)}))},r=0;r{"use strict";n.d(t,{l:()=>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+)/),d=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()):d&&d[1]&&(e.insertAdjacentHTML("afterend",''),e.remove())}(e,t))}))}},512:(e,t,n)=>{"use strict";n.d(t,{e:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t,n){void 0===t&&(t=r.Y.CDN);var a=o.mermaidRenderAdapter.getElements(e);0!==a.length&&(0,i.Z)(t+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then((function(){var e={altFontFamily:"sans-serif",flowchart:{htmlLabels:!0,useMaxWidth:!0},fontFamily:"sans-serif",gantt:{leftPadding:75,rightPadding:20},securityLevel:"loose",sequence:{boxMargin:8,diagramMarginX:8,diagramMarginY:8,useMaxWidth:!0},startOnLoad:!1};"dark"===n&&(e.theme="dark",e.themeVariables={activationBkgColor:"hsl(180, 1.5873015873%, 28.3529411765%)",activationBorderColor:"#81B1DB",activeTaskBkgColor:"#81B1DB",activeTaskBorderColor:"#ffffff",actorBkg:"#1f2020",actorBorder:"#81B1DB",actorLineColor:"lightgrey",actorTextColor:"lightgrey",altBackground:"hsl(0, 0%, 40%)",altSectionBkgColor:"#333",arrowheadColor:"lightgrey",background:"#333",border1:"#81B1DB",border2:"rgba(255, 255, 255, 0.25)",classText:"#e0dfdf",clusterBkg:"hsl(180, 1.5873015873%, 28.3529411765%)",clusterBorder:"rgba(255, 255, 255, 0.25)",critBkgColor:"#E83737",critBorderColor:"#E83737",darkTextColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",defaultLinkColor:"lightgrey",doneTaskBkgColor:"lightgrey",doneTaskBorderColor:"grey",edgeLabelBackground:"hsl(0, 0%, 34.4117647059%)",errorBkgColor:"#a44141",errorTextColor:"#ddd",fillType0:"#1f2020",fillType1:"hsl(180, 1.5873015873%, 28.3529411765%)",fillType2:"hsl(244, 1.5873015873%, 12.3529411765%)",fillType3:"hsl(244, 1.5873015873%, 28.3529411765%)",fillType4:"hsl(116, 1.5873015873%, 12.3529411765%)",fillType5:"hsl(116, 1.5873015873%, 28.3529411765%)",fillType6:"hsl(308, 1.5873015873%, 12.3529411765%)",fillType7:"hsl(308, 1.5873015873%, 28.3529411765%)",fontFamily:'"trebuchet ms", verdana, arial',fontSize:"16px",gridColor:"lightgrey",labelBackground:"#181818",labelBoxBkgColor:"#1f2020",labelBoxBorderColor:"#81B1DB",labelColor:"#ccc",labelTextColor:"lightgrey",lineColor:"lightgrey",loopTextColor:"lightgrey",mainBkg:"#1f2020",mainContrastColor:"lightgrey",nodeBkg:"#1f2020",nodeBorder:"#81B1DB",noteBkgColor:"#fff5ad",noteBorderColor:"rgba(255, 255, 255, 0.25)",noteTextColor:"#1f2020",primaryBorderColor:"hsl(180, 0%, 2.3529411765%)",primaryColor:"#1f2020",primaryTextColor:"#e0dfdf",secondBkg:"hsl(180, 1.5873015873%, 28.3529411765%)",secondaryBorderColor:"hsl(180, 0%, 18.3529411765%)",secondaryColor:"hsl(180, 1.5873015873%, 28.3529411765%)",secondaryTextColor:"rgb(183.8476190475, 181.5523809523, 181.5523809523)",sectionBkgColor:"hsl(52.9411764706, 28.813559322%, 58.431372549%)",sectionBkgColor2:"#EAE8D9",sequenceNumberColor:"black",signalColor:"lightgrey",signalTextColor:"lightgrey",taskBkgColor:"hsl(180, 1.5873015873%, 35.3529411765%)",taskBorderColor:"#ffffff",taskTextClickableColor:"#003163",taskTextColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",taskTextDarkColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",taskTextLightColor:"lightgrey",taskTextOutsideColor:"lightgrey",tertiaryBorderColor:"hsl(20, 0%, 2.3529411765%)",tertiaryColor:"hsl(20, 1.5873015873%, 12.3529411765%)",tertiaryTextColor:"rgb(222.9999999999, 223.6666666666, 223.9999999999)",textColor:"#ccc",titleColor:"#F9FFFE",todayLineColor:"#DB5757"}),mermaid.initialize(e),a.forEach((function(e){var t=o.mermaidRenderAdapter.getCode(e);"true"!==e.getAttribute("data-processed")&&""!==t.trim()&&(mermaid.init(void 0,e),e.setAttribute("data-processed","true"))}))}))}},430:(e,t,n)=>{"use strict";n.d(t,{l:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.Y.CDN);var a=o.mindmapRenderAdapter.getElements(e);a.length>0&&(0,i.Z)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){a.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=o.mindmapRenderAdapter.getCode(e);if(t)try{if("true"===e.getAttribute("data-processed"))return;echarts.init(e,"dark"===n?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(t))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(e,t){var n;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.children)?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="mindmap render error:
"+t}}}))}))}},442:(e,t,n)=>{"use strict";n.d(t,{N:()=>o});var r=n(472),i=n(876),o=function(e,t,n){var o="",a=[];if(Array.from(e.children).forEach((function(e,t){if((0,r.c)(e)){if(n){var i=e.id.lastIndexOf("_");e.id=e.id.substring(0,-1===i?void 0:i)+"_"+t}a.push(e.id),o+=e.outerHTML.replace("","")}})),""===o)return t.innerHTML="","";var l=document.createElement("div");if(n)n.lute.SetToC(!0),"wysiwyg"!==n.currentMode||n.preview.element.contains(e)?"ir"!==n.currentMode||n.preview.element.contains(e)?l.innerHTML=n.lute.HTML2VditorDOM("

[ToC]

"+o):l.innerHTML=n.lute.SpinVditorIRDOM("

[ToC]

"+o):l.innerHTML=n.lute.SpinVditorDOM("

[ToC]

"+o),n.lute.SetToC(n.options.preview.markdown.toc);else{t.classList.add("vditor-outline");var s=Lute.New();s.SetToC(!0),l.innerHTML=s.HTML2VditorDOM("

[ToC]

"+o)}var d=l.firstElementChild.querySelectorAll("li > span[data-target-id]");return d.forEach((function(e,t){if(e.nextElementSibling&&"UL"===e.nextElementSibling.tagName){var n="";document.getElementById("vditorIconScript")||(n=''),e.innerHTML=n+""+e.innerHTML+""}else e.innerHTML=""+e.innerHTML+"";e.setAttribute("data-target-id",a[t])})),o=l.firstElementChild.innerHTML,0===d.length?(t.innerHTML="",o):(t.innerHTML=o,n&&(0,i.T)(t,{cdn:n.options.cdn,extPath:n.options.extPath,math:n.options.preview.math}),t.firstElementChild.addEventListener("click",(function(r){for(var i=r.target;i&&!i.isEqualNode(t);){if(i.classList.contains("vditor-outline__action")){i.classList.contains("vditor-outline__action--close")?(i.classList.remove("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:block")):(i.classList.add("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:none")),r.preventDefault(),r.stopPropagation();break}if(i.getAttribute("data-target-id")){r.preventDefault(),r.stopPropagation();var o=document.getElementById(i.getAttribute("data-target-id"));if(!o)return;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{"use strict";n.d(t,{M:()=>a});var r=n(357),i=n(901),o=n(687),a=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.Y.CDN);var n=o.plantumlRenderAdapter.getElements(e);0!==n.length&&(0,i.Z)(t+"/dist/js/plantuml/plantuml-encoder.min.js","vditorPlantumlScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=o.plantumlRenderAdapter.getCode(e).trim();if(t)try{e.innerHTML=''}catch(t){e.className="vditor-reset--error",e.innerHTML="plantuml render error:
"+t}}}))}))}},136:(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var r=function(e){var t=Lute.New();return t.PutEmojis(e.emojis),t.SetEmojiSite(e.emojiSite),t.SetHeadingAnchor(e.headingAnchor),t.SetInlineMathAllowDigitAfterOpenMarker(e.inlineMathDigit),t.SetAutoSpace(e.autoSpace),t.SetToC(e.toc),t.SetFootnotes(e.footnotes),t.SetFixTermTypo(e.fixTermTypo),t.SetVditorCodeBlockPreview(e.codeBlockPreview),t.SetVditorMathBlockPreview(e.mathBlockPreview),t.SetSanitize(e.sanitize),t.SetChineseParagraphBeginningSpace(e.paragraphBeginningSpace),t.SetRenderListStyle(e.listStyle),t.SetLinkBase(e.linkBase),t.SetLinkPrefix(e.linkPrefix),t.SetMark(e.mark),e.lazyLoadImage&&t.SetImageLazyLoading(e.lazyLoadImage),t}},170:(e,t,n)=>{"use strict";n.d(t,{o:()=>r});var r=function(e,t,n){void 0===t&&(t="zh_CN"),void 0===n&&(n="classic");var r=e.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'
\n
\n \n \n '+window.VditorI18n.spin+"\n \n \n X  "+window.VditorI18n.close+'\n \n
\n
\n \n
\n
'),document.body.style.overflow="hidden";var i=document.querySelector(".vditor-img img"),o="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+Math.max(0,window.innerHeight-36-e.naturalHeight)/2+"px, 0)";setTimeout((function(){i.setAttribute("style","transition: transform .3s ease-in-out;transform: "+o),setTimeout((function(){i.parentElement.scrollTo((i.parentElement.scrollWidth-i.parentElement.clientWidth)/2,(i.parentElement.scrollHeight-i.parentElement.clientHeight)/2)}),400)}));var a=document.querySelector(".vditor-img__btn");a.addEventListener("click",(function(){var t=parseInt(a.getAttribute("data-deg"),10)+90;t/90%2==1&&e.naturalWidth>i.parentElement.clientHeight?i.style.transform="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+(e.naturalWidth/2-e.naturalHeight/2)+"px, 0) rotateZ("+t+"deg)":i.style.transform=o+" rotateZ("+t+"deg)",a.setAttribute("data-deg",t.toString()),setTimeout((function(){i.parentElement.scrollTo((i.parentElement.scrollWidth-i.parentElement.clientWidth)/2,(i.parentElement.scrollHeight-i.parentElement.clientHeight)/2)}),400)}))}},417:(e,t,n)=>{"use strict";n.d(t,{h:()=>o});var r=n(357),i=n(477),o=function(e,t){void 0===t&&(t=r.Y.CDN),r.Y.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(),(0,i.T)(o,"vditorHljsStyle")):(0,i.T)(o,"vditorHljsStyle")}},557:(e,t,n)=>{"use strict";n.d(t,{H:()=>i});var r=n(477),i=function(e,t){if(e&&t){var n=document.getElementById("vditorContentTheme"),i=t+"/"+e+".css";n?n.getAttribute("href")!==i&&(n.remove(),(0,r.T)(i,"vditorContentTheme")):(0,r.T)(i,"vditorContentTheme")}}},901:(e,t,n)=>{"use strict";n.d(t,{U:()=>r,Z:()=>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()}}))}},477:(e,t,n)=>{"use strict";n.d(t,{T:()=>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)}}},435:(e,t,n)=>{"use strict";n.d(t,{p:()=>r});var r=function(e){return e.replace(/\u00a0/g," ")}},849:(e,t,n)=>{"use strict";n.d(t,{D:()=>o,H8:()=>d,_0:()=>l,fG:()=>s,gm:()=>i,nr:()=>r,y3:()=>a});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.indexOf("⇧")>-1&&i()&&(e=e.replace(";",":").replace("=","+").replace("-","_")):(e=(e=e.startsWith("⌘")?e.replace("⌘","⌘+"):e.startsWith("⌥")&&"⌘"!==e.substr(1,1)?e.replace("⌥","⌥+"):e.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+")).replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt")).indexOf("Shift")>-1&&(e=e.replace(";",":").replace("=","+").replace("-","_")),e},d=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},514:(e,t,n)=>{"use strict";n.d(t,{Ab:()=>o,KJ:()=>c,KR:()=>a,Rp:()=>u,Th:()=>l,XW:()=>i,_Y:()=>d,pt:()=>s});var r=n(472),i=function(e,t){for(var n=c(e,t),r=!1,i=!1;n&&!n.classList.contains("vditor-reset")&&!i;)(r=c(n.parentElement,t))?n=r:i=!0;return n||!1},o=function(e,t){for(var n=(0,r.f)(e,t),i=!1,o=!1;n&&!n.classList.contains("vditor-reset")&&!o;)(i=(0,r.f)(n.parentElement,t))?n=i:o=!0;return n||!1},a=function(e){var t=o(e,"UL"),n=o(e,"OL"),r=t;return n&&(!t||t&&n.contains(t))&&(r=n),r},l=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},s=function(e){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);var t=e,n=!1,r=l(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},c=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},u=function(e){for(;e&&e.lastChild;)e=e.lastChild;return e}},472:(e,t,n)=>{"use strict";n.d(t,{c:()=>i,f:()=>r});var r=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)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}},29:(e,t,n)=>{"use strict";n.d(t,{h:()=>r});var r=function(){for(var e=[],t=0;t{"use strict";n.d(t,{Co:()=>s,ED:()=>c,Ey:()=>l,Fm:()=>u,RN:()=>a,Z2:()=>m,ir:()=>p,jl:()=>d});var r=n(357),i=n(849),o=n(514),a=function(e){var t,n=e[e.currentMode].element;return getSelection().rangeCount>0&&(t=getSelection().getRangeAt(0),n.isEqualNode(t.startContainer)||n.contains(t.startContainer))?t:e[e.currentMode].range?e[e.currentMode].range:(n.focus(),(t=n.ownerDocument.createRange()).setStart(n,0),t.collapse(!0),t)},l=function(e){var t=window.getSelection().getRangeAt(0);if(!e.contains(t.startContainer)&&!(0,o.KJ)(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)},d=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)},c=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 c=r+o.textContent.length;if(!a&&e>=r&&e<=c&&(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<=c&&(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=c,o=n.childNodes[++i]}return!l&&n.childNodes[i-1]&&s.setStartBefore(n.childNodes[i-1]),d(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),d(t),!(0,i.H8)()||"EM"!==n.previousElementSibling.tagName&&"STRONG"!==n.previousElementSibling.tagName&&"S"!==n.previousElementSibling.tagName||(t.insertNode(document.createTextNode(r.Y.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(),d(t)}},m=function(e,t){var n=document.createElement("div");n.innerHTML=e;var r=n.querySelectorAll("p");1===r.length&&!r[0].previousSibling&&!r[0].nextSibling&&t[t.currentMode].element.children.length>0&&"P"===n.firstElementChild.tagName&&(e=r[0].innerHTML.trim());var i=document.createElement("div");i.innerHTML=e;var l=a(t);if(""!==l.toString()&&(t[t.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),i.firstElementChild&&"0"===i.firstElementChild.getAttribute("data-block")){i.lastElementChild.insertAdjacentHTML("beforeend","");var s=(0,o.pt)(l.startContainer);s?s.insertAdjacentHTML("afterend",i.innerHTML):t[t.currentMode].element.insertAdjacentHTML("beforeend",i.innerHTML),p(t[t.currentMode].element,l)}else{var c=document.createElement("template");c.innerHTML=e,l.insertNode(c.content.cloneNode(!0)),l.collapse(!1),d(l)}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.d(r,{default:()=>Gn});var e=n(131),t=n(357),i=n(435),o=function(e){return"sv"===e.currentMode?(0,i.p)((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):""},a=n(901),l=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&&(0,a.Z)(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(o(e))),initialTreeDepth:-1,label:{align:"left",backgroundColor:"rgba(68, 77, 86, .68)",borderRadius:3,color:"#d1d5da",fontSize:12,lineHeight:12,offset:[9,12],padding:[2,4,2,4],position:"top",verticalAlign:"middle"},lineStyle:{color:"#4285f4",type:"curve",width:1},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}(),s=n(849),d=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")}}))},c=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")}}))},u=function(e,n){n.forEach((function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(t.Y.CLASS_MENU_DISABLED)&&r.classList.remove(t.Y.CLASS_MENU_DISABLED)}}))},p=function(e,n){n.forEach((function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(t.Y.CLASS_MENU_DISABLED)&&r.classList.add(t.Y.CLASS_MENU_DISABLED)}}))},m=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="none")}))},f=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="block")}))},h=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")},v=function(e,n,r,i){r.addEventListener((0,s.y3)(),(function(i){i.preventDefault(),i.stopPropagation(),r.classList.contains(t.Y.CLASS_MENU_DISABLED)||(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach((function(e){e.classList.remove("vditor-hint--current")})),"block"===n.style.display?n.style.display="none":(h(e,["subToolbar","hint","popover"],r.parentElement.parentElement),r.classList.contains("vditor-tooltipped")||r.classList.add("vditor-hint--current"),n.style.display="block",e.toolbar.element.getBoundingClientRect().right-r.getBoundingClientRect().right<250?n.classList.add("vditor-panel--left"):n.classList.remove("vditor-panel--left")))}))},g=n(514),y=n(472),b=function(e,t,n,r){r&&console.log(e+" - "+n+": "+t)},w=n(108),E=n(900),k=n(663),S=n(600),T=n(407),C=n(376),_=n(876),L=n(512),M=n(430),x=n(667),A=function(e,t){if(e)if("html-block"!==e.parentElement.getAttribute("data-type")){var n=e.firstElementChild.className.replace("language-","");n&&("abc"===n?(0,w.$)(e,t.options.cdn):"mermaid"===n?(0,L.e)(e,t.options.cdn,t.options.theme):"flowchart"===n?(0,S.D)(e,t.options.cdn):"echarts"===n?(0,E.v)(e,t.options.cdn,t.options.theme):"mindmap"===n?(0,M.l)(e,t.options.cdn,t.options.theme):"plantuml"===n?(0,x.M)(e,t.options.cdn):"graphviz"===n?(0,T.m)(e,t.options.cdn):"math"===n?(0,_.T)(e,{cdn:t.options.cdn,extPath:t.options.extPath,math:t.options.preview.math}):((0,C.$)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,k.o)(e)),e.setAttribute("data-render","1"))}else e.setAttribute("data-render","1")},N=n(183),H=function(e){if("sv"!==e.currentMode){var t=e[e.currentMode].element,n=e.outline.render(e);""===n&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach((function(t){t.innerHTML=n,(0,_.T)(t,{cdn:e.options.cdn,extPath:e.options.extPath,math:e.options.preview.math})}))}},D=function(e,t){var n=(0,g._Y)(e.target,"SPAN");if(n&&(0,g.KJ)(n,"vditor-toc")){var r=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(r)if("auto"===t.options.height){var i=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(i+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,i)}else t.element.offsetTop=e.textContent.trimRight().length)return e.nextElementSibling.remove(),pt(t),!0;if(it(t,n,r,e,e.nextElementSibling))return!0}if("Backspace"===n.key||"Delete"===n.key){var i=(0,g.KJ)(r.startContainer,"vditor-toc");if(i)return i.remove(),pt(t),!0}},I=function(e,n,r,i){void 0===r&&(r=!1);var a=(0,g.pt)(n.startContainer);if(a&&!r&&"code-block"!==a.getAttribute("data-type")){if(ct(a.innerHTML)&&a.previousElementSibling||ut(a.innerHTML))return;for(var l=(0,N.ED)(a,e.ir.element,n).start,s=!0,d=l-1;d>a.textContent.substr(0,l).lastIndexOf("\n");d--)if(" "!==a.textContent.charAt(d)&&"\t"!==a.textContent.charAt(d)){s=!1;break}0===l&&(s=!1);var c=!0;for(d=l-1;d"):n.insertNode(document.createElement("wbr"))}a.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),"link-ref-defs-block"===a.getAttribute("data-type")&&(a=e.ir.element);var m,f=a.isEqualNode(e.ir.element),h=(0,g.Th)(a,"data-type","footnotes-block"),v="";if(f)v=a.innerHTML;else{var w=(0,y.f)(n.startContainer,"BLOCKQUOTE"),E=(0,g.KR)(n.startContainer);if(E&&(a=E),w&&(!E||E&&!w.contains(E))&&(a=w),h&&(a=h),v=a.outerHTML,"UL"===a.tagName||"OL"===a.tagName){var k=a.previousElementSibling,S=a.nextElementSibling;!k||"UL"!==k.tagName&&"OL"!==k.tagName||(v=k.outerHTML+v,k.remove()),!S||"UL"!==S.tagName&&"OL"!==S.tagName||(v+=S.outerHTML,S.remove()),v=v.replace("

","

  • ")}else a.previousElementSibling&&""!==a.previousElementSibling.textContent.replace(t.Y.ZWSP,"")&&i&&"insertParagraph"===i.inputType&&(v=a.previousElementSibling.outerHTML+v,a.previousElementSibling.remove());a.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e){e&&!a.isEqualNode(e)&&(v+=e.outerHTML,e.remove())})),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach((function(e){e&&!a.isEqualNode(e)&&(v+=e.outerHTML,e.remove())})))}if(b("SpinVditorIRDOM",v,"argument",e.options.debugger),v=e.lute.SpinVditorIRDOM(v),b("SpinVditorIRDOM",v,"result",e.options.debugger),f)a.innerHTML=v;else if(a.outerHTML=v,h){var T=(0,g.Th)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(T){var C=T.textContent,_=C.substring(1,C.indexOf("]:")),L=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+_+'"]');L&&L.setAttribute("aria-label",C.substr(_.length+3).trim().substr(0,24))}}var M,x=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");x.forEach((function(e,t){0===t?m=e:(m.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),x.length>0&&e.ir.element.insertAdjacentElement("beforeend",x[0]);var D=e.ir.element.querySelectorAll("[data-type='footnotes-block']");D.forEach((function(e,t){0===t?M=e:(M.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),D.length>0&&e.ir.element.insertAdjacentElement("beforeend",D[0]),(0,N.ir)(e.ir.element,n),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){A(t,e)})),H(e),At(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},j=function(e,t){if(""===e)return!1;if(e.match(/[\^!\+]/))return R(e,t);if(-1===e.indexOf("⇧")&&-1===e.indexOf("⌘")&&-1===e.indexOf("⌥"))return!((0,s._0)(t)||t.altKey||t.shiftKey||t.code!==e);if("⇧Tab"===e)return!((0,s._0)(t)||t.altKey||!t.shiftKey||"Tab"!==t.code);var n=e.split("");if(e.startsWith("⌥")){var r=3===n.length?n[2]:n[1];return!((3===n.length?!(0,s._0)(t):(0,s._0)(t))||!t.altKey||t.shiftKey||t.code!==(/^[0-9]$/.test(r)?"Digit":"Key")+r)}"⌘Enter"===e&&(n=["⌘","Enter"]);var i=n.length>2&&"⇧"===n[0],o=i?n[2]:n[1];return!i||!(0,s.gm)()&&/Mac/.test(navigator.platform)||("-"===o?o="_":"="===o&&(o="+")),!(!(0,s._0)(t)||t.key.toLowerCase()!==o.toLowerCase()||t.altKey||!(!i&&!t.shiftKey||i&&t.shiftKey))};function R(e,t){var n=null!=e.match(/!/)==t.altKey,r=null!=e.match(/⌘/)==t.metaKey,i=null!=e.match(/\^/)==t.ctrlKey,o=null!=e.match(/\+/)==t.shiftKey;if(n&&i&&o&&r)return e.match(new RegExp("\\b"+t.key+"\\b","i"))}var P,B=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach((function(e){e.classList.remove("vditor-ir__node--expand")}));var n=(0,g.XW)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,g.XW)(e.endContainer,"vditor-ir__node");if(e.collapsed||n&&n===r){n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"),(0,N.jl)(e));var i=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=(0,g.KJ)(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(i)return i.classList.add("vditor-ir__node--expand"),void i.classList.remove("vditor-ir__node--hidden");var o=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 o?(o.classList.add("vditor-ir__node--expand"),void o.classList.remove("vditor-ir__node--hidden")):void 0}},q=n(170),V=function(e,t){var n,r=getSelection().getRangeAt(0).cloneRange(),i=r.startContainer;3!==r.startContainer.nodeType&&"DIV"===r.startContainer.tagName&&(i=r.startContainer.childNodes[r.startOffset-1]);var o=(0,g.Th)(i,"data-block","0");if(o&&t&&("deleteContentBackward"===t.inputType||" "===t.data)){for(var a=(0,N.ED)(o,e.sv.element,r).start,l=!0,s=a-1;s>o.textContent.substr(0,a).lastIndexOf("\n");s--)if(" "!==o.textContent.charAt(s)&&"\t"!==o.textContent.charAt(s)){l=!1;break}if(0===a&&(l=!1),l)return void Pe(e);if("deleteContentBackward"===t.inputType){var d=(0,g.Th)(i,"data-type","code-block-open-marker")||(0,g.Th)(i,"data-type","code-block-close-marker");if(d){var c;if("code-block-close-marker"===d.getAttribute("data-type"))if(c=Ie(i,"code-block-open-marker"))return c.textContent=d.textContent,void Pe(e);if("code-block-open-marker"===d.getAttribute("data-type"))if(c=Ie(i,"code-block-close-marker",!1))return c.textContent=d.textContent,void Pe(e)}var u=(0,g.Th)(i,"data-type","math-block-open-marker");if(u){var p=u.nextElementSibling.nextElementSibling;return void(p&&"math-block-close-marker"===p.getAttribute("data-type")&&(p.remove(),Pe(e)))}o.querySelectorAll('[data-type="code-block-open-marker"]').forEach((function(e){1===e.textContent.length&&e.remove()})),o.querySelectorAll('[data-type="code-block-close-marker"]').forEach((function(e){1===e.textContent.length&&e.remove()}));var m=(0,g.Th)(i,"data-type","heading-marker");if(m&&-1===m.textContent.indexOf("#"))return void Pe(e)}if((" "===t.data||"deleteContentBackward"===t.inputType)&&((0,g.Th)(i,"data-type","padding")||(0,g.Th)(i,"data-type","li-marker")||(0,g.Th)(i,"data-type","task-marker")||(0,g.Th)(i,"data-type","blockquote-marker")))return void Pe(e)}if(o&&"$$"===o.textContent.trimRight())Pe(e);else{o||(o=e.sv.element),"link-ref-defs-block"===(null===(n=o.firstElementChild)||void 0===n?void 0:n.getAttribute("data-type"))&&(o=e.sv.element),(0,g.Th)(i,"data-type","footnotes-link")&&(o=e.sv.element),-1===o.textContent.indexOf(Lute.Caret)&&r.insertNode(document.createTextNode(Lute.Caret)),o.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),o.querySelectorAll("font").forEach((function(e){e.outerHTML=e.innerHTML}));var f,h=o.textContent,v=o.isEqualNode(e.sv.element);v?h=o.textContent:(o.previousElementSibling&&(h=o.previousElementSibling.textContent+h,o.previousElementSibling.remove()),o.previousElementSibling&&0===h.indexOf("---\n")&&(h=o.previousElementSibling.textContent+h,o.previousElementSibling.remove()),o.innerText.startsWith("```")||(e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e,t){0===t&&e&&!o.isEqualNode(e.parentElement)&&(h+="\n"+e.parentElement.textContent,e.parentElement.remove())})),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach((function(e,t){0===t&&e&&!o.isEqualNode(e.parentElement)&&(h+="\n"+e.parentElement.textContent,e.parentElement.remove())})))),h=je(h,e),v?o.innerHTML=h:o.outerHTML=h;var y,b=e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']");b.forEach((function(e,t){0===t?f=e.parentElement:(f.lastElementChild.remove(),f.insertAdjacentHTML("beforeend",""+e.parentElement.innerHTML),e.parentElement.remove())})),b.length>0&&e.sv.element.insertAdjacentElement("beforeend",f);var w=e.sv.element.querySelectorAll("[data-type='footnotes-link']");w.forEach((function(e,t){0===t?y=e.parentElement:(y.lastElementChild.remove(),y.insertAdjacentHTML("beforeend",""+e.parentElement.innerHTML),e.parentElement.remove())})),w.length>0&&e.sv.element.insertAdjacentElement("beforeend",y),(0,N.ir)(e.sv.element,r),Ne(e),Pe(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})}},Y=n(557),U=function(e){"dark"===e.options.theme?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},K=function(e){var n=window.innerWidth<=t.Y.MOBILE_WIDTH?10:35;if("none"!==e.wysiwyg.element.parentElement.style.display){var r=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px "+Math.max(n,r)+"px"}if("none"!==e.ir.element.parentElement.style.display){r=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px "+Math.max(n,r)+"px"}"block"!==e.preview.element.style.display||(e.toolbar.element.style.paddingLeft=5+("left"===e.options.outline.position?e.outline.element.offsetWidth:0)+"px")},W=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)):t=e.element.clientHeight,e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}};function z(){window.removeEventListener("resize",P)}var F=function(e){W(e),z(),window.addEventListener("resize",P=function(){K(e),W(e)});var t=(0,s.D)()&&localStorage.getItem(e.options.cache.id);return e.options.cache.enable&&t||(e.options.value?t=e.options.value:e.originalInnerHTML?t=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(t="")),t||""},Z=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout((function(){if("false"!==e[e.currentMode].element.getAttribute("contenteditable")&&(0,N.Co)(e[e.currentMode].element)){d(e.toolbar.elements,t.Y.EDIT_TOOLBARS),u(e.toolbar.elements,t.Y.EDIT_TOOLBARS);var n=(0,N.RN)(e),r=n.startContainer;3===n.startContainer.nodeType&&(r=n.startContainer.parentElement),r.classList.contains("vditor-reset")&&(r=r.childNodes[n.startOffset]),("sv"===e.currentMode?(0,g.Th)(r,"data-type","heading"):(0,y.c)(r))&&c(e.toolbar.elements,["headings"]),("sv"===e.currentMode?(0,g.Th)(r,"data-type","blockquote"):(0,g._Y)(r,"BLOCKQUOTE"))&&c(e.toolbar.elements,["quote"]),(0,g.Th)(r,"data-type","strong")&&c(e.toolbar.elements,["bold"]),(0,g.Th)(r,"data-type","em")&&c(e.toolbar.elements,["italic"]),(0,g.Th)(r,"data-type","s")&&c(e.toolbar.elements,["strike"]),(0,g.Th)(r,"data-type","a")&&c(e.toolbar.elements,["link"]);var i=(0,g._Y)(r,"LI");i?(i.classList.contains("vditor-task")?c(e.toolbar.elements,["check"]):"OL"===i.parentElement.tagName?c(e.toolbar.elements,["ordered-list"]):"UL"===i.parentElement.tagName&&c(e.toolbar.elements,["list"]),u(e.toolbar.elements,["outdent","indent"])):p(e.toolbar.elements,["outdent","indent"]),(0,g.Th)(r,"data-type","code-block")&&(p(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),c(e.toolbar.elements,["code"])),(0,g.Th)(r,"data-type","code")&&(p(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),c(e.toolbar.elements,["inline-code"])),(0,g.Th)(r,"data-type","table")&&p(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}}),200)};var J=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(){G(e,t)}),e.options.undoDelay)};function G(e,t){if(void 0===t&&(t={enableAddUndoStack:!0,enableInput:!0}),!e.wysiwyg.composingLock){var n=o(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&&(0,s.D)()&&(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)}}var X=function(e){for(var t="",n=e.nextSibling;n;)3===n.nodeType?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},$=function(e){for(var t="",n=e.previousSibling;n;)t=3===n.nodeType?n.textContent+t:n.outerHTML+t,n=n.previousSibling;return t},Q=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),(0,N.jl)(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+"

    "),(0,N.ir)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0}))},ee=function(e,t){var n=(0,N.RN)(e),r=(0,g.pt)(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()+"":r.outerHTML="<"+t+' data-block="0">'+r.innerHTML.trim()+"",(0,N.ir)(e.wysiwyg.element,n),H(e))},te=function(e){var t=getSelection().getRangeAt(0),n=(0,g.pt)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='

    '+n.innerHTML+"

    ",(0,N.ir)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},ne=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),(0,N.jl)(i),e.firstElementChild.classList.contains("language-mindmap")||Ne(t)},re=function(e,t){if(j("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');if(n)return n.click(),t.preventDefault(),!0}},ie=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout((function(){if("false"!==e.wysiwyg.element.getAttribute("contenteditable")&&(0,N.Co)(e.wysiwyg.element)){d(e.toolbar.elements,t.Y.EDIT_TOOLBARS),u(e.toolbar.elements,t.Y.EDIT_TOOLBARS);var n=getSelection().getRangeAt(0),r=n.startContainer;r=3===n.startContainer.nodeType?n.startContainer.parentElement:r.childNodes[n.startOffset>=r.childNodes.length?r.childNodes.length-1:n.startOffset];var i=(0,g.Th)(r,"data-type","footnotes-block");if(i)return e.wysiwyg.popover.innerHTML="",de(i,e),void oe(e,i);var o=(0,g._Y)(r,"LI");o?(o.classList.contains("vditor-task")?c(e.toolbar.elements,["check"]):"OL"===o.parentElement.tagName?c(e.toolbar.elements,["ordered-list"]):"UL"===o.parentElement.tagName&&c(e.toolbar.elements,["list"]),u(e.toolbar.elements,["outdent","indent"])):p(e.toolbar.elements,["outdent","indent"]),(0,g._Y)(r,"BLOCKQUOTE")&&c(e.toolbar.elements,["quote"]),((0,g._Y)(r,"B")||(0,g._Y)(r,"STRONG"))&&c(e.toolbar.elements,["bold"]),((0,g._Y)(r,"I")||(0,g._Y)(r,"EM"))&&c(e.toolbar.elements,["italic"]),((0,g._Y)(r,"STRIKE")||(0,g._Y)(r,"S"))&&c(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach((function(e){e.classList.remove("vditor-comment--focus")}));var a=(0,g.KJ)(r,"vditor-comment");if(a){var l=a.getAttribute("data-cmtids").split(" ");if(l.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var m=a.nextElementSibling.getAttribute("data-cmtids").split(" ");l.find((function(e){if(m.includes(e))return l=[e],!0}))}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach((function(e){e.getAttribute("data-cmtids").indexOf(l[0])>-1&&e.classList.add("vditor-comment--focus")}))}var f=(0,g._Y)(r,"A");f&&c(e.toolbar.elements,["link"]);var h=(0,g._Y)(r,"TABLE"),v=(0,y.c)(r);(0,g._Y)(r,"CODE")?(0,g._Y)(r,"PRE")?(p(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),c(e.toolbar.elements,["code"])):(p(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),c(e.toolbar.elements,["inline-code"])):v?(p(e.toolbar.elements,["bold"]),c(e.toolbar.elements,["headings"])):h&&p(e.toolbar.elements,["table"]);var b=(0,g.KJ)(r,"vditor-toc");if(b)return e.wysiwyg.popover.innerHTML="",de(b,e),void oe(e,b);var w=(0,y.f)(r,"BLOCKQUOTE");if(w&&(e.wysiwyg.popover.innerHTML="",le(n,w,e),se(n,w,e),de(w,e),oe(e,w)),o&&(e.wysiwyg.popover.innerHTML="",le(n,o,e),se(n,o,e),de(o,e),oe(e,o)),h){e.options.lang,e.options;e.wysiwyg.popover.innerHTML="";var E=function(){var e=h.rows.length,t=h.rows[0].cells.length,n=parseInt(R.value,10)||e,r=parseInt(B.value,10)||t;if(n!==e||t!==r){if(t!==r)for(var i=r-t,o=0;o0)for(var a=0;a "):h.rows[o].lastElementChild.insertAdjacentHTML("afterend"," ");else for(var l=t-1;l>=r;l--)h.rows[o].cells[l].remove();if(e!==n){var s=n-e;if(s>0){for(var d="",c=0;c ";for(var u=0;u")}else for(c=e-1;c>=n;c--)h.rows[c].remove(),1===h.rows.length&&h.querySelector("tbody").remove()}}},k=function(t){dt(h,t),"right"===t?(_.classList.remove("vditor-icon--current"),L.classList.remove("vditor-icon--current"),M.classList.add("vditor-icon--current")):"center"===t?(_.classList.remove("vditor-icon--current"),M.classList.remove("vditor-icon--current"),L.classList.add("vditor-icon--current")):(L.classList.remove("vditor-icon--current"),M.classList.remove("vditor-icon--current"),_.classList.add("vditor-icon--current")),(0,N.jl)(n),J(e)},S=(0,g._Y)(r,"TD"),T=(0,g._Y)(r,"TH"),C="left";S?C=S.getAttribute("align")||"left":T&&(C=T.getAttribute("align")||"center");var _=document.createElement("button");_.setAttribute("type","button"),_.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,s.fG)("⇧⌘L")+">"),_.setAttribute("data-type","left"),_.innerHTML='',_.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("left"===C?" vditor-icon--current":""),_.onclick=function(){k("left")};var L=document.createElement("button");L.setAttribute("type","button"),L.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,s.fG)("⇧⌘C")+">"),L.setAttribute("data-type","center"),L.innerHTML='',L.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("center"===C?" vditor-icon--current":""),L.onclick=function(){k("center")};var M=document.createElement("button");M.setAttribute("type","button"),M.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,s.fG)("⇧⌘R")+">"),M.setAttribute("data-type","right"),M.innerHTML='',M.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("right"===C?" vditor-icon--current":""),M.onclick=function(){k("right")};var x=document.createElement("button");x.setAttribute("type","button"),x.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,s.fG)("⌘=")+">"),x.setAttribute("data-type","insertRow"),x.innerHTML='',x.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",x.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");r&&vt(e,n,r)};var H=document.createElement("button");H.setAttribute("type","button"),H.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,s.fG)("⇧⌘F")+">"),H.setAttribute("data-type","insertRow"),H.innerHTML='',H.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",H.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");r&>(e,n,r)};var D=document.createElement("button");D.setAttribute("type","button"),D.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,s.fG)("⇧⌘=")+">"),D.setAttribute("data-type","insertColumn"),D.innerHTML='',D.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",D.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,n=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");n&&yt(e,h,n)};var O=document.createElement("button");O.setAttribute("type","button"),O.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,s.fG)("⇧⌘G")+">"),O.setAttribute("data-type","insertColumn"),O.innerHTML='',O.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",O.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,n=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");n&&yt(e,h,n,"beforebegin")};var I=document.createElement("button");I.setAttribute("type","button"),I.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,s.fG)("⌘-")+">"),I.setAttribute("data-type","deleteRow"),I.innerHTML='',I.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",I.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");r&&bt(e,n,r)};var j=document.createElement("button");j.setAttribute("type","button"),j.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,s.fG)("⇧⌘-")+">"),j.setAttribute("data-type","deleteColumn"),j.innerHTML='',j.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",j.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,r=(0,g._Y)(t,"TD")||(0,g._Y)(t,"TH");r&&wt(e,n,h,r)},(Z=document.createElement("span")).setAttribute("aria-label",window.VditorI18n.row),Z.className="vditor-tooltipped vditor-tooltipped__n";var R=document.createElement("input");Z.appendChild(R),R.type="number",R.min="1",R.className="vditor-input",R.style.width="42px",R.style.textAlign="center",R.setAttribute("placeholder",window.VditorI18n.row),R.value=h.rows.length.toString(),R.oninput=function(){E()},R.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(B.focus(),B.select(),void t.preventDefault()):void re(e,t)};var P=document.createElement("span");P.setAttribute("aria-label",window.VditorI18n.column),P.className="vditor-tooltipped vditor-tooltipped__n";var B=document.createElement("input");P.appendChild(B),B.type="number",B.min="1",B.className="vditor-input",B.style.width="42px",B.style.textAlign="center",B.setAttribute("placeholder",window.VditorI18n.column),B.value=h.rows[0].cells.length.toString(),B.oninput=function(){E()},B.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(R.focus(),R.select(),void t.preventDefault()):void re(e,t)},le(n,h,e),se(n,h,e),de(h,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",_),e.wysiwyg.popover.insertAdjacentElement("beforeend",L),e.wysiwyg.popover.insertAdjacentElement("beforeend",M),e.wysiwyg.popover.insertAdjacentElement("beforeend",H),e.wysiwyg.popover.insertAdjacentElement("beforeend",x),e.wysiwyg.popover.insertAdjacentElement("beforeend",O),e.wysiwyg.popover.insertAdjacentElement("beforeend",D),e.wysiwyg.popover.insertAdjacentElement("beforeend",I),e.wysiwyg.popover.insertAdjacentElement("beforeend",j),e.wysiwyg.popover.insertAdjacentElement("beforeend",Z),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",P),oe(e,h)}var q=(0,g.Th)(r,"data-type","link-ref");q&&ae(e,q);var V=(0,g.Th)(r,"data-type","footnotes-ref");if(V){e.options.lang,e.options;e.wysiwyg.popover.innerHTML="",(Z=document.createElement("span")).setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,s.fG)("⌥Enter")+">"),Z.className="vditor-tooltipped vditor-tooltipped__n";var Y=document.createElement("input");Z.appendChild(Y),Y.className="vditor-input",Y.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,s.fG)("⌥Enter")+">"),Y.style.width="120px",Y.value=V.getAttribute("data-footnotes-label"),Y.oninput=function(){""!==Y.value.trim()&&V.setAttribute("data-footnotes-label",Y.value)},Y.onkeydown=function(t){if(!t.isComposing)return(0,s._0)(t)||t.shiftKey||!t.altKey||"Enter"!==t.key?void re(e,t):(n.selectNodeContents(V),n.collapse(!1),(0,N.jl)(n),void t.preventDefault())},de(V,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Z),oe(e,V)}var U=(0,g.KJ)(r,"vditor-wysiwyg__block"),K=!!U&&U.getAttribute("data-type").indexOf("block")>-1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach((function(e){(!U||U&&K&&!U.contains(e))&&(e.previousElementSibling.style.display="none")})),U&&K){if(e.wysiwyg.popover.innerHTML="",le(n,U,e),se(n,U,e),de(U,e),"code-block"===U.getAttribute("data-type")){var W=document.createElement("span");W.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,s.fG)("⌥Enter")+">"),W.className="vditor-tooltipped vditor-tooltipped__n";var z=document.createElement("input");W.appendChild(z);var F=U.firstElementChild.firstElementChild;z.className="vditor-input",z.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,s.fG)("⌥Enter")+">"),z.value=F.className.indexOf("language-")>-1?F.className.split("-")[1].split(" ")[0]:"",z.oninput=function(t){""!==z.value.trim()?F.className="language-"+z.value:(F.className="",e.hint.recentLanguage=""),U.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(U.lastElementChild.innerHTML=U.firstElementChild.innerHTML,A(U.lastElementChild,e)),J(e),1===t.detail&&(n.setStart(F.firstChild,0),n.collapse(!0),(0,N.jl)(n))},z.onkeydown=function(t){if(!t.isComposing&&!re(e,t)){if("Escape"===t.key&&"block"===e.hint.element.style.display)return e.hint.element.style.display="none",void t.preventDefault();e.hint.select(t,e),(0,s._0)(t)||t.shiftKey||"Enter"!==t.key||(n.setStart(F.firstChild,0),n.collapse(!0),(0,N.jl)(n),t.preventDefault(),t.stopPropagation())}},z.onkeyup=function(n){if(!n.isComposing&&"Enter"!==n.key&&"ArrowUp"!==n.key&&"Escape"!==n.key&&"ArrowDown"!==n.key){var r=[],i=z.value.substring(0,z.selectionStart);t.Y.CODE_LANGUAGES.forEach((function(e){e.indexOf(i.toLowerCase())>-1&&r.push({html:e,value:e})})),e.hint.genHTML(r,i,e),n.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",W)}oe(e,U)}else U=void 0;if(v){var Z;e.wysiwyg.popover.innerHTML="",(Z=document.createElement("span")).setAttribute("aria-label","ID<"+(0,s.fG)("⌥Enter")+">"),Z.className="vditor-tooltipped vditor-tooltipped__n";var G=document.createElement("input");Z.appendChild(G),G.className="vditor-input",G.setAttribute("placeholder","ID<"+(0,s.fG)("⌥Enter")+">"),G.style.width="120px",G.value=v.getAttribute("data-id")||"",G.oninput=function(){v.setAttribute("data-id",G.value)},G.onkeydown=function(t){if(!t.isComposing)return(0,s._0)(t)||t.shiftKey||!t.altKey||"Enter"!==t.key?void re(e,t):(n.selectNodeContents(v),n.collapse(!1),(0,N.jl)(n),void t.preventDefault())},le(n,v,e),se(n,v,e),de(v,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Z),oe(e,v)}if(f&&ue(e,f),!(w||o||h||U||f||q||V||v||b)){var X=(0,g.Th)(r,"data-block","0");X&&X.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",le(n,X,e),se(n,X,e),de(X,e),oe(e,X)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach((function(e){e.style.display="none"}));var $=(0,g.Th)(n.startContainer,"data-type","backslash");$&&($.querySelector("span").style.display="inline")}}),200)},oe=function(e,t){var n=t,r=(0,g._Y)(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())},ae=function(e,t){e.wysiwyg.popover.innerHTML="";var n=function(){""!==i.value.trim()&&("IMG"===t.tagName?t.setAttribute("alt",i.value):t.textContent=i.value),""!==a.value.trim()&&t.setAttribute("data-link-label",a.value)},r=document.createElement("span");r.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var i=document.createElement("input");r.appendChild(i),i.className="vditor-input",i.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),i.style.width="120px",i.value=t.getAttribute("alt")||t.textContent,i.oninput=function(){n()},i.onkeydown=function(n){re(e,n)||ce(e,t,n,a)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");o.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.linkRef),a.value=t.getAttribute("data-link-label"),a.oninput=function(){n()},a.onkeydown=function(n){re(e,n)||ce(e,t,n,i)},de(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),oe(e,t)},le=function(e,t,n){},se=function(e,t,n){if(t.nextElementSibling&&(t.parentElement.isEqualNode(n.wysiwyg.element)||"LI"===t.tagName)){var r=document.createElement("button");r.setAttribute("type","button"),r.setAttribute("data-type","down"),r.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,s.fG)("⇧⌘D")+">"),r.innerHTML='',r.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",r.onclick=function(){},n.wysiwyg.popover.insertAdjacentElement("beforeend",r)}},de=function(e,t){},ce=function(e,n,r,i){if(!r.isComposing){if("Tab"===r.key)return i.focus(),i.select(),void r.preventDefault();if(!(0,s._0)(r)&&!r.shiftKey&&r.altKey&&"Enter"===r.key){var o=(0,N.RN)(e);n.insertAdjacentHTML("afterend",t.Y.ZWSP),o.setStartAfter(n.nextSibling),o.collapse(!0),(0,N.jl)(o),r.preventDefault()}}},ue=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),J(e)};t.querySelectorAll("[data-marker]").forEach((function(e){e.removeAttribute("data-marker")}));var r=document.createElement("span");r.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var i=document.createElement("input");r.appendChild(i),i.className="vditor-input",i.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),i.style.width="120px",i.value=t.innerHTML||"",i.oninput=function(){n()},i.onkeydown=function(n){re(e,n)||ce(e,t,n,a)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");o.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.link),a.value=t.getAttribute("href")||"",a.oninput=function(){n()},a.onkeydown=function(n){re(e,n)||ce(e,t,n,s)};var l=document.createElement("span");l.setAttribute("aria-label",window.VditorI18n.tooltipText),l.className="vditor-tooltipped vditor-tooltipped__n";var s=document.createElement("input");l.appendChild(s),s.className="vditor-input",s.setAttribute("placeholder",window.VditorI18n.tooltipText),s.style.width="60px",s.value=t.getAttribute("title")||"",s.oninput=function(){n()},s.onkeydown=function(n){re(e,n)||ce(e,t,n,i)},de(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",l),oe(e,t)},pe=function(e){var t=e.startContainer;return(0,y.f)(t,"BLOCKQUOTE")||(0,g._Y)(t,"LI")||(0,g._Y)(t,"TABLE")||(0,g.KJ)(t,"vditor-wysiwyg__block")||(0,y.c)(t)||(0,g.Th)(t,"data-block","0")};function me(e,t){var n=pe(e),r=n.nextElementSibling;r&&(n.parentElement.isEqualNode(t.wysiwyg.element)||"LI"===n.tagName)&&(e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",n),(0,N.ir)(t.wysiwyg.element,e),J(t),ie(t),Ne(t))}function fe(e,t){var n=pe(e);console.log(n);var r=n.previousElementSibling;console.log(r),r&&(n.parentElement.isEqualNode(t.wysiwyg.element)||"LI"===n.tagName)&&(e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",n),(0,N.ir)(t.wysiwyg.element,e),J(t),ie(t),Ne(t))}var he,ve,ge=function(e){"wysiwyg"===e.currentMode?ie(e):"ir"===e.currentMode&&Z(e)},ye=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){A(t,e),t.previousElementSibling.setAttribute("style","display:none")})),J(e,n)},be=function(e,n,r){for(var i=e.startContainer.parentElement,o=!1,a="",l="",s=function(e){var n=$(e.startContainer),r=X(e.startContainer),i=e.startContainer.textContent,o=e.startOffset,a="",l="";return(""!==i.substr(0,o)&&i.substr(0,o)!==t.Y.ZWSP||n)&&(a=""+n+i.substr(0,o)),(""!==i.substr(o)&&i.substr(o)!==t.Y.ZWSP||r)&&(l=""+i.substr(o)+r),{afterHTML:l,beforeHTML:a}}(e),d=s.beforeHTML,c=s.afterHTML;i&&!o;){var u=i.tagName;if("STRIKE"===u&&(u="S"),"I"===u&&(u="EM"),"B"===u&&(u="STRONG"),"S"===u||"STRONG"===u||"EM"===u){var p="",m="",f="";"0"!==i.parentElement.getAttribute("data-block")&&(m=$(i),f=X(i)),(d||m)&&(d=p=m+"<"+u+">"+d+""),("bold"===r&&"STRONG"===u||"italic"===r&&"EM"===u||"strikeThrough"===r&&"S"===u)&&(p+=""+a+t.Y.ZWSP+""+l,o=!0),(c||f)&&(p+=c="<"+u+">"+c+""+f),"0"!==i.parentElement.getAttribute("data-block")?(i=i.parentElement).innerHTML=p:(i.outerHTML=p,i=i.parentElement),a="<"+u+">"+a,l=""+l}else o=!0}(0,N.ir)(n.wysiwyg.element,e)},we=function(e,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var o=n.hotkey?" <"+(0,s.fG)(n.hotkey)+">":"";2===n.level&&(o=n.hotkey?" <"+(0,s.fG)(n.hotkey)+">":"");var a=n.tip?n.tip+o:""+window.VditorI18n[n.name]+o,l="upload"===n.name?"div":"button";if(2===n.level)this.element.innerHTML="<"+l+' data-type="'+n.name+'">'+a+"";else{this.element.classList.add("vditor-toolbar__item");var c=document.createElement(l);c.setAttribute("data-type",n.name),c.className="vditor-tooltipped vditor-tooltipped__"+n.tipPosition,c.setAttribute("aria-label",a),c.innerHTML=n.icon,this.element.appendChild(c)}n.prefix&&this.element.children[0].addEventListener((0,s.y3)(),(function(r){r.preventDefault(),i.element.firstElementChild.classList.contains(t.Y.CLASS_MENU_DISABLED)||("wysiwyg"===e.currentMode?function(e,n,r){if(!(e.wysiwyg.composingLock&&r instanceof CustomEvent)){var i=!0,o=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,N.RN)(e),l=n.getAttribute("data-type");if(n.classList.contains("vditor-menu--current"))if("strike"===l&&(l="strikeThrough"),"quote"===l){var s=(0,g._Y)(a.startContainer,"BLOCKQUOTE");s||(s=a.startContainer.childNodes[a.startOffset]),s&&(i=!1,n.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),s.outerHTML=""===s.innerHTML.trim()?'

    '+s.innerHTML+"

    ":s.innerHTML,(0,N.ir)(e.wysiwyg.element,a))}else if("inline-code"===l){var c=(0,g._Y)(a.startContainer,"CODE");c||(c=a.startContainer.childNodes[a.startOffset]),c&&(c.outerHTML=c.innerHTML.replace(t.Y.ZWSP,"")+"",(0,N.ir)(e.wysiwyg.element,a))}else"link"===l?a.collapsed?(a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):document.execCommand("unlink",!1,""):"check"===l||"list"===l||"ordered-list"===l?(at(e,a,l),(0,N.ir)(e.wysiwyg.element,a),i=!1,n.classList.remove("vditor-menu--current")):(i=!1,n.classList.remove("vditor-menu--current"),""===a.toString()?be(a,e,l):document.execCommand(l,!1,""));else{0===e.wysiwyg.element.childNodes.length&&(e.wysiwyg.element.innerHTML='

    ',(0,N.ir)(e.wysiwyg.element,a));var u=(0,g.pt)(a.startContainer);if("quote"===l){if(u||(u=a.startContainer.childNodes[a.startOffset]),u){i=!1,n.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var p=(0,g._Y)(a.startContainer,"LI");p&&u.contains(p)?p.innerHTML='
    '+p.innerHTML+"
    ":u.outerHTML='
    '+u.outerHTML+"
    ",(0,N.ir)(e.wysiwyg.element,a)}}else if("check"===l||"list"===l||"ordered-list"===l)at(e,a,l,!1),(0,N.ir)(e.wysiwyg.element,a),i=!1,d(e.toolbar.elements,["check","list","ordered-list"]),n.classList.add("vditor-menu--current");else if("inline-code"===l){if(""===a.toString())(m=document.createElement("code")).textContent=t.Y.ZWSP,a.insertNode(m),a.setStart(m.firstChild,1),a.collapse(!0),(0,N.jl)(a);else if(3===a.startContainer.nodeType){var m=document.createElement("code");a.surroundContents(m),a.insertNode(m),(0,N.jl)(a)}n.classList.add("vditor-menu--current")}else if("code"===l)(m=document.createElement("div")).className="vditor-wysiwyg__block",m.setAttribute("data-type","code-block"),m.setAttribute("data-block","0"),m.setAttribute("data-marker","```"),""===a.toString()?m.innerHTML="
    \n
    ":(m.innerHTML="
    "+a.toString()+"
    ",a.deleteContents()),a.insertNode(m),u&&(u.outerHTML=e.lute.SpinVditorDOM(u.outerHTML)),(0,N.ir)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){A(t,e)})),n.classList.add("vditor-menu--disabled");else if("link"===l){if(""===a.toString()){var f=document.createElement("a");f.innerText=t.Y.ZWSP,a.insertNode(f),a.setStart(f.firstChild,1),a.collapse(!0),ue(e,f);var h=e.wysiwyg.popover.querySelector("input");h.value="",h.focus(),o=!1}else{(m=document.createElement("a")).setAttribute("href",""),m.innerHTML=a.toString(),a.surroundContents(m),a.insertNode(m),(0,N.jl)(a),ue(e,m);var v=e.wysiwyg.popover.querySelectorAll("input");v[0].value=m.innerText,v[1].focus()}i=!1,n.classList.add("vditor-menu--current")}else if("table"===l){var y='
    col1col2col3
    ';if(""===a.toString().trim())u&&""===u.innerHTML.trim().replace(t.Y.ZWSP,"")?u.outerHTML=y:document.execCommand("insertHTML",!1,y),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,N.jl)(a);else{y='';var b=a.toString().split("\n"),w=b[0].split(",").length>b[0].split("\t").length?",":"\t";b.forEach((function(e,t){0===t?(e.split(w).forEach((function(e,t){y+=0===t?"":""})),y+=""):(y+=1===t?"":"",e.split(w).forEach((function(e){y+=""})),y+="")})),y+="
    "+e+""+e+"
    "+e+"
    ",document.execCommand("insertHTML",!1,y),(0,N.ir)(e.wysiwyg.element,a)}i=!1,n.classList.add("vditor-menu--disabled")}else if("line"===l){if(u){var E='

    \n

    ';""===u.innerHTML.trim()?u.outerHTML=E:u.insertAdjacentHTML("afterend",E),(0,N.ir)(e.wysiwyg.element,a)}}else if(i=!1,n.classList.add("vditor-menu--current"),"strike"===l&&(l="strikeThrough"),""!==a.toString()||"bold"!==l&&"italic"!==l&&"strikeThrough"!==l)document.execCommand(l,!1,"");else{var k="strong";"italic"===l?k="em":"strikeThrough"===l&&(k="s"),(m=document.createElement(k)).textContent=t.Y.ZWSP,a.insertNode(m),m.previousSibling&&m.previousSibling.textContent===t.Y.ZWSP&&(m.previousSibling.textContent=""),a.setStart(m.firstChild,1),a.collapse(!0),(0,N.jl)(a)}}i&&ie(e),o&&J(e)}}(e,i.element.children[0],r):"ir"===e.currentMode?Dt(e,i.element.children[0],n.prefix||"",n.suffix||""):qe(e,i.element.children[0],n.prefix||"",n.suffix||""))}))},Ee=(he=function(e,t){return he=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])},he(e,t)},function(e,t){function n(){this.constructor=e}he(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ke=function(e,n,r){var i;if("string"!=typeof r?(h(e,["subToolbar","hint"]),r.preventDefault(),i=o(e)):i=r,e.currentMode!==n||"string"==typeof r){if(e.devtools&&e.devtools.renderEchart(e),"both"===e.options.preview.mode&&"sv"===n?e.preview.element.style.display="block":e.preview.element.style.display="none",u(e.toolbar.elements,t.Y.EDIT_TOOLBARS),d(e.toolbar.elements,t.Y.EDIT_TOOLBARS),p(e.toolbar.elements,["outdent","indent"]),"ir"===n)m(e.toolbar.elements,["both"]),f(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.lute.SetVditorIR(!0),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!1),e.currentMode="ir",e.ir.element.innerHTML=e.lute.Md2VditorIRDOM(i),At(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),K(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){A(t,e)})),e.ir.element.querySelectorAll(".vditor-toc").forEach((function(t){(0,_.T)(t,{cdn:e.options.cdn,extPath:e.options.extPath,math:e.options.preview.math})}));else if("wysiwyg"===n)m(e.toolbar.elements,["both"]),f(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.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!0),e.lute.SetVditorSV(!1),e.currentMode="wysiwyg",K(e),ye(e,i,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach((function(t){(0,_.T)(t,{cdn:e.options.cdn,extPath:e.options.extPath,math:e.options.preview.math})})),e.wysiwyg.popover.style.display="none";else if("sv"===n){f(e.toolbar.elements,["both"]),m(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.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var a=je(i,e);"
    "===a&&(a=""),e.sv.element.innerHTML=a,Pe(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),K(e)}e.undo.resetIcon(e),"string"!=typeof r&&(e[e.currentMode].element.focus(),ge(e)),H(e),W(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.enable)}},Se=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 Ee(t,e),t.prototype._bindEvent=function(e,t,n){var r=this.element.children[0];v(e,t,r,n.level),t.children.item(0).addEventListener((0,s.y3)(),(function(t){ke(e,"wysiwyg",t),e.options.changeEditMode("wysiwyg"),t.preventDefault(),t.stopPropagation()})),t.children.item(1).addEventListener((0,s.y3)(),(function(t){ke(e,"ir",t),e.options.changeEditMode("ir"),t.preventDefault(),t.stopPropagation()})),t.children.item(2).addEventListener((0,s.y3)(),(function(t){ke(e,"sv",t),e.options.changeEditMode("sv"),t.preventDefault(),t.stopPropagation()}))},t}(we),Te=function(e,t){return(0,N.Co)(e,t)?getSelection().toString():""},Ce=function(e,t){t.addEventListener("focus",(function(){e.options.focus&&e.options.focus(o(e)),h(e,["subToolbar","hint"])}))},_e=function(e,t){t.addEventListener("dblclick",(function(t){"IMG"===t.target.tagName&&(0,q.o)(t.target,e.options.lang,e.options.theme)}))},Le=function(e,t){t.addEventListener("blur",(function(t){if("ir"===e.currentMode){var n=e.ir.element.querySelector(".vditor-ir__node--expand");n&&n.classList.remove("vditor-ir__node--expand")}else"wysiwyg"!==e.currentMode||e.wysiwyg.selectPopover.contains(t.relatedTarget)||e.wysiwyg.hideComment();e[e.currentMode].range=(0,N.RN)(e),e.options.blur&&e.options.blur(o(e))}))},Me=function(e,n){n.addEventListener("dragstart",(function(e){e.dataTransfer.setData(t.Y.DROP_EDITOR,t.Y.DROP_EDITOR)})),n.addEventListener("drop",(function(n){n.dataTransfer.getData(t.Y.DROP_EDITOR)?pt(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Mt(e,n,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})}))},xe=function(e,t,n){t.addEventListener("copy",(function(t){return n(t,e)}))},Ae=function(e,t,n){t.addEventListener("cut",(function(t){n(t,e),e.options.comment.enable&&"wysiwyg"===e.currentMode&&e.wysiwyg.getComments(e),document.execCommand("delete")}))},Ne=function(e){if("wysiwyg"===e.currentMode&&e.options.comment.enable&&e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)),e.options.typewriterMode){var t=e[e.currentMode].element,n=(0,N.Ey)(t).top;"auto"!==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),("auto"!==e.options.height||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},He=function(e,n){n.addEventListener("keydown",(function(n){if(!(e.options.hint.extend.length>1||e.toolbar.elements.emoji)||!e.hint.select(n,e)){if(e.options.comment.enable&&"wysiwyg"===e.currentMode&&("Backspace"===n.key||j("⌘X",n))&&e.wysiwyg.getComments(e),"sv"===e.currentMode){if(function(e,t){var n,r,i,o,a;if(e.sv.composingLock=t.isComposing,t.isComposing)return!1;if(-1!==t.key.indexOf("Arrow")||"Meta"===t.key||"Control"===t.key||"Alt"===t.key||"Shift"===t.key||"CapsLock"===t.key||"Escape"===t.key||/^F\d{1,2}$/.test(t.key)||e.undo.recordFirstPosition(e,t),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!(0,s._0)(t)&&"Escape"!==t.key)return!1;var l=(0,N.RN)(e),d=l.startContainer;3!==l.startContainer.nodeType&&"DIV"===l.startContainer.tagName&&(d=l.startContainer.childNodes[l.startOffset-1]);var c=(0,g.Th)(d,"data-type","text"),u=(0,g.Th)(d,"data-type","blockquote-marker");if(!u&&0===l.startOffset&&c&&c.previousElementSibling&&"blockquote-marker"===c.previousElementSibling.getAttribute("data-type")&&(u=c.previousElementSibling),u&&"Enter"===t.key&&!(0,s._0)(t)&&!t.altKey&&""===u.nextElementSibling.textContent.trim()&&(0,N.ED)(u,e.sv.element,l).start===u.textContent.length)return"padding"===(null===(n=u.previousElementSibling)||void 0===n?void 0:n.getAttribute("data-type"))&&u.previousElementSibling.setAttribute("data-action","enter-remove"),u.remove(),Pe(e),t.preventDefault(),!0;var p=(0,g.Th)(d,"data-type","li-marker"),m=(0,g.Th)(d,"data-type","task-marker"),f=p;if(f||m&&"task-marker"!==m.nextElementSibling.getAttribute("data-type")&&(f=m),f||0!==l.startOffset||!c||!c.previousElementSibling||"li-marker"!==c.previousElementSibling.getAttribute("data-type")&&"task-marker"!==c.previousElementSibling.getAttribute("data-type")||(f=c.previousElementSibling),f){var h=(0,N.ED)(f,e.sv.element,l).start,v="task-marker"===f.getAttribute("data-type"),b=f;if(v&&(b=f.previousElementSibling.previousElementSibling.previousElementSibling),h===f.textContent.length){if("Enter"===t.key&&!(0,s._0)(t)&&!t.altKey&&!t.shiftKey&&""===f.nextElementSibling.textContent.trim())return"padding"===(null===(r=b.previousElementSibling)||void 0===r?void 0:r.getAttribute("data-type"))?(b.previousElementSibling.remove(),V(e)):(v&&(b.remove(),f.previousElementSibling.previousElementSibling.remove(),f.previousElementSibling.remove()),f.nextElementSibling.remove(),f.remove(),Pe(e)),t.preventDefault(),!0;if("Tab"===t.key)return b.insertAdjacentHTML("beforebegin",''+b.textContent.replace(/\S/g," ")+""),/^\d/.test(b.textContent)&&(b.textContent=b.textContent.replace(/^\d{1,}/,"1"),l.selectNodeContents(f.firstChild),l.collapse(!1)),V(e),t.preventDefault(),!0}}if(ft(e,l,t))return!0;var w=(0,g.Th)(d,"data-block","0"),E=(0,y.f)(d,"SPAN");if("Enter"===t.key&&!(0,s._0)(t)&&!t.altKey&&!t.shiftKey&&w){var k=!1,S=w.textContent.match(/^\n+/);(0,N.ED)(w,e.sv.element).start<=(S?S[0].length:0)&&(k=!0);var T="\n";if(E){if("enter-remove"===(null===(i=E.previousElementSibling)||void 0===i?void 0:i.getAttribute("data-action")))return E.previousElementSibling.remove(),Pe(e),t.preventDefault(),!0;T+=Re(E)}return l.insertNode(document.createTextNode(T)),l.collapse(!1),w&&""!==w.textContent.trim()&&!k?V(e):Pe(e),t.preventDefault(),!0}if("Backspace"===t.key&&!(0,s._0)(t)&&!t.altKey&&!t.shiftKey){if(E&&"newline"===(null===(o=E.previousElementSibling)||void 0===o?void 0:o.getAttribute("data-type"))&&1===(0,N.ED)(E,e.sv.element,l).start&&-1===E.getAttribute("data-type").indexOf("code-block-"))return l.setStart(E,0),l.extractContents(),""!==E.textContent.trim()?V(e):Pe(e),t.preventDefault(),!0;if(w&&0===(0,N.ED)(w,e.sv.element,l).start&&w.previousElementSibling){l.extractContents();var C=w.previousElementSibling.lastElementChild;return"newline"===C.getAttribute("data-type")&&(C.remove(),C=w.previousElementSibling.lastElementChild),"newline"!==C.getAttribute("data-type")&&(C.insertAdjacentHTML("afterend",w.innerHTML),w.remove()),""===w.textContent.trim()||(null===(a=w.previousElementSibling)||void 0===a?void 0:a.querySelector('[data-type="code-block-open-marker"]'))?("newline"!==C.getAttribute("data-type")&&(l.selectNodeContents(C.lastChild),l.collapse(!1)),Pe(e)):V(e),t.preventDefault(),!0}}return!1}(e,n))return}else if("wysiwyg"===e.currentMode){if(function(e,n){if(e.wysiwyg.composingLock=n.isComposing,n.isComposing)return!1;-1!==n.key.indexOf("Arrow")||"Meta"===n.key||"Control"===n.key||"Alt"===n.key||"Shift"===n.key||"CapsLock"===n.key||"Escape"===n.key||/^F\d{1,2}$/.test(n.key)||e.undo.recordFirstPosition(e,n);var r=(0,N.RN)(e),i=r.startContainer;if(!Xe(n,e,i))return!1;if($e(r,e,n),_t(r),j("^⌘i",n)&&fe(r,e),j("^⌘j",n)&&me(r,e),"Enter"!==n.key&&"Tab"!==n.key&&"Backspace"!==n.key&&-1===n.key.indexOf("Arrow")&&!(0,s._0)(n)&&"Escape"!==n.key&&"Delete"!==n.key)return!1;var o=(0,g.pt)(i),a=(0,g._Y)(i,"P");if(ht(n,e,a,r))return!0;if(mt(r,e,a,n))return!0;if(Et(e,n,r))return!0;var l=(0,g.KJ)(i,"vditor-wysiwyg__block");if(l){if("Escape"===n.key&&2===l.children.length)return e.wysiwyg.popover.style.display="none",l.firstElementChild.style.display="none",e.wysiwyg.element.blur(),n.preventDefault(),!0;if(!(0,s._0)(n)&&!n.shiftKey&&n.altKey&&"Enter"===n.key&&"code-block"===l.getAttribute("data-type")){var d=e.wysiwyg.popover.querySelector(".vditor-input");return d.focus(),d.select(),n.preventDefault(),!0}if("0"===l.getAttribute("data-block")){if(kt(e,n,l.firstElementChild,r))return!0;if(it(e,n,r,l.firstElementChild,l))return!0;if("yaml-front-matter"!==l.getAttribute("data-type")&&ot(e,n,r,l.firstElementChild,l))return!0}}if(St(e,r,n,a))return!0;var c=(0,g.Ab)(i,"BLOCKQUOTE");if(c&&!n.shiftKey&&n.altKey&&"Enter"===n.key){(0,s._0)(n)?r.setStartBefore(c):r.setStartAfter(c),(0,N.jl)(r);var u=document.createElement("p");return u.setAttribute("data-block","0"),u.innerHTML="\n",r.insertNode(u),r.collapse(!0),(0,N.jl)(r),J(e),Ne(e),n.preventDefault(),!0}var p=(0,y.c)(i);if(p){if("H6"===p.tagName&&i.textContent.length===r.startOffset&&!(0,s._0)(n)&&!n.shiftKey&&!n.altKey&&"Enter"===n.key){var m=document.createElement("p");return m.textContent="\n",m.setAttribute("data-block","0"),i.parentElement.insertAdjacentElement("afterend",m),r.setStart(m,0),(0,N.jl)(r),J(e),Ne(e),n.preventDefault(),!0}var f;if(j("⌘=",n))return(f=parseInt(p.tagName.substr(1),10)-1)>0&&(ee(e,"h"+f),J(e)),n.preventDefault(),!0;if(j("⌘-",n))return(f=parseInt(p.tagName.substr(1),10)+1)<7&&(ee(e,"h"+f),J(e)),n.preventDefault(),!0;"Backspace"!==n.key||(0,s._0)(n)||n.shiftKey||n.altKey||1!==p.textContent.length||te(e)}if(Tt(e,r,n))return!0;if(n.altKey&&"Enter"===n.key&&!(0,s._0)(n)&&!n.shiftKey){var h=(0,g._Y)(i,"A"),v=(0,g.Th)(i,"data-type","link-ref"),b=(0,g.Th)(i,"data-type","footnotes-ref");if(h||v||b||p&&2===p.tagName.length){var w=e.wysiwyg.popover.querySelector("input");w.focus(),w.select()}}if(re(e,n))return!0;if(j("^!i",n)&&fe(r,e),j("^!j",n)&&me(r,e),ft(e,r,n))return!0;if(!(0,s._0)(n)&&n.shiftKey&&!n.altKey&&"Enter"===n.key&&"LI"!==i.parentElement.tagName&&"P"!==i.parentElement.tagName)return["STRONG","STRIKE","S","I","EM","B"].includes(i.parentElement.tagName)?r.insertNode(document.createTextNode("\n"+t.Y.ZWSP)):r.insertNode(document.createTextNode("\n")),r.collapse(!1),(0,N.jl)(r),J(e),Ne(e),n.preventDefault(),!0;if("Backspace"===n.key&&!(0,s._0)(n)&&!n.shiftKey&&!n.altKey&&""===r.toString()){if(Ct(e,r,n,a))return!0;if(o){if(o.previousElementSibling&&o.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&"0"===o.previousElementSibling.getAttribute("data-block")&&"UL"!==o.tagName&&"OL"!==o.tagName){var E=(0,N.ED)(o,e.wysiwyg.element,r).start;if(0===E&&0===r.startOffset||1===E&&o.innerText.startsWith(t.Y.ZWSP))return ne(o.previousElementSibling.lastElementChild,e,!1),""===o.innerHTML.trim().replace(t.Y.ZWSP,"")&&(o.remove(),J(e)),n.preventDefault(),!0}var k=r.startOffset;if(""===r.toString()&&3===i.nodeType&&"\n"===i.textContent.charAt(k-2)&&i.textContent.charAt(k-1)!==t.Y.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(i.parentElement.tagName))return i.textContent=i.textContent.substring(0,k-1)+t.Y.ZWSP,r.setStart(i,k),r.collapse(!0),J(e),n.preventDefault(),!0;i.textContent===t.Y.ZWSP&&1===r.startOffset&&!i.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-entity"!==t.getAttribute("data-type")&&"html-inline"!==t.getAttribute("data-type"))}(r)&&(i.textContent=""),o.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach((function(e){e.firstElementChild.style.display="inline",e.lastElementChild.style.display="none"})),o.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach((function(e){e.firstElementChild.style.display="inline",e.lastElementChild.style.display="none"}))}}if((0,s.gm)()&&1===r.startOffset&&i.textContent.indexOf(t.Y.ZWSP)>-1&&i.previousSibling&&3!==i.previousSibling.nodeType&&"CODE"===i.previousSibling.tagName&&("Backspace"===n.key||"ArrowLeft"===n.key))return r.selectNodeContents(i.previousSibling),r.collapse(!1),n.preventDefault(),!0;if(Lt(n,o,r))return n.preventDefault(),!0;if(Qe(r,n.key),"ArrowDown"===n.key){var S=i.nextSibling;S&&3!==S.nodeType&&"math-inline"===S.getAttribute("data-type")&&r.setStartAfter(S)}return!(!o||!O(o,e,n,r)||(n.preventDefault(),0))}(e,n))return void n.stopPropagation()}else if("ir"===e.currentMode&&function(e,n){if(e.ir.composingLock=n.isComposing,n.isComposing)return!1;-1!==n.key.indexOf("Arrow")||"Meta"===n.key||"Control"===n.key||"Alt"===n.key||"Shift"===n.key||"CapsLock"===n.key||"Escape"===n.key||/^F\d{1,2}$/.test(n.key)||e.undo.recordFirstPosition(e,n);var r=(0,N.RN)(e),i=r.startContainer;if(!Xe(n,e,i))return!1;if($e(r,e,n),_t(r),"Enter"!==n.key&&"Tab"!==n.key&&"Backspace"!==n.key&&-1===n.key.indexOf("Arrow")&&!(0,s._0)(n)&&"Escape"!==n.key&&"Delete"!==n.key)return!1;var o=(0,g.Th)(i,"data-newline","1");if(!(0,s._0)(n)&&!n.altKey&&!n.shiftKey&&"Enter"===n.key&&o&&r.startOffset-1&&f){var v=tt(f);if(v&&ot(e,n,r,f,v))return!0;var b=nt(f);if(b&&it(e,n,r,f,b))return!0}if(Et(e,n,r))return!0;if(Tt(e,r,n))return!0;if(ft(e,r,n))return!0;var w=(0,y.c)(i);if(w){var E;if(j("⌘=",n))return(E=w.querySelector(".vditor-ir__marker--heading"))&&E.textContent.trim().length>1&&Nt(e,E.textContent.substr(1)),n.preventDefault(),!0;if(j("⌘-",n))return(E=w.querySelector(".vditor-ir__marker--heading"))&&E.textContent.trim().length<6&&Nt(e,E.textContent.trim()+"# "),n.preventDefault(),!0}var k=(0,g.pt)(i);if("Backspace"===n.key&&!(0,s._0)(n)&&!n.shiftKey&&!n.altKey&&""===r.toString()){if(Ct(e,r,n,d))return!0;if(k&&k.previousElementSibling&&"UL"!==k.tagName&&"OL"!==k.tagName&&("code-block"===k.previousElementSibling.getAttribute("data-type")||"math-block"===k.previousElementSibling.getAttribute("data-type"))){var S=(0,N.ED)(k,e.ir.element,r).start;if(0===S||1===S&&k.innerText.startsWith(t.Y.ZWSP))return r.selectNodeContents(k.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),r.collapse(!1),B(r,e),""===k.textContent.trim().replace(t.Y.ZWSP,"")&&(k.remove(),At(e)),n.preventDefault(),!0}if(w){var T=w.firstElementChild.textContent.length;(0,N.ED)(w,e.ir.element).start===T&&(r.setStart(w.firstElementChild.firstChild,T-1),r.collapse(!0),(0,N.jl)(r))}}return!(("ArrowUp"!==n.key&&"ArrowDown"!==n.key||!k||(k.querySelectorAll(".vditor-ir__node").forEach((function(e){e.contains(i)||e.classList.add("vditor-ir__node--hidden")})),!Lt(n,k,r)))&&(Qe(r,n.key),!k||!O(k,e,n,r)||(n.preventDefault(),0)))}(e,n))return;if(!function(e,t){return(R("^s",e)||R("^x",e)||R("^v",e))&&(clearTimeout(t.wysiwyg.afterRenderTimeoutId),G(t)),!1}(n,e)){if(e.options.ctrlEnter&&j("⌘Enter",n))return e.options.ctrlEnter(o(e)),void n.preventDefault();if(j("⌘Z",n)&&!e.toolbar.elements.undo)return e.undo.undo(e),void n.preventDefault();if(j("⌘Y",n)&&!e.toolbar.elements.redo)return e.undo.redo(e),void n.preventDefault();if("Escape"===n.key)return"block"===e.hint.element.style.display?e.hint.element.style.display="none":e.options.esc&&!n.isComposing&&e.options.esc(o(e)),void n.preventDefault();if((0,s._0)(n)&&n.altKey&&!n.shiftKey&&/^Digit[1-6]$/.test(n.code)){if("wysiwyg"===e.currentMode){var r=n.code.replace("Digit","H");(0,g._Y)(getSelection().getRangeAt(0).startContainer,r)?te(e):ee(e,r),J(e)}else"sv"===e.currentMode?Be(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):"ir"===e.currentMode&&Nt(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,s._0)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return"Digit7"===n.code?ke(e,"wysiwyg",n):"Digit8"===n.code?ke(e,"ir",n):"Digit9"===n.code&&ke(e,"sv",n),!0;e.options.toolbar.find((function(t){return!t.hotkey||t.toolbar?!!t.toolbar&&!!t.toolbar.find((function(t){return!!t.hotkey&&(j(t.hotkey,n)?(e.toolbar.elements[t.name].children[0].dispatchEvent(new CustomEvent((0,s.y3)())),n.preventDefault(),!0):void 0)})):j(t.hotkey,n)?(e.toolbar.elements[t.name].children[0].dispatchEvent(new CustomEvent((0,s.y3)())),n.preventDefault(),n.stopPropagation(),!0):void 0}))}}}))},De=function(e,t){t.addEventListener("selectstart",(function(n){t.onmouseup=function(){setTimeout((function(){var t=Te(e[e.currentMode].element);t.trim()?("wysiwyg"===e.currentMode&&e.options.comment.enable&&((0,g.Th)(n.target,"data-type","footnotes-block")||(0,g.Th)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.hideComment():e.wysiwyg.showComment()),e.options.select&&e.options.select(t)):"wysiwyg"===e.currentMode&&e.options.comment.enable&&e.wysiwyg.hideComment()}))}}))},Oe=function(e,t){var n=(0,N.RN)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,g.Th)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i=e.lute.SpinVditorSVDOM(r.textContent);i=i.indexOf('data-type="footnotes-link"')>-1||i.indexOf('data-type="link-ref-defs-block"')>-1?"
    "+i+"
    ":"
    "+i.replace(/
    \n<\/span><\/span>
    \n<\/span><\/span>
    \n

    \n
    <')+"
    ",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,(0,N.ir)(e.sv.element,n),Ne(e)},Ie=function(e,t,n){void 0===n&&(n=!0);var r=e;for(3===r.nodeType&&(r=r.parentElement);r;){if(r.getAttribute("data-type")===t)return r;r=n?r.previousElementSibling:r.nextElementSibling}return!1},je=function(e,t){b("SpinVditorSVDOM",e,"argument",t.options.debugger);var n=t.lute.SpinVditorSVDOM(e);return e=n.indexOf('data-type="footnotes-link"')>-1||n.indexOf('data-type="link-ref-defs-block"')>-1?"
    "+n+"
    ":"
    "+n.replace(/
    \n<\/span><\/span>
    \n<\/span><\/span>
    \n

    \n
    <')+"
    ",b("SpinVditorSVDOM",e,"result",t.options.debugger),e},Re=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,r=t&&"text"!==t&&"table"!==t&&"heading-marker"!==t&&"newline"!==t&&"yaml-front-matter-open-marker"!==t&&"yaml-front-matter-close-marker"!==t&&"code-block-info"!==t&&"code-block-close-marker"!==t&&"code-block-open-marker"!==t?e.textContent:"",i=!1;for("newline"===t&&(i=!0);n&&!i;){var o=n.getAttribute("data-type");if("li-marker"===o||"blockquote-marker"===o||"task-marker"===o||"padding"===o){var a=n.textContent;if("li-marker"!==o||"code-block-open-marker"!==t&&"code-block-info"!==t)if("code-block-close-marker"===t&&n.nextElementSibling.isSameNode(e)){var l=Ie(e,"code-block-open-marker");l&&l.previousElementSibling&&(n=l.previousElementSibling,r=a+r)}else r=a+r;else r=a.replace(/\S/g," ")+r}else"newline"===o&&(i=!0);n=n.previousElementSibling}return r},Pe=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),e.preview.render(e);var n=o(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&&(0,s.D)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),clearTimeout(e.sv.processTimeoutId),e.sv.processTimeoutId=window.setTimeout((function(){t.enableAddUndoStack&&!e.sv.composingLock&&e.undo.addToUndoStack(e)}),e.options.undoDelay)},Be=function(e,t){var n=(0,N.RN)(e),r=(0,y.f)(n.startContainer,"SPAN");r&&""!==r.textContent.trim()&&(t="\n"+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},qe=function(e,t,n,r){var i=(0,N.RN)(e),o=t.getAttribute("data-type");0===e.sv.element.childNodes.length&&(e.sv.element.innerHTML='
    \n
    ',(0,N.ir)(e.sv.element,i));var a=(0,g.pt)(i.startContainer),l=(0,y.f)(i.startContainer,"SPAN");if(a){if("link"===o){var s=void 0;return s=""===i.toString()?""+n+Lute.Caret+r:""+n+i.toString()+r.replace(")",Lute.Caret+")"),void document.execCommand("insertHTML",!1,s)}if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o||"line"===o){s=void 0;return s=""===i.toString()?""+n+Lute.Caret+("code"===o?"":r):""+n+i.toString()+Lute.Caret+("code"===o?"":r),"table"===o||"code"===o&&l&&""!==l.textContent?s="\n\n"+s:"line"===o&&(s="\n\n"+n+"\n"+Lute.Caret),void document.execCommand("insertHTML",!1,s)}if(("check"===o||"list"===o||"ordered-list"===o||"quote"===o)&&l){var d="* ";"check"===o?d="* [ ] ":"ordered-list"===o?d="1. ":"quote"===o&&(d="> ");var c=Ie(l,"newline");return c?c.insertAdjacentText("afterend",d):a.insertAdjacentText("afterbegin",d),void V(e)}(0,N.ir)(e.sv.element,i),Pe(e)}},Ve=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},Ye=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])}))},Ue=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())}))},Ke=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]"+window.VditorI18n.nameEmpty+"",s=!1),l.size>e.options.upload.max&&(r+="
  • "+l.name+" "+window.VditorI18n.over+" "+e.options.upload.max/1024/1024+"M
  • ",s=!1);var d=l.name.lastIndexOf("."),c=l.name.substr(d),u=e.options.upload.filename(l.name.substr(0,d))+c;e.options.upload.accept&&(e.options.upload.accept.split(",").some((function(e){var t=e.trim();if(0===t.indexOf(".")){if(c.toLowerCase()===t.toLowerCase())return!0}else if(l.type.split("/")[0]===t.split("/")[0])return!0;return!1}))||(r+="
  • "+l.name+" "+window.VditorI18n.fileTypeError+"
  • ",s=!1)),s&&(n.push(l),i+="
  • "+u+" "+window.VditorI18n.uploading+"
  • ")}),a=t.length,l=0;l"+r+i+""),n}(e,r),0===s.length)return n&&(n.value=""),[2];for(d=new FormData,c=e.options.upload.extraData,u=0,p=Object.keys(c);u=200&&v.status<300)if(e.options.upload.success)e.options.upload.success(l,v.responseText);else{var r=v.responseText;e.options.upload.format&&(r=e.options.upload.format(t,v.responseText)),function(e,t){Ve(t).focus();var n=JSON.parse(e),r="";1===n.code&&(r=""+n.msg),n.data.errFiles&&n.data.errFiles.length>0&&(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+" "+window.VditorI18n.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;0===(a=a.toLowerCase()).indexOf(".wav")||0===a.indexOf(".mp3")||0===a.indexOf(".ogg")?"wysiwyg"===t.currentMode?i+='
    <audio controls="controls" src="'+r+'"></audio>
    \n':"ir"===t.currentMode?i+='\n':i+="["+l+"]("+r+")\n":0===a.indexOf(".apng")||0===a.indexOf(".bmp")||0===a.indexOf(".gif")||0===a.indexOf(".ico")||0===a.indexOf(".cur")||0===a.indexOf(".jpg")||0===a.indexOf(".jpeg")||0===a.indexOf(".jfif")||0===a.indexOf(".pjp")||0===a.indexOf(".pjpeg")||0===a.indexOf(".png")||0===a.indexOf(".svg")||0===a.indexOf(".webp")?"wysiwyg"===t.currentMode?i+=''+l+'\n':i+="!["+l+"]("+r+")\n":"wysiwyg"===t.currentMode?i+=''+l+"\n":i+="["+l+"]("+r+")\n"})),(0,N.jl)(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),[2]}}))}))},Fe=function(e,n,r){var i,o=(0,g.pt)(n.startContainer);if(o||(o=e.wysiwyg.element),r&&"formatItalic"!==r.inputType&&"deleteByDrag"!==r.inputType&&"insertFromDrop"!==r.inputType&&"formatBold"!==r.inputType&&"formatRemove"!==r.inputType&&"formatStrikeThrough"!==r.inputType&&"insertUnorderedList"!==r.inputType&&"insertOrderedList"!==r.inputType&&"formatOutdent"!==r.inputType&&"formatIndent"!==r.inputType&&""!==r.inputType||!r){var a=function(e){for(var n=e.previousSibling;n;){if(3!==n.nodeType&&"A"===n.tagName&&!n.previousSibling&&""===n.innerHTML.replace(t.Y.ZWSP,"")&&n.nextSibling)return n;n=n.previousSibling}return!1}(n.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr")),o.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),o.querySelectorAll(".vditor-comment").forEach((function(e){""===e.textContent.trim()&&(e.classList.remove("vditor-comment","vditor-comment--focus"),e.removeAttribute("data-cmtids"))})),null===(i=o.previousElementSibling)||void 0===i||i.querySelectorAll(".vditor-comment").forEach((function(e){""===e.textContent.trim()&&(e.classList.remove("vditor-comment","vditor-comment--focus"),e.removeAttribute("data-cmtids"))}));var l="";"link-ref-defs-block"===o.getAttribute("data-type")&&(o=e.wysiwyg.element);var s=o.isEqualNode(e.wysiwyg.element),d=(0,g.Th)(o,"data-type","footnotes-block");if(s)l=o.innerHTML;else{var c=(0,g.KR)(n.startContainer);if(c&&!d){var u=(0,y.f)(n.startContainer,"BLOCKQUOTE");o=u?(0,g.pt)(n.startContainer)||o:c}if(d&&(o=d),l=o.outerHTML,"UL"===o.tagName||"OL"===o.tagName){var p=o.previousElementSibling,m=o.nextElementSibling;!p||"UL"!==p.tagName&&"OL"!==p.tagName||(l=p.outerHTML+l,p.remove()),!m||"UL"!==m.tagName&&"OL"!==m.tagName||(l+=m.outerHTML,m.remove()),l=l.replace("

    ","

  • ")}o.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e){e&&!o.isEqualNode(e)&&(l+=e.outerHTML,e.remove())})),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach((function(e){e&&!o.isEqualNode(e)&&(l+=e.outerHTML,e.remove())})))}'

    ```

    '===(l=l.replace(/<\/(strong|b)>/g,"").replace(/<\/(em|i)>/g,"").replace(/<\/(s|strike)>/g,""))&&e.hint.recentLanguage&&(l='

    ```

    '.replace("```","```"+e.hint.recentLanguage)),b("SpinVditorDOM",l,"argument",e.options.debugger);var f,h=l;if(l=e.lute.SpinVditorDOM(l),b("SpinVditorDOM",l,"result",e.options.debugger),s)o.innerHTML=l;else if(l.match(/vditor-wysiwyg__pre\b/)&&!h.match(/```/)||(o.outerHTML=l.replace('alt=""','alt="img"')),d){var v=(0,g.Ab)(e.wysiwyg.element.querySelector("wbr"),"LI");if(v){var w=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+v.getAttribute("data-marker")+'"]');w&&w.setAttribute("aria-label",v.textContent.trim().substr(0,24))}}var E,k=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");k.forEach((function(e,t){0===t?f=e:(f.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),k.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",k[0]);var S=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");S.forEach((function(e,t){0===t?E=e:(E.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),S.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",S[0]),(0,N.ir)(e.wysiwyg.element,n),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){A(t,e)})),r&&("deleteContentBackward"===r.inputType||"deleteContentForward"===r.inputType)&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}H(e),J(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},Ze=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Je=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())}))},Ge=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]-1||(0,s._0)(r)||"Escape"===r.key||r.shiftKey||r.altKey)){var i=(0,g._Y)(e.startContainer,"P")||(0,g._Y)(e.startContainer,"LI");if(i&&0===(0,N.ED)(i,n[n.currentMode].element,e).start){var o=document.createTextNode(t.Y.ZWSP);e.insertNode(o),e.setStartAfter(o)}}},Qe=function(e,t){if("ArrowDown"===t||"ArrowUp"===t){var n=(0,g.Th)(e.startContainer,"data-type","math-inline")||(0,g.Th)(e.startContainer,"data-type","html-entity")||(0,g.Th)(e.startContainer,"data-type","html-inline");n&&("ArrowDown"===t&&e.setStartAfter(n.parentElement),"ArrowUp"===t&&e.setStartBefore(n.parentElement))}},et=function(e,n){var r=(0,N.RN)(e),i=(0,g.pt)(r.startContainer);i&&(i.insertAdjacentHTML(n,'

    '+t.Y.ZWSP+"\n

    "),(0,N.ir)(e[e.currentMode].element,r),ge(e),pt(e))},tt=function(e){var t=(0,g._Y)(e,"TABLE");return!(!t||!t.rows[0].cells[0].isSameNode(e))&&t},nt=function(e){var t=(0,g._Y)(e,"TABLE");return!(!t||!t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e))&&t},rt=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),(0,N.jl)(t)),r},it=function(e,n,r,i,o){var a=(0,N.ED)(i,e[e.currentMode].element,r);if("ArrowDown"===n.key&&-1===i.textContent.trimRight().substr(a.start).indexOf("\n")||"ArrowRight"===n.key&&a.start>=i.textContent.trimRight().length){var l=o.nextElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(o.insertAdjacentHTML("afterend",'

    '+t.Y.ZWSP+"

    "),(0,N.ir)(e[e.currentMode].element,r)):(r.selectNodeContents(l),r.collapse(!0),(0,N.jl)(r)),n.preventDefault(),!0}return!1},ot=function(e,n,r,i,o){var a=(0,N.ED)(i,e[e.currentMode].element,r);if("ArrowUp"===n.key&&-1===i.textContent.substr(0,a.start).indexOf("\n")||("ArrowLeft"===n.key||"Backspace"===n.key&&""===r.toString())&&0===a.start){var l=o.previousElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(o.insertAdjacentHTML("beforebegin",'

    '+t.Y.ZWSP+"

    "),(0,N.ir)(e[e.currentMode].element,r)):(r.selectNodeContents(l),r.collapse(!1),(0,N.jl)(r)),n.preventDefault(),!0}return!1},at=function(e,t,n,r){void 0===r&&(r=!0);var i=(0,g._Y)(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;"list"===n?(s=document.createElement("ul")).setAttribute("data-marker","*"):(s=document.createElement("ol")).setAttribute("data-marker","1."),s.setAttribute("data-block","0"),s.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),s.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(s,i.parentElement)}else{var d=(0,g.Th)(t.startContainer,"data-block","0");d||(e[e.currentMode].element.querySelector("wbr").remove(),(d=e[e.currentMode].element.querySelector("p")).innerHTML=""),"check"===n?(d.insertAdjacentHTML("beforebegin",'
    • '+d.innerHTML+"
    "),d.remove()):"list"===n?(d.insertAdjacentHTML("beforebegin",'
    • '+d.innerHTML+"
    "),d.remove()):"ordered-list"===n&&(d.insertAdjacentHTML("beforebegin",'
    1. '+d.innerHTML+"
    "),d.remove())}},lt=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach((function(e,n){3!==e.nodeType&&t&&""!==e.textContent.trim()&&t.getAttribute("data-node-id")===e.getAttribute("data-node-id")&&(0!==n&&i.push(t),t=t.nextElementSibling)})),e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr"));var o=r.parentElement,a="";i.forEach((function(e){var t=e.getAttribute("data-marker");1!==t.length&&(t="1"+t.slice(-1)),a+='
  • '+e.innerHTML+"
  • ",e.remove()})),r.insertAdjacentHTML("beforeend","<"+o.tagName+' data-block="0">'+a+""),"wysiwyg"===e.currentMode?o.outerHTML=e.lute.SpinVditorDOM(o.outerHTML):o.outerHTML=e.lute.SpinVditorIRDOM(o.outerHTML),(0,N.ir)(e[e.currentMode].element,n);var l=(0,g.KR)(n.startContainer);l&&l.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){A(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),pt(e),ge(e)}else e[e.currentMode].element.focus()},st=function(e,t,n,r){var i=(0,g._Y)(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=[t];Array.from(n.cloneContents().children).forEach((function(e,n){3!==e.nodeType&&t&&""!==e.textContent.trim()&&t.getAttribute("data-node-id")===e.getAttribute("data-node-id")&&(0!==n&&l.push(t),t=t.nextElementSibling)}));var s=!1,d="";o.querySelectorAll("li").forEach((function(e){s&&(d+=e.outerHTML,e.nextElementSibling||e.previousElementSibling?e.remove():e.parentElement.remove()),e.isSameNode(l[l.length-1])&&(s=!0)})),l.reverse().forEach((function(e){i.insertAdjacentElement("afterend",e)})),d&&(a.innerHTML=d,l[0].insertAdjacentElement("beforeend",a)),"wysiwyg"===e.currentMode?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,N.ir)(e[e.currentMode].element,n);var c=(0,g.KR)(n.startContainer);c&&c.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){A(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),pt(e),ge(e)}else e[e.currentMode].element.focus()},dt=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")))))},ut=function(e){var t=e.trimRight().split("\n");return 0!==(e=t.pop()).indexOf(" ")&&0!==e.indexOf("\t")&&(""!==(e=e.trimLeft())&&0!==t.length&&(""===e.replace(/-/g,"")||""===e.replace(/=/g,"")))},pt=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),"wysiwyg"===e.currentMode?J(e,t):"ir"===e.currentMode?At(e,t):"sv"===e.currentMode&&Pe(e,t)},mt=function(e,n,r,i){var o,a=e.startContainer,l=(0,g._Y)(a,"LI");if(l){if(!(0,s._0)(i)&&!i.altKey&&"Enter"===i.key&&!i.shiftKey&&r&&l.contains(r)&&r.nextElementSibling)return l&&!l.textContent.endsWith("\n")&&l.insertAdjacentText("beforeend","\n"),e.insertNode(document.createTextNode("\n\n")),e.collapse(!1),pt(n),i.preventDefault(),!0;if(!((0,s._0)(i)||i.shiftKey||i.altKey||"Backspace"!==i.key||l.previousElementSibling||""!==e.toString()||0!==(0,N.ED)(l,n[n.currentMode].element,e).start))return l.nextElementSibling?(l.parentElement.insertAdjacentHTML("beforebegin",'

    '+l.innerHTML+"

    "),l.remove()):l.parentElement.outerHTML='

    '+l.innerHTML+"

    ",(0,N.ir)(n[n.currentMode].element,e),pt(n),i.preventDefault(),!0;if(!(0,s._0)(i)&&!i.shiftKey&&!i.altKey&&"Backspace"===i.key&&""===l.textContent.trim().replace(t.Y.ZWSP,"")&&""===e.toString()&&"LI"===(null===(o=l.previousElementSibling)||void 0===o?void 0:o.tagName))return l.previousElementSibling.insertAdjacentText("beforeend","\n\n"),e.selectNodeContents(l.previousElementSibling),e.collapse(!1),l.remove(),(0,N.ir)(n[n.currentMode].element,e),pt(n),i.preventDefault(),!0;if(!(0,s._0)(i)&&!i.altKey&&"Tab"===i.key){var d=!1;if((0===e.startOffset&&(3===a.nodeType&&!a.previousSibling||3!==a.nodeType&&"LI"===a.nodeName)||l.classList.contains("vditor-task")&&1===e.startOffset&&3!==a.previousSibling.nodeType&&"INPUT"===a.previousSibling.tagName)&&(d=!0),d||""!==e.toString())return i.shiftKey?st(n,l,e,l.parentElement):lt(n,l,e),i.preventDefault(),!0}}return!1},ft=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))),(0,N.jl)(t),pt(e),n.preventDefault(),!0},ht=function(e,t,n,r){if(n){if(!(0,s._0)(e)&&!e.altKey&&"Enter"===e.key){var i=String.raw(ve||(ve=Ze(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),o=i.split("|");if(i.startsWith("|")&&i.endsWith("|")&&o.length>3){var a=o.map((function(){return"---"})).join("|");return a=n.textContent+"\n"+a.substring(3,a.length-3)+"\n|",n.outerHTML=t.lute.SpinVditorDOM(a),(0,N.ir)(t[t.currentMode].element,r),pt(t),Ne(t),e.preventDefault(),!0}if(ct(n.innerHTML)&&n.previousElementSibling){var l="",d=n.innerHTML.trimRight().split("\n");return d.length>1&&(d.pop(),l='

    '+d.join("\n")+"

    "),n.insertAdjacentHTML("afterend",l+'

    \n

    '),n.remove(),(0,N.ir)(t[t.currentMode].element,r),pt(t),Ne(t),e.preventDefault(),!0}if(ut(n.innerHTML))return"wysiwyg"===t.currentMode?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+'

    \n

    '):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+'

    \n

    '),(0,N.ir)(t[t.currentMode].element,r),pt(t),Ne(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&"Backspace"===e.key&&!(0,s._0)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split("\n").length>1&&0===(0,N.ED)(n,t[t.currentMode].element,r).start){var c=(0,g.Rp)(n.previousElementSibling);return c.textContent.endsWith("\n")||(c.textContent=c.textContent+"\n"),c.parentElement.insertAdjacentHTML("beforeend",""+n.innerHTML),n.remove(),(0,N.ir)(t[t.currentMode].element,r),!1}return!1}},vt=function(e,t,n){for(var r="",i=0;i ';"TH"===n.tagName?n.parentElement.parentElement.insertAdjacentHTML("afterend",""+r+""):n.parentElement.insertAdjacentHTML("afterend",""+r+""),pt(e)},gt=function(e,t,n){for(var r="",i=0;i ':r+=' ';if("TH"===n.tagName){n.parentElement.parentElement.insertAdjacentHTML("beforebegin",""+r+""),t.insertNode(document.createElement("wbr"));var o=n.parentElement.innerHTML.replace(//g,"").replace(/<\/th>/g,"");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",o),n.parentElement.parentElement.remove(),(0,N.ir)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin",""+r+"");pt(e)},yt=function(e,t,n,r){void 0===r&&(r="afterend");for(var i=0,o=n.previousElementSibling;o;)i++,o=o.previousElementSibling;for(var a=0;a "):t.rows[a].cells[i].insertAdjacentHTML(r," ");pt(e)},bt=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),(0,N.jl)(t),pt(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),pt(e),Ne(e),t.preventDefault(),!0}if("Tab"===t.key)return t.shiftKey?(rt(i,n),t.preventDefault(),!0):((u=i.nextElementSibling)||(u=i.parentElement.nextElementSibling?i.parentElement.nextElementSibling.firstElementChild:"THEAD"===i.parentElement.parentElement.tagName&&i.parentElement.parentElement.nextElementSibling?i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:null),u&&(n.selectNodeContents(u),(0,N.jl)(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),(0,N.jl)(n)):et(e,"beforebegin"),!0;for(var l=0,d=i.parentElement;l\n

    ',(0,N.ir)(e[e.currentMode].element,n)):(n.setStartBefore(a),n.collapse(!0)),pt(e)),t.preventDefault(),!0;if(j("⇧⌘F",t))return gt(e,n,i),t.preventDefault(),!0;if(j("⌘=",t))return vt(e,n,i),t.preventDefault(),!0;if(j("⇧⌘G",t))return yt(e,a,i,"beforebegin"),t.preventDefault(),!0;if(j("⇧⌘=",t))return yt(e,a,i),t.preventDefault(),!0;if(j("⌘-",t))return bt(e,n,i),t.preventDefault(),!0;if(j("⇧⌘-",t))return wt(e,n,a,i),t.preventDefault(),!0;if(j("⇧⌘L",t)){if("ir"===e.currentMode)return dt(a,"left"),pt(e),t.preventDefault(),!0;if(m=e.wysiwyg.popover.querySelector('[data-type="left"]'))return m.click(),t.preventDefault(),!0}if(j("⇧⌘C",t)){if("ir"===e.currentMode)return dt(a,"center"),pt(e),t.preventDefault(),!0;if(m=e.wysiwyg.popover.querySelector('[data-type="center"]'))return m.click(),t.preventDefault(),!0}if(j("⇧⌘R",t)){if("ir"===e.currentMode)return dt(a,"right"),pt(e),t.preventDefault(),!0;var m;if(m=e.wysiwyg.popover.querySelector('[data-type="right"]'))return m.click(),t.preventDefault(),!0}}return!1},kt=function(e,t,n,r){if("PRE"===n.tagName&&j("⌘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),pt(e),t.preventDefault(),!0;if("Backspace"===t.key&&!(0,s._0)(t)&&!t.shiftKey&&!t.altKey){var i=(0,N.ED)(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+"

    ",(0,N.ir)(e[e.currentMode].element,r),pt(e),t.preventDefault(),!0}return!(0,s._0)(t)&&!t.altKey&&"Enter"===t.key&&(n.firstElementChild.textContent.endsWith("\n")||n.firstElementChild.insertAdjacentText("beforeend","\n"),r.extractContents(),r.insertNode(document.createTextNode("\n")),r.collapse(!1),(0,N.jl)(r),(0,s.gm)()||("wysiwyg"===e.currentMode?Fe(e,r):I(e,r)),Ne(e),t.preventDefault(),!0)},St=function(e,n,r,i){var o=n.startContainer,a=(0,g._Y)(o,"BLOCKQUOTE");if(a&&""===n.toString()){if("Backspace"===r.key&&!(0,s._0)(r)&&!r.shiftKey&&!r.altKey&&0===(0,N.ED)(a,e[e.currentMode].element,n).start)return n.insertNode(document.createElement("wbr")),a.outerHTML=a.innerHTML,(0,N.ir)(e[e.currentMode].element,n),pt(e),r.preventDefault(),!0;if(i&&"Enter"===r.key&&!(0,s._0)(r)&&!r.shiftKey&&!r.altKey&&"BLOCKQUOTE"===i.parentElement.tagName){var l=!1;if("\n"===i.innerHTML.replace(t.Y.ZWSP,"")||""===i.innerHTML.replace(t.Y.ZWSP,"")?(l=!0,i.remove()):i.innerHTML.endsWith("\n\n")&&(0,N.ED)(i,e[e.currentMode].element,n).start===i.textContent.length-1&&(i.innerHTML=i.innerHTML.substr(0,i.innerHTML.length-2),l=!0),l)return a.insertAdjacentHTML("afterend",'

    '+t.Y.ZWSP+"\n

    "),(0,N.ir)(e[e.currentMode].element,n),pt(e),r.preventDefault(),!0}var d=(0,g.pt)(o);if("wysiwyg"===e.currentMode&&d&&j("⇧⌘;",r))return n.insertNode(document.createElement("wbr")),d.outerHTML='
    '+d.outerHTML+"
    ",(0,N.ir)(e.wysiwyg.element,n),J(e),r.preventDefault(),!0;if(it(e,r,n,a,a))return!0;if(ot(e,r,n,a,a))return!0}return!1},Tt=function(e,t,n){var r=t.startContainer,i=(0,g.KJ)(r,"vditor-task");if(i){if(j("⇧⌘J",n)){var o=i.firstElementChild;return o.checked?o.removeAttribute("checked"):o.setAttribute("checked","checked"),pt(e),n.preventDefault(),!0}if("Backspace"===n.key&&!(0,s._0)(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)(0,g.Rp)(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(0,N.ir)(e[e.currentMode].element,t),pt(e),n.preventDefault(),!0}if("Enter"===n.key&&!(0,s._0)(n)&&!n.shiftKey&&!n.altKey){if(""===i.textContent.trim())if((0,g.KJ)(i.parentElement,"vditor-task")){var l=(0,g.KR)(r);l&&st(e,i,t,l)}else if(i.nextElementSibling){var d="",c="",u=!1;Array.from(i.parentElement.children).forEach((function(e){i.isSameNode(e)?u=!0:u?d+=e.outerHTML:c+=e.outerHTML}));var p=i.parentElement.tagName,m="OL"===i.parentElement.tagName?"":' data-marker="'+i.parentElement.getAttribute("data-marker")+'"',f="";c&&(f="UL"===i.parentElement.tagName?"":' start="1"',c="<"+p+' data-tight="true"'+m+' data-block="0">'+c+""),i.parentElement.outerHTML=c+'

    \n

    <'+p+'\n data-tight="true"'+m+' data-block="0"'+f+">"+d+""}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(0,N.ir)(e[e.currentMode].element,t),pt(e),Ne(e),n.preventDefault(),!0}}return!1},Ct=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===(0,N.ED)(r,e[e.currentMode].element,t).start&&((0,s.gm)()&&"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(0,N.ir)(e[e.currentMode].element,t),pt(e),n.preventDefault(),!0}}return!1},_t=function(e){(0,s.gm)()&&3!==e.startContainer.nodeType&&"HR"===e.startContainer.tagName&&e.setStartBefore(e.startContainer)},Lt=function(e,t,n){var r,i;if(!(0,s.gm)())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)},Mt=function(e,n,r){return Je(void 0,void 0,void 0,(function(){var i,o,a,l,s,d,c,u,p,m,f,h,v,y,b,w;return Ge(this,(function(E){switch(E.label){case 0:return"true"!==e[e.currentMode].element.getAttribute("contenteditable")?[2]:(n.stopPropagation(),n.preventDefault(),"clipboardData"in n?(i=n.clipboardData.getData("text/html"),o=n.clipboardData.getData("text/plain"),a=n.clipboardData.files):(i=n.dataTransfer.getData("text/html"),o=n.dataTransfer.getData("text/plain"),n.dataTransfer.types.includes("Files")&&(a=n.dataTransfer.items)),l={},s=function(t,n){if(!n)return["",Lute.WalkContinue];var r=t.TokensStr();if(34===t.__internal_object__.Parent.Type&&r&&-1===r.indexOf("file://")&&e.options.upload.linkToImgUrl){var i=new XMLHttpRequest;i.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&i.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(i.withCredentials=!0),Ye(e,i),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){if(200===i.status){var t=i.responseText;e.options.upload.linkToImgFormat&&(t=e.options.upload.linkToImgFormat(i.responseText));var n=JSON.parse(t);if(0!==n.code)return void e.tip.show(n.msg);var r=n.data.originalURL;if("sv"===e.currentMode)e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach((function(e){e.textContent===r&&(e.textContent=n.data.url)}));else{var o=e[e.currentMode].element.querySelector('img[src="'+r+'"]');o.src=n.data.url,"ir"===e.currentMode&&(o.previousElementSibling.previousElementSibling.innerHTML=n.data.url)}pt(e)}else e.tip.show(i.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(i.responseText)}},i.send(JSON.stringify({url:r}))}return"ir"===e.currentMode?[''+Lute.EscapeHTMLStr(r)+"",Lute.WalkContinue]:"wysiwyg"===e.currentMode?["",Lute.WalkContinue]:[''+Lute.EscapeHTMLStr(r)+"",Lute.WalkContinue]},i.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!==''+o+""&&i.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='\x3c!--StartFragment--\x3e'+o+"\x3c!--EndFragment--\x3e"||(i=""),(d=(new DOMParser).parseFromString(i,"text/html")).body&&(i=d.body.innerHTML),i=Lute.Sanitize(i),e.wysiwyg.getComments(e),c=e[e.currentMode].element.scrollHeight,void 0===e.currentMode&&"sv",u=!1,(p="sv"===e.currentMode?(0,g.Th)(n.target,"data-type","code-block"):(0,g._Y)(n.target,"CODE"))?("sv"===e.currentMode?document.execCommand("insertHTML",!1,o.replace(/&/g,"&").replace(/0?e.options.upload.url||e.options.upload.handler?[4,ze(e,a)]:[3,5]:[3,7];case 4:return E.sent(),[3,6];case 5:h=new FileReader,"clipboardData"in n?(a=n.clipboardData.files,v=a[0]):n.dataTransfer.types.includes("Files")&&(a=n.dataTransfer.items,v=a[0].getAsFile()),v&&v.type.startsWith("image")&&(h.readAsDataURL(v),h.onload=function(){var t="";"wysiwyg"===e.currentMode?t+=''+v.name+'\n':t+="!["+v.name+"]("+h.result.toString()+")\n",document.execCommand("insertHTML",!1,t)}),E.label=6;case 6:return[3,8];case 7:""!==o.trim()&&0===a.length&&("ir"===e.currentMode?(l.Md2VditorIRDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.Z2)(e.lute.Md2VditorIRDOM(o),e)):"wysiwyg"===e.currentMode?(l.Md2VditorDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.Z2)(e.lute.Md2VditorDOM(o),e)):(l.Md2VditorSVDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Oe(e,o)),e.outline.render(e)),E.label=8;case 8:return"sv"!==e.currentMode&&((y=(0,g.pt)((0,N.RN)(e).startContainer))&&(b=(0,N.RN)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),b.insertNode(document.createElement("wbr")),"wysiwyg"===e.currentMode?y.outerHTML=e.lute.SpinVditorDOM(y.outerHTML):y.outerHTML=e.lute.SpinVditorIRDOM(y.outerHTML),(0,N.ir)(e[e.currentMode].element,b)),e[e.currentMode].element.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){A(t,e)}))),e.wysiwyg.triggerRemoveComment(e),pt(e),e[e.currentMode].element.scrollHeight-c>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&Ne(e),[2]}}))}))},xt=function(e){e.hint.render(e);var n=(0,N.RN)(e).startContainer,r=(0,g.Th)(n,"data-type","code-block-info");if(r)if(""===r.textContent.replace(t.Y.ZWSP,"")&&e.hint.recentLanguage){r.textContent=t.Y.ZWSP+e.hint.recentLanguage,(0,N.RN)(e).selectNodeContents(r)}else{var i=[],o=r.textContent.substring(0,(0,N.ED)(r,e.ir.element).start).replace(t.Y.ZWSP,"");t.Y.CODE_LANGUAGES.forEach((function(e){e.indexOf(o.toLowerCase())>-1&&i.push({html:e,value:e})})),e.hint.genHTML(i,o,e)}},At=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&xt(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout((function(){if(!e.ir.composingLock){var n=o(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&&(0,s.D)()&&(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)}}),e.options.undoDelay)},Nt=function(e,t){var n=(0,N.RN)(e),r=(0,g.pt)(n.startContainer)||n.startContainer;if(r){var i=r.querySelector(".vditor-ir__marker--heading");i?i.innerHTML=t:(r.insertAdjacentText("afterbegin",t),n.selectNodeContents(r),n.collapse(!1)),I(e,n.cloneRange()),Z(e)}},Ht=function(e,t,n){var r=(0,g.Th)(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()}},Dt=function(e,t,n,r){var i=(0,N.RN)(e),o=t.getAttribute("data-type"),a=i.startContainer;3===a.nodeType&&(a=a.parentElement);var l=!0;if(t.classList.contains("vditor-menu--current"))if("quote"===o){var s=(0,g._Y)(a,"BLOCKQUOTE");s&&(i.insertNode(document.createElement("wbr")),s.outerHTML=""===s.innerHTML.trim()?'

    '+s.innerHTML+"

    ":s.innerHTML)}else if("link"===o){var c=(0,g.Th)(i.startContainer,"data-type","a");if(c){var u=(0,g.KJ)(i.startContainer,"vditor-ir__link");u?(i.insertNode(document.createElement("wbr")),c.outerHTML=u.innerHTML):c.outerHTML=c.querySelector(".vditor-ir__link").innerHTML+""}}else"italic"===o?Ht(i,e,"em"):"bold"===o?Ht(i,e,"strong"):"strike"===o?Ht(i,e,"s"):"inline-code"===o?Ht(i,e,"code"):"check"!==o&&"list"!==o&&"ordered-list"!==o||(at(e,i,o),l=!1,t.classList.remove("vditor-menu--current"));else{0===e.ir.element.childNodes.length&&(e.ir.element.innerHTML='

    ',(0,N.ir)(e.ir.element,i));var p=(0,g.pt)(i.startContainer);if("line"===o){if(p){var m='

    \n

    ';""===p.innerHTML.trim()?p.outerHTML=m:p.insertAdjacentHTML("afterend",m)}}else if("quote"===o)p&&(i.insertNode(document.createElement("wbr")),p.outerHTML='
    '+p.outerHTML+"
    ",l=!1,t.classList.add("vditor-menu--current"));else if("link"===o){var f=void 0;f=""===i.toString()?n+""+r:""+n+i.toString()+r.replace(")",")"),document.execCommand("insertHTML",!1,f),l=!1,t.classList.add("vditor-menu--current")}else if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o){f=void 0;""===i.toString()?f=n+""+r:(f="code"===o||"table"===o?""+n+i.toString()+""+r:""+n+i.toString()+r+"",i.deleteContents()),"table"!==o&&"code"!==o||(f="\n"+f+"\n\n");var h=document.createElement("span");h.innerHTML=f,i.insertNode(h),I(e,i),"table"===o&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,N.jl)(i))}else"check"!==o&&"list"!==o&&"ordered-list"!==o||(at(e,i,o,!1),l=!1,d(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,N.ir)(e.ir.element,i),At(e),l&&Z(e)},Ot=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())}))},It=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]-1&&"sv"!==r.currentMode&&o.insertNode(document.createTextNode(" ")),o.collapse(!1),(0,N.jl)(o),"wysiwyg"===r.currentMode)(d=(0,g.KJ)(o.startContainer,"vditor-wysiwyg__block"))&&d.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(d.lastElementChild.innerHTML=d.firstElementChild.innerHTML,A(d.lastElementChild,r));else if("ir"===r.currentMode){var d;(d=(0,g.KJ)(o.startContainer,"vditor-ir__marker--pre"))&&d.nextElementSibling.classList.contains("vditor-ir__preview")&&(d.nextElementSibling.innerHTML=d.innerHTML,A(d.nextElementSibling,r))}pt(r)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage="",e.push({key:":"})}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,e.options.hint.extend);if(void 0===i)this.element.style.display="none",clearTimeout(this.timeId);else e.options.hint.extend.forEach((function(n){n.key===t.splitChar&&(clearTimeout(t.timeId),t.timeId=window.setTimeout((function(){return Ot(t,void 0,void 0,(function(){var t;return It(this,(function(r){switch(r.label){case 0:return t=this.genHTML,[4,n.hint(i)];case 1:return t.apply(this,[r.sent(),i,e]),[2]}}))}))}),e.options.hint.delay))}))}},e.prototype.genHTML=function(e,t,n){var r=this;if(0!==e.length){var i=n[n.currentMode].element,o=(0,N.Ey)(i),a=o.left+("left"===n.options.outline.position?n.outline.element.offsetWidth:0),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 d=parseInt(document.defaultView.getComputedStyle(i,null).getPropertyValue("line-height"),10);this.element.style.top=l+(d||22)+"px",this.element.style.left=a+"px",this.element.style.display="block",this.element.style.right="auto",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"),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")}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!((0,s._0)(e)||e.shiftKey||e.altKey||"Enter"!==e.key||e.isComposing)&&(e.preventDefault(),e.stopPropagation(),this.fillEmoji(n,t),!0)},e.prototype.getKey=function(e,t){var n,r=this;if(this.lastIndex=-1,this.splitChar="",t.forEach((function(t){var n=e.lastIndexOf(t.key);r.lastIndex1&&a.trim()===a)if(2===o.length&&""===o[0]&&o[1].length<32)n=o[1];else{var l=o[o.length-2].slice(-1);" "===(0,i.p)(l)&&a.length<32&&(n=a)}return n},e}(),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),_e(e,this.element),Le(e,this.element),He(e,this.element),De(e,this.element),Me(e,this.element),xe(e,this.element,this.copy),Ae(e,this.element,this.copy)}return e.prototype.copy=function(e,t){var n=getSelection().getRangeAt(0);if(""!==n.toString()){e.stopPropagation(),e.preventDefault();var r=document.createElement("div");r.appendChild(n.cloneContents()),e.clipboardData.setData("text/plain",t.lute.VditorIRDOM2Md(r.innerHTML).trim()),e.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(e){var n=this;this.element.addEventListener("paste",(function(t){Mt(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})})),this.element.addEventListener("compositionstart",(function(e){n.composingLock=!0})),this.element.addEventListener("compositionend",(function(t){(0,s.gm)()||I(e,getSelection().getRangeAt(0).cloneRange()),n.composingLock=!1})),this.element.addEventListener("input",(function(t){if("deleteByDrag"!==t.inputType&&"insertFromDrop"!==t.inputType)return n.preventInput?(n.preventInput=!1,void At(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})):void(n.composingLock||"‘"===t.data||"“"===t.data||"《"===t.data||I(e,getSelection().getRangeAt(0).cloneRange(),!1,t))})),this.element.addEventListener("click",(function(r){if("INPUT"===r.target.tagName)return r.target.checked?r.target.setAttribute("checked","checked"):r.target.removeAttribute("checked"),n.preventInput=!0,void At(e);var i=(0,N.RN)(e),o=(0,g.KJ)(r.target,"vditor-ir__preview");if(o||(o=(0,g.KJ)(i.startContainer,"vditor-ir__preview")),o&&(o.previousElementSibling.firstElementChild?i.selectNodeContents(o.previousElementSibling.firstElementChild):i.selectNodeContents(o.previousElementSibling),i.collapse(!0),(0,N.jl)(i),Ne(e)),"IMG"===r.target.tagName){var a=r.target.parentElement.querySelector(".vditor-ir__marker--link");a&&(i.selectNode(a),(0,N.jl)(i))}var l=(0,g.Th)(r.target,"data-type","a");if(!l||l.classList.contains("vditor-ir__node--expand")){if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&i.collapsed){var s=n.element.lastElementChild.getBoundingClientRect();r.y>s.top+s.height&&("P"===n.element.lastElementChild.tagName&&""===n.element.lastElementChild.textContent.trim().replace(t.Y.ZWSP,"")?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'

    '+t.Y.ZWSP+"

    "),(0,N.ir)(n.element,i)))}""===i.toString()?B(i,e):setTimeout((function(){B((0,N.RN)(e),e)})),D(r,e),Z(e)}else window.open(l.querySelector(":scope > .vditor-ir__marker--link").textContent)})),this.element.addEventListener("keyup",(function(r){if(!r.isComposing&&!(0,s._0)(r))if("Enter"===r.key&&Ne(e),Z(e),"Backspace"!==r.key&&"Delete"!==r.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 i=(0,N.RN)(e);"Backspace"===r.key?((0,s.gm)()&&"\n"===i.startContainer.textContent&&1===i.startOffset&&(i.startContainer.textContent="",B(i,e)),n.element.querySelectorAll(".language-math").forEach((function(e){var t=e.querySelector("br");t&&t.remove()}))):r.key.indexOf("Arrow")>-1?("ArrowLeft"!==r.key&&"ArrowRight"!==r.key||xt(e),B(i,e)):229===r.keyCode&&""===r.code&&"Unidentified"===r.key&&B(i,e);var o=(0,g.KJ)(i.startContainer,"vditor-ir__preview");if(o){if("ArrowUp"===r.key||"ArrowLeft"===r.key)return o.previousElementSibling.firstElementChild?i.selectNodeContents(o.previousElementSibling.firstElementChild):i.selectNodeContents(o.previousElementSibling),i.collapse(!1),r.preventDefault(),!0;if("SPAN"===o.tagName&&("ArrowDown"===r.key||"ArrowRight"===r.key))return"html-entity"===o.parentElement.getAttribute("data-type")?(o.parentElement.insertAdjacentText("afterend",t.Y.ZWSP),i.setStart(o.parentElement.nextSibling,1)):i.selectNodeContents(o.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}else e.ir.element.innerHTML=""}))},e}(),Pt=function(e){return"sv"===e.currentMode?e.lute.Md2HTML(o(e)):"wysiwyg"===e.currentMode?e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML):"ir"===e.currentMode?e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML):void 0},Bt=n(136),qt=n(442),Vt=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){return"block"===e.preview.element.style.display?(0,qt.N)(e.preview.element.lastElementChild,this.element.lastElementChild,e):(0,qt.N)(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;if(t?(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")),getSelection().rangeCount>0){var i=getSelection().getRangeAt(0);e[e.currentMode].element.contains(i.startContainer)&&(0,N.jl)(i)}K(e)},e}(),Yt=n(924),Ut=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){if("TEXTAREA"!==n.target.tagName){var r=document.createElement("div");r.className="vditor-reset",r.appendChild(getSelection().getRangeAt(0).cloneContents()),t.copyToX(e,r),n.preventDefault()}})),n.addEventListener("click",(function(r){var i=(0,g._Y)(r.target,"SPAN");if(i&&(0,g.KJ)(i,"vditor-toc")){var o=n.querySelector("#"+i.getAttribute("data-target-id"));o&&(t.element.scrollTop=o.offsetTop)}else"IMG"===r.target.tagName&&(0,q.o)(r.target,e.options.lang,e.options.theme)}));var r=e.options.preview.actions,i=document.createElement("div");i.className="vditor-preview__action";for(var o=[],a=0;aDesktop');break;case"tablet":o.push('');break;case"mobile":o.push('');break;case"mp-wechat":o.push('');break;case"zhihu":o.push('')}else o.push('")}i.innerHTML=o.join(""),0===r.length&&(i.style.display="none"),this.element.appendChild(i),this.element.appendChild(n),i.addEventListener((0,s.y3)(),(function(o){var a=(0,y.f)(o.target,"BUTTON");if(a){var l=a.getAttribute("data-type"),s=r.find((function(e){return(null==e?void 0:e.key)===l}));s?s.click(l):"mp-wechat"!==l&&"zhihu"!==l?(n.style.width="desktop"===l?"auto":"tablet"===l?"780px":"360px",n.scrollWidth>n.parentElement.clientWidth&&(n.style.width="auto"),t.render(e),i.querySelectorAll("button").forEach((function(e){e.classList.remove("vditor-preview__action--current")})),a.classList.add("vditor-preview__action--current")):t.copyToX(e,t.element.lastElementChild.cloneNode(!0),l)}}))}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(""!==o(e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")){var r=(new Date).getTime(),i=o(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(window.VditorI18n.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"));var r=e.preview.element.querySelector(".vditor-comment--focus");r&&r.classList.remove("vditor-comment--focus"),(0,k.o)(e.preview.element.lastElementChild),(0,C.$)(e.options.preview.hljs,e.preview.element.lastElementChild,e.options.cdn),(0,L.e)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,S.D)(e.preview.element.lastElementChild,e.options.cdn),(0,T.m)(e.preview.element.lastElementChild,e.options.cdn),(0,E.v)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,M.l)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,x.M)(e.preview.element.lastElementChild,e.options.cdn),(0,w.$)(e.preview.element.lastElementChild,e.options.cdn),(0,Yt.l)(e.preview.element.lastElementChild);var i=e.preview.element,o=e.outline.render(e);""===o&&(o="[ToC]"),i.querySelectorAll('[data-type="toc-block"]').forEach((function(t){t.innerHTML=o,(0,_.T)(t,{cdn:e.options.cdn,extPath:e.options.extPath,math:e.options.preview.math})})),(0,_.T)(e.preview.element.lastElementChild,{cdn:e.options.cdn,extPath:e.options.extPath,math:e.options.preview.math})},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(".language-math").forEach((function(e){e.outerHTML=''+e.getAttribute('})),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),(0,N.jl)(r),document.execCommand("copy"),this.element.lastElementChild.remove(),e.tip.show("已复制,可到"+("zhihu"===n?"知乎":"微信公众号平台")+"进行粘贴")},e}(),Kt=function(){function e(e){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--"+e.options.resize.position,this.element.innerHTML='
    ',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}(),Wt=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),Le(e,this.element),He(e,this.element),De(e,this.element),Me(e,this.element),xe(e,this.element,this.copy),Ae(e,this.element,this.copy)}return e.prototype.copy=function(e,t){e.stopPropagation(),e.preventDefault(),e.clipboardData.setData("text/plain",Te(t[t.currentMode].element))},e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("paste",(function(t){Mt(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){(0,s.gm)()||V(e,n),t.composingLock=!1})),this.element.addEventListener("input",(function(n){if("deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType&&!t.composingLock&&"‘"!==n.data&&"“"!==n.data&&"《"!==n.data)return t.preventInput?(t.preventInput=!1,void Pe(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})):void V(e,n)})),this.element.addEventListener("keyup",(function(t){t.isComposing||(0,s._0)(t)||("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?"Enter"===t.key&&Ne(e):e.sv.element.innerHTML="")}))},e}(),zt=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(e,t){var n=this;void 0===t&&(t=6e3),this.element.className="vditor-tip vditor-tip--show",0===t?(this.element.innerHTML='
    '+e+'\n
    X
    ',this.element.querySelector(".vditor-tip__close").addEventListener("click",(function(){n.hide()}))):(this.element.innerHTML='
    '+e+"
    ",setTimeout((function(){n.hide()}),t)),this.element.removeAttribute("style"),setTimeout((function(){n.element.getBoundingClientRect().top<46&&(n.element.style.position="fixed",n.element.style.top="46px")}),150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e}(),Ft=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),c(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",d(t.toolbar.elements,["both"])}t.devtools&&t.devtools.renderEchart(t)}},Zt=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])},e(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)}}(),Jt=function(e){function n(n,r){var i=e.call(this,n,r)||this;return"both"===n.options.preview.mode&&i.element.children[0].classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,s.y3)(),(function(e){i.element.firstElementChild.classList.contains(t.Y.CLASS_MENU_DISABLED)||(e.preventDefault(),"sv"===n.currentMode&&("both"===n.options.preview.mode?Ft("editor",n):Ft("both",n)))})),i}return Zt(n,e),n}(we),Gt=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"},Xt=n(417),$t=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])},e(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)}}(),Qt=function(e){function n(n,r){var i=e.call(this,n,r)||this,o=i.element.children[0],a=document.createElement("div");a.className="vditor-hint"+(2===r.level?"":" vditor-panel--arrow");var l="";return t.Y.CODE_THEME.forEach((function(e){l+=""})),a.innerHTML='
    '+l+"
    ",a.addEventListener((0,s.y3)(),(function(e){"BUTTON"===e.target.tagName&&(h(n,["subToolbar"]),n.options.preview.hljs.style=e.target.textContent,(0,Xt.h)(e.target.textContent,n.options.cdn),n.options.changeCodeTheme&&n.options.changeCodeTheme(e.target.textContent),e.preventDefault(),e.stopPropagation())})),i.element.appendChild(a),v(n,a,o,r.level),i}return $t(n,e),n}(we),en=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])},e(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)}}(),tn=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((0,s.y3)(),(function(e){"BUTTON"===e.target.tagName&&(h(t,["subToolbar"]),t.options.preview.theme.current=e.target.getAttribute("data-type"),(0,Y.H)(t.options.preview.theme.current,t.options.preview.theme.path),e.preventDefault(),e.stopPropagation())})),r.element.appendChild(o),v(t,o,i,n.level),r}return en(t,e),t}(we),nn=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.options.counter.after&&e.options.counter.after(n,{enable:e.options.counter.enable,max:e.options.counter.max,type:e.options.counter.type})},e}(),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])},e(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 n(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].innerHTML=r.icon,i.element.children[0].addEventListener((0,s.y3)(),(function(e){e.preventDefault(),e.currentTarget.classList.contains(t.Y.CLASS_MENU_DISABLED)||r.click(e,n)})),i}return rn(n,e),n}(we),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])},e(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 n(n,r){var i=e.call(this,n,r)||this;return i.element.firstElementChild.addEventListener((0,s.y3)(),(function(e){var r=i.element.firstElementChild;r.classList.contains(t.Y.CLASS_MENU_DISABLED)||(e.preventDefault(),r.classList.contains("vditor-menu--current")?(r.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",K(n)):(r.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",K(n),n.devtools.renderEchart(n)))})),i}return an(n,e),n}(we),sn=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"},dn=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])},e(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)}}(),cn=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="";return Object.keys(t.options.hint.emoji).forEach((function(e){var n=t.options.hint.emoji[e];n.indexOf(".")>-1?o+='':o+='"})),i.innerHTML='
    '+o+'
    \n '+(t.options.hint.emojiTail||"")+"\n
    ",r.element.appendChild(i),v(t,i,r.element.firstElementChild,n.level),r.bindEvent(t),r}return dn(t,e),t.prototype.bindEvent=function(e){var t=this;this.element.lastElementChild.addEventListener((0,s.y3)(),(function(n){var r=(0,y.f)(n.target,"BUTTON");if(r){n.preventDefault();var i=r.getAttribute("data-value"),o=(0,N.RN)(e),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+" ",(0,N.Z2)(a,e)}else o.extractContents(),o.insertNode(document.createTextNode(i));o.collapse(!1),(0,N.jl)(o),t.element.lastElementChild.style.display="none",pt(e)}})),this.element.lastElementChild.addEventListener("mouseover",(function(e){var n=(0,y.f)(e.target,"BUTTON");n&&(t.element.querySelector(".vditor-emojis__tip").innerHTML=n.getAttribute("data-key"))}))},t}(we),un=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(window.VditorI18n.downloadTip,0)},pn=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])},e(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=r.element.children[0],a=document.createElement("div");return a.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow"),a.innerHTML='\n\n',a.addEventListener((0,s.y3)(),(function(e){var n=e.target;if("BUTTON"===n.tagName){switch(n.getAttribute("data-type")){case"markdown":!function(e){var t=o(e);un(e,t,t.substr(0,10)+".md")}(t);break;case"pdf":!function(e){e.tip.show(window.VditorI18n.generate,3800);var t=document.querySelector("iframe");t.contentDocument.open(),t.contentDocument.write('\n