@dcodegroup-au/dsg-vue 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dsg-vue.editor.cjs +43 -42
- package/dist/dsg-vue.editor.esm.js +490 -472
- package/package.json +1 -1
package/dist/dsg-vue.editor.cjs
CHANGED
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
*/var Ti=Tt.exports,Un;function _i(){return Un||(Un=1,(function(
|
|
27
|
-
`,s),C==-1&&(C=b.length-1);var D=b.substring(s,C+1);(p.hasOwnProperty?p.hasOwnProperty(D):p[D]!==void 0)?g+=String.fromCharCode(p[D]):(_==d&&(D=b.substring(s),C=b.length),g+=String.fromCharCode(_),p[D]=_,y[_++]=D),s=C+1}return g}var d=4e4,v=m(c);d=65535;var w=m(l);return{chars1:v,chars2:w,lineArray:y}},E.prototype.diff_charsToLines_=function(c,l){for(var y=0;y<c.length;y++){for(var p=c[y][1],m=[],d=0;d<p.length;d++)m[d]=l[p.charCodeAt(d)];c[y][1]=m.join("")}},E.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(d,m)==l.substring(d,m)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(c.length-m,c.length-d)==l.substring(l.length-m,l.length-d)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonOverlap_=function(c,l){var y=c.length,p=l.length;if(y==0||p==0)return 0;y>p?c=c.substring(y-p):y<p&&(l=l.substring(0,y));var m=Math.min(y,p);if(c==l)return m;for(var d=0,v=1;;){var w=c.substring(m-v),b=l.indexOf(w);if(b==-1)return d;v+=b,(b==0||c.substring(m-v)==l.substring(0,v))&&(d=v,v++)}},E.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var y=c.length>l.length?c:l,p=c.length>l.length?l:c;if(y.length<4||p.length*2<y.length)return null;var m=this;function d(M,P,F){for(var z=M.substring(F,F+Math.floor(M.length/4)),$=-1,ne="",oe,ge,de,le;($=P.indexOf(z,$+1))!=-1;){var ve=m.diff_commonPrefix(M.substring(F),P.substring($)),_e=m.diff_commonSuffix(M.substring(0,F),P.substring(0,$));ne.length<_e+ve&&(ne=P.substring($-_e,$)+P.substring($,$+ve),oe=M.substring(0,F-_e),ge=M.substring(F+ve),de=P.substring(0,$-_e),le=P.substring($+ve))}return ne.length*2>=M.length?[oe,ge,de,le,ne]:null}var v=d(y,p,Math.ceil(y.length/4)),w=d(y,p,Math.ceil(y.length/2)),b;if(!v&&!w)return null;w?v?b=v[4].length>w[4].length?v:w:b=w:b=v;var g,s,C,_;c.length>l.length?(g=b[0],s=b[1],C=b[2],_=b[3]):(C=b[0],_=b[1],g=b[2],s=b[3]);var D=b[4];return[g,s,C,_,D]},E.prototype.diff_cleanupSemantic=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=0,w=0,b=0,g=0;d<c.length;)c[d][0]==A?(y[p++]=d,v=b,w=g,b=0,g=0,m=c[d][1]):(c[d][0]==x?b+=c[d][1].length:g+=c[d][1].length,m&&m.length<=Math.max(v,w)&&m.length<=Math.max(b,g)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,p--,d=p>0?y[p-1]:-1,v=0,w=0,b=0,g=0,m=null,l=!0)),d++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),d=1;d<c.length;){if(c[d-1][0]==L&&c[d][0]==x){var s=c[d-1][1],C=c[d][1],_=this.diff_commonOverlap_(s,C),D=this.diff_commonOverlap_(C,s);_>=D?(_>=s.length/2||_>=C.length/2)&&(c.splice(d,0,new E.Diff(A,C.substring(0,_))),c[d-1][1]=s.substring(0,s.length-_),c[d+1][1]=C.substring(_),d++):(D>=s.length/2||D>=C.length/2)&&(c.splice(d,0,new E.Diff(A,s.substring(0,D))),c[d-1][0]=x,c[d-1][1]=C.substring(0,C.length-D),c[d+1][0]=L,c[d+1][1]=s.substring(D),d++),d++}d++}},E.prototype.diff_cleanupSemanticLossless=function(c){function l(D,M){if(!D||!M)return 6;var P=D.charAt(D.length-1),F=M.charAt(0),z=P.match(E.nonAlphaNumericRegex_),$=F.match(E.nonAlphaNumericRegex_),ne=z&&P.match(E.whitespaceRegex_),oe=$&&F.match(E.whitespaceRegex_),ge=ne&&P.match(E.linebreakRegex_),de=oe&&F.match(E.linebreakRegex_),le=ge&&D.match(E.blanklineEndRegex_),ve=de&&M.match(E.blanklineStartRegex_);return le||ve?5:ge||de?4:z&&!ne&&oe?3:ne||oe?2:z||$?1:0}for(var y=1;y<c.length-1;){if(c[y-1][0]==A&&c[y+1][0]==A){var p=c[y-1][1],m=c[y][1],d=c[y+1][1],v=this.diff_commonSuffix(p,m);if(v){var w=m.substring(m.length-v);p=p.substring(0,p.length-v),m=w+m.substring(0,m.length-v),d=w+d}for(var b=p,g=m,s=d,C=l(p,m)+l(m,d);m.charAt(0)===d.charAt(0);){p+=m.charAt(0),m=m.substring(1)+d.charAt(0),d=d.substring(1);var _=l(p,m)+l(m,d);_>=C&&(C=_,b=p,g=m,s=d)}c[y-1][1]!=b&&(b?c[y-1][1]=b:(c.splice(y-1,1),y--),c[y][1]=g,s?c[y+1][1]=s:(c.splice(y+1,1),y--))}y++}},E.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,E.whitespaceRegex_=/\s/,E.linebreakRegex_=/[\r\n]/,E.blanklineEndRegex_=/\n\r?\n$/,E.blanklineStartRegex_=/^\r?\n\r?\n/,E.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=!1,w=!1,b=!1,g=!1;d<c.length;)c[d][0]==A?(c[d][1].length<this.Diff_EditCost&&(b||g)?(y[p++]=d,v=b,w=g,m=c[d][1]):(p=0,m=null),b=g=!1):(c[d][0]==L?g=!0:b=!0,m&&(v&&w&&b&&g||m.length<this.Diff_EditCost/2&&v+w+b+g==3)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,m=null,v&&w?(b=g=!0,p=0):(p--,d=p>0?y[p-1]:-1,b=g=!1),l=!0)),d++;l&&this.diff_cleanupMerge(c)},E.prototype.diff_cleanupMerge=function(c){c.push(new E.Diff(A,""));for(var l=0,y=0,p=0,m="",d="",v;l<c.length;)switch(c[l][0]){case x:p++,d+=c[l][1],l++;break;case L:y++,m+=c[l][1],l++;break;case A:y+p>1?(y!==0&&p!==0&&(v=this.diff_commonPrefix(d,m),v!==0&&(l-y-p>0&&c[l-y-p-1][0]==A?c[l-y-p-1][1]+=d.substring(0,v):(c.splice(0,0,new E.Diff(A,d.substring(0,v))),l++),d=d.substring(v),m=m.substring(v)),v=this.diff_commonSuffix(d,m),v!==0&&(c[l][1]=d.substring(d.length-v)+c[l][1],d=d.substring(0,d.length-v),m=m.substring(0,m.length-v))),l-=y+p,c.splice(l,y+p),m.length&&(c.splice(l,0,new E.Diff(L,m)),l++),d.length&&(c.splice(l,0,new E.Diff(x,d)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,y=0,m="",d="";break}c[c.length-1][1]===""&&c.pop();var w=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),w=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),w=!0)),l++;w&&this.diff_cleanupMerge(c)},E.prototype.diff_xIndex=function(c,l){var y=0,p=0,m=0,d=0,v;for(v=0;v<c.length&&(c[v][0]!==x&&(y+=c[v][1].length),c[v][0]!==L&&(p+=c[v][1].length),!(y>l));v++)m=y,d=p;return c.length!=v&&c[v][0]===L?d:d+(l-m)},E.prototype.diff_prettyHtml=function(c){for(var l=[],y=/&/g,p=/</g,m=/>/g,d=/\n/g,v=0;v<c.length;v++){var w=c[v][0],b=c[v][1],g=b.replace(y,"&").replace(p,"<").replace(m,">").replace(d,"¶<br>");switch(w){case x:l[v]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case L:l[v]='<del style="background:#ffe6e6;">'+g+"</del>";break;case A:l[v]="<span>"+g+"</span>";break}}return l.join("")},E.prototype.diff_text1=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==x&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_text2=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==L&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_levenshtein=function(c){for(var l=0,y=0,p=0,m=0;m<c.length;m++){var d=c[m][0],v=c[m][1];switch(d){case x:y+=v.length;break;case L:p+=v.length;break;case A:l+=Math.max(y,p),y=0,p=0;break}}return l+=Math.max(y,p),l},E.prototype.diff_toDelta=function(c){for(var l=[],y=0;y<c.length;y++)switch(c[y][0]){case x:l[y]="+"+encodeURI(c[y][1]);break;case L:l[y]="-"+c[y][1].length;break;case A:l[y]="="+c[y][1].length;break}return l.join(" ").replace(/%20/g," ")},E.prototype.diff_fromDelta=function(c,l){for(var y=[],p=0,m=0,d=l.split(/\t/g),v=0;v<d.length;v++){var w=d[v].substring(1);switch(d[v].charAt(0)){case"+":try{y[p++]=new E.Diff(x,decodeURI(w))}catch{throw new Error("Illegal escape in diff_fromDelta: "+w)}break;case"-":case"=":var b=parseInt(w,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+w);var g=c.substring(m,m+=b);d[v].charAt(0)=="="?y[p++]=new E.Diff(A,g):y[p++]=new E.Diff(L,g);break;default:if(d[v])throw new Error("Invalid diff operation in diff_fromDelta: "+d[v])}}if(m!=c.length)throw new Error("Delta length ("+m+") does not equal source text length ("+c.length+").");return y},E.prototype.match_main=function(c,l,y){if(c==null||l==null||y==null)throw new Error("Null input. (match_main)");return y=Math.max(0,Math.min(y,c.length)),c==l?0:c.length?c.substring(y,y+l.length)==l?y:this.match_bitap_(c,l,y):-1},E.prototype.match_bitap_=function(c,l,y){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),m=this;function d(oe,ge){var de=oe/l.length,le=Math.abs(y-ge);return m.Match_Distance?de+le/m.Match_Distance:le?1:de}var v=this.Match_Threshold,w=c.indexOf(l,y);w!=-1&&(v=Math.min(d(0,w),v),w=c.lastIndexOf(l,y+l.length),w!=-1&&(v=Math.min(d(0,w),v)));var b=1<<l.length-1;w=-1;for(var g,s,C=l.length+c.length,_,D=0;D<l.length;D++){for(g=0,s=C;g<s;)d(D,y+s)<=v?g=s:C=s,s=Math.floor((C-g)/2+g);C=s;var M=Math.max(1,y-s+1),P=Math.min(y+s,c.length)+l.length,F=Array(P+2);F[P+1]=(1<<D)-1;for(var z=P;z>=M;z--){var $=p[c.charAt(z-1)];if(D===0?F[z]=(F[z+1]<<1|1)&$:F[z]=(F[z+1]<<1|1)&$|((_[z+1]|_[z])<<1|1)|_[z+1],F[z]&b){var ne=d(D,z-1);if(ne<=v)if(v=ne,w=z-1,w>y)M=Math.max(1,2*y-w);else break}}if(d(D+1,y)>v)break;_=F}return w},E.prototype.match_alphabet_=function(c){for(var l={},y=0;y<c.length;y++)l[c.charAt(y)]=0;for(var y=0;y<c.length;y++)l[c.charAt(y)]|=1<<c.length-y-1;return l},E.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var y=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(y)!=l.lastIndexOf(y)&&y.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,y=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var m=l.substring(c.start2-p,c.start2);m&&c.diffs.unshift(new E.Diff(A,m));var d=l.substring(c.start2+c.length1,c.start2+c.length1+p);d&&c.diffs.push(new E.Diff(A,d)),c.start1-=m.length,c.start2-=m.length,c.length1+=m.length+d.length,c.length2+=m.length+d.length}},E.prototype.patch_make=function(c,l,y){var p,m;if(typeof c=="string"&&typeof l=="string"&&typeof y>"u")p=c,m=this.diff_main(p,l,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof y>"u")m=c,p=this.diff_text1(m);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof y>"u")p=c,m=l;else if(typeof c=="string"&&typeof l=="string"&&y&&typeof y=="object")p=c,m=y;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var d=[],v=new E.patch_obj,w=0,b=0,g=0,s=p,C=p,_=0;_<m.length;_++){var D=m[_][0],M=m[_][1];switch(!w&&D!==A&&(v.start1=b,v.start2=g),D){case x:v.diffs[w++]=m[_],v.length2+=M.length,C=C.substring(0,g)+M+C.substring(g);break;case L:v.length1+=M.length,v.diffs[w++]=m[_],C=C.substring(0,g)+C.substring(g+M.length);break;case A:M.length<=2*this.Patch_Margin&&w&&m.length!=_+1?(v.diffs[w++]=m[_],v.length1+=M.length,v.length2+=M.length):M.length>=2*this.Patch_Margin&&w&&(this.patch_addContext_(v,s),d.push(v),v=new E.patch_obj,w=0,s=C,b=g);break}D!==x&&(b+=M.length),D!==L&&(g+=M.length)}return w&&(this.patch_addContext_(v,s),d.push(v)),d},E.prototype.patch_deepCopy=function(c){for(var l=[],y=0;y<c.length;y++){var p=c[y],m=new E.patch_obj;m.diffs=[];for(var d=0;d<p.diffs.length;d++)m.diffs[d]=new E.Diff(p.diffs[d][0],p.diffs[d][1]);m.start1=p.start1,m.start2=p.start2,m.length1=p.length1,m.length2=p.length2,l[y]=m}return l},E.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var y=this.patch_addPadding(c);l=y+l+y,this.patch_splitMax(c);for(var p=0,m=[],d=0;d<c.length;d++){var v=c[d].start2+p,w=this.diff_text1(c[d].diffs),b,g=-1;if(w.length>this.Match_MaxBits?(b=this.match_main(l,w.substring(0,this.Match_MaxBits),v),b!=-1&&(g=this.match_main(l,w.substring(w.length-this.Match_MaxBits),v+w.length-this.Match_MaxBits),(g==-1||b>=g)&&(b=-1))):b=this.match_main(l,w,v),b==-1)m[d]=!1,p-=c[d].length2-c[d].length1;else{m[d]=!0,p=b-v;var s;if(g==-1?s=l.substring(b,b+w.length):s=l.substring(b,g+this.Match_MaxBits),w==s)l=l.substring(0,b)+this.diff_text2(c[d].diffs)+l.substring(b+w.length);else{var C=this.diff_main(w,s,!1);if(w.length>this.Match_MaxBits&&this.diff_levenshtein(C)/w.length>this.Patch_DeleteThreshold)m[d]=!1;else{this.diff_cleanupSemanticLossless(C);for(var _=0,D,M=0;M<c[d].diffs.length;M++){var P=c[d].diffs[M];P[0]!==A&&(D=this.diff_xIndex(C,_)),P[0]===x?l=l.substring(0,b+D)+P[1]+l.substring(b+D):P[0]===L&&(l=l.substring(0,b+D)+l.substring(b+this.diff_xIndex(C,_+P[1].length))),P[0]!==L&&(_+=P[1].length)}}}}}return l=l.substring(y.length,l.length-y.length),[l,m]},E.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,y="",p=1;p<=l;p++)y+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var m=c[0],d=m.diffs;if(d.length==0||d[0][0]!=A)d.unshift(new E.Diff(A,y)),m.start1-=l,m.start2-=l,m.length1+=l,m.length2+=l;else if(l>d[0][1].length){var v=l-d[0][1].length;d[0][1]=y.substring(d[0][1].length)+d[0][1],m.start1-=v,m.start2-=v,m.length1+=v,m.length2+=v}if(m=c[c.length-1],d=m.diffs,d.length==0||d[d.length-1][0]!=A)d.push(new E.Diff(A,y)),m.length1+=l,m.length2+=l;else if(l>d[d.length-1][1].length){var v=l-d[d.length-1][1].length;d[d.length-1][1]+=y.substring(0,v),m.length1+=v,m.length2+=v}return y},E.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,y=0;y<c.length;y++)if(!(c[y].length1<=l)){var p=c[y];c.splice(y--,1);for(var m=p.start1,d=p.start2,v="";p.diffs.length!==0;){var w=new E.patch_obj,b=!0;for(w.start1=m-v.length,w.start2=d-v.length,v!==""&&(w.length1=w.length2=v.length,w.diffs.push(new E.Diff(A,v)));p.diffs.length!==0&&w.length1<l-this.Patch_Margin;){var g=p.diffs[0][0],s=p.diffs[0][1];g===x?(w.length2+=s.length,d+=s.length,w.diffs.push(p.diffs.shift()),b=!1):g===L&&w.diffs.length==1&&w.diffs[0][0]==A&&s.length>2*l?(w.length1+=s.length,m+=s.length,b=!1,w.diffs.push(new E.Diff(g,s)),p.diffs.shift()):(s=s.substring(0,l-w.length1-this.Patch_Margin),w.length1+=s.length,m+=s.length,g===A?(w.length2+=s.length,d+=s.length):b=!1,w.diffs.push(new E.Diff(g,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}v=this.diff_text2(w.diffs),v=v.substring(v.length-this.Patch_Margin);var C=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);C!==""&&(w.length1+=C.length,w.length2+=C.length,w.diffs.length!==0&&w.diffs[w.diffs.length-1][0]===A?w.diffs[w.diffs.length-1][1]+=C:w.diffs.push(new E.Diff(A,C))),b||c.splice(++y,0,w)}}},E.prototype.patch_toText=function(c){for(var l=[],y=0;y<c.length;y++)l[y]=c[y];return l.join("")},E.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var y=c.split(`
|
|
28
|
-
`),p=0,m=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;p<y.length;){var d=y[p].match(m);if(!d)throw new Error("Invalid patch string: "+y[p]);var v=new E.patch_obj;for(l.push(v),v.start1=parseInt(d[1],10),d[2]===""?(v.start1--,v.length1=1):d[2]=="0"?v.length1=0:(v.start1--,v.length1=parseInt(d[2],10)),v.start2=parseInt(d[3],10),d[4]===""?(v.start2--,v.length2=1):d[4]=="0"?v.length2=0:(v.start2--,v.length2=parseInt(d[4],10)),p++;p<y.length;){var w=y[p].charAt(0);try{var b=decodeURI(y[p].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+b)}if(w=="-")v.diffs.push(new E.Diff(
|
|
29
|
-
`],p,m=0;m<this.diffs.length;m++){switch(this.diffs[m][0]){case
|
|
30
|
-
`}return y.join("").replace(/%20/g," ")},Z.exports=E,Z.exports.diff_match_patch=E,Z.exports.DIFF_DELETE=L,Z.exports.DIFF_INSERT=x,Z.exports.DIFF_EQUAL=A}),408:((Z,E,L)=>{L.d(E,{default:()=>qe});var x=L(135),A=L(840),c=L(775),l=L(428),y=L(325),p=L(483),m=L(999),d=function(I){I===void 0&&(I=document);var re=function(W){var j=document.createElement("img");j.src=W.getAttribute("data-src"),j.addEventListener("load",function(){!W.getAttribute("style")&&!W.getAttribute("class")&&!W.getAttribute("width")&&!W.getAttribute("height")&&j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(W.style.height=window.innerHeight-40+"px"),W.src=j.src}),W.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return I.querySelectorAll("img").forEach(function(W){W.getAttribute("data-src")&&re(W)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(W){W.forEach(function(j){(typeof j.isIntersecting>"u"?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&re(j.target)})}),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)}))},v=L(472),w=L(280),b=L(637),g=L(825),s=L(11),C=L(194),_=L(436),D=L(229),M=L(145),P=L(538),F=L(413),z=L(106),$=L(673),ne=function(I){document.querySelectorAll(".vditor-anchor").forEach(function(re){I===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var W=re.getAttribute("href").substr(1),j=document.getElementById("vditorAnchor-"+W).offsetTop;document.querySelector("html").scrollTop=j}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},oe=L(214),ge=L(810),de=function(I,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var W=function(){var Me=speechSynthesis.getVoices(),X,pe;return Me.forEach(function(He){He.lang===re.replace("_","-")&&(X=He),He.default&&(pe=He)}),X||(X=pe),X},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',he='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(j='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',he='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var K=document.querySelector(".vditor-speech");K||(K=document.createElement("button"),K.className="vditor-speech",I.insertAdjacentElement("beforeend",K),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=W));var ye=W(),ie=new SpeechSynthesisUtterance;ie.voice=ye,ie.onend=ie.onerror=function(){K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j},I.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(Me){var X=Me.target;if(X.classList.contains("vditor-speech")||X.parentElement.classList.contains("vditor-speech")){K.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),K.innerHTML=he):(speechSynthesis.pause(),K.innerHTML=j)):(ie.text=K.getAttribute("data-text"),speechSynthesis.speak(ie),K.classList.add("vditor-speech--current"),K.innerHTML=he),(0,ge.Hc)(window.vditorSpeechRange),I.focus();return}if(K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j,getSelection().rangeCount!==0){var pe=getSelection().getRangeAt(0),He=pe.toString().trim();if(He){window.vditorSpeechRange=pe.cloneRange();var Re=pe.getBoundingClientRect();K.innerHTML=j,K.style.display="block",K.style.top=Re.top+Re.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?K.style.left=Me.changedTouches[Me.changedTouches.length-1].pageX+2+"px":K.style.left=Me.clientX+2+"px",K.setAttribute("data-text",He)}}})}},le=function(I,re,W,j){function he(K){return K instanceof W?K:new W(function(ye){ye(K)})}return new(W||(W=Promise))(function(K,ye){function ie(pe){try{X(j.next(pe))}catch(He){ye(He)}}function Me(pe){try{X(j.throw(pe))}catch(He){ye(He)}}function X(pe){pe.done?K(pe.value):he(pe.value).then(ie,Me)}X((j=j.apply(I,re||[])).next())})},ve=function(I,re){var W={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},j,he,K,ye;return ye={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(ye[Symbol.iterator]=function(){return this}),ye;function ie(X){return function(pe){return Me([X,pe])}}function Me(X){if(j)throw new TypeError("Generator is already executing.");for(;ye&&(ye=0,X[0]&&(W=0)),W;)try{if(j=1,he&&(K=X[0]&2?he.return:X[0]?he.throw||((K=he.return)&&K.call(he),0):he.next)&&!(K=K.call(he,X[1])).done)return K;switch(he=0,K&&(X=[X[0]&2,K.value]),X[0]){case 0:case 1:K=X;break;case 4:return W.label++,{value:X[1],done:!1};case 5:W.label++,he=X[1],X=[0];continue;case 7:X=W.ops.pop(),W.trys.pop();continue;default:if(K=W.trys,!(K=K.length>0&&K[K.length-1])&&(X[0]===6||X[0]===2)){W=0;continue}if(X[0]===3&&(!K||X[1]>K[0]&&X[1]<K[3])){W.label=X[1];break}if(X[0]===6&&W.label<K[1]){W.label=K[1],K=X;break}if(K&&W.label<K[2]){W.label=K[2],W.ops.push(X);break}K[2]&&W.ops.pop(),W.trys.pop();continue}X=re.call(I,W)}catch(pe){X=[6,pe],he=0}finally{j=K=0}if(X[0]&5)throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}},_e=function(I){var re,W={anchor:0,cdn:M.g.CDN,customEmoji:{},emojiPath:"".concat(M.g.CDN,"/dist/images/emoji"),hljs:M.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:M.g.MARKDOWN_OPTIONS,math:M.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:M.g.THEME_OPTIONS};return I.cdn&&(!((re=I.theme)===null||re===void 0)&&re.path||(W.theme.path="".concat(I.cdn,"/dist/css/content-theme")),I.emojiPath||(W.emojiPath="".concat(I.cdn,"/dist/images/emoji"))),(0,$.T)(W,I)},Ee=function(I,re){var W=_e(re);return(0,F.G)("".concat(W.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var j=(0,oe.X)({autoSpace:W.markdown.autoSpace,gfmAutoLink:W.markdown.gfmAutoLink,codeBlockPreview:W.markdown.codeBlockPreview,emojiSite:W.emojiPath,emojis:W.customEmoji,fixTermTypo:W.markdown.fixTermTypo,footnotes:W.markdown.footnotes,headingAnchor:W.anchor!==0,inlineMathDigit:W.math.inlineDigit,lazyLoadImage:W.lazyLoadImage,linkBase:W.markdown.linkBase,linkPrefix:W.markdown.linkPrefix,listStyle:W.markdown.listStyle,mark:W.markdown.mark,mathBlockPreview:W.markdown.mathBlockPreview,paragraphBeginningSpace:W.markdown.paragraphBeginningSpace,sanitize:W.markdown.sanitize,toc:W.markdown.toc});return re?.renderers&&j.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),j.SetHeadingID(!0),j.Md2HTML(I)})},k=function(I,re,W){return le(void 0,void 0,void 0,function(){var j,he,K,ye;return ve(this,function(ie){switch(ie.label){case 0:return j=_e(W),[4,Ee(re,j)];case 1:if(he=ie.sent(),j.transform&&(he=j.transform(he)),I.innerHTML=he,I.classList.add("vditor-reset"),j.i18n)return[3,5];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(j.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return K="vditorI18nScript",ye=K+j.lang,document.querySelectorAll('head script[id^="'.concat(K,'"]')).forEach(function(Me){Me.id!==ye&&document.head.removeChild(Me)}),[4,(0,F.G)("".concat(j.cdn,"/dist/js/i18n/").concat(j.lang,".js"),ye)];case 3:ie.sent(),ie.label=4;case 4:return[3,6];case 5:window.VditorI18n=j.i18n,ie.label=6;case 6:return j.icon?[4,(0,F.G)("".concat(j.cdn,"/dist/js/icons/").concat(j.icon,".js"),"vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,P.Z)(j.theme.current,j.theme.path),j.anchor===1&&I.classList.add("vditor-reset--anchor"),(0,l.O)(I,j.hljs),(0,m.s)(j.hljs,I,j.cdn),(0,v.H)(I,{cdn:j.cdn,math:j.math}),(0,b.i)(I,j.cdn,j.mode),(0,g.J)(I,j.cdn,j.mode),(0,s.K)(I,j.cdn),(0,y.P)(I,j.cdn),(0,p.v)(I,j.cdn),(0,c.p)(I,j.cdn,j.mode),(0,C.P)(I,j.cdn,j.mode),(0,D.B)(I,j.cdn),(0,x.Q)(I,j.cdn),j.render.media.enable&&(0,w.Y)(I),j.speech.enable&&de(I),j.anchor!==0&&ne(j.anchor),j.after&&j.after(),j.lazyLoadImage&&d(I),I.addEventListener("click",function(Me){var X=(0,z.lG)(Me.target,"SPAN");if(X&&(0,z.fb)(X,"vditor-toc")){var pe=I.querySelector("#"+X.getAttribute("data-target-id"));pe&&window.scrollTo(window.scrollX,pe.offsetTop);return}}),[2]}})})},Be=L(190),ht=L(580),mt=(function(){function I(){}return I.adapterRender=A,I.previewImage=Be.E,I.codeRender=l.O,I.graphvizRender=p.v,I.highlightRender=m.s,I.mathRender=v.H,I.mermaidRender=b.i,I.SMILESRender=g.J,I.markmapRender=s.K,I.flowchartRender=y.P,I.chartRender=c.p,I.abcRender=x.Q,I.mindmapRender=C.P,I.plantumlRender=D.B,I.outlineRender=_.k,I.mediaRender=w.Y,I.speechRender=de,I.lazyLoadImageRender=d,I.md2html=Ee,I.preview=k,I.setCodeTheme=ht.Y,I.setContentTheme=P.Z,I})();const qe=mt}),145:((Z,E,L)=>{L.d(E,{H:()=>x,g:()=>A});var x="3.11.2",A=(function(){function c(){}return c.ZWSP="",c.DROP_EDITOR="application/editor",c.MOBILE_WIDTH=520,c.CLASS_MENU_DISABLED="vditor-menu--disabled",c.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],c.CODE_THEME=["a11y-dark","agate","an-old-hope","androidstudio","arta","atom-one-dark","atom-one-dark-reasonable","base16/3024","base16/apathy","base16/apprentice","base16/ashes","base16/atelier-cave","base16/atelier-dune","base16/atelier-estuary","base16/atelier-forest","base16/atelier-heath","base16/atelier-lakeside","base16/atelier-plateau","base16/atelier-savanna","base16/atelier-seaside","base16/atelier-sulphurpool","base16/atlas","base16/bespin","base16/black-metal","base16/black-metal-bathory","base16/black-metal-burzum","base16/black-metal-dark-funeral","base16/black-metal-gorgoroth","base16/black-metal-immortal","base16/black-metal-khold","base16/black-metal-marduk","base16/black-metal-mayhem","base16/black-metal-nile","base16/black-metal-venom","base16/brewer","base16/bright","base16/brogrammer","base16/brush-trees-dark","base16/chalk","base16/circus","base16/classic-dark","base16/codeschool","base16/colors","base16/danqing","base16/darcula","base16/dark-violet","base16/darkmoss","base16/darktooth","base16/decaf","base16/default-dark","base16/dracula","base16/edge-dark","base16/eighties","base16/embers","base16/equilibrium-dark","base16/equilibrium-gray-dark","base16/espresso","base16/eva","base16/eva-dim","base16/flat","base16/framer","base16/gigavolt","base16/google-dark","base16/grayscale-dark","base16/green-screen","base16/gruvbox-dark-hard","base16/gruvbox-dark-medium","base16/gruvbox-dark-pale","base16/gruvbox-dark-soft","base16/hardcore","base16/harmonic16-dark","base16/heetch-dark","base16/helios","base16/hopscotch","base16/horizon-dark","base16/humanoid-dark","base16/ia-dark","base16/icy-dark","base16/ir-black","base16/isotope","base16/kimber","base16/london-tube","base16/macintosh","base16/marrakesh","base16/materia","base16/material","base16/material-darker","base16/material-palenight","base16/material-vivid","base16/mellow-purple","base16/mocha","base16/monokai","base16/nebula","base16/nord","base16/nova","base16/ocean","base16/oceanicnext","base16/onedark","base16/outrun-dark","base16/papercolor-dark","base16/paraiso","base16/pasque","base16/phd","base16/pico","base16/pop","base16/porple","base16/qualia","base16/railscasts","base16/rebecca","base16/ros-pine","base16/ros-pine-moon","base16/sandcastle","base16/seti-ui","base16/silk-dark","base16/snazzy","base16/solar-flare","base16/solarized-dark","base16/spacemacs","base16/summercamp","base16/summerfruit-dark","base16/synth-midnight-terminal-dark","base16/tango","base16/tender","base16/tomorrow-night","base16/twilight","base16/unikitty-dark","base16/vulcan","base16/windows-10","base16/windows-95","base16/windows-high-contrast","base16/windows-nt","base16/woodland","base16/xcode-dusk","base16/zenburn","codepen-embed","dark","devibeans","far","felipec","github-dark","github-dark-dimmed","gml","gradient-dark","hybrid","ir-black","isbl-editor-dark","kimbie-dark","lioshi","monokai","monokai-sublime","night-owl","nnfx-dark","nord","obsidian","panda-syntax-dark","paraiso-dark","pojoaque","qtcreator-dark","rainbow","shades-of-purple","srcery","stackoverflow-dark","sunburst","tomorrow-night-blue","tomorrow-night-bright","tokyo-night-dark","vs2015","xt256","ant-design","a11y-light","arduino-light","ascetic","atom-one-light","base16/atelier-cave-light","base16/atelier-dune-light","base16/atelier-estuary-light","base16/atelier-forest-light","base16/atelier-heath-light","base16/atelier-lakeside-light","base16/atelier-plateau-light","base16/atelier-savanna-light","base16/atelier-seaside-light","base16/atelier-sulphurpool-light","base16/brush-trees","base16/classic-light","base16/cupcake","base16/cupertino","base16/default-light","base16/dirtysea","base16/edge-light","base16/equilibrium-gray-light","base16/equilibrium-light","base16/fruit-soda","base16/github","base16/google-light","base16/grayscale-light","base16/gruvbox-light-hard","base16/gruvbox-light-medium","base16/gruvbox-light-soft","base16/harmonic16-light","base16/heetch-light","base16/humanoid-light","base16/horizon-light","base16/ia-light","base16/material-lighter","base16/mexico-light","base16/one-light","base16/papercolor-light","base16/ros-pine-dawn","base16/sagelight","base16/shapeshifter","base16/silk-light","base16/solar-flare-light","base16/solarized-light","base16/summerfruit-light","base16/synth-midnight-terminal-light","base16/tomorrow","base16/unikitty-light","base16/windows-10-light","base16/windows-95-light","base16/windows-high-contrast-light","brown-paper","base16/windows-nt-light","color-brewer","docco","foundation","github","googlecode","gradient-light","grayscale","idea","intellij-light","isbl-editor-light","kimbie-light","lightfair","magula","mono-blue","nnfx-light","panda-syntax-light","paraiso-light","purebasic","qtcreator-light","routeros","school-book","stackoverflow-light","tokyo-night-light","vs","xcode","default"],c.ALIAS_CODE_LANGUAGES=["abc","plantuml","mermaid","flowchart","echarts","mindmap","graphviz","math","markmap","smiles","js","ts","html","toml","c#","bat"],c.CDN="https://unpkg.com/vditor@".concat("3.11.2"),c.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c})()}),825:((Z,E,L)=>{L.d(E,{J:()=>y});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(p,m,d){p===void 0&&(p=document),m===void 0&&(m=x.g.CDN);var v=c.SMILESRenderAdapter.getElements(p);v.length>0&&(0,A.G)("".concat(m,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var w=new SmiDrawer({},{});v.forEach(function(b){var g=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),w.draw(g,"#"+s,d==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}}),135:((Z,E,L)=>{L.d(E,{Q:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=x.g.CDN);var m=c.abcRenderAdapter.getElements(y);m.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){m.forEach(function(d){d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre")||d.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(d,c.abcRenderAdapter.getCode(d).trim()),d.style.overflowX="auto",d.setAttribute("data-processed","true"))})})}}),840:((Z,E,L)=>{L.r(E),L.d(E,{mathRenderAdapter:()=>x,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>y,chartRenderAdapter:()=>p,abcRenderAdapter:()=>m,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var x={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},y={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},m={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},d={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},w={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}}),775:((Z,E,L)=>{L.d(E,{p:()=>m});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(d,v,w,b){function g(s){return s instanceof w?s:new w(function(C){C(s)})}return new(w||(w=Promise))(function(s,C){function _(P){try{M(b.next(P))}catch(F){C(F)}}function D(P){try{M(b.throw(P))}catch(F){C(F)}}function M(P){P.done?s(P.value):g(P.value).then(_,D)}M((b=b.apply(d,v||[])).next())})},p=function(d,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,g,s,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(M){return function(P){return D([M,P])}}function D(M){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,M[0]&&(w=0)),w;)try{if(b=1,g&&(s=M[0]&2?g.return:M[0]?g.throw||((s=g.return)&&s.call(g),0):g.next)&&!(s=s.call(g,M[1])).done)return s;switch(g=0,s&&(M=[M[0]&2,s.value]),M[0]){case 0:case 1:s=M;break;case 4:return w.label++,{value:M[1],done:!1};case 5:w.label++,g=M[1],M=[0];continue;case 7:M=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(M[0]===6||M[0]===2)){w=0;continue}if(M[0]===3&&(!s||M[1]>s[0]&&M[1]<s[3])){w.label=M[1];break}if(M[0]===6&&w.label<s[1]){w.label=s[1],s=M;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(M);break}s[2]&&w.ops.pop(),w.trys.pop();continue}M=v.call(d,w)}catch(P){M=[6,P],g=0}finally{b=s=0}if(M[0]&5)throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}},m=function(d,v,w){d===void 0&&(d=document),v===void 0&&(v=x.g.CDN);var b=c.chartRenderAdapter.getElements(d);b.length>0&&(0,A.G)("".concat(v,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(g){return y(void 0,void 0,void 0,function(){var s,C,_;return p(this,function(D){switch(D.label){case 0:if(g.parentElement.classList.contains("vditor-wysiwyg__pre")||g.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(g).trim(),!s)return[2];D.label=1;case 1:return D.trys.push([1,3,,4]),g.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return C=D.sent(),echarts.init(g,w==="dark"?"dark":void 0).setOption(C),g.setAttribute("data-processed","true"),[3,4];case 3:return _=D.sent(),g.className="vditor-reset--error",g.innerHTML="echarts render error: <br>".concat(_),[3,4];case 4:return[2]}})})})})}}),428:((Z,E,L)=>{L.d(E,{O:()=>c});var x=L(105),A=L(145),c=function(l,y){Array.from(l.querySelectorAll("pre > code")).filter(function(p,m){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&m>5)}).forEach(function(p){var m,d,v,w=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(_){_.remove()}),w=b.innerText}else w.endsWith(`
|
|
26
|
+
*/var Ti=Tt.exports,Un;function _i(){return Un||(Un=1,(function(ve,Jt){(function(rt,Y){ve.exports=Y()})(Ti,function(){return(()=>{var pt={173:(Z=>{var E=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},M=-1,D=1,A=0;E.Diff=function(c,l){return[c,l]},E.prototype.diff_main=function(c,l,y,p){typeof p>"u"&&(this.Diff_Timeout<=0?p=Number.MAX_VALUE:p=new Date().getTime()+this.Diff_Timeout*1e3);var m=p;if(c==null||l==null)throw new Error("Null input. (diff_main)");if(c==l)return c?[new E.Diff(A,c)]:[];typeof y>"u"&&(y=!0);var d=y,v=this.diff_commonPrefix(c,l),w=c.substring(0,v);c=c.substring(v),l=l.substring(v),v=this.diff_commonSuffix(c,l);var b=c.substring(c.length-v);c=c.substring(0,c.length-v),l=l.substring(0,l.length-v);var g=this.diff_compute_(c,l,d,m);return w&&g.unshift(new E.Diff(A,w)),b&&g.push(new E.Diff(A,b)),this.diff_cleanupMerge(g),g},E.prototype.diff_compute_=function(c,l,y,p){var m;if(!c)return[new E.Diff(D,l)];if(!l)return[new E.Diff(M,c)];var d=c.length>l.length?c:l,v=c.length>l.length?l:c,w=d.indexOf(v);if(w!=-1)return m=[new E.Diff(D,d.substring(0,w)),new E.Diff(A,v),new E.Diff(D,d.substring(w+v.length))],c.length>l.length&&(m[0][0]=m[2][0]=M),m;if(v.length==1)return[new E.Diff(M,c),new E.Diff(D,l)];var b=this.diff_halfMatch_(c,l);if(b){var g=b[0],s=b[1],C=b[2],_=b[3],x=b[4],L=this.diff_main(g,C,y,p),P=this.diff_main(s,_,y,p);return L.concat([new E.Diff(A,x)],P)}return y&&c.length>100&&l.length>100?this.diff_lineMode_(c,l,p):this.diff_bisect_(c,l,p)},E.prototype.diff_lineMode_=function(c,l,y){var p=this.diff_linesToChars_(c,l);c=p.chars1,l=p.chars2;var m=p.lineArray,d=this.diff_main(c,l,!1,y);this.diff_charsToLines_(d,m),this.diff_cleanupSemantic(d),d.push(new E.Diff(A,""));for(var v=0,w=0,b=0,g="",s="";v<d.length;){switch(d[v][0]){case D:b++,s+=d[v][1];break;case M:w++,g+=d[v][1];break;case A:if(w>=1&&b>=1){d.splice(v-w-b,w+b),v=v-w-b;for(var C=this.diff_main(g,s,!1,y),_=C.length-1;_>=0;_--)d.splice(v,0,C[_]);v=v+C.length}b=0,w=0,g="",s="";break}v++}return d.pop(),d},E.prototype.diff_bisect_=function(c,l,y){for(var p=c.length,m=l.length,d=Math.ceil((p+m)/2),v=d,w=2*d,b=new Array(w),g=new Array(w),s=0;s<w;s++)b[s]=-1,g[s]=-1;b[v+1]=0,g[v+1]=0;for(var C=p-m,_=C%2!=0,x=0,L=0,P=0,F=0,z=0;z<d&&!(new Date().getTime()>y);z++){for(var Q=-z+x;Q<=z-L;Q+=2){var ne=v+Q,oe;Q==-z||Q!=z&&b[ne-1]<b[ne+1]?oe=b[ne+1]:oe=b[ne-1]+1;for(var ge=oe-Q;oe<p&&ge<m&&c.charAt(oe)==l.charAt(ge);)oe++,ge++;if(b[ne]=oe,oe>p)L+=2;else if(ge>m)x+=2;else if(_){var de=v+C-Q;if(de>=0&&de<w&&g[de]!=-1){var le=p-g[de];if(oe>=le)return this.diff_bisectSplit_(c,l,oe,ge,y)}}}for(var Ee=-z+P;Ee<=z-F;Ee+=2){var de=v+Ee,le;Ee==-z||Ee!=z&&g[de-1]<g[de+1]?le=g[de+1]:le=g[de-1]+1;for(var _e=le-Ee;le<p&&_e<m&&c.charAt(p-le-1)==l.charAt(m-_e-1);)le++,_e++;if(g[de]=le,le>p)F+=2;else if(_e>m)P+=2;else if(!_){var ne=v+C-Ee;if(ne>=0&&ne<w&&b[ne]!=-1){var oe=b[ne],ge=v+oe-ne;if(le=p-le,oe>=le)return this.diff_bisectSplit_(c,l,oe,ge,y)}}}}return[new E.Diff(M,c),new E.Diff(D,l)]},E.prototype.diff_bisectSplit_=function(c,l,y,p,m){var d=c.substring(0,y),v=l.substring(0,p),w=c.substring(y),b=l.substring(p),g=this.diff_main(d,v,!1,m),s=this.diff_main(w,b,!1,m);return g.concat(s)},E.prototype.diff_linesToChars_=function(c,l){var y=[],p={};y[0]="";function m(b){for(var g="",s=0,C=-1,_=y.length;C<b.length-1;){C=b.indexOf(`
|
|
27
|
+
`,s),C==-1&&(C=b.length-1);var x=b.substring(s,C+1);(p.hasOwnProperty?p.hasOwnProperty(x):p[x]!==void 0)?g+=String.fromCharCode(p[x]):(_==d&&(x=b.substring(s),C=b.length),g+=String.fromCharCode(_),p[x]=_,y[_++]=x),s=C+1}return g}var d=4e4,v=m(c);d=65535;var w=m(l);return{chars1:v,chars2:w,lineArray:y}},E.prototype.diff_charsToLines_=function(c,l){for(var y=0;y<c.length;y++){for(var p=c[y][1],m=[],d=0;d<p.length;d++)m[d]=l[p.charCodeAt(d)];c[y][1]=m.join("")}},E.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(d,m)==l.substring(d,m)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(c.length-m,c.length-d)==l.substring(l.length-m,l.length-d)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonOverlap_=function(c,l){var y=c.length,p=l.length;if(y==0||p==0)return 0;y>p?c=c.substring(y-p):y<p&&(l=l.substring(0,y));var m=Math.min(y,p);if(c==l)return m;for(var d=0,v=1;;){var w=c.substring(m-v),b=l.indexOf(w);if(b==-1)return d;v+=b,(b==0||c.substring(m-v)==l.substring(0,v))&&(d=v,v++)}},E.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var y=c.length>l.length?c:l,p=c.length>l.length?l:c;if(y.length<4||p.length*2<y.length)return null;var m=this;function d(L,P,F){for(var z=L.substring(F,F+Math.floor(L.length/4)),Q=-1,ne="",oe,ge,de,le;(Q=P.indexOf(z,Q+1))!=-1;){var Ee=m.diff_commonPrefix(L.substring(F),P.substring(Q)),_e=m.diff_commonSuffix(L.substring(0,F),P.substring(0,Q));ne.length<_e+Ee&&(ne=P.substring(Q-_e,Q)+P.substring(Q,Q+Ee),oe=L.substring(0,F-_e),ge=L.substring(F+Ee),de=P.substring(0,Q-_e),le=P.substring(Q+Ee))}return ne.length*2>=L.length?[oe,ge,de,le,ne]:null}var v=d(y,p,Math.ceil(y.length/4)),w=d(y,p,Math.ceil(y.length/2)),b;if(!v&&!w)return null;w?v?b=v[4].length>w[4].length?v:w:b=w:b=v;var g,s,C,_;c.length>l.length?(g=b[0],s=b[1],C=b[2],_=b[3]):(C=b[0],_=b[1],g=b[2],s=b[3]);var x=b[4];return[g,s,C,_,x]},E.prototype.diff_cleanupSemantic=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=0,w=0,b=0,g=0;d<c.length;)c[d][0]==A?(y[p++]=d,v=b,w=g,b=0,g=0,m=c[d][1]):(c[d][0]==D?b+=c[d][1].length:g+=c[d][1].length,m&&m.length<=Math.max(v,w)&&m.length<=Math.max(b,g)&&(c.splice(y[p-1],0,new E.Diff(M,m)),c[y[p-1]+1][0]=D,p--,p--,d=p>0?y[p-1]:-1,v=0,w=0,b=0,g=0,m=null,l=!0)),d++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),d=1;d<c.length;){if(c[d-1][0]==M&&c[d][0]==D){var s=c[d-1][1],C=c[d][1],_=this.diff_commonOverlap_(s,C),x=this.diff_commonOverlap_(C,s);_>=x?(_>=s.length/2||_>=C.length/2)&&(c.splice(d,0,new E.Diff(A,C.substring(0,_))),c[d-1][1]=s.substring(0,s.length-_),c[d+1][1]=C.substring(_),d++):(x>=s.length/2||x>=C.length/2)&&(c.splice(d,0,new E.Diff(A,s.substring(0,x))),c[d-1][0]=D,c[d-1][1]=C.substring(0,C.length-x),c[d+1][0]=M,c[d+1][1]=s.substring(x),d++),d++}d++}},E.prototype.diff_cleanupSemanticLossless=function(c){function l(x,L){if(!x||!L)return 6;var P=x.charAt(x.length-1),F=L.charAt(0),z=P.match(E.nonAlphaNumericRegex_),Q=F.match(E.nonAlphaNumericRegex_),ne=z&&P.match(E.whitespaceRegex_),oe=Q&&F.match(E.whitespaceRegex_),ge=ne&&P.match(E.linebreakRegex_),de=oe&&F.match(E.linebreakRegex_),le=ge&&x.match(E.blanklineEndRegex_),Ee=de&&L.match(E.blanklineStartRegex_);return le||Ee?5:ge||de?4:z&&!ne&&oe?3:ne||oe?2:z||Q?1:0}for(var y=1;y<c.length-1;){if(c[y-1][0]==A&&c[y+1][0]==A){var p=c[y-1][1],m=c[y][1],d=c[y+1][1],v=this.diff_commonSuffix(p,m);if(v){var w=m.substring(m.length-v);p=p.substring(0,p.length-v),m=w+m.substring(0,m.length-v),d=w+d}for(var b=p,g=m,s=d,C=l(p,m)+l(m,d);m.charAt(0)===d.charAt(0);){p+=m.charAt(0),m=m.substring(1)+d.charAt(0),d=d.substring(1);var _=l(p,m)+l(m,d);_>=C&&(C=_,b=p,g=m,s=d)}c[y-1][1]!=b&&(b?c[y-1][1]=b:(c.splice(y-1,1),y--),c[y][1]=g,s?c[y+1][1]=s:(c.splice(y+1,1),y--))}y++}},E.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,E.whitespaceRegex_=/\s/,E.linebreakRegex_=/[\r\n]/,E.blanklineEndRegex_=/\n\r?\n$/,E.blanklineStartRegex_=/^\r?\n\r?\n/,E.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=!1,w=!1,b=!1,g=!1;d<c.length;)c[d][0]==A?(c[d][1].length<this.Diff_EditCost&&(b||g)?(y[p++]=d,v=b,w=g,m=c[d][1]):(p=0,m=null),b=g=!1):(c[d][0]==M?g=!0:b=!0,m&&(v&&w&&b&&g||m.length<this.Diff_EditCost/2&&v+w+b+g==3)&&(c.splice(y[p-1],0,new E.Diff(M,m)),c[y[p-1]+1][0]=D,p--,m=null,v&&w?(b=g=!0,p=0):(p--,d=p>0?y[p-1]:-1,b=g=!1),l=!0)),d++;l&&this.diff_cleanupMerge(c)},E.prototype.diff_cleanupMerge=function(c){c.push(new E.Diff(A,""));for(var l=0,y=0,p=0,m="",d="",v;l<c.length;)switch(c[l][0]){case D:p++,d+=c[l][1],l++;break;case M:y++,m+=c[l][1],l++;break;case A:y+p>1?(y!==0&&p!==0&&(v=this.diff_commonPrefix(d,m),v!==0&&(l-y-p>0&&c[l-y-p-1][0]==A?c[l-y-p-1][1]+=d.substring(0,v):(c.splice(0,0,new E.Diff(A,d.substring(0,v))),l++),d=d.substring(v),m=m.substring(v)),v=this.diff_commonSuffix(d,m),v!==0&&(c[l][1]=d.substring(d.length-v)+c[l][1],d=d.substring(0,d.length-v),m=m.substring(0,m.length-v))),l-=y+p,c.splice(l,y+p),m.length&&(c.splice(l,0,new E.Diff(M,m)),l++),d.length&&(c.splice(l,0,new E.Diff(D,d)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,y=0,m="",d="";break}c[c.length-1][1]===""&&c.pop();var w=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),w=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),w=!0)),l++;w&&this.diff_cleanupMerge(c)},E.prototype.diff_xIndex=function(c,l){var y=0,p=0,m=0,d=0,v;for(v=0;v<c.length&&(c[v][0]!==D&&(y+=c[v][1].length),c[v][0]!==M&&(p+=c[v][1].length),!(y>l));v++)m=y,d=p;return c.length!=v&&c[v][0]===M?d:d+(l-m)},E.prototype.diff_prettyHtml=function(c){for(var l=[],y=/&/g,p=/</g,m=/>/g,d=/\n/g,v=0;v<c.length;v++){var w=c[v][0],b=c[v][1],g=b.replace(y,"&").replace(p,"<").replace(m,">").replace(d,"¶<br>");switch(w){case D:l[v]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case M:l[v]='<del style="background:#ffe6e6;">'+g+"</del>";break;case A:l[v]="<span>"+g+"</span>";break}}return l.join("")},E.prototype.diff_text1=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==D&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_text2=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==M&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_levenshtein=function(c){for(var l=0,y=0,p=0,m=0;m<c.length;m++){var d=c[m][0],v=c[m][1];switch(d){case D:y+=v.length;break;case M:p+=v.length;break;case A:l+=Math.max(y,p),y=0,p=0;break}}return l+=Math.max(y,p),l},E.prototype.diff_toDelta=function(c){for(var l=[],y=0;y<c.length;y++)switch(c[y][0]){case D:l[y]="+"+encodeURI(c[y][1]);break;case M:l[y]="-"+c[y][1].length;break;case A:l[y]="="+c[y][1].length;break}return l.join(" ").replace(/%20/g," ")},E.prototype.diff_fromDelta=function(c,l){for(var y=[],p=0,m=0,d=l.split(/\t/g),v=0;v<d.length;v++){var w=d[v].substring(1);switch(d[v].charAt(0)){case"+":try{y[p++]=new E.Diff(D,decodeURI(w))}catch{throw new Error("Illegal escape in diff_fromDelta: "+w)}break;case"-":case"=":var b=parseInt(w,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+w);var g=c.substring(m,m+=b);d[v].charAt(0)=="="?y[p++]=new E.Diff(A,g):y[p++]=new E.Diff(M,g);break;default:if(d[v])throw new Error("Invalid diff operation in diff_fromDelta: "+d[v])}}if(m!=c.length)throw new Error("Delta length ("+m+") does not equal source text length ("+c.length+").");return y},E.prototype.match_main=function(c,l,y){if(c==null||l==null||y==null)throw new Error("Null input. (match_main)");return y=Math.max(0,Math.min(y,c.length)),c==l?0:c.length?c.substring(y,y+l.length)==l?y:this.match_bitap_(c,l,y):-1},E.prototype.match_bitap_=function(c,l,y){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),m=this;function d(oe,ge){var de=oe/l.length,le=Math.abs(y-ge);return m.Match_Distance?de+le/m.Match_Distance:le?1:de}var v=this.Match_Threshold,w=c.indexOf(l,y);w!=-1&&(v=Math.min(d(0,w),v),w=c.lastIndexOf(l,y+l.length),w!=-1&&(v=Math.min(d(0,w),v)));var b=1<<l.length-1;w=-1;for(var g,s,C=l.length+c.length,_,x=0;x<l.length;x++){for(g=0,s=C;g<s;)d(x,y+s)<=v?g=s:C=s,s=Math.floor((C-g)/2+g);C=s;var L=Math.max(1,y-s+1),P=Math.min(y+s,c.length)+l.length,F=Array(P+2);F[P+1]=(1<<x)-1;for(var z=P;z>=L;z--){var Q=p[c.charAt(z-1)];if(x===0?F[z]=(F[z+1]<<1|1)&Q:F[z]=(F[z+1]<<1|1)&Q|((_[z+1]|_[z])<<1|1)|_[z+1],F[z]&b){var ne=d(x,z-1);if(ne<=v)if(v=ne,w=z-1,w>y)L=Math.max(1,2*y-w);else break}}if(d(x+1,y)>v)break;_=F}return w},E.prototype.match_alphabet_=function(c){for(var l={},y=0;y<c.length;y++)l[c.charAt(y)]=0;for(var y=0;y<c.length;y++)l[c.charAt(y)]|=1<<c.length-y-1;return l},E.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var y=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(y)!=l.lastIndexOf(y)&&y.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,y=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var m=l.substring(c.start2-p,c.start2);m&&c.diffs.unshift(new E.Diff(A,m));var d=l.substring(c.start2+c.length1,c.start2+c.length1+p);d&&c.diffs.push(new E.Diff(A,d)),c.start1-=m.length,c.start2-=m.length,c.length1+=m.length+d.length,c.length2+=m.length+d.length}},E.prototype.patch_make=function(c,l,y){var p,m;if(typeof c=="string"&&typeof l=="string"&&typeof y>"u")p=c,m=this.diff_main(p,l,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof y>"u")m=c,p=this.diff_text1(m);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof y>"u")p=c,m=l;else if(typeof c=="string"&&typeof l=="string"&&y&&typeof y=="object")p=c,m=y;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var d=[],v=new E.patch_obj,w=0,b=0,g=0,s=p,C=p,_=0;_<m.length;_++){var x=m[_][0],L=m[_][1];switch(!w&&x!==A&&(v.start1=b,v.start2=g),x){case D:v.diffs[w++]=m[_],v.length2+=L.length,C=C.substring(0,g)+L+C.substring(g);break;case M:v.length1+=L.length,v.diffs[w++]=m[_],C=C.substring(0,g)+C.substring(g+L.length);break;case A:L.length<=2*this.Patch_Margin&&w&&m.length!=_+1?(v.diffs[w++]=m[_],v.length1+=L.length,v.length2+=L.length):L.length>=2*this.Patch_Margin&&w&&(this.patch_addContext_(v,s),d.push(v),v=new E.patch_obj,w=0,s=C,b=g);break}x!==D&&(b+=L.length),x!==M&&(g+=L.length)}return w&&(this.patch_addContext_(v,s),d.push(v)),d},E.prototype.patch_deepCopy=function(c){for(var l=[],y=0;y<c.length;y++){var p=c[y],m=new E.patch_obj;m.diffs=[];for(var d=0;d<p.diffs.length;d++)m.diffs[d]=new E.Diff(p.diffs[d][0],p.diffs[d][1]);m.start1=p.start1,m.start2=p.start2,m.length1=p.length1,m.length2=p.length2,l[y]=m}return l},E.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var y=this.patch_addPadding(c);l=y+l+y,this.patch_splitMax(c);for(var p=0,m=[],d=0;d<c.length;d++){var v=c[d].start2+p,w=this.diff_text1(c[d].diffs),b,g=-1;if(w.length>this.Match_MaxBits?(b=this.match_main(l,w.substring(0,this.Match_MaxBits),v),b!=-1&&(g=this.match_main(l,w.substring(w.length-this.Match_MaxBits),v+w.length-this.Match_MaxBits),(g==-1||b>=g)&&(b=-1))):b=this.match_main(l,w,v),b==-1)m[d]=!1,p-=c[d].length2-c[d].length1;else{m[d]=!0,p=b-v;var s;if(g==-1?s=l.substring(b,b+w.length):s=l.substring(b,g+this.Match_MaxBits),w==s)l=l.substring(0,b)+this.diff_text2(c[d].diffs)+l.substring(b+w.length);else{var C=this.diff_main(w,s,!1);if(w.length>this.Match_MaxBits&&this.diff_levenshtein(C)/w.length>this.Patch_DeleteThreshold)m[d]=!1;else{this.diff_cleanupSemanticLossless(C);for(var _=0,x,L=0;L<c[d].diffs.length;L++){var P=c[d].diffs[L];P[0]!==A&&(x=this.diff_xIndex(C,_)),P[0]===D?l=l.substring(0,b+x)+P[1]+l.substring(b+x):P[0]===M&&(l=l.substring(0,b+x)+l.substring(b+this.diff_xIndex(C,_+P[1].length))),P[0]!==M&&(_+=P[1].length)}}}}}return l=l.substring(y.length,l.length-y.length),[l,m]},E.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,y="",p=1;p<=l;p++)y+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var m=c[0],d=m.diffs;if(d.length==0||d[0][0]!=A)d.unshift(new E.Diff(A,y)),m.start1-=l,m.start2-=l,m.length1+=l,m.length2+=l;else if(l>d[0][1].length){var v=l-d[0][1].length;d[0][1]=y.substring(d[0][1].length)+d[0][1],m.start1-=v,m.start2-=v,m.length1+=v,m.length2+=v}if(m=c[c.length-1],d=m.diffs,d.length==0||d[d.length-1][0]!=A)d.push(new E.Diff(A,y)),m.length1+=l,m.length2+=l;else if(l>d[d.length-1][1].length){var v=l-d[d.length-1][1].length;d[d.length-1][1]+=y.substring(0,v),m.length1+=v,m.length2+=v}return y},E.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,y=0;y<c.length;y++)if(!(c[y].length1<=l)){var p=c[y];c.splice(y--,1);for(var m=p.start1,d=p.start2,v="";p.diffs.length!==0;){var w=new E.patch_obj,b=!0;for(w.start1=m-v.length,w.start2=d-v.length,v!==""&&(w.length1=w.length2=v.length,w.diffs.push(new E.Diff(A,v)));p.diffs.length!==0&&w.length1<l-this.Patch_Margin;){var g=p.diffs[0][0],s=p.diffs[0][1];g===D?(w.length2+=s.length,d+=s.length,w.diffs.push(p.diffs.shift()),b=!1):g===M&&w.diffs.length==1&&w.diffs[0][0]==A&&s.length>2*l?(w.length1+=s.length,m+=s.length,b=!1,w.diffs.push(new E.Diff(g,s)),p.diffs.shift()):(s=s.substring(0,l-w.length1-this.Patch_Margin),w.length1+=s.length,m+=s.length,g===A?(w.length2+=s.length,d+=s.length):b=!1,w.diffs.push(new E.Diff(g,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}v=this.diff_text2(w.diffs),v=v.substring(v.length-this.Patch_Margin);var C=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);C!==""&&(w.length1+=C.length,w.length2+=C.length,w.diffs.length!==0&&w.diffs[w.diffs.length-1][0]===A?w.diffs[w.diffs.length-1][1]+=C:w.diffs.push(new E.Diff(A,C))),b||c.splice(++y,0,w)}}},E.prototype.patch_toText=function(c){for(var l=[],y=0;y<c.length;y++)l[y]=c[y];return l.join("")},E.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var y=c.split(`
|
|
28
|
+
`),p=0,m=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;p<y.length;){var d=y[p].match(m);if(!d)throw new Error("Invalid patch string: "+y[p]);var v=new E.patch_obj;for(l.push(v),v.start1=parseInt(d[1],10),d[2]===""?(v.start1--,v.length1=1):d[2]=="0"?v.length1=0:(v.start1--,v.length1=parseInt(d[2],10)),v.start2=parseInt(d[3],10),d[4]===""?(v.start2--,v.length2=1):d[4]=="0"?v.length2=0:(v.start2--,v.length2=parseInt(d[4],10)),p++;p<y.length;){var w=y[p].charAt(0);try{var b=decodeURI(y[p].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+b)}if(w=="-")v.diffs.push(new E.Diff(M,b));else if(w=="+")v.diffs.push(new E.Diff(D,b));else if(w==" ")v.diffs.push(new E.Diff(A,b));else{if(w=="@")break;if(w!=="")throw new Error('Invalid patch mode "'+w+'" in: '+b)}p++}}return l},E.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},E.patch_obj.prototype.toString=function(){var c,l;this.length1===0?c=this.start1+",0":this.length1==1?c=this.start1+1:c=this.start1+1+","+this.length1,this.length2===0?l=this.start2+",0":this.length2==1?l=this.start2+1:l=this.start2+1+","+this.length2;for(var y=["@@ -"+c+" +"+l+` @@
|
|
29
|
+
`],p,m=0;m<this.diffs.length;m++){switch(this.diffs[m][0]){case D:p="+";break;case M:p="-";break;case A:p=" ";break}y[m+1]=p+encodeURI(this.diffs[m][1])+`
|
|
30
|
+
`}return y.join("").replace(/%20/g," ")},Z.exports=E,Z.exports.diff_match_patch=E,Z.exports.DIFF_DELETE=M,Z.exports.DIFF_INSERT=D,Z.exports.DIFF_EQUAL=A}),408:((Z,E,M)=>{M.d(E,{default:()=>qe});var D=M(135),A=M(840),c=M(775),l=M(428),y=M(325),p=M(483),m=M(999),d=function(I){I===void 0&&(I=document);var re=function(W){var j=document.createElement("img");j.src=W.getAttribute("data-src"),j.addEventListener("load",function(){!W.getAttribute("style")&&!W.getAttribute("class")&&!W.getAttribute("width")&&!W.getAttribute("height")&&j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(W.style.height=window.innerHeight-40+"px"),W.src=j.src}),W.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return I.querySelectorAll("img").forEach(function(W){W.getAttribute("data-src")&&re(W)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(W){W.forEach(function(j){(typeof j.isIntersecting>"u"?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&re(j.target)})}),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)}))},v=M(472),w=M(280),b=M(637),g=M(825),s=M(11),C=M(194),_=M(436),x=M(229),L=M(145),P=M(538),F=M(413),z=M(106),Q=M(673),ne=function(I){document.querySelectorAll(".vditor-anchor").forEach(function(re){I===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var W=re.getAttribute("href").substr(1),j=document.getElementById("vditorAnchor-"+W).offsetTop;document.querySelector("html").scrollTop=j}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},oe=M(214),ge=M(810),de=function(I,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var W=function(){var ke=speechSynthesis.getVoices(),X,pe;return ke.forEach(function(He){He.lang===re.replace("_","-")&&(X=He),He.default&&(pe=He)}),X||(X=pe),X},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',he='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(j='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',he='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var K=document.querySelector(".vditor-speech");K||(K=document.createElement("button"),K.className="vditor-speech",I.insertAdjacentElement("beforeend",K),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=W));var ye=W(),ie=new SpeechSynthesisUtterance;ie.voice=ye,ie.onend=ie.onerror=function(){K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j},I.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(ke){var X=ke.target;if(X.classList.contains("vditor-speech")||X.parentElement.classList.contains("vditor-speech")){K.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),K.innerHTML=he):(speechSynthesis.pause(),K.innerHTML=j)):(ie.text=K.getAttribute("data-text"),speechSynthesis.speak(ie),K.classList.add("vditor-speech--current"),K.innerHTML=he),(0,ge.Hc)(window.vditorSpeechRange),I.focus();return}if(K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j,getSelection().rangeCount!==0){var pe=getSelection().getRangeAt(0),He=pe.toString().trim();if(He){window.vditorSpeechRange=pe.cloneRange();var Re=pe.getBoundingClientRect();K.innerHTML=j,K.style.display="block",K.style.top=Re.top+Re.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?K.style.left=ke.changedTouches[ke.changedTouches.length-1].pageX+2+"px":K.style.left=ke.clientX+2+"px",K.setAttribute("data-text",He)}}})}},le=function(I,re,W,j){function he(K){return K instanceof W?K:new W(function(ye){ye(K)})}return new(W||(W=Promise))(function(K,ye){function ie(pe){try{X(j.next(pe))}catch(He){ye(He)}}function ke(pe){try{X(j.throw(pe))}catch(He){ye(He)}}function X(pe){pe.done?K(pe.value):he(pe.value).then(ie,ke)}X((j=j.apply(I,re||[])).next())})},Ee=function(I,re){var W={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},j,he,K,ye;return ye={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(ye[Symbol.iterator]=function(){return this}),ye;function ie(X){return function(pe){return ke([X,pe])}}function ke(X){if(j)throw new TypeError("Generator is already executing.");for(;ye&&(ye=0,X[0]&&(W=0)),W;)try{if(j=1,he&&(K=X[0]&2?he.return:X[0]?he.throw||((K=he.return)&&K.call(he),0):he.next)&&!(K=K.call(he,X[1])).done)return K;switch(he=0,K&&(X=[X[0]&2,K.value]),X[0]){case 0:case 1:K=X;break;case 4:return W.label++,{value:X[1],done:!1};case 5:W.label++,he=X[1],X=[0];continue;case 7:X=W.ops.pop(),W.trys.pop();continue;default:if(K=W.trys,!(K=K.length>0&&K[K.length-1])&&(X[0]===6||X[0]===2)){W=0;continue}if(X[0]===3&&(!K||X[1]>K[0]&&X[1]<K[3])){W.label=X[1];break}if(X[0]===6&&W.label<K[1]){W.label=K[1],K=X;break}if(K&&W.label<K[2]){W.label=K[2],W.ops.push(X);break}K[2]&&W.ops.pop(),W.trys.pop();continue}X=re.call(I,W)}catch(pe){X=[6,pe],he=0}finally{j=K=0}if(X[0]&5)throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}},_e=function(I){var re,W={anchor:0,cdn:L.g.CDN,customEmoji:{},emojiPath:"".concat(L.g.CDN,"/dist/images/emoji"),hljs:L.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:L.g.MARKDOWN_OPTIONS,math:L.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:L.g.THEME_OPTIONS};return I.cdn&&(!((re=I.theme)===null||re===void 0)&&re.path||(W.theme.path="".concat(I.cdn,"/dist/css/content-theme")),I.emojiPath||(W.emojiPath="".concat(I.cdn,"/dist/images/emoji"))),(0,Q.T)(W,I)},Se=function(I,re){var W=_e(re);return(0,F.G)("".concat(W.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var j=(0,oe.X)({autoSpace:W.markdown.autoSpace,gfmAutoLink:W.markdown.gfmAutoLink,codeBlockPreview:W.markdown.codeBlockPreview,emojiSite:W.emojiPath,emojis:W.customEmoji,fixTermTypo:W.markdown.fixTermTypo,footnotes:W.markdown.footnotes,headingAnchor:W.anchor!==0,inlineMathDigit:W.math.inlineDigit,lazyLoadImage:W.lazyLoadImage,linkBase:W.markdown.linkBase,linkPrefix:W.markdown.linkPrefix,listStyle:W.markdown.listStyle,mark:W.markdown.mark,mathBlockPreview:W.markdown.mathBlockPreview,paragraphBeginningSpace:W.markdown.paragraphBeginningSpace,sanitize:W.markdown.sanitize,toc:W.markdown.toc});return re?.renderers&&j.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),j.SetHeadingID(!0),j.Md2HTML(I)})},k=function(I,re,W){return le(void 0,void 0,void 0,function(){var j,he,K,ye;return Ee(this,function(ie){switch(ie.label){case 0:return j=_e(W),[4,Se(re,j)];case 1:if(he=ie.sent(),j.transform&&(he=j.transform(he)),I.innerHTML=he,I.classList.add("vditor-reset"),j.i18n)return[3,5];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(j.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return K="vditorI18nScript",ye=K+j.lang,document.querySelectorAll('head script[id^="'.concat(K,'"]')).forEach(function(ke){ke.id!==ye&&document.head.removeChild(ke)}),[4,(0,F.G)("".concat(j.cdn,"/dist/js/i18n/").concat(j.lang,".js"),ye)];case 3:ie.sent(),ie.label=4;case 4:return[3,6];case 5:window.VditorI18n=j.i18n,ie.label=6;case 6:return j.icon?[4,(0,F.G)("".concat(j.cdn,"/dist/js/icons/").concat(j.icon,".js"),"vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,P.Z)(j.theme.current,j.theme.path),j.anchor===1&&I.classList.add("vditor-reset--anchor"),(0,l.O)(I,j.hljs),(0,m.s)(j.hljs,I,j.cdn),(0,v.H)(I,{cdn:j.cdn,math:j.math}),(0,b.i)(I,j.cdn,j.mode),(0,g.J)(I,j.cdn,j.mode),(0,s.K)(I,j.cdn),(0,y.P)(I,j.cdn),(0,p.v)(I,j.cdn),(0,c.p)(I,j.cdn,j.mode),(0,C.P)(I,j.cdn,j.mode),(0,x.B)(I,j.cdn),(0,D.Q)(I,j.cdn),j.render.media.enable&&(0,w.Y)(I),j.speech.enable&&de(I),j.anchor!==0&&ne(j.anchor),j.after&&j.after(),j.lazyLoadImage&&d(I),I.addEventListener("click",function(ke){var X=(0,z.lG)(ke.target,"SPAN");if(X&&(0,z.fb)(X,"vditor-toc")){var pe=I.querySelector("#"+X.getAttribute("data-target-id"));pe&&window.scrollTo(window.scrollX,pe.offsetTop);return}}),[2]}})})},Be=M(190),ht=M(580),mt=(function(){function I(){}return I.adapterRender=A,I.previewImage=Be.E,I.codeRender=l.O,I.graphvizRender=p.v,I.highlightRender=m.s,I.mathRender=v.H,I.mermaidRender=b.i,I.SMILESRender=g.J,I.markmapRender=s.K,I.flowchartRender=y.P,I.chartRender=c.p,I.abcRender=D.Q,I.mindmapRender=C.P,I.plantumlRender=x.B,I.outlineRender=_.k,I.mediaRender=w.Y,I.speechRender=de,I.lazyLoadImageRender=d,I.md2html=Se,I.preview=k,I.setCodeTheme=ht.Y,I.setContentTheme=P.Z,I})();const qe=mt}),145:((Z,E,M)=>{M.d(E,{H:()=>D,g:()=>A});var D="3.11.2",A=(function(){function c(){}return c.ZWSP="",c.DROP_EDITOR="application/editor",c.MOBILE_WIDTH=520,c.CLASS_MENU_DISABLED="vditor-menu--disabled",c.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],c.CODE_THEME=["a11y-dark","agate","an-old-hope","androidstudio","arta","atom-one-dark","atom-one-dark-reasonable","base16/3024","base16/apathy","base16/apprentice","base16/ashes","base16/atelier-cave","base16/atelier-dune","base16/atelier-estuary","base16/atelier-forest","base16/atelier-heath","base16/atelier-lakeside","base16/atelier-plateau","base16/atelier-savanna","base16/atelier-seaside","base16/atelier-sulphurpool","base16/atlas","base16/bespin","base16/black-metal","base16/black-metal-bathory","base16/black-metal-burzum","base16/black-metal-dark-funeral","base16/black-metal-gorgoroth","base16/black-metal-immortal","base16/black-metal-khold","base16/black-metal-marduk","base16/black-metal-mayhem","base16/black-metal-nile","base16/black-metal-venom","base16/brewer","base16/bright","base16/brogrammer","base16/brush-trees-dark","base16/chalk","base16/circus","base16/classic-dark","base16/codeschool","base16/colors","base16/danqing","base16/darcula","base16/dark-violet","base16/darkmoss","base16/darktooth","base16/decaf","base16/default-dark","base16/dracula","base16/edge-dark","base16/eighties","base16/embers","base16/equilibrium-dark","base16/equilibrium-gray-dark","base16/espresso","base16/eva","base16/eva-dim","base16/flat","base16/framer","base16/gigavolt","base16/google-dark","base16/grayscale-dark","base16/green-screen","base16/gruvbox-dark-hard","base16/gruvbox-dark-medium","base16/gruvbox-dark-pale","base16/gruvbox-dark-soft","base16/hardcore","base16/harmonic16-dark","base16/heetch-dark","base16/helios","base16/hopscotch","base16/horizon-dark","base16/humanoid-dark","base16/ia-dark","base16/icy-dark","base16/ir-black","base16/isotope","base16/kimber","base16/london-tube","base16/macintosh","base16/marrakesh","base16/materia","base16/material","base16/material-darker","base16/material-palenight","base16/material-vivid","base16/mellow-purple","base16/mocha","base16/monokai","base16/nebula","base16/nord","base16/nova","base16/ocean","base16/oceanicnext","base16/onedark","base16/outrun-dark","base16/papercolor-dark","base16/paraiso","base16/pasque","base16/phd","base16/pico","base16/pop","base16/porple","base16/qualia","base16/railscasts","base16/rebecca","base16/ros-pine","base16/ros-pine-moon","base16/sandcastle","base16/seti-ui","base16/silk-dark","base16/snazzy","base16/solar-flare","base16/solarized-dark","base16/spacemacs","base16/summercamp","base16/summerfruit-dark","base16/synth-midnight-terminal-dark","base16/tango","base16/tender","base16/tomorrow-night","base16/twilight","base16/unikitty-dark","base16/vulcan","base16/windows-10","base16/windows-95","base16/windows-high-contrast","base16/windows-nt","base16/woodland","base16/xcode-dusk","base16/zenburn","codepen-embed","dark","devibeans","far","felipec","github-dark","github-dark-dimmed","gml","gradient-dark","hybrid","ir-black","isbl-editor-dark","kimbie-dark","lioshi","monokai","monokai-sublime","night-owl","nnfx-dark","nord","obsidian","panda-syntax-dark","paraiso-dark","pojoaque","qtcreator-dark","rainbow","shades-of-purple","srcery","stackoverflow-dark","sunburst","tomorrow-night-blue","tomorrow-night-bright","tokyo-night-dark","vs2015","xt256","ant-design","a11y-light","arduino-light","ascetic","atom-one-light","base16/atelier-cave-light","base16/atelier-dune-light","base16/atelier-estuary-light","base16/atelier-forest-light","base16/atelier-heath-light","base16/atelier-lakeside-light","base16/atelier-plateau-light","base16/atelier-savanna-light","base16/atelier-seaside-light","base16/atelier-sulphurpool-light","base16/brush-trees","base16/classic-light","base16/cupcake","base16/cupertino","base16/default-light","base16/dirtysea","base16/edge-light","base16/equilibrium-gray-light","base16/equilibrium-light","base16/fruit-soda","base16/github","base16/google-light","base16/grayscale-light","base16/gruvbox-light-hard","base16/gruvbox-light-medium","base16/gruvbox-light-soft","base16/harmonic16-light","base16/heetch-light","base16/humanoid-light","base16/horizon-light","base16/ia-light","base16/material-lighter","base16/mexico-light","base16/one-light","base16/papercolor-light","base16/ros-pine-dawn","base16/sagelight","base16/shapeshifter","base16/silk-light","base16/solar-flare-light","base16/solarized-light","base16/summerfruit-light","base16/synth-midnight-terminal-light","base16/tomorrow","base16/unikitty-light","base16/windows-10-light","base16/windows-95-light","base16/windows-high-contrast-light","brown-paper","base16/windows-nt-light","color-brewer","docco","foundation","github","googlecode","gradient-light","grayscale","idea","intellij-light","isbl-editor-light","kimbie-light","lightfair","magula","mono-blue","nnfx-light","panda-syntax-light","paraiso-light","purebasic","qtcreator-light","routeros","school-book","stackoverflow-light","tokyo-night-light","vs","xcode","default"],c.ALIAS_CODE_LANGUAGES=["abc","plantuml","mermaid","flowchart","echarts","mindmap","graphviz","math","markmap","smiles","js","ts","html","toml","c#","bat"],c.CDN="https://unpkg.com/vditor@".concat("3.11.2"),c.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c})()}),825:((Z,E,M)=>{M.d(E,{J:()=>y});var D=M(145),A=M(413),c=M(840),l=M(494),y=function(p,m,d){p===void 0&&(p=document),m===void 0&&(m=D.g.CDN);var v=c.SMILESRenderAdapter.getElements(p);v.length>0&&(0,A.G)("".concat(m,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var w=new SmiDrawer({},{});v.forEach(function(b){var g=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),w.draw(g,"#"+s,d==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}}),135:((Z,E,M)=>{M.d(E,{Q:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=D.g.CDN);var m=c.abcRenderAdapter.getElements(y);m.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){m.forEach(function(d){d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre")||d.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(d,c.abcRenderAdapter.getCode(d).trim()),d.style.overflowX="auto",d.setAttribute("data-processed","true"))})})}}),840:((Z,E,M)=>{M.r(E),M.d(E,{mathRenderAdapter:()=>D,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>y,chartRenderAdapter:()=>p,abcRenderAdapter:()=>m,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var D={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},y={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},m={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},d={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},w={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}}),775:((Z,E,M)=>{M.d(E,{p:()=>m});var D=M(145),A=M(413),c=M(840),l=M(494),y=function(d,v,w,b){function g(s){return s instanceof w?s:new w(function(C){C(s)})}return new(w||(w=Promise))(function(s,C){function _(P){try{L(b.next(P))}catch(F){C(F)}}function x(P){try{L(b.throw(P))}catch(F){C(F)}}function L(P){P.done?s(P.value):g(P.value).then(_,x)}L((b=b.apply(d,v||[])).next())})},p=function(d,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,g,s,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(L){return function(P){return x([L,P])}}function x(L){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,L[0]&&(w=0)),w;)try{if(b=1,g&&(s=L[0]&2?g.return:L[0]?g.throw||((s=g.return)&&s.call(g),0):g.next)&&!(s=s.call(g,L[1])).done)return s;switch(g=0,s&&(L=[L[0]&2,s.value]),L[0]){case 0:case 1:s=L;break;case 4:return w.label++,{value:L[1],done:!1};case 5:w.label++,g=L[1],L=[0];continue;case 7:L=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(L[0]===6||L[0]===2)){w=0;continue}if(L[0]===3&&(!s||L[1]>s[0]&&L[1]<s[3])){w.label=L[1];break}if(L[0]===6&&w.label<s[1]){w.label=s[1],s=L;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(L);break}s[2]&&w.ops.pop(),w.trys.pop();continue}L=v.call(d,w)}catch(P){L=[6,P],g=0}finally{b=s=0}if(L[0]&5)throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}},m=function(d,v,w){d===void 0&&(d=document),v===void 0&&(v=D.g.CDN);var b=c.chartRenderAdapter.getElements(d);b.length>0&&(0,A.G)("".concat(v,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(g){return y(void 0,void 0,void 0,function(){var s,C,_;return p(this,function(x){switch(x.label){case 0:if(g.parentElement.classList.contains("vditor-wysiwyg__pre")||g.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(g).trim(),!s)return[2];x.label=1;case 1:return x.trys.push([1,3,,4]),g.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return C=x.sent(),echarts.init(g,w==="dark"?"dark":void 0).setOption(C),g.setAttribute("data-processed","true"),[3,4];case 3:return _=x.sent(),g.className="vditor-reset--error",g.innerHTML="echarts render error: <br>".concat(_),[3,4];case 4:return[2]}})})})})}}),428:((Z,E,M)=>{M.d(E,{O:()=>c});var D=M(105),A=M(145),c=function(l,y){Array.from(l.querySelectorAll("pre > code")).filter(function(p,m){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&m>5)}).forEach(function(p){var m,d,v,w=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(_){_.remove()}),w=b.innerText}else w.endsWith(`
|
|
31
31
|
`)&&(w=w.substr(0,w.length-1));var g='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(g='<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(((m=window.VditorI18n)===null||m===void 0?void 0:m.copy)||"复制",`"
|
|
32
32
|
onmouseover="this.setAttribute('aria-label', '`).concat(((d=window.VditorI18n)===null||d===void 0?void 0:d.copy)||"复制",`')"
|
|
33
33
|
class="vditor-tooltipped vditor-tooltipped__w"
|
|
34
|
-
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((v=window.VditorI18n)===null||v===void 0?void 0:v.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(g,"</span>");var C=document.createElement("textarea");C.value=(0,
|
|
35
|
-
`,z=' style="height:'.concat(C.getBoundingClientRect().height,'px"')),
|
|
34
|
+
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((v=window.VditorI18n)===null||v===void 0?void 0:v.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(g,"</span>");var C=document.createElement("textarea");C.value=(0,D.X)(w),s.insertAdjacentElement("afterbegin",C),y&&y.renderMenu&&y.renderMenu(p,s),p.before(s),p.style.maxHeight=window.outerHeight-40+"px",p.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(A.g.ZWSP,"</span>"))})}}),325:((Z,E,M)=>{M.d(E,{P:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p){p===void 0&&(p=D.g.CDN);var m=c.flowchartRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){m.forEach(function(d){if(d.getAttribute("data-processed")!=="true"){var v=flowchart.parse(c.flowchartRenderAdapter.getCode(d));d.innerHTML="",v.drawSVG(d),d.setAttribute("data-processed","true")}})})}}),483:((Z,E,M)=>{M.d(E,{v:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p){p===void 0&&(p=D.g.CDN);var m=c.graphvizRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){m.forEach(function(d){var v=c.graphvizRenderAdapter.getCode(d);if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(d.getAttribute("data-processed")==="true"||v.trim()==="")){try{var w=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),b=window.URL||window.webkitURL,g=b.createObjectURL(w),s=new Worker(g);new Viz({worker:s}).renderSVGElement(v).then(function(C){d.innerHTML=C.outerHTML}).catch(function(C){d.innerHTML="graphviz render error: <br>".concat(C),d.className="vditor-reset--error"})}catch(C){console.error("graphviz error",C)}d.setAttribute("data-processed","true")}})})}}),999:((Z,E,M)=>{M.d(E,{s:()=>l});var D=M(145),A=M(413),c=M(290),l=function(y,p,m){p===void 0&&(p=document),m===void 0&&(m=D.g.CDN);var d=y.style;D.g.CODE_THEME.includes(d)||(d="github");var v=document.getElementById("vditorHljsStyle"),w="".concat(m,"/dist/js/highlight.js/styles/").concat(d,".min.css");if(v&&v.getAttribute("href")!==w&&v.remove(),(0,c.c)("".concat(m,"/dist/js/highlight.js/styles/").concat(d,".min.css"),"vditorHljsStyle"),y.enable!==!1){var b=p.querySelectorAll("pre > code");b.length!==0&&(0,A.G)("".concat(m,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,A.G)("".concat(m,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){p.querySelectorAll("pre > code").forEach(function(g){if(!(g.parentElement.classList.contains("vditor-ir__marker--pre")||g.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(g.classList.contains("language-mermaid")||g.classList.contains("language-flowchart")||g.classList.contains("language-echarts")||g.classList.contains("language-mindmap")||g.classList.contains("language-plantuml")||g.classList.contains("language-smiles")||g.classList.contains("language-abc")||g.classList.contains("language-graphviz")||g.classList.contains("language-math"))){y.defaultLang!==""&&g.className.indexOf("language-")===-1&&g.classList.add("language-"+y.defaultLang);var s=g.className.replace("language-","");if(window.hljs.getLanguage(s)||(s="plaintext"),g.innerHTML=window.hljs.highlight(g.textContent,{language:s,ignoreIllegals:!0}).value,g.classList.add("hljs"),!!y.lineNumber){g.classList.add("vditor-linenumber");var C=g.querySelector(".vditor-linenumber__temp");C||(C=document.createElement("div"),C.className="vditor-linenumber__temp",g.insertAdjacentElement("beforeend",C));var _=getComputedStyle(g).whiteSpace,x=!1;(_==="pre-wrap"||_==="pre-line")&&(x=!0);var L="",P=g.textContent.split(/\r\n|\r|\n/g);P.pop(),P.map(function(F){var z="";x&&(C.textContent=F||`
|
|
35
|
+
`,z=' style="height:'.concat(C.getBoundingClientRect().height,'px"')),L+="<span".concat(z,"></span>")}),C.style.display="none",L='<span class="vditor-linenumber__rows">'.concat(L,"</span>"),g.insertAdjacentHTML("beforeend",L)}}})})})}}}),11:((Z,E,M)=>{M.d(E,{K:()=>m});var D=M(145),A=M(413),c=M(840),l={},y=function(d,v){var w=d.transform(v),b=Object.keys(w.features).filter(function(x){return!l[x]});b.forEach(function(x){l[x]=!0});var g=d.getAssets(b),s=g.styles,C=g.scripts,_=window.markmap;return s&&_.loadCSS(s),C&&_.loadJS(C),w},p=function(d,v){var w=window.markmap,b=w.Transformer,g=w.Markmap,s=w.deriveOptions;w.globalCSS;var C=new b;d.innerHTML='<svg style="width:100%"></svg>';var _=d.firstChild,x=g.create(_,null),L=y(C,v),P=L.root,F=L.frontmatter,z=F?.markmap,Q=s(z);x.setData(P,Q),x.fit()},m=function(d,v){d===void 0&&(d=document),v===void 0&&(v=D.g.CDN);var w=c.markmapRenderAdapter.getElements(d);w.length!==0&&(0,A.G)("".concat(v,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){w.forEach(function(b){var g=c.markmapRenderAdapter.getCode(b);if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var s=document.createElement("div");s.className="language-markmap",b.parentNode.appendChild(s),p(s,g),b.parentNode.childNodes[0].nodeName=="CODE"&&b.parentNode.removeChild(b.parentNode.childNodes[0])}})})}}),472:((Z,E,M)=>{M.d(E,{H:()=>p});var D=M(145),A=M(413),c=M(290),l=M(105),y=M(840),p=function(m,d){m===void 0&&(m=document);var v=y.mathRenderAdapter.getElements(m);if(v.length!==0){var w={cdn:D.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(d&&d.math&&(d.math=Object.assign({},w.math,d.math)),d=Object.assign({},w,d),d.math.engine==="KaTeX")(0,c.c)("".concat(d.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,A.G)("".concat(d.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,A.G)("".concat(d.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){v.forEach(function(s){if(!(s.parentElement.classList.contains("vditor-wysiwyg__pre")||s.parentElement.classList.contains("vditor-ir__marker--pre"))&&!s.getAttribute("data-math")){var C=(0,l.X)(y.mathRenderAdapter.getCode(s));s.setAttribute("data-math",C);try{s.innerHTML=katex.renderToString(C,{displayMode:s.tagName==="DIV",output:"html",macros:d.math.macros})}catch(_){s.innerHTML=_.message,s.className="language-math vditor-reset--error"}s.addEventListener("copy",function(_){_.stopPropagation(),_.preventDefault();var x=_.currentTarget.closest(".language-math");_.clipboardData.setData("text/html",x.innerHTML),_.clipboardData.setData("text/plain",x.getAttribute("data-math"))})}})})});else if(d.math.engine==="MathJax"){var b=function(s){if(s.length!==0){var C=0,_=s[s.length-1],x=function(){var L=s[C++];L===_?L():L(x)};x()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(d.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:d.math.macros}},Object.assign(window.MathJax,d.math.mathJaxOptions)),(0,A.J)("".concat(d.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var g=function(s,C){var _=(0,l.X)(s.textContent).trim(),x=window.MathJax.getMetricsFor(s);x.display=s.tagName==="DIV",window.MathJax.tex2svgPromise(_,x).then(function(L){s.innerHTML="",s.setAttribute("data-math",_),s.append(L),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var P=L.querySelector('[data-mml-node="merror"]');P&&P.textContent.trim()!==""&&(s.innerHTML=P.textContent.trim(),s.className="vditor-reset--error"),C&&C()})};window.MathJax.startup.promise.then(function(){for(var s=[],C=function(x){var L=v[x];!L.parentElement.classList.contains("vditor-wysiwyg__pre")&&!L.parentElement.classList.contains("vditor-ir__marker--pre")&&!L.getAttribute("data-math")&&(0,l.X)(L.textContent).trim()&&s.push(function(P){x===v.length-1?g(L):g(L,P)})},_=0;_<v.length;_++)C(_);b(s)})}}}}),280:((Z,E,M)=>{M.d(E,{Y:()=>y});var D=M(494),A=function(p,m){p.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(m,'"></video>')),p.remove()},c=function(p,m){p.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(m,'"></audio>')),p.remove()},l=function(p,m){var d=m.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),v=m.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),w=m.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),b=m.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),g=m.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),s=m.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),C=m.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),_=m.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(d&&d[1].length===11)p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(d[1]+(d[2]?"?start="+d[2]:""),'"></iframe>')),p.remove();else if(v&&v[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(v[1],'"></iframe>')),p.remove();else if(w&&w[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(w[1],'"></iframe>')),p.remove();else if(b&&b[1])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
36
36
|
src="//coub.com/embed/`.concat(b[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),p.remove();else if(g&&g[0])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
37
37
|
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(g[0]),'"></iframe>')),p.remove();else if(s&&s[2])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
38
|
-
src="https://www.dailymotion.com/embed/video/`.concat(s[2],'"></iframe>')),p.remove();else if(m.indexOf("bilibili.com")>-1&&(m.indexOf("bvid=")>-1||C&&C[1])){var
|
|
39
|
-
<div style="text-align: left"><small>`).concat(
|
|
38
|
+
src="https://www.dailymotion.com/embed/video/`.concat(s[2],'"></iframe>')),p.remove();else if(m.indexOf("bilibili.com")>-1&&(m.indexOf("bvid=")>-1||C&&C[1])){var x={bvid:(0,D.on)("bvid",m)||C&&C[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(m.startsWith("http")?m:"https:"+m).search.split("&").forEach(function(F,z){if(F){z===0&&(F=F.substr(1));var Q=F.split("=");x[Q[0]]=Q[1]}});var L="https://player.bilibili.com/player.html?",P=Object.keys(x);P.forEach(function(F,z){L+="".concat(F,"=").concat(x[F]),z<P.length-1&&(L+="&")}),p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(L,'"></iframe>')),p.remove()}else _&&_[1]&&(p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(_[1],'"></iframe>')),p.remove())},y=function(p){p&&p.querySelectorAll("a").forEach(function(m){var d=m.getAttribute("href");d&&(d.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?A(m,d):d.match(/^.+.(mp3|wav|flac)$/)?c(m,d):l(m,d))})}}),637:((Z,E,M)=>{M.d(E,{i:()=>m});var D=M(145),A=M(413),c=M(840),l=M(494),y=function(d,v,w,b){function g(s){return s instanceof w?s:new w(function(C){C(s)})}return new(w||(w=Promise))(function(s,C){function _(P){try{L(b.next(P))}catch(F){C(F)}}function x(P){try{L(b.throw(P))}catch(F){C(F)}}function L(P){P.done?s(P.value):g(P.value).then(_,x)}L((b=b.apply(d,v||[])).next())})},p=function(d,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,g,s,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(L){return function(P){return x([L,P])}}function x(L){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,L[0]&&(w=0)),w;)try{if(b=1,g&&(s=L[0]&2?g.return:L[0]?g.throw||((s=g.return)&&s.call(g),0):g.next)&&!(s=s.call(g,L[1])).done)return s;switch(g=0,s&&(L=[L[0]&2,s.value]),L[0]){case 0:case 1:s=L;break;case 4:return w.label++,{value:L[1],done:!1};case 5:w.label++,g=L[1],L=[0];continue;case 7:L=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(L[0]===6||L[0]===2)){w=0;continue}if(L[0]===3&&(!s||L[1]>s[0]&&L[1]<s[3])){w.label=L[1];break}if(L[0]===6&&w.label<s[1]){w.label=s[1],s=L;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(L);break}s[2]&&w.ops.pop(),w.trys.pop();continue}L=v.call(d,w)}catch(P){L=[6,P],g=0}finally{b=s=0}if(L[0]&5)throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}},m=function(d,v,w){d===void 0&&(d=document),v===void 0&&(v=D.g.CDN);var b=c.mermaidRenderAdapter.getElements(d);b.length!==0&&(0,A.G)("".concat(v,"/dist/js/mermaid/mermaid.min.js?v=11.6.0"),"vditorMermaidScript").then(function(){var g={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}};w==="dark"&&(g.theme="dark"),mermaid.initialize(g),b.forEach(function(s){return y(void 0,void 0,void 0,function(){var C,_,x,L,P;return p(this,function(F){switch(F.label){case 0:if(C=c.mermaidRenderAdapter.getCode(s),s.getAttribute("data-processed")==="true"||C.trim()==="")return[2];_="mermaid"+(0,l.Wb)(),F.label=1;case 1:return F.trys.push([1,3,,4]),[4,mermaid.render(_,s.textContent)];case 2:return x=F.sent(),s.innerHTML=x.svg,[3,4];case 3:return L=F.sent(),P=document.querySelector("#"+_),s.innerHTML="".concat(P.outerHTML,`<br>
|
|
39
|
+
<div style="text-align: left"><small>`).concat(L.message.replace(/\n/,"<br>"),"</small></div>"),P.parentElement.remove(),[3,4];case 4:return s.setAttribute("data-processed","true"),[2]}})})})})}}),194:((Z,E,M)=>{M.d(E,{P:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p,m){y===void 0&&(y=document),p===void 0&&(p=D.g.CDN);var d=c.mindmapRenderAdapter.getElements(y);d.length>0&&(0,A.G)("".concat(p,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){d.forEach(function(v){if(!(v.parentElement.classList.contains("vditor-wysiwyg__pre")||v.parentElement.classList.contains("vditor-ir__marker--pre"))){var w=c.mindmapRenderAdapter.getCode(v);if(w)try{if(v.getAttribute("data-processed")==="true")return;echarts.init(v,m==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(w))],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(b,g){var s;return!((s=g?.data)===null||s===void 0)&&s.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),v.setAttribute("data-processed","true")}catch(b){v.className="vditor-reset--error",v.innerHTML="mindmap render error: <br>".concat(b)}}})})}}),436:((Z,E,M)=>{M.d(E,{k:()=>c});var D=M(771),A=M(472),c=function(l,y,p){var m="",d=[];if(Array.from(l.children).forEach(function(g,s){if((0,D.W)(g)){if(p){var C=g.id.lastIndexOf("_");g.id=g.id.substring(0,C===-1?void 0:C)+"_"+s}d.push(g.id),m+=g.outerHTML.replace("<wbr>","")}}),m==="")return y.innerHTML="","";var v=document.createElement("div");if(p)p.lute.SetToC(!0),p.currentMode==="wysiwyg"&&!p.preview.element.contains(l)?v.innerHTML=p.lute.SpinVditorDOM("<p>[ToC]</p>"+m):p.currentMode==="ir"&&!p.preview.element.contains(l)?v.innerHTML=p.lute.SpinVditorIRDOM("<p>[ToC]</p>"+m):v.innerHTML=p.lute.HTML2VditorDOM("<p>[ToC]</p>"+m),p.lute.SetToC(p.options.preview.markdown.toc);else{y.classList.add("vditor-outline");var w=Lute.New();w.SetToC(!0),v.innerHTML=w.HTML2VditorDOM("<p>[ToC]</p>"+m)}var b=v.firstElementChild.querySelectorAll("li > span[data-target-id]");return b.forEach(function(g,s){if(g.nextElementSibling&&g.nextElementSibling.tagName==="UL"){var C="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(C='<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>'),g.innerHTML="".concat(C,"<span>").concat(g.innerHTML,"</span>")}else g.innerHTML="<svg></svg><span>".concat(g.innerHTML,"</span>");g.setAttribute("data-target-id",d[s])}),m=v.firstElementChild.innerHTML,b.length===0?(y.innerHTML="",m):(y.innerHTML=m,p&&(0,A.H)(y,{cdn:p.options.cdn,math:p.options.preview.math}),y.firstElementChild.addEventListener("click",function(g){for(var s=g.target;s&&!s.isEqualNode(y);){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")),g.preventDefault(),g.stopPropagation();break}else if(s.getAttribute("data-target-id")){g.preventDefault(),g.stopPropagation();var C=document.getElementById(s.getAttribute("data-target-id"));if(!C)return;if(p)if(p.options.height==="auto"){var _=C.offsetTop+p.element.offsetTop;p.options.toolbarConfig.pin||(_+=p.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,_)}else p.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,p.element.offsetTop),p.preview.element.contains(l)?l.parentElement.scrollTop=C.offsetTop:l.scrollTop=C.offsetTop;else window.scrollTo(window.scrollX,C.offsetTop);break}s=s.parentElement}}),m)}}),229:((Z,E,M)=>{M.d(E,{B:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=D.g.CDN);var m=c.plantumlRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then(function(){m.forEach(function(d){if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))){var v=c.plantumlRenderAdapter.getCode(d).trim();if(v)try{d.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(v),'"/>')}catch(w){d.className="vditor-reset--error",d.innerHTML="plantuml render error: <br>".concat(w)}}})})}}),214:((Z,E,M)=>{M.d(E,{X:()=>D});var D=function(A){var c=Lute.New();return c.PutEmojis(A.emojis),c.SetEmojiSite(A.emojiSite),c.SetHeadingAnchor(A.headingAnchor),c.SetInlineMathAllowDigitAfterOpenMarker(A.inlineMathDigit),c.SetAutoSpace(A.autoSpace),c.SetToC(A.toc),c.SetFootnotes(A.footnotes),c.SetFixTermTypo(A.fixTermTypo),c.SetVditorCodeBlockPreview(A.codeBlockPreview),c.SetVditorMathBlockPreview(A.mathBlockPreview),c.SetSanitize(A.sanitize),c.SetChineseParagraphBeginningSpace(A.paragraphBeginningSpace),c.SetRenderListStyle(A.listStyle),c.SetLinkBase(A.linkBase),c.SetLinkPrefix(A.linkPrefix),c.SetMark(A.mark),c.SetGFMAutoLink(A.gfmAutoLink),A.lazyLoadImage&&c.SetImageLazyLoading(A.lazyLoadImage),c}}),190:((Z,E,M)=>{M.d(E,{E:()=>D});var D=function(A,c,l){l===void 0&&(l="classic");var y=A.getBoundingClientRect(),p=36;document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat(l==="dark"?" vditor--dark":"",`">
|
|
40
40
|
<div class="vditor-img__bar">
|
|
41
41
|
<span class="vditor-img__btn" data-deg="0">
|
|
42
42
|
<svg><use xlink:href="#vditor-icon-redo"></use></svg>
|
|
@@ -49,38 +49,38 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
49
49
|
<div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|
50
50
|
<img style="width: `).concat(A.width,"px;height:").concat(A.height,"px;transform: translate3d(").concat(y.left,"px, ").concat(y.top-p,'px, 0)" src="').concat(A.getAttribute("src"),`">
|
|
51
51
|
</div>
|
|
52
|
-
</div>`)),document.body.style.overflow="hidden";var m=document.querySelector(".vditor-img img"),d="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){m.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(d)),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)});var v=document.querySelector(".vditor-img__btn");v.addEventListener("click",function(){var w=parseInt(v.getAttribute("data-deg"),10)+90;w/90%2===1&&A.naturalWidth>m.parentElement.clientHeight?m.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(w,"deg)"):m.style.transform="".concat(d," rotateZ(").concat(w,"deg)"),v.setAttribute("data-deg",w.toString()),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)})}}),580:((Z,E,L)=>{L.d(E,{Y:()=>c});var x=L(145),A=L(290),c=function(l,y){y===void 0&&(y=x.g.CDN),x.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),m="".concat(y,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==m&&(p.remove(),(0,A.c)(m,"vditorHljsStyle")):(0,A.c)(m,"vditorHljsStyle")}}),538:((Z,E,L)=>{L.d(E,{Z:()=>A});var x=L(290),A=function(c,l){if(!(!c||!l)){var y=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");y?y.getAttribute("href")!==p&&(y.remove(),(0,x.c)(p,"vditorContentTheme")):(0,x.c)(p,"vditorContentTheme")}}}),413:((Z,E,L)=>{L.d(E,{J:()=>x,G:()=>A});var x=function(c,l){if(document.getElementById(l))return!1;var y=new XMLHttpRequest;y.open("GET",c,!1),y.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),y.send("");var p=document.createElement("script");p.type="text/javascript",p.text=y.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(y,p){if(document.getElementById(l))return y(!0),!1;var m=document.createElement("script");m.src=c,m.async=!0,document.head.appendChild(m),m.onerror=function(d){p(d)},m.onload=function(){if(document.getElementById(l))return m.remove(),y(!0),!1;m.id=l,y(!0)}})}}),290:((Z,E,L)=>{L.d(E,{c:()=>x});var x=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}}),105:((Z,E,L)=>{L.d(E,{X:()=>x});var x=function(A){return A.replace(/\u00a0/g," ")}}),410:((Z,E,L)=>{L.d(E,{G6:()=>x,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>y,ns:()=>p,i7:()=>m});var x=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},y=function(d){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(d.metaKey&&!d.ctrlKey):!!(!d.metaKey&&d.ctrlKey)},p=function(d){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?d.indexOf("⇧")>-1&&A()&&(d=d.replace(";",":").replace("=","+").replace("-","_")):(d.startsWith("⌘")?d=d.replace("⌘","⌘+"):d.startsWith("⌥")&&d.substr(1,1)!=="⌘"?d=d.replace("⌥","⌥+"):d=d.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),d=d.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),d.indexOf("Shift")>-1&&(d=d.replace(";",":").replace("=","+").replace("-","_"))),d},m=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((Z,E,L)=>{L.d(E,{Wb:()=>x,on:()=>A,Qf:()=>c});var x=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,y){y===void 0&&(y=window.location.search);var p=y.substring(y.indexOf("?")),m=p.indexOf("#"),d=new URLSearchParams(p.substring(0,m>=0?m:void 0));return d.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}}),106:((Z,E,L)=>{L.d(E,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>y,F9:()=>p,lG:()=>m,fb:()=>d,DX:()=>v});var x=L(771),A=function(w,b){for(var g=d(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=d(g.parentElement,b),s?g=s:C=!0;return g||!1},c=function(w,b){for(var g=(0,x.S)(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=(0,x.S)(g.parentElement,b),s?g=s:C=!0;return g||!1},l=function(w){var b=c(w,"UL"),g=c(w,"OL"),s=b;return g&&(!b||b&&g.contains(b))&&(s=g),s},y=function(w,b,g){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var s=w,C=!1;s&&!C&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===g?C=!0:s=s.parentElement;return C&&s},p=function(w){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);var b=w,g=!1,s=y(w,"data-block","0");if(s)return s;for(;b&&!g&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?g=!0:b=b.parentElement;return g&&b},m=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},d=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.classList.contains(b)?s=!0:g=g.parentElement;return s&&g},v=function(w){for(;w&&w.lastChild;)w=w.lastChild;return w}}),771:((Z,E,L)=>{L.d(E,{S:()=>x,W:()=>A});var x=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var y=c,p=!1;y&&!p&&!y.classList.contains("vditor-reset");)y.nodeName.indexOf(l)===0?p=!0:y=y.parentElement;return p&&y},A=function(c){var l=x(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}}),673:((Z,E,L)=>{L.d(E,{T:()=>x});var x=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},y=function(m){for(var d in m)m.hasOwnProperty(d)&&(Object.prototype.toString.call(m[d])==="[object Object]"?l[d]=x(l[d],m[d]):l[d]=m[d])},p=0;p<A.length;p++)y(A[p]);return l}}),810:((Z,E,L)=>{L.d(E,{zh:()=>l,Ny:()=>y,Gb:()=>p,Hc:()=>m,im:()=>d,$j:()=>v,ib:()=>w,oC:()=>b});var x=L(145),A=L(410),c=L(106),l=function(g){var s,C=g[g.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),C.isEqualNode(s.startContainer)||C.contains(s.startContainer))?s:g[g.currentMode].range?g[g.currentMode].range:(C.focus(),s=C.ownerDocument.createRange(),s.setStart(C,0),s.collapse(!0),s)},y=function(g){var s=window.getSelection().getRangeAt(0);if(!g.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var C=g.parentElement.getBoundingClientRect(),_;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var D=s.startContainer.parentElement;if(D&&D.getClientRects().length>0)_=D.getClientRects()[0];else return{left:0,top:0}}else{var M=s.startContainer.children;if(M[s.startOffset]&&M[s.startOffset].getClientRects().length>0)_=M[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var P=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),_=s.getClientRects()[0],s.setEnd(P.endContainer,P.endOffset),s.setStart(P.startContainer,P.startOffset)}else _=s.startContainer.getClientRects()[0];if(!_){for(var F=s.startContainer.childNodes[s.startOffset];!F.getClientRects||F.getClientRects&&F.getClientRects().length===0;)F=F.parentElement;_=F.getClientRects()[0]}}else _=s.getClientRects()[0];return{left:_.left-C.left,top:_.top-C.top}},p=function(g,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var C=s.commonAncestorContainer;return g.isEqualNode(C)||g.contains(C)},m=function(g){var s=window.getSelection();s.removeAllRanges(),s.addRange(g)},d=function(g,s,C){var _={end:0,start:0};if(!C){if(getSelection().rangeCount===0)return _;C=window.getSelection().getRangeAt(0)}if(p(s,C)){var D=C.cloneRange();g.childNodes[0]&&g.childNodes[0].childNodes[0]?D.setStart(g.childNodes[0].childNodes[0],0):D.selectNodeContents(g),D.setEnd(C.startContainer,C.startOffset),_.start=D.toString().length,_.end=_.start+C.toString().length}return _},v=function(g,s,C){var _=0,D=0,M=C.childNodes[D],P=!1,F=!1;g=Math.max(0,g),s=Math.max(0,s);var z=C.ownerDocument.createRange();for(z.setStart(M||C,0),z.collapse(!0);!F&&M;){var $=_+M.textContent.length;if(!P&&g>=_&&g<=$&&(g===0?z.setStart(M,0):M.childNodes[0].nodeType===3?z.setStart(M.childNodes[0],g-_):M.nextSibling?z.setStartBefore(M.nextSibling):z.setStartAfter(M),P=!0,g===s)){F=!0;break}P&&s>=_&&s<=$&&(s===0?z.setEnd(M,0):M.childNodes[0].nodeType===3?z.setEnd(M.childNodes[0],s-_):M.nextSibling?z.setEndBefore(M.nextSibling):z.setEndAfter(M),F=!0),_=$,M=C.childNodes[++D]}return!F&&C.childNodes[D-1]&&z.setStartBefore(C.childNodes[D-1]),m(z),z},w=function(g,s){var C=g.querySelector("wbr");if(C){if(!C.previousElementSibling)C.previousSibling?s.setStart(C.previousSibling,C.previousSibling.textContent.length):C.nextSibling?C.nextSibling.nodeType===3?s.setStart(C.nextSibling,0):s.setStartBefore(C.nextSibling):s.setStart(C.parentElement,0);else if(C.previousElementSibling.isSameNode(C.previousSibling))if(C.previousElementSibling.lastChild){s.setStartBefore(C),s.collapse(!0),m(s),(0,A.i7)()&&(C.previousElementSibling.tagName==="EM"||C.previousElementSibling.tagName==="STRONG"||C.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(x.g.ZWSP)),s.collapse(!1)),C.remove();return}else s.setStartAfter(C.previousElementSibling);else s.setStart(C.previousSibling,C.previousSibling.textContent.length);s.collapse(!0),C.remove(),m(s)}},b=function(g,s){var C=document.createElement("div");C.innerHTML=g;var _=C.querySelectorAll("p");_.length===1&&!_[0].previousSibling&&!_[0].nextSibling&&s[s.currentMode].element.children.length>0&&C.firstElementChild.tagName==="P"&&(g=_[0].innerHTML.trim());var D=document.createElement("div");D.innerHTML=g;var M=l(s);if(M.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),D.firstElementChild&&D.firstElementChild.getAttribute("data-block")==="0"){D.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var P=(0,c.F9)(M.startContainer);if(!P)s[s.currentMode].element.insertAdjacentHTML("beforeend",D.innerHTML);else{var F=(0,c.lG)(M.startContainer,"LI");F&&D.firstElementChild.tagName==="UL"?F.insertAdjacentHTML("afterend",D.firstElementChild.innerHTML):P.insertAdjacentHTML("afterend",D.innerHTML)}w(s[s.currentMode].element,M)}else{var z=document.createElement("template");z.innerHTML=g,M.insertNode(z.content.cloneNode(!0)),M.collapse(!1),m(M)}}})},rt={};function Y(Z){var E=rt[Z];if(E!==void 0)return E.exports;var L=rt[Z]={exports:{}};return pt[Z](L,L.exports,Y),L.exports}Y.d=(Z,E)=>{for(var L in E)Y.o(E,L)&&!Y.o(Z,L)&&Object.defineProperty(Z,L,{enumerable:!0,get:E[L]})},Y.o=(Z,E)=>Object.prototype.hasOwnProperty.call(Z,E),Y.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var Te={};return(()=>{Y.d(Te,{default:()=>Li});var Z=Y(408),E=Y(145),L=Y(105),x=function(e){return e.currentMode==="sv"?(0,L.X)("".concat(e.sv.element.textContent,`
|
|
52
|
+
</div>`)),document.body.style.overflow="hidden";var m=document.querySelector(".vditor-img img"),d="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){m.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(d)),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)});var v=document.querySelector(".vditor-img__btn");v.addEventListener("click",function(){var w=parseInt(v.getAttribute("data-deg"),10)+90;w/90%2===1&&A.naturalWidth>m.parentElement.clientHeight?m.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(w,"deg)"):m.style.transform="".concat(d," rotateZ(").concat(w,"deg)"),v.setAttribute("data-deg",w.toString()),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)})}}),580:((Z,E,M)=>{M.d(E,{Y:()=>c});var D=M(145),A=M(290),c=function(l,y){y===void 0&&(y=D.g.CDN),D.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),m="".concat(y,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==m&&(p.remove(),(0,A.c)(m,"vditorHljsStyle")):(0,A.c)(m,"vditorHljsStyle")}}),538:((Z,E,M)=>{M.d(E,{Z:()=>A});var D=M(290),A=function(c,l){if(!(!c||!l)){var y=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");y?y.getAttribute("href")!==p&&(y.remove(),(0,D.c)(p,"vditorContentTheme")):(0,D.c)(p,"vditorContentTheme")}}}),413:((Z,E,M)=>{M.d(E,{J:()=>D,G:()=>A});var D=function(c,l){if(document.getElementById(l))return!1;var y=new XMLHttpRequest;y.open("GET",c,!1),y.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),y.send("");var p=document.createElement("script");p.type="text/javascript",p.text=y.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(y,p){if(document.getElementById(l))return y(!0),!1;var m=document.createElement("script");m.src=c,m.async=!0,document.head.appendChild(m),m.onerror=function(d){p(d)},m.onload=function(){if(document.getElementById(l))return m.remove(),y(!0),!1;m.id=l,y(!0)}})}}),290:((Z,E,M)=>{M.d(E,{c:()=>D});var D=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}}),105:((Z,E,M)=>{M.d(E,{X:()=>D});var D=function(A){return A.replace(/\u00a0/g," ")}}),410:((Z,E,M)=>{M.d(E,{G6:()=>D,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>y,ns:()=>p,i7:()=>m});var D=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},y=function(d){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(d.metaKey&&!d.ctrlKey):!!(!d.metaKey&&d.ctrlKey)},p=function(d){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?d.indexOf("⇧")>-1&&A()&&(d=d.replace(";",":").replace("=","+").replace("-","_")):(d.startsWith("⌘")?d=d.replace("⌘","⌘+"):d.startsWith("⌥")&&d.substr(1,1)!=="⌘"?d=d.replace("⌥","⌥+"):d=d.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),d=d.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),d.indexOf("Shift")>-1&&(d=d.replace(";",":").replace("=","+").replace("-","_"))),d},m=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((Z,E,M)=>{M.d(E,{Wb:()=>D,on:()=>A,Qf:()=>c});var D=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,y){y===void 0&&(y=window.location.search);var p=y.substring(y.indexOf("?")),m=p.indexOf("#"),d=new URLSearchParams(p.substring(0,m>=0?m:void 0));return d.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}}),106:((Z,E,M)=>{M.d(E,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>y,F9:()=>p,lG:()=>m,fb:()=>d,DX:()=>v});var D=M(771),A=function(w,b){for(var g=d(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=d(g.parentElement,b),s?g=s:C=!0;return g||!1},c=function(w,b){for(var g=(0,D.S)(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=(0,D.S)(g.parentElement,b),s?g=s:C=!0;return g||!1},l=function(w){var b=c(w,"UL"),g=c(w,"OL"),s=b;return g&&(!b||b&&g.contains(b))&&(s=g),s},y=function(w,b,g){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var s=w,C=!1;s&&!C&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===g?C=!0:s=s.parentElement;return C&&s},p=function(w){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);var b=w,g=!1,s=y(w,"data-block","0");if(s)return s;for(;b&&!g&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?g=!0:b=b.parentElement;return g&&b},m=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},d=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.classList.contains(b)?s=!0:g=g.parentElement;return s&&g},v=function(w){for(;w&&w.lastChild;)w=w.lastChild;return w}}),771:((Z,E,M)=>{M.d(E,{S:()=>D,W:()=>A});var D=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var y=c,p=!1;y&&!p&&!y.classList.contains("vditor-reset");)y.nodeName.indexOf(l)===0?p=!0:y=y.parentElement;return p&&y},A=function(c){var l=D(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}}),673:((Z,E,M)=>{M.d(E,{T:()=>D});var D=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},y=function(m){for(var d in m)m.hasOwnProperty(d)&&(Object.prototype.toString.call(m[d])==="[object Object]"?l[d]=D(l[d],m[d]):l[d]=m[d])},p=0;p<A.length;p++)y(A[p]);return l}}),810:((Z,E,M)=>{M.d(E,{zh:()=>l,Ny:()=>y,Gb:()=>p,Hc:()=>m,im:()=>d,$j:()=>v,ib:()=>w,oC:()=>b});var D=M(145),A=M(410),c=M(106),l=function(g){var s,C=g[g.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),C.isEqualNode(s.startContainer)||C.contains(s.startContainer))?s:g[g.currentMode].range?g[g.currentMode].range:(C.focus(),s=C.ownerDocument.createRange(),s.setStart(C,0),s.collapse(!0),s)},y=function(g){var s=window.getSelection().getRangeAt(0);if(!g.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var C=g.parentElement.getBoundingClientRect(),_;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var x=s.startContainer.parentElement;if(x&&x.getClientRects().length>0)_=x.getClientRects()[0];else return{left:0,top:0}}else{var L=s.startContainer.children;if(L[s.startOffset]&&L[s.startOffset].getClientRects().length>0)_=L[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var P=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),_=s.getClientRects()[0],s.setEnd(P.endContainer,P.endOffset),s.setStart(P.startContainer,P.startOffset)}else _=s.startContainer.getClientRects()[0];if(!_){for(var F=s.startContainer.childNodes[s.startOffset];!F.getClientRects||F.getClientRects&&F.getClientRects().length===0;)F=F.parentElement;_=F.getClientRects()[0]}}else _=s.getClientRects()[0];return{left:_.left-C.left,top:_.top-C.top}},p=function(g,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var C=s.commonAncestorContainer;return g.isEqualNode(C)||g.contains(C)},m=function(g){var s=window.getSelection();s.removeAllRanges(),s.addRange(g)},d=function(g,s,C){var _={end:0,start:0};if(!C){if(getSelection().rangeCount===0)return _;C=window.getSelection().getRangeAt(0)}if(p(s,C)){var x=C.cloneRange();g.childNodes[0]&&g.childNodes[0].childNodes[0]?x.setStart(g.childNodes[0].childNodes[0],0):x.selectNodeContents(g),x.setEnd(C.startContainer,C.startOffset),_.start=x.toString().length,_.end=_.start+C.toString().length}return _},v=function(g,s,C){var _=0,x=0,L=C.childNodes[x],P=!1,F=!1;g=Math.max(0,g),s=Math.max(0,s);var z=C.ownerDocument.createRange();for(z.setStart(L||C,0),z.collapse(!0);!F&&L;){var Q=_+L.textContent.length;if(!P&&g>=_&&g<=Q&&(g===0?z.setStart(L,0):L.childNodes[0].nodeType===3?z.setStart(L.childNodes[0],g-_):L.nextSibling?z.setStartBefore(L.nextSibling):z.setStartAfter(L),P=!0,g===s)){F=!0;break}P&&s>=_&&s<=Q&&(s===0?z.setEnd(L,0):L.childNodes[0].nodeType===3?z.setEnd(L.childNodes[0],s-_):L.nextSibling?z.setEndBefore(L.nextSibling):z.setEndAfter(L),F=!0),_=Q,L=C.childNodes[++x]}return!F&&C.childNodes[x-1]&&z.setStartBefore(C.childNodes[x-1]),m(z),z},w=function(g,s){var C=g.querySelector("wbr");if(C){if(!C.previousElementSibling)C.previousSibling?s.setStart(C.previousSibling,C.previousSibling.textContent.length):C.nextSibling?C.nextSibling.nodeType===3?s.setStart(C.nextSibling,0):s.setStartBefore(C.nextSibling):s.setStart(C.parentElement,0);else if(C.previousElementSibling.isSameNode(C.previousSibling))if(C.previousElementSibling.lastChild){s.setStartBefore(C),s.collapse(!0),m(s),(0,A.i7)()&&(C.previousElementSibling.tagName==="EM"||C.previousElementSibling.tagName==="STRONG"||C.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(D.g.ZWSP)),s.collapse(!1)),C.remove();return}else s.setStartAfter(C.previousElementSibling);else s.setStart(C.previousSibling,C.previousSibling.textContent.length);s.collapse(!0),C.remove(),m(s)}},b=function(g,s){var C=document.createElement("div");C.innerHTML=g;var _=C.querySelectorAll("p");_.length===1&&!_[0].previousSibling&&!_[0].nextSibling&&s[s.currentMode].element.children.length>0&&C.firstElementChild.tagName==="P"&&(g=_[0].innerHTML.trim());var x=document.createElement("div");x.innerHTML=g;var L=l(s);if(L.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),x.firstElementChild&&x.firstElementChild.getAttribute("data-block")==="0"){x.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var P=(0,c.F9)(L.startContainer);if(!P)s[s.currentMode].element.insertAdjacentHTML("beforeend",x.innerHTML);else{var F=(0,c.lG)(L.startContainer,"LI");F&&x.firstElementChild.tagName==="UL"?F.insertAdjacentHTML("afterend",x.firstElementChild.innerHTML):P.insertAdjacentHTML("afterend",x.innerHTML)}w(s[s.currentMode].element,L)}else{var z=document.createElement("template");z.innerHTML=g,L.insertNode(z.content.cloneNode(!0)),L.collapse(!1),m(L)}}})},rt={};function Y(Z){var E=rt[Z];if(E!==void 0)return E.exports;var M=rt[Z]={exports:{}};return pt[Z](M,M.exports,Y),M.exports}Y.d=(Z,E)=>{for(var M in E)Y.o(E,M)&&!Y.o(Z,M)&&Object.defineProperty(Z,M,{enumerable:!0,get:E[M]})},Y.o=(Z,E)=>Object.prototype.hasOwnProperty.call(Z,E),Y.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var Me={};return(()=>{Y.d(Me,{default:()=>Li});var Z=Y(408),E=Y(145),M=Y(105),D=function(e){return e.currentMode==="sv"?(0,M.X)("".concat(e.sv.element.textContent,`
|
|
53
53
|
`).replace(/\n\n$/,`
|
|
54
|
-
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=Y(413),c=(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,A.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(
|
|
55
|
-
<p class="p1">`)===0&&(i=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var o=t||e;return/\n/.test(o)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(o.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(o,"`")}return!1},
|
|
54
|
+
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=Y(413),c=(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,A.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(D(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})(),l=Y(410),y=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")}})},p=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")}})},m=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.remove(E.g.CLASS_MENU_DISABLED)}})},d=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.add(E.g.CLASS_MENU_DISABLED)}})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},w=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},b=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")},g=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(E.g.CLASS_MENU_DISABLED)&&(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach(function(a){a.classList.remove("vditor-hint--current")}),t.style.display==="block"?t.style.display="none":(b(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=Y(106),C=Y(771),_=function(e,t,n,r){r&&console.log("".concat(e," - ").concat(n,": ").concat(t))},x=Y(135),L=Y(775),P=Y(428),F=Y(325),z=Y(483),Q=Y(999),ne=Y(472),oe=Y(637),ge=Y(11),de=Y(194),le=Y(229),Ee=Y(825),_e=function(e,t,n){n===void 0&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var i=!1;r.childElementCount===1&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(i=!0);var a=r.querySelectorAll("pre");if(r.childElementCount===1&&a.length===1&&a[0].className!=="vditor-wysiwyg"&&a[0].className!=="vditor-sv"&&(i=!0),e.indexOf(`
|
|
55
|
+
<p class="p1">`)===0&&(i=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var o=t||e;return/\n/.test(o)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(o.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(o,"`")}return!1},Se=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,x.Q)(e,t.options.cdn);else if(n==="mermaid")(0,oe.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,Ee.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,ge.K)(e,t.options.cdn);else if(n==="flowchart")(0,F.P)(e,t.options.cdn);else if(n==="echarts")(0,L.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,de.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,le.B)(e,t.options.cdn);else if(n==="graphviz")(0,z.v)(e,t.options.cdn);else if(n==="math")(0,ne.H)(e,{cdn:t.options.cdn,math:t.options.preview.math});else{var r=t.options.customRenders.find(function(i){if(i.language===n)return i.render(e,t),!0});r||((0,Q.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,P.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},k=Y(810),Be=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,ne.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},ht=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 i=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(i+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,i)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=r.offsetTop;return}},mt=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,k.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),ee(t),!0;if(Qe(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,k.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),ee(t),!0;if(ct(t,n,r,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var i=(0,s.fb)(r.startContainer,"vditor-toc");if(i)return i.remove(),ee(t),!0}},qe=function(e,t,n,r){n===void 0&&(n=!1);var i=(0,s.F9)(t.startContainer);if(i&&!n&&i.getAttribute("data-type")!=="code-block"){if(Vt(i.innerHTML)&&i.previousElementSibling||Wt(i.innerHTML))return;for(var a=(0,k.im)(i,e.ir.element,t).start,o=!0,u=a-1;u>i.textContent.substr(0,a).lastIndexOf(`
|
|
56
56
|
`);u--)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==" "){o=!1;break}a===0&&(o=!1);for(var h=!0,u=a-1;u<i.textContent.length;u++)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==`
|
|
57
|
-
`){h=!1;break}if(o){typeof e.options.input=="function"&&e.options.input(
|
|
58
|
-
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}if(o===0&&(u=!1),u){
|
|
57
|
+
`){h=!1;break}if(o){typeof e.options.input=="function"&&e.options.input(D(e));return}if(h&&/^#{1,6} $/.test(i.textContent)&&(h=!1),h){var f=(0,s.fb)(t.startContainer,"vditor-ir__marker");if(!f){var S=t.startContainer.previousSibling;S&&S.nodeType!==3&&S.classList.contains("vditor-ir__node--expand")&&S.classList.remove("vditor-ir__node--expand"),typeof e.options.input=="function"&&e.options.input(D(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function($){$.classList.remove("vditor-ir__node--expand")}),i||(i=e.ir.element),!i.querySelector("wbr")){var T=(0,s.fb)(t.startContainer,"vditor-ir__preview");T?T.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach(function($){$.removeAttribute("style")}),i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.ir.element);var N=i.isEqualNode(e.ir.element),R=(0,s.a1)(i,"data-type","footnotes-block"),H="";if(N)H=i.innerHTML;else{var U=(0,C.S)(t.startContainer,"BLOCKQUOTE"),B=(0,s.O9)(t.startContainer);if(B&&(i=B),U&&(!B||B&&!U.contains(B))&&(i=U),R&&(i=R),H=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var O=i.previousElementSibling,G=i.nextElementSibling;O&&(O.tagName==="UL"||O.tagName==="OL")&&(H=O.outerHTML+H,O.remove()),G&&(G.tagName==="UL"||G.tagName==="OL")&&(H=H+G.outerHTML,G.remove()),H=H.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&i.previousElementSibling.textContent.replace(E.g.ZWSP,"")!==""&&r&&r.inputType==="insertParagraph"&&(H=i.previousElementSibling.outerHTML+H,i.previousElementSibling.remove());i.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function($){$&&!i.isEqualNode($)&&(H+=$.outerHTML,$.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function($){$&&!i.isEqualNode($)&&(H+=$.outerHTML,$.remove())}))}if(_("SpinVditorIRDOM",H,"argument",e.options.debugger),H=e.lute.SpinVditorIRDOM(H),_("SpinVditorIRDOM",H,"result",e.options.debugger),N)i.innerHTML=H;else if(i.outerHTML=H,R){var V=(0,s.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(V){var J=V.textContent,se=J.substring(1,J.indexOf("]:")),ae=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(se,'"]'));ae&&ae.setAttribute("aria-label",J.substr(se.length+3).trim().substr(0,24))}}var ue,xe=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");xe.forEach(function($,we){we===0?ue=$:(ue.insertAdjacentHTML("beforeend",$.innerHTML),$.remove())}),xe.length>0&&e.ir.element.insertAdjacentElement("beforeend",xe[0]);var Te,De=e.ir.element.querySelectorAll("[data-type='footnotes-block']");De.forEach(function($,we){we===0?Te=$:(Te.insertAdjacentHTML("beforeend",$.innerHTML),$.remove())}),De.length>0&&e.ir.element.insertAdjacentElement("beforeend",De[0]),(0,k.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function($){Se($,e)}),Be(e),We(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},I=function(e,t){if(e==="")return!1;if(e.indexOf("⇧")===-1&&e.indexOf("⌘")===-1&&e.indexOf("⌥")===-1)return!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.code===e;if(e==="⇧Tab")return!!(!(0,l.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,l.yl)(t):!(0,l.yl)(t))&&t.altKey&&!t.shiftKey&&t.code===(/^[0-9]$/.test(r)?"Digit":"Key")+r)}e==="⌘Enter"&&(n=["⌘","Enter"]);var i=n.length>2&&n[0]==="⇧",a=i?n[2]:n[1];return i&&((0,l.vU)()||!/Mac/.test(navigator.platform))&&(a==="-"?a="_":a==="="&&(a="+")),!!((0,l.yl)(t)&&t.key.toLowerCase()===a.toLowerCase()&&!t.altKey&&(!i&&!t.shiftKey||i&&t.shiftKey))},re=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")&&!n.getAttribute("data-block"))return n}else{var r=(0,s.fb)(t,"vditor-ir__marker");if(r&&!r.nextSibling){var i=t.parentElement.parentElement.nextSibling;if(i&&i.nodeType!==3&&i.classList.contains("vditor-ir__node"))return i}return!1}return!1},W=function(e){var t=e.startContainer,n=t.previousSibling;return t.nodeType===3&&e.startOffset===0&&n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block")?n:!1},j=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(o){o.classList.remove("vditor-ir__node--expand")});var n=(0,s.JQ)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,s.JQ)(e.endContainer,"vditor-ir__node");if(!(!e.collapsed&&(!n||n!==r))){n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"),(0,k.Hc)(e));var i=re(e);if(i){i.classList.add("vditor-ir__node--expand"),i.classList.remove("vditor-ir__node--hidden");return}var a=W(e);if(a){a.classList.add("vditor-ir__node--expand"),a.classList.remove("vditor-ir__node--hidden");return}}},he=function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;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);var n=(0,k.zh)(e),r=n.startContainer;if(!un(t,e,r)||(fn(n,e,t),kn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.a1)(r,"data-newline","1");if(!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.key==="Enter"&&i&&n.startOffset<i.textContent.length){var a=i.previousElementSibling;a&&(n.insertNode(document.createTextNode(a.textContent)),n.collapse(!1));var o=i.nextSibling;o&&(n.insertNode(document.createTextNode(o.textContent)),n.collapse(!0))}var u=(0,s.lG)(r,"P");if(gn(t,e,u,n)||mn(n,e,u,t)||Cn(e,n,t,u))return!0;var h=(0,s.fb)(r,"vditor-ir__marker--pre");if(h&&h.tagName==="PRE"){var f=h.firstChild;if(Sn(e,t,h,n)||(f.getAttribute("data-type")==="math-block"||f.getAttribute("data-type")==="html-block")&&Qe(e,t,n,f,h.parentElement)||ct(e,t,n,f,h.parentElement))return!0}var S=(0,s.a1)(r,"data-type","code-block-info");if(S){if(t.key==="Enter"||t.key==="Tab")return n.selectNodeContents(S.nextElementSibling.firstChild),n.collapse(!0),t.preventDefault(),b(e,["hint"]),!0;if(t.key==="Backspace"){var T=(0,k.im)(S,e.ir.element).start;T===1&&n.setStart(r,0),T===2&&(e.hint.recentLanguage="")}if(Qe(e,t,n,S,S.parentElement))return b(e,["hint"]),!0}var N=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&N){var R=sr(N);if(R&&Qe(e,t,n,N,R))return!0;var H=lr(N);if(H&&ct(e,t,n,N,H))return!0}if(En(e,t,n)||Ln(e,n,t)||Ft(e,n,t))return!0;var U=(0,C.W)(r);if(U){if(I("⌘=",t)){var B=U.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length>1&&ut(e,B.textContent.substr(1)),t.preventDefault(),!0}if(I("⌘-",t)){var B=U.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length<6&&ut(e,B.textContent.trim()+"# "),t.preventDefault(),!0}}var O=(0,s.F9)(r);if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(Mn(e,n,t,u))return!0;if(O&&O.previousElementSibling&&O.tagName!=="UL"&&O.tagName!=="OL"&&(O.previousElementSibling.getAttribute("data-type")==="code-block"||O.previousElementSibling.getAttribute("data-type")==="math-block")){var G=(0,k.im)(O,e.ir.element,n).start;if(G===0||G===1&&O.innerText.startsWith(E.g.ZWSP))return n.selectNodeContents(O.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),j(n,e),O.textContent.trim().replace(E.g.ZWSP,"")===""&&(O.remove(),We(e)),t.preventDefault(),!0}if(U){var V=U.firstElementChild.textContent.length;(0,k.im)(U,e.ir.element).start===V&&V!==0&&(n.setStart(U.firstElementChild.firstChild,V-1),n.collapse(!0),(0,k.Hc)(n))}}return(t.key==="ArrowUp"||t.key==="ArrowDown")&&O&&(O.querySelectorAll(".vditor-ir__node").forEach(function(J){J.contains(r)||J.classList.add("vditor-ir__node--hidden")}),Tn(t,O,n))?!0:(dn(n,t.key),O&&mt(O,e,t,n)?(t.preventDefault(),!0):!1)},K=Y(190),ye=function(e,t){e.querySelectorAll("[data-type=footnotes-link]").forEach(function(n){for(var r=n.parentElement,i=r.nextSibling;i&&i.textContent.startsWith(" ");){var a=i;a.childNodes.forEach(function(o){r.append(o.cloneNode(!0))}),i=i.nextSibling,a.remove()}t&&t(r)})},ie=function(e,t){var n,r=getSelection().getRangeAt(0).cloneRange(),i=r.startContainer;r.startContainer.nodeType!==3&&r.startContainer.tagName==="DIV"&&(i=r.startContainer.childNodes[r.startOffset-1]);var a=(0,s.a1)(i,"data-block","0");if(a&&t&&(t.inputType==="deleteContentBackward"||t.data===" ")){for(var o=(0,k.im)(a,e.sv.element,r).start,u=!0,h=o-1;h>a.textContent.substr(0,o).lastIndexOf(`
|
|
58
|
+
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}if(o===0&&(u=!1),u){Ce(e);return}if(t.inputType==="deleteContentBackward"){var f=(0,s.a1)(i,"data-type","code-block-open-marker")||(0,s.a1)(i,"data-type","code-block-close-marker");if(f){if(f.getAttribute("data-type")==="code-block-close-marker"){var S=bt(i,"code-block-open-marker");if(S){S.textContent=f.textContent,Ce(e);return}}if(f.getAttribute("data-type")==="code-block-open-marker"){var S=bt(i,"code-block-close-marker",!1);if(S){S.textContent=f.textContent,Ce(e);return}}}var T=(0,s.a1)(i,"data-type","math-block-open-marker");if(T){var N=T.nextElementSibling.nextElementSibling;N&&N.getAttribute("data-type")==="math-block-close-marker"&&(N.remove(),Ce(e));return}a.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(O){O.textContent.length===1&&O.remove()}),a.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(O){O.textContent.length===1&&O.remove()});var R=(0,s.a1)(i,"data-type","heading-marker");if(R&&R.textContent.indexOf("#")===-1){Ce(e);return}}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,s.a1)(i,"data-type","padding")||(0,s.a1)(i,"data-type","li-marker")||(0,s.a1)(i,"data-type","task-marker")||(0,s.a1)(i,"data-type","blockquote-marker"))){Ce(e);return}}if(a&&a.textContent.trimRight()==="$$"){Ce(e);return}a||(a=e.sv.element),((n=a.firstElementChild)===null||n===void 0?void 0:n.getAttribute("data-type"))==="link-ref-defs-block"&&(a=e.sv.element),(0,s.a1)(i,"data-type","footnotes-link")&&(a=e.sv.element),a.textContent.indexOf(Lute.Caret)===-1&&r.insertNode(document.createTextNode(Lute.Caret)),a.querySelectorAll("[style]").forEach(function(O){O.removeAttribute("style")}),a.querySelectorAll("font").forEach(function(O){O.outerHTML=O.innerHTML});var H=a.textContent,U=a.isEqualNode(e.sv.element);if(U)H=a.textContent;else{a.previousElementSibling&&(H=a.previousElementSibling.textContent+H,a.previousElementSibling.remove()),a.previousElementSibling&&H.indexOf(`---
|
|
59
59
|
`)===0&&(H=a.previousElementSibling.textContent+H,a.previousElementSibling.remove());var B="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(O,G){O&&!a.isEqualNode(O.parentElement)&&(B+=O.parentElement.textContent+`
|
|
60
60
|
`,O.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(O,G){O&&!a.isEqualNode(O.parentElement)&&(B+=O.parentElement.textContent+`
|
|
61
|
-
`,O.parentElement.remove())}),H=B+H}H=rn(H,e),U?a.innerHTML=H:a.outerHTML=H,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(O){e.sv.element.insertAdjacentElement("beforeend",O.parentElement)}),ye(e.sv.element,function(O){e.sv.element.insertAdjacentElement("beforeend",O)}),(0,k.ib)(e.sv.element,r),be(e),
|
|
62
|
-
`;if(G){if(((i=G.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return G.previousElementSibling.remove(),Se(e),t.preventDefault(),!0;se+=$n(G)}return u.insertNode(document.createTextNode(se)),u.collapse(!1),O&&O.textContent.trim()!==""&&!V?ie(e):Se(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(G&&((a=G.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,k.im)(G,e.sv.element,u).start===1&&G.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(G,0),u.extractContents(),G.textContent.trim()!==""?ie(e):Se(e),t.preventDefault(),!0;if(O&&(0,k.im)(O,e.sv.element,u).start===0&&O.previousElementSibling){u.extractContents();var ae=O.previousElementSibling.lastElementChild;return ae.getAttribute("data-type")==="newline"&&(ae.remove(),ae=O.previousElementSibling.lastElementChild),ae.getAttribute("data-type")!=="newline"&&(ae.insertAdjacentHTML("afterend",O.innerHTML),O.remove()),O.textContent.trim()!==""&&!(!((o=O.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?ie(e):(ae.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ae.lastChild),u.collapse(!1)),Se(e)),t.preventDefault(),!0}}return!1},X=Y(538),pe=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},He=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),pe(e),(0,X.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(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Je(e,e.options.mode,Wn(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport<"u"){var n=!1,r=function(i){n||(n=!0,requestAnimationFrame(function(){n=!1;var a=e.toolbar.element;a.style.transform="none",a.getBoundingClientRect().top<0&&(a.style.transform="translate(0, ".concat(-a.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},Re=function(e){var t=window.innerWidth<=E.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))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},gt=function(e){if(e.options.typewriterMode){var t=window.innerHeight;typeof e.options.height=="number"?(t=e.options.height,typeof e.options.minHeight=="number"&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)):t=e.element.clientHeight,e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}},Xt;function Yt(){window.removeEventListener("resize",Xt)}var Wn=function(e){gt(e),Yt(),window.addEventListener("resize",Xt=function(){Re(e),gt(e)});var t=(0,l.pK)()&&localStorage.getItem(e.options.cache.id);return(!e.options.cache.enable||!t)&&(e.options.value?t=e.options.value:e.originalInnerHTML?t=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(t="")),t||""},it=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e[e.currentMode].element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,k.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,C.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&p(e.toolbar.elements,["italic"]);var u=(0,s.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var h=(0,s.a1)(n,"data-type","a");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"LI");f?(f.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):f.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):f.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]);var S=(0,s.a1)(n,"data-type","code-block");S&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"]));var T=(0,s.a1)(n,"data-type","code");T&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"]));var N=(0,s.a1)(n,"data-type","table");N&&d(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ce=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=x(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,l.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)},Fn=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(E.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},qn=function(e){for(var t=e.startContainer.nextSibling;t&&t.textContent==="";)t=t.nextSibling;return!!(t&&t.nodeType!==3&&(t.tagName==="CODE"||t.getAttribute("data-type")==="math-inline"||t.getAttribute("data-type")==="html-entity"||t.getAttribute("data-type")==="html-inline"))},Qt=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},$t=function(e){for(var t="",n=e.previousSibling;n;)n.nodeType===3?t=n.textContent+t:t=n.outerHTML+t,n=n.previousSibling;return t},Kn=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},zn=function(e){var t=$t(e.startContainer),n=Qt(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==E.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==E.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},_t=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,k.Hc)(t),!0}else if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,k.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},yt=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,k.ib)(e.wysiwyg.element,n),Be(e))},At=function(e){var t=getSelection().getRangeAt(0),n=(0,s.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,k.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},at=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,k.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&be(t)},Gn=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;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);var n=(0,k.zh)(e),r=n.startContainer;if(!un(t,e,r)||(fn(n,e,t),kn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.F9)(r),a=(0,s.lG)(r,"P");if(gn(t,e,a,n)||mn(n,e,a,t)||En(e,t,n))return!0;var o=(0,s.fb)(r,"vditor-wysiwyg__block");if(o){if(t.key==="Escape"&&o.children.length===2)return e.wysiwyg.popover.style.display="none",o.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&o.getAttribute("data-type")==="code-block"){var u=e.wysiwyg.popover.querySelector(".vditor-input");return u.focus(),u.select(),t.preventDefault(),!0}if(o.getAttribute("data-block")==="0"&&(Sn(e,t,o.firstElementChild,n)||ct(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&$e(e,t,n,o.firstElementChild,o)))return!0}if(Cn(e,n,t,a))return!0;var h=(0,s.E2)(r,"BLOCKQUOTE");if(h&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(h):n.setStartAfter(h),(0,k.Hc)(n);var f=document.createElement("p");return f.setAttribute("data-block","0"),f.innerHTML=`
|
|
61
|
+
`,O.parentElement.remove())}),H=B+H}H=rn(H,e),U?a.innerHTML=H:a.outerHTML=H,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(O){e.sv.element.insertAdjacentElement("beforeend",O.parentElement)}),ye(e.sv.element,function(O){e.sv.element.insertAdjacentElement("beforeend",O)}),(0,k.ib)(e.sv.element,r),be(e),Ce(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},ke=function(e,t){var n,r,i,a,o;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,l.yl)(t)&&t.key!=="Escape"))return!1;var u=(0,k.zh)(e),h=u.startContainer;u.startContainer.nodeType!==3&&u.startContainer.tagName==="DIV"&&(h=u.startContainer.childNodes[u.startOffset-1]);var f=(0,s.a1)(h,"data-type","text"),S=(0,s.a1)(h,"data-type","blockquote-marker");if(!S&&u.startOffset===0&&f&&f.previousElementSibling&&f.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(S=f.previousElementSibling),S&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&S.nextElementSibling.textContent.trim()===""&&(0,k.im)(S,e.sv.element,u).start===S.textContent.length)return((n=S.previousElementSibling)===null||n===void 0?void 0:n.getAttribute("data-type"))==="padding"&&S.previousElementSibling.setAttribute("data-action","enter-remove"),S.remove(),Ce(e),t.preventDefault(),!0;var T=(0,s.a1)(h,"data-type","li-marker"),N=(0,s.a1)(h,"data-type","task-marker"),R=T;if(R||N&&N.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(R=N),!R&&u.startOffset===0&&f&&f.previousElementSibling&&(f.previousElementSibling.getAttribute("data-type")==="li-marker"||f.previousElementSibling.getAttribute("data-type")==="task-marker")&&(R=f.previousElementSibling),R){var H=(0,k.im)(R,e.sv.element,u).start,U=R.getAttribute("data-type")==="task-marker",B=R;if(U&&(B=R.previousElementSibling.previousElementSibling.previousElementSibling),H===R.textContent.length){if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&R.nextElementSibling.textContent.trim()==="")return((r=B.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?(B.previousElementSibling.remove(),ie(e)):(U&&(B.remove(),R.previousElementSibling.previousElementSibling.remove(),R.previousElementSibling.remove()),R.nextElementSibling.remove(),R.remove(),Ce(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?B.previousElementSibling.getAttribute("data-type")==="padding"&&B.previousElementSibling.remove():B.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat(B.textContent.replace(/\S/g," "),"</span>")),/^\d/.test(B.textContent)&&(B.textContent=B.textContent.replace(/^\d{1,}/,"1"),u.selectNodeContents(R.firstChild),u.collapse(!1)),ie(e),t.preventDefault(),!0}}if(Ft(e,u,t))return!0;var O=(0,s.a1)(h,"data-block","0"),G=(0,C.S)(h,"SPAN");if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&O){var V=!1,J=O.textContent.match(/^\n+/);(0,k.im)(O,e.sv.element).start<=(J?J[0].length:0)&&(V=!0);var se=`
|
|
62
|
+
`;if(G){if(((i=G.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return G.previousElementSibling.remove(),Ce(e),t.preventDefault(),!0;se+=Qn(G)}return u.insertNode(document.createTextNode(se)),u.collapse(!1),O&&O.textContent.trim()!==""&&!V?ie(e):Ce(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(G&&((a=G.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,k.im)(G,e.sv.element,u).start===1&&G.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(G,0),u.extractContents(),G.textContent.trim()!==""?ie(e):Ce(e),t.preventDefault(),!0;if(O&&(0,k.im)(O,e.sv.element,u).start===0&&O.previousElementSibling){u.extractContents();var ae=O.previousElementSibling.lastElementChild;return ae.getAttribute("data-type")==="newline"&&(ae.remove(),ae=O.previousElementSibling.lastElementChild),ae.getAttribute("data-type")!=="newline"&&(ae.insertAdjacentHTML("afterend",O.innerHTML),O.remove()),O.textContent.trim()!==""&&!(!((o=O.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?ie(e):(ae.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ae.lastChild),u.collapse(!1)),Ce(e)),t.preventDefault(),!0}}return!1},X=Y(538),pe=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},He=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),pe(e),(0,X.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(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Je(e,e.options.mode,Wn(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport<"u"){var n=!1,r=function(i){n||(n=!0,requestAnimationFrame(function(){n=!1;var a=e.toolbar.element;a.style.transform="none",a.getBoundingClientRect().top<0&&(a.style.transform="translate(0, ".concat(-a.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},Re=function(e){var t=window.innerWidth<=E.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))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},gt=function(e){if(e.options.typewriterMode){var t=window.innerHeight;typeof e.options.height=="number"?(t=e.options.height,typeof e.options.minHeight=="number"&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)):t=e.element.clientHeight,e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}},Xt;function Yt(){window.removeEventListener("resize",Xt)}var Wn=function(e){gt(e),Yt(),window.addEventListener("resize",Xt=function(){Re(e),gt(e)});var t=(0,l.pK)()&&localStorage.getItem(e.options.cache.id);return(!e.options.cache.enable||!t)&&(e.options.value?t=e.options.value:e.originalInnerHTML?t=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(t="")),t||""},it=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e[e.currentMode].element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,k.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,C.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&p(e.toolbar.elements,["italic"]);var u=(0,s.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var h=(0,s.a1)(n,"data-type","a");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"LI");f?(f.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):f.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):f.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]);var S=(0,s.a1)(n,"data-type","code-block");S&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"]));var T=(0,s.a1)(n,"data-type","code");T&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"]));var N=(0,s.a1)(n,"data-type","table");N&&d(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ce=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=D(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,l.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)},Fn=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(E.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},qn=function(e){for(var t=e.startContainer.nextSibling;t&&t.textContent==="";)t=t.nextSibling;return!!(t&&t.nodeType!==3&&(t.tagName==="CODE"||t.getAttribute("data-type")==="math-inline"||t.getAttribute("data-type")==="html-entity"||t.getAttribute("data-type")==="html-inline"))},$t=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},Qt=function(e){for(var t="",n=e.previousSibling;n;)n.nodeType===3?t=n.textContent+t:t=n.outerHTML+t,n=n.previousSibling;return t},Kn=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},zn=function(e){var t=Qt(e.startContainer),n=$t(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==E.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==E.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},_t=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,k.Hc)(t),!0}else if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,k.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},yt=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,k.ib)(e.wysiwyg.element,n),Be(e))},At=function(e){var t=getSelection().getRangeAt(0),n=(0,s.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,k.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},at=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,k.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&be(t)},Gn=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;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);var n=(0,k.zh)(e),r=n.startContainer;if(!un(t,e,r)||(fn(n,e,t),kn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.F9)(r),a=(0,s.lG)(r,"P");if(gn(t,e,a,n)||mn(n,e,a,t)||En(e,t,n))return!0;var o=(0,s.fb)(r,"vditor-wysiwyg__block");if(o){if(t.key==="Escape"&&o.children.length===2)return e.wysiwyg.popover.style.display="none",o.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&o.getAttribute("data-type")==="code-block"){var u=e.wysiwyg.popover.querySelector(".vditor-input");return u.focus(),u.select(),t.preventDefault(),!0}if(o.getAttribute("data-block")==="0"&&(Sn(e,t,o.firstElementChild,n)||ct(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&Qe(e,t,n,o.firstElementChild,o)))return!0}if(Cn(e,n,t,a))return!0;var h=(0,s.E2)(r,"BLOCKQUOTE");if(h&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(h):n.setStartAfter(h),(0,k.Hc)(n);var f=document.createElement("p");return f.setAttribute("data-block","0"),f.innerHTML=`
|
|
63
63
|
`,n.insertNode(f),n.collapse(!0),(0,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0}var S=(0,C.W)(r);if(S){if(S.tagName==="H6"&&r.textContent.length===n.startOffset&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"){var T=document.createElement("p");return T.textContent=`
|
|
64
64
|
`,T.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",T),n.setStart(T,0),(0,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0}if(I("⌘=",t)){var N=parseInt(S.tagName.substr(1),10)-1;return N>0&&(yt(e,"h".concat(N)),ce(e)),t.preventDefault(),!0}if(I("⌘-",t)){var N=parseInt(S.tagName.substr(1),10)+1;return N<7&&(yt(e,"h".concat(N)),ce(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&S.textContent.length===1&&At(e)}if(Ln(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.shiftKey){var R=(0,s.lG)(r,"A"),H=(0,s.a1)(r,"data-type","link-ref"),U=(0,s.a1)(r,"data-type","footnotes-ref");if(R||H||U||S&&S.tagName.length===2){var B=e.wysiwyg.popover.querySelector("input");B.focus(),B.select()}}if(Ae(e,t))return!0;if(I("⇧⌘U",t)){var O=e.wysiwyg.popover.querySelector('[data-type="up"]');if(O)return O.click(),t.preventDefault(),!0}if(I("⇧⌘D",t)){var O=e.wysiwyg.popover.querySelector('[data-type="down"]');if(O)return O.click(),t.preventDefault(),!0}if(Ft(e,n,t))return!0;if(!(0,l.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(`
|
|
65
65
|
`+E.g.ZWSP)):n.insertNode(document.createTextNode(`
|
|
66
66
|
`)),n.collapse(!1),(0,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(Mn(e,n,t,a))return!0;if(i){if(i.previousElementSibling&&i.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&i.previousElementSibling.getAttribute("data-block")==="0"&&i.tagName!=="UL"&&i.tagName!=="OL"){var G=(0,k.im)(i,e.wysiwyg.element,n).start;if(G===0&&n.startOffset===0||G===1&&i.innerText.startsWith(E.g.ZWSP))return at(i.previousElementSibling.lastElementChild,e,!1),i.innerHTML.trim().replace(E.g.ZWSP,"")===""&&(i.remove(),ce(e)),t.preventDefault(),!0}var V=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(V-2)===`
|
|
67
|
-
`&&r.textContent.charAt(V-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,V-1)+E.g.ZWSP,n.setStart(r,V),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===E.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&qn(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(E.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(Tn(t,i,n))return t.preventDefault(),!0;if(dn(n,t.key),t.key==="ArrowDown"){var J=r.nextSibling;J&&J.nodeType!==3&&J.getAttribute("data-type")==="math-inline"&&n.setStartAfter(J)}return i&&mt(i,e,t,n)?(t.preventDefault(),!0):!1},Ae=function(e,t){if(I("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ze=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e.wysiwyg.element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.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="",Pe(r,e),Oe(e,"footnotes-block"),Ie(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(q){q.classList.remove("vditor-comment--focus")});var a=(0,s.fb)(n,"vditor-comment");if(a){var o=a.getAttribute("data-cmtids").split(" ");if(o.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var u=a.nextElementSibling.getAttribute("data-cmtids").split(" ");o.find(function(q){if(u.includes(q))return o=[q],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(q){q.getAttribute("data-cmtids").indexOf(o[0])>-1&&q.classList.add("vditor-comment--focus")})}var h=(0,s.lG)(n,"A");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"TABLE"),S=(0,C.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"])):(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])):S?(d(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):f&&d(e.toolbar.elements,["table"]);var T=(0,s.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Pe(T,e),Oe(e,"vditor-toc"),Ie(e,T);return}var N=(0,C.S)(n,"BLOCKQUOTE");if(N&&(e.wysiwyg.popover.innerHTML="",Xe(t,N,e),Ye(t,N,e),Pe(N,e),Oe(e,"blockquote"),Ie(e,N)),i&&(e.wysiwyg.popover.innerHTML="",Xe(t,i,e),Ye(t,i,e),Pe(i,e),Oe(e,"li"),Ie(e,i)),f){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var R=function(){var q=f.rows.length,te=f.rows[0].cells.length,ze=parseInt(we.value,10)||q,Ge=parseInt(Ne.value,10)||te;if(!(ze===q&&te===Ge)){if(te!==Ge)for(var dt=Ge-te,Ve=0;Ve<f.rows.length;Ve++)if(dt>0)for(var Pn=0;Pn<dt;Pn++)Ve===0?f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Gt=te-1;Gt>=Ge;Gt--)f.rows[Ve].cells[Gt].remove();if(q!==ze){var jn=ze-q;if(jn>0){for(var Zt="<tr>",nt=0;nt<Ge;nt++)Zt+="<td> </td>";for(var Bn=0;Bn<jn;Bn++)f.querySelector("tbody")?f.querySelector("tbody").insertAdjacentHTML("beforeend",Zt):f.querySelector("thead").insertAdjacentHTML("afterend",Zt+"</tr>")}else for(var nt=q-1;nt>=ze;nt--)f.rows[nt].remove(),f.rows.length===1&&f.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(x(e))}},H=function(q){Et(f,q),q==="right"?(G.classList.remove("vditor-icon--current"),V.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")):q==="center"?(G.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),V.classList.add("vditor-icon--current")):(V.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),G.classList.add("vditor-icon--current")),(0,k.Hc)(t),ce(e)},U=(0,s.lG)(n,"TD"),B=(0,s.lG)(n,"TH"),O="left";U?O=U.getAttribute("align")||"left":B&&(O=B.getAttribute("align")||"center");var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),G.setAttribute("data-type","left"),G.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="left"?" vditor-icon--current":""),G.onclick=function(){H("left")};var V=document.createElement("button");V.setAttribute("type","button"),V.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),V.setAttribute("data-type","center"),V.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',V.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="center"?" vditor-icon--current":""),V.onclick=function(){H("center")};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),J.setAttribute("data-type","right"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="right"?" vditor-icon--current":""),J.onclick=function(){H("right")};var se=document.createElement("button");se.setAttribute("type","button"),se.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),se.setAttribute("data-type","insertRow"),se.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',se.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",se.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&yn(e,t,te)};var ae=document.createElement("button");ae.setAttribute("type","button"),ae.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ae.setAttribute("data-type","insertRow"),ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ae.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&bn(e,t,te)};var ue=document.createElement("button");ue.setAttribute("type","button"),ue.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),ue.setAttribute("data-type","insertColumn"),ue.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',ue.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ue.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te)};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),xe.setAttribute("data-type","insertColumn"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te,"beforebegin")};var ke=document.createElement("button");ke.setAttribute("type","button"),ke.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),ke.setAttribute("data-type","deleteRow"),ke.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',ke.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ke.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&wn(e,t,te)};var De=document.createElement("button");De.setAttribute("type","button"),De.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),De.setAttribute("data-type","deleteColumn"),De.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',De.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",De.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&vn(e,t,f,te)};var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.row),Q.className="vditor-tooltipped vditor-tooltipped__n";var we=document.createElement("input");Q.appendChild(we),we.type="number",we.min="1",we.className="vditor-input",we.style.width="42px",we.style.textAlign="center",we.setAttribute("placeholder",window.VditorI18n.row),we.value=f.rows.length.toString(),we.oninput=function(){R()},we.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){Ne.focus(),Ne.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}};var Mt=document.createElement("span");Mt.setAttribute("aria-label",window.VditorI18n.column),Mt.className="vditor-tooltipped vditor-tooltipped__n";var Ne=document.createElement("input");Mt.appendChild(Ne),Ne.type="number",Ne.min="1",Ne.className="vditor-input",Ne.style.width="42px",Ne.style.textAlign="center",Ne.setAttribute("placeholder",window.VditorI18n.column),Ne.value=f.rows[0].cells.length.toString(),Ne.oninput=function(){R()},Ne.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){we.focus(),we.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}},Xe(t,f,e),Ye(t,f,e),Pe(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",V),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",se),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",ue),e.wysiwyg.popover.insertAdjacentElement("beforeend",ke),e.wysiwyg.popover.insertAdjacentElement("beforeend",De),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Mt),Oe(e,"table"),Ie(e,f)}var zt=(0,s.a1)(n,"data-type","link-ref");zt&&en(e,zt,t);var et=(0,s.a1)(n,"data-type","footnotes-ref");if(et){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var Fe=document.createElement("input");Q.appendChild(Fe),Fe.className="vditor-input",Fe.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Fe.style.width="120px",Fe.value=et.getAttribute("data-footnotes-label"),Fe.oninput=function(){Fe.value.trim()!==""&&et.setAttribute("data-footnotes-label",Fe.value),typeof e.options.input=="function"&&e.options.input(x(e))},Fe.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Pe(et,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Oe(e,"footnotes-ref"),Ie(e,et)}var Ce=(0,s.fb)(n,"vditor-wysiwyg__block"),Rn=Ce?Ce.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(q){if(!Ce||Ce&&Rn&&!Ce.contains(q)){var te=q.previousElementSibling;te.style.display="none"}}),Ce&&Rn){if(e.wysiwyg.popover.innerHTML="",Xe(t,Ce,e),Ye(t,Ce,e),Pe(Ce,e),Ce.getAttribute("data-type")==="code-block"){var kt=document.createElement("span");kt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),kt.className="vditor-tooltipped vditor-tooltipped__n";var je=document.createElement("input");kt.appendChild(je);var ft=Ce.firstElementChild.firstElementChild;je.className="vditor-input",je.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),je.value=ft.className.indexOf("language-")>-1?ft.className.split("-")[1].split(" ")[0]:"",je.oninput=function(q){je.value.trim()!==""?ft.className="language-".concat(je.value):(ft.className="",e.hint.recentLanguage=""),Ce.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Ce.lastElementChild.innerHTML=Ce.firstElementChild.innerHTML,Ee(Ce.lastElementChild,e)),ce(e),q.detail===1&&(t.setStart(ft.firstChild,0),t.collapse(!0),(0,k.Hc)(t))},je.onkeydown=function(q){if(!q.isComposing&&!Ae(e,q)){if(q.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",q.preventDefault();return}e.hint.select(q,e),Ue(q,t)}},je.onkeyup=function(q){var te,ze;if(!(q.isComposing||q.key==="Enter"||q.key==="ArrowUp"||q.key==="Escape"||q.key==="ArrowDown")){var Ge=[],dt=je.value.substring(0,je.selectionStart);(e.options.preview.hljs.langs||E.g.ALIAS_CODE_LANGUAGES.concat(((ze=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&ze!==void 0?ze:[]).sort())).forEach(function(Ve){Ve.indexOf(dt.toLowerCase())>-1&&Ge.push({html:Ve,value:Ve})}),e.hint.genHTML(Ge,dt,e),q.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",kt),Oe(e,"code-block")}else Oe(e,"block");Ie(e,Ce)}else Ce=void 0;if(S){e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var Ke=document.createElement("input");Q.appendChild(Ke),Ke.className="vditor-input",Ke.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ke.style.width="120px",Ke.value=S.getAttribute("data-id")||"",Ke.oninput=function(){S.setAttribute("data-id",Ke.value),typeof e.options.input=="function"&&e.options.input(x(e))},Ke.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Xe(t,S,e),Ye(t,S,e),Pe(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Oe(e,"heading"),Ie(e,S)}if(h&&xt(e,h,t),!N&&!i&&!f&&!Ce&&!h&&!zt&&!et&&!S&&!T){var tt=(0,s.a1)(n,"data-block","0");tt&&tt.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Xe(t,tt,e),Ye(t,tt,e),Pe(tt,e),Oe(e,"block"),Ie(e,tt)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(q){q.style.display="none"});var In=(0,s.a1)(t.startContainer,"data-type","backslash");In&&(In.querySelector("span").style.display="inline")}},200)},Ie=function(e,t){var n=t,r=(0,s.lG)(t,"TABLE");r&&(n=r),e.wysiwyg.popover.style.left="0",e.wysiwyg.popover.style.display="block",e.wysiwyg.popover.style.top=Math.max(-8,n.offsetTop-21-e.wysiwyg.element.scrollTop)+"px",e.wysiwyg.popover.style.left=Math.min(n.offsetLeft,e.wysiwyg.element.clientWidth-e.wysiwyg.popover.clientWidth)+"px",e.wysiwyg.popover.setAttribute("data-top",(n.offsetTop-21).toString())},en=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",a.value):t.textContent=a.value),u.value.trim()!==""&&t.setAttribute("data-link-label",u.value),typeof e.options.input=="function"&&e.options.input(x(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Oe(e,"link-ref"),Ie(e,t)},Xe=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ye=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Pe=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,k.zh)(t);r.setStartAfter(e),(0,k.Hc)(r),e.remove(),ce(t),Ze(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Be(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},ot=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,k.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,k.Hc)(i),n.preventDefault()}}},xt=function(e,t,n){e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.innerHTML=a.value),t.setAttribute("href",u.value),t.setAttribute("title",f.value),ce(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.link),u.value=t.getAttribute("href")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,f)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.tooltipText),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.tooltipText),f.style.width="60px",f.value=t.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(e,"a"),Ie(e,t)},Zn=function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",a.value),n.setAttribute("alt",u.value),n.setAttribute("title",f.value),typeof t.options.input=="function"&&t.options.input(x(t))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.imageURL),a.value=n.getAttribute("src")||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(t,S)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.alternateText),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.alternateText),u.style.width="52px",u.value=n.getAttribute("alt")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(t,S)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.title),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.title),f.value=n.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(t,S)},Pe(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(t,"image"),Ie(t,n)},Ue=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,k.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Oe=function(e,t){e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},Qe=function(e){e.currentMode==="wysiwyg"?Ze(e):e.currentMode==="ir"&&it(e)},tn=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(i){Ee(i,e),i.previousElementSibling.setAttribute("style","display:none")}),ce(e,n)},Jn=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=zn(e),h=u.beforeHTML,f=u.afterHTML;r&&!i;){var S=r.tagName;if(S==="STRIKE"&&(S="S"),S==="I"&&(S="EM"),S==="B"&&(S="STRONG"),S==="S"||S==="STRONG"||S==="EM"){var T="",N="",R="";r.parentElement.getAttribute("data-block")!=="0"&&(N=$t(r),R=Qt(r)),(h||N)&&(T="".concat(N,"<").concat(S,">").concat(h,"</").concat(S,">"),h=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(E.g.ZWSP,"<wbr>").concat(o),i=!0),(f||R)&&(f="<".concat(S,">").concat(f,"</").concat(S,">").concat(R),T+=f),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,o="</".concat(S,">")+o}else i=!0}(0,k.ib)(t.wysiwyg.element,e)},Xn=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,k.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var u=(0,s.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,k.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var h=(0,s.lG)(a.startContainer,"CODE");h||(h=a.startContainer.childNodes[a.startOffset]),h&&(h.outerHTML=h.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,k.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(vt(e,a,o),(0,k.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?Jn(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.wysiwyg.element,a));var f=(0,s.F9)(a.startContainer);if(o==="quote"){if(f||(f=a.startContainer.childNodes[a.startOffset]),f){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,s.lG)(a.startContainer,"LI");S&&f.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):f.outerHTML='<blockquote data-block="0">'.concat(f.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")vt(e,a,o,!1),(0,k.ib)(e.wysiwyg.element,a),r=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=E.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var T=document.createElement("div");T.className="vditor-wysiwyg__block",T.setAttribute("data-type","code-block"),T.setAttribute("data-block","0"),T.setAttribute("data-marker","```"),a.toString()===""?T.innerHTML=`<pre><code><wbr>
|
|
68
|
-
</code></pre>`:(T.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(T),f&&(f.outerHTML=e.lute.SpinVditorDOM(f.outerHTML)),(0,k.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(se){
|
|
67
|
+
`&&r.textContent.charAt(V-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,V-1)+E.g.ZWSP,n.setStart(r,V),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===E.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&qn(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(E.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(Tn(t,i,n))return t.preventDefault(),!0;if(dn(n,t.key),t.key==="ArrowDown"){var J=r.nextSibling;J&&J.nodeType!==3&&J.getAttribute("data-type")==="math-inline"&&n.setStartAfter(J)}return i&&mt(i,e,t,n)?(t.preventDefault(),!0):!1},Ae=function(e,t){if(I("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ze=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e.wysiwyg.element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.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="",Pe(r,e),Oe(e,"footnotes-block"),Ie(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(q){q.classList.remove("vditor-comment--focus")});var a=(0,s.fb)(n,"vditor-comment");if(a){var o=a.getAttribute("data-cmtids").split(" ");if(o.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var u=a.nextElementSibling.getAttribute("data-cmtids").split(" ");o.find(function(q){if(u.includes(q))return o=[q],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(q){q.getAttribute("data-cmtids").indexOf(o[0])>-1&&q.classList.add("vditor-comment--focus")})}var h=(0,s.lG)(n,"A");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"TABLE"),S=(0,C.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"])):(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])):S?(d(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):f&&d(e.toolbar.elements,["table"]);var T=(0,s.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Pe(T,e),Oe(e,"vditor-toc"),Ie(e,T);return}var N=(0,C.S)(n,"BLOCKQUOTE");if(N&&(e.wysiwyg.popover.innerHTML="",Xe(t,N,e),Ye(t,N,e),Pe(N,e),Oe(e,"blockquote"),Ie(e,N)),i&&(e.wysiwyg.popover.innerHTML="",Xe(t,i,e),Ye(t,i,e),Pe(i,e),Oe(e,"li"),Ie(e,i)),f){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var R=function(){var q=f.rows.length,te=f.rows[0].cells.length,ze=parseInt(we.value,10)||q,Ge=parseInt(Ne.value,10)||te;if(!(ze===q&&te===Ge)){if(te!==Ge)for(var dt=Ge-te,Ve=0;Ve<f.rows.length;Ve++)if(dt>0)for(var Pn=0;Pn<dt;Pn++)Ve===0?f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Gt=te-1;Gt>=Ge;Gt--)f.rows[Ve].cells[Gt].remove();if(q!==ze){var jn=ze-q;if(jn>0){for(var Zt="<tr>",nt=0;nt<Ge;nt++)Zt+="<td> </td>";for(var Bn=0;Bn<jn;Bn++)f.querySelector("tbody")?f.querySelector("tbody").insertAdjacentHTML("beforeend",Zt):f.querySelector("thead").insertAdjacentHTML("afterend",Zt+"</tr>")}else for(var nt=q-1;nt>=ze;nt--)f.rows[nt].remove(),f.rows.length===1&&f.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(D(e))}},H=function(q){Et(f,q),q==="right"?(G.classList.remove("vditor-icon--current"),V.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")):q==="center"?(G.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),V.classList.add("vditor-icon--current")):(V.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),G.classList.add("vditor-icon--current")),(0,k.Hc)(t),ce(e)},U=(0,s.lG)(n,"TD"),B=(0,s.lG)(n,"TH"),O="left";U?O=U.getAttribute("align")||"left":B&&(O=B.getAttribute("align")||"center");var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),G.setAttribute("data-type","left"),G.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="left"?" vditor-icon--current":""),G.onclick=function(){H("left")};var V=document.createElement("button");V.setAttribute("type","button"),V.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),V.setAttribute("data-type","center"),V.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',V.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="center"?" vditor-icon--current":""),V.onclick=function(){H("center")};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),J.setAttribute("data-type","right"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="right"?" vditor-icon--current":""),J.onclick=function(){H("right")};var se=document.createElement("button");se.setAttribute("type","button"),se.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),se.setAttribute("data-type","insertRow"),se.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',se.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",se.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&yn(e,t,te)};var ae=document.createElement("button");ae.setAttribute("type","button"),ae.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ae.setAttribute("data-type","insertRow"),ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ae.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&bn(e,t,te)};var ue=document.createElement("button");ue.setAttribute("type","button"),ue.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),ue.setAttribute("data-type","insertColumn"),ue.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',ue.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ue.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te)};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),xe.setAttribute("data-type","insertColumn"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te,"beforebegin")};var Te=document.createElement("button");Te.setAttribute("type","button"),Te.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),Te.setAttribute("data-type","deleteRow"),Te.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Te.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Te.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&wn(e,t,te)};var De=document.createElement("button");De.setAttribute("type","button"),De.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),De.setAttribute("data-type","deleteColumn"),De.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',De.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",De.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&vn(e,t,f,te)};var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.row),$.className="vditor-tooltipped vditor-tooltipped__n";var we=document.createElement("input");$.appendChild(we),we.type="number",we.min="1",we.className="vditor-input",we.style.width="42px",we.style.textAlign="center",we.setAttribute("placeholder",window.VditorI18n.row),we.value=f.rows.length.toString(),we.oninput=function(){R()},we.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){Ne.focus(),Ne.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}};var Mt=document.createElement("span");Mt.setAttribute("aria-label",window.VditorI18n.column),Mt.className="vditor-tooltipped vditor-tooltipped__n";var Ne=document.createElement("input");Mt.appendChild(Ne),Ne.type="number",Ne.min="1",Ne.className="vditor-input",Ne.style.width="42px",Ne.style.textAlign="center",Ne.setAttribute("placeholder",window.VditorI18n.column),Ne.value=f.rows[0].cells.length.toString(),Ne.oninput=function(){R()},Ne.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){we.focus(),we.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}},Xe(t,f,e),Ye(t,f,e),Pe(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",V),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",se),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",ue),e.wysiwyg.popover.insertAdjacentElement("beforeend",Te),e.wysiwyg.popover.insertAdjacentElement("beforeend",De),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Mt),Oe(e,"table"),Ie(e,f)}var zt=(0,s.a1)(n,"data-type","link-ref");zt&&en(e,zt,t);var et=(0,s.a1)(n,"data-type","footnotes-ref");if(et){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Fe=document.createElement("input");$.appendChild(Fe),Fe.className="vditor-input",Fe.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Fe.style.width="120px",Fe.value=et.getAttribute("data-footnotes-label"),Fe.oninput=function(){Fe.value.trim()!==""&&et.setAttribute("data-footnotes-label",Fe.value),typeof e.options.input=="function"&&e.options.input(D(e))},Fe.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Pe(et,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),Oe(e,"footnotes-ref"),Ie(e,et)}var Le=(0,s.fb)(n,"vditor-wysiwyg__block"),Rn=Le?Le.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(q){if(!Le||Le&&Rn&&!Le.contains(q)){var te=q.previousElementSibling;te.style.display="none"}}),Le&&Rn){if(e.wysiwyg.popover.innerHTML="",Xe(t,Le,e),Ye(t,Le,e),Pe(Le,e),Le.getAttribute("data-type")==="code-block"){var kt=document.createElement("span");kt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),kt.className="vditor-tooltipped vditor-tooltipped__n";var je=document.createElement("input");kt.appendChild(je);var ft=Le.firstElementChild.firstElementChild;je.className="vditor-input",je.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),je.value=ft.className.indexOf("language-")>-1?ft.className.split("-")[1].split(" ")[0]:"",je.oninput=function(q){je.value.trim()!==""?ft.className="language-".concat(je.value):(ft.className="",e.hint.recentLanguage=""),Le.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Le.lastElementChild.innerHTML=Le.firstElementChild.innerHTML,Se(Le.lastElementChild,e)),ce(e),q.detail===1&&(t.setStart(ft.firstChild,0),t.collapse(!0),(0,k.Hc)(t))},je.onkeydown=function(q){if(!q.isComposing&&!Ae(e,q)){if(q.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",q.preventDefault();return}e.hint.select(q,e),Ue(q,t)}},je.onkeyup=function(q){var te,ze;if(!(q.isComposing||q.key==="Enter"||q.key==="ArrowUp"||q.key==="Escape"||q.key==="ArrowDown")){var Ge=[],dt=je.value.substring(0,je.selectionStart);(e.options.preview.hljs.langs||E.g.ALIAS_CODE_LANGUAGES.concat(((ze=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&ze!==void 0?ze:[]).sort())).forEach(function(Ve){Ve.indexOf(dt.toLowerCase())>-1&&Ge.push({html:Ve,value:Ve})}),e.hint.genHTML(Ge,dt,e),q.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",kt),Oe(e,"code-block")}else Oe(e,"block");Ie(e,Le)}else Le=void 0;if(S){e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Ke=document.createElement("input");$.appendChild(Ke),Ke.className="vditor-input",Ke.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ke.style.width="120px",Ke.value=S.getAttribute("data-id")||"",Ke.oninput=function(){S.setAttribute("data-id",Ke.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ke.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Xe(t,S,e),Ye(t,S,e),Pe(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),Oe(e,"heading"),Ie(e,S)}if(h&&xt(e,h,t),!N&&!i&&!f&&!Le&&!h&&!zt&&!et&&!S&&!T){var tt=(0,s.a1)(n,"data-block","0");tt&&tt.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Xe(t,tt,e),Ye(t,tt,e),Pe(tt,e),Oe(e,"block"),Ie(e,tt)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(q){q.style.display="none"});var In=(0,s.a1)(t.startContainer,"data-type","backslash");In&&(In.querySelector("span").style.display="inline")}},200)},Ie=function(e,t){var n=t,r=(0,s.lG)(t,"TABLE");r&&(n=r),e.wysiwyg.popover.style.left="0",e.wysiwyg.popover.style.display="block",e.wysiwyg.popover.style.top=Math.max(-8,n.offsetTop-21-e.wysiwyg.element.scrollTop)+"px",e.wysiwyg.popover.style.left=Math.min(n.offsetLeft,e.wysiwyg.element.clientWidth-e.wysiwyg.popover.clientWidth)+"px",e.wysiwyg.popover.setAttribute("data-top",(n.offsetTop-21).toString())},en=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",a.value):t.textContent=a.value),u.value.trim()!==""&&t.setAttribute("data-link-label",u.value),typeof e.options.input=="function"&&e.options.input(D(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Oe(e,"link-ref"),Ie(e,t)},Xe=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ye=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Pe=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,k.zh)(t);r.setStartAfter(e),(0,k.Hc)(r),e.remove(),ce(t),Ze(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Be(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},ot=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,k.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,k.Hc)(i),n.preventDefault()}}},xt=function(e,t,n){e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.innerHTML=a.value),t.setAttribute("href",u.value),t.setAttribute("title",f.value),ce(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.link),u.value=t.getAttribute("href")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,f)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.tooltipText),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.tooltipText),f.style.width="60px",f.value=t.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(e,"a"),Ie(e,t)},Zn=function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",a.value),n.setAttribute("alt",u.value),n.setAttribute("title",f.value),typeof t.options.input=="function"&&t.options.input(D(t))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.imageURL),a.value=n.getAttribute("src")||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(t,S)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.alternateText),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.alternateText),u.style.width="52px",u.value=n.getAttribute("alt")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(t,S)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.title),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.title),f.value=n.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(t,S)},Pe(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(t,"image"),Ie(t,n)},Ue=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,k.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Oe=function(e,t){e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},$e=function(e){e.currentMode==="wysiwyg"?Ze(e):e.currentMode==="ir"&&it(e)},tn=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(i){Se(i,e),i.previousElementSibling.setAttribute("style","display:none")}),ce(e,n)},Jn=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=zn(e),h=u.beforeHTML,f=u.afterHTML;r&&!i;){var S=r.tagName;if(S==="STRIKE"&&(S="S"),S==="I"&&(S="EM"),S==="B"&&(S="STRONG"),S==="S"||S==="STRONG"||S==="EM"){var T="",N="",R="";r.parentElement.getAttribute("data-block")!=="0"&&(N=Qt(r),R=$t(r)),(h||N)&&(T="".concat(N,"<").concat(S,">").concat(h,"</").concat(S,">"),h=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(E.g.ZWSP,"<wbr>").concat(o),i=!0),(f||R)&&(f="<".concat(S,">").concat(f,"</").concat(S,">").concat(R),T+=f),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,o="</".concat(S,">")+o}else i=!0}(0,k.ib)(t.wysiwyg.element,e)},Xn=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,k.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var u=(0,s.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,k.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var h=(0,s.lG)(a.startContainer,"CODE");h||(h=a.startContainer.childNodes[a.startOffset]),h&&(h.outerHTML=h.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,k.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(vt(e,a,o),(0,k.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?Jn(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.wysiwyg.element,a));var f=(0,s.F9)(a.startContainer);if(o==="quote"){if(f||(f=a.startContainer.childNodes[a.startOffset]),f){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,s.lG)(a.startContainer,"LI");S&&f.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):f.outerHTML='<blockquote data-block="0">'.concat(f.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")vt(e,a,o,!1),(0,k.ib)(e.wysiwyg.element,a),r=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=E.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var T=document.createElement("div");T.className="vditor-wysiwyg__block",T.setAttribute("data-type","code-block"),T.setAttribute("data-block","0"),T.setAttribute("data-marker","```"),a.toString()===""?T.innerHTML=`<pre><code><wbr>
|
|
68
|
+
</code></pre>`:(T.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(T),f&&(f.outerHTML=e.lute.SpinVditorDOM(f.outerHTML)),(0,k.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(se){Se(se,e)}),t.classList.add("vditor-menu--disabled")}else if(o==="link"){if(a.toString()===""){var N=document.createElement("a");N.innerText=E.g.ZWSP,a.insertNode(N),a.setStart(N.firstChild,1),a.collapse(!0),xt(e,N,a);var R=e.wysiwyg.popover.querySelector("input");R.value="",R.focus(),i=!1}else{var T=document.createElement("a");T.setAttribute("href",""),T.innerHTML=a.toString(),a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a),xt(e,T,a);var H=e.wysiwyg.popover.querySelectorAll("input");H[0].value=T.innerText,H[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if(o==="table"){var U='<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(a.toString().trim()==="")f&&f.innerHTML.trim().replace(E.g.ZWSP,"")===""?f.outerHTML=U:document.execCommand("insertHTML",!1,U),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,k.Hc)(a);else{U='<table data-block="0"><thead><tr>';var B=a.toString().split(`
|
|
69
69
|
`),O=B[0].split(",").length>B[0].split(" ").length?",":" ";B.forEach(function(J,se){se===0?(J.split(O).forEach(function(ae,ue){ue===0?U+="<th>".concat(ae,"<wbr></th>"):U+="<th>".concat(ae,"</th>")}),U+="</tr></thead>"):(se===1?U+="<tbody><tr>":U+="<tr>",J.split(O).forEach(function(ae){U+="<td>".concat(ae,"</td>")}),U+="</tr>")}),U+="</tbody></table>",document.execCommand("insertHTML",!1,U),(0,k.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(o==="line"){if(f){var G=`<hr data-block="0"><p data-block="0"><wbr>
|
|
70
|
-
</p>`;f.innerHTML.trim()===""?f.outerHTML=G:f.insertAdjacentHTML("afterend",G),(0,k.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),o==="strike"&&(o="strikeThrough"),a.toString()===""&&(o==="bold"||o==="italic"||o==="strikeThrough")){var V="strong";o==="italic"?V="em":o==="strikeThrough"&&(V="s");var T=document.createElement(V);T.textContent=E.g.ZWSP,a.insertNode(T),T.previousSibling&&T.previousSibling.textContent===E.g.ZWSP&&(T.previousSibling.textContent=""),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else document.execCommand(o,!1,"")}r&&Ze(e),i&&ce(e)}},me=(function(){function e(t,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"";n.level===2&&(a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"");var o=n.tip?n.tip+a:"".concat(window.VditorI18n[n.name]).concat(a),u=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(u,' data-type="').concat(n.name,'">').concat(o,"</").concat(u,">");else{this.element.classList.add("vditor-toolbar__item");var h=document.createElement(u);h.setAttribute("data-type",n.name),h.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),h.setAttribute("aria-label",o),h.innerHTML=n.icon,this.element.appendChild(h)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(f){f.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?Xn(t,i.element.children[0],f):t.currentMode==="ir"?ur(t,i.element.children[0],n.prefix||"",n.suffix||""):er(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),Yn=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Je=function(e,t,n){var r;if(typeof n!="string"?(b(e,["subToolbar","hint"]),n.preventDefault(),r=
|
|
70
|
+
</p>`;f.innerHTML.trim()===""?f.outerHTML=G:f.insertAdjacentHTML("afterend",G),(0,k.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),o==="strike"&&(o="strikeThrough"),a.toString()===""&&(o==="bold"||o==="italic"||o==="strikeThrough")){var V="strong";o==="italic"?V="em":o==="strikeThrough"&&(V="s");var T=document.createElement(V);T.textContent=E.g.ZWSP,a.insertNode(T),T.previousSibling&&T.previousSibling.textContent===E.g.ZWSP&&(T.previousSibling.textContent=""),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else document.execCommand(o,!1,"")}r&&Ze(e),i&&ce(e)}},me=(function(){function e(t,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"";n.level===2&&(a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"");var o=n.tip?n.tip+a:"".concat(window.VditorI18n[n.name]).concat(a),u=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(u,' data-type="').concat(n.name,'">').concat(o,"</").concat(u,">");else{this.element.classList.add("vditor-toolbar__item");var h=document.createElement(u);h.setAttribute("data-type",n.name),h.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),h.setAttribute("aria-label",o),h.innerHTML=n.icon,this.element.appendChild(h)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(f){f.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?Xn(t,i.element.children[0],f):t.currentMode==="ir"?ur(t,i.element.children[0],n.prefix||"",n.suffix||""):er(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),Yn=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Je=function(e,t,n){var r;if(typeof n!="string"?(b(e,["subToolbar","hint"]),n.preventDefault(),r=D(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",m(e.toolbar.elements,E.g.EDIT_TOOLBARS),y(e.toolbar.elements,E.g.EDIT_TOOLBARS),d(e.toolbar.elements,["outdent","indent"]),t==="ir")v(e.toolbar.elements,["both"]),w(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),We(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Re(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){Se(a,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")v(e.toolbar.elements,["both"]),w(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",Re(e),tn(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){w(e.toolbar.elements,["both"]),v(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",(e.options.preview.mode==="both"||e.options.preview.mode==="editor")&&(e.sv.element.style.display="block"),e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var i=rn(r,e);i==="<div data-block='0'></div>"&&(i=""),e.sv.element.innerHTML=i,ye(e.sv.element),Ce(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Re(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),$e(e)),Be(e),gt(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach(function(a){a.classList.remove("vditor-menu--current")}),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'.concat(e.currentMode,'"]')).classList.add("vditor-menu--current")),e.outline.toggle(e,e.currentMode!=="sv"&&e.options.outline.enable,typeof n!="string")}},$n=(function(e){Yn(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),a.innerHTML='<button data-mode="wysiwyg">'.concat(window.VditorI18n.wysiwyg," <").concat((0,l.ns)("⌥⌘7"),`></button>
|
|
71
71
|
<button data-mode="ir">`).concat(window.VditorI18n.instantRendering," <").concat((0,l.ns)("⌥⌘8"),`></button>
|
|
72
|
-
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];g(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(o){Je(n,"wysiwyg",o),o.preventDefault(),o.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(o){Je(n,"ir",o),o.preventDefault(),o.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(o){Je(n,"sv",o),o.preventDefault(),o.stopPropagation()})},t})(me),st=function(e,t){return(0,k.Gb)(e,t)?getSelection().toString():""},Dt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(
|
|
72
|
+
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];g(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(o){Je(n,"wysiwyg",o),o.preventDefault(),o.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(o){Je(n,"ir",o),o.preventDefault(),o.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(o){Je(n,"sv",o),o.preventDefault(),o.stopPropagation()})},t})(me),st=function(e,t){return(0,k.Gb)(e,t)?getSelection().toString():""},Dt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(D(e)),b(e,["subToolbar","hint"])})},nn=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,K.E)(n.target,e.options.lang,e.options.theme))})},Ht=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,k.zh)(e),e.options.blur&&e.options.blur(D(e))})},Ot=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(E.g.DROP_EDITOR,E.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(E.g.DROP_EDITOR)?ee(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Ct(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},Nt=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},Rt=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")})},be=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,k.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)}},It=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"||I("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(ke(e,n))return}else if(e.currentMode==="wysiwyg"){if(Gn(e,n))return}else if(e.currentMode==="ir"&&he(e,n))return;if(e.options.ctrlEnter&&I("⌘Enter",n)){e.options.ctrlEnter(D(e)),n.preventDefault();return}if(I("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(I("⌘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(D(e)),n.preventDefault();return}if((0,l.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)?At(e):yt(e,r),ce(e)}else e.currentMode==="sv"?an(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ut(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return n.code==="Digit7"?Je(e,"wysiwyg",n):n.code==="Digit8"?Je(e,"ir",n):n.code==="Digit9"&&Je(e,"sv",n),!0;e.options.toolbar.find(function(i){if(!i.hotkey||i.toolbar){if(i.toolbar){var a=i.toolbar.find(function(o){if(!o.hotkey)return!1;if(I(o.hotkey,n))return e.toolbar.elements[o.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0});return!!a}return!1}if(I(i.hotkey,n))return e.toolbar.elements[i.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0})}})},Pt=function(e,t){t.addEventListener("selectstart",function(n){t.onmouseup=function(){setTimeout(function(){var r=st(e[e.currentMode].element);r.trim()?(e.currentMode==="wysiwyg"&&e.options.comment.enable&&(!(0,s.a1)(n.target,"data-type","footnotes-block")&&!(0,s.a1)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.showComment():e.wysiwyg.hideComment()),e.options.select&&e.options.select(r)):(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.wysiwyg.hideComment(),typeof e.options.unSelect=="function"&&e.options.unSelect())})}})},jt=function(e,t){var n=(0,k.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,s.a1)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i=e.lute.SpinVditorSVDOM(r.textContent);i="<div data-block='0'>"+i.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">
|
|
73
73
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
74
74
|
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,ye(e.sv.element),(0,k.ib)(e.sv.element,n),be(e)},bt=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},rn=function(e,t){_("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">
|
|
75
75
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
76
|
-
</span></span></div><div data-block="0"><`)+"</div>",_("SpinVditorSVDOM",e,"result",t.options.debugger),e}
|
|
76
|
+
</span></span></div><div data-block="0"><`)+"</div>",_("SpinVditorSVDOM",e,"result",t.options.debugger),e},Qn=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:"",i=!1;for(t==="newline"&&(i=!0);n&&!i;){var a=n.getAttribute("data-type");if(a==="li-marker"||a==="blockquote-marker"||a==="task-marker"||a==="padding"){var o=n.textContent;if(a==="li-marker"&&(t==="code-block-open-marker"||t==="code-block-info"))r=o.replace(/\S/g," ")+r;else if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var u=bt(e,"code-block-open-marker");u&&u.previousElementSibling&&(n=u.previousElementSibling,r=o+r)}else r=o+r}else a==="newline"&&(i=!0);n=n.previousElementSibling}return r},Ce=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=D(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,l.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)},an=function(e,t){var n=(0,k.zh)(e),r=(0,C.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
|
|
77
77
|
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},er=function(e,t,n,r){var i=(0,k.zh)(e),a=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">
|
|
78
78
|
</span></span>`,(0,k.ib)(e.sv.element,i));var o=(0,s.F9)(i.startContainer),u=(0,C.S)(i.startContainer,"SPAN");if(o){if(a==="link"){var h=void 0;i.toString()===""?h="".concat(n).concat(Lute.Caret).concat(r):h="".concat(n).concat(i.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,h);return}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"||a==="line"){var h=void 0;i.toString()===""?h="".concat(n).concat(Lute.Caret).concat(a==="code"?"":r):h="".concat(n).concat(i.toString()).concat(Lute.Caret).concat(a==="code"?"":r),a==="table"||a==="code"&&u&&u.textContent!==""?h=`
|
|
79
79
|
|
|
80
80
|
`+h:a==="line"&&(h=`
|
|
81
81
|
|
|
82
82
|
`.concat(n,`
|
|
83
|
-
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,h);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var f="* ";a==="check"?f="* [ ] ":a==="ordered-list"?f="1. ":a==="quote"&&(f="> ");var S=bt(u,"newline");S?S.insertAdjacentText("afterend",f):o.insertAdjacentText("afterbegin",f),ie(e);return}(0,k.ib)(e.sv.element,i),
|
|
83
|
+
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,h);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var f="* ";a==="check"?f="* [ ] ":a==="ordered-list"?f="1. ":a==="quote"&&(f="> ");var S=bt(u,"newline");S?S.insertAdjacentText("afterend",f):o.insertAdjacentText("afterbegin",f),ie(e);return}(0,k.ib)(e.sv.element,i),Ce(e)}},on=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},sn=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])})},tr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function h(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,h)}f((r=r.apply(e,t||[])).next())})},nr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return h([f,S])}}function h(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},rr=(function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e})(),ir=function(e,t){e.tip.hide();var n=[],r="",i="";e.options.lang,e.options;for(var a=function(f,S){var T=t[S],N=!0;T.name||(r+="<li>".concat(window.VditorI18n.nameEmpty,"</li>"),N=!1),T.size>e.options.upload.max&&(r+="<li>".concat(T.name," ").concat(window.VditorI18n.over," ").concat(e.options.upload.max/1024/1024,"M</li>"),N=!1);var R=T.name.lastIndexOf("."),H=T.name.substr(R),U=e.options.upload.filename(T.name.substr(0,R))+H;if(e.options.upload.accept){var B=e.options.upload.accept.split(",").some(function(O){var G=O.trim();if(G.indexOf(".")===0){if(H.toLowerCase()===G.toLowerCase())return!0}else if(T.type.split("/")[0]===G.split("/")[0])return!0;return!1});B||(r+="<li>".concat(T.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),N=!1)}N&&(n.push(T),i+="<li>".concat(U," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},o=t.length,u=0;u<o;u++)a(o,u);if(e.tip.show("<ul>".concat(r).concat(i,"</ul>")),e.options.upload.cancel){var h=e.tip.element.querySelector(".vditorCancelUpload");h&&h.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},ar=function(e,t){var n=on(t);n.focus();var r=JSON.parse(e),i="";r.code===1&&(i="".concat(r.msg)),r.data.errFiles&&r.data.errFiles.length>0&&(i="<ul><li>".concat(i,"</li>"),r.data.errFiles.forEach(function(o){var u=o.lastIndexOf("."),h=t.options.upload.filename(o.substr(0,u))+o.substr(u);i+="<li>".concat(h," ").concat(window.VditorI18n.uploadError,"</li>")}),i+="</ul>"),i?t.tip.show(i):t.tip.hide();var a="";Object.keys(r.data.succMap).forEach(function(o){var u=r.data.succMap[o],h=o.lastIndexOf("."),f=o.substr(h),S=t.options.upload.filename(o.substr(0,h))+f;f=f.toLowerCase(),f.indexOf(".wav")===0||f.indexOf(".mp3")===0||f.indexOf(".ogg")===0?t.currentMode==="wysiwyg"?a+=`<div class="vditor-wysiwyg__block" data-type="html-block"
|
|
84
84
|
data-block="0"><pre><code><audio controls="controls" src="`.concat(u,'"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(u,`"></audio></pre></div>
|
|
85
85
|
`):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(u,`"></audio>
|
|
86
86
|
`):a+="[".concat(S,"](").concat(u,`)
|
|
@@ -88,13 +88,13 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
88
88
|
`):a+=".concat(u,`)
|
|
89
89
|
`):t.currentMode==="wysiwyg"?a+='<a href="'.concat(u,'">').concat(S,`</a>
|
|
90
90
|
`):a+="[".concat(S,"](").concat(u,`)
|
|
91
|
-
`)}),(0,k.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},Bt=function(e,t,n){return tr(void 0,void 0,void 0,function(){var r,i,H,a,o,o,u,h,f,S,T,N,R,H,U,B;return nr(this,function(O){switch(O.label){case 0:for(r=[],i=e.options.upload.multiple===!0?t.length:1,H=0;H<i;H++)a=t[H],a instanceof DataTransferItem&&(a=a.getAsFile()),r.push(a);return e.options.upload.handler?[4,e.options.upload.handler(r)]:[3,2];case 1:return o=O.sent(),n&&(n.value=""),typeof o=="string"?(e.tip.show(o),[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=O.sent(),O.label=4;case 4:if(e.options.upload.validate&&(o=e.options.upload.validate(r),typeof o=="string"))return e.tip.show(o),[2];if(u=on(e),e.upload.range=(0,k.zh)(e),h=ir(e,r),h.length===0)return n&&(n.value=""),[2];for(f=new FormData,S=e.options.upload.extraData,T=0,N=Object.keys(S);T<N.length;T++)R=N[T],f.append(R,S[R]);for(H=0,U=h.length;H<U;H++)f.append(e.options.upload.fieldName,h[H]);return B=new XMLHttpRequest,e.upload.xhr=B,B.open("POST",e.options.upload.url),e.options.upload.token&&B.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(B.withCredentials=!0),sn(e,B),e.upload.isUploading=!0,u.setAttribute("contenteditable","false"),B.onreadystatechange=function(){if(B.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,u.setAttribute("contenteditable","true"),B.status>=200&&B.status<300)if(e.options.upload.success)e.options.upload.success(u,B.responseText);else{var G=B.responseText;e.options.upload.format&&(G=e.options.upload.format(t,B.responseText)),ar(G,e)}else e.options.upload.error?e.options.upload.error(B.responseText):e.tip.show(B.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},B.upload.onprogress=function(G){if(G.lengthComputable){var V=G.loaded/G.total*100;e.upload.element.style.display="block";var J=e.upload.element;J.style.width=V+"%"}},B.send(f),[2]}})})},wt=function(e,t,n){var r,i=(0,s.F9)(t.startContainer);if(i||(i=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 a=Fn(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(V){V.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(V){V.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(V){V.textContent.trim()===""&&(V.classList.remove("vditor-comment","vditor-comment--focus"),V.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(V){V.textContent.trim()===""&&(V.classList.remove("vditor-comment","vditor-comment--focus"),V.removeAttribute("data-cmtids"))});var o="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var u=i.isEqualNode(e.wysiwyg.element),h=(0,s.a1)(i,"data-type","footnotes-block");if(u)o=i.innerHTML;else{var f=(0,s.O9)(t.startContainer);if(f&&!h){var S=(0,C.S)(t.startContainer,"BLOCKQUOTE");S?i=(0,s.F9)(t.startContainer)||i:i=f}if(h&&(i=h),o=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var T=i.previousElementSibling,N=i.nextElementSibling;T&&(T.tagName==="UL"||T.tagName==="OL")&&(o=T.outerHTML+o,T.remove()),N&&(N.tagName==="UL"||N.tagName==="OL")&&(o=o+N.outerHTML,N.remove()),o=o.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}i.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(V){V&&!i.isEqualNode(V)&&(o+=V.outerHTML,V.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(V){V&&!i.isEqualNode(V)&&(o+=V.outerHTML,V.remove())}))}if(o=o.replace(/<\/(strong|b)><strong data-marker="\W{2}">/g,"").replace(/<\/(em|i)><em data-marker="\W{1}">/g,"").replace(/<\/(s|strike)><s data-marker="~{1,2}">/g,""),o==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(o='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),_("SpinVditorDOM",o,"argument",e.options.debugger),o=e.lute.SpinVditorDOM(o),_("SpinVditorDOM",o,"result",e.options.debugger),u)i.innerHTML=o;else if(i.outerHTML=o,h){var R=(0,s.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(R){var H=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(R.getAttribute("data-marker"),'"]'));H&&H.setAttribute("aria-label",R.textContent.trim().substr(0,24))}}var U,B=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");B.forEach(function(V,J){J===0?U=V:(U.insertAdjacentHTML("beforeend",V.innerHTML),V.remove())}),B.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",B[0]);var O,G=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");G.forEach(function(V,J){J===0?O=V:(O.insertAdjacentHTML("beforeend",V.innerHTML),V.remove())}),G.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",G[0]),(0,k.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(V){
|
|
92
|
-
</p>`)),(0,k.ib)(e[e.currentMode].element,n)
|
|
93
|
-
`)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var o=i.nextElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!0),(0,k.Hc)(n)),t.preventDefault(),!0}return!1}
|
|
94
|
-
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var o=i.previousElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!1),(0,k.Hc)(n)),t.preventDefault(),!0}return!1},vt=function(e,t,n,r){r===void 0&&(r=!0);var i=(0,s.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(S){S.remove()}),t.insertNode(document.createElement("wbr")),r&&i){for(var a="",o=0;o<i.parentElement.childElementCount;o++){var u=i.parentElement.children[o].querySelector("input");u&&u.remove(),a+='<p data-block="0">'.concat(i.parentElement.children[o].innerHTML.trimLeft(),"</p>")}i.parentElement.insertAdjacentHTML("beforebegin",a),i.parentElement.remove()}else if(i)if(n==="check")i.parentElement.querySelectorAll("li").forEach(function(S){S.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(S.textContent.indexOf(" ")===0?"":" ")),S.classList.add("vditor-task")});else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach(function(S){S.querySelector("input").remove(),S.classList.remove("vditor-task")});var f=void 0;n==="list"?(f=document.createElement("ul"),f.setAttribute("data-marker","*")):(f=document.createElement("ol"),f.setAttribute("data-marker","1.")),f.setAttribute("data-block","0"),f.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),f.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(f,i.parentElement)}else{var h=(0,s.a1)(t.startContainer,"data-block","0");h||(e[e.currentMode].element.querySelector("wbr").remove(),h=e[e.currentMode].element.querySelector("p"),h.innerHTML="<wbr>"),n==="check"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="list"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="ordered-list"&&(h.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(h.innerHTML,"</li></ol>")),h.remove())}},hn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(h,f){h.nodeType!==3&&t&&h.textContent.trim()!==""&&t.getAttribute("data-node-id")===h.getAttribute("data-node-id")&&(f!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(h){h.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,o="";i.forEach(function(h){var f=h.getAttribute("data-marker");f.length!==1&&(f="1".concat(f.slice(-1))),o+='<li data-node-id="'.concat(h.getAttribute("data-node-id"),'" data-marker="').concat(f,'">').concat(h.innerHTML,"</li>"),h.remove()}),r.insertAdjacentHTML("beforeend","<".concat(a.tagName,' data-block="0">').concat(o,"</").concat(a.tagName,">")),e.currentMode==="wysiwyg"?a.outerHTML=e.lute.SpinVditorDOM(a.outerHTML):a.outerHTML=e.lute.SpinVditorIRDOM(a.outerHTML),(0,k.ib)(e[e.currentMode].element,n);var u=(0,s.O9)(n.startContainer);u&&u.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(h){
|
|
91
|
+
`)}),(0,k.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},Bt=function(e,t,n){return tr(void 0,void 0,void 0,function(){var r,i,H,a,o,o,u,h,f,S,T,N,R,H,U,B;return nr(this,function(O){switch(O.label){case 0:for(r=[],i=e.options.upload.multiple===!0?t.length:1,H=0;H<i;H++)a=t[H],a instanceof DataTransferItem&&(a=a.getAsFile()),r.push(a);return e.options.upload.handler?[4,e.options.upload.handler(r)]:[3,2];case 1:return o=O.sent(),n&&(n.value=""),typeof o=="string"?(e.tip.show(o),[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=O.sent(),O.label=4;case 4:if(e.options.upload.validate&&(o=e.options.upload.validate(r),typeof o=="string"))return e.tip.show(o),[2];if(u=on(e),e.upload.range=(0,k.zh)(e),h=ir(e,r),h.length===0)return n&&(n.value=""),[2];for(f=new FormData,S=e.options.upload.extraData,T=0,N=Object.keys(S);T<N.length;T++)R=N[T],f.append(R,S[R]);for(H=0,U=h.length;H<U;H++)f.append(e.options.upload.fieldName,h[H]);return B=new XMLHttpRequest,e.upload.xhr=B,B.open("POST",e.options.upload.url),e.options.upload.token&&B.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(B.withCredentials=!0),sn(e,B),e.upload.isUploading=!0,u.setAttribute("contenteditable","false"),B.onreadystatechange=function(){if(B.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,u.setAttribute("contenteditable","true"),B.status>=200&&B.status<300)if(e.options.upload.success)e.options.upload.success(u,B.responseText);else{var G=B.responseText;e.options.upload.format&&(G=e.options.upload.format(t,B.responseText)),ar(G,e)}else e.options.upload.error?e.options.upload.error(B.responseText):e.tip.show(B.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},B.upload.onprogress=function(G){if(G.lengthComputable){var V=G.loaded/G.total*100;e.upload.element.style.display="block";var J=e.upload.element;J.style.width=V+"%"}},B.send(f),[2]}})})},wt=function(e,t,n){var r,i=(0,s.F9)(t.startContainer);if(i||(i=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 a=Fn(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(V){V.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(V){V.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(V){V.textContent.trim()===""&&(V.classList.remove("vditor-comment","vditor-comment--focus"),V.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(V){V.textContent.trim()===""&&(V.classList.remove("vditor-comment","vditor-comment--focus"),V.removeAttribute("data-cmtids"))});var o="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var u=i.isEqualNode(e.wysiwyg.element),h=(0,s.a1)(i,"data-type","footnotes-block");if(u)o=i.innerHTML;else{var f=(0,s.O9)(t.startContainer);if(f&&!h){var S=(0,C.S)(t.startContainer,"BLOCKQUOTE");S?i=(0,s.F9)(t.startContainer)||i:i=f}if(h&&(i=h),o=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var T=i.previousElementSibling,N=i.nextElementSibling;T&&(T.tagName==="UL"||T.tagName==="OL")&&(o=T.outerHTML+o,T.remove()),N&&(N.tagName==="UL"||N.tagName==="OL")&&(o=o+N.outerHTML,N.remove()),o=o.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}i.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(V){V&&!i.isEqualNode(V)&&(o+=V.outerHTML,V.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(V){V&&!i.isEqualNode(V)&&(o+=V.outerHTML,V.remove())}))}if(o=o.replace(/<\/(strong|b)><strong data-marker="\W{2}">/g,"").replace(/<\/(em|i)><em data-marker="\W{1}">/g,"").replace(/<\/(s|strike)><s data-marker="~{1,2}">/g,""),o==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(o='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),_("SpinVditorDOM",o,"argument",e.options.debugger),o=e.lute.SpinVditorDOM(o),_("SpinVditorDOM",o,"result",e.options.debugger),u)i.innerHTML=o;else if(i.outerHTML=o,h){var R=(0,s.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(R){var H=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(R.getAttribute("data-marker"),'"]'));H&&H.setAttribute("aria-label",R.textContent.trim().substr(0,24))}}var U,B=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");B.forEach(function(V,J){J===0?U=V:(U.insertAdjacentHTML("beforeend",V.innerHTML),V.remove())}),B.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",B[0]);var O,G=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");G.forEach(function(V,J){J===0?O=V:(O.insertAdjacentHTML("beforeend",V.innerHTML),V.remove())}),G.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",G[0]),(0,k.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(V){Se(V,e)}),n&&(n.inputType==="deleteContentBackward"||n.inputType==="deleteContentForward")&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}Be(e),ce(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},or=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},ln=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function h(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,h)}f((r=r.apply(e,t||[])).next())})},cn=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return h([f,S])}}function h(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},un=function(e,t,n){if(e.keyCode===229&&e.code===""&&e.key==="Unidentified"&&t.currentMode!=="sv"){var r=(0,s.F9)(n);if(r&&r.textContent.trim()==="")return t[t.currentMode].composingLock=!0,!1}return!0},fn=function(e,t,n){if(!(n.key==="Enter"||n.key==="Tab"||n.key==="Backspace"||n.key.indexOf("Arrow")>-1||(0,l.yl)(n)||n.key==="Escape"||n.shiftKey||n.altKey)){var r=(0,s.lG)(e.startContainer,"P")||(0,s.lG)(e.startContainer,"LI");if(r&&(0,k.im)(r,t[t.currentMode].element,e).start===0){r.nodeValue&&(r.nodeValue=r.nodeValue.replace(/\u2006/g,""));var i=document.createTextNode(E.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},dn=function(e,t){if(t==="ArrowDown"||t==="ArrowUp"){var n=(0,s.a1)(e.startContainer,"data-type","math-inline")||(0,s.a1)(e.startContainer,"data-type","html-entity")||(0,s.a1)(e.startContainer,"data-type","html-inline");n&&(t==="ArrowDown"&&e.setStartAfter(n.parentElement),t==="ArrowUp"&&e.setStartBefore(n.parentElement))}},lt=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'.concat(E.g.ZWSP,`<wbr>
|
|
92
|
+
</p>`)),(0,k.ib)(e[e.currentMode].element,n),$e(e),ee(e))},sr=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},lr=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},pn=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,k.Hc)(t)),r},ct=function(e,t,n,r,i){var a=(0,k.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowDown"&&r.textContent.trimRight().substr(a.start).indexOf(`
|
|
93
|
+
`)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var o=i.nextElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!0),(0,k.Hc)(n)),t.preventDefault(),!0}return!1},Qe=function(e,t,n,r,i){var a=(0,k.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowUp"&&r.textContent.substr(0,a.start).indexOf(`
|
|
94
|
+
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var o=i.previousElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!1),(0,k.Hc)(n)),t.preventDefault(),!0}return!1},vt=function(e,t,n,r){r===void 0&&(r=!0);var i=(0,s.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(S){S.remove()}),t.insertNode(document.createElement("wbr")),r&&i){for(var a="",o=0;o<i.parentElement.childElementCount;o++){var u=i.parentElement.children[o].querySelector("input");u&&u.remove(),a+='<p data-block="0">'.concat(i.parentElement.children[o].innerHTML.trimLeft(),"</p>")}i.parentElement.insertAdjacentHTML("beforebegin",a),i.parentElement.remove()}else if(i)if(n==="check")i.parentElement.querySelectorAll("li").forEach(function(S){S.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(S.textContent.indexOf(" ")===0?"":" ")),S.classList.add("vditor-task")});else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach(function(S){S.querySelector("input").remove(),S.classList.remove("vditor-task")});var f=void 0;n==="list"?(f=document.createElement("ul"),f.setAttribute("data-marker","*")):(f=document.createElement("ol"),f.setAttribute("data-marker","1.")),f.setAttribute("data-block","0"),f.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),f.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(f,i.parentElement)}else{var h=(0,s.a1)(t.startContainer,"data-block","0");h||(e[e.currentMode].element.querySelector("wbr").remove(),h=e[e.currentMode].element.querySelector("p"),h.innerHTML="<wbr>"),n==="check"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="list"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="ordered-list"&&(h.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(h.innerHTML,"</li></ol>")),h.remove())}},hn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(h,f){h.nodeType!==3&&t&&h.textContent.trim()!==""&&t.getAttribute("data-node-id")===h.getAttribute("data-node-id")&&(f!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(h){h.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,o="";i.forEach(function(h){var f=h.getAttribute("data-marker");f.length!==1&&(f="1".concat(f.slice(-1))),o+='<li data-node-id="'.concat(h.getAttribute("data-node-id"),'" data-marker="').concat(f,'">').concat(h.innerHTML,"</li>"),h.remove()}),r.insertAdjacentHTML("beforeend","<".concat(a.tagName,' data-block="0">').concat(o,"</").concat(a.tagName,">")),e.currentMode==="wysiwyg"?a.outerHTML=e.lute.SpinVditorDOM(a.outerHTML):a.outerHTML=e.lute.SpinVditorIRDOM(a.outerHTML),(0,k.ib)(e[e.currentMode].element,n);var u=(0,s.O9)(n.startContainer);u&&u.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(h){Se(h,e),e.currentMode==="wysiwyg"&&h.previousElementSibling.setAttribute("style","display:none")}),ee(e),$e(e)}else e[e.currentMode].element.focus()},Ut=function(e,t,n,r){var i=(0,s.lG)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(T){T.remove()}),n.insertNode(document.createElement("wbr"));var a=t.parentElement,o=a.cloneNode(),u=[t];Array.from(n.cloneContents().children).forEach(function(T,N){T.nodeType!==3&&t&&T.textContent.trim()!==""&&t.getAttribute("data-node-id")===T.getAttribute("data-node-id")&&(N!==0&&u.push(t),t=t.nextElementSibling)});var h=!1,f="";a.querySelectorAll("li").forEach(function(T){h&&(f+=T.outerHTML,!T.nextElementSibling&&!T.previousElementSibling?T.parentElement.remove():T.remove()),T.isSameNode(u[u.length-1])&&(h=!0)}),u.reverse().forEach(function(T){i.insertAdjacentElement("afterend",T)}),f&&(o.innerHTML=f,u[0].insertAdjacentElement("beforeend",o)),e.currentMode==="wysiwyg"?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,k.ib)(e[e.currentMode].element,n);var S=(0,s.O9)(n.startContainer);S&&S.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(T){Se(T,e),e.currentMode==="wysiwyg"&&T.previousElementSibling.setAttribute("style","display:none")}),ee(e),$e(e)}else e[e.currentMode].element.focus()},Et=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,a=0,o=0;o<i;o++)for(var u=0;u<r;u++)if(e.rows[o].cells[u].isSameNode(n)){a=u;break}for(var h=0;h<i;h++)e.rows[h].cells[a].setAttribute("align",t)},Vt=function(e){var t=e.trimRight().split(`
|
|
95
95
|
`).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(`
|
|
96
96
|
`).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},Wt=function(e){var t=e.trimRight().split(`
|
|
97
|
-
`);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},ee=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?ce(e,t):e.currentMode==="ir"?We(e,t):e.currentMode==="sv"&&
|
|
97
|
+
`);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},ee=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?ce(e,t):e.currentMode==="ir"?We(e,t):e.currentMode==="sv"&&Ce(e,t)},mn=function(e,t,n,r){var i,a=e.startContainer,o=(0,s.lG)(a,"LI");if(o){if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&o.contains(n)&&n.nextElementSibling)return o&&!o.textContent.endsWith(`
|
|
98
98
|
`)&&o.insertAdjacentText("beforeend",`
|
|
99
99
|
`),e.insertNode(document.createTextNode(`
|
|
100
100
|
|
|
@@ -110,7 +110,7 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
110
110
|
</p>`),(0,k.ib)(t[t.currentMode].element,r),ee(t),be(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,l.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
|
|
111
111
|
`).length>1&&(0,k.im)(n,t[t.currentMode].element,r).start===0){var f=(0,s.DX)(n.previousElementSibling);return f.textContent.endsWith(`
|
|
112
112
|
`)||(f.textContent=f.textContent+`
|
|
113
|
-
`),f.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),!1}return!1}},yn=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)r+='<td align="'.concat(n.parentElement.children[i].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>")),ee(e)},bn=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)n.tagName==="TH"?r+='<th align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </th>'):r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>".concat(r,"</tr></thead>")),t.insertNode(document.createElement("wbr"));var a=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",a),n.parentElement.parentElement.remove(),(0,k.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));ee(e)},St=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var o=0;o<t.rows.length;o++)o===0?t.rows[o].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[o].cells[i].insertAdjacentHTML(r,"<td> </td>");ee(e)},wn=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,k.Hc)(t),ee(e)}},vn=function(e,t,n,r){for(var i=0,a=r.previousElementSibling;a;)i++,a=a.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var o=0;o<n.rows.length;o++){var u=n.rows[o].cells;if(u.length===1){n.remove()
|
|
113
|
+
`),f.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),!1}return!1}},yn=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)r+='<td align="'.concat(n.parentElement.children[i].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>")),ee(e)},bn=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)n.tagName==="TH"?r+='<th align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </th>'):r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>".concat(r,"</tr></thead>")),t.insertNode(document.createElement("wbr"));var a=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",a),n.parentElement.parentElement.remove(),(0,k.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));ee(e)},St=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var o=0;o<t.rows.length;o++)o===0?t.rows[o].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[o].cells[i].insertAdjacentHTML(r,"<td> </td>");ee(e)},wn=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,k.Hc)(t),ee(e)}},vn=function(e,t,n,r){for(var i=0,a=r.previousElementSibling;a;)i++,a=a.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var o=0;o<n.rows.length;o++){var u=n.rows[o].cells;if(u.length===1){n.remove(),$e(e);break}u[i].remove()}(0,k.Hc)(t),ee(e)},En=function(e,t,n){var r=n.startContainer,i=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(i){if(!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"){(!i.lastElementChild||i.lastElementChild&&(!i.lastElementChild.isSameNode(i.lastChild)||i.lastElementChild.tagName!=="BR"))&&i.insertAdjacentHTML("beforeend","<br>");var a=document.createElement("br");return n.insertNode(a),n.setStartAfter(a),ee(e),be(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return pn(i,n),t.preventDefault(),!0;var o=i.nextElementSibling;return o||(i.parentElement.nextElementSibling?o=i.parentElement.nextElementSibling.firstElementChild:i.parentElement.parentElement.tagName==="THEAD"&&i.parentElement.parentElement.nextElementSibling?o=i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:o=null),o&&(n.selectNodeContents(o),(0,k.Hc)(n)),t.preventDefault(),!0}var u=i.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),i.tagName==="TH")return u.previousElementSibling?(n.selectNodeContents(u.previousElementSibling),n.collapse(!1),(0,k.Hc)(n)):lt(e,"beforebegin"),!0;for(var h=0,f=i.parentElement;h<f.cells.length&&!f.cells[h].isSameNode(i);h++);var S=f.previousElementSibling;return S||(S=f.parentElement.previousElementSibling.firstChild),n.selectNodeContents(S.cells[h]),n.collapse(!1),(0,k.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var f=i.parentElement;if(!f.nextElementSibling&&i.tagName==="TD")return u.nextElementSibling?(n.selectNodeContents(u.nextElementSibling),n.collapse(!0),(0,k.Hc)(n)):lt(e,"afterend"),!0;for(var h=0;h<f.cells.length&&!f.cells[h].isSameNode(i);h++);var o=f.nextElementSibling;return o||(o=f.parentElement.nextElementSibling.firstChild),n.selectNodeContents(o.cells[h]),n.collapse(!0),(0,k.Hc)(n),!0}if(e.currentMode==="wysiwyg"&&!(0,l.yl)(t)&&t.key==="Enter"&&!t.shiftKey&&t.altKey){var T=e.wysiwyg.popover.querySelector(".vditor-input");return T.focus(),T.select(),t.preventDefault(),!0}if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Backspace"&&n.startOffset===0&&n.toString()===""){var N=pn(i,n,!1);return!N&&u&&(u.textContent.trim()===""?(u.outerHTML=`<p data-block="0"><wbr>
|
|
114
114
|
</p>`,(0,k.ib)(e[e.currentMode].element,n)):(n.setStartBefore(u),n.collapse(!0)),ee(e)),t.preventDefault(),!0}if(I("⇧⌘F",t))return bn(e,n,i),t.preventDefault(),!0;if(I("⌘=",t))return yn(e,n,i),t.preventDefault(),!0;if(I("⇧⌘G",t))return St(e,u,i,"beforebegin"),t.preventDefault(),!0;if(I("⇧⌘=",t))return St(e,u,i),t.preventDefault(),!0;if(I("⌘-",t))return wn(e,n,i),t.preventDefault(),!0;if(I("⇧⌘-",t))return vn(e,n,u,i),t.preventDefault(),!0;if(I("⇧⌘L",t)){if(e.currentMode==="ir")return Et(u,"left"),ee(e),t.preventDefault(),!0;var R=e.wysiwyg.popover.querySelector('[data-type="left"]');if(R)return R.click(),t.preventDefault(),!0}if(I("⇧⌘C",t)){if(e.currentMode==="ir")return Et(u,"center"),ee(e),t.preventDefault(),!0;var R=e.wysiwyg.popover.querySelector('[data-type="center"]');if(R)return R.click(),t.preventDefault(),!0}if(I("⇧⌘R",t)){if(e.currentMode==="ir")return Et(u,"right"),ee(e),t.preventDefault(),!0;var R=e.wysiwyg.popover.querySelector('[data-type="right"]');if(R)return R.click(),t.preventDefault(),!0}}return!1},Sn=function(e,t,n,r){if(n.tagName==="PRE"&&I("⌘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),ee(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,k.im)(n,e[e.currentMode].element,r);if((i.start===0||i.start===1&&n.innerText===`
|
|
115
115
|
`)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,k.ib)(e[e.currentMode].element,r),ee(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
|
|
116
116
|
`)||n.firstElementChild.insertAdjacentText("beforeend",`
|
|
@@ -119,30 +119,30 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
119
119
|
`||r.innerHTML.replace(E.g.ZWSP,"")===""?(o=!0,r.remove()):r.innerHTML.endsWith(`
|
|
120
120
|
|
|
121
121
|
`)&&(0,k.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),o=!0),o)return a.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(E.g.ZWSP,`<wbr>
|
|
122
|
-
</p>`)),(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}var u=(0,s.F9)(i);if(e.currentMode==="wysiwyg"&&u&&I("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),u.outerHTML='<blockquote data-block="0">'.concat(u.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,t),ce(e),n.preventDefault(),!0;if(ct(e,n,t,a,a)
|
|
122
|
+
</p>`)),(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}var u=(0,s.F9)(i);if(e.currentMode==="wysiwyg"&&u&&I("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),u.outerHTML='<blockquote data-block="0">'.concat(u.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,t),ce(e),n.preventDefault(),!0;if(ct(e,n,t,a,a)||Qe(e,n,t,a,a))return!0}return!1},Ln=function(e,t,n){var r=t.startContainer,i=(0,s.lG)(r,"LI");if(i&&i.classList.contains("vditor-task")){if(I("⇧⌘J",n)){var a=i.firstElementChild;return a.checked?a.removeAttribute("checked"):a.setAttribute("checked","checked"),ee(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&t.toString()===""&&t.startOffset===1&&(r.nodeType===3&&r.previousSibling&&r.previousSibling.tagName==="INPUT"||r.nodeType!==3)){var o=i.previousElementSibling;if(i.querySelector("input").remove(),o){var u=(0,s.DX)(o);u.parentElement.insertAdjacentHTML("beforeend","<wbr>"+i.innerHTML.trim()),i.remove()}else i.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(i.innerHTML.trim()||`
|
|
123
123
|
`,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(i.textContent.trim()==="")if((0,s.fb)(i.parentElement,"vditor-task")){var h=(0,s.O9)(r);h&&Ut(e,i,t,h)}else if(i.nextElementSibling){var f="",S="",T=!1;Array.from(i.parentElement.children).forEach(function(U){i.isSameNode(U)?T=!0:T?f+=U.outerHTML:S+=U.outerHTML});var N=i.parentElement.tagName,R=i.parentElement.tagName==="OL"?"":' data-marker="'.concat(i.parentElement.getAttribute("data-marker"),'"'),H="";S&&(H=i.parentElement.tagName==="UL"?"":' start="1"',S="<".concat(N,' data-tight="true"').concat(R,' data-block="0">').concat(S,"</").concat(N,">")),i.parentElement.outerHTML="".concat(S,`<p data-block="0"><wbr>
|
|
124
124
|
</p><`).concat(N,`
|
|
125
125
|
data-tight="true"`).concat(R,' data-block="0"').concat(H,">").concat(f,"</").concat(N,">")}else i.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
|
|
126
|
-
</p>`),i.parentElement.querySelectorAll("li").length===1?i.parentElement.remove():i.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(i.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,k.ib)(e[e.currentMode].element,t),ee(e),be(e),n.preventDefault(),!0}}return!1},Mn=function(e,t,n,r){if(t.startContainer.nodeType!==3){var i=t.startContainer.children[t.startOffset];if(i&&i.tagName==="HR")return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var a=r.previousElementSibling;if(a&&(0,k.im)(r,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&a.tagName==="HR"||a.tagName==="TABLE")){if(a.tagName==="TABLE"){var o=a.lastElementChild.lastElementChild.lastElementChild;o.innerHTML=o.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else a.remove();return(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}}return!1},kn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Tn=function(e,t,n){var r,i;if(!(0,l.vU)())return!1;if(e.key==="ArrowUp"&&t&&((r=t.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="TABLE"){var a=t.previousElementSibling;return n.selectNodeContents(a.rows[a.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return e.key==="ArrowDown"&&t&&((i=t.nextElementSibling)===null||i===void 0?void 0:i.tagName)==="TABLE"?(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0):!1},Ct=function(e,t,n){return ln(void 0,void 0,void 0,function(){var r,i,a,o,u,h,f,S,T,N,R,H,U,O,B,O,G;return cn(this,function(V){switch(V.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"),i=t.clipboardData.getData("text/plain"),a=t.clipboardData.files):(r=t.dataTransfer.getData("text/html"),i=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items)),o={},u=function(J,se){if(!se)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,J,se);var ae=J.TokensStr();if(J.__internal_object__.Parent.Type===34&&ae&&ae.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var ue=new XMLHttpRequest;ue.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&ue.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(ue.withCredentials=!0),sn(e,ue),ue.setRequestHeader("Content-Type","application/json; charset=utf-8"),ue.onreadystatechange=function(){if(ue.readyState===XMLHttpRequest.DONE){if(ue.status===200){var xe=ue.responseText;e.options.upload.linkToImgFormat&&(xe=e.options.upload.linkToImgFormat(ue.responseText));var
|
|
126
|
+
</p>`),i.parentElement.querySelectorAll("li").length===1?i.parentElement.remove():i.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(i.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,k.ib)(e[e.currentMode].element,t),ee(e),be(e),n.preventDefault(),!0}}return!1},Mn=function(e,t,n,r){if(t.startContainer.nodeType!==3){var i=t.startContainer.children[t.startOffset];if(i&&i.tagName==="HR")return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var a=r.previousElementSibling;if(a&&(0,k.im)(r,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&a.tagName==="HR"||a.tagName==="TABLE")){if(a.tagName==="TABLE"){var o=a.lastElementChild.lastElementChild.lastElementChild;o.innerHTML=o.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else a.remove();return(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}}return!1},kn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Tn=function(e,t,n){var r,i;if(!(0,l.vU)())return!1;if(e.key==="ArrowUp"&&t&&((r=t.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="TABLE"){var a=t.previousElementSibling;return n.selectNodeContents(a.rows[a.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return e.key==="ArrowDown"&&t&&((i=t.nextElementSibling)===null||i===void 0?void 0:i.tagName)==="TABLE"?(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0):!1},Ct=function(e,t,n){return ln(void 0,void 0,void 0,function(){var r,i,a,o,u,h,f,S,T,N,R,H,U,O,B,O,G;return cn(this,function(V){switch(V.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"),i=t.clipboardData.getData("text/plain"),a=t.clipboardData.files):(r=t.dataTransfer.getData("text/html"),i=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items)),o={},u=function(J,se){if(!se)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,J,se);var ae=J.TokensStr();if(J.__internal_object__.Parent.Type===34&&ae&&ae.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var ue=new XMLHttpRequest;ue.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&ue.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(ue.withCredentials=!0),sn(e,ue),ue.setRequestHeader("Content-Type","application/json; charset=utf-8"),ue.onreadystatechange=function(){if(ue.readyState===XMLHttpRequest.DONE){if(ue.status===200){var xe=ue.responseText;e.options.upload.linkToImgFormat&&(xe=e.options.upload.linkToImgFormat(ue.responseText));var Te=JSON.parse(xe);if(Te.code!==0){e.tip.show(Te.msg);return}var De=Te.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(we){we.textContent===De&&(we.textContent=Te.data.url)});else{var $=e[e.currentMode].element.querySelector('img[src="'.concat(De,'"]'));$.src=Te.data.url,e.currentMode==="ir"&&($.previousElementSibling.previousElementSibling.innerHTML=Te.data.url)}ee(e)}else e.tip.show(ue.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(ue.responseText)}},ue.send(JSON.stringify({url:ae}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(ae),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(ae),"</span>"),Lute.WalkContinue]},(r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(i,'">').concat(i,"</a>")||r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<!--StartFragment--><a href="'.concat(i,'">').concat(i,"</a><!--EndFragment-->"))&&(r=""),h=new DOMParser().parseFromString(r,"text/html"),h.body&&(r=h.body.innerHTML),r=Lute.Sanitize(r),e.wysiwyg.getComments(e),f=e[e.currentMode].element.scrollHeight,S=_e(r,i,e.currentMode),T=e.currentMode==="sv"?(0,s.a1)(t.target,"data-type","code-block"):(0,s.lG)(t.target,"CODE"),T?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,i.replace(/&/g,"&").replace(/</g,"<")):(N=(0,k.im)(t.target,e[e.currentMode].element),T.parentElement.tagName!=="PRE"&&(i+=E.g.ZWSP),T.textContent=T.textContent.substring(0,N.start)+i+T.textContent.substring(N.end),(0,k.$j)(N.start+i.length,N.start+i.length,T.parentElement),!((G=T.parentElement)===null||G===void 0)&&G.nextElementSibling.classList.contains("vditor-".concat(e.currentMode,"__preview"))&&(T.parentElement.nextElementSibling.innerHTML=T.outerHTML,Se(T.parentElement.nextElementSibling,e))),[3,10]):[3,1]);case 1:return S?(n.pasteCode(S),[3,10]):[3,2];case 2:return r.trim()===""?[3,5]:(R=document.createElement("div"),R.innerHTML=r,e.options.upload.base64ToLink?[3,4]:[4,cr(e,R,("clipboardData"in t?t.clipboardData:t.dataTransfer).getData("text/rtf"))]);case 3:V.sent(),V.label=4;case 4:return R.querySelectorAll("[style]").forEach(function(J){J.removeAttribute("style")}),R.querySelectorAll(".vditor-copy").forEach(function(J){J.remove()}),e.currentMode==="ir"?(o.HTML2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(e.lute.HTML2VditorIRDOM(R.innerHTML),e)):e.currentMode==="wysiwyg"?(o.HTML2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(e.lute.HTML2VditorDOM(R.innerHTML),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),jt(e,e.lute.HTML2Md(R.innerHTML).trimRight())),e.outline.render(e),[3,10];case 5:return a.length>0?e.options.upload.url||e.options.upload.handler?[4,Bt(e,a)]:[3,7]:[3,9];case 6:return V.sent(),[3,8];case 7:H=new FileReader,"clipboardData"in t?(a=t.clipboardData.files,U=a[0]):t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items,U=a[0].getAsFile()),U&&U.type.startsWith("image")&&(H.readAsDataURL(U),H.onload=function(){var J="";e.currentMode==="wysiwyg"?J+='<img alt="'.concat(U.name,'" src="').concat(H.result.toString(),`">
|
|
127
127
|
`):J+=".concat(H.result.toString(),`)
|
|
128
|
-
`),document.execCommand("insertHTML",!1,J)}),V.label=8;case 8:return[3,10];case 9:i.trim()!==""&&a.length===0&&(O=(0,k.zh)(e),O.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(O.toString(),"](").concat(i,")")),e.currentMode==="ir"?(o.Md2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(i)),e)):e.currentMode==="wysiwyg"?(o.Md2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(i)),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),jt(e,i)),e.outline.render(e)),V.label=10;case 10:return e.currentMode!=="sv"&&(B=(0,s.F9)((0,k.zh)(e).startContainer),B&&(O=(0,k.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(J){J.remove()}),O.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?B.outerHTML=e.lute.SpinVditorDOM(B.outerHTML):B.outerHTML=e.lute.SpinVditorIRDOM(B.outerHTML),(0,k.ib)(e[e.currentMode].element,O)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(J){
|
|
128
|
+
`),document.execCommand("insertHTML",!1,J)}),V.label=8;case 8:return[3,10];case 9:i.trim()!==""&&a.length===0&&(O=(0,k.zh)(e),O.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(O.toString(),"](").concat(i,")")),e.currentMode==="ir"?(o.Md2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(i)),e)):e.currentMode==="wysiwyg"?(o.Md2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,k.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(i)),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),jt(e,i)),e.outline.render(e)),V.label=10;case 10:return e.currentMode!=="sv"&&(B=(0,s.F9)((0,k.zh)(e).startContainer),B&&(O=(0,k.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(J){J.remove()}),O.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?B.outerHTML=e.lute.SpinVditorDOM(B.outerHTML):B.outerHTML=e.lute.SpinVditorIRDOM(B.outerHTML),(0,k.ib)(e[e.currentMode].element,O)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(J){Se(J,e)})),e.wysiwyg.triggerRemoveComment(e),ee(e),e[e.currentMode].element.scrollHeight-f>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&be(e),[2]}})})},cr=function(e,t,n){return ln(void 0,void 0,void 0,function(){var r,i,a,o,u,h,f,S,T,U,N,R,H,U,B,O;return cn(this,function(G){switch(G.label){case 0:if(!n)return[2];if(r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+r.source+"))([\\da-fA-F\\s]+)\\}","g"),a=n.match(i),o=[],a)for(u=0,h=a;u<h.length;u++)f=h[u],S=void 0,f.includes("\\pngblip")?S="image/png":f.includes("\\jpegblip")&&(S="image/jpeg"),S&&o.push({hex:f.replace(r,"").replace(/[^\da-fA-F]/g,""),type:S});for(T=[],qt(t,function(V){if(V.tagName==="V:SHAPE")return qt(V,function(J){J.tagName==="V:IMAGEDATA"&&T.push({shape:V,img:J})}),!1}),U=0;U<T.length;U++)N=document.createElement("img"),R="data:"+o[U].type+";base64,"+btoa((o[U].hex.match(/\w{2}/g)||[]).map(function(V){return String.fromCharCode(parseInt(V,16))}).join("")),N.src=R,N.title=T[U].img.getAttribute("title"),T[U].shape.parentNode.replaceChild(N,T[U].shape);H=t.querySelectorAll("img"),U=0,G.label=1;case 1:return U<H.length?(B=H[U].src||"",B?(O=H[U],[4,e.options.upload.base64ToLink(B)]):[3,3]):[3,4];case 2:O.src=G.sent(),G.label=3;case 3:return U++,[3,1];case 4:return[2]}})})},qt=function(e,t){var n=t(e);if(n!==!1)for(var r=0;r<e.children.length;r++)qt(e.children[r],t)},_n,An=function(e){var t,n;e.hint.render(e);var r=(0,k.zh)(e).startContainer,i=(0,s.a1)(r,"data-type","code-block-info");if(i)if(i.textContent.replace(E.g.ZWSP,"")===""&&e.hint.recentLanguage){i.textContent=E.g.ZWSP+e.hint.recentLanguage;var a=(0,k.zh)(e);a.selectNodeContents(i)}else{var o=[],u=i.textContent.substring(0,(0,k.im)(i,e.ir.element).start).replace(E.g.ZWSP,"");(e.options.preview.hljs.langs||E.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(h){h.indexOf(u.toLowerCase())>-1&&o.push({html:h,value:h})}),e.hint.genHTML(o,u,e)}},We=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&An(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=D(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,l.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)},ut=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer)||n.startContainer;if(r){var i=r.querySelector(".vditor-ir__marker--heading");i?i.innerHTML=t:(r.insertAdjacentText("afterbegin",t),n.selectNodeContents(r),n.collapse(!1)),qe(e,n.cloneRange()),it(e)}},Lt=function(e,t,n){var r=(0,s.a1)(e.startContainer,"data-type",n);if(r){r.firstElementChild.remove(),r.lastElementChild.remove(),e.insertNode(document.createElement("wbr"));var i=document.createElement("div");i.innerHTML=t.lute.SpinVditorIRDOM(r.outerHTML),r.outerHTML=i.firstElementChild.innerHTML.trim()}},ur=function(e,t,n,r){var i=(0,k.zh)(e),a=t.getAttribute("data-type"),o=i.startContainer;o.nodeType===3&&(o=o.parentElement);var u=!0;if(t.classList.contains("vditor-menu--current"))if(a==="quote"){var h=(0,s.lG)(o,"BLOCKQUOTE");h&&(i.insertNode(document.createElement("wbr")),h.outerHTML=h.innerHTML.trim()===""?'<p data-block="0">'.concat(h.innerHTML,"</p>"):h.innerHTML)}else if(a==="link"){var f=(0,s.a1)(i.startContainer,"data-type","a");if(f){var S=(0,s.fb)(i.startContainer,"vditor-ir__link");S?(i.insertNode(document.createElement("wbr")),f.outerHTML=S.innerHTML):f.outerHTML=f.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else a==="italic"?Lt(i,e,"em"):a==="bold"?Lt(i,e,"strong"):a==="strike"?Lt(i,e,"s"):a==="inline-code"?Lt(i,e,"code"):(a==="check"||a==="list"||a==="ordered-list")&&(vt(e,i,a),u=!1,t.classList.remove("vditor-menu--current"));else{e.ir.element.childNodes.length===0&&(e.ir.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.ir.element,i));var T=(0,s.F9)(i.startContainer);if(a==="line"){if(T){var N=`<hr data-block="0"><p data-block="0"><wbr>
|
|
129
129
|
</p>`;T.innerHTML.trim()===""?T.outerHTML=N:T.insertAdjacentHTML("afterend",N)}}else if(a==="quote")T&&(i.insertNode(document.createElement("wbr")),T.outerHTML='<blockquote data-block="0">'.concat(T.outerHTML,"</blockquote>"),u=!1,t.classList.add("vditor-menu--current"));else if(a==="link"){var R=void 0;i.toString()===""?R="".concat(n,"<wbr>").concat(r):R="".concat(n).concat(i.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,R),u=!1,t.classList.add("vditor-menu--current")}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"){var R=void 0;i.toString()===""?R="".concat(n,"<wbr>").concat(r):(a==="code"?R="".concat(n,`
|
|
130
130
|
`).concat(i.toString(),"<wbr>").concat(r):a==="table"?R="".concat(n).concat(i.toString(),"<wbr>").concat(r):R="".concat(n).concat(i.toString()).concat(r,"<wbr>"),i.deleteContents()),(a==="table"||a==="code")&&(R=`
|
|
131
131
|
`+R+`
|
|
132
132
|
|
|
133
|
-
`);var H=document.createElement("span");H.innerHTML=R,i.insertNode(H),qe(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,k.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(vt(e,i,a,!1),u=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,k.ib)(e.ir.element,i),We(e),u&&it(e)},fr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function h(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,h)}f((r=r.apply(e,t||[])).next())})},dr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return h([f,S])}}function h(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},pr=(function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(r,i){n.element.style.display="none";var a=decodeURIComponent(r.getAttribute("data-value")),o=window.getSelection().getRangeAt(0);if(i.currentMode==="ir"){var u=(0,s.a1)(o.startContainer,"data-type","code-block-info");if(u){u.textContent=E.g.ZWSP+a.trimRight(),o.selectNodeContents(u),o.collapse(!1),We(i),u.parentElement.querySelectorAll("code").forEach(function(T){T.className="language-"+a.trimRight()}),
|
|
134
|
-
`).concat(N===0?"class='vditor-hint--current'":"","> ").concat(R,"</button>")}}),this.element.innerHTML=f;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(h+(S||22),"px"),this.element.style.left="".concat(u,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(T){T.addEventListener("click",function(N){i.fillEmoji(T,r),N.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(h-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 i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.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(f){var S=t.lastIndexOf(f.key);r.lastIndex<S&&(r.splitChar=f.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),o=a[a.length-1],u=32;if(a.length>1&&o.trim()===o)if(a.length===2&&a[0]===""&&a[1].length<u)i=a[1];else{var h=a[a.length-2].slice(-1);(0,
|
|
133
|
+
`);var H=document.createElement("span");H.innerHTML=R,i.insertNode(H),qe(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,k.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(vt(e,i,a,!1),u=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,k.ib)(e.ir.element,i),We(e),u&&it(e)},fr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function h(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,h)}f((r=r.apply(e,t||[])).next())})},dr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return h([f,S])}}function h(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},pr=(function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(r,i){n.element.style.display="none";var a=decodeURIComponent(r.getAttribute("data-value")),o=window.getSelection().getRangeAt(0);if(i.currentMode==="ir"){var u=(0,s.a1)(o.startContainer,"data-type","code-block-info");if(u){u.textContent=E.g.ZWSP+a.trimRight(),o.selectNodeContents(u),o.collapse(!1),We(i),u.parentElement.querySelectorAll("code").forEach(function(T){T.className="language-"+a.trimRight()}),Se(u.parentElement.querySelector(".vditor-ir__preview"),i),n.recentLanguage=a.trimRight();return}}if(i.currentMode==="wysiwyg"&&o.startContainer.nodeType!==3){var h=o.startContainer,f=void 0;if(h.classList.contains("vditor-input")?f=h:f=h.firstElementChild,f&&f.classList.contains("vditor-input")){f.value=a.trimRight(),o.selectNodeContents(f),o.collapse(!1),f.dispatchEvent(new CustomEvent("input",{detail:1})),n.recentLanguage=a.trimRight();return}}if(o.setStart(o.startContainer,n.lastIndex),o.deleteContents(),i.options.hint.parse?i.currentMode==="sv"?(0,k.oC)(i.lute.SpinVditorSVDOM(a),i):i.currentMode==="wysiwyg"?(0,k.oC)(i.lute.SpinVditorDOM(a),i):(0,k.oC)(i.lute.SpinVditorIRDOM(a),i):(0,k.oC)(a,i),n.splitChar===":"&&a.indexOf(":")>-1&&i.currentMode!=="sv"&&o.insertNode(document.createTextNode(" ")),o.collapse(!1),(0,k.Hc)(o),i.currentMode==="wysiwyg"){var S=(0,s.fb)(o.startContainer,"vditor-wysiwyg__block");S&&S.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(S.lastElementChild.innerHTML=S.firstElementChild.innerHTML,Se(S.lastElementChild,i))}else if(i.currentMode==="ir"){var S=(0,s.fb)(o.startContainer,"vditor-ir__marker--pre");S&&S.nextElementSibling.classList.contains("vditor-ir__preview")&&(S.nextElementSibling.innerHTML=S.innerHTML,Se(S.nextElementSibling,i))}ee(i)},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,i=getSelection().getRangeAt(0);r=i.startContainer.textContent.substring(0,i.startOffset)||"";var a=this.getKey(r,t.options.hint.extend);if(typeof a>"u")this.element.style.display="none",clearTimeout(this.timeId);else if(this.splitChar===":"){var o=a===""?t.options.hint.emoji:t.lute.GetEmojis(),u=[];Object.keys(o).forEach(function(h){h.indexOf(a.toLowerCase())===0&&(o[h].indexOf(".")>-1?u.push({html:'<img src="'.concat(o[h],'" title=":').concat(h,':"/> :').concat(h,":"),value:":".concat(h,":")}):u.push({html:'<span class="vditor-hint__emoji">'.concat(o[h],"</span>").concat(h),value:o[h]}))}),this.genHTML(u,a,t)}else t.options.hint.extend.forEach(function(h){h.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return fr(n,void 0,void 0,function(){var f;return dr(this,function(S){switch(S.label){case 0:return f=this.genHTML,[4,h.hint(a)];case 1:return f.apply(this,[S.sent(),a,t]),[2]}})})},t.options.hint.delay))})}},e.prototype.genHTML=function(t,n,r){var i=this;if(t.length===0){this.element.style.display="none";return}var a=r[r.currentMode].element,o=(0,k.Ny)(a),u=o.left+(r.options.outline.position==="left"?r.outline.element.offsetWidth:0),h=o.top,f="";t.forEach(function(T,N){if(!(N>7)){var R=T.html;if(n!==""){var H=R.lastIndexOf(">")+1,U=R.substr(H),B=U.toLowerCase().indexOf(n.toLowerCase());B>-1&&(U=U.substring(0,B)+"<b>"+U.substring(B,B+n.length)+"</b>"+U.substring(B+n.length),R=R.substr(0,H)+U)}f+='<button type="button" data-value="'.concat(encodeURIComponent(T.value),` "
|
|
134
|
+
`).concat(N===0?"class='vditor-hint--current'":"","> ").concat(R,"</button>")}}),this.element.innerHTML=f;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(h+(S||22),"px"),this.element.style.left="".concat(u,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(T){T.addEventListener("click",function(N){i.fillEmoji(T,r),N.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(h-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 i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.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(f){var S=t.lastIndexOf(f.key);r.lastIndex<S&&(r.splitChar=f.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),o=a[a.length-1],u=32;if(a.length>1&&o.trim()===o)if(a.length===2&&a[0]===""&&a[1].length<u)i=a[1];else{var h=a[a.length-2].slice(-1);(0,M.X)(h)===" "&&o.length<u&&(i=o)}return i},e})(),hr=(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,`"
|
|
135
135
|
contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),Dt(t,this.element),nn(t,this.element),Ht(t,this.element),It(t,this.element),Pt(t,this.element),Ot(t,this.element),Nt(t,this.element,this.copy),Rt(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 i=document.createElement("div");i.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorIRDOM2Md(i.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Ct(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){b(t,["hint"])}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||qe(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,We(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||qe(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,We(t);return}var i=(0,k.zh)(t),a=(0,s.fb)(r.target,"vditor-ir__preview");if(a||(a=(0,s.fb)(i.startContainer,"vditor-ir__preview")),a&&(a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!0),(0,k.Hc)(i),be(t)),r.target.tagName==="IMG"){var o=r.target.parentElement.querySelector(".vditor-ir__marker--link");o&&(i.selectNode(o),(0,k.Hc)(i))}var u=(0,s.a1)(r.target,"data-type","a");if(u&&!u.classList.contains("vditor-ir__node--expand")){t.options.link.click?t.options.link.click(u.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(u.querySelector(":scope > .vditor-ir__marker--link").textContent);return}if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&i.collapsed){var h=n.element.lastElementChild.getBoundingClientRect();r.y>h.top+h.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(n.element,i)))}i.toString()===""?j(i,t):setTimeout(function(){j((0,k.zh)(t),t)}),ht(r,t),it(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if(r.key==="Enter"&&be(t),it(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===`
|
|
136
136
|
`)){t.ir.element.innerHTML="";return}var i=(0,k.zh)(t);r.key==="Backspace"?((0,l.vU)()&&i.startContainer.textContent===`
|
|
137
|
-
`&&i.startOffset===1&&(i.startContainer.textContent="",j(i,t)),n.element.querySelectorAll(".language-math").forEach(function(o){var u=o.querySelector("br");u&&u.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&An(t),j(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&j(i,t);var a=(0,s.fb)(i.startContainer,"vditor-ir__preview");if(a){if(r.key==="ArrowUp"||r.key==="ArrowLeft")return a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!1),r.preventDefault(),!0;if(a.tagName==="SPAN"&&(r.key==="ArrowDown"||r.key==="ArrowRight"))return a.parentElement.getAttribute("data-type")==="html-entity"?(a.parentElement.insertAdjacentText("afterend",E.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e})(),xn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(
|
|
138
|
-
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Dn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Dn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,k.Hc)(o)}Re(t)},e})(),yr=Y(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(h){if(h.target.tagName!=="TEXTAREA"){var f=document.createElement("div");f.className="vditor-reset",f.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,f,"default"),h.preventDefault()}}),this.previewElement.addEventListener("click",function(h){var f=(0,s.lG)(h.target,"SPAN");if(f&&(0,s.fb)(f,"vditor-toc")){var S=n.previewElement.querySelector("#"+f.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(h.target.tagName==="A"){t.options.link.click?t.options.link.click(h.target):t.options.link.isOpen&&window.open(h.target.getAttribute("href")),h.preventDefault();return}h.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(h.target):t.options.image.isPreview&&(0,K.E)(h.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var u=r[o];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.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":a.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}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(h){var f=(0,C.S)(h.target,"BUTTON");if(f){var S=f.getAttribute("data-type"),T=r.find(function(N){return N?.key===S});if(T){T.click(S);return}if(S==="mp-wechat"||S==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),S);return}S==="desktop"?n.previewElement.style.width="auto":S==="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),i.querySelectorAll("button").forEach(function(N){N.classList.remove("vditor-preview__action--current")}),f.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(x(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=x(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var h=JSON.parse(o.responseText);if(h.code!==0){t.tip.show(h.msg);return}t.options.preview.transform&&(h.data=t.options.preview.transform(h.data)),r.previewElement.innerHTML=h.data,r.afterRender(t,i)}else{var f=t.lute.Md2HTML(a);t.options.preview.transform&&(f=t.options.preview.transform(f)),r.previewElement.innerHTML=f,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,P.O)(t.preview.previewElement,t.options.preview.hljs),(0,$.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,oe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ge.K)(t.preview.previewElement,t.options.cdn),(0,ve.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,F.P)(t.preview.previewElement,t.options.cdn),(0,z.v)(t.preview.previewElement,t.options.cdn),(0,M.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,le.B)(t.preview.previewElement,t.options.cdn),(0,D.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,yr.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=o,(0,ne.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,k.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),wr=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(t.options.resize.position),this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(t)}return e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("mousedown",function(r){var i=document,a=r.clientY,o=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(h){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-h.clientY))+"px":t.element.style.height=Math.max(u,o+(h.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e})(),vr=(function(){function e(t){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",t.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(t),Dt(t,this.element),Ht(t,this.element),It(t,this.element),Pt(t,this.element),Ot(t,this.element),Nt(t,this.element,this.copy),Rt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",st(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Ct(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ie(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Se(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ie(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.key==="Delete")&&t.sv.element.innerHTML!==""&&t.sv.element.childNodes.length===1&&t.sv.element.firstElementChild&&t.sv.element.firstElementChild.tagName==="DIV"&&t.sv.element.firstElementChild.childElementCount===2&&(t.sv.element.firstElementChild.textContent===""||t.sv.element.textContent===`
|
|
137
|
+
`&&i.startOffset===1&&(i.startContainer.textContent="",j(i,t)),n.element.querySelectorAll(".language-math").forEach(function(o){var u=o.querySelector("br");u&&u.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&An(t),j(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&j(i,t);var a=(0,s.fb)(i.startContainer,"vditor-ir__preview");if(a){if(r.key==="ArrowUp"||r.key==="ArrowLeft")return a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!1),r.preventDefault(),!0;if(a.tagName==="SPAN"&&(r.key==="ArrowDown"||r.key==="ArrowRight"))return a.parentElement.getAttribute("data-type")==="html-entity"?(a.parentElement.insertAdjacentText("afterend",E.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e})(),xn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(D(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)},mr=Y(214),Dn=Y(436),gr=(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>
|
|
138
|
+
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Dn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Dn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,k.Hc)(o)}Re(t)},e})(),yr=Y(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(h){if(h.target.tagName!=="TEXTAREA"){var f=document.createElement("div");f.className="vditor-reset",f.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,f,"default"),h.preventDefault()}}),this.previewElement.addEventListener("click",function(h){var f=(0,s.lG)(h.target,"SPAN");if(f&&(0,s.fb)(f,"vditor-toc")){var S=n.previewElement.querySelector("#"+f.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(h.target.tagName==="A"){t.options.link.click?t.options.link.click(h.target):t.options.link.isOpen&&window.open(h.target.getAttribute("href")),h.preventDefault();return}h.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(h.target):t.options.image.isPreview&&(0,K.E)(h.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var u=r[o];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.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":a.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}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(h){var f=(0,C.S)(h.target,"BUTTON");if(f){var S=f.getAttribute("data-type"),T=r.find(function(N){return N?.key===S});if(T){T.click(S);return}if(S==="mp-wechat"||S==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),S);return}S==="desktop"?n.previewElement.style.width="auto":S==="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),i.querySelectorAll("button").forEach(function(N){N.classList.remove("vditor-preview__action--current")}),f.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(D(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=D(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var h=JSON.parse(o.responseText);if(h.code!==0){t.tip.show(h.msg);return}t.options.preview.transform&&(h.data=t.options.preview.transform(h.data)),r.previewElement.innerHTML=h.data,r.afterRender(t,i)}else{var f=t.lute.Md2HTML(a);t.options.preview.transform&&(f=t.options.preview.transform(f)),r.previewElement.innerHTML=f,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,P.O)(t.preview.previewElement,t.options.preview.hljs),(0,Q.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,oe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ge.K)(t.preview.previewElement,t.options.cdn),(0,Ee.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,F.P)(t.preview.previewElement,t.options.cdn),(0,z.v)(t.preview.previewElement,t.options.cdn),(0,L.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,le.B)(t.preview.previewElement,t.options.cdn),(0,x.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,yr.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=o,(0,ne.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,k.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),wr=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(t.options.resize.position),this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(t)}return e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("mousedown",function(r){var i=document,a=r.clientY,o=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(h){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-h.clientY))+"px":t.element.style.height=Math.max(u,o+(h.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e})(),vr=(function(){function e(t){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",t.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(t),Dt(t,this.element),Ht(t,this.element),It(t,this.element),Pt(t,this.element),Ot(t,this.element),Nt(t,this.element,this.copy),Rt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",st(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Ct(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ie(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Ce(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ie(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.key==="Delete")&&t.sv.element.innerHTML!==""&&t.sv.element.childNodes.length===1&&t.sv.element.firstElementChild&&t.sv.element.firstElementChild.tagName==="DIV"&&t.sv.element.firstElementChild.childElementCount===2&&(t.sv.element.firstElementChild.textContent===""||t.sv.element.textContent===`
|
|
139
139
|
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&be(t)}})},e})(),Hn=(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,`
|
|
140
140
|
<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 i=r.element.getBoundingClientRect();i.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})(),Kt=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),p(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",y(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},Er=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Sr=(function(e){Er(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.preview.mode==="both"&&i.element.children[0].classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(a.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Kt("editor",n):Kt("both",n)))}),i}return t})(me),Cr=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e})(),On=Y(580),Lr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Mr=(function(e){Lr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return E.g.CODE_THEME.forEach(function(h){u+="<button>".concat(h,"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(h){h.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.hljs.style=h.target.textContent,(0,On.Y)(h.target.textContent,n.options.cdn),h.preventDefault(),h.stopPropagation())}),i.element.appendChild(o),g(n,o,a,r.level),i}return t})(me),kr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Tr=(function(e){kr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return Object.keys(n.options.preview.theme.list).forEach(function(h){u+='<button data-type="'.concat(h,'">').concat(n.options.preview.theme.list[h],"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(h){h.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.theme.current=h.target.getAttribute("data-type"),(0,X.Z)(n.options.preview.theme.current,n.options.preview.theme.path),h.preventDefault(),h.stopPropagation())}),i.element.appendChild(o),g(n,o,a,r.level),i}return t})(me),_r=(function(){function e(t){this.element=document.createElement("span"),this.element.className="vditor-counter vditor-tooltipped vditor-tooltipped__nw",this.render(t,"")}return e.prototype.render=function(t,n){var r=n.endsWith(`
|
|
141
141
|
`)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var i=t[t.currentMode].element.cloneNode(!0);i.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(a){a.remove()}),r=i.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})(),Ar=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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){Ar(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].innerHTML=r.icon,i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!a.currentTarget.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t})(me),Dr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Hr=(function(e){Dr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.firstElementChild.addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(a.preventDefault(),o.classList.contains("vditor-menu--current")?(o.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",Re(n)):(o.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",Re(n),n.devtools.renderEchart(n)))}),i}return t})(me),Or=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e})(),Nr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Rr=(function(e){Nr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");a.className="vditor-panel vditor-panel--arrow";var o="";return Object.keys(n.options.hint.emoji).forEach(function(u){var h=n.options.hint.emoji[u];h.indexOf(".")>-1?o+='<button data-value=":'.concat(u,': " data-key=":').concat(u,`:"><img
|
|
142
142
|
data-value=":`).concat(u,': " data-key=":').concat(u,':" class="vditor-emojis__icon" src="').concat(h,'"/></button>'):o+='<button data-value="'.concat(h,` "
|
|
143
143
|
data-key="`).concat(u,'"><span class="vditor-emojis__icon">').concat(h,"</span></button>")}),a.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(o,`</div><div class="vditor-emojis__tail">
|
|
144
144
|
<span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
|
|
145
|
-
</div>`),i.element.appendChild(a),g(n,a,i.element.firstElementChild,r.level),i.bindEvent(n),i}return t.prototype.bindEvent=function(n){var r=this;this.element.lastElementChild.addEventListener((0,l.Le)(),function(i){var a=(0,C.S)(i.target,"BUTTON");if(a){i.preventDefault();var o=a.getAttribute("data-value"),u=(0,k.zh)(n),h=o;if(n.currentMode==="wysiwyg"?h=n.lute.SpinVditorDOM(o):n.currentMode==="ir"&&(h=n.lute.SpinVditorIRDOM(o)),o.indexOf(":")>-1&&n.currentMode!=="sv"){var f=document.createElement("div");f.innerHTML=h,h=f.firstElementChild.firstElementChild.outerHTML+" ",(0,k.oC)(h,n)}else u.extractContents(),u.insertNode(document.createTextNode(o)),(0,s.F9)(u.startContainer)||_t(n,u);u.collapse(!1),(0,k.Hc)(u),r.element.lastElementChild.style.display="none",ee(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,C.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t})(me),Nn=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)},Ir=function(e){var t=
|
|
145
|
+
</div>`),i.element.appendChild(a),g(n,a,i.element.firstElementChild,r.level),i.bindEvent(n),i}return t.prototype.bindEvent=function(n){var r=this;this.element.lastElementChild.addEventListener((0,l.Le)(),function(i){var a=(0,C.S)(i.target,"BUTTON");if(a){i.preventDefault();var o=a.getAttribute("data-value"),u=(0,k.zh)(n),h=o;if(n.currentMode==="wysiwyg"?h=n.lute.SpinVditorDOM(o):n.currentMode==="ir"&&(h=n.lute.SpinVditorIRDOM(o)),o.indexOf(":")>-1&&n.currentMode!=="sv"){var f=document.createElement("div");f.innerHTML=h,h=f.firstElementChild.firstElementChild.outerHTML+" ",(0,k.oC)(h,n)}else u.extractContents(),u.insertNode(document.createTextNode(o)),(0,s.F9)(u.startContainer)||_t(n,u);u.collapse(!1),(0,k.Hc)(u),r.element.lastElementChild.style.display="none",ee(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,C.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t})(me),Nn=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)},Ir=function(e){var t=D(e);Nn(e,t,t.substr(0,10)+".md")},Pr=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"/>
|
|
146
146
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
|
|
147
147
|
<div id="preview" style="width: 800px"></div>
|
|
148
148
|
<script>
|
|
@@ -163,7 +163,7 @@ window.addEventListener("message", (e) => {
|
|
|
163
163
|
window.print();
|
|
164
164
|
}, 3600);
|
|
165
165
|
}, false);
|
|
166
|
-
<\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(
|
|
166
|
+
<\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(D(e),"*")},200)},jr=function(e){var t=xn(e),n='<html><head><link rel="stylesheet" type="text/css" href="'.concat(e.options.cdn,`/dist/index.css"/>
|
|
167
167
|
<script src="`).concat(e.options.cdn,"/dist/js/i18n/").concat(e.options.lang,`.js"><\/script>
|
|
168
168
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script></head>
|
|
169
169
|
<body><div class="vditor-reset" id="preview">`).concat(t,`</div>
|
|
@@ -242,7 +242,7 @@ window.addEventListener("message", (e) => {
|
|
|
242
242
|
</li>
|
|
243
243
|
</ul>
|
|
244
244
|
</div>
|
|
245
|
-
</div>`),0)}),i}return t})(me),Yr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Qr=(function(e){Yr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"afterend")}),i}return t})(me),$r=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ei=(function(e){$r(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"beforebegin")}),i}return t})(me),ti=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ni=(function(e){ti(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,k.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Ut(n,u,o,u.parentElement)}}),i}return t})(me),ri=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ii=(function(e){ri(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t})(me),ai=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),oi=(function(e){ai(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),m(n.toolbar.elements,o),n.outline.render(n)):(d(n.toolbar.elements,o),n.preview.element.style.display="block",n.currentMode==="sv"?n.sv.element.style.display="none":n[n.currentMode].element.parentElement.style.display="none",n.preview.render(n),a.classList.add("vditor-menu--current"),b(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),Re(n)}})},t})(me),si=(function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.connect(this.recorder),this.recorder.connect(n.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(t,n){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(n)),this.recordingLength+=2048},e.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},e.prototype.stopRecording=function(){this.isRecording=!1},e.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),n=this.mergeBuffers(this.rightChannel),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),u=new DataView(o);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var h=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,h,!0);for(var f=r.length,S=44,T=1,N=0;N<f;N++)u.setInt16(S,r[N]*(32767*T),!0),S+=2;return new Blob([u],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var r=this.DEFAULT_SAMPLE_RATE/n,i=Math.round(t.length/r),a=new Float32Array(i),o=0,u=0;o<a.length;){for(var h=Math.round((o+1)*r),f=0,S=0,T=u;T<h&&T<t.length;T++)f+=t[T],S++;a[o]=f/S,o++,u=h}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e})(),li=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ci=(function(e){li(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(h){i=new si(h),i.recorder.onaudioprocess=function(f){if(i.isRecording){var S=f.inputBuffer.getChannelData(0),T=f.inputBuffer.getChannelData(1);i.cloneChannelData(S,T)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])});return}if(i.isRecording){i.stopRecording(),n.tip.hide();var u=new File([i.buildWavFileBlob()],"record".concat(new Date().getTime(),".wav"),{type:"video/webm"});Bt(n,[u]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t})(me),ui=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),fi=(function(e){ui(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(me),di=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),pi=(function(e){di(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(me),hi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),mi=(function(e){hi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Bt(n,i.target.files,i.target)})},t})(me),gi=(function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(h){u.style.display="none"}),i.toolbar.forEach(function(h,f){h.level=2,u.appendChild(n.genItem(t,h,a+f))}),o.appendChild(u),g(t,u,o.children[0])}}),t.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),t.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),t.options.counter.enable&&(t.counter=new _r(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;switch(n.name){case"bold":case"italic":case"more":case"strike":case"line":case"quote":case"list":case"ordered-list":case"check":case"code":case"inline-code":case"link":case"table":i=new me(t,n);break;case"emoji":i=new Rr(t,n);break;case"headings":i=new qr(t,n);break;case"|":i=new Or;break;case"br":i=new Cr;break;case"undo":i=new pi(t,n);break;case"redo":i=new fi(t,n);break;case"help":i=new zr(t,n);break;case"both":i=new Sr(t,n);break;case"preview":i=new oi(t,n);break;case"fullscreen":i=new Wr(t,n);break;case"upload":i=new mi(t,n);break;case"record":i=new ci(t,n);break;case"info":i=new Xr(t,n);break;case"edit-mode":i=new Qn(t,n);break;case"devtools":i=new Hr(t,n);break;case"outdent":i=new ni(t,n);break;case"indent":i=new Zr(t,n);break;case"outline":i=new ii(t,n);break;case"insert-after":i=new Qr(t,n);break;case"insert-before":i=new ei(t,n);break;case"code-theme":i=new Mr(t,n);break;case"content-theme":i=new Tr(t,n);break;case"export":i=new Ur(t,n);break;default:i=new xr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),yi=Y(173),bi=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new yi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):d(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?m(t.toolbar.elements,["redo"]):d(t.toolbar.elements,["redo"]))},e.prototype.undo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"&&!(this[t.currentMode].undoStack.length<2)){var n=this[t.currentMode].undoStack.pop();n&&(this[t.currentMode].redoStack.push(n),this.renderDiff(n,t),this[t.currentMode].hasUndo=!0,b(t,["hint"]))}},e.prototype.redo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"){var n=this[t.currentMode].redoStack.pop();n&&(this[t.currentMode].undoStack.push(n),this.renderDiff(n,t,!0))}},e.prototype.recordFirstPosition=function(t,n){if(getSelection().rangeCount!==0&&!(this[t.currentMode].undoStack.length!==1||this[t.currentMode].undoStack[0].length===0||this[t.currentMode].redoStack.length>0)&&!((0,l.vU)()&&n.key==="Backspace")&&!(0,l.G6)()){var r=this.addCaret(t);r.replace("<wbr>","").replace(" vditor-ir__node--expand","")===this[t.currentMode].undoStack[0][0].diffs[0][1].replace("<wbr>","")&&(this[t.currentMode].undoStack[0][0].diffs[0][1]=r,this[t.currentMode].lastText=r)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),r=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),i=this.dmp.patch_make(n,this[t.currentMode].lastText,r);i.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(i),this[t.currentMode].undoStack.length>this.stackSize&&this[t.currentMode].undoStack.shift(),this[t.currentMode].hasUndo&&(this[t.currentMode].redoStack=[],this[t.currentMode].hasUndo=!1,d(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&m(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(h){h[0]=-h[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Ee(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,k.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),be(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}Be(n),ee(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),Qe(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Ee(u,n)}),this[n.currentMode].undoStack.length>1?m(n.toolbar.elements,["undo"]):d(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?m(n.toolbar.elements,["redo"]):d(n.toolbar.elements,["redo"])},e.prototype.resetStack=function(){this.ir={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.sv={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.wysiwyg={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]}},e.prototype.addCaret=function(t,n){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(h){h.firstElementChild&&(h.firstElementChild.classList.contains("language-echarts")||h.firstElementChild.classList.contains("language-plantuml")||h.firstElementChild.classList.contains("language-mindmap")?(h.firstElementChild.removeAttribute("_echarts_instance_"),h.firstElementChild.removeAttribute("data-processed"),h.firstElementChild.innerHTML=h.previousElementSibling.firstElementChild.innerHTML,h.setAttribute("data-render","2")):h.firstElementChild.classList.contains("language-math")&&(h.setAttribute("data-render","2"),h.firstElementChild.textContent=h.firstElementChild.getAttribute("data-math"),h.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(h){h.remove()}),n&&r&&(0,k.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),wi=Y(673),vi=(function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:E.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(E.g.CDN,"/dist/images/emoji"),extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:E.g.HLJS_OPTIONS,markdown:E.g.MARKDOWN_OPTIONS,math:E.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:E.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,u,h,f;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((h=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||h===void 0)&&h.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((f=this.options.hint)===null||f===void 0)&&f.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,wi.T)(this.defaultOptions,this.options);if(S.cache.enable&&!S.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return S},e.prototype.mergeToolbar=function(t){var n=this,r=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"⌘E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"⌘H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"⌘B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"⌘K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"⌘L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"⇧⌘I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"⇧⌘O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"⌘;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"⇧⌘H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"---",tipPosition:"n"},{hotkey:"⌘U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"⇧⌘B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"⇧⌘E",icon:'<svg><use xlink:href="#vditor-icon-after"></use></svg>',name:"insert-after",tipPosition:"n"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-upload"></use></svg>',name:"upload",tipPosition:"n"},{icon:'<svg><use xlink:href="#vditor-icon-record"></use></svg>',name:"record",tipPosition:"n"},{hotkey:"⌘M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
|
|
245
|
+
</div>`),0)}),i}return t})(me),Yr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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){Yr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"afterend")}),i}return t})(me),Qr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ei=(function(e){Qr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"beforebegin")}),i}return t})(me),ti=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ni=(function(e){ti(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,k.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Ut(n,u,o,u.parentElement)}}),i}return t})(me),ri=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ii=(function(e){ri(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t})(me),ai=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),oi=(function(e){ai(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),m(n.toolbar.elements,o),n.outline.render(n)):(d(n.toolbar.elements,o),n.preview.element.style.display="block",n.currentMode==="sv"?n.sv.element.style.display="none":n[n.currentMode].element.parentElement.style.display="none",n.preview.render(n),a.classList.add("vditor-menu--current"),b(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),Re(n)}})},t})(me),si=(function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.connect(this.recorder),this.recorder.connect(n.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(t,n){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(n)),this.recordingLength+=2048},e.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},e.prototype.stopRecording=function(){this.isRecording=!1},e.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),n=this.mergeBuffers(this.rightChannel),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),u=new DataView(o);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var h=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,h,!0);for(var f=r.length,S=44,T=1,N=0;N<f;N++)u.setInt16(S,r[N]*(32767*T),!0),S+=2;return new Blob([u],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var r=this.DEFAULT_SAMPLE_RATE/n,i=Math.round(t.length/r),a=new Float32Array(i),o=0,u=0;o<a.length;){for(var h=Math.round((o+1)*r),f=0,S=0,T=u;T<h&&T<t.length;T++)f+=t[T],S++;a[o]=f/S,o++,u=h}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e})(),li=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),ci=(function(e){li(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(h){i=new si(h),i.recorder.onaudioprocess=function(f){if(i.isRecording){var S=f.inputBuffer.getChannelData(0),T=f.inputBuffer.getChannelData(1);i.cloneChannelData(S,T)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])});return}if(i.isRecording){i.stopRecording(),n.tip.hide();var u=new File([i.buildWavFileBlob()],"record".concat(new Date().getTime(),".wav"),{type:"video/webm"});Bt(n,[u]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t})(me),ui=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),fi=(function(e){ui(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(me),di=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),pi=(function(e){di(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(me),hi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),mi=(function(e){hi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Bt(n,i.target.files,i.target)})},t})(me),gi=(function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(h){u.style.display="none"}),i.toolbar.forEach(function(h,f){h.level=2,u.appendChild(n.genItem(t,h,a+f))}),o.appendChild(u),g(t,u,o.children[0])}}),t.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),t.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),t.options.counter.enable&&(t.counter=new _r(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;switch(n.name){case"bold":case"italic":case"more":case"strike":case"line":case"quote":case"list":case"ordered-list":case"check":case"code":case"inline-code":case"link":case"table":i=new me(t,n);break;case"emoji":i=new Rr(t,n);break;case"headings":i=new qr(t,n);break;case"|":i=new Or;break;case"br":i=new Cr;break;case"undo":i=new pi(t,n);break;case"redo":i=new fi(t,n);break;case"help":i=new zr(t,n);break;case"both":i=new Sr(t,n);break;case"preview":i=new oi(t,n);break;case"fullscreen":i=new Wr(t,n);break;case"upload":i=new mi(t,n);break;case"record":i=new ci(t,n);break;case"info":i=new Xr(t,n);break;case"edit-mode":i=new $n(t,n);break;case"devtools":i=new Hr(t,n);break;case"outdent":i=new ni(t,n);break;case"indent":i=new Zr(t,n);break;case"outline":i=new ii(t,n);break;case"insert-after":i=new $r(t,n);break;case"insert-before":i=new ei(t,n);break;case"code-theme":i=new Mr(t,n);break;case"content-theme":i=new Tr(t,n);break;case"export":i=new Ur(t,n);break;default:i=new xr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),yi=Y(173),bi=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new yi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):d(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?m(t.toolbar.elements,["redo"]):d(t.toolbar.elements,["redo"]))},e.prototype.undo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"&&!(this[t.currentMode].undoStack.length<2)){var n=this[t.currentMode].undoStack.pop();n&&(this[t.currentMode].redoStack.push(n),this.renderDiff(n,t),this[t.currentMode].hasUndo=!0,b(t,["hint"]))}},e.prototype.redo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"){var n=this[t.currentMode].redoStack.pop();n&&(this[t.currentMode].undoStack.push(n),this.renderDiff(n,t,!0))}},e.prototype.recordFirstPosition=function(t,n){if(getSelection().rangeCount!==0&&!(this[t.currentMode].undoStack.length!==1||this[t.currentMode].undoStack[0].length===0||this[t.currentMode].redoStack.length>0)&&!((0,l.vU)()&&n.key==="Backspace")&&!(0,l.G6)()){var r=this.addCaret(t);r.replace("<wbr>","").replace(" vditor-ir__node--expand","")===this[t.currentMode].undoStack[0][0].diffs[0][1].replace("<wbr>","")&&(this[t.currentMode].undoStack[0][0].diffs[0][1]=r,this[t.currentMode].lastText=r)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),r=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),i=this.dmp.patch_make(n,this[t.currentMode].lastText,r);i.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(i),this[t.currentMode].undoStack.length>this.stackSize&&this[t.currentMode].undoStack.shift(),this[t.currentMode].hasUndo&&(this[t.currentMode].redoStack=[],this[t.currentMode].hasUndo=!1,d(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&m(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(h){h[0]=-h[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Se(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,k.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),be(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}Be(n),ee(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),$e(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Se(u,n)}),this[n.currentMode].undoStack.length>1?m(n.toolbar.elements,["undo"]):d(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?m(n.toolbar.elements,["redo"]):d(n.toolbar.elements,["redo"])},e.prototype.resetStack=function(){this.ir={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.sv={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.wysiwyg={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]}},e.prototype.addCaret=function(t,n){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(h){h.firstElementChild&&(h.firstElementChild.classList.contains("language-echarts")||h.firstElementChild.classList.contains("language-plantuml")||h.firstElementChild.classList.contains("language-mindmap")?(h.firstElementChild.removeAttribute("_echarts_instance_"),h.firstElementChild.removeAttribute("data-processed"),h.firstElementChild.innerHTML=h.previousElementSibling.firstElementChild.innerHTML,h.setAttribute("data-render","2")):h.firstElementChild.classList.contains("language-math")&&(h.setAttribute("data-render","2"),h.firstElementChild.textContent=h.firstElementChild.getAttribute("data-math"),h.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(h){h.remove()}),n&&r&&(0,k.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),wi=Y(673),vi=(function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:E.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(E.g.CDN,"/dist/images/emoji"),extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:E.g.HLJS_OPTIONS,markdown:E.g.MARKDOWN_OPTIONS,math:E.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:E.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,u,h,f;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((h=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||h===void 0)&&h.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((f=this.options.hint)===null||f===void 0)&&f.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,wi.T)(this.defaultOptions,this.options);if(S.cache.enable&&!S.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return S},e.prototype.mergeToolbar=function(t){var n=this,r=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"⌘E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"⌘H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"⌘B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"⌘K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"⌘L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"⇧⌘I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"⇧⌘O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"⌘;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"⇧⌘H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"---",tipPosition:"n"},{hotkey:"⌘U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"⇧⌘B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"⇧⌘E",icon:'<svg><use xlink:href="#vditor-icon-after"></use></svg>',name:"insert-after",tipPosition:"n"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-upload"></use></svg>',name:"upload",tipPosition:"n"},{icon:'<svg><use xlink:href="#vditor-icon-record"></use></svg>',name:"record",tipPosition:"n"},{hotkey:"⌘M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
|
|
246
246
|
| --- | --- | --- |
|
|
247
247
|
| | | |
|
|
248
248
|
| | | |`,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"}],i=[];return t.forEach(function(a){var o=a;r.forEach(function(u){typeof a=="string"&&u.name===a&&(o=u),typeof a=="object"&&u.name===a.name&&(o=Object.assign({},u,a))}),a.toolbar&&(o.toolbar=n.mergeToolbar(a.toolbar)),i.push(o)}),i},e})(),Ei=(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,`"
|
|
@@ -254,8 +254,9 @@ window.addEventListener("message", (e) => {
|
|
|
254
254
|
</button>
|
|
255
255
|
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),Dt(t,this.element),nn(t,this.element),Ht(t,this.element),It(t,this.element),Pt(t,this.element),Ot(t,this.element),Nt(t,this.element,this.copy),Rt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),o=a.cloneRange(),u=a.extractContents(),h,f,S=!1,T=!1;u.childNodes.forEach(function(H,U){var B=!1;if(H.nodeType===3?B=!0:H.classList.contains("vditor-comment")?H.classList.contains("vditor-comment")&&H.setAttribute("data-cmtids",H.getAttribute("data-cmtids")+" "+i):B=!0,B)if(H.nodeType!==3&&H.getAttribute("data-block")==="0"&&U===0&&o.startOffset>0)H.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(H.innerHTML,"</span>"),h=H;else if(H.nodeType!==3&&H.getAttribute("data-block")==="0"&&U===u.childNodes.length-1&&o.endOffset<o.endContainer.textContent.length)H.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(H.innerHTML,"</span>"),f=H;else if(H.nodeType!==3&&H.getAttribute("data-block")==="0")U===0?S=!0:U===u.childNodes.length-1&&(T=!0),H.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(H.innerHTML,"</span>");else{var O=document.createElement("span");O.classList.add("vditor-comment"),O.setAttribute("data-cmtids",i),H.parentNode.insertBefore(O,H),O.appendChild(H)}});var N=(0,s.F9)(o.startContainer);N&&(h?(N.insertAdjacentHTML("beforeend",h.innerHTML),h.remove()):N.textContent.trim().replace(E.g.ZWSP,"")===""&&S&&N.remove());var R=(0,s.F9)(o.endContainer);R&&(f?(R.insertAdjacentHTML("afterbegin",f.innerHTML),f.remove()):R.textContent.trim().replace(E.g.ZWSP,"")===""&&T&&R.remove()),a.insertNode(u),t.options.comment.add(i,a.toString(),n.getComments(t,!0)),ce(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(a){r.commentIds=r.commentIds.concat(a.getAttribute("data-cmtids").split(" "))}),this.commentIds=Array.from(new Set(this.commentIds));var i=[];if(n)return this.commentIds.forEach(function(a){i.push({id:a,top:r.element.querySelector('.vditor-comment[data-cmtids="'.concat(a,'"]')).offsetTop})}),i}else return[]},e.prototype.triggerRemoveComment=function(t){var n=function(a,o){var u=new Set(o);return a.filter(function(h){return!u.has(h)})};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 i=n(r,this.commentIds);i.length>0&&t.options.comment.remove(i)}},e.prototype.showComment=function(){var t=(0,k.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 i=(0,s.lG)(r.startContainer,"CODE"),a=(0,s.lG)(r.endContainer,"CODE");if(i&&a&&a.isSameNode(i)){var o="";i.parentElement.tagName==="PRE"?o=r.toString():o="`"+r.toString()+"`",t.clipboardData.setData("text/plain",o),t.clipboardData.setData("text/html","");return}var u=(0,s.lG)(r.startContainer,"A"),h=(0,s.lG)(r.endContainer,"A");if(u&&h&&h.isSameNode(u)){var f=u.getAttribute("title")||"";f&&(f=' "'.concat(f,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(u.getAttribute("href")).concat(f,")")),t.clipboardData.setData("text/html","");return}var S=document.createElement("div");S.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(S.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.unbindListener(),window.addEventListener("scroll",this.scrollListener=function(){if(b(t,["hint"]),!(n.popover.style.display!=="block"||n.selectPopover.style.display!=="block")){var r=parseInt(n.popover.getAttribute("data-top"),10);if(t.options.height!=="auto"){if(t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0){var i=Math.max(window.scrollY-t.element.offsetTop-8,Math.min(r-t.wysiwyg.element.scrollTop,n.element.clientHeight-21))+"px";n.popover.style.display==="block"&&(n.popover.style.top=i),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=i)}return}else if(!t.options.toolbarConfig.pin)return;var a=Math.max(r,window.scrollY-t.element.offsetTop-8)+"px";n.popover.style.display==="block"&&(n.popover.style.top=a),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=a)}}),this.element.addEventListener("scroll",function(){if(b(t,["hint"]),t.options.comment&&t.options.comment.enable&&t.options.comment.scroll&&t.options.comment.scroll(t.wysiwyg.element.scrollTop),n.popover.style.display==="block"){var r=parseInt(n.popover.getAttribute("data-top"),10)-t.wysiwyg.element.scrollTop,i=-8;t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0&&(i=window.scrollY-t.element.offsetTop+i);var a=Math.max(i,Math.min(r,n.element.clientHeight-21))+"px";n.popover.style.top=a,n.selectPopover.style.top=a}}),this.element.addEventListener("paste",function(r){Ct(t,r,{pasteCode:function(i){var a=(0,k.zh)(t),o=document.createElement("template");o.innerHTML=i,a.insertNode(o.content.cloneNode(!0));var u=(0,s.a1)(a.startContainer,"data-block","0");u?u.outerHTML=t.lute.SpinVditorDOM(u.outerHTML):t.wysiwyg.element.innerHTML=t.lute.SpinVditorDOM(t.wysiwyg.element.innerHTML),(0,k.ib)(t.wysiwyg.element,a)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){var i=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(i&&i.textContent===""){Be(t);return}(0,l.vU)()||wt(t,getSelection().getRangeAt(0).cloneRange(),r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,ce(t);return}if(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"){ce(t);return}var i=getSelection().getRangeAt(0),a=(0,s.F9)(i.startContainer);if(a||(_t(t,i),a=(0,s.F9)(i.startContainer)),!!a){for(var o=(0,k.im)(a,t.wysiwyg.element,i).start,u=!0,h=o-1;h>a.textContent.substr(0,o).lastIndexOf(`
|
|
256
256
|
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}o===0&&(u=!1);for(var f=!0,h=o-1;h<a.textContent.length;h++)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==`
|
|
257
|
-
`){f=!1;break}f&&/^#{1,6} $/.test(a.textContent)&&(f=!1);var S=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(Be(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||f||Wt(a.innerHTML)||Vt(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(
|
|
257
|
+
`){f=!1;break}f&&/^#{1,6} $/.test(a.textContent)&&(f=!1);var S=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(Be(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||f||Wt(a.innerHTML)||Vt(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(D(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),wt(t,i,r)}}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){var i=r.target;i.checked?i.setAttribute("checked","checked"):i.removeAttribute("checked"),n.preventInput=!0,getSelection().rangeCount>0&&(0,k.Hc)(getSelection().getRangeAt(0)),ce(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?en(t,r.target):Zn(r,t);return}var a=(0,s.lG)(r.target,"A");if(a){t.options.link.click?t.options.link.click(a):t.options.link.isOpen&&window.open(a.getAttribute("href")),r.preventDefault();return}var o=(0,k.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&o.collapsed){var u=n.element.lastElementChild.getBoundingClientRect();r.y>u.top+u.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(o.selectNodeContents(n.element.lastElementChild),o.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(n.element,o)))}Ze(t);var h=(0,s.fb)(r.target,"vditor-wysiwyg__preview");h||(h=(0,s.fb)((0,k.zh)(t).startContainer,"vditor-wysiwyg__preview")),h&&at(h,t),ht(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){r.key==="Enter"&&be(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===`
|
|
258
258
|
`)&&(t.wysiwyg.element.innerHTML="");var i=(0,k.zh)(t);if(r.key==="Backspace"&&(0,l.vU)()&&i.startContainer.textContent===`
|
|
259
|
-
`&&i.startOffset===1&&(i.startContainer.textContent=""),_t(t,i),Ze(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 a=(0,s.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var o=i.startContainer;o.classList.contains("vditor-wysiwyg__block")&&(a=o.lastElementChild)}if(a){var u=a.previousElementSibling;if(u.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?at(a,t):at(a,t,!1);return}var h=a.previousElementSibling;if(h.tagName==="PRE"&&(h=h.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,f=Kn(o);if(f&&f.nodeType!==3){var S=f.querySelector(".vditor-wysiwyg__preview");if(S){at(S,t);return}}if(f.nodeType===3){for(;f.textContent.length===0&&f.nextSibling;)f=f.nextSibling;i.setStart(f,1)}else i.setStart(f.firstChild,0)}else i.selectNodeContents(h),i.collapse(!1)}}}})},e})(),Si=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Ci=(function(e){Si(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=E.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 i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new vi(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);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(o.lang)){var u="vditorI18nScript",h=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(f){f.id!==h&&document.head.removeChild(f)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),h).then(function(){i.init(n,o)}).catch(function(f){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new Hn;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,i,a){this.vditor.options.theme=n,pe(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,X.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,On.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return x(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(){b(this.vditor,["subToolbar","hint","popover"]),d(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){m(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){if(this.vditor.currentMode==="wysiwyg")return st(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return st(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return st(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,k.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return xn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Kt(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,r){r===void 0&&(r=!0);var i=(0,k.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&wt(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&qe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,k.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,k.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):jt(this.vditor,n),this.vditor.outline.render(this.vditor),ee(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Se(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?tn(this.vditor,n,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}):(this.vditor.ir.element.innerHTML=this.vditor.lute.Md2VditorIRDOM(n),this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){Ee(a,i.vditor)}),We(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(b(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),r&&this.clearStack()},t.prototype.insertEmptyBlock=function(n){lt(this.vditor,n)},t.prototype.clearStack=function(){this.vditor.undo.clearStack(this.vditor),this.vditor.undo.addToUndoStack(this.vditor)},t.prototype.destroy=function(){this.vditor.element.innerHTML=this.vditor.originalInnerHTML,this.vditor.element.classList.remove("vditor"),this.vditor.element.removeAttribute("style");var n=document.getElementById("vditorIconScript");n&&n.remove(),this.clearCache(),Yt(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0,this.isDestroyed=!0},t.prototype.getCommentIds=function(){return this.vditor.currentMode!=="wysiwyg"?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(h,f){if(h===o)return u.splice(f,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,k.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new pr(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new gr(window.VditorI18n.outline),tip:new Hn},this.vditor.sv=new vr(this.vditor),this.vditor.undo=new bi,this.vditor.wysiwyg=new Ei(this.vditor),this.vditor.ir=new hr(this.vditor),this.vditor.toolbar=new gi(this.vditor),r.resize.enable&&(this.vditor.resize=new wr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new rr),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,mr.X)({autoSpace:i.vditor.options.preview.markdown.autoSpace,gfmAutoLink:i.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:i.vditor.options.preview.markdown.codeBlockPreview,emojiSite:i.vditor.options.hint.emojiPath,emojis:i.vditor.options.hint.emoji,fixTermTypo:i.vditor.options.preview.markdown.fixTermTypo,footnotes:i.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:i.vditor.options.preview.math.inlineDigit,linkBase:i.vditor.options.preview.markdown.linkBase,linkPrefix:i.vditor.options.preview.markdown.linkPrefix,listStyle:i.vditor.options.preview.markdown.listStyle,mark:i.vditor.options.preview.markdown.mark,mathBlockPreview:i.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:i.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:i.vditor.options.preview.markdown.sanitize,toc:i.vditor.options.preview.markdown.toc}),i.vditor.preview=new br(i.vditor),He(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(Z.default);const Li=Ci})(),Te=Te.default,Te})()})})(Tt)),Tt.exports}var Ai=_i();const xi=Mi.getDefaultExportFromCjs(Ai),Di={class:"dsg-editor"},Hi={ref:"vditor",class:"dsg-editor__vditor"},Oi={key:0,class:"dsg-editor--error-wrapper"},Ni=fe.defineComponent({__name:"DsgEditor",props:fe.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""},errors:{default:()=>[]}},{modelValue:{required:!0},modelModifiers:{}}),emits:fe.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(Le,{expose:Jt,emit:pt}){let rt=fe.useModel(Le,"modelValue"),Y=fe.ref(rt);fe.watch(()=>Y.value,(w,b)=>{m("update:modelValue",w)});const Te=fe.ref(),Z=fe.useTemplateRef("vditor"),E=()=>({modelId:Le.targetModel?Le.targetModel.id:"",modelClass:Le.targetModelClass?Le.targetModelClass:""}),L=(w,b)=>{if(!w)return!1;w.nodeType===3&&(w=w.parentElement);let g=w,s=!1;for(;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},x=w=>{let b;const g=w[w.currentMode].element;return getSelection().rangeCount>0&&(b=getSelection().getRangeAt(0),g.isEqualNode(b.startContainer)||g.contains(b.startContainer))?b:w[w.currentMode].range?w[w.currentMode].range:(g.focus(),b=g.ownerDocument.createRange(),b.setStart(g,0),b.collapse(!0),b)},A=w=>{let b=x(Te.value.vditor);const g=L(b.startContainer,"LI");if(!g||g.nextElementSibling||g.previousElementSibling)return!1;if(g.parentNode?.previousSibling?.nodeName==="UL"&&g.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let s=g.parentNode?.previousSibling,C=g.parentNode;s.appendChild(g),g.classList.add("vditor-task");let _=document.createElement("input");_.setAttribute("type","checkbox"),g.insertBefore(_,g.firstChild),C&&C.parentNode&&C.parentNode.removeChild(C),b.setStartAfter(g),b.collapse(!0)}},c=()=>Le.csrf?Le.csrf:window.csrf,l=w=>new Promise(b=>{new MutationObserver((s,C)=>{const _=document.querySelector(w);_&&(C.disconnect(),b(_))}).observe(document.body,{childList:!0,subtree:!0})}),y=w=>{w.addEventListener("paste",b=>{if("clipboardData"in b&&b.clipboardData?.items){for(const g of b.clipboardData.items)if(g.type.startsWith("image/")){const s=b.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",C=g.type.split("/")[1];b.preventDefault(),b.stopPropagation();const _=new FileReader;_.readAsDataURL(g.getAsFile()),_.onload=()=>{const D=_.result;Te.value?.insertMD(`🐰 
|
|
260
|
-
`)}
|
|
261
|
-
`),
|
|
259
|
+
`&&i.startOffset===1&&(i.startContainer.textContent=""),_t(t,i),Ze(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 a=(0,s.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var o=i.startContainer;o.classList.contains("vditor-wysiwyg__block")&&(a=o.lastElementChild)}if(a){var u=a.previousElementSibling;if(u.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?at(a,t):at(a,t,!1);return}var h=a.previousElementSibling;if(h.tagName==="PRE"&&(h=h.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,f=Kn(o);if(f&&f.nodeType!==3){var S=f.querySelector(".vditor-wysiwyg__preview");if(S){at(S,t);return}}if(f.nodeType===3){for(;f.textContent.length===0&&f.nextSibling;)f=f.nextSibling;i.setStart(f,1)}else i.setStart(f.firstChild,0)}else i.selectNodeContents(h),i.collapse(!1)}}}})},e})(),Si=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},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)}})(),Ci=(function(e){Si(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=E.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 i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new vi(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);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(o.lang)){var u="vditorI18nScript",h=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(f){f.id!==h&&document.head.removeChild(f)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),h).then(function(){i.init(n,o)}).catch(function(f){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new Hn;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,i,a){this.vditor.options.theme=n,pe(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,X.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,On.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return D(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(){b(this.vditor,["subToolbar","hint","popover"]),d(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){m(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){if(this.vditor.currentMode==="wysiwyg")return st(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return st(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return st(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,k.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return xn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Kt(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,r){r===void 0&&(r=!0);var i=(0,k.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&wt(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&qe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,k.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,k.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):jt(this.vditor,n),this.vditor.outline.render(this.vditor),ee(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?tn(this.vditor,n,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}):(this.vditor.ir.element.innerHTML=this.vditor.lute.Md2VditorIRDOM(n),this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){Se(a,i.vditor)}),We(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(b(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),r&&this.clearStack()},t.prototype.insertEmptyBlock=function(n){lt(this.vditor,n)},t.prototype.clearStack=function(){this.vditor.undo.clearStack(this.vditor),this.vditor.undo.addToUndoStack(this.vditor)},t.prototype.destroy=function(){this.vditor.element.innerHTML=this.vditor.originalInnerHTML,this.vditor.element.classList.remove("vditor"),this.vditor.element.removeAttribute("style");var n=document.getElementById("vditorIconScript");n&&n.remove(),this.clearCache(),Yt(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0,this.isDestroyed=!0},t.prototype.getCommentIds=function(){return this.vditor.currentMode!=="wysiwyg"?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(h,f){if(h===o)return u.splice(f,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,k.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new pr(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new gr(window.VditorI18n.outline),tip:new Hn},this.vditor.sv=new vr(this.vditor),this.vditor.undo=new bi,this.vditor.wysiwyg=new Ei(this.vditor),this.vditor.ir=new hr(this.vditor),this.vditor.toolbar=new gi(this.vditor),r.resize.enable&&(this.vditor.resize=new wr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new rr),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,mr.X)({autoSpace:i.vditor.options.preview.markdown.autoSpace,gfmAutoLink:i.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:i.vditor.options.preview.markdown.codeBlockPreview,emojiSite:i.vditor.options.hint.emojiPath,emojis:i.vditor.options.hint.emoji,fixTermTypo:i.vditor.options.preview.markdown.fixTermTypo,footnotes:i.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:i.vditor.options.preview.math.inlineDigit,linkBase:i.vditor.options.preview.markdown.linkBase,linkPrefix:i.vditor.options.preview.markdown.linkPrefix,listStyle:i.vditor.options.preview.markdown.listStyle,mark:i.vditor.options.preview.markdown.mark,mathBlockPreview:i.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:i.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:i.vditor.options.preview.markdown.sanitize,toc:i.vditor.options.preview.markdown.toc}),i.vditor.preview=new br(i.vditor),He(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(Z.default);const Li=Ci})(),Me=Me.default,Me})()})})(Tt)),Tt.exports}var Ai=_i();const xi=Mi.getDefaultExportFromCjs(Ai),Di={class:"dsg-editor"},Hi={ref:"vditor",class:"dsg-editor__vditor"},Oi={key:0,class:"dsg-editor--error-wrapper"},Ni=fe.defineComponent({__name:"DsgEditor",props:fe.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""},errors:{default:()=>[]}},{modelValue:{required:!0},modelModifiers:{}}),emits:fe.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(ve,{expose:Jt,emit:pt}){let rt=fe.useModel(ve,"modelValue"),Y=fe.ref(rt);fe.watch(()=>Y.value,(w,b)=>{m("update:modelValue",w)});const Me=fe.ref(),Z=fe.useTemplateRef("vditor"),E=()=>({modelId:ve.targetModel?ve.targetModel.id:"",modelClass:ve.targetModelClass?ve.targetModelClass:""}),M=(w,b)=>{if(!w)return!1;w.nodeType===3&&(w=w.parentElement);let g=w,s=!1;for(;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},D=w=>{let b;const g=w[w.currentMode].element;return getSelection().rangeCount>0&&(b=getSelection().getRangeAt(0),g.isEqualNode(b.startContainer)||g.contains(b.startContainer))?b:w[w.currentMode].range?w[w.currentMode].range:(g.focus(),b=g.ownerDocument.createRange(),b.setStart(g,0),b.collapse(!0),b)},A=w=>{let b=D(Me.value.vditor);const g=M(b.startContainer,"LI");if(!g||g.nextElementSibling||g.previousElementSibling)return!1;if(g.parentNode?.previousSibling?.nodeName==="UL"&&g.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let s=g.parentNode?.previousSibling,C=g.parentNode;s.appendChild(g),g.classList.add("vditor-task");let _=document.createElement("input");_.setAttribute("type","checkbox"),g.insertBefore(_,g.firstChild),C&&C.parentNode&&C.parentNode.removeChild(C),b.setStartAfter(g),b.collapse(!0)}},c=()=>ve.csrf?ve.csrf:window.csrf,l=w=>new Promise(b=>{new MutationObserver((s,C)=>{const _=document.querySelector(w);_&&(C.disconnect(),b(_))}).observe(document.body,{childList:!0,subtree:!0})}),y=w=>{w.addEventListener("paste",b=>{if("clipboardData"in b&&b.clipboardData?.items){for(const g of b.clipboardData.items)if(g.type.startsWith("image/")){const s=b.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",C=g.type.split("/")[1];if(b.preventDefault(),b.stopPropagation(),ve.mediaUploadEndpoint&&c()!==""){const _=new FormData,x=E();Object.keys(x).forEach(L=>{_.append(L,x[L])}),_.append("file",g.getAsFile()),fetch(ve.mediaUploadEndpoint,{method:"POST",headers:{"X-CSRF-TOKEN":c()},body:_}).then(L=>L.json()).then(L=>{Me.value?.insertMD(`
|
|
260
|
+
`)}).catch(()=>{Me.value?.vditor.tip.show("The file upload failed",5e3)});return}else{const _=new FileReader;_.readAsDataURL(g.getAsFile()),_.onload=()=>{const x=_.result;Me.value?.insertMD(`
|
|
261
|
+
`)}}}}},!0)},p=()=>{let w=["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|"];ve.mediaUploadEndpoint&&c()!==""&&w.push("upload");let b=["table","|","undo","redo","|","fullscreen",{name:"more",toolbar:["both","export","outline","preview","devtools","info","help"]}];for(let g=0;g<b.length;g++)w.push(b[g]);return w};fe.onMounted(()=>{let w={mode:"wysiwyg",height:"auto",minHeight:300,lang:"en_US",toolbarConfig:{pin:!0},cache:{enable:!1},preview:{maxWidth:2e3},toolbar:p(),after:()=>{Z.value.getElementsByClassName("vditor-wysiwyg")[0].addEventListener("keyup",g=>{g.key==="Enter"&&A()&&g.preventDefault()}),Y.value&&Me.value?.setValue(Y.value)},input:b=>{m("on-before-input",Y.value,b),Y.value=b,m("on-after-input",b)},upload:{}};ve.mediaUploadEndpoint&&c()!==""&&(w.upload={accept:"image/*",url:ve.mediaUploadEndpoint,headers:{"X-CSRF-TOKEN":c()},extraData:E(),multiple:!1,error:b=>{Me.value?.vditor.tip.show("The file upload failed",5e3)},success:(b,g)=>{const s=JSON.parse(g);document.execCommand("insertHTML",!1,`
|
|
262
|
+
`),Y.value=Me.value.getValue(),Me.value?.setValue(Me.value.getValue()),m("update:modelValue",Y.value),Me.value?.vditor.tip.hide()}}),Z.value&&(Me.value=new xi(Z.value,w),l("pre.vditor-reset").then(b=>{y(b)}))});const m=pt;return Jt({getEditor:()=>Me.value,getEditorValue:()=>Y.value}),(w,b)=>(fe.openBlock(),fe.createElementBlock("div",Di,[fe.createElementVNode("div",null,[ve.label?(fe.openBlock(),fe.createBlock(ki._sfc_main,{key:0,classes:"dsg-editor__label",label:ve.label},null,8,["label"])):fe.createCommentVNode("",!0),fe.createElementVNode("div",Hi,null,512)]),ve.errors&&ve.errors.length?(fe.openBlock(),fe.createElementBlock("div",Oi,[(fe.openBlock(!0),fe.createElementBlock(fe.Fragment,null,fe.renderList(ve.errors,(g,s)=>(fe.openBlock(),fe.createElementBlock("div",{class:"dsg-editor--error",key:s},fe.toDisplayString(g),1))),128))])):fe.createCommentVNode("",!0)]))}}),Vn=Ni,Ri={DsgEditor:Vn};exports.DsgEditor=Vn;exports.default=Ri;
|