From e9154f6ad05cf081cfe90dae4ff06dcf3fc58cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Wed, 13 Mar 2024 18:53:56 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20#714=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E7=9A=84=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/scripts/preview-demo.js | 5 +++++ src/Cherry.config.js | 18 ++++++++++++++++++ src/Editor.js | 6 ++++++ types/cherry.d.ts | 1 + 4 files changed, 30 insertions(+) diff --git a/examples/scripts/preview-demo.js b/examples/scripts/preview-demo.js index 8292fc923..990509005 100644 --- a/examples/scripts/preview-demo.js +++ b/examples/scripts/preview-demo.js @@ -62,6 +62,11 @@ var cherryConfig = { }, toolbars: { toolbar: false, + // 配置目录 + toc: { + updateLocationHash: false, // 要不要更新URL的hash + defaultModel: 'full', // pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题 + }, }, editor: { defaultModel: 'previewOnly', diff --git a/src/Cherry.config.js b/src/Cherry.config.js index aeb65c741..a2b7a87b2 100644 --- a/src/Cherry.config.js +++ b/src/Cherry.config.js @@ -56,6 +56,16 @@ const callbacks = { afterInit: (text, html) => {}, beforeImageMounted: (srcProp, src) => ({ srcProp, src }), onClickPreview: (event) => {}, + /** + * 粘贴时触发 + * @param {ClipboardEvent['clipboardData']} clipboardData + * @returns + * false: 走cherry粘贴的默认逻辑 + * string: 直接粘贴的内容 + */ + onPaste: (clipboardData) => { + return false; + }, onCopyCode: (event, code) => { // 阻止默认的粘贴事件 // return false; @@ -346,6 +356,14 @@ const defaultConfig = { onCopyCode: callbacks.onCopyCode, // 把中文变成拼音的回调,当然也可以把中文变成英文、英文变成中文 changeString2Pinyin: callbacks.changeString2Pinyin, + /** + * 粘贴时触发 + * @param {ClipboardEvent['clipboardData']} clipboardData + * @returns + * false: 走cherry粘贴的默认逻辑 + * string: 直接粘贴的内容 + */ + onPaste: callbacks.onPaste, }, previewer: { dom: false, diff --git a/src/Editor.js b/src/Editor.js index c9f70b7af..2e4594b14 100644 --- a/src/Editor.js +++ b/src/Editor.js @@ -265,6 +265,12 @@ export default class Editor { * @returns {boolean | void} */ handlePaste(event, clipboardData, codemirror) { + const onPasteRet = this.$cherry.options.callback.onPaste(clipboardData); + if (onPasteRet !== false && typeof onPasteRet === 'string') { + event.preventDefault(); + codemirror.replaceSelection(onPasteRet); + return; + } let html = clipboardData.getData('Text/Html'); const { items } = clipboardData; // 清空注释 diff --git a/types/cherry.d.ts b/types/cherry.d.ts index 9faee46aa..a8bfaa2ee 100644 --- a/types/cherry.d.ts +++ b/types/cherry.d.ts @@ -43,6 +43,7 @@ export interface CherryOptions { onClickPreview: (e: MouseEvent) => void; onCopyCode: (e: ClipboardEvent, code: string) => string|false; changeString2Pinyin: (str: string) => string; + onPaste: (clipboardData: ClipboardEvent['clipboardData']) => string|boolean; }; /** 预览区域配置 */ previewer: CherryPreviewerOptions; From 872ec1e53c153ff5ab85d598793804630565ebd1 Mon Sep 17 00:00:00 2001 From: jiawei686 <892001108@qq.com> Date: Fri, 15 Mar 2024 15:56:39 +0800 Subject: [PATCH 02/11] feat: support config mathjax installed by npm --- src/Engine.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Engine.js b/src/Engine.js index 4c72cec33..d877aec90 100644 --- a/src/Engine.js +++ b/src/Engine.js @@ -60,7 +60,10 @@ export default class Engine { const { syntax } = engine; const { plugins } = syntax.mathBlock; // 未开启公式 - if (!isBrowser() || (!syntax.mathBlock.src && !syntax.inlineMath.src)) { + if ( + !isBrowser() || + (!syntax.mathBlock.src && !syntax.inlineMath.src && !syntax.mathBlock.engine && !syntax.inlineMath.engine) + ) { return; } // 已经加载过MathJax From 0ae5b237be4571a4a4e74bf3d86fd6d5a5b8f8a3 Mon Sep 17 00:00:00 2001 From: Andre-John Mas Date: Mon, 18 Mar 2024 08:05:57 -0400 Subject: [PATCH 03/11] Issue #734 support for other locales (#736) * chore(release): v0.8.36 * Issue #734 support for other locales --------- Co-authored-by: jiawei686 <892001108@qq.com> --- .../cherry-code-block-mermaid-plugin.d.ts | 35 ++- .../cherry-code-block-mermaid-plugin.js | 4 +- .../cherry-code-block-plantuml-plugin.d.ts | 9 +- .../cherry-code-block-plantuml-plugin.js | 4 +- dist/cherry-markdown.core.common.d.ts | 6 +- dist/cherry-markdown.core.d.ts | 6 +- dist/cherry-markdown.d.ts | 6 +- dist/cherry-markdown.engine.core.common.d.ts | 6 +- dist/cherry-markdown.engine.core.d.ts | 6 +- dist/cherry-markdown.engine.core.esm.d.ts | 6 +- dist/cherry-markdown.esm.d.ts | 6 +- dist/cherry-markdown.min.d.ts | 6 +- dist/fonts/ch-icon.svg | 279 +++++++++++++++++- src/Cherry.config.js | 2 + src/Cherry.js | 10 +- types/cherry.d.ts | 5 +- 16 files changed, 355 insertions(+), 41 deletions(-) diff --git a/dist/addons/cherry-code-block-mermaid-plugin.d.ts b/dist/addons/cherry-code-block-mermaid-plugin.d.ts index 81473856a..7817883c8 100644 --- a/dist/addons/cherry-code-block-mermaid-plugin.d.ts +++ b/dist/addons/cherry-code-block-mermaid-plugin.d.ts @@ -1,3 +1,32 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f7e94c0e0790e3a81858a2788b170845f35dbda7a081f4c5ad677482e7b27128 -size 930 +export default class MermaidCodeEngine { + static TYPE: string; + static install(cherryOptions: any, ...args: any[]): void; + constructor(mermaidOptions?: {}); + mermaidAPIRefs: any; + options: { + theme: string; + altFontFamily: string; + fontFamily: string; + themeCSS: string; + flowchart: { + useMaxWidth: boolean; + }; + sequence: { + useMaxWidth: boolean; + }; + startOnLoad: boolean; + logLevel: number; + }; + dom: any; + mermaidCanvas: any; + mountMermaidCanvas($engine: any): void; + /** + * 转换svg为img,如果出错则直出svg + * @param {string} svgCode + * @param {string} graphId + * @returns {string} + */ + convertMermaidSvgToImg(svgCode: string, graphId: string): string; + render(src: any, sign: any, $engine: any, config?: {}): any; + svg2img: any; +} diff --git a/dist/addons/cherry-code-block-mermaid-plugin.js b/dist/addons/cherry-code-block-mermaid-plugin.js index a10559f19..cf8396a9c 100644 --- a/dist/addons/cherry-code-block-mermaid-plugin.js +++ b/dist/addons/cherry-code-block-mermaid-plugin.js @@ -1,3 +1 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0b0ed61ec4ca29374c878e329f4a23f604635d8dd3211ec41ee5a1f1d209082a -size 39334 +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).CherryCodeBlockMermaidPlugin=r()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,r){return t(r={exports:{}},r.exports),r.exports}var n,o,i=function(t){return t&&t.Math==Math&&t},a=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof t&&t)||function(){return this}()||Function("return this")(),u=function(t){try{return!!t()}catch(t){return!0}},c=!u((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),f=Function.prototype,s=f.apply,l=f.call,p="object"==typeof Reflect&&Reflect.apply||(c?l.bind(s):function(){return l.apply(s,arguments)}),v=Function.prototype,y=v.bind,d=v.call,h=c&&y.bind(d,d),b=c?function(t){return t&&h(t)}:function(t){return t&&function(){return d.apply(t,arguments)}},g=function(t){return"function"==typeof t},m=!u((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=Function.prototype.call,O=c?w.bind(w):function(){return w.apply(w,arguments)},_={}.propertyIsEnumerable,j=Object.getOwnPropertyDescriptor,S={f:j&&!_.call({1:2},1)?function(t){var r=j(this,t);return!!r&&r.enumerable}:_},P=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},x=b({}.toString),A=b("".slice),T=function(t){return A(x(t),8,-1)},E=a.Object,F=b("".split),M=u((function(){return!E("z").propertyIsEnumerable(0)}))?function(t){return"String"==T(t)?F(t,""):E(t)}:E,I=a.TypeError,L=function(t){if(null==t)throw I("Can't call method on "+t);return t},C=function(t){return M(L(t))},k=function(t){return"object"==typeof t?null!==t:g(t)},R={},D=function(t){return g(t)?t:void 0},z=function(t,r){return arguments.length<2?D(R[t])||D(a[t]):R[t]&&R[t][r]||a[t]&&a[t][r]},B=b({}.isPrototypeOf),N=z("navigator","userAgent")||"",G=a.process,U=a.Deno,V=G&&G.versions||U&&U.version,$=V&&V.v8;$&&(o=(n=$.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&N&&(!(n=N.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=N.match(/Chrome\/(\d+)/))&&(o=+n[1]);var W=o,H=!!Object.getOwnPropertySymbols&&!u((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&W&&W<41})),q=H&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=a.Object,J=q?function(t){return"symbol"==typeof t}:function(t){var r=z("Symbol");return g(r)&&B(r.prototype,Y(t))},X=a.String,K=function(t){try{return X(t)}catch(t){return"Object"}},Q=a.TypeError,Z=function(t){if(g(t))return t;throw Q(K(t)+" is not a function")},tt=a.TypeError,rt=Object.defineProperty,et="__core-js_shared__",nt=a[et]||function(t,r){try{rt(a,t,{value:r,configurable:!0,writable:!0})}catch(e){a[t]=r}return r}(et,{}),ot=e((function(t){(t.exports=function(t,r){return nt[t]||(nt[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.22.6",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE",source:"https://github.com/zloirock/core-js"})})),it=a.Object,at=function(t){return it(L(t))},ut=b({}.hasOwnProperty),ct=Object.hasOwn||function(t,r){return ut(at(t),r)},ft=0,st=Math.random(),lt=b(1..toString),pt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+lt(++ft+st,36)},vt=ot("wks"),yt=a.Symbol,dt=yt&&yt.for,ht=q?yt:yt&&yt.withoutSetter||pt,bt=function(t){if(!ct(vt,t)||!H&&"string"!=typeof vt[t]){var r="Symbol."+t;H&&ct(yt,t)?vt[t]=yt[t]:vt[t]=q&&dt?dt(r):ht(r)}return vt[t]},gt=a.TypeError,mt=bt("toPrimitive"),wt=function(t,r){if(!k(t)||J(t))return t;var e,n,o=null==(e=t[mt])?void 0:Z(e);if(o){if(void 0===r&&(r="default"),n=O(o,t,r),!k(n)||J(n))return n;throw gt("Can't convert object to primitive value")}return void 0===r&&(r="number"),function(t,r){var e,n;if("string"===r&&g(e=t.toString)&&!k(n=O(e,t)))return n;if(g(e=t.valueOf)&&!k(n=O(e,t)))return n;if("string"!==r&&g(e=t.toString)&&!k(n=O(e,t)))return n;throw tt("Can't convert object to primitive value")}(t,r)},Ot=function(t){var r=wt(t,"string");return J(r)?r:r+""},_t=a.document,jt=k(_t)&&k(_t.createElement),St=function(t){return jt?_t.createElement(t):{}},Pt=!m&&!u((function(){return 7!=Object.defineProperty(St("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,At={f:m?xt:function(t,r){if(t=C(t),r=Ot(r),Pt)try{return xt(t,r)}catch(t){}if(ct(t,r))return P(!O(S.f,t,r),t[r])}},Tt=/#|\.prototype\./,Et=function(t,r){var e=Mt[Ft(t)];return e==Lt||e!=It&&(g(r)?u(r):!!r)},Ft=Et.normalize=function(t){return String(t).replace(Tt,".").toLowerCase()},Mt=Et.data={},It=Et.NATIVE="N",Lt=Et.POLYFILL="P",Ct=Et,kt=b(b.bind),Rt=function(t,r){return Z(t),void 0===r?t:c?kt(t,r):function(){return t.apply(r,arguments)}},Dt=m&&u((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),zt=a.String,Bt=a.TypeError,Nt=function(t){if(k(t))return t;throw Bt(zt(t)+" is not an object")},Gt=a.TypeError,Ut=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,$t="enumerable",Wt="configurable",Ht="writable",qt={f:m?Dt?function(t,r,e){if(Nt(t),r=Ot(r),Nt(e),"function"==typeof t&&"prototype"===r&&"value"in e&&Ht in e&&!e[Ht]){var n=Vt(t,r);n&&n[Ht]&&(t[r]=e.value,e={configurable:Wt in e?e[Wt]:n[Wt],enumerable:$t in e?e[$t]:n[$t],writable:!1})}return Ut(t,r,e)}:Ut:function(t,r,e){if(Nt(t),r=Ot(r),Nt(e),Pt)try{return Ut(t,r,e)}catch(t){}if("get"in e||"set"in e)throw Gt("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},Yt=m?function(t,r,e){return qt.f(t,r,P(1,e))}:function(t,r,e){return t[r]=e,t},Jt=At.f,Xt=function(t){var r=function(e,n,o){if(this instanceof r){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,o)}return p(t,this,arguments)};return r.prototype=t.prototype,r},Kt=function(t,r){var e,n,o,i,u,c,f,s,l=t.target,p=t.global,v=t.stat,y=t.proto,d=p?a:v?a[l]:(a[l]||{}).prototype,h=p?R:R[l]||Yt(R,l,{})[l],m=h.prototype;for(o in r)e=!Ct(p?o:l+(v?".":"#")+o,t.forced)&&d&&ct(d,o),u=h[o],e&&(c=t.dontCallGetSet?(s=Jt(d,o))&&s.value:d[o]),i=e&&c?c:r[o],e&&typeof u==typeof i||(f=t.bind&&e?Rt(i,a):t.wrap&&e?Xt(i):y&&g(i)?b(i):i,(t.sham||i&&i.sham||u&&u.sham)&&Yt(f,"sham",!0),Yt(h,o,f),y&&(ct(R,n=l+"Prototype")||Yt(R,n,{}),Yt(R[n],o,i),t.real&&m&&!m[o]&&Yt(m,o,i)))},Qt=Math.ceil,Zt=Math.floor,tr=Math.trunc||function(t){var r=+t;return(r>0?Zt:Qt)(r)},rr=function(t){var r=+t;return r!=r||0===r?0:tr(r)},er=Math.max,nr=Math.min,or=function(t,r){var e=rr(t);return e<0?er(e+r,0):nr(e,r)},ir=Math.min,ar=function(t){return(r=t.length)>0?ir(rr(r),9007199254740991):0;var r},ur=function(t){return function(r,e,n){var o,i=C(r),a=ar(i),u=or(n,a);if(t&&e!=e){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===e)return t||u||0;return!t&&-1}},cr={includes:ur(!0),indexOf:ur(!1)},fr={},sr=cr.indexOf,lr=b([].push),pr=function(t,r){var e,n=C(t),o=0,i=[];for(e in n)!ct(fr,e)&&ct(n,e)&&lr(i,e);for(;r.length>o;)ct(n,e=r[o++])&&(~sr(i,e)||lr(i,e));return i},vr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yr=Object.keys||function(t){return pr(t,vr)},dr=u((function(){yr(1)}));Kt({target:"Object",stat:!0,forced:dr},{keys:function(t){return yr(at(t))}});var hr=R.Object.keys,br={};br[bt("toStringTag")]="z";var gr,mr="[object z]"===String(br),wr=bt("toStringTag"),Or=a.Object,_r="Arguments"==T(function(){return arguments}()),jr=mr?T:function(t){var r,e,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,r){try{return t[r]}catch(t){}}(r=Or(t),wr))?e:_r?T(r):"Object"==(n=T(r))&&g(r.callee)?"Arguments":n},Sr=a.String,Pr=function(t){if("Symbol"===jr(t))throw TypeError("Cannot convert a Symbol value to a string");return Sr(t)},xr=m&&!Dt?Object.defineProperties:function(t,r){Nt(t);for(var e,n=C(r),o=yr(r),i=o.length,a=0;i>a;)qt.f(t,e=o[a++],n[e]);return t},Ar={f:xr},Tr=z("document","documentElement"),Er=ot("keys"),Fr=function(t){return Er[t]||(Er[t]=pt(t))},Mr="prototype",Ir="script",Lr=Fr("IE_PROTO"),Cr=function(){},kr=function(t){return"<"+Ir+">"+t+""},Rr=function(t){t.write(kr("")),t.close();var r=t.parentWindow.Object;return t=null,r},Dr=function(){try{gr=new ActiveXObject("htmlfile")}catch(t){}var t,r,e;Dr="undefined"!=typeof document?document.domain&&gr?Rr(gr):(r=St("iframe"),e="java"+Ir+":",r.style.display="none",Tr.appendChild(r),r.src=String(e),(t=r.contentWindow.document).open(),t.write(kr("document.F=Object")),t.close(),t.F):Rr(gr);for(var n=vr.length;n--;)delete Dr[Mr][vr[n]];return Dr()};fr[Lr]=!0;var zr=Object.create||function(t,r){var e;return null!==t?(Cr[Mr]=Nt(t),e=new Cr,Cr[Mr]=null,e[Lr]=t):e=Dr(),void 0===r?e:Ar.f(e,r)},Br=vr.concat("length","prototype"),Nr={f:Object.getOwnPropertyNames||function(t){return pr(t,Br)}},Gr=function(t,r,e){var n=Ot(r);n in t?qt.f(t,n,P(0,e)):t[n]=e},Ur=a.Array,Vr=Math.max,$r=Nr.f,Wr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Hr=function(t){try{return $r(t)}catch(t){return function(t,r,e){for(var n=ar(t),o=or(r,n),i=or(void 0===e?n:e,n),a=Ur(Vr(i-o,0)),u=0;og;g++)if((u||g in d)&&(v=h(p=d[g],g,y),t))if(r)w[g]=v;else if(v)switch(t){case 3:return!0;case 5:return p;case 6:return g;case 2:Me(w,p)}else switch(t){case 4:return!1;case 7:Me(w,p)}return i?-1:n||o?o:w}},Le={forEach:Ie(0),map:Ie(1),filter:Ie(2),some:Ie(3),every:Ie(4),find:Ie(5),findIndex:Ie(6),filterReject:Ie(7)},Ce=Le.forEach,ke=Fr("hidden"),Re="Symbol",De="prototype",ze=be.set,Be=be.getterFor(Re),Ne=Object[De],Ge=a.Symbol,Ue=Ge&&Ge[De],Ve=a.TypeError,$e=a.QObject,We=At.f,He=qt.f,qe=qr.f,Ye=S.f,Je=b([].push),Xe=ot("symbols"),Ke=ot("op-symbols"),Qe=ot("wks"),Ze=!$e||!$e[De]||!$e[De].findChild,tn=m&&u((function(){return 7!=zr(He({},"a",{get:function(){return He(this,"a",{value:7}).a}})).a}))?function(t,r,e){var n=We(Ne,r);n&&delete Ne[r],He(t,r,e),n&&t!==Ne&&He(Ne,r,n)}:He,rn=function(t,r){var e=Xe[t]=zr(Ue);return ze(e,{type:Re,tag:t,description:r}),m||(e.description=r),e},en=function(t,r,e){t===Ne&&en(Ke,r,e),Nt(t);var n=Ot(r);return Nt(e),ct(Xe,n)?(e.enumerable?(ct(t,ke)&&t[ke][n]&&(t[ke][n]=!1),e=zr(e,{enumerable:P(0,!1)})):(ct(t,ke)||He(t,ke,P(1,{})),t[ke][n]=!0),tn(t,n,e)):He(t,n,e)},nn=function(t,r){Nt(t);var e=C(r),n=yr(e).concat(cn(e));return Ce(n,(function(r){m&&!O(on,e,r)||en(t,r,e[r])})),t},on=function(t){var r=Ot(t),e=O(Ye,this,r);return!(this===Ne&&ct(Xe,r)&&!ct(Ke,r))&&(!(e||!ct(this,r)||!ct(Xe,r)||ct(this,ke)&&this[ke][r])||e)},an=function(t,r){var e=C(t),n=Ot(r);if(e!==Ne||!ct(Xe,n)||ct(Ke,n)){var o=We(e,n);return!o||!ct(Xe,n)||ct(e,ke)&&e[ke][n]||(o.enumerable=!0),o}},un=function(t){var r=qe(C(t)),e=[];return Ce(r,(function(t){ct(Xe,t)||ct(fr,t)||Je(e,t)})),e},cn=function(t){var r=t===Ne,e=qe(r?Ke:C(t)),n=[];return Ce(e,(function(t){!ct(Xe,t)||r&&!ct(Ne,t)||Je(n,Xe[t])})),n};H||(Ge=function(){if(B(Ue,this))throw Ve("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?Pr(arguments[0]):void 0,r=pt(t),e=function(t){this===Ne&&O(e,Ke,t),ct(this,ke)&&ct(this[ke],r)&&(this[ke][r]=!1),tn(this,r,P(1,t))};return m&&Ze&&tn(Ne,r,{configurable:!0,set:e}),rn(r,t)},Ue=Ge[De],Jr(Ue,"toString",(function(){return Be(this).tag})),Jr(Ge,"withoutSetter",(function(t){return rn(pt(t),t)})),S.f=on,qt.f=en,Ar.f=nn,At.f=an,Nr.f=qr.f=un,Yr.f=cn,Xr.f=function(t){return rn(bt(t),t)},m&&He(Ue,"description",{configurable:!0,get:function(){return Be(this).description}})),Kt({global:!0,constructor:!0,wrap:!0,forced:!H,sham:!H},{Symbol:Ge}),Ce(yr(Qe),(function(t){!function(t){var r=R.Symbol||(R.Symbol={});ct(r,t)||Kr(r,t,{value:Xr.f(t)})}(t)})),Kt({target:Re,stat:!0,forced:!H},{useSetter:function(){Ze=!0},useSimple:function(){Ze=!1}}),Kt({target:"Object",stat:!0,forced:!H,sham:!m},{create:function(t,r){return void 0===r?zr(t):nn(zr(t),r)},defineProperty:en,defineProperties:nn,getOwnPropertyDescriptor:an}),Kt({target:"Object",stat:!0,forced:!H},{getOwnPropertyNames:un}),function(){var t=z("Symbol"),r=t&&t.prototype,e=r&&r.valueOf,n=bt("toPrimitive");r&&!r[n]&&Jr(r,n,(function(t){return O(e,this)}),{arity:1})}(),re(Ge,Re),fr[ke]=!0;var fn=H&&!!Symbol.for&&!!Symbol.keyFor,sn=ot("string-to-symbol-registry"),ln=ot("symbol-to-string-registry");Kt({target:"Symbol",stat:!0,forced:!fn},{for:function(t){var r=Pr(t);if(ct(sn,r))return sn[r];var e=z("Symbol")(r);return sn[r]=e,ln[e]=r,e}});var pn=ot("symbol-to-string-registry");Kt({target:"Symbol",stat:!0,forced:!fn},{keyFor:function(t){if(!J(t))throw TypeError(K(t)+" is not a symbol");if(ct(pn,t))return pn[t]}});var vn=b([].slice),yn=z("JSON","stringify"),dn=b(/./.exec),hn=b("".charAt),bn=b("".charCodeAt),gn=b("".replace),mn=b(1..toString),wn=/[\uD800-\uDFFF]/g,On=/^[\uD800-\uDBFF]$/,_n=/^[\uDC00-\uDFFF]$/,jn=!H||u((function(){var t=z("Symbol")();return"[null]"!=yn([t])||"{}"!=yn({a:t})||"{}"!=yn(Object(t))})),Sn=u((function(){return'"\\udf06\\ud834"'!==yn("\udf06\ud834")||'"\\udead"'!==yn("\udead")})),Pn=function(t,r){var e=vn(arguments),n=r;if((k(r)||void 0!==t)&&!J(t))return ge(r)||(r=function(t,r){if(g(n)&&(r=O(n,this,t,r)),!J(r))return r}),e[1]=r,p(yn,null,e)},xn=function(t,r,e){var n=hn(e,r-1),o=hn(e,r+1);return dn(On,t)&&!dn(_n,o)||dn(_n,t)&&!dn(On,n)?"\\u"+mn(bn(t,0),16):t};yn&&Kt({target:"JSON",stat:!0,arity:3,forced:jn||Sn},{stringify:function(t,r,e){var n=vn(arguments),o=p(jn?Pn:yn,null,n);return Sn&&"string"==typeof o?gn(o,wn,xn):o}});var An=!H||u((function(){Yr.f(1)}));Kt({target:"Object",stat:!0,forced:An},{getOwnPropertySymbols:function(t){var r=Yr.f;return r?r(at(t)):[]}});var Tn=R.Object.getOwnPropertySymbols,En=bt("species"),Fn=function(t){return W>=51||!u((function(){var r=[];return(r.constructor={})[En]=function(){return{foo:1}},1!==r[t](Boolean).foo}))},Mn=Le.filter,In=Fn("filter");Kt({target:"Array",proto:!0,forced:!In},{filter:function(t){return Mn(this,t,arguments.length>1?arguments[1]:void 0)}});var Ln=function(t){return R[t+"Prototype"]},Cn=Ln("Array").filter,kn=Array.prototype,Rn=function(t){var r=t.filter;return t===kn||B(kn,t)&&r===kn.filter?Cn:r},Dn=At.f,zn=u((function(){Dn(1)}));Kt({target:"Object",stat:!0,forced:!m||zn,sham:!m},{getOwnPropertyDescriptor:function(t,r){return Dn(C(t),r)}});var Bn,Nn,Gn,Un=e((function(t){var r=R.Object,e=t.exports=function(t,e){return r.getOwnPropertyDescriptor(t,e)};r.getOwnPropertyDescriptor.sham&&(e.sham=!0)})),Vn=Un,$n={},Wn=Function.prototype,Hn=m&&Object.getOwnPropertyDescriptor,qn=ct(Wn,"name"),Yn={EXISTS:qn,PROPER:qn&&"something"===function(){}.name,CONFIGURABLE:qn&&(!m||m&&Hn(Wn,"name").configurable)},Jn=!u((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Xn=Fr("IE_PROTO"),Kn=a.Object,Qn=Kn.prototype,Zn=Jn?Kn.getPrototypeOf:function(t){var r=at(t);if(ct(r,Xn))return r[Xn];var e=r.constructor;return g(e)&&r instanceof e?e.prototype:r instanceof Kn?Qn:null},to=bt("iterator"),ro=!1;[].keys&&("next"in(Gn=[].keys())?(Nn=Zn(Zn(Gn)))!==Object.prototype&&(Bn=Nn):ro=!0);var eo=null==Bn||u((function(){var t={};return Bn[to].call(t)!==t}));Bn=eo?{}:zr(Bn),g(Bn[to])||Jr(Bn,to,(function(){return this}));var no={IteratorPrototype:Bn,BUGGY_SAFARI_ITERATORS:ro},oo=no.IteratorPrototype,io=function(){return this},ao=a.String,uo=a.TypeError,co=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,e={};try{(t=b(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(e,[]),r=e instanceof Array}catch(t){}return function(e,n){return Nt(e),function(t){if("object"==typeof t||g(t))return t;throw uo("Can't set "+ao(t)+" as a prototype")}(n),r?t(e,n):e.__proto__=n,e}}():void 0),fo=Yn.PROPER,so=no.BUGGY_SAFARI_ITERATORS,lo=bt("iterator"),po="keys",vo="values",yo="entries",ho=function(){return this};qt.f;var bo="Array Iterator",go=be.set,mo=be.getterFor(bo);!function(t,r,e,n,o,i,a){!function(t,r,e,n){var o=r+" Iterator";t.prototype=zr(oo,{next:P(+!n,e)}),re(t,o,!1,!0),$n[o]=io}(e,r,n);var u,c,f,s=function(t){if(t===o&&d)return d;if(!so&&t in v)return v[t];switch(t){case po:case vo:case yo:return function(){return new e(this,t)}}return function(){return new e(this)}},l=r+" Iterator",p=!1,v=t.prototype,y=v[lo]||v["@@iterator"]||o&&v[o],d=!so&&y||s(o),h="Array"==r&&v.entries||y;if(h&&(u=Zn(h.call(new t)))!==Object.prototype&&u.next&&(re(u,l,!0,!0),$n[l]=ho),fo&&o==vo&&y&&y.name!==vo&&(p=!0,d=function(){return O(y,this)}),o)if(c={values:s(vo),keys:i?d:s(po),entries:s(yo)},a)for(f in c)(so||p||!(f in v))&&Jr(v,f,c[f]);else Kt({target:r,proto:!0,forced:so||p},c);a&&v[lo]!==d&&Jr(v,lo,d,{name:o}),$n[r]=d}(Array,"Array",(function(t,r){go(this,{type:bo,target:C(t),index:0,kind:r})}),(function(){var t=mo(this),r=t.target,e=t.kind,n=t.index++;return!r||n>=r.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==e?{value:n,done:!1}:"values"==e?{value:r[n],done:!1}:{value:[n,r[n]],done:!1}}),"values"),$n.Arguments=$n.Array;var wo=bt("toStringTag");for(var Oo in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var _o=a[Oo],jo=_o&&_o.prototype;jo&&jr(jo)!==wo&&Yt(jo,wo,Oo),$n[Oo]=$n.Array}var So,Po,xo=Le.forEach,Ao=!!(Po=[]["forEach"])&&u((function(){Po.call(null,So||function(){return 1},1)}))?[].forEach:function(t){return xo(this,t,arguments.length>1?arguments[1]:void 0)};Kt({target:"Array",proto:!0,forced:[].forEach!=Ao},{forEach:Ao});var To=Ln("Array").forEach,Eo=Array.prototype,Fo={DOMTokenList:!0,NodeList:!0},Mo=function(t){var r=t.forEach;return t===Eo||B(Eo,t)&&r===Eo.forEach||ct(Fo,jr(t))?To:r},Io=b([].concat),Lo=z("Reflect","ownKeys")||function(t){var r=Nr.f(Nt(t)),e=Yr.f;return e?Io(r,e(t)):r};Kt({target:"Object",stat:!0,sham:!m},{getOwnPropertyDescriptors:function(t){for(var r,e,n=C(t),o=At.f,i=Lo(n),a={},u=0;i.length>u;)void 0!==(e=o(n,r=i[u++]))&&Gr(a,r,e);return a}});var Co=R.Object.getOwnPropertyDescriptors,ko=Ar.f;Kt({target:"Object",stat:!0,forced:Object.defineProperties!==ko,sham:!m},{defineProperties:ko});var Ro=e((function(t){var r=R.Object,e=t.exports=function(t,e){return r.defineProperties(t,e)};r.defineProperties.sham&&(e.sham=!0)})),Do=Ro,zo=qt.f;Kt({target:"Object",stat:!0,forced:Object.defineProperty!==zo,sham:!m},{defineProperty:zo});var Bo=e((function(t){var r=R.Object,e=t.exports=function(t,e,n){return r.defineProperty(t,e,n)};r.defineProperty.sham&&(e.sham=!0)})),No=Bo,Go=No,Uo=a.Function,Vo=b([].concat),$o=b([].join),Wo={},Ho=c?Uo.bind:function(t){var r=Z(this),e=r.prototype,n=vn(arguments,1),o=function(){var e=Vo(n,vn(arguments));return this instanceof o?function(t,r,e){if(!ct(Wo,r)){for(var n=[],o=0;o=51||!u((function(){var t=[];return t[yi]=!1,t.concat()[0]!==t})),mi=Fn("concat"),wi=function(t){if(!k(t))return!1;var r=t[yi];return void 0!==r?!!r:ge(t)};Kt({target:"Array",proto:!0,arity:1,forced:!gi||!mi},{concat:function(t){var r,e,n,o,i,a=at(this),u=Fe(a,0),c=0;for(r=-1,n=arguments.length;rdi)throw bi(hi);for(e=0;e=di)throw bi(hi);Gr(u,c++,i)}return u.length=c,u}});var Oi=Ln("Array").concat,_i=Array.prototype,ji=function(t){var r=t.concat;return t===_i||B(_i,t)&&r===_i.concat?Oi:r};var Si=function(){this.__data__=[],this.size=0};var Pi=function(t,r){return t===r||t!=t&&r!=r};var xi=function(t,r){for(var e=t.length;e--;)if(Pi(t[e][0],r))return e;return-1},Ai=Array.prototype.splice;var Ti=function(t){var r=this.__data__,e=xi(r,t);return!(e<0)&&(e==r.length-1?r.pop():Ai.call(r,e,1),--this.size,!0)};var Ei=function(t){var r=this.__data__,e=xi(r,t);return e<0?void 0:r[e][1]};var Fi=function(t){return xi(this.__data__,t)>-1};var Mi=function(t,r){var e=this.__data__,n=xi(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};function Ii(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=9007199254740991};var au=function(t){return null!=t&&iu(t.length)&&!Qi(t)};var uu=function(t){return Ka(t)&&au(t)};var cu=function(){return!1},fu=e((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e?Ni.Buffer:void 0,i=(o?o.isBuffer:void 0)||cu;t.exports=i})),su=Function.prototype,lu=Object.prototype,pu=su.toString,vu=lu.hasOwnProperty,yu=pu.call(Object);var du=function(t){if(!Ka(t)||"[object Object]"!=Xi(t))return!1;var r=qa(t);if(null===r)return!0;var e=vu.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&pu.call(e)==yu},hu={};hu["[object Float32Array]"]=hu["[object Float64Array]"]=hu["[object Int8Array]"]=hu["[object Int16Array]"]=hu["[object Int32Array]"]=hu["[object Uint8Array]"]=hu["[object Uint8ClampedArray]"]=hu["[object Uint16Array]"]=hu["[object Uint32Array]"]=!0,hu["[object Arguments]"]=hu["[object Array]"]=hu["[object ArrayBuffer]"]=hu["[object Boolean]"]=hu["[object DataView]"]=hu["[object Date]"]=hu["[object Error]"]=hu["[object Function]"]=hu["[object Map]"]=hu["[object Number]"]=hu["[object Object]"]=hu["[object RegExp]"]=hu["[object Set]"]=hu["[object String]"]=hu["[object WeakMap]"]=!1;var bu=function(t){return Ka(t)&&iu(t.length)&&!!hu[Xi(t)]};var gu=function(t){return function(r){return t(r)}},mu=e((function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e&&zi.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),wu=mu&&mu.isTypedArray,Ou=wu?gu(wu):bu;var _u=function(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]},ju=Object.prototype.hasOwnProperty;var Su=function(t,r,e){var n=t[r];ju.call(t,r)&&Pi(n,e)&&(void 0!==e||r in t)||Da(t,r,e)};var Pu=function(t,r,e,n){var o=!e;e||(e={});for(var i=-1,a=r.length;++i-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}},Hu=Wu(Vu);var qu=function(t,r){return Hu(Gu(t,r,zu),t+"")};var Yu=function(t,r,e){if(!Ki(e))return!1;var n=typeof r;return!!("number"==n?au(e)&&Tu(r,e.length):"string"==n&&r in e)&&Pi(e[r],t)};var Ju=function(t){return qu((function(r,e){var n=-1,o=e.length,i=o>1?e[o-1]:void 0,a=o>2?e[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&Yu(e[0],e[1],a)&&(i=o<3?void 0:i,o=1),r=Object(r);++n0&&void 0!==arguments[0]?arguments[0]:{};si(this,t),vi(this,"mermaidAPIRefs",null),vi(this,"options",Qu),vi(this,"dom",null),vi(this,"mermaidCanvas",null);var e=r.mermaid,n=r.mermaidAPI;if(!(n||window.mermaidAPI||e&&e.mermaidAPI||window.mermaid&&window.mermaid.mermaidAPI))throw new Error("code-block-mermaid-plugin[init]: Package mermaid or mermaidAPI not found.");this.options=Ku(Ku({},Qu),r||{}),this.mermaidAPIRefs=n||window.mermaidAPI||e.mermaidAPI||window.mermaid.mermaidAPI,delete this.options.mermaid,delete this.options.mermaidAPI,this.mermaidAPIRefs.initialize(this.options)}return pi(t,[{key:"mountMermaidCanvas",value:function(t){this.mermaidCanvas&&document.body.contains(this.mermaidCanvas)||(this.mermaidCanvas=document.createElement("div"),this.mermaidCanvas.style="width:1024px;opacity:0;position:fixed;top:100%;",(t.$cherry.wrapperDom||document.body).appendChild(this.mermaidCanvas))}},{key:"convertMermaidSvgToImg",value:function(t,r){var e,n=new DOMParser,o=function(t){return t.replace("')}}else e=o(t)}catch(r){e=o(t)}return e}},{key:"render",value:function(t,r,e){var n,o,i,a=this,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=r;c||(c=Math.round(1e8*Math.random())),this.mountMermaidCanvas(e);var f=ji(n="mermaid-".concat(c,"-")).call(n,(new Date).getTime());this.svg2img=null!==(o=null==u?void 0:u.svg2img)&&void 0!==o&&o;try{this.mermaidAPIRefs.render(f,t,(function(t){var r=t.replace(/\s*markerUnits="0"/g,"").replace(/\s*x="NaN"/g,"").replace(/
/g,"
");i=a.convertMermaidSvgToImg(r,f)}),this.mermaidCanvas)}catch(t){return null==t?void 0:t.str}return i}}],[{key:"install",value:function(r){for(var e=arguments.length,n=new Array(e>1?e-1:0),o=1;o0&&e[0]<4?1:+(e[0]+e[1])),!o&&G&&(!(e=G.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=G.match(/Chrome\/(\d+)/))&&(o=+e[1]);var W=o,q=!!Object.getOwnPropertySymbols&&!a((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&W&&W<41})),H=q&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Y=u.Object,J=H?function(t){return"symbol"==typeof t}:function(t){var r=R("Symbol");return g(r)&&N(r.prototype,Y(t))},X=u.String,K=function(t){try{return X(t)}catch(t){return"Object"}},Q=u.TypeError,Z=function(t){if(g(t))return t;throw Q(K(t)+" is not a function")},tt=u.TypeError,rt=Object.defineProperty,nt="__core-js_shared__",et=u[nt]||function(t,r){try{rt(u,t,{value:r,configurable:!0,writable:!0})}catch(n){u[t]=r}return r}(nt,{}),ot=n((function(t){(t.exports=function(t,r){return et[t]||(et[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.22.6",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE",source:"https://github.com/zloirock/core-js"})})),it=u.Object,ut=function(t){return it(k(t))},at=b({}.hasOwnProperty),ct=Object.hasOwn||function(t,r){return at(ut(t),r)},ft=0,lt=Math.random(),st=b(1..toString),pt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+st(++ft+lt,36)},vt=ot("wks"),yt=u.Symbol,ht=yt&&yt.for,dt=H?yt:yt&&yt.withoutSetter||pt,bt=function(t){if(!ct(vt,t)||!q&&"string"!=typeof vt[t]){var r="Symbol."+t;q&&ct(yt,t)?vt[t]=yt[t]:vt[t]=H&&ht?ht(r):dt(r)}return vt[t]},gt=u.TypeError,mt=bt("toPrimitive"),_t=function(t,r){if(!I(t)||J(t))return t;var n,e,o=null==(n=t[mt])?void 0:Z(n);if(o){if(void 0===r&&(r="default"),e=w(o,t,r),!I(e)||J(e))return e;throw gt("Can't convert object to primitive value")}return void 0===r&&(r="number"),function(t,r){var n,e;if("string"===r&&g(n=t.toString)&&!I(e=w(n,t)))return e;if(g(n=t.valueOf)&&!I(e=w(n,t)))return e;if("string"!==r&&g(n=t.toString)&&!I(e=w(n,t)))return e;throw tt("Can't convert object to primitive value")}(t,r)},wt=function(t){var r=_t(t,"string");return J(r)?r:r+""},Ot=u.document,jt=I(Ot)&&I(Ot.createElement),St=function(t){return jt?Ot.createElement(t):{}},At=!m&&!a((function(){return 7!=Object.defineProperty(St("div"),"a",{get:function(){return 7}}).a})),xt=Object.getOwnPropertyDescriptor,Pt={f:m?xt:function(t,r){if(t=M(t),r=wt(r),At)try{return xt(t,r)}catch(t){}if(ct(t,r))return A(!w(S.f,t,r),t[r])}},Tt=/#|\.prototype\./,Et=function(t,r){var n=Ft[Ct(t)];return n==kt||n!=Lt&&(g(r)?a(r):!!r)},Ct=Et.normalize=function(t){return String(t).replace(Tt,".").toLowerCase()},Ft=Et.data={},Lt=Et.NATIVE="N",kt=Et.POLYFILL="P",Mt=Et,It=b(b.bind),zt=function(t,r){return Z(t),void 0===r?t:c?It(t,r):function(){return t.apply(r,arguments)}},Dt=m&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Rt=u.String,Nt=u.TypeError,Gt=function(t){if(I(t))return t;throw Nt(Rt(t)+" is not an object")},Ut=u.TypeError,Bt=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Vt="enumerable",Wt="configurable",qt="writable",Ht={f:m?Dt?function(t,r,n){if(Gt(t),r=wt(r),Gt(n),"function"==typeof t&&"prototype"===r&&"value"in n&&qt in n&&!n[qt]){var e=$t(t,r);e&&e[qt]&&(t[r]=n.value,n={configurable:Wt in n?n[Wt]:e[Wt],enumerable:Vt in n?n[Vt]:e[Vt],writable:!1})}return Bt(t,r,n)}:Bt:function(t,r,n){if(Gt(t),r=wt(r),Gt(n),At)try{return Bt(t,r,n)}catch(t){}if("get"in n||"set"in n)throw Ut("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},Yt=m?function(t,r,n){return Ht.f(t,r,A(1,n))}:function(t,r,n){return t[r]=n,t},Jt=Pt.f,Xt=function(t){var r=function(n,e,o){if(this instanceof r){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,o)}return p(t,this,arguments)};return r.prototype=t.prototype,r},Kt=function(t,r){var n,e,o,i,a,c,f,l,s=t.target,p=t.global,v=t.stat,y=t.proto,h=p?u:v?u[s]:(u[s]||{}).prototype,d=p?z:z[s]||Yt(z,s,{})[s],m=d.prototype;for(o in r)n=!Mt(p?o:s+(v?".":"#")+o,t.forced)&&h&&ct(h,o),a=d[o],n&&(c=t.dontCallGetSet?(l=Jt(h,o))&&l.value:h[o]),i=n&&c?c:r[o],n&&typeof a==typeof i||(f=t.bind&&n?zt(i,u):t.wrap&&n?Xt(i):y&&g(i)?b(i):i,(t.sham||i&&i.sham||a&&a.sham)&&Yt(f,"sham",!0),Yt(d,o,f),y&&(ct(z,e=s+"Prototype")||Yt(z,e,{}),Yt(z[e],o,i),t.real&&m&&!m[o]&&Yt(m,o,i)))},Qt=Math.ceil,Zt=Math.floor,tr=Math.trunc||function(t){var r=+t;return(r>0?Zt:Qt)(r)},rr=function(t){var r=+t;return r!=r||0===r?0:tr(r)},nr=Math.max,er=Math.min,or=function(t,r){var n=rr(t);return n<0?nr(n+r,0):er(n,r)},ir=Math.min,ur=function(t){return(r=t.length)>0?ir(rr(r),9007199254740991):0;var r},ar=function(t){return function(r,n,e){var o,i=M(r),u=ur(i),a=or(e,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return!t&&-1}},cr={includes:ar(!0),indexOf:ar(!1)},fr={},lr=cr.indexOf,sr=b([].push),pr=function(t,r){var n,e=M(t),o=0,i=[];for(n in e)!ct(fr,n)&&ct(e,n)&&sr(i,n);for(;r.length>o;)ct(e,n=r[o++])&&(~lr(i,n)||sr(i,n));return i},vr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yr=Object.keys||function(t){return pr(t,vr)},hr=a((function(){yr(1)}));Kt({target:"Object",stat:!0,forced:hr},{keys:function(t){return yr(ut(t))}});var dr=z.Object.keys,br={};br[bt("toStringTag")]="z";var gr,mr="[object z]"===String(br),_r=bt("toStringTag"),wr=u.Object,Or="Arguments"==T(function(){return arguments}()),jr=mr?T:function(t){var r,n,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,r){try{return t[r]}catch(t){}}(r=wr(t),_r))?n:Or?T(r):"Object"==(e=T(r))&&g(r.callee)?"Arguments":e},Sr=u.String,Ar=function(t){if("Symbol"===jr(t))throw TypeError("Cannot convert a Symbol value to a string");return Sr(t)},xr=m&&!Dt?Object.defineProperties:function(t,r){Gt(t);for(var n,e=M(r),o=yr(r),i=o.length,u=0;i>u;)Ht.f(t,n=o[u++],e[n]);return t},Pr={f:xr},Tr=R("document","documentElement"),Er=ot("keys"),Cr=function(t){return Er[t]||(Er[t]=pt(t))},Fr="prototype",Lr="script",kr=Cr("IE_PROTO"),Mr=function(){},Ir=function(t){return"<"+Lr+">"+t+""},zr=function(t){t.write(Ir("")),t.close();var r=t.parentWindow.Object;return t=null,r},Dr=function(){try{gr=new ActiveXObject("htmlfile")}catch(t){}var t,r,n;Dr="undefined"!=typeof document?document.domain&&gr?zr(gr):(r=St("iframe"),n="java"+Lr+":",r.style.display="none",Tr.appendChild(r),r.src=String(n),(t=r.contentWindow.document).open(),t.write(Ir("document.F=Object")),t.close(),t.F):zr(gr);for(var e=vr.length;e--;)delete Dr[Fr][vr[e]];return Dr()};fr[kr]=!0;var Rr=Object.create||function(t,r){var n;return null!==t?(Mr[Fr]=Gt(t),n=new Mr,Mr[Fr]=null,n[kr]=t):n=Dr(),void 0===r?n:Pr.f(n,r)},Nr=vr.concat("length","prototype"),Gr={f:Object.getOwnPropertyNames||function(t){return pr(t,Nr)}},Ur=function(t,r,n){var e=wt(r);e in t?Ht.f(t,e,A(0,n)):t[e]=n},Br=u.Array,$r=Math.max,Vr=Gr.f,Wr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],qr=function(t){try{return Vr(t)}catch(t){return function(t,r,n){for(var e=ur(t),o=or(r,e),i=or(void 0===n?e:n,e),u=Br($r(i-o,0)),a=0;og;g++)if((a||g in h)&&(v=d(p=h[g],g,y),t))if(r)_[g]=v;else if(v)switch(t){case 3:return!0;case 5:return p;case 6:return g;case 2:Ln(_,p)}else switch(t){case 4:return!1;case 7:Ln(_,p)}return i?-1:e||o?o:_}},Mn={forEach:kn(0),map:kn(1),filter:kn(2),some:kn(3),every:kn(4),find:kn(5),findIndex:kn(6),filterReject:kn(7)},In=Mn.forEach,zn=Cr("hidden"),Dn="Symbol",Rn="prototype",Nn=gn.set,Gn=gn.getterFor(Dn),Un=Object[Rn],Bn=u.Symbol,$n=Bn&&Bn[Rn],Vn=u.TypeError,Wn=u.QObject,qn=Pt.f,Hn=Ht.f,Yn=Hr.f,Jn=S.f,Xn=b([].push),Kn=ot("symbols"),Qn=ot("op-symbols"),Zn=ot("wks"),te=!Wn||!Wn[Rn]||!Wn[Rn].findChild,re=m&&a((function(){return 7!=Rr(Hn({},"a",{get:function(){return Hn(this,"a",{value:7}).a}})).a}))?function(t,r,n){var e=qn(Un,r);e&&delete Un[r],Hn(t,r,n),e&&t!==Un&&Hn(Un,r,e)}:Hn,ne=function(t,r){var n=Kn[t]=Rr($n);return Nn(n,{type:Dn,tag:t,description:r}),m||(n.description=r),n},ee=function(t,r,n){t===Un&&ee(Qn,r,n),Gt(t);var e=wt(r);return Gt(n),ct(Kn,e)?(n.enumerable?(ct(t,zn)&&t[zn][e]&&(t[zn][e]=!1),n=Rr(n,{enumerable:A(0,!1)})):(ct(t,zn)||Hn(t,zn,A(1,{})),t[zn][e]=!0),re(t,e,n)):Hn(t,e,n)},oe=function(t,r){Gt(t);var n=M(r),e=yr(n).concat(ce(n));return In(e,(function(r){m&&!w(ie,n,r)||ee(t,r,n[r])})),t},ie=function(t){var r=wt(t),n=w(Jn,this,r);return!(this===Un&&ct(Kn,r)&&!ct(Qn,r))&&(!(n||!ct(this,r)||!ct(Kn,r)||ct(this,zn)&&this[zn][r])||n)},ue=function(t,r){var n=M(t),e=wt(r);if(n!==Un||!ct(Kn,e)||ct(Qn,e)){var o=qn(n,e);return!o||!ct(Kn,e)||ct(n,zn)&&n[zn][e]||(o.enumerable=!0),o}},ae=function(t){var r=Yn(M(t)),n=[];return In(r,(function(t){ct(Kn,t)||ct(fr,t)||Xn(n,t)})),n},ce=function(t){var r=t===Un,n=Yn(r?Qn:M(t)),e=[];return In(n,(function(t){!ct(Kn,t)||r&&!ct(Un,t)||Xn(e,Kn[t])})),e};q||(Bn=function(){if(N($n,this))throw Vn("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?Ar(arguments[0]):void 0,r=pt(t),n=function(t){this===Un&&w(n,Qn,t),ct(this,zn)&&ct(this[zn],r)&&(this[zn][r]=!1),re(this,r,A(1,t))};return m&&te&&re(Un,r,{configurable:!0,set:n}),ne(r,t)},$n=Bn[Rn],Jr($n,"toString",(function(){return Gn(this).tag})),Jr(Bn,"withoutSetter",(function(t){return ne(pt(t),t)})),S.f=ie,Ht.f=ee,Pr.f=oe,Pt.f=ue,Gr.f=Hr.f=ae,Yr.f=ce,Xr.f=function(t){return ne(bt(t),t)},m&&Hn($n,"description",{configurable:!0,get:function(){return Gn(this).description}})),Kt({global:!0,constructor:!0,wrap:!0,forced:!q,sham:!q},{Symbol:Bn}),In(yr(Zn),(function(t){!function(t){var r=z.Symbol||(z.Symbol={});ct(r,t)||Kr(r,t,{value:Xr.f(t)})}(t)})),Kt({target:Dn,stat:!0,forced:!q},{useSetter:function(){te=!0},useSimple:function(){te=!1}}),Kt({target:"Object",stat:!0,forced:!q,sham:!m},{create:function(t,r){return void 0===r?Rr(t):oe(Rr(t),r)},defineProperty:ee,defineProperties:oe,getOwnPropertyDescriptor:ue}),Kt({target:"Object",stat:!0,forced:!q},{getOwnPropertyNames:ae}),function(){var t=R("Symbol"),r=t&&t.prototype,n=r&&r.valueOf,e=bt("toPrimitive");r&&!r[e]&&Jr(r,e,(function(t){return w(n,this)}),{arity:1})}(),rn(Bn,Dn),fr[zn]=!0;var fe=q&&!!Symbol.for&&!!Symbol.keyFor,le=ot("string-to-symbol-registry"),se=ot("symbol-to-string-registry");Kt({target:"Symbol",stat:!0,forced:!fe},{for:function(t){var r=Ar(t);if(ct(le,r))return le[r];var n=R("Symbol")(r);return le[r]=n,se[n]=r,n}});var pe=ot("symbol-to-string-registry");Kt({target:"Symbol",stat:!0,forced:!fe},{keyFor:function(t){if(!J(t))throw TypeError(K(t)+" is not a symbol");if(ct(pe,t))return pe[t]}});var ve=b([].slice),ye=R("JSON","stringify"),he=b(/./.exec),de=b("".charAt),be=b("".charCodeAt),ge=b("".replace),me=b(1..toString),_e=/[\uD800-\uDFFF]/g,we=/^[\uD800-\uDBFF]$/,Oe=/^[\uDC00-\uDFFF]$/,je=!q||a((function(){var t=R("Symbol")();return"[null]"!=ye([t])||"{}"!=ye({a:t})||"{}"!=ye(Object(t))})),Se=a((function(){return'"\\udf06\\ud834"'!==ye("\udf06\ud834")||'"\\udead"'!==ye("\udead")})),Ae=function(t,r){var n=ve(arguments),e=r;if((I(r)||void 0!==t)&&!J(t))return mn(r)||(r=function(t,r){if(g(e)&&(r=w(e,this,t,r)),!J(r))return r}),n[1]=r,p(ye,null,n)},xe=function(t,r,n){var e=de(n,r-1),o=de(n,r+1);return he(we,t)&&!he(Oe,o)||he(Oe,t)&&!he(we,e)?"\\u"+me(be(t,0),16):t};ye&&Kt({target:"JSON",stat:!0,arity:3,forced:je||Se},{stringify:function(t,r,n){var e=ve(arguments),o=p(je?Ae:ye,null,e);return Se&&"string"==typeof o?ge(o,_e,xe):o}});var Pe=!q||a((function(){Yr.f(1)}));Kt({target:"Object",stat:!0,forced:Pe},{getOwnPropertySymbols:function(t){var r=Yr.f;return r?r(ut(t)):[]}});var Te=z.Object.getOwnPropertySymbols,Ee=bt("species"),Ce=function(t){return W>=51||!a((function(){var r=[];return(r.constructor={})[Ee]=function(){return{foo:1}},1!==r[t](Boolean).foo}))},Fe=Mn.filter,Le=Ce("filter");Kt({target:"Array",proto:!0,forced:!Le},{filter:function(t){return Fe(this,t,arguments.length>1?arguments[1]:void 0)}});var ke=function(t){return z[t+"Prototype"]},Me=ke("Array").filter,Ie=Array.prototype,ze=function(t){var r=t.filter;return t===Ie||N(Ie,t)&&r===Ie.filter?Me:r},De=Pt.f,Re=a((function(){De(1)}));Kt({target:"Object",stat:!0,forced:!m||Re,sham:!m},{getOwnPropertyDescriptor:function(t,r){return De(M(t),r)}});var Ne,Ge,Ue,Be=n((function(t){var r=z.Object,n=t.exports=function(t,n){return r.getOwnPropertyDescriptor(t,n)};r.getOwnPropertyDescriptor.sham&&(n.sham=!0)})),$e=Be,Ve={},We=Function.prototype,qe=m&&Object.getOwnPropertyDescriptor,He=ct(We,"name"),Ye={EXISTS:He,PROPER:He&&"something"===function(){}.name,CONFIGURABLE:He&&(!m||m&&qe(We,"name").configurable)},Je=!a((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Xe=Cr("IE_PROTO"),Ke=u.Object,Qe=Ke.prototype,Ze=Je?Ke.getPrototypeOf:function(t){var r=ut(t);if(ct(r,Xe))return r[Xe];var n=r.constructor;return g(n)&&r instanceof n?n.prototype:r instanceof Ke?Qe:null},to=bt("iterator"),ro=!1;[].keys&&("next"in(Ue=[].keys())?(Ge=Ze(Ze(Ue)))!==Object.prototype&&(Ne=Ge):ro=!0);var no=null==Ne||a((function(){var t={};return Ne[to].call(t)!==t}));Ne=no?{}:Rr(Ne),g(Ne[to])||Jr(Ne,to,(function(){return this}));var eo={IteratorPrototype:Ne,BUGGY_SAFARI_ITERATORS:ro},oo=eo.IteratorPrototype,io=function(){return this};u.String,u.TypeError;Object.setPrototypeOf||"__proto__"in{}&&function(){var t,r=!1,n={};try{(t=b(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),r=n instanceof Array}catch(t){}}();var uo=Ye.PROPER,ao=eo.BUGGY_SAFARI_ITERATORS,co=bt("iterator"),fo="keys",lo="values",so="entries",po=function(){return this};Ht.f;var vo="Array Iterator",yo=gn.set,ho=gn.getterFor(vo);!function(t,r,n,e,o,i,u){!function(t,r,n,e){var o=r+" Iterator";t.prototype=Rr(oo,{next:A(+!e,n)}),rn(t,o,!1,!0),Ve[o]=io}(n,r,e);var a,c,f,l=function(t){if(t===o&&h)return h;if(!ao&&t in v)return v[t];switch(t){case fo:case lo:case so:return function(){return new n(this,t)}}return function(){return new n(this)}},s=r+" Iterator",p=!1,v=t.prototype,y=v[co]||v["@@iterator"]||o&&v[o],h=!ao&&y||l(o),d="Array"==r&&v.entries||y;if(d&&(a=Ze(d.call(new t)))!==Object.prototype&&a.next&&(rn(a,s,!0,!0),Ve[s]=po),uo&&o==lo&&y&&y.name!==lo&&(p=!0,h=function(){return w(y,this)}),o)if(c={values:l(lo),keys:i?h:l(fo),entries:l(so)},u)for(f in c)(ao||p||!(f in v))&&Jr(v,f,c[f]);else Kt({target:r,proto:!0,forced:ao||p},c);u&&v[co]!==h&&Jr(v,co,h,{name:o}),Ve[r]=h}(Array,"Array",(function(t,r){yo(this,{type:vo,target:M(t),index:0,kind:r})}),(function(){var t=ho(this),r=t.target,n=t.kind,e=t.index++;return!r||e>=r.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:e,done:!1}:"values"==n?{value:r[e],done:!1}:{value:[e,r[e]],done:!1}}),"values"),Ve.Arguments=Ve.Array;var bo=bt("toStringTag");for(var go in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var mo=u[go],_o=mo&&mo.prototype;_o&&jr(_o)!==bo&&Yt(_o,bo,go),Ve[go]=Ve.Array}var wo,Oo,jo=Mn.forEach,So=!!(Oo=[]["forEach"])&&a((function(){Oo.call(null,wo||function(){return 1},1)}))?[].forEach:function(t){return jo(this,t,arguments.length>1?arguments[1]:void 0)};Kt({target:"Array",proto:!0,forced:[].forEach!=So},{forEach:So});var Ao=ke("Array").forEach,xo=Array.prototype,Po={DOMTokenList:!0,NodeList:!0},To=function(t){var r=t.forEach;return t===xo||N(xo,t)&&r===xo.forEach||ct(Po,jr(t))?Ao:r},Eo=b([].concat),Co=R("Reflect","ownKeys")||function(t){var r=Gr.f(Gt(t)),n=Yr.f;return n?Eo(r,n(t)):r};Kt({target:"Object",stat:!0,sham:!m},{getOwnPropertyDescriptors:function(t){for(var r,n,e=M(t),o=Pt.f,i=Co(e),u={},a=0;i.length>a;)void 0!==(n=o(e,r=i[a++]))&&Ur(u,r,n);return u}});var Fo=z.Object.getOwnPropertyDescriptors,Lo=Pr.f;Kt({target:"Object",stat:!0,forced:Object.defineProperties!==Lo,sham:!m},{defineProperties:Lo});var ko=n((function(t){var r=z.Object,n=t.exports=function(t,n){return r.defineProperties(t,n)};r.defineProperties.sham&&(n.sham=!0)})),Mo=ko,Io=Ht.f;Kt({target:"Object",stat:!0,forced:Object.defineProperty!==Io,sham:!m},{defineProperty:Io});var zo=n((function(t){var r=z.Object,n=t.exports=function(t,n,e){return r.defineProperty(t,n,e)};r.defineProperty.sham&&(n.sham=!0)})),Do=zo,Ro=zo,No=r(n((function(t){t.exports=function(t,r,n){return r in t?Ro(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports}))),Go=r(n((function(t){t.exports=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports}))),Uo=r(n((function(t){function r(t,r){for(var n=0;n=51||!a((function(){var t=[];return t[Bo]=!1,t.concat()[0]!==t})),Ho=Ce("concat"),Yo=function(t){if(!I(t))return!1;var r=t[Bo];return void 0!==r?!!r:mn(t)};Kt({target:"Array",proto:!0,arity:1,forced:!qo||!Ho},{concat:function(t){var r,n,e,o,i,u=ut(this),a=Fn(u,0),c=0;for(r=-1,e=arguments.length;r$o)throw Wo(Vo);for(n=0;n=$o)throw Wo(Vo);Ur(a,c++,i)}return a.length=c,a}});var Jo=ke("Array").concat,Xo=Array.prototype,Ko=function(t){var r=t.concat;return t===Xo||N(Xo,t)&&r===Xo.concat?Jo:r};var Qo=function(){this.__data__=[],this.size=0};var Zo=function(t,r){return t===r||t!=t&&r!=r};var ti=function(t,r){for(var n=t.length;n--;)if(Zo(t[n][0],r))return n;return-1},ri=Array.prototype.splice;var ni=function(t){var r=this.__data__,n=ti(r,t);return!(n<0)&&(n==r.length-1?r.pop():ri.call(r,n,1),--this.size,!0)};var ei=function(t){var r=this.__data__,n=ti(r,t);return n<0?void 0:r[n][1]};var oi=function(t){return ti(this.__data__,t)>-1};var ii=function(t,r){var n=this.__data__,e=ti(n,t);return e<0?(++this.size,n.push([t,r])):n[e][1]=r,this};function ui(t){var r=-1,n=null==t?0:t.length;for(this.clear();++r-1&&t%1==0&&t<=9007199254740991};var Mu=function(t){return null!=t&&ku(t.length)&&!xi(t)};var Iu=function(t){return Au(t)&&Mu(t)};var zu=function(){return!1},Du=n((function(t,r){var n=r&&!r.nodeType&&r,e=n&&t&&!t.nodeType&&t,o=e&&e.exports===n?yi.Buffer:void 0,i=(o?o.isBuffer:void 0)||zu;t.exports=i})),Ru=Function.prototype,Nu=Object.prototype,Gu=Ru.toString,Uu=Nu.hasOwnProperty,Bu=Gu.call(Object);var $u=function(t){if(!Au(t)||"[object Object]"!=Si(t))return!1;var r=wu(t);if(null===r)return!0;var n=Uu.call(r,"constructor")&&r.constructor;return"function"==typeof n&&n instanceof n&&Gu.call(n)==Bu},Vu={};Vu["[object Float32Array]"]=Vu["[object Float64Array]"]=Vu["[object Int8Array]"]=Vu["[object Int16Array]"]=Vu["[object Int32Array]"]=Vu["[object Uint8Array]"]=Vu["[object Uint8ClampedArray]"]=Vu["[object Uint16Array]"]=Vu["[object Uint32Array]"]=!0,Vu["[object Arguments]"]=Vu["[object Array]"]=Vu["[object ArrayBuffer]"]=Vu["[object Boolean]"]=Vu["[object DataView]"]=Vu["[object Date]"]=Vu["[object Error]"]=Vu["[object Function]"]=Vu["[object Map]"]=Vu["[object Number]"]=Vu["[object Object]"]=Vu["[object RegExp]"]=Vu["[object Set]"]=Vu["[object String]"]=Vu["[object WeakMap]"]=!1;var Wu=function(t){return Au(t)&&ku(t.length)&&!!Vu[Si(t)]};var qu=function(t){return function(r){return t(r)}},Hu=n((function(t,r){var n=r&&!r.nodeType&&r,e=n&&t&&!t.nodeType&&t,o=e&&e.exports===n&&pi.process,i=function(){try{var t=e&&e.require&&e.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),Yu=Hu&&Hu.isTypedArray,Ju=Yu?qu(Yu):Wu;var Xu=function(t,r){if(("constructor"!==r||"function"!=typeof t[r])&&"__proto__"!=r)return t[r]},Ku=Object.prototype.hasOwnProperty;var Qu=function(t,r,n){var e=t[r];Ku.call(t,r)&&Zo(e,n)&&(void 0!==n||r in t)||su(t,r,n)};var Zu=function(t,r,n,e){var o=!n;n||(n={});for(var i=-1,u=r.length;++i-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}},_a=ma(ba);var wa=function(t,r){return _a(ha(t,r,pa),t+"")};var Oa=function(t,r,n){if(!Ai(n))return!1;var e=typeof r;return!!("number"==e?Mu(n)&&na(r,n.length):"string"==e&&r in n)&&Zo(n[r],t)};var ja=function(t){return wa((function(r,n){var e=-1,o=n.length,i=o>1?n[o-1]:void 0,u=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,u&&Oa(n[0],n[1],u)&&(i=o<3?void 0:i,o=1),r=Object(r);++e>>0||(Ia(Ma,n)?16:10))}:Fa;Kt({global:!0,forced:parseInt!=za},{parseInt:za});var Da=z.parseInt,Ra=function(){var t,r,n,e,o,i,u,a,c,f,l,s,p,v,y,h,d,b,g,m,_,w,O,j,S,A,x,P,T,E,C,F,L,k,M,I,z,D,R,N,G,U,B,$,V,W,q,H,Y,J,X,K,Q,Z,tt,rt=32768,nt=0,et=1,ot=2,it=8192,ut=2*rt,at=3,ct=258,ft=8192,lt=ft,st=8192,pt=st-1,vt=rt-1,yt=0,ht=4096,dt=ct+at+1,bt=rt-dt,gt=1,mt=15,_t=7,wt=29,Ot=256,jt=256,St=Ot+1+wt,At=30,xt=19,Pt=16,Tt=17,Et=18,Ct=2*St+1,Ft=Da((13+at-1)/at),Lt=null;function kt(){this.fc=0,this.dl=0}function Mt(){this.dyn_tree=null,this.static_tree=null,this.extra_bits=null,this.extra_base=0,this.elems=0,this.max_length=0,this.max_code=0}function It(t,r,n,e){this.good_length=t,this.max_lazy=r,this.nice_length=n,this.max_chain=e}function zt(){this.next=null,this.len=0,this.ptr=new Array(it),this.off=0}var Dt=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Rt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Nt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Gt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ut=[new It(0,0,0,0),new It(4,4,8,4),new It(4,5,16,8),new It(4,6,32,32),new It(4,4,16,16),new It(8,16,32,32),new It(8,16,128,128),new It(8,32,128,256),new It(32,128,258,1024),new It(32,258,258,4096)];function Bt(r){r.next=t,t=r}function $t(t){return l[rt+t]}function Vt(t,r){return l[rt+t]=r}function Wt(e){Lt[i+o++]=e,i+o==it&&function(){if(0!=o){var e,u;for(null!=t?(a=t,t=t.next):a=new zt,a.next=null,a.len=a.off=0,e=a,null==r?r=n=e:n=n.next=e,e.len=o-i,u=0;u>>8):(Wt(255&t),Wt(t>>>8))}function Ht(){y=(y<>7)])}function Xt(t,r,n){return t[r].fcbt?_-bt:yt,c=_+ct,f=a[o+i-1],s=a[o+i];m>=P&&(e>>=2);do{if(a[(r=t)+i]==s&&a[r+i-1]==f&&a[r]==a[o]&&a[++r]==a[o+1]){o+=2,r++;do{}while(a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&a[++o]==a[++r]&&oi){if(w=t,i=n,n>=ct)break;f=a[o+i-1],s=a[o+i]}}}while((t=l[t&vt])>u&&0!=--e);return i}function Zt(){var t,r,n=ut-j-_;if(-1==n)n--;else if(_>=rt+bt){for(t=0;t=rt?r-rt:yt);for(t=0;t=rt?r-rt:yt;n+=rt}O||((t=Kt(a,_+j,n))<=0?O=!0:j+=t)}function tr(){O||(s=0,p=0,function(){var t,r,n,e,o;if(0!=F[0].dl)return;for(k.dyn_tree=T,k.static_tree=C,k.extra_bits=Dt,k.extra_base=Ot+1,k.elems=St,k.max_length=mt,k.max_code=0,M.dyn_tree=E,M.static_tree=F,M.extra_bits=Rt,M.extra_base=0,M.elems=At,M.max_length=mt,M.max_code=0,I.dyn_tree=L,I.static_tree=null,I.extra_bits=Nt,I.extra_base=0,I.elems=xt,I.max_length=_t,I.max_code=0,n=0,e=0;e>=7;ej&&(g=j),g>=at)if(t=lr(_-w,g-at),j-=g,g<=A){g--;do{_++,Ht()}while(0!=--g);_++}else _+=g,g=0,y=((y=255&a[_])<j&&(g=j),g==at&&_-w>ht&&g--),m>=at&&g<=m){var t;t=lr(_-1-d,m-at),j-=m-1,m-=2;do{_++,Ht()}while(0!=--m);b=0,g=at-1,_++,t&&(fr(0),v=_)}else 0!=b?(lr(0,255&a[_-1])&&(fr(0),v=_),_++,j--):(b=1,_++,j--);for(;jr.len&&(a=r.len),c=0;co-i&&(a=o-i),c=0;c>1;r>=1;r--)or(e,r);do{r=D[gt],D[gt]=D[R--],or(e,gt),n=D[gt],D[--N]=r,D[--N]=n,e[a].fc=e[r].fc+e[n].fc,G[r]>G[n]+1?G[a]=G[r]:G[a]=G[n]+1,e[r].dl=e[n].dl=a,D[gt]=a++,or(e,gt)}while(R>=2);D[--N]=D[gt],function(t){var r,n,e,o,i,u,a=t.dyn_tree,c=t.extra_bits,f=t.extra_base,l=t.max_code,s=t.max_length,p=t.static_tree,v=0;for(o=0;o<=mt;o++)z[o]=0;for(a[D[N]].dl=0,r=N+1;rs&&(o=s,v++),a[n].dl=o,n>l||(z[o]++,i=0,n>=f&&(i=c[n-f]),u=a[n].fc,K+=u*(o+i),null!=p&&(Q+=u*(p[n].dl+i)));if(0!=v){do{for(o=s-1;0==z[o];)o--;z[o]--,z[o+1]+=2,z[s]--,v-=2}while(v>0);for(o=s;0!=o;o--)for(n=z[o];0!=n;)(e=D[--r])>l||(a[e].dl!=o&&(K+=(o-a[e].dl)*a[e].fc,a[e].fc=o),n--)}}(t),ir(e,u)}function ar(t,r){var n,e,o=-1,i=t[0].dl,u=0,a=7,c=4;for(0==i&&(a=138,c=3),t[r+1].dl=65535,n=0;n<=r;n++)e=i,i=t[n+1].dl,++u=3&&0==L[Gt[t]].dl;t--);return K+=3*(t+1)+5+5+4,t}(),(n=Q+3+7>>3)<=(r=K+3+7>>3)&&(r=n),o+4<=r&&v>=0)for(vr((nt<<1)+t,3),hr(),qt(o),qt(~o),i=0;i2&&0==(4095&q)){var n,e=8*q,o=_-v;for(n=0;n>=3,H>=1}while(upr-r?(qt(s|=t<>pr-p,p+=r-pr):(s|=t<>=1,n<<=1}while(--r>0);return n>>1}function hr(){p>8?qt(s):p>0&&Wt(s),s=0,p=0}return function(o,i){var u,s;Z=o,tt=0,void 0===i&&(i=6),function(o){var i;if(o?o<1?o=1:o>9&&(o=9):o=6,x=o,e=!1,O=!1,null==Lt){for(t=r=n=null,Lt=new Array(it),a=new Array(ut),c=new Array(lt),f=new Array(32832),l=new Array(65536),T=new Array(Ct),i=0;i0;){var y=new Array(u);for(s=0;s>4,o=(15&r)<<2|n>>6,i=63&n,u="";return u+=Ba(63&t>>2),u+=Ba(63&e),u+=Ba(63&o),u+=Ba(63&i)}function Ba(t){var r=t;return r<10?String.fromCharCode(48+r):(r-=10)<26?String.fromCharCode(65+r):(r-=26)<26?String.fromCharCode(97+r):0===(r-=26)?"-":1===r?"_":"?"}function $a(t,r){var n,e=unescape(encodeURIComponent(t));return Ko(n="".concat(r,"/svg/")).call(n,function(t){for(var r="",n=0;n0&&void 0!==arguments[0]?arguments[0]:{};Go(this,t);this.baseUrl=null!==(r=n.baseUrl)&&void 0!==r?r:"http://www.plantuml.com/plantuml"}return Uo(t,[{key:"render",value:function(t,r){var n,e,o=r;o||(o=Math.round(1e8*Math.random()));var i=Ko(n="plantuml-".concat(o,"-")).call(n,(new Date).getTime());return Ko(e='')}}],[{key:"install",value:function(r,n){var e;ja(r,{engine:{syntax:{codeBlock:{customRenderer:{plantuml:new t(Ga(Ga({},n),null!==(e=r.engine.syntax.plantuml)&&void 0!==e?e:{}))}}}}})}}]),t}();return Va})); diff --git a/dist/cherry-markdown.core.common.d.ts b/dist/cherry-markdown.core.common.d.ts index d565ac2c6..e0f4da5a4 100644 --- a/dist/cherry-markdown.core.common.d.ts +++ b/dist/cherry-markdown.core.common.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:94638491176c689c7e489fd6f73482a4e228ffaba22fcbd31992ec4d614be7a9 -size 138 +import Cherry, { MenuHookBase, SyntaxHookBase } from "./types/index.core"; +export { MenuHookBase, SyntaxHookBase }; +export default Cherry; \ No newline at end of file diff --git a/dist/cherry-markdown.core.d.ts b/dist/cherry-markdown.core.d.ts index d565ac2c6..e0f4da5a4 100644 --- a/dist/cherry-markdown.core.d.ts +++ b/dist/cherry-markdown.core.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:94638491176c689c7e489fd6f73482a4e228ffaba22fcbd31992ec4d614be7a9 -size 138 +import Cherry, { MenuHookBase, SyntaxHookBase } from "./types/index.core"; +export { MenuHookBase, SyntaxHookBase }; +export default Cherry; \ No newline at end of file diff --git a/dist/cherry-markdown.d.ts b/dist/cherry-markdown.d.ts index 1ea1b82be..e5a14563b 100644 --- a/dist/cherry-markdown.d.ts +++ b/dist/cherry-markdown.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5ed6ef572ce788c67ba71f62aca8ed761f61f8c6f500a17d83ae30466f30243 -size 133 +import Cherry, { MenuHookBase, SyntaxHookBase } from "./types/index"; +export { MenuHookBase, SyntaxHookBase }; +export default Cherry; \ No newline at end of file diff --git a/dist/cherry-markdown.engine.core.common.d.ts b/dist/cherry-markdown.engine.core.common.d.ts index 3d0a4a368..466d2a05a 100644 --- a/dist/cherry-markdown.engine.core.common.d.ts +++ b/dist/cherry-markdown.engine.core.common.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a8d8c68f52c6d728229fa6d2c0b846a7441821d7146598e47344a1abcdde6b95 -size 157 +import CherryEngine, { MenuHookBase, SyntaxHookBase } from "./types/index.engine.core"; +export { MenuHookBase, SyntaxHookBase }; +export default CherryEngine; \ No newline at end of file diff --git a/dist/cherry-markdown.engine.core.d.ts b/dist/cherry-markdown.engine.core.d.ts index 3d0a4a368..466d2a05a 100644 --- a/dist/cherry-markdown.engine.core.d.ts +++ b/dist/cherry-markdown.engine.core.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a8d8c68f52c6d728229fa6d2c0b846a7441821d7146598e47344a1abcdde6b95 -size 157 +import CherryEngine, { MenuHookBase, SyntaxHookBase } from "./types/index.engine.core"; +export { MenuHookBase, SyntaxHookBase }; +export default CherryEngine; \ No newline at end of file diff --git a/dist/cherry-markdown.engine.core.esm.d.ts b/dist/cherry-markdown.engine.core.esm.d.ts index 3d0a4a368..466d2a05a 100644 --- a/dist/cherry-markdown.engine.core.esm.d.ts +++ b/dist/cherry-markdown.engine.core.esm.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a8d8c68f52c6d728229fa6d2c0b846a7441821d7146598e47344a1abcdde6b95 -size 157 +import CherryEngine, { MenuHookBase, SyntaxHookBase } from "./types/index.engine.core"; +export { MenuHookBase, SyntaxHookBase }; +export default CherryEngine; \ No newline at end of file diff --git a/dist/cherry-markdown.esm.d.ts b/dist/cherry-markdown.esm.d.ts index 1ea1b82be..e5a14563b 100644 --- a/dist/cherry-markdown.esm.d.ts +++ b/dist/cherry-markdown.esm.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5ed6ef572ce788c67ba71f62aca8ed761f61f8c6f500a17d83ae30466f30243 -size 133 +import Cherry, { MenuHookBase, SyntaxHookBase } from "./types/index"; +export { MenuHookBase, SyntaxHookBase }; +export default Cherry; \ No newline at end of file diff --git a/dist/cherry-markdown.min.d.ts b/dist/cherry-markdown.min.d.ts index 1ea1b82be..e5a14563b 100644 --- a/dist/cherry-markdown.min.d.ts +++ b/dist/cherry-markdown.min.d.ts @@ -1,3 +1,3 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5ed6ef572ce788c67ba71f62aca8ed761f61f8c6f500a17d83ae30466f30243 -size 133 +import Cherry, { MenuHookBase, SyntaxHookBase } from "./types/index"; +export { MenuHookBase, SyntaxHookBase }; +export default Cherry; \ No newline at end of file diff --git a/dist/fonts/ch-icon.svg b/dist/fonts/ch-icon.svg index 44148f5a9..8a2e30a1e 100644 --- a/dist/fonts/ch-icon.svg +++ b/dist/fonts/ch-icon.svg @@ -1,3 +1,276 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:49e04ae7ae2e981ef749ffdca3e90c1e11b72d229108966c65281df70055d887 -size 282836 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Cherry.config.js b/src/Cherry.config.js index a2b7a87b2..9eb0180ae 100644 --- a/src/Cherry.config.js +++ b/src/Cherry.config.js @@ -425,6 +425,8 @@ const defaultConfig = { forceAppend: true, // The locale Cherry is going to use. Locales live in /src/locales/ locale: 'zh_CN', + // Supplementary locales + locales: {}, // cherry初始化后是否检查 location.hash 尝试滚动到对应位置 autoScrollByHashAfterInit: false, }; diff --git a/src/Cherry.js b/src/Cherry.js index c60c6e07b..109f204c3 100644 --- a/src/Cherry.js +++ b/src/Cherry.js @@ -65,8 +65,16 @@ export default class Cherry extends CherryStatic { */ this.options = mergeWith({}, defaultConfigCopy, options, customizer); + this.locales = locales; + if (this.options.locales) { + this.locales = { + ...this.options.locales, + ...this.locales, + }; + } + // loading the locale - this.locale = locales[this.options.locale]; + this.locale = this.locales[this.options.locale]; if (typeof this.options.engine.global.urlProcessor === 'function') { this.options.engine.global.urlProcessor = urlProcessorProxy(this.options.engine.global.urlProcessor); diff --git a/types/cherry.d.ts b/types/cherry.d.ts index a8bfaa2ee..1eca2dfa4 100644 --- a/types/cherry.d.ts +++ b/types/cherry.d.ts @@ -64,6 +64,9 @@ export interface CherryOptions { instanceId?: string; /** Locale **/ locale: string; + locales: { + [locale: string]: Record + } } export interface CherryExternalsOptions { @@ -298,7 +301,7 @@ export interface CherryFileUploadHandler { * @param file 用户上传的文件对象 * @param callback 回调函数,接收最终的文件url */ - (file: File, + (file: File, /** * @param params.name 回填的alt信息 * @param params.poster 封面图片地址(视频的场景下生效) From 92987ab8e1f06d992e6da85d70d1f9a9d1ea2af8 Mon Sep 17 00:00:00 2001 From: Balder1840 Date: Tue, 19 Mar 2024 09:50:54 +0800 Subject: [PATCH 04/11] show auto number for toc (#737) Co-authored-by: zhenhua.zhou --- docs/cherry/configuration/base.md | 2 + .../configuration/quick-configuration.md | 2 + examples/head_num.html | 6 +++ src/Cherry.config.js | 3 ++ src/Cherry.js | 2 + src/core/hooks/Toc.js | 11 ++-- src/sass/cherry.scss | 46 +++++++++++++++++ src/sass/markdown.scss | 51 +++++++++++++++++++ src/toolbars/Toc.js | 6 ++- types/cherry.d.ts | 1 + 10 files changed, 125 insertions(+), 5 deletions(-) diff --git a/docs/cherry/configuration/base.md b/docs/cherry/configuration/base.md index 00ac94a0c..5994b4dde 100644 --- a/docs/cherry/configuration/base.md +++ b/docs/cherry/configuration/base.md @@ -250,6 +250,8 @@ editor: { toc: { /** 默认只渲染一个目录 */ allowMultiToc: false, + /** 是否显示自增序号 */ + showAutoNumber: false, }, header: { /** diff --git a/docs/cherry/configuration/quick-configuration.md b/docs/cherry/configuration/quick-configuration.md index 6c39c5e95..8e59020ad 100644 --- a/docs/cherry/configuration/quick-configuration.md +++ b/docs/cherry/configuration/quick-configuration.md @@ -177,6 +177,8 @@ const defaultConfig = { toc: { /** 默认只渲染一个目录 */ allowMultiToc: false, + /** 是否显示自增序号 */ + showAutoNumber: false, }, header: { /** diff --git a/examples/head_num.html b/examples/head_num.html index 483546d7c..28a37e12b 100644 --- a/examples/head_num.html +++ b/examples/head_num.html @@ -112,9 +112,15 @@ syntax: { header: { anchorStyle: 'autonumber', + }, + toc: { + showAutoNumber: true } } }, + toolbars: { + showAutoNumber: true + }, value: document.getElementById("demo-val").value, }); diff --git a/src/Cherry.config.js b/src/Cherry.config.js index 9eb0180ae..698eba44f 100644 --- a/src/Cherry.config.js +++ b/src/Cherry.config.js @@ -237,6 +237,8 @@ const defaultConfig = { toc: { /** 默认只渲染一个目录 */ allowMultiToc: false, + /** 是否显示自增序号 */ + showAutoNumber: false, }, header: { /** @@ -315,6 +317,7 @@ const defaultConfig = { // toc: { // updateLocationHash: false, // 要不要更新URL的hash // defaultModel: 'full', // pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题 + // showAutoNumber: false, // 是否显示自增序号 // }, // 快捷键配置,如果配置为空,则使用toolbar的配置 shortcutKey: { diff --git a/src/Cherry.js b/src/Cherry.js index 109f204c3..d16d3f1c0 100644 --- a/src/Cherry.js +++ b/src/Cherry.js @@ -226,6 +226,8 @@ export default class Cherry extends CherryStatic { updateLocationHash: this.options.toolbars.toc.updateLocationHash ?? true, // @ts-ignore defaultModel: this.options.toolbars.toc.defaultModel ?? 'pure', + // @ts-ignore + showAutoNumber: this.options.toolbars.toc.showAutoNumber ?? false, }); } diff --git a/src/core/hooks/Toc.js b/src/core/hooks/Toc.js index c031f3914..b79ddb7da 100644 --- a/src/core/hooks/Toc.js +++ b/src/core/hooks/Toc.js @@ -26,6 +26,7 @@ const defaultOptions = { tocContainerClass: 'toc', tocTitleClass: 'toc-title', linkProcessor: defaultLinkProcessor, + showAutoNumber: false, }; const emptyLinePlaceholder = '

 

'; @@ -43,6 +44,8 @@ export default class Toc extends ParagraphBase { isFirstTocToken = true; /** 允许渲染多个TOC */ allowMultiToc = false; + /** 是否显示自增序号 */ + showAutoNumber = false; constructor({ externals, config }) { super({ needCache: true }); @@ -107,9 +110,8 @@ export default class Toc extends ParagraphBase { nodePrefix = this.$makeLevel(node.level); } const tocLink = this.linkProcessor(`#${node.id}`.replace(/safe_/g, '')); // transform header id to avoid being sanitized - return `
  • ${nodePrefix}${ - node.text - }${closeTag ? '
  • ' : ''}`; + return `
  • + ${nodePrefix}${node.text}${closeTag ? '
  • ' : ''}`; } $makePlainToc(tocNodeList) { @@ -219,7 +221,8 @@ export default class Toc extends ParagraphBase { $makeToc(arr, dataSign, preLinesMatch) { const lines = calculateLinesOfParagraph(preLinesMatch, 1); - let ret = `
    `; + let ret = `
    `; ret += `

    目录

    `; if (arr.length <= 0) { return ''; diff --git a/src/sass/cherry.scss b/src/sass/cherry.scss index 86ebebcec..4f8b3d154 100644 --- a/src/sass/cherry.scss +++ b/src/sass/cherry.scss @@ -894,6 +894,52 @@ } } } + + &.auto-num { + .cherry-toc-list { + counter-reset: toclevel1; + + .cherry-toc-one-a__1{ + counter-reset: toclevel2; + } + .cherry-toc-one-a__2{ + counter-reset: toclevel3; + } + .cherry-toc-one-a__3{ + counter-reset: toclevel4; + } + .cherry-toc-one-a__4{ + counter-reset: toclevel5; + } + .cherry-toc-one-a__5{ + counter-reset: toclevel6; + } + .cherry-toc-one-a__1:before{ + counter-increment: toclevel1; + content: counter(toclevel1) ". "; + } + .cherry-toc-one-a__2:before{ + counter-increment: toclevel2; + content: counter(toclevel1) "." counter(toclevel2) ". "; + } + .cherry-toc-one-a__3:before{ + counter-increment: toclevel3; + content: counter(toclevel1) "." counter(toclevel2) "." counter(toclevel3) ". "; + } + .cherry-toc-one-a__4:before{ + counter-increment: toclevel4; + content: counter(toclevel1) "." counter(toclevel2) "." counter(toclevel3) "." counter(toclevel4) ". "; + } + .cherry-toc-one-a__5:before{ + counter-increment: toclevel5; + content: counter(toclevel1) "." counter(toclevel2) "." counter(toclevel3) "." counter(toclevel4) "." counter(toclevel5) ". "; + } + .cherry-toc-one-a__6:before{ + counter-increment: toclevel5; + content: counter(toclevel1) "." counter(toclevel2) "." counter(toclevel3) "." counter(toclevel4) "." counter(toclevel5) "." counter(toclevel6) ". "; + } + } + } } /** 引入自带的主题 */ diff --git a/src/sass/markdown.scss b/src/sass/markdown.scss index 83c3cfb89..d594cb554 100644 --- a/src/sass/markdown.scss +++ b/src/sass/markdown.scss @@ -325,6 +325,57 @@ } } + .auto-num-toc { + counter-reset: headtoclevel1; + + .toc-li-1 { + counter-reset: headtoclevel2; + a:before { + counter-increment: headtoclevel1; + content: counter(headtoclevel1) ". " + } + } + + .toc-li-2 { + counter-reset: headtoclevel3; + a:before { + counter-increment: headtoclevel2; + content: counter(headtoclevel1) "." counter(headtoclevel2) ". " + } + } + + .toc-li-3 { + counter-reset: headtoclevel4; + a:before { + counter-increment: headtoclevel3; + content: counter(headtoclevel1) "." counter(headtoclevel2) "." counter(headtoclevel3) ". " + } + } + + .toc-li-4 { + counter-reset: headtoclevel5; + a:before { + counter-increment: headtoclevel4; + content: counter(headtoclevel1) "." counter(headtoclevel2) "." counter(headtoclevel3) "." counter(headtoclevel4) ". " + } + } + + .toc-li-5 { + counter-reset: headtoclevel6; + a:before { + counter-increment: headtoclevel5; + content: counter(headtoclevel1) "." counter(headtoclevel2) "." counter(headtoclevel3) "." counter(headtoclevel4) "." counter(headtoclevel5) ". " + } + } + + .toc-li-6 { + a:before { + counter-increment: headtoclevel6; + content: counter(headtoclevel1) "." counter(headtoclevel2) "." counter(headtoclevel3) "." counter(headtoclevel4) "." counter(headtoclevel5) "." counter(headtoclevel6) ". " + } + } + } + .check-list-item { list-style: none; diff --git a/src/toolbars/Toc.js b/src/toolbars/Toc.js index 29f6bf1cb..c358b9b7f 100644 --- a/src/toolbars/Toc.js +++ b/src/toolbars/Toc.js @@ -25,6 +25,7 @@ export default class Toc { this.tocStr = ''; this.updateLocationHash = options.updateLocationHash ?? true; this.defaultModel = options.defaultModel ?? 'full'; + this.showAutoNumber = options.showAutoNumber ?? false; this.init(); } @@ -58,7 +59,10 @@ export default class Toc { } drawDom() { - const tocDom = createElement('div', 'cherry-flex-toc cherry-flex-toc__pure'); + const tocDom = createElement( + 'div', + `cherry-flex-toc cherry-flex-toc__pure${this.showAutoNumber ? ' auto-num' : ''}`, + ); const tocHead = createElement('div', 'cherry-toc-head'); const tocTitle = createElement('span', 'cherry-toc-title'); tocTitle.append(this.$cherry.locale.toc); diff --git a/types/cherry.d.ts b/types/cherry.d.ts index 1eca2dfa4..3f3a9af8a 100644 --- a/types/cherry.d.ts +++ b/types/cherry.d.ts @@ -280,6 +280,7 @@ export interface CherryToolbarOptions { toc?: false | { updateLocationHash: boolean, // 要不要更新URL的hash defaultModel: 'pure' | 'full', // pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题 + showAutoNumber: boolean, // 是否显示自增序号 }; /** 是否展示顶部工具栏 */ showToolbar?: boolean; From 5f43a529148299e805ddcd3b7e681e3273f3a723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Sun, 14 Apr 2024 15:58:07 +0800 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20#743=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=81=94=E6=83=B3=E3=80=81=E5=85=A8=E8=A7=92=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=9A=84=E9=85=8D=E7=BD=AE=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/scripts/index-demo.js | 3 +++ src/Cherry.config.js | 2 ++ src/Editor.js | 5 +++++ src/core/hooks/Suggester.js | 3 +++ types/cherry.d.ts | 4 ++++ types/editor.d.ts | 4 ++++ 6 files changed, 21 insertions(+) diff --git a/examples/scripts/index-demo.js b/examples/scripts/index-demo.js index c63298c7f..3ae04cadc 100644 --- a/examples/scripts/index-demo.js +++ b/examples/scripts/index-demo.js @@ -100,6 +100,7 @@ var basicConfig = { syntax: { codeBlock: { theme: 'twilight', + lineNumber: true, // 默认显示行号 }, table: { enableChart: false, @@ -218,6 +219,8 @@ var basicConfig = { name: 'cherry-text', autoSave2Textarea: true, defaultModel: 'edit&preview', + showFullWidthMark: true, // 是否高亮全角符号 ·|¥|、|:|“|”|【|】|(|)|《|》 + showSuggestList: true, // 是否显示联想框 }, // cherry初始化后是否检查 location.hash 尝试滚动到对应位置 autoScrollByHashAfterInit: true, diff --git a/src/Cherry.config.js b/src/Cherry.config.js index 698eba44f..94b3365a7 100644 --- a/src/Cherry.config.js +++ b/src/Cherry.config.js @@ -271,6 +271,8 @@ const defaultConfig = { }, writingStyle: 'normal', // 书写风格,normal 普通 | typewriter 打字机 | focus 专注,默认normal keepDocumentScrollAfterInit: false, // 在初始化后是否保持网页的滚动,true:保持滚动;false:网页自动滚动到cherry初始化的位置 + showFullWidthMark: true, // 是否高亮全角符号 ·|¥|、|:|“|”|【|】|(|)|《|》 + showSuggestList: true, // 是否显示联想框 }, toolbars: { theme: 'dark', // light or dark diff --git a/src/Editor.js b/src/Editor.js index 2e4594b14..7e5dcd010 100644 --- a/src/Editor.js +++ b/src/Editor.js @@ -66,6 +66,8 @@ export default class Editor { wrapperDom: null, autoScrollByCursor: true, convertWhenPaste: true, + showFullWidthMark: true, + showSuggestList: true, codemirror: { lineNumbers: false, // 显示行数 cursorHeight: 0.85, // 光标高度,0.85好看一些 @@ -163,6 +165,9 @@ export default class Editor { * full width翻译为全角 */ formatFullWidthMark() { + if (!this.options.showFullWidthMark) { + return; + } const { editor } = this; const regex = /[·¥、:“”【】()《》]/; // 此处以仅匹配单个全角符号 const searcher = editor.getSearchCursor(regex); diff --git a/src/core/hooks/Suggester.js b/src/core/hooks/Suggester.js index 604a025d8..4b2fe3b6c 100644 --- a/src/core/hooks/Suggester.js +++ b/src/core/hooks/Suggester.js @@ -248,6 +248,9 @@ class SuggesterPanel { } bindEvent() { + if (!this.editor.options.showSuggestList) { + return; + } let keyAction = false; this.editor.editor.on('change', (codemirror, evt) => { keyAction = true; diff --git a/types/cherry.d.ts b/types/cherry.d.ts index 3f3a9af8a..fed30ec17 100644 --- a/types/cherry.d.ts +++ b/types/cherry.d.ts @@ -153,6 +153,10 @@ export interface CherryEditorOptions { editor?: CodeMirror.Editor; /** 在初始化后是否保持网页的滚动,true:保持滚动;false:网页自动滚动到cherry初始化的位置 */ keepDocumentScrollAfterInit?: boolean; + /** 是否高亮全角符号 ·|¥|、|:|“|”|【|】|(|)|《|》 */ + showFullWidthMark?: boolean; + /** 是否显示联想框 */ + showSuggestList?: boolean; } export type CherryLifecycle = (text: string, html: string) => void; diff --git a/types/editor.d.ts b/types/editor.d.ts index d71e88ce0..c47d82ed4 100644 --- a/types/editor.d.ts +++ b/types/editor.d.ts @@ -47,6 +47,10 @@ export type EditorConfiguration = { value?: string; convertWhenPaste?: boolean; keepDocumentScrollAfterInit?: boolean; + /** 是否高亮全角符号 ·|¥|、|:|“|”|【|】|(|)|《|》 */ + showFullWidthMark?: boolean; + /** 是否显示联想框 */ + showSuggestList?: boolean; codemirror: CodeMirror.EditorConfiguration; onKeydown: EditorEventCallback; onFocus: EditorEventCallback; From b2c6a0e8b3c2e63508861193891421daa3465974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Sun, 21 Apr 2024 13:12:28 +0800 Subject: [PATCH 06/11] fix: image loading failed in vscode plugin (#748) fix: ts's `HeadersInit` deletion close #744 --- vscodePlugin/tsconfig.json | 6 +++++- vscodePlugin/web-resources/scripts/index.js | 14 +++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/vscodePlugin/tsconfig.json b/vscodePlugin/tsconfig.json index b65c74510..8251dd137 100644 --- a/vscodePlugin/tsconfig.json +++ b/vscodePlugin/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "outDir": "out", "lib": [ - "es6" + "es6", + "DOM" ], "sourceMap": true, "rootDir": "src", @@ -14,6 +15,9 @@ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUnusedParameters": true, /* Report errors on unused parameters. */ }, + "include": [ + "src/**/*.ts" + ], "exclude": [ "node_modules", ".vscode-test" diff --git a/vscodePlugin/web-resources/scripts/index.js b/vscodePlugin/web-resources/scripts/index.js index 5c5628c62..94a4c3c0c 100644 --- a/vscodePlugin/web-resources/scripts/index.js +++ b/vscodePlugin/web-resources/scripts/index.js @@ -1,5 +1,6 @@ import 'mathjax/es5/tex-svg.js'; import path from 'path-browserify'; +import vscodeApi from 'vscode'; // import md5 from 'md5'; /** @@ -295,15 +296,22 @@ const basicConfig = { // eslint-disable-next-line no-undef changeString2Pinyin: pinyin, beforeImageMounted(srcProp, srcValue) { + console.log('beforeImageMounted', srcProp, srcValue); if (isHttpUrl(srcValue) || isDataUrl(srcValue)) { return { src: srcValue, }; } - // eslint-disable-next-line no-underscore-dangle - const basePath = window._baseResourcePath || ''; + let imgPath = srcValue; + const { workspaceFolders } = vscodeApi.workspace; + if (workspaceFolders && workspaceFolders.length > 0) { + const workspacePath = workspaceFolders[0].uri.fsPath; + imgPath = path.join(workspacePath, srcValue); + } + return { - src: path.join(basePath, srcValue), + // src: path.join(basePath, srcValue), + src: imgPath, }; }, }, From e1df9847d1f3ef0f7564784da9987876720a46cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Wed, 24 Apr 2024 09:56:10 +0800 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20#728=20=E6=8A=8A=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=A1=A8=E6=A0=BC=E7=94=9F=E6=88=90=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=E6=94=BE=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/markdown/basic.md | 38 ++++ examples/scripts/index-demo.js | 18 +- src/Previewer.js | 22 ++- .../advance/cherry-table-echarts-plugin.js | 170 ++++++++++++++++++ src/core/hooks/Table.js | 10 +- src/index.js | 2 + src/sass/ch-icon.scss | 3 +- src/sass/icons/uEA72-trendingUp.svg | 1 + 8 files changed, 254 insertions(+), 10 deletions(-) create mode 100644 src/addons/advance/cherry-table-echarts-plugin.js create mode 100644 src/sass/icons/uEA72-trendingUp.svg diff --git a/examples/markdown/basic.md b/examples/markdown/basic.md index 73178ebd9..ce54d9442 100644 --- a/examples/markdown/basic.md +++ b/examples/markdown/basic.md @@ -489,6 +489,44 @@ $$ ----- +## 表格配图 +**说明** +- 在通用表格语法的基础上,通过在首行首列单元格里写入关键字来同时生成表格和图表 + +**示例(折线图)** +```markdown +| :line:{x,y} | Header1 | Header2 | Header3 | Header4 | +| ------ | ------ | ------ | ------ | ------ | +| Sample1 | 11 | 11 | 4 | 33 | +| Sample2 | 112 | 111 | 22 | 222 | +| Sample3 | 333 | 142 | 311 | 11 | +``` + +**效果** +| :line:{x,y} | Header1 | Header2 | Header3 | Header4 | +| ------ | ------ | ------ | ------ | ------ | +| Sample1 | 11 | 11 | 4 | 33 | +| Sample2 | 112 | 111 | 22 | 222 | +| Sample3 | 333 | 142 | 311 | 11 | + +**示例(柱状图)** +```markdown +| :bar:{y,x} | Header1 | Header2 | Header3 | Header4 | +| ------ | ------ | ------ | ------ | ------ | +| Sample1 | 11 | 11 | 4 | 33 | +| Sample2 | 112 | 111 | 22 | 222 | +| Sample3 | 333 | 142 | 311 | 11 | +``` + +**效果** +| :bar:{y,x} | Header1 | Header2 | Header3 | Header4 | +| ------ | ------ | ------ | ------ | ------ | +| Sample1 | 11 | 11 | 4 | 33 | +| Sample2 | 112 | 111 | 22 | 222 | +| Sample3 | 333 | 142 | 311 | 11 | + +----- + ## 流程图[^不通用提醒] **说明** diff --git a/examples/scripts/index-demo.js b/examples/scripts/index-demo.js index 3ae04cadc..ce48996e4 100644 --- a/examples/scripts/index-demo.js +++ b/examples/scripts/index-demo.js @@ -82,6 +82,17 @@ var customMenuC = Cherry.createMenuHook('帮助中心', { ] }); +/** + * 定义带图表表格的按钮 + */ +var customMenuTable = Cherry.createMenuHook('图表', { + iconName: 'trendingUp', + subMenuConfig: [ + { noIcon: true, name: '折线图', onclick: (event)=>{cherry.insert('\n| :line:{x,y} | Header1 | Header2 | Header3 | Header4 |\n| ------ | ------ | ------ | ------ | ------ |\n| Sample1 | 11 | 11 | 4 | 33 |\n| Sample2 | 112 | 111 | 22 | 222 |\n| Sample3 | 333 | 142 | 311 | 11 |\n');} }, + { noIcon: true, name: '柱状图', onclick: (event)=>{cherry.insert('\n| :bar:{x,y} | Header1 | Header2 | Header3 | Header4 |\n| ------ | ------ | ------ | ------ | ------ |\n| Sample1 | 11 | 11 | 4 | 33 |\n| Sample2 | 112 | 111 | 22 | 222 |\n| Sample3 | 333 | 142 | 311 | 11 |\n');} }, + ] +}); + var basicConfig = { id: 'markdown', externals: { @@ -103,8 +114,7 @@ var basicConfig = { lineNumber: true, // 默认显示行号 }, table: { - enableChart: false, - // chartEngine: Engine Class + enableChart: true, }, fontEmphasis: { allowWhitespace: false, // 是否允许首尾空格 @@ -166,6 +176,7 @@ var basicConfig = { insert: ['image', 'audio', 'video', 'link', 'hr', 'br', 'code', 'formula', 'toc', 'table', 'pdf', 'word', 'ruby'], }, 'graph', + 'customMenuTable', 'togglePreview', 'settings', 'codeTheme', @@ -181,13 +192,14 @@ var basicConfig = { sidebar: ['mobilePreview', 'copy', 'theme', 'publish'], sidebar: ['mobilePreview', 'copy', 'theme'], toc: { - updateLocationHash: false, // 要不要更新URL的hash + updateLocationHash: true, // 要不要更新URL的hash defaultModel: 'full', // pure: 精简模式/缩略模式,只有一排小点; full: 完整模式,会展示所有标题 }, customMenu: { customMenuAName: customMenuA, customMenuBName: customMenuB, customMenuCName: customMenuC, + customMenuTable, }, // config: { // publish: [ diff --git a/src/Previewer.js b/src/Previewer.js index 9d2fc042e..1e8cc3bb6 100644 --- a/src/Previewer.js +++ b/src/Previewer.js @@ -633,10 +633,28 @@ export default class Previewer { break; case 'update': try { - if (newContent[change.newIndex].dom.querySelector('svg')) { + // 处理表格包含图表的特殊场景 + let hasUpdate = false; + if ( + newContent[change.newIndex].dom.className === 'cherry-table-container' && + newContent[change.newIndex].dom.querySelector('.cherry-table-figure') && + oldContent[change.oldIndex].dom.querySelector('.cherry-table-figure') + ) { + oldContent[change.oldIndex].dom + .querySelector('.cherry-table-figure') + .replaceWith(newContent[change.newIndex].dom.querySelector('.cherry-table-figure')); + oldContent[change.oldIndex].dom.dataset.sign = newContent[change.oldIndex].dom.dataset.sign; + this.$updateDom( + newContent[change.newIndex].dom.querySelector('.cherry-table'), + oldContent[change.oldIndex].dom.querySelector('.cherry-table'), + ); + hasUpdate = true; + } else if (newContent[change.newIndex].dom.querySelector('svg')) { throw new Error(); // SVG暂不使用patch更新 } - this.$updateDom(newContent[change.newIndex].dom, oldContent[change.oldIndex].dom); + if (!hasUpdate) { + this.$updateDom(newContent[change.newIndex].dom, oldContent[change.oldIndex].dom); + } } catch (e) { domContainer.insertBefore(newContent[change.newIndex].dom, oldContent[change.oldIndex].dom); domContainer.removeChild(oldContent[change.oldIndex].dom); diff --git a/src/addons/advance/cherry-table-echarts-plugin.js b/src/addons/advance/cherry-table-echarts-plugin.js new file mode 100644 index 000000000..18b025210 --- /dev/null +++ b/src/addons/advance/cherry-table-echarts-plugin.js @@ -0,0 +1,170 @@ +/** + * Tencent is pleased to support the open source community by making CherryMarkdown available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * The below software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications"). + * + * All Tencent Modifications are Copyright (C) THL A29 Limited. + * + * CherryMarkdown is licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import mergeWith from 'lodash/mergeWith'; + +const DEFAULT_OPTIONS = { + renderer: 'svg', + width: 500, + height: 300, +}; + +export default class EChartsTableEngine { + static install(cherryOptions, ...args) { + if (typeof window === 'undefined') { + console.warn('echarts-table-engine only works in browser.'); + mergeWith(cherryOptions, { + engine: { + syntax: { + table: { + enableChart: false, + }, + }, + }, + }); + return; + } + mergeWith(cherryOptions, { + engine: { + syntax: { + table: { + enableChart: true, + chartRenderEngine: EChartsTableEngine, + externals: ['echarts'], + }, + }, + }, + }); + } + + constructor(echartsOptions = {}) { + const { echarts, ...options } = echartsOptions; + if (!echarts && !window.echarts) { + throw new Error('table-echarts-plugin[init]: Package echarts not found.'); + } + this.options = { ...DEFAULT_OPTIONS, ...(options || {}) }; + this.echartsRef = echarts || window.echarts; // echarts引用 + this.dom = null; + } + + getInstance() { + if (!this.dom) { + this.dom = document.createElement('div'); + this.echartsRef.init(this.dom, null, this.options); + } + return this.echartsRef.getInstanceByDom(this.dom); + } + + render(type, options, tableObject) { + // console.log(type, options, tableObject); + let chartOption = {}; + switch (type) { + case 'bar': + chartOption = this.renderBarChart(tableObject, options); + break; + case 'line': + chartOption = this.renderLineChart(tableObject, options); + break; + default: + return ''; + } + const eChartInstance = this.getInstance(); + eChartInstance.clear(); + eChartInstance.setOption(chartOption); + return eChartInstance.getDom().innerHTML; + } + + renderBarChart(tableObject, options) { + return this.$renderChartCommon(tableObject, options, 'bar'); + } + + renderLineChart(tableObject, options) { + return this.$renderChartCommon(tableObject, options, 'line'); + } + + $renderChartCommon(tableObject, options, type) { + // TODO: 通过options反转xy轴 + const baseSeries = { + bar: { + type: 'bar', + barWidth: 20, + animation: false, + name: '', + data: [], + }, + line: { + type: 'line', + animation: false, + name: '', + data: [], + }, + }; + if (!baseSeries[type]) { + return; + } + const dataSet = tableObject.rows.reduce( + (result, row) => { + // legend + result.legend.data.push(row[0]); + // series + result.series.push({ + ...baseSeries[type], + name: row[0], + data: row.slice(1).map((data) => { + const num = Number.parseFloat(data.replace(/,/g, '')); + return num; + }), + }); + return result; + }, + { + legend: { data: [] }, + series: [], + }, + ); + const chartOptions = { + ...dataSet, + xAxis: { + data: tableObject.header.slice(1), + type: 'category', + }, + yAxis: { + type: 'value', + axisLabel: { + width: '100%', + }, + }, + grid: { + containLabel: true, + left: '1%', + right: '1%', + bottom: '10%', + }, + }; + return chartOptions; + } + + onDestroy() { + if (!this.dom) { + return; + } + this.echartsRef.dispose(this.dom); + } +} diff --git a/src/core/hooks/Table.js b/src/core/hooks/Table.js index 4f12b4cc4..56f0e3566 100644 --- a/src/core/hooks/Table.js +++ b/src/core/hooks/Table.js @@ -166,11 +166,13 @@ export default class Table extends ParagraphBase { return tableResult; } const chart = this.chartRenderEngine.render(chartOptions.type, chartOptions.options, tableObject); - const chartHtml = `
    ${chart}
    `; + const chartHtml = `
    ${chart}
    `; + const newSign = `${tableResult.sign}${chartOptionsSign}`; return { - html: `${chartHtml}${tableResult.html}`, - sign: chartOptionsSign + tableResult.sign, + html: tableResult.html + .replace(/(^
    )/, `$1${chartHtml}`) + .replace(/(^