tiny-markdown-editor 0.1.30 → 0.1.32

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.
@@ -1 +1 @@
1
- .TinyMDE{background-color:#fff;color:#000;font-size:16px;height:100%;line-height:24px;outline:none;padding:5px}.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}.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{-ms-overflow-style:none;background-color:#f8f8f8;border:4px solid #f8f8f8;box-sizing:content-box;display:flex;height:24px;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;-webkit-user-select:none;user-select:none}.TMCommandBar::-webkit-scrollbar{display:none}.TMCommandButton{fill:#404040;box-sizing:border-box;color:#404040;cursor:pointer;display:inline-block;font-family:sans-serif;font-size:20px;height:24px;line-height:18px;margin-right:4px;padding:3px;text-align:center;vertical-align:middle;width:24px}.TMCommandDivider{border-left:1px solid silver;border-right:1px solid #fff;box-sizing:content-box;height:24px;margin-left:4px;margin-right:8px;width:0}.TMCommandButton_Active{fill:navy;background-color:#c0c0ff;color:navy;font-weight:700}.TMCommandButton_Inactive{background-color:#f8f8f8}.TMCommandButton_Disabled{fill:#a0a0a0;color:#a0a0a0}@media (hover:hover){.TMCommandButton_Active:hover,.TMCommandButton_Disabled:hover,.TMCommandButton_Inactive:hover{fill:#000;background-color:#e0e0ff}}
1
+ .TinyMDE{background-color:#fff;color:#000;font-size:16px;height:100%;line-height:24px;outline:none;padding:5px}.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}.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}}
@@ -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";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>',clear_formatting:'<svg height="18" width="18"><path d="M11.03 1a1 1 0 00-.74.3l-9 9a1 1 0 000 1.4l4 4A1 1 0 006 16h2a1 1 0 00.7-.3l8-8a1 1 0 000-1.4l-5-5a1 1 0 00-.67-.3zM8.7 5.7l3.58 3.6L7.6 14H6.4l-3-3 5.3-5.3z"/><rect ry=".8" rx=".8" y="14" x="16" height="2" width="2"/><rect width="2" height="2" x="13" y="14" rx=".8" ry=".8"/><rect ry=".8" rx=".8" y="14" x="10" height="2" width="2"/></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" style="font-variation-settings:normal;marker:none"/></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>',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>',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>'},n=/(Mac|iPhone|iPod|iPad)/i.test("undefined"!=typeof navigator?navigator.platform:""),s={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"},insertLink:{name:"insertLink",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&null,innerHTML:t.link,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&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"}};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math===Math&&e},a=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i&&i)||function(){return this}()||i||Function("return this")(),l=function(e){try{return!!e()}catch(e){return!0}},o=!l((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={},c={get exports(){return u},set exports(e){u=e}},h=!l((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),p=h,d=Function.prototype,g=d.call,m=p&&d.bind.bind(g,g),f=p?m:function(e){return function(){return g.apply(e,arguments)}},M="object"==typeof document&&document.all,T={all:M,IS_HTMLDDA:void 0===M&&void 0!==M},D=T.all,F=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===D}:function(e){return"function"==typeof e},y=function(e){return null==e},C=y,k=TypeError,b=function(e){if(C(e))throw new k("Can't call method on "+e);return e},E=Object,$=function(e){return E(b(e))},A=f({}.hasOwnProperty),w=Object.hasOwn||function(e,t){return A($(e),t)},v=o,x=w,S=Function.prototype,L=v&&Object.getOwnPropertyDescriptor,B=x(S,"name"),N={EXISTS:B,PROPER:B&&"something"===function(){}.name,CONFIGURABLE:B&&(!v||v&&L(S,"name").configurable)},H=a,_=Object.defineProperty,I=function(e,t){try{_(H,e,{value:t,configurable:!0,writable:!0})}catch(n){H[e]=t}return t},O="__core-js_shared__",P=a[O]||I(O,{}),j=F,z=P,R=f(Function.toString);j(z.inspectSource)||(z.inspectSource=function(e){return R(e)});var q,V,Z=z.inspectSource,K=F,U=a.WeakMap,W=K(U)&&/native code/.test(String(U)),X=F,G=T.all,Q=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:X(e)||e===G}:function(e){return"object"==typeof e?null!==e:X(e)},J={},Y=Q,ee=a.document,te=Y(ee)&&Y(ee.createElement),ne=function(e){return te?ee.createElement(e):{}},se=!o&&!l((function(){return 7!==Object.defineProperty(ne("div"),"a",{get:function(){return 7}}).a})),ie=o&&l((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),re=Q,ae=String,le=TypeError,oe=function(e){if(re(e))return e;throw new le(ae(e)+" is not an object")},ue=h,ce=Function.prototype.call,he=ue?ce.bind(ce):function(){return ce.apply(ce,arguments)},pe=a,de=F,ge=f({}.isPrototypeOf),me=a,fe="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Me=me.process,Te=me.Deno,De=Me&&Me.versions||Te&&Te.version,Fe=De&&De.v8;Fe&&(V=(q=Fe.split("."))[0]>0&&q[0]<4?1:+(q[0]+q[1])),!V&&fe&&(!(q=fe.match(/Edge\/(\d+)/))||q[1]>=74)&&(q=fe.match(/Chrome\/(\d+)/))&&(V=+q[1]);var ye=V,Ce=l,ke=a.String,be=!!Object.getOwnPropertySymbols&&!Ce((function(){var e=Symbol("symbol detection");return!ke(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ye&&ye<41})),Ee=be&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,$e=function(e,t){return arguments.length<2?(n=pe[e],de(n)?n:void 0):pe[e]&&pe[e][t];var n},Ae=F,we=ge,ve=Object,xe=Ee?function(e){return"symbol"==typeof e}:function(e){var t=$e("Symbol");return Ae(t)&&we(t.prototype,ve(e))},Se=String,Le=F,Be=function(e){try{return Se(e)}catch(e){return"Object"}},Ne=TypeError,He=function(e){if(Le(e))return e;throw new Ne(Be(e)+" is not a function")},_e=y,Ie=he,Oe=F,Pe=Q,je=TypeError,ze={},Re=P;({get exports(){return ze},set exports(e){ze=e}}.exports=function(e,t){return Re[e]||(Re[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var qe=f,Ve=0,Ze=Math.random(),Ke=qe(1..toString),Ue=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ke(++Ve+Ze,36)},We=ze,Xe=w,Ge=Ue,Qe=be,Je=Ee,Ye=a.Symbol,et=We("wks"),tt=Je?Ye.for||Ye:Ye&&Ye.withoutSetter||Ge,nt=he,st=Q,it=xe,rt=function(e,t){var n=e[t];return _e(n)?void 0:He(n)},at=function(e,t){var n,s;if("string"===t&&Oe(n=e.toString)&&!Pe(s=Ie(n,e)))return s;if(Oe(n=e.valueOf)&&!Pe(s=Ie(n,e)))return s;if("string"!==t&&Oe(n=e.toString)&&!Pe(s=Ie(n,e)))return s;throw new je("Can't convert object to primitive value")},lt=TypeError,ot=function(e){return Xe(et,e)||(et[e]=Qe&&Xe(Ye,e)?Ye[e]:tt("Symbol."+e)),et[e]}("toPrimitive"),ut=function(e,t){if(!st(e)||it(e))return e;var n,s=rt(e,ot);if(s){if(void 0===t&&(t="default"),n=nt(s,e,t),!st(n)||it(n))return n;throw new lt("Can't convert object to primitive value")}return void 0===t&&(t="number"),at(e,t)},ct=xe,ht=o,pt=se,dt=ie,gt=oe,mt=function(e){var t=ut(e,"string");return ct(t)?t:t+""},ft=TypeError,Mt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,Dt="enumerable",Ft="configurable",yt="writable";J.f=ht?dt?function(e,t,n){if(gt(e),t=mt(t),gt(n),"function"==typeof e&&"prototype"===t&&"value"in n&&yt in n&&!n[yt]){var s=Tt(e,t);s&&s[yt]&&(e[t]=n.value,n={configurable:Ft in n?n[Ft]:s[Ft],enumerable:Dt in n?n[Dt]:s[Dt],writable:!1})}return Mt(e,t,n)}:Mt:function(e,t,n){if(gt(e),t=mt(t),gt(n),pt)try{return Mt(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new ft("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Ct,kt,bt,Et=J,$t=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},At=o?function(e,t,n){return Et.f(e,t,$t(1,n))}:function(e,t,n){return e[t]=n,e},wt=Ue,vt=ze("keys"),xt=W,St=a,Lt=Q,Bt=At,Nt=w,Ht=P,_t=function(e){return vt[e]||(vt[e]=wt(e))},It="Object already initialized",Ot=St.TypeError,Pt=St.WeakMap;if(xt||Ht.state){var jt=Ht.state||(Ht.state=new Pt);jt.get=jt.get,jt.has=jt.has,jt.set=jt.set,Ct=function(e,t){if(jt.has(e))throw new Ot(It);return t.facade=e,jt.set(e,t),t},kt=function(e){return jt.get(e)||{}},bt=function(e){return jt.has(e)}}else{var zt=_t("state");Ct=function(e,t){if(Nt(e,zt))throw new Ot(It);return t.facade=e,Bt(e,zt,t),t},kt=function(e){return Nt(e,zt)?e[zt]:{}},bt=function(e){return Nt(e,zt)}}var Rt={set:Ct,get:kt,has:bt,enforce:function(e){return bt(e)?kt(e):Ct(e,{})},getterFor:function(e){return function(t){var n;if(!Lt(t)||(n=kt(t)).type!==e)throw new Ot("Incompatible receiver, "+e+" required");return n}}},qt=f,Vt=l,Zt=F,Kt=w,Ut=o,Wt=N.CONFIGURABLE,Xt=Z,Gt=Rt.enforce,Qt=Rt.get,Jt=String,Yt=Object.defineProperty,en=qt("".slice),tn=qt("".replace),nn=qt([].join),sn=Ut&&!Vt((function(){return 8!==Yt((function(){}),"length",{value:8}).length})),rn=String(String).split("String"),an=c.exports=function(e,t,n){"Symbol("===en(Jt(t),0,7)&&(t="["+tn(Jt(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!Kt(e,"name")||Wt&&e.name!==t)&&(Ut?Yt(e,"name",{value:t,configurable:!0}):e.name=t),sn&&n&&Kt(n,"arity")&&e.length!==n.arity&&Yt(e,"length",{value:n.arity});try{n&&Kt(n,"constructor")&&n.constructor?Ut&&Yt(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var s=Gt(e);return Kt(s,"source")||(s.source=nn(rn,"string"==typeof t?t:"")),e};Function.prototype.toString=an((function(){return Zt(this)&&Qt(this).source||Xt(this)}),"toString");var ln=u,on=J,un=oe,cn=o,hn=function(e,t,n){return n.get&&ln(n.get,t,{getter:!0}),n.set&&ln(n.set,t,{setter:!0}),on.f(e,t,n)},pn=function(){var e=un(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},dn=l,gn=a.RegExp,mn=gn.prototype;cn&&dn((function(){var e=!0;try{gn(".","d")}catch(t){e=!1}var t={},n="",s=e?"dgimsy":"gimsy",i=function(e,s){Object.defineProperty(t,e,{get:function(){return n+=s,!0}})},r={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(r.hasIndices="d"),r)i(a,r[a]);return Object.getOwnPropertyDescriptor(mn,"flags").get.call(t)!==s||n!==s}))&&hn(mn,"flags",{configurable:!0,get:pn});const fn={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,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/},Mn=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])/),Tn=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])$/),Dn={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}};var Fn=[{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}],yn={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">&lt;</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">&gt;</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"}};const Cn=new RegExp(Object.keys(fn).join("|")),kn=[...Object.keys(yn)];for(let e of kn){let t=yn[e].regexp.source;for(;t.match(Cn);)t=t.replace(Cn,(e=>fn[e].source));yn[e].regexp=new RegExp(t,yn[e].regexp.flags)}for(let e of Fn){let t=e.start.source;for(;t.match(Cn);)t=t.replace(Cn,(e=>fn[e].source));e.start=new RegExp(t,e.start.flags)}function bn(e){return(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const En={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=[];let t=e.element;t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.body),this.createCommandBarElement(t,e.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","|","blockquote","hr","|","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(!s[e])continue;t=e,this.commands[t]=s[t]}else{if("object"!=typeof e||!e.name)continue;t=e.name,this.commands[t]={},s[t]&&Object.assign(this.commands[t],s[t]),Object.assign(this.commands[t],e)}let i=this.commands[t].title||t;if(this.commands[t].hotkey){const e=this.commands[t].hotkey.split("-");let s=[],r=[];for(let t=0;t<e.length-1;t++)switch(e[t]){case"Ctrl":s.push("ctrlKey"),r.push("Ctrl");break;case"Cmd":s.push("metaKey"),r.push("⌘");break;case"Alt":s.push("altKey"),r.push("Alt");break;case"Option":s.push("altKey"),r.push("⌥");break;case"Win":s.push("metaKey"),r.push("⊞ Win");break;case"Shift":s.push("shiftKey"),r.push("⇧");break;case"Mod":n?(s.push("metaKey"),r.push("⌘")):(s.push("ctrlKey"),r.push("Ctrl"));break;case"Mod2":s.push("altKey"),n?r.push("⌥"):r.push("Alt")}r.push(e[e.length-1]);let a={modifiers:s,command:t};e[e.length-1].match(/^[0-9]$/)?a.code=`Digit${e[e.length-1]}`:a.key=e[e.length-1].toLowerCase(),this.hotkeys.push(a),i=i.concat(` (${r.join("+")})`)}this.buttons[t]=document.createElement("div"),this.buttons[t].className="TMCommandButton TMCommandButton_Disabled",this.buttons[t].title=i,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){this.editor&&(t.preventDefault(),"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){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]:{};this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[],drop:[]};let t=e.element;this.textarea=e.textarea,this.textarea&&(this.textarea.tagName||(this.textarea=document.getElementById(this.textarea)),t||(t=this.textarea)),t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.getElementsByTagName("body")[0]),"TEXTAREA"==t.tagName&&(this.textarea=t,t=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.createEditorElement(t,e),this.setContent("string"==typeof e.content?e.content:this.textarea?this.textarea.value:"# Hello TinyMDE!\nEdit **here**")}createEditorElement(e,t){t&&void 0!==t.editor?t.editor.tagName?this.e=t.editor:this.e=document.getElementById(t.editor):this.e=document.createElement("div"),this.e.classList.add("TinyMDE"),this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",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("compositionend",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>this.handleSelectionChangeEvent(e))),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.e.addEventListener("drop",(e=>this.handleDrop(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),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.fireChange()}getContent(){return this.lines.join("\n")}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][Dn.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(/(\${1,2})([0-9])/g,((e,n,s)=>"$"==n?bn(t[s]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[s])}</span>`))}applyLineTypes(){for(let e=0;e<this.lines.length;e++){if(this.lineDirty[e]){let t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}updateLineTypes(){let e=!1,t=0,n=!1;for(let s=0;s<this.lines.length;s++){let i="TMPara",r=[this.lines[s]],a="$$0";if("TMCodeFenceBacktickOpen"==e){let n=Dn.TMCodeFenceBacktickClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceBacktickClose",a=Dn.TMCodeFenceBacktickClose.replacement,r=n,e=!1):(i="TMFencedCodeBacktick",a='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[s]])}else if("TMCodeFenceTildeOpen"==e){let n=Dn.TMCodeFenceTildeClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceTildeClose",a=Dn.TMCodeFenceTildeClose.replacement,r=n,e=!1):(i="TMFencedCodeTilde",a='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[s]])}if("TMPara"==i&&!1===n)for(let e of Fn)if(this.lines[s].match(e.start)&&(e.paraInterrupt||0==s||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1])){n=e;break}if(!1!==n&&(i="TMHTMLBlock",a='<span class="TMHTMLContent">$0<br /></span>',r=[this.lines[s]],n.end?this.lines[s].match(n.end)&&(n=!1):(s==this.lines.length-1||this.lines[s+1].match(Dn.TMBlankLine.regexp))&&(n=!1)),"TMPara"==i)for(let e in Dn)if(Dn[e].regexp){let t=Dn[e].regexp.exec(this.lines[s]);if(t){i=e,a=Dn[e].replacement,r=t;break}}if("TMCodeFenceBacktickOpen"!=i&&"TMCodeFenceTildeOpen"!=i||(e=i,t=r.groups.seq.length),"TMIndentedCode"!=i&&"TMLinkReferenceDefinition"!=i||!(s>0)||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1]||(i="TMPara",r=[this.lines[s]],a="$$0"),"TMSetextH2Marker"==i){let e=Dn.TMUL.regexp.exec(this.lines[s]);e&&(i="TMUL",a=Dn.TMUL.replacement,r=e)}if("TMSetextH1Marker"==i||"TMSetextH2Marker"==i)if(0==s||"TMPara"!=this.lineTypes[s-1]){let e=Dn.TMHR.regexp.exec(this.lines[s]);e?(i="TMHR",r=e,a=Dn.TMHR.replacement):(i="TMPara",r=[this.lines[s]],a="$$0")}else{let e=s-1;const t="TMSetextH1Marker"==i?"TMSetextH1":"TMSetextH2";do{this.lineTypes[t]!=t&&(this.lineTypes[e]=t,this.lineDirty[t]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"==this.lineTypes[e])}this.lineTypes[s]!=i&&(this.lineTypes[s]=i,this.lineDirty[s]=!0),this.lineReplacements[s]=a,this.lineCaptures[s]=r}}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}parseLinkOrImage(e,t){let n=t?2:1,s=e.substr(0,n),i=t?"TMImage":"TMLink",r=n,a=1,l=!1,o=!1,u=[],c=[];e:for(;r<e.length&&!1===l;){let s=e.substr(r);for(let e of["escape","code","autolink","html"]){let t=yn[e].regexp.exec(s);if(t){r+=t[0].length;continue e}}if(s.match(yn.imageOpen.regexp))a++,r+=2;else if(s.match(yn.linkOpen.regexp)){if(a++,!t&&this.parseLinkOrImage(s,!1))return!1;r+=1}else s.match(/^\]/)&&(a--,0==a)?(l=e.substr(n,r-n),r++):r++}if(!1===l)return!1;let h=r<e.length?e.substr(r,1):"";if("["==h){let t=e.substr(r),n=yn.linkLabel.regexp.exec(t);if(!n)return!1;r+=n[0].length,u.push(n[1],n[2],n[3]),o=n[yn.linkLabel.labelPlaceholder]?n[yn.linkLabel.labelPlaceholder]:l.trim()}else if("("!=h)o=l.trim();else{r++;let t=1;for(;r<e.length&&t>0;){let n=e.substr(r),s=/^\s+/.exec(n);if(s){switch(c.length){case 0:case 1:c.push(s[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(s[0]);else{if(1!=t)return!1;c.push(""),c.push(s[0])}break;case 3:c.push(s[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;case 7:c[6]=c[6].concat(s[0]);break;default:return!1}r+=s[0].length}else if(s=yn.escape.regexp.exec(n),s){switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else if(c.length<2&&n.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),r++;else if(1!=c.length&&2!=c.length||!n.match(/^>/))if(s=/^["']/.exec(n),!s||0!=c.length&&1!=c.length&&4!=c.length)if(!s||5!=c.length&&6!=c.length||c[4]!=s[0])if(n.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||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}r++}else if(n.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||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("");r++}else{if(s=/^./.exec(n),!s)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else 5==c.length&&c.push(""),c.push(s[0]),r++;else{for(;c.length<4;)c.push("");c.push(s[0]),r++}else 1==c.length&&c.push(""),c.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_${i}">${s}</span><span class="${i} ${u.length<3||!u[1]?t:""}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">]</span>`;return u.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${i}">${u[0]}</span>`,`<span class="${t}">${u[1]}</span>`,`<span class="TMMark TMMark_${i}">${u[2]}</span>`)),{output:n,charCount:r}}if(c){for(;c.length<7;)c.push("");return{output:`<span class="TMMark TMMark_${i}">${s}</span><span class="${i}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">](${c[0]}</span><span class="${i}Destination">${c[1]}</span><span class="TMMark TMMark_${i}">${c[2]}${c[3]}${c[4]}</span><span class="${i}Title">${c[5]}</span><span class="TMMark TMMark_${i}">${c[6]})</span>`,charCount:r}}return!1}processInlineStyles(e){let t="",n=[],s=0,i=e;e:for(;i;){for(let e of["escape","code","autolink","html"]){let n=yn[e].regexp.exec(i);if(n){i=i.substr(n[0].length),s+=n[0].length,t+=yn[e].replacement.replace(/\$([1-9])/g,((e,t)=>bn(n[t])));continue e}}let r=i.match(yn.linkOpen.regexp),a=i.match(yn.imageOpen.regexp);if(a||r){let e=this.parseLinkOrImage(i,a);if(e){t=`${t}${e.output}`,i=i.substr(e.charCount),s+=e.charCount;continue e}}let l=/(^\*+)|(^_+)/.exec(i);if(l){let r=l[0].length;const a=l[0],o=l[0][0];i=i.substr(l[0].length);const u=s>0?e.substr(0,s):" ",c=s+l[0].length<e.length?i:" ",h=c.match(Mn),p=u.match(Tn),d=c.match(/^\s/),g=u.match(/\s$/);let m=!(d||h&&!g&&!p),f=!(g||p&&!d&&!h);if("_"==o&&m&&f&&(m=p,f=h),f){let e=n.length-1;for(;r&&e>=0;)if(n[e].delimiter==o){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">${o}${o}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${o}${o}</span>`,r-=2,n[e].count-=2):(t=`<span class="TMMark">${o}</span><em class="TMEm">${t}</em><span class="TMMark">${o}</span>`,r-=1,n[e].count-=1),0==n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}r&&m&&(n.push({delimiter:o,delimString:a,count:r,output:t}),t="",r=0),r&&(t=`${t}${a.substr(0,r)}`),s+=l[0].length}else if(l=/^~~/.exec(i),l){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=""),s+=l[0].length,i=i.substr(l[0].length)}else{if(l=yn.default.regexp.exec(i),!l)throw"Infinite loop!";i=i.substr(l[0].length),s+=l[0].length,t+=yn.default.replacement.replace(/\$([1-9])/g,((e,t)=>bn(l[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}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;)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;)n--;let s=this.lines.length+n+1-t;s<-e&&(s=-e),s<0&&(s=0);let i=[];for(let n=0;n<s+e;n++)i.push(this.lineElements[t+n].textContent);this.spliceLines(t,s,i,!1)}else for(let e=0;e<this.lineElements.length;e++){let t=this.lineElements[e].textContent;this.lines[e]!==t&&(this.lines[e]=t,this.lineDirty[e]=!0)}}processNewParagraph(e){if(!e)return;this.updateLineContents();let t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}let s=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(1!=s.length){if(this.spliceLines(e.row,1,s,!0),e.row++,e.col=0,t){let n=Dn[t].regexp.exec(this.lines[e.row-1]);n&&(n[2]?("TMOL"==t&&(n[1]=n[1].replace(/\d{1,9}/,(e=>parseInt(e[0])+1))),this.lines[e.row]=`${n[1]}${this.lines[e.row]}`,this.lineDirty[e.row]=!0,e.col=n[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}else this.updateFormatting()}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=window.getSelection();let n=e?t.anchorNode:t.focusNode;if(!n)return null;let s=e?t.anchorOffset:t.focusOffset;if(n==this.e)return s<this.lines.length?{row:s,col:0}:{row:s-1,col:this.lines[s-1].length};let i=this.computeColumn(n,s);if(null===i)return null;let r=n;for(;r.parentElement!=this.e;)r=r.parentElement;let a=0;if(!r.dataset||!r.dataset.lineNum||r.previousSibling&&r.previousSibling.dataset.lineNum==r.dataset.lineNum)for(;r.previousSibling;)a++,r=r.previousSibling;else a=parseInt(r.dataset.lineNum);return{row:a,col:i,node:n}}computeColumn(e,t){let n,s=e;for(;s&&s.parentNode!=this.e;)s=s.parentNode;if(null==s)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,s=e):t>0&&(s=e.childNodes[t-1],n=s.textContent.length);s.parentNode!=this.e;)s.previousSibling?(s=s.previousSibling,n+=s.textContent.length):s=s.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 s=this.lineElements[e];let i=s.firstChild,r=!1,a={node:s.firstChild?s.firstChild:s,offset:0};for(;i!=s;){if(!r&&i.nodeType===Node.TEXT_NODE)if(i.nodeValue.length>=t){if(!n||i.nodeValue.length!=t)return{node:i,offset:t};a={node:i,offset:t},t=0}else t-=i.nodeValue.length;!r&&i.firstChild?i=i.firstChild:i.nextSibling?(r=!1,i=i.nextSibling):(r=!0,i=i.parentNode)}return a}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let n=document.createRange(),{node:s,offset:i}=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),r=null,a=null;if(t&&(t.row!=e.row||t.col!=e.col)){let{node:n,offset:s}=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col);r=n,a=s}r?n.setStart(r,a):n.setStart(s,i),n.setEnd(s,i);let l=window.getSelection();l.removeAllRanges(),l.addRange(n)}handleInputEvent(e){if("insertCompositionText"==e.inputType)return;let t=this.getSelection();"insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t?(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting()):(this.clearDirtyFlag(),this.processNewParagraph(t)),t&&this.setSelection(t),this.fireChange()}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=function(e){const t=e.parentElement,n=e.nextSibling;t.removeChild(e);for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];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)}}))}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleSelectionChangeEvent(){this.fireSelection()}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(s)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let i=[],r=[];for(let t=0;t<n.length;t++)i.push(""),r.push(!0),s&&(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,...r)}handlePaste(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}paste(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s||(s=this.getSelection(!0)),i||(i=this.getSelection(!1)),i||(i={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),s||(s=i),s.row<i.row||s.row==i.row&&s.col<=i.col?(t=s,n=i):(t=i,n=s);let r=e.split(/(?:\r\n|\r|\n)/),a=this.lines[t.row].substr(0,t.col),l=this.lines[n.row].substr(n.col);r[0]=a.concat(r[0]);let o=r[r.length-1].length;r[r.length-1]=r[r.length-1].concat(l),this.spliceLines(t.row,1+n.row-t.row,r),i.row=t.row+r.length-1,i.col=o,this.updateFormatting(),this.setSelection(i),this.fireChange()}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},s=n(e),i=n(t);if(s[0]!=i[0])return null;let r;for(r=0;s[r]==i[r];r++);return s[r-1]}computeEnclosingMarkupNode(e,t,n){let s=null;if(!e)return null;if(t){if(e.row!=t.row)return null;s=this.computeCommonAncestor(e.node,t.node)}else s=e.node;if(!s)return null;for(;s!=this.e;){if(s.className&&s.className.includes(n))return s;s=s.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={};if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n){for(let e in En)i[e]=null;return i}s||(s=n),s.row<n.row||s.row==n.row&&s.col<n.col?(e=s,t=n):(e=n,t=s),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length);for(let r in En)if("inline"==En[r].type&&(n&&n.row==s.row&&this.isInlineFormattingAllowed(n,s)?i[r]=!!this.computeEnclosingMarkupNode(n,s,En[r].className)||n.col==s.col&&!!this.lines[n.row].substr(0,n.col).match(En[r].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(En[r].unset.postPattern):i[r]=null),"line"==En[r].type)if(n){let n=this.lineTypes[e.row]==En[r].className;for(let s=e.row;s<=t.row;s++)if(this.lineTypes[s]==En[r].className!=n){n=null;break}i[r]=n}else i[r]=null;return i}setCommandState(e,t){if("inline"==En[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(n,t))return;let s=this.computeEnclosingMarkupNode(n,t,En[e].className);if(this.clearDirtyFlag(),s){this.lineDirty[n.row]=!0;const i=this.computeColumn(s,0),r=s.textContent.length,a=this.lines[n.row].substr(0,i).replace(En[e].unset.prePattern,""),l=this.lines[n.row].substr(i,r),o=this.lines[n.row].substr(i+r).replace(En[e].unset.postPattern,"");this.lines[n.row]=a.concat(l,o),t.col=a.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(En[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(En[e].unset.postPattern)){this.lineDirty[n.row]=!0;const s=this.lines[n.row].substr(0,n.col).replace(En[e].unset.prePattern,""),i=this.lines[n.row].substr(n.col).replace(En[e].unset.postPattern,"");this.lines[n.row]=s.concat(i),n.col=t.col=s.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let{startCol:s,endCol:i}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},r=this.lines[n.row].substr(s,i-s).match(/^(?<leading>\s*).*\S(?<trailing>\s*)$/);r&&(s+=r.groups.leading.length,i-=r.groups.trailing.length),n.col=s,t.col=i,this.wrapSelection(En[e].set.pre,En[e].set.post,n,t),this.fireChange()}}else if("line"==En[e].type){let n=this.getSelection(!0),s=this.getSelection(!1);if(n||(n=s),!s)return;this.clearDirtyFlag();let i=n.row>s.row?s:n,r=n.row>s.row?n:s;r.row>i.row&&0==r.col&&r.row--;for(let n=i.row;n<=r.row;n++)t&&this.lineTypes[n]!=En[e].className&&(this.lines[n]=this.lines[n].replace(En[e].set.pattern,En[e].set.replacement.replace("$#",n-i.row+1)),this.lineDirty[n]=!0),t||this.lineTypes[n]!=En[e].className||(this.lines[n]=this.lines[n].replace(En[e].unset.pattern,En[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:r.row,col:this.lines[r.row].length},{row:i.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.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!=this.e;){if(t.className&&"function"==typeof t.className.includes&&(t.className.includes("TMInlineFormatted")||t.className.includes("TMBlankLine")))return!0;t=t.parentNode}return!1}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n||!s||n.row!=s.row)return;this.lineDirty[n.row]=!0;const i=n.col<s.col?n.col:s.col,r=n.col<s.col?s.col:n.col,a=this.lines[n.row].substr(0,i).concat(e),l=r==i?"":this.lines[n.row].substr(i,r-i),o=t.concat(this.lines[n.row].substr(r));this.lines[n.row]=a.concat(l,o),s.col=a.length,n.col=s.col+l.length,this.updateFormatting(),this.setSelection(n,s)}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireChange(){if(!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.linesDirty})}fireSelection(){if(this.listeners.selection&&this.listeners.selection.length){let e=this.getSelection(!1),t=this.getSelection(!0),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})}}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}addEventListener(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t),e.match(/^(?:drop)$/i)&&this.listeners.drop.push(t)}}}));
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" style="font-variation-settings:normal;marker:none"/></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>',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:""),s={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"},insertLink:{name:"insertLink",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("[","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&null,innerHTML:t.link,title:"Insert link",hotkey:"Mod-K"},insertImage:{name:"insertImage",action:e=>{e.isInlineFormattingAllowed()&&e.wrapSelection("![","]()")},enabled:(e,t,n)=>!e.isInlineFormattingAllowed(t,n)&&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 i,r,a,l,o,u,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={};function p(){if(r)return i;r=1;var e=function(e){return e&&e.Math===Math&&e};return i=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof c&&c)||e("object"==typeof i&&i)||function(){return this}()||Function("return this")()}function d(){return l?a:(l=1,a=function(e){try{return!!e()}catch(e){return!0}})}function f(){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,m,M,T,F,D,y,C,k,E,b,v,$,A,w,S,x={exports:{}};function L(){if(m)return g;m=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,s=e&&t.bind.bind(n,n);return M=e?s:function(e){return function(){return n.apply(e,arguments)}},M}function B(){if(D)return F;D=1;var e="object"==typeof document&&document.all;return F=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function N(){return C?y:(C=1,y=function(e){return null==e})}function _(){if(E)return k;E=1;var e=N(),t=TypeError;return k=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function O(){if(v)return b;v=1;var e=_(),t=Object;return b=function(n){return t(e(n))}}function I(){if(A)return $;A=1;var e=H(),t=O(),n=e({}.hasOwnProperty);return $=Object.hasOwn||function(e,s){return n(t(e),s)}}var P,j,R,z,q,V,K,U,Z,W,X,G={exports:{}};function Q(){if(z)return R;z=1;var e=p(),t=Object.defineProperty;return R=function(n,s){try{t(e,n,{value:s,configurable:!0,writable:!0})}catch(t){e[n]=s}return s}}function Y(){if(q)return G.exports;q=1;var e=j?P:(j=1,P=!1),t=p(),n=Q(),s="__core-js_shared__",i=G.exports=t[s]||n(s,{});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"}),G.exports}function J(){if(K)return V;K=1;var e=H(),t=B(),n=Y(),s=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return s(e)}),V=n.inspectSource}function ee(){if(X)return W;X=1;var e=B();return W=function(t){return"object"==typeof t?null!==t:e(t)}}var te,ne,se,ie,re,ae,le,oe,ue,ce,he,pe,de,fe,ge,me,Me,Te,Fe,De,ye,Ce,ke,Ee,be,ve,$e,Ae,we,Se,xe,Le,He,Be,Ne,_e,Oe,Ie,Pe,je,Re,ze,qe,Ve,Ke,Ue,Ze,We,Xe,Ge,Qe,Ye,Je,et,tt,nt,st,it,rt,at={};function lt(){if(ie)return se;ie=1;var e=f(),t=d(),n=function(){if(ne)return te;ne=1;var e=p(),t=ee(),n=e.document,s=t(n)&&t(n.createElement);return te=function(e){return s?n.createElement(e):{}}}();return se=!e&&!t((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function ot(){if(oe)return le;oe=1;var e=ee(),t=String,n=TypeError;return le=function(s){if(e(s))return s;throw new n(t(s)+" is not an object")}}function ut(){if(ce)return ue;ce=1;var e=L(),t=Function.prototype.call;return ue=e?t.bind(t):function(){return t.apply(t,arguments)},ue}function ct(){if(pe)return he;pe=1;var e=p(),t=B();return he=function(n,s){return arguments.length<2?(i=e[n],t(i)?i:void 0):e[n]&&e[n][s];var i},he}function ht(){if(Te)return Me;Te=1;var e,t,n=p(),s=function(){if(me)return ge;me=1;var e=p().navigator,t=e&&e.userAgent;return ge=t?String(t):""}(),i=n.process,r=n.Deno,a=i&&i.versions||r&&r.version,l=a&&a.v8;return l&&(t=(e=l.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&s&&(!(e=s.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=s.match(/Chrome\/(\d+)/))&&(t=+e[1]),Me=t}function pt(){if(De)return Fe;De=1;var e=ht(),t=d(),n=p().String;return Fe=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))}function dt(){if(Ce)return ye;Ce=1;var e=pt();return ye=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ft(){if(Ee)return ke;Ee=1;var e=ct(),t=B(),n=function(){if(fe)return de;fe=1;var e=H();return de=e({}.isPrototypeOf)}(),s=dt(),i=Object;return ke=s?function(e){return"symbol"==typeof e}:function(s){var r=e("Symbol");return t(r)&&n(r.prototype,i(s))}}function gt(){if(ve)return be;ve=1;var e=String;return be=function(t){try{return e(t)}catch(e){return"Object"}}}function mt(){if(Ae)return $e;Ae=1;var e=B(),t=gt(),n=TypeError;return $e=function(s){if(e(s))return s;throw new n(t(s)+" is not a function")}}function Mt(){if(Se)return we;Se=1;var e=mt(),t=N();return we=function(n,s){var i=n[s];return t(i)?void 0:e(i)}}function Tt(){if(Le)return xe;Le=1;var e=ut(),t=B(),n=ee(),s=TypeError;return xe=function(i,r){var a,l;if("string"===r&&t(a=i.toString)&&!n(l=e(a,i)))return l;if(t(a=i.valueOf)&&!n(l=e(a,i)))return l;if("string"!==r&&t(a=i.toString)&&!n(l=e(a,i)))return l;throw new s("Can't convert object to primitive value")}}function Ft(){if(Be)return He;Be=1;var e=Y();return He=function(t,n){return e[t]||(e[t]=n||{})}}function Dt(){if(_e)return Ne;_e=1;var e=H(),t=0,n=Math.random(),s=e(1..toString);return Ne=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++t+n,36)}}function yt(){if(Ie)return Oe;Ie=1;var e=p(),t=Ft(),n=I(),s=Dt(),i=pt(),r=dt(),a=e.Symbol,l=t("wks"),o=r?a.for||a:a&&a.withoutSetter||s;return Oe=function(e){return n(l,e)||(l[e]=i&&n(a,e)?a[e]:o("Symbol."+e)),l[e]}}function Ct(){if(je)return Pe;je=1;var e=ut(),t=ee(),n=ft(),s=Mt(),i=Tt(),r=yt(),a=TypeError,l=r("toPrimitive");return Pe=function(r,o){if(!t(r)||n(r))return r;var u,c=s(r,l);if(c){if(void 0===o&&(o="default"),u=e(c,r,o),!t(u)||n(u))return u;throw new a("Can't convert object to primitive value")}return void 0===o&&(o="number"),i(r,o)}}function kt(){if(ze)return Re;ze=1;var e=Ct(),t=ft();return Re=function(n){var s=e(n,"string");return t(s)?s:s+""}}function Et(){if(qe)return at;qe=1;var e=f(),t=lt(),n=function(){if(ae)return re;ae=1;var e=f(),t=d();return re=e&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}(),s=ot(),i=kt(),r=TypeError,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o="enumerable",u="configurable",c="writable";return at.f=e?n?function(e,t,n){if(s(e),t=i(t),s(n),"function"==typeof e&&"prototype"===t&&"value"in n&&c in n&&!n[c]){var r=l(e,t);r&&r[c]&&(e[t]=n.value,n={configurable:u in n?n[u]:r[u],enumerable:o in n?n[o]:r[o],writable:!1})}return a(e,t,n)}:a:function(e,n,l){if(s(e),n=i(n),s(l),t)try{return a(e,n,l)}catch(e){}if("get"in l||"set"in l)throw new r("Accessors not supported");return"value"in l&&(e[n]=l.value),e},at}function bt(){return Ke?Ve:(Ke=1,Ve=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function vt(){if(Ze)return Ue;Ze=1;var e=f(),t=Et(),n=bt();return Ue=e?function(e,s,i){return t.f(e,s,n(1,i))}:function(e,t,n){return e[t]=n,e}}function $t(){if(Xe)return We;Xe=1;var e=Ft(),t=Dt(),n=e("keys");return We=function(e){return n[e]||(n[e]=t(e))}}function At(){return Qe?Ge:(Qe=1,Ge={})}function wt(){if(Je)return Ye;Je=1;var e,t,n,s=function(){if(Z)return U;Z=1;var e=p(),t=B(),n=e.WeakMap;return U=t(n)&&/native code/.test(String(n))}(),i=p(),r=ee(),a=vt(),l=I(),o=Y(),u=$t(),c=At(),h="Object already initialized",d=i.TypeError,f=i.WeakMap;if(s||o.state){var g=o.state||(o.state=new f);g.get=g.get,g.has=g.has,g.set=g.set,e=function(e,t){if(g.has(e))throw new d(h);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=u("state");c[m]=!0,e=function(e,t){if(l(e,m))throw new d(h);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 Ye={set:e,get:t,has:n,enforce:function(s){return n(s)?t(s):e(s,{})},getterFor:function(e){return function(n){var s;if(!r(n)||(s=t(n)).type!==e)throw new d("Incompatible receiver, "+e+" required");return s}}}}function St(){if(et)return x.exports;et=1;var e=H(),t=d(),n=B(),s=I(),i=f(),r=function(){if(S)return w;S=1;var e=f(),t=I(),n=Function.prototype,s=e&&Object.getOwnPropertyDescriptor,i=t(n,"name"),r=i&&"something"===function(){}.name,a=i&&(!e||e&&s(n,"name").configurable);return w={EXISTS:i,PROPER:r,CONFIGURABLE:a}}().CONFIGURABLE,a=J(),l=wt(),o=l.enforce,u=l.get,c=String,h=Object.defineProperty,p=e("".slice),g=e("".replace),m=e([].join),M=i&&!t((function(){return 8!==h((function(){}),"length",{value:8}).length})),T=String(String).split("String"),F=x.exports=function(e,t,n){"Symbol("===p(c(t),0,7)&&(t="["+g(c(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!s(e,"name")||r&&e.name!==t)&&(i?h(e,"name",{value:t,configurable:!0}):e.name=t),M&&n&&s(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?i&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=o(e);return s(a,"source")||(a.source=m(T,"string"==typeof t?t:"")),e};return Function.prototype.toString=F((function(){return n(this)&&u(this).source||a(this)}),"toString"),x.exports}function xt(){if(nt)return tt;nt=1;var e=St(),t=Et();return tt=function(n,s,i){return i.get&&e(i.get,s,{getter:!0}),i.set&&e(i.set,s,{setter:!0}),t.f(n,s,i)}}!function(){if(rt)return h;rt=1;var e=p(),t=f(),n=xt(),s=function(){if(it)return st;it=1;var e=ot();return st=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}}(),i=d(),r=e.RegExp,a=r.prototype;t&&i((function(){var e=!0;try{r(".","d")}catch(t){e=!1}var t={},n="",s=e?"dgimsy":"gimsy",i=function(e,s){Object.defineProperty(t,e,{get:function(){return n+=s,!0}})},l={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(l.hasIndices="d"),l)i(o,l[o]);return Object.getOwnPropertyDescriptor(a,"flags").get.call(t)!==s||n!==s}))&&n(a,"flags",{configurable:!0,get:s})}();const Lt={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,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])$/),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}};var _t=[{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}],Ot={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">&lt;</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">&gt;</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"}};const It=new RegExp(Object.keys(Lt).join("|")),Pt=[...Object.keys(Ot)];for(let e of Pt){let t=Ot[e].regexp.source;for(;t.match(It);)t=t.replace(It,(e=>Lt[e].source));Ot[e].regexp=new RegExp(t,Ot[e].regexp.flags)}for(let e of _t){let t=e.start.source;for(;t.match(It);)t=t.replace(It,(e=>Lt[e].source));e.start=new RegExp(t,e.start.flags)}function jt(e){return(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Rt={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=[];let t=e.element;t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.body),this.createCommandBarElement(t,e.commands||["bold","italic","strikethrough","|","code","|","h1","h2","|","ul","ol","|","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(!s[e])continue;t=e,this.commands[t]=s[t]}else{if("object"!=typeof e||!e.name)continue;t=e.name,this.commands[t]={},s[t]&&Object.assign(this.commands[t],s[t]),Object.assign(this.commands[t],e)}let i=this.commands[t].title||t;if(this.commands[t].hotkey){const e=this.commands[t].hotkey.split("-");let s=[],r=[];for(let t=0;t<e.length-1;t++)switch(e[t]){case"Ctrl":s.push("ctrlKey"),r.push("Ctrl");break;case"Cmd":s.push("metaKey"),r.push("⌘");break;case"Alt":s.push("altKey"),r.push("Alt");break;case"Option":s.push("altKey"),r.push("⌥");break;case"Win":s.push("metaKey"),r.push("⊞ Win");break;case"Shift":s.push("shiftKey"),r.push("⇧");break;case"Mod":n?(s.push("metaKey"),r.push("⌘")):(s.push("ctrlKey"),r.push("Ctrl"));break;case"Mod2":s.push("altKey"),n?r.push("⌥"):r.push("Alt")}r.push(e[e.length-1]);let a={modifiers:s,command:t};e[e.length-1].match(/^[0-9]$/)?a.code=`Digit${e[e.length-1]}`:a.key=e[e.length-1].toLowerCase(),this.hotkeys.push(a),i=i.concat(` (${r.join("+")})`)}this.buttons[t]=document.createElement("div"),this.buttons[t].className="TMCommandButton TMCommandButton_Disabled",this.buttons[t].title=i,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){this.editor&&(t.preventDefault(),"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){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]:{};this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[],drop:[]};let t=e.element;this.textarea=e.textarea,this.textarea&&(this.textarea.tagName||(this.textarea=document.getElementById(this.textarea)),t||(t=this.textarea)),t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.getElementsByTagName("body")[0]),"TEXTAREA"==t.tagName&&(this.textarea=t,t=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.createEditorElement(t,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)))}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){(/Mac|iPod|iPhone|iPad/.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?t.editor.tagName?this.e=t.editor:this.e=document.getElementById(t.editor):this.e=document.createElement("div"),this.e.classList.add("TinyMDE"),this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",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("compositionend",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>this.handleSelectionChangeEvent(e))),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.e.addEventListener("drop",(e=>this.handleDrop(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),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.fireChange(),this.isRestoringHistory||this.pushHistory()}getContent(){return this.lines.join("\n")}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(/(\${1,2})([0-9])/g,((e,n,s)=>"$"==n?jt(t[s]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[s])}</span>`))}applyLineTypes(){for(let e=0;e<this.lines.length;e++){if(this.lineDirty[e]){let t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}updateLineTypes(){let e=!1,t=0,n=!1;for(let s=0;s<this.lines.length;s++){let i="TMPara",r=[this.lines[s]],a="$$0";if("TMCodeFenceBacktickOpen"==e){let n=Nt.TMCodeFenceBacktickClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceBacktickClose",a=Nt.TMCodeFenceBacktickClose.replacement,r=n,e=!1):(i="TMFencedCodeBacktick",a='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[s]])}else if("TMCodeFenceTildeOpen"==e){let n=Nt.TMCodeFenceTildeClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(i="TMCodeFenceTildeClose",a=Nt.TMCodeFenceTildeClose.replacement,r=n,e=!1):(i="TMFencedCodeTilde",a='<span class="TMFencedCode">$0<br /></span>',r=[this.lines[s]])}if("TMPara"==i&&!1===n)for(let e of _t)if(this.lines[s].match(e.start)&&(e.paraInterrupt||0==s||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1])){n=e;break}if(!1!==n&&(i="TMHTMLBlock",a='<span class="TMHTMLContent">$0<br /></span>',r=[this.lines[s]],n.end?this.lines[s].match(n.end)&&(n=!1):(s==this.lines.length-1||this.lines[s+1].match(Nt.TMBlankLine.regexp))&&(n=!1)),"TMPara"==i)for(let e in Nt)if(Nt[e].regexp){let t=Nt[e].regexp.exec(this.lines[s]);if(t){i=e,a=Nt[e].replacement,r=t;break}}if("TMCodeFenceBacktickOpen"!=i&&"TMCodeFenceTildeOpen"!=i||(e=i,t=r.groups.seq.length),"TMIndentedCode"!=i&&"TMLinkReferenceDefinition"!=i||!(s>0)||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1]||(i="TMPara",r=[this.lines[s]],a="$$0"),"TMSetextH2Marker"==i){let e=Nt.TMUL.regexp.exec(this.lines[s]);e&&(i="TMUL",a=Nt.TMUL.replacement,r=e)}if("TMSetextH1Marker"==i||"TMSetextH2Marker"==i)if(0==s||"TMPara"!=this.lineTypes[s-1]){let e=Nt.TMHR.regexp.exec(this.lines[s]);e?(i="TMHR",r=e,a=Nt.TMHR.replacement):(i="TMPara",r=[this.lines[s]],a="$$0")}else{let e=s-1;const t="TMSetextH1Marker"==i?"TMSetextH1":"TMSetextH2";do{this.lineTypes[t]!=t&&(this.lineTypes[e]=t,this.lineDirty[t]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"==this.lineTypes[e])}this.lineTypes[s]!=i&&(this.lineTypes[s]=i,this.lineDirty[s]=!0),this.lineReplacements[s]=a,this.lineCaptures[s]=r}}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}parseLinkOrImage(e,t){let n=t?2:1,s=e.substr(0,n),i=t?"TMImage":"TMLink",r=n,a=1,l=!1,o=!1,u=[],c=[];e:for(;r<e.length&&!1===l;){let s=e.substr(r);for(let e of["escape","code","autolink","html"]){let t=Ot[e].regexp.exec(s);if(t){r+=t[0].length;continue e}}if(s.match(Ot.imageOpen.regexp))a++,r+=2;else if(s.match(Ot.linkOpen.regexp)){if(a++,!t&&this.parseLinkOrImage(s,!1))return!1;r+=1}else s.match(/^\]/)&&(a--,0==a)?(l=e.substr(n,r-n),r++):r++}if(!1===l)return!1;let h=r<e.length?e.substr(r,1):"";if("["==h){let t=e.substr(r),n=Ot.linkLabel.regexp.exec(t);if(!n)return!1;r+=n[0].length,u.push(n[1],n[2],n[3]),o=n[Ot.linkLabel.labelPlaceholder]?n[Ot.linkLabel.labelPlaceholder]:l.trim()}else if("("!=h)o=l.trim();else{r++;let t=1;for(;r<e.length&&t>0;){let n=e.substr(r),s=/^\s+/.exec(n);if(s){switch(c.length){case 0:case 1:c.push(s[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(s[0]);else{if(1!=t)return!1;c.push(""),c.push(s[0])}break;case 3:c.push(s[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;case 7:c[6]=c[6].concat(s[0]);break;default:return!1}r+=s[0].length}else if(s=Ot.escape.regexp.exec(n),s){switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else if(c.length<2&&n.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),r++;else if(1!=c.length&&2!=c.length||!n.match(/^>/))if(s=/^["']/.exec(n),!s||0!=c.length&&1!=c.length&&4!=c.length)if(!s||5!=c.length&&6!=c.length||c[4]!=s[0])if(n.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||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}r++}else if(n.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||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("");r++}else{if(s=/^./.exec(n),!s)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}r+=s[0].length}else 5==c.length&&c.push(""),c.push(s[0]),r++;else{for(;c.length<4;)c.push("");c.push(s[0]),r++}else 1==c.length&&c.push(""),c.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_${i}">${s}</span><span class="${i} ${u.length<3||!u[1]?t:""}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">]</span>`;return u.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${i}">${u[0]}</span>`,`<span class="${t}">${u[1]}</span>`,`<span class="TMMark TMMark_${i}">${u[2]}</span>`)),{output:n,charCount:r}}if(c){for(;c.length<7;)c.push("");return{output:`<span class="TMMark TMMark_${i}">${s}</span><span class="${i}">${this.processInlineStyles(l)}</span><span class="TMMark TMMark_${i}">](${c[0]}</span><span class="${i}Destination">${c[1]}</span><span class="TMMark TMMark_${i}">${c[2]}${c[3]}${c[4]}</span><span class="${i}Title">${c[5]}</span><span class="TMMark TMMark_${i}">${c[6]})</span>`,charCount:r}}return!1}processInlineStyles(e){let t="",n=[],s=0,i=e;e:for(;i;){for(let e of["escape","code","autolink","html"]){let n=Ot[e].regexp.exec(i);if(n){i=i.substr(n[0].length),s+=n[0].length,t+=Ot[e].replacement.replace(/\$([1-9])/g,((e,t)=>jt(n[t])));continue e}}let r=i.match(Ot.linkOpen.regexp),a=i.match(Ot.imageOpen.regexp);if(a||r){let e=this.parseLinkOrImage(i,a);if(e){t=`${t}${e.output}`,i=i.substr(e.charCount),s+=e.charCount;continue e}}let l=/(^\*+)|(^_+)/.exec(i);if(l){let r=l[0].length;const a=l[0],o=l[0][0];i=i.substr(l[0].length);const u=s>0?e.substr(0,s):" ",c=s+l[0].length<e.length?i:" ",h=c.match(Ht),p=u.match(Bt),d=c.match(/^\s/),f=u.match(/\s$/);let g=!(d||h&&!f&&!p),m=!(f||p&&!d&&!h);if("_"==o&&g&&m&&(g=p,m=h),m){let e=n.length-1;for(;r&&e>=0;)if(n[e].delimiter==o){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">${o}${o}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${o}${o}</span>`,r-=2,n[e].count-=2):(t=`<span class="TMMark">${o}</span><em class="TMEm">${t}</em><span class="TMMark">${o}</span>`,r-=1,n[e].count-=1),0==n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}r&&g&&(n.push({delimiter:o,delimString:a,count:r,output:t}),t="",r=0),r&&(t=`${t}${a.substr(0,r)}`),s+=l[0].length}else if(l=/^~~/.exec(i),l){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=""),s+=l[0].length,i=i.substr(l[0].length)}else{if(l=Ot.default.regexp.exec(i),!l)throw"Infinite loop!";i=i.substr(l[0].length),s+=l[0].length,t+=Ot.default.replacement.replace(/\$([1-9])/g,((e,t)=>jt(l[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}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 s=this.lines.length+n+1-t;s<-e&&(s=-e),s<0&&(s=0);let i=[];for(let n=0;n<s+e;n++)i.push(this.lineElements[t+n].textContent);this.spliceLines(t,s,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)}}processNewParagraph(e){if(!e)return;this.updateLineContents();let t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}let s=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(s.length>1&&(this.spliceLines(e.row,1,s,!0),e.row++,e.col=0),t){let n=Nt[t].regexp.exec(this.lines[e.row-1]);n&&(n[2]?("TMOL"==t&&(n[1]=n[1].replace(/\d{1,9}/,(e=>parseInt(e[0])+1))),this.lines[e.row]=`${n[1]}${this.lines[e.row]}`,this.lineDirty[e.row]=!0,e.col=n[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=window.getSelection();let n=e?t.anchorNode:t.focusNode;if(!n)return null;let s=e?t.anchorOffset:t.focusOffset;if(n==this.e)return s<this.lines.length?{row:s,col:0}:{row:s-1,col:this.lines[s-1].length};let i=this.computeColumn(n,s);if(null===i)return null;let r=n;for(;r.parentElement!=this.e;)r=r.parentElement;let a=0;if(!r.dataset||!r.dataset.lineNum||r.previousSibling&&r.previousSibling.dataset.lineNum==r.dataset.lineNum)for(;r.previousSibling;)a++,r=r.previousSibling;else a=parseInt(r.dataset.lineNum);return{row:a,col:i,node:n}}computeColumn(e,t){let n,s=e;for(;s&&s.parentNode!=this.e;)s=s.parentNode;if(null==s)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,s=e):t>0&&(s=e.childNodes[t-1],n=s.textContent.length);s.parentNode!=this.e;)s.previousSibling?(s=s.previousSibling,n+=s.textContent.length):s=s.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 s=this.lineElements[e];let i=s.firstChild,r=!1,a={node:s.firstChild?s.firstChild:s,offset:0};for(;i!=s;){if(!r&&i.nodeType===Node.TEXT_NODE)if(i.nodeValue.length>=t){if(!n||i.nodeValue.length!=t)return{node:i,offset:t};a={node:i,offset:t},t=0}else t-=i.nodeValue.length;!r&&i.firstChild?i=i.firstChild:i.nextSibling?(r=!1,i=i.nextSibling):(r=!0,i=i.parentNode)}return a}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let{node:n,offset:s}=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),i=null,r=null;if(t&&(t.row!=e.row||t.col!=e.col)){let{node:n,offset:s}=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col);i=n,r=s}window.getSelection().setBaseAndExtent(n,s,i||n,i?r:s)}handleInputEvent(e){if(this.isRestoringHistory||this.pushHistory(),"insertCompositionText"==e.inputType)return;let t=this.getSelection();"insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t?(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting()):(this.clearDirtyFlag(),this.processNewParagraph(t)),t&&this.setSelection(t),this.fireChange()}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=function(e){const t=e.parentElement,n=e.nextSibling;t.removeChild(e);for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];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)}}))}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleSelectionChangeEvent(){this.fireSelection()}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(s)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let i=[],r=[];for(let t=0;t<n.length;t++)i.push(""),r.push(!0),s&&(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,...r)}handlePaste(e){this.isRestoringHistory||this.pushHistory(),e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}paste(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s||(s=this.getSelection(!0)),i||(i=this.getSelection(!1)),i||(i={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),s||(s=i),s.row<i.row||s.row==i.row&&s.col<=i.col?(t=s,n=i):(t=i,n=s);let r=e.split(/(?:\r\n|\r|\n)/),a=this.lines[t.row].substr(0,t.col),l=this.lines[n.row].substr(n.col);r[0]=a.concat(r[0]);let o=r[r.length-1].length;r[r.length-1]=r[r.length-1].concat(l),this.spliceLines(t.row,1+n.row-t.row,r),i.row=t.row+r.length-1,i.col=o,this.updateFormatting(),this.setSelection(i),this.fireChange()}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},s=n(e),i=n(t);if(s[0]!=i[0])return null;let r;for(r=0;s[r]==i[r];r++);return s[r-1]}computeEnclosingMarkupNode(e,t,n){let s=null;if(!e)return null;if(t){if(e.row!=t.row)return null;s=this.computeCommonAncestor(e.node,t.node)}else s=e.node;if(!s)return null;for(;s!=this.e;){if(s.className&&s.className.includes(n))return s;s=s.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i={};if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n){for(let e in Rt)i[e]=null;return i}s||(s=n),s.row<n.row||s.row==n.row&&s.col<n.col?(e=s,t=n):(e=n,t=s),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length);for(let r in Rt)if("inline"==Rt[r].type&&(n&&n.row==s.row&&this.isInlineFormattingAllowed(n,s)?i[r]=!!this.computeEnclosingMarkupNode(n,s,Rt[r].className)||n.col==s.col&&!!this.lines[n.row].substr(0,n.col).match(Rt[r].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(Rt[r].unset.postPattern):i[r]=null),"line"==Rt[r].type)if(n){let n=this.lineTypes[e.row]==Rt[r].className;for(let s=e.row;s<=t.row;s++)if(this.lineTypes[s]==Rt[r].className!=n){n=null;break}i[r]=n}else i[r]=null;return i}setCommandState(e,t){if(this.isRestoringHistory||this.pushHistory(),"inline"==Rt[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(n,t))return;let s=this.computeEnclosingMarkupNode(n,t,Rt[e].className);if(this.clearDirtyFlag(),s){this.lineDirty[n.row]=!0;const i=this.computeColumn(s,0),r=s.textContent.length,a=this.lines[n.row].substr(0,i).replace(Rt[e].unset.prePattern,""),l=this.lines[n.row].substr(i,r),o=this.lines[n.row].substr(i+r).replace(Rt[e].unset.postPattern,"");this.lines[n.row]=a.concat(l,o),t.col=a.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(Rt[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(Rt[e].unset.postPattern)){this.lineDirty[n.row]=!0;const s=this.lines[n.row].substr(0,n.col).replace(Rt[e].unset.prePattern,""),i=this.lines[n.row].substr(n.col).replace(Rt[e].unset.postPattern,"");this.lines[n.row]=s.concat(i),n.col=t.col=s.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let{startCol:s,endCol:i}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},r=this.lines[n.row].substr(s,i-s).match(/^(?<leading>\s*).*\S(?<trailing>\s*)$/);r&&(s+=r.groups.leading.length,i-=r.groups.trailing.length),n.col=s,t.col=i,this.wrapSelection(Rt[e].set.pre,Rt[e].set.post,n,t),this.fireChange()}}else if("line"==Rt[e].type){let n=this.getSelection(!0),s=this.getSelection(!1);if(n||(n=s),!s)return;this.clearDirtyFlag();let i=n.row>s.row?s:n,r=n.row>s.row?n:s;r.row>i.row&&0==r.col&&r.row--;for(let n=i.row;n<=r.row;n++)t&&this.lineTypes[n]!=Rt[e].className&&(this.lines[n]=this.lines[n].replace(Rt[e].set.pattern,Rt[e].set.replacement.replace("$#",n-i.row+1)),this.lineDirty[n]=!0),t||this.lineTypes[n]!=Rt[e].className||(this.lines[n]=this.lines[n].replace(Rt[e].unset.pattern,Rt[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:r.row,col:this.lines[r.row].length},{row:i.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.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!=this.e;){if(t.className&&"function"==typeof t.className.includes&&(t.className.includes("TMInlineFormatted")||t.className.includes("TMBlankLine")))return!0;t=t.parentNode}return!1}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.isRestoringHistory||this.pushHistory(),n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n||!s||n.row!=s.row)return;this.lineDirty[n.row]=!0;const i=n.col<s.col?n.col:s.col,r=n.col<s.col?s.col:n.col,a=this.lines[n.row].substr(0,i).concat(e),l=r==i?"":this.lines[n.row].substr(i,r-i),o=t.concat(this.lines[n.row].substr(r));this.lines[n.row]=a.concat(l,o),s.col=a.length,n.col=s.col+l.length,this.updateFormatting(),this.setSelection(n,s)}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireChange(){if(!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.linesDirty})}fireSelection(){if(this.listeners.selection&&this.listeners.selection.length){let e=this.getSelection(!1),t=this.getSelection(!0),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})}}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}addEventListener(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t),e.match(/^(?:drop)$/i)&&this.listeners.drop.push(t)}get canUndo(){return this.undoStack.length>1}get canRedo(){return this.redoStack.length>0}}}));
@@ -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="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=function(e){return e&&e.Math===Math&&e},s=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||function(){return this}()||t||Function("return this")(),r=function(e){try{return!!e()}catch(e){return!0}},i=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),l={},a={get exports(){return l},set exports(e){l=e}},u=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),o=u,c=Function.prototype,p=c.call,h=o&&c.bind.bind(p,p),d=o?h:function(e){return function(){return p.apply(e,arguments)}},f="object"==typeof document&&document.all,g={all:f,IS_HTMLDDA:void 0===f&&void 0!==f},m=g.all,M=g.IS_HTMLDDA?function(e){return"function"==typeof e||e===m}:function(e){return"function"==typeof e},T=function(e){return null==e},D=T,F=TypeError,C=function(e){if(D(e))throw new F("Can't call method on "+e);return e},E=Object,$=function(e){return E(C(e))},y=d({}.hasOwnProperty),k=Object.hasOwn||function(e,t){return y($(e),t)},A=i,b=k,w=Function.prototype,x=A&&Object.getOwnPropertyDescriptor,S=b(w,"name"),v={EXISTS:S,PROPER:S&&"something"===function(){}.name,CONFIGURABLE:S&&(!A||A&&x(w,"name").configurable)},L=s,B=Object.defineProperty,N=function(e,t){try{B(L,e,{value:t,configurable:!0,writable:!0})}catch(n){L[e]=t}return t},_="__core-js_shared__",H=s[_]||N(_,{}),O=M,I=H,P=d(Function.toString);O(I.inspectSource)||(I.inspectSource=function(e){return P(e)});var j,R,z=I.inspectSource,q=M,Z=s.WeakMap,U=q(Z)&&/native code/.test(String(Z)),V=M,X=g.all,G=g.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:V(e)||e===X}:function(e){return"object"==typeof e?null!==e:V(e)},K={},W=G,J=s.document,Q=W(J)&&W(J.createElement),Y=function(e){return Q?J.createElement(e):{}},ee=!i&&!r((function(){return 7!==Object.defineProperty(Y("div"),"a",{get:function(){return 7}}).a})),te=i&&r((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ne=G,se=String,re=TypeError,ie=function(e){if(ne(e))return e;throw new re(se(e)+" is not an object")},le=u,ae=Function.prototype.call,ue=le?ae.bind(ae):function(){return ae.apply(ae,arguments)},oe=s,ce=M,pe=d({}.isPrototypeOf),he=s,de="undefined"!=typeof navigator&&String(navigator.userAgent)||"",fe=he.process,ge=he.Deno,me=fe&&fe.versions||ge&&ge.version,Me=me&&me.v8;Me&&(R=(j=Me.split("."))[0]>0&&j[0]<4?1:+(j[0]+j[1])),!R&&de&&(!(j=de.match(/Edge\/(\d+)/))||j[1]>=74)&&(j=de.match(/Chrome\/(\d+)/))&&(R=+j[1]);var Te=R,De=r,Fe=s.String,Ce=!!Object.getOwnPropertySymbols&&!De((function(){var e=Symbol("symbol detection");return!Fe(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Te&&Te<41})),Ee=Ce&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,$e=function(e,t){return arguments.length<2?(n=oe[e],ce(n)?n:void 0):oe[e]&&oe[e][t];var n},ye=M,ke=pe,Ae=Object,be=Ee?function(e){return"symbol"==typeof e}:function(e){var t=$e("Symbol");return ye(t)&&ke(t.prototype,Ae(e))},we=String,xe=M,Se=function(e){try{return we(e)}catch(e){return"Object"}},ve=TypeError,Le=function(e){if(xe(e))return e;throw new ve(Se(e)+" is not a function")},Be=T,Ne=ue,_e=M,He=G,Oe=TypeError,Ie={},Pe=H;({get exports(){return Ie},set exports(e){Ie=e}}.exports=function(e,t){return Pe[e]||(Pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var je=d,Re=0,ze=Math.random(),qe=je(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+qe(++Re+ze,36)},Ue=Ie,Ve=k,Xe=Ze,Ge=Ce,Ke=Ee,We=s.Symbol,Je=Ue("wks"),Qe=Ke?We.for||We:We&&We.withoutSetter||Xe,Ye=ue,et=G,tt=be,nt=function(e,t){var n=e[t];return Be(n)?void 0:Le(n)},st=function(e,t){var n,s;if("string"===t&&_e(n=e.toString)&&!He(s=Ne(n,e)))return s;if(_e(n=e.valueOf)&&!He(s=Ne(n,e)))return s;if("string"!==t&&_e(n=e.toString)&&!He(s=Ne(n,e)))return s;throw new Oe("Can't convert object to primitive value")},rt=TypeError,it=function(e){return Ve(Je,e)||(Je[e]=Ge&&Ve(We,e)?We[e]:Qe("Symbol."+e)),Je[e]}("toPrimitive"),lt=function(e,t){if(!et(e)||tt(e))return e;var n,s=nt(e,it);if(s){if(void 0===t&&(t="default"),n=Ye(s,e,t),!et(n)||tt(n))return n;throw new rt("Can't convert object to primitive value")}return void 0===t&&(t="number"),st(e,t)},at=be,ut=i,ot=ee,ct=te,pt=ie,ht=function(e){var t=lt(e,"string");return at(t)?t:t+""},dt=TypeError,ft=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,mt="enumerable",Mt="configurable",Tt="writable";K.f=ut?ct?function(e,t,n){if(pt(e),t=ht(t),pt(n),"function"==typeof e&&"prototype"===t&&"value"in n&&Tt in n&&!n[Tt]){var s=gt(e,t);s&&s[Tt]&&(e[t]=n.value,n={configurable:Mt in n?n[Mt]:s[Mt],enumerable:mt in n?n[mt]:s[mt],writable:!1})}return ft(e,t,n)}:ft:function(e,t,n){if(pt(e),t=ht(t),pt(n),ot)try{return ft(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new dt("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Dt,Ft,Ct,Et=K,$t=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},yt=i?function(e,t,n){return Et.f(e,t,$t(1,n))}:function(e,t,n){return e[t]=n,e},kt=Ze,At=Ie("keys"),bt=U,wt=s,xt=G,St=yt,vt=k,Lt=H,Bt=function(e){return At[e]||(At[e]=kt(e))},Nt="Object already initialized",_t=wt.TypeError,Ht=wt.WeakMap;if(bt||Lt.state){var Ot=Lt.state||(Lt.state=new Ht);Ot.get=Ot.get,Ot.has=Ot.has,Ot.set=Ot.set,Dt=function(e,t){if(Ot.has(e))throw new _t(Nt);return t.facade=e,Ot.set(e,t),t},Ft=function(e){return Ot.get(e)||{}},Ct=function(e){return Ot.has(e)}}else{var It=Bt("state");Dt=function(e,t){if(vt(e,It))throw new _t(Nt);return t.facade=e,St(e,It,t),t},Ft=function(e){return vt(e,It)?e[It]:{}},Ct=function(e){return vt(e,It)}}var Pt={set:Dt,get:Ft,has:Ct,enforce:function(e){return Ct(e)?Ft(e):Dt(e,{})},getterFor:function(e){return function(t){var n;if(!xt(t)||(n=Ft(t)).type!==e)throw new _t("Incompatible receiver, "+e+" required");return n}}},jt=d,Rt=r,zt=M,qt=k,Zt=i,Ut=v.CONFIGURABLE,Vt=z,Xt=Pt.enforce,Gt=Pt.get,Kt=String,Wt=Object.defineProperty,Jt=jt("".slice),Qt=jt("".replace),Yt=jt([].join),en=Zt&&!Rt((function(){return 8!==Wt((function(){}),"length",{value:8}).length})),tn=String(String).split("String"),nn=a.exports=function(e,t,n){"Symbol("===Jt(Kt(t),0,7)&&(t="["+Qt(Kt(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!qt(e,"name")||Ut&&e.name!==t)&&(Zt?Wt(e,"name",{value:t,configurable:!0}):e.name=t),en&&n&&qt(n,"arity")&&e.length!==n.arity&&Wt(e,"length",{value:n.arity});try{n&&qt(n,"constructor")&&n.constructor?Zt&&Wt(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var s=Xt(e);return qt(s,"source")||(s.source=Yt(tn,"string"==typeof t?t:"")),e};Function.prototype.toString=nn((function(){return zt(this)&&Gt(this).source||Vt(this)}),"toString");var sn=l,rn=K,ln=ie,an=i,un=function(e,t,n){return n.get&&sn(n.get,t,{getter:!0}),n.set&&sn(n.set,t,{setter:!0}),rn.f(e,t,n)},on=function(){var e=ln(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},cn=r,pn=s.RegExp,hn=pn.prototype;an&&cn((function(){var e=!0;try{pn(".","d")}catch(t){e=!1}var t={},n="",s=e?"dgimsy":"gimsy",r=function(e,s){Object.defineProperty(t,e,{get:function(){return n+=s,!0}})},i={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var l in e&&(i.hasIndices="d"),i)r(l,i[l]);return Object.getOwnPropertyDescriptor(hn,"flags").get.call(t)!==s||n!==s}))&&un(hn,"flags",{configurable:!0,get:on});const dn={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,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/},fn=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])/),gn=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])$/),mn={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}};var Mn=[{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}],Tn={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">&lt;</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">&gt;</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"}};const Dn=new RegExp(Object.keys(dn).join("|")),Fn=[...Object.keys(Tn)];for(let e of Fn){let t=Tn[e].regexp.source;for(;t.match(Dn);)t=t.replace(Dn,(e=>dn[e].source));Tn[e].regexp=new RegExp(t,Tn[e].regexp.flags)}for(let e of Mn){let t=e.start.source;for(;t.match(Dn);)t=t.replace(Dn,(e=>dn[e].source));e.start=new RegExp(t,e.start.flags)}function Cn(e){return(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const En={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.Editor=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[],drop:[]};let t=e.element;this.textarea=e.textarea,this.textarea&&(this.textarea.tagName||(this.textarea=document.getElementById(this.textarea)),t||(t=this.textarea)),t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.getElementsByTagName("body")[0]),"TEXTAREA"==t.tagName&&(this.textarea=t,t=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.createEditorElement(t,e),this.setContent("string"==typeof e.content?e.content:this.textarea?this.textarea.value:"# Hello TinyMDE!\nEdit **here**")}createEditorElement(e,t){t&&void 0!==t.editor?t.editor.tagName?this.e=t.editor:this.e=document.getElementById(t.editor):this.e=document.createElement("div"),this.e.classList.add("TinyMDE"),this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",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("compositionend",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>this.handleSelectionChangeEvent(e))),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.e.addEventListener("drop",(e=>this.handleDrop(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),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.fireChange()}getContent(){return this.lines.join("\n")}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][mn.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(/(\${1,2})([0-9])/g,((e,n,s)=>"$"==n?Cn(t[s]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[s])}</span>`))}applyLineTypes(){for(let e=0;e<this.lines.length;e++){if(this.lineDirty[e]){let t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}updateLineTypes(){let e=!1,t=0,n=!1;for(let s=0;s<this.lines.length;s++){let r="TMPara",i=[this.lines[s]],l="$$0";if("TMCodeFenceBacktickOpen"==e){let n=mn.TMCodeFenceBacktickClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(r="TMCodeFenceBacktickClose",l=mn.TMCodeFenceBacktickClose.replacement,i=n,e=!1):(r="TMFencedCodeBacktick",l='<span class="TMFencedCode">$0<br /></span>',i=[this.lines[s]])}else if("TMCodeFenceTildeOpen"==e){let n=mn.TMCodeFenceTildeClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(r="TMCodeFenceTildeClose",l=mn.TMCodeFenceTildeClose.replacement,i=n,e=!1):(r="TMFencedCodeTilde",l='<span class="TMFencedCode">$0<br /></span>',i=[this.lines[s]])}if("TMPara"==r&&!1===n)for(let e of Mn)if(this.lines[s].match(e.start)&&(e.paraInterrupt||0==s||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1])){n=e;break}if(!1!==n&&(r="TMHTMLBlock",l='<span class="TMHTMLContent">$0<br /></span>',i=[this.lines[s]],n.end?this.lines[s].match(n.end)&&(n=!1):(s==this.lines.length-1||this.lines[s+1].match(mn.TMBlankLine.regexp))&&(n=!1)),"TMPara"==r)for(let e in mn)if(mn[e].regexp){let t=mn[e].regexp.exec(this.lines[s]);if(t){r=e,l=mn[e].replacement,i=t;break}}if("TMCodeFenceBacktickOpen"!=r&&"TMCodeFenceTildeOpen"!=r||(e=r,t=i.groups.seq.length),"TMIndentedCode"!=r&&"TMLinkReferenceDefinition"!=r||!(s>0)||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1]||(r="TMPara",i=[this.lines[s]],l="$$0"),"TMSetextH2Marker"==r){let e=mn.TMUL.regexp.exec(this.lines[s]);e&&(r="TMUL",l=mn.TMUL.replacement,i=e)}if("TMSetextH1Marker"==r||"TMSetextH2Marker"==r)if(0==s||"TMPara"!=this.lineTypes[s-1]){let e=mn.TMHR.regexp.exec(this.lines[s]);e?(r="TMHR",i=e,l=mn.TMHR.replacement):(r="TMPara",i=[this.lines[s]],l="$$0")}else{let e=s-1;const t="TMSetextH1Marker"==r?"TMSetextH1":"TMSetextH2";do{this.lineTypes[t]!=t&&(this.lineTypes[e]=t,this.lineDirty[t]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"==this.lineTypes[e])}this.lineTypes[s]!=r&&(this.lineTypes[s]=r,this.lineDirty[s]=!0),this.lineReplacements[s]=l,this.lineCaptures[s]=i}}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}parseLinkOrImage(e,t){let n=t?2:1,s=e.substr(0,n),r=t?"TMImage":"TMLink",i=n,l=1,a=!1,u=!1,o=[],c=[];e:for(;i<e.length&&!1===a;){let s=e.substr(i);for(let e of["escape","code","autolink","html"]){let t=Tn[e].regexp.exec(s);if(t){i+=t[0].length;continue e}}if(s.match(Tn.imageOpen.regexp))l++,i+=2;else if(s.match(Tn.linkOpen.regexp)){if(l++,!t&&this.parseLinkOrImage(s,!1))return!1;i+=1}else s.match(/^\]/)&&(l--,0==l)?(a=e.substr(n,i-n),i++):i++}if(!1===a)return!1;let p=i<e.length?e.substr(i,1):"";if("["==p){let t=e.substr(i),n=Tn.linkLabel.regexp.exec(t);if(!n)return!1;i+=n[0].length,o.push(n[1],n[2],n[3]),u=n[Tn.linkLabel.labelPlaceholder]?n[Tn.linkLabel.labelPlaceholder]:a.trim()}else if("("!=p)u=a.trim();else{i++;let t=1;for(;i<e.length&&t>0;){let n=e.substr(i),s=/^\s+/.exec(n);if(s){switch(c.length){case 0:case 1:c.push(s[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(s[0]);else{if(1!=t)return!1;c.push(""),c.push(s[0])}break;case 3:c.push(s[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;case 7:c[6]=c[6].concat(s[0]);break;default:return!1}i+=s[0].length}else if(s=Tn.escape.regexp.exec(n),s){switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}i+=s[0].length}else if(c.length<2&&n.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),i++;else if(1!=c.length&&2!=c.length||!n.match(/^>/))if(s=/^["']/.exec(n),!s||0!=c.length&&1!=c.length&&4!=c.length)if(!s||5!=c.length&&6!=c.length||c[4]!=s[0])if(n.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||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}i++}else if(n.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||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("");i++}else{if(s=/^./.exec(n),!s)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}i+=s[0].length}else 5==c.length&&c.push(""),c.push(s[0]),i++;else{for(;c.length<4;)c.push("");c.push(s[0]),i++}else 1==c.length&&c.push(""),c.push(">"),i++}if(t>0)return!1}if(!1!==u){let e=!1;for(let t of this.linkLabels)if(t==u){e=!0;break}let t=e?"TMLinkLabel TMLinkLabel_Valid":"TMLinkLabel TMLinkLabel_Invalid",n=`<span class="TMMark TMMark_${r}">${s}</span><span class="${r} ${o.length<3||!o[1]?t:""}">${this.processInlineStyles(a)}</span><span class="TMMark TMMark_${r}">]</span>`;return o.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${r}">${o[0]}</span>`,`<span class="${t}">${o[1]}</span>`,`<span class="TMMark TMMark_${r}">${o[2]}</span>`)),{output:n,charCount:i}}if(c){for(;c.length<7;)c.push("");return{output:`<span class="TMMark TMMark_${r}">${s}</span><span class="${r}">${this.processInlineStyles(a)}</span><span class="TMMark TMMark_${r}">](${c[0]}</span><span class="${r}Destination">${c[1]}</span><span class="TMMark TMMark_${r}">${c[2]}${c[3]}${c[4]}</span><span class="${r}Title">${c[5]}</span><span class="TMMark TMMark_${r}">${c[6]})</span>`,charCount:i}}return!1}processInlineStyles(e){let t="",n=[],s=0,r=e;e:for(;r;){for(let e of["escape","code","autolink","html"]){let n=Tn[e].regexp.exec(r);if(n){r=r.substr(n[0].length),s+=n[0].length,t+=Tn[e].replacement.replace(/\$([1-9])/g,((e,t)=>Cn(n[t])));continue e}}let i=r.match(Tn.linkOpen.regexp),l=r.match(Tn.imageOpen.regexp);if(l||i){let e=this.parseLinkOrImage(r,l);if(e){t=`${t}${e.output}`,r=r.substr(e.charCount),s+=e.charCount;continue e}}let a=/(^\*+)|(^_+)/.exec(r);if(a){let i=a[0].length;const l=a[0],u=a[0][0];r=r.substr(a[0].length);const o=s>0?e.substr(0,s):" ",c=s+a[0].length<e.length?r:" ",p=c.match(fn),h=o.match(gn),d=c.match(/^\s/),f=o.match(/\s$/);let g=!(d||p&&!f&&!h),m=!(f||h&&!d&&!p);if("_"==u&&g&&m&&(g=h,m=p),m){let e=n.length-1;for(;i&&e>=0;)if(n[e].delimiter==u){for(;e<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}if(i>=2&&n[e].count>=2?(t=`<span class="TMMark">${u}${u}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${u}${u}</span>`,i-=2,n[e].count-=2):(t=`<span class="TMMark">${u}</span><em class="TMEm">${t}</em><span class="TMMark">${u}</span>`,i-=1,n[e].count-=1),0==n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}i&&g&&(n.push({delimiter:u,delimString:l,count:i,output:t}),t="",i=0),i&&(t=`${t}${l.substr(0,i)}`),s+=a[0].length}else if(a=/^~~/.exec(r),a){let e=!1,i=n.length-1;for(;!e&&i>=0;)if("~"==n[i].delimiter){for(;i<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 i--;e||(n.push({delimiter:"~",delimString:"~~",count:2,output:t}),t=""),s+=a[0].length,r=r.substr(a[0].length)}else{if(a=Tn.default.regexp.exec(r),!a)throw"Infinite loop!";r=r.substr(a[0].length),s+=a[0].length,t+=Tn.default.replacement.replace(/\$([1-9])/g,((e,t)=>Cn(a[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}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;)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;)n--;let s=this.lines.length+n+1-t;s<-e&&(s=-e),s<0&&(s=0);let r=[];for(let n=0;n<s+e;n++)r.push(this.lineElements[t+n].textContent);this.spliceLines(t,s,r,!1)}else for(let e=0;e<this.lineElements.length;e++){let t=this.lineElements[e].textContent;this.lines[e]!==t&&(this.lines[e]=t,this.lineDirty[e]=!0)}}processNewParagraph(e){if(!e)return;this.updateLineContents();let t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}let s=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(1!=s.length){if(this.spliceLines(e.row,1,s,!0),e.row++,e.col=0,t){let n=mn[t].regexp.exec(this.lines[e.row-1]);n&&(n[2]?("TMOL"==t&&(n[1]=n[1].replace(/\d{1,9}/,(e=>parseInt(e[0])+1))),this.lines[e.row]=`${n[1]}${this.lines[e.row]}`,this.lineDirty[e.row]=!0,e.col=n[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}else this.updateFormatting()}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=window.getSelection();let n=e?t.anchorNode:t.focusNode;if(!n)return null;let s=e?t.anchorOffset:t.focusOffset;if(n==this.e)return s<this.lines.length?{row:s,col:0}:{row:s-1,col:this.lines[s-1].length};let r=this.computeColumn(n,s);if(null===r)return null;let i=n;for(;i.parentElement!=this.e;)i=i.parentElement;let l=0;if(!i.dataset||!i.dataset.lineNum||i.previousSibling&&i.previousSibling.dataset.lineNum==i.dataset.lineNum)for(;i.previousSibling;)l++,i=i.previousSibling;else l=parseInt(i.dataset.lineNum);return{row:l,col:r,node:n}}computeColumn(e,t){let n,s=e;for(;s&&s.parentNode!=this.e;)s=s.parentNode;if(null==s)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,s=e):t>0&&(s=e.childNodes[t-1],n=s.textContent.length);s.parentNode!=this.e;)s.previousSibling?(s=s.previousSibling,n+=s.textContent.length):s=s.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 s=this.lineElements[e];let r=s.firstChild,i=!1,l={node:s.firstChild?s.firstChild:s,offset:0};for(;r!=s;){if(!i&&r.nodeType===Node.TEXT_NODE)if(r.nodeValue.length>=t){if(!n||r.nodeValue.length!=t)return{node:r,offset:t};l={node:r,offset:t},t=0}else t-=r.nodeValue.length;!i&&r.firstChild?r=r.firstChild:r.nextSibling?(i=!1,r=r.nextSibling):(i=!0,r=r.parentNode)}return l}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let n=document.createRange(),{node:s,offset:r}=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),i=null,l=null;if(t&&(t.row!=e.row||t.col!=e.col)){let{node:n,offset:s}=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col);i=n,l=s}i?n.setStart(i,l):n.setStart(s,r),n.setEnd(s,r);let a=window.getSelection();a.removeAllRanges(),a.addRange(n)}handleInputEvent(e){if("insertCompositionText"==e.inputType)return;let t=this.getSelection();"insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t?(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting()):(this.clearDirtyFlag(),this.processNewParagraph(t)),t&&this.setSelection(t),this.fireChange()}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=function(e){const t=e.parentElement,n=e.nextSibling;t.removeChild(e);for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];r.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)}}))}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleSelectionChangeEvent(){this.fireSelection()}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(s)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let r=[],i=[];for(let t=0;t<n.length;t++)r.push(""),i.push(!0),s&&(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,...r),this.lineDirty.splice(e,t,...i)}handlePaste(e){e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}paste(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s||(s=this.getSelection(!0)),r||(r=this.getSelection(!1)),r||(r={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),s||(s=r),s.row<r.row||s.row==r.row&&s.col<=r.col?(t=s,n=r):(t=r,n=s);let i=e.split(/(?:\r\n|\r|\n)/),l=this.lines[t.row].substr(0,t.col),a=this.lines[n.row].substr(n.col);i[0]=l.concat(i[0]);let u=i[i.length-1].length;i[i.length-1]=i[i.length-1].concat(a),this.spliceLines(t.row,1+n.row-t.row,i),r.row=t.row+i.length-1,r.col=u,this.updateFormatting(),this.setSelection(r),this.fireChange()}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},s=n(e),r=n(t);if(s[0]!=r[0])return null;let i;for(i=0;s[i]==r[i];i++);return s[i-1]}computeEnclosingMarkupNode(e,t,n){let s=null;if(!e)return null;if(t){if(e.row!=t.row)return null;s=this.computeCommonAncestor(e.node,t.node)}else s=e.node;if(!s)return null;for(;s!=this.e;){if(s.className&&s.className.includes(n))return s;s=s.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r={};if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n){for(let e in En)r[e]=null;return r}s||(s=n),s.row<n.row||s.row==n.row&&s.col<n.col?(e=s,t=n):(e=n,t=s),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length);for(let i in En)if("inline"==En[i].type&&(n&&n.row==s.row&&this.isInlineFormattingAllowed(n,s)?r[i]=!!this.computeEnclosingMarkupNode(n,s,En[i].className)||n.col==s.col&&!!this.lines[n.row].substr(0,n.col).match(En[i].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(En[i].unset.postPattern):r[i]=null),"line"==En[i].type)if(n){let n=this.lineTypes[e.row]==En[i].className;for(let s=e.row;s<=t.row;s++)if(this.lineTypes[s]==En[i].className!=n){n=null;break}r[i]=n}else r[i]=null;return r}setCommandState(e,t){if("inline"==En[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(n,t))return;let s=this.computeEnclosingMarkupNode(n,t,En[e].className);if(this.clearDirtyFlag(),s){this.lineDirty[n.row]=!0;const r=this.computeColumn(s,0),i=s.textContent.length,l=this.lines[n.row].substr(0,r).replace(En[e].unset.prePattern,""),a=this.lines[n.row].substr(r,i),u=this.lines[n.row].substr(r+i).replace(En[e].unset.postPattern,"");this.lines[n.row]=l.concat(a,u),t.col=l.length,n.col=t.col+i,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else if(n.col==t.col&&this.lines[n.row].substr(0,n.col).match(En[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(En[e].unset.postPattern)){this.lineDirty[n.row]=!0;const s=this.lines[n.row].substr(0,n.col).replace(En[e].unset.prePattern,""),r=this.lines[n.row].substr(n.col).replace(En[e].unset.postPattern,"");this.lines[n.row]=s.concat(r),n.col=t.col=s.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let{startCol:s,endCol:r}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},i=this.lines[n.row].substr(s,r-s).match(/^(?<leading>\s*).*\S(?<trailing>\s*)$/);i&&(s+=i.groups.leading.length,r-=i.groups.trailing.length),n.col=s,t.col=r,this.wrapSelection(En[e].set.pre,En[e].set.post,n,t),this.fireChange()}}else if("line"==En[e].type){let n=this.getSelection(!0),s=this.getSelection(!1);if(n||(n=s),!s)return;this.clearDirtyFlag();let r=n.row>s.row?s:n,i=n.row>s.row?n:s;i.row>r.row&&0==i.col&&i.row--;for(let n=r.row;n<=i.row;n++)t&&this.lineTypes[n]!=En[e].className&&(this.lines[n]=this.lines[n].replace(En[e].set.pattern,En[e].set.replacement.replace("$#",n-r.row+1)),this.lineDirty[n]=!0),t||this.lineTypes[n]!=En[e].className||(this.lines[n]=this.lines[n].replace(En[e].unset.pattern,En[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:i.row,col:this.lines[i.row].length},{row:r.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.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!=this.e;){if(t.className&&"function"==typeof t.className.includes&&(t.className.includes("TMInlineFormatted")||t.className.includes("TMBlankLine")))return!0;t=t.parentNode}return!1}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n||!s||n.row!=s.row)return;this.lineDirty[n.row]=!0;const r=n.col<s.col?n.col:s.col,i=n.col<s.col?s.col:n.col,l=this.lines[n.row].substr(0,r).concat(e),a=i==r?"":this.lines[n.row].substr(r,i-r),u=t.concat(this.lines[n.row].substr(i));this.lines[n.row]=l.concat(a,u),s.col=l.length,n.col=s.col+a.length,this.updateFormatting(),this.setSelection(n,s)}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireChange(){if(!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.linesDirty})}fireSelection(){if(this.listeners.selection&&this.listeners.selection.length){let e=this.getSelection(!1),t=this.getSelection(!0),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})}}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}addEventListener(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t),e.match(/^(?:drop)$/i)&&this.listeners.drop.push(t)}}}));
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,s,r,i,a,u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l={};function o(){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 u&&u)||e("object"==typeof t&&t)||function(){return this}()||Function("return this")()}function c(){return r?s:(r=1,s=function(e){try{return!!e()}catch(e){return!0}})}function h(){if(a)return i;a=1;var e=c();return i=!e((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}var p,f,d,g,m,M,T,F,D,C,y,E,k,$,A,b,w={exports:{}};function v(){if(f)return p;f=1;var e=c();return p=!e((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))}function S(){if(g)return d;g=1;var e=v(),t=Function.prototype,n=t.call,s=e&&t.bind.bind(n,n);return d=e?s:function(e){return function(){return n.apply(e,arguments)}},d}function x(){if(M)return m;M=1;var e="object"==typeof document&&document.all;return m=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function L(){return F?T:(F=1,T=function(e){return null==e})}function N(){if(C)return D;C=1;var e=L(),t=TypeError;return D=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function B(){if(E)return y;E=1;var e=N(),t=Object;return y=function(n){return t(e(n))}}function H(){if($)return k;$=1;var e=S(),t=B(),n=e({}.hasOwnProperty);return k=Object.hasOwn||function(e,s){return n(t(e),s)}}var _,O,P,I,R,j,z,U,Z,q,V,K={exports:{}};function X(){if(I)return P;I=1;var e=o(),t=Object.defineProperty;return P=function(n,s){try{t(e,n,{value:s,configurable:!0,writable:!0})}catch(t){e[n]=s}return s}}function G(){if(R)return K.exports;R=1;var e=O?_:(O=1,_=!1),t=o(),n=X(),s="__core-js_shared__",r=K.exports=t[s]||n(s,{});return(r.versions||(r.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"}),K.exports}function W(){if(z)return j;z=1;var e=S(),t=x(),n=G(),s=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return s(e)}),j=n.inspectSource}function Y(){if(V)return q;V=1;var e=x();return q=function(t){return"object"==typeof t?null!==t:e(t)}}var J,Q,ee,te,ne,se,re,ie,ae,ue,le,oe,ce,he,pe,fe,de,ge,me,Me,Te,Fe,De,Ce,ye,Ee,ke,$e,Ae,be,we,ve,Se,xe,Le,Ne,Be,He,_e,Oe,Pe,Ie,Re,je,ze,Ue,Ze,qe,Ve,Ke,Xe,Ge,We,Ye,Je,Qe,et,tt,nt,st={};function rt(){if(te)return ee;te=1;var e=h(),t=c(),n=function(){if(Q)return J;Q=1;var e=o(),t=Y(),n=e.document,s=t(n)&&t(n.createElement);return J=function(e){return s?n.createElement(e):{}}}();return ee=!e&&!t((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function it(){if(ie)return re;ie=1;var e=Y(),t=String,n=TypeError;return re=function(s){if(e(s))return s;throw new n(t(s)+" is not an object")}}function at(){if(ue)return ae;ue=1;var e=v(),t=Function.prototype.call;return ae=e?t.bind(t):function(){return t.apply(t,arguments)},ae}function ut(){if(oe)return le;oe=1;var e=o(),t=x();return le=function(n,s){return arguments.length<2?(r=e[n],t(r)?r:void 0):e[n]&&e[n][s];var r},le}function lt(){if(ge)return de;ge=1;var e,t,n=o(),s=function(){if(fe)return pe;fe=1;var e=o().navigator,t=e&&e.userAgent;return pe=t?String(t):""}(),r=n.process,i=n.Deno,a=r&&r.versions||i&&i.version,u=a&&a.v8;return u&&(t=(e=u.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&s&&(!(e=s.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=s.match(/Chrome\/(\d+)/))&&(t=+e[1]),de=t}function ot(){if(Me)return me;Me=1;var e=lt(),t=c(),n=o().String;return me=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))}function ct(){if(Fe)return Te;Fe=1;var e=ot();return Te=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ht(){if(Ce)return De;Ce=1;var e=ut(),t=x(),n=function(){if(he)return ce;he=1;var e=S();return ce=e({}.isPrototypeOf)}(),s=ct(),r=Object;return De=s?function(e){return"symbol"==typeof e}:function(s){var i=e("Symbol");return t(i)&&n(i.prototype,r(s))}}function pt(){if(Ee)return ye;Ee=1;var e=String;return ye=function(t){try{return e(t)}catch(e){return"Object"}}}function ft(){if($e)return ke;$e=1;var e=x(),t=pt(),n=TypeError;return ke=function(s){if(e(s))return s;throw new n(t(s)+" is not a function")}}function dt(){if(be)return Ae;be=1;var e=ft(),t=L();return Ae=function(n,s){var r=n[s];return t(r)?void 0:e(r)}}function gt(){if(ve)return we;ve=1;var e=at(),t=x(),n=Y(),s=TypeError;return we=function(r,i){var a,u;if("string"===i&&t(a=r.toString)&&!n(u=e(a,r)))return u;if(t(a=r.valueOf)&&!n(u=e(a,r)))return u;if("string"!==i&&t(a=r.toString)&&!n(u=e(a,r)))return u;throw new s("Can't convert object to primitive value")}}function mt(){if(xe)return Se;xe=1;var e=G();return Se=function(t,n){return e[t]||(e[t]=n||{})}}function Mt(){if(Ne)return Le;Ne=1;var e=S(),t=0,n=Math.random(),s=e(1..toString);return Le=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++t+n,36)}}function Tt(){if(He)return Be;He=1;var e=o(),t=mt(),n=H(),s=Mt(),r=ot(),i=ct(),a=e.Symbol,u=t("wks"),l=i?a.for||a:a&&a.withoutSetter||s;return Be=function(e){return n(u,e)||(u[e]=r&&n(a,e)?a[e]:l("Symbol."+e)),u[e]}}function Ft(){if(Oe)return _e;Oe=1;var e=at(),t=Y(),n=ht(),s=dt(),r=gt(),i=Tt(),a=TypeError,u=i("toPrimitive");return _e=function(i,l){if(!t(i)||n(i))return i;var o,c=s(i,u);if(c){if(void 0===l&&(l="default"),o=e(c,i,l),!t(o)||n(o))return o;throw new a("Can't convert object to primitive value")}return void 0===l&&(l="number"),r(i,l)}}function Dt(){if(Ie)return Pe;Ie=1;var e=Ft(),t=ht();return Pe=function(n){var s=e(n,"string");return t(s)?s:s+""}}function Ct(){if(Re)return st;Re=1;var e=h(),t=rt(),n=function(){if(se)return ne;se=1;var e=h(),t=c();return ne=e&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}(),s=it(),r=Dt(),i=TypeError,a=Object.defineProperty,u=Object.getOwnPropertyDescriptor,l="enumerable",o="configurable",p="writable";return st.f=e?n?function(e,t,n){if(s(e),t=r(t),s(n),"function"==typeof e&&"prototype"===t&&"value"in n&&p in n&&!n[p]){var i=u(e,t);i&&i[p]&&(e[t]=n.value,n={configurable:o in n?n[o]:i[o],enumerable:l in n?n[l]:i[l],writable:!1})}return a(e,t,n)}:a:function(e,n,u){if(s(e),n=r(n),s(u),t)try{return a(e,n,u)}catch(e){}if("get"in u||"set"in u)throw new i("Accessors not supported");return"value"in u&&(e[n]=u.value),e},st}function yt(){return ze?je:(ze=1,je=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function Et(){if(Ze)return Ue;Ze=1;var e=h(),t=Ct(),n=yt();return Ue=e?function(e,s,r){return t.f(e,s,n(1,r))}:function(e,t,n){return e[t]=n,e}}function kt(){if(Ve)return qe;Ve=1;var e=mt(),t=Mt(),n=e("keys");return qe=function(e){return n[e]||(n[e]=t(e))}}function $t(){return Xe?Ke:(Xe=1,Ke={})}function At(){if(We)return Ge;We=1;var e,t,n,s=function(){if(Z)return U;Z=1;var e=o(),t=x(),n=e.WeakMap;return U=t(n)&&/native code/.test(String(n))}(),r=o(),i=Y(),a=Et(),u=H(),l=G(),c=kt(),h=$t(),p="Object already initialized",f=r.TypeError,d=r.WeakMap;if(s||l.state){var g=l.state||(l.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(u(e,m))throw new f(p);return t.facade=e,a(e,m,t),t},t=function(e){return u(e,m)?e[m]:{}},n=function(e){return u(e,m)}}return Ge={set:e,get:t,has:n,enforce:function(s){return n(s)?t(s):e(s,{})},getterFor:function(e){return function(n){var s;if(!i(n)||(s=t(n)).type!==e)throw new f("Incompatible receiver, "+e+" required");return s}}}}function bt(){if(Ye)return w.exports;Ye=1;var e=S(),t=c(),n=x(),s=H(),r=h(),i=function(){if(b)return A;b=1;var e=h(),t=H(),n=Function.prototype,s=e&&Object.getOwnPropertyDescriptor,r=t(n,"name"),i=r&&"something"===function(){}.name,a=r&&(!e||e&&s(n,"name").configurable);return A={EXISTS:r,PROPER:i,CONFIGURABLE:a}}().CONFIGURABLE,a=W(),u=At(),l=u.enforce,o=u.get,p=String,f=Object.defineProperty,d=e("".slice),g=e("".replace),m=e([].join),M=r&&!t((function(){return 8!==f((function(){}),"length",{value:8}).length})),T=String(String).split("String"),F=w.exports=function(e,t,n){"Symbol("===d(p(t),0,7)&&(t="["+g(p(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!s(e,"name")||i&&e.name!==t)&&(r?f(e,"name",{value:t,configurable:!0}):e.name=t),M&&n&&s(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?r&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=l(e);return s(a,"source")||(a.source=m(T,"string"==typeof t?t:"")),e};return Function.prototype.toString=F((function(){return n(this)&&o(this).source||a(this)}),"toString"),w.exports}function wt(){if(Qe)return Je;Qe=1;var e=bt(),t=Ct();return Je=function(n,s,r){return r.get&&e(r.get,s,{getter:!0}),r.set&&e(r.set,s,{setter:!0}),t.f(n,s,r)}}!function(){if(nt)return l;nt=1;var e=o(),t=h(),n=wt(),s=function(){if(tt)return et;tt=1;var e=it();return et=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}}(),r=c(),i=e.RegExp,a=i.prototype;t&&r((function(){var e=!0;try{i(".","d")}catch(t){e=!1}var t={},n="",s=e?"dgimsy":"gimsy",r=function(e,s){Object.defineProperty(t,e,{get:function(){return n+=s,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var l in e&&(u.hasIndices="d"),u)r(l,u[l]);return Object.getOwnPropertyDescriptor(a,"flags").get.call(t)!==s||n!==s}))&&n(a,"flags",{configurable:!0,get:s})}();const vt={ASCIIPunctuation:/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,NotTriggerChar:/[^`_*[\]()<>!~]/,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/},St=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])/),xt=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])$/),Lt={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}};var Nt=[{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}],Bt={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">&lt;</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">&gt;</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"}};const Ht=new RegExp(Object.keys(vt).join("|")),_t=[...Object.keys(Bt)];for(let e of _t){let t=Bt[e].regexp.source;for(;t.match(Ht);)t=t.replace(Ht,(e=>vt[e].source));Bt[e].regexp=new RegExp(t,Bt[e].regexp.flags)}for(let e of Nt){let t=e.start.source;for(;t.match(Ht);)t=t.replace(Ht,(e=>vt[e].source));e.start=new RegExp(t,e.start.flags)}function Ot(e){return(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Pt={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.Editor=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.e=null,this.textarea=null,this.lines=[],this.lineElements=[],this.lineTypes=[],this.lineCaptures=[],this.lineReplacements=[],this.linkLabels=[],this.lineDirty=[],this.lastCommandState=null,this.listeners={change:[],selection:[],drop:[]};let t=e.element;this.textarea=e.textarea,this.textarea&&(this.textarea.tagName||(this.textarea=document.getElementById(this.textarea)),t||(t=this.textarea)),t&&!t.tagName&&(t=document.getElementById(e.element)),t||(t=document.getElementsByTagName("body")[0]),"TEXTAREA"==t.tagName&&(this.textarea=t,t=this.textarea.parentNode),this.textarea&&(this.textarea.style.display="none"),this.undoStack=[],this.redoStack=[],this.isRestoringHistory=!1,this.maxHistory=100,this.createEditorElement(t,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)))}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){(/Mac|iPod|iPhone|iPad/.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?t.editor.tagName?this.e=t.editor:this.e=document.getElementById(t.editor):this.e=document.createElement("div"),this.e.classList.add("TinyMDE"),this.e.contentEditable=!0,this.e.style.whiteSpace="pre-wrap",this.e.style.webkitUserModify="read-write-plaintext-only",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("compositionend",(e=>this.handleInputEvent(e))),document.addEventListener("selectionchange",(e=>this.handleSelectionChangeEvent(e))),this.e.addEventListener("paste",(e=>this.handlePaste(e))),this.e.addEventListener("drop",(e=>this.handleDrop(e))),this.lineElements=this.e.childNodes}setContent(e){for(;this.e.firstChild;)this.e.removeChild(this.e.firstChild);this.lines=e.split(/(?:\r\n|\r|\n)/),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.fireChange(),this.isRestoringHistory||this.pushHistory()}getContent(){return this.lines.join("\n")}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][Lt.TMLinkReferenceDefinition.labelPlaceholder])}replace(e,t){return e.replace(/(\${1,2})([0-9])/g,((e,n,s)=>"$"==n?Ot(t[s]):`<span class="TMInlineFormatted">${this.processInlineStyles(t[s])}</span>`))}applyLineTypes(){for(let e=0;e<this.lines.length;e++){if(this.lineDirty[e]){let t=this.replace(this.lineReplacements[e],this.lineCaptures[e]);this.lineElements[e].className=this.lineTypes[e],this.lineElements[e].removeAttribute("style"),this.lineElements[e].innerHTML=""==t?"<br />":t}this.lineElements[e].dataset.lineNum=e}}updateLineTypes(){let e=!1,t=0,n=!1;for(let s=0;s<this.lines.length;s++){let r="TMPara",i=[this.lines[s]],a="$$0";if("TMCodeFenceBacktickOpen"==e){let n=Lt.TMCodeFenceBacktickClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(r="TMCodeFenceBacktickClose",a=Lt.TMCodeFenceBacktickClose.replacement,i=n,e=!1):(r="TMFencedCodeBacktick",a='<span class="TMFencedCode">$0<br /></span>',i=[this.lines[s]])}else if("TMCodeFenceTildeOpen"==e){let n=Lt.TMCodeFenceTildeClose.regexp.exec(this.lines[s]);n&&n.groups.seq.length>=t?(r="TMCodeFenceTildeClose",a=Lt.TMCodeFenceTildeClose.replacement,i=n,e=!1):(r="TMFencedCodeTilde",a='<span class="TMFencedCode">$0<br /></span>',i=[this.lines[s]])}if("TMPara"==r&&!1===n)for(let e of Nt)if(this.lines[s].match(e.start)&&(e.paraInterrupt||0==s||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1])){n=e;break}if(!1!==n&&(r="TMHTMLBlock",a='<span class="TMHTMLContent">$0<br /></span>',i=[this.lines[s]],n.end?this.lines[s].match(n.end)&&(n=!1):(s==this.lines.length-1||this.lines[s+1].match(Lt.TMBlankLine.regexp))&&(n=!1)),"TMPara"==r)for(let e in Lt)if(Lt[e].regexp){let t=Lt[e].regexp.exec(this.lines[s]);if(t){r=e,a=Lt[e].replacement,i=t;break}}if("TMCodeFenceBacktickOpen"!=r&&"TMCodeFenceTildeOpen"!=r||(e=r,t=i.groups.seq.length),"TMIndentedCode"!=r&&"TMLinkReferenceDefinition"!=r||!(s>0)||"TMPara"!=this.lineTypes[s-1]&&"TMUL"!=this.lineTypes[s-1]&&"TMOL"!=this.lineTypes[s-1]&&"TMBlockquote"!=this.lineTypes[s-1]||(r="TMPara",i=[this.lines[s]],a="$$0"),"TMSetextH2Marker"==r){let e=Lt.TMUL.regexp.exec(this.lines[s]);e&&(r="TMUL",a=Lt.TMUL.replacement,i=e)}if("TMSetextH1Marker"==r||"TMSetextH2Marker"==r)if(0==s||"TMPara"!=this.lineTypes[s-1]){let e=Lt.TMHR.regexp.exec(this.lines[s]);e?(r="TMHR",i=e,a=Lt.TMHR.replacement):(r="TMPara",i=[this.lines[s]],a="$$0")}else{let e=s-1;const t="TMSetextH1Marker"==r?"TMSetextH1":"TMSetextH2";do{this.lineTypes[t]!=t&&(this.lineTypes[e]=t,this.lineDirty[t]=!0),this.lineReplacements[e]="$$0",this.lineCaptures[e]=[this.lines[e]],e--}while(e>=0&&"TMPara"==this.lineTypes[e])}this.lineTypes[s]!=r&&(this.lineTypes[s]=r,this.lineDirty[s]=!0),this.lineReplacements[s]=a,this.lineCaptures[s]=i}}updateLineContentsAndFormatting(){this.clearDirtyFlag(),this.updateLineContents(),this.updateFormatting()}parseLinkOrImage(e,t){let n=t?2:1,s=e.substr(0,n),r=t?"TMImage":"TMLink",i=n,a=1,u=!1,l=!1,o=[],c=[];e:for(;i<e.length&&!1===u;){let s=e.substr(i);for(let e of["escape","code","autolink","html"]){let t=Bt[e].regexp.exec(s);if(t){i+=t[0].length;continue e}}if(s.match(Bt.imageOpen.regexp))a++,i+=2;else if(s.match(Bt.linkOpen.regexp)){if(a++,!t&&this.parseLinkOrImage(s,!1))return!1;i+=1}else s.match(/^\]/)&&(a--,0==a)?(u=e.substr(n,i-n),i++):i++}if(!1===u)return!1;let h=i<e.length?e.substr(i,1):"";if("["==h){let t=e.substr(i),n=Bt.linkLabel.regexp.exec(t);if(!n)return!1;i+=n[0].length,o.push(n[1],n[2],n[3]),l=n[Bt.linkLabel.labelPlaceholder]?n[Bt.linkLabel.labelPlaceholder]:u.trim()}else if("("!=h)l=u.trim();else{i++;let t=1;for(;i<e.length&&t>0;){let n=e.substr(i),s=/^\s+/.exec(n);if(s){switch(c.length){case 0:case 1:c.push(s[0]);break;case 2:if(c[0].match(/</))c[1]=c[1].concat(s[0]);else{if(1!=t)return!1;c.push(""),c.push(s[0])}break;case 3:c.push(s[0]);break;case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;case 7:c[6]=c[6].concat(s[0]);break;default:return!1}i+=s[0].length}else if(s=Bt.escape.regexp.exec(n),s){switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}i+=s[0].length}else if(c.length<2&&n.match(/^</))0==c.length&&c.push(""),c[0]=c[0].concat("<"),i++;else if(1!=c.length&&2!=c.length||!n.match(/^>/))if(s=/^["']/.exec(n),!s||0!=c.length&&1!=c.length&&4!=c.length)if(!s||5!=c.length&&6!=c.length||c[4]!=s[0])if(n.match(/^\(/)){switch(c.length){case 0:c.push("");case 1:c.push("");case 2:c[1]=c[1].concat("("),c[0].match(/<$/)||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}i++}else if(n.match(/^\)/)){if(c.length<=2){for(;c.length<2;)c.push("");c[0].match(/<$/)||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("");i++}else{if(s=/^./.exec(n),!s)throw"Infinite loop";switch(c.length){case 0:c.push("");case 1:c.push(s[0]);break;case 2:c[1]=c[1].concat(s[0]);break;case 3:case 4:return!1;case 5:c.push("");case 6:c[5]=c[5].concat(s[0]);break;default:return!1}i+=s[0].length}else 5==c.length&&c.push(""),c.push(s[0]),i++;else{for(;c.length<4;)c.push("");c.push(s[0]),i++}else 1==c.length&&c.push(""),c.push(">"),i++}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_${r}">${s}</span><span class="${r} ${o.length<3||!o[1]?t:""}">${this.processInlineStyles(u)}</span><span class="TMMark TMMark_${r}">]</span>`;return o.length>=3&&(n=n.concat(`<span class="TMMark TMMark_${r}">${o[0]}</span>`,`<span class="${t}">${o[1]}</span>`,`<span class="TMMark TMMark_${r}">${o[2]}</span>`)),{output:n,charCount:i}}if(c){for(;c.length<7;)c.push("");return{output:`<span class="TMMark TMMark_${r}">${s}</span><span class="${r}">${this.processInlineStyles(u)}</span><span class="TMMark TMMark_${r}">](${c[0]}</span><span class="${r}Destination">${c[1]}</span><span class="TMMark TMMark_${r}">${c[2]}${c[3]}${c[4]}</span><span class="${r}Title">${c[5]}</span><span class="TMMark TMMark_${r}">${c[6]})</span>`,charCount:i}}return!1}processInlineStyles(e){let t="",n=[],s=0,r=e;e:for(;r;){for(let e of["escape","code","autolink","html"]){let n=Bt[e].regexp.exec(r);if(n){r=r.substr(n[0].length),s+=n[0].length,t+=Bt[e].replacement.replace(/\$([1-9])/g,((e,t)=>Ot(n[t])));continue e}}let i=r.match(Bt.linkOpen.regexp),a=r.match(Bt.imageOpen.regexp);if(a||i){let e=this.parseLinkOrImage(r,a);if(e){t=`${t}${e.output}`,r=r.substr(e.charCount),s+=e.charCount;continue e}}let u=/(^\*+)|(^_+)/.exec(r);if(u){let i=u[0].length;const a=u[0],l=u[0][0];r=r.substr(u[0].length);const o=s>0?e.substr(0,s):" ",c=s+u[0].length<e.length?r:" ",h=c.match(St),p=o.match(xt),f=c.match(/^\s/),d=o.match(/\s$/);let g=!(f||h&&!d&&!p),m=!(d||p&&!f&&!h);if("_"==l&&g&&m&&(g=p,m=h),m){let e=n.length-1;for(;i&&e>=0;)if(n[e].delimiter==l){for(;e<n.length-1;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}if(i>=2&&n[e].count>=2?(t=`<span class="TMMark">${l}${l}</span><strong class="TMStrong">${t}</strong><span class="TMMark">${l}${l}</span>`,i-=2,n[e].count-=2):(t=`<span class="TMMark">${l}</span><em class="TMEm">${t}</em><span class="TMMark">${l}</span>`,i-=1,n[e].count-=1),0==n[e].count){t=`${n.pop().output}${t}`,e--}}else e--}i&&g&&(n.push({delimiter:l,delimString:a,count:i,output:t}),t="",i=0),i&&(t=`${t}${a.substr(0,i)}`),s+=u[0].length}else if(u=/^~~/.exec(r),u){let e=!1,i=n.length-1;for(;!e&&i>=0;)if("~"==n[i].delimiter){for(;i<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 i--;e||(n.push({delimiter:"~",delimString:"~~",count:2,output:t}),t=""),s+=u[0].length,r=r.substr(u[0].length)}else{if(u=Bt.default.regexp.exec(r),!u)throw"Infinite loop!";r=r.substr(u[0].length),s+=u[0].length,t+=Bt.default.replacement.replace(/\$([1-9])/g,((e,t)=>Ot(u[t])))}}for(;n.length;){const e=n.pop();t=`${e.output}${e.delimString.substr(0,e.count)}${t}`}return t}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 s=this.lines.length+n+1-t;s<-e&&(s=-e),s<0&&(s=0);let r=[];for(let n=0;n<s+e;n++)r.push(this.lineElements[t+n].textContent);this.spliceLines(t,s,r,!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)}}processNewParagraph(e){if(!e)return;this.updateLineContents();let t=!1,n=e.col>0?e.row:e.row-1;switch(this.lineTypes[n]){case"TMUL":t="TMUL";break;case"TMOL":t="TMOL";break;case"TMIndentedCode":t="TMIndentedCode"}let s=this.lines[e.row].replace(/\n\n$/,"\n").split(/(?:\r\n|\n|\r)/);if(s.length>1&&(this.spliceLines(e.row,1,s,!0),e.row++,e.col=0),t){let n=Lt[t].regexp.exec(this.lines[e.row-1]);n&&(n[2]?("TMOL"==t&&(n[1]=n[1].replace(/\d{1,9}/,(e=>parseInt(e[0])+1))),this.lines[e.row]=`${n[1]}${this.lines[e.row]}`,this.lineDirty[e.row]=!0,e.col=n[1].length):(this.lines[e.row-1]="",this.lineDirty[e.row-1]=!0))}this.updateFormatting()}getSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=window.getSelection();let n=e?t.anchorNode:t.focusNode;if(!n)return null;let s=e?t.anchorOffset:t.focusOffset;if(n==this.e)return s<this.lines.length?{row:s,col:0}:{row:s-1,col:this.lines[s-1].length};let r=this.computeColumn(n,s);if(null===r)return null;let i=n;for(;i.parentElement!=this.e;)i=i.parentElement;let a=0;if(!i.dataset||!i.dataset.lineNum||i.previousSibling&&i.previousSibling.dataset.lineNum==i.dataset.lineNum)for(;i.previousSibling;)a++,i=i.previousSibling;else a=parseInt(i.dataset.lineNum);return{row:a,col:r,node:n}}computeColumn(e,t){let n,s=e;for(;s&&s.parentNode!=this.e;)s=s.parentNode;if(null==s)return null;for(e.nodeType===Node.TEXT_NODE||0===t?(n=t,s=e):t>0&&(s=e.childNodes[t-1],n=s.textContent.length);s.parentNode!=this.e;)s.previousSibling?(s=s.previousSibling,n+=s.textContent.length):s=s.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 s=this.lineElements[e];let r=s.firstChild,i=!1,a={node:s.firstChild?s.firstChild:s,offset:0};for(;r!=s;){if(!i&&r.nodeType===Node.TEXT_NODE)if(r.nodeValue.length>=t){if(!n||r.nodeValue.length!=t)return{node:r,offset:t};a={node:r,offset:t},t=0}else t-=r.nodeValue.length;!i&&r.firstChild?r=r.firstChild:r.nextSibling?(i=!1,r=r.nextSibling):(i=!0,r=r.parentNode)}return a}setSelection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let{node:n,offset:s}=this.computeNodeAndOffset(e.row,e.col,t&&t.row==e.row&&t.col>e.col),r=null,i=null;if(t&&(t.row!=e.row||t.col!=e.col)){let{node:n,offset:s}=this.computeNodeAndOffset(t.row,t.col,e.row==t.row&&e.col>t.col);r=n,i=s}window.getSelection().setBaseAndExtent(n,s,r||n,r?i:s)}handleInputEvent(e){if(this.isRestoringHistory||this.pushHistory(),"insertCompositionText"==e.inputType)return;let t=this.getSelection();"insertParagraph"!=e.inputType&&"insertLineBreak"!=e.inputType||!t?(this.e.firstChild?this.fixNodeHierarchy():this.e.innerHTML='<div class="TMBlankLine"><br></div>',this.updateLineContentsAndFormatting()):(this.clearDirtyFlag(),this.processNewParagraph(t)),t&&this.setSelection(t),this.fireChange()}fixNodeHierarchy(){const e=Array.from(this.e.childNodes),t=function(e){const t=e.parentElement,n=e.nextSibling;t.removeChild(e);for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];r.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)}}))}handleDrop(e){e.preventDefault(),this.fireDrop(e.dataTransfer)}handleSelectionChangeEvent(){this.fireSelection()}spliceLines(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(s)for(let n=0;n<t;n++)this.e.removeChild(this.e.childNodes[e]);let r=[],i=[];for(let t=0;t<n.length;t++)r.push(""),i.push(!0),s&&(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,...r),this.lineDirty.splice(e,t,...i)}handlePaste(e){this.isRestoringHistory||this.pushHistory(),e.preventDefault();let t=(e.originalEvent||e).clipboardData.getData("text/plain");this.paste(t)}paste(e){let t,n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s||(s=this.getSelection(!0)),r||(r=this.getSelection(!1)),r||(r={row:this.lines.length-1,col:this.lines[this.lines.length-1].length}),s||(s=r),s.row<r.row||s.row==r.row&&s.col<=r.col?(t=s,n=r):(t=r,n=s);let i=e.split(/(?:\r\n|\r|\n)/),a=this.lines[t.row].substr(0,t.col),u=this.lines[n.row].substr(n.col);i[0]=a.concat(i[0]);let l=i[i.length-1].length;i[i.length-1]=i[i.length-1].concat(u),this.spliceLines(t.row,1+n.row-t.row,i),r.row=t.row+i.length-1,r.col=l,this.updateFormatting(),this.setSelection(r),this.fireChange()}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},s=n(e),r=n(t);if(s[0]!=r[0])return null;let i;for(i=0;s[i]==r[i];i++);return s[i-1]}computeEnclosingMarkupNode(e,t,n){let s=null;if(!e)return null;if(t){if(e.row!=t.row)return null;s=this.computeCommonAncestor(e.node,t.node)}else s=e.node;if(!s)return null;for(;s!=this.e;){if(s.className&&s.className.includes(n))return s;s=s.parentNode}return null}getCommandState(){let e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r={};if(n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n){for(let e in Pt)r[e]=null;return r}s||(s=n),s.row<n.row||s.row==n.row&&s.col<n.col?(e=s,t=n):(e=n,t=s),t.row>e.row&&0==t.col&&(t.row--,t.col=this.lines[t.row].length);for(let i in Pt)if("inline"==Pt[i].type&&(n&&n.row==s.row&&this.isInlineFormattingAllowed(n,s)?r[i]=!!this.computeEnclosingMarkupNode(n,s,Pt[i].className)||n.col==s.col&&!!this.lines[n.row].substr(0,n.col).match(Pt[i].unset.prePattern)&&!!this.lines[n.row].substr(n.col).match(Pt[i].unset.postPattern):r[i]=null),"line"==Pt[i].type)if(n){let n=this.lineTypes[e.row]==Pt[i].className;for(let s=e.row;s<=t.row;s++)if(this.lineTypes[s]==Pt[i].className!=n){n=null;break}r[i]=n}else r[i]=null;return r}setCommandState(e,t){if(this.isRestoringHistory||this.pushHistory(),"inline"==Pt[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(n,t))return;let s=this.computeEnclosingMarkupNode(n,t,Pt[e].className);if(this.clearDirtyFlag(),s){this.lineDirty[n.row]=!0;const r=this.computeColumn(s,0),i=s.textContent.length,a=this.lines[n.row].substr(0,r).replace(Pt[e].unset.prePattern,""),u=this.lines[n.row].substr(r,i),l=this.lines[n.row].substr(r+i).replace(Pt[e].unset.postPattern,"");this.lines[n.row]=a.concat(u,l),t.col=a.length,n.col=t.col+i,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else if(n.col==t.col&&this.lines[n.row].substr(0,n.col).match(Pt[e].unset.prePattern)&&this.lines[n.row].substr(n.col).match(Pt[e].unset.postPattern)){this.lineDirty[n.row]=!0;const s=this.lines[n.row].substr(0,n.col).replace(Pt[e].unset.prePattern,""),r=this.lines[n.row].substr(n.col).replace(Pt[e].unset.postPattern,"");this.lines[n.row]=s.concat(r),n.col=t.col=s.length,this.updateFormatting(),this.setSelection(n,t),this.fireChange()}else{let{startCol:s,endCol:r}=n.col<t.col?{startCol:n.col,endCol:t.col}:{startCol:t.col,endCol:n.col},i=this.lines[n.row].substr(s,r-s).match(/^(?<leading>\s*).*\S(?<trailing>\s*)$/);i&&(s+=i.groups.leading.length,r-=i.groups.trailing.length),n.col=s,t.col=r,this.wrapSelection(Pt[e].set.pre,Pt[e].set.post,n,t),this.fireChange()}}else if("line"==Pt[e].type){let n=this.getSelection(!0),s=this.getSelection(!1);if(n||(n=s),!s)return;this.clearDirtyFlag();let r=n.row>s.row?s:n,i=n.row>s.row?n:s;i.row>r.row&&0==i.col&&i.row--;for(let n=r.row;n<=i.row;n++)t&&this.lineTypes[n]!=Pt[e].className&&(this.lines[n]=this.lines[n].replace(Pt[e].set.pattern,Pt[e].set.replacement.replace("$#",n-r.row+1)),this.lineDirty[n]=!0),t||this.lineTypes[n]!=Pt[e].className||(this.lines[n]=this.lines[n].replace(Pt[e].unset.pattern,Pt[e].unset.replacement),this.lineDirty[n]=!0);this.updateFormatting(),this.setSelection({row:i.row,col:this.lines[i.row].length},{row:r.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.className&&t.nextSibling.className.includes("TMInlineFormatted"))return!0}let t=this.computeCommonAncestor(e.focusNode,e.anchorNode);if(!t)return!1;for(;t&&t!=this.e;){if(t.className&&"function"==typeof t.className.includes&&(t.className.includes("TMInlineFormatted")||t.className.includes("TMBlankLine")))return!0;t=t.parentNode}return!1}wrapSelection(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.isRestoringHistory||this.pushHistory(),n||(n=this.getSelection(!1)),s||(s=this.getSelection(!0)),!n||!s||n.row!=s.row)return;this.lineDirty[n.row]=!0;const r=n.col<s.col?n.col:s.col,i=n.col<s.col?s.col:n.col,a=this.lines[n.row].substr(0,r).concat(e),u=i==r?"":this.lines[n.row].substr(r,i-r),l=t.concat(this.lines[n.row].substr(i));this.lines[n.row]=a.concat(u,l),s.col=a.length,n.col=s.col+u.length,this.updateFormatting(),this.setSelection(n,s)}toggleCommandState(e){this.lastCommandState||(this.lastCommandState=this.getCommandState()),this.setCommandState(e,!this.lastCommandState[e])}fireChange(){if(!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.linesDirty})}fireSelection(){if(this.listeners.selection&&this.listeners.selection.length){let e=this.getSelection(!1),t=this.getSelection(!0),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})}}fireDrop(e){for(let t of this.listeners.drop)t({dataTransfer:e})}addEventListener(e,t){e.match(/^(?:change|input)$/i)&&this.listeners.change.push(t),e.match(/^(?:selection|selectionchange)$/i)&&this.listeners.selection.push(t),e.match(/^(?:drop)$/i)&&this.listeners.drop.push(t)}get canUndo(){return this.undoStack.length>1}get canRedo(){return this.redoStack.length>0}}}));