389 lines
366 KiB
Java
389 lines
366 KiB
Java
|
|
var Ka=Object.defineProperty,Ga=Object.defineProperties;var $a=Object.getOwnPropertyDescriptors;var Kn=Object.getOwnPropertySymbols;var Za=Object.prototype.hasOwnProperty,Ja=Object.prototype.propertyIsEnumerable;var Gn=(Ee,me,ge)=>me in Ee?Ka(Ee,me,{enumerable:!0,configurable:!0,writable:!0,value:ge}):Ee[me]=ge,wt=(Ee,me)=>{for(var ge in me||(me={}))Za.call(me,ge)&&Gn(Ee,ge,me[ge]);if(Kn)for(var ge of Kn(me))Ja.call(me,ge)&&Gn(Ee,ge,me[ge]);return Ee},$n=(Ee,me)=>Ga(Ee,$a(me));var Zn=(Ee,me,ge)=>new Promise((E,ae)=>{var Me=D=>{try{M(ge.next(D))}catch(R){ae(R)}},ee=D=>{try{M(ge.throw(D))}catch(R){ae(R)}},M=D=>D.done?E(D.value):Promise.resolve(D.value).then(Me,ee);M((ge=ge.apply(Ee,me)).next())});import{bt as Xa,R as tr,k as Qa,bu as Jn,b as Xn,bv as Ya,bw as ei,a3 as ti,d as nr,aH as ni,x as rr}from"./index-BI6CMai0.js";import{d as ar,f as yt,w as tn,e as ir,u as Ot,n as ri,j as ai,Q as ii,ar as sr,as as or,at as Qn,au as si}from"./vue-vendor-C7Zq48Yl.js";import{a as ur}from"./antd-vue-vendor-BPnV8VqP.js";import"./index-Du0A3ksf.js";import{u as oi}from"./BasicModal-0sAdFEk_.js";var vt={exports:{}};/*!
|
|||
|
|
* Vditor v3.11.2 - A markdown editor written in TypeScript.
|
|||
|
|
*
|
|||
|
|
* MIT License
|
|||
|
|
*
|
|||
|
|
* Copyright (c) 2018-present B3log 开源, b3log.org
|
|||
|
|
*
|
|||
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|||
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|||
|
|
* in the Software without restriction, including without limitation the rights
|
|||
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|||
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|||
|
|
* furnished to do so, subject to the following conditions:
|
|||
|
|
*
|
|||
|
|
* The above copyright notice and this permission notice shall be included in all
|
|||
|
|
* copies or substantial portions of the Software.
|
|||
|
|
*
|
|||
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|||
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|||
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
|
|
* SOFTWARE.
|
|||
|
|
*
|
|||
|
|
*/var ui=vt.exports,Yn;function li(){return Yn||(Yn=1,(function(Ee,me){(function(E,ae){Ee.exports=ae()})(ui,function(){return(()=>{var ge={173:(ee=>{var M=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},D=-1,R=1,N=0;M.Diff=function(d,c){return[d,c]},M.prototype.diff_main=function(d,c,_,b){typeof b=="undefined"&&(this.Diff_Timeout<=0?b=Number.MAX_VALUE:b=new Date().getTime()+this.Diff_Timeout*1e3);var y=b;if(d==null||c==null)throw new Error("Null input. (diff_main)");if(d==c)return d?[new M.Diff(N,d)]:[];typeof _=="undefined"&&(_=!0);var m=_,C=this.diff_commonPrefix(d,c),L=d.substring(0,C);d=d.substring(C),c=c.substring(C),C=this.diff_commonSuffix(d,c);var S=d.substring(d.length-C);d=d.substring(0,d.length-C),c=c.substring(0,c.length-C);var i=this.diff_compute_(d,c,m,y);return L&&i.unshift(new M.Diff(N,L)),S&&i.push(new M.Diff(N,S)),this.diff_cleanupMerge(i),i},M.prototype.diff_compute_=function(d,c,_,b){var y;if(!d)return[new M.Diff(R,c)];if(!c)return[new M.Diff(D,d)];var m=d.length>c.length?d:c,C=d.length>c.length?c:d,L=m.indexOf(C);if(L!=-1)return y=[new M.Diff(R,m.substring(0,L)),new M.Diff(N,C),new M.Diff(R,m.substring(L+C.length))],d.length>c.length&&(y[0][0]=y[2][0]=D),y;if(C.length==1)return[new M.Diff(D,d),new M.Diff(R,c)];var S=this.diff_halfMatch_(d,c);if(S){var i=S[0],s=S[1],u=S[2],f=S[3],v=S[4],g=this.diff_main(i,u,_,b),k=this.diff_main(s,f,_,b);return g.concat([new M.Diff(N,v)],k)}return _&&d.length>100&&c.length>100?this.diff_lineMode_(d,c,b):this.diff_bisect_(d,c,b)},M.prototype.diff_lineMode_=function(d,c,_){var b=this.diff_linesToChars_(d,c);d=b.chars1,c=b.chars2;var y=b.lineArray,m=this.diff_main(d,c,!1,_);this.diff_charsToLines_(m,y),this.diff_cleanupSemantic(m),m.push(new M.Diff(N,""));for(var C=0,L=0,S=0,i="",s="";C<m.length;){switch(m[C][0]){case R:S++,s+=m[C][1];break;case D:L++,i+=m[C][1];break;case N:if(L>=1&&S>=1){m.splice(C-L-S,L+S),C=C-L-S;for(var u=this.diff_main(i,s,!1,_),f=u.length-1;f>=0;f--)m.splice(C,0,u[f]);C=C+u.length}S=0,L=0,i="",s="";break}C++}return m.pop(),m},M.prototype.diff_bisect_=function(d,c,_){for(var b=d.length,y=c.length,m=Math.ceil((b+y)/2),C=m,L=2*m,S=new Array(L),i=new Array(L),s=0;s<L;s++)S[s]=-1,i[s]=-1;S[C+1]=0,i[C+1]=0;for(var u=b-y,f=u%2!=0,v=0,g=0,k=0,H=0,j=0;j<m&&!(new Date().getTime()>_);j++){for(var x=-j+v;x<=j-g;x+=2){var I=C+x,z;x==-j||x!=j&&S[I-1]<S[I+1]?z=S[I+1]:z=S[I-1]+1;for(var T=z-x;z<b&&T<y&&d.charAt(z)==c.charAt(T);)z++,T++;if(S[I]=z,z>b)g+=2;else if(T>y)v+=2;else if(f){var B=C+u-x;if(B>=0&&B<L&&i[B]!=-1){var K=b-i[B];if(z>=K)return this.diff_bisectSplit_(d,c,z,T,_)}}}for(var X=-j+k;X<=j-H;X+=2){var B=C+X,K;X==-j||X!=j&&i[B-1]<i[B+1]?K=i[B+1]:K=i[B-1]+1;for(var oe=K-X;K<b&&oe<y&&d.charAt(b-K-1)==c.charAt(y-oe-1);)K++,oe++;if(i[B]=K,K>b)H+=2;else if(oe>y)k+=2;else if(!f){var I=C+u-X;if(I>=0&&I<L&&S[I]!=-1){var z=S[I],T=C+z-I;if(K=b-K,z>=K)return this.diff_bisectSplit_(d,c,z,T,_)}}}}return[new M.Diff(D,d),new M.Diff(R,c)]},M.prototype.diff_bisectSplit_=function(d,c,_,b,y){var m=d.substring(0,_),C=c.substring(0,b),L=d.substring(_),S=c.substring(b),i=this.diff_main(m,C,!1,y),s=this.diff_main(L,S,!1,y);return i.concat(s)},M.prototype.diff_linesToChars_=function(d,c){var _=[],b={};_[0]="";function y(S){for(var i="",s=0,u=-1,f=_.length;u<S.length-1;){u=S.indexOf(`
|
|||
|
|
`,s),u==-1&&(u=S.length-1);var v=S.substring(s,u+1);(b.hasOwnProperty?b.hasOwnProperty(v):b[v]!==void 0)?i+=String.fromCharCode(b[v]):(f==m&&(v=S.substring(s),u=S.length),i+=String.fromCharCode(f),b[v]=f,_[f++]=v),s=u+1}return i}var m=4e4,C=y(d);m=65535;var L=y(c);return{chars1:C,chars2:L,lineArray:_}},M.prototype.diff_charsToLines_=function(d,c){for(var _=0;_<d.length;_++){for(var b=d[_][1],y=[],m=0;m<b.length;m++)y[m]=c[b.charCodeAt(m)];d[_][1]=y.join("")}},M.prototype.diff_commonPrefix=function(d,c){if(!d||!c||d.charAt(0)!=c.charAt(0))return 0;for(var _=0,b=Math.min(d.length,c.length),y=b,m=0;_<y;)d.substring(m,y)==c.substring(m,y)?(_=y,m=_):b=y,y=Math.floor((b-_)/2+_);return y},M.prototype.diff_commonSuffix=function(d,c){if(!d||!c||d.charAt(d.length-1)!=c.charAt(c.length-1))return 0;for(var _=0,b=Math.min(d.length,c.length),y=b,m=0;_<y;)d.substring(d.length-y,d.length-m)==c.substring(c.length-y,c.length-m)?(_=y,m=_):b=y,y=Math.floor((b-_)/2+_);return y},M.prototype.diff_commonOverlap_=function(d,c){var _=d.length,b=c.length;if(_==0||b==0)return 0;_>b?d=d.substring(_-b):_<b&&(c=c.substring(0,_));var y=Math.min(_,b);if(d==c)return y;for(var m=0,C=1;;){var L=d.substring(y-C),S=c.indexOf(L);if(S==-1)return m;C+=S,(S==0||d.substring(y-C)==c.substring(0,C))&&(m=C,C++)}},M.prototype.diff_halfMatch_=function(d,c){if(this.Diff_Timeout<=0)return null;var _=d.length>c.length?d:c,b=d.length>c.length?c:d;if(_.length<4||b.length*2<_.length)return null;var y=this;function m(g,k,H){for(var j=g.substring(H,H+Math.floor(g.length/4)),x=-1,I="",z,T,B,K;(x=k.indexOf(j,x+1))!=-1;){var X=y.diff_commonPrefix(g.substring(H),k.substring(x)),oe=y.diff_commonSuffix(g.substring(0,H),k.substring(0,x));I.length<oe+X&&(I=k.substring(x-oe,x)+k.substring(x,x+X),z=g.substring(0,H-oe),T=g.substring(H+X),B=k.substring(0,x-oe),K=k.substring(x+X))}return I.length*2>=g.length?[z,T,B,K,I]:null}var C=m(_,b,Math.ceil(_.length/4)),L=m(_,b,Math.ceil(_.length/2)),S;if(!C&&!L)return null;L?C?S=C[4].length>L[4].length?C:L:S=L:S=C;var i,s,u,f;d.length>c.length?(i=S[0],s=S[1],u=S[2],f=S[3]):(u=S[0],f=S[1],i=S[2],s=S[3]);var v=S[4];return[i,s,u,f,v]},M.prototype.diff_cleanupSemantic=function(d){for(var c=!1,_=[],b=0,y=null,m=0,C=0,L=0,S=0,i=0;m<d.length;)d[m][0]==N?(_[b++]=m,C=S,L=i,S=0,i=0,y=d[m][1]):(d[m][0]==R?S+=d[m][1].length:i+=d[m][1].length,y&&y.length<=Math.max(C,L)&&y.length<=Math.max(S,i)&&(d.splice(_[b-1],0,new M.Diff(D,y)),d[_[b-1]+1][0]=R,b--,b--,m=b>0?_[b-1]:-1,C=0,L=0,S=0,i=0,y=null,c=!0)),m++;for(c&&this.diff_cleanupMerge(d),this.diff_cleanupSemanticLossless(d),m=1;m<d.length;){if(d[m-1][0]==D&&d[m][0]==R){var s=d[m-1][1],u=d[m][1],f=this.diff_commonOverlap_(s,u),v=this.diff_commonOverlap_(u,s);f>=v?(f>=s.length/2||f>=u.length/2)&&(d.splice(m,0,new M.Diff(N,u.substring(0,f))),d[m-1][1]=s.substring(0,s.length-f),d[m+1][1]=u.substring(f),m++):(v>=s.length/2||v>=u.length/2)&&(d.splice(m,0,new M.Diff(N,s.substring(0,v))),d[m-1][0]=R,d[m-1][1]=u.substring(0,u.length-v),d[m+1][0]=D,d[m+1][1]=s.substring(v),m++),m++}m++}},M.prototype.diff_cleanupSemanticLossless=function(d){function c(v,g){if(!v||!g)return 6;var k=v.charAt(v.length-1),H=g.charAt(0),j=k.match(M.nonAlphaNumericRegex_),x=H.match(M.nonAlphaNumericRegex_),I=j&&k.match(M.whitespaceRegex_),z=x&&H.match(M.whitespaceRegex_),T=I&&k.match(M.linebreakRegex_),B=z&&H.match(M.linebreakRegex_),K=T&&v.match(M.blanklineEndRegex_),X=B&&g.match(M.blanklineStartRegex_);return K||X?5:T||B?4:j&&!I&&z?3:I||z?2:j||x?1:0}for(var _=1;_<d.length-1;){if(d[_-1][0]==N&&d[_+1][0]==N){var b=d[_-1][1],y=d[_][1],m=d[_+1][1],C=this.diff_commonSuffix(b,y);if(C){var L=y.substring(y.length-C);b=b.substring(0,b.length-C),y=L+y.substring(0,y.length-C),m=L+m}for(var S=b,i=y,s=m,u=c(b,y)+c(y,m);y.charAt(0)===m.charAt(0);){b+=y.charAt(0),y=y.substring(1)+m.charAt(0),m=m.substring(1);var f=c(b,y)+c(y,m);f>=u&&(u=f,S=b,i=y,s=m)}d[_-1][1]!=S&&(S?d[_-1][1]=S:(d.splice(_-1,1),_--),d[_][1]=i,s?d[_+1][1]=s:(d.splice(_+1,1),_--))}_++}},M.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,M.whitespaceRegex_=/\s/,M.linebreakRegex_=/[\r\n]/,M.blanklineEndRe
|
|||
|
|
`),b=0,y=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;b<_.length;){var m=_[b].match(y);if(!m)throw new Error("Invalid patch string: "+_[b]);var C=new M.patch_obj;for(c.push(C),C.start1=parseInt(m[1],10),m[2]===""?(C.start1--,C.length1=1):m[2]=="0"?C.length1=0:(C.start1--,C.length1=parseInt(m[2],10)),C.start2=parseInt(m[3],10),m[4]===""?(C.start2--,C.length2=1):m[4]=="0"?C.length2=0:(C.start2--,C.length2=parseInt(m[4],10)),b++;b<_.length;){var L=_[b].charAt(0);try{var S=decodeURI(_[b].substring(1))}catch(i){throw new Error("Illegal escape in patch_fromText: "+S)}if(L=="-")C.diffs.push(new M.Diff(D,S));else if(L=="+")C.diffs.push(new M.Diff(R,S));else if(L==" ")C.diffs.push(new M.Diff(N,S));else{if(L=="@")break;if(L!=="")throw new Error('Invalid patch mode "'+L+'" in: '+S)}b++}}return c},M.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},M.patch_obj.prototype.toString=function(){var d,c;this.length1===0?d=this.start1+",0":this.length1==1?d=this.start1+1:d=this.start1+1+","+this.length1,this.length2===0?c=this.start2+",0":this.length2==1?c=this.start2+1:c=this.start2+1+","+this.length2;for(var _=["@@ -"+d+" +"+c+` @@
|
|||
|
|
`],b,y=0;y<this.diffs.length;y++){switch(this.diffs[y][0]){case R:b="+";break;case D:b="-";break;case N:b=" ";break}_[y+1]=b+encodeURI(this.diffs[y][1])+`
|
|||
|
|
`}return _.join("").replace(/%20/g," ")},ee.exports=M,ee.exports.diff_match_patch=M,ee.exports.DIFF_DELETE=D,ee.exports.DIFF_INSERT=R,ee.exports.DIFF_EQUAL=N}),408:((ee,M,D)=>{"use strict";D.d(M,{default:()=>_e});var R=D(135),N=D(840),d=D(775),c=D(428),_=D(325),b=D(483),y=D(999),m=function(U){U===void 0&&(U=document);var ue=function(J){var G=document.createElement("img");G.src=J.getAttribute("data-src"),G.addEventListener("load",function(){!J.getAttribute("style")&&!J.getAttribute("class")&&!J.getAttribute("width")&&!J.getAttribute("height")&&G.naturalHeight>G.naturalWidth&&G.naturalWidth/G.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&G.naturalHeight>window.innerHeight-40&&(J.style.height=window.innerHeight-40+"px"),J.src=G.src}),J.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return U.querySelectorAll("img").forEach(function(J){J.getAttribute("data-src")&&ue(J)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),U.querySelectorAll("img").forEach(function(J){window.vditorImageIntersectionObserver.observe(J)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(J){J.forEach(function(G){(typeof G.isIntersecting=="undefined"?G.intersectionRatio!==0:G.isIntersecting)&&G.target.getAttribute("data-src")&&ue(G.target)})}),U.querySelectorAll("img").forEach(function(J){window.vditorImageIntersectionObserver.observe(J)}))},C=D(472),L=D(280),S=D(637),i=D(825),s=D(11),u=D(194),f=D(436),v=D(229),g=D(145),k=D(538),H=D(413),j=D(106),x=D(673),I=function(U){document.querySelectorAll(".vditor-anchor").forEach(function(ue){U===1&&ue.classList.add("vditor-anchor--left"),ue.onclick=function(){var J=ue.getAttribute("href").substr(1),G=document.getElementById("vditorAnchor-"+J).offsetTop;document.querySelector("html").scrollTop=G}}),window.onhashchange=function(){var ue=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));ue&&(document.querySelector("html").scrollTop=ue.offsetTop)}},z=D(214),T=D(810),B=function(U,ue){if(ue===void 0&&(ue="zh_CN"),!(typeof speechSynthesis=="undefined"||typeof SpeechSynthesisUtterance=="undefined")){var J=function(){var De=speechSynthesis.getVoices(),se,ke;return De.forEach(function(Be){Be.lang===ue.replace("_","-")&&(se=Be),Be.default&&(ke=Be)}),se||(se=ke),se},G='<svg><use xlink:href="#vditor-icon-play"></use></svg>',be='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(G='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',be='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var te=document.querySelector(".vditor-speech");te||(te=document.createElement("button"),te.className="vditor-speech",U.insertAdjacentElement("beforeend",te),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=J));var Se=J(),he=new SpeechSynthesisUtterance;he.voice=Se,he.onend=he.onerror=function(){te.style.display="none",speechSynthesis.cancel(),te.classList.remove("vditor-speech--current"),te.innerHTML=G},U.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(De){var se=De.target;if(se.classList.contains("vditor-speech")||se.parentElement.classList.contains("vditor-speech")){te.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),te.innerHTML=be):(speechSynthesis.pause(),te.innerHTML=G)):(he.text=te.getAttribute("data-text"),speechSynthesis.speak(he),te.classList.add("vditor-speech--current"),te.innerHTML=be),(0,T.Hc)(window.vditorSpeechRange),U.focus();return}if(te.style.display="none",speechSynthesis.cancel(),te.classList.remove("vditor-speech--current"),te.innerHTML=G,getSelection().rangeCount!==0){var ke=getSelection().getRangeAt(0),Be=ke.toString().trim();if(Be){window.vditorSpeechRange=ke.cloneRange();var We=ke.getBoundingClientRect();te.innerHTML=G,te.style.display="block",te.style.top=We.top+We.height+do
|
|||
|
|
`)&&(L=L.substr(0,L.length-1));var i='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(i='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var s=document.createElement("div");s.className="vditor-copy",s.innerHTML='<span aria-label="'.concat(((y=window.VditorI18n)===null||y===void 0?void 0:y.copy)||"复制",`"
|
|||
|
|
onmouseover="this.setAttribute('aria-label', '`).concat(((m=window.VditorI18n)===null||m===void 0?void 0:m.copy)||"复制",`')"
|
|||
|
|
class="vditor-tooltipped vditor-tooltipped__w"
|
|||
|
|
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((C=window.VditorI18n)===null||C===void 0?void 0:C.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(i,"</span>");var u=document.createElement("textarea");u.value=(0,R.X)(L),s.insertAdjacentElement("afterbegin",u),_&&_.renderMenu&&_.renderMenu(b,s),b.before(s),b.style.maxHeight=window.outerHeight-40+"px",b.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(N.g.ZWSP,"</span>"))})}}),325:((ee,M,D)=>{"use strict";D.d(M,{P:()=>c});var R=D(145),N=D(413),d=D(840),c=function(_,b){b===void 0&&(b=R.g.CDN);var y=d.flowchartRenderAdapter.getElements(_);y.length!==0&&(0,N.G)("".concat(b,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){y.forEach(function(m){if(m.getAttribute("data-processed")!=="true"){var C=flowchart.parse(d.flowchartRenderAdapter.getCode(m));m.innerHTML="",C.drawSVG(m),m.setAttribute("data-processed","true")}})})}}),483:((ee,M,D)=>{"use strict";D.d(M,{v:()=>c});var R=D(145),N=D(413),d=D(840),c=function(_,b){b===void 0&&(b=R.g.CDN);var y=d.graphvizRenderAdapter.getElements(_);y.length!==0&&(0,N.G)("".concat(b,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){y.forEach(function(m){var C=d.graphvizRenderAdapter.getCode(m);if(!(m.parentElement.classList.contains("vditor-wysiwyg__pre")||m.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(m.getAttribute("data-processed")==="true"||C.trim()==="")){try{var L=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),S=window.URL||window.webkitURL,i=S.createObjectURL(L),s=new Worker(i);new Viz({worker:s}).renderSVGElement(C).then(function(u){m.innerHTML=u.outerHTML}).catch(function(u){m.innerHTML="graphviz render error: <br>".concat(u),m.className="vditor-reset--error"})}catch(u){}m.setAttribute("data-processed","true")}})})}}),999:((ee,M,D)=>{"use strict";D.d(M,{s:()=>c});var R=D(145),N=D(413),d=D(290),c=function(_,b,y){b===void 0&&(b=document),y===void 0&&(y=R.g.CDN);var m=_.style;R.g.CODE_THEME.includes(m)||(m="github");var C=document.getElementById("vditorHljsStyle"),L="".concat(y,"/dist/js/highlight.js/styles/").concat(m,".min.css");if(C&&C.getAttribute("href")!==L&&C.remove(),(0,d.c)("".concat(y,"/dist/js/highlight.js/styles/").concat(m,".min.css"),"vditorHljsStyle"),_.enable!==!1){var S=b.querySelectorAll("pre > code");S.length!==0&&(0,N.G)("".concat(y,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,N.G)("".concat(y,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){b.querySelectorAll("pre > code").forEach(function(i){if(!(i.parentElement.classList.contains("vditor-ir__marker--pre")||i.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(i.classList.contains("language-mermaid")||i.classList.contains("language-flowchart")||i.classList.contains("language-echarts")||i.classList.contains("language-mindmap")||i.classList.contains("language-plantuml")||i.classList.contains("language-smiles")||i.classList.contains("language-abc")||i.classList.contains("language-graphviz")||i.classList.contains("language-math"))){_.defaultLang!==""&&i.className.indexOf("language-")===-1&&i.classList.add("language-"+_.defaultLang);var s=i.className.replace("language-","");if(window.hljs.getLanguage(s)||(s="plaintext"),i.innerHTML=window.hljs.highlight(i.textContent,{language:s,ignoreIllegals:!0}).value,i.classList.add("hljs"),!!_.lineNumber){i.classList.add("vditor-linenumber");var u=i.querySelector(".vditor-linenumber__temp");u||(u=document.createElement("div"),u.className="vditor-linenumber__temp",i.insertAdjacentElement("beforeend",u));var f=getComputedStyle(i).whiteSpace,v=!1;(f==="pre-wrap"||f==="pre-line")&&(v=!0);var g="",k=i.textContent.split(/\r\n|\r|\n/g);k.pop(),k.map(function(H){var j="";v&&(u.textContent=H||`
|
|||
|
|
`,j=' style="height:'.concat(u.getBoundingClientRect().height,'px"')),g+="<span".concat(j,"></span>")}),u.style.display="none",g='<span class="vditor-linenumber__rows">'.concat(g,"</span>"),i.insertAdjacentHTML("beforeend",g)}}})})})}}}),11:((ee,M,D)=>{"use strict";D.d(M,{K:()=>y});var R=D(145),N=D(413),d=D(840),c={},_=function(m,C){var L=m.transform(C),S=Object.keys(L.features).filter(function(v){return!c[v]});S.forEach(function(v){c[v]=!0});var i=m.getAssets(S),s=i.styles,u=i.scripts,f=window.markmap;return s&&f.loadCSS(s),u&&f.loadJS(u),L},b=function(m,C){var L=window.markmap,S=L.Transformer,i=L.Markmap,s=L.deriveOptions,u=L.globalCSS,f=new S;m.innerHTML='<svg style="width:100%"></svg>';var v=m.firstChild,g=i.create(v,null),k=_(f,C),H=k.root,j=k.frontmatter,x=j==null?void 0:j.markmap,I=s(x);g.setData(H,I),g.fit()},y=function(m,C){m===void 0&&(m=document),C===void 0&&(C=R.g.CDN);var L=d.markmapRenderAdapter.getElements(m);L.length!==0&&(0,N.G)("".concat(C,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){L.forEach(function(S){var i=d.markmapRenderAdapter.getCode(S);if(!(S.getAttribute("data-processed")==="true"||i.trim()==="")){var s=document.createElement("div");s.className="language-markmap",S.parentNode.appendChild(s),b(s,i),S.parentNode.childNodes[0].nodeName=="CODE"&&S.parentNode.removeChild(S.parentNode.childNodes[0])}})})}}),472:((ee,M,D)=>{"use strict";D.d(M,{H:()=>b});var R=D(145),N=D(413),d=D(290),c=D(105),_=D(840),b=function(y,m){y===void 0&&(y=document);var C=_.mathRenderAdapter.getElements(y);if(C.length!==0){var L={cdn:R.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(m&&m.math&&(m.math=Object.assign({},L.math,m.math)),m=Object.assign({},L,m),m.math.engine==="KaTeX")(0,d.c)("".concat(m.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,N.G)("".concat(m.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,N.G)("".concat(m.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){C.forEach(function(s){if(!(s.parentElement.classList.contains("vditor-wysiwyg__pre")||s.parentElement.classList.contains("vditor-ir__marker--pre"))&&!s.getAttribute("data-math")){var u=(0,c.X)(_.mathRenderAdapter.getCode(s));s.setAttribute("data-math",u);try{s.innerHTML=katex.renderToString(u,{displayMode:s.tagName==="DIV",output:"html",macros:m.math.macros})}catch(f){s.innerHTML=f.message,s.className="language-math vditor-reset--error"}s.addEventListener("copy",function(f){f.stopPropagation(),f.preventDefault();var v=f.currentTarget.closest(".language-math");f.clipboardData.setData("text/html",v.innerHTML),f.clipboardData.setData("text/plain",v.getAttribute("data-math"))})}})})});else if(m.math.engine==="MathJax"){var S=function(s){if(s.length!==0){var u=0,f=s[s.length-1],v=function(){var g=s[u++];g===f?g():g(v)};v()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(m.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:m.math.macros}},Object.assign(window.MathJax,m.math.mathJaxOptions)),(0,N.J)("".concat(m.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var i=function(s,u){var f=(0,c.X)(s.textContent).trim(),v=window.MathJax.getMetricsFor(s);v.display=s.tagName==="DIV",window.MathJax.tex2svgPromise(f,v).then(function(g){s.innerHTML="",s.setAttribute("data-math",f),s.append(g),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var k=g.querySelector('[data-mml-node="merror"]');k&&k.textContent.trim()!==""&&(s.innerHTML=k.textContent.trim(),s.className="vditor-reset--error"),u&&u()})};window.MathJax.startup.promise.then(function(){for(var s=[],u=function(v){var g=C[v];!g.parentElement.classList.contains("vditor-wysiwyg__pre")&&!g.parentElement.classList.contains("vditor-ir__marker--pre")&&!g.getAttribute("data-math")&&(0,c.X)(g.textContent).trim()&&s.push(function(k){v===C.length-1?i(g):i(g,k)})},f=0;f<C.length;f++)u(f);S(s)})}}}}),280:((ee,M,D)=>{"use strict";D.d(M,{Y:()=>_});var R=D(494),N=function(b,y){b.insertAdjacentHTML("afterend",'<video cont
|
|||
|
|
src="//coub.com/embed/`.concat(S[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),b.remove();else if(i&&i[0])b.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|||
|
|
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(i[0]),'"></iframe>')),b.remove();else if(s&&s[2])b.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|||
|
|
src="https://www.dailymotion.com/embed/video/`.concat(s[2],'"></iframe>')),b.remove();else if(y.indexOf("bilibili.com")>-1&&(y.indexOf("bvid=")>-1||u&&u[1])){var v={bvid:(0,R.on)("bvid",y)||u&&u[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(y.startsWith("http")?y:"https:"+y).search.split("&").forEach(function(H,j){if(H){j===0&&(H=H.substr(1));var x=H.split("=");v[x[0]]=x[1]}});var g="https://player.bilibili.com/player.html?",k=Object.keys(v);k.forEach(function(H,j){g+="".concat(H,"=").concat(v[H]),j<k.length-1&&(g+="&")}),b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(g,'"></iframe>')),b.remove()}else f&&f[1]&&(b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(f[1],'"></iframe>')),b.remove())},_=function(b){b&&b.querySelectorAll("a").forEach(function(y){var m=y.getAttribute("href");m&&(m.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?N(y,m):m.match(/^.+.(mp3|wav|flac)$/)?d(y,m):c(y,m))})}}),637:((ee,M,D)=>{"use strict";D.d(M,{i:()=>y});var R=D(145),N=D(413),d=D(840),c=D(494),_=function(m,C,L,S){function i(s){return s instanceof L?s:new L(function(u){u(s)})}return new(L||(L=Promise))(function(s,u){function f(k){try{g(S.next(k))}catch(H){u(H)}}function v(k){try{g(S.throw(k))}catch(H){u(H)}}function g(k){k.done?s(k.value):i(k.value).then(f,v)}g((S=S.apply(m,C||[])).next())})},b=function(m,C){var L={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},S,i,s,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(g){return function(k){return v([g,k])}}function v(g){if(S)throw new TypeError("Generator is already executing.");for(;u&&(u=0,g[0]&&(L=0)),L;)try{if(S=1,i&&(s=g[0]&2?i.return:g[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,g[1])).done)return s;switch(i=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return L.label++,{value:g[1],done:!1};case 5:L.label++,i=g[1],g=[0];continue;case 7:g=L.ops.pop(),L.trys.pop();continue;default:if(s=L.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){L=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){L.label=g[1];break}if(g[0]===6&&L.label<s[1]){L.label=s[1],s=g;break}if(s&&L.label<s[2]){L.label=s[2],L.ops.push(g);break}s[2]&&L.ops.pop(),L.trys.pop();continue}g=C.call(m,L)}catch(k){g=[6,k],i=0}finally{S=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},y=function(m,C,L){m===void 0&&(m=document),C===void 0&&(C=R.g.CDN);var S=d.mermaidRenderAdapter.getElements(m);S.length!==0&&(0,N.G)("".concat(C,"/dist/js/mermaid/mermaid.min.js?v=11.6.0"),"vditorMermaidScript").then(function(){var i={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8,showSequenceNumbers:!0},gantt:{leftPadding:75,rightPadding:20}};L==="dark"&&(i.theme="dark"),mermaid.initialize(i),S.forEach(function(s){return _(void 0,void 0,void 0,function(){var u,f,v,g,k;return b(this,function(H){switch(H.label){case 0:if(u=d.mermaidRenderAdapter.getCode(s),s.getAttribute("data-processed")==="true"||u.trim()==="")return[2];f="mermaid"+(0,c.Wb)(),H.label=1;case 1:return H.trys.push([1,3,,4]),[4,mermaid.render(f,s.textContent)];case 2:return v=H.sent(),s.innerHTML=v.svg,[3,4];case 3:return g=H.sent(),k=document.querySelector("#"+f),s.innerHTML="".concat(k.outerHTML,`<br>
|
|||
|
|
<div style="text-align: left"><small>`).concat(g.message.replace(/\n/,"<br>"),"</small></div>"),k.parentElement.remove(),[3,4];case 4:return s.setAttribute("data-processed","true"),[2]}})})})})}}),194:((ee,M,D)=>{"use strict";D.d(M,{P:()=>c});var R=D(145),N=D(413),d=D(840),c=function(_,b,y){_===void 0&&(_=document),b===void 0&&(b=R.g.CDN);var m=d.mindmapRenderAdapter.getElements(_);m.length>0&&(0,N.G)("".concat(b,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){m.forEach(function(C){if(!(C.parentElement.classList.contains("vditor-wysiwyg__pre")||C.parentElement.classList.contains("vditor-ir__marker--pre"))){var L=d.mindmapRenderAdapter.getCode(C);if(L)try{if(C.getAttribute("data-processed")==="true")return;echarts.init(C,y==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(L))],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(S,i){var s;return!((s=i==null?void 0:i.data)===null||s===void 0)&&s.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),C.setAttribute("data-processed","true")}catch(S){C.className="vditor-reset--error",C.innerHTML="mindmap render error: <br>".concat(S)}}})})}}),436:((ee,M,D)=>{"use strict";D.d(M,{k:()=>d});var R=D(771),N=D(472),d=function(c,_,b){var y="",m=[];if(Array.from(c.children).forEach(function(i,s){if((0,R.W)(i)){if(b){var u=i.id.lastIndexOf("_");i.id=i.id.substring(0,u===-1?void 0:u)+"_"+s}m.push(i.id),y+=i.outerHTML.replace("<wbr>","")}}),y==="")return _.innerHTML="","";var C=document.createElement("div");if(b)b.lute.SetToC(!0),b.currentMode==="wysiwyg"&&!b.preview.element.contains(c)?C.innerHTML=b.lute.SpinVditorDOM("<p>[ToC]</p>"+y):b.currentMode==="ir"&&!b.preview.element.contains(c)?C.innerHTML=b.lute.SpinVditorIRDOM("<p>[ToC]</p>"+y):C.innerHTML=b.lute.HTML2VditorDOM("<p>[ToC]</p>"+y),b.lute.SetToC(b.options.preview.markdown.toc);else{_.classList.add("vditor-outline");var L=Lute.New();L.SetToC(!0),C.innerHTML=L.HTML2VditorDOM("<p>[ToC]</p>"+y)}var S=C.firstElementChild.querySelectorAll("li > span[data-target-id]");return S.forEach(function(i,s){if(i.nextElementSibling&&i.nextElementSibling.tagName==="UL"){var u="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(u='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),i.innerHTML="".concat(u,"<span>").concat(i.innerHTML,"</span>")}else i.innerHTML="<svg></svg><span>".concat(i.innerHTML,"</span>");i.setAttribute("data-target-id",m[s])}),y=C.firstElementChild.innerHTML,S.length===0?(_.innerHTML="",y):(_.innerHTML=y,b&&(0,N.H)(_,{cdn:b.options.cdn,math:b.options.preview.math}),_.firstElementChild.addEventListener("click",function(i){for(var s=i.target;s&&!s.isEqualNode(_);){if(s.classList.contains("vditor-outline__action")){s.classList.contains("vditor-outline__action--close")?(s.classList.remove("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:block")):(s.classList.add("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:none")),i.preventDefault(),i.stopPropagation();break}else if(s.getAttribute("data-target-id")){i.preventDefault(),i.stopPropagation();var u=document.getElementById(s.getAttribute("data-target-id"));if(!u)return;if(b)if(b.options.height==="auto"){var f=u.offsetTop+b.element.offsetTop;b.options.toolbarConfig.pin||(f+=b.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,f)}else b.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,b.element.offsetTop),b.preview.element.contains(c)?c.parentElement.scrollTop=u.offsetTop:c.scrollTop=u.offsetTop;else window.scrollTo(window.scrollX,u.offsetTop);break
|
|||
|
|
<div class="vditor-img__bar">
|
|||
|
|
<span class="vditor-img__btn" data-deg="0">
|
|||
|
|
<svg><use xlink:href="#vditor-icon-redo"></use></svg>
|
|||
|
|
`).concat(window.VditorI18n.spin,`
|
|||
|
|
</span>
|
|||
|
|
<span class="vditor-img__btn" onclick="this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|||
|
|
X `).concat(window.VditorI18n.close,`
|
|||
|
|
</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|||
|
|
<img style="width: `).concat(N.width,"px;height:").concat(N.height,"px;transform: translate3d(").concat(_.left,"px, ").concat(_.top-b,'px, 0)" src="').concat(N.getAttribute("src"),`">
|
|||
|
|
</div>
|
|||
|
|
</div>`)),document.body.style.overflow="hidden";var y=document.querySelector(".vditor-img img"),m="translate3d(".concat(Math.max(0,window.innerWidth-N.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-b-N.naturalHeight)/2,"px, 0)");setTimeout(function(){y.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(m)),setTimeout(function(){y.parentElement.scrollTo((y.parentElement.scrollWidth-y.parentElement.clientWidth)/2,(y.parentElement.scrollHeight-y.parentElement.clientHeight)/2)},400)});var C=document.querySelector(".vditor-img__btn");C.addEventListener("click",function(){var L=parseInt(C.getAttribute("data-deg"),10)+90;L/90%2===1&&N.naturalWidth>y.parentElement.clientHeight?y.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-N.naturalWidth)/2,"px, ").concat(N.naturalWidth/2-N.naturalHeight/2,"px, 0) rotateZ(").concat(L,"deg)"):y.style.transform="".concat(m," rotateZ(").concat(L,"deg)"),C.setAttribute("data-deg",L.toString()),setTimeout(function(){y.parentElement.scrollTo((y.parentElement.scrollWidth-y.parentElement.clientWidth)/2,(y.parentElement.scrollHeight-y.parentElement.clientHeight)/2)},400)})}}),580:((ee,M,D)=>{"use strict";D.d(M,{Y:()=>d});var R=D(145),N=D(290),d=function(c,_){_===void 0&&(_=R.g.CDN),R.g.CODE_THEME.includes(c)||(c="github");var b=document.getElementById("vditorHljsStyle"),y="".concat(_,"/dist/js/highlight.js/styles/").concat(c,".min.css");b?b.getAttribute("href")!==y&&(b.remove(),(0,N.c)(y,"vditorHljsStyle")):(0,N.c)(y,"vditorHljsStyle")}}),538:((ee,M,D)=>{"use strict";D.d(M,{Z:()=>N});var R=D(290),N=function(d,c){if(!(!d||!c)){var _=document.getElementById("vditorContentTheme"),b="".concat(c,"/").concat(d,".css");_?_.getAttribute("href")!==b&&(_.remove(),(0,R.c)(b,"vditorContentTheme")):(0,R.c)(b,"vditorContentTheme")}}}),413:((ee,M,D)=>{"use strict";D.d(M,{J:()=>R,G:()=>N});var R=function(d,c){if(document.getElementById(c))return!1;var _=new XMLHttpRequest;_.open("GET",d,!1),_.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),_.send("");var b=document.createElement("script");b.type="text/javascript",b.text=_.responseText,b.id=c,document.head.appendChild(b)},N=function(d,c){return new Promise(function(_,b){if(document.getElementById(c))return _(!0),!1;var y=document.createElement("script");y.src=d,y.async=!0,document.head.appendChild(y),y.onerror=function(m){b(m)},y.onload=function(){if(document.getElementById(c))return y.remove(),_(!0),!1;y.id=c,_(!0)}})}}),290:((ee,M,D)=>{"use strict";D.d(M,{c:()=>R});var R=function(N,d){if(!document.getElementById(d)){var c=document.createElement("link");c.id=d,c.rel="stylesheet",c.type="text/css",c.href=N,document.getElementsByTagName("head")[0].appendChild(c)}}}),105:((ee,M,D)=>{"use strict";D.d(M,{X:()=>R});var R=function(N){return N.replace(/\u00a0/g," ")}}),410:((ee,M,D)=>{"use strict";D.d(M,{G6:()=>R,vU:()=>N,pK:()=>d,Le:()=>c,yl:()=>_,ns:()=>b,i7:()=>y});var R=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},N=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},d=function(){try{return typeof localStorage!="undefined"}catch(m){return!1}},c=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},_=function(m){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(m.metaKey&&!m.ctrlKey):!!(!m.metaKey&&m.ctrlKey)},b=function(m){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?m.indexOf("⇧")>-1&&N()&&(m=m.replace(";",":").replace("=","+").replace("-","_")):(m.startsWith("⌘")?m=m.replace("⌘","⌘+"):m.startsWith("⌥")&&m.substr(1,1)!=="⌘"?m=m.replace("⌥","⌥+"):m=m.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),m=m.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),m.indexOf("Shift")>-1&&(m=m.replace(";",":").replace("=","+").replace("-","_"))),m},y=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((ee,M,D)=>{"use
|
|||
|
|
`).replace(/\n\n$/,`
|
|||
|
|
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},N=ae(413),d=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-devtools",this.element.innerHTML='<div class="vditor-reset--error"></div><div style="height: 100%;"></div>'}return e.prototype.renderEchart=function(t){var n=this;t.devtools.element.style.display==="block"&&(0,N.G)("".concat(t.options.cdn,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){n.ASTChart||(n.ASTChart=echarts.init(t.devtools.element.lastElementChild));try{n.element.lastElementChild.style.display="block",n.element.firstElementChild.innerHTML="",n.ASTChart.setOption({series:[{data:JSON.parse(t.lute.RenderEChartsJSON(R(t))),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}}),n.ASTChart.resize()}catch(r){n.element.lastElementChild.style.display="none",n.element.firstElementChild.innerHTML=r}})},e})(),c=ae(410),_=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains("vditor-menu--current")&&r.classList.remove("vditor-menu--current")}})},b=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains("vditor-menu--current")&&r.classList.add("vditor-menu--current")}})},y=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(M.g.CLASS_MENU_DISABLED)&&r.classList.remove(M.g.CLASS_MENU_DISABLED)}})},m=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(M.g.CLASS_MENU_DISABLED)&&r.classList.add(M.g.CLASS_MENU_DISABLED)}})},C=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},L=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},S=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach(function(r){n&&r.isEqualNode(n)||(r.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")},i=function(e,t,n,r){n.addEventListener((0,c.Le)(),function(a){a.preventDefault(),a.stopPropagation(),!n.classList.contains(M.g.CLASS_MENU_DISABLED)&&(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach(function(o){o.classList.remove("vditor-hint--current")}),t.style.display==="block"?t.style.display="none":(S(e,["subToolbar","hint","popover"],n.parentElement.parentElement),n.classList.contains("vditor-tooltipped")||n.classList.add("vditor-hint--current"),t.style.display="block",e.toolbar.element.getBoundingClientRect().right-n.getBoundingClientRect().right<250?t.classList.add("vditor-panel--left"):t.classList.remove("vditor-panel--left")))})},s=ae(106),u=ae(771),f=function(e,t,n,r){},v=ae(135),g=ae(775),k=ae(428),H=ae(325),j=ae(483),x=ae(999),I=ae(472),z=ae(637),T=ae(11),B=ae(194),K=ae(229),X=ae(825),oe=function(e,t,n){n===void 0&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var a=!1;r.childElementCount===1&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(a=!0);var o=r.querySelectorAll("pre");if(r.childElementCount===1&&o.length===1&&o[0].className!=="vditor-wysiwyg"&&o[0].className!=="vditor-sv"&&(a=!0),e.indexOf(`
|
|||
|
|
<p class="p1">`)===0&&(a=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(a=!0),a){var l=t||e;return/\n/.test(l)||o.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(l.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+l.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(l.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(l,"`")}return!1},Q=function(e,t){if(e){if(e.parentElement.getAttribute("data-type")==="html-block"){e.setAttribute("data-render","1");return}var n=e.firstElementChild.className.replace("language-","");if(n==="abc")(0,v.Q)(e,t.options.cdn);else if(n==="mermaid")(0,z.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,X.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,T.K)(e,t.options.cdn);else if(n==="flowchart")(0,H.P)(e,t.options.cdn);else if(n==="echarts")(0,g.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,B.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,K.B)(e,t.options.cdn);else if(n==="graphviz")(0,j.v)(e,t.options.cdn);else if(n==="math")(0,I.H)(e,{cdn:t.options.cdn,math:t.options.preview.math});else{var r=t.options.customRenders.find(function(a){if(a.language===n)return a.render(e,t),!0});r||((0,x.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,k.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},O=ae(810),ve=function(e){if(e.currentMode!=="sv"){var t=e[e.currentMode].element,n=e.outline.render(e);n===""&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach(function(r){r.innerHTML=n,(0,I.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},Pe=function(e,t){var n=(0,s.lG)(e.target,"SPAN");if(n&&(0,s.fb)(n,"vditor-toc")){var r=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(r)if(t.options.height==="auto"){var a=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(a+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,a)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=r.offsetTop;return}},Le=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,O.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),le(t),!0;if(it(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,O.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),le(t),!0;if(ht(t,n,r,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var a=(0,s.fb)(r.startContainer,"vditor-toc");if(a)return a.remove(),le(t),!0}},_e=function(e,t,n,r){n===void 0&&(n=!1);var a=(0,s.F9)(t.startContainer);if(a&&!n&&a.getAttribute("data-type")!=="code-block"){if(Gt(a.innerHTML)&&a.previousElementSibling||$t(a.innerHTML))return;for(var o=(0,O.im)(a,e.ir.element,t).start,l=!0,h=o-1;h>a.textContent.substr(0,o).lastIndexOf(`
|
|||
|
|
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){l=!1;break}o===0&&(l=!1);for(var w=!0,h=o-1;h<a.textContent.length;h++)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==`
|
|||
|
|
`){w=!1;break}if(l){typeof e.options.input=="function"&&e.options.input(R(e));return}if(w&&/^#{1,6} $/.test(a.textContent)&&(w=!1),w){var p=(0,s.fb)(t.startContainer,"vditor-ir__marker");if(!p){var A=t.startContainer.previousSibling;A&&A.nodeType!==3&&A.classList.contains("vditor-ir__node--expand")&&A.classList.remove("vditor-ir__node--expand"),typeof e.options.input=="function"&&e.options.input(R(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(ce){ce.classList.remove("vditor-ir__node--expand")}),a||(a=e.ir.element),!a.querySelector("wbr")){var P=(0,s.fb)(t.startContainer,"vditor-ir__preview");P?P.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}a.querySelectorAll("[style]").forEach(function(ce){ce.removeAttribute("style")}),a.getAttribute("data-type")==="link-ref-defs-block"&&(a=e.ir.element);var q=a.isEqualNode(e.ir.element),W=(0,s.a1)(a,"data-type","footnotes-block"),V="";if(q)V=a.innerHTML;else{var Z=(0,u.S)(t.startContainer,"BLOCKQUOTE"),$=(0,s.O9)(t.startContainer);if($&&(a=$),Z&&(!$||$&&!Z.contains($))&&(a=Z),W&&(a=W),V=a.outerHTML,a.tagName==="UL"||a.tagName==="OL"){var F=a.previousElementSibling,ie=a.nextElementSibling;F&&(F.tagName==="UL"||F.tagName==="OL")&&(V=F.outerHTML+V,F.remove()),ie&&(ie.tagName==="UL"||ie.tagName==="OL")&&(V=V+ie.outerHTML,ie.remove()),V=V.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else a.previousElementSibling&&a.previousElementSibling.textContent.replace(M.g.ZWSP,"")!==""&&r&&r.inputType==="insertParagraph"&&(V=a.previousElementSibling.outerHTML+V,a.previousElementSibling.remove());a.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(ce){ce&&!a.isEqualNode(ce)&&(V+=ce.outerHTML,ce.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(ce){ce&&!a.isEqualNode(ce)&&(V+=ce.outerHTML,ce.remove())}))}if(f("SpinVditorIRDOM",V,"argument",e.options.debugger),V=e.lute.SpinVditorIRDOM(V),f("SpinVditorIRDOM",V,"result",e.options.debugger),q)a.innerHTML=V;else if(a.outerHTML=V,W){var Y=(0,s.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(Y){var re=Y.textContent,pe=re.substring(1,re.indexOf("]:")),fe=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(pe,'"]'));fe&&fe.setAttribute("aria-label",re.substr(pe.length+3).trim().substr(0,24))}}var ye,je=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");je.forEach(function(ce,Ie){Ie===0?ye=ce:(ye.insertAdjacentHTML("beforeend",ce.innerHTML),ce.remove())}),je.length>0&&e.ir.element.insertAdjacentElement("beforeend",je[0]);var Oe,Re=e.ir.element.querySelectorAll("[data-type='footnotes-block']");Re.forEach(function(ce,Ie){Ie===0?Oe=ce:(Oe.insertAdjacentHTML("beforeend",ce.innerHTML),ce.remove())}),Re.length>0&&e.ir.element.insertAdjacentElement("beforeend",Re[0]),(0,O.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(ce){Q(ce,e)}),ve(e),Je(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},U=function(e,t){if(e==="")return!1;if(e.indexOf("⇧")===-1&&e.indexOf("⌘")===-1&&e.indexOf("⌥")===-1)return!(0,c.yl)(t)&&!t.altKey&&!t.shiftKey&&t.code===e;if(e==="⇧Tab")return!!(!(0,c.yl)(t)&&!t.altKey&&t.shiftKey&&t.code==="Tab");var n=e.split("");if(e.startsWith("⌥")){var r=n.length===3?n[2]:n[1];return!!((n.length===3?(0,c.yl)(t):!(0,c.yl)(t))&&t.altKey&&!t.shiftKey&&t.code===(/^[0-9]$/.test(r)?"Digit":"Key")+r)}e==="⌘Enter"&&(n=["⌘","Enter"]);var a=n.length>2&&n[0]==="⇧",o=a?n[2]:n[1];return a&&((0,c.vU)()||!/Mac/.test(navigator.platform))&&(o==="-"?o="_":o==="="&&(o="+")),!!((0,c.yl)(t)&&t.key.toLowerCase()===o.toLowerCase()&&!t.altKey&&(!a&&!t.shiftKey||a&&t.shiftKey))},ue=function(e){var t=e.startContainer;if(t.nodeType===3&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&n.textContent==="";)n=n.nextSibling;if(n){if(n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&
|
|||
|
|
`);w--)if(o.textContent.charAt(w)!==" "&&o.textContent.charAt(w)!==" "){h=!1;break}if(l===0&&(h=!1),h){Ae(e);return}if(t.inputType==="deleteContentBackward"){var p=(0,s.a1)(a,"data-type","code-block-open-marker")||(0,s.a1)(a,"data-type","code-block-close-marker");if(p){if(p.getAttribute("data-type")==="code-block-close-marker"){var A=Et(a,"code-block-open-marker");if(A){A.textContent=p.textContent,Ae(e);return}}if(p.getAttribute("data-type")==="code-block-open-marker"){var A=Et(a,"code-block-close-marker",!1);if(A){A.textContent=p.textContent,Ae(e);return}}}var P=(0,s.a1)(a,"data-type","math-block-open-marker");if(P){var q=P.nextElementSibling.nextElementSibling;q&&q.getAttribute("data-type")==="math-block-close-marker"&&(q.remove(),Ae(e));return}o.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(F){F.textContent.length===1&&F.remove()}),o.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(F){F.textContent.length===1&&F.remove()});var W=(0,s.a1)(a,"data-type","heading-marker");if(W&&W.textContent.indexOf("#")===-1){Ae(e);return}}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,s.a1)(a,"data-type","padding")||(0,s.a1)(a,"data-type","li-marker")||(0,s.a1)(a,"data-type","task-marker")||(0,s.a1)(a,"data-type","blockquote-marker"))){Ae(e);return}}if(o&&o.textContent.trimRight()==="$$"){Ae(e);return}o||(o=e.sv.element),((n=o.firstElementChild)===null||n===void 0?void 0:n.getAttribute("data-type"))==="link-ref-defs-block"&&(o=e.sv.element),(0,s.a1)(a,"data-type","footnotes-link")&&(o=e.sv.element),o.textContent.indexOf(Lute.Caret)===-1&&r.insertNode(document.createTextNode(Lute.Caret)),o.querySelectorAll("[style]").forEach(function(F){F.removeAttribute("style")}),o.querySelectorAll("font").forEach(function(F){F.outerHTML=F.innerHTML});var V=o.textContent,Z=o.isEqualNode(e.sv.element);if(Z)V=o.textContent;else{o.previousElementSibling&&(V=o.previousElementSibling.textContent+V,o.previousElementSibling.remove()),o.previousElementSibling&&V.indexOf(`---
|
|||
|
|
`)===0&&(V=o.previousElementSibling.textContent+V,o.previousElementSibling.remove());var $="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(F,ie){F&&!o.isEqualNode(F.parentElement)&&($+=F.parentElement.textContent+`
|
|||
|
|
`,F.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(F,ie){F&&!o.isEqualNode(F.parentElement)&&($+=F.parentElement.textContent+`
|
|||
|
|
`,F.parentElement.remove())}),V=$+V}V=cn(V,e),Z?o.innerHTML=V:o.outerHTML=V,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(F){e.sv.element.insertAdjacentElement("beforeend",F.parentElement)}),Se(e.sv.element,function(F){e.sv.element.insertAdjacentElement("beforeend",F)}),(0,O.ib)(e.sv.element,r),Te(e),Ae(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},De=function(e,t){var n,r,a,o,l;if(e.sv.composingLock=t.isComposing,t.isComposing||(t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,c.yl)(t)&&t.key!=="Escape"))return!1;var h=(0,O.zh)(e),w=h.startContainer;h.startContainer.nodeType!==3&&h.startContainer.tagName==="DIV"&&(w=h.startContainer.childNodes[h.startOffset-1]);var p=(0,s.a1)(w,"data-type","text"),A=(0,s.a1)(w,"data-type","blockquote-marker");if(!A&&h.startOffset===0&&p&&p.previousElementSibling&&p.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(A=p.previousElementSibling),A&&t.key==="Enter"&&!(0,c.yl)(t)&&!t.altKey&&A.nextElementSibling.textContent.trim()===""&&(0,O.im)(A,e.sv.element,h).start===A.textContent.length)return((n=A.previousElementSibling)===null||n===void 0?void 0:n.getAttribute("data-type"))==="padding"&&A.previousElementSibling.setAttribute("data-action","enter-remove"),A.remove(),Ae(e),t.preventDefault(),!0;var P=(0,s.a1)(w,"data-type","li-marker"),q=(0,s.a1)(w,"data-type","task-marker"),W=P;if(W||q&&q.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(W=q),!W&&h.startOffset===0&&p&&p.previousElementSibling&&(p.previousElementSibling.getAttribute("data-type")==="li-marker"||p.previousElementSibling.getAttribute("data-type")==="task-marker")&&(W=p.previousElementSibling),W){var V=(0,O.im)(W,e.sv.element,h).start,Z=W.getAttribute("data-type")==="task-marker",$=W;if(Z&&($=W.previousElementSibling.previousElementSibling.previousElementSibling),V===W.textContent.length){if(t.key==="Enter"&&!(0,c.yl)(t)&&!t.altKey&&!t.shiftKey&&W.nextElementSibling.textContent.trim()==="")return((r=$.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?($.previousElementSibling.remove(),he(e)):(Z&&($.remove(),W.previousElementSibling.previousElementSibling.remove(),W.previousElementSibling.remove()),W.nextElementSibling.remove(),W.remove(),Ae(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?$.previousElementSibling.getAttribute("data-type")==="padding"&&$.previousElementSibling.remove():$.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat($.textContent.replace(/\S/g," "),"</span>")),/^\d/.test($.textContent)&&($.textContent=$.textContent.replace(/^\d{1,}/,"1"),h.selectNodeContents(W.firstChild),h.collapse(!1)),he(e),t.preventDefault(),!0}}if(Zt(e,h,t))return!0;var F=(0,s.a1)(w,"data-block","0"),ie=(0,u.S)(w,"SPAN");if(t.key==="Enter"&&!(0,c.yl)(t)&&!t.altKey&&!t.shiftKey&&F){var Y=!1,re=F.textContent.match(/^\n+/);(0,O.im)(F,e.sv.element).start<=(re?re[0].length:0)&&(Y=!0);var pe=`
|
|||
|
|
`;if(ie){if(((a=ie.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-action"))==="enter-remove")return ie.previousElementSibling.remove(),Ae(e),t.preventDefault(),!0;pe+=vr(ie)}return h.insertNode(document.createTextNode(pe)),h.collapse(!1),F&&F.textContent.trim()!==""&&!Y?he(e):Ae(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,c.yl)(t)&&!t.altKey&&!t.shiftKey){if(ie&&((o=ie.previousElementSibling)===null||o===void 0?void 0:o.getAttribute("data-type"))==="newline"&&(0,O.im)(ie,e.sv.element,h).start===1&&ie.getAttribute("data-type").indexOf("code-block-")===-1)return h.setStart(ie,0),h.extractContents(),ie.textContent.trim()!==""?he(e):Ae(e),t.preventDefault(),!0;if(F&&(0,O.im)(F,e.sv.element,h).start===0&&F.previousElementSibling){h.extractContents();var fe=F.previousElementSibling.lastElementChild;return fe.getAttribute("data-type")==="newline"&&(fe.remove(),fe=F.previousElementSibling.lastElementChild),fe.getAttribute("data-type")!=="newline"&&(fe.insertAdjacentHTML("afterend",F.innerHTML),F.remove()),F.textContent.trim()!==""&&!(!((l=F.previousElementSibling)===null||l===void 0)&&l.querySelector('[data-type="code-block-open-marker"]'))?he(e):(fe.getAttribute("data-type")!=="newline"&&(h.selectNodeContents(fe.lastChild),h.collapse(!1)),Ae(e)),t.preventDefault(),!0}}return!1},se=ae(538),ke=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},Be=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),ke(e),(0,se.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){S(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),tt(e,e.options.mode,lr(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport!="undefined"){var n=!1,r=function(a){n||(n=!0,requestAnimationFrame(function(){n=!1;var o=e.toolbar.element;o.style.transform="none",o.getBoundingClientRect().top<0&&(o.style.transform="translate(0, ".concat(-o.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},We=function(e){var t=window.innerWidth<=M.g.MOBILE_WIDTH?10:35;if(e.wysiwyg.element.parentElement.style.display!=="none"){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(Math.max(t,n),"px")}e.preview.element.style.display!=="block"?e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0))+
|
|||
|
|
`,n.insertNode(p),n.collapse(!0),(0,O.Hc)(n),we(e),Te(e),t.preventDefault(),!0}var A=(0,u.W)(r);if(A){if(A.tagName==="H6"&&r.textContent.length===n.startOffset&&!(0,c.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"){var P=document.createElement("p");return P.textContent=`
|
|||
|
|
`,P.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",P),n.setStart(P,0),(0,O.Hc)(n),we(e),Te(e),t.preventDefault(),!0}if(U("⌘=",t)){var q=parseInt(A.tagName.substr(1),10)-1;return q>0&&(kt(e,"h".concat(q)),we(e)),t.preventDefault(),!0}if(U("⌘-",t)){var q=parseInt(A.tagName.substr(1),10)+1;return q<7&&(kt(e,"h".concat(q)),we(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,c.yl)(t)&&!t.shiftKey&&!t.altKey&&A.textContent.length===1&&jt(e)}if(Hn(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,c.yl)(t)&&!t.shiftKey){var W=(0,s.lG)(r,"A"),V=(0,s.a1)(r,"data-type","link-ref"),Z=(0,s.a1)(r,"data-type","footnotes-ref");if(W||V||Z||A&&A.tagName.length===2){var $=e.wysiwyg.popover.querySelector("input");$.focus(),$.select()}}if(Ne(e,t))return!0;if(U("⇧⌘U",t)){var F=e.wysiwyg.popover.querySelector('[data-type="up"]');if(F)return F.click(),t.preventDefault(),!0}if(U("⇧⌘D",t)){var F=e.wysiwyg.popover.querySelector('[data-type="down"]');if(F)return F.click(),t.preventDefault(),!0}if(Zt(e,n,t))return!0;if(!(0,c.yl)(t)&&t.shiftKey&&!t.altKey&&t.key==="Enter"&&r.parentElement.tagName!=="LI"&&r.parentElement.tagName!=="P")return["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName)?n.insertNode(document.createTextNode(`
|
|||
|
|
`+M.g.ZWSP)):n.insertNode(document.createTextNode(`
|
|||
|
|
`)),n.collapse(!1),(0,O.Hc)(n),we(e),Te(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,c.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(Dn(e,n,t,o))return!0;if(a){if(a.previousElementSibling&&a.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&a.previousElementSibling.getAttribute("data-block")==="0"&&a.tagName!=="UL"&&a.tagName!=="OL"){var ie=(0,O.im)(a,e.wysiwyg.element,n).start;if(ie===0&&n.startOffset===0||ie===1&&a.innerText.startsWith(M.g.ZWSP))return ct(a.previousElementSibling.lastElementChild,e,!1),a.innerHTML.trim().replace(M.g.ZWSP,"")===""&&(a.remove(),we(e)),t.preventDefault(),!0}var Y=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(Y-2)===`
|
|||
|
|
`&&r.textContent.charAt(Y-1)!==M.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,Y-1)+M.g.ZWSP,n.setStart(r,Y),n.collapse(!0),we(e),t.preventDefault(),!0;r.textContent===M.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&dr(n)&&(r.textContent=""),a.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(pe){pe.firstElementChild.style.display="inline",pe.lastElementChild.style.display="none"}),a.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(pe){pe.firstElementChild.style.display="inline",pe.lastElementChild.style.display="none"})}}if((0,c.vU)()&&n.startOffset===1&&r.textContent.indexOf(M.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Pn(t,a,n))return t.preventDefault(),!0;if(wn(n,t.key),t.key==="ArrowDown"){var re=r.nextSibling;re&&re.nodeType!==3&&re.getAttribute("data-type")==="math-inline"&&n.setStartAfter(re)}return a&&Le(a,e,t,n)?(t.preventDefault(),!0):!1},Ne=function(e,t){if(U("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},et=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,O.Gb)(e.wysiwyg.element)){_(e.toolbar.elements,M.g.EDIT_TOOLBARS),y(e.toolbar.elements,M.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,s.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",qe(r,e),ze(e,"footnotes-block"),Fe(e,r);return}var a=(0,s.lG)(n,"LI");a?(a.classList.contains("vditor-task")?b(e.toolbar.elements,["check"]):a.parentElement.tagName==="OL"?b(e.toolbar.elements,["ordered-list"]):a.parentElement.tagName==="UL"&&b(e.toolbar.elements,["list"]),y(e.toolbar.elements,["outdent","indent"])):m(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&b(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&b(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&b(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&b(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(ne){ne.classList.remove("vditor-comment--focus")});var o=(0,s.fb)(n,"vditor-comment");if(o){var l=o.getAttribute("data-cmtids").split(" ");if(l.length>1&&o.nextSibling.isSameNode(o.nextElementSibling)){var h=o.nextElementSibling.getAttribute("data-cmtids").split(" ");l.find(function(ne){if(h.includes(ne))return l=[ne],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(ne){ne.getAttribute("data-cmtids").indexOf(l[0])>-1&&ne.classList.add("vditor-comment--focus")})}var w=(0,s.lG)(n,"A");w&&b(e.toolbar.elements,["link"]);var p=(0,s.lG)(n,"TABLE"),A=(0,u.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(m(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),b(e.toolbar.elements,["code"])):(m(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),b(e.toolbar.elements,["inline-code"])):A?(m(e.toolbar.elements,["bold"]),b(e.toolbar.elements,["headings"])):p&&m(e.toolbar.elements,["table"]);var P=(0,s.fb)(n,"vditor-toc");if(P){e.wysiwyg.popover.innerHTML="",qe(P,e),ze(e,"vditor-toc"),Fe(e,P);return}var q=(0,u.S)(n,"BLOCKQUOTE");if(q&&(e.wysiwyg.popover.innerHTML="",nt(t,q,e),rt(t,q,e),qe(q,e),ze(e,"blockquote"),Fe(e,q)),a&&(e.wysiwyg.popover.innerHTML="",nt(t,a,e),rt(t,a,e),qe(a,e),ze(e,"li"),Fe(e,a)),p){var W=e.options.lang,V=e.op
|
|||
|
|
</code></pre>`:(P.innerHTML="<pre><code>".concat(o.toString(),"<wbr></code></pre>"),o.deleteContents()),o.insertNode(P),p&&(p.outerHTML=e.lute.SpinVditorDOM(p.outerHTML)),(0,O.ib)(e.wysiwyg.element,o),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(pe){Q(pe,e)}),t.classList.add("vditor-menu--disabled")}else if(l==="link"){if(o.toString()===""){var q=document.createElement("a");q.innerText=M.g.ZWSP,o.insertNode(q),o.setStart(q.firstChild,1),o.collapse(!0),Rt(e,q,o);var W=e.wysiwyg.popover.querySelector("input");W.value="",W.focus(),a=!1}else{var P=document.createElement("a");P.setAttribute("href",""),P.innerHTML=o.toString(),o.surroundContents(P),o.insertNode(P),(0,O.Hc)(o),Rt(e,P,o);var V=e.wysiwyg.popover.querySelectorAll("input");V[0].value=P.innerText,V[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if(l==="table"){var Z='<table data-block="0"><thead><tr><th>col1<wbr></th><th>col2</th><th>col3</th></tr></thead><tbody><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table>';if(o.toString().trim()==="")p&&p.innerHTML.trim().replace(M.g.ZWSP,"")===""?p.outerHTML=Z:document.execCommand("insertHTML",!1,Z),o.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,O.Hc)(o);else{Z='<table data-block="0"><thead><tr>';var $=o.toString().split(`
|
|||
|
|
`),F=$[0].split(",").length>$[0].split(" ").length?",":" ";$.forEach(function(re,pe){pe===0?(re.split(F).forEach(function(fe,ye){ye===0?Z+="<th>".concat(fe,"<wbr></th>"):Z+="<th>".concat(fe,"</th>")}),Z+="</tr></thead>"):(pe===1?Z+="<tbody><tr>":Z+="<tr>",re.split(F).forEach(function(fe){Z+="<td>".concat(fe,"</td>")}),Z+="</tr>")}),Z+="</tbody></table>",document.execCommand("insertHTML",!1,Z),(0,O.ib)(e.wysiwyg.element,o)}r=!1,t.classList.add("vditor-menu--disabled")}else if(l==="line"){if(p){var ie=`<hr data-block="0"><p data-block="0"><wbr>
|
|||
|
|
</p>`;p.innerHTML.trim()===""?p.outerHTML=ie:p.insertAdjacentHTML("afterend",ie),(0,O.ib)(e.wysiwyg.element,o)}}else if(r=!1,t.classList.add("vditor-menu--current"),l==="strike"&&(l="strikeThrough"),o.toString()===""&&(l==="bold"||l==="italic"||l==="strikeThrough")){var Y="strong";l==="italic"?Y="em":l==="strikeThrough"&&(Y="s");var P=document.createElement(Y);P.textContent=M.g.ZWSP,o.insertNode(P),P.previousSibling&&P.previousSibling.textContent===M.g.ZWSP&&(P.previousSibling.textContent=""),o.setStart(P.firstChild,1),o.collapse(!0),(0,O.Hc)(o)}else document.execCommand(l,!1,"")}r&&et(e),a&&we(e)}},Ce=(function(){function e(t,n){var r,a=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var o=n.hotkey?" <".concat((0,c.ns)(n.hotkey),">"):"";n.level===2&&(o=n.hotkey?" <".concat((0,c.ns)(n.hotkey),">"):"");var l=n.tip?n.tip+o:"".concat(window.VditorI18n[n.name]).concat(o),h=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(h,' data-type="').concat(n.name,'">').concat(l,"</").concat(h,">");else{this.element.classList.add("vditor-toolbar__item");var w=document.createElement(h);w.setAttribute("data-type",n.name),w.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),w.setAttribute("aria-label",l),w.innerHTML=n.icon,this.element.appendChild(w)}n.prefix&&this.element.children[0].addEventListener((0,c.Le)(),function(p){p.preventDefault(),!a.element.firstElementChild.classList.contains(M.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?br(t,a.element.children[0],p):t.currentMode==="ir"?Dr(t,a.element.children[0],n.prefix||"",n.suffix||""):_r(t,a.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),wr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),tt=function(e,t,n){var r;if(typeof n!="string"?(S(e,["subToolbar","hint"]),n.preventDefault(),r=R(e)):r=n,!(e.currentMode===t&&typeof n!="string")){if(e.devtools&&e.devtools.renderEchart(e),e.options.preview.mode==="both"&&t==="sv"?e.preview.element.style.display="block":e.preview.element.style.display="none",y(e.toolbar.elements,M.g.EDIT_TOOLBARS),_(e.toolbar.elements,M.g.EDIT_TOOLBARS),m(e.toolbar.elements,["outdent","indent"]),t==="ir")C(e.toolbar.elements,["both"]),L(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(r),Je(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),We(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(o){Q(o,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(o){(0,I.H)(o,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")C(e.toolbar.elements,["both"]),L(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",We(e),un(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(o){(0,I.H)(o,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){L(e.toolbar.elements,["both"]),C(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-aft
|
|||
|
|
<button data-mode="ir">`).concat(window.VditorI18n.instantRendering," <").concat((0,c.ns)("⌥⌘8"),`></button>
|
|||
|
|
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,c.ns)("⌥⌘9"),"></button>"),a.element.appendChild(o),a._bindEvent(n,o,r),a}return t.prototype._bindEvent=function(n,r,a){var o=this.element.children[0];i(n,r,o,a.level),r.children.item(0).addEventListener((0,c.Le)(),function(l){tt(n,"wysiwyg",l),l.preventDefault(),l.stopPropagation()}),r.children.item(1).addEventListener((0,c.Le)(),function(l){tt(n,"ir",l),l.preventDefault(),l.stopPropagation()}),r.children.item(2).addEventListener((0,c.Le)(),function(l){tt(n,"sv",l),l.preventDefault(),l.stopPropagation()})},t})(Ce),ft=function(e,t){return(0,O.Gb)(e,t)?getSelection().toString():""},It=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(R(e)),S(e,["subToolbar","hint"])})},ln=function(e,t){t.addEventListener("dblclick",function(n){n.target.tagName==="IMG"&&(e.options.image.preview?e.options.image.preview(n.target):e.options.image.isPreview&&(0,te.E)(n.target,e.options.lang,e.options.theme))})},xt=function(e,t){t.addEventListener("blur",function(n){if(e.currentMode==="ir"){var r=e.ir.element.querySelector(".vditor-ir__node--expand");r&&r.classList.remove("vditor-ir__node--expand")}else e.currentMode==="wysiwyg"&&!e.wysiwyg.selectPopover.contains(n.relatedTarget)&&e.wysiwyg.hideComment();e[e.currentMode].range=(0,O.zh)(e),e.options.blur&&e.options.blur(R(e))})},Bt=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(M.g.DROP_EDITOR,M.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(M.g.DROP_EDITOR)?le(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Tt(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},zt=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},Ut=function(e,t,n){t.addEventListener("cut",function(r){n(r,e),e.options.comment.enable&&e.currentMode==="wysiwyg"&&e.wysiwyg.getComments(e),document.execCommand("delete")})},Te=function(e){if(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)),!!e.options.typewriterMode){var t=e[e.currentMode].element,n=(0,O.Ny)(t).top;e.options.height==="auto"&&!e.element.classList.contains("vditor--fullscreen")&&window.scrollTo(window.scrollX,n+e.element.offsetTop+e.toolbar.element.offsetHeight-window.innerHeight/2+10),(e.options.height!=="auto"||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},Vt=function(e,t){t.addEventListener("keydown",function(n){if(!n.isComposing&&e.options.keydown&&e.options.keydown(n),!((e.options.hint.extend.length>1||e.toolbar.elements.emoji)&&e.hint.select(n,e))){if(e.options.comment.enable&&e.currentMode==="wysiwyg"&&(n.key==="Backspace"||U("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(De(e,n))return}else if(e.currentMode==="wysiwyg"){if(hr(e,n))return}else if(e.currentMode==="ir"&&be(e,n))return;if(e.options.ctrlEnter&&U("⌘Enter",n)){e.options.ctrlEnter(R(e)),n.preventDefault();return}if(U("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(U("⌘Y",n)&&!e.toolbar.elements.redo){e.undo.redo(e),n.preventDefault();return}if(n.key==="Escape"){e.hint.element.style.display==="block"?e.hint.element.style.display="none":e.options.esc&&!n.isComposing&&e.options.esc(R(e)),n.preventDefault();return}if((0,c.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[1-6]$/.test(n.code)){if(e.currentMode==="wysiwyg"){var r=n.code.replace("Digit","H");(0,s.lG)(getSelection().getRangeAt(0).startContainer,r)?jt(e):kt(e,r),we(e)}else e.currentMode==="sv"?dn(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&mt(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,c.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return n.code==="Digit7"?tt(e,"wysiwyg",n):n.code==="Digit8"?tt(e,"ir",n):n.code==="Digit9"&&tt(e,"sv",n),!0;e.options.toolbar.find(function(a){if(!a.hotkey||a.toolbar){if(a.toolbar){var o=a.toolbar.f
|
|||
|
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|||
|
|
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=a:r.outerHTML=a,Se(e.sv.element),(0,O.ib)(e.sv.element,n),Te(e)},Et=function(e,t,n){n===void 0&&(n=!0);var r=e;for(r.nodeType===3&&(r=r.parentElement);r;){if(r.getAttribute("data-type")===t)return r;n?r=r.previousElementSibling:r=r.nextElementSibling}return!1},cn=function(e,t){f("SpinVditorSVDOM",e,"argument",t.options.debugger);var n=t.lute.SpinVditorSVDOM(e);return e="<div data-block='0'>"+n.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
|
|||
|
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|||
|
|
</span></span></div><div data-block="0"><`)+"</div>",f("SpinVditorSVDOM",e,"result",t.options.debugger),e},vr=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,r=t&&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"?e.textContent:"",a=!1;for(t==="newline"&&(a=!0);n&&!a;){var o=n.getAttribute("data-type");if(o==="li-marker"||o==="blockquote-marker"||o==="task-marker"||o==="padding"){var l=n.textContent;if(o==="li-marker"&&(t==="code-block-open-marker"||t==="code-block-info"))r=l.replace(/\S/g," ")+r;else if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var h=Et(e,"code-block-open-marker");h&&h.previousElementSibling&&(n=h.previousElementSibling,r=l+r)}else r=l+r}else o==="newline"&&(a=!0);n=n.previousElementSibling}return r},Ae=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),e.preview.render(e);var n=R(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,c.pK)()&&(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)},dn=function(e,t){var n=(0,O.zh)(e),r=(0,u.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
|
|||
|
|
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},_r=function(e,t,n,r){var a=(0,O.zh)(e),o=t.getAttribute("data-type");e.sv.element.childNodes.length===0&&(e.sv.element.innerHTML=`<span data-type="p" data-block="0"><span data-type="text"><wbr></span></span><span data-type="newline"><br><span style="display: none">
|
|||
|
|
</span></span>`,(0,O.ib)(e.sv.element,a));var l=(0,s.F9)(a.startContainer),h=(0,u.S)(a.startContainer,"SPAN");if(l){if(o==="link"){var w=void 0;a.toString()===""?w="".concat(n).concat(Lute.Caret).concat(r):w="".concat(n).concat(a.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,w);return}else if(o==="italic"||o==="bold"||o==="strike"||o==="inline-code"||o==="code"||o==="table"||o==="line"){var w=void 0;a.toString()===""?w="".concat(n).concat(Lute.Caret).concat(o==="code"?"":r):w="".concat(n).concat(a.toString()).concat(Lute.Caret).concat(o==="code"?"":r),o==="table"||o==="code"&&h&&h.textContent!==""?w=`
|
|||
|
|
|
|||
|
|
`+w:o==="line"&&(w=`
|
|||
|
|
|
|||
|
|
`.concat(n,`
|
|||
|
|
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,w);return}else if((o==="check"||o==="list"||o==="ordered-list"||o==="quote")&&h){var p="* ";o==="check"?p="* [ ] ":o==="ordered-list"?p="1. ":o==="quote"&&(p="> ");var A=Et(h,"newline");A?A.insertAdjacentText("afterend",p):l.insertAdjacentText("afterbegin",p),he(e);return}(0,O.ib)(e.sv.element,a),Ae(e)}},fn=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},pn=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])})},kr=function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function h(A){try{p(r.next(A))}catch(P){l(P)}}function w(A){try{p(r.throw(A))}catch(P){l(P)}}function p(A){A.done?o(A.value):a(A.value).then(h,w)}p((r=r.apply(e,t||[])).next())})},Er=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,a,o,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(p){return function(A){return w([p,A])}}function w(p){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,p[0]&&(n=0)),n;)try{if(r=1,a&&(o=p[0]&2?a.return:p[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,p[1])).done)return o;switch(a=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){n.label=p[1];break}if(p[0]===6&&n.label<o[1]){n.label=o[1],o=p;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(p);break}o[2]&&n.ops.pop(),n.trys.pop();continue}p=t.call(e,n)}catch(A){p=[6,A],a=0}finally{r=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Sr=(function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e})(),Cr=function(e,t){e.tip.hide();for(var n=[],r="",a="",o=e.options.lang,l=e.options,h=function(P,q){var W=t[q],V=!0;W.name||(r+="<li>".concat(window.VditorI18n.nameEmpty,"</li>"),V=!1),W.size>e.options.upload.max&&(r+="<li>".concat(W.name," ").concat(window.VditorI18n.over," ").concat(e.options.upload.max/1024/1024,"M</li>"),V=!1);var Z=W.name.lastIndexOf("."),$=W.name.substr(Z),F=e.options.upload.filename(W.name.substr(0,Z))+$;if(e.options.upload.accept){var ie=e.options.upload.accept.split(",").some(function(Y){var re=Y.trim();if(re.indexOf(".")===0){if($.toLowerCase()===re.toLowerCase())return!0}else if(W.type.split("/")[0]===re.split("/")[0])return!0;return!1});ie||(r+="<li>".concat(W.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),V=!1)}V&&(n.push(W),a+="<li>".concat(F," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},w=t.length,p=0;p<w;p++)h(w,p);if(e.tip.show("<ul>".concat(r).concat(a,"</ul>")),e.options.upload.cancel){var A=e.tip.element.querySelector(".vditorCancelUpload");A&&A.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},Mr=function(e,t){var n=fn(t);n.focus();var r=JSON.parse(e),a="";r.code===1&&(a="".concat(r.msg)),r.data.errFiles&&r.data.errFiles.length>0&&(a="<ul><li>".concat(a,"</li>"),r.data.errFiles.forEach(function(l){var h=l.lastIndexOf("."),w=t.options.upload.filename(l.substr(0,h))+l.substr(h);a+="<li>".concat(w," ").concat(window.VditorI18n.uploadError,"</li>")}),a+="</ul>"),a?t.tip.show(a):t.tip.hide();var o="";Object.keys(r.data.succMap).forEach(function(l){var h=r.data.succMap[l],w=l.lastIndexOf("."),p=l.substr(w),A=t.options.upload.filename(l.substr(0,w))+p;p=p.toLowerCase(),p.indexOf("
|
|||
|
|
data-block="0"><pre><code><audio controls="controls" src="`.concat(h,'"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(h,`"></audio></pre></div>
|
|||
|
|
`):t.currentMode==="ir"?o+='<audio controls="controls" src="'.concat(h,`"></audio>
|
|||
|
|
`):o+="[".concat(A,"](").concat(h,`)
|
|||
|
|
`):p.indexOf(".apng")===0||p.indexOf(".bmp")===0||p.indexOf(".gif")===0||p.indexOf(".ico")===0||p.indexOf(".cur")===0||p.indexOf(".jpg")===0||p.indexOf(".jpeg")===0||p.indexOf(".jfif")===0||p.indexOf(".pjp")===0||p.indexOf(".pjpeg")===0||p.indexOf(".png")===0||p.indexOf(".svg")===0||p.indexOf(".webp")===0?t.currentMode==="wysiwyg"?o+='<img alt="'.concat(A,'" src="').concat(h,`">
|
|||
|
|
`):o+=".concat(h,`)
|
|||
|
|
`):t.currentMode==="wysiwyg"?o+='<a href="'.concat(h,'">').concat(A,`</a>
|
|||
|
|
`):o+="[".concat(A,"](").concat(h,`)
|
|||
|
|
`)}),(0,O.Hc)(t.upload.range),document.execCommand("insertHTML",!1,o),t.upload.range=getSelection().getRangeAt(0).cloneRange()},qt=function(e,t,n){return kr(void 0,void 0,void 0,function(){var r,a,V,o,l,l,h,w,p,A,P,q,W,V,Z,$;return Er(this,function(F){switch(F.label){case 0:for(r=[],a=e.options.upload.multiple===!0?t.length:1,V=0;V<a;V++)o=t[V],o instanceof DataTransferItem&&(o=o.getAsFile()),r.push(o);return e.options.upload.handler?[4,e.options.upload.handler(r)]:[3,2];case 1:return l=F.sent(),n&&(n.value=""),typeof l=="string"?(e.tip.show(l),[2]):[2];case 2:return!e.options.upload.url||!e.upload?(n&&(n.value=""),e.tip.show("please config: options.upload.url"),[2]):e.options.upload.file?[4,e.options.upload.file(r)]:[3,4];case 3:r=F.sent(),F.label=4;case 4:if(e.options.upload.validate&&(l=e.options.upload.validate(r),typeof l=="string"))return e.tip.show(l),[2];if(h=fn(e),e.upload.range=(0,O.zh)(e),w=Cr(e,r),w.length===0)return n&&(n.value=""),[2];for(p=new FormData,A=e.options.upload.extraData,P=0,q=Object.keys(A);P<q.length;P++)W=q[P],p.append(W,A[W]);for(V=0,Z=w.length;V<Z;V++)p.append(e.options.upload.fieldName,w[V]);return $=new XMLHttpRequest,e.upload.xhr=$,$.open("POST",e.options.upload.url),e.options.upload.token&&$.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&($.withCredentials=!0),pn(e,$),e.upload.isUploading=!0,h.setAttribute("contenteditable","false"),$.onreadystatechange=function(){if($.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,h.setAttribute("contenteditable","true"),$.status>=200&&$.status<300)if(e.options.upload.success)e.options.upload.success(h,$.responseText);else{var ie=$.responseText;e.options.upload.format&&(ie=e.options.upload.format(t,$.responseText)),Mr(ie,e)}else e.options.upload.error?e.options.upload.error($.responseText):e.tip.show($.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},$.upload.onprogress=function(ie){if(ie.lengthComputable){var Y=ie.loaded/ie.total*100;e.upload.element.style.display="block";var re=e.upload.element;re.style.width=Y+"%"}},$.send(p),[2]}})})},St=function(e,t,n){var r,a=(0,s.F9)(t.startContainer);if(a||(a=e.wysiwyg.element),n&&n.inputType!=="formatItalic"&&n.inputType!=="deleteByDrag"&&n.inputType!=="insertFromDrop"&&n.inputType!=="formatBold"&&n.inputType!=="formatRemove"&&n.inputType!=="formatStrikeThrough"&&n.inputType!=="insertUnorderedList"&&n.inputType!=="insertOrderedList"&&n.inputType!=="formatOutdent"&&n.inputType!=="formatIndent"&&n.inputType!==""||!n){var o=cr(t.startContainer);o&&o.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(Y){Y.remove()}),t.insertNode(document.createElement("wbr")),a.querySelectorAll("[style]").forEach(function(Y){Y.removeAttribute("style")}),a.querySelectorAll(".vditor-comment").forEach(function(Y){Y.textContent.trim()===""&&(Y.classList.remove("vditor-comment","vditor-comment--focus"),Y.removeAttribute("data-cmtids"))}),(r=a.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(Y){Y.textContent.trim()===""&&(Y.classList.remove("vditor-comment","vditor-comment--focus"),Y.removeAttribute("data-cmtids"))});var l="";a.getAttribute("data-type")==="link-ref-defs-block"&&(a=e.wysiwyg.element);var h=a.isEqualNode(e.wysiwyg.element),w=(0,s.a1)(a,"data-type","footnotes-block");if(h)l=a.innerHTML;else{var p=(0,s.O9)(t.startContainer);if(p&&!w){var A=(0,u.S)(t.startContainer,"BLOCKQUOTE");A?a=(0,s.F9)(t.startContainer)||a:a=p}if(w&&(a=w),l=a.outerHTML,a.tagName==="UL"||a.tagName==="OL"){var P=a.previousElementSibling,q=a.nextElementSibling;P&&(P.tagName==="UL"||P.tagName==="OL")&&(l=P.outerHTML+l,P.remove()),q&&(q.tagName==="UL"||q.tagName==="OL")&&(l=l+q.outerHTML,q.remove()),l=l.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}a.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(Y){Y&&!a.isEqualNode(Y)&&(l+=Y.outerHTML,Y.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-b
|
|||
|
|
</p>`)),(0,O.ib)(e[e.currentMode].element,n),at(e),le(e))},Tr=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},Ar=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},yn=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling;return r||(e.parentElement.previousElementSibling?r=e.parentElement.previousElementSibling.lastElementChild:e.parentElement.parentElement.tagName==="TBODY"&&e.parentElement.parentElement.previousElementSibling?r=e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:r=null),r&&(t.selectNodeContents(r),n||t.collapse(!1),(0,O.Hc)(t)),r},ht=function(e,t,n,r,a){var o=(0,O.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowDown"&&r.textContent.trimRight().substr(o.start).indexOf(`
|
|||
|
|
`)===-1||t.key==="ArrowRight"&&o.start>=r.textContent.trimRight().length){var l=a.nextElementSibling;return!l||l&&(l.tagName==="TABLE"||l.getAttribute("data-type"))?(a.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(M.g.ZWSP,"<wbr></p>")),(0,O.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(l),n.collapse(!0),(0,O.Hc)(n)),t.preventDefault(),!0}return!1},it=function(e,t,n,r,a){var o=(0,O.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowUp"&&r.textContent.substr(0,o.start).indexOf(`
|
|||
|
|
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&o.start===0){var l=a.previousElementSibling;return!l||l&&(l.tagName==="TABLE"||l.getAttribute("data-type"))?(a.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(M.g.ZWSP,"<wbr></p>")),(0,O.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(l),n.collapse(!1),(0,O.Hc)(n)),t.preventDefault(),!0}return!1},Ct=function(e,t,n,r){r===void 0&&(r=!0);var a=(0,s.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(A){A.remove()}),t.insertNode(document.createElement("wbr")),r&&a){for(var o="",l=0;l<a.parentElement.childElementCount;l++){var h=a.parentElement.children[l].querySelector("input");h&&h.remove(),o+='<p data-block="0">'.concat(a.parentElement.children[l].innerHTML.trimLeft(),"</p>")}a.parentElement.insertAdjacentHTML("beforebegin",o),a.parentElement.remove()}else if(a)if(n==="check")a.parentElement.querySelectorAll("li").forEach(function(A){A.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(A.textContent.indexOf(" ")===0?"":" ")),A.classList.add("vditor-task")});else{a.querySelector("input")&&a.parentElement.querySelectorAll("li").forEach(function(A){A.querySelector("input").remove(),A.classList.remove("vditor-task")});var p=void 0;n==="list"?(p=document.createElement("ul"),p.setAttribute("data-marker","*")):(p=document.createElement("ol"),p.setAttribute("data-marker","1.")),p.setAttribute("data-block","0"),p.setAttribute("data-tight",a.parentElement.getAttribute("data-tight")),p.innerHTML=a.parentElement.innerHTML,a.parentElement.parentNode.replaceChild(p,a.parentElement)}else{var w=(0,s.a1)(t.startContainer,"data-block","0");w||(e[e.currentMode].element.querySelector("wbr").remove(),w=e[e.currentMode].element.querySelector("p"),w.innerHTML="<wbr>"),n==="check"?(w.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(w.innerHTML,"</li></ul>")),w.remove()):n==="list"?(w.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(w.innerHTML,"</li></ul>")),w.remove()):n==="ordered-list"&&(w.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(w.innerHTML,"</li></ol>")),w.remove())}},vn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var a=[t];Array.from(n.cloneContents().children).forEach(function(w,p){w.nodeType!==3&&t&&w.textContent.trim()!==""&&t.getAttribute("data-node-id")===w.getAttribute("data-node-id")&&(p!==0&&a.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(w){w.remove()}),n.insertNode(document.createElement("wbr"));var o=r.parentElement,l="";a.forEach(function(w){var p=w.getAttribute("data-marker");p.length!==1&&(p="1".concat(p.slice(-1))),l+='<li data-node-id="'.concat(w.getAttribute("data-node-id"),'" data-marker="').concat(p,'">').concat(w.innerHTML,"</li>"),w.remove()}),r.insertAdjacentHTML("beforeend","<".concat(o.tagName,' data-block="0">').concat(l,"</").concat(o.tagName,">")),e.currentMode==="wysiwyg"?o.outerHTML=e.lute.SpinVditorDOM(o.outerHTML):o.outerHTML=e.lute.SpinVditorIRDOM(o.outerHTML),(0,O.ib)(e[e.currentMode].element,n);var h=(0,s.O9)(n.startContainer);h&&h.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(w){Q(w,e),e.currentMode==="wysiwyg"&&w.previousElementSibling.setAttribute("style","display:none")}),le(e),at(e)}else e[e.currentMode].element.focus()},Kt=function(e,t,n,r){var a=(0,s.lG)(t.parentElement,"LI");if(a){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(P){P.remove()}),n.insertNode(document.createElement("wbr"));var o=t.parentElement,l=o.cloneNode(),h=[t];Array.from(n.cloneContents().children).forEach(function(P,q){P.nodeType!==3&&t&&P.textContent.trim()!==""&&t.getAttribute("data-node-id")===P.getAttribute("data-node-id")&&(q!==0&&h.push(t),t=t.nextElementSibling)});var w=!1,p="";o.querySelectorAll("li").forEach(function(P){w&&(p+=P.outerHTML,!P.nextElementSibling&&!P.previousElementSibling?P.parentElement.remove():P.remove()),P.isSameNo
|
|||
|
|
`).pop();return t===""?!1:(t.replace(/ |-/g,"")===""||t.replace(/ |_/g,"")===""||t.replace(/ |\*/g,"")==="")&&t.replace(/ /g,"").length>2?!(t.indexOf("-")>-1&&t.trimLeft().indexOf(" ")===-1&&e.trimRight().split(`
|
|||
|
|
`).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},$t=function(e){var t=e.trimRight().split(`
|
|||
|
|
`);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},le=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?we(e,t):e.currentMode==="ir"?Je(e,t):e.currentMode==="sv"&&Ae(e,t)},_n=function(e,t,n,r){var a,o=e.startContainer,l=(0,s.lG)(o,"LI");if(l){if(!(0,c.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&l.contains(n)&&n.nextElementSibling)return l&&!l.textContent.endsWith(`
|
|||
|
|
`)&&l.insertAdjacentText("beforeend",`
|
|||
|
|
`),e.insertNode(document.createTextNode(`
|
|||
|
|
|
|||
|
|
`)),e.collapse(!1),le(t),r.preventDefault(),!0;if(!(0,c.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!l.previousElementSibling&&e.toString()===""&&(0,O.im)(l,t[t.currentMode].element,e).start===0)return l.nextElementSibling?(l.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(l.innerHTML,"</p>")),l.remove()):l.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(l.innerHTML,"</p>"),(0,O.ib)(t[t.currentMode].element,e),le(t),r.preventDefault(),!0;if(!(0,c.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&l.textContent.trim().replace(M.g.ZWSP,"")===""&&e.toString()===""&&((a=l.previousElementSibling)===null||a===void 0?void 0:a.tagName)==="LI")return l.previousElementSibling.insertAdjacentText("beforeend",`
|
|||
|
|
|
|||
|
|
`),e.selectNodeContents(l.previousElementSibling),e.collapse(!1),l.remove(),(0,O.ib)(t[t.currentMode].element,e),le(t),r.preventDefault(),!0;if(!(0,c.yl)(r)&&!r.altKey&&r.key==="Tab"){var h=!1;if((e.startOffset===0&&(o.nodeType===3&&!o.previousSibling||o.nodeType!==3&&o.nodeName==="LI")||l.classList.contains("vditor-task")&&e.startOffset===1&&o.previousSibling.nodeType!==3&&o.previousSibling.tagName==="INPUT")&&(h=!0),h||e.toString()!=="")return r.shiftKey?Kt(t,l,e,l.parentElement):vn(t,l,e),r.preventDefault(),!0}}return!1},Zt=function(e,t,n){if(e.options.tab&&n.key==="Tab")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,O.Hc)(t),le(e),n.preventDefault(),!0},kn=function(e,t,n,r){if(n){if(!(0,c.yl)(e)&&!e.altKey&&e.key==="Enter"){var a=String.raw(Nn||(Nn=Lr(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),o=a.split("|");if(a.startsWith("|")&&a.endsWith("|")&&o.length>3){var l=o.map(function(){return"---"}).join("|");return l=n.textContent+`
|
|||
|
|
`+l.substring(3,l.length-3)+`
|
|||
|
|
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(l),(0,O.ib)(t[t.currentMode].element,r),le(t),Te(t),e.preventDefault(),!0}if(Gt(n.innerHTML)&&n.previousElementSibling){var h="",w=n.innerHTML.trimRight().split(`
|
|||
|
|
`);return w.length>1&&(w.pop(),h='<p data-block="0">'.concat(w.join(`
|
|||
|
|
`),"</p>")),n.insertAdjacentHTML("afterend","".concat(h,`<hr data-block="0"><p data-block="0"><wbr>
|
|||
|
|
</p>`)),n.remove(),(0,O.ib)(t[t.currentMode].element,r),le(t),Te(t),e.preventDefault(),!0}if($t(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|||
|
|
</p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|||
|
|
</p>`),(0,O.ib)(t[t.currentMode].element,r),le(t),Te(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,c.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
|
|||
|
|
`).length>1&&(0,O.im)(n,t[t.currentMode].element,r).start===0){var p=(0,s.DX)(n.previousElementSibling);return p.textContent.endsWith(`
|
|||
|
|
`)||(p.textContent=p.textContent+`
|
|||
|
|
`),p.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,O.ib)(t[t.currentMode].element,r),!1}return!1}},En=function(e,t,n){for(var r="",a=0;a<n.parentElement.childElementCount;a++)r+='<td align="'.concat(n.parentElement.children[a].getAttribute("align"),'"> </td>');n.tagName==="TH"?n.parentElement.parentElement.insertAdjacentHTML("afterend","<tbody><tr>".concat(r,"</tr></tbody>")):n.parentElement.insertAdjacentHTML("afterend","<tr>".concat(r,"</tr>")),le(e)},Sn=function(e,t,n){for(var r="",a=0;a<n.parentElement.childElementCount;a++)n.tagName==="TH"?r+='<th align="'.concat(n.parentElement.children[a].getAttribute("align"),'"> </th>'):r+='<td align="'.concat(n.parentElement.children[a].getAttribute("align"),'"> </td>');if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>".concat(r,"</tr></thead>")),t.insertNode(document.createElement("wbr"));var o=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",o),n.parentElement.parentElement.remove(),(0,O.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));le(e)},Lt=function(e,t,n,r){r===void 0&&(r="afterend");for(var a=0,o=n.previousElementSibling;o;)a++,o=o.previousElementSibling;for(var l=0;l<t.rows.length;l++)l===0?t.rows[l].cells[a].insertAdjacentHTML(r,"<th> </th>"):t.rows[l].cells[a].insertAdjacentHTML(r,"<td> </td>");le(e)},Cn=function(e,t,n){if(n.tagName==="TD"){var r=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(r.previousElementSibling.lastElementChild.lastElementChild),r.childElementCount===1?r.remove():n.parentElement.remove(),t.collapse(!1),(0,O.Hc)(t),le(e)}},Mn=function(e,t,n,r){for(var a=0,o=r.previousElementSibling;o;)a++,o=o.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var l=0;l<n.rows.length;l++){var h=n.rows[l].cells;if(h.length===1){n.remove(),at(e);break}h[a].remove()}(0,O.Hc)(t),le(e)},Ln=function(e,t,n){var r=n.startContainer,a=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(a){if(!(0,c.yl)(t)&&!t.altKey&&t.key==="Enter"){(!a.lastElementChild||a.lastElementChild&&(!a.lastElementChild.isSameNode(a.lastChild)||a.lastElementChild.tagName!=="BR"))&&a.insertAdjacentHTML("beforeend","<br>");var o=document.createElement("br");return n.insertNode(o),n.setStartAfter(o),le(e),Te(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return yn(a,n),t.preventDefault(),!0;var l=a.nextElementSibling;return l||(a.parentElement.nextElementSibling?l=a.parentElement.nextElementSibling.firstElementChild:a.parentElement.parentElement.tagName==="THEAD"&&a.parentElement.parentElement.nextElementSibling?l=a.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:l=null),l&&(n.selectNodeContents(l),(0,O.Hc)(n)),t.preventDefault(),!0}var h=a.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),a.tagName==="TH")return h.previousElementSibling?(n.selectNodeContents(h.previousElementSibling),n.collapse(!1),(0,O.Hc)(n)):pt(e,"beforebegin"),!0;for(var w=0,p=a.parentElement;w<p.cells.length&&!p.cells[w].isSameNode(a);w++);var A=p.previousElementSibling;return A||(A=p.parentElement.previousElementSibling.firstChild),n.selectNodeContents(A.cells[w]),n.collapse(!1),(0,O.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var p=a.parentElement;if(!p.nextElementSibling&&a.tagName==="TD")return h.nextElementSibling?(n.selectNodeContents(h.nextElementSibling),n.collapse(!0),(0,O.Hc)(n)):pt(e,"afterend"),!0;for(var w=0;w<p.cells.length&&!p.cells[w].isSameNode(a);w++);var l=p.nextElementSibling;return l||(l=p.parentElement.nextElementSibling.firstChild),n.selectNodeContents(l.cells[w]),n.collapse(!0),(0,O.Hc)(n),!0}if(e.currentMode==="wysiwyg"&&!(0,c.yl)(t)&&t.key==="Enter"&&!t.
|
|||
|
|
</p>`,(0,O.ib)(e[e.currentMode].element,n)):(n.setStartBefore(h),n.collapse(!0)),le(e)),t.preventDefault(),!0}if(U("⇧⌘F",t))return Sn(e,n,a),t.preventDefault(),!0;if(U("⌘=",t))return En(e,n,a),t.preventDefault(),!0;if(U("⇧⌘G",t))return Lt(e,h,a,"beforebegin"),t.preventDefault(),!0;if(U("⇧⌘=",t))return Lt(e,h,a),t.preventDefault(),!0;if(U("⌘-",t))return Cn(e,n,a),t.preventDefault(),!0;if(U("⇧⌘-",t))return Mn(e,n,h,a),t.preventDefault(),!0;if(U("⇧⌘L",t)){if(e.currentMode==="ir")return Mt(h,"left"),le(e),t.preventDefault(),!0;var W=e.wysiwyg.popover.querySelector('[data-type="left"]');if(W)return W.click(),t.preventDefault(),!0}if(U("⇧⌘C",t)){if(e.currentMode==="ir")return Mt(h,"center"),le(e),t.preventDefault(),!0;var W=e.wysiwyg.popover.querySelector('[data-type="center"]');if(W)return W.click(),t.preventDefault(),!0}if(U("⇧⌘R",t)){if(e.currentMode==="ir")return Mt(h,"right"),le(e),t.preventDefault(),!0;var W=e.wysiwyg.popover.querySelector('[data-type="right"]');if(W)return W.click(),t.preventDefault(),!0}}return!1},Tn=function(e,t,n,r){if(n.tagName==="PRE"&&U("⌘A",t))return r.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&t.key==="Tab"&&!t.shiftKey&&r.toString()==="")return r.insertNode(document.createTextNode(e.options.tab)),r.collapse(!1),le(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,c.yl)(t)&&!t.shiftKey&&!t.altKey){var a=(0,O.im)(n,e[e.currentMode].element,r);if((a.start===0||a.start===1&&n.innerText===`
|
|||
|
|
`)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,O.ib)(e[e.currentMode].element,r),le(e),t.preventDefault(),!0}return!(0,c.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
|
|||
|
|
`)||n.firstElementChild.insertAdjacentText("beforeend",`
|
|||
|
|
`),r.extractContents(),r.insertNode(document.createTextNode(`
|
|||
|
|
`)),r.collapse(!1),(0,O.Hc)(r),(0,c.vU)()||(e.currentMode==="wysiwyg"?St(e,r):_e(e,r)),Te(e),t.preventDefault(),!0):!1},An=function(e,t,n,r){var a=t.startContainer,o=(0,s.lG)(a,"BLOCKQUOTE");if(o&&t.toString()===""){if(n.key==="Backspace"&&!(0,c.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,O.im)(o,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),o.outerHTML=o.innerHTML,(0,O.ib)(e[e.currentMode].element,t),le(e),n.preventDefault(),!0;if(r&&n.key==="Enter"&&!(0,c.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.tagName==="BLOCKQUOTE"){var l=!1;if(r.innerHTML.replace(M.g.ZWSP,"")===`
|
|||
|
|
`||r.innerHTML.replace(M.g.ZWSP,"")===""?(l=!0,r.remove()):r.innerHTML.endsWith(`
|
|||
|
|
|
|||
|
|
`)&&(0,O.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),l=!0),l)return o.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(M.g.ZWSP,`<wbr>
|
|||
|
|
</p>`)),(0,O.ib)(e[e.currentMode].element,t),le(e),n.preventDefault(),!0}var h=(0,s.F9)(a);if(e.currentMode==="wysiwyg"&&h&&U("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),h.outerHTML='<blockquote data-block="0">'.concat(h.outerHTML,"</blockquote>"),(0,O.ib)(e.wysiwyg.element,t),we(e),n.preventDefault(),!0;if(ht(e,n,t,o,o)||it(e,n,t,o,o))return!0}return!1},Hn=function(e,t,n){var r=t.startContainer,a=(0,s.lG)(r,"LI");if(a&&a.classList.contains("vditor-task")){if(U("⇧⌘J",n)){var o=a.firstElementChild;return o.checked?o.removeAttribute("checked"):o.setAttribute("checked","checked"),le(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,c.yl)(n)&&!n.shiftKey&&!n.altKey&&t.toString()===""&&t.startOffset===1&&(r.nodeType===3&&r.previousSibling&&r.previousSibling.tagName==="INPUT"||r.nodeType!==3)){var l=a.previousElementSibling;if(a.querySelector("input").remove(),l){var h=(0,s.DX)(l);h.parentElement.insertAdjacentHTML("beforeend","<wbr>"+a.innerHTML.trim()),a.remove()}else a.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(a.innerHTML.trim()||`
|
|||
|
|
`,"</p>")),a.nextElementSibling?a.remove():a.parentElement.remove();return(0,O.ib)(e[e.currentMode].element,t),le(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,c.yl)(n)&&!n.shiftKey&&!n.altKey){if(a.textContent.trim()==="")if((0,s.fb)(a.parentElement,"vditor-task")){var w=(0,s.O9)(r);w&&Kt(e,a,t,w)}else if(a.nextElementSibling){var p="",A="",P=!1;Array.from(a.parentElement.children).forEach(function(Z){a.isSameNode(Z)?P=!0:P?p+=Z.outerHTML:A+=Z.outerHTML});var q=a.parentElement.tagName,W=a.parentElement.tagName==="OL"?"":' data-marker="'.concat(a.parentElement.getAttribute("data-marker"),'"'),V="";A&&(V=a.parentElement.tagName==="UL"?"":' start="1"',A="<".concat(q,' data-tight="true"').concat(W,' data-block="0">').concat(A,"</").concat(q,">")),a.parentElement.outerHTML="".concat(A,`<p data-block="0"><wbr>
|
|||
|
|
</p><`).concat(q,`
|
|||
|
|
data-tight="true"`).concat(W,' data-block="0"').concat(V,">").concat(p,"</").concat(q,">")}else a.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
|
|||
|
|
</p>`),a.parentElement.querySelectorAll("li").length===1?a.parentElement.remove():a.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(a.lastChild),a.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(a.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,O.ib)(e[e.currentMode].element,t),le(e),Te(e),n.preventDefault(),!0}}return!1},Dn=function(e,t,n,r){if(t.startContainer.nodeType!==3){var a=t.startContainer.children[t.startOffset];if(a&&a.tagName==="HR")return t.selectNodeContents(a.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var o=r.previousElementSibling;if(o&&(0,O.im)(r,e[e.currentMode].element,t).start===0&&((0,c.vU)()&&o.tagName==="HR"||o.tagName==="TABLE")){if(o.tagName==="TABLE"){var l=o.lastElementChild.lastElementChild.lastElementChild;l.innerHTML=l.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else o.remove();return(0,O.ib)(e[e.currentMode].element,t),le(e),n.preventDefault(),!0}}return!1},On=function(e){(0,c.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Pn=function(e,t,n){var r,a;if(!(0,c.vU)())return!1;if(e.key==="ArrowUp"&&t&&((r=t.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="TABLE"){var o=t.previousElementSibling;return n.selectNodeContents(o.rows[o.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return e.key==="ArrowDown"&&t&&((a=t.nextElementSibling)===null||a===void 0?void 0:a.tagName)==="TABLE"?(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0):!1},Tt=function(e,t,n){return hn(void 0,void 0,void 0,function(){var r,a,o,l,h,w,p,A,P,q,W,V,Z,F,$,F,ie;return mn(this,function(Y){switch(Y.label){case 0:return e[e.currentMode].element.getAttribute("contenteditable")!=="true"?[2]:(t.stopPropagation(),t.preventDefault(),"clipboardData"in t?(r=t.clipboardData.getData("text/html"),a=t.clipboardData.getData("text/plain"),o=t.clipboardData.files):(r=t.dataTransfer.getData("text/html"),a=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(o=t.dataTransfer.items)),l={},h=function(re,pe){if(!pe)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,re,pe);var fe=re.TokensStr();if(re.__internal_object__.Parent.Type===34&&fe&&fe.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var ye=new XMLHttpRequest;ye.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&ye.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(ye.withCredentials=!0),pn(e,ye),ye.setRequestHeader("Content-Type","application/json; charset=utf-8"),ye.onreadystatechange=function(){if(ye.readyState===XMLHttpRequest.DONE){if(ye.status===200){var je=ye.responseText;e.options.upload.linkToImgFormat&&(je=e.options.upload.linkToImgFormat(ye.responseText));var Oe=JSON.parse(je);if(Oe.code!==0){e.tip.show(Oe.msg);return}var Re=Oe.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(Ie){Ie.textContent===Re&&(Ie.textContent=Oe.data.url)});else{var ce=e[e.currentMode].element.querySelector('img[src="'.concat(Re,'"]'));ce.src=Oe.data.url,e.currentMode==="ir"&&(ce.previousElementSibling.previousElementSibling.innerHTML=Oe.data.url)}le(e)}else e.tip.show(ye.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(ye.responseText)}},ye.send(JSON.stringify({url:fe}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(fe),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(fe),"</span>"),Lute.WalkContinue]},(r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(a,'">').concat(a,"</a>")|
|
|||
|
|
`):re+=".concat(V.result.toString(),`)
|
|||
|
|
`),document.execCommand("insertHTML",!1,re)}),Y.label=8;case 8:return[3,10];case 9:a.trim()!==""&&o.length===0&&(F=(0,O.zh)(e),F.toString()!==""&&e.lute.IsValidLinkDest(a)&&(a="[".concat(F.toString(),"](").concat(a,")")),e.currentMode==="ir"?(l.Md2VditorIRDOM={renderLinkDest:h},e.lute.SetJSRenderers({renderers:l}),(0,O.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(a)),e)):e.currentMode==="wysiwyg"?(l.Md2VditorDOM={renderLinkDest:h},e.lute.SetJSRenderers({renderers:l}),(0,O.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(a)),e)):(l.Md2VditorSVDOM={renderLinkDest:h},e.lute.SetJSRenderers({renderers:l}),Ft(e,a)),e.outline.render(e)),Y.label=10;case 10:return e.currentMode!=="sv"&&($=(0,s.F9)((0,O.zh)(e).startContainer),$&&(F=(0,O.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(re){re.remove()}),F.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?$.outerHTML=e.lute.SpinVditorDOM($.outerHTML):$.outerHTML=e.lute.SpinVditorIRDOM($.outerHTML),(0,O.ib)(e[e.currentMode].element,F)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(re){Q(re,e)})),e.wysiwyg.triggerRemoveComment(e),le(e),e[e.currentMode].element.scrollHeight-p>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&Te(e),[2]}})})},Hr=function(e,t,n){return hn(void 0,void 0,void 0,function(){var r,a,o,l,h,w,p,A,P,Z,q,W,V,Z,$,F;return mn(this,function(ie){switch(ie.label){case 0:if(!n)return[2];if(r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,a=new RegExp("(?:("+r.source+"))([\\da-fA-F\\s]+)\\}","g"),o=n.match(a),l=[],o)for(h=0,w=o;h<w.length;h++)p=w[h],A=void 0,p.includes("\\pngblip")?A="image/png":p.includes("\\jpegblip")&&(A="image/jpeg"),A&&l.push({hex:p.replace(r,"").replace(/[^\da-fA-F]/g,""),type:A});for(P=[],Jt(t,function(Y){if(Y.tagName==="V:SHAPE")return Jt(Y,function(re){re.tagName==="V:IMAGEDATA"&&P.push({shape:Y,img:re})}),!1}),Z=0;Z<P.length;Z++)q=document.createElement("img"),W="data:"+l[Z].type+";base64,"+btoa((l[Z].hex.match(/\w{2}/g)||[]).map(function(Y){return String.fromCharCode(parseInt(Y,16))}).join("")),q.src=W,q.title=P[Z].img.getAttribute("title"),P[Z].shape.parentNode.replaceChild(q,P[Z].shape);V=t.querySelectorAll("img"),Z=0,ie.label=1;case 1:return Z<V.length?($=V[Z].src||"",$?(F=V[Z],[4,e.options.upload.base64ToLink($)]):[3,3]):[3,4];case 2:F.src=ie.sent(),ie.label=3;case 3:return Z++,[3,1];case 4:return[2]}})})},Jt=function(e,t){var n=t(e);if(n!==!1)for(var r=0;r<e.children.length;r++)Jt(e.children[r],t)},Nn,jn=function(e){var t,n;e.hint.render(e);var r=(0,O.zh)(e).startContainer,a=(0,s.a1)(r,"data-type","code-block-info");if(a)if(a.textContent.replace(M.g.ZWSP,"")===""&&e.hint.recentLanguage){a.textContent=M.g.ZWSP+e.hint.recentLanguage;var o=(0,O.zh)(e);o.selectNodeContents(a)}else{var l=[],h=a.textContent.substring(0,(0,O.im)(a,e.ir.element).start).replace(M.g.ZWSP,"");(e.options.preview.hljs.langs||M.g.ALIAS_CODE_LANGUAGES.concat(((n=(t=window.hljs)===null||t===void 0?void 0:t.listLanguages())!==null&&n!==void 0?n:[]).sort())).forEach(function(w){w.indexOf(h.toLowerCase())>-1&&l.push({html:w,value:w})}),e.hint.genHTML(l,h,e)}},Je=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&jn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=R(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,c.pK)()&&(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)},mt=function(e,t){var n=(0,O.zh)(e),r=(0,s.F9)(n.startContainer)||n.startContainer;if(r){var a=r.querySelector(".vditor-ir__marker--heading");a?a.innerHTML=t:(r.insertAdjacentText("afterbegin",t),n.selectNodeContents(r),n.collapse(!1)),_e(e,n.cloneRange()),lt(e)}},At=function(e,t,n){var
|
|||
|
|
</p>`;P.innerHTML.trim()===""?P.outerHTML=q:P.insertAdjacentHTML("afterend",q)}}else if(o==="quote")P&&(a.insertNode(document.createElement("wbr")),P.outerHTML='<blockquote data-block="0">'.concat(P.outerHTML,"</blockquote>"),h=!1,t.classList.add("vditor-menu--current"));else if(o==="link"){var W=void 0;a.toString()===""?W="".concat(n,"<wbr>").concat(r):W="".concat(n).concat(a.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,W),h=!1,t.classList.add("vditor-menu--current")}else if(o==="italic"||o==="bold"||o==="strike"||o==="inline-code"||o==="code"||o==="table"){var W=void 0;a.toString()===""?W="".concat(n,"<wbr>").concat(r):(o==="code"?W="".concat(n,`
|
|||
|
|
`).concat(a.toString(),"<wbr>").concat(r):o==="table"?W="".concat(n).concat(a.toString(),"<wbr>").concat(r):W="".concat(n).concat(a.toString()).concat(r,"<wbr>"),a.deleteContents()),(o==="table"||o==="code")&&(W=`
|
|||
|
|
`+W+`
|
|||
|
|
|
|||
|
|
`);var V=document.createElement("span");V.innerHTML=W,a.insertNode(V),_e(e,a),o==="table"&&(a.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,O.Hc)(a))}else(o==="check"||o==="list"||o==="ordered-list")&&(Ct(e,a,o,!1),h=!1,_(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,O.ib)(e.ir.element,a),Je(e),h&<(e)},Or=function(e,t,n,r){function a(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function h(A){try{p(r.next(A))}catch(P){l(P)}}function w(A){try{p(r.throw(A))}catch(P){l(P)}}function p(A){A.done?o(A.value):a(A.value).then(h,w)}p((r=r.apply(e,t||[])).next())})},Pr=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,a,o,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(p){return function(A){return w([p,A])}}function w(p){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,p[0]&&(n=0)),n;)try{if(r=1,a&&(o=p[0]&2?a.return:p[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,p[1])).done)return o;switch(a=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){n.label=p[1];break}if(p[0]===6&&n.label<o[1]){n.label=o[1],o=p;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(p);break}o[2]&&n.ops.pop(),n.trys.pop();continue}p=t.call(e,n)}catch(A){p=[6,A],a=0}finally{r=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Nr=(function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(r,a){n.element.style.display="none";var o=decodeURIComponent(r.getAttribute("data-value")),l=window.getSelection().getRangeAt(0);if(a.currentMode==="ir"){var h=(0,s.a1)(l.startContainer,"data-type","code-block-info");if(h){h.textContent=M.g.ZWSP+o.trimRight(),l.selectNodeContents(h),l.collapse(!1),Je(a),h.parentElement.querySelectorAll("code").forEach(function(P){P.className="language-"+o.trimRight()}),Q(h.parentElement.querySelector(".vditor-ir__preview"),a),n.recentLanguage=o.trimRight();return}}if(a.currentMode==="wysiwyg"&&l.startContainer.nodeType!==3){var w=l.startContainer,p=void 0;if(w.classList.contains("vditor-input")?p=w:p=w.firstElementChild,p&&p.classList.contains("vditor-input")){p.value=o.trimRight(),l.selectNodeContents(p),l.collapse(!1),p.dispatchEvent(new CustomEvent("input",{detail:1})),n.recentLanguage=o.trimRight();return}}if(l.setStart(l.startContainer,n.lastIndex),l.deleteContents(),a.options.hint.parse?a.currentMode==="sv"?(0,O.oC)(a.lute.SpinVditorSVDOM(o),a):a.currentMode==="wysiwyg"?(0,O.oC)(a.lute.SpinVditorDOM(o),a):(0,O.oC)(a.lute.SpinVditorIRDOM(o),a):(0,O.oC)(o,a),n.splitChar===":"&&o.indexOf(":")>-1&&a.currentMode!=="sv"&&l.insertNode(document.createTextNode(" ")),l.collapse(!1),(0,O.Hc)(l),a.currentMode==="wysiwyg"){var A=(0,s.fb)(l.startContainer,"vditor-wysiwyg__block");A&&A.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(A.lastElementChild.innerHTML=A.firstElementChild.innerHTML,Q(A.lastElementChild,a))}else if(a.currentMode==="ir"){var A=(0,s.fb)(l.startContainer,"vditor-ir__marker--pre");A&&A.nextElementSibling.classList.contains("vditor-ir__preview")&&(A.nextElementSibling.innerHTML=A.innerHTML,Q(A.nextElementSibling,a))}le(a)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage="",t.push({key:":"})}return e.prototype.render=function(t){var n=this;if(window.getSelection().focusNode){var r,a=getSelection().getRangeAt(0);r=a.startContainer.textContent.substring(0,a.startOffset)||"";var o=this.getKey(r,t.options.hint.extend);if(typeof o=="undefined")this.element.style.display="none",clearTimeout(this.timeId);else if(this.splitChar===":"){var l=o===""?t.optio
|
|||
|
|
`).concat(q===0?"class='vditor-hint--current'":"","> ").concat(W,"</button>")}}),this.element.innerHTML=p;var A=parseInt(document.defaultView.getComputedStyle(o,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(w+(A||22),"px"),this.element.style.left="".concat(h,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(P){P.addEventListener("click",function(q){a.fillEmoji(P,r),q.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(w-this.element.offsetHeight,"px")),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var r=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.nextElementSibling?r.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.previousElementSibling)r.previousElementSibling.className="vditor-hint--current";else{var a=this.element.children.length;this.element.children[a-1].className="vditor-hint--current"}return!0}else if(!(0,c.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"&&!t.isComposing)return t.preventDefault(),t.stopPropagation(),this.fillEmoji(r,n),!0;return!1},e.prototype.getKey=function(t,n){var r=this;this.lastIndex=-1,this.splitChar="",n.forEach(function(p){var A=t.lastIndexOf(p.key);r.lastIndex<A&&(r.splitChar=p.key,r.lastIndex=A)});var a;if(this.lastIndex===-1)return a;var o=t.split(this.splitChar),l=o[o.length-1],h=32;if(o.length>1&&l.trim()===l)if(o.length===2&&o[0]===""&&o[1].length<h)a=o[1];else{var w=o[o.length-2].slice(-1);(0,D.X)(w)===" "&&l.length<h&&(a=l)}return a},e})(),jr=(function(){function e(t){this.composingLock=!1;var n=document.createElement("div");n.className="vditor-ir",n.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
|
|||
|
|
contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),It(t,this.element),ln(t,this.element),xt(t,this.element),Vt(t,this.element),Wt(t,this.element),Bt(t,this.element),zt(t,this.element,this.copy),Ut(t,this.element,this.copy)}return e.prototype.copy=function(t,n){var r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var a=document.createElement("div");a.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorIRDOM2Md(a.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Tt(t,r,{pasteCode:function(a){document.execCommand("insertHTML",!1,a)}})}),this.element.addEventListener("scroll",function(){S(t,["hint"])}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,c.vU)()||_e(t,getSelection().getRangeAt(0).cloneRange()),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,Je(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||_e(t,getSelection().getRangeAt(0).cloneRange(),!1,r)}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){r.target.checked?r.target.setAttribute("checked","checked"):r.target.removeAttribute("checked"),n.preventInput=!0,Je(t);return}var a=(0,O.zh)(t),o=(0,s.fb)(r.target,"vditor-ir__preview");if(o||(o=(0,s.fb)(a.startContainer,"vditor-ir__preview")),o&&(o.previousElementSibling.firstElementChild?a.selectNodeContents(o.previousElementSibling.firstElementChild):a.selectNodeContents(o.previousElementSibling),a.collapse(!0),(0,O.Hc)(a),Te(t)),r.target.tagName==="IMG"){var l=r.target.parentElement.querySelector(".vditor-ir__marker--link");l&&(a.selectNode(l),(0,O.Hc)(a))}var h=(0,s.a1)(r.target,"data-type","a");if(h&&!h.classList.contains("vditor-ir__node--expand")){t.options.link.click?t.options.link.click(h.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(h.querySelector(":scope > .vditor-ir__marker--link").textContent);return}if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&a.collapsed){var w=n.element.lastElementChild.getBoundingClientRect();r.y>w.top+w.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(M.g.ZWSP,"")===""?(a.selectNodeContents(n.element.lastElementChild),a.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(M.g.ZWSP,"<wbr></p>")),(0,O.ib)(n.element,a)))}a.toString()===""?G(a,t):setTimeout(function(){G((0,O.zh)(t),t)}),Pe(r,t),lt(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,c.yl)(r))){if(r.key==="Enter"&&Te(t),lt(t),(r.key==="Backspace"||r.key==="Delete")&&t.ir.element.innerHTML!==""&&t.ir.element.childNodes.length===1&&t.ir.element.firstElementChild&&t.ir.element.firstElementChild.tagName==="P"&&t.ir.element.firstElementChild.childElementCount===0&&(t.ir.element.textContent===""||t.ir.element.textContent===`
|
|||
|
|
`)){t.ir.element.innerHTML="";return}var a=(0,O.zh)(t);r.key==="Backspace"?((0,c.vU)()&&a.startContainer.textContent===`
|
|||
|
|
`&&a.startOffset===1&&(a.startContainer.textContent="",G(a,t)),n.element.querySelectorAll(".language-math").forEach(function(l){var h=l.querySelector("br");h&&h.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&jn(t),G(a,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&G(a,t);var o=(0,s.fb)(a.startContainer,"vditor-ir__preview");if(o){if(r.key==="ArrowUp"||r.key==="ArrowLeft")return o.previousElementSibling.firstElementChild?a.selectNodeContents(o.previousElementSibling.firstElementChild):a.selectNodeContents(o.previousElementSibling),a.collapse(!1),r.preventDefault(),!0;if(o.tagName==="SPAN"&&(r.key==="ArrowDown"||r.key==="ArrowRight"))return o.parentElement.getAttribute("data-type")==="html-entity"?(o.parentElement.insertAdjacentText("afterend",M.g.ZWSP),a.setStart(o.parentElement.nextSibling,1)):a.selectNodeContents(o.parentElement.lastElementChild),a.collapse(!1),r.preventDefault(),!0}}})},e})(),Rn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(R(e));if(e.currentMode==="wysiwyg")return e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML);if(e.currentMode==="ir")return e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML)},Rr=ae(214),In=ae(436),Ir=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML='<div class="vditor-outline__title">'.concat(t,`</div>
|
|||
|
|
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,In.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,In.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var a;n===void 0&&(n=!0),r===void 0&&(r=!0);var o=(a=t.toolbar.elements.outline)===null||a===void 0?void 0:a.firstElementChild;if(n&&window.innerWidth>=M.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),o==null||o.classList.add("vditor-menu--current")):(this.element.style.display="none",o==null||o.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var l=getSelection().getRangeAt(0);t[t.currentMode].element.contains(l.startContainer)&&(0,O.Hc)(l)}We(t)},e})(),xr=ae(280),Br=(function(){function e(t){var n=this;this.element=document.createElement("div"),this.element.className="vditor-preview",this.previewElement=document.createElement("div"),this.previewElement.className="vditor-reset",t.options.classes.preview&&this.previewElement.classList.add(t.options.classes.preview),this.previewElement.style.maxWidth=t.options.preview.maxWidth+"px",this.previewElement.addEventListener("copy",function(w){if(w.target.tagName!=="TEXTAREA"){var p=document.createElement("div");p.className="vditor-reset",p.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,p,"default"),w.preventDefault()}}),this.previewElement.addEventListener("click",function(w){var p=(0,s.lG)(w.target,"SPAN");if(p&&(0,s.fb)(p,"vditor-toc")){var A=n.previewElement.querySelector("#"+p.getAttribute("data-target-id"));A&&(n.element.scrollTop=A.offsetTop);return}if(w.target.tagName==="A"){t.options.link.click?t.options.link.click(w.target):t.options.link.isOpen&&window.open(w.target.getAttribute("href")),w.preventDefault();return}w.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(w.target):t.options.image.isPreview&&(0,te.E)(w.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var a=document.createElement("div");a.className="vditor-preview__action";for(var o=[],l=0;l<r.length;l++){var h=r[l];if(typeof h=="object"){o.push('<button type="button" data-type="'.concat(h.key,'" class="').concat(h.className,'"').concat(h.tooltip?' aria-label="'.concat(h.tooltip,'"'):"",'">').concat(h.text,"</button>"));continue}switch(h){case"desktop":o.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":o.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":o.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":o.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":o.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}a.innerHTML=o.join(""),a.addEventListener((0,c.Le)(),function(w){var p=(0,u.S)(w.target,"BUTTON");if(p){var A=p.getAttribute("data-type"),P=r.find(function(q){return(q==null?void 0:q.key)===A});if(P){P.click(A);return}if(A==="mp-wechat"||A==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),A);return}A==="desktop"?n.previewElement.style.width="auto":A==="tablet"?n.previewElement.style.width="780px":n.previewElement.style.width="360px",n.previewElement.scrollWidth>n.previewElement.parentElement.clientWidth&&(n.previewElement.style.width="auto"),n.render(t),a.querySelectorAll("button").forEach(function(q){q.classList.remove("vditor-preview__action--current")}),p.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(a,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.styl
|
|||
|
|
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&Te(t)}})},e})(),xn=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(t,n){var r=this;n===void 0&&(n=6e3),this.element.className="vditor-tip vditor-tip--show",n===0?(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,`
|
|||
|
|
<div class="vditor-tip__close">X</div></div>`),this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){r.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,"</div>"),setTimeout(function(){r.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){var a=r.element.getBoundingClientRect();a.top<46&&(r.element.style.position="fixed",r.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e})(),Xt=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),b(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",_(t.toolbar.elements,["both"]);break;default:break}t.devtools&&t.devtools.renderEchart(t)}},Vr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Wr=(function(e){Vr(t,e);function t(n,r){var a=e.call(this,n,r)||this;return n.options.preview.mode==="both"&&a.element.children[0].classList.add("vditor-menu--current"),a.element.children[0].addEventListener((0,c.Le)(),function(o){var l=a.element.firstElementChild;l.classList.contains(M.g.CLASS_MENU_DISABLED)||(o.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Xt("editor",n):Xt("both",n)))}),a}return t})(Ce),Fr=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e})(),Bn=ae(580),qr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Kr=(function(e){qr(t,e);function t(n,r){var a=e.call(this,n,r)||this,o=a.element.children[0],l=document.createElement("div");l.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var h="";return M.g.CODE_THEME.forEach(function(w){h+="<button>".concat(w,"</button>")}),l.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(h,"</div>"),l.addEventListener((0,c.Le)(),function(w){w.target.tagName==="BUTTON"&&(S(n,["subToolbar"]),n.options.preview.hljs.style=w.target.textContent,(0,Bn.Y)(w.target.textContent,n.options.cdn),w.preventDefault(),w.stopPropagation())}),a.element.appendChild(l),i(n,l,o,r.level),a}return t})(Ce),Gr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),$r=(function(e){Gr(t,e);function t(n,r){var a=e.call(this,n,r)||this,o=a.element.children[0],l=document.createElement("div");l.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var h="";return Object.keys(n.options.preview.theme.list).forEach(function(w){h+='<button data-type="'.concat(w,'">').concat(n.options.preview.theme.list[w],"</button>")}),l.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px
|
|||
|
|
`)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var a=t[t.currentMode].element.cloneNode(!0);a.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(o){o.remove()}),r=a.textContent.length}typeof t.options.counter.max=="number"?(r>t.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML="".concat(r,"/").concat(t.options.counter.max)):this.element.innerHTML="".concat(r),this.element.setAttribute("aria-label",t.options.counter.type),t.options.counter.after&&t.options.counter.after(r,{enable:t.options.counter.enable,max:t.options.counter.max,type:t.options.counter.type})},e})(),Jr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Xr=(function(e){Jr(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].innerHTML=r.icon,a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault(),!o.currentTarget.classList.contains(M.g.CLASS_MENU_DISABLED)&&r.click(o,n)}),a}return t})(Ce),Qr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Yr=(function(e){Qr(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.firstElementChild.addEventListener((0,c.Le)(),function(o){var l=a.element.firstElementChild;l.classList.contains(M.g.CLASS_MENU_DISABLED)||(o.preventDefault(),l.classList.contains("vditor-menu--current")?(l.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",We(n)):(l.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",We(n),n.devtools.renderEchart(n)))}),a}return t})(Ce),ea=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e})(),ta=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),na=(function(e){ta(t,e);function t(n,r){var a=e.call(this,n,r)||this,o=document.createElement("div");o.className="vditor-panel vditor-panel--arrow";var l="";return Object.keys(n.options.hint.emoji).forEach(function(h){var w=n.options.hint.emoji[h];w.indexOf(".")>-1?l+='<button data-value=":'.concat(h,': " data-key=":').concat(h,`:"><img
|
|||
|
|
data-value=":`).concat(h,': " data-key=":').concat(h,':" class="vditor-emojis__icon" src="').concat(w,'"/></button>'):l+='<button data-value="'.concat(w,` "
|
|||
|
|
data-key="`).concat(h,'"><span class="vditor-emojis__icon">').concat(w,"</span></button>")}),o.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(l,`</div><div class="vditor-emojis__tail">
|
|||
|
|
<span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
|
|||
|
|
</div>`),a.element.appendChild(o),i(n,o,a.element.firstElementChild,r.level),a.bindEvent(n),a}return t.prototype.bindEvent=function(n){var r=this;this.element.lastElementChild.addEventListener((0,c.Le)(),function(a){var o=(0,u.S)(a.target,"BUTTON");if(o){a.preventDefault();var l=o.getAttribute("data-value"),h=(0,O.zh)(n),w=l;if(n.currentMode==="wysiwyg"?w=n.lute.SpinVditorDOM(l):n.currentMode==="ir"&&(w=n.lute.SpinVditorIRDOM(l)),l.indexOf(":")>-1&&n.currentMode!=="sv"){var p=document.createElement("div");p.innerHTML=w,w=p.firstElementChild.firstElementChild.outerHTML+" ",(0,O.oC)(w,n)}else h.extractContents(),h.insertNode(document.createTextNode(l)),(0,s.F9)(h.startContainer)||Nt(n,h);h.collapse(!1),(0,O.Hc)(h),r.element.lastElementChild.style.display="none",le(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(a){var o=(0,u.S)(a.target,"BUTTON");o&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=o.getAttribute("data-key"))})},t})(Ce),zn=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)},ra=function(e){var t=R(e);zn(e,t,t.substr(0,10)+".md")},aa=function(e){e.tip.show(window.VditorI18n.generate,3800);var t=document.querySelector("#vditorExportIframe");t.contentDocument.open(),t.contentDocument.write('<link rel="stylesheet" href="'.concat(e.options.cdn,`/dist/index.css"/>
|
|||
|
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
|
|||
|
|
<div id="preview" style="width: 800px"></div>
|
|||
|
|
<script>
|
|||
|
|
window.addEventListener("message", (e) => {
|
|||
|
|
if(!e.data) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
Vditor.preview(document.getElementById('preview'), e.data, {
|
|||
|
|
cdn: "`).concat(e.options.cdn,`",
|
|||
|
|
markdown: {
|
|||
|
|
theme: `).concat(JSON.stringify(e.options.preview.theme),`
|
|||
|
|
},
|
|||
|
|
hljs: {
|
|||
|
|
style: "`).concat(e.options.preview.hljs.style,`"
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
setTimeout(() => {
|
|||
|
|
window.print();
|
|||
|
|
}, 3600);
|
|||
|
|
}, false);
|
|||
|
|
<\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(R(e),"*")},200)},ia=function(e){var t=Rn(e),n='<html><head><link rel="stylesheet" type="text/css" href="'.concat(e.options.cdn,`/dist/index.css"/>
|
|||
|
|
<script src="`).concat(e.options.cdn,"/dist/js/i18n/").concat(e.options.lang,`.js"><\/script>
|
|||
|
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script></head>
|
|||
|
|
<body><div class="vditor-reset" id="preview">`).concat(t,`</div>
|
|||
|
|
<script>
|
|||
|
|
const previewElement = document.getElementById('preview')
|
|||
|
|
Vditor.setContentTheme('`).concat(e.options.preview.theme.current,"', '").concat(e.options.preview.theme.path,`');
|
|||
|
|
Vditor.codeRender(previewElement);
|
|||
|
|
Vditor.highlightRender(`).concat(JSON.stringify(e.options.preview.hljs),", previewElement, '").concat(e.options.cdn,`');
|
|||
|
|
Vditor.mathRender(previewElement, {
|
|||
|
|
cdn: '`).concat(e.options.cdn,`',
|
|||
|
|
math: `).concat(JSON.stringify(e.options.preview.math),`,
|
|||
|
|
});
|
|||
|
|
Vditor.mermaidRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|||
|
|
Vditor.SMILESRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|||
|
|
Vditor.markmapRender(previewElement, '`).concat(e.options.cdn,`');
|
|||
|
|
Vditor.flowchartRender(previewElement, '`).concat(e.options.cdn,`');
|
|||
|
|
Vditor.graphvizRender(previewElement, '`).concat(e.options.cdn,`');
|
|||
|
|
Vditor.chartRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|||
|
|
Vditor.mindmapRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|||
|
|
Vditor.abcRender(previewElement, '`).concat(e.options.cdn,`');
|
|||
|
|
`).concat(e.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"",`
|
|||
|
|
Vditor.speechRender(previewElement);
|
|||
|
|
<\/script>
|
|||
|
|
<script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');zn(e,n,t.substr(0,10)+".html")},sa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),oa=(function(e){sa(t,e);function t(n,r){var a=e.call(this,n,r)||this,o=a.element.children[0],l=document.createElement("div");return l.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),l.innerHTML=`<button data-type="markdown">Markdown</button>
|
|||
|
|
<button data-type="pdf">PDF</button>
|
|||
|
|
<button data-type="html">HTML</button>`,l.addEventListener((0,c.Le)(),function(h){var w=h.target;if(w.tagName==="BUTTON"){switch(w.getAttribute("data-type")){case"markdown":ra(n);break;case"pdf":aa(n);break;case"html":ia(n);break;default:break}S(n,["subToolbar"]),h.preventDefault(),h.stopPropagation()}}),a.element.appendChild(l),i(n,l,o,r.level),a}return t})(Ce),ua=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),la=(function(e){ua(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a._bindEvent(n,r),a}return t.prototype._bindEvent=function(n,r){this.element.children[0].addEventListener((0,c.Le)(),function(a){a.preventDefault(),n.element.className.includes("vditor--fullscreen")?(r.level||(this.innerHTML=r.icon),n.element.style.zIndex="",document.body.style.overflow="",n.element.classList.remove("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(o){var l=n.toolbar.elements[o].firstChild;l&&(l.className=l.className.replace("__s","__n"),n.options.toolbar.forEach(function(h){typeof h!="string"&&h.tipPosition&&h.name===l.dataset.type&&(l.className="vditor-tooltipped vditor-tooltipped__".concat(h.tipPosition))}))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__s","__n"))):(r.level||(this.innerHTML='<svg><use xlink:href="#vditor-icon-contract"></use></svg>'),n.element.style.zIndex=n.options.fullscreen.index.toString(),document.body.style.overflow="hidden",n.element.classList.add("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(o){var l=n.toolbar.elements[o].firstChild;l&&(l.className=l.className.replace("__n","__s"))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__n","__s"))),n.devtools&&n.devtools.renderEchart(n),r.click&&r.click(a,n),We(n),_t(n)})},t})(Ce),ca=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),da=(function(e){ca(t,e);function t(n,r){var a=e.call(this,n,r)||this,o=document.createElement("div");return o.className="vditor-hint vditor-panel--arrow",o.innerHTML='<button data-tag="h1" data-value="# ">'.concat(window.VditorI18n.heading1," ").concat((0,c.ns)("<⌥⌘1>"),`</button>
|
|||
|
|
<button data-tag="h2" data-value="## ">`).concat(window.VditorI18n.heading2," <").concat((0,c.ns)("⌥⌘2"),`></button>
|
|||
|
|
<button data-tag="h3" data-value="### ">`).concat(window.VditorI18n.heading3," <").concat((0,c.ns)("⌥⌘3"),`></button>
|
|||
|
|
<button data-tag="h4" data-value="#### ">`).concat(window.VditorI18n.heading4," <").concat((0,c.ns)("⌥⌘4"),`></button>
|
|||
|
|
<button data-tag="h5" data-value="##### ">`).concat(window.VditorI18n.heading5," <").concat((0,c.ns)("⌥⌘5"),`></button>
|
|||
|
|
<button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," <").concat((0,c.ns)("⌥⌘6"),"></button>"),a.element.appendChild(o),a._bindEvent(n,o),a}return t.prototype._bindEvent=function(n,r){var a=this.element.children[0];a.addEventListener((0,c.Le)(),function(l){l.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),!a.classList.contains(M.g.CLASS_MENU_DISABLED)&&(a.blur(),a.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(jt(n),we(n)):n.currentMode==="ir"&&mt(n,""),a.classList.remove("vditor-menu--current")):(S(n,["subToolbar"]),r.style.display="block"))});for(var o=0;o<6;o++)r.children.item(o).addEventListener((0,c.Le)(),function(l){l.preventDefault(),n.currentMode==="wysiwyg"?(kt(n,l.target.getAttribute("data-tag")),we(n),a.classList.add("vditor-menu--current")):n.currentMode==="ir"?(mt(n,l.target.getAttribute("data-value")),a.classList.add("vditor-menu--current")):dn(n,l.target.getAttribute("data-value")),r.style.display="none"})},t})(Ce),fa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),pa=(function(e){fa(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault(),n.tip.show(`<div style="margin-bottom:14px;font-size: 14px;line-height: 22px;min-width:300px;max-width: 360px;display: flex;">
|
|||
|
|
<div style="margin-top: 14px;flex: 1">
|
|||
|
|
<div>Markdown 使用指南</div>
|
|||
|
|
<ul style="list-style: none">
|
|||
|
|
<li><a href="https://ld246.com/article/1583308420519" target="_blank">语法速查手册</a></li>
|
|||
|
|
<li><a href="https://ld246.com/article/1583129520165" target="_blank">基础语法</a></li>
|
|||
|
|
<li><a href="https://ld246.com/article/1583305480675" target="_blank">扩展语法</a></li>
|
|||
|
|
<li><a href="https://ld246.com/article/1582778815353" target="_blank">键盘快捷键</a></li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
<div style="margin-top: 14px;flex: 1">
|
|||
|
|
<div>Vditor 支持</div>
|
|||
|
|
<ul style="list-style: none">
|
|||
|
|
<li><a href="https://github.com/Vanessa219/vditor/issues" target="_blank">Issues</a></li>
|
|||
|
|
<li><a href="https://ld246.com/tag/vditor" target="_blank">官方讨论区</a></li>
|
|||
|
|
<li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>
|
|||
|
|
<li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>
|
|||
|
|
</ul>
|
|||
|
|
</div></div>`,0)}),a}return t})(Ce),ha=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ma=(function(e){ha(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){if(o.preventDefault(),!(a.element.firstElementChild.classList.contains(M.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var l=(0,O.zh)(n),h=(0,s.lG)(l.startContainer,"LI");h&&vn(n,h,l)}}),a}return t})(Ce),ga=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ba=(function(e){ga(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault(),n.tip.show(`<div style="max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;">
|
|||
|
|
<p style="text-align: center;margin: 14px 0">
|
|||
|
|
<em>下一代的 Markdown 编辑器,为未来而构建</em>
|
|||
|
|
</p>
|
|||
|
|
<div style="display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center">
|
|||
|
|
<img src="https://unpkg.com/vditor/dist/images/logo.png" style="margin: 0 auto;height: 68px"/>
|
|||
|
|
<div> </div>
|
|||
|
|
<div style="flex: 1;min-width: 250px">
|
|||
|
|
Vditor 是一款浏览器端的 Markdown 编辑器,支持所见即所得、即时渲染(类似 Typora)和分屏预览模式。
|
|||
|
|
它使用 TypeScript 实现,支持原生 JavaScript 以及 Vue、React、Angular 和 Svelte 等框架。
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div style="display: flex;flex-wrap: wrap;">
|
|||
|
|
<ul style="list-style: none;flex: 1;min-width:148px">
|
|||
|
|
<li>
|
|||
|
|
项目地址:<a href="https://b3log.org/vditor" target="_blank">b3log.org/vditor</a>
|
|||
|
|
</li>
|
|||
|
|
<li>
|
|||
|
|
开源协议:MIT
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
<ul style="list-style: none;margin-right: 18px">
|
|||
|
|
<li>
|
|||
|
|
组件版本:Vditor v`.concat(M.H," / Lute v").concat(Lute.Version,`
|
|||
|
|
</li>
|
|||
|
|
<li>
|
|||
|
|
赞助捐赠:<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
</div>`),0)}),a}return t})(Ce),wa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ya=(function(e){wa(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault(),!(a.element.firstElementChild.classList.contains(M.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&pt(n,"afterend")}),a}return t})(Ce),va=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),_a=(function(e){va(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault(),!(a.element.firstElementChild.classList.contains(M.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&pt(n,"beforebegin")}),a}return t})(Ce),ka=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ea=(function(e){ka(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a.element.children[0].addEventListener((0,c.Le)(),function(o){if(o.preventDefault(),!(a.element.firstElementChild.classList.contains(M.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var l=(0,O.zh)(n),h=(0,s.lG)(l.startContainer,"LI");h&&Kt(n,h,l,h.parentElement)}}),a}return t})(Ce),Sa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ca=(function(e){Sa(t,e);function t(n,r){var a=e.call(this,n,r)||this;return n.options.outline&&a.element.firstElementChild.classList.add("vditor-menu--current"),a.element.children[0].addEventListener((0,c.Le)(),function(o){o.preventDefault();var l=n.toolbar.elements.outline.firstElementChild;l.classList.contains(M.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!a.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),a}return t})(Ce),Ma=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),La=(function(e){Ma(t,e);function t(n,r){var a=e.call(this,n,r)||this;return a._bindEvent(n),a}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,c.Le)(),function(a){a.preventDefault();v
|
|||
|
|
| --- | --- | --- |
|
|||
|
|
| | | |
|
|||
|
|
| | | |`,tipPosition:"n"},{name:"|"},{hotkey:"⌘Z",icon:'<svg><use xlink:href="#vditor-icon-undo"></use></svg>',name:"undo",tipPosition:"nw"},{hotkey:"⌘Y",icon:'<svg><use xlink:href="#vditor-icon-redo"></use></svg>',name:"redo",tipPosition:"nw"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-more"></use></svg>',name:"more",tipPosition:"e"},{hotkey:"⌘'",icon:'<svg><use xlink:href="#vditor-icon-fullscreen"></use></svg>',name:"fullscreen",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-edit"></use></svg>',name:"edit-mode",tipPosition:"nw"},{hotkey:"⌘P",icon:'<svg><use xlink:href="#vditor-icon-both"></use></svg>',name:"both",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-preview"></use></svg>',name:"preview",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',name:"outline",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-theme"></use></svg>',name:"content-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-code-theme"></use></svg>',name:"code-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-bug"></use></svg>',name:"devtools",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-info"></use></svg>',name:"info",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-help"></use></svg>',name:"help",tipPosition:"nw"},{name:"br"}],a=[];return t.forEach(function(o){var l=o;r.forEach(function(h){typeof o=="string"&&h.name===o&&(l=h),typeof o=="object"&&h.name===o.name&&(l=Object.assign({},h,o))}),o.toolbar&&(l.toolbar=n.mergeToolbar(o.toolbar)),a.push(l)}),a},e})(),Va=(function(){function e(t){var n=this;this.composingLock=!1,this.commentIds=[];var r=document.createElement("div");r.className="vditor-wysiwyg",r.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
|
|||
|
|
contenteditable="true" spellcheck="false"></pre>
|
|||
|
|
<div class="vditor-panel vditor-panel--none"></div>
|
|||
|
|
<div class="vditor-panel vditor-panel--none">
|
|||
|
|
<button type="button" aria-label="`).concat(window.VditorI18n.comment,`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
|
|||
|
|
<svg><use xlink:href="#vditor-icon-comment"></use></svg>
|
|||
|
|
</button>
|
|||
|
|
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),It(t,this.element),ln(t,this.element),xt(t,this.element),Vt(t,this.element),Wt(t,this.element),Bt(t,this.element),zt(t,this.element,this.copy),Ut(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var a=Lute.NewNodeID(),o=getSelection().getRangeAt(0),l=o.cloneRange(),h=o.extractContents(),w,p,A=!1,P=!1;h.childNodes.forEach(function(V,Z){var $=!1;if(V.nodeType===3?$=!0:V.classList.contains("vditor-comment")?V.classList.contains("vditor-comment")&&V.setAttribute("data-cmtids",V.getAttribute("data-cmtids")+" "+a):$=!0,$)if(V.nodeType!==3&&V.getAttribute("data-block")==="0"&&Z===0&&l.startOffset>0)V.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(a,'">').concat(V.innerHTML,"</span>"),w=V;else if(V.nodeType!==3&&V.getAttribute("data-block")==="0"&&Z===h.childNodes.length-1&&l.endOffset<l.endContainer.textContent.length)V.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(a,'">').concat(V.innerHTML,"</span>"),p=V;else if(V.nodeType!==3&&V.getAttribute("data-block")==="0")Z===0?A=!0:Z===h.childNodes.length-1&&(P=!0),V.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(a,'">').concat(V.innerHTML,"</span>");else{var F=document.createElement("span");F.classList.add("vditor-comment"),F.setAttribute("data-cmtids",a),V.parentNode.insertBefore(F,V),F.appendChild(V)}});var q=(0,s.F9)(l.startContainer);q&&(w?(q.insertAdjacentHTML("beforeend",w.innerHTML),w.remove()):q.textContent.trim().replace(M.g.ZWSP,"")===""&&A&&q.remove());var W=(0,s.F9)(l.endContainer);W&&(p?(W.insertAdjacentHTML("afterbegin",p.innerHTML),p.remove()):W.textContent.trim().replace(M.g.ZWSP,"")===""&&P&&W.remove()),o.insertNode(h),t.options.comment.add(a,o.toString(),n.getComments(t,!0)),we(t,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),n.hideComment()})}return e.prototype.getComments=function(t,n){var r=this;if(n===void 0&&(n=!1),t.currentMode==="wysiwyg"&&t.options.comment.enable){this.commentIds=[],this.element.querySelectorAll(".vditor-comment").forEach(function(o){r.commentIds=r.commentIds.concat(o.getAttribute("data-cmtids").split(" "))}),this.commentIds=Array.from(new Set(this.commentIds));var a=[];if(n)return this.commentIds.forEach(function(o){a.push({id:o,top:r.element.querySelector('.vditor-comment[data-cmtids="'.concat(o,'"]')).offsetTop})}),a}else return[]},e.prototype.triggerRemoveComment=function(t){var n=function(o,l){var h=new Set(l);return o.filter(function(w){return!h.has(w)})};if(t.currentMode==="wysiwyg"&&t.options.comment.enable&&t.wysiwyg.commentIds.length>0){var r=JSON.parse(JSON.stringify(this.commentIds));this.getComments(t);var a=n(r,this.commentIds);a.length>0&&t.options.comment.remove(a)}},e.prototype.showComment=function(){var t=(0,O.Ny)(this.element);this.selectPopover.setAttribute("style","left:".concat(t.left,"px;display:block;top:").concat(Math.max(-8,t.top-21),"px"))},e.prototype.hideComment=function(){this.selectPopover.setAttribute("style","display:none")},e.prototype.unbindListener=function(){window.removeEventListener("scroll",this.scrollListener)},e.prototype.copy=function(t,n){var r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var a=(0,s.lG)(r.startContainer,"CODE"),o=(0,s.lG)(r.endContainer,"CODE");if(a&&o&&o.isSameNode(a)){var l="";a.parentElement.tagName==="PRE"?l=r.toString():l="`"+r.toString()+"`",t.clipboardData.setData("text/plain",l),t.clipboardData.setData("text/html","");return}var h=(0,s.lG)(r.startContainer,"A"),w=(0,s.lG)(r.endContainer,"A");if(h&&w&&w.isSameNode(h)){var p=h.getAttribute("title")||"";p&&(p=' "'.concat(p,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(h.getAttribute("href")).concat(p,")")),t.clipboardData.setData("text/html","");return}var A=document.createElement("div");A.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(A.innerH
|
|||
|
|
`);w--)if(o.textContent.charAt(w)!==" "&&o.textContent.charAt(w)!==" "){h=!1;break}l===0&&(h=!1);for(var p=!0,w=l-1;w<o.textContent.length;w++)if(o.textContent.charAt(w)!==" "&&o.textContent.charAt(w)!==`
|
|||
|
|
`){p=!1;break}p&&/^#{1,6} $/.test(o.textContent)&&(p=!1);var A=(0,u.W)(getSelection().getRangeAt(0).startContainer);if(A&&A.textContent===""&&(ve(t),A.remove()),h&&o.getAttribute("data-type")!=="code-block"||p||$t(o.innerHTML)||Gt(o.innerHTML)&&o.previousElementSibling){typeof t.options.input=="function"&&t.options.input(R(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&o.previousElementSibling.remove(),St(t,a,r)}}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){var a=r.target;a.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),n.preventInput=!0,getSelection().rangeCount>0&&(0,O.Hc)(getSelection().getRangeAt(0)),we(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?on(t,r.target):mr(r,t);return}var o=(0,s.lG)(r.target,"A");if(o){t.options.link.click?t.options.link.click(o):t.options.link.isOpen&&window.open(o.getAttribute("href")),r.preventDefault();return}var l=(0,O.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&l.collapsed){var h=n.element.lastElementChild.getBoundingClientRect();r.y>h.top+h.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(M.g.ZWSP,"")===""?(l.selectNodeContents(n.element.lastElementChild),l.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(M.g.ZWSP,"<wbr></p>")),(0,O.ib)(n.element,l)))}et(t);var w=(0,s.fb)(r.target,"vditor-wysiwyg__preview");w||(w=(0,s.fb)((0,O.zh)(t).startContainer,"vditor-wysiwyg__preview")),w&&ct(w,t),Pe(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,c.yl)(r))){r.key==="Enter"&&Te(t),(r.key==="Backspace"||r.key==="Delete")&&t.wysiwyg.element.innerHTML!==""&&t.wysiwyg.element.childNodes.length===1&&t.wysiwyg.element.firstElementChild&&t.wysiwyg.element.firstElementChild.tagName==="P"&&t.wysiwyg.element.firstElementChild.childElementCount===0&&(t.wysiwyg.element.textContent===""||t.wysiwyg.element.textContent===`
|
|||
|
|
`)&&(t.wysiwyg.element.innerHTML="");var a=(0,O.zh)(t);if(r.key==="Backspace"&&(0,c.vU)()&&a.startContainer.textContent===`
|
|||
|
|
`&&a.startOffset===1&&(a.startContainer.textContent=""),Nt(t,a),et(t),!(r.key!=="ArrowDown"&&r.key!=="ArrowRight"&&r.key!=="Backspace"&&r.key!=="ArrowLeft"&&r.key!=="ArrowUp")){(r.key==="ArrowLeft"||r.key==="ArrowRight")&&t.hint.render(t);var o=(0,s.fb)(a.startContainer,"vditor-wysiwyg__preview");if(!o&&a.startContainer.nodeType!==3&&a.startOffset>0){var l=a.startContainer;l.classList.contains("vditor-wysiwyg__block")&&(o=l.lastElementChild)}if(o){var h=o.previousElementSibling;if(h.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?ct(o,t):ct(o,t,!1);return}var w=o.previousElementSibling;if(w.tagName==="PRE"&&(w=w.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var l=o.parentElement,p=fr(l);if(p&&p.nodeType!==3){var A=p.querySelector(".vditor-wysiwyg__preview");if(A){ct(A,t);return}}if(p.nodeType===3){for(;p.textContent.length===0&&p.nextSibling;)p=p.nextSibling;a.setStart(p,1)}else a.setStart(p.firstChild,0)}else a.selectNodeContents(w),a.collapse(!1)}}}})},e})(),Wa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(r[o]=a[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Fa=(function(e){Wa(t,e);function t(n,r){var a=e.call(this)||this;if(a.isDestroyed=!1,a.version=M.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return a.showErrorTip("Failed to get element by id: ".concat(n)),a;n=document.getElementById(n)}var o=new Ua(r),l=o.merge();if(l.i18n)window.VditorI18n=l.i18n,a.init(n,l);else if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(l.lang)){var h="vditorI18nScript",w=h+l.lang;document.querySelectorAll('head script[id^="'.concat(h,'"]')).forEach(function(p){p.id!==w&&document.head.removeChild(p)}),(0,N.G)("".concat(l.cdn,"/dist/js/i18n/").concat(l.lang,".js"),w).then(function(){a.init(n,l)}).catch(function(p){a.showErrorTip("GET ".concat(l.cdn,"/dist/js/i18n/").concat(l.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return a}return t.prototype.showErrorTip=function(n){var r=new xn;document.body.appendChild(r.element),r.show(n,0)},t.prototype.updateToolbarConfig=function(n){this.vditor.toolbar.updateConfig(this.vditor,n)},t.prototype.setTheme=function(n,r,a,o){this.vditor.options.theme=n,ke(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,se.Z)(r,o||this.vditor.options.preview.theme.path)),a&&(this.vditor.options.preview.hljs.style=a,(0,Bn.Y)(a,this.vditor.options.cdn))},t.prototype.getValue=function(){return R(this.vditor)},t.prototype.getCurrentMode=function(){return this.vditor.currentMode},t.prototype.focus=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.focus():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.focus():this.vditor.currentMode==="ir"&&this.vditor.ir.element.focus()},t.prototype.blur=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.blur():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.blur():this.vditor.currentMode==="ir"&&this.vditor.ir.element.blur()},t.prototype.disabled=function(){S(this.vditor,["subToolbar","hint","popover"]),m(this.vditor.toolbar.elements,M.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){y(this.vditor.toolbar.elements,M.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","tr
|
|||
|
|
`),T=T.replace(/\r/g,`
|
|||
|
|
`),T=T.replace(/\u00A0/g," "),s.smartIndentationFix&&(T=z(T)),T=`
|
|||
|
|
|
|||
|
|
`+T+`
|
|||
|
|
|
|||
|
|
`,T=E.subParser("detab")(T,s,B),T=T.replace(/^[ \t]+$/mg,""),E.helper.forEach(u,function(K){T=E.subParser("runExtension")(K,T,s,B)}),T=E.subParser("metadata")(T,s,B),T=E.subParser("hashPreCodeTags")(T,s,B),T=E.subParser("githubCodeBlocks")(T,s,B),T=E.subParser("hashHTMLBlocks")(T,s,B),T=E.subParser("hashCodeTags")(T,s,B),T=E.subParser("stripLinkDefinitions")(T,s,B),T=E.subParser("blockGamut")(T,s,B),T=E.subParser("unhashHTMLSpans")(T,s,B),T=E.subParser("unescapeSpecialChars")(T,s,B),T=T.replace(/¨D/g,"$$"),T=T.replace(/¨T/g,"¨"),T=E.subParser("completeHTMLDocument")(T,s,B),E.helper.forEach(f,function(K){T=E.subParser("runExtension")(K,T,s,B)}),k=B.metadata,T},this.makeMarkdown=this.makeMd=function(T,B){if(T=T.replace(/\r\n/g,`
|
|||
|
|
`),T=T.replace(/\r/g,`
|
|||
|
|
`),T=T.replace(/>[ \t]+</,">¨NBSP;<"),!B)if(window&&window.document)B=window.document;else throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");var K=B.createElement("div");K.innerHTML=T;var X={preList:Pe(K)};ve(K);for(var oe=K.childNodes,Q="",O=0;O<oe.length;O++)Q+=E.subParser("makeMarkdown.node")(oe[O],X);function ve(Le){for(var _e=0;_e<Le.childNodes.length;++_e){var U=Le.childNodes[_e];U.nodeType===3?!/\S/.test(U.nodeValue)&&!/^[ ]+$/.test(U.nodeValue)?(Le.removeChild(U),--_e):(U.nodeValue=U.nodeValue.split(`
|
|||
|
|
`).join(" "),U.nodeValue=U.nodeValue.replace(/(\s)+/g,"$1")):U.nodeType===1&&ve(U)}}function Pe(Le){for(var _e=Le.querySelectorAll("pre"),U=[],ue=0;ue<_e.length;++ue)if(_e[ue].childElementCount===1&&_e[ue].firstChild.tagName.toLowerCase()==="code"){var J=_e[ue].firstChild.innerHTML.trim(),G=_e[ue].firstChild.getAttribute("data-language")||"";if(G==="")for(var be=_e[ue].firstChild.className.split(" "),te=0;te<be.length;++te){var Se=be[te].match(/^language-(.+)$/);if(Se!==null){G=Se[1];break}}J=E.helper.unescapeHTMLEntities(J),U.push(J),_e[ue].outerHTML='<precode language="'+G+'" precodenum="'+ue.toString()+'"></precode>'}else U.push(_e[ue].innerHTML),_e[ue].innerHTML="",_e[ue].setAttribute("prenum",ue.toString());return U}return Q},this.setOption=function(T,B){s[T]=B},this.getOption=function(T){return s[T]},this.getOptions=function(){return s},this.addExtension=function(T,B){B=B||null,j(T,B)},this.useExtension=function(T){j(T)},this.setFlavor=function(T){if(!D.hasOwnProperty(T))throw Error(T+" flavor was not found");var B=D[T];g=T;for(var K in B)B.hasOwnProperty(K)&&(s[K]=B[K])},this.getFlavor=function(){return g},this.removeExtension=function(T){E.helper.isArray(T)||(T=[T]);for(var B=0;B<T.length;++B){for(var K=T[B],X=0;X<u.length;++X)u[X]===K&&u.splice(X,1);for(var oe=0;oe<f.length;++oe)f[oe]===K&&f.splice(oe,1)}},this.getAllExtensions=function(){return{language:u,output:f}},this.getMetadata=function(T){return T?k.raw:k.parsed},this.getMetadataFormat=function(){return k.format},this._setMetadataPair=function(T,B){k.parsed[T]=B},this._setMetadataFormat=function(T){k.format=T},this._setMetadataRaw=function(T){k.raw=T}},E.subParser("anchors",function(i,s,u){"use strict";i=u.converter._dispatch("anchors.before",i,s,u);var f=function(v,g,k,H,j,x,I){if(E.helper.isUndefined(I)&&(I=""),k=k.toLowerCase(),v.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)H="";else if(!H)if(k||(k=g.toLowerCase().replace(/ ?\n/g," ")),H="#"+k,!E.helper.isUndefined(u.gUrls[k]))H=u.gUrls[k],E.helper.isUndefined(u.gTitles[k])||(I=u.gTitles[k]);else return v;H=H.replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback);var z='<a href="'+H+'"';return I!==""&&I!==null&&(I=I.replace(/"/g,"""),I=I.replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback),z+=' title="'+I+'"'),s.openLinksInNewWindow&&!/^#/.test(H)&&(z+=' rel="noopener noreferrer" target="¨E95Eblank"'),z+=">"+g+"</a>",z};return i=i.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,f),i=i.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,f),i=i.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,f),i=i.replace(/\[([^\[\]]+)]()()()()()/g,f),s.ghMentions&&(i=i.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi,function(v,g,k,H,j){if(k==="\\")return g+H;if(!E.helper.isString(s.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var x=s.ghMentionsLink.replace(/\{u}/g,j),I="";return s.openLinksInNewWindow&&(I=' rel="noopener noreferrer" target="¨E95Eblank"'),g+'<a href="'+x+'"'+I+">"+H+"</a>"})),i=u.converter._dispatch("anchors.after",i,s,u),i});var c=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,_=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,b=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,y=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,C=function(i){"use strict";return function(s,u,f,v,g,k,H){f=f.replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback);var j=f,x="",I="",z=u||"",T=H||"";return/^www\./i.test(f)&&(f=f.replace(/^www\./i,"http://www.")),i.excludeTrailingPunctuationFromURLs&&k&&(x=k),i.openLinksInNewWindow&&(I=' rel="noopener noreferrer" target="¨E95Eblank"'),z+'<a href="'+f+'"'+I+">"+j+"</a>"+x+T}},L=function(i,
|
|||
|
|
|
|||
|
|
`;var f=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return s.splitAdjacentBlockquotes&&(f=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),i=i.replace(f,function(v){return v=v.replace(/^[ \t]*>[ \t]?/gm,""),v=v.replace(/¨0/g,""),v=v.replace(/^[ \t]+$/gm,""),v=E.subParser("githubCodeBlocks")(v,s,u),v=E.subParser("blockGamut")(v,s,u),v=v.replace(/(^|\n)/g,"$1 "),v=v.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(g,k){var H=k;return H=H.replace(/^ /mg,"¨0"),H=H.replace(/¨0/g,""),H}),E.subParser("hashBlock")(`<blockquote>
|
|||
|
|
`+v+`
|
|||
|
|
</blockquote>`,s,u)}),i=u.converter._dispatch("blockQuotes.after",i,s,u),i}),E.subParser("codeBlocks",function(i,s,u){"use strict";i=u.converter._dispatch("codeBlocks.before",i,s,u),i+="¨0";var f=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;return i=i.replace(f,function(v,g,k){var H=g,j=k,x=`
|
|||
|
|
`;return H=E.subParser("outdent")(H,s,u),H=E.subParser("encodeCode")(H,s,u),H=E.subParser("detab")(H,s,u),H=H.replace(/^\n+/g,""),H=H.replace(/\n+$/g,""),s.omitExtraWLInCodeBlocks&&(x=""),H="<pre><code>"+H+x+"</code></pre>",E.subParser("hashBlock")(H,s,u)+j}),i=i.replace(/¨0/,""),i=u.converter._dispatch("codeBlocks.after",i,s,u),i}),E.subParser("codeSpans",function(i,s,u){"use strict";return i=u.converter._dispatch("codeSpans.before",i,s,u),typeof i=="undefined"&&(i=""),i=i.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(f,v,g,k){var H=k;return H=H.replace(/^([ \t]*)/g,""),H=H.replace(/[ \t]*$/g,""),H=E.subParser("encodeCode")(H,s,u),H=v+"<code>"+H+"</code>",H=E.subParser("hashHTMLSpans")(H,s,u),H}),i=u.converter._dispatch("codeSpans.after",i,s,u),i}),E.subParser("completeHTMLDocument",function(i,s,u){"use strict";if(!s.completeHTMLDocument)return i;i=u.converter._dispatch("completeHTMLDocument.before",i,s,u);var f="html",v=`<!DOCTYPE HTML>
|
|||
|
|
`,g="",k=`<meta charset="utf-8">
|
|||
|
|
`,H="",j="";typeof u.metadata.parsed.doctype!="undefined"&&(v="<!DOCTYPE "+u.metadata.parsed.doctype+`>
|
|||
|
|
`,f=u.metadata.parsed.doctype.toString().toLowerCase(),(f==="html"||f==="html5")&&(k='<meta charset="utf-8">'));for(var x in u.metadata.parsed)if(u.metadata.parsed.hasOwnProperty(x))switch(x.toLowerCase()){case"doctype":break;case"title":g="<title>"+u.metadata.parsed.title+`</title>
|
|||
|
|
`;break;case"charset":f==="html"||f==="html5"?k='<meta charset="'+u.metadata.parsed.charset+`">
|
|||
|
|
`:k='<meta name="charset" content="'+u.metadata.parsed.charset+`">
|
|||
|
|
`;break;case"language":case"lang":H=' lang="'+u.metadata.parsed[x]+'"',j+='<meta name="'+x+'" content="'+u.metadata.parsed[x]+`">
|
|||
|
|
`;break;default:j+='<meta name="'+x+'" content="'+u.metadata.parsed[x]+`">
|
|||
|
|
`}return i=v+"<html"+H+`>
|
|||
|
|
<head>
|
|||
|
|
`+g+k+j+`</head>
|
|||
|
|
<body>
|
|||
|
|
`+i.trim()+`
|
|||
|
|
</body>
|
|||
|
|
</html>`,i=u.converter._dispatch("completeHTMLDocument.after",i,s,u),i}),E.subParser("detab",function(i,s,u){"use strict";return i=u.converter._dispatch("detab.before",i,s,u),i=i.replace(/\t(?=\t)/g," "),i=i.replace(/\t/g,"¨A¨B"),i=i.replace(/¨B(.+?)¨A/g,function(f,v){for(var g=v,k=4-g.length%4,H=0;H<k;H++)g+=" ";return g}),i=i.replace(/¨A/g," "),i=i.replace(/¨B/g,""),i=u.converter._dispatch("detab.after",i,s,u),i}),E.subParser("ellipsis",function(i,s,u){"use strict";return s.ellipsis&&(i=u.converter._dispatch("ellipsis.before",i,s,u),i=i.replace(/\.\.\./g,"…"),i=u.converter._dispatch("ellipsis.after",i,s,u)),i}),E.subParser("emoji",function(i,s,u){"use strict";if(!s.emoji)return i;i=u.converter._dispatch("emoji.before",i,s,u);var f=/:([\S]+?):/g;return i=i.replace(f,function(v,g){return E.helper.emojis.hasOwnProperty(g)?E.helper.emojis[g]:v}),i=u.converter._dispatch("emoji.after",i,s,u),i}),E.subParser("encodeAmpsAndAngles",function(i,s,u){"use strict";return i=u.converter._dispatch("encodeAmpsAndAngles.before",i,s,u),i=i.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),i=i.replace(/<(?![a-z\/?$!])/gi,"<"),i=i.replace(/</g,"<"),i=i.replace(/>/g,">"),i=u.converter._dispatch("encodeAmpsAndAngles.after",i,s,u),i}),E.subParser("encodeBackslashEscapes",function(i,s,u){"use strict";return i=u.converter._dispatch("encodeBackslashEscapes.before",i,s,u),i=i.replace(/\\(\\)/g,E.helper.escapeCharactersCallback),i=i.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g,E.helper.escapeCharactersCallback),i=u.converter._dispatch("encodeBackslashEscapes.after",i,s,u),i}),E.subParser("encodeCode",function(i,s,u){"use strict";return i=u.converter._dispatch("encodeCode.before",i,s,u),i=i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,E.helper.escapeCharactersCallback),i=u.converter._dispatch("encodeCode.after",i,s,u),i}),E.subParser("escapeSpecialCharsWithinTagAttributes",function(i,s,u){"use strict";i=u.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",i,s,u);var f=/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,v=/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;return i=i.replace(f,function(g){return g.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,E.helper.escapeCharactersCallback)}),i=i.replace(v,function(g){return g.replace(/([\\`*_~=|])/g,E.helper.escapeCharactersCallback)}),i=u.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",i,s,u),i}),E.subParser("githubCodeBlocks",function(i,s,u){"use strict";return s.ghCodeBlocks?(i=u.converter._dispatch("githubCodeBlocks.before",i,s,u),i+="¨0",i=i.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(f,v,g,k){var H=s.omitExtraWLInCodeBlocks?"":`
|
|||
|
|
`;return k=E.subParser("encodeCode")(k,s,u),k=E.subParser("detab")(k,s,u),k=k.replace(/^\n+/g,""),k=k.replace(/\n+$/g,""),k="<pre><code"+(g?' class="'+g+" language-"+g+'"':"")+">"+k+H+"</code></pre>",k=E.subParser("hashBlock")(k,s,u),`
|
|||
|
|
|
|||
|
|
¨G`+(u.ghCodeBlocks.push({text:f,codeblock:k})-1)+`G
|
|||
|
|
|
|||
|
|
`}),i=i.replace(/¨0/,""),u.converter._dispatch("githubCodeBlocks.after",i,s,u)):i}),E.subParser("hashBlock",function(i,s,u){"use strict";return i=u.converter._dispatch("hashBlock.before",i,s,u),i=i.replace(/(^\n+|\n+$)/g,""),i=`
|
|||
|
|
|
|||
|
|
¨K`+(u.gHtmlBlocks.push(i)-1)+`K
|
|||
|
|
|
|||
|
|
`,i=u.converter._dispatch("hashBlock.after",i,s,u),i}),E.subParser("hashCodeTags",function(i,s,u){"use strict";i=u.converter._dispatch("hashCodeTags.before",i,s,u);var f=function(v,g,k,H){var j=k+E.subParser("encodeCode")(g,s,u)+H;return"¨C"+(u.gHtmlSpans.push(j)-1)+"C"};return i=E.helper.replaceRecursiveRegExp(i,f,"<code\\b[^>]*>","</code>","gim"),i=u.converter._dispatch("hashCodeTags.after",i,s,u),i}),E.subParser("hashElement",function(i,s,u){"use strict";return function(f,v){var g=v;return g=g.replace(/\n\n/g,`
|
|||
|
|
`),g=g.replace(/^\n/,""),g=g.replace(/\n+$/g,""),g=`
|
|||
|
|
|
|||
|
|
¨K`+(u.gHtmlBlocks.push(g)-1)+`K
|
|||
|
|
|
|||
|
|
`,g}}),E.subParser("hashHTMLBlocks",function(i,s,u){"use strict";i=u.converter._dispatch("hashHTMLBlocks.before",i,s,u);var f=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],v=function(T,B,K,X){var oe=T;return K.search(/\bmarkdown\b/)!==-1&&(oe=K+u.converter.makeHtml(B)+X),`
|
|||
|
|
|
|||
|
|
¨K`+(u.gHtmlBlocks.push(oe)-1)+`K
|
|||
|
|
|
|||
|
|
`};s.backslashEscapesHTMLTags&&(i=i.replace(/\\<(\/?[^>]+?)>/g,function(T,B){return"<"+B+">"}));for(var g=0;g<f.length;++g)for(var k,H=new RegExp("^ {0,3}(<"+f[g]+"\\b[^>]*>)","im"),j="<"+f[g]+"\\b[^>]*>",x="</"+f[g]+">";(k=E.helper.regexIndexOf(i,H))!==-1;){var I=E.helper.splitAtIndex(i,k),z=E.helper.replaceRecursiveRegExp(I[1],v,j,x,"im");if(z===I[1])break;i=I[0].concat(z)}return i=i.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,E.subParser("hashElement")(i,s,u)),i=E.helper.replaceRecursiveRegExp(i,function(T){return`
|
|||
|
|
|
|||
|
|
¨K`+(u.gHtmlBlocks.push(T)-1)+`K
|
|||
|
|
|
|||
|
|
`},"^ {0,3}<!--","-->","gm"),i=i.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,E.subParser("hashElement")(i,s,u)),i=u.converter._dispatch("hashHTMLBlocks.after",i,s,u),i}),E.subParser("hashHTMLSpans",function(i,s,u){"use strict";i=u.converter._dispatch("hashHTMLSpans.before",i,s,u);function f(v){return"¨C"+(u.gHtmlSpans.push(v)-1)+"C"}return i=i.replace(/<[^>]+?\/>/gi,function(v){return f(v)}),i=i.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(v){return f(v)}),i=i.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(v){return f(v)}),i=i.replace(/<[^>]+?>/gi,function(v){return f(v)}),i=u.converter._dispatch("hashHTMLSpans.after",i,s,u),i}),E.subParser("unhashHTMLSpans",function(i,s,u){"use strict";i=u.converter._dispatch("unhashHTMLSpans.before",i,s,u);for(var f=0;f<u.gHtmlSpans.length;++f){for(var v=u.gHtmlSpans[f],g=0;/¨C(\d+)C/.test(v);){var k=RegExp.$1;if(v=v.replace("¨C"+k+"C",u.gHtmlSpans[k]),g===10)break;++g}i=i.replace("¨C"+f+"C",v)}return i=u.converter._dispatch("unhashHTMLSpans.after",i,s,u),i}),E.subParser("hashPreCodeTags",function(i,s,u){"use strict";i=u.converter._dispatch("hashPreCodeTags.before",i,s,u);var f=function(v,g,k,H){var j=k+E.subParser("encodeCode")(g,s,u)+H;return`
|
|||
|
|
|
|||
|
|
¨G`+(u.ghCodeBlocks.push({text:v,codeblock:j})-1)+`G
|
|||
|
|
|
|||
|
|
`};return i=E.helper.replaceRecursiveRegExp(i,f,"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),i=u.converter._dispatch("hashPreCodeTags.after",i,s,u),i}),E.subParser("headers",function(i,s,u){"use strict";i=u.converter._dispatch("headers.before",i,s,u);var f=isNaN(parseInt(s.headerLevelStart))?1:parseInt(s.headerLevelStart),v=s.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,g=s.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;i=i.replace(v,function(j,x){var I=E.subParser("spanGamut")(x,s,u),z=s.noHeaderId?"":' id="'+H(x)+'"',T=f,B="<h"+T+z+">"+I+"</h"+T+">";return E.subParser("hashBlock")(B,s,u)}),i=i.replace(g,function(j,x){var I=E.subParser("spanGamut")(x,s,u),z=s.noHeaderId?"":' id="'+H(x)+'"',T=f+1,B="<h"+T+z+">"+I+"</h"+T+">";return E.subParser("hashBlock")(B,s,u)});var k=s.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;i=i.replace(k,function(j,x,I){var z=I;s.customizedHeaderId&&(z=I.replace(/\s?\{([^{]+?)}\s*$/,""));var T=E.subParser("spanGamut")(z,s,u),B=s.noHeaderId?"":' id="'+H(I)+'"',K=f-1+x.length,X="<h"+K+B+">"+T+"</h"+K+">";return E.subParser("hashBlock")(X,s,u)});function H(j){var x,I;if(s.customizedHeaderId){var z=j.match(/\{([^{]+?)}\s*$/);z&&z[1]&&(j=z[1])}return x=j,E.helper.isString(s.prefixHeaderId)?I=s.prefixHeaderId:s.prefixHeaderId===!0?I="section-":I="",s.rawPrefixHeaderId||(x=I+x),s.ghCompatibleHeaderId?x=x.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():s.rawHeaderId?x=x.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():x=x.replace(/[^\w]/g,"").toLowerCase(),s.rawPrefixHeaderId&&(x=I+x),u.hashLinkCounts[x]?x=x+"-"+u.hashLinkCounts[x]++:u.hashLinkCounts[x]=1,x}return i=u.converter._dispatch("headers.after",i,s,u),i}),E.subParser("horizontalRule",function(i,s,u){"use strict";i=u.converter._dispatch("horizontalRule.before",i,s,u);var f=E.subParser("hashBlock")("<hr />",s,u);return i=i.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,f),i=i.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,f),i=i.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,f),i=u.converter._dispatch("horizontalRule.after",i,s,u),i}),E.subParser("images",function(i,s,u){"use strict";i=u.converter._dispatch("images.before",i,s,u);var f=/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,v=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,g=/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,k=/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,H=/!\[([^\[\]]+)]()()()()()/g;function j(I,z,T,B,K,X,oe,Q){return B=B.replace(/\s/g,""),x(I,z,T,B,K,X,oe,Q)}function x(I,z,T,B,K,X,oe,Q){var O=u.gUrls,ve=u.gTitles,Pe=u.gDimensions;if(T=T.toLowerCase(),Q||(Q=""),I.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)B="";else if(B===""||B===null)if((T===""||T===null)&&(T=z.toLowerCase().replace(/ ?\n/g," ")),B="#"+T,!E.helper.isUndefined(O[T]))B=O[T],E.helper.isUndefined(ve[T])||(Q=ve[T]),E.helper.isUndefined(Pe[T])||(K=Pe[T].width,X=Pe[T].height);else return I;z=z.replace(/"/g,""").replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback),B=B.replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback);var Le='<img src="'+B+'" alt="'+z+'"';return Q&&E.helper.isString(Q)&&(Q=Q.replace(/"/g,""").replace(E.helper.regexes.asteriskDashAndColon,E.helper.escapeCharactersCallback),Le+=' title="'+Q+'"'),K&&X&&(K=K==="*"?"auto":K,X=X==="*"?"auto":X,Le+=' width="'+K+'"',Le+=' height="'+X+'"'),Le+=" />",Le}return i=i.replace(k,x),i=i.replace(g,j),i=i.replace(v,x),i=i.replace(f,x),i=i.replace(H,x),i=u.converter._dispatch("images.after",i,s,u),i}),E.subPars
|
|||
|
|
`),k+="¨0";var j=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,x=/\n[ \t]*\n(?!¨0)/.test(k);return s.disableForced4SpacesIndentedSublists&&(j=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),k=k.replace(j,function(I,z,T,B,K,X,oe){oe=oe&&oe.trim()!=="";var Q=E.subParser("outdent")(K,s,u),O="";return X&&s.tasklists&&(O=' class="task-list-item" style="list-style-type: none;"',Q=Q.replace(/^[ \t]*\[(x|X| )?]/m,function(){var ve='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return oe&&(ve+=" checked"),ve+=">",ve})),Q=Q.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(ve){return"¨A"+ve}),z||Q.search(/\n{2,}/)>-1?(Q=E.subParser("githubCodeBlocks")(Q,s,u),Q=E.subParser("blockGamut")(Q,s,u)):(Q=E.subParser("lists")(Q,s,u),Q=Q.replace(/\n$/,""),Q=E.subParser("hashHTMLBlocks")(Q,s,u),Q=Q.replace(/\n\n+/g,`
|
|||
|
|
|
|||
|
|
`),x?Q=E.subParser("paragraphs")(Q,s,u):Q=E.subParser("spanGamut")(Q,s,u)),Q=Q.replace("¨A",""),Q="<li"+O+">"+Q+`</li>
|
|||
|
|
`,Q}),k=k.replace(/¨0/g,""),u.gListLevel--,H&&(k=k.replace(/\s+$/,"")),k}function v(k,H){if(H==="ol"){var j=k.match(/^ *(\d+)\./);if(j&&j[1]!=="1")return' start="'+j[1]+'"'}return""}function g(k,H,j){var x=s.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,I=s.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,z=H==="ul"?x:I,T="";if(k.search(z)!==-1)(function K(X){var oe=X.search(z),Q=v(k,H);oe!==-1?(T+=`
|
|||
|
|
|
|||
|
|
<`+H+Q+`>
|
|||
|
|
`+f(X.slice(0,oe),!!j)+"</"+H+`>
|
|||
|
|
`,H=H==="ul"?"ol":"ul",z=H==="ul"?x:I,K(X.slice(oe))):T+=`
|
|||
|
|
|
|||
|
|
<`+H+Q+`>
|
|||
|
|
`+f(X,!!j)+"</"+H+`>
|
|||
|
|
`})(k);else{var B=v(k,H);T=`
|
|||
|
|
|
|||
|
|
<`+H+B+`>
|
|||
|
|
`+f(k,!!j)+"</"+H+`>
|
|||
|
|
`}return T}return i=u.converter._dispatch("lists.before",i,s,u),i+="¨0",u.gListLevel?i=i.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(k,H,j){var x=j.search(/[*+-]/g)>-1?"ul":"ol";return g(H,x,!0)}):i=i.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(k,H,j,x){var I=x.search(/[*+-]/g)>-1?"ul":"ol";return g(j,I,!1)}),i=i.replace(/¨0/,""),i=u.converter._dispatch("lists.after",i,s,u),i}),E.subParser("metadata",function(i,s,u){"use strict";if(!s.metadata)return i;i=u.converter._dispatch("metadata.before",i,s,u);function f(v){u.metadata.raw=v,v=v.replace(/&/g,"&").replace(/"/g,"""),v=v.replace(/\n {4}/g," "),v.replace(/^([\S ]+): +([\s\S]+?)$/gm,function(g,k,H){return u.metadata.parsed[k]=H,""})}return i=i.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(v,g,k){return f(k),"¨M"}),i=i.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(v,g,k){return g&&(u.metadata.format=g),f(k),"¨M"}),i=i.replace(/¨M/g,""),i=u.converter._dispatch("metadata.after",i,s,u),i}),E.subParser("outdent",function(i,s,u){"use strict";return i=u.converter._dispatch("outdent.before",i,s,u),i=i.replace(/^(\t|[ ]{1,4})/gm,"¨0"),i=i.replace(/¨0/g,""),i=u.converter._dispatch("outdent.after",i,s,u),i}),E.subParser("paragraphs",function(i,s,u){"use strict";i=u.converter._dispatch("paragraphs.before",i,s,u),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,"");for(var f=i.split(/\n{2,}/g),v=[],g=f.length,k=0;k<g;k++){var H=f[k];H.search(/¨(K|G)(\d+)\1/g)>=0?v.push(H):H.search(/\S/)>=0&&(H=E.subParser("spanGamut")(H,s,u),H=H.replace(/^([ \t]*)/g,"<p>"),H+="</p>",v.push(H))}for(g=v.length,k=0;k<g;k++){for(var j="",x=v[k],I=!1;/¨(K|G)(\d+)\1/.test(x);){var z=RegExp.$1,T=RegExp.$2;z==="K"?j=u.gHtmlBlocks[T]:I?j=E.subParser("encodeCode")(u.ghCodeBlocks[T].text,s,u):j=u.ghCodeBlocks[T].codeblock,j=j.replace(/\$/g,"$$$$"),x=x.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,j),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(x)&&(I=!0)}v[k]=x}return i=v.join(`
|
|||
|
|
`),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),u.converter._dispatch("paragraphs.after",i,s,u)}),E.subParser("runExtension",function(i,s,u,f){"use strict";if(i.filter)s=i.filter(s,f.converter,u);else if(i.regex){var v=i.regex;v instanceof RegExp||(v=new RegExp(v,"g")),s=s.replace(v,i.replace)}return s}),E.subParser("spanGamut",function(i,s,u){"use strict";return i=u.converter._dispatch("spanGamut.before",i,s,u),i=E.subParser("codeSpans")(i,s,u),i=E.subParser("escapeSpecialCharsWithinTagAttributes")(i,s,u),i=E.subParser("encodeBackslashEscapes")(i,s,u),i=E.subParser("images")(i,s,u),i=E.subParser("anchors")(i,s,u),i=E.subParser("autoLinks")(i,s,u),i=E.subParser("simplifiedAutoLinks")(i,s,u),i=E.subParser("emoji")(i,s,u),i=E.subParser("underline")(i,s,u),i=E.subParser("italicsAndBold")(i,s,u),i=E.subParser("strikethrough")(i,s,u),i=E.subParser("ellipsis")(i,s,u),i=E.subParser("hashHTMLSpans")(i,s,u),i=E.subParser("encodeAmpsAndAngles")(i,s,u),s.simpleLineBreaks?/\n\n¨K/.test(i)||(i=i.replace(/\n+/g,`<br />
|
|||
|
|
`)):i=i.replace(/ +\n/g,`<br />
|
|||
|
|
`),i=u.converter._dispatch("spanGamut.after",i,s,u),i}),E.subParser("strikethrough",function(i,s,u){"use strict";function f(v){return s.simplifiedAutoLink&&(v=E.subParser("simplifiedAutoLinks")(v,s,u)),"<del>"+v+"</del>"}return s.strikethrough&&(i=u.converter._dispatch("strikethrough.before",i,s,u),i=i.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(v,g){return f(g)}),i=u.converter._dispatch("strikethrough.after",i,s,u)),i}),E.subParser("stripLinkDefinitions",function(i,s,u){"use strict";var f=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,v=/^ {0,3}\[([^\]]+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;i+="¨0";var g=function(k,H,j,x,I,z,T){return H=H.toLowerCase(),i.toLowerCase().split(H).length-1<2?k:(j.match(/^data:.+?\/.+?;base64,/)?u.gUrls[H]=j.replace(/\s/g,""):u.gUrls[H]=E.subParser("encodeAmpsAndAngles")(j,s,u),z?z+T:(T&&(u.gTitles[H]=T.replace(/"|'/g,""")),s.parseImgDimensions&&x&&I&&(u.gDimensions[H]={width:x,height:I}),""))};return i=i.replace(v,g),i=i.replace(f,g),i=i.replace(/¨0/,""),i}),E.subParser("tables",function(i,s,u){"use strict";if(!s.tables)return i;var f=/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,v=/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;function g(I){return/^:[ \t]*--*$/.test(I)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(I)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(I)?' style="text-align:center;"':""}function k(I,z){var T="";return I=I.trim(),(s.tablesHeaderId||s.tableHeaderId)&&(T=' id="'+I.replace(/ /g,"_").toLowerCase()+'"'),I=E.subParser("spanGamut")(I,s,u),"<th"+T+z+">"+I+`</th>
|
|||
|
|
`}function H(I,z){var T=E.subParser("spanGamut")(I,s,u);return"<td"+z+">"+T+`</td>
|
|||
|
|
`}function j(I,z){for(var T=`<table>
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
`,B=I.length,K=0;K<B;++K)T+=I[K];for(T+=`</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
`,K=0;K<z.length;++K){T+=`<tr>
|
|||
|
|
`;for(var X=0;X<B;++X)T+=z[K][X];T+=`</tr>
|
|||
|
|
`}return T+=`</tbody>
|
|||
|
|
</table>
|
|||
|
|
`,T}function x(I){var z,T=I.split(`
|
|||
|
|
`);for(z=0;z<T.length;++z)/^ {0,3}\|/.test(T[z])&&(T[z]=T[z].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(T[z])&&(T[z]=T[z].replace(/\|[ \t]*$/,"")),T[z]=E.subParser("codeSpans")(T[z],s,u);var B=T[0].split("|").map(function(Le){return Le.trim()}),K=T[1].split("|").map(function(Le){return Le.trim()}),X=[],oe=[],Q=[],O=[];for(T.shift(),T.shift(),z=0;z<T.length;++z)T[z].trim()!==""&&X.push(T[z].split("|").map(function(Le){return Le.trim()}));if(B.length<K.length)return I;for(z=0;z<K.length;++z)Q.push(g(K[z]));for(z=0;z<B.length;++z)E.helper.isUndefined(Q[z])&&(Q[z]=""),oe.push(k(B[z],Q[z]));for(z=0;z<X.length;++z){for(var ve=[],Pe=0;Pe<oe.length;++Pe)E.helper.isUndefined(X[z][Pe]),ve.push(H(X[z][Pe],Q[Pe]));O.push(ve)}return j(oe,O)}return i=u.converter._dispatch("tables.before",i,s,u),i=i.replace(/\\(\|)/g,E.helper.escapeCharactersCallback),i=i.replace(f,x),i=i.replace(v,x),i=u.converter._dispatch("tables.after",i,s,u),i}),E.subParser("underline",function(i,s,u){"use strict";return s.underline&&(i=u.converter._dispatch("underline.before",i,s,u),s.literalMidWordUnderscores?(i=i.replace(/\b___(\S[\s\S]*?)___\b/g,function(f,v){return"<u>"+v+"</u>"}),i=i.replace(/\b__(\S[\s\S]*?)__\b/g,function(f,v){return"<u>"+v+"</u>"})):(i=i.replace(/___(\S[\s\S]*?)___/g,function(f,v){return/\S$/.test(v)?"<u>"+v+"</u>":f}),i=i.replace(/__(\S[\s\S]*?)__/g,function(f,v){return/\S$/.test(v)?"<u>"+v+"</u>":f})),i=i.replace(/(_)/g,E.helper.escapeCharactersCallback),i=u.converter._dispatch("underline.after",i,s,u)),i}),E.subParser("unescapeSpecialChars",function(i,s,u){"use strict";return i=u.converter._dispatch("unescapeSpecialChars.before",i,s,u),i=i.replace(/¨E(\d+)E/g,function(f,v){var g=parseInt(v);return String.fromCharCode(g)}),i=u.converter._dispatch("unescapeSpecialChars.after",i,s,u),i}),E.subParser("makeMarkdown.blockquote",function(i,s){"use strict";var u="";if(i.hasChildNodes())for(var f=i.childNodes,v=f.length,g=0;g<v;++g){var k=E.subParser("makeMarkdown.node")(f[g],s);k!==""&&(u+=k)}return u=u.trim(),u="> "+u.split(`
|
|||
|
|
`).join(`
|
|||
|
|
> `),u}),E.subParser("makeMarkdown.codeBlock",function(i,s){"use strict";var u=i.getAttribute("language"),f=i.getAttribute("precodenum");return"```"+u+`
|
|||
|
|
`+s.preList[f]+"\n```"}),E.subParser("makeMarkdown.codeSpan",function(i){"use strict";return"`"+i.innerHTML+"`"}),E.subParser("makeMarkdown.emphasis",function(i,s){"use strict";var u="";if(i.hasChildNodes()){u+="*";for(var f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);u+="*"}return u}),E.subParser("makeMarkdown.header",function(i,s,u){"use strict";var f=new Array(u+1).join("#"),v="";if(i.hasChildNodes()){v=f+" ";for(var g=i.childNodes,k=g.length,H=0;H<k;++H)v+=E.subParser("makeMarkdown.node")(g[H],s)}return v}),E.subParser("makeMarkdown.hr",function(){"use strict";return"---"}),E.subParser("makeMarkdown.image",function(i){"use strict";var s="";return i.hasAttribute("src")&&(s+="+">",i.hasAttribute("width")&&i.hasAttribute("height")&&(s+=" ="+i.getAttribute("width")+"x"+i.getAttribute("height")),i.hasAttribute("title")&&(s+=' "'+i.getAttribute("title")+'"'),s+=")"),s}),E.subParser("makeMarkdown.links",function(i,s){"use strict";var u="";if(i.hasChildNodes()&&i.hasAttribute("href")){var f=i.childNodes,v=f.length;u="[";for(var g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);u+="](",u+="<"+i.getAttribute("href")+">",i.hasAttribute("title")&&(u+=' "'+i.getAttribute("title")+'"'),u+=")"}return u}),E.subParser("makeMarkdown.list",function(i,s,u){"use strict";var f="";if(!i.hasChildNodes())return"";for(var v=i.childNodes,g=v.length,k=i.getAttribute("start")||1,H=0;H<g;++H)if(!(typeof v[H].tagName=="undefined"||v[H].tagName.toLowerCase()!=="li")){var j="";u==="ol"?j=k.toString()+". ":j="- ",f+=j+E.subParser("makeMarkdown.listItem")(v[H],s),++k}return f+=`
|
|||
|
|
<!-- -->
|
|||
|
|
`,f.trim()}),E.subParser("makeMarkdown.listItem",function(i,s){"use strict";for(var u="",f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);return/\n$/.test(u)?u=u.split(`
|
|||
|
|
`).join(`
|
|||
|
|
`).replace(/^ {4}$/gm,"").replace(/\n\n+/g,`
|
|||
|
|
|
|||
|
|
`):u+=`
|
|||
|
|
`,u}),E.subParser("makeMarkdown.node",function(i,s,u){"use strict";u=u||!1;var f="";if(i.nodeType===3)return E.subParser("makeMarkdown.txt")(i,s);if(i.nodeType===8)return"<!--"+i.data+`-->
|
|||
|
|
|
|||
|
|
`;if(i.nodeType!==1)return"";var v=i.tagName.toLowerCase();switch(v){case"h1":u||(f=E.subParser("makeMarkdown.header")(i,s,1)+`
|
|||
|
|
|
|||
|
|
`);break;case"h2":u||(f=E.subParser("makeMarkdown.header")(i,s,2)+`
|
|||
|
|
|
|||
|
|
`);break;case"h3":u||(f=E.subParser("makeMarkdown.header")(i,s,3)+`
|
|||
|
|
|
|||
|
|
`);break;case"h4":u||(f=E.subParser("makeMarkdown.header")(i,s,4)+`
|
|||
|
|
|
|||
|
|
`);break;case"h5":u||(f=E.subParser("makeMarkdown.header")(i,s,5)+`
|
|||
|
|
|
|||
|
|
`);break;case"h6":u||(f=E.subParser("makeMarkdown.header")(i,s,6)+`
|
|||
|
|
|
|||
|
|
`);break;case"p":u||(f=E.subParser("makeMarkdown.paragraph")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"blockquote":u||(f=E.subParser("makeMarkdown.blockquote")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"hr":u||(f=E.subParser("makeMarkdown.hr")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"ol":u||(f=E.subParser("makeMarkdown.list")(i,s,"ol")+`
|
|||
|
|
|
|||
|
|
`);break;case"ul":u||(f=E.subParser("makeMarkdown.list")(i,s,"ul")+`
|
|||
|
|
|
|||
|
|
`);break;case"precode":u||(f=E.subParser("makeMarkdown.codeBlock")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"pre":u||(f=E.subParser("makeMarkdown.pre")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"table":u||(f=E.subParser("makeMarkdown.table")(i,s)+`
|
|||
|
|
|
|||
|
|
`);break;case"code":f=E.subParser("makeMarkdown.codeSpan")(i,s);break;case"em":case"i":f=E.subParser("makeMarkdown.emphasis")(i,s);break;case"strong":case"b":f=E.subParser("makeMarkdown.strong")(i,s);break;case"del":f=E.subParser("makeMarkdown.strikethrough")(i,s);break;case"a":f=E.subParser("makeMarkdown.links")(i,s);break;case"img":f=E.subParser("makeMarkdown.image")(i,s);break;default:f=i.outerHTML+`
|
|||
|
|
|
|||
|
|
`}return f}),E.subParser("makeMarkdown.paragraph",function(i,s){"use strict";var u="";if(i.hasChildNodes())for(var f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);return u=u.trim(),u}),E.subParser("makeMarkdown.pre",function(i,s){"use strict";var u=i.getAttribute("prenum");return"<pre>"+s.preList[u]+"</pre>"}),E.subParser("makeMarkdown.strikethrough",function(i,s){"use strict";var u="";if(i.hasChildNodes()){u+="~~";for(var f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);u+="~~"}return u}),E.subParser("makeMarkdown.strong",function(i,s){"use strict";var u="";if(i.hasChildNodes()){u+="**";for(var f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s);u+="**"}return u}),E.subParser("makeMarkdown.table",function(i,s){"use strict";var u="",f=[[],[]],v=i.querySelectorAll("thead>tr>th"),g=i.querySelectorAll("tbody>tr"),k,H;for(k=0;k<v.length;++k){var j=E.subParser("makeMarkdown.tableCell")(v[k],s),x="---";if(v[k].hasAttribute("style")){var I=v[k].getAttribute("style").toLowerCase().replace(/\s/g,"");switch(I){case"text-align:left;":x=":---";break;case"text-align:right;":x="---:";break;case"text-align:center;":x=":---:";break}}f[0][k]=j.trim(),f[1][k]=x}for(k=0;k<g.length;++k){var z=f.push([])-1,T=g[k].getElementsByTagName("td");for(H=0;H<v.length;++H){var B=" ";typeof T[H]!="undefined"&&(B=E.subParser("makeMarkdown.tableCell")(T[H],s)),f[z].push(B)}}var K=3;for(k=0;k<f.length;++k)for(H=0;H<f[k].length;++H){var X=f[k][H].length;X>K&&(K=X)}for(k=0;k<f.length;++k){for(H=0;H<f[k].length;++H)k===1?f[k][H].slice(-1)===":"?f[k][H]=E.helper.padEnd(f[k][H].slice(-1),K-1,"-")+":":f[k][H]=E.helper.padEnd(f[k][H],K,"-"):f[k][H]=E.helper.padEnd(f[k][H],K);u+="| "+f[k].join(" | ")+` |
|
|||
|
|
`}return u.trim()}),E.subParser("makeMarkdown.tableCell",function(i,s){"use strict";var u="";if(!i.hasChildNodes())return"";for(var f=i.childNodes,v=f.length,g=0;g<v;++g)u+=E.subParser("makeMarkdown.node")(f[g],s,!0);return u.trim()}),E.subParser("makeMarkdown.txt",function(i){"use strict";var s=i.nodeValue;return s=s.replace(/ +/g," "),s=s.replace(/¨NBSP;/g," "),s=E.helper.unescapeHTMLEntities(s),s=s.replace(/([*_~|`])/g,"\\$1"),s=s.replace(/^(\s*)>/g,"\\$1>"),s=s.replace(/^#/gm,"\\#"),s=s.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),s=s.replace(/^( {0,3}\d+)\./gm,"$1\\."),s=s.replace(/^( {0,3})([+-])/gm,"$1\\$2"),s=s.replace(/]([\s]*)\(/g,"\\]$1\\("),s=s.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:"),s});var S=this;Ee.exports?Ee.exports=E:S.showdown=E}).call(gi)})(Pt)),Pt.exports}var wi=bi();const yi=ur(wi),vi=["innerHTML"],_i=ar({__name:"MarkdownViewer",props:{value:{type:String},class:{type:String}},setup(Ee){const me=new yi.Converter;me.setOption("tables",!0),me.setOption("emoji",!0);const ge=Ee,E=ir(()=>me.makeHtml(ge.value||"")),ae=yt(!1),{getDarkMode:Me}=tr();return tn(()=>Me.value,ee=>{ae.value=ee===ni.DARK},{immediate:!0}),(ee,M)=>(or(),sr("div",{class:Qn(["preview",[{preview_dark:ae.value}]])},[si("div",{innerHTML:E.value,class:Qn([ee.$props.class,"markdown-viewer vditor-reset"])},null,10,vi)],2))}}),ki=nr(_i,[["__scopeId","data-v-48d9037f"]]),Ai=rr(mi),Hi=rr(ki);export{Ai as M,Hi as a};
|