tiny-markdown-editor 0.2.32 → 0.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/tiny-mde.css +3 -4
- package/dist/tiny-mde.js +3940 -6353
- package/dist/tiny-mde.min.css +1 -1
- package/dist/tiny-mde.min.js +1 -1
- package/dist/tiny-mde.tiny.js +1 -1
- package/lib/TinyMDE.d.ts +17 -0
- package/lib/TinyMDE.js +80 -10
- package/lib/TinyMDECommandBar.d.ts +10 -0
- package/lib/TinyMDECommandBar.js +37 -3
- package/package.json +1 -1
package/dist/tiny-mde.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.TinyMDE{background-color:#fff;box-sizing:border-box;color:#000;font-size:16px;line-height:24px;min-height:100%;outline:none;padding:5px}.TinyMDE.TinyMDE_empty{position:relative}.TinyMDE.TinyMDE_empty:before{color:#a0a0a0;content:attr(data-placeholder);pointer-events:none;position:absolute}.TMBlankLine{height:24px}.TMH1,.TMSetextH1{font-size:22px;font-weight:700;line-height:32px;margin-bottom:8px}.TMSetextH1{margin-bottom:0}.TMSetextH1Marker{margin-bottom:8px}.TMH2,.TMSetextH2{font-size:20px;font-weight:700;line-height:28px;margin-bottom:4px}.TMMark_TMCode{font-family:monospace;font-size:.9em}.TMCode,.TMFencedCodeBacktick,.TMFencedCodeTilde,.TMIndentedCode{background-color:#e0e0e0;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickOpen,.TMCodeFenceTildeOpen{border-bottom:1px solid silver;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickClose,.TMCodeFenceTildeClose{border-top:1px solid silver;font-family:monospace;font-size:.9em}.TMInfoString{color:#00f}.TMCode{border:1px solid silver;border-radius:2px}.TMBlockquote{border-left:2px solid silver;font-style:italic;margin-left:10px;padding-left:10px}.TMMark{color:#a0a0a0}.TMMark_TMH1,.TMMark_TMH2,.TMMark_TMOL,.TMMark_TMUL{color:#ff8080}.TMMark_TMTask{color:#e0e0e0}.TMCheckbox{caret-color:#000;color:#0000;cursor:pointer;font-family:monospace;position:relative}.TMCheckbox:before{border:1px solid silver;border-radius:2px;box-sizing:border-box;content:"";height:.85em;left:50%;pointer-events:none;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:.85em}.TMCheckbox_checked:before{border-color:#2aa775}.TMCheckbox_checked:after{box-sizing:border-box;color:#2aa775;content:"✓";left:50%;pointer-events:none;position:absolute;text-align:center;top:50%;transform:translateX(-50%) translateY(-50%);vertical-align:top}.TMImage{text-decoration:underline
|
|
1
|
+
.TinyMDE{background-color:#fff;box-sizing:border-box;color:#000;font-size:16px;line-height:24px;min-height:100%;outline:none;padding:5px}.TinyMDE.TinyMDE_empty{position:relative}.TinyMDE.TinyMDE_empty:before{color:#a0a0a0;content:attr(data-placeholder);pointer-events:none;position:absolute}.TMBlankLine{height:24px}.TMH1,.TMSetextH1{font-size:22px;font-weight:700;line-height:32px;margin-bottom:8px}.TMSetextH1{margin-bottom:0}.TMSetextH1Marker{margin-bottom:8px}.TMH2,.TMSetextH2{font-size:20px;font-weight:700;line-height:28px;margin-bottom:4px}.TMMark_TMCode{font-family:monospace;font-size:.9em}.TMCode,.TMFencedCodeBacktick,.TMFencedCodeTilde,.TMIndentedCode{background-color:#e0e0e0;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickOpen,.TMCodeFenceTildeOpen{border-bottom:1px solid silver;font-family:monospace;font-size:.9em}.TMCodeFenceBacktickClose,.TMCodeFenceTildeClose{border-top:1px solid silver;font-family:monospace;font-size:.9em}.TMInfoString{color:#00f}.TMCode{border:1px solid silver;border-radius:2px}.TMBlockquote{border-left:2px solid silver;font-style:italic;margin-left:10px;padding-left:10px}.TMMark{color:#a0a0a0}.TMMark_TMH1,.TMMark_TMH2,.TMMark_TMOL,.TMMark_TMUL{color:#ff8080}.TMMark_TMTask{color:#e0e0e0}.TMCheckbox{caret-color:#000;color:#0000;cursor:pointer;font-family:monospace;position:relative}.TMCheckbox:before{border:1px solid silver;border-radius:2px;box-sizing:border-box;content:"";height:.85em;left:50%;pointer-events:none;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%);width:.85em}.TMCheckbox_checked:before{border-color:#2aa775}.TMCheckbox_checked:after{box-sizing:border-box;color:#2aa775;content:"✓";left:50%;pointer-events:none;position:absolute;text-align:center;top:50%;transform:translateX(-50%) translateY(-50%);vertical-align:top}.TMImage{text-decoration:underline;text-decoration-color:#0f0}.TMLink{text-decoration:underline;text-decoration-color:#00f}.TMLinkLabel{font-family:monospace;text-decoration:underline}.TMLinkLabel_Definition,.TMLinkLabel_Valid{color:#40c040}.TMLinkLabel_Invalid{color:red}.TMLinkTitle{font-style:italic}.TMAutolink,.TMLinkDestination{color:#00f;text-decoration:underline}.TMHR{position:relative}.TMHR:before{border-bottom:2px solid grey;bottom:50%;content:"";left:40%;position:absolute;width:20%;z-index:0}.TMHTML,.TMHTMLBlock{color:#8000ff;font-family:monospace;font-size:.9em}.TMHTMLBlock{color:#6000c0}.TMCommandBar{background-color:#f8f8f8;border:4px solid #f8f8f8;box-sizing:initial;display:flex;height:24px;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;-webkit-user-select:none;user-select:none;-ms-overflow-style:none}.TMCommandBar::-webkit-scrollbar{display:none}.TMCommandButton{box-sizing:border-box;color:#404040;display:inline-block;height:24px;margin-right:4px;padding:3px;width:24px;fill:#404040;cursor:pointer;font-family:sans-serif;font-size:20px;line-height:18px;text-align:center;vertical-align:middle}.TMCommandDivider{border-left:1px solid silver;border-right:1px solid #fff;box-sizing:initial;height:24px;margin-left:4px;margin-right:8px;width:0}.TMCommandButton_Active{background-color:#c0c0ff;color:navy;font-weight:700;fill:navy}.TMCommandButton_Inactive{background-color:#f8f8f8}.TMCommandButton_Disabled{color:#a0a0a0;fill:#a0a0a0}@media (hover:hover){.TMCommandButton_Active:hover,.TMCommandButton_Disabled:hover,.TMCommandButton_Inactive:hover{background-color:#e0e0ff;fill:#000}}
|
package/dist/tiny-mde.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyMDE={})}(this,(function(e){"use strict";var t,n,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={};function s(){if(n)return t;n=1;var e=function(e){return e&&e.Math===Math&&e};return t=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof r&&r)||e("object"==typeof t&&t)||function(){return this}()||Function("return this")()}var o,a,l,u,c,h,p,f,d={};function g(){return a?o:(a=1,o=function(e){try{return!!e()}catch(e){return!0}})}function m(){if(u)return l;u=1;var e=g();return l=!e((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function y(){if(h)return c;h=1;var e=g();return c=!e((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))}function v(){if(f)return p;f=1;var e=y(),t=Function.prototype.call;return p=e?t.bind(t):function(){return t.apply(t,arguments)},p}var M,T,k,b,C,D,F,w,E,A,x,S,L,$,I,O,H,B,P,N,_,R,j,z,G,V,U,Z,q,K,W,X,Y,Q,J,ee,te,ne,re,ie,se,oe={};function ae(){return k?T:(k=1,T=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function le(){if(C)return b;C=1;var e=y(),t=Function.prototype,n=t.call,r=e&&t.bind.bind(n,n);return b=e?r:function(e){return function(){return n.apply(e,arguments)}},b}function ue(){if(F)return D;F=1;var e=le(),t=e({}.toString),n=e("".slice);return D=function(e){return n(t(e),8,-1)}}function ce(){return x?A:(x=1,A=function(e){return null==e})}function he(){if(L)return S;L=1;var e=ce(),t=TypeError;return S=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function pe(){if(I)return $;I=1;var e=function(){if(E)return w;E=1;var e=le(),t=g(),n=ue(),r=Object,i=e("".split);return w=t((function(){return!r("z").propertyIsEnumerable(0)}))?function(e){return"String"===n(e)?i(e,""):r(e)}:r}(),t=he();return $=function(n){return e(t(n))}}function fe(){if(H)return O;H=1;var e="object"==typeof document&&document.all;return O=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function de(){if(P)return B;P=1;var e=fe();return B=function(t){return"object"==typeof t?null!==t:e(t)}}function ge(){if(_)return N;_=1;var e=s(),t=fe();return N=function(n,r){return arguments.length<2?(i=e[n],t(i)?i:void 0):e[n]&&e[n][r];var i},N}function me(){if(j)return R;j=1;var e=le();return R=e({}.isPrototypeOf)}function ye(){if(U)return V;U=1;var e,t,n=s(),r=function(){if(G)return z;G=1;var e=s().navigator,t=e&&e.userAgent;return z=t?String(t):""}(),i=n.process,o=n.Deno,a=i&&i.versions||o&&o.version,l=a&&a.v8;return l&&(t=(e=l.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&r&&(!(e=r.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=r.match(/Chrome\/(\d+)/))&&(t=+e[1]),V=t}function ve(){if(q)return Z;q=1;var e=ye(),t=g(),n=s().String;return Z=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))}function Me(){if(W)return K;W=1;var e=ve();return K=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Te(){if(Y)return X;Y=1;var e=ge(),t=fe(),n=me(),r=Me(),i=Object;return X=r?function(e){return"symbol"==typeof e}:function(r){var s=e("Symbol");return t(s)&&n(s.prototype,i(r))}}function ke(){if(J)return Q;J=1;var e=String;return Q=function(t){try{return e(t)}catch(e){return"Object"}}}function be(){if(te)return ee;te=1;var e=fe(),t=ke(),n=TypeError;return ee=function(r){if(e(r))return r;throw new n(t(r)+" is not a function")}}function Ce(){if(re)return ne;re=1;var e=be(),t=ce();return ne=function(n,r){var i=n[r];return t(i)?void 0:e(i)}}function De(){if(se)return ie;se=1;var e=v(),t=fe(),n=de(),r=TypeError;return ie=function(i,s){var o,a;if("string"===s&&t(o=i.toString)&&!n(a=e(o,i)))return a;if(t(o=i.valueOf)&&!n(a=e(o,i)))return a;if("string"!==s&&t(o=i.toString)&&!n(a=e(o,i)))return a;throw new r("Can't convert object to primitive value")}}var Fe,we,Ee,Ae,xe,Se,Le,$e,Ie,Oe,He,Be,Pe,Ne,_e,Re,je,ze,Ge,Ve,Ue,Ze,qe,Ke,We={exports:{}};function Xe(){return we?Fe:(we=1,Fe=!1)}function Ye(){if(Ae)return Ee;Ae=1;var e=s(),t=Object.defineProperty;return Ee=function(n,r){try{t(e,n,{value:r,configurable:!0,writable:!0})}catch(t){e[n]=r}return r}}function Qe(){if(xe)return We.exports;xe=1;var e=Xe(),t=s(),n=Ye(),r="__core-js_shared__",i=We.exports=t[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.42.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"}),We.exports}function Je(){if(Le)return Se;Le=1;var e=Qe();return Se=function(t,n){return e[t]||(e[t]=n||{})}}function et(){if(Ie)return $e;Ie=1;var e=he(),t=Object;return $e=function(n){return t(e(n))}}function tt(){if(He)return Oe;He=1;var e=le(),t=et(),n=e({}.hasOwnProperty);return Oe=Object.hasOwn||function(e,r){return n(t(e),r)}}function nt(){if(Pe)return Be;Pe=1;var e=le(),t=0,n=Math.random(),r=e(1..toString);return Be=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++t+n,36)}}function rt(){if(_e)return Ne;_e=1;var e=s(),t=Je(),n=tt(),r=nt(),i=ve(),o=Me(),a=e.Symbol,l=t("wks"),u=o?a.for||a:a&&a.withoutSetter||r;return Ne=function(e){return n(l,e)||(l[e]=i&&n(a,e)?a[e]:u("Symbol."+e)),l[e]}}function it(){if(je)return Re;je=1;var e=v(),t=de(),n=Te(),r=Ce(),i=De(),s=rt(),o=TypeError,a=s("toPrimitive");return Re=function(s,l){if(!t(s)||n(s))return s;var u,c=r(s,a);if(c){if(void 0===l&&(l="default"),u=e(c,s,l),!t(u)||n(u))return u;throw new o("Can't convert object to primitive value")}return void 0===l&&(l="number"),i(s,l)}}function st(){if(Ge)return ze;Ge=1;var e=it(),t=Te();return ze=function(n){var r=e(n,"string");return t(r)?r:r+""}}function ot(){if(Ue)return Ve;Ue=1;var e=s(),t=de(),n=e.document,r=t(n)&&t(n.createElement);return Ve=function(e){return r?n.createElement(e):{}}}function at(){if(qe)return Ze;qe=1;var e=m(),t=g(),n=ot();return Ze=!e&&!t((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function lt(){if(Ke)return d;Ke=1;var e=m(),t=v(),n=function(){if(M)return oe;M=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!e.call({1:2},1);return oe.f=n?function(e){var n=t(this,e);return!!n&&n.enumerable}:e,oe}(),r=ae(),i=pe(),s=st(),o=tt(),a=at(),l=Object.getOwnPropertyDescriptor;return d.f=e?l:function(e,u){if(e=i(e),u=s(u),a)try{return l(e,u)}catch(e){}if(o(e,u))return r(!t(n.f,e,u),e[u])},d}var ut,ct,ht,pt,ft,dt,gt,mt={};function yt(){if(ct)return ut;ct=1;var e=m(),t=g();return ut=e&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function vt(){if(pt)return ht;pt=1;var e=de(),t=String,n=TypeError;return ht=function(r){if(e(r))return r;throw new n(t(r)+" is not an object")}}function Mt(){if(ft)return mt;ft=1;var e=m(),t=at(),n=yt(),r=vt(),i=st(),s=TypeError,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l="enumerable",u="configurable",c="writable";return mt.f=e?n?function(e,t,n){if(r(e),t=i(t),r(n),"function"==typeof e&&"prototype"===t&&"value"in n&&c in n&&!n[c]){var s=a(e,t);s&&s[c]&&(e[t]=n.value,n={configurable:u in n?n[u]:s[u],enumerable:l in n?n[l]:s[l],writable:!1})}return o(e,t,n)}:o:function(e,n,a){if(r(e),n=i(n),r(a),t)try{return o(e,n,a)}catch(e){}if("get"in a||"set"in a)throw new s("Accessors not supported");return"value"in a&&(e[n]=a.value),e},mt}function Tt(){if(gt)return dt;gt=1;var e=m(),t=Mt(),n=ae();return dt=e?function(e,r,i){return t.f(e,r,n(1,i))}:function(e,t,n){return e[t]=n,e}}var kt,bt,Ct,Dt,Ft,wt,Et,At,xt,St,Lt,$t,It,Ot,Ht,Bt={exports:{}};function Pt(){if(bt)return kt;bt=1;var e=m(),t=tt(),n=Function.prototype,r=e&&Object.getOwnPropertyDescriptor,i=t(n,"name"),s=i&&"something"===function(){}.name,o=i&&(!e||e&&r(n,"name").configurable);return kt={EXISTS:i,PROPER:s,CONFIGURABLE:o}}function Nt(){if(Dt)return Ct;Dt=1;var e=le(),t=fe(),n=Qe(),r=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return r(e)}),Ct=n.inspectSource}function _t(){if(At)return Et;At=1;var e=Je(),t=nt(),n=e("keys");return Et=function(e){return n[e]||(n[e]=t(e))}}function Rt(){return St?xt:(St=1,xt={})}function jt(){if($t)return Lt;$t=1;var e,t,n,r=function(){if(wt)return Ft;wt=1;var e=s(),t=fe(),n=e.WeakMap;return Ft=t(n)&&/native code/.test(String(n))}(),i=s(),o=de(),a=Tt(),l=tt(),u=Qe(),c=_t(),h=Rt(),p="Object already initialized",f=i.TypeError,d=i.WeakMap;if(r||u.state){var g=u.state||(u.state=new d);g.get=g.get,g.has=g.has,g.set=g.set,e=function(e,t){if(g.has(e))throw new f(p);return t.facade=e,g.set(e,t),t},t=function(e){return g.get(e)||{}},n=function(e){return g.has(e)}}else{var m=c("state");h[m]=!0,e=function(e,t){if(l(e,m))throw new f(p);return t.facade=e,a(e,m,t),t},t=function(e){return l(e,m)?e[m]:{}},n=function(e){return l(e,m)}}return Lt={set:e,get:t,has:n,enforce:function(r){return n(r)?t(r):e(r,{})},getterFor:function(e){return function(n){var r;if(!o(n)||(r=t(n)).type!==e)throw new f("Incompatible receiver, "+e+" required");return r}}}}function zt(){if(It)return Bt.exports;It=1;var e=le(),t=g(),n=fe(),r=tt(),i=m(),s=Pt().CONFIGURABLE,o=Nt(),a=jt(),l=a.enforce,u=a.get,c=String,h=Object.defineProperty,p=e("".slice),f=e("".replace),d=e([].join),y=i&&!t((function(){return 8!==h((function(){}),"length",{value:8}).length})),v=String(String).split("String"),M=Bt.exports=function(e,t,n){"Symbol("===p(c(t),0,7)&&(t="["+f(c(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!r(e,"name")||s&&e.name!==t)&&(i?h(e,"name",{value:t,configurable:!0}):e.name=t),y&&n&&r(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var o=l(e);return r(o,"source")||(o.source=d(v,"string"==typeof t?t:"")),e};return Function.prototype.toString=M((function(){return n(this)&&u(this).source||o(this)}),"toString"),Bt.exports}function Gt(){if(Ht)return Ot;Ht=1;var e=fe(),t=Mt(),n=zt(),r=Ye();return Ot=function(i,s,o,a){a||(a={});var l=a.enumerable,u=void 0!==a.name?a.name:s;if(e(o)&&n(o,u,a),a.global)l?i[s]=o:r(s,o);else{try{a.unsafe?i[s]&&(l=!0):delete i[s]}catch(e){}l?i[s]=o:t.f(i,s,{value:o,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return i}}var Vt,Ut,Zt,qt,Kt,Wt,Xt,Yt,Qt,Jt,en,tn,nn,rn,sn,on,an,ln={};function un(){if(qt)return Zt;qt=1;var e=function(){if(Ut)return Vt;Ut=1;var e=Math.ceil,t=Math.floor;return Vt=Math.trunc||function(n){var r=+n;return(r>0?t:e)(r)}}();return Zt=function(t){var n=+t;return n!=n||0===n?0:e(n)}}function cn(){if(Wt)return Kt;Wt=1;var e=un(),t=Math.max,n=Math.min;return Kt=function(r,i){var s=e(r);return s<0?t(s+i,0):n(s,i)}}function hn(){if(Yt)return Xt;Yt=1;var e=un(),t=Math.min;return Xt=function(n){var r=e(n);return r>0?t(r,9007199254740991):0}}function pn(){if(Jt)return Qt;Jt=1;var e=hn();return Qt=function(t){return e(t.length)}}function fn(){if(rn)return nn;rn=1;var e=le(),t=tt(),n=pe(),r=function(){if(tn)return en;tn=1;var e=pe(),t=cn(),n=pn(),r=function(r){return function(i,s,o){var a=e(i),l=n(a);if(0===l)return!r&&-1;var u,c=t(o,l);if(r&&s!=s){for(;l>c;)if((u=a[c++])!=u)return!0}else for(;l>c;c++)if((r||c in a)&&a[c]===s)return r||c||0;return!r&&-1}};return en={includes:r(!0),indexOf:r(!1)}}().indexOf,i=Rt(),s=e([].push);return nn=function(e,o){var a,l=n(e),u=0,c=[];for(a in l)!t(i,a)&&t(l,a)&&s(c,a);for(;o.length>u;)t(l,a=o[u++])&&(~r(c,a)||s(c,a));return c}}function dn(){return on?sn:(on=1,sn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function gn(){if(an)return ln;an=1;var e=fn(),t=dn().concat("length","prototype");return ln.f=Object.getOwnPropertyNames||function(n){return e(n,t)},ln}var mn,yn,vn,Mn,Tn,kn,bn,Cn,Dn,Fn,wn,En,An,xn,Sn,Ln,$n,In,On,Hn={};function Bn(){if(vn)return yn;vn=1;var e=ge(),t=le(),n=gn(),r=(mn||(mn=1,Hn.f=Object.getOwnPropertySymbols),Hn),i=vt(),s=t([].concat);return yn=e("Reflect","ownKeys")||function(e){var t=n.f(i(e)),o=r.f;return o?s(t,o(e)):t}}function Pn(){if(Tn)return Mn;Tn=1;var e=tt(),t=Bn(),n=lt(),r=Mt();return Mn=function(i,s,o){for(var a=t(s),l=r.f,u=n.f,c=0;c<a.length;c++){var h=a[c];e(i,h)||o&&e(o,h)||l(i,h,u(s,h))}}}function Nn(){if(bn)return kn;bn=1;var e=g(),t=fe(),n=/#|\.prototype\./,r=function(n,r){var l=s[i(n)];return l===a||l!==o&&(t(r)?e(r):!!r)},i=r.normalize=function(e){return String(e).replace(n,".").toLowerCase()},s=r.data={},o=r.NATIVE="N",a=r.POLYFILL="P";return kn=r}function _n(){if(Dn)return Cn;Dn=1;var e=s(),t=lt().f,n=Tt(),r=Gt(),i=Ye(),o=Pn(),a=Nn();return Cn=function(s,l){var u,c,h,p,f,d=s.target,g=s.global,m=s.stat;if(u=g?e:m?e[d]||i(d,{}):e[d]&&e[d].prototype)for(c in l){if(p=l[c],h=s.dontCallGetSet?(f=t(u,c))&&f.value:u[c],!a(g?c:d+(m?".":"#")+c,s.forced)&&void 0!==h){if(typeof p==typeof h)continue;o(p,h)}(s.sham||h&&h.sham)&&n(p,"sham",!0),r(u,c,p,s)}}}function Rn(){if(An)return En;An=1;var e=function(){if(wn)return Fn;wn=1;var e={};return e[rt()("toStringTag")]="z",Fn="[object z]"===String(e)}(),t=fe(),n=ue(),r=rt()("toStringTag"),i=Object,s="Arguments"===n(function(){return arguments}());return En=e?n:function(e){var o,a,l;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(a=function(e,t){try{return e[t]}catch(e){}}(o=i(e),r))?a:s?n(o):"Object"===(l=n(o))&&t(o.callee)?"Arguments":l}}function jn(){if(Sn)return xn;Sn=1;var e=Rn(),t=String;return xn=function(n){if("Symbol"===e(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function zn(){if($n)return Ln;$n=1;var e=vt();return Ln=function(){var t=e(this),n="";return t.hasIndices&&(n+="d"),t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t.unicode&&(n+="u"),t.unicodeSets&&(n+="v"),t.sticky&&(n+="y"),n}}function Gn(){if(On)return In;On=1;var e=g(),t=s().RegExp,n=e((function(){var e=t("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),r=n||e((function(){return!t("a","y").sticky})),i=n||e((function(){var e=t("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));return In={BROKEN_CARET:i,MISSED_STICKY:r,UNSUPPORTED_Y:n}}var Vn,Un,Zn,qn,Kn,Wn,Xn,Yn,Qn,Jn,er,tr,nr,rr,ir={};function sr(){if(Un)return Vn;Un=1;var e=fn(),t=dn();return Vn=Object.keys||function(n){return e(n,t)}}function or(){if(Kn)return qn;Kn=1;var e=ge();return qn=e("document","documentElement")}function ar(){if(Xn)return Wn;Xn=1;var e,t=vt(),n=function(){if(Zn)return ir;Zn=1;var e=m(),t=yt(),n=Mt(),r=vt(),i=pe(),s=sr();return ir.f=e&&!t?Object.defineProperties:function(e,t){r(e);for(var o,a=i(t),l=s(t),u=l.length,c=0;u>c;)n.f(e,o=l[c++],a[o]);return e},ir}(),r=dn(),i=Rt(),s=or(),o=ot(),a=_t(),l="prototype",u="script",c=a("IE_PROTO"),h=function(){},p=function(e){return"<"+u+">"+e+"</"+u+">"},f=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},d=function(){try{e=new ActiveXObject("htmlfile")}catch(e){}var t,n,i;d="undefined"!=typeof document?document.domain&&e?f(e):(n=o("iframe"),i="java"+u+":",n.style.display="none",s.appendChild(n),n.src=String(i),(t=n.contentWindow.document).open(),t.write(p("document.F=Object")),t.close(),t.F):f(e);for(var a=r.length;a--;)delete d[l][r[a]];return d()};return i[c]=!0,Wn=Object.create||function(e,r){var i;return null!==e?(h[l]=t(e),i=new h,h[l]=null,i[c]=e):i=d(),void 0===r?i:n.f(i,r)}}function lr(){if(Qn)return Yn;Qn=1;var e=g(),t=s().RegExp;return Yn=e((function(){var e=t(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))}function ur(){if(er)return Jn;er=1;var e=g(),t=s().RegExp;return Jn=e((function(){var e=t("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))}function cr(){if(nr)return tr;nr=1;var e,t,n=v(),r=le(),i=jn(),s=zn(),o=Gn(),a=Je(),l=ar(),u=jt().get,c=lr(),h=ur(),p=a("native-string-replace",String.prototype.replace),f=RegExp.prototype.exec,d=f,g=r("".charAt),m=r("".indexOf),y=r("".replace),M=r("".slice),T=(t=/b*/g,n(f,e=/a/,"a"),n(f,t,"a"),0!==e.lastIndex||0!==t.lastIndex),k=o.BROKEN_CARET,b=void 0!==/()??/.exec("")[1];return(T||b||k||c||h)&&(d=function(e){var t,r,o,a,c,h,v,C=this,D=u(C),F=i(e),w=D.raw;if(w)return w.lastIndex=C.lastIndex,t=n(d,w,F),C.lastIndex=w.lastIndex,t;var E=D.groups,A=k&&C.sticky,x=n(s,C),S=C.source,L=0,$=F;if(A&&(x=y(x,"y",""),-1===m(x,"g")&&(x+="g"),$=M(F,C.lastIndex),C.lastIndex>0&&(!C.multiline||C.multiline&&"\n"!==g(F,C.lastIndex-1))&&(S="(?: "+S+")",$=" "+$,L++),r=new RegExp("^(?:"+S+")",x)),b&&(r=new RegExp("^"+S+"$(?!\\s)",x)),T&&(o=C.lastIndex),a=n(f,A?r:C,$),A?a?(a.input=M(a.input,L),a[0]=M(a[0],L),a.index=C.lastIndex,C.lastIndex+=a[0].length):C.lastIndex=0:T&&a&&(C.lastIndex=C.global?a.index+a[0].length:o),b&&a&&a.length>1&&n(p,a[0],r,(function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(a[c]=void 0)})),a&&E)for(a.groups=h=l(null),c=0;c<E.length;c++)h[(v=E[c])[0]]=a[v[1]];return a}),tr=d}function hr(){if(rr)return i;rr=1;var e=_n(),t=cr();return e({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),i}hr();var pr,fr,dr,gr,mr,yr,vr,Mr,Tr,kr,br,Cr,Dr,Fr,wr,Er,Ar,xr,Sr,Lr,$r,Ir,Or,Hr,Br,Pr,Nr,_r,Rr,jr,zr,Gr,Vr,Ur={};function Zr(){if(yr)return mr;yr=1;var e=rt(),t=ar(),n=Mt().f,r=e("unscopables"),i=Array.prototype;return void 0===i[r]&&n(i,r,{configurable:!0,value:t(null)}),mr=function(e){i[r][e]=!0}}function qr(){return Mr?vr:(Mr=1,vr={})}function Kr(){if(Cr)return br;Cr=1;var e=tt(),t=fe(),n=et(),r=_t(),i=function(){if(kr)return Tr;kr=1;var e=g();return Tr=!e((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))}(),s=r("IE_PROTO"),o=Object,a=o.prototype;return br=i?o.getPrototypeOf:function(r){var i=n(r);if(e(i,s))return i[s];var l=i.constructor;return t(l)&&i instanceof l?l.prototype:i instanceof o?a:null}}function Wr(){if(Fr)return Dr;Fr=1;var e,t,n,r=g(),i=fe(),s=de(),o=ar(),a=Kr(),l=Gt(),u=rt(),c=Xe(),h=u("iterator"),p=!1;return[].keys&&("next"in(n=[].keys())?(t=a(a(n)))!==Object.prototype&&(e=t):p=!0),!s(e)||r((function(){var t={};return e[h].call(t)!==t}))?e={}:c&&(e=o(e)),i(e[h])||l(e,h,(function(){return this})),Dr={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:p}}function Xr(){if(Er)return wr;Er=1;var e=Mt().f,t=tt(),n=rt()("toStringTag");return wr=function(r,i,s){r&&!s&&(r=r.prototype),r&&!t(r,n)&&e(r,n,{configurable:!0,value:i})}}function Yr(){if(Ir)return $r;Ir=1;var e=de();return $r=function(t){return e(t)||null===t}}function Qr(){if(Hr)return Or;Hr=1;var e=Yr(),t=String,n=TypeError;return Or=function(r){if(e(r))return r;throw new n("Can't set "+t(r)+" as a prototype")}}function Jr(){if(Pr)return Br;Pr=1;var e=function(){if(Lr)return Sr;Lr=1;var e=le(),t=be();return Sr=function(n,r,i){try{return e(t(Object.getOwnPropertyDescriptor(n,r)[i]))}catch(e){}}}(),t=de(),n=he(),r=Qr();return Br=Object.setPrototypeOf||("__proto__"in{}?function(){var i,s=!1,o={};try{(i=e(Object.prototype,"__proto__","set"))(o,[]),s=o instanceof Array}catch(e){}return function(e,o){return n(e),r(o),t(e)?(s?i(e,o):e.__proto__=o,e):e}}():void 0)}function ei(){if(_r)return Nr;_r=1;var e=_n(),t=v(),n=Xe(),r=Pt(),i=fe(),s=function(){if(xr)return Ar;xr=1;var e=Wr().IteratorPrototype,t=ar(),n=ae(),r=Xr(),i=qr(),s=function(){return this};return Ar=function(o,a,l,u){var c=a+" Iterator";return o.prototype=t(e,{next:n(+!u,l)}),r(o,c,!1,!0),i[c]=s,o}}(),o=Kr(),a=Jr(),l=Xr(),u=Tt(),c=Gt(),h=rt(),p=qr(),f=Wr(),d=r.PROPER,g=r.CONFIGURABLE,m=f.IteratorPrototype,y=f.BUGGY_SAFARI_ITERATORS,M=h("iterator"),T="keys",k="values",b="entries",C=function(){return this};return Nr=function(r,h,f,v,D,F,w){s(f,h,v);var E,A,x,S=function(e){if(e===D&&H)return H;if(!y&&e&&e in I)return I[e];switch(e){case T:case k:case b:return function(){return new f(this,e)}}return function(){return new f(this)}},L=h+" Iterator",$=!1,I=r.prototype,O=I[M]||I["@@iterator"]||D&&I[D],H=!y&&O||S(D),B="Array"===h&&I.entries||O;if(B&&(E=o(B.call(new r)))!==Object.prototype&&E.next&&(n||o(E)===m||(a?a(E,m):i(E[M])||c(E,M,C)),l(E,L,!0,!0),n&&(p[L]=C)),d&&D===k&&O&&O.name!==k&&(!n&&g?u(I,"name",k):($=!0,H=function(){return t(O,this)})),D)if(A={values:S(k),keys:F?H:S(T),entries:S(b)},w)for(x in A)(y||$||!(x in I))&&c(I,x,A[x]);else e({target:h,proto:!0,forced:y||$},A);return n&&!w||I[M]===H||c(I,M,H,{name:D}),p[h]=H,A}}function ti(){return jr?Rr:(jr=1,Rr=function(e,t){return{value:e,done:t}})}!function(){if(Vr)return Ur;Vr=1;var e=s(),t=fr?pr:(fr=1,pr={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}),n=function(){if(gr)return dr;gr=1;var e=ot()("span").classList,t=e&&e.constructor&&e.constructor.prototype;return dr=t===Object.prototype?void 0:t}(),r=function(){if(Gr)return zr;Gr=1;var e=pe(),t=Zr(),n=qr(),r=jt(),i=Mt().f,s=ei(),o=ti(),a=Xe(),l=m(),u="Array Iterator",c=r.set,h=r.getterFor(u);zr=s(Array,"Array",(function(t,n){c(this,{type:u,target:e(t),index:0,kind:n})}),(function(){var e=h(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,o(void 0,!0);switch(e.kind){case"keys":return o(n,!1);case"values":return o(t[n],!1)}return o([n,t[n]],!1)}),"values");var p=n.Arguments=n.Array;if(t("keys"),t("values"),t("entries"),!a&&l&&"values"!==p.name)try{i(p,"name",{value:"values"})}catch(e){}return zr}(),i=Tt(),o=Xr(),a=rt()("iterator"),l=r.values,u=function(e,n){if(e){if(e[a]!==l)try{i(e,a,l)}catch(t){e[a]=l}if(o(e,n,!0),t[n])for(var s in r)if(e[s]!==r[s])try{i(e,s,r[s])}catch(t){e[s]=r[s]}}};for(var c in t)u(e[c]&&e[c].prototype,c);u(n,"DOMTokenList")}();const ni='<svg height="18" width="18"><rect width="5" height="5" x="3" y="4" ry="1"/><rect ry="1" y="4" x="10" height="5" width="5"/><path d="M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z"/></svg>',ri='<svg height="18" width="18"><path d="M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z"/></svg>',ii='<svg height="18" width="18"><path d="M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z"/></svg>',si='<svg height="18" width="18"><path d="M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z"/></svg>',oi='<svg height="18" width="18"><path d="M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z"/></svg>',ai='<svg height="18" width="18"><rect ry="1" y="8" height="2" width="18"/></svg>',li='<svg height="18" width="18"><path d="M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z"/><circle r="1.5" cy="6.5" cx="5.5"/></svg>',ui='<svg height="18" width="18"><path d="M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z"/></svg>',ci='<svg height="18" width="18"><path d="M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z"/><path d="M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z"/></svg>',hi='<svg height="18" width="18"><path d="M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z"/><path d="M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z"/><rect y="13" x="6" height="2" width="12" ry="1"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="3" x="6" height="2" width="12" ry="1"/><path d="M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z"/></svg>',pi='<svg height="18" width="18"><path d="M 7.2695308,2.7050781 C 8.1128755,2.7081581 8.9529895,2.8712156 9.730469,3.1347656 11.408874,3.7037121 12.90142,4.6847104 14,5.6367188 V 4 h 2 V 9 H 11 V 7 h 1.509765 C 11.59075,6.2485173 10.340208,5.453808 9.0878904,5.0292969 7.4309398,4.4676231 5.9453458,4.468717 4.7070308,5.7070312 c -1.225014,1.2250142 -1.409769,2.7206953 -0.779297,4.2968748 0.630472,1.57618 2.167475,3.158006 4.4433598,4.06836 l -0.7421878,1.855468 c -2.724115,-1.089646 -4.687112,-3.00782 -5.55664,-5.18164 -0.869528,-2.1738206 -0.554283,-4.6781393 1.220703,-6.4531252 0.923857,-0.9238568 2.015388,-1.388828 3.134765,-1.5351563 0.279845,-0.036582 0.560682,-0.053761 0.841797,-0.052734 z" /></svg>',fi='<svg width="18" height="18"><path d="M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z"/><rect ry="1" y="8" x="1" height="2" width="16"/></svg>',di='<svg\n height="18"\n width="18"\n>\n <path\n d="M 2.3339844,1 C 1.6039663,1 1,1.6039663 1,2.3339844 V 5.6660156 C 1,6.3960337 1.6039663,7 2.3339844,7 H 5.6660156 C 6.3960337,7 7,6.3960337 7,5.6660156 V 2.3339844 C 7,1.6039663 6.3960337,1 5.6660156,1 Z m 0,1 H 5.6660156 C 5.8593309,2 6,2.1406691 6,2.3339844 V 5.6660156 C 6,5.8593309 5.8593309,6 5.6660156,6 H 2.3339844 C 2.1406691,6 2,5.8593309 2,5.6660156 V 2.3339844 C 2,2.1406691 2.1406691,2 2.3339844,2 Z"\n />\n <path\n d="M 2.3339844,11 C 1.6039663,11 1,11.603966 1,12.333984 v 3.332032 C 1,16.396034 1.6039663,17 2.3339844,17 H 5.6660156 C 6.3960337,17 7,16.396034 7,15.666016 V 12.333984 C 7,11.603966 6.3960337,11 5.6660156,11 Z m 0,1 H 5.6660156 C 5.8593309,12 6,12.140669 6,12.333984 v 3.332032 C 6,15.859331 5.8593309,16 5.6660156,16 H 2.3339844 C 2.1406691,16 2,15.859331 2,15.666016 V 12.333984 C 2,12.140669 2.1406691,12 2.3339844,12 Z"\n />\n <path\n d="m 10,3 h 7 c 0.554,0 1,0.446 1,1 0,0.554 -0.446,1 -1,1 H 10 C 9.446,5 9,4.554 9,4 9,3.446 9.446,3 10,3 Z" />\n <path\n d="m 10,13 h 7 c 0.554,0 1,0.446 1,1 0,0.554 -0.446,1 -1,1 H 10 C 9.446,15 9,14.554 9,14 9,13.446 9.446,13 10,13 Z" />\n <path\n d="M 4.8417969,2.5253906 A 0.5,0.5 0 0 0 4.5527344,2.7773438 L 3.8632813,4.15625 3.3535156,3.6464844 a 0.5,0.5 0 0 0 -0.7070312,0 0.5,0.5 0 0 0 0,0.7070312 l 1,1 A 0.50005,0.50005 0 0 0 4.4472656,5.2226562 l 1,-1.9999999 A 0.5,0.5 0 0 0 5.2226562,2.5527344 0.5,0.5 0 0 0 4.8417969,2.5253906 Z"\n />\n</svg>',gi='<svg height="18" width="18"><circle cx="2" cy="9" r="2"/><circle cy="4" cx="2" r="2"/><rect y="3" x="6" height="2" width="12" ry="1"/><circle cx="2" cy="14" r="2"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="13" x="6" height="2" width="12" ry="1"/></svg>',mi='<svg height="18" width="18"><path d="M 10.730469 2.7050781 C 9.8871243 2.7081594 9.0470103 2.8712156 8.2695312 3.1347656 C 6.5911256 3.7037121 5.0985797 4.6847104 4 5.6367188 L 4 4 L 2 4 L 2 9 L 7 9 L 7 7 L 5.4902344 7 C 6.4092499 6.2485173 7.6597914 5.453808 8.9121094 5.0292969 C 10.56906 4.4676231 12.054654 4.468717 13.292969 5.7070312 C 14.517983 6.9320454 14.702738 8.4277265 14.072266 10.003906 C 13.441794 11.580086 11.904791 13.161912 9.6289062 14.072266 L 10.371094 15.927734 C 13.095209 14.838088 15.058206 12.919914 15.927734 10.746094 C 16.797262 8.5722734 16.482017 6.0679547 14.707031 4.2929688 C 13.783174 3.369112 12.691643 2.9041408 11.572266 2.7578125 C 11.292421 2.7212304 11.011584 2.704051 10.730469 2.7050781 z " /></svg>\n',yi=/(Mac|iPhone|iPod|iPad)/i.test("undefined"!=typeof navigator?navigator.platform:""),vi={bold:{name:"bold",action:"bold",innerHTML:ri,title:"Bold",hotkey:"Mod-B"},italic:{name:"italic",action:"italic",innerHTML:ui,title:"Italic",hotkey:"Mod-I"},strikethrough:{name:"strikethrough",action:"strikethrough",innerHTML:fi,title:"Strikethrough",hotkey:"Mod2-Shift-5"},code:{name:"code",action:"code",innerHTML:ii,title:"Format as code"},h1:{name:"h1",action:"h1",innerHTML:si,title:"Level 1 heading",hotkey:"Mod-Shift-1"},h2:{name:"h2",action:"h2",innerHTML:oi,title:"Level 2 heading",hotkey:"Mod-Shift-2"},ul:{name:"ul",action:"ul",innerHTML:gi,title:"Bulleted list"},ol:{name:"ol",action:"ol",innerHTML:hi,title:"Numbered list"},blockquote:{name:"blockquote",action:"blockquote",innerHTML:ni,title:"Quote",hotkey:"Mod2-Shift-Q"},tasklist:{name:"tasklist",action:e=>e.toggleTaskList(),enabled:(e,t)=>t?e.isTaskListItem(t.row):null,innerHTML:di,title:"Task list",hotkey:"Mod2-Shift-T"},insertLink:{name:"insertLink",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:e=>!e.isInlineFormattingAllowed()&&null,innerHTML:ci,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:e=>!e.isInlineFormattingAllowed()&&null,innerHTML:li,title:"Insert image",hotkey:"Mod2-Shift-I"},hr:{name:"hr",action:e=>e.paste("\n***\n"),enabled:()=>!1,innerHTML:ai,title:"Insert horizontal line",hotkey:"Mod2-Shift-L"},undo:{name:"undo",action:e=>e.undo(),enabled:e=>!e.canUndo&&null,innerHTML:mi,title:"Undo"},redo:{name:"redo",action:e=>e.redo(),enabled:e=>!e.canRedo&&null,innerHTML:pi,title:"Redo"}};var Mi,Ti,ki,bi,Ci,Di,Fi,wi,Ei,Ai,xi,Si,Li,$i={};function Ii(){if(wi)return Fi;wi=1;var e=function(){if(Di)return Ci;Di=1;var e=le(),t=un(),n=jn(),r=he(),i=e("".charAt),s=e("".charCodeAt),o=e("".slice),a=function(e){return function(a,l){var u,c,h=n(r(a)),p=t(l),f=h.length;return p<0||p>=f?e?"":void 0:(u=s(h,p))<55296||u>56319||p+1===f||(c=s(h,p+1))<56320||c>57343?e?i(h,p):u:e?o(h,p,p+2):c-56320+(u-55296<<10)+65536}};return Ci={codeAt:a(!1),charAt:a(!0)}}().charAt;return Fi=function(t,n,r){return n+(r?e(t,n).length:1)}}function Oi(){if(Ai)return Ei;Ai=1;var e=le(),t=et(),n=Math.floor,r=e("".charAt),i=e("".replace),s=e("".slice),o=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,a=/\$([$&'`]|\d{1,2})/g;return Ei=function(e,l,u,c,h,p){var f=u+e.length,d=c.length,g=a;return void 0!==h&&(h=t(h),g=o),i(p,g,(function(t,i){var o;switch(r(i,0)){case"$":return"$";case"&":return e;case"`":return s(l,0,u);case"'":return s(l,f);case"<":o=h[s(i,1,-1)];break;default:var a=+i;if(0===a)return t;if(a>d){var p=n(a/10);return 0===p?t:p<=d?void 0===c[p-1]?r(i,1):c[p-1]+r(i,1):t}o=c[a-1]}return void 0===o?"":o}))}}!function(){if(Li)return $i;Li=1;var e=function(){if(Ti)return Mi;Ti=1;var e=y(),t=Function.prototype,n=t.apply,r=t.call;return Mi="object"==typeof Reflect&&Reflect.apply||(e?r.bind(n):function(){return r.apply(n,arguments)}),Mi}(),t=v(),n=le(),r=function(){if(bi)return ki;bi=1,hr();var e=v(),t=Gt(),n=cr(),r=g(),i=rt(),s=Tt(),o=i("species"),a=RegExp.prototype;return ki=function(l,u,c,h){var p=i(l),f=!r((function(){var e={};return e[p]=function(){return 7},7!==""[l](e)})),d=f&&!r((function(){var e=!1,t=/a/;return"split"===l&&((t={}).constructor={},t.constructor[o]=function(){return t},t.flags="",t[p]=/./[p]),t.exec=function(){return e=!0,null},t[p](""),!e}));if(!f||!d||c){var g=/./[p],m=u(p,""[l],(function(t,r,i,s,o){var l=r.exec;return l===n||l===a.exec?f&&!o?{done:!0,value:e(g,r,i,s)}:{done:!0,value:e(t,i,r,s)}:{done:!1}}));t(String.prototype,l,m[0]),t(a,p,m[1])}h&&s(a[p],"sham",!0)}}(),i=g(),s=vt(),o=fe(),a=de(),l=un(),u=hn(),c=jn(),h=he(),p=Ii(),f=Ce(),d=Oi(),m=function(){if(Si)return xi;Si=1;var e=v(),t=vt(),n=fe(),r=ue(),i=cr(),s=TypeError;return xi=function(o,a){var l=o.exec;if(n(l)){var u=e(l,o,a);return null!==u&&t(u),u}if("RegExp"===r(o))return e(i,o,a);throw new s("RegExp#exec called on incompatible receiver")}}(),M=rt()("replace"),T=Math.max,k=Math.min,b=n([].concat),C=n([].push),D=n("".indexOf),F=n("".slice),w="$0"==="a".replace(/./,"$0"),E=!!/./[M]&&""===/./[M]("a","$0");r("replace",(function(n,r,i){var g=E?"$":"$0";return[function(e,n){var i=h(this),s=a(e)?f(e,M):void 0;return s?t(s,e,i,n):t(r,c(i),e,n)},function(t,n){var a=s(this),h=c(t);if("string"==typeof n&&-1===D(n,g)&&-1===D(n,"$<")){var f=i(r,a,h,n);if(f.done)return f.value}var y=o(n);y||(n=c(n));var v,M=a.global;M&&(v=a.unicode,a.lastIndex=0);for(var w,E=[];null!==(w=m(a,h))&&(C(E,w),M);){""===c(w[0])&&(a.lastIndex=p(h,u(a.lastIndex),v))}for(var A,x="",S=0,L=0;L<E.length;L++){for(var $,I=c((w=E[L])[0]),O=T(k(l(w.index),h.length),0),H=[],B=1;B<w.length;B++)C(H,void 0===(A=w[B])?A:String(A));var P=w.groups;if(y){var N=b([I],H,O,h);void 0!==P&&C(N,P),$=c(e(n,void 0,N))}else $=d(I,h,O,H,P,n);O>=S&&(x+=F(h,S,O)+$,S=O+I.length)}return x+F(h,S)}]}),!!i((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!w||E)}();var Hi,Bi,Pi,Ni,_i,Ri,ji,zi={};function Gi(){return Bi?Hi:(Bi=1,Hi="\t\n\v\f\r \u2028\u2029\ufeff")}function Vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ui(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zi(Object(n),!0).forEach((function(t){Ui(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ki(e,t){return Ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ki(e,t)}function Wi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xi(){Xi=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,i){var s=RegExp(e,r);return t.set(s,i||t.get(e)),Ki(s,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce((function(t,n){var i=r[n];if("number"==typeof i)t[n]=e[i];else{for(var s=0;void 0===e[i[s]]&&s+1<i.length;)s++;t[n]=e[i[s]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ki(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var i=n.indices;i&&(i.groups=r(i,this))}return n},n.prototype[Symbol.replace]=function(n,i){if("string"==typeof i){var s=t.get(this);return e[Symbol.replace].call(this,n,i.replace(/\$<([^>]+)(>|$)/g,(function(e,t,n){if(""===n)return e;var r=s[t];return Array.isArray(r)?"$"+r.join("$"):"number"==typeof r?"$"+r:""})))}if("function"==typeof i){var o=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(r(e,o)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},Xi.apply(this,arguments)}!function(){if(ji)return zi;ji=1;var e=_n(),t=function(){if(Ni)return Pi;Ni=1;var e=le(),t=he(),n=jn(),r=Gi(),i=e("".replace),s=RegExp("^["+r+"]+"),o=RegExp("(^|[^"+r+"])["+r+"]+$"),a=function(e){return function(r){var a=n(t(r));return 1&e&&(a=i(a,s,"")),2&e&&(a=i(a,o,"$1")),a}};return Pi={start:a(1),end:a(2),trim:a(3)}}().trim,n=function(){if(Ri)return _i;Ri=1;var e=Pt().PROPER,t=g(),n=Gi();return _i=function(r){return t((function(){return!!n[r]()||"
"!=="
"[r]()||e&&n[r].name!==r}))}}();e({target:"String",proto:!0,forced:n("trim")},{trim:function(){return t(this)}})}();var Yi,Qi,Ji,es,ts,ns,rs,is,ss,os,as,ls,us,cs={};function hs(){if(Qi)return Yi;Qi=1;var e=fe(),t=de(),n=Jr();return Yi=function(r,i,s){var o,a;return n&&e(o=i.constructor)&&o!==s&&t(a=o.prototype)&&a!==s.prototype&&n(r,a),r}}function ps(){if(is)return rs;is=1;var e=Mt().f;return rs=function(t,n,r){r in t||e(t,r,{configurable:!0,get:function(){return n[r]},set:function(e){n[r]=e}})}}function fs(){if(os)return ss;os=1;var e=zt(),t=Mt();return ss=function(n,r,i){return i.get&&e(i.get,r,{getter:!0}),i.set&&e(i.set,r,{setter:!0}),t.f(n,r,i)}}function ds(){if(ls)return as;ls=1;var e=ge(),t=fs(),n=rt(),r=m(),i=n("species");return as=function(n){var s=e(n);r&&s&&!s[i]&&t(s,i,{configurable:!0,get:function(){return this}})}}!function(){if(us)return cs;us=1;var e=m(),t=s(),n=le(),r=Nn(),i=hs(),o=Tt(),a=ar(),l=gn().f,u=me(),c=function(){if(es)return Ji;es=1;var e=de(),t=ue(),n=rt()("match");return Ji=function(r){var i;return e(r)&&(void 0!==(i=r[n])?!!i:"RegExp"===t(r))}}(),h=jn(),p=function(){if(ns)return ts;ns=1;var e=v(),t=tt(),n=me(),r=zn(),i=RegExp.prototype;return ts=function(s){var o=s.flags;return void 0!==o||"flags"in i||t(s,"flags")||!n(i,s)?o:e(r,s)}}(),f=Gn(),d=ps(),y=Gt(),M=g(),T=tt(),k=jt().enforce,b=ds(),C=rt(),D=lr(),F=ur(),w=C("match"),E=t.RegExp,A=E.prototype,x=t.SyntaxError,S=n(A.exec),L=n("".charAt),$=n("".replace),I=n("".indexOf),O=n("".slice),H=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,B=/a/g,P=/a/g,N=new E(B)!==B,_=f.MISSED_STICKY,R=f.UNSUPPORTED_Y,j=e&&(!N||_||D||F||M((function(){return P[w]=!1,E(B)!==B||E(P)===P||"/a/i"!==String(E(B,"i"))})));if(r("RegExp",j)){for(var z=function(e,t){var n,r,s,l,f,d,g=u(A,this),m=c(e),y=void 0===t,v=[],M=e;if(!g&&m&&y&&e.constructor===z)return e;if((m||u(A,e))&&(e=e.source,y&&(t=p(M))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),M=e,D&&"dotAll"in B&&(r=!!t&&I(t,"s")>-1)&&(t=$(t,/s/g,"")),n=t,_&&"sticky"in B&&(s=!!t&&I(t,"y")>-1)&&R&&(t=$(t,/y/g,"")),F&&(l=function(e){for(var t,n=e.length,r=0,i="",s=[],o=a(null),l=!1,u=!1,c=0,h="";r<=n;r++){if("\\"===(t=L(e,r)))t+=L(e,++r);else if("]"===t)l=!1;else if(!l)switch(!0){case"["===t:l=!0;break;case"("===t:if(i+=t,"?:"===O(e,r+1,r+3))continue;S(H,O(e,r+1))&&(r+=2,u=!0),c++;continue;case">"===t&&u:if(""===h||T(o,h))throw new x("Invalid capture group name");o[h]=!0,s[s.length]=[h,c],u=!1,h="";continue}u?h+=t:i+=t}return[i,s]}(e),e=l[0],v=l[1]),f=i(E(e,t),g?this:A,z),(r||s||v.length)&&(d=k(f),r&&(d.dotAll=!0,d.raw=z(function(e){for(var t,n=e.length,r=0,i="",s=!1;r<=n;r++)"\\"!==(t=L(e,r))?s||"."!==t?("["===t?s=!0:"]"===t&&(s=!1),i+=t):i+="[\\s\\S]":i+=t+L(e,++r);return i}(e),n)),s&&(d.sticky=!0),v.length&&(d.groups=v)),e!==M)try{o(f,"source",""===M?"(?:)":M)}catch(e){}return f},G=l(E),V=0;G.length>V;)d(z,E,G[V++]);A.constructor=z,z.prototype=A,y(t,"RegExp",z,{constructor:!0})}b("RegExp")}();var gs,ms={};!function(){if(gs)return ms;gs=1;var e=s(),t=m(),n=fs(),r=zn(),i=g(),o=e.RegExp,a=o.prototype;t&&i((function(){var e=!0;try{o(".","d")}catch(t){e=!1}var t={},n="",r=e?"dgimsy":"gimsy",i=function(e,r){Object.defineProperty(t,e,{get:function(){return n+=r,!0}})},s={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var l in e&&(s.hasIndices="d"),s)i(l,s[l]);return Object.getOwnPropertyDescriptor(a,"flags").get.call(t)!==r||n!==r}))&&n(a,"flags",{configurable:!0,get:r})}();const ys={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~\n]/,Scheme:/[A-Za-z][A-Za-z0-9+.-]{1,31}/,Email:/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/,HTMLOpenTag:/<HTMLTagName(?:HTMLAttribute)*\s*\/?>/,HTMLCloseTag:/<\/HTMLTagName\s*>/,HTMLTagName:/[A-Za-z][A-Za-z0-9-]*/,HTMLComment:/<!--(?:[^>-]|(?:[^>-](?:[^-]|-[^-])*[^-]))-->/,HTMLPI:/<\?(?:|.|(?:[^?]|\?[^>])*)\?>/,HTMLDeclaration:/<![A-Z]+\s[^>]*>/,HTMLCDATA:/<!\[CDATA\[.*?\]\]>/,HTMLAttribute:/\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,HTMLAttValue:/\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,KnownTag:/address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/},vs=new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/),Ms=new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/),Ts={macPlatform:/Mac|iPod|iPhone|iPad/,lineSplit:/(?:\r\n|\r|\n)/,replacementPlaceholder:/(\${1,2})([0-9])/g,inlineContentPlaceholder:/\$\$([0-9])/,inlineReplacementPlaceholder:/\$([1-9])/g,blankContent:/^\s*$/,leadingWhitespace:/^\s/,trailingWhitespace:/\s$/,leadingWhitespaceRun:/^\s+/,surroundingWhitespace:Xi(/^(\s*).*\S(\s*)$/,{leading:1,trailing:2}),taskListItem:/^(\[)([ xX])(\])(\s|$)([\s\S]*)$/,orderedListNumber:/\d{1,9}/,inlineTagName:/^<\s*([a-zA-Z][a-zA-Z0-9]*)/,changeEvent:/^(?:change|input)$/i,selectionEvent:/^(?:selection|selectionchange)$/i,dropEvent:/^(?:drop)$/i,autolinkPrecedingChar:/[\s*_~(]/,emphasisDelimiter:/(^\*+)|(^_+)/,strikethroughDelimiter:/^~~/,autolinkScheme:/^(?:https?|ftp):\/\//i,autolinkWww:/^www\./i,autolinkDomain:/^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/,autolinkPath:/^[^\s<]*/,autolinkProtocol:/^(?:mailto|xmpp):/i,autolinkXmpp:/^xmpp:/i,autolinkXmppResource:/^\/[a-zA-Z0-9@.\-_]+/,autolinkEmail:/^[a-zA-Z0-9.\-_+]+@[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/,emailTrailingChar:/[-_]$/,emailTld:/\.[a-zA-Z0-9]+$/,linkClosingBracket:/^\]/,openingAngle:/^</,closingAngle:/^>/,titleQuote:/^["']/,openingParen:/^\(/,closingParen:/^\)/,endsWithOpenAngle:/<$/,containsOpenAngle:/</,anyChar:/^./},ks={TMH1:{regexp:/^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'},TMH2:{regexp:/^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH2">$1</span>$$2<span class="TMMark TMMark_TMH2">$3</span>'},TMH3:{regexp:/^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH3">$1</span>$$2<span class="TMMark TMMark_TMH3">$3</span>'},TMH4:{regexp:/^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH4">$1</span>$$2<span class="TMMark TMMark_TMH4">$3</span>'},TMH5:{regexp:/^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH5">$1</span>$$2<span class="TMMark TMMark_TMH5">$3</span>'},TMH6:{regexp:/^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH6">$1</span>$$2<span class="TMMark TMMark_TMH6">$3</span>'},TMBlockquote:{regexp:/^( {0,3}>[ ]?)(.*)$/,replacement:'<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'},TMCodeFenceBacktickOpen:{regexp:Xi(/^( {0,3}(````*)\s*)([^`]*?)(\s*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceTildeOpen:{regexp:Xi(/^( {0,3}(~~~~*)\s*)(.*?)(\s*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceBacktickClose:{regexp:Xi(/^( {0,3}(````*))(\s*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'},TMCodeFenceTildeClose:{regexp:Xi(/^( {0,3}(~~~~*))(\s*)$/,{seq:2}),replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'},TMBlankLine:{regexp:/^([ \t]*)$/,replacement:"$0"},TMSetextH1Marker:{regexp:/^ {0,3}=+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMSetextH2Marker:{regexp:/^ {0,3}-+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMHR:{regexp:/^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/,replacement:'<span class="TMMark TMMark_TMHR">$0</span>'},TMUL:{regexp:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMUL">$1</span>$$2'},TMOL:{regexp:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMOL">$1</span>$$2'},TMIndentedCode:{regexp:/^( {4}|\t)(.*)$/,replacement:'<span class="TMMark TMMark_TMIndentedCode">$1</span>$2'},TMLinkReferenceDefinition:{regexp:/^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,replacement:'<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',labelPlaceholder:2}},bs=[{start:/^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i,end:/(?:<\/script>|<\/pre>|<\/style>)/i,paraInterrupt:!0},{start:/^ {0,3}<!--/,end:/-->/,paraInterrupt:!0},{start:/^ {0,3}<\?/,end:/\?>/,paraInterrupt:!0},{start:/^ {0,3}<![A-Z]/,end:/>/,paraInterrupt:!0},{start:/^ {0,3}<!\[CDATA\[/,end:/\]\]>/,paraInterrupt:!0},{start:/^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i,end:!1,paraInterrupt:!0},{start:/^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/,end:!1,paraInterrupt:!1}],Cs={escape:{regexp:/^\\(ASCIIPunctuation)/,replacement:'<span class="TMMark TMMark_TMEscape">\\</span>$1'},code:{regexp:/^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/,replacement:'<span class="TMMark TMMark_TMCode">$1</span><code class="TMCode">$2</code><span class="TMMark TMMark_TMCode">$3</span>'},autolink:{regexp:/^<((?:Scheme:[^\s<>]*)|(?:Email))>/,replacement:'<span class="TMMark TMMark_TMAutolink"><</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">></span>'},html:{regexp:/^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/,replacement:'<span class="TMHTML">$1</span>'},linkOpen:{regexp:/^\[/,replacement:""},imageOpen:{regexp:/^!\[/,replacement:""},linkLabel:{regexp:/^(\[\s*)([^\]]*?)(\s*\])/,replacement:"",labelPlaceholder:2},default:{regexp:/^(.|(?:NotTriggerChar+))/,replacement:"$1"}},Ds=new RegExp(Object.keys(ys).join("|")),Fs=[...Object.keys(Cs)];for(let e of Fs){let t=Cs[e].regexp.source;for(;t.match(Ds);)t=t.replace(Ds,(e=>ys[e].source));Cs[e].regexp=new RegExp(t,Cs[e].regexp.flags)}for(let e of bs){let t=e.start.source;for(;t.match(Ds);)t=t.replace(Ds,(e=>ys[e].source));e.start=new RegExp(t,e.start.flags)}function ws(e){return(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const Es={bold:{type:"inline",className:"TMStrong",set:{pre:"**",post:"**"},unset:{prePattern:/(?:\*\*|__)$/,postPattern:/^(?:\*\*|__)/}},italic:{type:"inline",className:"TMEm",set:{pre:"*",post:"*"},unset:{prePattern:/(?:\*|_)$/,postPattern:/^(?:\*|_)/}},code:{type:"inline",className:"TMCode",set:{pre:"`",post:"`"},unset:{prePattern:/`+$/,postPattern:/^`+/}},strikethrough:{type:"inline",className:"TMStrikethrough",set:{pre:"~~",post:"~~"},unset:{prePattern:/~~$/,postPattern:/^~~/}},h1:{type:"line",className:"TMH1",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"# $2"},unset:{pattern:/^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h2:{type:"line",className:"TMH2",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"## $2"},unset:{pattern:/^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h3:{type:"line",className:"TMH3",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"### $2"},unset:{pattern:/^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h4:{type:"line",className:"TMH4",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"#### $2"},unset:{pattern:/^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h5:{type:"line",className:"TMH5",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"##### $2"},unset:{pattern:/^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h6:{type:"line",className:"TMH6",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"###### $2"},unset:{pattern:/^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},ul:{type:"line",className:"TMUL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"- $2"},unset:{pattern:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:"$2"}},ol:{type:"line",className:"TMOL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"$#. $2"},unset:{pattern:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:"$2"}},blockquote:{type:"line",className:"TMBlockquote",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"> $2"},unset:{pattern:/^( {0,3}>[ ]?)(.*)$/,replacement:"$2"}}};e.CommandBar=class{constructor(e){this.e=null,this.editor=null,this.commands={},this.buttons={},this.state={},this.hotkeys=[],this.e=null,this.editor=null,this.commands={},this.buttons={},this.state={},this.hotkeys=[];let t=null;"string"==typeof e.element?t=document.getElementById(e.element):e.element&&(t=e.element),t||(t=document.body),this.createCommandBarElement(t,e.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","tasklist","|","blockquote","hr","|","undo","redo","|","insertLink","insertImage"]),document.addEventListener("keydown",(e=>this.handleKeydown(e))),e.editor&&this.setEditor(e.editor)}createCommandBarElement(e,t){this.e=document.createElement("div"),this.e.className="TMCommandBar";for(let e of t)if("|"===e){let e=document.createElement("div");e.className="TMCommandDivider",this.e.appendChild(e)}else{let t;if("string"==typeof e){if(!vi[e])continue;t=e,this.commands[t]=vi[t]}else{if("object"!=typeof e||!e.name)continue;t=e.name,this.commands[t]={},vi[t]&&Object.assign(this.commands[t],vi[t]),Object.assign(this.commands[t],e)}let n=this.commands[t].title||t;if(this.commands[t].hotkey){const e=this.commands[t].hotkey.split("-");let r=[],i=[];for(let t=0;t<e.length-1;t++)switch(e[t]){case"Ctrl":r.push("ctrlKey"),i.push("Ctrl");break;case"Cmd":r.push("metaKey"),i.push("⌘");break;case"Alt":r.push("altKey"),i.push("Alt");break;case"Option":r.push("altKey"),i.push("⌥");break;case"Win":r.push("metaKey"),i.push("⊞ Win");break;case"Shift":r.push("shiftKey"),i.push("⇧");break;case"Mod":yi?(r.push("metaKey"),i.push("⌘")):(r.push("ctrlKey"),i.push("Ctrl"));break;case"Mod2":r.push("altKey"),yi?i.push("⌥"):i.push("Alt")}i.push(e[e.length-1]);let s={modifiers:r,command:t};const o=e[e.length-1];o.match(/^[0-9]$/)?s.code="Digit".concat(o):o.match(/^[a-zA-Z]$/)?s.code="Key".concat(o.toUpperCase()):s.key=o.toLowerCase(),this.hotkeys.push(s),n=n.concat(" (".concat(i.join("+"),")"))}this.buttons[t]=document.createElement("div"),this.buttons[t].className="TMCommandButton TMCommandButton_Disabled",this.buttons[t].title=n,this.buttons[t].innerHTML=this.commands[t].innerHTML||"?",this.buttons[t].addEventListener("mousedown",(e=>this.handleClick(t,e))),this.e.appendChild(this.buttons[t])}e.appendChild(this.e)}handleClick(e,t){if(this.editor){if(t.preventDefault(),this.editor.e){const e=this.editor.e.contains(document.activeElement);this.editor.e.focus(),e||this.editor.restoreLastSelection()}"string"==typeof this.commands[e].action?!1===this.state[e]?this.editor.setCommandState(e,!0):this.editor.setCommandState(e,!1):"function"==typeof this.commands[e].action&&this.commands[e].action(this.editor)}}setEditor(e){this.editor=e,e.addEventListener("selection",(e=>this.handleSelection(e)))}handleSelection(e){if(e.commandState)for(let t in this.commands)void 0===e.commandState[t]?this.commands[t].enabled?this.state[t]=this.commands[t].enabled(this.editor,e.focus,e.anchor):this.state[t]=!e.focus&&null:this.state[t]=e.commandState[t],!0===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Active":!1===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Inactive":this.buttons[t].className="TMCommandButton TMCommandButton_Disabled"}handleKeydown(e){if(this.editor&&this.editor.e&&this.editor.e.contains(document.activeElement))e:for(let t of this.hotkeys)if(t.key&&e.key.toLowerCase()===t.key||t.code&&e.code===t.code){for(let n of t.modifiers)if(!e[n])continue e;return void this.handleClick(t.command,e)}}},e.Editor=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.customInlineGrammar={},this.mergedInlineGrammar=Cs,this.hasFocus=!0,this.lastSelection=null,this.listeners={change:[],selection:[],drop:[]},this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.hasFocus=!0,this.lastSelection=null,this.customInlineGrammar=e.customInlineGrammar||{},this.mergedInlineGrammar=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=qi({},Cs);for(const r of Object.entries(e)){var n=Wi(r,2);const e=n[0],i=n[1];{const n=qi({},i);let r=i.regexp.source;const s=new RegExp(Object.keys(ys).join("|"));for(;r.match(s);)r=r.replace(s,(e=>ys[e].source));n.regexp=new RegExp(r,i.regexp.flags),t[e]=n}}return t}(this.customInlineGrammar),this.listeners={change:[],selection:[],drop:[]};let n=null;"string"==typeof e.element?n=document.getElementById(e.element):e.element&&(n=e.element),"string"==typeof e.textarea?this.textarea=document.getElementById(e.textarea):e.textarea&&(this.textarea=e.textarea),this.textarea&&(n||(n=this.textarea)),n||(n=document.getElementsByTagName("body")[0]),n&&"TEXTAREA"===n.tagName&&(this.textarea=n,n=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.placeholder=void 0!==e.placeholder?e.placeholder:(null===(t=this.textarea)||void 0===t?void 0:t.placeholder)||void 0,this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.createEditorElement(n,e),this.setContent("string"==typeof e.content?e.content:this.textarea?this.textarea.value:"# Hello TinyMDE!\nEdit **here**"),this.e.addEventListener("keydown",(e=>this.handleUndoRedoKey(e)))}get canUndo(){return this.undoStack.length>=2}get canRedo(){return this.redoStack.length>0}pushHistory(){this.isRestoringHistory||(this.pushCurrentState(),this.redoStack=[])}pushCurrentState(){this.undoStack.push({content:this.getContent(),selection:this.getSelection(),anchor:this.getSelection(!0)}),this.undoStack.length>this.maxHistory&&this.undoStack.shift()}undo(){if(this.undoStack.length<2)return;this.isRestoringHistory=!0,this.pushCurrentState();const e=this.undoStack.pop();this.redoStack.push(e);const t=this.undoStack[this.undoStack.length-1];this.setContent(t.content),t.selection&&this.setSelection(t.selection,t.anchor),this.undoStack.pop(),this.isRestoringHistory=!1}redo(){if(!this.redoStack.length)return;this.isRestoringHistory=!0,this.pushCurrentState();const e=this.redoStack.pop();this.setContent(e.content),e.selection&&this.setSelection(e.selection,e.anchor),this.isRestoringHistory=!1}handleUndoRedoKey(e){(Ts.macPlatform.test(navigator.platform)?e.metaKey:e.ctrlKey)&&!e.altKey&&("z"===e.key||"Z"===e.key?(e.shiftKey?this.redo():this.undo(),e.preventDefault()):"y"!==e.key&&"Y"!==e.key||(this.redo(),e.preventDefault()))}createEditorElement(e,t){t&&void 0!==t.editor?"string"==typeof t.editor?this.e=document.getElementById(t.editor):this.e=t.editor:this.e=document.createElement("div"),this.e.classList.add("TinyMDE"),this.e.contentEditable="true",this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",this.placeholder&&this.e.setAttribute("data-placeholder",this.placeholder),void 0===t.editor&&(this.textarea&&this.textarea.parentNode===e&&this.textarea.nextSibling?e.insertBefore(this.e,this.textarea.nextSibling):e.appendChild(this.e)),this.e.addEventListener("input",(e=>this.handleInputEvent(e))),this.e.addEventListener("beforeinput",(e=>this.handleBeforeInputEvent(e))),this.e.addEventListener("compositionend",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>{this.hasFocus&&this.handleSelectionChangeEvent(e)})),this.e.addEventListener("blur",(()=>this.hasFocus=!1)),this.e.addEventListener("focus",(()=>this.hasFocus=!0)),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.e.addEventListener("drop",(e=>this.handleDrop(e))),this.e.addEventListener("click",(e=>this.handleClick(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(Ts.lineSplit),this.lineDirty=[];for(let e=0;e<this.lines.length;e++){let e=document.createElement("div");this.e.appendChild(e),this.lineDirty.push(!0)}this.lineTypes=new Array(this.lines.length),this.updateFormatting(),this.updatePlaceholder(),this.fireChange(),this.isRestoringHistory||this.pushHistory()}getContent(){return this.lines.join("\n")}updatePlaceholder(){this.placeholder&&this.e&&(""===this.getContent()?this.e.classList.add("TinyMDE_empty"):this.e.classList.remove("TinyMDE_empty"))}updateFormatting(){this.updateLineTypes(),this.updateLinkLabels(),this.applyLineTypes()}updateLinkLabels(){this.linkLabels=[];for(let e=0;e<this.lines.length;e++)"TMLinkReferenceDefinition"===this.lineTypes[e]&&this.linkLabels.push(this.lineCaptures[e][ks.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(Ts.replacementPlaceholder,((e,n,r)=>"$"===n?ws(t[parseInt(r)]):'<span class="TMInlineFormatted">'.concat(this.processInlineStyles(t[parseInt(r)]),"</span>")))}applyLineTypes(){let e=0;for(;e<this.lines.length;)if(this.isInlineGroupLeader(e)){const t=this.lineTypes[e];let n=e;for(;n+1<this.lines.length&&this.isInlineContinuation(n+1,t);)n++;this.applyInlineGroup(e,n),e=n+1}else this.applyLine(e),e++}isInlineGroupLeader(e){const t=this.lineTypes[e];return"TMPara"===t||"TMUL"===t||"TMOL"===t||"TMBlockquote"===t&&!this.isBlankBlockquoteContent(e)}isInlineContinuation(e,t){const n=this.lineTypes[e];return"TMPara"===n||"TMBlockquote"===n&&"TMBlockquote"===t&&!this.isBlankBlockquoteContent(e)}isBlankBlockquoteContent(e){const t=this.lineCaptures[e],n=t&&void 0!==t[2]?t[2]:"";return Ts.blankContent.test(n)}applyLine(e){const t=this.lineElements[e];if(this.lineDirty[e]){let n=this.replace(this.lineReplacements[e],this.lineCaptures[e]);t.className=this.lineTypes[e],t.removeAttribute("style"),t.innerHTML=""===n?"<br />":n,delete t.dataset.mlSig}t.dataset.lineNum=e.toString()}applyInlineGroup(e,t){const n=[];let r="".concat(t-e);for(let i=e;i<=t;i++){const e=this.inlineContentIndex(this.lineReplacements[i]);n.push(void 0!==this.lineCaptures[i][e]?this.lineCaptures[i][e]:""),r+="".concat(this.lineTypes[i],"").concat(this.lineReplacements[i],"").concat(JSON.stringify(this.lineCaptures[i]))}const i="".concat(this.hashString(r));let s=!1;for(let n=e;n<=t;n++)if(this.lineDirty[n]||this.lineElements[n].dataset.mlSig!==i){s=!0;break}if(s){const r=this.splitInlineHTMLByLine(this.processInlineStyles(n.join("\n")));for(let n=e;n<=t;n++){const t=this.lineElements[n],s=r[n-e]||"",o=this.replaceWithInline(this.lineReplacements[n],this.lineCaptures[n],s);t.className=this.lineTypes[n],t.removeAttribute("style"),t.innerHTML=""===o?"<br />":o,t.dataset.mlSig=i}}for(let n=e;n<=t;n++)this.lineElements[n].dataset.lineNum=n.toString()}inlineContentIndex(e){const t=Ts.inlineContentPlaceholder.exec(e);return t?parseInt(t[1]):0}replaceWithInline(e,t,n){return e.replace(Ts.replacementPlaceholder,((e,r,i)=>"$"===r?ws(t[parseInt(i)]):'<span class="TMInlineFormatted">'.concat(n,"</span>")))}splitInlineHTMLByLine(e){const t=[],n=[];let r="",i=0;for(;i<e.length;){const s=e[i];if("\n"===s){for(let e=n.length-1;e>=0;e--)r+="</".concat(this.inlineTagName(n[e]),">");t.push(r),r=n.join(""),i++}else if("<"===s){const t=e.indexOf(">",i);if(t<0){r+=e.substr(i);break}const s=e.substring(i,t+1);r+=s,"/"===s[1]?n.pop():"/"!==s[s.length-2]&&n.push(s),i=t+1}else r+=s,i++}return t.push(r),t}inlineTagName(e){const t=Ts.inlineTagName.exec(e);return t?t[1]:"span"}hashString(e){let t=5381;for(let n=0;n<e.length;n++)t=((t<<5)+t^e.charCodeAt(n))>>>0;return t}updateLineTypes(){let e=!1,t=0,n=!1;for(let r=0;r<this.lines.length;r++){let i="TMPara",s=[this.lines[r]],o="$$0";if("TMCodeFenceBacktickOpen"===e){let n=ks.TMCodeFenceBacktickClose.regexp.exec(this.lines[r]);n&&n.groups.seq.length>=t?(i="TMCodeFenceBacktickClose",o=ks.TMCodeFenceBacktickClose.replacement,s=n,e=!1):(i="TMFencedCodeBacktick",o='<span class="TMFencedCode">$0<br /></span>',s=[this.lines[r]])}else if("TMCodeFenceTildeOpen"===e){let n=ks.TMCodeFenceTildeClose.regexp.exec(this.lines[r]);n&&n.groups.seq.length>=t?(i="TMCodeFenceTildeClose",o=ks.TMCodeFenceTildeClose.replacement,s=n,e=!1):(i="TMFencedCodeTilde",o='<span class="TMFencedCode">$0<br /></span>',s=[this.lines[r]])}if("TMPara"===i&&!1===n)for(let e of bs)if(this.lines[r].match(e.start)&&(e.paraInterrupt||0===r||"TMPara"!==this.lineTypes[r-1]&&"TMUL"!==this.lineTypes[r-1]&&"TMOL"!==this.lineTypes[r-1]&&"TMBlockquote"!==this.lineTypes[r-1])){n=e;break}if(!1!==n&&(i="TMHTMLBlock",o='<span class="TMHTMLContent">$0<br /></span>',s=[this.lines[r]],n.end?this.lines[r].match(n.end)&&(n=!1):(r===this.lines.length-1||this.lines[r+1].match(ks.TMBlankLine.regexp))&&(n=!1)),"TMPara"===i)for(let e in ks)if(ks[e].regexp){let t=ks[e].regexp.exec(this.lines[r]);if(t){i=e,o=ks[e].replacement,s=t;break}}if("TMCodeFenceBacktickOpen"!==i&&"TMCodeFenceTildeOpen"!==i||(e=i,t=s.groups.seq.length),"TMIndentedCode"!==i&&"TMLinkReferenceDefinition"!==i||!(r>0)||"TMPara"!==this.lineTypes[r-1]&&"TMUL"!==this.lineTypes[r-1]&&"TMOL"!==this.lineTypes[r-1]&&"TMBlockquote"!==this.lineTypes[r-1]||(i="TMPara",s=[this.lines[r]],o="$$0"),"TMSetextH2Marker"===i){let e=ks.TMUL.regexp.exec(this.lines[r]);e&&(i="TMUL",o=ks.TMUL.replacement,s=e)}if("TMSetextH1Marker"===i||"TMSetextH2Marker"===i)if(0===r||"TMPara"!==this.lineTypes[r-1]){let e=ks.TMHR.regexp.exec(this.lines[r]);e?(i="TMHR",s=e,o=ks.TMHR.replacement):(i="TMPara",s=[this.lines[r]],o="$$0")}else{let e=r-1;const t="TMSetextH1Marker"===i?"TMSetextH1":"TMSetextH2";do{this.lineTypes[e]!==t&&(this.lineTypes[e]=t,this.lineDirty[e]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"===this.lineTypes[e])}if("TMUL"===i||"TMOL"===i){const e=void 0!==s[2]?s[2]:"",t=Ts.taskListItem.exec(e);if(t){const e="TMUL"===i?"TMMark_TMUL":"TMMark_TMOL",n=" "!==t[2]?"TMCheckbox TMCheckbox_checked":"TMCheckbox TMCheckbox_unchecked";s=[s[0],s[1],t[1],t[2],t[3],t[4],t[5]],o='<span class="TMMark '.concat(e,'">$1</span>')+'<span class="TMMark TMMark_TMTask">$2</span>'+'<span class="'.concat(n,'">$3</span>')+'<span class="TMMark TMMark_TMTask">$4</span><span class="TMMark TMMark_TMTask">$5</span>$$6'}}this.lineTypes[r]!==i&&(this.lineTypes[r]=i,this.lineDirty[r]=!0),this.lineReplacements[r]=o,this.lineCaptures[r]=s}}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var t,n;const r=window.getSelection();let i=e?r.anchorNode:r.focusNode;if(!i)return null;let s=e?r.anchorOffset:r.focusOffset;if(i===this.e)return s<this.lines.length?{row:s,col:0}:{row:s-1,col:this.lines[s-1].length};let o=this.computeColumn(i,s);if(null===o)return null;let a=i;for(;a.parentElement!==this.e;)a=a.parentElement;let l=0;if(a.previousSibling){const e=null===(t=a.dataset)||void 0===t?void 0:t.lineNum,r=null===(n=a.previousSibling.dataset)||void 0===n?void 0:n.lineNum;if(e&&r){const t=parseInt(e);if(t===parseInt(r)+1)l=t;else for(;a.previousSibling;)l++,a=a.previousSibling}}return{row:l,col:o}}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let n=this.computeNodeAndOffset(e.row,e.col,!!t&&(t.row===e.row&&t.col>e.col)),r=n.node,i=n.offset,s=null,o=null;if(t&&(t.row!==e.row||t.col!==e.col)){let n=this.computeNodeAndOffset(t.row,t.col,e.row===t.row&&e.col>t.col);s=n.node,o=n.offset}window.getSelection().setBaseAndExtent(r,i,s||r,s?o:i)}restoreLastSelection(){return!(!this.lastSelection||!this.lastSelection.focus)&&(this.setSelection(this.lastSelection.focus,this.lastSelection.anchor),!0)}paste(e){let t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r||(r=this.getSelection(!0)),i||(i=this.getSelection(!1)),i||(i={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),r||(r=i),r.row<i.row||r.row===i.row&&r.col<=i.col?(t=r,n=i):(t=i,n=r);let s=e.split(Ts.lineSplit),o=this.lines[t.row].substr(0,t.col),a=this.lines[n.row].substr(n.col);s[0]=o.concat(s[0]);let l=s[s.length-1].length;s[s.length-1]=s[s.length-1].concat(a),this.spliceLines(t.row,1+n.row-t.row,s),i.row=t.row+s.length-1,i.col=l,this.updateFormatting(),this.setSelection(i),this.fireChange()}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(n||(n=this.getSelection(!1)),r||(r=this.getSelection(!0)),!n||!r||n.row!==r.row)return;this.isRestoringHistory||this.pushHistory(),this.lineDirty[n.row]=!0;const i=n.col<r.col?n.col:r.col,s=n.col<r.col?r.col:n.col,o=this.lines[n.row].substr(0,i).concat(e),a=s===i?"":this.lines[n.row].substr(i,s-i),l=t.concat(this.lines[n.row].substr(s));this.lines[n.row]=o.concat(a,l),r.col=o.length,n.col=r.col+a.length,this.updateFormatting(),this.setSelection(n,r),this.fireChange()}addEventListener(e,t){e.match(Ts.changeEvent)&&this.listeners.change.push(t),e.match(Ts.selectionEvent)&&this.listeners.selection.push(t),e.match(Ts.dropEvent)&&this.listeners.drop.push(t)}fireChange(){if(this.updatePlaceholder(),!this.textarea&&!this.listeners.change.length)return;const e=this.getContent();this.textarea&&(this.textarea.value=e);for(let t of this.listeners.change)t({content:e,linesDirty:[...this.lineDirty]})}handleBeforeInputEvent(e){const t=e;if("deleteContentBackward"===t.inputType||"deleteContentForward"===t.inputType){const n=this.getSelection(),r=this.getSelection(!0);if(!n||!r)return;const i="deleteContentBackward"===t.inputType;if(n.row===r.row&&n.col===r.col){if(i&&0===n.col&&n.row>0){e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const t=this.lines[n.row-1].length;return this.lines[n.row-1]=this.lines[n.row-1]+this.lines[n.row],this.lineDirty[n.row-1]=!0,this.spliceLines(n.row,1),this.updateFormatting(),this.setSelection({row:n.row-1,col:t}),void this.fireChange()}if(!i&&n.col===this.lines[n.row].length&&n.row<this.lines.length-1){e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const t=this.lines[n.row].length;return this.lines[n.row]=this.lines[n.row]+this.lines[n.row+1],this.lineDirty[n.row]=!0,this.spliceLines(n.row+1,1),this.updateFormatting(),this.setSelection({row:n.row,col:t}),void this.fireChange()}}return}if("insertParagraph"!==t.inputType&&"insertLineBreak"!==t.inputType)return;this.isRestoringHistory||this.pushHistory(),e.preventDefault(),this.clearDirtyFlag();const n=this.getSelection(),r=this.getSelection(!0);if(n&&r){if(n.row!==r.row){const e=n.row<r.row?n:r,t=n.row<r.row?r:n;this.lines[e.row]=this.lines[e.row].substring(0,e.col),this.lines[t.row]=this.lines[t.row].substring(t.col),this.spliceLines(e.row+1,t.row-e.row-1),n.row=e.row+1,n.col=0}else{let e=!1;switch(this.lineTypes[n.row]){case"TMUL":e="TMUL";break;case"TMOL":e="TMOL";break;case"TMIndentedCode":e="TMIndentedCode"}const t=this.lines[n.row].substring(0,n.col<=r.col?n.col:r.col),i=this.lines[n.row].substring(n.col<=r.col?r.col:n.col);if(this.spliceLines(n.row,1,[t,i]),n.row+=1,n.col=0,e){let t=ks[e].regexp.exec(this.lines[n.row-1]);t&&(t[2]?("TMOL"===e&&(t[1]=t[1].replace(Ts.orderedListNumber,(e=>(parseInt(e)+1).toString()))),this.lines[n.row]="".concat(t[1]).concat(this.lines[n.row]),this.lineDirty[n.row]=!0,n.col=t[1].length):(this.lines[n.row-1]="",this.lineDirty[n.row-1]=!0))}}this.updateFormatting(),this.setSelection(n),n&&n.row<this.lineElements.length&&this.lineElements[n.row].scrollIntoView({block:"nearest",inline:"nearest"}),this.fireChange()}}handleInputEvent(e){const t=e;if("insertCompositionText"===t.inputType)return;this.isRestoringHistory||this.pushHistory();let n=this.getSelection();("insertParagraph"!==t.inputType&&"insertLineBreak"!==t.inputType||!n)&&(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting(),n&&this.setSelection(n),this.fireChange())}handleSelectionChangeEvent(e){this.fireSelection()}handlePaste(e){this.isRestoringHistory||this.pushHistory(),e.preventDefault();let t=e.clipboardData.getData("text/plain");this.paste(t)}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleClick(e){const t=e.target,n=t&&t.closest?t.closest(".TMCheckbox"):null;if(!n)return;let r=n;for(;r&&r.parentNode!==this.e;)r=r.parentNode;if(!r||void 0===r.dataset.lineNum)return;const i=parseInt(r.dataset.lineNum,10);if(isNaN(i)||i<0||i>=this.lines.length)return;const s=this.computeColumn(n,0);if(null===s)return;const o=this.lines[i].charAt(s);if(" "!==o&&"x"!==o&&"X"!==o)return;e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const a=" "===o?"x":" ";this.lines[i]=this.lines[i].substr(0,s)+a+this.lines[i].substr(s+1),this.lineDirty[i]=!0,this.updateFormatting(),this.fireChange()}processInlineStyles(e){let t="",n=[],r=0,i=e;e:for(;i;){if(10===i.charCodeAt(0)){t+="\n",i=i.substr(1),r+=1;continue e}for(let e of["escape","code","autolink","html"])if(this.mergedInlineGrammar[e]){let n=this.mergedInlineGrammar[e].regexp.exec(i);if(n){i=i.substr(n[0].length),r+=n[0].length,t+=this.mergedInlineGrammar[e].replacement.replace(Ts.inlineReplacementPlaceholder,((e,t)=>ws(n[t])));continue e}}for(let e in this.customInlineGrammar)if("escape"!==e&&"code"!==e&&"autolink"!==e&&"html"!==e&&"linkOpen"!==e&&"imageOpen"!==e&&"linkLabel"!==e&&"default"!==e){let n=this.mergedInlineGrammar[e].regexp.exec(i);if(n){i=i.substr(n[0].length),r+=n[0].length,t+=this.mergedInlineGrammar[e].replacement.replace(Ts.inlineReplacementPlaceholder,((e,t)=>ws(n[t])));continue e}}const s=r>0?e[r-1]:"";if(""===s||Ts.autolinkPrecedingChar.test(s)){let e=this.parseAutolinkExtension(i);if(e){t="".concat(t).concat(e.output),i=i.substr(e.charCount),r+=e.charCount;continue e}}let o=i.match(this.mergedInlineGrammar.linkOpen.regexp),a=i.match(this.mergedInlineGrammar.imageOpen.regexp);if(a||o){let e=this.parseLinkOrImage(i,!!a);if(e){t="".concat(t).concat(e.output),i=i.substr(e.charCount),r+=e.charCount;continue e}}let l=Ts.emphasisDelimiter.exec(i);if(l){let s=l[0].length;const o=l[0],a=l[0][0];i=i.substr(l[0].length);const u=r>0?e.substr(0,r):" ",c=r+l[0].length<e.length?i:" ",h=c.match(vs),p=u.match(Ms),f=c.match(Ts.leadingWhitespace),d=u.match(Ts.trailingWhitespace);let g=!(f||h&&!d&&!p),m=!(d||p&&!f&&!h);if("_"===a&&g&&m&&(g=!!p,m=!!h),m){let e=n.length-1;for(;s&&e>=0;)if(n[e].delimiter===a){for(;e<n.length-1;){const e=n.pop();t="".concat(e.output).concat(e.delimString.substr(0,e.count)).concat(t)}if(s>=2&&n[e].count>=2?(t='<span class="TMMark">'.concat(a).concat(a,'</span><strong class="TMStrong">').concat(t,'</strong><span class="TMMark">').concat(a).concat(a,"</span>"),s-=2,n[e].count-=2):(t='<span class="TMMark">'.concat(a,'</span><em class="TMEm">').concat(t,'</em><span class="TMMark">').concat(a,"</span>"),s-=1,n[e].count-=1),0===n[e].count){let r=n.pop();t="".concat(r.output).concat(t),e--}}else e--}s&&g&&(n.push({delimiter:a,delimString:o,count:s,output:t}),t="",s=0),s&&(t="".concat(t).concat(o.substr(0,s))),r+=l[0].length}else if(l=Ts.strikethroughDelimiter.exec(i),l){let e=!1,s=n.length-1;for(;!e&&s>=0;)if("~"===n[s].delimiter){for(;s<n.length-1;){const e=n.pop();t="".concat(e.output).concat(e.delimString.substr(0,e.count)).concat(t)}t='<span class="TMMark">~~</span><del class="TMStrikethrough">'.concat(t,'</del><span class="TMMark">~~</span>');let r=n.pop();t="".concat(r.output).concat(t),e=!0}else s--;e||(n.push({delimiter:"~",delimString:"~~",count:2,output:t}),t=""),r+=l[0].length,i=i.substr(l[0].length)}else{if(l=this.mergedInlineGrammar.default.regexp.exec(i),!l)throw"Infinite loop!";i=i.substr(l[0].length),r+=l[0].length,t+=this.mergedInlineGrammar.default.replacement.replace(Ts.inlineReplacementPlaceholder,((e,t)=>ws(l[t])))}}for(;n.length;){const e=n.pop();t="".concat(e.output).concat(e.delimString.substr(0,e.count)).concat(t)}return t}computeColumn(e,t){let n,r=e;for(;r&&r.parentNode!==this.e;)r=r.parentNode;if(null===r)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,r=e):t>0?(r=e.childNodes[t-1],n=r.textContent.length):(n=0,r=e);r.parentNode!==this.e;)r.previousSibling?(r=r.previousSibling,n+=r.textContent.length):r=r.parentNode;return n}computeNodeAndOffset(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e>=this.lineElements.length&&(e=this.lineElements.length-1,t=this.lines[e].length),t>this.lines[e].length&&(t=this.lines[e].length);const r=this.lineElements[e];let i=r.firstChild,s=!1,o={node:r.firstChild?r.firstChild:r,offset:0};for(;i!==r;){if(!s&&i.nodeType===Node.TEXT_NODE)if(i.nodeValue.length>=t){if(!n||i.nodeValue.length!==t)return{node:i,offset:t};o={node:i,offset:t},t=0}else t-=i.nodeValue.length;!s&&i.firstChild?i=i.firstChild:i.nextSibling?(s=!1,i=i.nextSibling):(s=!0,i=i.parentNode)}return o}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}clearDirtyFlag(){this.lineDirty=new Array(this.lines.length);for(let e=0;e<this.lineDirty.length;e++)this.lineDirty[e]=!1}updateLineContents(){let e=this.e.childElementCount-this.lines.length;if(e){let t=0;for(;t<=this.lines.length&&t<=this.lineElements.length&&this.lineElements[t]&&this.lines[t]===this.lineElements[t].textContent&&this.lineTypes[t]===this.lineElements[t].className;)t++;let n=-1;for(;-n<this.lines.length&&-n<this.lineElements.length&&this.lines[this.lines.length+n]===this.lineElements[this.lineElements.length+n].textContent&&this.lineTypes[this.lines.length+n]===this.lineElements[this.lineElements.length+n].className;)n--;let r=this.lines.length+n+1-t;r<-e&&(r=-e),r<0&&(r=0);let i=[];for(let n=0;n<r+e;n++)i.push(this.lineElements[t+n].textContent||"");this.spliceLines(t,r,i,!1)}else for(let e=0;e<this.lineElements.length;e++){let t=this.lineElements[e],n=t.textContent||"";this.lines[e]===n&&this.lineTypes[e]===t.className||(this.lines[e]=n,this.lineTypes[e]=t.className,this.lineDirty[e]=!0)}}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(r)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let i=[],s=[];for(let t=0;t<n.length;t++)i.push(""),s.push(!0),r&&(this.e.childNodes[e]?this.e.insertBefore(document.createElement("div"),this.e.childNodes[e]):this.e.appendChild(document.createElement("div")));this.lines.splice(e,t,...n),this.lineTypes.splice(e,t,...i),this.lineDirty.splice(e,t,...s)}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=function(e){const t=e.parentElement,n=e.nextSibling;t.removeChild(e);for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];i.forEach((e=>n?t.insertBefore(e,n):t.appendChild(e)))};e.forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE||"DIV"!==e.tagName){const n=document.createElement("div");t(e,n),n.appendChild(e)}else if(0===e.childNodes.length)e.appendChild(document.createElement("br"));else{const n=Array.from(e.childNodes);if(n.some((e=>e.nodeType===Node.ELEMENT_NODE&&"DIV"===e.tagName)))return t(e,...n)}}))}parseAutolinkExtension(e){const t=this.matchExtendedAutolink(e);return!!t&&{output:'<span class="TMAutolink">'.concat(ws(t),"</span>"),charCount:t.length}}matchExtendedAutolink(e){const t=Ts.autolinkScheme.exec(e),n=Ts.autolinkWww.test(e);if(t||n){const n=t?t[0].length:0,r=e.substr(n),i=Ts.autolinkDomain.exec(r);if(i&&this.isValidAutolinkDomain(i[0])){const t=Ts.autolinkPath.exec(r.substr(i[0].length)),s=e.substr(0,n+i[0].length+(t?t[0].length:0)),o=this.trimAutolinkTrailing(s);if(o.length>=n+i[0].length)return o}}const r=Ts.autolinkProtocol.exec(e);if(r){const t=this.matchAutolinkEmail(e.substr(r[0].length));if(t){let n="";if(Ts.autolinkXmpp.test(e)){const i=Ts.autolinkXmppResource.exec(e.substr(r[0].length+t.length));i&&(n=i[0])}return r[0]+t+n}}const i=this.matchAutolinkEmail(e);return i||!1}isValidAutolinkDomain(e){const t=e.split(".");return!(t.length<2)&&!t.slice(-2).some((e=>e.indexOf("_")>=0))}matchAutolinkEmail(e){const t=Ts.autolinkEmail.exec(e);if(!t)return!1;let n=t[0];for(;n.length&&Ts.emailTrailingChar.test(n);)n=n.substr(0,n.length-1);return!!Ts.emailTld.test(n)&&n}trimAutolinkTrailing(e){let t=e.length,n=!0;for(;n&&t>0;){n=!1;const r=e[t-1];if("?!.,:*_~".indexOf(r)>=0)t--,n=!0;else if(")"===r){let r=0,i=0;for(let n=0;n<t;n++)"("===e[n]?r++:")"===e[n]&&i++;i>r&&(t--,n=!0)}}return e.substr(0,t)}parseLinkOrImage(e,t){let n=t?2:1,r=e.substr(0,n),i=t?"TMImage":"TMLink",s=n,o=1,a=!1,l=!1,u=[],c=[];e:for(;s<e.length&&!1===a;){let r=e.substr(s);for(let e of["escape","code","autolink","html"]){let t=this.mergedInlineGrammar[e].regexp.exec(r);if(t){s+=t[0].length;continue e}}if(r.match(this.mergedInlineGrammar.imageOpen.regexp))o++,s+=2;else if(r.match(this.mergedInlineGrammar.linkOpen.regexp)){if(o++,!t&&this.parseLinkOrImage(r,!1))return!1;s+=1}else r.match(Ts.linkClosingBracket)&&(o--,0===o)?(a=e.substr(n,s-n),s++):s++}if(!1===a)return!1;let h=s<e.length?e.substr(s,1):"";if("["===h){let t=e.substr(s),n=this.mergedInlineGrammar.linkLabel.regexp.exec(t);if(!n)return!1;s+=n[0].length,u.push(n[1],n[2],n[3]),l=n[this.mergedInlineGrammar.linkLabel.labelPlaceholder]?n[this.mergedInlineGrammar.linkLabel.labelPlaceholder]:a.trim()}else if("("!==h)l=a.trim();else{s++;let t=1;for(;s<e.length&&t>0;){let n=e.substr(s),r=Ts.leadingWhitespaceRun.exec(n);if(r){switch(c.length){case 0:case 1:c.push(r[0]);break;case 2:if(c[0].match(Ts.containsOpenAngle))c[1]=c[1].concat(r[0]);else{if(1!==t)return!1;c.push(""),c.push(r[0])}break;case 3:c.push(r[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(r[0]);break;case 7:c[6]=c[6].concat(r[0]);break;default:return!1}s+=r[0].length}else if(r=this.mergedInlineGrammar.escape.regexp.exec(n),r){switch(c.length){case 0:c.push("");case 1:c.push(r[0]);break;case 2:c[1]=c[1].concat(r[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(r[0]);break;default:return!1}s+=r[0].length}else if(c.length<2&&n.match(Ts.openingAngle))0===c.length&&c.push(""),c[0]=c[0].concat("<"),s++;else if(1!==c.length&&2!==c.length||!n.match(Ts.closingAngle))if(r=Ts.titleQuote.exec(n),!r||0!==c.length&&1!==c.length&&4!==c.length)if(!r||5!==c.length&&6!==c.length||c[4]!==r[0])if(n.match(Ts.openingParen)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(Ts.endsWithOpenAngle)||t++;break;case 3:c.push("");case 4:c.push("(");break;case 5:c.push("");case 6:if("("===c[4])return!1;c[5]=c[5].concat("(");break;default:return!1}s++}else if(n.match(Ts.closingParen)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(Ts.endsWithOpenAngle)||t--,t>0&&(c[1]=c[1].concat(")"))}else 5===c.length||6===c.length?"("===c[4]?(5===c.length&&c.push(""),c.push(")")):5===c.length?c.push(")"):c[5]=c[5].concat(")"):t--;if(0===t)for(;c.length<7;)c.push("");s++}else{if(r=Ts.anyChar.exec(n),!r)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(r[0]);break;case 2:c[1]=c[1].concat(r[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(r[0]);break;default:return!1}s+=r[0].length}else 5===c.length&&c.push(""),c.push(r[0]),s++;else{for(;c.length<4;)c.push("");c.push(r[0]),s++}else 1===c.length&&c.push(""),c.push(">"),s++}if(t>0)return!1}if(!1!==l){let e=!1;for(let t of this.linkLabels)if(t===l){e=!0;break}let t=e?"TMLinkLabel TMLinkLabel_Valid":"TMLinkLabel TMLinkLabel_Invalid",n='<span class="TMMark TMMark_'.concat(i,'">').concat(r,'</span><span class="').concat(i," ").concat(u.length<3||!u[1]?t:"",'">').concat(this.processInlineStyles(a),'</span><span class="TMMark TMMark_').concat(i,'">]</span>');return u.length>=3&&(n=n.concat('<span class="TMMark TMMark_'.concat(i,'">').concat(u[0],"</span>"),'<span class="'.concat(t,'">').concat(u[1],"</span>"),'<span class="TMMark TMMark_'.concat(i,'">').concat(u[2],"</span>"))),{output:n,charCount:s}}if(c.length>0){for(;c.length<7;)c.push("");return{output:'<span class="TMMark TMMark_'.concat(i,'">').concat(r,'</span><span class="').concat(i,'">').concat(this.processInlineStyles(a),'</span><span class="TMMark TMMark_').concat(i,'">](').concat(ws(c[0]),'</span><span class="').concat(i,'Destination">').concat(ws(c[1]),'</span><span class="TMMark TMMark_').concat(i,'">').concat(ws(c[2])).concat(ws(c[3])).concat(ws(c[4]),'</span><span class="').concat(i,'Title">').concat(ws(c[5]),'</span><span class="TMMark TMMark_').concat(i,'">').concat(ws(c[6]),")</span>"),charCount:s}}return!1}computeCommonAncestor(e,t){if(!e||!t)return null;if(e===t)return e;const n=e=>{let t=[];for(;e;)t.unshift(e),e=e.parentNode;return t},r=n(e),i=n(t);if(r[0]!==i[0])return null;let s;for(s=0;r[s]===i[s];s++);return r[s-1]}computeEnclosingMarkupNode(e,t,n){let r=null;if(!e)return null;if(t){if(e.row!==t.row)return null;const n=window.getSelection();if(!n)return null;r=this.computeCommonAncestor(n.focusNode,n.anchorNode)}else{const e=window.getSelection();if(!e||!e.focusNode)return null;r=e.focusNode}if(!r)return null;for(;r!==this.e;){if(r.classList&&r.classList.contains(n))return r;r=r.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={};if(n||(n=this.getSelection(!1)),r||(r=this.getSelection(!0)),!n){for(let e in Es)i[e]=null;return i}r||(r=n),r.row<n.row||r.row===n.row&&r.col<n.col?(e=r,t=n):(e=n,t=r),t.row>e.row&&0===t.col&&(t.row--,t.col=this.lines[t.row].length);for(let s in Es)if("inline"===Es[s].type&&(n&&n.row===r.row&&this.isInlineFormattingAllowed()?i[s]=!!this.computeEnclosingMarkupNode(n,r,Es[s].className)||n.col===r.col&&!!this.lines[n.row].substr(0,n.col).match(Es[s].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(Es[s].unset.postPattern):i[s]=null),"line"===Es[s].type)if(n){let n=this.lineTypes[e.row]===Es[s].className;for(let r=e.row;r<=t.row;r++)if(this.lineTypes[r]===Es[s].className!==n){n=null;break}i[s]=n}else i[s]=null;return i}setCommandState(e,t){if(this.isRestoringHistory||this.pushHistory(),"inline"===Es[e].type){let t=this.getSelection(!0),n=this.getSelection(!1);if(t||(t=n),!t)return;if(t.row!==n.row)return;if(!this.isInlineFormattingAllowed())return;let r=this.computeEnclosingMarkupNode(n,t,Es[e].className);if(this.clearDirtyFlag(),r){this.lineDirty[n.row]=!0;const i=this.computeColumn(r,0),s=r.textContent.length,o=this.lines[n.row].substr(0,i).replace(Es[e].unset.prePattern,""),a=this.lines[n.row].substr(i,s),l=this.lines[n.row].substr(i+s).replace(Es[e].unset.postPattern,"");this.lines[n.row]=o.concat(a,l),t.col=o.length,n.col=t.col+s,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else if(n.col===t.col&&this.lines[n.row].substr(0,n.col).match(Es[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(Es[e].unset.postPattern)){this.lineDirty[n.row]=!0;const r=this.lines[n.row].substr(0,n.col).replace(Es[e].unset.prePattern,""),i=this.lines[n.row].substr(n.col).replace(Es[e].unset.postPattern,"");this.lines[n.row]=r.concat(i),n.col=t.col=r.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let r=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},i=r.startCol,s=r.endCol,o=this.lines[n.row].substr(i,s-i).match(Ts.surroundingWhitespace);o&&(i+=o.groups.leading.length,s-=o.groups.trailing.length),n.col=i,t.col=s,this.wrapSelection(Es[e].set.pre,Es[e].set.post,n,t)}}else if("line"===Es[e].type){let n=this.getSelection(!0),r=this.getSelection(!1);if(n||(n=r),!r)return;this.clearDirtyFlag();let i=n.row>r.row?r:n,s=n.row>r.row?n:r;s.row>i.row&&0===s.col&&s.row--;for(let n=i.row;n<=s.row;n++)t&&this.lineTypes[n]!==Es[e].className&&(this.lines[n]=this.lines[n].replace(Es[e].set.pattern,Es[e].set.replacement.replace("$#",(n-i.row+1).toString())),this.lineDirty[n]=!0),t||this.lineTypes[n]!==Es[e].className||(this.lines[n]=this.lines[n].replace(Es[e].unset.pattern,Es[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:s.row,col:this.lines[s.row].length},{row:i.row,col:0}),this.fireChange()}}listItemMarker(e){const t=ks.TMUL.regexp.exec(e);if(t)return t[1];const n=ks.TMOL.regexp.exec(e);return n?n[1]:null}isTaskListItem(e){if(e<0||e>=this.lines.length)return!1;const t=this.lineTypes[e];if("TMUL"!==t&&"TMOL"!==t)return!1;const n=this.listItemMarker(this.lines[e]);return null!==n&&Ts.taskListItem.test(this.lines[e].substr(n.length))}addTaskCheckbox(e){const t=this.listItemMarker(e);if(null!==t){const n=e.substr(t.length);return Ts.taskListItem.test(n)?e:"".concat(t,"[ ] ").concat(n)}return e.replace(Es.ul.set.pattern,"- [ ] $2")}removeTaskCheckbox(e){const t=this.listItemMarker(e);if(null===t)return e;const n=Ts.taskListItem.exec(e.substr(t.length));return n?"".concat(t).concat(n[5]):e}toggleTaskList(){let e=this.getSelection(!0),t=this.getSelection(!1);if(e||(e=t),!t)return;let n=e.row>t.row?t:e,r=e.row>t.row?e:t;r.row>n.row&&0===r.col&&r.row--;let i=!0;for(let e=n.row;e<=r.row;e++)if(!this.isTaskListItem(e)){i=!1;break}this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();for(let e=n.row;e<=r.row;e++){const t=i?this.removeTaskCheckbox(this.lines[e]):this.addTaskCheckbox(this.lines[e]);t!==this.lines[e]&&(this.lines[e]=t,this.lineDirty[e]=!0)}this.updateFormatting(),this.setSelection({row:r.row,col:this.lines[r.row].length},{row:n.row,col:0}),this.fireChange()}isInlineFormattingAllowed(){const e=window.getSelection();if(!e||!e.focusNode||!e.anchorNode)return!1;if(e.isCollapsed&&3===e.focusNode.nodeType&&e.focusOffset===e.focusNode.nodeValue.length){let t;for(t=e.focusNode;t&&null===t.nextSibling;t=t.parentNode);if(t&&t.nextSibling&&t.nextSibling.classList&&t.nextSibling.classList.contains("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!==this.e;){if(t.classList&&(t.classList.contains("TMInlineFormatted")||t.classList.contains("TMBlankLine")))return!0;t=t.parentNode}return!1}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}fireSelection(){let e=this.getSelection(!1),t=this.getSelection(!0);if(this.lastSelection={focus:e,anchor:t},this.listeners.selection&&this.listeners.selection.length){let n=this.getCommandState(e,t);this.lastCommandState?Object.assign(this.lastCommandState,n):this.lastCommandState=Object.assign({},n);for(let n of this.listeners.selection)n({focus:e,anchor:t,commandState:this.lastCommandState})}}}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyMDE={})}(this,(function(e){"use strict";const t={blockquote:'<svg height="18" width="18"><rect width="5" height="5" x="3" y="4" ry="1"/><rect ry="1" y="4" x="10" height="5" width="5"/><path d="M8 6.999v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3zm7 0v3c0 1-1 3-1 3s-.331 1-1.331 1h-1c-1 0-.669-1-.669-1s1-2 1-3v-3z"/></svg>',bold:'<svg height="18" width="18"><path d="M4 2a1 1 0 00-1 1v12a1 1 0 001 1h6c4 0 5-2 5-4 0-1.322-.434-2.636-1.885-3.381C13.772 7.885 14 6.945 14 6c0-2-1-4-5-4zm1 2h4c1.668 0 2.32.393 2.6.672.28.279.4.662.4 1.328s-.12 1.057-.4 1.338c-.275.274-1.014.646-2.6.662H5zm5 6c1.666.005 2.318.388 2.596.666.277.278.404.667.404 1.334s-.127 1.06-.404 1.338c-.278.278-.93.66-2.596.662l-4.992.004L5 10z"/></svg>',code:'<svg height="18" width="18"><path d="M13.5 2.994a.5.5 0 00-.5.5.5.5 0 000 .034V4.53a5.993 5.993 0 00-7.451-.445A6 6 0 1012.45 13.9a5.99 5.99 0 001.346-1.334.5.5 0 00.096-.101.5.5 0 00-.12-.698.5.5 0 00-.697.12l-.004-.005a5 5 0 01-1.197 1.2 5 5 0 111.215-6.965.5.5 0 00.697.12.5.5 0 00.211-.44V4.745H14V3.493a.5.5 0 00-.5-.5z"/></svg>',h1:'<svg height="18" width="18"><path d="M3 2s0-1 1-1h1c1 0 1 1 1 1v6h6V2s0-1 1-1h1c1 0 1 1 1 1v14s0 1-1 1h-1c-1 0-1-1-1-1v-6H6v6s0 1-1 1H4c-1 0-1-1-1-1z"/></svg>',h2:'<svg height="18" width="18"><path d="M4 2s0-1 1-1 1 1 1 1v6c1-1 2-1 4-1 3 0 4 2 4 4v5s0 1-1 1-1-1-1-1v-5c0-1.094-1-2-2-2-2 0-3 0-4 2v5s0 1-1 1-1-1-1-1z"/></svg>',hr:'<svg height="18" width="18"><rect ry="1" y="8" height="2" width="18"/></svg>',image:'<svg height="18" width="18"><path d="M1 2v14h16V2H1zm2 2h12v7l-3-3-4 4-2-2-3 3V4z"/><circle r="1.5" cy="6.5" cx="5.5"/></svg>',italic:'<svg height="18" width="18"><path d="M9 2a1 1 0 000 2L7 14a1 1 0 100 2h2a1 1 0 000-2l2-10a1 1 0 100-2z"/></svg>',link:'<svg height="18" width="18"><path d="M9.07 5.18a3.9 3.9 0 00-1.52.43C6.31 6.22 5.3 7.29 4.3 8.29c-1 1-2.07 2.02-2.68 3.26-.31.62-.5 1.33-.41 2.07.09.75.48 1.47 1.1 2.09.61.61 1.33 1 2.08 1.1.74.09 1.45-.1 2.07-.42 1.24-.61 2.26-1.68 3.26-2.68.46-.47.94-.94 1.39-1.44l-.43.26c-.68.34-1.49.56-2.36.46-.2-.03-.4-.08-.6-.14-.79.76-1.55 1.45-2.16 1.76-.38.19-.67.24-.92.21-.26-.03-.54-.14-.92-.53-.39-.38-.5-.66-.53-.91-.03-.26.02-.55.21-.93.39-.76 1.32-1.74 2.32-2.74 1-1 1.98-1.93 2.74-2.32.38-.19.67-.24.93-.21.25.03.53.14.91.53.39.38.5.66.53.92v.06l1.12-1.06.44-.47c-.18-.3-.4-.6-.67-.87-.62-.61-1.34-1-2.09-1.1a3.08 3.08 0 00-.55-.01z"/><path d="M13.07.86a3.9 3.9 0 00-1.52.43c-1.24.62-2.26 1.69-3.26 2.69-.46.47-.94.94-1.39 1.43.15-.08.28-.18.43-.25a4.4 4.4 0 012.36-.46c.2.02.4.07.6.14.79-.77 1.55-1.46 2.16-1.76.38-.19.67-.25.93-.21.25.03.53.14.91.52.39.38.5.66.53.92.03.26-.02.55-.21.93-.39.76-1.32 1.74-2.32 2.74-1 1-1.98 1.93-2.74 2.31-.38.2-.67.25-.93.22-.25-.04-.53-.15-.91-.53-.39-.38-.5-.66-.53-.92V9c-.36.33-.73.67-1.12 1.06l-.43.46c.17.3.4.6.66.87.62.62 1.34 1 2.08 1.1.75.1 1.46-.1 2.08-.41 1.24-.62 2.26-1.69 3.26-2.69s2.07-2.02 2.68-3.26c.31-.62.5-1.32.41-2.07a3.63 3.63 0 00-1.1-2.08c-.61-.62-1.33-1-2.07-1.1a3.08 3.08 0 00-.56-.02z"/></svg>',ol:'<svg height="18" width="18"><path d="M1.5 7a.5.5 0 100 1h1a.5.5 0 01.5.5c0 .164-.08.31-.14.355l-1.655 1.25A.492.492 0 001 10.5a.5.5 0 00.5.5h2a.5.5 0 000-1H3l.398-.299A1.5 1.5 0 002.5 7z"/><path d="M1.5 12c-.667 0-.667 1 0 1h1.25c.333 0 .333.5 0 .5H2.5c-.667 0-.667 1 0 1h.25c.333 0 .333.5 0 .5H1.5c-.667 0-.667 1 0 1h1c.398 0 .78-.131 1.06-.365.282-.235.44-.554.44-.885a1.121 1.121 0 00-.303-.75c.191-.204.3-.47.303-.75 0-.332-.158-.651-.44-.885-.3-.241-.675-.37-1.06-.365z"/><rect y="13" x="6" height="2" width="12" ry="1"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="3" x="6" height="2" width="12" ry="1"/><path d="M1.5 2a.5.5 0 100 1H2v2h-.5a.5.5 0 100 1h2a.5.5 0 100-1H3V2.5c0-.277-.223-.5-.5-.5z"/></svg>',redo:'<svg height="18" width="18"><path d="M 7.2695308,2.7050781 C 8.1128755,2.7081581 8.9529895,2.8712156 9.730469,3.1347656 11.408874,3.7037121 12.90142,4.6847104 14,5.6367188 V 4 h 2 V 9 H 11 V 7 h 1.509765 C 11.59075,6.2485173 10.340208,5.453808 9.0878904,5.0292969 7.4309398,4.4676231 5.9453458,4.468717 4.7070308,5.7070312 c -1.225014,1.2250142 -1.409769,2.7206953 -0.779297,4.2968748 0.630472,1.57618 2.167475,3.158006 4.4433598,4.06836 l -0.7421878,1.855468 c -2.724115,-1.089646 -4.687112,-3.00782 -5.55664,-5.18164 -0.869528,-2.1738206 -0.554283,-4.6781393 1.220703,-6.4531252 0.923857,-0.9238568 2.015388,-1.388828 3.134765,-1.5351563 0.279845,-0.036582 0.560682,-0.053761 0.841797,-0.052734 z" /></svg>',strikethrough:'<svg width="18" height="18"><path d="M10 2C6 2 4 4 4 6c0 .338.08.672.193 1h2.34C6.113 6.629 6 6.295 6 6c0-.334.117-.725.691-1.154C7.265 4.416 8.331 4 10 4h3a1 1 0 000-2zm1.477 9c.413.368.523.706.523 1 0 .334-.127.712-.701 1.143-.575.43-1.632.85-3.299.857l-1.006.007V14H5a1 1 0 000 2h3c4 0 6-2 6-4 0-.338-.081-.672-.195-1z"/><rect ry="1" y="8" x="1" height="2" width="16"/></svg>',tasklist:'<svg\n height="18"\n width="18"\n>\n <path\n d="M 2.3339844,1 C 1.6039663,1 1,1.6039663 1,2.3339844 V 5.6660156 C 1,6.3960337 1.6039663,7 2.3339844,7 H 5.6660156 C 6.3960337,7 7,6.3960337 7,5.6660156 V 2.3339844 C 7,1.6039663 6.3960337,1 5.6660156,1 Z m 0,1 H 5.6660156 C 5.8593309,2 6,2.1406691 6,2.3339844 V 5.6660156 C 6,5.8593309 5.8593309,6 5.6660156,6 H 2.3339844 C 2.1406691,6 2,5.8593309 2,5.6660156 V 2.3339844 C 2,2.1406691 2.1406691,2 2.3339844,2 Z"\n />\n <path\n d="M 2.3339844,11 C 1.6039663,11 1,11.603966 1,12.333984 v 3.332032 C 1,16.396034 1.6039663,17 2.3339844,17 H 5.6660156 C 6.3960337,17 7,16.396034 7,15.666016 V 12.333984 C 7,11.603966 6.3960337,11 5.6660156,11 Z m 0,1 H 5.6660156 C 5.8593309,12 6,12.140669 6,12.333984 v 3.332032 C 6,15.859331 5.8593309,16 5.6660156,16 H 2.3339844 C 2.1406691,16 2,15.859331 2,15.666016 V 12.333984 C 2,12.140669 2.1406691,12 2.3339844,12 Z"\n />\n <path\n d="m 10,3 h 7 c 0.554,0 1,0.446 1,1 0,0.554 -0.446,1 -1,1 H 10 C 9.446,5 9,4.554 9,4 9,3.446 9.446,3 10,3 Z" />\n <path\n d="m 10,13 h 7 c 0.554,0 1,0.446 1,1 0,0.554 -0.446,1 -1,1 H 10 C 9.446,15 9,14.554 9,14 9,13.446 9.446,13 10,13 Z" />\n <path\n d="M 4.8417969,2.5253906 A 0.5,0.5 0 0 0 4.5527344,2.7773438 L 3.8632813,4.15625 3.3535156,3.6464844 a 0.5,0.5 0 0 0 -0.7070312,0 0.5,0.5 0 0 0 0,0.7070312 l 1,1 A 0.50005,0.50005 0 0 0 4.4472656,5.2226562 l 1,-1.9999999 A 0.5,0.5 0 0 0 5.2226562,2.5527344 0.5,0.5 0 0 0 4.8417969,2.5253906 Z"\n />\n</svg>',ul:'<svg height="18" width="18"><circle cx="2" cy="9" r="2"/><circle cy="4" cx="2" r="2"/><rect y="3" x="6" height="2" width="12" ry="1"/><circle cx="2" cy="14" r="2"/><rect ry="1" width="12" height="2" x="6" y="8"/><rect y="13" x="6" height="2" width="12" ry="1"/></svg>',undo:'<svg height="18" width="18"><path d="M 10.730469 2.7050781 C 9.8871243 2.7081594 9.0470103 2.8712156 8.2695312 3.1347656 C 6.5911256 3.7037121 5.0985797 4.6847104 4 5.6367188 L 4 4 L 2 4 L 2 9 L 7 9 L 7 7 L 5.4902344 7 C 6.4092499 6.2485173 7.6597914 5.453808 8.9121094 5.0292969 C 10.56906 4.4676231 12.054654 4.468717 13.292969 5.7070312 C 14.517983 6.9320454 14.702738 8.4277265 14.072266 10.003906 C 13.441794 11.580086 11.904791 13.161912 9.6289062 14.072266 L 10.371094 15.927734 C 13.095209 14.838088 15.058206 12.919914 15.927734 10.746094 C 16.797262 8.5722734 16.482017 6.0679547 14.707031 4.2929688 C 13.783174 3.369112 12.691643 2.9041408 11.572266 2.7578125 C 11.292421 2.7212304 11.011584 2.704051 10.730469 2.7050781 z " /></svg>\n'},n=/(Mac|iPhone|iPod|iPad)/i.test("undefined"!=typeof navigator?navigator.platform:""),i={bold:{name:"bold",action:"bold",innerHTML:t.bold,title:"Bold",hotkey:"Mod-B"},italic:{name:"italic",action:"italic",innerHTML:t.italic,title:"Italic",hotkey:"Mod-I"},strikethrough:{name:"strikethrough",action:"strikethrough",innerHTML:t.strikethrough,title:"Strikethrough",hotkey:"Mod2-Shift-5"},code:{name:"code",action:"code",innerHTML:t.code,title:"Format as code"},h1:{name:"h1",action:"h1",innerHTML:t.h1,title:"Level 1 heading",hotkey:"Mod-Shift-1"},h2:{name:"h2",action:"h2",innerHTML:t.h2,title:"Level 2 heading",hotkey:"Mod-Shift-2"},ul:{name:"ul",action:"ul",innerHTML:t.ul,title:"Bulleted list"},ol:{name:"ol",action:"ol",innerHTML:t.ol,title:"Numbered list"},blockquote:{name:"blockquote",action:"blockquote",innerHTML:t.blockquote,title:"Quote",hotkey:"Mod2-Shift-Q"},tasklist:{name:"tasklist",action:e=>e.toggleTaskList(),enabled:(e,t)=>t?e.isTaskListItem(t.row):null,innerHTML:t.tasklist,title:"Task list",hotkey:"Mod2-Shift-T"},insertLink:{name:"insertLink",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:e=>!e.isInlineFormattingAllowed()&&null,innerHTML:t.link,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:e=>!e.isInlineFormattingAllowed()&&null,innerHTML:t.image,title:"Insert image",hotkey:"Mod2-Shift-I"},hr:{name:"hr",action:e=>e.paste("\n***\n"),enabled:()=>!1,innerHTML:t.hr,title:"Insert horizontal line",hotkey:"Mod2-Shift-L"},undo:{name:"undo",action:e=>e.undo(),enabled:e=>!e.canUndo&&null,innerHTML:t.undo,title:"Undo"},redo:{name:"redo",action:e=>e.redo(),enabled:e=>!e.canRedo&&null,innerHTML:t.redo,title:"Redo"}};var s,r,l,a,o,u,h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c={};function p(){if(r)return s;r=1;var e=function(e){return e&&e.Math===Math&&e};return s=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof h&&h)||e("object"==typeof s&&s)||function(){return this}()||Function("return this")()}function d(){return a?l:(a=1,l=function(e){try{return!!e()}catch(e){return!0}})}function m(){if(u)return o;u=1;var e=d();return o=!e((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}var g,f,M,T,k,y,C,D,F,b,w,E,v,A,$,x,S={exports:{}};function L(){if(f)return g;f=1;var e=d();return g=!e((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))}function H(){if(T)return M;T=1;var e=L(),t=Function.prototype,n=t.call,i=e&&t.bind.bind(n,n);return M=e?i:function(e){return function(){return n.apply(e,arguments)}},M}function B(){if(y)return k;y=1;var e="object"==typeof document&&document.all;return k=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function I(){return D?C:(D=1,C=function(e){return null==e})}function N(){if(b)return F;b=1;var e=I(),t=TypeError;return F=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function O(){if(E)return w;E=1;var e=N(),t=Object;return w=function(n){return t(e(n))}}function _(){if(A)return v;A=1;var e=H(),t=O(),n=e({}.hasOwnProperty);return v=Object.hasOwn||function(e,i){return n(t(e),i)}}var P,R,z,j,Z,V,G,q,U,K,W,X={exports:{}};function Q(){if(j)return z;j=1;var e=p(),t=Object.defineProperty;return z=function(n,i){try{t(e,n,{value:i,configurable:!0,writable:!0})}catch(t){e[n]=i}return i}}function J(){if(Z)return X.exports;Z=1;var e=R?P:(R=1,P=!1),t=p(),n=Q(),i="__core-js_shared__",s=X.exports=t[i]||n(i,{});return(s.versions||(s.versions=[])).push({version:"3.42.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"}),X.exports}function Y(){if(G)return V;G=1;var e=H(),t=B(),n=J(),i=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return i(e)}),V=n.inspectSource}function ee(){if(W)return K;W=1;var e=B();return K=function(t){return"object"==typeof t?null!==t:e(t)}}var te,ne,ie,se,re,le,ae,oe,ue,he,ce,pe,de,me,ge,fe,Me,Te,ke,ye,Ce,De,Fe,be,we,Ee,ve,Ae,$e,xe,Se,Le,He,Be,Ie,Ne,Oe,_e,Pe,Re,ze,je,Ze,Ve,Ge,qe,Ue,Ke,We,Xe,Qe,Je,Ye,et,tt,nt,it,st,rt,lt={};function at(){if(se)return ie;se=1;var e=m(),t=d(),n=function(){if(ne)return te;ne=1;var e=p(),t=ee(),n=e.document,i=t(n)&&t(n.createElement);return te=function(e){return i?n.createElement(e):{}}}();return ie=!e&&!t((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function ot(){if(oe)return ae;oe=1;var e=ee(),t=String,n=TypeError;return ae=function(i){if(e(i))return i;throw new n(t(i)+" is not an object")}}function ut(){if(he)return ue;he=1;var e=L(),t=Function.prototype.call;return ue=e?t.bind(t):function(){return t.apply(t,arguments)},ue}function ht(){if(pe)return ce;pe=1;var e=p(),t=B();return ce=function(n,i){return arguments.length<2?(s=e[n],t(s)?s:void 0):e[n]&&e[n][i];var s},ce}function ct(){if(Te)return Me;Te=1;var e,t,n=p(),i=function(){if(fe)return ge;fe=1;var e=p().navigator,t=e&&e.userAgent;return ge=t?String(t):""}(),s=n.process,r=n.Deno,l=s&&s.versions||r&&r.version,a=l&&l.v8;return a&&(t=(e=a.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&i&&(!(e=i.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=i.match(/Chrome\/(\d+)/))&&(t=+e[1]),Me=t}function pt(){if(ye)return ke;ye=1;var e=ct(),t=d(),n=p().String;return ke=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))}function dt(){if(De)return Ce;De=1;var e=pt();return Ce=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function mt(){if(be)return Fe;be=1;var e=ht(),t=B(),n=function(){if(me)return de;me=1;var e=H();return de=e({}.isPrototypeOf)}(),i=dt(),s=Object;return Fe=i?function(e){return"symbol"==typeof e}:function(i){var r=e("Symbol");return t(r)&&n(r.prototype,s(i))}}function gt(){if(Ee)return we;Ee=1;var e=String;return we=function(t){try{return e(t)}catch(e){return"Object"}}}function ft(){if(Ae)return ve;Ae=1;var e=B(),t=gt(),n=TypeError;return ve=function(i){if(e(i))return i;throw new n(t(i)+" is not a function")}}function Mt(){if(xe)return $e;xe=1;var e=ft(),t=I();return $e=function(n,i){var s=n[i];return t(s)?void 0:e(s)}}function Tt(){if(Le)return Se;Le=1;var e=ut(),t=B(),n=ee(),i=TypeError;return Se=function(s,r){var l,a;if("string"===r&&t(l=s.toString)&&!n(a=e(l,s)))return a;if(t(l=s.valueOf)&&!n(a=e(l,s)))return a;if("string"!==r&&t(l=s.toString)&&!n(a=e(l,s)))return a;throw new i("Can't convert object to primitive value")}}function kt(){if(Be)return He;Be=1;var e=J();return He=function(t,n){return e[t]||(e[t]=n||{})}}function yt(){if(Ne)return Ie;Ne=1;var e=H(),t=0,n=Math.random(),i=e(1..toString);return Ie=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++t+n,36)}}function Ct(){if(_e)return Oe;_e=1;var e=p(),t=kt(),n=_(),i=yt(),s=pt(),r=dt(),l=e.Symbol,a=t("wks"),o=r?l.for||l:l&&l.withoutSetter||i;return Oe=function(e){return n(a,e)||(a[e]=s&&n(l,e)?l[e]:o("Symbol."+e)),a[e]}}function Dt(){if(Re)return Pe;Re=1;var e=ut(),t=ee(),n=mt(),i=Mt(),s=Tt(),r=Ct(),l=TypeError,a=r("toPrimitive");return Pe=function(r,o){if(!t(r)||n(r))return r;var u,h=i(r,a);if(h){if(void 0===o&&(o="default"),u=e(h,r,o),!t(u)||n(u))return u;throw new l("Can't convert object to primitive value")}return void 0===o&&(o="number"),s(r,o)}}function Ft(){if(je)return ze;je=1;var e=Dt(),t=mt();return ze=function(n){var i=e(n,"string");return t(i)?i:i+""}}function bt(){if(Ze)return lt;Ze=1;var e=m(),t=at(),n=function(){if(le)return re;le=1;var e=m(),t=d();return re=e&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}(),i=ot(),s=Ft(),r=TypeError,l=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o="enumerable",u="configurable",h="writable";return lt.f=e?n?function(e,t,n){if(i(e),t=s(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=a(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:u in n?n[u]:r[u],enumerable:o in n?n[o]:r[o],writable:!1})}return l(e,t,n)}:l:function(e,n,a){if(i(e),n=s(n),i(a),t)try{return l(e,n,a)}catch(e){}if("get"in a||"set"in a)throw new r("Accessors not supported");return"value"in a&&(e[n]=a.value),e},lt}function wt(){return Ge?Ve:(Ge=1,Ve=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function Et(){if(Ue)return qe;Ue=1;var e=m(),t=bt(),n=wt();return qe=e?function(e,i,s){return t.f(e,i,n(1,s))}:function(e,t,n){return e[t]=n,e}}function vt(){if(We)return Ke;We=1;var e=kt(),t=yt(),n=e("keys");return Ke=function(e){return n[e]||(n[e]=t(e))}}function At(){return Qe?Xe:(Qe=1,Xe={})}function $t(){if(Ye)return Je;Ye=1;var e,t,n,i=function(){if(U)return q;U=1;var e=p(),t=B(),n=e.WeakMap;return q=t(n)&&/native code/.test(String(n))}(),s=p(),r=ee(),l=Et(),a=_(),o=J(),u=vt(),h=At(),c="Object already initialized",d=s.TypeError,m=s.WeakMap;if(i||o.state){var g=o.state||(o.state=new m);g.get=g.get,g.has=g.has,g.set=g.set,e=function(e,t){if(g.has(e))throw new d(c);return t.facade=e,g.set(e,t),t},t=function(e){return g.get(e)||{}},n=function(e){return g.has(e)}}else{var f=u("state");h[f]=!0,e=function(e,t){if(a(e,f))throw new d(c);return t.facade=e,l(e,f,t),t},t=function(e){return a(e,f)?e[f]:{}},n=function(e){return a(e,f)}}return Je={set:e,get:t,has:n,enforce:function(i){return n(i)?t(i):e(i,{})},getterFor:function(e){return function(n){var i;if(!r(n)||(i=t(n)).type!==e)throw new d("Incompatible receiver, "+e+" required");return i}}}}function xt(){if(et)return S.exports;et=1;var e=H(),t=d(),n=B(),i=_(),s=m(),r=function(){if(x)return $;x=1;var e=m(),t=_(),n=Function.prototype,i=e&&Object.getOwnPropertyDescriptor,s=t(n,"name"),r=s&&"something"===function(){}.name,l=s&&(!e||e&&i(n,"name").configurable);return $={EXISTS:s,PROPER:r,CONFIGURABLE:l}}().CONFIGURABLE,l=Y(),a=$t(),o=a.enforce,u=a.get,h=String,c=Object.defineProperty,p=e("".slice),g=e("".replace),f=e([].join),M=s&&!t((function(){return 8!==c((function(){}),"length",{value:8}).length})),T=String(String).split("String"),k=S.exports=function(e,t,n){"Symbol("===p(h(t),0,7)&&(t="["+g(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||r&&e.name!==t)&&(s?c(e,"name",{value:t,configurable:!0}):e.name=t),M&&n&&i(n,"arity")&&e.length!==n.arity&&c(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&c(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var l=o(e);return i(l,"source")||(l.source=f(T,"string"==typeof t?t:"")),e};return Function.prototype.toString=k((function(){return n(this)&&u(this).source||l(this)}),"toString"),S.exports}function St(){if(nt)return tt;nt=1;var e=xt(),t=bt();return tt=function(n,i,s){return s.get&&e(s.get,i,{getter:!0}),s.set&&e(s.set,i,{setter:!0}),t.f(n,i,s)}}!function(){if(rt)return c;rt=1;var e=p(),t=m(),n=St(),i=function(){if(st)return it;st=1;var e=ot();return it=function(){var t=e(this),n="";return t.hasIndices&&(n+="d"),t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t.unicode&&(n+="u"),t.unicodeSets&&(n+="v"),t.sticky&&(n+="y"),n}}(),s=d(),r=e.RegExp,l=r.prototype;t&&s((function(){var e=!0;try{r(".","d")}catch(t){e=!1}var t={},n="",i=e?"dgimsy":"gimsy",s=function(e,i){Object.defineProperty(t,e,{get:function(){return n+=i,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)s(o,a[o]);return Object.getOwnPropertyDescriptor(l,"flags").get.call(t)!==i||n!==i}))&&n(l,"flags",{configurable:!0,get:i})}();const Lt={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~\n]/,Scheme:/[A-Za-z][A-Za-z0-9+.-]{1,31}/,Email:/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/,HTMLOpenTag:/<HTMLTagName(?:HTMLAttribute)*\s*\/?>/,HTMLCloseTag:/<\/HTMLTagName\s*>/,HTMLTagName:/[A-Za-z][A-Za-z0-9-]*/,HTMLComment:/<!--(?:[^>-]|(?:[^>-](?:[^-]|-[^-])*[^-]))-->/,HTMLPI:/<\?(?:|.|(?:[^?]|\?[^>])*)\?>/,HTMLDeclaration:/<![A-Z]+\s[^>]*>/,HTMLCDATA:/<!\[CDATA\[.*?\]\]>/,HTMLAttribute:/\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,HTMLAttValue:/\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,KnownTag:/address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/},Ht=new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/),Bt=new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/),It={macPlatform:/Mac|iPod|iPhone|iPad/,lineSplit:/(?:\r\n|\r|\n)/,replacementPlaceholder:/(\${1,2})([0-9])/g,inlineContentPlaceholder:/\$\$([0-9])/,inlineReplacementPlaceholder:/\$([1-9])/g,blankContent:/^\s*$/,leadingWhitespace:/^\s/,trailingWhitespace:/\s$/,leadingWhitespaceRun:/^\s+/,surroundingWhitespace:/^(?<leading>\s*).*\S(?<trailing>\s*)$/,taskListItem:/^(\[)([ xX])(\])(\s|$)([\s\S]*)$/,orderedListNumber:/\d{1,9}/,inlineTagName:/^<\s*([a-zA-Z][a-zA-Z0-9]*)/,changeEvent:/^(?:change|input)$/i,selectionEvent:/^(?:selection|selectionchange)$/i,dropEvent:/^(?:drop)$/i,autolinkPrecedingChar:/[\s*_~(]/,emphasisDelimiter:/(^\*+)|(^_+)/,strikethroughDelimiter:/^~~/,autolinkScheme:/^(?:https?|ftp):\/\//i,autolinkWww:/^www\./i,autolinkDomain:/^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/,autolinkPath:/^[^\s<]*/,autolinkProtocol:/^(?:mailto|xmpp):/i,autolinkXmpp:/^xmpp:/i,autolinkXmppResource:/^\/[a-zA-Z0-9@.\-_]+/,autolinkEmail:/^[a-zA-Z0-9.\-_+]+@[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)+/,emailTrailingChar:/[-_]$/,emailTld:/\.[a-zA-Z0-9]+$/,linkClosingBracket:/^\]/,openingAngle:/^</,closingAngle:/^>/,titleQuote:/^["']/,openingParen:/^\(/,closingParen:/^\)/,endsWithOpenAngle:/<$/,containsOpenAngle:/</,anyChar:/^./},Nt={TMH1:{regexp:/^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'},TMH2:{regexp:/^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH2">$1</span>$$2<span class="TMMark TMMark_TMH2">$3</span>'},TMH3:{regexp:/^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH3">$1</span>$$2<span class="TMMark TMMark_TMH3">$3</span>'},TMH4:{regexp:/^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH4">$1</span>$$2<span class="TMMark TMMark_TMH4">$3</span>'},TMH5:{regexp:/^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH5">$1</span>$$2<span class="TMMark TMMark_TMH5">$3</span>'},TMH6:{regexp:/^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/,replacement:'<span class="TMMark TMMark_TMH6">$1</span>$$2<span class="TMMark TMMark_TMH6">$3</span>'},TMBlockquote:{regexp:/^( {0,3}>[ ]?)(.*)$/,replacement:'<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'},TMCodeFenceBacktickOpen:{regexp:/^( {0,3}(?<seq>````*)\s*)([^`]*?)(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceTildeOpen:{regexp:/^( {0,3}(?<seq>~~~~*)\s*)(.*?)(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'},TMCodeFenceBacktickClose:{regexp:/^( {0,3}(?<seq>````*))(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'},TMCodeFenceTildeClose:{regexp:/^( {0,3}(?<seq>~~~~*))(\s*)$/,replacement:'<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'},TMBlankLine:{regexp:/^([ \t]*)$/,replacement:"$0"},TMSetextH1Marker:{regexp:/^ {0,3}=+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMSetextH2Marker:{regexp:/^ {0,3}-+\s*$/,replacement:'<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'},TMHR:{regexp:/^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/,replacement:'<span class="TMMark TMMark_TMHR">$0</span>'},TMUL:{regexp:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMUL">$1</span>$$2'},TMOL:{regexp:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:'<span class="TMMark TMMark_TMOL">$1</span>$$2'},TMIndentedCode:{regexp:/^( {4}|\t)(.*)$/,replacement:'<span class="TMMark TMMark_TMIndentedCode">$1</span>$2'},TMLinkReferenceDefinition:{regexp:/^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,replacement:'<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',labelPlaceholder:2}},Ot=[{start:/^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i,end:/(?:<\/script>|<\/pre>|<\/style>)/i,paraInterrupt:!0},{start:/^ {0,3}<!--/,end:/-->/,paraInterrupt:!0},{start:/^ {0,3}<\?/,end:/\?>/,paraInterrupt:!0},{start:/^ {0,3}<![A-Z]/,end:/>/,paraInterrupt:!0},{start:/^ {0,3}<!\[CDATA\[/,end:/\]\]>/,paraInterrupt:!0},{start:/^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i,end:!1,paraInterrupt:!0},{start:/^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/,end:!1,paraInterrupt:!1}],_t={escape:{regexp:/^\\(ASCIIPunctuation)/,replacement:'<span class="TMMark TMMark_TMEscape">\\</span>$1'},code:{regexp:/^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/,replacement:'<span class="TMMark TMMark_TMCode">$1</span><code class="TMCode">$2</code><span class="TMMark TMMark_TMCode">$3</span>'},autolink:{regexp:/^<((?:Scheme:[^\s<>]*)|(?:Email))>/,replacement:'<span class="TMMark TMMark_TMAutolink"><</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">></span>'},html:{regexp:/^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/,replacement:'<span class="TMHTML">$1</span>'},linkOpen:{regexp:/^\[/,replacement:""},imageOpen:{regexp:/^!\[/,replacement:""},linkLabel:{regexp:/^(\[\s*)([^\]]*?)(\s*\])/,replacement:"",labelPlaceholder:2},default:{regexp:/^(.|(?:NotTriggerChar+))/,replacement:"$1"}},Pt=new RegExp(Object.keys(Lt).join("|")),Rt=[...Object.keys(_t)];for(let e of Rt){let t=_t[e].regexp.source;for(;t.match(Pt);)t=t.replace(Pt,(e=>Lt[e].source));_t[e].regexp=new RegExp(t,_t[e].regexp.flags)}for(let e of Ot){let t=e.start.source;for(;t.match(Pt);)t=t.replace(Pt,(e=>Lt[e].source));e.start=new RegExp(t,e.start.flags)}function zt(e){return(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const jt={bold:{type:"inline",className:"TMStrong",set:{pre:"**",post:"**"},unset:{prePattern:/(?:\*\*|__)$/,postPattern:/^(?:\*\*|__)/}},italic:{type:"inline",className:"TMEm",set:{pre:"*",post:"*"},unset:{prePattern:/(?:\*|_)$/,postPattern:/^(?:\*|_)/}},code:{type:"inline",className:"TMCode",set:{pre:"`",post:"`"},unset:{prePattern:/`+$/,postPattern:/^`+/}},strikethrough:{type:"inline",className:"TMStrikethrough",set:{pre:"~~",post:"~~"},unset:{prePattern:/~~$/,postPattern:/^~~/}},h1:{type:"line",className:"TMH1",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"# $2"},unset:{pattern:/^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h2:{type:"line",className:"TMH2",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"## $2"},unset:{pattern:/^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h3:{type:"line",className:"TMH3",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"### $2"},unset:{pattern:/^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h4:{type:"line",className:"TMH4",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"#### $2"},unset:{pattern:/^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h5:{type:"line",className:"TMH5",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"##### $2"},unset:{pattern:/^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},h6:{type:"line",className:"TMH6",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"###### $2"},unset:{pattern:/^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/,replacement:"$2"}},ul:{type:"line",className:"TMUL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"- $2"},unset:{pattern:/^( {0,3}[+*-] {1,4})(.*)$/,replacement:"$2"}},ol:{type:"line",className:"TMOL",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"$#. $2"},unset:{pattern:/^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,replacement:"$2"}},blockquote:{type:"line",className:"TMBlockquote",set:{pattern:/^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/,replacement:"> $2"},unset:{pattern:/^( {0,3}>[ ]?)(.*)$/,replacement:"$2"}}};e.CommandBar=class{constructor(e){this.e=null,this.editor=null,this.commands={},this.buttons={},this.state={},this.hotkeys=[],this.cleanupFns=[],this.detachEditor=null,this.destroyed=!1,this.e=null,this.editor=null,this.commands={},this.buttons={},this.state={},this.hotkeys=[];let t=null;"string"==typeof e.element?t=document.getElementById(e.element):e.element&&(t=e.element),t||(t=document.body),this.createCommandBarElement(t,e.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","tasklist","|","blockquote","hr","|","undo","redo","|","insertLink","insertImage"]),this.addListener(document,"keydown",(e=>this.handleKeydown(e))),e.editor&&this.setEditor(e.editor)}createCommandBarElement(e,t){this.e=document.createElement("div"),this.e.className="TMCommandBar";for(let e of t)if("|"===e){let e=document.createElement("div");e.className="TMCommandDivider",this.e.appendChild(e)}else{let t;if("string"==typeof e){if(!i[e])continue;t=e,this.commands[t]=i[t]}else{if("object"!=typeof e||!e.name)continue;t=e.name,this.commands[t]={},i[t]&&Object.assign(this.commands[t],i[t]),Object.assign(this.commands[t],e)}let s=this.commands[t].title||t;if(this.commands[t].hotkey){const e=this.commands[t].hotkey.split("-");let i=[],r=[];for(let t=0;t<e.length-1;t++)switch(e[t]){case"Ctrl":i.push("ctrlKey"),r.push("Ctrl");break;case"Cmd":i.push("metaKey"),r.push("⌘");break;case"Alt":i.push("altKey"),r.push("Alt");break;case"Option":i.push("altKey"),r.push("⌥");break;case"Win":i.push("metaKey"),r.push("⊞ Win");break;case"Shift":i.push("shiftKey"),r.push("⇧");break;case"Mod":n?(i.push("metaKey"),r.push("⌘")):(i.push("ctrlKey"),r.push("Ctrl"));break;case"Mod2":i.push("altKey"),n?r.push("⌥"):r.push("Alt")}r.push(e[e.length-1]);let l={modifiers:i,command:t};const a=e[e.length-1];a.match(/^[0-9]$/)?l.code=`Digit${a}`:a.match(/^[a-zA-Z]$/)?l.code=`Key${a.toUpperCase()}`:l.key=a.toLowerCase(),this.hotkeys.push(l),s=s.concat(` (${r.join("+")})`)}this.buttons[t]=document.createElement("div"),this.buttons[t].className="TMCommandButton TMCommandButton_Disabled",this.buttons[t].title=s,this.buttons[t].innerHTML=this.commands[t].innerHTML||"?",this.addListener(this.buttons[t],"mousedown",(e=>this.handleClick(t,e))),this.e.appendChild(this.buttons[t])}e.appendChild(this.e)}handleClick(e,t){if(this.editor){if(t.preventDefault(),this.editor.e){const e=this.editor.e.contains(document.activeElement);this.editor.e.focus(),e||this.editor.restoreLastSelection()}"string"==typeof this.commands[e].action?!1===this.state[e]?this.editor.setCommandState(e,!0):this.editor.setCommandState(e,!1):"function"==typeof this.commands[e].action&&this.commands[e].action(this.editor)}}setEditor(e){this.detachEditor&&this.detachEditor(),this.editor=e;const t=e=>this.handleSelection(e);e.addEventListener("selection",t),this.detachEditor=()=>e.removeEventListener("selection",t)}handleSelection(e){if(e.commandState)for(let t in this.commands)void 0===e.commandState[t]?this.commands[t].enabled?this.state[t]=this.commands[t].enabled(this.editor,e.focus,e.anchor):this.state[t]=!e.focus&&null:this.state[t]=e.commandState[t],!0===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Active":!1===this.state[t]?this.buttons[t].className="TMCommandButton TMCommandButton_Inactive":this.buttons[t].className="TMCommandButton TMCommandButton_Disabled"}handleKeydown(e){if(this.editor&&this.editor.e&&this.editor.e.contains(document.activeElement))e:for(let t of this.hotkeys)if(t.key&&e.key.toLowerCase()===t.key||t.code&&e.code===t.code){for(let n of t.modifiers)if(!e[n])continue e;return void this.handleClick(t.command,e)}}addListener(e,t,n){e.addEventListener(t,n),this.cleanupFns.push((()=>e.removeEventListener(t,n)))}destroy(){if(!this.destroyed){this.destroyed=!0,this.detachEditor&&(this.detachEditor(),this.detachEditor=null);for(const e of this.cleanupFns)e();this.cleanupFns=[],this.e&&this.e.parentNode&&this.e.parentNode.removeChild(this.e),this.editor=null,this.e=null,this.buttons={}}}},e.Editor=class{constructor(e={}){var t;this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.customInlineGrammar={},this.mergedInlineGrammar=_t,this.hasFocus=!0,this.lastSelection=null,this.cleanupFns=[],this.ownsElement=!1,this.elementOriginalStyle=null,this.textareaOriginalDisplay=null,this.destroyed=!1,this.listeners={change:[],selection:[],drop:[]},this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.hasFocus=!0,this.lastSelection=null,this.customInlineGrammar=e.customInlineGrammar||{},this.mergedInlineGrammar=function(e={}){const t={..._t};for(const[n,i]of Object.entries(e)){const e={...i};let s=i.regexp.source;const r=new RegExp(Object.keys(Lt).join("|"));for(;s.match(r);)s=s.replace(r,(e=>Lt[e].source));e.regexp=new RegExp(s,i.regexp.flags),t[n]=e}return t}(this.customInlineGrammar),this.listeners={change:[],selection:[],drop:[]};let n=null;"string"==typeof e.element?n=document.getElementById(e.element):e.element&&(n=e.element),"string"==typeof e.textarea?this.textarea=document.getElementById(e.textarea):e.textarea&&(this.textarea=e.textarea),this.textarea&&(n||(n=this.textarea)),n||(n=document.getElementsByTagName("body")[0]),n&&"TEXTAREA"===n.tagName&&(this.textarea=n,n=this.textarea.parentNode),this.textarea&&(this.textareaOriginalDisplay=this.textarea.style.display,this.textarea.style.display="none"),this.placeholder=void 0!==e.placeholder?e.placeholder:(null===(t=this.textarea)||void 0===t?void 0:t.placeholder)||void 0,this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.createEditorElement(n,e),this.setContent("string"==typeof e.content?e.content:this.textarea?this.textarea.value:"# Hello TinyMDE!\nEdit **here**"),this.addListener(this.e,"keydown",(e=>this.handleUndoRedoKey(e)))}get canUndo(){return this.undoStack.length>=2}get canRedo(){return this.redoStack.length>0}pushHistory(){this.isRestoringHistory||(this.pushCurrentState(),this.redoStack=[])}pushCurrentState(){this.undoStack.push({content:this.getContent(),selection:this.getSelection(),anchor:this.getSelection(!0)}),this.undoStack.length>this.maxHistory&&this.undoStack.shift()}undo(){if(this.undoStack.length<2)return;this.isRestoringHistory=!0,this.pushCurrentState();const e=this.undoStack.pop();this.redoStack.push(e);const t=this.undoStack[this.undoStack.length-1];this.setContent(t.content),t.selection&&this.setSelection(t.selection,t.anchor),this.undoStack.pop(),this.isRestoringHistory=!1}redo(){if(!this.redoStack.length)return;this.isRestoringHistory=!0,this.pushCurrentState();const e=this.redoStack.pop();this.setContent(e.content),e.selection&&this.setSelection(e.selection,e.anchor),this.isRestoringHistory=!1}handleUndoRedoKey(e){(It.macPlatform.test(navigator.platform)?e.metaKey:e.ctrlKey)&&!e.altKey&&("z"===e.key||"Z"===e.key?(e.shiftKey?this.redo():this.undo(),e.preventDefault()):"y"!==e.key&&"Y"!==e.key||(this.redo(),e.preventDefault()))}createEditorElement(e,t){t&&void 0!==t.editor?"string"==typeof t.editor?this.e=document.getElementById(t.editor):this.e=t.editor:(this.e=document.createElement("div"),this.ownsElement=!0),this.ownsElement||(this.elementOriginalStyle=this.e.getAttribute("style")),this.e.classList.add("TinyMDE"),this.e.contentEditable="true",this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",this.placeholder&&this.e.setAttribute("data-placeholder",this.placeholder),void 0===t.editor&&(this.textarea&&this.textarea.parentNode===e&&this.textarea.nextSibling?e.insertBefore(this.e,this.textarea.nextSibling):e.appendChild(this.e)),this.addListener(this.e,"input",(e=>this.handleInputEvent(e))),this.addListener(this.e,"beforeinput",(e=>this.handleBeforeInputEvent(e))),this.addListener(this.e,"compositionend",(e=>this.handleInputEvent(e))),this.addListener(document,"selectionchange",(e=>{this.hasFocus&&this.handleSelectionChangeEvent(e)})),this.addListener(this.e,"blur",(()=>this.hasFocus=!1)),this.addListener(this.e,"focus",(()=>this.hasFocus=!0)),this.addListener(this.e,"paste",(e=>this.handlePaste(e))),this.addListener(this.e,"drop",(e=>this.handleDrop(e))),this.addListener(this.e,"click",(e=>this.handleClick(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(It.lineSplit),this.lineDirty=[];for(let e=0;e<this.lines.length;e++){let e=document.createElement("div");this.e.appendChild(e),this.lineDirty.push(!0)}this.lineTypes=new Array(this.lines.length),this.updateFormatting(),this.updatePlaceholder(),this.fireChange(),this.isRestoringHistory||this.pushHistory()}getContent(){return this.lines.join("\n")}updatePlaceholder(){this.placeholder&&this.e&&(""===this.getContent()?this.e.classList.add("TinyMDE_empty"):this.e.classList.remove("TinyMDE_empty"))}updateFormatting(){this.updateLineTypes(),this.updateLinkLabels(),this.applyLineTypes()}updateLinkLabels(){this.linkLabels=[];for(let e=0;e<this.lines.length;e++)"TMLinkReferenceDefinition"===this.lineTypes[e]&&this.linkLabels.push(this.lineCaptures[e][Nt.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(It.replacementPlaceholder,((e,n,i)=>"$"===n?zt(t[parseInt(i)]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[parseInt(i)])}</span>`))}applyLineTypes(){let e=0;for(;e<this.lines.length;)if(this.isInlineGroupLeader(e)){const t=this.lineTypes[e];let n=e;for(;n+1<this.lines.length&&this.isInlineContinuation(n+1,t);)n++;this.applyInlineGroup(e,n),e=n+1}else this.applyLine(e),e++}isInlineGroupLeader(e){const t=this.lineTypes[e];return"TMPara"===t||"TMUL"===t||"TMOL"===t||"TMBlockquote"===t&&!this.isBlankBlockquoteContent(e)}isInlineContinuation(e,t){const n=this.lineTypes[e];return"TMPara"===n||"TMBlockquote"===n&&"TMBlockquote"===t&&!this.isBlankBlockquoteContent(e)}isBlankBlockquoteContent(e){const t=this.lineCaptures[e],n=t&&void 0!==t[2]?t[2]:"";return It.blankContent.test(n)}applyLine(e){const t=this.lineElements[e];if(this.lineDirty[e]){let n=this.replace(this.lineReplacements[e],this.lineCaptures[e]);t.className=this.lineTypes[e],t.removeAttribute("style"),t.innerHTML=""===n?"<br />":n,delete t.dataset.mlSig}t.dataset.lineNum=e.toString()}applyInlineGroup(e,t){const n=[];let i=""+(t-e);for(let s=e;s<=t;s++){const e=this.inlineContentIndex(this.lineReplacements[s]);n.push(void 0!==this.lineCaptures[s][e]?this.lineCaptures[s][e]:""),i+=`${this.lineTypes[s]}${this.lineReplacements[s]}${JSON.stringify(this.lineCaptures[s])}`}const s=`${this.hashString(i)}`;let r=!1;for(let n=e;n<=t;n++)if(this.lineDirty[n]||this.lineElements[n].dataset.mlSig!==s){r=!0;break}if(r){const i=this.splitInlineHTMLByLine(this.processInlineStyles(n.join("\n")));for(let n=e;n<=t;n++){const t=this.lineElements[n],r=i[n-e]||"",l=this.replaceWithInline(this.lineReplacements[n],this.lineCaptures[n],r);t.className=this.lineTypes[n],t.removeAttribute("style"),t.innerHTML=""===l?"<br />":l,t.dataset.mlSig=s}}for(let n=e;n<=t;n++)this.lineElements[n].dataset.lineNum=n.toString()}inlineContentIndex(e){const t=It.inlineContentPlaceholder.exec(e);return t?parseInt(t[1]):0}replaceWithInline(e,t,n){return e.replace(It.replacementPlaceholder,((e,i,s)=>"$"===i?zt(t[parseInt(s)]):`<span class="TMInlineFormatted">${n}</span>`))}splitInlineHTMLByLine(e){const t=[],n=[];let i="",s=0;for(;s<e.length;){const r=e[s];if("\n"===r){for(let e=n.length-1;e>=0;e--)i+=`</${this.inlineTagName(n[e])}>`;t.push(i),i=n.join(""),s++}else if("<"===r){const t=e.indexOf(">",s);if(t<0){i+=e.substr(s);break}const r=e.substring(s,t+1);i+=r,"/"===r[1]?n.pop():"/"!==r[r.length-2]&&n.push(r),s=t+1}else i+=r,s++}return t.push(i),t}inlineTagName(e){const t=It.inlineTagName.exec(e);return t?t[1]:"span"}hashString(e){let t=5381;for(let n=0;n<e.length;n++)t=((t<<5)+t^e.charCodeAt(n))>>>0;return t}updateLineTypes(){let e=!1,t=0,n=!1;for(let i=0;i<this.lines.length;i++){let s="TMPara",r=[this.lines[i]],l="$$0";if("TMCodeFenceBacktickOpen"===e){let n=Nt.TMCodeFenceBacktickClose.regexp.exec(this.lines[i]);n&&n.groups.seq.length>=t?(s="TMCodeFenceBacktickClose",l=Nt.TMCodeFenceBacktickClose.replacement,r=n,e=!1):(s="TMFencedCodeBacktick",l='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[i]])}else if("TMCodeFenceTildeOpen"===e){let n=Nt.TMCodeFenceTildeClose.regexp.exec(this.lines[i]);n&&n.groups.seq.length>=t?(s="TMCodeFenceTildeClose",l=Nt.TMCodeFenceTildeClose.replacement,r=n,e=!1):(s="TMFencedCodeTilde",l='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[i]])}if("TMPara"===s&&!1===n)for(let e of Ot)if(this.lines[i].match(e.start)&&(e.paraInterrupt||0===i||"TMPara"!==this.lineTypes[i-1]&&"TMUL"!==this.lineTypes[i-1]&&"TMOL"!==this.lineTypes[i-1]&&"TMBlockquote"!==this.lineTypes[i-1])){n=e;break}if(!1!==n&&(s="TMHTMLBlock",l='<span class="TMHTMLContent">$0<br /></span>',r=[this.lines[i]],n.end?this.lines[i].match(n.end)&&(n=!1):(i===this.lines.length-1||this.lines[i+1].match(Nt.TMBlankLine.regexp))&&(n=!1)),"TMPara"===s)for(let e in Nt)if(Nt[e].regexp){let t=Nt[e].regexp.exec(this.lines[i]);if(t){s=e,l=Nt[e].replacement,r=t;break}}if("TMCodeFenceBacktickOpen"!==s&&"TMCodeFenceTildeOpen"!==s||(e=s,t=r.groups.seq.length),"TMIndentedCode"!==s&&"TMLinkReferenceDefinition"!==s||!(i>0)||"TMPara"!==this.lineTypes[i-1]&&"TMUL"!==this.lineTypes[i-1]&&"TMOL"!==this.lineTypes[i-1]&&"TMBlockquote"!==this.lineTypes[i-1]||(s="TMPara",r=[this.lines[i]],l="$$0"),"TMSetextH2Marker"===s){let e=Nt.TMUL.regexp.exec(this.lines[i]);e&&(s="TMUL",l=Nt.TMUL.replacement,r=e)}if("TMSetextH1Marker"===s||"TMSetextH2Marker"===s)if(0===i||"TMPara"!==this.lineTypes[i-1]){let e=Nt.TMHR.regexp.exec(this.lines[i]);e?(s="TMHR",r=e,l=Nt.TMHR.replacement):(s="TMPara",r=[this.lines[i]],l="$$0")}else{let e=i-1;const t="TMSetextH1Marker"===s?"TMSetextH1":"TMSetextH2";do{this.lineTypes[e]!==t&&(this.lineTypes[e]=t,this.lineDirty[e]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"===this.lineTypes[e])}if("TMUL"===s||"TMOL"===s){const e=void 0!==r[2]?r[2]:"",t=It.taskListItem.exec(e);if(t){const e="TMUL"===s?"TMMark_TMUL":"TMMark_TMOL",n=" "!==t[2]?"TMCheckbox TMCheckbox_checked":"TMCheckbox TMCheckbox_unchecked";r=[r[0],r[1],t[1],t[2],t[3],t[4],t[5]],l=`<span class="TMMark ${e}">$1</span><span class="TMMark TMMark_TMTask">$2</span><span class="${n}">$3</span><span class="TMMark TMMark_TMTask">$4</span><span class="TMMark TMMark_TMTask">$5</span>$$6`}}this.lineTypes[i]!==s&&(this.lineTypes[i]=s,this.lineDirty[i]=!0),this.lineReplacements[i]=l,this.lineCaptures[i]=r}}getSelection(e=!1){var t,n;const i=window.getSelection();let s=e?i.anchorNode:i.focusNode;if(!s)return null;let r=e?i.anchorOffset:i.focusOffset;if(s===this.e)return r<this.lines.length?{row:r,col:0}:{row:r-1,col:this.lines[r-1].length};let l=this.computeColumn(s,r);if(null===l)return null;let a=s;for(;a.parentElement!==this.e;)a=a.parentElement;let o=0;if(a.previousSibling){const e=null===(t=a.dataset)||void 0===t?void 0:t.lineNum,i=null===(n=a.previousSibling.dataset)||void 0===n?void 0:n.lineNum;if(e&&i){const t=parseInt(e);if(t===parseInt(i)+1)o=t;else for(;a.previousSibling;)o++,a=a.previousSibling}}return{row:o,col:l}}setSelection(e,t=null){if(!e)return;let{node:n,offset:i}=this.computeNodeAndOffset(e.row,e.col,!!t&&(t.row===e.row&&t.col>e.col)),s=null,r=null;if(t&&(t.row!==e.row||t.col!==e.col)){let{node:n,offset:i}=this.computeNodeAndOffset(t.row,t.col,e.row===t.row&&e.col>t.col);s=n,r=i}window.getSelection().setBaseAndExtent(n,i,s||n,s?r:i)}restoreLastSelection(){return!(!this.lastSelection||!this.lastSelection.focus)&&(this.setSelection(this.lastSelection.focus,this.lastSelection.anchor),!0)}paste(e,t=null,n=null){let i,s;t||(t=this.getSelection(!0)),n||(n=this.getSelection(!1)),n||(n={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),t||(t=n),t.row<n.row||t.row===n.row&&t.col<=n.col?(i=t,s=n):(i=n,s=t);let r=e.split(It.lineSplit),l=this.lines[i.row].substr(0,i.col),a=this.lines[s.row].substr(s.col);r[0]=l.concat(r[0]);let o=r[r.length-1].length;r[r.length-1]=r[r.length-1].concat(a),this.spliceLines(i.row,1+s.row-i.row,r),n.row=i.row+r.length-1,n.col=o,this.updateFormatting(),this.setSelection(n),this.fireChange()}wrapSelection(e,t,n=null,i=null){if(n||(n=this.getSelection(!1)),i||(i=this.getSelection(!0)),!n||!i||n.row!==i.row)return;this.isRestoringHistory||this.pushHistory(),this.lineDirty[n.row]=!0;const s=n.col<i.col?n.col:i.col,r=n.col<i.col?i.col:n.col,l=this.lines[n.row].substr(0,s).concat(e),a=r===s?"":this.lines[n.row].substr(s,r-s),o=t.concat(this.lines[n.row].substr(r));this.lines[n.row]=l.concat(a,o),i.col=l.length,n.col=i.col+a.length,this.updateFormatting(),this.setSelection(n,i),this.fireChange()}addEventListener(e,t){e.match(It.changeEvent)&&this.listeners.change.push(t),e.match(It.selectionEvent)&&this.listeners.selection.push(t),e.match(It.dropEvent)&&this.listeners.drop.push(t)}removeEventListener(e,t){e.match(It.changeEvent)&&(this.listeners.change=this.listeners.change.filter((e=>e!==t))),e.match(It.selectionEvent)&&(this.listeners.selection=this.listeners.selection.filter((e=>e!==t))),e.match(It.dropEvent)&&(this.listeners.drop=this.listeners.drop.filter((e=>e!==t)))}addListener(e,t,n){e.addEventListener(t,n),this.cleanupFns.push((()=>e.removeEventListener(t,n)))}destroy(){var e;if(!this.destroyed){this.destroyed=!0;for(const e of this.cleanupFns)e();if(this.cleanupFns=[],this.e)if(this.ownsElement)this.e.parentNode&&this.e.parentNode.removeChild(this.e);else{for(this.e.classList.remove("TinyMDE","TinyMDE_empty"),this.e.removeAttribute("contenteditable"),this.e.removeAttribute("data-placeholder");this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.elementOriginalStyle?this.e.setAttribute("style",this.elementOriginalStyle):this.e.removeAttribute("style")}this.textarea&&(this.textarea.style.display=null!==(e=this.textareaOriginalDisplay)&&void 0!==e?e:""),this.listeners={change:[],selection:[],drop:[]},this.e=null,this.textarea=null}}fireChange(){if(this.updatePlaceholder(),!this.textarea&&!this.listeners.change.length)return;const e=this.getContent();this.textarea&&(this.textarea.value=e);for(let t of this.listeners.change)t({content:e,linesDirty:[...this.lineDirty]})}handleBeforeInputEvent(e){const t=e;if("deleteContentBackward"===t.inputType||"deleteContentForward"===t.inputType){const n=this.getSelection(),i=this.getSelection(!0);if(!n||!i)return;const s="deleteContentBackward"===t.inputType;if(n.row===i.row&&n.col===i.col){if(s&&0===n.col&&n.row>0){e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const t=this.lines[n.row-1].length;return this.lines[n.row-1]=this.lines[n.row-1]+this.lines[n.row],this.lineDirty[n.row-1]=!0,this.spliceLines(n.row,1),this.updateFormatting(),this.setSelection({row:n.row-1,col:t}),void this.fireChange()}if(!s&&n.col===this.lines[n.row].length&&n.row<this.lines.length-1){e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const t=this.lines[n.row].length;return this.lines[n.row]=this.lines[n.row]+this.lines[n.row+1],this.lineDirty[n.row]=!0,this.spliceLines(n.row+1,1),this.updateFormatting(),this.setSelection({row:n.row,col:t}),void this.fireChange()}}return}if("insertParagraph"!==t.inputType&&"insertLineBreak"!==t.inputType)return;this.isRestoringHistory||this.pushHistory(),e.preventDefault(),this.clearDirtyFlag();const n=this.getSelection(),i=this.getSelection(!0);if(n&&i){if(n.row!==i.row){const e=n.row<i.row?n:i,t=n.row<i.row?i:n;this.lines[e.row]=this.lines[e.row].substring(0,e.col),this.lines[t.row]=this.lines[t.row].substring(t.col),this.spliceLines(e.row+1,t.row-e.row-1),n.row=e.row+1,n.col=0}else{let e=!1;switch(this.lineTypes[n.row]){case"TMUL":e="TMUL";break;case"TMOL":e="TMOL";break;case"TMIndentedCode":e="TMIndentedCode"}const t=this.lines[n.row].substring(0,n.col<=i.col?n.col:i.col),s=this.lines[n.row].substring(n.col<=i.col?i.col:n.col);if(this.spliceLines(n.row,1,[t,s]),n.row+=1,n.col=0,e){let t=Nt[e].regexp.exec(this.lines[n.row-1]);t&&(t[2]?("TMOL"===e&&(t[1]=t[1].replace(It.orderedListNumber,(e=>(parseInt(e)+1).toString()))),this.lines[n.row]=`${t[1]}${this.lines[n.row]}`,this.lineDirty[n.row]=!0,n.col=t[1].length):(this.lines[n.row-1]="",this.lineDirty[n.row-1]=!0))}}this.updateFormatting(),this.setSelection(n),n&&n.row<this.lineElements.length&&this.lineElements[n.row].scrollIntoView({block:"nearest",inline:"nearest"}),this.fireChange()}}handleInputEvent(e){const t=e;if("insertCompositionText"===t.inputType)return;this.isRestoringHistory||this.pushHistory();let n=this.getSelection();("insertParagraph"!==t.inputType&&"insertLineBreak"!==t.inputType||!n)&&(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting(),n&&this.setSelection(n),this.fireChange())}handleSelectionChangeEvent(e){this.fireSelection()}handlePaste(e){this.isRestoringHistory||this.pushHistory(),e.preventDefault();let t=e.clipboardData.getData("text/plain");this.paste(t)}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleClick(e){const t=e.target,n=t&&t.closest?t.closest(".TMCheckbox"):null;if(!n)return;let i=n;for(;i&&i.parentNode!==this.e;)i=i.parentNode;if(!i||void 0===i.dataset.lineNum)return;const s=parseInt(i.dataset.lineNum,10);if(isNaN(s)||s<0||s>=this.lines.length)return;const r=this.computeColumn(n,0);if(null===r)return;const l=this.lines[s].charAt(r);if(" "!==l&&"x"!==l&&"X"!==l)return;e.preventDefault(),this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();const a=" "===l?"x":" ";this.lines[s]=this.lines[s].substr(0,r)+a+this.lines[s].substr(r+1),this.lineDirty[s]=!0,this.updateFormatting(),this.fireChange()}processInlineStyles(e){let t="",n=[],i=0,s=e;e:for(;s;){if(10===s.charCodeAt(0)){t+="\n",s=s.substr(1),i+=1;continue e}for(let e of["escape","code","autolink","html"])if(this.mergedInlineGrammar[e]){let n=this.mergedInlineGrammar[e].regexp.exec(s);if(n){s=s.substr(n[0].length),i+=n[0].length,t+=this.mergedInlineGrammar[e].replacement.replace(It.inlineReplacementPlaceholder,((e,t)=>zt(n[t])));continue e}}for(let e in this.customInlineGrammar)if("escape"!==e&&"code"!==e&&"autolink"!==e&&"html"!==e&&"linkOpen"!==e&&"imageOpen"!==e&&"linkLabel"!==e&&"default"!==e){let n=this.mergedInlineGrammar[e].regexp.exec(s);if(n){s=s.substr(n[0].length),i+=n[0].length,t+=this.mergedInlineGrammar[e].replacement.replace(It.inlineReplacementPlaceholder,((e,t)=>zt(n[t])));continue e}}const r=i>0?e[i-1]:"";if(""===r||It.autolinkPrecedingChar.test(r)){let e=this.parseAutolinkExtension(s);if(e){t=`${t}${e.output}`,s=s.substr(e.charCount),i+=e.charCount;continue e}}let l=s.match(this.mergedInlineGrammar.linkOpen.regexp),a=s.match(this.mergedInlineGrammar.imageOpen.regexp);if(a||l){let e=this.parseLinkOrImage(s,!!a);if(e){t=`${t}${e.output}`,s=s.substr(e.charCount),i+=e.charCount;continue e}}let o=It.emphasisDelimiter.exec(s);if(o){let r=o[0].length;const l=o[0],a=o[0][0];s=s.substr(o[0].length);const u=i>0?e.substr(0,i):" ",h=i+o[0].length<e.length?s:" ",c=h.match(Ht),p=u.match(Bt),d=h.match(It.leadingWhitespace),m=u.match(It.trailingWhitespace);let g=!(d||c&&!m&&!p),f=!(m||p&&!d&&!c);if("_"===a&&g&&f&&(g=!!p,f=!!c),f){let e=n.length-1;for(;r&&e>=0;)if(n[e].delimiter===a){for(;e<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}if(r>=2&&n[e].count>=2?(t=`<span class="TMMark">${a}${a}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${a}${a}</span>`,r-=2,n[e].count-=2):(t=`<span class="TMMark">${a}</span><em class="TMEm">${t}</em><span class="TMMark">${a}</span>`,r-=1,n[e].count-=1),0===n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}r&&g&&(n.push({delimiter:a,delimString:l,count:r,output:t}),t="",r=0),r&&(t=`${t}${l.substr(0,r)}`),i+=o[0].length}else if(o=It.strikethroughDelimiter.exec(s),o){let e=!1,r=n.length-1;for(;!e&&r>=0;)if("~"===n[r].delimiter){for(;r<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}t=`<span class="TMMark">~~</span><del class="TMStrikethrough">${t}</del><span class="TMMark">~~</span>`,t=`${n.pop().output}${t}`,e=!0}else r--;e||(n.push({delimiter:"~",delimString:"~~",count:2,output:t}),t=""),i+=o[0].length,s=s.substr(o[0].length)}else{if(o=this.mergedInlineGrammar.default.regexp.exec(s),!o)throw"Infinite loop!";s=s.substr(o[0].length),i+=o[0].length,t+=this.mergedInlineGrammar.default.replacement.replace(It.inlineReplacementPlaceholder,((e,t)=>zt(o[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}computeColumn(e,t){let n,i=e;for(;i&&i.parentNode!==this.e;)i=i.parentNode;if(null===i)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,i=e):t>0?(i=e.childNodes[t-1],n=i.textContent.length):(n=0,i=e);i.parentNode!==this.e;)i.previousSibling?(i=i.previousSibling,n+=i.textContent.length):i=i.parentNode;return n}computeNodeAndOffset(e,t,n=!1){e>=this.lineElements.length&&(e=this.lineElements.length-1,t=this.lines[e].length),t>this.lines[e].length&&(t=this.lines[e].length);const i=this.lineElements[e];let s=i.firstChild,r=!1,l={node:i.firstChild?i.firstChild:i,offset:0};for(;s!==i;){if(!r&&s.nodeType===Node.TEXT_NODE)if(s.nodeValue.length>=t){if(!n||s.nodeValue.length!==t)return{node:s,offset:t};l={node:s,offset:t},t=0}else t-=s.nodeValue.length;!r&&s.firstChild?s=s.firstChild:s.nextSibling?(r=!1,s=s.nextSibling):(r=!0,s=s.parentNode)}return l}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}clearDirtyFlag(){this.lineDirty=new Array(this.lines.length);for(let e=0;e<this.lineDirty.length;e++)this.lineDirty[e]=!1}updateLineContents(){let e=this.e.childElementCount-this.lines.length;if(e){let t=0;for(;t<=this.lines.length&&t<=this.lineElements.length&&this.lineElements[t]&&this.lines[t]===this.lineElements[t].textContent&&this.lineTypes[t]===this.lineElements[t].className;)t++;let n=-1;for(;-n<this.lines.length&&-n<this.lineElements.length&&this.lines[this.lines.length+n]===this.lineElements[this.lineElements.length+n].textContent&&this.lineTypes[this.lines.length+n]===this.lineElements[this.lineElements.length+n].className;)n--;let i=this.lines.length+n+1-t;i<-e&&(i=-e),i<0&&(i=0);let s=[];for(let n=0;n<i+e;n++)s.push(this.lineElements[t+n].textContent||"");this.spliceLines(t,i,s,!1)}else for(let e=0;e<this.lineElements.length;e++){let t=this.lineElements[e],n=t.textContent||"";this.lines[e]===n&&this.lineTypes[e]===t.className||(this.lines[e]=n,this.lineTypes[e]=t.className,this.lineDirty[e]=!0)}}spliceLines(e,t=0,n=[],i=!0){if(i)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let s=[],r=[];for(let t=0;t<n.length;t++)s.push(""),r.push(!0),i&&(this.e.childNodes[e]?this.e.insertBefore(document.createElement("div"),this.e.childNodes[e]):this.e.appendChild(document.createElement("div")));this.lines.splice(e,t,...n),this.lineTypes.splice(e,t,...s),this.lineDirty.splice(e,t,...r)}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=(e,...t)=>{const n=e.parentElement,i=e.nextSibling;n.removeChild(e),t.forEach((e=>i?n.insertBefore(e,i):n.appendChild(e)))};e.forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE||"DIV"!==e.tagName){const n=document.createElement("div");t(e,n),n.appendChild(e)}else if(0===e.childNodes.length)e.appendChild(document.createElement("br"));else{const n=Array.from(e.childNodes);if(n.some((e=>e.nodeType===Node.ELEMENT_NODE&&"DIV"===e.tagName)))return t(e,...n)}}))}parseAutolinkExtension(e){const t=this.matchExtendedAutolink(e);return!!t&&{output:`<span class="TMAutolink">${zt(t)}</span>`,charCount:t.length}}matchExtendedAutolink(e){const t=It.autolinkScheme.exec(e),n=It.autolinkWww.test(e);if(t||n){const n=t?t[0].length:0,i=e.substr(n),s=It.autolinkDomain.exec(i);if(s&&this.isValidAutolinkDomain(s[0])){const t=It.autolinkPath.exec(i.substr(s[0].length)),r=e.substr(0,n+s[0].length+(t?t[0].length:0)),l=this.trimAutolinkTrailing(r);if(l.length>=n+s[0].length)return l}}const i=It.autolinkProtocol.exec(e);if(i){const t=this.matchAutolinkEmail(e.substr(i[0].length));if(t){let n="";if(It.autolinkXmpp.test(e)){const s=It.autolinkXmppResource.exec(e.substr(i[0].length+t.length));s&&(n=s[0])}return i[0]+t+n}}const s=this.matchAutolinkEmail(e);return s||!1}isValidAutolinkDomain(e){const t=e.split(".");return!(t.length<2)&&!t.slice(-2).some((e=>e.indexOf("_")>=0))}matchAutolinkEmail(e){const t=It.autolinkEmail.exec(e);if(!t)return!1;let n=t[0];for(;n.length&&It.emailTrailingChar.test(n);)n=n.substr(0,n.length-1);return!!It.emailTld.test(n)&&n}trimAutolinkTrailing(e){let t=e.length,n=!0;for(;n&&t>0;){n=!1;const i=e[t-1];if("?!.,:*_~".indexOf(i)>=0)t--,n=!0;else if(")"===i){let i=0,s=0;for(let n=0;n<t;n++)"("===e[n]?i++:")"===e[n]&&s++;s>i&&(t--,n=!0)}}return e.substr(0,t)}parseLinkOrImage(e,t){let n=t?2:1,i=e.substr(0,n),s=t?"TMImage":"TMLink",r=n,l=1,a=!1,o=!1,u=[],h=[];e:for(;r<e.length&&!1===a;){let i=e.substr(r);for(let e of["escape","code","autolink","html"]){let t=this.mergedInlineGrammar[e].regexp.exec(i);if(t){r+=t[0].length;continue e}}if(i.match(this.mergedInlineGrammar.imageOpen.regexp))l++,r+=2;else if(i.match(this.mergedInlineGrammar.linkOpen.regexp)){if(l++,!t&&this.parseLinkOrImage(i,!1))return!1;r+=1}else i.match(It.linkClosingBracket)&&(l--,0===l)?(a=e.substr(n,r-n),r++):r++}if(!1===a)return!1;let c=r<e.length?e.substr(r,1):"";if("["===c){let t=e.substr(r),n=this.mergedInlineGrammar.linkLabel.regexp.exec(t);if(!n)return!1;r+=n[0].length,u.push(n[1],n[2],n[3]),o=n[this.mergedInlineGrammar.linkLabel.labelPlaceholder]?n[this.mergedInlineGrammar.linkLabel.labelPlaceholder]:a.trim()}else if("("!==c)o=a.trim();else{r++;let t=1;for(;r<e.length&&t>0;){let n=e.substr(r),i=It.leadingWhitespaceRun.exec(n);if(i){switch(h.length){case 0:case 1:h.push(i[0]);break;case 2:if(h[0].match(It.containsOpenAngle))h[1]=h[1].concat(i[0]);else{if(1!==t)return!1;h.push(""),h.push(i[0])}break;case 3:h.push(i[0]);break;case 4:return!1;case 5:h.push("");case 6:h[5]=h[5].concat(i[0]);break;case 7:h[6]=h[6].concat(i[0]);break;default:return!1}r+=i[0].length}else if(i=this.mergedInlineGrammar.escape.regexp.exec(n),i){switch(h.length){case 0:h.push("");case 1:h.push(i[0]);break;case 2:h[1]=h[1].concat(i[0]);break;case 3:case 4:return!1;case 5:h.push("");case 6:h[5]=h[5].concat(i[0]);break;default:return!1}r+=i[0].length}else if(h.length<2&&n.match(It.openingAngle))0===h.length&&h.push(""),h[0]=h[0].concat("<"),r++;else if(1!==h.length&&2!==h.length||!n.match(It.closingAngle))if(i=It.titleQuote.exec(n),!i||0!==h.length&&1!==h.length&&4!==h.length)if(!i||5!==h.length&&6!==h.length||h[4]!==i[0])if(n.match(It.openingParen)){switch(h.length){case 0:h.push("");case 1:h.push("");case 2:h[1]=h[1].concat("("),h[0].match(It.endsWithOpenAngle)||t++;break;case 3:h.push("");case 4:h.push("(");break;case 5:h.push("");case 6:if("("===h[4])return!1;h[5]=h[5].concat("(");break;default:return!1}r++}else if(n.match(It.closingParen)){if(h.length<=2){for(;h.length<2;)h.push("");h[0].match(It.endsWithOpenAngle)||t--,t>0&&(h[1]=h[1].concat(")"))}else 5===h.length||6===h.length?"("===h[4]?(5===h.length&&h.push(""),h.push(")")):5===h.length?h.push(")"):h[5]=h[5].concat(")"):t--;if(0===t)for(;h.length<7;)h.push("");r++}else{if(i=It.anyChar.exec(n),!i)throw"Infinite loop";switch(h.length){case 0:h.push("");case 1:h.push(i[0]);break;case 2:h[1]=h[1].concat(i[0]);break;case 3:case 4:return!1;case 5:h.push("");case 6:h[5]=h[5].concat(i[0]);break;default:return!1}r+=i[0].length}else 5===h.length&&h.push(""),h.push(i[0]),r++;else{for(;h.length<4;)h.push("");h.push(i[0]),r++}else 1===h.length&&h.push(""),h.push(">"),r++}if(t>0)return!1}if(!1!==o){let e=!1;for(let t of this.linkLabels)if(t===o){e=!0;break}let t=e?"TMLinkLabel TMLinkLabel_Valid":"TMLinkLabel TMLinkLabel_Invalid",n=`<span class="TMMark TMMark_${s}">${i}</span><span class="${s} ${u.length<3||!u[1]?t:""}">${this.processInlineStyles(a)}</span><span class="TMMark TMMark_${s}">]</span>`;return u.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${s}">${u[0]}</span>`,`<span class="${t}">${u[1]}</span>`,`<span class="TMMark TMMark_${s}">${u[2]}</span>`)),{output:n,charCount:r}}if(h.length>0){for(;h.length<7;)h.push("");return{output:`<span class="TMMark TMMark_${s}">${i}</span><span class="${s}">${this.processInlineStyles(a)}</span><span class="TMMark TMMark_${s}">](${zt(h[0])}</span><span class="${s}Destination">${zt(h[1])}</span><span class="TMMark TMMark_${s}">${zt(h[2])}${zt(h[3])}${zt(h[4])}</span><span class="${s}Title">${zt(h[5])}</span><span class="TMMark TMMark_${s}">${zt(h[6])})</span>`,charCount:r}}return!1}computeCommonAncestor(e,t){if(!e||!t)return null;if(e===t)return e;const n=e=>{let t=[];for(;e;)t.unshift(e),e=e.parentNode;return t},i=n(e),s=n(t);if(i[0]!==s[0])return null;let r;for(r=0;i[r]===s[r];r++);return i[r-1]}computeEnclosingMarkupNode(e,t,n){let i=null;if(!e)return null;if(t){if(e.row!==t.row)return null;const n=window.getSelection();if(!n)return null;i=this.computeCommonAncestor(n.focusNode,n.anchorNode)}else{const e=window.getSelection();if(!e||!e.focusNode)return null;i=e.focusNode}if(!i)return null;for(;i!==this.e;){if(i.classList&&i.classList.contains(n))return i;i=i.parentNode}return null}getCommandState(e=null,t=null){let n,i,s={};if(e||(e=this.getSelection(!1)),t||(t=this.getSelection(!0)),!e){for(let e in jt)s[e]=null;return s}t||(t=e),t.row<e.row||t.row===e.row&&t.col<e.col?(n=t,i=e):(n=e,i=t),i.row>n.row&&0===i.col&&(i.row--,i.col=this.lines[i.row].length);for(let r in jt)if("inline"===jt[r].type&&(e&&e.row===t.row&&this.isInlineFormattingAllowed()?s[r]=!!this.computeEnclosingMarkupNode(e,t,jt[r].className)||e.col===t.col&&!!this.lines[e.row].substr(0,e.col).match(jt[r].unset.prePattern)&&!!this.lines[e.row].substr(e.col).match(jt[r].unset.postPattern):s[r]=null),"line"===jt[r].type)if(e){let e=this.lineTypes[n.row]===jt[r].className;for(let t=n.row;t<=i.row;t++)if(this.lineTypes[t]===jt[r].className!==e){e=null;break}s[r]=e}else s[r]=null;return s}setCommandState(e,t){if(this.isRestoringHistory||this.pushHistory(),"inline"===jt[e].type){let t=this.getSelection(!0),n=this.getSelection(!1);if(t||(t=n),!t)return;if(t.row!==n.row)return;if(!this.isInlineFormattingAllowed())return;let i=this.computeEnclosingMarkupNode(n,t,jt[e].className);if(this.clearDirtyFlag(),i){this.lineDirty[n.row]=!0;const s=this.computeColumn(i,0),r=i.textContent.length,l=this.lines[n.row].substr(0,s).replace(jt[e].unset.prePattern,""),a=this.lines[n.row].substr(s,r),o=this.lines[n.row].substr(s+r).replace(jt[e].unset.postPattern,"");this.lines[n.row]=l.concat(a,o),t.col=l.length,n.col=t.col+r,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else if(n.col===t.col&&this.lines[n.row].substr(0,n.col).match(jt[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(jt[e].unset.postPattern)){this.lineDirty[n.row]=!0;const i=this.lines[n.row].substr(0,n.col).replace(jt[e].unset.prePattern,""),s=this.lines[n.row].substr(n.col).replace(jt[e].unset.postPattern,"");this.lines[n.row]=i.concat(s),n.col=t.col=i.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let{startCol:i,endCol:s}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},r=this.lines[n.row].substr(i,s-i).match(It.surroundingWhitespace);r&&(i+=r.groups.leading.length,s-=r.groups.trailing.length),n.col=i,t.col=s,this.wrapSelection(jt[e].set.pre,jt[e].set.post,n,t)}}else if("line"===jt[e].type){let n=this.getSelection(!0),i=this.getSelection(!1);if(n||(n=i),!i)return;this.clearDirtyFlag();let s=n.row>i.row?i:n,r=n.row>i.row?n:i;r.row>s.row&&0===r.col&&r.row--;for(let n=s.row;n<=r.row;n++)t&&this.lineTypes[n]!==jt[e].className&&(this.lines[n]=this.lines[n].replace(jt[e].set.pattern,jt[e].set.replacement.replace("$#",(n-s.row+1).toString())),this.lineDirty[n]=!0),t||this.lineTypes[n]!==jt[e].className||(this.lines[n]=this.lines[n].replace(jt[e].unset.pattern,jt[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:r.row,col:this.lines[r.row].length},{row:s.row,col:0}),this.fireChange()}}listItemMarker(e){const t=Nt.TMUL.regexp.exec(e);if(t)return t[1];const n=Nt.TMOL.regexp.exec(e);return n?n[1]:null}isTaskListItem(e){if(e<0||e>=this.lines.length)return!1;const t=this.lineTypes[e];if("TMUL"!==t&&"TMOL"!==t)return!1;const n=this.listItemMarker(this.lines[e]);return null!==n&&It.taskListItem.test(this.lines[e].substr(n.length))}addTaskCheckbox(e){const t=this.listItemMarker(e);if(null!==t){const n=e.substr(t.length);return It.taskListItem.test(n)?e:`${t}[ ] ${n}`}return e.replace(jt.ul.set.pattern,"- [ ] $2")}removeTaskCheckbox(e){const t=this.listItemMarker(e);if(null===t)return e;const n=It.taskListItem.exec(e.substr(t.length));return n?`${t}${n[5]}`:e}toggleTaskList(){let e=this.getSelection(!0),t=this.getSelection(!1);if(e||(e=t),!t)return;let n=e.row>t.row?t:e,i=e.row>t.row?e:t;i.row>n.row&&0===i.col&&i.row--;let s=!0;for(let e=n.row;e<=i.row;e++)if(!this.isTaskListItem(e)){s=!1;break}this.isRestoringHistory||this.pushHistory(),this.clearDirtyFlag();for(let e=n.row;e<=i.row;e++){const t=s?this.removeTaskCheckbox(this.lines[e]):this.addTaskCheckbox(this.lines[e]);t!==this.lines[e]&&(this.lines[e]=t,this.lineDirty[e]=!0)}this.updateFormatting(),this.setSelection({row:i.row,col:this.lines[i.row].length},{row:n.row,col:0}),this.fireChange()}isInlineFormattingAllowed(){const e=window.getSelection();if(!e||!e.focusNode||!e.anchorNode)return!1;if(e.isCollapsed&&3===e.focusNode.nodeType&&e.focusOffset===e.focusNode.nodeValue.length){let t;for(t=e.focusNode;t&&null===t.nextSibling;t=t.parentNode);if(t&&t.nextSibling&&t.nextSibling.classList&&t.nextSibling.classList.contains("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!==this.e;){if(t.classList&&(t.classList.contains("TMInlineFormatted")||t.classList.contains("TMBlankLine")))return!0;t=t.parentNode}return!1}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}fireSelection(){let e=this.getSelection(!1),t=this.getSelection(!0);if(this.lastSelection={focus:e,anchor:t},this.listeners.selection&&this.listeners.selection.length){let n=this.getCommandState(e,t);this.lastCommandState?Object.assign(this.lastCommandState,n):this.lastCommandState=Object.assign({},n);for(let n of this.listeners.selection)n({focus:e,anchor:t,commandState:this.lastCommandState})}}}}));
|