text: var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,a=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,l=(e,t)=>{for(var n in t||(t={}))i.call(t,n)&&a(e,n,t[n]);if(r)for(var n of r(t))o.call(t,n)&&a(e,n,t[n]);return e};import{bX as s,k as c,r as d,D as u,u as p,f as m,I as f,J as h,a0 as v,o as g,n as y}from"./vendor.9d9efc92.js";import{p as b,V as w,l as E}from"./index.1f477f84.js";import{u as k}from"./useModal.0a504584.js";import"./useWindowSizeFn.0534066c.js";var S={exports:{}},L=S.exports=(()=>{var e={694:e=>{var t=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},n=-1;t.Diff=function(e,t){return[e,t]},t.prototype.diff_main=function(e,n,r,i){void 0===i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var o=i;if(null==e||null==n)throw new Error("Null input. (diff_main)");if(e==n)return e?[new t.Diff(0,e)]:[];void 0===r&&(r=!0);var a=r,l=this.diff_commonPrefix(e,n),s=e.substring(0,l);e=e.substring(l),n=n.substring(l),l=this.diff_commonSuffix(e,n);var c=e.substring(e.length-l);e=e.substring(0,e.length-l),n=n.substring(0,n.length-l);var d=this.diff_compute_(e,n,a,o);return s&&d.unshift(new t.Diff(0,s)),c&&d.push(new t.Diff(0,c)),this.diff_cleanupMerge(d),d},t.prototype.diff_compute_=function(e,r,i,o){var a;if(!e)return[new t.Diff(1,r)];if(!r)return[new t.Diff(n,e)];var l=e.length>r.length?e:r,s=e.length>r.length?r:e,c=l.indexOf(s);if(-1!=c)return a=[new t.Diff(1,l.substring(0,c)),new t.Diff(0,s),new t.Diff(1,l.substring(c+s.length))],e.length>r.length&&(a[0][0]=a[2][0]=n),a;if(1==s.length)return[new t.Diff(n,e),new t.Diff(1,r)];var d=this.diff_halfMatch_(e,r);if(d){var u=d[0],p=d[1],m=d[2],f=d[3],h=d[4],v=this.diff_main(u,m,i,o),g=this.diff_main(p,f,i,o);return v.concat([new t.Diff(0,h)],g)}return i&&e.length>100&&r.length>100?this.diff_lineMode_(e,r,o):this.diff_bisect_(e,r,o)},t.prototype.diff_lineMode_=function(e,r,i){var o=this.diff_linesToChars_(e,r);e=o.chars1,r=o.chars2;var a=o.lineArray,l=this.diff_main(e,r,!1,i);this.diff_charsToLines_(l,a),this.diff_cleanupSemantic(l),l.push(new t.Diff(0,""));for(var s=0,c=0,d=0,u="",p="";s<l.length;){switch(l[s][0]){case 1:d++,p+=l[s][1];break;case n:c++,u+=l[s][1];break;case 0:if(c>=1&&d>=1){l.splice(s-c-d,c+d),s=s-c-d;for(var m=this.diff_main(u,p,!1,i),f=m.length-1;f>=0;f--)l.splice(s,0,m[f]);s+=m.length}d=0,c=0,u="",p=""}s++}return l.pop(),l},t.prototype.diff_bisect_=function(e,r,i){for(var o=e.length,a=r.length,l=Math.ceil((o+a)/2),s=l,c=2*l,d=new Array(c),u=new Array(c),p=0;p<c;p++)d[p]=-1,u[p]=-1;d[s+1]=0,u[s+1]=0;for(var m=o-a,f=m%2!=0,h=0,v=0,g=0,y=0,b=0;b<l&&!((new Date).getTime()>i);b++){for(var w=-b+h;w<=b-v;w+=2){for(var E=s+w,k=(M=w==-b||w!=b&&d[E-1]<d[E+1]?d[E+1]:d[E-1]+1)-w;M<o&&k<a&&e.charAt(M)==r.charAt(k);)M++,k++;if(d[E]=M,M>o)v+=2;else if(k>a)h+=2;else if(f&&(C=s+m-w)>=0&&C<c&&-1!=u[C]&&M>=(L=o-u[C]))return this.diff_bisectSplit_(e,r,M,k,i)}for(var S=-b+g;S<=b-y;S+=2){for(var L,C=s+S,T=(L=S==-b||S!=b&&u[C-1]<u[C+1]?u[C+1]:u[C-1]+1)-S;L<o&&T<a&&e.charAt(o-L-1)==r.charAt(a-T-1);)L++,T++;if(u[C]=L,L>o)y+=2;else if(T>a)g+=2;else if(!f){var M;if((E=s+m-S)>=0&&E<c&&-1!=d[E]&&(k=s+(M=d[E])-E,M>=(L=o-L)))return this.diff_bisectSplit_(e,r,M,k,i)}}}return[new t.Diff(n,e),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(e,t,n,r,i){var o=e.substring(0,n),a=t.substring(0,r),l=e.substring(n),s=t.substring(r),c=this.diff_main(o,a,!1,i),d=this.diff_main(l,s,!1,i);return c.concat(d)},t.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function i(e){for(var t="",i=0,a=-1,l=n.length;a<e.length-1;){-1==(a=e.indexOf("\n",i))&&(a=e.length-1);var s=e.substring(i,a+1);(r.hasOwnProperty?r.hasOwnProperty(s):void 0!==r[s])?t+=String.fromCharCode(r[s]):(l==o&&(s=e.substring(i),a=e.length),t+=String.fromCharCode(l),r[s]=l,n[l++]=s),i=a+1}return t}n[0]="";var o=4e4,a=i(e);return o=65535,{chars1:a,chars2:i(t),lineArray:n}},t.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],o=0;o<r.length;o++)i[o]=t[r.charCodeAt(o)];e[n][1]=i.join("")}},t.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,o=0;n<i;)e.substring(o,i)==t.substring(o,i)?o=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,o=0;n<i;)e.substring(e.length-i,e.length-o)==t.substring(t.length-i,t.length-o)?o=n=i:r=i,i=Math.floor((r-n)/2+n);return i},t.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var o=0,a=1;;){var l=e.substring(i-a),s=t.indexOf(l);if(-1==s)return o;a+=s,0!=s&&e.substring(i-a)!=t.substring(0,a)||(o=a,a++)}},t.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||2*r.length<n.length)return null;var i=this;function o(e,t,n){for(var r,o,a,l,s=e.substring(n,n+Math.floor(e.length/4)),c=-1,d="";-1!=(c=t.indexOf(s,c+1));){var u=i.diff_commonPrefix(e.substring(n),t.substring(c)),p=i.diff_commonSuffix(e.substring(0,n),t.substring(0,c));d.length<p+u&&(d=t.substring(c-p,c)+t.substring(c,c+u),r=e.substring(0,n-p),o=e.substring(n+u),a=t.substring(0,c-p),l=t.substring(c+u))}return 2*d.length>=e.length?[r,o,a,l,d]:null}var a,l,s,c,d,u=o(n,r,Math.ceil(n.length/4)),p=o(n,r,Math.ceil(n.length/2));return u||p?(a=p?u&&u[4].length>p[4].length?u:p:u,e.length>t.length?(l=a[0],s=a[1],c=a[2],d=a[3]):(c=a[0],d=a[1],l=a[2],s=a[3]),[l,s,c,d,a[4]]):null},t.prototype.diff_cleanupSemantic=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=0,c=0,d=0,u=0;l<e.length;)0==e[l][0]?(i[o++]=l,s=d,c=u,d=0,u=0,a=e[l][1]):(1==e[l][0]?d+=e[l][1].length:u+=e[l][1].length,a&&a.length<=Math.max(s,c)&&a.length<=Math.max(d,u)&&(e.splice(i[o-1],0,new t.Diff(n,a)),e[i[o-1]+1][0]=1,o--,l=--o>0?i[o-1]:-1,s=0,c=0,d=0,u=0,a=null,r=!0)),l++;for(r&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==n&&1==e[l][0]){var p=e[l-1][1],m=e[l][1],f=this.diff_commonOverlap_(p,m),h=this.diff_commonOverlap_(m,p);f>=h?(f>=p.length/2||f>=m.length/2)&&(e.splice(l,0,new t.Diff(0,m.substring(0,f))),e[l-1][1]=p.substring(0,p.length-f),e[l+1][1]=m.substring(f),l++):(h>=p.length/2||h>=m.length/2)&&(e.splice(l,0,new t.Diff(0,p.substring(0,h))),e[l-1][0]=1,e[l-1][1]=m.substring(0,m.length-h),e[l+1][0]=n,e[l+1][1]=p.substring(h),l++),l++}l++}},t.prototype.diff_cleanupSemanticLossless=function(e){function n(e,n){if(!e||!n)return 6;var r=e.charAt(e.length-1),i=n.charAt(0),o=r.match(t.nonAlphaNumericRegex_),a=i.match(t.nonAlphaNumericRegex_),l=o&&r.match(t.whitespaceRegex_),s=a&&i.match(t.whitespaceRegex_),c=l&&r.match(t.linebreakRegex_),d=s&&i.match(t.linebreakRegex_),u=c&&e.match(t.blanklineEndRegex_),p=d&&n.match(t.blanklineStartRegex_);return u||p?5:c||d?4:o&&!l&&s?3:l||s?2:o||a?1:0}for(var r=1;r<e.length-1;){if(0==e[r-1][0]&&0==e[r+1][0]){var i=e[r-1][1],o=e[r][1],a=e[r+1][1],l=this.diff_commonSuffix(i,o);if(l){var s=o.substring(o.length-l);i=i.substring(0,i.length-l),o=s+o.substring(0,o.length-l),a=s+a}for(var c=i,d=o,u=a,p=n(i,o)+n(o,a);o.charAt(0)===a.charAt(0);){i+=o.charAt(0),o=o.substring(1)+a.charAt(0),a=a.substring(1);var m=n(i,o)+n(o,a);m>=p&&(p=m,c=i,d=o,u=a)}e[r-1][1]!=c&&(c?e[r-1][1]=c:(e.splice(r-1,1),r--),e[r][1]=d,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=!1,c=!1,d=!1,u=!1;l<e.length;)0==e[l][0]?(e[l][1].length<this.Diff_EditCost&&(d||u)?(i[o++]=l,s=d,c=u,a=e[l][1]):(o=0,a=null),d=u=!1):(e[l][0]==n?u=!0:d=!0,a&&(s&&c&&d&&u||a.length<this.Diff_EditCost/2&&s+c+d+u==3)&&(e.splice(i[o-1],0,new t.Diff(n,a)),e[i[o-1]+1][0]=1,o--,a=null,s&&c?(d=u=!0,o=0):(l=--o>0?i[o-1]:-1,d=u=!1),r=!0)),l++;r&&this.diff_cleanupMerge(e)},t.prototype.diff_cleanupMerge=function(e){e.push(new t.Diff(0,""));for(var r,i=0,o=0,a=0,l="",s="";i<e.length;)switch(e[i][0]){case 1:a++,s+=e[i][1],i++;break;case n:o++,l+=e[i][1],i++;break;case 0:o+a>1?(0!==o&&0!==a&&(0!==(r=this.diff_commonPrefix(s,l))&&(i-o-a>0&&0==e[i-o-a-1][0]?e[i-o-a-1][1]+=s.substring(0,r):(e.splice(0,0,new t.Diff(0,s.substring(0,r))),i++),s=s.substring(r),l=l.substring(r)),0!==(r=this.diff_commonSuffix(s,l))&&(e[i][1]=s.substring(s.length-r)+e[i][1],s=s.substring(0,s.length-r),l=l.substring(0,l.length-r))),i-=o+a,e.splice(i,o+a),l.length&&(e.splice(i,0,new t.Diff(n,l)),i++),s.length&&(e.splice(i,0,new t.Diff(1,s)),i++),i++):0!==i&&0==e[i-1][0]?(e[i-1][1]+=e[i][1],e.splice(i,1)):i++,a=0,o=0,l="",s=""}""===e[e.length-1][1]&&e.pop();var c=!1;for(i=1;i<e.length-1;)0==e[i-1][0]&&0==e[i+1][0]&&(e[i][1].substring(e[i][1].length-e[i-1][1].length)==e[i-1][1]?(e[i][1]=e[i-1][1]+e[i][1].substring(0,e[i][1].length-e[i-1][1].length),e[i+1][1]=e[i-1][1]+e[i+1][1],e.splice(i-1,1),c=!0):e[i][1].substring(0,e[i+1][1].length)==e[i+1][1]&&(e[i-1][1]+=e[i+1][1],e[i][1]=e[i][1].substring(e[i+1][1].length)+e[i+1][1],e.splice(i+1,1),c=!0)),i++;c&&this.diff_cleanupMerge(e)},t.prototype.diff_xIndex=function(e,t){var r,i=0,o=0,a=0,l=0;for(r=0;r<e.length&&(1!==e[r][0]&&(i+=e[r][1].length),e[r][0]!==n&&(o+=e[r][1].length),!(i>t));r++)a=i,l=o;return e.length!=r&&e[r][0]===n?l:l+(t-a)},t.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,i=/</g,o=/>/g,a=/\n/g,l=0;l<e.length;l++){var s=e[l][0],c=e[l][1].replace(r,"&amp;").replace(i,"&lt;").replace(o,"&gt;").replace(a,"&para;<br>");switch(s){case 1:t[l]='<ins style="background:#e6ffe6;">'+c+"</ins>";break;case n:t[l]='<del style="background:#ffe6e6;">'+c+"</del>";break;case 0:t[l]="<span>"+c+"</span>"}}return t.join("")},t.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)1!==e[n][0]&&(t[n]=e[n][1]);return t.join("")},t.prototype.diff_text2=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==n&&(t[r]=e[r][1]);return t.join("")},t.prototype.diff_levenshtein=function(e){for(var t=0,r=0,i=0,o=0;o<e.length;o++){var a=e[o][0],l=e[o][1];switch(a){case 1:r+=l.length;break;case n:i+=l.length;break;case 0:t+=Math.max(r,i),r=0,i=0}}return t+=Math.max(r,i)},t.prototype.diff_toDelta=function(e){for(var t=[],r=0;r<e.length;r++)switch(e[r][0]){case 1:t[r]="+"+encodeURI(e[r][1]);break;case n:t[r]="-"+e[r][1].length;break;case 0:t[r]="="+e[r][1].length}return t.join("\t").replace(/%20/g," ")},t.prototype.diff_fromDelta=function(e,r){for(var i=[],o=0,a=0,l=r.split(/\t/g),s=0;s<l.length;s++){var c=l[s].substring(1);switch(l[s].charAt(0)){case"+":try{i[o++]=new t.Diff(1,decodeURI(c))}catch(p){throw new Error("Illegal escape in diff_fromDelta: "+c)}break;case"-":case"=":var d=parseInt(c,10);if(isNaN(d)||d<0)throw new Error("Invalid number in diff_fromDelta: "+c);var u=e.substring(a,a+=d);"="==l[s].charAt(0)?i[o++]=new t.Diff(0,u):i[o++]=new t.Diff(n,u);break;default:if(l[s])throw new Error("Invalid diff operation in diff_fromDelta: "+l[s])}}if(a!=e.length)throw new Error("Delta length ("+a+") does not equal source text length ("+e.length+").");return i},t.prototype.match_main=function(e,t,n){if(null==e||null==t||null==n)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},t.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),i=this;function o(e,r){var o=e/t.length,a=Math.abs(n-r);return i.Match_Distance?o+a/i.Match_Distance:a?1:o}var a=this.Match_Threshold,l=e.indexOf(t,n);-1!=l&&(a=Math.min(o(0,l),a),-1!=(l=e.lastIndexOf(t,n+t.length))&&(a=Math.min(o(0,l),a)));var s,c,d=1<<t.length-1;l=-1;for(var u,p=t.length+e.length,m=0;m<t.length;m++){for(s=0,c=p;s<c;)o(m,n+c)<=a?s=c:p=c,c=Math.floor((p-s)/2+s);p=c;var f=Math.max(1,n-c+1),h=Math.min(n+c,e.length)+t.length,v=Array(h+2);v[h+1]=(1<<m)-1;for(var g=h;g>=f;g--){var y=r[e.charAt(g-1)];if(v[g]=0===m?(v[g+1]<<1|1)&y:(v[g+1]<<1|1)&y|(u[g+1]|u[g])<<1|1|u[g+1],v[g]&d){var b=o(m,g-1);if(b<=a){if(a=b,!((l=g-1)>n))break;f=Math.max(1,2*n-l)}}}if(o(m+1,n)>a)break;u=v}return l},t.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},t.prototype.patch_addContext_=function(e,n){if(0!=n.length){if(null===e.start2)throw Error("patch not initialized");for(var r=n.substring(e.start2,e.start2+e.length1),i=0;n.indexOf(r)!=n.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=n.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=n.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new t.Diff(0,o));var a=n.substring(e.start2+e.length1,e.start2+e.length1+i);a&&e.diffs.push(new t.Diff(0,a)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+a.length,e.length2+=o.length+a.length}},t.prototype.patch_make=function(e,r,i){var o,a;if("string"==typeof e&&"string"==typeof r&&void 0===i)o=e,(a=this.diff_main(o,r,!0)).length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&"object"==typeof e&&void 0===r&&void 0===i)a=e,o=this.diff_text1(a);else if("string"==typeof e&&r&&"object"==typeof r&&void 0===i)o=e,a=r;else{if("string"!=typeof e||"string"!=typeof r||!i||"object"!=typeof i)throw new Error("Unknown call format to patch_make.");o=e,a=i}if(0===a.length)return[];for(var l=[],s=new t.patch_obj,c=0,d=0,u=0,p=o,m=o,f=0;f<a.length;f++){var h=a[f][0],v=a[f][1];switch(c||0===h||(s.start1=d,s.start2=u),h){case 1:s.diffs[c++]=a[f],s.length2+=v.length,m=m.substring(0,u)+v+m.substring(u);break;case n:s.length1+=v.length,s.diffs[c++]=a[f],m=m.substring(0,u)+m.substring(u+v.length);break;case 0:v.length<=2*this.Patch_Margin&&c&&a.length!=f+1?(s.diffs[c++]=a[f],s.length1+=v.length,s.length2+=v.length):v.length>=2*this.Patch_Margin&&c&&(this.patch_addContext_(s,p),l.push(s),s=new t.patch_obj,c=0,p=m,d=u)}1!==h&&(d+=v.length),h!==n&&(u+=v.length)}return c&&(this.patch_addContext_(s,p),l.push(s)),l},t.prototype.patch_deepCopy=function(e){for(var n=[],r=0;r<e.length;r++){var i=e[r],o=new t.patch_obj;o.diffs=[];for(var a=0;a<i.diffs.length;a++)o.diffs[a]=new t.Diff(i.diffs[a][0],i.diffs[a][1]);o.start1=i.start1,o.start2=i.start2,o.length1=i.length1,o.length2=i.length2,n[r]=o}return n},t.prototype.patch_apply=function(e,t){if(0==e.length)return[t,[]];e=this.patch_deepCopy(e);var r=this.patch_addPadding(e);t=r+t+r,this.patch_splitMax(e);for(var i=0,o=[],a=0;a<e.length;a++){var l,s,c=e[a].start2+i,d=this.diff_text1(e[a].diffs),u=-1;if(d.length>this.Match_MaxBits?-1!=(l=this.match_main(t,d.substring(0,this.Match_MaxBits),c))&&(-1==(u=this.match_main(t,d.substring(d.length-this.Match_MaxBits),c+d.length-this.Match_MaxBits))||l>=u)&&(l=-1):l=this.match_main(t,d,c),-1==l)o[a]=!1,i-=e[a].length2-e[a].length1;else if(o[a]=!0,i=l-c,d==(s=-1==u?t.substring(l,l+d.length):t.substring(l,u+this.Match_MaxBits)))t=t.substring(0,l)+this.diff_text2(e[a].diffs)+t.substring(l+d.length);else{var p=this.diff_main(d,s,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(p)/d.length>this.Patch_DeleteThreshold)o[a]=!1;else{this.diff_cleanupSemanticLossless(p);for(var m,f=0,h=0;h<e[a].diffs.length;h++){var v=e[a].diffs[h];0!==v[0]&&(m=this.diff_xIndex(p,f)),1===v[0]?t=t.substring(0,l+m)+v[1]+t.substring(l+m):v[0]===n&&(t=t.substring(0,l+m)+t.substring(l+this.diff_xIndex(p,f+v[1].length))),v[0]!==n&&(f+=v[1].length)}}}}return[t=t.substring(r.length,t.length-r.length),o]},t.prototype.patch_addPadding=function(e){for(var n=this.Patch_Margin,r="",i=1;i<=n;i++)r+=String.fromCharCode(i);for(i=0;i<e.length;i++)e[i].start1+=n,e[i].start2+=n;var o=e[0],a=o.diffs;if(0==a.length||0!=a[0][0])a.unshift(new t.Diff(0,r)),o.start1-=n,o.start2-=n,o.length1+=n,o.length2+=n;else if(n>a[0][1].length){var l=n-a[0][1].length;a[0][1]=r.substring(a[0][1].length)+a[0][1],o.start1-=l,o.start2-=l,o.length1+=l,o.length2+=l}return 0==(a=(o=e[e.length-1]).diffs).length||0!=a[a.length-1][0]?(a.push(new t.Diff(0,r)),o.length1+=n,o.length2+=n):n>a[a.length-1][1].length&&(l=n-a[a.length-1][1].length,a[a.length-1][1]+=r.substring(0,l),o.length1+=l,o.length2+=l),r},t.prototype.patch_splitMax=function(e){for(var r=this.Match_MaxBits,i=0;i<e.length;i++)if(!(e[i].length1<=r)){var o=e[i];e.splice(i--,1);for(var a=o.start1,l=o.start2,s="";0!==o.diffs.length;){var c=new t.patch_obj,d=!0;for(c.start1=a-s.length,c.start2=l-s.length,""!==s&&(c.length1=c.length2=s.length,c.diffs.push(new t.Diff(0,s)));0!==o.diffs.length&&c.length1<r-this.Patch_Margin;){var u=o.diffs[0][0],p=o.diffs[0][1];1===u?(c.length2+=p.length,l+=p.length,c.diffs.push(o.diffs.shift()),d=!1):u===n&&1==c.diffs.length&&0==c.diffs[0][0]&&p.length>2*r?(c.length1+=p.length,a+=p.length,d=!1,c.diffs.push(new t.Diff(u,p)),o.diffs.shift()):(p=p.substring(0,r-c.length1-this.Patch_Margin),c.length1+=p.length,a+=p.length,0===u?(c.length2+=p.length,l+=p.length):d=!1,c.diffs.push(new t.Diff(u,p)),p==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(p.length))}s=(s=this.diff_text2(c.diffs)).substring(s.length-this.Patch_Margin);var m=this.diff_text1(o.diffs).substring(0,this.Patch_Margin);""!==m&&(c.length1+=m.length,c.length2+=m.length,0!==c.diffs.length&&0===c.diffs[c.diffs.length-1][0]?c.diffs[c.diffs.length-1][1]+=m:c.diffs.push(new t.Diff(0,m))),d||e.splice(++i,0,c)}}},t.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join("")},t.prototype.patch_fromText=function(e){var r=[];if(!e)return r;for(var i=e.split("\n"),o=0,a=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;o<i.length;){var l=i[o].match(a);if(!l)throw new Error("Invalid patch string: "+i[o]);var s=new t.patch_obj;for(r.push(s),s.start1=parseInt(l[1],10),""===l[2]?(s.start1--,s.length1=1):"0"==l[2]?s.length1=0:(s.start1--,s.length1=parseInt(l[2],10)),s.start2=parseInt(l[3],10),""===l[4]?(s.start2--,s.length2=1):"0"==l[4]?s.length2=0:(s.start2--,s.length2=parseInt(l[4],10)),o++;o<i.length;){var c=i[o].charAt(0);try{var d=decodeURI(i[o].substring(1))}catch(u){throw new Error("Illegal escape in patch_fromText: "+d)}if("-"==c)s.diffs.push(new t.Diff(n,d));else if("+"==c)s.diffs.push(new t.Diff(1,d));else if(" "==c)s.diffs.push(new t.Diff(0,d));else{if("@"==c)break;if(""!==c)throw new Error('Invalid patch mode "'+c+'" in: '+d)}o++}}return r},(t.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var e,t=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],r=0;r<this.diffs.length;r++){switch(this.diffs[r][0]){case 1:e="+";break;case n:e="-";break;case 0:e=" "}t[r+1]=e+encodeURI(this.diffs[r][1])+"\n"}return t.join("").replace(/%20/g," ")},e.exports=t,e.exports.diff_match_patch=t,e.exports.DIFF_DELETE=n,e.exports.DIFF_INSERT=1,e.exports.DIFF_EQUAL=0},157:()=>{},857:(e,t,n)=>{n.d(t,{default:()=>H});var r=n(369),i=n(726),o=n(23),a=n(383),l=n(890),s=n(93),c=function(e){void 0===e&&(e=document);var t=function(e){var t=document.createElement("img");t.src=e.getAttribute("data-src"),t.addEventListener("load",(function(){e.getAttribute("style")||e.getAttribute("class")||e.getAttribute("width")||e.getAttribute("height")||t.naturalHeight>t.naturalWidth&&t.naturalWidth/t.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&t.naturalHeight>window.innerHeight-40&&(e.style.height=window.innerHeight-40+"px"),e.src=t.src})),e.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return e.querySelectorAll("img").forEach((function(e){e.getAttribute("data-src")&&t(e)})),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)}))):(window.vditorImageIntersectionObserver=new IntersectionObserver((function(e){e.forEach((function(e){(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)&&e.target.getAttribute("data-src")&&t(e.target)}))})),e.querySelectorAll("img").forEach((function(e){window.vditorImageIntersectionObserver.observe(e)})))},d=n(323),u=n(207),p=n(765),m=n(894),f=n(198),h=n(583),v=n(260),g=n(958),y=n(228),b=n(713),w=n(224),E=n(792),k=n(187),S=function(e,t){if(void 0===t&&(t="zh_CN"),"undefined"!=typeof speechSynthesis&&"undefined"!=typeof SpeechSynthesisUtterance){var n='<svg><use xlink:href="#vditor-icon-play"></use></svg>',r='<svg><use xlink:href="#vditor-icon-pause"></use></svg>',i=document.querySelector(".vditor-speech");if(!i){(i=document.createElement("div")).className="vditor-speech",document.body.insertAdjacentElement("beforeend",i);var o=function(){var e,n;return speechSynthesis.getVoices().forEach((function(r){r.lang===t.replace("_","-")&&(e=r),r.default&&(n=r)})),e||(e=n),e};void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=o);var a=o();i.onclick=function(){if("vditor-speech"===i.className){var e=new SpeechSynthesisUtterance(i.getAttribute("data-text"));e.voice=a,e.onend=function(){i.className="vditor-speech",speechSynthesis.cancel(),i.innerHTML=n},speechSynthesis.speak(e),i.className="vditor-speech vditor-speech--current",i.innerHTML=r}else speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),i.innerHTML=r):(speechSynthesis.pause(),i.innerHTML=n));(0,k.Hc)(window.vditorSpeechRange)},document.body.addEventListener("click",(function(){""===getSelection().toString().trim()&&"block"===i.style.display&&(i.className="vditor-speech",speechSynthesis.cancel(),i.style.display="none")}))}e.addEventListener("mouseup",(function(e){var t=getSelection().toString().trim();if(speechSynthesis.cancel(),""!==getSelection().toString().trim()){window.vditorSpeechRange=getSelection().getRangeAt(0).cloneRange();var r=getSelection().getRangeAt(0).getBoundingClientRect();i.innerHTML=n,i.style.display="block",i.style.top=r.top+r.height+document.querySelector("html").scrollTop-20+"px",i.style.left=e.screenX+2+"px",i.setAttribute("data-text",t)}else"block"===i.style.display&&(i.className="vditor-speech",i.style.display="none")}))}},L=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function l(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((r=r.apply(e,t||[])).next())}))},C=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(l){o=[6,l],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}},T=function(e){var t={anchor:0,cdn:v.g.CDN,customEmoji:{},emojiPath:(e&&e.emojiPath||v.g.CDN)+"/dist/images/emoji",hljs:v.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:v.g.MARKDOWN_OPTIONS,math:v.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},theme:v.g.THEME_OPTIONS};return(0,w.T)(t,e)},M=function(e,t){var n=T(t);return(0,y.G)(n.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then((function(){var r=(0,E.X)({autoSpace:n.markdown.autoSpace,codeBlockPreview:n.markdown.codeBlockPreview,emojiSite:n.emojiPath,emojis:n.customEmoji,fixTermTypo:n.markdown.fixTermTypo,footnotes:n.markdown.footnotes,headingAnchor:0!==n.anchor,inlineMathDigit:n.math.inlineDigit,lazyLoadImage:n.lazyLoadImage,linkBase:n.markdown.linkBase,linkPrefix:n.markdown.linkPrefix,listStyle:n.markdown.listStyle,mark:n.markdown.mark,mathBlockPreview:n.markdown.mathBlockPreview,paragraphBeginningSpace:n.markdown.paragraphBeginningSpace,sanitize:n.markdown.sanitize,toc:n.markdown.toc});return(null==t?void 0:t.renderers)&&r.SetJSRenderers({renderers:{Md2HTML:t.renderers}}),r.SetHeadingID(!0),r.Md2HTML(e)}))},x=function(e,t,n){return L(void 0,void 0,void 0,(function(){var f,v;return C(this,(function(w){switch(w.label){case 0:return f=T(n),[4,M(t,f)];case 1:return v=w.sent(),f.transform&&(v=f.transform(v)),e.innerHTML=v,e.classList.add("vditor-reset"),(0,g.Z)(f.theme.current,f.theme.path),1===f.anchor&&e.classList.add("vditor-reset--anchor"),(0,o.O)(e,f.lang),(0,s.s)(f.hljs,e,f.cdn),(0,d.H)(e,{cdn:f.cdn,math:f.math}),(0,p.i)(e,f.cdn,f.mode),(0,a.P)(e,f.cdn),(0,l.v)(e,f.cdn),(0,i.p)(e,f.cdn,f.mode),(0,m.P)(e,f.cdn,f.mode),(0,h.B)(e,f.cdn),(0,r.Q)(e,f.cdn),(0,u.Y)(e),f.speech.enable&&S(e,f.lang),0!==f.anchor&&(E=f.anchor,document.querySelectorAll(".vditor-anchor").forEach((function(e){1===E&&e.classList.add("vditor-anchor--left"),e.onclick=function(){var t=e.getAttribute("href").substr(1),n=document.getElementById("vditorAnchor-"+t).offsetTop;document.querySelector("html").scrollTop=n}})),window.onhashchange=function(){var e=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));e&&(document.querySelector("html").scrollTop=e.offsetTop)}),f.after&&f.after(),f.lazyLoadImage&&c(e),f.icon&&(0,y.G)(f.cdn+"/dist/js/icons/"+f.icon+".js","vditorIconScript"),e.addEventListener("click",(function(t){var n=(0,b.lG)(t.target,"SPAN");if(n&&(0,b.fb)(n,"vditor-toc")){var r=e.querySelector("#"+n.getAttribute("data-target-id"));r&&window.scrollTo(window.scrollX,r.offsetTop)}})),[2]}var E}))}))},_=n(264),A=n(968);const H=function(){function e(){}return e.previewImage=_.E,e.codeRender=o.O,e.graphvizRender=l.v,e.highlightRender=s.s,e.mathRender=d.H,e.mermaidRender=p.i,e.flowchartRender=a.P,e.chartRender=i.p,e.abcRender=r.Q,e.mindmapRender=m.P,e.plantumlRender=h.B,e.outlineRender=f.k,e.mediaRender=u.Y,e.speechRender=S,e.lazyLoadImageRender=c,e.md2html=M,e.preview=x,e.setCodeTheme=A.Y,e.setContentTheme=g.Z,e}()},260:(e,t,n)=>{n.d(t,{H:()=>r,g:()=>i});var r="3.8.5",i=function(){function e(){}return e.ZWSP="​",e.DROP_EDITOR="application/editor",e.MOBILE_WIDTH=520,e.CLASS_MENU_DISABLED="vditor-menu--disabled",e.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],e.CODE_THEME=["abap","algol","algol_nu","arduino","autumn","borland","bw","colorful","dracula","emacs","friendly","fruity","github","igor","lovelace","manni","monokai","monokailight","murphy","native","paraiso-dark","paraiso-light","pastie","perldoc","pygments","rainbow_dash","rrt","solarized-dark","solarized-dark256","solarized-light","swapoff","tango","trac","vim","vs","xcode","ant-design"],e.CODE_LANGUAGES=["mermaid","echarts","mindmap","plantuml","abc","graphviz","flowchart","apache","js","ts","html","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica"],e.CDN="https://cdn.jsdelivr.net/npm/vditor@3.8.5",e.MARKDOWN_OPTIONS={autoSpace:!1,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},e.HLJS_OPTIONS={enable:!0,lineNumber:!1,style:"github"},e.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},e.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:e.CDN+"/dist/css/content-theme"},e}()},577:(e,t,n)=>{n.d(t,{a:()=>r});var r={en_US:{alignCenter:"Center",alignLeft:"Left",alignRight:"Right",alternateText:"Alternate text",bold:"Blod",both:"editor & preview",check:"Task List",close:"Close",code:"Code Block","code-theme":"Code Block Theme Preview",column:"Column",comment:"Comment",confirm:"Confirm","content-theme":"Content Theme Preview",copied:"Copied",copy:"Copy","delete-column":"Delete Row","delete-row":"Delete Column",devtools:"DevTools",down:"Down",downloadTip:"The browser does not support the download function",edit:"Edit","edit-mode":"Toggle Edit Mode",emoji:"Emoji",export:"Export",fileTypeError:"file type is error",footnoteRef:"Footnote Ref",fullscreen:"Toggle Fullscreen",generate:"Generating",headings:"Headings",help:"Help",imageURL:"image URL",indent:"Indent",info:"Info","inline-code":"Inline Code","insert-after":"Insert line after","insert-before":"Insert line Before",insertColumnLeft:"Insert 1 left",insertColumnRight:"Insert 1 right",insertRowAbove:"Insert 1 above",insertRowBelow:"Insert 1 below",instantRendering:"Instant Rendering",italic:"Italic",language:"Language",line:"Line",link:"Link",linkRef:"Link Ref",list:"List",more:"More",nameEmpty:"Name is empty","ordered-list":"Order List",outdent:"Outdent",outline:"Outline",over:"over",performanceTip:"Real-time preview requires ${x}ms, you can close it",preview:"Preview",quote:"Quote",record:"Start Record/End Record","record-tip":"The device does not support recording",recording:"recording...",redo:"Redo",remove:"Remove",row:"Row",spin:"Spin",splitView:"Split View",strike:"Strike",table:"Table",textIsNotEmpty:"text(no empty)",title:"Title",tooltipText:"Tooltip text",undo:"Undo",up:"Up",update:"Update",upload:"Upload image or file",uploadError:"upload error",uploading:"uploading...",wysiwyg:"WYSIWYG"},ja_JP:{alignCenter:"中央",alignLeft:"左側",alignRight:"右側",alternateText:"イメージタグ",bold:"太く",both:"エディター & プレビュー",check:"チェックリスト",close:"閉じる",code:"コードブロック挿入","code-theme":"コードブロックテーマ",column:"行列",comment:"コメント",confirm:"確認","content-theme":"コンテンツテーマ",copied:"コピー完了",copy:"コピー","delete-column":"列 消去","delete-row":"行 消去",devtools:"開発ツール",down:"ダウンロード",downloadTip:"ブラウザがダウンロード機能をサポートしていません。",edit:"修正","edit-mode":"編集モード",emoji:"絵文字",export:"書き出し",fileTypeError:"サポートしていません。",footnoteRef:"脚注参照",fullscreen:"全体画面",generate:"作成する",headings:"タイトル大きさ",help:"ヘルプ",imageURL:"イメージ URL",indent:"字下げ",info:"情報","inline-code":"インラインコード","insert-after":"ブロックの後ろに入力","insert-before":"ブロックの前に入力",insertColumnLeft:"左側に列を挿入",insertColumnRight:"右側に列を挿入",insertRowAbove:"上に行を挿入",insertRowBelow:"下に行を挿入",instantRendering:"インスタントレンダリング",italic:"斜体",language:"言語",line:"段落分割",link:"リンク",linkRef:"リンク参照",list:"リスト",more:"詳しく見る",nameEmpty:"名前が入力されていません。","ordered-list":"順序のあるリスト",outdent:"ぶら下げインデント",outline:"概要",over:"オーバー",performanceTip:"リアルタイムプレビューには、${x}msが必要でエディター/プレビューボタンをクリックして閉じる事が出来ます。",preview:"プレビュー",quote:"引用段落",record:"録音開始/録音終了","record-tip":"録音がサポートされていません。",recording:"録音中...",redo:"戻る",remove:"消去",row:"列",spin:"スピン",splitView:"マークダウン",strike:"取り消し線",table:"表 挿入",textIsNotEmpty:"テキスト(no empty)",title:"題名",tooltipText:"ツールチップ",undo:"取り消す",up:"戻る",update:"アップデート",upload:"イメージをダウンロードする",uploadError:"アップロード失敗",uploading:"アップロード中",wysiwyg:"ウィジウィグ"},ko_KR:{alignCenter:"가운데",alignLeft:"왼쪽",alignRight:"오른쪽",alternateText:"이미지 태그",bold:"굵게",both:"에디터 & 미리보기",check:"체크박스",close:"닫기",code:"코드블럭삽입","code-theme":"코드블럭테마",column:"행",comment:"코멘트",confirm:"확인","content-theme":"컨텐츠테마",copied:"복사완료",copy:"복사","delete-column":"열 삭제","delete-row":"행 삭제",devtools:"개발툴",down:"다운",downloadTip:"브라우저가 다운로드 기능을 지원하지 않습니다",edit:"수정","edit-mode":"편집모드",emoji:"이모지",export:"내보내기",fileTypeError:"지원하지않습니다.",footnoteRef:"각주참조",fullscreen:"전체화면",generate:"생성",headings:"제목크기",help:"도움말",imageURL:"이미지 URL",indent:"들여쓰기",info:"정보","inline-code":"인라인코드","insert-after":"블락 뒤로 입력","insert-before":"블락 앞으로 입력",insertColumnLeft:"왼쪽에 열 삽입",insertColumnRight:"오른쪽에 열 삽입",insertRowAbove:"위에 행 삽입",insertRowBelow:"아래에 행 삽입",instantRendering:"타이포라",italic:"기울임꼴",language:"언어",line:"문단나눔",link:"링크",linkRef:"링크 참조",list:"순서없는 목록",more:"더보기",nameEmpty:"이름이 비어있습니다.","ordered-list":"순서있는 목록",outdent:"내어쓰기",outline:"개요",over:"오버",performanceTip:"실시간 미리보기에는 ${x}ms가 필요하며 에디터/미리보기 버튼을 클릭하여 닫을 수 있습니다.",preview:"미리보기",quote:"인용단락",record:"녹음시작/녹음종료","record-tip":"녹음을 지원하지 않습니다.",recording:"녹음중...",redo:"되돌리기",remove:"삭제",row:"열",spin:"회전",splitView:"마크다운",strike:"취소선",table:"표삽입",textIsNotEmpty:"텍스트(no empty)",title:"표제",tooltipText:"툴팁",undo:"취소하기",up:"위로",update:"업데이트",upload:"이미지 업로드하기",uploadError:"업로드 실패",uploading:"업로드중...",wysiwyg:"위지위그"},ru_RU:{alignCenter:"Выровнять по центру",alignLeft:"Выровнять по левому краю",alignRight:"Выровнять по правому краю",alternateText:"Альтернативный текст",bold:"Полужирный текст",both:"Редактор с предпросмотром",check:"Список задач",close:"Закрыть",code:"Блок кода","code-theme":"Тема отображения блока кода",column:"Количество столбцов",comment:"Комментарий",confirm:"Подтвердить","content-theme":"Тема отображения контента",copied:"Скопировано",copy:"Копировать","delete-column":"Удалить столбец","delete-row":"Удалить строку",devtools:"Граф документа",down:"Переместить вниз",downloadTip:"Браузер не поддерживает функции загрузки",edit:"Редактирование","edit-mode":"Переключить режим редактирования",emoji:"Смайлы",export:"Экспорт",fileTypeError:"Ошибка типа файла",footnoteRef:"Сноска",fullscreen:"Переключиться на полный экран",generate:"Генерация",headings:"Заголовки",help:"Помощь",imageURL:"Ссылка на картинку",indent:"Отступ",info:"Информация о редакторе","inline-code":"Встроенный код ","insert-after":"Вставить линию после этой строки","insert-before":"Вставить линию перед этой строкой",insertColumnLeft:"Вставить столбец слева",insertColumnRight:"Вставить столбец справа",insertRowAbove:"Вставить строку сверху",insertRowBelow:"Вставить строку снизу",instantRendering:"Мгновенный рендеринг",italic:"Курсив",language:"Синтаксис",line:"Линия",link:"Ссылка",linkRef:"Вставить ссылку",list:"Список",more:"Дополнительно",nameEmpty:"Имя пустое","ordered-list":"Упорядоченный список",outdent:"Выступ",outline:"Содержание",over:"Над",performanceTip:"Предварительный просмотр в реальном времени требует ${x}мс, вы можете закрыть его",preview:"Предпросмотр",quote:"Цитата",record:"Начать запись/Завершить запись","record-tip":"Устройство не поддерживает запись",recording:"Запись...",redo:"Вернуть",remove:"Удалить",row:"Количество строк",spin:"Прокрутка",splitView:"Разделенный просмотр",strike:"Зачеркнутый текст",table:"Таблица",textIsNotEmpty:"Текст (непустой)",title:"Заголовок",tooltipText:"Текст всплывающей подсказки",undo:"Отменить",up:"Переместить вверх",update:"Обновить",upload:"Загрузить изображение или файл",uploadError:"Ошибка загрузки",uploading:"Загрузка...",wysiwyg:"Редактор WYSIWYG"},zh_CN:{alignCenter:"居中",alignLeft:"居左",alignRight:"居右",alternateText:"替代文本",bold:"粗体",both:"编辑 & 预览",check:"任务列表",close:"关闭",code:"代码块","code-theme":"代码块主题预览",column:"列",comment:"评论",confirm:"确定","content-theme":"内容主题预览",copied:"已复制",copy:"复制","delete-column":"删除列","delete-row":"删除行",devtools:"开发者工具",down:"下",downloadTip:"该浏览器不支持下载功能",edit:"编辑","edit-mode":"切换编辑模式",emoji:"表情",export:"导出",fileTypeError:"文件类型不允许上传",footnoteRef:"脚注标识",fullscreen:"全屏切换",generate:"生成中",headings:"标题",help:"帮助",imageURL:"图片地址",indent:"列表缩进",info:"关于","inline-code":"行内代码","insert-after":"末尾插入行","insert-before":"起始插入行",insertColumnLeft:"在左边插入一列",insertColumnRight:"在右边插入一列",insertRowAbove:"在上方插入一行",insertRowBelow:"在下方插入一行",instantRendering:"即时渲染",italic:"斜体",language:"语言",line:"分隔线",link:"链接",linkRef:"引用标识",list:"无序列表",more:"更多",nameEmpty:"文件名不能为空","ordered-list":"有序列表",outdent:"列表反向缩进",outline:"大纲",over:"超过",performanceTip:"实时预览需 ${x}ms，可点击编辑 & 预览按钮进行关闭",preview:"预览",quote:"引用",record:"开始录音/结束录音","record-tip":"该设备不支持录音功能",recording:"录音中...",redo:"重做",remove:"删除",row:"行",spin:"旋转",splitView:"分屏预览",strike:"删除线",table:"表格",textIsNotEmpty:"文本（不能为空）",title:"标题",tooltipText:"提示文本",undo:"撤销",up:"上",update:"更新",upload:"上传图片或文件",uploadError:"上传错误",uploading:"上传中...",wysiwyg:"所见即所得"},zh_TW:{alignCenter:"置中",alignLeft:"置左",alignRight:"置右",alternateText:"替代文字",bold:"粗體",both:"編輯 & 預覽",check:"任務列表",close:"關閉",code:"代碼塊","code-theme":"代碼塊主題預覽",column:"欄",comment:"評論",confirm:"確定","content-theme":"內容主題預覽",copied:"已複製",copy:"複製","delete-column":"刪除欄","delete-row":"刪除列",devtools:"開發者工具",down:"下",downloadTip:"該瀏覽器不支持下載功能",edit:"編輯","edit-mode":"切換編輯模式",emoji:"表情",export:"匯出",fileTypeError:"檔案類型不允許上傳",footnoteRef:"腳註參考",fullscreen:"全螢幕切換",generate:"生成中",headings:"標題",help:"幫助",imageURL:"圖片位址",indent:"列表縮排",info:"關於","inline-code":"行內代碼","insert-after":"末尾插入列","insert-before":"起始插入列",insertColumnLeft:"在左邊插入一欄",insertColumnRight:"在右邊插入一欄",insertRowAbove:"在上方插入一行",insertRowBelow:"在下方插入一行",instantRendering:"即時渲染",italic:"斜體",language:"語言",line:"分隔線",link:"連結",linkRef:"連結參考",list:"無序列表",more:"更多",nameEmpty:"文件名不能為空","ordered-list":"有序列表",outdent:"列表反向縮排",outline:"大綱",over:"超過",performanceTip:"即時預覽需 ${x}ms，可點擊編輯 & 預覽按鈕進行關閉",preview:"預覽",quote:"引用",record:"開始錄音/結束錄音","record-tip":"該設備不支持錄音功能",recording:"錄音中...",redo:"重做",remove:"刪除",row:"列",spin:"旋轉",splitView:"分割預覽",strike:"刪除縣",table:"表格",textIsNotEmpty:"文字（不能為空）",title:"標題",tooltipText:"提示文字",undo:"撤銷",up:"上",update:"更新",upload:"上傳圖片或文件",uploadError:"上傳錯誤",uploading:"上傳中...",wysiwyg:"所見即所得"}}},369:(e,t,n)=>{n.d(t,{Q:()=>o});var r=n(260),i=n(228),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=e.querySelectorAll(".language-abc");n.length>0&&(0,i.G)(t+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript").then((function(){n.forEach((function(e){e.parentElement.classList.contains("vditor-wysiwyg__pre")||e.parentElement.classList.contains("vditor-ir__marker--pre")||"true"!==e.getAttribute("data-processed")&&(ABCJS.renderAbc(e,e.textContent.trim()),e.style.overflowX="auto",e.setAttribute("data-processed","true"))}))}))}},726:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(260),i=n(228),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=e.querySelectorAll(".language-echarts");o.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=e.innerText.trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var r=JSON.parse(t);echarts.init(e,"dark"===n?"dark":void 0).setOption(r),e.setAttribute("data-processed","true")}catch(i){e.className="vditor-reset--error",e.innerHTML="echarts render error: <br>"+i}}}))}))}},23:(e,t,n)=>{n.d(t,{O:()=>o});var r=n(577),i=n(769),o=function(e,t){void 0===t&&(t="zh_CN"),e.querySelectorAll("pre > code").forEach((function(n,o){if(!n.parentElement.classList.contains("vditor-wysiwyg__pre")&&!n.parentElement.classList.contains("vditor-ir__marker--pre")&&!(n.classList.contains("language-mermaid")||n.classList.contains("language-flowchart")||n.classList.contains("language-echarts")||n.classList.contains("language-mindmap")||n.classList.contains("language-plantuml")||n.classList.contains("language-abc")||n.classList.contains("language-graphviz")||n.classList.contains("language-math")||n.style.maxHeight.indexOf("px")>-1||e.classList.contains("vditor-preview")&&o>5)){var a=n.innerText;if(n.classList.contains("highlight-chroma")){var l=document.createElement("code");l.innerHTML=n.innerHTML,l.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),a=l.innerText}var s=document.createElement("div");s.className="vditor-copy",s.innerHTML='<span aria-label="'+r.a[t].copy+"\"\nonmouseover=\"this.setAttribute('aria-label', '"+r.a[t].copy+"')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '"+r.a[t].copied+'\')"><svg><use xlink:href="#vditor-icon-copy"></use></svg></span>';var c=document.createElement("textarea");c.value=(0,i.X)(a),s.insertAdjacentElement("afterbegin",c),n.before(s),n.style.maxHeight=window.outerHeight-40+"px"}}))}},383:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(260),i=n(228),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=e.querySelectorAll(".language-flowchart");0!==n.length&&(0,i.G)(t+"/dist/js/flowchart.js/flowchart.min.js","vditorFlowchartScript").then((function(){n.forEach((function(e){if("true"!==e.getAttribute("data-processed")){var t=flowchart.parse(e.textContent);e.innerHTML="",t.drawSVG(e),e.setAttribute("data-processed","true")}}))}))}},890:(e,t,n)=>{n.d(t,{v:()=>o});var r=n(260),i=n(228),o=function(e,t){void 0===t&&(t=r.g.CDN);var n=e.querySelectorAll(".language-graphviz");0!==n.length&&(0,i.G)(t+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&"true"!==e.getAttribute("data-processed")&&""!==e.textContent.trim()){try{var t=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),n=(window.URL||window.webkitURL).createObjectURL(t),r=new Worker(n);new Viz({worker:r}).renderSVGElement(e.textContent).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error: <br>"+t,e.className="vditor-reset--error"}))}catch(i){}e.setAttribute("data-processed","true")}}))}))}},93:(e,t,n)=>{n.d(t,{s:()=>a});var r=n(260),i=n(228),o=n(946),a=function(e,t,n){void 0===t&&(t=document),void 0===n&&(n=r.g.CDN);var a=e.style;r.g.CODE_THEME.includes(a)||(a="github");var l=document.getElementById("vditorHljsStyle"),s=n+"/dist/js/highlight.js/styles/"+a+".css";l&&l.href!==s&&l.remove(),(0,o.c)(n+"/dist/js/highlight.js/styles/"+a+".css","vditorHljsStyle"),!1!==e.enable&&0!==t.querySelectorAll("pre > code").length&&(0,i.G)(n+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript").then((function(){t.querySelectorAll("pre > code").forEach((function(t){if(!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(hljs.highlightElement(t),e.lineNumber)){t.classList.add("vditor-linenumber");var n=t.querySelector(".vditor-linenumber__temp");n||((n=document.createElement("div")).className="vditor-linenumber__temp",t.insertAdjacentElement("beforeend",n));var r=getComputedStyle(t).whiteSpace,i=!1;"pre-wrap"!==r&&"pre-line"!==r||(i=!0);var o="",a=t.textContent.split(/\r\n|\r|\n/g);a.pop(),a.map((function(e){var t="";i&&(n.textContent=e||"\n",t=' style="height:'+n.getBoundingClientRect().height+'px"'),o+="<span"+t+"></span>"})),n.style.display="none",o='<span class="vditor-linenumber__rows">'+o+"</span>",t.insertAdjacentHTML("beforeend",o)}}))}))}},323:(e,t,n)=>{n.d(t,{H:()=>l});var r=n(260),i=n(228),o=n(946),a=n(769),l=function(e,t){var n=e.querySelectorAll(".language-math");if(0!==n.length){var l={cdn:r.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(t&&t.math&&(t.math=Object.assign({},l.math,t.math)),"KaTeX"===(t=Object.assign({},l,t)).math.engine)(0,o.c)(t.cdn+"/dist/js/katex/katex.min.css","vditorKatexStyle"),(0,i.G)(t.cdn+"/dist/js/katex/katex.min.js","vditorKatexScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&!e.getAttribute("data-math")){var t=(0,a.X)(e.textContent);e.setAttribute("data-math",t);try{e.innerHTML=katex.renderToString(t,{displayMode:"DIV"===e.tagName,output:"html"})}catch(n){e.innerHTML=n.message,e.className="language-math vditor-reset--error"}e.addEventListener("copy",(function(e){e.stopPropagation(),e.preventDefault();var t=e.currentTarget.closest(".language-math");e.clipboardData.setData("text/html",t.innerHTML),e.clipboardData.setData("text/plain",t.getAttribute("data-math"))}))}}))}));else if("MathJax"===t.math.engine){window.MathJax||(window.MathJax={loader:{paths:{mathjax:t.cdn+"/dist/js/mathjax"}},startup:{typeset:!1},tex:{macros:t.math.macros}}),(0,i.J)(t.cdn+"/dist/js/mathjax/tex-svg-full.js","protyleMathJaxScript");var s=function(e,t){var n=(0,a.X)(e.textContent).trim(),r=window.MathJax.getMetricsFor(e);r.display="DIV"===e.tagName,window.MathJax.tex2svgPromise(n,r).then((function(r){e.innerHTML="",e.setAttribute("data-math",n),e.append(r),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var i=r.querySelector('[data-mml-node="merror"]');i&&""!==i.textContent.trim()&&(e.innerHTML=i.textContent.trim(),e.className="vditor-reset--error"),t&&t()}))};window.MathJax.startup.promise.then((function(){for(var e=[],t=function(t){var r=n[t];r.parentElement.classList.contains("vditor-wysiwyg__pre")||r.parentElement.classList.contains("vditor-ir__marker--pre")||r.getAttribute("data-math")||!(0,a.X)(r.textContent).trim()||e.push((function(e){t===n.length-1?s(r):s(r,e)}))},r=0;r<n.length;r++)t(r);!function(e){if(0!==e.length){var t=0,n=e[e.length-1],r=function(){var i=e[t++];i===n?i():i(r)};r()}}(e)}))}}}},207:(e,t,n)=>{n.d(t,{Y:()=>r});var r=function(e){e&&e.querySelectorAll("a").forEach((function(e){var t=e.getAttribute("href");t&&(t.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<video controls="controls" src="'+t+'"></video>'),e.remove()}(e,t):t.match(/^.+.(mp3|wav|flac)$/)?function(e,t){e.insertAdjacentHTML("afterend",'<audio controls="controls" src="'+t+'"></audio>'),e.remove()}(e,t):function(e,t){var n=t.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),r=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),i=t.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),o=t.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),a=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),l=t.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),s=t.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),c=t.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);n&&11===n[1].length?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'+n[1]+(n[2]?"?start="+n[2]:"")+'"></iframe>'),e.remove()):r&&r[1]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'+r[1]+'"></iframe>'),e.remove()):i&&i[1]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='+i[1]+'"></iframe>'),e.remove()):o&&o[1]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="//coub.com/embed/'+o[1]+'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>'),e.remove()):a&&a[0]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.facebook.com/plugins/video.php?href='+encodeURIComponent(a[0])+'"></iframe>'),e.remove()):l&&l[2]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="https://www.dailymotion.com/embed/video/'+l[2]+'"></iframe>'),e.remove()):s&&s[1]?(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video"\n src="//player.bilibili.com/player.html?bvid='+s[1]+'"></iframe>'),e.remove()):c&&c[1]&&(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'+c[1]+'"></iframe>'),e.remove())}(e,t))}))}},765:(e,t,n)=>{n.d(t,{i:()=>o});var r=n(260),i=n(228),o=function(e,t,n){void 0===t&&(t=r.g.CDN);var o=e.querySelectorAll(".language-mermaid");0!==o.length&&(0,i.G)(t+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then((function(){var e={altFontFamily:"sans-serif",flowchart:{htmlLabels:!0,useMaxWidth:!0},fontFamily:"sans-serif",gantt:{leftPadding:75,rightPadding:20},securityLevel:"loose",sequence:{boxMargin:8,diagramMarginX:8,diagramMarginY:8,useMaxWidth:!0},startOnLoad:!1};"dark"===n&&(e.theme="dark",e.themeVariables={activationBkgColor:"hsl(180, 1.5873015873%, 28.3529411765%)",activationBorderColor:"#81B1DB",activeTaskBkgColor:"#81B1DB",activeTaskBorderColor:"#ffffff",actorBkg:"#1f2020",actorBorder:"#81B1DB",actorLineColor:"lightgrey",actorTextColor:"lightgrey",altBackground:"hsl(0, 0%, 40%)",altSectionBkgColor:"#333",arrowheadColor:"lightgrey",background:"#333",border1:"#81B1DB",border2:"rgba(255, 255, 255, 0.25)",classText:"#e0dfdf",clusterBkg:"hsl(180, 1.5873015873%, 28.3529411765%)",clusterBorder:"rgba(255, 255, 255, 0.25)",critBkgColor:"#E83737",critBorderColor:"#E83737",darkTextColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",defaultLinkColor:"lightgrey",doneTaskBkgColor:"lightgrey",doneTaskBorderColor:"grey",edgeLabelBackground:"hsl(0, 0%, 34.4117647059%)",errorBkgColor:"#a44141",errorTextColor:"#ddd",fillType0:"#1f2020",fillType1:"hsl(180, 1.5873015873%, 28.3529411765%)",fillType2:"hsl(244, 1.5873015873%, 12.3529411765%)",fillType3:"hsl(244, 1.5873015873%, 28.3529411765%)",fillType4:"hsl(116, 1.5873015873%, 12.3529411765%)",fillType5:"hsl(116, 1.5873015873%, 28.3529411765%)",fillType6:"hsl(308, 1.5873015873%, 12.3529411765%)",fillType7:"hsl(308, 1.5873015873%, 28.3529411765%)",fontFamily:'"trebuchet ms", verdana, arial',fontSize:"16px",gridColor:"lightgrey",labelBackground:"#181818",labelBoxBkgColor:"#1f2020",labelBoxBorderColor:"#81B1DB",labelColor:"#ccc",labelTextColor:"lightgrey",lineColor:"lightgrey",loopTextColor:"lightgrey",mainBkg:"#1f2020",mainContrastColor:"lightgrey",nodeBkg:"#1f2020",nodeBorder:"#81B1DB",noteBkgColor:"#fff5ad",noteBorderColor:"rgba(255, 255, 255, 0.25)",noteTextColor:"#1f2020",primaryBorderColor:"hsl(180, 0%, 2.3529411765%)",primaryColor:"#1f2020",primaryTextColor:"#e0dfdf",secondBkg:"hsl(180, 1.5873015873%, 28.3529411765%)",secondaryBorderColor:"hsl(180, 0%, 18.3529411765%)",secondaryColor:"hsl(180, 1.5873015873%, 28.3529411765%)",secondaryTextColor:"rgb(183.8476190475, 181.5523809523, 181.5523809523)",sectionBkgColor:"hsl(52.9411764706, 28.813559322%, 58.431372549%)",sectionBkgColor2:"#EAE8D9",sequenceNumberColor:"black",signalColor:"lightgrey",signalTextColor:"lightgrey",taskBkgColor:"hsl(180, 1.5873015873%, 35.3529411765%)",taskBorderColor:"#ffffff",taskTextClickableColor:"#003163",taskTextColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",taskTextDarkColor:"hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",taskTextLightColor:"lightgrey",taskTextOutsideColor:"lightgrey",tertiaryBorderColor:"hsl(20, 0%, 2.3529411765%)",tertiaryColor:"hsl(20, 1.5873015873%, 12.3529411765%)",tertiaryTextColor:"rgb(222.9999999999, 223.6666666666, 223.9999999999)",textColor:"#ccc",titleColor:"#F9FFFE",todayLineColor:"#DB5757"}),mermaid.initialize(e),o.forEach((function(e){"true"!==e.getAttribute("data-processed")&&""!==e.textContent.trim()&&(mermaid.init(void 0,e),e.setAttribute("data-processed","true"))}))}))}},894:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(260),i=n(228),o=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var o=e.querySelectorAll(".language-mindmap");o.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){o.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=e.getAttribute("data-code");if(t)try{if("true"===e.getAttribute("data-processed"))return;echarts.init(e,"dark"===n?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(t))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(e,t){var n;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.children)?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),e.setAttribute("data-processed","true")}catch(r){e.className="vditor-reset--error",e.innerHTML="mindmap render error: <br>"+r}}}))}))}},198:(e,t,n)=>{n.d(t,{k:()=>o});var r=n(615),i=n(323),o=function(e,t,n){var o="",a=[];if(Array.from(e.children).forEach((function(e,t){if((0,r.W)(e)){if(n){var i=e.id.lastIndexOf("_");e.id=e.id.substring(0,-1===i?void 0:i)+"_"+t}a.push(e.id),o+=e.outerHTML.replace("<wbr>","")}})),""===o)return t.innerHTML="","";var l=document.createElement("div");if(n)n.lute.SetToC(!0),"wysiwyg"!==n.currentMode||n.preview.element.contains(e)?"ir"!==n.currentMode||n.preview.element.contains(e)?l.innerHTML=n.lute.HTML2VditorDOM("<p>[ToC]</p>"+o):l.innerHTML=n.lute.SpinVditorIRDOM("<p>[ToC]</p>"+o):l.innerHTML=n.lute.SpinVditorDOM("<p>[ToC]</p>"+o),n.lute.SetToC(n.options.preview.markdown.toc);else{t.classList.add("vditor-outline");var s=Lute.New();s.SetToC(!0),l.innerHTML=s.HTML2VditorDOM("<p>[ToC]</p>"+o)}var c=l.firstElementChild.querySelectorAll("li > span[data-target-id]");return c.forEach((function(e,t){e.nextElementSibling&&"UL"===e.nextElementSibling.tagName?e.innerHTML="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg><span>"+e.innerHTML+"</span>":e.innerHTML="<svg></svg><span>"+e.innerHTML+"</span>",e.setAttribute("data-target-id",a[t])})),o=l.firstElementChild.innerHTML,0===c.length?(t.innerHTML="",o):(t.innerHTML=o,n&&(0,i.H)(t,{cdn:n.options.cdn,math:n.options.preview.math}),t.firstElementChild.addEventListener("click",(function(r){for(var i=r.target;i&&!i.isEqualNode(t);){if(i.classList.contains("vditor-outline__action")){i.classList.contains("vditor-outline__action--close")?(i.classList.remove("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:block")):(i.classList.add("vditor-outline__action--close"),i.parentElement.nextElementSibling.setAttribute("style","display:none")),r.preventDefault(),r.stopPropagation();break}if(i.getAttribute("data-target-id")){r.preventDefault(),r.stopPropagation();var o=document.getElementById(i.getAttribute("data-target-id"));if(!o)return;if(n)if("auto"===n.options.height){var a=o.offsetTop+n.element.offsetTop;n.options.toolbarConfig.pin||(a+=n.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,a)}else n.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,n.element.offsetTop),n.preview.element.contains(e)?e.parentElement.scrollTop=o.offsetTop:e.scrollTop=o.offsetTop;else window.scrollTo(window.scrollX,o.offsetTop);break}i=i.parentElement}})),o)}},583:(e,t,n)=>{n.d(t,{B:()=>o});var r=n(260),i=n(228),o=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=e.querySelectorAll(".language-plantuml");0!==n.length&&(0,i.G)(t+"/dist/js/plantuml/plantuml-encoder.min.js","vditorPlantumlScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=e.textContent.trim();if(t)try{e.innerHTML='<img src="http://www.plantuml.com/plantuml/svg/~1'+plantumlEncoder.encode(t)+'">'}catch(n){e.className="vditor-reset--error",e.innerHTML="plantuml render error: <br>"+n}}}))}))}},792:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){var t=Lute.New();return t.PutEmojis(e.emojis),t.SetEmojiSite(e.emojiSite),t.SetHeadingAnchor(e.headingAnchor),t.SetInlineMathAllowDigitAfterOpenMarker(e.inlineMathDigit),t.SetAutoSpace(e.autoSpace),t.SetToC(e.toc),t.SetFootnotes(e.footnotes),t.SetFixTermTypo(e.fixTermTypo),t.SetVditorCodeBlockPreview(e.codeBlockPreview),t.SetVditorMathBlockPreview(e.mathBlockPreview),t.SetSanitize(e.sanitize),t.SetChineseParagraphBeginningSpace(e.paragraphBeginningSpace),t.SetRenderListStyle(e.listStyle),t.SetLinkBase(e.linkBase),t.SetLinkPrefix(e.linkPrefix),t.SetMark(e.mark),e.lazyLoadImage&&t.SetImageLazyLoading(e.lazyLoadImage),t}},264:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(577),i=function(e,t,n){void 0===t&&(t="zh_CN"),void 0===n&&(n="classic");var i=e.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'+("dark"===n?" vditor--dark":"")+'">\n    <div class="vditor-img__bar">\n      <span class="vditor-img__btn" data-deg="0">\n        <svg><use xlink:href="#vditor-icon-redo"></use></svg>\n        '+r.a[t].spin+"\n      </span>\n      <span class=\"vditor-img__btn\"  onclick=\"this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n        X &nbsp;"+r.a[t].close+'\n      </span>\n    </div>\n    <div class="vditor-img__img" onclick="this.parentElement.outerHTML = \'\';document.body.style.overflow = \'\'">\n      <img style="width: '+e.width+"px;height:"+e.height+"px;transform: translate3d("+i.left+"px, "+(i.top-36)+'px, 0)" src="'+e.getAttribute("src")+'">\n    </div>\n</div>'),document.body.style.overflow="hidden";var o=document.querySelector(".vditor-img img"),a="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+Math.max(0,window.innerHeight-36-e.naturalHeight)/2+"px, 0)";setTimeout((function(){o.setAttribute("style","transition: transform .3s ease-in-out;transform: "+a),setTimeout((function(){o.parentElement.scrollTo((o.parentElement.scrollWidth-o.parentElement.clientWidth)/2,(o.parentElement.scrollHeight-o.parentElement.clientHeight)/2)}),400)}));var l=document.querySelector(".vditor-img__btn");l.addEventListener("click",(function(){var t=parseInt(l.getAttribute("data-deg"),10)+90;t/90%2==1&&e.naturalWidth>o.parentElement.clientHeight?o.style.transform="translate3d("+Math.max(0,window.innerWidth-e.naturalWidth)/2+"px, "+(e.naturalWidth/2-e.naturalHeight/2)+"px, 0) rotateZ("+t+"deg)":o.style.transform=a+" rotateZ("+t+"deg)",l.setAttribute("data-deg",t.toString()),setTimeout((function(){o.parentElement.scrollTo((o.parentElement.scrollWidth-o.parentElement.clientWidth)/2,(o.parentElement.scrollHeight-o.parentElement.clientHeight)/2)}),400)}))}},968:(e,t,n)=>{n.d(t,{Y:()=>o});var r=n(260),i=n(946),o=function(e,t){void 0===t&&(t=r.g.CDN),r.g.CODE_THEME.includes(e)||(e="github");var n=document.getElementById("vditorHljsStyle"),o=t+"/dist/js/highlight.js/styles/"+e+".css";n?n.href!==o&&(n.remove(),(0,i.c)(o,"vditorHljsStyle")):(0,i.c)(o,"vditorHljsStyle")}},958:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(946),i=function(e,t){if(e&&t){var n=document.getElementById("vditorContentTheme"),i=t+"/"+e+".css";n?n.href!==i&&(n.remove(),(0,r.c)(i,"vditorContentTheme")):(0,r.c)(i,"vditorContentTheme")}}},228:(e,t,n)=>{n.d(t,{J:()=>r,G:()=>i});var r=function(e,t){if(document.getElementById(t))return!1;var n=new XMLHttpRequest;n.open("GET",e,!1),n.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),n.send("");var r=document.createElement("script");r.type="text/javascript",r.text=n.responseText,r.id=t,document.head.appendChild(r)},i=function(e,t){return new Promise((function(n,r){if(document.getElementById(t))return n(),!1;var i=document.createElement("script");i.src=e,i.async=!0,document.head.appendChild(i),i.onload=function(){if(document.getElementById(t))return i.remove(),n(),!1;i.id=t,n()}}))}},946:(e,t,n)=>{n.d(t,{c:()=>r});var r=function(e,t){if(!document.getElementById(t)){var n=document.createElement("link");n.id=t,n.rel="stylesheet",n.type="text/css",n.href=e,document.getElementsByTagName("head")[0].appendChild(n)}}},769:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){return e.replace(/\u00a0/g," ")}},931:(e,t,n)=>{n.d(t,{G6:()=>r,vU:()=>i,pK:()=>o,Le:()=>a,yl:()=>l,ns:()=>s,i7:()=>c});var r=function(){return navigator.userAgent.indexOf("Safari")>-1&&-1===navigator.userAgent.indexOf("Chrome")},i=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},o=function(){try{return"undefined"!=typeof localStorage}catch(e){return!1}},a=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},l=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!(!e.metaKey||e.ctrlKey):!(e.metaKey||!e.ctrlKey)},s=function(e){return/Mac/.test(navigator.platform)||"iPhone"===navigator.platform?e.indexOf("⇧")>-1&&i()&&(e=e.replace(";",":").replace("=","+").replace("-","_")):(e=(e=e.startsWith("⌘")?e.replace("⌘","⌘+"):e.startsWith("⌥")&&"⌘"!==e.substr(1,1)?e.replace("⌥","⌥+"):e.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+")).replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt")).indexOf("Shift")>-1&&(e=e.replace(";",":").replace("=","+").replace("-","_")),e},c=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},713:(e,t,n)=>{n.d(t,{JQ:()=>i,E2:()=>o,O9:()=>a,a1:()=>l,F9:()=>s,lG:()=>c,fb:()=>d,DX:()=>u});var r=n(615),i=function(e,t){for(var n=d(e,t),r=!1,i=!1;n&&!n.classList.contains("vditor-reset")&&!i;)(r=d(n.parentElement,t))?n=r:i=!0;return n||!1},o=function(e,t){for(var n=(0,r.S)(e,t),i=!1,o=!1;n&&!n.classList.contains("vditor-reset")&&!o;)(i=(0,r.S)(n.parentElement,t))?n=i:o=!0;return n||!1},a=function(e){var t=o(e,"UL"),n=o(e,"OL"),r=t;return n&&(!t||t&&n.contains(t))&&(r=n),r},l=function(e,t,n){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var r=e,i=!1;r&&!i&&!r.classList.contains("vditor-reset");)r.getAttribute(t)===n?i=!0:r=r.parentElement;return i&&r},s=function(e){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);var t=e,n=!1,r=l(e,"data-block","0");if(r)return r;for(;t&&!n&&!t.classList.contains("vditor-reset");)"H1"===t.tagName||"H2"===t.tagName||"H3"===t.tagName||"H4"===t.tagName||"H5"===t.tagName||"H6"===t.tagName||"P"===t.tagName||"BLOCKQUOTE"===t.tagName||"OL"===t.tagName||"UL"===t.tagName?n=!0:t=t.parentElement;return n&&t},c=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.nodeName===t?r=!0:n=n.parentElement;return r&&n},d=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)n.classList.contains(t)?r=!0:n=n.parentElement;return r&&n},u=function(e){for(;e&&e.lastChild;)e=e.lastChild;return e}},615:(e,t,n)=>{n.d(t,{S:()=>r,W:()=>i});var r=function(e,t){if(!e)return!1;3===e.nodeType&&(e=e.parentElement);for(var n=e,r=!1;n&&!r&&!n.classList.contains("vditor-reset");)0===n.nodeName.indexOf(t)?r=!0:n=n.parentElement;return r&&n},i=function(e){var t=r(e,"H");return!(!t||2!==t.tagName.length||"HR"===t.tagName)&&t}},224:(e,t,n)=>{n.d(t,{T:()=>r});var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n={},i=function(e){for(var t in e)e.hasOwnProperty(t)&&("[object Object]"===Object.prototype.toString.call(e[t])?n[t]=r(n[t],e[t]):n[t]=e[t])},o=0;o<e.length;o++)i(e[o]);return n}},187:(e,t,n)=>{n.d(t,{zh:()=>a,Ny:()=>l,Gb:()=>s,Hc:()=>c,im:()=>d,$j:()=>u,ib:()=>p,oC:()=>m});var r=n(260),i=n(931),o=n(713),a=function(e){var t,n=e[e.currentMode].element;return getSelection().rangeCount>0&&(t=getSelection().getRangeAt(0),n.isEqualNode(t.startContainer)||n.contains(t.startContainer))?t:e[e.currentMode].range?e[e.currentMode].range:(n.focus(),(t=n.ownerDocument.createRange()).setStart(n,0),t.collapse(!0),t)},l=function(e){var t=window.getSelection().getRangeAt(0);if(!e.contains(t.startContainer)&&!(0,o.fb)(t.startContainer,"vditor-panel--none"))return{left:0,top:0};var n,r=e.parentElement.getBoundingClientRect();if(0===t.getClientRects().length)if(3===t.startContainer.nodeType){var i=t.startContainer.parentElement;if(!(i&&i.getClientRects().length>0))return{left:0,top:0};n=i.getClientRects()[0]}else{var a=t.startContainer.children;if(a[t.startOffset]&&a[t.startOffset].getClientRects().length>0)n=a[t.startOffset].getClientRects()[0];else if(t.startContainer.childNodes.length>0){var l=t.cloneRange();t.selectNode(t.startContainer.childNodes[Math.max(0,t.startOffset-1)]),n=t.getClientRects()[0],t.setEnd(l.endContainer,l.endOffset),t.setStart(l.startContainer,l.startOffset)}else n=t.startContainer.getClientRects()[0];if(!n){for(var s=t.startContainer.childNodes[t.startOffset];!s.getClientRects||s.getClientRects&&0===s.getClientRects().length;)s=s.parentElement;n=s.getClientRects()[0]}}else n=t.getClientRects()[0];return{left:n.left-r.left,top:n.top-r.top}},s=function(e,t){if(!t){if(0===getSelection().rangeCount)return!1;t=getSelection().getRangeAt(0)}var n=t.commonAncestorContainer;return e.isEqualNode(n)||e.contains(n)},c=function(e){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)},d=function(e,t,n){var r={end:0,start:0};if(!n){if(0===getSelection().rangeCount)return r;n=window.getSelection().getRangeAt(0)}if(s(t,n)){var i=n.cloneRange();e.childNodes[0]&&e.childNodes[0].childNodes[0]?i.setStart(e.childNodes[0].childNodes[0],0):i.selectNodeContents(e),i.setEnd(n.startContainer,n.startOffset),r.start=i.toString().length,r.end=r.start+n.toString().length}return r},u=function(e,t,n){var r=0,i=0,o=n.childNodes[i],a=!1,l=!1;e=Math.max(0,e),t=Math.max(0,t);var s=n.ownerDocument.createRange();for(s.setStart(o||n,0),s.collapse(!0);!l&&o;){var d=r+o.textContent.length;if(!a&&e>=r&&e<=d&&(0===e?s.setStart(o,0):3===o.childNodes[0].nodeType?s.setStart(o.childNodes[0],e-r):o.nextSibling?s.setStartBefore(o.nextSibling):s.setStartAfter(o),a=!0,e===t)){l=!0;break}a&&t>=r&&t<=d&&(0===t?s.setEnd(o,0):3===o.childNodes[0].nodeType?s.setEnd(o.childNodes[0],t-r):o.nextSibling?s.setEndBefore(o.nextSibling):s.setEndAfter(o),l=!0),r=d,o=n.childNodes[++i]}return!l&&n.childNodes[i-1]&&s.setStartBefore(n.childNodes[i-1]),c(s),s},p=function(e,t){var n=e.querySelector("wbr");if(n){if(n.previousElementSibling)if(n.previousElementSibling.isSameNode(n.previousSibling)){if(n.previousElementSibling.lastChild)return t.setStartBefore(n),t.collapse(!0),c(t),!(0,i.i7)()||"EM"!==n.previousElementSibling.tagName&&"STRONG"!==n.previousElementSibling.tagName&&"S"!==n.previousElementSibling.tagName||(t.insertNode(document.createTextNode(r.g.ZWSP)),t.collapse(!1)),void n.remove();t.setStartAfter(n.previousElementSibling)}else t.setStart(n.previousSibling,n.previousSibling.textContent.length);else n.previousSibling?t.setStart(n.previousSibling,n.previousSibling.textContent.length):n.nextSibling?3===n.nextSibling.nodeType?t.setStart(n.nextSibling,0):t.setStartBefore(n.nextSibling):t.setStart(n.parentElement,0);t.collapse(!0),n.remove(),c(t)}},m=function(e,t){var n=document.createElement("div");n.innerHTML=e;var r=n.querySelectorAll("p");1===r.length&&!r[0].previousSibling&&!r[0].nextSibling&&t[t.currentMode].element.children.length>0&&"P"===n.firstElementChild.tagName&&(e=r[0].innerHTML.trim());var i=document.createElement("div");i.innerHTML=e;var l=a(t);if(""!==l.toString()&&(t[t.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),i.firstElementChild&&"0"===i.firstElementChild.getAttribute("data-block")){i.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var s=(0,o.F9)(l.startContainer);s?s.insertAdjacentHTML("afterend",i.innerHTML):t[t.currentMode].element.insertAdjacentHTML("beforeend",i.innerHTML),p(t[t.currentMode].element,l)}else{var d=document.createElement("template");d.innerHTML=e,l.insertNode(d.content.cloneNode(!0)),l.collapse(!1),c(l)}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r={};return(()=>{n.d(r,{default:()=>qn}),n(157);var e,t,i=n(857),o=n(260),a=n(769),l=function(e){return"sv"===e.currentMode?(0,a.X)((e.sv.element.textContent+"\n").replace(/\n\n$/,"\n")):"wysiwyg"===e.currentMode?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):"ir"===e.currentMode?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},s=n(228),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(e){var t=this;"block"===e.devtools.element.style.display&&(0,s.G)(e.options.cdn+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){t.ASTChart||(t.ASTChart=echarts.init(e.devtools.element.lastElementChild));try{t.element.lastElementChild.style.display="block",t.element.firstElementChild.innerHTML="",t.ASTChart.setOption({series:[{data:JSON.parse(e.lute.RenderEChartsJSON(l(e))),initialTreeDepth:-1,label:{align:"left",backgroundColor:"rgba(68, 77, 86, .68)",borderRadius:3,color:"#d1d5da",fontSize:12,lineHeight:12,offset:[9,12],padding:[2,4,2,4],position:"top",verticalAlign:"middle"},lineStyle:{color:"#4285f4",type:"curve",width:1},orient:"vertical",roam:!0,type:"tree"}],toolbox:{bottom:25,emphasis:{iconStyle:{color:"#4285f4"}},feature:{restore:{show:!0},saveAsImage:{show:!0}},right:15,show:!0}}),t.ASTChart.resize()}catch(n){t.element.lastElementChild.style.display="none",t.element.firstElementChild.innerHTML=n}}))},e}(),d=n(931),u=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&n.classList.contains("vditor-menu--current")&&n.classList.remove("vditor-menu--current")}}))},p=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&!n.classList.contains("vditor-menu--current")&&n.classList.add("vditor-menu--current")}}))},m=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&n.classList.contains(o.g.CLASS_MENU_DISABLED)&&n.classList.remove(o.g.CLASS_MENU_DISABLED)}}))},f=function(e,t){t.forEach((function(t){if(e[t]){var n=e[t].children[0];n&&!n.classList.contains(o.g.CLASS_MENU_DISABLED)&&n.classList.add(o.g.CLASS_MENU_DISABLED)}}))},h=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="none")}))},v=function(e,t){t.forEach((function(t){e[t]&&e[t]&&(e[t].style.display="block")}))},g=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach((function(e){n&&e.isEqualNode(n)||(e.style.display="none")})),e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.lastElementChild.style.display="none")),t.includes("hint")&&(e.hint.element.style.display="none"),e.wysiwyg.popover&&t.includes("popover")&&(e.wysiwyg.popover.style.display="none")},y=function(e,t,n,r){n.addEventListener((0,d.Le)(),(function(r){r.preventDefault(),r.stopPropagation(),n.classList.contains(o.g.CLASS_MENU_DISABLED)||(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach((function(e){e.classList.remove("vditor-hint--current")})),"block"===t.style.display?t.style.display="none":(g(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")))}))},b=n(713),w=n(615),E=n(369),k=n(726),S=n(23),L=n(383),C=n(890),T=n(93),M=n(323),x=n(765),_=n(894),A=n(583),H=function(e,t){if(e)if("html-block"!==e.parentElement.getAttribute("data-type")){var n=e.firstElementChild.className.replace("language-","");n&&("abc"===n?(0,E.Q)(e,t.options.cdn):"mermaid"===n?(0,x.i)(e,t.options.cdn,t.options.theme):"flowchart"===n?(0,L.P)(e,t.options.cdn):"echarts"===n?(0,k.p)(e,t.options.cdn,t.options.theme):"mindmap"===n?(0,_.P)(e,t.options.cdn,t.options.theme):"plantuml"===n?(0,A.B)(e,t.options.cdn):"graphviz"===n?(0,C.v)(e,t.options.cdn):"math"===n?(0,M.H)(e,{cdn:t.options.cdn,math:t.options.preview.math}):((0,T.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,S.O)(e,t.options.lang)),e.setAttribute("data-render","1"))}else e.setAttribute("data-render","1")},N=n(187),D=function(e){if("sv"!==e.currentMode){var t=e[e.currentMode].element,n=e.outline.render(e);""===n&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach((function(t){t.innerHTML=n,(0,M.H)(t,{cdn:e.options.cdn,math:e.options.preview.math})}))}},O=function(e,t){var n=(0,b.lG)(e.target,"SPAN");if(n&&(0,b.fb)(n,"vditor-toc")){var r=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(r)if("auto"===t.options.height){var i=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(i+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,i)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=r.offsetTop}},R=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if("Backspace"===n.key&&0===(0,N.im)(e,t[t.currentMode].element,r).start)return e.previousElementSibling.remove(),it(t),!0;if(Ye(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if("Delete"===n.key&&(0,N.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),it(t),!0;if(Xe(t,n,r,e,e.nextElementSibling))return!0}if("Backspace"===n.key||"Delete"===n.key){var i=(0,b.fb)(r.startContainer,"vditor-toc");if(i)return i.remove(),it(t),!0}},j=function(e,t,n,r){void 0===n&&(n=!1);var i=(0,b.F9)(t.startContainer);if(i&&!n&&"code-block"!==i.getAttribute("data-type")){if(nt(i.innerHTML)&&i.previousElementSibling||rt(i.innerHTML))return;for(var a=(0,N.im)(i,e.ir.element,t).start,l=!0,s=a-1;s>i.textContent.substr(0,a).lastIndexOf("\n");s--)if(" "!==i.textContent.charAt(s)&&"\t"!==i.textContent.charAt(s)){l=!1;break}0===a&&(l=!1);var c=!0;for(s=a-1;s<i.textContent.length;s++)if(" "!==i.textContent.charAt(s)&&"\n"!==i.textContent.charAt(s)){c=!1;break}if(l)return;if(c&&!(0,b.fb)(t.startContainer,"vditor-ir__marker")){var d=t.startContainer.previousSibling;return void(d&&3!==d.nodeType&&d.classList.contains("vditor-ir__node--expand")&&d.classList.remove("vditor-ir__node--expand"))}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach((function(e){e.classList.remove("vditor-ir__node--expand")})),i||(i=e.ir.element),!i.querySelector("wbr")){var u=(0,b.fb)(t.startContainer,"vditor-ir__preview");u?u.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),"link-ref-defs-block"===i.getAttribute("data-type")&&(i=e.ir.element);var p,m=i.isEqualNode(e.ir.element),f=(0,b.a1)(i,"data-type","footnotes-block"),h="";if(m)h=i.innerHTML;else{var v=(0,w.S)(t.startContainer,"BLOCKQUOTE"),g=(0,b.O9)(t.startContainer);if(g&&(i=g),v&&(!g||g&&!v.contains(g))&&(i=v),f&&(i=f),h=i.outerHTML,"UL"===i.tagName||"OL"===i.tagName){var y=i.previousElementSibling,E=i.nextElementSibling;!y||"UL"!==y.tagName&&"OL"!==y.tagName||(h=y.outerHTML+h,y.remove()),!E||"UL"!==E.tagName&&"OL"!==E.tagName||(h+=E.outerHTML,E.remove()),h=h.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&""!==i.previousElementSibling.textContent.replace(o.g.ZWSP,"")&&r&&"insertParagraph"===r.inputType&&(h=i.previousElementSibling.outerHTML+h,i.previousElementSibling.remove());e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e){e&&!i.isEqualNode(e)&&(h+=e.outerHTML,e.remove())})),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach((function(e){e&&!i.isEqualNode(e)&&(h+=e.outerHTML,e.remove())}))}if(e.options.debugger,h=e.lute.SpinVditorIRDOM(h),e.options.debugger,m)i.innerHTML=h;else if(i.outerHTML=h,f){var k=(0,b.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(k){var S=k.textContent,L=S.substring(1,S.indexOf("]:")),C=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+L+'"]');C&&C.setAttribute("aria-label",S.substr(L.length+3).trim().substr(0,24))}}var T,M=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");M.forEach((function(e,t){0===t?p=e:(p.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),M.length>0&&e.ir.element.insertAdjacentElement("beforeend",M[0]);var x=e.ir.element.querySelectorAll("[data-type='footnotes-block']");x.forEach((function(e,t){0===t?T=e:(T.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),x.length>0&&e.ir.element.insertAdjacentElement("beforeend",x[0]),(0,N.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){H(t,e)})),D(e),kt(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},I=function(e,t){if(""===e)return!1;if(-1===e.indexOf("⇧")&&-1===e.indexOf("⌘")&&-1===e.indexOf("⌥"))return!((0,d.yl)(t)||t.altKey||t.shiftKey||t.code!==e);if("⇧Tab"===e)return!((0,d.yl)(t)||t.altKey||!t.shiftKey||"Tab"!==t.code);var n=e.split("");if(e.startsWith("⌥")){var r=3===n.length?n[2]:n[1];return!((3===n.length?!(0,d.yl)(t):(0,d.yl)(t))||!t.altKey||t.shiftKey||t.code!==(/^[0-9]$/.test(r)?"Digit":"Key")+r)}"⌘Enter"===e&&(n=["⌘","Enter"]);var i=n.length>2&&"⇧"===n[0],o=i?n[2]:n[1];return!i||!(0,d.vU)()&&/Mac/.test(navigator.platform)||("-"===o?o="_":"="===o&&(o="+")),!(!(0,d.yl)(t)||t.key.toLowerCase()!==o.toLowerCase()||t.altKey||!(!i&&!t.shiftKey||i&&t.shiftKey))},P=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach((function(e){e.classList.remove("vditor-ir__node--expand")}));var n=(0,b.JQ)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,b.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,N.Hc)(e));var i=function(e){var t=e.startContainer;if(3===t.nodeType&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&""===n.textContent;)n=n.nextSibling;if(!n){var r=(0,b.fb)(t,"vditor-ir__marker");if(r&&!r.nextSibling){var i=t.parentElement.parentElement.nextSibling;if(i&&3!==i.nodeType&&i.classList.contains("vditor-ir__node"))return i}return!1}return!(!n||3===n.nodeType||!n.classList.contains("vditor-ir__node")||n.getAttribute("data-block"))&&n}(e);if(i)return i.classList.add("vditor-ir__node--expand"),void i.classList.remove("vditor-ir__node--hidden");var o=function(e){var t=e.startContainer,n=t.previousSibling;return!(3!==t.nodeType||0!==e.startOffset||!n||3===n.nodeType||!n.classList.contains("vditor-ir__node")||n.getAttribute("data-block"))&&n}(e);return o?(o.classList.add("vditor-ir__node--expand"),void o.classList.remove("vditor-ir__node--hidden")):void 0}},B=n(264),q=function(e,t){var n,r=getSelection().getRangeAt(0).cloneRange(),i=r.startContainer;3!==r.startContainer.nodeType&&"DIV"===r.startContainer.tagName&&(i=r.startContainer.childNodes[r.startOffset-1]);var o=(0,b.a1)(i,"data-block","0");if(o&&t&&("deleteContentBackward"===t.inputType||" "===t.data)){for(var a=(0,N.im)(o,e.sv.element,r).start,l=!0,s=a-1;s>o.textContent.substr(0,a).lastIndexOf("\n");s--)if(" "!==o.textContent.charAt(s)&&"\t"!==o.textContent.charAt(s)){l=!1;break}if(0===a&&(l=!1),l)return void He(e);if("deleteContentBackward"===t.inputType){var c=(0,b.a1)(i,"data-type","code-block-open-marker")||(0,b.a1)(i,"data-type","code-block-close-marker");if(c){var d;if("code-block-close-marker"===c.getAttribute("data-type")&&(d=xe(i,"code-block-open-marker")))return d.textContent=c.textContent,void He(e);if("code-block-open-marker"===c.getAttribute("data-type")&&(d=xe(i,"code-block-close-marker",!1)))return d.textContent=c.textContent,void He(e)}var u=(0,b.a1)(i,"data-type","math-block-open-marker");if(u){var p=u.nextElementSibling.nextElementSibling;return void(p&&"math-block-close-marker"===p.getAttribute("data-type")&&(p.remove(),He(e)))}o.querySelectorAll('[data-type="code-block-open-marker"]').forEach((function(e){1===e.textContent.length&&e.remove()})),o.querySelectorAll('[data-type="code-block-close-marker"]').forEach((function(e){1===e.textContent.length&&e.remove()}));var m=(0,b.a1)(i,"data-type","heading-marker");if(m&&-1===m.textContent.indexOf("#"))return void He(e)}if((" "===t.data||"deleteContentBackward"===t.inputType)&&((0,b.a1)(i,"data-type","padding")||(0,b.a1)(i,"data-type","li-marker")||(0,b.a1)(i,"data-type","task-marker")||(0,b.a1)(i,"data-type","blockquote-marker")))return void He(e)}if(o&&"$$"===o.textContent.trimRight())He(e);else{o||(o=e.sv.element),"link-ref-defs-block"===(null===(n=o.firstElementChild)||void 0===n?void 0:n.getAttribute("data-type"))&&(o=e.sv.element),(0,b.a1)(i,"data-type","footnotes-link")&&(o=e.sv.element),-1===o.textContent.indexOf(Lute.Caret)&&r.insertNode(document.createTextNode(Lute.Caret)),o.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),o.querySelectorAll("font").forEach((function(e){e.outerHTML=e.innerHTML}));var f,h=o.textContent,v=o.isEqualNode(e.sv.element);v?h=o.textContent:(o.previousElementSibling&&(h=o.previousElementSibling.textContent+h,o.previousElementSibling.remove()),o.previousElementSibling&&0===h.indexOf("---\n")&&(h=o.previousElementSibling.textContent+h,o.previousElementSibling.remove()),e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e,t){0===t&&e&&!o.isEqualNode(e.parentElement)&&(h+="\n"+e.parentElement.textContent,e.parentElement.remove())})),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach((function(e,t){0===t&&e&&!o.isEqualNode(e.parentElement)&&(h+="\n"+e.parentElement.textContent,e.parentElement.remove())}))),h=_e(h,e),v?o.innerHTML=h:o.outerHTML=h;var g,y=e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']");y.forEach((function(e,t){0===t?f=e.parentElement:(f.lastElementChild.remove(),f.insertAdjacentHTML("beforeend",""+e.parentElement.innerHTML),e.parentElement.remove())})),y.length>0&&e.sv.element.insertAdjacentElement("beforeend",f);var w=e.sv.element.querySelectorAll("[data-type='footnotes-link']");w.forEach((function(e,t){0===t?g=e.parentElement:(g.lastElementChild.remove(),g.insertAdjacentHTML("beforeend",""+e.parentElement.innerHTML),e.parentElement.remove())})),w.length>0&&e.sv.element.insertAdjacentElement("beforeend",g),(0,N.ib)(e.sv.element,r),Le(e),He(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})}},U=n(577),W=n(958),V=function(e){"dark"===e.options.theme?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},K=function(e){var t=window.innerWidth<=o.g.MOBILE_WIDTH?10:35;if("none"!==e.wysiwyg.element.parentElement.style.display){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px "+Math.max(t,n)+"px"}"none"!==e.ir.element.parentElement.style.display&&(n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2,e.ir.element.style.padding="10px "+Math.max(t,n)+"px"),"block"===e.preview.element.style.display&&"sv"!==e.currentMode||(e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+("left"===e.options.outline.position?e.outline.element.offsetWidth:0))+"px")},G=function(e){if(e.options.typewriterMode){var t=window.innerHeight;"number"==typeof e.options.height&&(t=e.options.height,"number"==typeof e.options.minHeight&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)),e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}},z=function(e,t){G(e),window.addEventListener("resize",(function(){K(e),G(e)}));var n=(0,d.pK)()&&localStorage.getItem(e.options.cache.id);return e.options.cache.enable&&n||(e.options.value?n=e.options.value:e.originalInnerHTML?n=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(n="")),n||""},F=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout((function(){if("false"!==e[e.currentMode].element.getAttribute("contenteditable")&&(0,N.Gb)(e[e.currentMode].element)){u(e.toolbar.elements,o.g.EDIT_TOOLBARS),m(e.toolbar.elements,o.g.EDIT_TOOLBARS);var t=(0,N.zh)(e),n=t.startContainer;3===t.startContainer.nodeType&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]),("sv"===e.currentMode?(0,b.a1)(n,"data-type","heading"):(0,w.W)(n))&&p(e.toolbar.elements,["headings"]),("sv"===e.currentMode?(0,b.a1)(n,"data-type","blockquote"):(0,b.lG)(n,"BLOCKQUOTE"))&&p(e.toolbar.elements,["quote"]),(0,b.a1)(n,"data-type","strong")&&p(e.toolbar.elements,["bold"]),(0,b.a1)(n,"data-type","em")&&p(e.toolbar.elements,["italic"]),(0,b.a1)(n,"data-type","s")&&p(e.toolbar.elements,["strike"]),(0,b.a1)(n,"data-type","a")&&p(e.toolbar.elements,["link"]);var r=(0,b.lG)(n,"LI");r?(r.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):"OL"===r.parentElement.tagName?p(e.toolbar.elements,["ordered-list"]):"UL"===r.parentElement.tagName&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(e.toolbar.elements,["outdent","indent"]),(0,b.a1)(n,"data-type","code-block")&&(f(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"])),(0,b.a1)(n,"data-type","code")&&(f(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])),(0,b.a1)(n,"data-type","table")&&f(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}}),200)},Z=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout((function(){if(!e.wysiwyg.composingLock){var n=l(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,d.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)},J=function(e){for(var t="",n=e.nextSibling;n;)3===n.nodeType?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},X=function(e){for(var t="",n=e.previousSibling;n;)t=3===n.nodeType?n.textContent+t:n.outerHTML+t,n=n.previousSibling;return t},Y=function(e,t){Array.from(e.wysiwyg.element.childNodes).find((function(n){if(3===n.nodeType){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=3===t.startContainer.nodeType?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,N.Hc)(t),!0}if(!n.getAttribute("data-block"))return"P"===n.tagName?n.remove():("DIV"===n.tagName?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.innerHTML+"</p>"):"BR"===n.tagName?n.outerHTML='<p data-block="0">'+n.outerHTML+"<wbr></p>":(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.outerHTML+"</p>"),(0,N.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0}))},$=function(e,t){var n=(0,N.zh)(e),r=(0,b.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),r||0!==e.wysiwyg.element.children.length||(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),"<wbr>"===r.innerHTML.trim()&&(r.innerHTML="<wbr><br>"),"BLOCKQUOTE"===r.tagName||r.classList.contains("vditor-reset")?r.innerHTML="<"+t+' data-block="0">'+r.innerHTML.trim()+"</"+t+">":r.outerHTML="<"+t+' data-block="0">'+r.innerHTML.trim()+"</"+t+">",(0,N.ib)(e.wysiwyg.element,n),D(e))},Q=function(e){var t=getSelection().getRangeAt(0),n=(0,b.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.innerHTML+"</p>",(0,N.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},ee=function(e,t,n){void 0===n&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();"CODE"===r.tagName?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,N.Hc)(i),e.firstElementChild.classList.contains("language-mindmap")||Le(t)},te=function(e,t){if(I("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');if(n)return n.click(),t.preventDefault(),!0}},ne=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout((function(){if("false"!==e.wysiwyg.element.getAttribute("contenteditable")&&(0,N.Gb)(e.wysiwyg.element)){u(e.toolbar.elements,o.g.EDIT_TOOLBARS),m(e.toolbar.elements,o.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;n=3===t.startContainer.nodeType?t.startContainer.parentElement:n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,b.a1)(n,"data-type","footnotes-block");if(r)return e.wysiwyg.popover.innerHTML="",le(r,e),void re(e,r);var i=(0,b.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):"OL"===i.parentElement.tagName?p(e.toolbar.elements,["ordered-list"]):"UL"===i.parentElement.tagName&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(e.toolbar.elements,["outdent","indent"]),(0,b.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,b.lG)(n,"B")||(0,b.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,b.lG)(n,"I")||(0,b.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,b.lG)(n,"STRIKE")||(0,b.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach((function(e){e.classList.remove("vditor-comment--focus")}));var a=(0,b.fb)(n,"vditor-comment");if(a){var l=a.getAttribute("data-cmtids").split(" ");if(l.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var s=a.nextElementSibling.getAttribute("data-cmtids").split(" ");l.find((function(e){if(s.includes(e))return l=[e],!0}))}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach((function(e){e.getAttribute("data-cmtids").indexOf(l[0])>-1&&e.classList.add("vditor-comment--focus")}))}var c=(0,b.lG)(n,"A");c&&p(e.toolbar.elements,["link"]);var h=(0,b.lG)(n,"TABLE"),v=(0,w.W)(n);(0,b.lG)(n,"CODE")?(0,b.lG)(n,"PRE")?(f(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"])):(f(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])):v?(f(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):h&&f(e.toolbar.elements,["table"]);var g=(0,b.fb)(n,"vditor-toc");if(g)return e.wysiwyg.popover.innerHTML="",le(g,e),void re(e,g);var y=(0,w.S)(n,"BLOCKQUOTE");if(y&&(e.wysiwyg.popover.innerHTML="",oe(t,y,e),ae(t,y,e),le(y,e),re(e,y)),i&&(e.wysiwyg.popover.innerHTML="",oe(t,i,e),ae(t,i,e),le(i,e),re(e,i)),h){e.wysiwyg.popover.innerHTML="";var E=function(){var e=h.rows.length,t=h.rows[0].cells.length,n=parseInt(I.value,10)||e,r=parseInt(B.value,10)||t;if(n!==e||t!==r){if(t!==r)for(var i=r-t,o=0;o<h.rows.length;o++)if(i>0)for(var a=0;a<i;a++)0===o?h.rows[o].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):h.rows[o].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var l=t-1;l>=r;l--)h.rows[o].cells[l].remove();if(e!==n){var s=n-e;if(s>0){for(var c="<tr>",d=0;d<r;d++)c+="<td> </td>";for(var u=0;u<s;u++)h.querySelector("tbody")?h.querySelector("tbody").insertAdjacentHTML("beforeend",c):h.querySelector("thead").insertAdjacentHTML("afterend",c+"</tr>")}else for(d=e-1;d>=n;d--)h.rows[d].remove(),1===h.rows.length&&h.querySelector("tbody").remove()}}},k=function(n){tt(h,n),"right"===n?(T.classList.remove("vditor-icon--current"),M.classList.remove("vditor-icon--current"),x.classList.add("vditor-icon--current")):"center"===n?(T.classList.remove("vditor-icon--current"),x.classList.remove("vditor-icon--current"),M.classList.add("vditor-icon--current")):(M.classList.remove("vditor-icon--current"),x.classList.remove("vditor-icon--current"),T.classList.add("vditor-icon--current")),(0,N.Hc)(t),Z(e)},S=(0,b.lG)(n,"TD"),L=(0,b.lG)(n,"TH"),C="left";S?C=S.getAttribute("align")||"left":L&&(C=L.getAttribute("align")||"center");var T=document.createElement("button");T.setAttribute("type","button"),T.setAttribute("aria-label",U.a[e.options.lang].alignLeft+"<"+(0,d.ns)("⇧⌘L")+">"),T.setAttribute("data-type","left"),T.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',T.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("left"===C?" vditor-icon--current":""),T.onclick=function(){k("left")};var M=document.createElement("button");M.setAttribute("type","button"),M.setAttribute("aria-label",U.a[e.options.lang].alignCenter+"<"+(0,d.ns)("⇧⌘C")+">"),M.setAttribute("data-type","center"),M.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',M.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("center"===C?" vditor-icon--current":""),M.onclick=function(){k("center")};var x=document.createElement("button");x.setAttribute("type","button"),x.setAttribute("aria-label",U.a[e.options.lang].alignRight+"<"+(0,d.ns)("⇧⌘R")+">"),x.setAttribute("data-type","right"),x.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',x.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+("right"===C?" vditor-icon--current":""),x.onclick=function(){k("right")};var _=document.createElement("button");_.setAttribute("type","button"),_.setAttribute("aria-label",U.a[e.options.lang].insertRowBelow+"<"+(0,d.ns)("⌘=")+">"),_.setAttribute("data-type","insertRow"),_.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',_.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",_.onclick=function(){var n=getSelection().getRangeAt(0).startContainer,r=(0,b.lG)(n,"TD")||(0,b.lG)(n,"TH");r&&st(e,t,r)};var A=document.createElement("button");A.setAttribute("type","button"),A.setAttribute("aria-label",U.a[e.options.lang].insertRowAbove+"<"+(0,d.ns)("⇧⌘F")+">"),A.setAttribute("data-type","insertRow"),A.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',A.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",A.onclick=function(){var n=getSelection().getRangeAt(0).startContainer,r=(0,b.lG)(n,"TD")||(0,b.lG)(n,"TH");r&&ct(e,t,r)};var D=document.createElement("button");D.setAttribute("type","button"),D.setAttribute("aria-label",U.a[e.options.lang].insertColumnRight+"<"+(0,d.ns)("⇧⌘=")+">"),D.setAttribute("data-type","insertColumn"),D.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',D.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",D.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,n=(0,b.lG)(t,"TD")||(0,b.lG)(t,"TH");n&&dt(e,h,n)};var O=document.createElement("button");O.setAttribute("type","button"),O.setAttribute("aria-label",U.a[e.options.lang].insertColumnLeft+"<"+(0,d.ns)("⇧⌘G")+">"),O.setAttribute("data-type","insertColumn"),O.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',O.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",O.onclick=function(){var t=getSelection().getRangeAt(0).startContainer,n=(0,b.lG)(t,"TD")||(0,b.lG)(t,"TH");n&&dt(e,h,n,"beforebegin")};var R=document.createElement("button");R.setAttribute("type","button"),R.setAttribute("aria-label",U.a[e.options.lang]["delete-row"]+"<"+(0,d.ns)("⌘-")+">"),R.setAttribute("data-type","deleteRow"),R.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',R.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",R.onclick=function(){var n=getSelection().getRangeAt(0).startContainer,r=(0,b.lG)(n,"TD")||(0,b.lG)(n,"TH");r&&ut(e,t,r)};var j=document.createElement("button");j.setAttribute("type","button"),j.setAttribute("aria-label",U.a[e.options.lang]["delete-column"]+"<"+(0,d.ns)("⇧⌘-")+">"),j.setAttribute("data-type","deleteColumn"),j.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',j.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",j.onclick=function(){var n=getSelection().getRangeAt(0).startContainer,r=(0,b.lG)(n,"TD")||(0,b.lG)(n,"TH");r&&pt(e,t,h,r)},(J=document.createElement("span")).setAttribute("aria-label",U.a[e.options.lang].row),J.className="vditor-tooltipped vditor-tooltipped__n";var I=document.createElement("input");J.appendChild(I),I.type="number",I.min="1",I.className="vditor-input",I.style.width="42px",I.style.textAlign="center",I.setAttribute("placeholder",U.a[e.options.lang].row),I.value=h.rows.length.toString(),I.oninput=function(){E()},I.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(B.focus(),B.select(),void t.preventDefault()):void te(e,t)};var P=document.createElement("span");P.setAttribute("aria-label",U.a[e.options.lang].column),P.className="vditor-tooltipped vditor-tooltipped__n";var B=document.createElement("input");P.appendChild(B),B.type="number",B.min="1",B.className="vditor-input",B.style.width="42px",B.style.textAlign="center",B.setAttribute("placeholder",U.a[e.options.lang].column),B.value=h.rows[0].cells.length.toString(),B.oninput=function(){E()},B.onkeydown=function(t){if(!t.isComposing)return"Tab"===t.key?(I.focus(),I.select(),void t.preventDefault()):void te(e,t)},oe(t,h,e),ae(t,h,e),le(h,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",T),e.wysiwyg.popover.insertAdjacentElement("beforeend",M),e.wysiwyg.popover.insertAdjacentElement("beforeend",x),e.wysiwyg.popover.insertAdjacentElement("beforeend",A),e.wysiwyg.popover.insertAdjacentElement("beforeend",_),e.wysiwyg.popover.insertAdjacentElement("beforeend",O),e.wysiwyg.popover.insertAdjacentElement("beforeend",D),e.wysiwyg.popover.insertAdjacentElement("beforeend",R),e.wysiwyg.popover.insertAdjacentElement("beforeend",j),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",P),re(e,h)}var q=(0,b.a1)(n,"data-type","link-ref");q&&ie(e,q);var W=(0,b.a1)(n,"data-type","footnotes-ref");if(W){e.wysiwyg.popover.innerHTML="",(J=document.createElement("span")).setAttribute("aria-label",U.a[e.options.lang].footnoteRef+"<"+(0,d.ns)("⌥Enter")+">"),J.className="vditor-tooltipped vditor-tooltipped__n";var V=document.createElement("input");J.appendChild(V),V.className="vditor-input",V.setAttribute("placeholder",U.a[e.options.lang].footnoteRef+"<"+(0,d.ns)("⌥Enter")+">"),V.style.width="120px",V.value=W.getAttribute("data-footnotes-label"),V.oninput=function(){""!==V.value.trim()&&W.setAttribute("data-footnotes-label",V.value)},V.onkeydown=function(n){if(!n.isComposing)return(0,d.yl)(n)||n.shiftKey||!n.altKey||"Enter"!==n.key?void te(e,n):(t.selectNodeContents(W),t.collapse(!1),(0,N.Hc)(t),void n.preventDefault())},le(W,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),re(e,W)}var K=(0,b.fb)(n,"vditor-wysiwyg__block");if(K&&K.getAttribute("data-type").indexOf("block")>-1){if(e.wysiwyg.popover.innerHTML="",oe(t,K,e),ae(t,K,e),le(K,e),"code-block"===K.getAttribute("data-type")){var G=document.createElement("span");G.setAttribute("aria-label",U.a[e.options.lang].language+"<"+(0,d.ns)("⌥Enter")+">"),G.className="vditor-tooltipped vditor-tooltipped__n";var z=document.createElement("input");G.appendChild(z);var F=K.firstElementChild.firstElementChild;z.className="vditor-input",z.setAttribute("placeholder",U.a[e.options.lang].language+"<"+(0,d.ns)("⌥Enter")+">"),z.value=F.className.indexOf("language-")>-1?F.className.split("-")[1].split(" ")[0]:"",z.oninput=function(){""!==z.value.trim()?F.className="language-"+z.value:(F.className="",e.hint.recentLanguage=""),K.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(K.lastElementChild.innerHTML=K.firstElementChild.innerHTML,H(K.lastElementChild,e)),Z(e)},z.onkeydown=function(n){if(!n.isComposing&&!te(e,n)){if("Escape"===n.key&&"block"===e.hint.element.style.display)return e.hint.element.style.display="none",void n.preventDefault();(0,d.yl)(n)||n.shiftKey||!n.altKey||"Enter"!==n.key||(t.setStart(F.firstChild,0),t.collapse(!0),(0,N.Hc)(t)),e.hint.select(n,e)}},z.onkeyup=function(t){if(!t.isComposing&&"Enter"!==t.key&&"ArrowUp"!==t.key&&"Escape"!==t.key&&"ArrowDown"!==t.key){var n=[],r=z.value.substring(0,z.selectionStart);o.g.CODE_LANGUAGES.forEach((function(e){e.indexOf(r.toLowerCase())>-1&&n.push({html:e,value:e})})),e.hint.genHTML(n,r,e),t.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",G)}re(e,K)}else K||e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach((function(e){e.previousElementSibling.style.display="none"})),K=void 0;if(v){var J;e.wysiwyg.popover.innerHTML="",(J=document.createElement("span")).setAttribute("aria-label","ID<"+(0,d.ns)("⌥Enter")+">"),J.className="vditor-tooltipped vditor-tooltipped__n";var X=document.createElement("input");J.appendChild(X),X.className="vditor-input",X.setAttribute("placeholder","ID<"+(0,d.ns)("⌥Enter")+">"),X.style.width="120px",X.value=v.getAttribute("data-id")||"",X.oninput=function(){v.setAttribute("data-id",X.value)},X.onkeydown=function(n){if(!n.isComposing)return(0,d.yl)(n)||n.shiftKey||!n.altKey||"Enter"!==n.key?void te(e,n):(t.selectNodeContents(v),t.collapse(!1),(0,N.Hc)(t),void n.preventDefault())},oe(t,v,e),ae(t,v,e),le(v,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),re(e,v)}if(c&&ce(e,c),!(y||i||h||K||c||q||W||v||g)){var Y=(0,b.a1)(n,"data-block","0");Y&&Y.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",oe(t,Y,e),ae(t,Y,e),le(Y,e),re(e,Y)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach((function(e){e.style.display="none"}));var $=(0,b.a1)(t.startContainer,"data-type","backslash");$&&($.querySelector("span").style.display="inline")}}),200)},re=function(e,t){var n=t,r=(0,b.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())},ie=function(e,t){e.wysiwyg.popover.innerHTML="";var n=function(){""!==i.value.trim()&&("IMG"===t.tagName?t.setAttribute("alt",i.value):t.textContent=i.value),""!==a.value.trim()&&t.setAttribute("data-link-label",a.value)},r=document.createElement("span");r.setAttribute("aria-label",U.a[e.options.lang].textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var i=document.createElement("input");r.appendChild(i),i.className="vditor-input",i.setAttribute("placeholder",U.a[e.options.lang].textIsNotEmpty),i.style.width="120px",i.value=t.getAttribute("alt")||t.textContent,i.oninput=function(){n()},i.onkeydown=function(n){te(e,n)||se(e,t,n,a)};var o=document.createElement("span");o.setAttribute("aria-label",U.a[e.options.lang].linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");o.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",U.a[e.options.lang].linkRef),a.value=t.getAttribute("data-link-label"),a.oninput=function(){n()},a.onkeydown=function(n){te(e,n)||se(e,t,n,i)},le(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),re(e,t)},oe=function(e,t,n){var r=t.previousElementSibling;if(r&&(t.parentElement.isEqualNode(n.wysiwyg.element)||"LI"===t.tagName)){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",U.a[n.options.lang].up+"<"+(0,d.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,N.ib)(n.wysiwyg.element,e),Z(n),ne(n),Le(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},ae=function(e,t,n){var r=t.nextElementSibling;if(r&&(t.parentElement.isEqualNode(n.wysiwyg.element)||"LI"===t.tagName)){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",U.a[n.options.lang].down+"<"+(0,d.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,N.ib)(n.wysiwyg.element,e),Z(n),ne(n),Le(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},le=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",U.a[t.options.lang].remove+"<"+(0,d.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 n=(0,N.zh)(t);n.setStartAfter(e),(0,N.Hc)(n),e.remove(),Z(t),ne(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},se=function(e,t,n,r){if(!n.isComposing){if("Tab"===n.key)return r.focus(),r.select(),void n.preventDefault();if(!(0,d.yl)(n)&&!n.shiftKey&&n.altKey&&"Enter"===n.key){var i=(0,N.zh)(e);t.insertAdjacentHTML("afterend",o.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,N.Hc)(i),n.preventDefault()}}},ce=function(e,t){e.wysiwyg.popover.innerHTML="";var n=function(){""!==i.value.trim()&&(t.innerHTML=i.value),t.setAttribute("href",a.value),t.setAttribute("title",s.value)};t.querySelectorAll("[data-marker]").forEach((function(e){e.removeAttribute("data-marker")}));var r=document.createElement("span");r.setAttribute("aria-label",U.a[e.options.lang].textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var i=document.createElement("input");r.appendChild(i),i.className="vditor-input",i.setAttribute("placeholder",U.a[e.options.lang].textIsNotEmpty),i.style.width="120px",i.value=t.innerHTML||"",i.oninput=function(){n()},i.onkeydown=function(n){te(e,n)||se(e,t,n,a)};var o=document.createElement("span");o.setAttribute("aria-label",U.a[e.options.lang].link),o.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");o.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",U.a[e.options.lang].link),a.value=t.getAttribute("href")||"",a.oninput=function(){n()},a.onkeydown=function(n){te(e,n)||se(e,t,n,s)};var l=document.createElement("span");l.setAttribute("aria-label",U.a[e.options.lang].tooltipText),l.className="vditor-tooltipped vditor-tooltipped__n";var s=document.createElement("input");l.appendChild(s),s.className="vditor-input",s.setAttribute("placeholder",U.a[e.options.lang].tooltipText),s.style.width="60px",s.value=t.getAttribute("title")||"",s.oninput=function(){n()},s.onkeydown=function(n){te(e,n)||se(e,t,n,i)},le(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",l),re(e,t)},de=function(e){"wysiwyg"===e.currentMode?ne(e):"ir"===e.currentMode&&F(e)},ue=function(e,t,n){void 0===n&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){H(t,e),t.previousElementSibling.setAttribute("style","display:none")})),Z(e,n)},pe=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",l="",s=function(e){var t=X(e.startContainer),n=J(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",l="";return(""!==r.substr(0,i)&&r.substr(0,i)!==o.g.ZWSP||t)&&(a=""+t+r.substr(0,i)),(""!==r.substr(i)&&r.substr(i)!==o.g.ZWSP||n)&&(l=""+r.substr(i)+n),{afterHTML:l,beforeHTML:a}}(e),c=s.beforeHTML,d=s.afterHTML;r&&!i;){var u=r.tagName;if("STRIKE"===u&&(u="S"),"I"===u&&(u="EM"),"B"===u&&(u="STRONG"),"S"===u||"STRONG"===u||"EM"===u){var p="",m="",f="";"0"!==r.parentElement.getAttribute("data-block")&&(m=X(r),f=J(r)),(c||m)&&(c=p=m+"<"+u+">"+c+"</"+u+">"),("bold"===n&&"STRONG"===u||"italic"===n&&"EM"===u||"strikeThrough"===n&&"S"===u)&&(p+=""+a+o.g.ZWSP+"<wbr>"+l,i=!0),(d||f)&&(p+=d="<"+u+">"+d+"</"+u+">"+f),"0"!==r.parentElement.getAttribute("data-block")?(r=r.parentElement).innerHTML=p:(r.outerHTML=p,r=r.parentElement),a="<"+u+">"+a,l="</"+u+">"+l}else i=!0}(0,N.ib)(t.wysiwyg.element,e)},me=function(e,t){var n,r=this;this.element=document.createElement("div"),t.className&&(n=this.element.classList).add.apply(n,t.className.split(" "));var i=t.hotkey?" <"+(0,d.ns)(t.hotkey)+">":"";2===t.level&&(i=t.hotkey?" &lt;"+(0,d.ns)(t.hotkey)+"&gt;":"");var a=t.tip?t.tip+i:U.a[e.options.lang][t.name]+i,l="upload"===t.name?"div":"button";if(2===t.level)this.element.innerHTML="<"+l+' data-type="'+t.name+'">'+a+"</"+l+">";else{this.element.classList.add("vditor-toolbar__item");var s=document.createElement(l);s.setAttribute("data-type",t.name),s.className="vditor-tooltipped vditor-tooltipped__"+t.tipPosition,s.setAttribute("aria-label",a),s.innerHTML=t.icon,this.element.appendChild(s)}t.prefix&&this.element.children[0].addEventListener((0,d.Le)(),(function(n){n.preventDefault(),r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||("wysiwyg"===e.currentMode?function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,N.zh)(e),l=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if("strike"===l&&(l="strikeThrough"),"quote"===l){var s=(0,b.lG)(a.startContainer,"BLOCKQUOTE");s||(s=a.startContainer.childNodes[a.startOffset]),s&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),s.outerHTML=""===s.innerHTML.trim()?'<p data-block="0">'+s.innerHTML+"</p>":s.innerHTML,(0,N.ib)(e.wysiwyg.element,a))}else if("inline-code"===l){var c=(0,b.lG)(a.startContainer,"CODE");c||(c=a.startContainer.childNodes[a.startOffset]),c&&(c.outerHTML=c.innerHTML.replace(o.g.ZWSP,"")+"<wbr>",(0,N.ib)(e.wysiwyg.element,a))}else"link"===l?a.collapsed?(a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):document.execCommand("unlink",!1,""):"check"===l||"list"===l||"ordered-list"===l?($e(e,a,l),(0,N.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),""===a.toString()?pe(a,e,l):document.execCommand(l,!1,""));else{0===e.wysiwyg.element.childNodes.length&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,N.ib)(e.wysiwyg.element,a));var d=(0,b.F9)(a.startContainer);if("quote"===l){if(d||(d=a.startContainer.childNodes[a.startOffset]),d){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var p=(0,b.lG)(a.startContainer,"LI");p&&d.contains(p)?p.innerHTML='<blockquote data-block="0">'+p.innerHTML+"</blockquote>":d.outerHTML='<blockquote data-block="0">'+d.outerHTML+"</blockquote>",(0,N.ib)(e.wysiwyg.element,a)}}else if("check"===l||"list"===l||"ordered-list"===l)$e(e,a,l,!1),(0,N.ib)(e.wysiwyg.element,a),r=!1,u(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if("inline-code"===l){if(""===a.toString())(m=document.createElement("code")).textContent=o.g.ZWSP,a.insertNode(m),a.setStart(m.firstChild,1),a.collapse(!0),(0,N.Hc)(a);else if(3===a.startContainer.nodeType){var m=document.createElement("code");a.surroundContents(m),a.insertNode(m),(0,N.Hc)(a)}t.classList.add("vditor-menu--current")}else if("code"===l)(m=document.createElement("div")).className="vditor-wysiwyg__block",m.setAttribute("data-type","code-block"),m.setAttribute("data-block","0"),m.setAttribute("data-marker","```"),""===a.toString()?m.innerHTML="<pre><code><wbr>\n</code></pre>":(m.innerHTML="<pre><code>"+a.toString()+"<wbr></code></pre>",a.deleteContents()),a.insertNode(m),d&&(d.outerHTML=e.lute.SpinVditorDOM(d.outerHTML)),(0,N.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){H(t,e)})),t.classList.add("vditor-menu--disabled");else if("link"===l){if(""===a.toString()){var f=document.createElement("a");f.innerText=o.g.ZWSP,a.insertNode(f),a.setStart(f.firstChild,1),a.collapse(!0),ce(e,f);var h=e.wysiwyg.popover.querySelector("input");h.value="",h.focus(),i=!1}else{(m=document.createElement("a")).setAttribute("href",""),m.innerHTML=a.toString(),a.surroundContents(m),a.insertNode(m),(0,N.Hc)(a),ce(e,m);var v=e.wysiwyg.popover.querySelectorAll("input");v[0].value=m.innerText,v[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if("table"===l){var g='<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())d&&""===d.innerHTML.trim().replace(o.g.ZWSP,"")?d.outerHTML=g:document.execCommand("insertHTML",!1,g),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,N.Hc)(a);else{g='<table data-block="0"><thead><tr>';var y=a.toString().split("\n"),w=y[0].split(",").length>y[0].split("\t").length?",":"\t";y.forEach((function(e,t){0===t?(e.split(w).forEach((function(e,t){g+=0===t?"<th>"+e+"<wbr></th>":"<th>"+e+"</th>"})),g+="</tr></thead>"):(g+=1===t?"<tbody><tr>":"<tr>",e.split(w).forEach((function(e){g+="<td>"+e+"</td>"})),g+="</tr>")})),g+="</tbody></table>",document.execCommand("insertHTML",!1,g),(0,N.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if("line"===l){if(d){var E='<hr data-block="0"><p data-block="0"><wbr>\n</p>';""===d.innerHTML.trim()?d.outerHTML=E:d.insertAdjacentHTML("afterend",E),(0,N.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),"strike"===l&&(l="strikeThrough"),""!==a.toString()||"bold"!==l&&"italic"!==l&&"strikeThrough"!==l)document.execCommand(l,!1,"");else{var k="strong";"italic"===l?k="em":"strikeThrough"===l&&(k="s"),(m=document.createElement(k)).textContent=o.g.ZWSP,a.insertNode(m),m.previousSibling&&m.previousSibling.textContent===o.g.ZWSP&&(m.previousSibling.textContent=""),a.setStart(m.firstChild,1),a.collapse(!0),(0,N.Hc)(a)}}r&&ne(e),i&&Z(e)}}(e,r.element.children[0],n):"ir"===e.currentMode?Ct(e,r.element.children[0],t.prefix||"",t.suffix||""):De(e,r.element.children[0],t.prefix||"",t.suffix||""))}))},fe=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),he=function(e,t,n){var r;if("string"!=typeof n?(g(e,["subToolbar","hint"]),n.preventDefault(),r=l(e)):r=n,e.currentMode!==t||"string"==typeof n){if(e.devtools&&e.devtools.renderEchart(e),"both"===e.options.preview.mode&&"sv"===t?e.preview.element.style.display="block":e.preview.element.style.display="none",m(e.toolbar.elements,o.g.EDIT_TOOLBARS),u(e.toolbar.elements,o.g.EDIT_TOOLBARS),f(e.toolbar.elements,["outdent","indent"]),"ir"===t)h(e.toolbar.elements,["both"]),v(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),kt(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),K(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(t){H(t,e)})),e.ir.element.querySelectorAll(".vditor-toc").forEach((function(t){(0,M.H)(t,{cdn:e.options.cdn,math:e.options.preview.math})}));else if("wysiwyg"===t)h(e.toolbar.elements,["both"]),v(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="block",e.ir.element.parentElement.style.display="none",e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!0),e.lute.SetVditorSV(!1),e.currentMode="wysiwyg",K(e),ue(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach((function(t){(0,M.H)(t,{cdn:e.options.cdn,math:e.options.preview.math})})),e.wysiwyg.popover.style.display="none";else if("sv"===t){v(e.toolbar.elements,["both"]),h(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",("both"===e.options.preview.mode||"editor"===e.options.preview.mode)&&(e.sv.element.style.display="block"),e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var i=_e(r,e);"<div data-block='0'></div>"===i&&(i=""),e.sv.element.innerHTML=i,He(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),K(e)}e.undo.resetIcon(e),"string"!=typeof n&&(e[e.currentMode].element.focus(),de(e)),D(e),G(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach((function(e){e.classList.remove("vditor-menu--current")})),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'+e.currentMode+'"]').classList.add("vditor-menu--current")),e.outline.toggle(e,"sv"!==e.currentMode&&e.options.outline.enable)}},ve=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=document.createElement("div");return i.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow"),i.innerHTML='<button data-mode="wysiwyg">'+U.a[t.options.lang].wysiwyg+" &lt;"+(0,d.ns)("⌥⌘7")+'></button>\n<button data-mode="ir">'+U.a[t.options.lang].instantRendering+" &lt;"+(0,d.ns)("⌥⌘8")+'></button>\n<button data-mode="sv">'+U.a[t.options.lang].splitView+" &lt;"+(0,d.ns)("⌥⌘9")+"></button>",r.element.appendChild(i),r._bindEvent(t,i,n),r}return fe(t,e),t.prototype._bindEvent=function(e,t,n){var r=this.element.children[0];y(e,t,r,n.level),t.children.item(0).addEventListener((0,d.Le)(),(function(t){he(e,"wysiwyg",t),t.preventDefault(),t.stopPropagation()})),t.children.item(1).addEventListener((0,d.Le)(),(function(t){he(e,"ir",t),t.preventDefault(),t.stopPropagation()})),t.children.item(2).addEventListener((0,d.Le)(),(function(t){he(e,"sv",t),t.preventDefault(),t.stopPropagation()}))},t}(me),ge=function(e,t){return(0,N.Gb)(e,t)?getSelection().toString():""},ye=function(e,t){t.addEventListener("focus",(function(){e.options.focus&&e.options.focus(l(e)),g(e,["subToolbar"])}))},be=function(e,t){t.addEventListener("dblclick",(function(t){"IMG"===t.target.tagName&&(0,B.E)(t.target,e.options.lang,e.options.theme)}))},we=function(e,t){t.addEventListener("blur",(function(t){if("ir"===e.currentMode){var n=e.ir.element.querySelector(".vditor-ir__node--expand");n&&n.classList.remove("vditor-ir__node--expand")}else"wysiwyg"!==e.currentMode||e.wysiwyg.selectPopover.contains(t.relatedTarget)||e.wysiwyg.hideComment();e[e.currentMode].range=(0,N.zh)(e),e.options.blur&&e.options.blur(l(e))}))},Ee=function(e,t){t.addEventListener("dragstart",(function(e){e.dataTransfer.setData(o.g.DROP_EDITOR,o.g.DROP_EDITOR)})),t.addEventListener("drop",(function(t){t.dataTransfer.getData(o.g.DROP_EDITOR)?it(e):("Files"===t.dataTransfer.types[0]||t.dataTransfer.types.includes("text/html"))&&wt(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})}))},ke=function(e,t,n){t.addEventListener("copy",(function(t){return n(t,e)}))},Se=function(e,t,n){t.addEventListener("cut",(function(t){n(t,e),e.options.comment.enable&&"wysiwyg"===e.currentMode&&e.wysiwyg.getComments(e),document.execCommand("delete")}))},Le=function(e){if("wysiwyg"===e.currentMode&&e.options.comment.enable&&e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)),e.options.typewriterMode){var t=e[e.currentMode].element,n=(0,N.Ny)(t).top;"string"!=typeof e.options.height||e.element.classList.contains("vditor--fullscreen")||window.scrollTo(window.scrollX,n+e.element.offsetTop+e.toolbar.element.offsetHeight-window.innerHeight/2+10),("number"==typeof e.options.height||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},Ce=function(e,t){t.addEventListener("keydown",(function(t){if(!(e.options.hint.extend.length>1||e.toolbar.elements.emoji)||!e.hint.select(t,e)){if(e.options.comment.enable&&"wysiwyg"===e.currentMode&&("Backspace"===t.key||I("⌘X",t))&&e.wysiwyg.getComments(e),"sv"===e.currentMode){if(function(e,t){var n,r,i,o,a;if(e.sv.composingLock=t.isComposing,t.isComposing)return!1;if(-1!==t.key.indexOf("Arrow")||"Meta"===t.key||"Control"===t.key||"Alt"===t.key||"Shift"===t.key||"CapsLock"===t.key||"Escape"===t.key||/^F\d{1,2}$/.test(t.key)||e.undo.recordFirstPosition(e,t),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!(0,d.yl)(t)&&"Escape"!==t.key)return!1;var l=(0,N.zh)(e),s=l.startContainer;3!==l.startContainer.nodeType&&"DIV"===l.startContainer.tagName&&(s=l.startContainer.childNodes[l.startOffset-1]);var c=(0,b.a1)(s,"data-type","text"),u=(0,b.a1)(s,"data-type","blockquote-marker");if(!u&&0===l.startOffset&&c&&c.previousElementSibling&&"blockquote-marker"===c.previousElementSibling.getAttribute("data-type")&&(u=c.previousElementSibling),u&&"Enter"===t.key&&!(0,d.yl)(t)&&!t.altKey&&""===u.nextElementSibling.textContent.trim()&&(0,N.im)(u,e.sv.element,l).start===u.textContent.length)return"padding"===(null===(n=u.previousElementSibling)||void 0===n?void 0:n.getAttribute("data-type"))&&u.previousElementSibling.setAttribute("data-action","enter-remove"),u.remove(),He(e),t.preventDefault(),!0;var p=(0,b.a1)(s,"data-type","li-marker"),m=(0,b.a1)(s,"data-type","task-marker"),f=p;if(f||m&&"task-marker"!==m.nextElementSibling.getAttribute("data-type")&&(f=m),f||0!==l.startOffset||!c||!c.previousElementSibling||"li-marker"!==c.previousElementSibling.getAttribute("data-type")&&"task-marker"!==c.previousElementSibling.getAttribute("data-type")||(f=c.previousElementSibling),f){var h=(0,N.im)(f,e.sv.element,l).start,v="task-marker"===f.getAttribute("data-type"),g=f;if(v&&(g=f.previousElementSibling.previousElementSibling.previousElementSibling),h===f.textContent.length){if("Enter"===t.key&&!(0,d.yl)(t)&&!t.altKey&&!t.shiftKey&&""===f.nextElementSibling.textContent.trim())return"padding"===(null===(r=g.previousElementSibling)||void 0===r?void 0:r.getAttribute("data-type"))?(g.previousElementSibling.remove(),q(e)):(v&&(g.remove(),f.previousElementSibling.previousElementSibling.remove(),f.previousElementSibling.remove()),f.nextElementSibling.remove(),f.remove(),He(e)),t.preventDefault(),!0;if("Tab"===t.key)return g.insertAdjacentHTML("beforebegin",'<span data-type="padding">'+g.textContent.replace(/\S/g," ")+"</span>"),/^\d/.test(g.textContent)&&(g.textContent=g.textContent.replace(/^\d{1,}/,"1"),l.selectNodeContents(f.firstChild),l.collapse(!1)),q(e),t.preventDefault(),!0}}if(at(e,l,t))return!0;var y=(0,b.a1)(s,"data-block","0"),E=(0,w.S)(s,"SPAN");if("Enter"===t.key&&!(0,d.yl)(t)&&!t.altKey&&!t.shiftKey&&y){var k=!1,S=y.textContent.match(/^\n+/);(0,N.im)(y,e.sv.element).start<=(S?S[0].length:0)&&(k=!0);var L="\n";if(E){if("enter-remove"===(null===(i=E.previousElementSibling)||void 0===i?void 0:i.getAttribute("data-action")))return E.previousElementSibling.remove(),He(e),t.preventDefault(),!0;L+=Ae(E)}return l.insertNode(document.createTextNode(L)),l.collapse(!1),y&&""!==y.textContent.trim()&&!k?q(e):He(e),t.preventDefault(),!0}if("Backspace"===t.key&&!(0,d.yl)(t)&&!t.altKey&&!t.shiftKey){if(E&&"newline"===(null===(o=E.previousElementSibling)||void 0===o?void 0:o.getAttribute("data-type"))&&1===(0,N.im)(E,e.sv.element,l).start&&-1===E.getAttribute("data-type").indexOf("code-block-"))return l.setStart(E,0),l.extractContents(),""!==E.textContent.trim()?q(e):He(e),t.preventDefault(),!0;if(y&&0===(0,N.im)(y,e.sv.element,l).start&&y.previousElementSibling){l.extractContents();var C=y.previousElementSibling.lastElementChild;return"newline"===C.getAttribute("data-type")&&(C.remove(),C=y.previousElementSibling.lastElementChild),"newline"!==C.getAttribute("data-type")&&(C.insertAdjacentHTML("afterend",y.innerHTML),y.remove()),""===y.textContent.trim()||(null===(a=y.previousElementSibling)||void 0===a?void 0:a.querySelector('[data-type="code-block-open-marker"]'))?("newline"!==C.getAttribute("data-type")&&(l.selectNodeContents(C.lastChild),l.collapse(!1)),He(e)):q(e),t.preventDefault(),!0}}return!1}(e,t))return}else if("wysiwyg"===e.currentMode){if(function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;-1!==t.key.indexOf("Arrow")||"Meta"===t.key||"Control"===t.key||"Alt"===t.key||"Shift"===t.key||"CapsLock"===t.key||"Escape"===t.key||/^F\d{1,2}$/.test(t.key)||e.undo.recordFirstPosition(e,t);var n=(0,N.zh)(e),r=n.startContainer;if(!Ve(t,e,r))return!1;if(Ke(n,e,t),yt(n),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!(0,d.yl)(t)&&"Escape"!==t.key&&"Delete"!==t.key)return!1;var i=(0,b.F9)(r),a=(0,b.lG)(r,"P");if(lt(t,e,a,n))return!0;if(ot(n,e,a,t))return!0;if(mt(e,t,n))return!0;var l=(0,b.fb)(r,"vditor-wysiwyg__block");if(l){if("Escape"===t.key&&2===l.children.length)return e.wysiwyg.popover.style.display="none",l.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,d.yl)(t)&&!t.shiftKey&&t.altKey&&"Enter"===t.key&&"code-block"===l.getAttribute("data-type")){var s=e.wysiwyg.popover.querySelector(".vditor-input");return s.focus(),s.select(),t.preventDefault(),!0}if("0"===l.getAttribute("data-block")){if(ft(e,t,l.firstElementChild,n))return!0;if(Xe(e,t,n,l.firstElementChild,l))return!0;if("yaml-front-matter"!==l.getAttribute("data-type")&&Ye(e,t,n,l.firstElementChild,l))return!0}}if(ht(e,n,t,a))return!0;var c=(0,b.E2)(r,"BLOCKQUOTE");if(c&&!t.shiftKey&&t.altKey&&"Enter"===t.key){(0,d.yl)(t)?n.setStartBefore(c):n.setStartAfter(c),(0,N.Hc)(n);var u=document.createElement("p");return u.setAttribute("data-block","0"),u.innerHTML="\n",n.insertNode(u),n.collapse(!0),(0,N.Hc)(n),Z(e),Le(e),t.preventDefault(),!0}var p,m=(0,w.W)(r);if(m){if("H6"===m.tagName&&r.textContent.length===n.startOffset&&!(0,d.yl)(t)&&!t.shiftKey&&!t.altKey&&"Enter"===t.key){var f=document.createElement("p");return f.textContent="\n",f.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",f),n.setStart(f,0),(0,N.Hc)(n),Z(e),Le(e),t.preventDefault(),!0}var h;if(I("⌘=",t))return(h=parseInt(m.tagName.substr(1),10)-1)>0&&($(e,"h"+h),Z(e)),t.preventDefault(),!0;if(I("⌘-",t))return(h=parseInt(m.tagName.substr(1),10)+1)<7&&($(e,"h"+h),Z(e)),t.preventDefault(),!0;"Backspace"!==t.key||(0,d.yl)(t)||t.shiftKey||t.altKey||1!==m.textContent.length||Q(e)}if(vt(e,n,t))return!0;if(t.altKey&&"Enter"===t.key&&!(0,d.yl)(t)&&!t.shiftKey){var v=(0,b.lG)(r,"A"),g=(0,b.a1)(r,"data-type","link-ref"),y=(0,b.a1)(r,"data-type","footnotes-ref");if(v||g||y||m&&2===m.tagName.length){var E=e.wysiwyg.popover.querySelector("input");E.focus(),E.select()}}if(te(e,t))return!0;if(I("⇧⌘U",t)&&(p=e.wysiwyg.popover.querySelector('[data-type="up"]')))return p.click(),t.preventDefault(),!0;if(I("⇧⌘D",t)&&(p=e.wysiwyg.popover.querySelector('[data-type="down"]')))return p.click(),t.preventDefault(),!0;if(at(e,n,t))return!0;if(!(0,d.yl)(t)&&t.shiftKey&&!t.altKey&&"Enter"===t.key&&"LI"!==r.parentElement.tagName&&"P"!==r.parentElement.tagName)return["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName)?n.insertNode(document.createTextNode("\n"+o.g.ZWSP)):n.insertNode(document.createTextNode("\n")),n.collapse(!1),(0,N.Hc)(n),Z(e),Le(e),t.preventDefault(),!0;if("Backspace"===t.key&&!(0,d.yl)(t)&&!t.shiftKey&&!t.altKey&&""===n.toString()){if(gt(e,n,t,a))return!0;if(i){if(i.previousElementSibling&&i.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&"0"===i.previousElementSibling.getAttribute("data-block")&&"UL"!==i.tagName&&"OL"!==i.tagName){var k=(0,N.im)(i,e.wysiwyg.element,n).start;if(0===k&&0===n.startOffset||1===k&&i.innerText.startsWith(o.g.ZWSP))return ee(i.previousElementSibling.lastElementChild,e,!1),""===i.innerHTML.trim().replace(o.g.ZWSP,"")&&(i.remove(),Z(e)),t.preventDefault(),!0}var S=n.startOffset;if(""===n.toString()&&3===r.nodeType&&"\n"===r.textContent.charAt(S-2)&&r.textContent.charAt(S-1)!==o.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,S-1)+o.g.ZWSP,n.setStart(r,S),n.collapse(!0),Z(e),t.preventDefault(),!0;r.textContent===o.g.ZWSP&&1===n.startOffset&&!r.previousSibling&&function(e){for(var t=e.startContainer.nextSibling;t&&""===t.textContent;)t=t.nextSibling;return!(!t||3===t.nodeType||"CODE"!==t.tagName&&"math-inline"!==t.getAttribute("data-type")&&"html-entity"!==t.getAttribute("data-type")&&"html-inline"!==t.getAttribute("data-type"))}(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach((function(e){e.firstElementChild.style.display="inline",e.lastElementChild.style.display="none"})),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach((function(e){e.firstElementChild.style.display="inline",e.lastElementChild.style.display="none"}))}}if((0,d.vU)()&&1===n.startOffset&&r.textContent.indexOf(o.g.ZWSP)>-1&&r.previousSibling&&3!==r.previousSibling.nodeType&&"CODE"===r.previousSibling.tagName&&("Backspace"===t.key||"ArrowLeft"===t.key))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(bt(t,i,n))return t.preventDefault(),!0;if(Ge(n,t.key),"ArrowDown"===t.key){var L=r.nextSibling;L&&3!==L.nodeType&&"math-inline"===L.getAttribute("data-type")&&n.setStartAfter(L)}return!(!i||!R(i,e,t,n)||(t.preventDefault(),0))}(e,t))return}else if("ir"===e.currentMode&&function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;-1!==t.key.indexOf("Arrow")||"Meta"===t.key||"Control"===t.key||"Alt"===t.key||"Shift"===t.key||"CapsLock"===t.key||"Escape"===t.key||/^F\d{1,2}$/.test(t.key)||e.undo.recordFirstPosition(e,t);var n=(0,N.zh)(e),r=n.startContainer;if(!Ve(t,e,r))return!1;if(Ke(n,e,t),yt(n),"Enter"!==t.key&&"Tab"!==t.key&&"Backspace"!==t.key&&-1===t.key.indexOf("Arrow")&&!(0,d.yl)(t)&&"Escape"!==t.key&&"Delete"!==t.key)return!1;var i=(0,b.a1)(r,"data-newline","1");if(!(0,d.yl)(t)&&!t.altKey&&!t.shiftKey&&"Enter"===t.key&&i&&n.startOffset<i.textContent.length){var a=i.previousElementSibling;a&&(n.insertNode(document.createTextNode(a.textContent)),n.collapse(!1));var l=i.nextSibling;l&&(n.insertNode(document.createTextNode(l.textContent)),n.collapse(!0))}var s=(0,b.lG)(r,"P");if(lt(t,e,s,n))return!0;if(ot(n,e,s,t))return!0;if(ht(e,n,t,s))return!0;var c=(0,b.fb)(r,"vditor-ir__marker--pre");if(c&&"PRE"===c.tagName){var u=c.firstChild;if(ft(e,t,c,n))return!0;if(("math-block"===u.getAttribute("data-type")||"html-block"===u.getAttribute("data-type"))&&Ye(e,t,n,u,c.parentElement))return!0;if(Xe(e,t,n,u,c.parentElement))return!0}var p=(0,b.a1)(r,"data-type","code-block-info");if(p){if("Enter"===t.key||"Tab"===t.key)return n.selectNodeContents(p.nextElementSibling.firstChild),n.collapse(!0),t.preventDefault(),g(e,["hint"]),!0;if("Backspace"===t.key){var m=(0,N.im)(p,e.ir.element).start;1===m&&n.setStart(r,0),2===m&&(e.hint.recentLanguage="")}if(Ye(e,t,n,p,p.parentElement))return g(e,["hint"]),!0}var f=(0,b.lG)(r,"TD")||(0,b.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&f){var h=Fe(f);if(h&&Ye(e,t,n,f,h))return!0;var v=Ze(f);if(v&&Xe(e,t,n,f,v))return!0}if(mt(e,t,n))return!0;if(vt(e,n,t))return!0;if(at(e,n,t))return!0;var y=(0,w.W)(r);if(y){var E;if(I("⌘=",t))return(E=y.querySelector(".vditor-ir__marker--heading"))&&E.textContent.trim().length>1&&St(e,E.textContent.substr(1)),t.preventDefault(),!0;if(I("⌘-",t))return(E=y.querySelector(".vditor-ir__marker--heading"))&&E.textContent.trim().length<6&&St(e,E.textContent.trim()+"# "),t.preventDefault(),!0}var k=(0,b.F9)(r);if("Backspace"===t.key&&!(0,d.yl)(t)&&!t.shiftKey&&!t.altKey&&""===n.toString()){if(gt(e,n,t,s))return!0;if(k&&k.previousElementSibling&&"UL"!==k.tagName&&"OL"!==k.tagName&&("code-block"===k.previousElementSibling.getAttribute("data-type")||"math-block"===k.previousElementSibling.getAttribute("data-type"))){var S=(0,N.im)(k,e.ir.element,n).start;if(0===S||1===S&&k.innerText.startsWith(o.g.ZWSP))return n.selectNodeContents(k.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),P(n,e),""===k.textContent.trim().replace(o.g.ZWSP,"")&&(k.remove(),kt(e)),t.preventDefault(),!0}if(y){var L=y.firstElementChild.textContent.length;(0,N.im)(y,e.ir.element).start===L&&(n.setStart(y.firstElementChild.firstChild,L-1),n.collapse(!0),(0,N.Hc)(n))}}return!(("ArrowUp"!==t.key&&"ArrowDown"!==t.key||!k||(k.querySelectorAll(".vditor-ir__node").forEach((function(e){e.contains(r)||e.classList.add("vditor-ir__node--hidden")})),!bt(t,k,n)))&&(Ge(n,t.key),!k||!R(k,e,t,n)||(t.preventDefault(),0)))}(e,t))return;if(e.options.ctrlEnter&&I("⌘Enter",t))return e.options.ctrlEnter(l(e)),void t.preventDefault();if(I("⌘Z",t)&&!e.toolbar.elements.undo)return e.undo.undo(e),void t.preventDefault();if(I("⌘Y",t)&&!e.toolbar.elements.redo)return e.undo.redo(e),void t.preventDefault();if("Escape"===t.key)return"block"===e.hint.element.style.display?e.hint.element.style.display="none":e.options.esc&&!t.isComposing&&e.options.esc(l(e)),void t.preventDefault();if((0,d.yl)(t)&&t.altKey&&!t.shiftKey&&/^Digit[1-6]$/.test(t.code)){if("wysiwyg"===e.currentMode){var n=t.code.replace("Digit","H");(0,b.lG)(getSelection().getRangeAt(0).startContainer,n)?Q(e):$(e,n),Z(e)}else"sv"===e.currentMode?Ne(e,"#".repeat(parseInt(t.code.replace("Digit",""),10))+" "):"ir"===e.currentMode&&St(e,"#".repeat(parseInt(t.code.replace("Digit",""),10))+" ");return t.preventDefault(),!0}if((0,d.yl)(t)&&t.altKey&&!t.shiftKey&&/^Digit[7-9]$/.test(t.code))return"Digit7"===t.code?he(e,"wysiwyg",t):"Digit8"===t.code?he(e,"ir",t):"Digit9"===t.code&&he(e,"sv",t),!0;e.options.toolbar.find((function(n){return!n.hotkey||n.toolbar?!!n.toolbar&&!!n.toolbar.find((function(n){return!!n.hotkey&&(I(n.hotkey,t)?(e.toolbar.elements[n.name].children[0].dispatchEvent(new CustomEvent((0,d.Le)())),t.preventDefault(),!0):void 0)})):I(n.hotkey,t)?(e.toolbar.elements[n.name].children[0].dispatchEvent(new CustomEvent((0,d.Le)())),t.preventDefault(),!0):void 0}))}}))},Te=function(e,t){t.addEventListener("selectstart",(function(n){t.onmouseup=function(){setTimeout((function(){var t=ge(e[e.currentMode].element);t.trim()?("wysiwyg"===e.currentMode&&e.options.comment.enable&&((0,b.a1)(n.target,"data-type","footnotes-block")||(0,b.a1)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.hideComment():e.wysiwyg.showComment()),e.options.select&&e.options.select(t)):"wysiwyg"===e.currentMode&&e.options.comment.enable&&e.wysiwyg.hideComment()}))}}))},Me=function(e,t){var n=(0,N.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,b.a1)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i="<div data-block='0'>"+e.lute.Md2VditorSVDOM(r.textContent).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">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><')+"</div>";r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,(0,N.ib)(e.sv.element,n),Le(e)},xe=function(e,t,n){void 0===n&&(n=!0);var r=e;for(3===r.nodeType&&(r=r.parentElement);r;){if(r.getAttribute("data-type")===t)return r;r=n?r.previousElementSibling:r.nextElementSibling}return!1},_e=function(e,t){return t.options.debugger,e="<div data-block='0'>"+t.lute.SpinVditorSVDOM(e).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">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><')+"</div>",t.options.debugger,e},Ae=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,r=t&&"text"!==t&&"table"!==t&&"heading-marker"!==t&&"newline"!==t&&"yaml-front-matter-open-marker"!==t&&"yaml-front-matter-close-marker"!==t&&"code-block-info"!==t&&"code-block-close-marker"!==t&&"code-block-open-marker"!==t?e.textContent:"",i=!1;for("newline"===t&&(i=!0);n&&!i;){var o=n.getAttribute("data-type");if("li-marker"===o||"blockquote-marker"===o||"task-marker"===o||"padding"===o){var a=n.textContent;if("li-marker"!==o||"code-block-open-marker"!==t&&"code-block-info"!==t)if("code-block-close-marker"===t&&n.nextElementSibling.isSameNode(e)){var l=xe(e,"code-block-open-marker");l&&l.previousElementSibling&&(n=l.previousElementSibling,r=a+r)}else r=a+r;else r=a.replace(/\S/g," ")+r}else"newline"===o&&(i=!0);n=n.previousElementSibling}return r},He=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),e.preview.render(e);var n=l(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,d.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)},Ne=function(e,t){var n=(0,N.zh)(e),r=(0,w.S)(n.startContainer,"SPAN");r&&""!==r.textContent.trim()&&(t="\n"+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},De=function(e,t,n,r){var i=(0,N.zh)(e),o=t.getAttribute("data-type");0===e.sv.element.childNodes.length&&(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">\n</span></span>',(0,N.ib)(e.sv.element,i));var a=(0,b.F9)(i.startContainer),l=(0,w.S)(i.startContainer,"SPAN");if(a){if("link"===o){var s=void 0;return s=""===i.toString()?""+n+Lute.Caret+r:""+n+i.toString()+r.replace(")",Lute.Caret+")"),void document.execCommand("insertHTML",!1,s)}if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o||"line"===o)return s=void 0,s=""===i.toString()?""+n+Lute.Caret+("code"===o?"":r):""+n+i.toString()+Lute.Caret+("code"===o?"":r),"table"===o||"code"===o&&l&&""!==l.textContent?s="\n\n"+s:"line"===o&&(s="\n\n"+n+"\n"+Lute.Caret),void document.execCommand("insertHTML",!1,s);if(("check"===o||"list"===o||"ordered-list"===o||"quote"===o)&&l){var c="* ";"check"===o?c="* [ ] ":"ordered-list"===o?c="1. ":"quote"===o&&(c="> ");var d=xe(l,"newline");return d?d.insertAdjacentText("afterend",c):a.insertAdjacentText("afterbegin",c),void q(e)}(0,N.ib)(e.sv.element,i),He(e)}},Oe=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},Re=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])}))},je=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function l(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((r=r.apply(e,t||[])).next())}))},Ie=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(l){o=[6,l],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}},Pe=function(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"},Be=function(e,t,n){return je(void 0,void 0,void 0,(function(){var r,i,o,a,l,s,c,d,u,p,m,f,h,v;return Ie(this,(function(g){switch(g.label){case 0:for(r=[],i=!0===e.options.upload.multiple?t.length:1,f=0;f<i;f++)(o=t[f])instanceof DataTransferItem&&(o=o.getAsFile()),r.push(o);return e.options.upload.handler?"string"==typeof(a=e.options.upload.handler(r))?(e.tip.show(a),[2]):[2]:e.options.upload.url&&e.upload?e.options.upload.file?[4,e.options.upload.file(r)]:[3,2]:(n&&(n.value=""),e.tip.show("please config: options.upload.url"),[2]);case 1:r=g.sent(),g.label=2;case 2:if(e.options.upload.validate&&"string"==typeof(a=e.options.upload.validate(r)))return e.tip.show(a),[2];if(l=Oe(e),e.upload.range=(0,N.zh)(e),0===(s=function(e,t){e.tip.hide();for(var n=[],r="",i="",o=e.options.lang,a=function(a,l){var s=t[l],c=!0;s.name||(r+="<li>"+U.a[o].nameEmpty+"</li>",c=!1),s.size>e.options.upload.max&&(r+="<li>"+s.name+" "+U.a[o].over+" "+e.options.upload.max/1024/1024+"M</li>",c=!1);var d=s.name.lastIndexOf("."),u=s.name.substr(d),p=e.options.upload.filename(s.name.substr(0,d))+u;e.options.upload.accept&&(e.options.upload.accept.split(",").some((function(e){var t=e.trim();if(0===t.indexOf(".")){if(u.toLowerCase()===t.toLowerCase())return!0}else if(s.type.split("/")[0]===t.split("/")[0])return!0;return!1}))||(r+="<li>"+s.name+" "+U.a[o].fileTypeError+"</li>",c=!1)),c&&(n.push(s),i+="<li>"+p+" "+U.a[o].uploading+"</li>")},l=t.length,s=0;s<l;s++)a(0,s);return e.tip.show("<ul>"+r+i+"</ul>"),n}(e,r)).length)return n&&(n.value=""),[2];for(c=new FormData,d=e.options.upload.extraData,u=0,p=Object.keys(d);u<p.length;u++)m=p[u],c.append(m,d[m]);for(f=0,h=s.length;f<h;f++)c.append(e.options.upload.fieldName,s[f]);return(v=new XMLHttpRequest).open("POST",e.options.upload.url),e.options.upload.token&&v.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(v.withCredentials=!0),Re(e,v),e.upload.isUploading=!0,l.setAttribute("contenteditable","false"),v.onreadystatechange=function(){if(v.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,l.setAttribute("contenteditable","true"),v.status>=200&&v.status<300)if(e.options.upload.success)e.options.upload.success(l,v.responseText);else{var r=v.responseText;e.options.upload.format&&(r=e.options.upload.format(t,v.responseText)),function(e,t){Oe(t).focus();var n=JSON.parse(e),r="";1===n.code&&(r=""+n.msg),n.data.errFiles&&n.data.errFiles.length>0&&(r="<ul><li>"+r+"</li>",n.data.errFiles.forEach((function(e){var n=e.lastIndexOf("."),i=t.options.upload.filename(e.substr(0,n))+e.substr(n);r+="<li>"+i+" "+U.a[t.options.lang].uploadError+"</li>"})),r+="</ul>"),r?t.tip.show(r):t.tip.hide();var i="";Object.keys(n.data.succMap).forEach((function(e){var r=n.data.succMap[e],o=e.lastIndexOf("."),a=e.substr(o),l=t.options.upload.filename(e.substr(0,o))+a;0===(a=a.toLowerCase()).indexOf(".wav")||0===a.indexOf(".mp3")||0===a.indexOf(".ogg")?"wysiwyg"===t.currentMode?i+='<div class="vditor-wysiwyg__block" data-type="html-block"\n data-block="0"><pre><code>&lt;audio controls="controls" src="'+r+'"&gt;&lt;/audio&gt;</code></pre>':"ir"===t.currentMode?i+='<audio controls="controls" src="'+r+'"></audio>\n':i+="["+l+"]("+r+")\n":0===a.indexOf(".apng")||0===a.indexOf(".bmp")||0===a.indexOf(".gif")||0===a.indexOf(".ico")||0===a.indexOf(".cur")||0===a.indexOf(".jpg")||0===a.indexOf(".jpeg")||0===a.indexOf(".jfif")||0===a.indexOf(".pjp")||0===a.indexOf(".pjpeg")||0===a.indexOf(".png")||0===a.indexOf(".svg")||0===a.indexOf(".webp")?"wysiwyg"===t.currentMode?i+='<img alt="'+l+'" src="'+r+'">':i+="!["+l+"]("+r+")\n":"wysiwyg"===t.currentMode?i+='<a href="'+r+'">'+l+"</a>":i+="["+l+"]("+r+")\n"})),(0,N.Hc)(t.upload.range),document.execCommand("insertHTML",!1,i),t.upload.range=getSelection().getRangeAt(0).cloneRange()}(r,e)}else e.options.upload.error?e.options.upload.error(v.responseText):e.tip.show(v.responseText);n&&(n.value=""),e.upload.element.style.display="none"}},v.upload.onprogress=function(t){if(t.lengthComputable){var n=t.loaded/t.total*100;e.upload.element.style.display="block",e.upload.element.style.width=n+"%"}},v.send(c),[2]}}))}))},qe=function(e,t,n){var r,i=(0,b.F9)(t.startContainer);if(i||(i=e.wysiwyg.element),n&&"formatItalic"!==n.inputType&&"deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType&&"formatBold"!==n.inputType&&"formatRemove"!==n.inputType&&"formatStrikeThrough"!==n.inputType&&"insertUnorderedList"!==n.inputType&&"insertOrderedList"!==n.inputType&&"formatOutdent"!==n.inputType&&"formatIndent"!==n.inputType&&""!==n.inputType||!n){var a=function(e){for(var t=e.previousSibling;t;){if(3!==t.nodeType&&"A"===t.tagName&&!t.previousSibling&&""===t.innerHTML.replace(o.g.ZWSP,"")&&t.nextSibling)return t;t=t.previousSibling}return!1}(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach((function(e){e.remove()})),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),i.querySelectorAll(".vditor-comment").forEach((function(e){""===e.textContent.trim()&&(e.classList.remove("vditor-comment","vditor-comment--focus"),e.removeAttribute("data-cmtids"))})),null===(r=i.previousElementSibling)||void 0===r||r.querySelectorAll(".vditor-comment").forEach((function(e){""===e.textContent.trim()&&(e.classList.remove("vditor-comment","vditor-comment--focus"),e.removeAttribute("data-cmtids"))}));var l="";"link-ref-defs-block"===i.getAttribute("data-type")&&(i=e.wysiwyg.element);var s,c=i.isEqualNode(e.wysiwyg.element),d=(0,b.a1)(i,"data-type","footnotes-block");if(c)l=i.innerHTML;else{var u=(0,b.O9)(t.startContainer);if(u&&!d){var p=(0,w.S)(t.startContainer,"BLOCKQUOTE");i=p?(0,b.F9)(t.startContainer)||i:u}if(d&&(i=d),l=i.outerHTML,"UL"===i.tagName||"OL"===i.tagName){var m=i.previousElementSibling,f=i.nextElementSibling;!m||"UL"!==m.tagName&&"OL"!==m.tagName||(l=m.outerHTML+l,m.remove()),!f||"UL"!==f.tagName&&"OL"!==f.tagName||(l+=f.outerHTML,f.remove()),l=l.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach((function(e){e&&!i.isEqualNode(e)&&(l+=e.outerHTML,e.remove())})),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach((function(e){e&&!i.isEqualNode(e)&&(l+=e.outerHTML,e.remove())}))}if('<p data-block="0">```<wbr></p>'===(l=l.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,""))&&e.hint.recentLanguage&&(l='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),e.options.debugger,l=e.lute.SpinVditorDOM(l),e.options.debugger,c)i.innerHTML=l;else if(i.outerHTML=l,d){var h=(0,b.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(h){var v=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+h.getAttribute("data-marker")+'"]');v&&v.setAttribute("aria-label",h.textContent.trim().substr(0,24))}}var g,y=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");y.forEach((function(e,t){0===t?s=e:(s.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),y.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",y[0]);var E=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");E.forEach((function(e,t){0===t?g=e:(g.insertAdjacentHTML("beforeend",e.innerHTML),e.remove())})),E.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",E[0]),(0,N.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach((function(t){H(t,e)})),n&&("deleteContentBackward"===n.inputType||"deleteContentForward"===n.inputType)&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}D(e),Z(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},Ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function l(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((r=r.apply(e,t||[])).next())}))},We=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(l){o=[6,l],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}},Ve=function(e,t,n){if(229===e.keyCode&&""===e.code&&"Unidentified"===e.key&&"sv"!==t.currentMode){var r=(0,b.F9)(n);if(r&&""===r.textContent.trim())return t[t.currentMode].composingLock=!0,!1}return!0},Ke=function(e,t,n){if(!("Enter"===n.key||"Tab"===n.key||"Backspace"===n.key||n.key.indexOf("Arrow")>-1||(0,d.yl)(n)||"Escape"===n.key||n.shiftKey||n.altKey)){var r=(0,b.lG)(e.startContainer,"P")||(0,b.lG)(e.startContainer,"LI");if(r&&0===(0,N.im)(r,t[t.currentMode].element,e).start){var i=document.createTextNode(o.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},Ge=function(e,t){if("ArrowDown"===t||"ArrowUp"===t){var n=(0,b.a1)(e.startContainer,"data-type","math-inline")||(0,b.a1)(e.startContainer,"data-type","html-entity")||(0,b.a1)(e.startContainer,"data-type","html-inline");n&&("ArrowDown"===t&&e.setStartAfter(n.parentElement),"ArrowUp"===t&&e.setStartBefore(n.parentElement))}},ze=function(e,t){var n=(0,N.zh)(e),r=(0,b.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'+o.g.ZWSP+"<wbr>\n</p>"),(0,N.ib)(e[e.currentMode].element,n),de(e),it(e))},Fe=function(e){var t=(0,b.lG)(e,"TABLE");return!(!t||!t.rows[0].cells[0].isSameNode(e))&&t},Ze=function(e){var t=(0,b.lG)(e,"TABLE");return!(!t||!t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e))&&t},Je=function(e,t,n){void 0===n&&(n=!0);var r=e.previousElementSibling;return r||(r=e.parentElement.previousElementSibling?e.parentElement.previousElementSibling.lastElementChild:"TBODY"===e.parentElement.parentElement.tagName&&e.parentElement.parentElement.previousElementSibling?e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:null),r&&(t.selectNodeContents(r),n||t.collapse(!1),(0,N.Hc)(t)),r},Xe=function(e,t,n,r,i){var a=(0,N.im)(r,e[e.currentMode].element,n);if("ArrowDown"===t.key&&-1===r.textContent.trimRight().substr(a.start).indexOf("\n")||"ArrowRight"===t.key&&a.start>=r.textContent.trimRight().length){var l=i.nextElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'+o.g.ZWSP+"<wbr></p>"),(0,N.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(l),n.collapse(!0),(0,N.Hc)(n)),t.preventDefault(),!0}return!1},Ye=function(e,t,n,r,i){var a=(0,N.im)(r,e[e.currentMode].element,n);if("ArrowUp"===t.key&&-1===r.textContent.substr(0,a.start).indexOf("\n")||("ArrowLeft"===t.key||"Backspace"===t.key&&""===n.toString())&&0===a.start){var l=i.previousElementSibling;return!l||l&&("TABLE"===l.tagName||l.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'+o.g.ZWSP+"<wbr></p>"),(0,N.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(l),n.collapse(!1),(0,N.Hc)(n)),t.preventDefault(),!0}return!1},$e=function(e,t,n,r){void 0===r&&(r=!0);var i=(0,b.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),t.insertNode(document.createElement("wbr")),r&&i){for(var o="",a=0;a<i.parentElement.childElementCount;a++){var l=i.parentElement.children[a].querySelector("input");l&&l.remove(),o+='<p data-block="0">'+i.parentElement.children[a].innerHTML.trimLeft()+"</p>"}i.parentElement.insertAdjacentHTML("beforebegin",o),i.parentElement.remove()}else if(i)if("check"===n)i.parentElement.querySelectorAll("li").forEach((function(e){e.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'+(0===e.textContent.indexOf(" ")?"":" ")),e.classList.add("vditor-task")}));else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach((function(e){e.querySelector("input").remove(),e.classList.remove("vditor-task")}));var s=void 0;(s="list"===n?document.createElement("ul"):document.createElement("ol")).innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(s,i.parentElement)}else{var c=(0,b.a1)(t.startContainer,"data-block","0");c||(e[e.currentMode].element.querySelector("wbr").remove(),(c=e[e.currentMode].element.querySelector("p")).innerHTML="<wbr>"),"check"===n?(c.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '+c.innerHTML+"</li></ul>"),c.remove()):"list"===n?(c.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'+c.innerHTML+"</li></ul>"),c.remove()):"ordered-list"===n&&(c.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'+c.innerHTML+"</li></ol>"),c.remove())}},Qe=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach((function(e,n){3!==e.nodeType&&t&&""!==e.textContent.trim()&&t.getAttribute("data-node-id")===e.getAttribute("data-node-id")&&(0!==n&&i.push(t),t=t.nextElementSibling)})),e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr"));var o=r.parentElement,a="";i.forEach((function(e){var t=e.getAttribute("data-marker");1!==t.length&&(t="1"+t.slice(-1)),a+='<li data-node-id="'+e.getAttribute("data-node-id")+'" data-marker="'+t+'">'+e.innerHTML+"</li>",e.remove()})),r.insertAdjacentHTML("beforeend","<"+o.tagName+' data-block="0">'+a+"</"+o.tagName+">"),"wysiwyg"===e.currentMode?o.outerHTML=e.lute.SpinVditorDOM(o.outerHTML):o.outerHTML=e.lute.SpinVditorIRDOM(o.outerHTML),(0,N.ib)(e[e.currentMode].element,n);var l=(0,b.O9)(n.startContainer);l&&l.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){H(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),it(e),de(e)}else e[e.currentMode].element.focus()},et=function(e,t,n,r){var i=(0,b.lG)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),n.insertNode(document.createElement("wbr"));var o=t.parentElement,a=o.cloneNode(),l=[t];Array.from(n.cloneContents().children).forEach((function(e,n){3!==e.nodeType&&t&&""!==e.textContent.trim()&&t.getAttribute("data-node-id")===e.getAttribute("data-node-id")&&(0!==n&&l.push(t),t=t.nextElementSibling)}));var s=!1,c="";o.querySelectorAll("li").forEach((function(e){s&&(c+=e.outerHTML,e.nextElementSibling||e.previousElementSibling?e.remove():e.parentElement.remove()),e.isSameNode(l[l.length-1])&&(s=!0)})),l.reverse().forEach((function(e){i.insertAdjacentElement("afterend",e)})),c&&(a.innerHTML=c,l[0].insertAdjacentElement("beforeend",a)),"wysiwyg"===e.currentMode?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,N.ib)(e[e.currentMode].element,n);var d=(0,b.O9)(n.startContainer);d&&d.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){H(t,e),"wysiwyg"===e.currentMode&&t.previousElementSibling.setAttribute("style","display:none")})),it(e),de(e)}else e[e.currentMode].element.focus()},tt=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,o=0,a=0;a<i;a++)for(var l=0;l<r;l++)if(e.rows[a].cells[l].isSameNode(n)){o=l;break}for(var s=0;s<i;s++)e.rows[s].cells[o].setAttribute("align",t)},nt=function(e){var t=e.trimRight().split("\n").pop();return""!==t&&(""===t.replace(/ |-/g,"")||""===t.replace(/ |_/g,"")||""===t.replace(/ |\*/g,""))&&t.replace(/ /g,"").length>2&&!(t.indexOf("-")>-1&&-1===t.trimLeft().indexOf(" ")&&e.trimRight().split("\n").length>1)&&0!==t.indexOf("    ")&&0!==t.indexOf("\t")},rt=function(e){var t=e.trimRight().split("\n");return 0!==(e=t.pop()).indexOf("    ")&&0!==e.indexOf("\t")&&""!==(e=e.trimLeft())&&0!==t.length&&(""===e.replace(/-/g,"")||""===e.replace(/=/g,""))},it=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),"wysiwyg"===e.currentMode?Z(e,t):"ir"===e.currentMode?kt(e,t):"sv"===e.currentMode&&He(e,t)},ot=function(e,t,n,r){var i,a=e.startContainer,l=(0,b.lG)(a,"LI");if(l){if(!(0,d.yl)(r)&&!r.altKey&&"Enter"===r.key&&!r.shiftKey&&n&&l.contains(n)&&n.nextElementSibling)return l&&!l.textContent.endsWith("\n")&&l.insertAdjacentText("beforeend","\n"),e.insertNode(document.createTextNode("\n\n")),e.collapse(!1),it(t),r.preventDefault(),!0;if(!((0,d.yl)(r)||r.shiftKey||r.altKey||"Backspace"!==r.key||l.previousElementSibling||""!==e.toString()||0!==(0,N.im)(l,t[t.currentMode].element,e).start))return l.nextElementSibling?(l.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'+l.innerHTML+"</p>"),l.remove()):l.parentElement.outerHTML='<p data-block="0"><wbr>'+l.innerHTML+"</p>",(0,N.ib)(t[t.currentMode].element,e),it(t),r.preventDefault(),!0;if(!(0,d.yl)(r)&&!r.shiftKey&&!r.altKey&&"Backspace"===r.key&&""===l.textContent.trim().replace(o.g.ZWSP,"")&&""===e.toString()&&"LI"===(null===(i=l.previousElementSibling)||void 0===i?void 0:i.tagName))return l.previousElementSibling.insertAdjacentText("beforeend","\n\n"),e.selectNodeContents(l.previousElementSibling),e.collapse(!1),l.remove(),(0,N.ib)(t[t.currentMode].element,e),it(t),r.preventDefault(),!0;if(!(0,d.yl)(r)&&!r.altKey&&"Tab"===r.key){var s=!1;if((0===e.startOffset&&(3===a.nodeType&&!a.previousSibling||3!==a.nodeType&&"LI"===a.nodeName)||l.classList.contains("vditor-task")&&1===e.startOffset&&3!==a.previousSibling.nodeType&&"INPUT"===a.previousSibling.tagName)&&(s=!0),s||""!==e.toString())return r.shiftKey?et(t,l,e,l.parentElement):Qe(t,l,e),r.preventDefault(),!0}}return!1},at=function(e,t,n){if(e.options.tab&&"Tab"===n.key)return n.shiftKey||(""===t.toString()?(t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1)):(t.extractContents(),t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1))),(0,N.Hc)(t),it(e),n.preventDefault(),!0},lt=function(e,n,r,i){if(r){if(!(0,d.yl)(e)&&!e.altKey&&"Enter"===e.key){var o=String.raw(t||(u=["",""],p=["",""],Object.defineProperty?Object.defineProperty(u,"raw",{value:p}):u.raw=p,t=u),r.textContent).replace(/\\\|/g,"").trim(),a=o.split("|");if(o.startsWith("|")&&o.endsWith("|")&&a.length>3){var l=a.map((function(){return"---"})).join("|");return l=r.textContent+"\n"+l.substring(3,l.length-3)+"\n|<wbr>",r.outerHTML=n.lute.SpinVditorDOM(l),(0,N.ib)(n[n.currentMode].element,i),it(n),Le(n),e.preventDefault(),!0}if(nt(r.innerHTML)&&r.previousElementSibling){var s="",c=r.innerHTML.trimRight().split("\n");return c.length>1&&(c.pop(),s='<p data-block="0">'+c.join("\n")+"</p>"),r.insertAdjacentHTML("afterend",s+'<hr data-block="0"><p data-block="0"><wbr>\n</p>'),r.remove(),(0,N.ib)(n[n.currentMode].element,i),it(n),Le(n),e.preventDefault(),!0}if(rt(r.innerHTML))return"wysiwyg"===n.currentMode?r.outerHTML=n.lute.SpinVditorDOM(r.innerHTML+'<p data-block="0"><wbr>\n</p>'):r.outerHTML=n.lute.SpinVditorIRDOM(r.innerHTML+'<p data-block="0"><wbr>\n</p>'),(0,N.ib)(n[n.currentMode].element,i),it(n),Le(n),e.preventDefault(),!0}var u,p;if(i.collapsed&&r.previousElementSibling&&"Backspace"===e.key&&!(0,d.yl)(e)&&!e.altKey&&!e.shiftKey&&r.textContent.trimRight().split("\n").length>1&&0===(0,N.im)(r,n[n.currentMode].element,i).start){var m=(0,b.DX)(r.previousElementSibling);return m.textContent.endsWith("\n")||(m.textContent=m.textContent+"\n"),m.parentElement.insertAdjacentHTML("beforeend","<wbr>"+r.innerHTML),r.remove(),(0,N.ib)(n[n.currentMode].element,i),!1}return!1}},st=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)r+='<td align="'+n.parentElement.children[i].getAttribute("align")+'"> </td>';"TH"===n.tagName?n.parentElement.parentElement.insertAdjacentHTML("afterend","<tbody><tr>"+r+"</tr></tbody>"):n.parentElement.insertAdjacentHTML("afterend","<tr>"+r+"</tr>"),it(e)},ct=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)"TH"===n.tagName?r+='<th align="'+n.parentElement.children[i].getAttribute("align")+'"> </th>':r+='<td align="'+n.parentElement.children[i].getAttribute("align")+'"> </td>';if("TH"===n.tagName){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>"+r+"</tr></thead>"),t.insertNode(document.createElement("wbr"));var o=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",o),n.parentElement.parentElement.remove(),(0,N.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>"+r+"</tr>");it(e)},dt=function(e,t,n,r){void 0===r&&(r="afterend");for(var i=0,o=n.previousElementSibling;o;)i++,o=o.previousElementSibling;for(var a=0;a<t.rows.length;a++)0===a?t.rows[a].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[a].cells[i].insertAdjacentHTML(r,"<td> </td>");it(e)},ut=function(e,t,n){if("TD"===n.tagName){var r=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(r.previousElementSibling.lastElementChild.lastElementChild),1===r.childElementCount?r.remove():n.parentElement.remove(),t.collapse(!1),(0,N.Hc)(t),it(e)}},pt=function(e,t,n,r){for(var i=0,o=r.previousElementSibling;o;)i++,o=o.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var a=0;a<n.rows.length;a++){var l=n.rows[a].cells;if(1===l.length){n.remove(),de(e);break}l[i].remove()}(0,N.Hc)(t),it(e)},mt=function(e,t,n){var r=n.startContainer,i=(0,b.lG)(r,"TD")||(0,b.lG)(r,"TH");if(i){if(!(0,d.yl)(t)&&!t.altKey&&"Enter"===t.key){i.lastElementChild&&(!i.lastElementChild||i.lastElementChild.isSameNode(i.lastChild)&&"BR"===i.lastElementChild.tagName)||i.insertAdjacentHTML("beforeend","<br>");var o=document.createElement("br");return n.insertNode(o),n.setStartAfter(o),it(e),Le(e),t.preventDefault(),!0}if("Tab"===t.key)return t.shiftKey?(Je(i,n),t.preventDefault(),!0):((u=i.nextElementSibling)||(u=i.parentElement.nextElementSibling?i.parentElement.nextElementSibling.firstElementChild:"THEAD"===i.parentElement.parentElement.tagName&&i.parentElement.parentElement.nextElementSibling?i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:null),u&&(n.selectNodeContents(u),(0,N.Hc)(n)),t.preventDefault(),!0);var a=i.parentElement.parentElement.parentElement;if("ArrowUp"===t.key){if(t.preventDefault(),"TH"===i.tagName)return a.previousElementSibling?(n.selectNodeContents(a.previousElementSibling),n.collapse(!1),(0,N.Hc)(n)):ze(e,"beforebegin"),!0;for(var l=0,s=i.parentElement;l<s.cells.length&&!s.cells[l].isSameNode(i);l++);var c=s.previousElementSibling;return c||(c=s.parentElement.previousElementSibling.firstChild),n.selectNodeContents(c.cells[l]),n.collapse(!1),(0,N.Hc)(n),!0}if("ArrowDown"===t.key){var u;if(t.preventDefault(),!(s=i.parentElement).nextElementSibling&&"TD"===i.tagName)return a.nextElementSibling?(n.selectNodeContents(a.nextElementSibling),n.collapse(!0),(0,N.Hc)(n)):ze(e,"afterend"),!0;for(l=0;l<s.cells.length&&!s.cells[l].isSameNode(i);l++);return(u=s.nextElementSibling)||(u=s.parentElement.nextElementSibling.firstChild),n.selectNodeContents(u.cells[l]),n.collapse(!0),(0,N.Hc)(n),!0}if("wysiwyg"===e.currentMode&&!(0,d.yl)(t)&&"Enter"===t.key&&!t.shiftKey&&t.altKey){var p=e.wysiwyg.popover.querySelector(".vditor-input");return p.focus(),p.select(),t.preventDefault(),!0}if(!(0,d.yl)(t)&&!t.shiftKey&&!t.altKey&&"Backspace"===t.key&&0===n.startOffset&&""===n.toString())return!Je(i,n,!1)&&a&&(""===a.textContent.trim()?(a.outerHTML='<p data-block="0"><wbr>\n</p>',(0,N.ib)(e[e.currentMode].element,n)):(n.setStartBefore(a),n.collapse(!0)),it(e)),t.preventDefault(),!0;if(I("⇧⌘F",t))return ct(e,n,i),t.preventDefault(),!0;if(I("⌘=",t))return st(e,n,i),t.preventDefault(),!0;if(I("⇧⌘G",t))return dt(e,a,i,"beforebegin"),t.preventDefault(),!0;if(I("⇧⌘=",t))return dt(e,a,i),t.preventDefault(),!0;if(I("⌘-",t))return ut(e,n,i),t.preventDefault(),!0;if(I("⇧⌘-",t))return pt(e,n,a,i),t.preventDefault(),!0;if(I("⇧⌘L",t)){if("ir"===e.currentMode)return tt(a,"left"),it(e),t.preventDefault(),!0;if(m=e.wysiwyg.popover.querySelector('[data-type="left"]'))return m.click(),t.preventDefault(),!0}if(I("⇧⌘C",t)){if("ir"===e.currentMode)return tt(a,"center"),it(e),t.preventDefault(),!0;if(m=e.wysiwyg.popover.querySelector('[data-type="center"]'))return m.click(),t.preventDefault(),!0}if(I("⇧⌘R",t)){if("ir"===e.currentMode)return tt(a,"right"),it(e),t.preventDefault(),!0;var m;if(m=e.wysiwyg.popover.querySelector('[data-type="right"]'))return m.click(),t.preventDefault(),!0}}return!1},ft=function(e,t,n,r){if("PRE"===n.tagName&&I("⌘A",t))return r.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&"Tab"===t.key&&!t.shiftKey&&""===r.toString())return r.insertNode(document.createTextNode(e.options.tab)),r.collapse(!1),it(e),t.preventDefault(),!0;if("Backspace"===t.key&&!(0,d.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,N.im)(n,e[e.currentMode].element,r);if((0===i.start||1===i.start&&"\n"===n.innerText)&&""===r.toString())return n.parentElement.outerHTML='<p data-block="0"><wbr>'+n.firstElementChild.innerHTML+"</p>",(0,N.ib)(e[e.currentMode].element,r),it(e),t.preventDefault(),!0}return!(0,d.yl)(t)&&!t.altKey&&"Enter"===t.key&&(n.firstElementChild.textContent.endsWith("\n")||n.firstElementChild.insertAdjacentText("beforeend","\n"),r.extractContents(),r.insertNode(document.createTextNode("\n")),r.collapse(!1),(0,N.Hc)(r),(0,d.vU)()||("wysiwyg"===e.currentMode?qe(e,r):j(e,r)),Le(e),t.preventDefault(),!0)},ht=function(e,t,n,r){var i=t.startContainer,a=(0,b.lG)(i,"BLOCKQUOTE");if(a&&""===t.toString()){if("Backspace"===n.key&&!(0,d.yl)(n)&&!n.shiftKey&&!n.altKey&&0===(0,N.im)(a,e[e.currentMode].element,t).start)return t.insertNode(document.createElement("wbr")),a.outerHTML=a.innerHTML,(0,N.ib)(e[e.currentMode].element,t),it(e),n.preventDefault(),!0;if(r&&"Enter"===n.key&&!(0,d.yl)(n)&&!n.shiftKey&&!n.altKey&&"BLOCKQUOTE"===r.parentElement.tagName){var l=!1;if("\n"===r.innerHTML.replace(o.g.ZWSP,"")||""===r.innerHTML.replace(o.g.ZWSP,"")?(l=!0,r.remove()):r.innerHTML.endsWith("\n\n")&&(0,N.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),l=!0),l)return a.insertAdjacentHTML("afterend",'<p data-block="0">'+o.g.ZWSP+"<wbr>\n</p>"),(0,N.ib)(e[e.currentMode].element,t),it(e),n.preventDefault(),!0}var s=(0,b.F9)(i);if("wysiwyg"===e.currentMode&&s&&I("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),s.outerHTML='<blockquote data-block="0">'+s.outerHTML+"</blockquote>",(0,N.ib)(e.wysiwyg.element,t),Z(e),n.preventDefault(),!0;if(Xe(e,n,t,a,a))return!0;if(Ye(e,n,t,a,a))return!0}return!1},vt=function(e,t,n){var r=t.startContainer,i=(0,b.fb)(r,"vditor-task");if(i){if(I("⇧⌘J",n)){var o=i.firstElementChild;return o.checked?o.removeAttribute("checked"):o.setAttribute("checked","checked"),it(e),n.preventDefault(),!0}if("Backspace"===n.key&&!(0,d.yl)(n)&&!n.shiftKey&&!n.altKey&&""===t.toString()&&1===t.startOffset&&(3===r.nodeType&&r.previousSibling&&"INPUT"===r.previousSibling.tagName||3!==r.nodeType)){var a=i.previousElementSibling;return i.querySelector("input").remove(),a?((0,b.DX)(a).parentElement.insertAdjacentHTML("beforeend","<wbr>"+i.innerHTML.trim()),i.remove()):(i.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'+(i.innerHTML.trim()||"\n")+"</p>"),i.nextElementSibling?i.remove():i.parentElement.remove()),(0,N.ib)(e[e.currentMode].element,t),it(e),n.preventDefault(),!0}if("Enter"===n.key&&!(0,d.yl)(n)&&!n.shiftKey&&!n.altKey){if(""===i.textContent.trim())if((0,b.fb)(i.parentElement,"vditor-task")){var l=(0,b.O9)(r);l&&et(e,i,t,l)}else if(i.nextElementSibling){var s="",c="",u=!1;Array.from(i.parentElement.children).forEach((function(e){i.isSameNode(e)?u=!0:u?s+=e.outerHTML:c+=e.outerHTML}));var p=i.parentElement.tagName,m="OL"===i.parentElement.tagName?"":' data-marker="'+i.parentElement.getAttribute("data-marker")+'"',f="";c&&(f="UL"===i.parentElement.tagName?"":' start="1"',c="<"+p+' data-tight="true"'+m+' data-block="0">'+c+"</"+p+">"),i.parentElement.outerHTML=c+'<p data-block="0"><wbr>\n</p><'+p+'\n data-tight="true"'+m+' data-block="0"'+f+">"+s+"</"+p+">"}else i.parentElement.insertAdjacentHTML("afterend",'<p data-block="0"><wbr>\n</p>'),1===i.parentElement.querySelectorAll("li").length?i.parentElement.remove():i.remove();else 3!==r.nodeType&&0===t.startOffset&&"INPUT"===r.firstChild.tagName?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'+i.getAttribute("data-marker")+'"><input type="checkbox"> <wbr></li>'),document.querySelector("wbr").after(t.extractContents()));return(0,N.ib)(e[e.currentMode].element,t),it(e),Le(e),n.preventDefault(),!0}}return!1},gt=function(e,t,n,r){if(3!==t.startContainer.nodeType){var i=t.startContainer.children[t.startOffset];if(i&&"HR"===i.tagName)return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var o=r.previousElementSibling;if(o&&0===(0,N.im)(r,e[e.currentMode].element,t).start&&((0,d.vU)()&&"HR"===o.tagName||"TABLE"===o.tagName)){if("TABLE"===o.tagName){var a=o.lastElementChild.lastElementChild.lastElementChild;a.innerHTML=a.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else o.remove();return(0,N.ib)(e[e.currentMode].element,t),it(e),n.preventDefault(),!0}}return!1},yt=function(e){(0,d.vU)()&&3!==e.startContainer.nodeType&&"HR"===e.startContainer.tagName&&e.setStartBefore(e.startContainer)},bt=function(e,t,n){var r,i;if(!(0,d.vU)())return!1;if("ArrowUp"===e.key&&t&&"TABLE"===(null===(r=t.previousElementSibling)||void 0===r?void 0:r.tagName)){var o=t.previousElementSibling;return n.selectNodeContents(o.rows[o.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return!("ArrowDown"!==e.key||!t||"TABLE"!==(null===(i=t.nextElementSibling)||void 0===i?void 0:i.tagName)||(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),0))},wt=function(e,t,n){return Ue(void 0,void 0,void 0,(function(){var r,i,a,l,s,c,d,u,p,m,f,h,v,g;return We(this,(function(y){switch(y.label){case 0:return 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"),"Files"===t.dataTransfer.types[0]&&(a=t.dataTransfer.items)),l={},s=function(t,n){if(!n)return["",Lute.WalkContinue];var r=t.TokensStr();if(34===t.__internal_object__.Parent.Type&&r&&-1===r.indexOf("file://")&&e.options.upload.linkToImgUrl){var i=new XMLHttpRequest;i.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&i.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(i.withCredentials=!0),Re(e,i),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){if(200===i.status){var t=i.responseText;e.options.upload.linkToImgFormat&&(t=e.options.upload.linkToImgFormat(i.responseText));var n=JSON.parse(t);if(0!==n.code)return void e.tip.show(n.msg);var r=n.data.originalURL;if("sv"===e.currentMode)e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach((function(e){e.textContent===r&&(e.textContent=n.data.url)}));else{var o=e[e.currentMode].element.querySelector('img[src="'+r+'"]');o.src=n.data.url,"ir"===e.currentMode&&(o.previousElementSibling.previousElementSibling.innerHTML=n.data.url)}it(e)}else e.tip.show(i.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(i.responseText)}},i.send(JSON.stringify({url:r}))}return"ir"===e.currentMode?['<span class="vditor-ir__marker vditor-ir__marker--link">'+r+"</span>",Lute.WalkContinue]:"wysiwyg"===e.currentMode?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'+r+"</span>",Lute.WalkContinue]},r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='<a href="'+i+'">'+i+"</a>"&&r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='\x3c!--StartFragment--\x3e<a href="'+i+'">'+i+"</a>\x3c!--EndFragment--\x3e"||(r=""),(c=(new DOMParser).parseFromString(r,"text/html")).body&&(r=c.body.innerHTML),e.wysiwyg.getComments(e),d=e[e.currentMode].element.scrollHeight,u=function(e,t,n){void 0===n&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var i=!1;1===r.childElementCount&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(i=!0);var o=r.querySelectorAll("pre");if(1===r.childElementCount&&1===o.length&&"vditor-wysiwyg"!==o[0].className&&"vditor-sv"!==o[0].className&&(i=!0),0===e.indexOf('\n<p class="p1">')&&(i=!0),1===r.childElementCount&&"TABLE"===r.firstElementChild.tagName&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var a=t||e;return/\n/.test(a)||1===o.length?"wysiwyg"===n?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'+a.replace(/&/g,"&amp;").replace(/</g,"&lt;")+"<wbr></code></pre></div>":"\n```\n"+a.replace(/&/g,"&amp;").replace(/</g,"&lt;")+"\n```":"wysiwyg"===n?"<code>"+a.replace(/&/g,"&amp;").replace(/</g,"&lt;")+"</code><wbr>":"`"+a+"`"}return!1}(r,i,e.currentMode),(p="sv"===e.currentMode?(0,b.a1)(t.target,"data-type","code-block"):(0,b.lG)(t.target,"CODE"))?("sv"===e.currentMode?document.execCommand("insertHTML",!1,i.replace(/&/g,"&amp;").replace(/</g,"&lt;")):(m=(0,N.im)(t.target,e[e.currentMode].element),"PRE"!==p.parentElement.tagName&&(i+=o.g.ZWSP),p.textContent=p.textContent.substring(0,m.start)+i+p.textContent.substring(m.end),(0,N.$j)(m.start+i.length,m.start+i.length,p.parentElement),(null===(g=p.parentElement)||void 0===g?void 0:g.nextElementSibling.classList.contains("vditor-"+e.currentMode+"__preview"))&&(p.parentElement.nextElementSibling.innerHTML=p.outerHTML,H(p.parentElement.nextElementSibling,e))),[3,6]):[3,1];case 1:return u?(n.pasteCode(u),[3,6]):[3,2];case 2:return""===r.trim()?[3,3]:((f=document.createElement("div")).innerHTML=r,f.querySelectorAll("[style]").forEach((function(e){e.removeAttribute("style")})),f.querySelectorAll(".vditor-copy").forEach((function(e){e.remove()})),"ir"===e.currentMode?(l.HTML2VditorIRDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.oC)(e.lute.HTML2VditorIRDOM(f.innerHTML),e)):"wysiwyg"===e.currentMode?(l.HTML2VditorDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.oC)(e.lute.HTML2VditorDOM(f.innerHTML),e)):(l.Md2VditorSVDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Me(e,e.lute.HTML2Md(f.innerHTML).trimRight())),e.outline.render(e),[3,6]);case 3:return a.length>0&&e.options.upload.url?[4,Be(e,a)]:[3,5];case 4:return y.sent(),[3,6];case 5:""!==i.trim()&&0===a.length&&("ir"===e.currentMode?(l.Md2VditorIRDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.oC)(e.lute.Md2VditorIRDOM(i),e)):"wysiwyg"===e.currentMode?(l.Md2VditorDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),(0,N.oC)(e.lute.Md2VditorDOM(i),e)):(l.Md2VditorSVDOM={renderLinkDest:s},e.lute.SetJSRenderers({renderers:l}),Me(e,i)),e.outline.render(e)),y.label=6;case 6:return"sv"!==e.currentMode&&((h=(0,b.F9)((0,N.zh)(e).startContainer))&&(v=(0,N.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach((function(e){e.remove()})),v.insertNode(document.createElement("wbr")),"wysiwyg"===e.currentMode?h.outerHTML=e.lute.SpinVditorDOM(h.outerHTML):h.outerHTML=e.lute.SpinVditorIRDOM(h.outerHTML),(0,N.ib)(e[e.currentMode].element,v)),e[e.currentMode].element.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach((function(t){H(t,e)}))),e.wysiwyg.triggerRemoveComment(e),it(e),e[e.currentMode].element.scrollHeight-d>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&Le(e),[2]}}))}))},Et=function(e){e.hint.render(e);var t=(0,N.zh)(e).startContainer,n=(0,b.a1)(t,"data-type","code-block-info");if(n)if(""===n.textContent.replace(o.g.ZWSP,"")&&e.hint.recentLanguage)n.textContent=o.g.ZWSP+e.hint.recentLanguage,(0,N.zh)(e).selectNodeContents(n);else{var r=[],i=n.textContent.substring(0,(0,N.im)(n,e.ir.element).start).replace(o.g.ZWSP,"");o.g.CODE_LANGUAGES.forEach((function(e){e.indexOf(i.toLowerCase())>-1&&r.push({html:e,value:e})})),e.hint.genHTML(r,i,e)}},kt=function(e,t){void 0===t&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&Et(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout((function(){if(!e.ir.composingLock){var n=l(e);"function"==typeof e.options.input&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,d.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)},St=function(e,t){var n=(0,N.zh)(e),r=(0,b.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)),j(e,n.cloneRange()),F(e)}},Lt=function(e,t,n){var r=(0,b.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()}},Ct=function(e,t,n,r){var i=(0,N.zh)(e),o=t.getAttribute("data-type"),a=i.startContainer;3===a.nodeType&&(a=a.parentElement);var l=!0;if(t.classList.contains("vditor-menu--current"))if("quote"===o){var s=(0,b.lG)(a,"BLOCKQUOTE");s&&(i.insertNode(document.createElement("wbr")),s.outerHTML=""===s.innerHTML.trim()?'<p data-block="0">'+s.innerHTML+"</p>":s.innerHTML)}else if("link"===o){var c=(0,b.a1)(i.startContainer,"data-type","a");if(c){var d=(0,b.fb)(i.startContainer,"vditor-ir__link");d?(i.insertNode(document.createElement("wbr")),c.outerHTML=d.innerHTML):c.outerHTML=c.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else"italic"===o?Lt(i,e,"em"):"bold"===o?Lt(i,e,"strong"):"strike"===o?Lt(i,e,"s"):"inline-code"===o?Lt(i,e,"code"):"check"!==o&&"list"!==o&&"ordered-list"!==o||($e(e,i,o),l=!1,t.classList.remove("vditor-menu--current"));else{0===e.ir.element.childNodes.length&&(e.ir.element.innerHTML='<p data-block="0"><wbr></p>',(0,N.ib)(e.ir.element,i));var p=(0,b.F9)(i.startContainer);if("line"===o){if(p){var m='<hr data-block="0"><p data-block="0"><wbr>\n</p>';""===p.innerHTML.trim()?p.outerHTML=m:p.insertAdjacentHTML("afterend",m)}}else if("quote"===o)p&&(i.insertNode(document.createElement("wbr")),p.outerHTML='<blockquote data-block="0">'+p.outerHTML+"</blockquote>",l=!1,t.classList.add("vditor-menu--current"));else if("link"===o){var f=void 0;f=""===i.toString()?n+"<wbr>"+r:""+n+i.toString()+r.replace(")","<wbr>)"),document.execCommand("insertHTML",!1,f),l=!1,t.classList.add("vditor-menu--current")}else if("italic"===o||"bold"===o||"strike"===o||"inline-code"===o||"code"===o||"table"===o){f=void 0,""===i.toString()?f=n+"<wbr>"+r:(f="code"===o||"table"===o?""+n+i.toString()+"<wbr>"+r:""+n+i.toString()+r+"<wbr>",i.deleteContents()),"table"!==o&&"code"!==o||(f="\n"+f+"\n\n");var h=document.createElement("span");h.innerHTML=f,i.insertNode(h),j(e,i),"table"===o&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,N.Hc)(i))}else"check"!==o&&"list"!==o&&"ordered-list"!==o||($e(e,i,o,!1),l=!1,u(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,N.ib)(e.ir.element,i),kt(e),l&&F(e)},Tt=function(){function e(e){var t=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(e,n){t.element.style.display="none";var r=decodeURIComponent(e.getAttribute("data-value")),i=window.getSelection().getRangeAt(0);if("ir"===n.currentMode){var a=(0,b.a1)(i.startContainer,"data-type","code-block-info");if(a)return a.textContent=o.g.ZWSP+r.trimRight(),i.selectNodeContents(a),i.collapse(!1),kt(n),a.parentElement.querySelectorAll("code").forEach((function(e){e.className="language-"+r.trimRight()})),H(a.parentElement.querySelector(".vditor-ir__preview"),n),void(t.recentLanguage=r.trimRight())}if("wysiwyg"===n.currentMode&&3!==i.startContainer.nodeType&&i.startContainer.firstElementChild.classList.contains("vditor-input")){var l=i.startContainer.firstElementChild;return l.value=r.trimRight(),i.selectNodeContents(l),i.collapse(!1),l.dispatchEvent(new CustomEvent("input")),void(t.recentLanguage=r.trimRight())}if(i.setStart(i.startContainer,t.lastIndex),i.deleteContents(),n.options.hint.parse?"sv"===n.currentMode?(0,N.oC)(n.lute.SpinVditorSVDOM(r),n):"wysiwyg"===n.currentMode?(0,N.oC)(n.lute.SpinVditorDOM(r),n):(0,N.oC)(n.lute.SpinVditorIRDOM(r),n):(0,N.oC)(r,n),":"===t.splitChar&&r.indexOf(":")>-1&&"sv"!==n.currentMode&&i.insertNode(document.createTextNode(" ")),i.collapse(!1),(0,N.Hc)(i),"wysiwyg"===n.currentMode)(s=(0,b.fb)(i.startContainer,"vditor-wysiwyg__block"))&&s.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(s.lastElementChild.innerHTML=s.firstElementChild.innerHTML,H(s.lastElementChild,n));else if("ir"===n.currentMode){var s;(s=(0,b.fb)(i.startContainer,"vditor-ir__marker--pre"))&&s.nextElementSibling.classList.contains("vditor-ir__preview")&&(s.nextElementSibling.innerHTML=s.innerHTML,H(s.nextElementSibling,n))}it(n)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage="",e.push({key:":"})}return e.prototype.render=function(e){var t=this;if(window.getSelection().focusNode){var n,r=getSelection().getRangeAt(0);n=r.startContainer.textContent.substring(0,r.startOffset)||"";var i=this.getKey(n,e.options.hint.extend);if(void 0===i)this.element.style.display="none",clearTimeout(this.timeId);else if(":"===this.splitChar){var o=""===i?e.options.hint.emoji:e.lute.GetEmojis(),a=[];Object.keys(o).forEach((function(e){0===e.indexOf(i.toLowerCase())&&(o[e].indexOf(".")>-1?a.push({html:'<img src="'+o[e]+'" title=":'+e+':"/> :'+e+":",value:":"+e+":"}):a.push({html:'<span class="vditor-hint__emoji">'+o[e]+"</span>"+e,value:o[e]}))})),this.genHTML(a,i,e)}else e.options.hint.extend.forEach((function(n){n.key===t.splitChar&&(clearTimeout(t.timeId),t.timeId=window.setTimeout((function(){t.genHTML(n.hint(i),i,e)}),e.options.hint.delay))}))}},e.prototype.genHTML=function(e,t,n){var r=this;if(0!==e.length){var i=n[n.currentMode].element,o=(0,N.Ny)(i),a=o.left+("left"===n.options.outline.position?n.outline.element.offsetWidth:0),l=o.top,s="";e.forEach((function(e,n){if(!(n>7)){var r=e.html;if(""!==t){var i=r.lastIndexOf(">")+1,o=r.substr(i),a=o.toLowerCase().indexOf(t.toLowerCase());a>-1&&(o=o.substring(0,a)+"<b>"+o.substring(a,a+t.length)+"</b>"+o.substring(a+t.length),r=r.substr(0,i)+o)}s+='<button data-value="'+encodeURIComponent(e.value)+' "\n'+(0===n?"class='vditor-hint--current'":"")+"> "+r+"</button>"}})),this.element.innerHTML=s;var c=parseInt(document.defaultView.getComputedStyle(i,null).getPropertyValue("line-height"),10);this.element.style.top=l+(c||22)+"px",this.element.style.left=a+"px",this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach((function(e){e.addEventListener("click",(function(t){r.fillEmoji(e,n),t.preventDefault()}))})),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top=l-this.element.offsetHeight+"px"),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")}else this.element.style.display="none"},e.prototype.select=function(e,t){if(0===this.element.querySelectorAll("button").length||"none"===this.element.style.display)return!1;var n=this.element.querySelector(".vditor-hint--current");if("ArrowDown"===e.key)return e.preventDefault(),e.stopPropagation(),n.removeAttribute("class"),n.nextElementSibling?n.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if("ArrowUp"===e.key){if(e.preventDefault(),e.stopPropagation(),n.removeAttribute("class"),n.previousElementSibling)n.previousElementSibling.className="vditor-hint--current";else{var r=this.element.children.length;this.element.children[r-1].className="vditor-hint--current"}return!0}return!((0,d.yl)(e)||e.shiftKey||e.altKey||"Enter"!==e.key||e.isComposing||(e.preventDefault(),e.stopPropagation(),this.fillEmoji(n,t),0))},e.prototype.getKey=function(e,t){var n,r=this;if(this.lastIndex=-1,this.splitChar="",t.forEach((function(t){var n=e.lastIndexOf(t.key);r.lastIndex<n&&(r.splitChar=t.key,r.lastIndex=n)})),-1===this.lastIndex)return n;var i=e.split(this.splitChar),o=i[i.length-1];if(i.length>1&&o.trim()===o)if(2===i.length&&""===i[0]&&i[1].length<32)n=i[1];else{var l=i[i.length-2].slice(-1);" "===(0,a.X)(l)&&o.length<32&&(n=o)}return n},e}(),Mt=function(){function e(e){this.composingLock=!1;var t=document.createElement("div");t.className="vditor-ir",t.innerHTML='<pre class="vditor-reset" placeholder="'+e.options.placeholder+'"\n contenteditable="true" spellcheck="false"></pre>',this.element=t.firstElementChild,this.bindEvent(e),ye(e,this.element),be(e,this.element),we(e,this.element),Ce(e,this.element),Te(e,this.element),Ee(e,this.element),ke(e,this.element,this.copy),Se(e,this.element,this.copy)}return e.prototype.copy=function(e,t){var n=getSelection().getRangeAt(0);if(""!==n.toString()){e.stopPropagation(),e.preventDefault();var r=document.createElement("div");r.appendChild(n.cloneContents()),e.clipboardData.setData("text/plain",t.lute.VditorIRDOM2Md(r.innerHTML).trim()),e.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("paste",(function(t){wt(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})})),this.element.addEventListener("compositionstart",(function(e){t.composingLock=!0})),this.element.addEventListener("compositionend",(function(n){(0,d.vU)()||j(e,getSelection().getRangeAt(0).cloneRange()),t.composingLock=!1})),this.element.addEventListener("input",(function(n){"deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType&&(t.preventInput?t.preventInput=!1:t.composingLock||"‘"===n.data||"“"===n.data||"《"===n.data||j(e,getSelection().getRangeAt(0).cloneRange(),!1,n))})),this.element.addEventListener("click",(function(n){if("INPUT"===n.target.tagName)return n.target.checked?n.target.setAttribute("checked","checked"):n.target.removeAttribute("checked"),t.preventInput=!0,void kt(e);var r=(0,N.zh)(e),i=(0,b.fb)(n.target,"vditor-ir__preview");if(i||(i=(0,b.fb)(r.startContainer,"vditor-ir__preview")),i&&(i.previousElementSibling.firstElementChild?r.selectNodeContents(i.previousElementSibling.firstElementChild):r.selectNodeContents(i.previousElementSibling),r.collapse(!0),(0,N.Hc)(r),Le(e)),"IMG"===n.target.tagName){var a=n.target.parentElement.querySelector(".vditor-ir__marker--link");a&&(r.selectNode(a),(0,N.Hc)(r))}var l=(0,b.a1)(n.target,"data-type","a");if(!l||l.classList.contains("vditor-ir__node--expand")){if(n.target.isEqualNode(t.element)&&t.element.lastElementChild&&r.collapsed){var s=t.element.lastElementChild.getBoundingClientRect();n.y>s.top+s.height&&("P"===t.element.lastElementChild.tagName&&""===t.element.lastElementChild.textContent.trim().replace(o.g.ZWSP,"")?(r.selectNodeContents(t.element.lastElementChild),r.collapse(!1)):(t.element.insertAdjacentHTML("beforeend",'<p data-block="0">'+o.g.ZWSP+"<wbr></p>"),(0,N.ib)(t.element,r)))}""===r.toString()?P(r,e):setTimeout((function(){P((0,N.zh)(e),e)})),O(n,e),F(e)}else window.open(l.querySelector(":scope > .vditor-ir__marker--link").textContent)})),this.element.addEventListener("keyup",(function(n){if(!n.isComposing&&!(0,d.yl)(n))if("Enter"===n.key&&Le(e),F(e),"Backspace"!==n.key&&"Delete"!==n.key||""===e.ir.element.innerHTML||1!==e.ir.element.childNodes.length||!e.ir.element.firstElementChild||"P"!==e.ir.element.firstElementChild.tagName||0!==e.ir.element.firstElementChild.childElementCount||""!==e.ir.element.textContent&&"\n"!==e.ir.element.textContent){var r=(0,N.zh)(e);"Backspace"===n.key?((0,d.vU)()&&"\n"===r.startContainer.textContent&&1===r.startOffset&&(r.startContainer.textContent="",P(r,e)),t.element.querySelectorAll(".language-math").forEach((function(e){var t=e.querySelector("br");t&&t.remove()}))):n.key.indexOf("Arrow")>-1?("ArrowLeft"!==n.key&&"ArrowRight"!==n.key||Et(e),P(r,e)):229===n.keyCode&&""===n.code&&"Unidentified"===n.key&&P(r,e);var i=(0,b.fb)(r.startContainer,"vditor-ir__preview");if(i){if("ArrowUp"===n.key||"ArrowLeft"===n.key)return i.previousElementSibling.firstElementChild?r.selectNodeContents(i.previousElementSibling.firstElementChild):r.selectNodeContents(i.previousElementSibling),r.collapse(!1),n.preventDefault(),!0;if("SPAN"===i.tagName&&("ArrowDown"===n.key||"ArrowRight"===n.key))return"html-entity"===i.parentElement.getAttribute("data-type")?(i.parentElement.insertAdjacentText("afterend",o.g.ZWSP),r.setStart(i.parentElement.nextSibling,1)):r.selectNodeContents(i.parentElement.lastElementChild),r.collapse(!1),n.preventDefault(),!0}}else e.ir.element.innerHTML=""}))},e}(),xt=function(e){return"sv"===e.currentMode?e.lute.Md2HTML(l(e)):"wysiwyg"===e.currentMode?e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML):"ir"===e.currentMode?e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML):void 0},_t=n(792),At=n(198),Ht=function(){function e(e){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML='<div class="vditor-outline__title">'+e+'</div>\n<div class="vditor-outline__content"></div>'}return e.prototype.render=function(e){return"block"===e.preview.element.style.display?(0,At.k)(e.preview.element.lastElementChild,this.element.lastElementChild,e):(0,At.k)(e[e.currentMode].element,this.element.lastElementChild,e)},e.prototype.toggle=function(e,t){var n;void 0===t&&(t=!0);var r=null===(n=e.toolbar.elements.outline)||void 0===n?void 0:n.firstElementChild;if(t&&window.innerWidth>=o.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(e),null==r||r.classList.add("vditor-menu--current")):(this.element.style.display="none",null==r||r.classList.remove("vditor-menu--current")),getSelection().rangeCount>0){var i=getSelection().getRangeAt(0);e[e.currentMode].element.contains(i.startContainer)?(0,N.Hc)(i):e[e.currentMode].element.focus()}K(e)},e}(),Nt=n(207),Dt=function(){function e(e){var t=this;this.element=document.createElement("div"),this.element.className="vditor-preview";var n=document.createElement("div");n.className="vditor-reset",e.options.classes.preview&&n.classList.add(e.options.classes.preview),n.style.maxWidth=e.options.preview.maxWidth+"px",n.addEventListener("copy",(function(n){if("TEXTAREA"!==n.target.tagName){var r=document.createElement("div");r.className="vditor-reset",r.appendChild(getSelection().getRangeAt(0).cloneContents()),t.copyToX(e,r),n.preventDefault()}})),n.addEventListener("click",(function(r){var i=(0,b.lG)(r.target,"SPAN");if(i&&(0,b.fb)(i,"vditor-toc")){var o=n.querySelector("#"+i.getAttribute("data-target-id"));o&&(t.element.scrollTop=o.offsetTop)}else"IMG"===r.target.tagName&&(0,B.E)(r.target,e.options.lang,e.options.theme)}));var r=e.options.preview.actions,i=document.createElement("div");i.className="vditor-preview__action";for(var o=[],a=0;a<r.length;a++){var l=r[a];if("object"!=typeof l)switch(l){case"desktop":o.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":o.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":o.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":o.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":o.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>')}else o.push('<button type="button" data-type="'+l.key+'" class="'+l.className+'"'+(l.tooltip?' aria-label="'+l.tooltip+'"':"")+'">'+l.text+"</button>")}i.innerHTML=o.join(""),0===r.length&&(i.style.display="none"),this.element.appendChild(i),this.element.appendChild(n),i.addEventListener((0,d.Le)(),(function(o){var a=(0,w.S)(o.target,"BUTTON");if(a){var l=a.getAttribute("data-type"),s=r.find((function(e){return(null==e?void 0:e.key)===l}));s?s.click(l):"mp-wechat"!==l&&"zhihu"!==l?(n.style.width="desktop"===l?"auto":"tablet"===l?"780px":"360px",n.scrollWidth>n.parentElement.clientWidth&&(n.style.width="auto"),t.render(e),i.querySelectorAll("button").forEach((function(e){e.classList.remove("vditor-preview__action--current")})),a.classList.add("vditor-preview__action--current")):t.copyToX(e,t.element.lastElementChild.cloneNode(!0),l)}}))}return e.prototype.render=function(e,t){var n=this;if(clearTimeout(this.mdTimeoutId),"none"!==this.element.style.display)if(t)this.element.lastElementChild.innerHTML=t;else if(""!==l(e).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")){var r=(new Date).getTime(),i=l(e);this.mdTimeoutId=window.setTimeout((function(){if(e.options.preview.url){var t=new XMLHttpRequest;t.open("POST",e.options.preview.url),t.setRequestHeader("Content-Type","application/json;charset=UTF-8"),t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE)if(200===t.status){var o=JSON.parse(t.responseText);if(0!==o.code)return void e.tip.show(o.msg);e.options.preview.transform&&(o.data=e.options.preview.transform(o.data)),n.element.lastElementChild.innerHTML=o.data,n.afterRender(e,r)}else{var a=e.lute.Md2HTML(i);e.options.preview.transform&&(a=e.options.preview.transform(a)),n.element.lastElementChild.innerHTML=a,n.afterRender(e,r)}},t.send(JSON.stringify({markdownText:i}))}else{var o=e.lute.Md2HTML(i);e.options.preview.transform&&(o=e.options.preview.transform(o)),n.element.lastElementChild.innerHTML=o,n.afterRender(e,r)}}),e.options.preview.delay)}else this.element.lastElementChild.innerHTML="";else"renderPerformance"===this.element.getAttribute("data-type")&&e.tip.hide()},e.prototype.afterRender=function(e,t){e.options.preview.parse&&e.options.preview.parse(this.element);var n=(new Date).getTime()-t;(new Date).getTime()-t>2600?(e.tip.show(U.a[e.options.lang].performanceTip.replace("${x}",n.toString())),e.preview.element.setAttribute("data-type","renderPerformance")):"renderPerformance"===e.preview.element.getAttribute("data-type")&&(e.tip.hide(),e.preview.element.removeAttribute("data-type"));var r=e.preview.element.querySelector(".vditor-comment--focus");r&&r.classList.remove("vditor-comment--focus"),(0,S.O)(e.preview.element.lastElementChild,e.options.lang),(0,T.s)(e.options.preview.hljs,e.preview.element.lastElementChild,e.options.cdn),(0,x.i)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,L.P)(e.preview.element.lastElementChild,e.options.cdn),(0,C.v)(e.preview.element.lastElementChild,e.options.cdn),(0,k.p)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,_.P)(e.preview.element.lastElementChild,e.options.cdn,e.options.theme),(0,A.B)(e.preview.element.lastElementChild,e.options.cdn),(0,E.Q)(e.preview.element.lastElementChild,e.options.cdn),(0,Nt.Y)(e.preview.element.lastElementChild);var i=e.preview.element,o=e.outline.render(e);""===o&&(o="[ToC]"),i.querySelectorAll('[data-type="toc-block"]').forEach((function(t){t.innerHTML=o,(0,M.H)(t,{cdn:e.options.cdn,math:e.options.preview.math})})),(0,M.H)(e.preview.element.lastElementChild,{cdn:e.options.cdn,math:e.options.preview.math})},e.prototype.copyToX=function(e,t,n){void 0===n&&(n="mp-wechat"),"zhihu"!==n?t.querySelectorAll(".katex-html .base").forEach((function(e){e.style.display="initial"})):t.querySelectorAll(".language-math").forEach((function(e){e.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'+e.getAttribute("data-math")+'\\" style="display: block; margin: 0 auto; max-width: 100%;">'})),t.style.backgroundColor="#fff",t.querySelectorAll("code").forEach((function(e){e.style.backgroundImage="none"})),this.element.append(t);var r=t.ownerDocument.createRange();r.selectNode(t),(0,N.Hc)(r),document.execCommand("copy"),this.element.lastElementChild.remove(),e.tip.show("已复制，可到"+("zhihu"===n?"知乎":"微信公众号平台")+"进行粘贴")},e}(),Ot=function(){function e(e){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--"+e.options.resize.position,this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(e)}return e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("mousedown",(function(n){var r=document,i=n.clientY,o=e.element.offsetHeight,a=63+e.element.querySelector(".vditor-toolbar").clientHeight;r.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),t.element.classList.add("vditor-resize--selected"),r.onmousemove=function(t){"top"===e.options.resize.position?e.element.style.height=Math.max(a,o+(i-t.clientY))+"px":e.element.style.height=Math.max(a,o+(t.clientY-i))+"px",e.options.typewriterMode&&(e.sv.element.style.paddingBottom=e.sv.element.parentElement.offsetHeight/2+"px")},r.onmouseup=function(){e.options.resize.after&&e.options.resize.after(e.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),r.onmousemove=null,r.onmouseup=null,r.ondragstart=null,r.onselectstart=null,r.onselect=null,t.element.classList.remove("vditor-resize--selected")}}))},e}(),Rt=function(){function e(e){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",e.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(e),ye(e,this.element),we(e,this.element),Ce(e,this.element),Te(e,this.element),Ee(e,this.element),ke(e,this.element,this.copy),Se(e,this.element,this.copy)}return e.prototype.copy=function(e,t){e.stopPropagation(),e.preventDefault(),e.clipboardData.setData("text/plain",ge(t[t.currentMode].element))},e.prototype.bindEvent=function(e){var t=this;this.element.addEventListener("paste",(function(t){wt(e,t,{pasteCode:function(e){document.execCommand("insertHTML",!1,e)}})})),this.element.addEventListener("scroll",(function(){if("block"===e.preview.element.style.display){var n=t.element.scrollTop,r=t.element.clientHeight,i=t.element.scrollHeight-parseFloat(t.element.style.paddingBottom||"0"),o=e.preview.element;o.scrollTop=n/r>.5?(n+r)*o.scrollHeight/i-r:n*o.scrollHeight/i}})),this.element.addEventListener("compositionstart",(function(e){t.composingLock=!0})),this.element.addEventListener("compositionend",(function(n){(0,d.vU)()||q(e,n),t.composingLock=!1})),this.element.addEventListener("input",(function(n){"deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType&&(t.composingLock||"‘"===n.data||"“"===n.data||"《"===n.data||(t.preventInput?t.preventInput=!1:q(e,n)))})),this.element.addEventListener("keyup",(function(t){t.isComposing||(0,d.yl)(t)||("Backspace"!==t.key&&"Delete"!==t.key||""===e.sv.element.innerHTML||1!==e.sv.element.childNodes.length||!e.sv.element.firstElementChild||"DIV"!==e.sv.element.firstElementChild.tagName||2!==e.sv.element.firstElementChild.childElementCount||""!==e.sv.element.firstElementChild.textContent&&"\n"!==e.sv.element.textContent?"Enter"===t.key&&Le(e):e.sv.element.innerHTML="")}))},e}(),jt=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(e,t){var n=this;if(void 0===t&&(t=6e3),this.element.className="vditor-tip vditor-tip--show",0===t)return this.element.innerHTML='<div class="vditor-tip__content">'+e+'\n<div class="vditor-tip__close">X</div></div>',void this.element.querySelector(".vditor-tip__close").addEventListener("click",(function(){n.hide()}));this.element.innerHTML='<div class="vditor-tip__content">'+e+"</div>",setTimeout((function(){n.hide()}),t)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e}(),It=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",u(t.toolbar.elements,["both"])}t.devtools&&t.devtools.renderEchart(t)}},Pt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return"both"===t.options.preview.mode&&r.element.children[0].classList.add("vditor-menu--current"),r.element.children[0].addEventListener((0,d.Le)(),(function(e){r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||(e.preventDefault(),"sv"===t.currentMode&&("both"===t.options.preview.mode?It("editor",t):It("both",t)))})),r}return Pt(t,e),t}(me),qt=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"},Ut=n(968),Wt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Vt=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],a=document.createElement("div");a.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow");var l="";return o.g.CODE_THEME.forEach((function(e){l+="<button>"+e+"</button>"})),a.innerHTML='<div style="overflow: auto;max-height:'+window.innerHeight/2+'px">'+l+"</div>",a.addEventListener((0,d.Le)(),(function(e){"BUTTON"===e.target.tagName&&(g(t,["subToolbar"]),t.options.preview.hljs.style=e.target.textContent,(0,Ut.Y)(e.target.textContent,t.options.cdn),e.preventDefault(),e.stopPropagation())})),r.element.appendChild(a),y(t,a,i,n.level),r}return Wt(t,e),t}(me),Kt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gt=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],o=document.createElement("div");o.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow");var a="";return Object.keys(t.options.preview.theme.list).forEach((function(e){a+='<button data-type="'+e+'">'+t.options.preview.theme.list[e]+"</button>"})),o.innerHTML='<div style="overflow: auto;max-height:'+window.innerHeight/2+'px">'+a+"</div>",o.addEventListener((0,d.Le)(),(function(e){"BUTTON"===e.target.tagName&&(g(t,["subToolbar"]),t.options.preview.theme.current=e.target.getAttribute("data-type"),(0,W.Z)(t.options.preview.theme.current,t.options.preview.theme.path),e.preventDefault(),e.stopPropagation())})),r.element.appendChild(o),y(t,o,i,n.level),r}return Kt(t,e),t}(me),zt=function(){function e(e){this.element=document.createElement("span"),this.element.className="vditor-counter vditor-tooltipped vditor-tooltipped__nw",this.render(e,"")}return e.prototype.render=function(e,t){var n=t.endsWith("\n")?t.length-1:t.length;if("text"===e.options.counter.type&&e[e.currentMode]){var r=e[e.currentMode].element.cloneNode(!0);r.querySelectorAll(".vditor-wysiwyg__preview").forEach((function(e){e.remove()})),n=r.textContent.length}"number"==typeof e.options.counter.max?(n>e.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML=n+"/"+e.options.counter.max):this.element.innerHTML=""+n,this.element.setAttribute("aria-label",e.options.counter.type),e.options.counter.after&&e.options.counter.after(n,{enable:e.options.counter.enable,max:e.options.counter.max,type:e.options.counter.type})},e}(),Ft=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].innerHTML=n.icon,r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),e.currentTarget.classList.contains(o.g.CLASS_MENU_DISABLED)||n.click(e,t)})),r}return Ft(t,e),t}(me),Jt=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.firstElementChild.addEventListener((0,d.Le)(),(function(e){var n=r.element.firstElementChild;n.classList.contains(o.g.CLASS_MENU_DISABLED)||(e.preventDefault(),n.classList.contains("vditor-menu--current")?(n.classList.remove("vditor-menu--current"),t.devtools.element.style.display="none",K(t)):(n.classList.add("vditor-menu--current"),t.devtools.element.style.display="block",K(t),t.devtools.renderEchart(t)))})),r}return Jt(t,e),t}(me),Yt=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"},$t=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qt=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=document.createElement("div");i.className="vditor-panel vditor-panel--arrow";var o="";Object.keys(t.options.hint.emoji).forEach((function(e){var n=t.options.hint.emoji[e];n.indexOf(".")>-1?o+='<button data-value=":'+e+': " data-key=":'+e+':"><img\ndata-value=":'+e+': " data-key=":'+e+':" class="vditor-emojis__icon" src="'+n+'"/></button>':o+='<button data-value="'+n+' "\n data-key="'+e+'"><span class="vditor-emojis__icon">'+n+"</span></button>"}));var a='<div class="vditor-emojis__tail">\n    <span class="vditor-emojis__tip"></span><span>'+(t.options.hint.emojiTail||"")+"</span>\n</div>";return i.innerHTML='<div class="vditor-emojis" style="max-height: '+("auto"===t.options.height?"auto":t.options.height-80)+'px">'+o+"</div>"+a,r.element.appendChild(i),y(t,i,r.element.children[0],n.level),r._bindEvent(t,i),r}return $t(t,e),t.prototype._bindEvent=function(e,t){t.querySelectorAll(".vditor-emojis button").forEach((function(n){n.addEventListener((0,d.Le)(),(function(r){r.preventDefault();var i=n.getAttribute("data-value"),o=(0,N.zh)(e),a=i;if("wysiwyg"===e.currentMode?a=e.lute.SpinVditorDOM(i):"ir"===e.currentMode&&(a=e.lute.SpinVditorIRDOM(i)),i.indexOf(":")>-1&&"sv"!==e.currentMode){var l=document.createElement("div");l.innerHTML=a,a=l.firstElementChild.firstElementChild.outerHTML+" ",(0,N.oC)(a,e)}else o.extractContents(),o.insertNode(document.createTextNode(i));o.collapse(!1),(0,N.Hc)(o),t.style.display="none",it(e)})),n.addEventListener("mouseover",(function(e){"BUTTON"===e.target.tagName&&(t.querySelector(".vditor-emojis__tip").innerHTML=e.target.getAttribute("data-key"))}))}))},t}(me),en=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(U.a[e.options.lang].downloadTip,0)},tn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nn=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=r.element.children[0],o=document.createElement("div");return o.className="vditor-hint"+(2===n.level?"":" vditor-panel--arrow"),o.innerHTML='<button data-type="markdown">Markdown</button>\n<button data-type="pdf">PDF</button>\n<button data-type="html">HTML</button>',o.addEventListener((0,d.Le)(),(function(e){var n=e.target;if("BUTTON"===n.tagName){switch(n.getAttribute("data-type")){case"markdown":!function(e){var t=l(e);en(e,t,t.substr(0,10)+".md")}(t);break;case"pdf":!function(e){e.tip.show(U.a[e.options.lang].generate,3800);var t=document.querySelector("iframe");t.contentDocument.open(),t.contentDocument.write('<link rel="stylesheet" href="'+e.options.cdn+'/dist/index.css"/>\n<script src="'+e.options.cdn+'/dist/method.min.js"><\/script>\n<div id="preview"></div>\n<script>\nwindow.addEventListener("message", (e) => {\n  if(!e.data) {\n    return;\n  }\n  Vditor.preview(document.getElementById(\'preview\'), e.data, {\n    markdown: {\n      theme: "'+e.options.preview.theme+'"\n    },\n    hljs: {\n      style: "'+e.options.preview.hljs.style+'"\n    }\n  });\n  setTimeout(() => {\n        window.print();\n    }, 3600);\n}, false);\n<\/script>'),t.contentDocument.close(),setTimeout((function(){t.contentWindow.postMessage(l(e),"*")}),200)}(t);break;case"html":!function(e){var t=xt(e),n='<html><head><link rel="stylesheet" type="text/css" href="'+e.options.cdn+'/dist/index.css"/>\n<script src="'+e.options.cdn+'/dist/method.min.js"><\/script></head>\n<body><div class="vditor-reset" id="preview">'+t+"</div>\n<script>\n    const previewElement = document.getElementById('preview')\n    Vditor.setContentTheme('"+e.options.preview.theme.current+"', '"+e.options.preview.theme.path+"');\n    Vditor.codeRender(previewElement, '"+e.options.lang+"');\n    Vditor.highlightRender("+JSON.stringify(e.options.preview.hljs)+", previewElement, '"+e.options.cdn+"');\n    Vditor.mathRender(previewElement, {\n        cdn: '"+e.options.cdn+"',\n        math: "+JSON.stringify(e.options.preview.math)+",\n    });\n    Vditor.mermaidRender(previewElement, '"+e.options.cdn+"', '"+e.options.theme+"');\n    Vditor.flowchartRender(previewElement, '"+e.options.cdn+"');\n    Vditor.graphvizRender(previewElement, '"+e.options.cdn+"');\n    Vditor.chartRender(previewElement, '"+e.options.cdn+"', '"+e.options.theme+"');\n    Vditor.mindmapRender(previewElement, '"+e.options.cdn+"', '"+e.options.theme+"');\n    Vditor.abcRender(previewElement, '"+e.options.cdn+"');\n    Vditor.mediaRender(previewElement);\n<\/script></body></html>";en(e,n,t.substr(0,10)+".html")}(t)}g(t,["subToolbar"]),e.preventDefault(),e.stopPropagation()}})),r.element.appendChild(o),y(t,o,i,n.level),r}return tn(t,e),t}(me),rn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),on=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._bindEvent(t,n),r}return rn(t,e),t.prototype._bindEvent=function(e,t){this.element.children[0].addEventListener((0,d.Le)(),(function(n){n.preventDefault(),e.element.className.includes("vditor--fullscreen")?(t.level||(this.innerHTML=t.icon),e.element.style.zIndex="",document.body.style.overflow="",e.element.classList.remove("vditor--fullscreen"),Object.keys(e.toolbar.elements).forEach((function(t){var n=e.toolbar.elements[t].firstChild;n&&(n.className=n.className.replace("__s","__n"))})),e.counter&&(e.counter.element.className=e.counter.element.className.replace("__s","__n"))):(t.level||(this.innerHTML='<svg><use xlink:href="#vditor-icon-contract"></use></svg>'),e.element.style.zIndex=e.options.fullscreen.index.toString(),document.body.style.overflow="hidden",e.element.classList.add("vditor--fullscreen"),Object.keys(e.toolbar.elements).forEach((function(t){var n=e.toolbar.elements[t].firstChild;n&&(n.className=n.className.replace("__n","__s"))})),e.counter&&(e.counter.element.className=e.counter.element.className.replace("__n","__s"))),e.devtools&&e.devtools.renderEchart(e),t.click&&t.click(n,e),K(e),G(e)}))},t}(me),an=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ln=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=document.createElement("div");return i.className="vditor-hint vditor-panel--arrow",i.innerHTML='<button data-tag="h1" data-value="# ">Heading 1 '+(0,d.ns)("&lt;⌥⌘1>")+'</button>\n<button data-tag="h2" data-value="## ">Heading 2 &lt;'+(0,d.ns)("⌥⌘2")+'></button>\n<button data-tag="h3" data-value="### ">Heading 3 &lt;'+(0,d.ns)("⌥⌘3")+'></button>\n<button data-tag="h4" data-value="#### ">Heading 4 &lt;'+(0,d.ns)("⌥⌘4")+'></button>\n<button data-tag="h5" data-value="##### ">Heading 5 &lt;'+(0,d.ns)("⌥⌘5")+'></button>\n<button data-tag="h6" data-value="###### ">Heading 6 &lt;'+(0,d.ns)("⌥⌘6")+"></button>",r.element.appendChild(i),r._bindEvent(t,i),r}return an(t,e),t.prototype._bindEvent=function(e,t){var n=this.element.children[0];n.addEventListener((0,d.Le)(),(function(r){r.preventDefault(),n.classList.contains(o.g.CLASS_MENU_DISABLED)||(n.blur(),n.classList.contains("vditor-menu--current")?("wysiwyg"===e.currentMode?(Q(e),Z(e)):"ir"===e.currentMode&&St(e,""),n.classList.remove("vditor-menu--current")):(g(e,["subToolbar"]),t.style.display="block"))}));for(var r=0;r<6;r++)t.children.item(r).addEventListener((0,d.Le)(),(function(r){r.preventDefault(),"wysiwyg"===e.currentMode?($(e,r.target.getAttribute("data-tag")),Z(e),n.classList.add("vditor-menu--current")):"ir"===e.currentMode?(St(e,r.target.getAttribute("data-value")),n.classList.add("vditor-menu--current")):Ne(e,r.target.getAttribute("data-value")),t.style.display="none"}))},t}(me),sn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),t.tip.show('<div style="margin-bottom:14px;font-size: 14px;line-height: 22px;min-width:300px;max-width: 360px;display: flex;">\n<div style="margin-top: 14px;flex: 1">\n    <div>Markdown 使用指南</div>\n    <ul style="list-style: none">\n        <li><a href="https://ld246.com/article/1583308420519" target="_blank">语法速查手册</a></li>\n        <li><a href="https://ld246.com/article/1583129520165" target="_blank">基础语法</a></li>\n        <li><a href="https://ld246.com/article/1583305480675" target="_blank">扩展语法</a></li>\n        <li><a href="https://ld246.com/article/1582778815353" target="_blank">键盘快捷键</a></li>\n    </ul>\n</div>\n<div style="margin-top: 14px;flex: 1">\n    <div>Vditor 支持</div>\n    <ul style="list-style: none">\n        <li><a href="https://github.com/Vanessa219/vditor/issues" target="_blank">Issues</a></li>\n        <li><a href="https://ld246.com/tag/vditor" target="_blank">官方讨论区</a></li>\n        <li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>\n        <li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>\n    </ul>\n</div></div>',0)})),r}return sn(t,e),t}(me),dn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),un=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){if(e.preventDefault(),!r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)&&"sv"!==t.currentMode){var n=(0,N.zh)(t),i=(0,b.lG)(n.startContainer,"LI");i&&Qe(t,i,n)}})),r}return dn(t,e),t}(me),pn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),t.tip.show('<div style="max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;">\n<p style="text-align: center;margin: 14px 0">\n    <em>下一代的 Markdown 编辑器，为未来而构建</em>\n</p>\n<div style="display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center">\n    <img src="https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png" style="margin: 0 auto;height: 68px"/>\n    <div>&nbsp;&nbsp;</div>\n    <div style="flex: 1;min-width: 250px">\n        Vditor 是一款浏览器端的 Markdown 编辑器，支持所见即所得、即时渲染（类似 Typora）和分屏预览模式。\n        它使用 TypeScript 实现，支持原生 JavaScript、Vue、React、Angular，提供<a target="_blank" href="https://b3log.org/siyuan">桌面版</a>。\n    </div>\n</div>\n<div style="display: flex;flex-wrap: wrap;">\n    <ul style="list-style: none;flex: 1;min-width:148px">\n        <li>\n        项目地址：<a href="https://b3log.org/vditor" target="_blank">b3log.org/vditor</a>\n        </li>\n        <li>\n        开源协议：MIT\n        </li>\n    </ul>\n    <ul style="list-style: none;margin-right: 18px">\n        <li>\n        组件版本：Vditor v'+o.H+" / Lute v"+Lute.Version+'\n        </li>\n        <li>\n        赞助捐赠：<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>\n        </li>\n    </ul>\n</div>\n</div>',0)})),r}return pn(t,e),t}(me),fn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),hn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||"sv"===t.currentMode||ze(t,"afterend")})),r}return fn(t,e),t}(me),vn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||"sv"===t.currentMode||ze(t,"beforebegin")})),r}return vn(t,e),t}(me),yn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),bn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.element.children[0].addEventListener((0,d.Le)(),(function(e){if(e.preventDefault(),!r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)&&"sv"!==t.currentMode){var n=(0,N.zh)(t),i=(0,b.lG)(n.startContainer,"LI");i&&et(t,i,n,i.parentElement)}})),r}return yn(t,e),t}(me),wn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),En=function(e){function t(t,n){var r=e.call(this,t,n)||this;return t.options.outline&&r.element.firstElementChild.classList.add("vditor-menu--current"),r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),t.toolbar.elements.outline.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||(t.options.outline.enable=!r.element.firstElementChild.classList.contains("vditor-menu--current"),t.outline.toggle(t,t.options.outline.enable))})),r}return wn(t,e),t}(me),kn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Sn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._bindEvent(t),r}return kn(t,e),t.prototype._bindEvent=function(e){var t=this;this.element.children[0].addEventListener((0,d.Le)(),(function(n){n.preventDefault();var r=t.element.firstElementChild;if(!r.classList.contains(o.g.CLASS_MENU_DISABLED)){var i=o.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);r.classList.contains("vditor-menu--current")?(r.classList.remove("vditor-menu--current"),"sv"===e.currentMode?(e.sv.element.style.display="block","both"===e.options.preview.mode?e.preview.element.style.display="block":e.preview.element.style.display="none"):(e[e.currentMode].element.parentElement.style.display="block",e.preview.element.style.display="none"),m(e.toolbar.elements,i),e.outline.render(e)):(f(e.toolbar.elements,i),e.preview.element.style.display="block","sv"===e.currentMode?e.sv.element.style.display="none":e[e.currentMode].element.parentElement.style.display="none",e.preview.render(e),r.classList.add("vditor-menu--current"),g(e,["subToolbar","hint","popover"]),setTimeout((function(){e.outline.render(e)}),e.options.preview.delay+10)),K(e)}}))},t}(me),Ln=function(){function e(e){var t;if(this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0,"undefined"!=typeof AudioContext)t=new AudioContext;else{if(!webkitAudioContext)return;t=new webkitAudioContext}this.DEFAULT_SAMPLE_RATE=t.sampleRate;var n=t.createGain();t.createMediaStreamSource(e).connect(n),this.recorder=t.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,n.connect(this.recorder),this.recorder.connect(t.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(e,t){this.leftChannel.push(new Float32Array(e)),this.rightChannel.push(new Float32Array(t)),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 e=this.mergeBuffers(this.leftChannel),t=this.mergeBuffers(this.rightChannel),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=.5*(e[r]+t[r]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(n=this.downSampleBuffer(n,this.SAMPLE_RATE));var i=44+2*n.length,o=new ArrayBuffer(i),a=new DataView(o);this.writeUTFBytes(a,0,"RIFF"),a.setUint32(4,i,!0),this.writeUTFBytes(a,8,"WAVE"),this.writeUTFBytes(a,12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,this.SAMPLE_RATE,!0),a.setUint32(28,2*this.SAMPLE_RATE,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0);var l=2*n.length;this.writeUTFBytes(a,36,"data"),a.setUint32(40,l,!0);for(var s=n.length,c=44,d=0;d<s;d++)a.setInt16(c,32767*n[d],!0),c+=2;return new Blob([a],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(e,t){if(t===this.DEFAULT_SAMPLE_RATE)return e;if(t>this.DEFAULT_SAMPLE_RATE)return e;for(var n=this.DEFAULT_SAMPLE_RATE/t,r=Math.round(e.length/n),i=new Float32Array(r),o=0,a=0;o<i.length;){for(var l=Math.round((o+1)*n),s=0,c=0,d=a;d<l&&d<e.length;d++)s+=e[d],c++;i[o]=s/c,o++,a=l}return i},e.prototype.mergeBuffers=function(e){for(var t=new Float32Array(this.recordingLength),n=0,r=e.length,i=0;i<r;++i){var o=e[i];t.set(o,n),n+=o.length}return t},e.prototype.writeUTFBytes=function(e,t,n){for(var r=n.length,i=0;i<r;i++)e.setUint8(t+i,n.charCodeAt(i))},e}(),Cn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Tn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._bindEvent(t),r}return Cn(t,e),t.prototype._bindEvent=function(e){var t,n=this;this.element.children[0].addEventListener((0,d.Le)(),(function(r){if(r.preventDefault(),!n.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)){var i=e[e.currentMode].element;if(t)if(t.isRecording){t.stopRecording(),e.tip.hide();var a=new File([t.buildWavFileBlob()],"record"+(new Date).getTime()+".wav",{type:"video/webm"});Be(e,[a]),n.element.children[0].classList.remove("vditor-menu--current")}else e.tip.show(U.a[e.options.lang].recording),i.setAttribute("contenteditable","false"),t.startRecordingNewWavFile(),n.element.children[0].classList.add("vditor-menu--current");else navigator.mediaDevices.getUserMedia({audio:!0}).then((function(r){(t=new Ln(r)).recorder.onaudioprocess=function(e){if(t.isRecording){var n=e.inputBuffer.getChannelData(0),r=e.inputBuffer.getChannelData(1);t.cloneChannelData(n,r)}},t.startRecordingNewWavFile(),e.tip.show(U.a[e.options.lang].recording),i.setAttribute("contenteditable","false"),n.element.children[0].classList.add("vditor-menu--current")})).catch((function(){e.tip.show(U.a[e.options.lang]["record-tip"])}))}}))},t}(me),Mn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xn=function(e){function t(t,n){var r=e.call(this,t,n)||this;return f({redo:r.element},["redo"]),r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||t.undo.redo(t)})),r}return Mn(t,e),t}(me),_n=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),An=function(e){function t(t,n){var r=e.call(this,t,n)||this;return f({undo:r.element},["undo"]),r.element.children[0].addEventListener((0,d.Le)(),(function(e){e.preventDefault(),r.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED)||t.undo.undo(t)})),r}return _n(t,e),t}(me),Hn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nn=function(e){function t(t,n){var r=e.call(this,t,n)||this,i='<input type="file"';return t.options.upload.multiple&&(i+=' multiple="multiple"'),t.options.upload.accept&&(i+=' accept="'+t.options.upload.accept+'"'),r.element.children[0].innerHTML=""+(n.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>')+i+">",r._bindEvent(t),r}return Hn(t,e),t.prototype._bindEvent=function(e){var t=this;this.element.children[0].addEventListener((0,d.Le)(),(function(e){if(t.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED))return e.stopPropagation(),void e.preventDefault()})),this.element.querySelector("input").addEventListener("change",(function(n){if(t.element.firstElementChild.classList.contains(o.g.CLASS_MENU_DISABLED))return n.stopPropagation(),void n.preventDefault();0!==n.target.files.length&&Be(e,n.target.files,n.target)}))},t}(me),Dn=function(){function e(e){var t=this,n=e.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",n.toolbar.forEach((function(n,r){var i=t.genItem(e,n,r);if(t.element.appendChild(i),n.toolbar){var o=document.createElement("div");o.className="vditor-hint vditor-panel--arrow",o.addEventListener((0,d.Le)(),(function(e){o.style.display="none"})),n.toolbar.forEach((function(n,i){n.level=2,o.appendChild(t.genItem(e,n,r+i))})),i.appendChild(o),y(e,o,i.children[0])}})),e.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),e.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),e.options.counter.enable&&(e.counter=new zt(e),this.element.appendChild(e.counter.element))}return e.prototype.genItem=function(e,t,n){var r;switch(t.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":r=new me(e,t);break;case"emoji":r=new Qt(e,t);break;case"headings":r=new ln(e,t);break;case"|":r=new Yt;break;case"br":r=new qt;break;case"undo":r=new An(e,t);break;case"redo":r=new xn(e,t);break;case"help":r=new cn(e,t);break;case"both":r=new Bt(e,t);break;case"preview":r=new Sn(e,t);break;case"fullscreen":r=new on(e,t);break;case"upload":r=new Nn(e,t);break;case"record":r=new Tn(e,t);break;case"info":r=new mn(e,t);break;case"edit-mode":r=new ve(e,t);break;case"devtools":r=new Xt(e,t);break;case"outdent":r=new bn(e,t);break;case"indent":r=new un(e,t);break;case"outline":r=new En(e,t);break;case"insert-after":r=new hn(e,t);break;case"insert-before":r=new gn(e,t);break;case"code-theme":r=new Vt(e,t);break;case"content-theme":r=new Gt(e,t);break;case"export":r=new nn(e,t);break;default:r=new Zt(e,t)}if(r){var i=t.name;return"br"!==i&&"|"!==i||(i+=n),this.elements[i]=r.element,r.element}},e}(),On=n(694),Rn=function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new On}return e.prototype.clearStack=function(e){this.resetStack(),this.resetIcon(e)},e.prototype.resetIcon=function(e){e.toolbar&&(this[e.currentMode].undoStack.length>1?m(e.toolbar.elements,["undo"]):f(e.toolbar.elements,["undo"]),0!==this[e.currentMode].redoStack.length?m(e.toolbar.elements,["redo"]):f(e.toolbar.elements,["redo"]))},e.prototype.undo=function(e){if("false"!==e[e.currentMode].element.getAttribute("contenteditable")&&!(this[e.currentMode].undoStack.length<2)){var t=this[e.currentMode].undoStack.pop();t&&(this[e.currentMode].redoStack.push(t),this.renderDiff(t,e),this[e.currentMode].hasUndo=!0,g(e,["hint"]))}},e.prototype.redo=function(e){if("false"!==e[e.currentMode].element.getAttribute("contenteditable")){var t=this[e.currentMode].redoStack.pop();t&&(this[e.currentMode].undoStack.push(t),this.renderDiff(t,e,!0))}},e.prototype.recordFirstPosition=function(e,t){if(0!==getSelection().rangeCount&&!(1!==this[e.currentMode].undoStack.length||0===this[e.currentMode].undoStack[0].length||this[e.currentMode].redoStack.length>0||(0,d.vU)()&&"Backspace"===t.key||(0,d.G6)())){var n=this.addCaret(e);n.replace("<wbr>","").replace(" vditor-ir__node--expand","")===this[e.currentMode].undoStack[0][0].diffs[0][1].replace("<wbr>","")&&(this[e.currentMode].undoStack[0][0].diffs[0][1]=n,this[e.currentMode].lastText=n)}},e.prototype.addToUndoStack=function(e){var t=this.addCaret(e,!0),n=this.dmp.diff_main(t,this[e.currentMode].lastText,!0),r=this.dmp.patch_make(t,this[e.currentMode].lastText,n);0===r.length&&this[e.currentMode].undoStack.length>0||(this[e.currentMode].lastText=t,this[e.currentMode].undoStack.push(r),this[e.currentMode].undoStack.length>this.stackSize&&this[e.currentMode].undoStack.shift(),this[e.currentMode].hasUndo&&(this[e.currentMode].redoStack=[],this[e.currentMode].hasUndo=!1,f(e.toolbar.elements,["redo"])),this[e.currentMode].undoStack.length>1&&m(e.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(e,t,n){var r;if(void 0===n&&(n=!1),n){var i=this.dmp.patch_deepCopy(e).reverse();i.forEach((function(e){e.diffs.forEach((function(e){e[0]=-e[0]}))})),r=this.dmp.patch_apply(i,this[t.currentMode].lastText)[0]}else r=this.dmp.patch_apply(e,this[t.currentMode].lastText)[0];if(this[t.currentMode].lastText=r,t[t.currentMode].element.innerHTML=r,"sv"!==t.currentMode&&t[t.currentMode].element.querySelectorAll(".vditor-"+t.currentMode+"__preview[data-render='2']").forEach((function(e){H(e,t)})),t[t.currentMode].element.querySelector("wbr"))(0,N.ib)(t[t.currentMode].element,t[t.currentMode].element.ownerDocument.createRange()),Le(t);else{var o=getSelection().getRangeAt(0);o.setEndBefore(t[t.currentMode].element),o.collapse(!1)}it(t,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),de(t),t[t.currentMode].element.querySelectorAll(".vditor-"+t.currentMode+"__preview[data-render='2']").forEach((function(e){H(e,t)})),this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):f(t.toolbar.elements,["undo"]),0!==this[t.currentMode].redoStack.length?m(t.toolbar.elements,["redo"]):f(t.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(e,t){var n;if(void 0===t&&(t=!1),0!==getSelection().rangeCount&&!e[e.currentMode].element.querySelector("wbr")){var r=getSelection().getRangeAt(0);if(e[e.currentMode].element.contains(r.startContainer)){n=r.cloneRange();var i=document.createElement("span");i.className="vditor-wbr",r.insertNode(i)}}e.ir.element.cloneNode(!0).querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='1']").forEach((function(e){(e.firstElementChild.classList.contains("language-echarts")||e.firstElementChild.classList.contains("language-plantuml")||e.firstElementChild.classList.contains("language-mindmap"))&&(e.firstElementChild.removeAttribute("_echarts_instance_"),e.firstElementChild.removeAttribute("data-processed"),e.firstElementChild.innerHTML=e.previousElementSibling.firstElementChild.innerHTML,e.setAttribute("data-render","2")),e.firstElementChild.classList.contains("language-math")&&(e.setAttribute("data-render","2"),e.firstElementChild.textContent=e.firstElementChild.getAttribute("data-math"),e.firstElementChild.removeAttribute("data-math"))}));var o=e[e.currentMode].element.innerHTML;return e[e.currentMode].element.querySelectorAll(".vditor-wbr").forEach((function(e){e.remove()})),t&&n&&(0,N.Hc)(n),o.replace('<span class="vditor-wbr"></span>',"<wbr>")},e}(),jn=n(224),In=function(){function e(e){this.defaultOptions={after:void 0,cache:{enable:!0},cdn:o.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:o.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:o.g.HLJS_OPTIONS,markdown:o.g.MARKDOWN_OPTIONS,math:o.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:o.g.THEME_OPTIONS},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(e){return e.replace(/\W/g,"")},linkToImgUrl:"",max:10485760,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=e}return e.prototype.merge=function(){var e,t,n;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),(null===(t=null===(e=this.options.preview)||void 0===e?void 0:e.theme)||void 0===t?void 0:t.list)&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),(null===(n=this.options.hint)||void 0===n?void 0:n.emoji)&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment));var r=(0,jn.T)(this.defaultOptions,this.options);if(r.cache.enable&&!r.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return r},e.prototype.mergeToolbar=function(e){var t=this,n=[{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 |\n| --- | --- | --- |\n|  |  |  |\n|  |  |  |",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"}],r=[];return e.forEach((function(e){var i=e;n.forEach((function(t){"string"==typeof e&&t.name===e&&(i=t),"object"==typeof e&&t.name===e.name&&(i=Object.assign({},t,e))})),e.toolbar&&(i.toolbar=t.mergeToolbar(e.toolbar)),r.push(i)})),r},e}(),Pn=function(){function e(e){var t=this;this.composingLock=!1,this.commentIds=[];var n=document.createElement("div");n.className="vditor-wysiwyg",n.innerHTML='<pre class="vditor-reset" placeholder="'+e.options.placeholder+'"\n contenteditable="true" spellcheck="false"></pre>\n<div class="vditor-panel vditor-panel--none"></div>\n<div class="vditor-panel vditor-panel--none">\n    <button type="button" aria-label="'+U.a[e.options.lang].comment+'" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">\n        <svg><use xlink:href="#vditor-icon-comment"></use></svg>\n    </button>\n</div>',this.element=n.firstElementChild,this.popover=n.firstElementChild.nextElementSibling,this.selectPopover=n.lastElementChild,this.bindEvent(e),ye(e,this.element),be(e,this.element),we(e,this.element),Ce(e,this.element),Te(e,this.element),Ee(e,this.element),ke(e,this.element,this.copy),Se(e,this.element,this.copy),e.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var n,r,i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),l=a.cloneRange(),s=a.extractContents(),c=!1,d=!1;s.childNodes.forEach((function(e,t){var o=!1;if(3===e.nodeType?o=!0:e.classList.contains("vditor-comment")?e.classList.contains("vditor-comment")&&e.setAttribute("data-cmtids",e.getAttribute("data-cmtids")+" "+i):o=!0,o)if(3!==e.nodeType&&"0"===e.getAttribute("data-block")&&0===t&&l.startOffset>0)e.innerHTML='<span class="vditor-comment" data-cmtids="'+i+'">'+e.innerHTML+"</span>",n=e;else if(3!==e.nodeType&&"0"===e.getAttribute("data-block")&&t===s.childNodes.length-1&&l.endOffset<l.endContainer.textContent.length)e.innerHTML='<span class="vditor-comment" data-cmtids="'+i+'">'+e.innerHTML+"</span>",r=e;else if(3!==e.nodeType&&"0"===e.getAttribute("data-block"))0===t?c=!0:t===s.childNodes.length-1&&(d=!0),e.innerHTML='<span class="vditor-comment" data-cmtids="'+i+'">'+e.innerHTML+"</span>";else{var a=document.createElement("span");a.classList.add("vditor-comment"),a.setAttribute("data-cmtids",i),e.parentNode.insertBefore(a,e),a.appendChild(e)}}));var u=(0,b.F9)(l.startContainer);u&&(n?(u.insertAdjacentHTML("beforeend",n.innerHTML),n.remove()):""===u.textContent.trim().replace(o.g.ZWSP,"")&&c&&u.remove());var p=(0,b.F9)(l.endContainer);p&&(r?(p.insertAdjacentHTML("afterbegin",r.innerHTML),r.remove()):""===p.textContent.trim().replace(o.g.ZWSP,"")&&d&&p.remove()),a.insertNode(s),e.options.comment.add(i,a.toString(),t.getComments(e,!0)),Z(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),t.hideComment()})}return e.prototype.getComments=function(e,t){var n=this;if(void 0===t&&(t=!1),"wysiwyg"!==e.currentMode||!e.options.comment.enable)return[];this.commentIds=[],this.element.querySelectorAll(".vditor-comment").forEach((function(e){n.commentIds=n.commentIds.concat(e.getAttribute("data-cmtids").split(" "))})),this.commentIds=Array.from(new Set(this.commentIds));var r=[];return t?(this.commentIds.forEach((function(e){r.push({id:e,top:n.element.querySelector('.vditor-comment[data-cmtids="'+e+'"]').offsetTop})})),r):void 0},e.prototype.triggerRemoveComment=function(e){var t,n,r;if("wysiwyg"===e.currentMode&&e.options.comment.enable&&e.wysiwyg.commentIds.length>0){var i=JSON.parse(JSON.stringify(this.commentIds));this.getComments(e);var o=(t=i,n=this.commentIds,r=new Set(n),t.filter((function(e){return!r.has(e)})));o.length>0&&e.options.comment.remove(o)}},e.prototype.showComment=function(){var e=(0,N.Ny)(this.element);this.selectPopover.setAttribute("style","left:"+e.left+"px;display:block;top:"+Math.max(-8,e.top-21)+"px")},e.prototype.hideComment=function(){this.selectPopover.setAttribute("style","display:none")},e.prototype.copy=function(e,t){var n=getSelection().getRangeAt(0);if(""!==n.toString()){e.stopPropagation(),e.preventDefault();var r=(0,b.lG)(n.startContainer,"CODE"),i=(0,b.lG)(n.endContainer,"CODE");if(r&&i&&i.isSameNode(r)){var o="";return o="PRE"===r.parentElement.tagName?n.toString():"`"+n.toString()+"`",e.clipboardData.setData("text/plain",o),void e.clipboardData.setData("text/html","")}var a=(0,b.lG)(n.startContainer,"A"),l=(0,b.lG)(n.endContainer,"A");if(a&&l&&l.isSameNode(a)){var s=a.getAttribute("title")||"";return s&&(s=' "'+s+'"'),e.clipboardData.setData("text/plain","["+n.toString()+"]("+a.getAttribute("href")+s+")"),void e.clipboardData.setData("text/html","")}var c=document.createElement("div");c.appendChild(n.cloneContents()),e.clipboardData.setData("text/plain",t.lute.VditorDOM2Md(c.innerHTML).trim()),e.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(e){var t=this;window.addEventListener("scroll",(function(){if(g(e,["hint"]),"block"===t.popover.style.display&&"block"===t.selectPopover.style.display){var n=parseInt(t.popover.getAttribute("data-top"),10);if("auto"===e.options.height){if(e.options.toolbarConfig.pin){var r=Math.max(n,window.scrollY-e.element.offsetTop-8)+"px";"block"===t.popover.style.display&&(t.popover.style.top=r),"block"===t.selectPopover.style.display&&(t.selectPopover.style.top=r)}}else if(e.options.toolbarConfig.pin&&0===e.toolbar.element.getBoundingClientRect().top){var i=Math.max(window.scrollY-e.element.offsetTop-8,Math.min(n-e.wysiwyg.element.scrollTop,t.element.clientHeight-21))+"px";"block"===t.popover.style.display&&(t.popover.style.top=i),"block"===t.selectPopover.style.display&&(t.selectPopover.style.top=i)}}})),this.element.addEventListener("scroll",(function(){if(g(e,["hint"]),e.options.comment&&e.options.comment.enable&&e.options.comment.scroll&&e.options.comment.scroll(e.wysiwyg.element.scrollTop),"block"===t.popover.style.display){var n=parseInt(t.popover.getAttribute("data-top"),10)-e.wysiwyg.element.scrollTop,r=-8;e.options.toolbarConfig.pin&&0===e.toolbar.element.getBoundingClientRect().top&&(r=window.scrollY-e.element.offsetTop+r);var i=Math.max(r,Math.min(n,t.element.clientHeight-21))+"px";t.popover.style.top=i,t.selectPopover.style.top=i}})),this.element.addEventListener("paste",(function(t){wt(e,t,{pasteCode:function(t){var n=(0,N.zh)(e),r=document.createElement("template");r.innerHTML=t,n.insertNode(r.content.cloneNode(!0));var i=(0,b.a1)(n.startContainer,"data-block","0");i?i.outerHTML=e.lute.SpinVditorDOM(i.outerHTML):e.wysiwyg.element.innerHTML=e.lute.SpinVditorDOM(e.wysiwyg.element.innerHTML),(0,N.ib)(e.wysiwyg.element,n)}})})),this.element.addEventListener("compositionstart",(function(){t.composingLock=!0})),this.element.addEventListener("compositionend",(function(n){var r=(0,w.W)(getSelection().getRangeAt(0).startContainer);r&&""===r.textContent?D(e):((0,d.vU)()||qe(e,getSelection().getRangeAt(0).cloneRange(),n),t.composingLock=!1)})),this.element.addEventListener("input",(function(n){if("deleteByDrag"!==n.inputType&&"insertFromDrop"!==n.inputType)if(t.preventInput)t.preventInput=!1;else if(!t.composingLock&&"‘"!==n.data&&"“"!==n.data&&"《"!==n.data){var r=getSelection().getRangeAt(0),i=(0,b.F9)(r.startContainer);if(i||(Y(e,r),i=(0,b.F9)(r.startContainer)),i){for(var o=(0,N.im)(i,e.wysiwyg.element,r).start,a=!0,l=o-1;l>i.textContent.substr(0,o).lastIndexOf("\n");l--)if(" "!==i.textContent.charAt(l)&&"\t"!==i.textContent.charAt(l)){a=!1;break}0===o&&(a=!1);var s=!0;for(l=o-1;l<i.textContent.length;l++)if(" "!==i.textContent.charAt(l)&&"\n"!==i.textContent.charAt(l)){s=!1;break}var c=(0,w.W)(getSelection().getRangeAt(0).startContainer);c&&""===c.textContent&&(D(e),c.remove()),a&&"code-block"!==i.getAttribute("data-type")||s||rt(i.innerHTML)||nt(i.innerHTML)&&i.previousElementSibling||qe(e,r,n)}}})),this.element.addEventListener("click",(function(n){if("INPUT"===n.target.tagName){var r=n.target;return r.checked?r.setAttribute("checked","checked"):r.removeAttribute("checked"),t.preventInput=!0,void Z(e)}if("IMG"!==n.target.tagName||n.target.parentElement.classList.contains("vditor-wysiwyg__preview")){"A"===n.target.tagName&&window.open(n.target.getAttribute("href"));var i=(0,N.zh)(e);if(n.target.isEqualNode(t.element)&&t.element.lastElementChild&&i.collapsed){var a=t.element.lastElementChild.getBoundingClientRect();n.y>a.top+a.height&&("P"===t.element.lastElementChild.tagName&&""===t.element.lastElementChild.textContent.trim().replace(o.g.ZWSP,"")?(i.selectNodeContents(t.element.lastElementChild),i.collapse(!1)):(t.element.insertAdjacentHTML("beforeend",'<p data-block="0">'+o.g.ZWSP+"<wbr></p>"),(0,N.ib)(t.element,i)))}ne(e);var l=(0,b.fb)(n.target,"vditor-wysiwyg__preview");l||(l=(0,b.fb)((0,N.zh)(e).startContainer,"vditor-wysiwyg__preview")),l&&ee(l,e),O(n,e)}else"link-ref"===n.target.getAttribute("data-type")?ie(e,n.target):function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",o.value),n.setAttribute("alt",l.value),n.setAttribute("title",c.value)},i=document.createElement("span");i.setAttribute("aria-label",U.a[t.options.lang].imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var o=document.createElement("input");i.appendChild(o),o.className="vditor-input",o.setAttribute("placeholder",U.a[t.options.lang].imageURL),o.value=n.getAttribute("src")||"",o.oninput=function(){r()},o.onkeydown=function(e){te(t,e)};var a=document.createElement("span");a.setAttribute("aria-label",U.a[t.options.lang].alternateText),a.className="vditor-tooltipped vditor-tooltipped__n";var l=document.createElement("input");a.appendChild(l),l.className="vditor-input",l.setAttribute("placeholder",U.a[t.options.lang].alternateText),l.style.width="52px",l.value=n.getAttribute("alt")||"",l.oninput=function(){r()},l.onkeydown=function(e){te(t,e)};var s=document.createElement("span");s.setAttribute("aria-label",U.a[t.options.lang].title),s.className="vditor-tooltipped vditor-tooltipped__n";var c=document.createElement("input");s.appendChild(c),c.className="vditor-input",c.setAttribute("placeholder",U.a[t.options.lang].title),c.value=n.getAttribute("title")||"",c.oninput=function(){r()},c.onkeydown=function(e){te(t,e)},le(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",a),t.wysiwyg.popover.insertAdjacentElement("beforeend",s),re(t,n)}(n,e)})),this.element.addEventListener("keyup",(function(t){if(!t.isComposing&&!(0,d.yl)(t)){"Enter"===t.key&&Le(e),"Backspace"!==t.key&&"Delete"!==t.key||""===e.wysiwyg.element.innerHTML||1!==e.wysiwyg.element.childNodes.length||!e.wysiwyg.element.firstElementChild||"P"!==e.wysiwyg.element.firstElementChild.tagName||0!==e.wysiwyg.element.firstElementChild.childElementCount||""!==e.wysiwyg.element.textContent&&"\n"!==e.wysiwyg.element.textContent||(e.wysiwyg.element.innerHTML="");var n=(0,N.zh)(e);if("Backspace"===t.key&&(0,d.vU)()&&"\n"===n.startContainer.textContent&&1===n.startOffset&&(n.startContainer.textContent=""),Y(e,n),ne(e),"ArrowDown"===t.key||"ArrowRight"===t.key||"Backspace"===t.key||"ArrowLeft"===t.key||"ArrowUp"===t.key){"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||e.hint.render(e);var r=(0,b.fb)(n.startContainer,"vditor-wysiwyg__preview");if(!r&&3!==n.startContainer.nodeType&&n.startOffset>0&&(o=n.startContainer).classList.contains("vditor-wysiwyg__block")&&(r=o.lastElementChild),r)if("none"!==r.previousElementSibling.style.display){var i=r.previousElementSibling;if("PRE"===i.tagName&&(i=i.firstElementChild),"ArrowDown"===t.key||"ArrowRight"===t.key){var o,a=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling}(o=r.parentElement);if(a&&3!==a.nodeType){var l=a.querySelector(".vditor-wysiwyg__preview");if(l)return void ee(l,e)}if(3===a.nodeType){for(;0===a.textContent.length&&a.nextSibling;)a=a.nextSibling;n.setStart(a,1)}else n.setStart(a.firstChild,0)}else n.selectNodeContents(i),n.collapse(!1)}else"ArrowDown"===t.key||"ArrowRight"===t.key?ee(r,e):ee(r,e,!1)}}}))},e}(),Bn=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();const qn=function(e){function t(t,n){var r=e.call(this)||this;r.version=o.H,"string"==typeof t&&(n?n.cache?n.cache.id||(n.cache.id="vditor"+t):n.cache={id:"vditor"+t}:n={cache:{id:"vditor"+t}},t=document.getElementById(t));var i=new In(n).merge();if(!["en_US","ja_JP","ko_KR","ru_RU","zh_CN","zh_TW"].includes(i.lang))throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return r.vditor={currentMode:i.mode,element:t,hint:new Tt(i.hint.extend),lute:void 0,options:i,originalInnerHTML:t.innerHTML,outline:new Ht(U.a[i.lang].outline),tip:new jt},r.vditor.sv=new Rt(r.vditor),r.vditor.undo=new Rn,r.vditor.wysiwyg=new Pn(r.vditor),r.vditor.ir=new Mt(r.vditor),r.vditor.toolbar=new Dn(r.vditor),i.resize.enable&&(r.vditor.resize=new Ot(r.vditor)),r.vditor.toolbar.elements.devtools&&(r.vditor.devtools=new c),(i.upload.url||i.upload.handler)&&(r.vditor.upload=new Pe),(0,s.G)(n._lutePath||i.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then((function(){r.vditor.lute=(0,_t.X)({autoSpace:r.vditor.options.preview.markdown.autoSpace,codeBlockPreview:r.vditor.options.preview.markdown.codeBlockPreview,emojiSite:r.vditor.options.hint.emojiPath,emojis:r.vditor.options.hint.emoji,fixTermTypo:r.vditor.options.preview.markdown.fixTermTypo,footnotes:r.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:r.vditor.options.preview.math.inlineDigit,linkBase:r.vditor.options.preview.markdown.linkBase,linkPrefix:r.vditor.options.preview.markdown.linkPrefix,listStyle:r.vditor.options.preview.markdown.listStyle,mark:r.vditor.options.preview.markdown.mark,mathBlockPreview:r.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:r.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:r.vditor.options.preview.markdown.sanitize,toc:r.vditor.options.preview.markdown.toc}),r.vditor.preview=new Dt(r.vditor),function(e){e.element.innerHTML="",e.element.classList.add("vditor"),V(e),(0,W.Z)(e.options.preview.theme.current,e.options.preview.theme.path),"number"==typeof e.options.height&&(e.element.style.height=e.options.height+"px"),"number"==typeof e.options.minHeight&&(e.element.style.minHeight=e.options.minHeight+"px"),"number"==typeof e.options.width?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","left"===e.options.outline.position&&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),"right"===e.options.outline.position&&(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),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe style="width: 100%;height: 0;border: 0"></iframe>'),he(e,e.options.mode,z(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&void 0!==window.visualViewport){var n=!1,r=function(t){n||(n=!0,requestAnimationFrame((function(){n=!1;var t=e.toolbar.element;t.style.transform="none",t.getBoundingClientRect().top<0&&(t.style.transform="translate(0, "+-t.getBoundingClientRect().top+"px)")})))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}}(r.vditor),i.after&&i.after(),i.icon&&(0,s.J)(i.cdn+"/dist/js/icons/"+i.icon+".js","vditorIconScript")})),r}return Bn(t,e),t.prototype.setTheme=function(e,t,n,r){this.vditor.options.theme=e,V(this.vditor),t&&(this.vditor.options.preview.theme.current=t,(0,W.Z)(t,r||this.vditor.options.preview.theme.path)),n&&(this.vditor.options.preview.hljs.style=n,(0,Ut.Y)(n,this.vditor.options.cdn))},t.prototype.getValue=function(){return l(this.vditor)},t.prototype.getCurrentMode=function(){return this.vditor.currentMode},t.prototype.focus=function(){"sv"===this.vditor.currentMode?this.vditor.sv.element.focus():"wysiwyg"===this.vditor.currentMode?this.vditor.wysiwyg.element.focus():"ir"===this.vditor.currentMode&&this.vditor.ir.element.focus()},t.prototype.blur=function(){"sv"===this.vditor.currentMode?this.vditor.sv.element.blur():"wysiwyg"===this.vditor.currentMode?this.vditor.wysiwyg.element.blur():"ir"===this.vditor.currentMode&&this.vditor.ir.element.blur()},t.prototype.disabled=function(){g(this.vditor,["subToolbar","hint","popover"]),f(this.vditor.toolbar.elements,o.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,o.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(){return"wysiwyg"===this.vditor.currentMode?ge(this.vditor.wysiwyg.element):"sv"===this.vditor.currentMode?ge(this.vditor.sv.element):"ir"===this.vditor.currentMode?ge(this.vditor.ir.element):void 0},t.prototype.renderPreview=function(e){this.vditor.preview.render(this.vditor,e)},t.prototype.getCursorPosition=function(){return(0,N.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){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(e){return this.vditor.lute.HTML2Md(e)},t.prototype.getHTML=function(){return xt(this.vditor)},t.prototype.tip=function(e,t){this.vditor.tip.show(e,t)},t.prototype.setPreviewMode=function(e){It(e,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(e){document.execCommand("insertHTML",!1,e)},t.prototype.insertValue=function(e,t){void 0===t&&(t=!0);var n=(0,N.zh)(this.vditor);n.collapse(!0);var r=document.createElement("template");r.innerHTML=e,n.insertNode(r.content.cloneNode(!0)),"sv"===this.vditor.currentMode?(this.vditor.sv.preventInput=!0,t&&q(this.vditor)):"wysiwyg"===this.vditor.currentMode?(this.vditor.wysiwyg.preventInput=!0,t&&qe(this.vditor,getSelection().getRangeAt(0))):"ir"===this.vditor.currentMode&&(this.vditor.ir.preventInput=!0,t&&j(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.setValue=function(e,t){var n=this;void 0===t&&(t=!1),"sv"===this.vditor.currentMode?(this.vditor.sv.element.innerHTML=this.vditor.lute.SpinVditorSVDOM(e),He(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):"wysiwyg"===this.vditor.currentMode?ue(this.vditor,e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}):(this.vditor.ir.element.innerHTML=this.vditor.lute.Md2VditorIRDOM(e),this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach((function(e){H(e,n.vditor)})),kt(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),e||(g(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),t&&this.clearStack()},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"),document.getElementById("vditorIconScript").remove(),this.clearCache()},t.prototype.getCommentIds=function(){return"wysiwyg"!==this.vditor.currentMode?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(e){if("wysiwyg"===this.vditor.currentMode){var t=function(t){t.classList.remove("vditor-comment--hover"),e.forEach((function(e){t.getAttribute("data-cmtids").indexOf(e)>-1&&t.classList.add("vditor-comment--hover")}))};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach((function(e){t(e)})),"none"!==this.vditor.preview.element.style.display&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach((function(e){t(e)}))}},t.prototype.unHlCommentIds=function(e){if("wysiwyg"===this.vditor.currentMode){var t=function(t){e.forEach((function(e){t.getAttribute("data-cmtids").indexOf(e)>-1&&t.classList.remove("vditor-comment--hover")}))};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach((function(e){t(e)})),"none"!==this.vditor.preview.element.style.display&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach((function(e){t(e)}))}},t.prototype.removeCommentIds=function(e){var t=this;if("wysiwyg"===this.vditor.currentMode){var n=function(e,n){var r=e.getAttribute("data-cmtids").split(" ");r.find((function(e,t){if(e===n)return r.splice(t,1),!0})),0===r.length?(e.outerHTML=e.innerHTML,(0,N.zh)(t.vditor).collapse(!0)):e.setAttribute("data-cmtids",r.join(" "))};e.forEach((function(e){t.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach((function(t){n(t,e)})),"none"!==t.vditor.preview.element.style.display&&t.vditor.preview.element.querySelectorAll(".vditor-comment").forEach((function(t){n(t,e)}))})),Z(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t}(i.default)})(),r=r.default})(),C=c({inheritAttrs:!1,props:{height:b.number.def(360),value:b.string.def("")},emits:["change","get"],setup(e,{attrs:r,emit:i}){const o=d(null),a=d(null),s=d(!1),c=k(),{getLocale:g}=w(),{getDarkMode:y}=E();u([()=>y.value,()=>s.value],(([e])=>{const t=p(a);if(!t)return;const n="dark"===e?"dark":void 0;t.setTheme(n)}),{immediate:!0,flush:"post"});const b=m((()=>{let e;switch(p(g)){case"en":e="en_US";break;case"ja":e="ja_JP";break;case"ko":e="ko_KR";break;default:e="zh_CN"}return e}));function S(){const c=p(o);if(!c)return;const d=l(l({},r),e);var u;a.value=new L(c,(u=l({theme:"classic",lang:p(b),mode:"sv",preview:{actions:[]},input:e=>{i("change",e)},blur:()=>{var t;null==(t=p(a))||t.setValue(e.value)}},d),t(u,n({cache:{enable:!1}})))),s.value=!0}const C={getVditor:()=>a.value};return f((()=>{h((()=>{S(),setTimeout((()=>{var e;null==(e=null==c?void 0:c.redoModalHeight)||e.call(c)}),200)})),i("get",C)})),v((()=>{var e;const t=p(a);if(t)try{null==(e=null==t?void 0:t.destroy)||e.call(t)}catch(n){}})),l({wrapRef:o},C)}});
  /*!
   * Vditor v3.8.5 - A markdown editor written in TypeScript.
   *
   * MIT License
   *
   * Copyright (c) 2018-present B3log 开源, b3log.org
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   *
   */const T={ref:"wrapRef"};C.render=function(e,t,n,r,i,o){return g(),y("div",T,null,512)};export default C;
  