UNPKG

vditor

Version:

♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生

1 lines 269 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Vditor=t():e.Vditor=t()}(this,(function(){return(()=>{var e={14:e=>{var t=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},n=-1;t.Diff=function(e,t){return[e,t]},t.prototype.diff_main=function(e,n,r,i){void 0===i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var o=i;if(null==e||null==n)throw new Error("Null input. (diff_main)");if(e==n)return e?[new t.Diff(0,e)]:[];void 0===r&&(r=!0);var a=r,l=this.diff_commonPrefix(e,n),s=e.substring(0,l);e=e.substring(l),n=n.substring(l),l=this.diff_commonSuffix(e,n);var d=e.substring(e.length-l);e=e.substring(0,e.length-l),n=n.substring(0,n.length-l);var c=this.diff_compute_(e,n,a,o);return s&&c.unshift(new t.Diff(0,s)),d&&c.push(new t.Diff(0,d)),this.diff_cleanupMerge(c),c},t.prototype.diff_compute_=function(e,r,i,o){var a;if(!e)return[new t.Diff(1,r)];if(!r)return[new t.Diff(n,e)];var l=e.length>r.length?e:r,s=e.length>r.length?r:e,d=l.indexOf(s);if(-1!=d)return a=[new t.Diff(1,l.substring(0,d)),new t.Diff(0,s),new t.Diff(1,l.substring(d+s.length))],e.length>r.length&&(a[0][0]=a[2][0]=n),a;if(1==s.length)return[new t.Diff(n,e),new t.Diff(1,r)];var c=this.diff_halfMatch_(e,r);if(c){var u=c[0],p=c[1],m=c[2],f=c[3],h=c[4],v=this.diff_main(u,m,i,o),g=this.diff_main(p,f,i,o);return v.concat([new t.Diff(0,h)],g)}return i&&e.length>100&&r.length>100?this.diff_lineMode_(e,r,o):this.diff_bisect_(e,r,o)},t.prototype.diff_lineMode_=function(e,r,i){var o=this.diff_linesToChars_(e,r);e=o.chars1,r=o.chars2;var a=o.lineArray,l=this.diff_main(e,r,!1,i);this.diff_charsToLines_(l,a),this.diff_cleanupSemantic(l),l.push(new t.Diff(0,""));for(var s=0,d=0,c=0,u="",p="";s<l.length;){switch(l[s][0]){case 1:c++,p+=l[s][1];break;case n:d++,u+=l[s][1];break;case 0:if(d>=1&&c>=1){l.splice(s-d-c,d+c),s=s-d-c;for(var m=this.diff_main(u,p,!1,i),f=m.length-1;f>=0;f--)l.splice(s,0,m[f]);s+=m.length}c=0,d=0,u="",p=""}s++}return l.pop(),l},t.prototype.diff_bisect_=function(e,r,i){for(var o=e.length,a=r.length,l=Math.ceil((o+a)/2),s=l,d=2*l,c=new Array(d),u=new Array(d),p=0;p<d;p++)c[p]=-1,u[p]=-1;c[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=(T=w==-b||w!=b&&c[E-1]<c[E+1]?c[E+1]:c[E-1]+1)-w;T<o&&k<a&&e.charAt(T)==r.charAt(k);)T++,k++;if(c[E]=T,T>o)v+=2;else if(k>a)h+=2;else if(f){if((C=s+m-w)>=0&&C<d&&-1!=u[C])if(T>=(L=o-u[C]))return this.diff_bisectSplit_(e,r,T,k,i)}}for(var S=-b+g;S<=b-y;S+=2){for(var L,C=s+S,M=(L=S==-b||S!=b&&u[C-1]<u[C+1]?u[C+1]:u[C-1]+1)-S;L<o&&M<a&&e.charAt(o-L-1)==r.charAt(a-M-1);)L++,M++;if(u[C]=L,L>o)y+=2;else if(M>a)g+=2;else if(!f){if((E=s+m-S)>=0&&E<d&&-1!=c[E]){var T;k=s+(T=c[E])-E;if(T>=(L=o-L))return this.diff_bisectSplit_(e,r,T,k,i)}}}}return[new t.Diff(n,e),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(e,t,n,r,i){var o=e.substring(0,n),a=t.substring(0,r),l=e.substring(n),s=t.substring(r),d=this.diff_main(o,a,!1,i),c=this.diff_main(l,s,!1,i);return d.concat(c)},t.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function i(e){for(var t="",i=0,a=-1,l=n.length;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)),d=-1,c="";-1!=(d=t.indexOf(s,d+1));){var u=i.diff_commonPrefix(e.substring(n),t.substring(d)),p=i.diff_commonSuffix(e.substring(0,n),t.substring(0,d));c.length<p+u&&(c=t.substring(d-p,d)+t.substring(d,d+u),r=e.substring(0,n-p),o=e.substring(n+u),a=t.substring(0,d-p),l=t.substring(d+u))}return 2*c.length>=e.length?[r,o,a,l,c]:null}var a,l,s,d,c,u=o(n,r,Math.ceil(n.length/4)),p=o(n,r,Math.ceil(n.length/2));return u||p?(a=p?u&&u[4].length>p[4].length?u:p:u,e.length>t.length?(l=a[0],s=a[1],d=a[2],c=a[3]):(d=a[0],c=a[1],l=a[2],s=a[3]),[l,s,d,c,a[4]]):null},t.prototype.diff_cleanupSemantic=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=0,d=0,c=0,u=0;l<e.length;)0==e[l][0]?(i[o++]=l,s=c,d=u,c=0,u=0,a=e[l][1]):(1==e[l][0]?c+=e[l][1].length:u+=e[l][1].length,a&&a.length<=Math.max(s,d)&&a.length<=Math.max(c,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,d=0,c=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_),d=l&&r.match(t.linebreakRegex_),c=s&&i.match(t.linebreakRegex_),u=d&&e.match(t.blanklineEndRegex_),p=c&&n.match(t.blanklineStartRegex_);return u||p?5:d||c?4:o&&!l&&s?3:l||s?2:o||a?1:0}for(var r=1;r<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 d=i,c=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,d=i,c=o,u=a)}e[r-1][1]!=d&&(d?e[r-1][1]=d:(e.splice(r-1,1),r--),e[r][1]=c,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(e){for(var r=!1,i=[],o=0,a=null,l=0,s=!1,d=!1,c=!1,u=!1;l<e.length;)0==e[l][0]?(e[l][1].length<this.Diff_EditCost&&(c||u)?(i[o++]=l,s=c,d=u,a=e[l][1]):(o=0,a=null),c=u=!1):(e[l][0]==n?u=!0:c=!0,a&&(s&&d&&c&&u||a.length<this.Diff_EditCost/2&&s+d+c+u==3)&&(e.splice(i[o-1],0,new t.Diff(n,a)),e[i[o-1]+1][0]=1,o--,a=null,s&&d?(c=u=!0,o=0):(l=--o>0?i[o-1]:-1,c=u=!1),r=!0)),l++;r&&this.diff_cleanupMerge(e)},t.prototype.diff_cleanupMerge=function(e){e.push(new t.Diff(0,""));for(var r,i=0,o=0,a=0,l="",s="";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 d=!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),d=!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),d=!0)),i++;d&&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],d=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;">'+d+"</ins>";break;case n:t[l]='<del style="background:#ffe6e6;">'+d+"</del>";break;case 0:t[l]="<span>"+d+"</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 d=l[s].substring(1);switch(l[s].charAt(0)){case"+":try{i[o++]=new t.Diff(1,decodeURI(d))}catch(e){throw new Error("Illegal escape in diff_fromDelta: "+d)}break;case"-":case"=":var c=parseInt(d,10);if(isNaN(c)||c<0)throw new Error("Invalid number in diff_fromDelta: "+d);var u=e.substring(a,a+=c);"="==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,d,c=1<<t.length-1;l=-1;for(var u,p=t.length+e.length,m=0;m<t.length;m++){for(s=0,d=p;s<d;)o(m,n+d)<=a?s=d:p=d,d=Math.floor((p-s)/2+s);p=d;var f=Math.max(1,n-d+1),h=Math.min(n+d,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]&c){var b=o(m,g-1);if(b<=a){if(a=b,!((l=g-1)>n))break;f=Math.max(1,2*n-l)}}}if(o(m+1,n)>a)break;u=v}return l},t.prototype.match_alphabet_=function(e){for(var t={},n=0;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,d=0,c=0,u=0,p=o,m=o,f=0;f<a.length;f++){var h=a[f][0],v=a[f][1];switch(d||0===h||(s.start1=c,s.start2=u),h){case 1:s.diffs[d++]=a[f],s.length2+=v.length,m=m.substring(0,u)+v+m.substring(u);break;case n:s.length1+=v.length,s.diffs[d++]=a[f],m=m.substring(0,u)+m.substring(u+v.length);break;case 0:v.length<=2*this.Patch_Margin&&d&&a.length!=f+1?(s.diffs[d++]=a[f],s.length1+=v.length,s.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(s,p),l.push(s),s=new t.patch_obj,d=0,p=m,c=u)}1!==h&&(c+=v.length),h!==n&&(u+=v.length)}return d&&(this.patch_addContext_(s,p),l.push(s)),l},t.prototype.patch_deepCopy=function(e){for(var n=[],r=0;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,d=e[a].start2+i,c=this.diff_text1(e[a].diffs),u=-1;if(c.length>this.Match_MaxBits?-1!=(l=this.match_main(t,c.substring(0,this.Match_MaxBits),d))&&(-1==(u=this.match_main(t,c.substring(c.length-this.Match_MaxBits),d+c.length-this.Match_MaxBits))||l>=u)&&(l=-1):l=this.match_main(t,c,d),-1==l)o[a]=!1,i-=e[a].length2-e[a].length1;else if(o[a]=!0,i=l-d,c==(s=-1==u?t.substring(l,l+c.length):t.substring(l,u+this.Match_MaxBits)))t=t.substring(0,l)+this.diff_text2(e[a].diffs)+t.substring(l+c.length);else{var p=this.diff_main(c,s,!1);if(c.length>this.Match_MaxBits&&this.diff_levenshtein(p)/c.length>this.Patch_DeleteThreshold)o[a]=!1;else{this.diff_cleanupSemanticLossless(p);for(var m,f=0,h=0;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}if(0==(a=(o=e[e.length-1]).diffs).length||0!=a[a.length-1][0])a.push(new t.Diff(0,r)),o.length1+=n,o.length2+=n;else if(n>a[a.length-1][1].length){l=n-a[a.length-1][1].length;a[a.length-1][1]+=r.substring(0,l),o.length1+=l,o.length2+=l}return r},t.prototype.patch_splitMax=function(e){for(var r=this.Match_MaxBits,i=0;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 d=new t.patch_obj,c=!0;for(d.start1=a-s.length,d.start2=l-s.length,""!==s&&(d.length1=d.length2=s.length,d.diffs.push(new t.Diff(0,s)));0!==o.diffs.length&&d.length1<r-this.Patch_Margin;){var u=o.diffs[0][0],p=o.diffs[0][1];1===u?(d.length2+=p.length,l+=p.length,d.diffs.push(o.diffs.shift()),c=!1):u===n&&1==d.diffs.length&&0==d.diffs[0][0]&&p.length>2*r?(d.length1+=p.length,a+=p.length,c=!1,d.diffs.push(new t.Diff(u,p)),o.diffs.shift()):(p=p.substring(0,r-d.length1-this.Patch_Margin),d.length1+=p.length,a+=p.length,0===u?(d.length2+=p.length,l+=p.length):c=!1,d.diffs.push(new t.Diff(u,p)),p==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(p.length))}s=(s=this.diff_text2(d.diffs)).substring(s.length-this.Patch_Margin);var m=this.diff_text1(o.diffs).substring(0,this.Patch_Margin);""!==m&&(d.length1+=m.length,d.length2+=m.length,0!==d.diffs.length&&0===d.diffs[d.diffs.length-1][0]?d.diffs[d.diffs.length-1][1]+=m:d.diffs.push(new t.Diff(0,m))),c||e.splice(++i,0,d)}}},t.prototype.patch_toText=function(e){for(var t=[],n=0;n<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 d=i[o].charAt(0);try{var c=decodeURI(i[o].substring(1))}catch(e){throw new Error("Illegal escape in patch_fromText: "+c)}if("-"==d)s.diffs.push(new t.Diff(n,c));else if("+"==d)s.diffs.push(new t.Diff(1,c));else if(" "==d)s.diffs.push(new t.Diff(0,c));else{if("@"==d)break;if(""!==d)throw new Error('Invalid patch mode "'+d+'" in: '+c)}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},872:(e,t,n)=>{"use strict";n.d(t,{default:()=>D});var r=n(478),i=n(156),o=n(314),a=n(730),l=n(66),s=n(218),d=n(702),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)})))},u=n(466),p=n(554),m=n(40),f=n(563),h=n(749),v=n(818),g=n(408),y=n(54),b=n(227),w=n(526),E=n(827),k=n(640),S=n(895),L=n(393),C=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>';document.getElementById("vditorIconScript")||(n='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',r='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var i=document.querySelector(".vditor-speech");if(!i){(i=document.createElement("div")).className="vditor-speech",document.body.insertAdjacentElement("beforeend",i);var o=function(){var e,n;return speechSynthesis.getVoices().forEach((function(r){r.lang===t.replace("_","-")&&(e=r),r.default&&(n=r)})),e||(e=n),e};void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=o);var a=o();i.onclick=function(){if("vditor-speech"===i.className){var e=new SpeechSynthesisUtterance(i.getAttribute("data-text"));e.voice=a,e.onend=function(){i.className="vditor-speech",speechSynthesis.cancel(),i.innerHTML=n},speechSynthesis.speak(e),i.className="vditor-speech vditor-speech--current",i.innerHTML=r}else speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),i.innerHTML=r):(speechSynthesis.pause(),i.innerHTML=n));(0,L.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.clientX+2+"px",i.setAttribute("data-text",t)}else"block"===i.style.display&&(i.className="vditor-speech",i.style.display="none")}))}},M=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((r=r.apply(e,t||[])).next())}))},T=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<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(e){o=[6,e],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])}}},A=function(e){var t={anchor:0,cdn:y.g.CDN,customEmoji:{},emojiPath:(e&&e.emojiPath||y.g.CDN)+"/dist/images/emoji",hljs:y.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:y.g.MARKDOWN_OPTIONS,math:y.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},theme:y.g.THEME_OPTIONS};return(0,k.T)(t,e)},_=function(e,t){var n=A(t);return(0,w.G)(n.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then((function(){var r=(0,S.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 M(void 0,void 0,void 0,(function(){var i,v,y;return T(this,(function(k){switch(k.label){case 0:return i=A(n),[4,_(t,i)];case 1:if(v=k.sent(),i.transform&&(v=i.transform(v)),e.innerHTML=v,e.classList.add("vditor-reset"),i.i18n)return[3,5];if(["en_US","fr_FR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(i.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return y="vditorI18nScript"+i.lang,document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach((function(e){e.id!==y&&document.head.removeChild(e)})),[4,(0,w.G)(i.cdn+"/dist/js/i18n/"+i.lang+".js",y)];case 3:k.sent(),k.label=4;case 4:return[3,6];case 5:window.VditorI18n=i.i18n,k.label=6;case 6:return i.icon?[4,(0,w.G)(i.cdn+"/dist/js/icons/"+i.icon+".js","vditorIconScript")]:[3,8];case 7:k.sent(),k.label=8;case 8:return(0,b.Z)(i.theme.current,i.theme.path),1===i.anchor&&e.classList.add("vditor-reset--anchor"),(0,a.O)(e),(0,d.s)(i.hljs,e,i.cdn),(0,u.H)(e,{cdn:i.cdn,math:i.math}),(0,m.i)(e,i.cdn,i.mode),(0,f.K)(e,i.cdn,i.mode),(0,l.P)(e,i.cdn),(0,s.v)(e,i.cdn),(0,o.p)(e,i.cdn,i.mode),(0,h.P)(e,i.cdn,i.mode),(0,g.B)(e,i.cdn),(0,r.Q)(e,i.cdn),(0,p.Y)(e),i.speech.enable&&C(e),0!==i.anchor&&(S=i.anchor,document.querySelectorAll(".vditor-anchor").forEach((function(e){1===S&&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)}),i.after&&i.after(),i.lazyLoadImage&&c(e),e.addEventListener("click",(function(t){var n=(0,E.lG)(t.target,"SPAN");if(n&&(0,E.fb)(n,"vditor-toc")){var r=e.querySelector("#"+n.getAttribute("data-target-id"));r&&window.scrollTo(window.scrollX,r.offsetTop)}else;})),[2]}var S}))}))},H=n(863),N=n(312);const D=function(){function e(){}return e.adapterRender=i,e.previewImage=H.E,e.codeRender=a.O,e.graphvizRender=s.v,e.highlightRender=d.s,e.mathRender=u.H,e.mermaidRender=m.i,e.markmapRender=f.K,e.flowchartRender=l.P,e.chartRender=o.p,e.abcRender=r.Q,e.mindmapRender=h.P,e.plantumlRender=g.B,e.outlineRender=v.k,e.mediaRender=p.Y,e.speechRender=C,e.lazyLoadImageRender=c,e.md2html=_,e.preview=x,e.setCodeTheme=N.Y,e.setContentTheme=b.Z,e}()},54:(e,t,n)=>{"use strict";n.d(t,{H:()=>r,g:()=>i});var r="3.9.2",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","markmap","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica","solidity","yul"],e.CDN="https://unpkg.com/vditor@3.9.2",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,defaultLang:"",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}()},478:(e,t,n)=>{"use strict";n.d(t,{Q:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=o.abcRenderAdapter.getElements(e);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,o.abcRenderAdapter.getCode(e).trim()),e.style.overflowX="auto",e.setAttribute("data-processed","true"))}))}))}},156:(e,t,n)=>{"use strict";n.r(t),n.d(t,{mathRenderAdapter:()=>r,mermaidRenderAdapter:()=>i,markmapRenderAdapter:()=>o,mindmapRenderAdapter:()=>a,chartRenderAdapter:()=>l,abcRenderAdapter:()=>s,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>c,plantumlRenderAdapter:()=>u});var r={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-math")}},i={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-mermaid")}},o={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-markmap")}},a={getCode:function(e){return e.getAttribute("data-code")},getElements:function(e){return e.querySelectorAll(".language-mindmap")}},l={getCode:function(e){return e.innerText},getElements:function(e){return e.querySelectorAll(".language-echarts")}},s={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-abc")}},d={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-graphviz")}},c={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-flowchart")}},u={getCode:function(e){return e.textContent},getElements:function(e){return e.querySelectorAll(".language-plantuml")}}},314:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var a=o.chartRenderAdapter.getElements(e);a.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){a.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=o.chartRenderAdapter.getCode(e).trim();if(t)try{if("true"===e.getAttribute("data-processed"))return;var r=JSON.parse(t);echarts.init(e,"dark"===n?"dark":void 0).setOption(r),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="echarts render error: <br>"+t}}}))}))}},730:(e,t,n)=>{"use strict";n.d(t,{O:()=>o});var r=n(51),i=n(54),o=function(e){e.querySelectorAll("pre > code").forEach((function(t,n){var o,a,l;if(!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-markmap")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math")||t.style.maxHeight.indexOf("px")>-1||e.classList.contains("vditor-preview")&&n>5)){var s=t.innerText;if(t.classList.contains("highlight-chroma")){var d=document.createElement("code");d.innerHTML=t.innerHTML,d.querySelectorAll(".highlight-ln").forEach((function(e){e.remove()})),s=d.innerText}else s.endsWith("\n")&&(s=s.substr(0,s.length-1));var c='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(c='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var u=document.createElement("div");u.className="vditor-copy",u.innerHTML='<span aria-label="'+((null===(o=window.VditorI18n)||void 0===o?void 0:o.copy)||"复制")+"\"\nonmouseover=\"this.setAttribute('aria-label', '"+((null===(a=window.VditorI18n)||void 0===a?void 0:a.copy)||"复制")+"')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '"+((null===(l=window.VditorI18n)||void 0===l?void 0:l.copied)||"已复制")+"')\">"+c+"</span>";var p=document.createElement("textarea");p.value=(0,r.X)(s),u.insertAdjacentElement("afterbegin",p),t.before(u),t.style.maxHeight=window.outerHeight-40+"px",t.insertAdjacentHTML("afterend",'<span style="position: absolute">'+i.g.ZWSP+"</span>")}}))}},66:(e,t,n)=>{"use strict";n.d(t,{P:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t){void 0===t&&(t=r.g.CDN);var n=o.flowchartRenderAdapter.getElements(e);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(o.flowchartRenderAdapter.getCode(e));e.innerHTML="",t.drawSVG(e),e.setAttribute("data-processed","true")}}))}))}},218:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t){void 0===t&&(t=r.g.CDN);var n=o.graphvizRenderAdapter.getElements(e);0!==n.length&&(0,i.G)(t+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then((function(){n.forEach((function(e){var t=o.graphvizRenderAdapter.getCode(e);if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&"true"!==e.getAttribute("data-processed")&&""!==t.trim()){try{var n=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),r=(window.URL||window.webkitURL).createObjectURL(n),i=new Worker(r);new Viz({worker:i}).renderSVGElement(t).then((function(t){e.innerHTML=t.outerHTML})).catch((function(t){e.innerHTML="graphviz render error: <br>"+t,e.className="vditor-reset--error"}))}catch(e){console.error("graphviz error",e)}e.setAttribute("data-processed","true")}}))}))}},702:(e,t,n)=>{"use strict";n.d(t,{s:()=>a});var r=n(54),i=n(526),o=n(578),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(){(0,i.G)(n+"/dist/js/highlight.js/solidity.min.js","vditorHljsSolidityScript").then((function(){(0,i.G)(n+"/dist/js/highlight.js/yul.min.js","vditorHljsYulScript").then((function(){t.querySelectorAll("pre > code").forEach((function(t){if(!t.parentElement.classList.contains("vditor-ir__marker--pre")&&!t.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(t.classList.contains("language-mermaid")||t.classList.contains("language-flowchart")||t.classList.contains("language-echarts")||t.classList.contains("language-mindmap")||t.classList.contains("language-plantuml")||t.classList.contains("language-abc")||t.classList.contains("language-graphviz")||t.classList.contains("language-math"))&&(""!==e.defaultLang&&-1===t.className.indexOf("language-")&&t.classList.add("language-"+e.defaultLang),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)}}))}))}))})))}},563:(e,t,n)=>{"use strict";n.d(t,{K:()=>s});var r=n(54),i=n(526),o=n(156),a={},l=function(e,t){var n=window.markmap,r=n.Transformer,i=n.Markmap,o=n.deriveOptions,l=(n.globalCSS,new r);e.innerHTML='<svg style="width:100%"></svg>';var s=e.firstChild,d=i.create(s,null),c=function(e,t){var n=e.transform(t),r=Object.keys(n.features).filter((function(e){return!a[e]}));r.forEach((function(e){a[e]=!0}));var i=e.getAssets(r),o=i.styles,l=i.scripts,s=window.markmap;return o&&s.loadCSS(o),l&&s.loadJS(l),n}(l,t),u=c.root,p=c.frontmatter,m=o(null==p?void 0:p.markmap);d.setData(u,m),d.fit()},s=function(e,t,n){void 0===t&&(t=r.g.CDN);var a=o.markmapRenderAdapter.getElements(e);0!==a.length&&(0,i.G)(t+"/src/js/markmap/markmap.min.js","vditorMermaidScript").then((function(){a.forEach((function(e){var t=o.markmapRenderAdapter.getCode(e);if("true"!==e.getAttribute("data-processed")&&""!==t.trim()){var n=document.createElement("div");n.className="language-markmap",e.parentNode.appendChild(n),l(n,t),"CODE"==e.parentNode.childNodes[0].nodeName&&e.parentNode.removeChild(e.parentNode.childNodes[0])}}))}))}},466:(e,t,n)=>{"use strict";n.d(t,{H:()=>s});var r=n(54),i=n(526),o=n(578),a=n(51),l=n(156),s=function(e,t){var n=l.mathRenderAdapter.getElements(e);if(0!==n.length){var s={cdn:r.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(t&&t.math&&(t.math=Object.assign({},s.math,t.math)),"KaTeX"===(t=Object.assign({},s,t)).math.engine)(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(){(0,i.G)(t.cdn+"/dist/js/katex/mhchem.min.js","vditorKatexChemScript").then((function(){n.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")&&!e.getAttribute("data-math")){var t=(0,a.X)(l.mathRenderAdapter.getCode(e));e.setAttribute("data-math",t);try{e.innerHTML=katex.renderToString(t,{displayMode:"DIV"===e.tagName,output:"html"})}catch(t){e.innerHTML=t.message,e.className="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 d=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?d(r):d(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)}))}}}},554:(e,t,n)=>{"use strict";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+)/),d=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()):d&&d[1]&&(e.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'+d[1]+'"></iframe>'),e.remove())}(e,t))}))}},40:(e,t,n)=>{"use strict";n.d(t,{i:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t,n){void 0===t&&(t=r.g.CDN);var a=o.mermaidRenderAdapter.getElements(e);0!==a.length&&(0,i.G)(t+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then((function(){var e={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8},gantt:{leftPadding:75,rightPadding:20}};"dark"===n&&(e.theme="dark"),mermaid.initialize(e),a.forEach((function(e){var t=o.mermaidRenderAdapter.getCode(e);"true"!==e.getAttribute("data-processed")&&""!==t.trim()&&(mermaid.init(void 0,e),e.setAttribute("data-processed","true"))}))}))}},749:(e,t,n)=>{"use strict";n.d(t,{P:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t,n){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var a=o.mindmapRenderAdapter.getElements(e);a.length>0&&(0,i.G)(t+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then((function(){a.forEach((function(e){if(!e.parentElement.classList.contains("vditor-wysiwyg__pre")&&!e.parentElement.classList.contains("vditor-ir__marker--pre")){var t=o.mindmapRenderAdapter.getCode(e);if(t)try{if("true"===e.getAttribute("data-processed"))return;echarts.init(e,"dark"===n?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(t))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(e,t){var n;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.children)?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),e.setAttribute("data-processed","true")}catch(t){e.className="vditor-reset--error",e.innerHTML="mindmap render error: <br>"+t}}}))}))}},818:(e,t,n)=>{"use strict";n.d(t,{k:()=>o});var r=n(64),i=n(466),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 d=l.firstElementChild.querySelectorAll("li > span[data-target-id]");return d.forEach((function(e,t){if(e.nextElementSibling&&"UL"===e.nextElementSibling.tagName){var n="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(n='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),e.innerHTML=n+"<span>"+e.innerHTML+"</span>"}else e.innerHTML="<svg></svg><span>"+e.innerHTML+"</span>";e.setAttribute("data-target-id",a[t])})),o=l.firstElementChild.innerHTML,0===d.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)}},408:(e,t,n)=>{"use strict";n.d(t,{B:()=>a});var r=n(54),i=n(526),o=n(156),a=function(e,t){void 0===e&&(e=document),void 0===t&&(t=r.g.CDN);var n=o.plantumlRenderAdapter.getElements(e);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=o.plantumlRenderAdapter.getCode(e).trim();if(t)try{e.innerHTML='<img src="http://www.plantuml.com/plantuml/svg/~1'+plantumlEncoder.encode(t)+'">'}catch(t){e.className="vditor-reset--error",e.innerHTML="plantuml render error: <br>"+t}}}))}))}},895:(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var r=function(e){var t=Lute.New();return t.PutEmojis(e.emojis),t.SetEmojiSite(e.emojiSite),t.SetHeadingAnchor(e.headingAnchor),t.SetInlineMathAllowDigitAfterOpenMarker(e.inlineMathDigit),t.SetAutoSpace(e.autoSpace),t.SetToC(e.toc),t.SetFootnotes(e.footnotes),t.SetFixTermTypo(e.fixTermTypo),t.SetVditorCodeBlockPreview(e.codeBlockPreview),t.SetVditorMathBlockPreview(e.mathBlockPreview),t.SetSanitize(e.sanitize),t.SetChineseParagraphBeginningSpace(e.paragraphBeginningSpace),t.SetRenderListStyle(e.listStyle),t.SetLinkBase(e.linkBase),t.SetLinkPrefix(e.linkPrefix),t.SetMark(e.mark),e.lazyLoadImage&&t.SetImageLazyLoading(e.lazyLoadImage),t}},863:(e,t,n)=>{"use strict";n.d(t,{E:()=>r});var r=function(e,t,n){void 0===t&&(t="zh_CN"),void 0===n&&(n="classic");var r=e.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'+("dark"===n?" vditor--dark":"")+'">\n <div class="vditor-img__b