lexxy 0.9.20 → 0.9.21
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.
- checksums.yaml +4 -4
- data/app/assets/javascript/lexxy.js +46 -14
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.js.map +1 -1
- data/app/assets/javascript/lexxy.min.js +1 -1
- data/app/assets/javascript/lexxy.min.js.br +0 -0
- data/app/assets/javascript/lexxy.min.js.gz +0 -0
- data/lib/lexxy/version.rb +1 -1
- metadata +1 -1
|
@@ -8,4 +8,4 @@ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?windo
|
|
|
8
8
|
* @public
|
|
9
9
|
*/t.exports&&(t.exports=n),void 0!==e&&(e.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i["language-"+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(void 0!==n&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",r="loading",i="loaded",o="pre[data-src]:not(["+t+'="'+i+'"]):not(['+t+'="'+r+'"])';n.hooks.add("before-highlightall",(function(e){e.selector+=", "+o})),n.hooks.add("before-sanity-check",(function(s){var l=s.element;if(l.matches(o)){s.code="",l.setAttribute(t,r);var a=l.appendChild(document.createElement("CODE"));a.textContent="Loading…";var c=l.getAttribute("data-src"),u=s.language;if("none"===u){var d=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[d]||d}n.util.setLanguage(a,u),n.util.setLanguage(l,u);var h=n.plugins.autoloader;h&&h.loadLanguages(u),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?n("✖ Error "+r.status+" while fetching file: "+r.statusText):n("✖ Error: File does not exist or is empty"))},r.send(null)}(c,(function(e){l.setAttribute(t,i);var r=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}(l.getAttribute("data-range"));if(r){var o=e.split(/\r\n?|\n/g),s=r[0],c=null==r[1]?o.length:r[1];s<0&&(s+=o.length),s=Math.max(0,Math.min(s-1,o.length)),c<0&&(c+=o.length),c=Math.max(0,Math.min(c,o.length)),e=o.slice(s,c).join("\n"),l.hasAttribute("data-start")||l.setAttribute("data-start",String(s+1))}a.textContent=e,n.highlightElement(a)}),(function(e){l.setAttribute(t,"failed"),a.textContent=e}))}})),n.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(o),i=0;t=r[i++];)n.highlightElement(t)}};var s=!1;n.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}(r)),r.exports),s=t(o);s.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(s),s.languages.javascript=s.languages.extend("clike",{"class-name":[s.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:s.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:s.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),s.languages.js=s.languages.javascript,s.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:s.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:s.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},s.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(e,t){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:s.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+o+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+o+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var i=t[n];if("code"===i.type){var o=i.content[1],s=i.content[3];if(o&&s&&"code-language"===o.type&&"code-block"===s.type&&"string"==typeof o.content){var l=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),a="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,a]:s.alias.push(a):s.alias=[a]}}else e(i.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,i=t.classes.length;r<i;r++){var o=t.classes[r],c=/language-(.+)/.exec(o);if(c){n=c[1];break}}var u=e.languages[n];if(u)t.content=e.highlight(function(e){var t=e.replace(s,"");return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),a(n);var r=l[t];return r||e})),t}(t.content),u,n);else if(n&&"none"!==n&&e.plugins.autoloader){var d="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=d,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(s),s.languages.c=s.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),s.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),s.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},s.languages.c.string],char:s.languages.c.char,comment:s.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:s.languages.c}}}}),s.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete s.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(s),s.languages.objectivec=s.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete s.languages.objectivec["class-name"],s.languages.objc=s.languages.objectivec,s.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},(i=s.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/}).string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:i},boolean:i.boolean,variable:i.variable};var l;l||(l=1,s.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},s.languages.python["string-interpolation"].inside.interpolation.inside.rest=s.languages.python,s.languages.py=s.languages.python);var a;a||(a=1,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(s)),s.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},s.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=s.languages.swift}));var c;c||(c=1,function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(s));var u;u||(u=1,function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(s));var d;d||(d=1,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(s)),function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,i,o){if(n.language===r){var s=n.tokenStack=[];n.code=n.code.replace(i,(function(e){if("function"==typeof o&&!o(e))return e;for(var i,l=s.length;-1!==n.code.indexOf(i=t(r,l));)++l;return s[l]=e,i})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var i=0,o=Object.keys(n.tokenStack);!function s(l){for(var a=0;a<l.length&&!(i>=o.length);a++){var c=l[a];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[i],d=n.tokenStack[u],h="string"==typeof c?c:c.content,g=t(r,u),p=h.indexOf(g);if(p>-1){++i;var f=h.substring(0,p),m=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),y=h.substring(p+g.length),b=[];f&&b.push.apply(b,s([f])),b.push(m),y&&b.push.apply(b,s([y])),"string"==typeof c?l.splice.apply(l,[a,1].concat(b)):c.content=b}}else c.content&&s(c.content)}return l}(n.tokens)}}}})}(s);var h;h||(h=1,function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(s));var g;g||(g=1,function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:i,punctuation:o};var s={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:s}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:s}}];e.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:i,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",(function(t){/<\?/.test(t.code)&&e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")}))}(s)),s.languages.go=s.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),s.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete s.languages.go["class-name"],function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,s=0;s<i.length;s++)o[i[s]]=e.languages.bash[i[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(s),s.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},s.languages.webmanifest=s.languages.json,function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(s),window.Prism||={},window.Prism.manual=!0;
|
|
10
10
|
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
11
|
-
const{entries:p,setPrototypeOf:f,isFrozen:m,getPrototypeOf:y,getOwnPropertyDescriptor:b}=Object;let{freeze:_,seal:x,create:C}=Object,{apply:S,construct:v}="undefined"!=typeof Reflect&&Reflect;_||(_=function(e){return e}),x||(x=function(e){return e}),S||(S=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),v||(v=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const w=$(Array.prototype.forEach),k=$(Array.prototype.lastIndexOf),E=$(Array.prototype.pop),T=$(Array.prototype.push),N=$(Array.prototype.splice),A=$(String.prototype.toLowerCase),L=$(String.prototype.toString),O=$(String.prototype.match),F=$(String.prototype.replace),I=$(String.prototype.indexOf),R=$(String.prototype.trim),P=$(Object.prototype.hasOwnProperty),M=$(RegExp.prototype.test),D=(B=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v(B,t)});var B;function $(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S(e,t,r)}}function z(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A;f&&f(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(m(t)||(t[r]=e),i=e)}e[i]=!0}return e}function H(e){for(let t=0;t<e.length;t++){P(e,t)||(e[t]=null)}return e}function K(e){const t=C(null);for(const[n,r]of p(e)){P(e,n)&&(Array.isArray(r)?t[n]=H(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=K(r):t[n]=r)}return t}function U(e,t){for(;null!==e;){const n=b(e,t);if(n){if(n.get)return $(n.get);if("function"==typeof n.value)return $(n.value)}e=y(e)}return function(){return null}}const W=_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),q=_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),j=_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Z=_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),J=_(["#text"]),Y=_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),X=_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Q=_(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ee=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),te=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ne=x(/<%[\w\W]*|[\w\W]*%>/gm),re=x(/\$\{[\w\W]*/gm),ie=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=x(/^aria-[\-\w]+$/),se=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),le=x(/^(?:\w+script|data):/i),ae=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ce=x(/^html$/i),ue=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var de=Object.freeze({__proto__:null,ARIA_ATTR:oe,ATTR_WHITESPACE:ae,CUSTOM_ELEMENT:ue,DATA_ATTR:ie,DOCTYPE_NAME:ce,ERB_EXPR:ne,IS_ALLOWED_URI:se,IS_SCRIPT_OR_DATA:le,MUSTACHE_EXPR:te,TMPLIT_EXPR:re});const he=1,ge=3,pe=7,fe=8,me=9,ye=function(){return"undefined"==typeof window?null:window};var be=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ye();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==me||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:f}=t,m=c.prototype,y=U(m,"cloneNode"),b=U(m,"remove"),x=U(m,"nextSibling"),S=U(m,"childNodes"),v=U(m,"parentNode");if("function"==typeof l){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let B,$="";const{implementation:H,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:re}=r,{importNode:ie}=i;let oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof p&&"function"==typeof v&&H&&void 0!==H.createHTMLDocument;const{MUSTACHE_EXPR:le,ERB_EXPR:ae,TMPLIT_EXPR:ue,DATA_ATTR:be,ARIA_ATTR:_e,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Se}=de;let{IS_ALLOWED_URI:ve}=de,we=null;const ke=z({},[...W,...V,...q,...Z,...J]);let Ee=null;const Te=z({},[...Y,...X,...Q,...ee]);let Ne=Object.seal(C(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null;const Oe=Object.seal(C(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ie=!0,Re=!1,Pe=!0,Me=!1,De=!0,Be=!1,$e=!1,ze=!1,He=!1,Ke=!1,Ue=!1,We=!0,Ve=!1,qe=!0,je=!1,Ze={},Ge=null;const Je=z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Xe=z({},["audio","video","img","source","image","track"]);let Qe=null;const et=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let it=rt,ot=!1,st=null;const lt=z({},[tt,nt,rt],L);let at=z({},["mi","mo","mn","ms","mtext"]),ct=z({},["annotation-xml"]);const ut=z({},["title","style","font","a","script"]);let dt=null;const ht=["application/xhtml+xml","text/html"];let gt=null,pt=null;const ft=r.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=K(e),dt=-1===ht.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===dt?L:A,we=P(e,"ALLOWED_TAGS")?z({},e.ALLOWED_TAGS,gt):ke,Ee=P(e,"ALLOWED_ATTR")?z({},e.ALLOWED_ATTR,gt):Te,st=P(e,"ALLOWED_NAMESPACES")?z({},e.ALLOWED_NAMESPACES,L):lt,Qe=P(e,"ADD_URI_SAFE_ATTR")?z(K(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=P(e,"ADD_DATA_URI_TAGS")?z(K(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Ge=P(e,"FORBID_CONTENTS")?z({},e.FORBID_CONTENTS,gt):Je,Ae=P(e,"FORBID_TAGS")?z({},e.FORBID_TAGS,gt):K({}),Le=P(e,"FORBID_ATTR")?z({},e.FORBID_ATTR,gt):K({}),Ze=!!P(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Ie=!1!==e.ALLOW_DATA_ATTR,Re=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Me=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Be=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ke=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,ve=e.ALLOWED_URI_REGEXP||se,it=e.NAMESPACE||rt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,ct=e.HTML_INTEGRATION_POINTS||ct,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Ie=!1),Ke&&(He=!0),Ze&&(we=z({},J),Ee=[],!0===Ze.html&&(z(we,W),z(Ee,Y)),!0===Ze.svg&&(z(we,V),z(Ee,X),z(Ee,ee)),!0===Ze.svgFilters&&(z(we,q),z(Ee,X),z(Ee,ee)),!0===Ze.mathMl&&(z(we,Z),z(Ee,Q),z(Ee,ee))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(we===ke&&(we=K(we)),z(we,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Oe.attributeCheck=e.ADD_ATTR:(Ee===Te&&(Ee=K(Ee)),z(Ee,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&z(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ge===Je&&(Ge=K(Ge)),z(Ge,e.FORBID_CONTENTS,gt)),qe&&(we["#text"]=!0),Be&&z(we,["html","head","body"]),we.table&&(z(we,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');B=e.TRUSTED_TYPES_POLICY,$=B.createHTML("")}else void 0===B&&(B=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(f,o)),null!==B&&"string"==typeof $&&($=B.createHTML(""));_&&_(e),pt=e}},bt=z({},[...V,...q,...j]),_t=z({},[...Z,...G]),xt=function(e){T(n.removed,{element:e});try{v(e).removeChild(e)}catch(t){b(e)}},Ct=function(e,t){try{T(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){T(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(He||Ke)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},St=function(e){let t=null,n=null;if(ze)e="<remove></remove>"+e;else{const t=O(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===dt&&it===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=B?B.createHTML(e):e;if(it===rt)try{t=(new g).parseFromString(i,dt)}catch(e){}if(!t||!t.documentElement){t=H.createDocument(it,"template",null);try{t.documentElement.innerHTML=ot?$:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),it===rt?re.call(t,Be?"html":"body")[0]:Be?t.documentElement:o},vt=function(e){return te.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},kt=function(e){return"function"==typeof a&&e instanceof a};function Et(e,t,r){w(e,(e=>{e.call(n,t,r,pt)}))}const Tt=function(e){let t=null;if(Et(oe.beforeSanitizeElements,e,null),wt(e))return xt(e),!0;const r=gt(e.nodeName);if(Et(oe.uponSanitizeElement,e,{tagName:r,allowedTags:we}),De&&e.hasChildNodes()&&!kt(e.firstElementChild)&&M(/<[/\w!]/g,e.innerHTML)&&M(/<[/\w!]/g,e.textContent))return xt(e),!0;if(e.nodeType===pe)return xt(e),!0;if(De&&e.nodeType===fe&&M(/<[/\w]/g,e.data))return xt(e),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(r))&&(!we[r]||Ae[r])){if(!Ae[r]&&At(r)){if(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,r))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(r))return!1}if(qe&&!Ge[r]){const t=v(e)||e.parentNode,n=S(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=y(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,x(e))}}}return xt(e),!0}return e instanceof c&&!function(e){let t=v(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=A(e.tagName),r=A(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(bt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(_t[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!at[r])&&!_t[n]&&(ut[n]||!bt[n]):!("application/xhtml+xml"!==dt||!st[e.namespaceURI]))}(e)?(xt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!M(/<\/no(script|embed|frames)/i,e.innerHTML)?(Me&&e.nodeType===ge&&(t=e.textContent,w([le,ae,ue],(e=>{t=F(t,e," ")})),e.textContent!==t&&(T(n.removed,{element:e.cloneNode()}),e.textContent=t)),Et(oe.afterSanitizeElements,e,null),!1):(xt(e),!0)},Nt=function(e,t,n){if(We&&("id"===t||"name"===t)&&(n in r||n in ft))return!1;if(Ie&&!Le[t]&&M(be,t));else if(Fe&&M(_e,t));else if(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(t,e));else if(!Ee[t]||Le[t]){if(!(At(e)&&(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&M(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t,e))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Qe[t]);else if(M(ve,F(n,Ce,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==I(n,"data:")||!Ye[e]){if(Re&&!M(xe,F(n,Ce,"")));else if(n)return!1}else;return!0},At=function(e){return"annotation-xml"!==e&&O(e,Se)},Lt=function(e){Et(oe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||wt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:l,value:a}=o,c=gt(s),u=a;let d="value"===s?u:R(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(oe.uponSanitizeAttribute,e,r),d=r.attrValue,!Ve||"id"!==c&&"name"!==c||(Ct(s,e),d="user-content-"+d),De&&M(/((--!?|])>)|<\/(style|title|textarea)/i,d)){Ct(s,e);continue}if("attributename"===c&&O(d,"href")){Ct(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ct(s,e);continue}if(!Pe&&M(/\/>/i,d)){Ct(s,e);continue}Me&&w([le,ae,ue],(e=>{d=F(d,e," ")}));const h=gt(e.nodeName);if(Nt(h,c,d)){if(B&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(l);else switch(f.getAttributeType(h,c)){case"TrustedHTML":d=B.createHTML(d);break;case"TrustedScriptURL":d=B.createScriptURL(d)}if(d!==u)try{l?e.setAttributeNS(l,s,d):e.setAttribute(s,d),wt(e)?xt(e):E(n.removed)}catch(t){Ct(s,e)}}else Ct(s,e)}Et(oe.afterSanitizeAttributes,e,null)},Ot=function e(t){let n=null;const r=vt(t);for(Et(oe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Et(oe.uponSanitizeShadowNode,n,null),Tt(n),Lt(n),n.content instanceof s&&e(n.content);Et(oe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,l=null,c=null;if(ot=!e,ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!kt(e)){if("function"!=typeof e.toString)throw D("toString is not a function");if("string"!=typeof(e=e.toString()))throw D("dirty is not a string, aborting")}if(!n.isSupported)return e;if($e||yt(t),n.removed=[],"string"==typeof e&&(je=!1),je){if(e.nodeName){const t=gt(e.nodeName);if(!we[t]||Ae[t])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof a)r=St("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===he&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!He&&!Me&&!Be&&-1===e.indexOf("<"))return B&&Ue?B.createHTML(e):e;if(r=St(e),!r)return He?null:Ue?$:""}r&&ze&&xt(r.firstChild);const u=vt(je?e:r);for(;l=u.nextNode();)Tt(l),Lt(l),l.content instanceof s&&Ot(l.content);if(je)return e;if(He){if(Ke)for(c=ne.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(Ee.shadowroot||Ee.shadowrootmode)&&(c=ie.call(i,c,!0)),c}let d=Be?r.outerHTML:r.innerHTML;return Be&&we["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&M(ce,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Me&&w([le,ae,ue],(e=>{d=F(d,e," ")})),B&&Ue?B.createHTML(d):d},n.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),$e=!0},n.clearConfig=function(){pt=null,$e=!1},n.isValidAttribute=function(e,t,n){pt||yt({});const r=gt(e),i=gt(t);return Nt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&T(oe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=k(oe[e],t);return-1===n?void 0:N(oe[e],n,1)[0]}return E(oe[e])},n.removeHooks=function(e){oe[e]=[]},n.removeAllHooks=function(){oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function _e(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function xe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ce="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Se=Ce&&"documentMode"in document?document.documentMode:null,ve=Ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),we=Ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ke=!(!Ce||!("InputEvent"in window)||Se)&&"getTargetRanges"in new window.InputEvent("input"),Ee=Ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Te=Ce&&/Android/.test(navigator.userAgent),Ne=Ce&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Te,Ae=Ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Le=Ce&&Te&&Ae,Oe=Ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ve&&!Ae,Fe=0,Ie=1,Re=2,Pe=1,Me=2,De=3,Be=4,$e=5,ze=6,He=Ne||Ee||Oe?" ":"",Ke="\n\n",Ue=we?" ":He,We="֑-߿יִ-﷽ﹰ-ﻼ",Ve="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",qe=new RegExp("^[^"+Ve+"]*["+We+"]"),je=new RegExp("^[^"+We+"]*["+Ve+"]"),Ze={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ge={directionless:1,unmergeable:2},Je={center:2,end:6,justify:4,left:1,right:3,start:5},Ye={[Me]:"center",[ze]:"end",[Be]:"justify",[Pe]:"left",[De]:"right",[$e]:"start"},Xe={normal:0,segmented:2,token:1},Qe={[Fe]:"normal",[Re]:"segmented",[Ie]:"token"},et="$config";let tt=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};function nt(e,t,n,r,i,o){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(Ho(s)&&nt(s,e,n,r,i,o),n.has(e)||o.delete(e),i.push(e)),s=s.getNextSibling()}}let rt=!1,it=0;function ot(e){it=e.timeStamp}function st(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==Ms(e,n)}function lt(e,t,n){const r=Nl(bl(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&Gs(t,s,i,o,!1)}function at(e,t,n){if(Mi(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return ws(t)&&n.isAttached()}function ct(e,t,n,r){for(let i=e;i&&!Wl(i);i=dl(i)){const e=Ms(i,t);if(void 0!==e){const t=Rs(e,n);if(t)return Wo(t)||!Ol(i)?void 0:[i,t]}else if(i===r)return[r,Hs(n)]}}function ut(e,t,n){rt=!0;const r=performance.now()-it>100;try{Do(e,(()=>{const i=eo()||function(e){return e.getEditorState().read((()=>{const e=eo();return null!==e?e.clone():null}))}(e),o=new Map,s=e.getRootElement(),l=e._editorState,a=e._blockCursorElement;let c=!1,u="";for(let n=0;n<t.length;n++){const d=t[n],h=d.type,g=d.target,p=ct(g,e,l,s);if(!p)continue;const[f,m]=p;if("characterData"===h)r&&Ei(m)&&ws(g)&&at(i,g,m)&<(g,m,e);else if("childList"===h){c=!0;const t=d.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=Ps(r),o=r.parentNode;if(null!=o&&r!==a&&null===i&&!st(r,o,e)){if(we){const e=(Ol(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}o.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(st(r,g,e)||a===r)&&(g.appendChild(r),t++)}r!==t&&o.set(f,m)}}}if(o.size>0)for(const[t,n]of o)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){const n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||st(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(c&&Ks(i),we&&al(e)&&i.insertRawText(u))}))}finally{rt=!1}}function dt(e){const t=e._observer;null!==t&&ut(e,t.takeRecords(),t)}function ht(e){!function(e){0===it&&bl(e).addEventListener("textInput",ot,!0)}(e),e._observer=new MutationObserver(((t,n)=>{ut(e,t,n)}))}let gt=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||St).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function pt(e,t){return new gt(e,t)}function ft(e,t,n="latest"){const r=("latest"===n?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function mt(e,t,n){let r;if(xo(),"function"==typeof n){const i=e.getLatest(),o=ft(i,t);if(r=n(o),t.isEqual(o,r))return i}else r=n;const i=e.getWritable();return _t(i).updateFromKnown(t,r),i}function yt(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=ql(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let bt=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Ct(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Ct(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function _t(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new bt(t,xt(t));return t.__state=n,n}function xt(e){return e.__state?e.__state.sharedNodeState:hs(Dl(),e.getType()).sharedNodeState}function Ct(e){if(e)for(const t in e)return e}function St(e){return e}function vt(e,t,n){for(const[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function wt(e,t,n){const{unknownState:r}=t,i=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0;return!1}function kt(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Et(e,t){const n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,l=t.__style,a=e.__state,c=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===e.__state||a===c||function(e,t){if(e===t)return!0;const n=new Set;return!(e&&vt(n,e,t)||t&&vt(n,t,e)||e&&wt(n,e,t)||t&&wt(n,t,e))}(a,c))}function Tt(e,t){const n=e.mergeWithSibling(t),r=vo()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Nt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Ei(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(Et(t,r)){r=Tt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Ei(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Et(r,n)){r=Tt(r,n);break}break}n.remove()}}else r.remove()}function At(e){return Lt(e.anchor),Lt(e.focus),e}function Lt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),Ei(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Ho(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let Ot,Ft,It,Rt,Pt,Mt,Dt,Bt,$t,zt,Ht,Kt="",Ut=null,Wt=null,Vt=!1,qt=!1;function jt(e,t){const n=Dt.get(e);if(null!==t){const n=cn(e);n.parentNode===t&&t.removeChild(n)}if(Bt.has(e)||Ft._keyToDOMMap.delete(e),Ho(n)){const e=Zl(n,Dt);Zt(e,0,e.length-1,null)}void 0!==n&&ol(zt,It,Rt,n,"destroyed")}function Zt(e,t,n,r){for(let i=t;i<=n;++i){const t=e[i];void 0!==t&&jt(t,r)}}function Gt(e,t){e.setProperty("text-align",t)}const Jt="40px";function Yt(e,t){const n=Ot.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(0===t)return void e.style.setProperty("padding-inline-start","");const r=getComputedStyle(Ft._rootElement||e).getPropertyValue("--lexical-indent-base-value")||Jt;e.style.setProperty("padding-inline-start",`calc(${t} * ${r})`)}function Xt(e,t){const n=e.style;0===t?Gt(n,""):1===t?Gt(n,"left"):2===t?Gt(n,"center"):3===t?Gt(n,"right"):4===t?Gt(n,"justify"):5===t?Gt(n,"start"):6===t&&Gt(n,"end")}function Qt(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if(qo(e))return null;const n=e.getParentOrThrow();return qo(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function en(e,t){const n=Bt.get(e);void 0===n&&_e(60);const r=Ht.$createDOM(n,Ft);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,Ft),Ei(n)?r.setAttribute("data-lexical-text","true"):Wo(n)&&r.setAttribute("data-lexical-decorator","true"),Ho(n)){const e=n.__indent,t=n.__size;if(Qt(r,n),0!==e&&Yt(r,e),0!==t){const e=t-1;tn(Zl(n,Bt),n,0,e,Ht.$getDOMSlot(n,r,Ft))}const i=n.__format;0!==i&&Xt(r,i),n.isInline()||rn(null,n,r)}else{const t=n.getTextContent();if(Wo(n)){const t=n.decorate(Ft,Ot);null!==t&&sn(e,t),r.contentEditable="false"}Kt+=t}return null!==t&&t.insertChild(r),Ht.$decorateDOM(n,null,r,Ft),ol(zt,It,Rt,n,"created"),r}function tn(e,t,n,r,i){const o=Kt;Kt="";let s=n;for(;s<=r;++s){en(e[s],i);const t=Bt.get(e[s]);null!==t&&Ei(t)?null===Ut&&(Ut=t.getFormat(),Wt=t.getStyle()):Ho(t)&&s<r&&!t.isInline()&&(Kt+=Ke)}i.element.__lexicalTextContent=Kt,Kt=o+Kt}function nn(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return ai(e)?"line-break":Wo(e)&&e.isInline()?"decorator":null}return"empty"}return null}function rn(e,t,n){const r=nn(e,Dt),i=nn(t,Bt);r!==i&&Ht.$getDOMSlot(t,n,Ft).setManagedLineBreak(i)}function on(e,t){const n=Dt.get(e);let r=Bt.get(e);void 0!==n&&void 0!==r||_e(61);const i=Vt||Mt.has(e)||Pt.has(e),o=ul(Ft,e);if(n===r&&!i){let e;if(Ho(n)){const t=o.__lexicalTextContent;"string"==typeof t?e=t:(e=n.getTextContent(),o.__lexicalTextContent=e)}else e=n.getTextContent();return Kt+=e,o}if(n!==r&&i&&ol(zt,It,Rt,r,"updated"),Ht.$updateDOM(r,n,o,Ft)){const n=en(e,null);return null===t&&_e(62),t.replaceChild(n,o),jt(e,null),n}if(Ho(n)){Ho(r)||_e(334,e);const t=r.__indent;(Vt||t!==n.__indent)&&Yt(o,t);const s=r.__format;if((Vt||s!==n.__format)&&Xt(o,s),i)(function(e,t,n){var r;Ut=null,Wt=null,function(e,t,n){const r=Kt,i=e.__size,o=t.__size;Kt="";const s=n.element;if(1===i&&1===o){const n=e.__first,i=t.__first;if(n===i)on(n,s);else{const e=cn(n),t=en(i,null);try{s.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${s.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(o)}throw r}jt(n,null)}const o=Bt.get(i);Ei(o)&&null===Ut&&(Ut=o.getFormat(),Wt=o.getStyle())}else{const r=Zl(e,Dt),l=Zl(t,Bt);if(r.length!==i&&_e(227),l.length!==o&&_e(228),0===i)0!==o&&tn(l,0,0,o-1,n);else if(0===o){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;Zt(r,0,i-1,e?null:s),e&&(s.textContent="")}}else!function(e,t,n,r,i,o){const s=r-1,l=i-1;let a,c,u=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=l;){const e=t[d],r=n[h];if(e===r)u=ln(on(r,o.element)),d++,h++;else{if(void 0===c&&(c=an(n,h)),void 0===a)a=an(t,d);else if(!a.has(e)){d++;continue}if(!c.has(e)){u=ln(cn(e)),jt(e,o.element),d++,a.delete(e);continue}if(a.has(r)){const e=ul(Ft,r);e!==u&&o.withBefore(u).insertChild(e),u=ln(on(r,o.element)),d++,h++}else en(r,o.withBefore(u)),h++}const i=Bt.get(r);null!==i&&Ei(i)?null===Ut&&(Ut=i.getFormat(),Wt=i.getStyle()):Ho(i)&&h<=l&&!i.isInline()&&(Kt+=Ke)}const g=d>s,p=h>l;if(g&&!p){const e=n[l+1],t=void 0===e?null:Ft.getElementByKey(e);tn(n,0,h,l,o.withBefore(t))}else p&&!g&&Zt(t,d,s,o.element)}(0,r,l,i,o,n)}s.__lexicalTextContent=Kt,Kt=r+Kt}(e,t,Ht.$getDOMSlot(t,n,Ft)),r=t,null==Ut||Ut===r.__textFormat||qt||r.setTextFormat(Ut),function(e){null==Wt||Wt===e.__textStyle||qt||e.setTextStyle(Wt)}(t)})(n,r,o),qo(r)||r.isInline()||rn(n,r,o);else{const e=o.__lexicalTextContent;let t;"string"==typeof e?t=e:(t=n.getTextContent(),o.__lexicalTextContent=t),Kt+=t}if((Vt||r.__dir!==n.__dir)&&(Qt(o,r),qo(r)&&!Vt))for(const e of r.getChildren())Ho(e)&&Qt(ul(Ft,e.getKey()),e)}else{const t=r.getTextContent();if(Wo(r)){const t=r.decorate(Ft,Ot);null!==t&&sn(e,t)}Kt+=t}if(!qt&&qo(r)&&r.__cachedText!==Kt){const e=r.getWritable();e.__cachedText=Kt,r=e}return Ht.$decorateDOM(r,n,o,Ft),o}function sn(e,t){let n=Ft._pendingDecorators;const r=Ft._decorators;if(null===n){if(r[e]===t)return;n=Bs(Ft)}n[e]=t}function ln(e){let t=e.nextSibling;return null!==t&&t===Ft._blockCursorElement&&(t=t.nextSibling),t}function an(e,t){const n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function cn(e){const t=$t.get(e);return void 0===t&&_e(75,e),t}function un(e){return{type:e}}const dn=un("SELECTION_CHANGE_COMMAND"),hn=un("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),gn=un("CLICK_COMMAND"),pn=un("BEFORE_INPUT_COMMAND"),fn=un("INPUT_COMMAND"),mn=un("COMPOSITION_START_COMMAND"),yn=un("COMPOSITION_END_COMMAND"),bn=un("DELETE_CHARACTER_COMMAND"),_n=un("INSERT_LINE_BREAK_COMMAND"),xn=un("INSERT_PARAGRAPH_COMMAND"),Cn=un("CONTROLLED_TEXT_INSERTION_COMMAND"),Sn=un("PASTE_COMMAND"),vn=un("REMOVE_TEXT_COMMAND"),wn=un("DELETE_WORD_COMMAND"),kn=un("DELETE_LINE_COMMAND"),En=un("FORMAT_TEXT_COMMAND"),Tn=un("UNDO_COMMAND"),Nn=un("REDO_COMMAND"),An=un("KEYDOWN_COMMAND"),Ln=un("KEY_ARROW_RIGHT_COMMAND"),On=un("MOVE_TO_END"),Fn=un("KEY_ARROW_LEFT_COMMAND"),In=un("MOVE_TO_START"),Rn=un("KEY_ARROW_UP_COMMAND"),Pn=un("KEY_ARROW_DOWN_COMMAND"),Mn=un("KEY_ENTER_COMMAND"),Dn=un("KEY_SPACE_COMMAND"),Bn=un("KEY_BACKSPACE_COMMAND"),$n=un("KEY_ESCAPE_COMMAND"),zn=un("KEY_DELETE_COMMAND"),Hn=un("KEY_TAB_COMMAND"),Kn=un("INSERT_TAB_COMMAND"),Un=un("INDENT_CONTENT_COMMAND"),Wn=un("OUTDENT_CONTENT_COMMAND"),Vn=un("DROP_COMMAND"),qn=un("FORMAT_ELEMENT_COMMAND"),jn=un("DRAGSTART_COMMAND"),Zn=un("DRAGOVER_COMMAND"),Gn=un("DRAGEND_COMMAND"),Jn=un("COPY_COMMAND"),Yn=un("CUT_COMMAND"),Xn=un("SELECT_ALL_COMMAND"),Qn=un("CLEAR_EDITOR_COMMAND"),er=un("CLEAR_HISTORY_COMMAND"),tr=un("CAN_REDO_COMMAND"),nr=un("CAN_UNDO_COMMAND"),rr=un("FOCUS_COMMAND"),ir=un("BLUR_COMMAND"),or=un("KEY_MODIFIER_COMMAND"),sr=Object.freeze({}),lr=[["keydown",function(e,t){ar=e.timeStamp,cr=e.key,t.isComposing()||cl(t,An,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;Fl(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Do(t,(()=>{fs(n)||(fr=!0)}))}],["compositionstart",function(e,t){cl(t,mn,e)}],["compositionend",function(e,t){we?yr=!0:Ee||!Ne&&!Oe?cl(t,yn,e):(br=!0,_r=e.data)}],["input",function(e,t){e.stopPropagation(),Do(t,(()=>{t.dispatchCommand(fn,e)}),{event:e}),dr=null}],["click",function(e,t){Do(t,(()=>{const n=eo(),r=Nl(bl(t)),i=to();if(r)if(Mi(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!qo(o)&&1===zs().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){const e=jl(o,(e=>Ho(e)&&!e.isInline()));Ho(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(Ol(n)||ws(n))&&Ks(Qi(i,r,t,e))}cl(t,gn,e)}))}],["cut",sr],["copy",sr],["dragstart",sr],["dragover",sr],["dragend",sr],["paste",sr],["focus",sr],["blur",sr],["drop",sr]];ke&&lr.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType;"deleteCompositionText"===n||we&&al(t)||"insertCompositionText"!==n&&cl(t,pn,e)}(e,t)]);let ar=0,cr=null,ur=0,dr=null;const hr=new WeakMap,gr=new WeakMap;let pr=!1,fr=!1,mr=!1,yr=!1,br=!1,_r="",xr=null,Cr=[0,"",0,"root",0];function Sr(e,t,n,r,i){const o=e.anchor,s=e.focus,l=o.getNode(),a=vo(),c=Nl(bl(a)),u=null!==c?c.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==s.key||!Ei(l)||(!i&&(!ke||ur<r+50)||l.isDirty()&&g<2||Ws(n))&&o.offset!==s.offset&&!l.isComposing()||vs(l)||l.isDirty()&&g>1||(i||!ke)&&null!==h&&!l.isComposing()&&u!==Es(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==e.format||l.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=Ss(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Ei(t)||Ho(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,l)}function vr(e,t){return ws(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function wr(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;pr&&(pr=!1,vr(r,i)&&vr(o,s)&&!xr)||Do(t,(()=>{if(!n)return void Ks(null);if(!ys(t,r,o))return;let l=eo();if(xr&&Mi(l)&&l.isCollapsed()){const e=l.anchor,t=xr.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(l=xr.clone(),Ks(l))}if(xr=null,Mi(l)){const n=l.anchor,r=n.getNode();if(l.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(l.dirty=!0);const i=bl(t).event,o=i?i.timeStamp:performance.now(),[s,a,c,u,d]=Cr,h=zs(),g=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===c&&n.key===u)kr(l,s,a);else if("text"===n.type)Ei(r)||_e(141),Er(l,r);else if("element"===n.type&&!g){Ho(r)||_e(259);const e=n.getNode();e.isEmpty()?function(e,t){kr(e,t.getTextFormat(),t.getTextStyle())}(l,e):kr(l,l.format,"")}}else{const e=n.key,t=l.focus.key,r=l.getNodes(),o=r.length,a=l.isBackward(),c=a?s:i,u=a?i:s,d=a?t:e,h=a?e:t;let g=2047,p=!1;for(let e=0;e<o;e++){const t=r[e],n=t.getTextContentSize();if(Ei(t)&&0!==n&&!(0===e&&t.__key===d&&c===n||e===o-1&&t.__key===h&&0===u)&&(p=!0,g&=t.getFormat(),0===g))break}l.format=p?g:0}}cl(t,dn,void 0)}))}function kr(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Er(e,t){kr(e,t.getFormat(),t.getStyle())}function Tr(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function Nr(e){const t=e.inputType,n=Tr(e),r=vo(),i=eo();if("deleteContentBackward"===t){if(null===i){const e=to();if(!Mi(e))return!0;Ks(e.clone())}if(Mi(i)){const t=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===cr&&o<ar+30&&r.isComposing()&&t){if(Fs(null),ar=0,setTimeout((()=>{Do(r,(()=>{Fs(null)}))}),30),Mi(i)){const e=i.anchor.getNode();e.markDirty(),Ei(e)||_e(142),Er(i,e)}}else{Fs(null),e.preventDefault();const n=i.anchor.getNode(),o=n.getTextContent(),s=n.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let a=Le&&t&&!l&&s;if(a&&i.isCollapsed()&&(a=!Wo(ll(i.anchor,!0))),!a){cl(r,bn,!0);const e=eo();Le&&Mi(e)&&e.isCollapsed()&&(xr=e,setTimeout((()=>xr=null)))}}return!0}}var o;if(!Mi(i))return!0;const s=e.data;null!==dr&&Zs(!1,r,dr),i.dirty&&null===dr||!i.isCollapsed()||qo(i.anchor.getNode())||null===n||i.applyDOMRange(n),dr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if("insertText"===t||"insertTranspose"===t){if("\n"===s)e.preventDefault(),cl(r,_n,!1);else if(s===Ke)e.preventDefault(),cl(r,xn,void 0);else if(null==s&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=s&&Sr(i,n,s,e.timeStamp,!0)?(e.preventDefault(),cl(r,Cn,s)):dr=s;return ur=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":cl(r,Cn,e);break;case"insertFromComposition":Fs(null),cl(r,Cn,e);break;case"insertLineBreak":Fs(null),cl(r,_n,!1);break;case"insertParagraph":Fs(null),mr&&!Ee?(mr=!1,cl(r,_n,!1)):cl(r,xn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":cl(r,Sn,e);break;case"deleteByComposition":(function(e,t){return e!==t||Ho(e)||Ho(t)||!Ss(e)||!Ss(t)})(c,u)&&cl(r,vn,e);break;case"deleteByDrag":pl(Xr),cl(r,vn,e);break;case"deleteByCut":cl(r,vn,e);break;case"deleteContent":cl(r,bn,!1);break;case"deleteWordBackward":cl(r,wn,!0);break;case"deleteWordForward":cl(r,wn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":cl(r,kn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":cl(r,kn,!1);break;case"formatStrikeThrough":cl(r,En,"strikethrough");break;case"formatBold":cl(r,En,"bold");break;case"formatItalic":cl(r,En,"italic");break;case"formatUnderline":cl(r,En,"underline");break;case"historyUndo":cl(r,Tn,void 0);break;case"historyRedo":cl(r,Nn,void 0)}return!0}function Ar(e){if(Ol(e.target)&&fs(e.target))return!0;const t=vo(),n=eo(),r=e.data,i=Tr(e);if(null!=r&&Mi(n)&&Sr(n,i,r,e.timeStamp,!1)){yr&&(Fr(t,r),yr=!1);const i=n.anchor.getNode(),o=Nl(bl(t));if(null===o)return!0;const s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,a=s?n.focus.offset:n.anchor.offset;ke&&!n.isCollapsed()&&Ei(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,l)+r+i.getTextContent().slice(l+a)===js(o.anchorNode)||cl(t,Cn,r);const c=r.length;we&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),Le&&t.isComposing()&&(ar=0,Fs(null))}else Zs(!1,t,null!==r?r:void 0),yr&&(Fr(t,r||void 0),yr=!1);return function(){xo();dt(vo())}(),!0}function Lr(e){const t=vo(),n=eo();if(Mi(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();Fs(r.key),pl(Qr),(e.timeStamp<ar+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Ei(i)&&i.getStyle()!==n.style)&&cl(t,Cn,Ue)}return!0}function Or(e){return Fr(vo(),e.data),pl(ei),!0}function Fr(e,t){const n=e._compositionKey;if(Fs(null),null!==n&&null!=t){if(""===t){const t=Rs(n),r=Es(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&Ei(t)){const n=Nl(bl(e));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Gs(t,r.nodeValue,i,o,!0)}return}if("\n"===t[t.length-1]){const t=eo();if(Mi(t)||Bi(t)){if(Mi(t)){const e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return void cl(e,Mn,null)}}}Zs(!0,e,t)}function Ir(e){const t=vo();if(null==e.key)return!0;if(br){if(tl(e))return Do(t,(()=>{Fr(t,_r)})),br=!1,_r="",!0;br=!1,_r=""}if(function(e){return Xs(e,"ArrowRight",{shiftKey:"any"})}(e))cl(t,Ln,e);else if(function(e){return Xs(e,"ArrowRight",Qs)}(e))cl(t,On,e);else if(function(e){return Xs(e,"ArrowLeft",{shiftKey:"any"})}(e))cl(t,Fn,e);else if(function(e){return Xs(e,"ArrowLeft",Qs)}(e))cl(t,In,e);else if(function(e){return Xs(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))cl(t,Rn,e);else if(function(e){return Xs(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))cl(t,Pn,e);else if(function(e){return Xs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))mr=!0,cl(t,Mn,e);else if(function(e){return" "===e.key}(e))cl(t,Dn,e);else if(function(e){return ve&&Xs(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),mr=!0,cl(t,_n,!0);else if(function(e){return Xs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))mr=!1,cl(t,Mn,e);else if(function(e){return Xs(e,"Backspace",{shiftKey:"any"})||ve&&Xs(e,"h",{ctrlKey:!0})}(e))tl(e)?cl(t,Bn,e):(e.preventDefault(),cl(t,bn,!0));else if(function(e){return"Escape"===e.key}(e))cl(t,$n,e);else if(function(e){return Xs(e,"Delete",{})||ve&&Xs(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),cl(t,bn,!1)):cl(t,zn,e);else if(function(e){return Xs(e,"Backspace",el)}(e))e.preventDefault(),cl(t,wn,!0);else if(function(e){return Xs(e,"Delete",el)}(e))e.preventDefault(),cl(t,wn,!1);else if(function(e){return ve&&Xs(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),cl(t,kn,!0);else if(function(e){return ve&&(Xs(e,"Delete",{metaKey:!0})||Xs(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),cl(t,kn,!1);else if(function(e){return Xs(e,"b",Qs)}(e))e.preventDefault(),cl(t,En,"bold");else if(function(e){return Xs(e,"u",Qs)}(e))e.preventDefault(),cl(t,En,"underline");else if(function(e){return Xs(e,"i",Qs)}(e))e.preventDefault(),cl(t,En,"italic");else if(function(e){return Xs(e,"Tab",{shiftKey:"any"})}(e))cl(t,Hn,e);else if(function(e){return Xs(e,"z",Qs)}(e))e.preventDefault(),cl(t,Tn,void 0);else if(function(e){return ve?Xs(e,"z",{metaKey:!0,shiftKey:!0}):Xs(e,"y",{ctrlKey:!0})||Xs(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),cl(t,Nn,void 0);else{const n=t._editorState._selection;null===n||Mi(n)?nl(e)&&(e.preventDefault(),cl(t,Xn,e)):function(e){return Xs(e,"c",Qs)}(e)?(e.preventDefault(),cl(t,Jn,e)):function(e){return Xs(e,"x",Qs)}(e)?(e.preventDefault(),cl(t,Yn,e)):nl(e)&&(e.preventDefault(),cl(t,Xn,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(or,e),!0}function Rr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Pr=new Map;function Mr(e){const t=function(e){const t=yl(e);return t?t.getSelection():null}(e.target);if(null===t)return;const n=_s(t.anchorNode);if(null===n)return;fr&&(fr=!1,Do(n,(()=>{const r=to(),i=t.anchorNode;(Ol(i)||ws(i))&&Ks(Qi(r,t,n,e))})));const r=Vs(n),i=r[r.length-1],o=i._key,s=Pr.get(o),l=s||i;l!==n&&wr(t,l,!1),wr(t,n,!0),n!==i?Pr.set(o,n):s&&Pr.delete(o)}function Dr(e){e._lexicalHandled=!0}function Br(e){return!0===e._lexicalHandled}function $r(e){const t=hr.get(e);if(void 0===t)return;const n=gr.get(t);if(void 0===n)return;const r=n-1;r>=0||_e(164),hr.delete(e),gr.set(t,r),0===r&&t.removeEventListener("selectionchange",Mr);const i=xs(e);bs(i)?(function(e){if(null!==e._parentEditor){const t=Vs(e),n=t[t.length-1]._key;Pr.get(n)===e&&Pr.delete(n)}else Pr.delete(e._key)}(i),e.__lexicalEditor=null):i&&_e(198);const o=Rr(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}function zr(e,t,n){xo();const r=e.__key,i=e.getParent();if(null===i)return;const o=function(e){const t=eo();if(!Mi(t)||!Ho(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return ml(i,e)&&n.set(e.__key,0,"element"),ml(o,e)&&r.set(e.__key,0,"element"),t}(e);let s=!1;if(Mi(o)&&t){const t=o.anchor,n=o.focus;t.key===r&&(io(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(io(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else Bi(o)&&t&&e.isSelected()&&e.selectPrevious();if(Mi(o)&&t&&!s){const t=e.getIndexWithinParent();Ls(e),no(o,i,t,-1)}else Ls(e);n||Cl(i)||i.canBeEmpty()||!i.isEmpty()||zr(i,t),t&&o&&qo(i)&&i.isEmpty()&&i.selectEnd()}const Hr=Symbol.for("ephemeral");function Kr(e){return e[Hr]||!1}let Ur=class{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=ql(this);return void 0===e&&_e(64,this.name),e}static clone(e){_e(65,this.name)}$config(){return{}}config(e,t){const n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),As(this,e)}getType(){return this.__type}isInline(){_e(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=Rs(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||eo();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(Ei(this))return n;if(Mi(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Wo(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Rs(e)}getParentOrThrow(){const e=this.getParent();return null===e&&_e(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(Cl(t))return Ho(e)||e===this&&Wo(e)||_e(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&_e(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Rs(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Rs(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Ho(this)?this:this.getParent(),n=Ho(e)?e:e.getParent(),r=t&&n?ka(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=ka(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Sa(t):("same"!==t.type&&"ancestor"!==t.type&&_e(279),!1)))}isParentOf(e){const t=ka(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;const s=Ho(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const a=i.getParentOrThrow();if(r.has(a.__key)||n.push(a),a===e)break;let c=null,u=a;do{if(null===u&&_e(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=vo()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(Kr(this))return this;const e=Rs(this.__key);return null===e&&_e(113),e}getWritable(){if(Kr(this))return this;xo();const e=So(),t=vo(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=eo();if(null!==s&&s.setCachedNodes(null),o.has(r))return Os(i),i;const l=Kl(i);return o.add(r),Os(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){_e(70)}updateDOM(e,t,n){_e(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){_e(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let i=r;for(const e of xt(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&_t(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){zr(this,!0,e)}replace(e,t){xo();let n=eo();null!==n&&(n=n.clone()),wl(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;Ls(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(zr(r,!1,!0),null===c?l.__first=o:c.getWritable().__next=o,s.__prev=d,null===u?l.__last=o:u.getWritable().__prev=o,s.__next=h,s.__parent=g,l.__size=a,t&&(Ho(this)&&Ho(s)||_e(139),this.getChildren().forEach((e=>{s.append(e)}))),Mi(n)){Ks(n);const e=n.anchor,t=n.focus;e.key===i&&Ri(e,s),t.key===i&&Ri(t,s)}return Is()===i&&Fs(o),s}insertAfter(e,t=!0){xo(),wl(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=eo();let s=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(Ls(r),Mi(o)){const e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===a?c.__last=u:a.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Mi(o)){const e=this.getIndexWithinParent();no(o,c,e+1);const t=c.__key;s&&o.anchor.set(t,e+2,"element"),l&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){xo(),wl(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;Ls(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const c=eo();return t&&Mi(c)&&no(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return es()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){xo();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Ho(n))return n.select();if(!Ei(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){xo();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Ho(n))return n.select(0,0);if(!Ei(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Wr(e){return e instanceof Ur}const Vr="historic",qr="history-push",jr="history-merge",Zr="paste",Gr="collaboration",Jr="skip-scroll-into-view",Yr="skip-dom-selection",Xr="skip-selection-focus",Qr="composition-start",ei="composition-end",ti=/\s*!important\s*$/i;function ni(e){const t={};if(!e)return t;let n="",r="",i=null,o=!1,s=!1,l=!1,a=0;for(let c=0;c<e.length;c++){const u=e[c];if(o)"*"===u&&"/"===e[c+1]&&(o=!1,c++);else if(s)l?r+=u:n+=u,s=!1;else if(null===i)if("/"!==u||"*"!==e[c+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==a){if(";"===u&&0===a){const e=n.trim(),i=r.trim();""!==e&&""!==i&&(t[e]=i),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else a=Math.max(0,a-1),l?r+=u:n+=u;else a++,l?r+=u:n+=u;else i=u,l?r+=u:n+=u;else o=!0,c++;else l?r+=u:n+=u,"\\"===u?s=!0:u===i&&(i=null)}const c=n.trim(),u=r.trim();return""!==c&&""!==u&&(t[c]=u),t}function ri(e,t,n){const r=ti.test(n)?"important":"",i=""===r?n:n.replace(ti,"").trim();e.setProperty(t,i,r)}function ii(e,t,n=""){if(t===n)return;const r=ni(n),i=ni(t);for(const t in i)delete r[t],ri(e,t,i[t]);for(const t in r)e.removeProperty(t)}class oi extends Ur{static getType(){return"linebreak"}static clone(e){return new oi(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&Pl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&ci(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&ci(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&Pl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&ci(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&ci(r))return!0}return!1}(e)?null:{conversion:si,priority:0}}}static importJSON(e){return li().updateFromJSON(e)}}function si(e){return{node:li()}}function li(){return vl(new oi)}function ai(e){return e instanceof oi}function ci(e){return ws(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function ui(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function di(e,t){return 1&t?"strong":2&t?"em":"span"}function hi(e,t,n,r,i){const o=r.classList;let s=il(i,"base");void 0!==s&&o.add(...s),s=il(i,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;void 0!==s&&(8&n&&4&n?(l=!0,a||o.add(...s)):a&&o.remove(...s));for(const e in Ze){const r=Ze[e];if(s=il(i,e),void 0!==s)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0===(t&r)||a&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function gi(e,t,n){const r=t.firstChild,i=n.isComposing(),o=e+(i?He:"");if(null==r)t.textContent=o;else{const e=r.nodeValue;if(e!==o)if(i||we){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function pi(e,t,n,r,i,o){gi(i,e,t);const s=o.theme.text;void 0!==s&&hi(0,0,r,e,s)}function fi(e,t){const n=document.createElement(t);return n.appendChild(e),n}class mi extends Ur{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new mi(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Qe[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Is()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ze[e];return 0!==(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ts(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const n=this.__format,r=ui(0,n),i=di(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l)),pi(l,this,0,n,this.__text,e);const a=this.__style;return""!==a&&ii(s.style,a),s}updateDOM(e,t,n){const r=this.__text,i=e.__format,o=this.__format,s=ui(0,i),l=ui(0,o),a=di(0,i),c=di(0,o);if((null===s?a:s)!==(null===l?c:l))return!0;if(s===l&&a!==c){const e=t.firstChild;null==e&&_e(48);const i=document.createElement(c);return pi(i,this,0,o,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==s&&(u=t.firstChild,null==u&&_e(49)),gi(r,u,this);const d=n.theme.text;void 0!==d&&i!==o&&hi(0,i,o,u,d);const h=e.__style,g=this.__style;return h!==g&&ii(t.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Ci,priority:0}),b:()=>({conversion:bi,priority:0}),code:()=>({conversion:wi,priority:0}),em:()=>({conversion:wi,priority:0}),i:()=>({conversion:wi,priority:0}),mark:()=>({conversion:wi,priority:0}),s:()=>({conversion:wi,priority:0}),span:()=>({conversion:yi,priority:0}),strong:()=>({conversion:wi,priority:0}),sub:()=>({conversion:wi,priority:0}),sup:()=>({conversion:wi,priority:0}),u:()=>({conversion:wi,priority:0})}}static importJSON(e){return ki().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Ol(t)||_e(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=fi(t,"b")),this.hasFormat("italic")&&(t=fi(t,"i")),this.hasFormat("strikethrough")&&(t=fi(t,"s")),this.hasFormat("underline")&&(t=fi(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Ze[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Ge[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ts(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Xe[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){xo();let n=e,r=t;const i=eo(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Mi(i))return Gi(s,n,s,r,"text","text");{const e=Is();e!==i.anchor.key&&e!==i.focus.key||Fs(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=e;l<0&&(l=s+l,l<0&&(l=0));const a=eo();if(r&&Mi(a)){const t=e+s;a.setTextNodeRange(i,t,i,t)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){xo();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Is(),o=n.length;e.sort(((e,t)=>e-t)),e.push(o);const s=[],l=e.length;for(let t=0,r=0;t<o&&r<=l;r++){const i=e[r];i>t&&(s.push(n.slice(t,i)),t=i)}const a=s.length;if(1===a)return[t];const c=s[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const b=eo();if(Mi(b)){const[e,t]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=ki(c),d.__format=h,d.__style=g,d.__detail=p,d.__state=kt(t,d),f=!0):d=t.setTextContent(c);const _=[d];for(let e=1;e<a;e++){const n=ki(s[e]);n.__format=h,n.__style=g,n.__detail=p,n.__state=kt(t,n);const o=n.__key;i===r&&Fs(o),_.push(n)}const x=m?m.offset:null,C=y?y.offset:null;let S=0;for(const e of _){if(!m&&!y)break;const t=S+e.getTextContentSize();if(null!==m&&null!==x&&x<=t&&x>=S&&(m.set(e.getKey(),x-S,"text"),x<t&&(m=null)),null!==y&&null!==C&&C<=t&&C>=S){y.set(e.getKey(),C-S,"text");break}S=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&Os(t),null!==n&&Os(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,_),this.remove()):e.splice(t,1,_),Mi(b)&&no(b,u,t,a-1)}return _}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||_e(50);const n=this.__key,r=e.__key,i=this.__text,o=i.length;Is()===r&&Fs(n);const s=eo();if(Mi(s)){const i=s.anchor,l=s.focus;null!==i&&i.key===r&&oo(i,t,n,e,o),null!==l&&l.key===r&&oo(l,t,n,e,o)}const l=e.__text,a=t?l+i:i+l;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function yi(e){return{forChild:Ti(e.style),node:null}}function bi(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Ti(t.style,n?void 0:"bold"),node:null}}const _i=new WeakMap;function xi(e){if(!Ol(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Ci(e){const t=e;null===e.parentElement&&_e(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=_i.get(n))&&!xi(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)_i.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(li()):"\t"===r?t.push(Ai()):""!==r&&t.push(ki(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=Si(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=Si(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:ki(n)}}function Si(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,Ol(n)){const e=n.style.display;if(""===e&&!Rl(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(ws(n))return n;if("BR"===n.nodeName)return null}}const vi={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function wi(e){const t=vi[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Ti(e.style,t),node:null}}function ki(e=""){return vl(new mi(e))}function Ei(e){return e instanceof mi}function Ti(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,l=r.includes("underline"),a=e.verticalAlign;return e=>Ei(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==a||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==a||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Ni extends mi{static getType(){return"tab"}static clone(e){return new Ni(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=il(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Ai().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&xe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||_e(286),this}setDetail(e){return 2!==e&&_e(127),this}setMode(e){return"normal"!==e&&_e(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ai(){return vl(new Ni)}function Li(e){return e instanceof Ni}class Oi{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Ca(Pa(Ea(this,"next")),Pa(Ea(e,"next")))<0}getNode(){const e=Rs(this.key);return null===e&&_e(20),e}set(e,t,n,r){const i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,_o()||(Is()===o&&Fs(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function Fi(e,t,n){return new Oi(e,t,n)}function Ii(e,t){let n=t.__key,r=e.offset,i="element";if(Ei(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!Ho(t)){const e=t.getNextSibling();if(Ei(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Ri(e,t){if(Ho(t)){const n=t.getLastDescendant();Ho(n)||Ei(n)?Ii(e,n):Ii(e,t)}else Ii(e,t)}class Pi{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Bi(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Pi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(Ei(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=Rs(e);null!==t&&n.push(t)}return _o()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){const e=this.getNodes();if((eo()||to())===this&&e[0]){const t=ca(e[0],"next");Na(_a(t,t))}for(const t of e)t.remove()}}function Mi(e){return e instanceof Di}class Di{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Mi(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=function(e){const t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);const i=new Set,o=new Set;for(const n of e)if(oa(n)){const{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{const{origin:e}=n;Ho(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),ia(e.focus)&&Ho(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=ga(e.focus.origin,"previous");oa(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=pa(n))i.delete(n.origin),t.pop();for(;t.length>1;){const e=t[t.length-1];if(!Ho(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=Pa(e.anchor),r=Pa(e.anchor.getFlipped()),i=e=>ra(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(Ba(La(this),"next"));return _o()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=zi(this);let a="",c=!0;for(let u=0;u<e.length;u++){const d=e[u];if(Ho(d)&&!d.isInline())c||(a+="\n"),c=!d.isEmpty();else if(c=!1,Ei(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<l?e.slice(s,l):e.slice(l,s)):e=o?e.slice(s):e.slice(l):d===n&&(e=o?e.slice(0,l):e.slice(0,s)),a+=e}else!Wo(d)&&!ai(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=vo(),n=t.getEditorState()._selection,r=ji(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),At(this)}clone(){const e=this.anchor,t=this.focus;return new Di(Fi(e.key,e.offset,e.type),Fi(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ts(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ze[e];return 0!==(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(li()):"\t"===r?n.push(Ai()):n.push(ki(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){const i=e.getNode(),o=i.getChildAtIndex(e.offset),s=ki();if(s.setFormat(n),s.setStyle(r),ts(o))o.splice(0,0,[s]);else{const e=qo(i)?es().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&Ta(s,Pa(Ea(s,"next")));const l=o.offset;let a=s.offset;const c=this.getNodes(),u=c.length;let d=c[0];Ei(d)||_e(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let p=c[u-1];if(1===u&&"element"===s.type&&(a=h,s.set(o.key,a,"text")),this.isCollapsed()&&l===h&&(vs(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Ei(t)&&t.canInsertTextBefore()&&!vs(t)||(t=ki(),t.setFormat(r),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(vs(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Ei(t)&&!vs(t)||(t=ki(),t.setFormat(r),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const e=ki(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){const t=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Ho(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),qi(this.anchor,this.focus),void this.insertText(e)}if(1===u){if(Ss(d)){const t=ki(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(l!==a||t===r&&n===i){if(Li(d)){const t=ki(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=ki(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)d.insertBefore(t,!1);else{const[e]=d.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}const o=a-l;d=d.spliceText(l,o,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{const t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=Ho(d)?d:d.getParentOrThrow();let r=Ho(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===s.type&&(0!==a||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<a)if(Ei(p)&&!Ss(p)&&a!==p.getTextContentSize()){if(p.isSegmented()){const e=ki(p.getTextContent());p.replace(e),p=e}qo(s.getNode())||"text"!==s.type||(p=p.spliceText(0,a,"")),t.add(p.__key)}else{const e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);const o=r.getChildren(),g=new Set(c),f=n.is(r),m=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){const t=o[e];if(t.is(d)||Ho(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Ss(d))if(l===h)d.select();else{const t=ki(e);t.select(),d.replace(t)}else d=d.spliceText(l,h-l,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<u;e++){const n=c[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const e=eo()===this;Aa(this,Ra(La(this))),e&&eo()!==this&&Ks(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Fs(null);const n=this.getNodes(),r=[];for(const e of n)Ei(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(Ho(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),Fs(null),void i(t);const s=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:s,u=a?s:l;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=o-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(vs(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||vs(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const b=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||vs(m)||([m]=m.splitText(y)),m.setFormat(b));for(let t=d+1;t<f;t++){const n=r[t],i=n.getFormatFlags(e,b);n.setFormat(i)}"text"===c.type&&c.set(h.__key,g,"text"),"text"===u.type&&u.set(m.__key,y,"text"),this.format=p|b}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const t=eo();return Mi(t)||_e(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=jl(t,Ml),r=e[e.length-1];if(Ho(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=co(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(Ho(e)||Wo(e))&&!e.isInline()))){Ho(n)||_e(211,t.constructor.name,t.getType());const i=co(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=es();let n=null;for(let r=0;r<e.length;r++){const i=e[r],o=ai(i);if(o||Wo(i)&&i.isInline()||Ho(i)&&i.isInline()||Ei(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),o=i.getLastDescendant(),s=i.getChildren(),l=Ho(n)&&n.isEmpty()?null:this.insertParagraph(),a=s[s.length-1];let c=s[0];var u;Ho(u=c)&&Ml(u)&&!u.isEmpty()&&Ho(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Ho(n)||_e(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=s[1]),c&&(null===n&&_e(212,t.constructor.name,t.getType()),function(e,t){const n=t.getParentOrThrow().getLastChild();let r=t;const i=[t];for(;r!==n;)r.getNextSibling()||_e(140),r=r.getNextSibling(),i.push(r);let o=e;for(const e of i)o=o.insertAfter(e)}(n,c));const d=jl(o,Ml);l&&Ho(d)&&(l.canMergeWhenEmpty()||Ml(a))&&(d.append(...l.getChildren()),l.remove()),Ho(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=Ho(n)?n.getLastChild():null;ai(h)&&d!==n&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const e=es();return zs().splice(this.anchor.offset,0,[e]),e.select(),e}const e=co(this),t=jl(this.anchor.getNode(),Ml);Ho(t)||_e(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=li();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=[...this.getNodes()],t=e.length;let n=e[0],r=e[t-1];const[i,o]=zi(this),s=this.isBackward(),[l,a]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,u]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(Ei(n)&&!this.isCollapsed()){const e=n.splitText(c,u),t=0===c?e[0]:e[1];return t?(l.set(t.getKey(),0,"text"),a.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(Ei(n)&&(c===n.getTextContentSize()?e.shift():0!==c&&([,n]=n.splitText(c),e[0]=n,l.set(n.getKey(),0,"text"))),Ei(r)){const t=r.getTextContent().length;0===u?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,a.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){if(ho(this,e,t,n))return;const r="move"===e,i=vo(),o=Nl(bl(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,a=this.focus.getNode();if(null===l||null===s||!Ho(a)||a.isInline()||a.canBeEmpty()||Tl(s,i,l),this.dirty){let e=ul(i,this.anchor.key),t=ul(i,this.focus.key);"text"===this.anchor.type&&(e=Es(e)),"text"===this.focus.type&&(t=Es(t)),e&&t&&so(o,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(o,e,t?"backward":"forward",n),o.rangeCount>0){const e=o.getRangeAt(0),n=this.anchor.getNode(),i=qo(n)?n:xl(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];ml(t,i)?r.push(t):s=!0}if(s&&r.length>0)if(t){const e=r[0];Ho(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Ho(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}o.anchorNode===e.startContainer&&o.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,o=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,o,!0)}(this)}}"lineboundary"===n&&ho(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Ho(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Ho(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=ya(Ea(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(oa(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Ho(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=Pa(t);Aa(this,_a(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(ia(t)){if(Ho(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(Wo(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Ho(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Yi();e.add(t.origin.getKey()),Ks(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return Aa(this,_a(!t.origin.isEmpty()&&n.isEmpty()?Oa(ca(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&Hi(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Ui(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Ui(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,o=r.offset,s=e<o,l=s?e:o,a=s?o:e,c=a-1;l!==c&&function(e){return!(Ws(e)||Ki(e))}(i.getTextContent().slice(l,a))&&(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&qo(e.getParent())&&null===e.getPreviousSibling()&&Hi(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Bi(e){return e instanceof Pi}function $i(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function zi(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[$i(n),$i(r)]}function Hi(e,t){for(let n=t;n;n=n.getParent()){if(Ho(n)){if(n.collapseAtStart(e))return!0;if(Cl(n))break}if(n.getPreviousSibling())break}return!1}const Ki=(()=>{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Ui(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let e=0;e<o;e++){const r=e===o-1;if(l=s,s+=i[e].length,t&&s===n||s>n||r){i.splice(e,1),r&&(l=void 0);break}}const a=i.join("").trim();""===a?r.remove():(r.setTextContent(a),r.select(l,l))}function Wi(e,t,n,r){let i,o=t;if(Ol(e)){let s=!1;const l=e.childNodes,a=l.length,c=r._blockCursorElement;o===a&&(s=!0,o=a-1);let u=l[o],d=!1;if(u===c)u=l[o+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&o--}if(i=Us(u),Ei(i))o=da(i,s?"next":"previous");else{let l=Us(e);if(null===l)return null;if(Ho(l)){const a=r.getElementByKey(l.getKey());null===a&&_e(214);const c=Bl(r).$getDOMSlot(l,a,r);[l,o]=c.resolveChildIndex(l,a,e,t),Ho(l)||_e(215),s&&o>=l.getChildrenSize()&&(o=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(o);if(Ho(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=s?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=Ho(u)?u:u.getParentOrThrow()),o=0}Ei(u)?(i=u,l=null,o=da(u,s?"next":"previous")):u!==l&&s&&!d&&(Ho(l)||_e(216),o=Math.min(l.getChildrenSize(),o+1))}else{const n=l.getIndexWithinParent();o=0===t&&Wo(l)&&Us(e)===l?n:n+1,l=l.getParentOrThrow()}if(Ho(l))return Fi(l.__key,o,"element")}}else i=Us(e);return Ei(i)?Fi(i.__key,da(i,o,"clamp"),"text"):null}function Vi(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&Ho(o)&&o.isInline()){const t=o.getPreviousSibling();Ei(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Ho(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Ei(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(t&&Ho(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Ho(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();Ei(t)&&e.set(t.__key,0,"text")}}}function qi(e,t,n){if("text"===e.type&&"text"===t.type){const n=e.isBefore(t),r=e.is(t);Vi(e,n,r),Vi(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function ji(e,t,n,r,i,o){if(null===e||null===n||!ys(i,e,n))return null;const s=Wi(e,t,Mi(o)?o.anchor:null,i);if(null===s)return null;const l=Wi(n,r,Mi(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const t=Us(e),r=Us(n);if(Wo(t)&&Wo(r))return null}return qi(s,l),[s,l]}function Zi(e){return Ho(e)&&!e.isInline()}function Gi(e,t,n,r,i,o){const s=So(),l=new Di(Fi(e,t,i),Fi(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Ji(){const e=Fi("root",0,"element"),t=Fi("root",0,"element");return new Di(e,t,0,"")}function Yi(){return new Pi(new Set)}function Xi(e,t){return Qi(null,e,t,null)}function Qi(e,t,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,a=!rt&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let c,u,d,h;if(Mi(e)&&!a)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,(l||void 0===s)&&Mi(e)&&!ys(n,c,u))return e.clone();const g=ji(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;let m=0,y="";if(Mi(e)){const t=e.anchor;if(p.key===t.key)m=e.format,y=e.style;else{const e=p.getNode();Ei(e)?(m=e.getFormat(),y=e.getStyle()):Ho(e)&&(m=e.getTextFormat(),y=e.getTextStyle())}}return new Di(p,f,m,y)}function eo(){return So()._selection}function to(){return vo()._editorState._selection}function no(e,t,n,r=1){const i=e.anchor,o=e.focus,s=i.getNode(),l=o.getNode();if(!t.is(s)&&!t.is(l))return;const a=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(a,n,"element"),o.set(a,n,"element"),ro(e)}}else{const s=e.isBackward(),l=s?o:i,c=l.getNode(),u=s?i:o,d=u.getNode();if(t.is(c)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(a,Math.max(0,e+r),"element")}if(t.is(d)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(a,Math.max(0,e+r),"element")}}ro(e)}function ro(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!Ho(o))return;const e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ei(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(Ho(o)){const e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ei(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Ho(s)){const e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(Ei(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function io(e,t,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,Ei(r)?(s=r.getTextContentSize(),l="text"):Ho(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,Ei(i)?l="text":Ho(i)&&(l="element")),null!==o&&null!==l?e.set(o,s,l):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function oo(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function so(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function lo(e,t,n){const r=ul(e,t.getKey());if(Ho(t)){const i=Bl(e).$getDOMSlot(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function ao(e){let t=eo()||to();null===t&&(t=zs().selectEnd()),t.insertNodes(e)}function co(e){let t=e;e.isCollapsed()||t.removeText();const n=eo();Mi(n)&&(t=n),Mi(t)||_e(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!Ml(i);){const e=i;if([i,o]=uo(i,o),e.is(i))break}return o}function uo(e,t){const n=e.getParent();if(!n){const e=es();return zs().append(e),e.select(),[zs(),0]}if(Ei(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Ho(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new Di(Fi(e.__key,t,"element"),Fi(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function ho(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const o=Ea(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!Ma(a)){for(const e of a){c=!1;const{origin:t}=e;if(!Wo(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of ya(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(oa(e))e.origin.isInline()||(a=e);else{if(Ho(e.origin))continue;Wo(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===o)return!1;if(l&&!s&&Wo(a.origin)&&a.origin.isKeyboardSelectable()){const e=Yi();return e.add(a.origin.getKey()),Ks(e),!0}return a=Pa(a),l&&Ta(e.anchor,a),Ta(e.focus,a),c||!s}let go=null,po=null,fo=!1,mo=!1,yo=0;const bo={characterData:!0,childList:!0,subtree:!0};function _o(){return fo||null!==go&&go._readOnly}function xo(){fo&&_e(13)}function Co(){yo>99&&_e(14)}function So(){return null===go&&_e(195,wo()),go}function vo(){return null===po&&_e(337,wo()),po}function wo(){let e=0;const t=new Set,n=as.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=xs(r);if(bs(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function ko(e,t,n){const r=t.__type,i=hs(e,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function Eo(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function To(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function No(e){return Ao(e,vo()._nodes)}function Ao(e,t){const n=e.type,r=t.get(n);void 0===r&&_e(17,n);const i=r.klass;e.type!==i.getType()&&_e(18,i.name);const o=i.importJSON(e),s=e.children;if(Ho(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){const n=Ao(s[e],t);o.append(n)}return o}function Lo(e,t,n){const r=go,i=fo,o=po;go=t,fo=!0,po=e;try{return n()}finally{go=r,fo=i,po=o}}function Oo(e,t){const n=e._pendingEditorState,r=e._rootElement,i=e._headless||null===r;if(null===n)return void(e._deferred.length>0&&Ro(e,e._deferred));const o=e._editorState,s=o._selection,l=n._selection,a=0!==e._dirtyType,c=go,u=fo,d=po,h=e._updating,g=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!i&&a&&null!==g){po=e,go=n,fo=!1,e._updating=!0;try{const t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),p=function(e,t,n,r,i,o){Kt="",Vt=2===r,Ft=n,Ot=n._config,Ht=n._config.dom||is,It=n._nodes,Rt=Ft._listeners.mutation,Pt=i,Mt=o,Dt=e._nodeMap,Bt=t._nodeMap,qt=t._readOnly,$t=new Map(n._keyToDOMMap);const s=new Map;return zt=s,on("root",null),Ft=void 0,It=void 0,Pt=void 0,Mt=void 0,Dt=void 0,Bt=void 0,Ot=void 0,$t=void 0,zt=void 0,Ht=is,s}(o,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),mo)throw t;return ns(e,null,r,n),ht(e),e._dirtyType=2,mo=!0,Oo(e,o),void(mo=!1)}finally{g.observe(r,bo),e._updating=h,go=c,fo=u,po=d}}n._readOnly||(n._readOnly=!0);const f=e._dirtyLeaves,m=e._dirtyElements,y=e._normalizedNodes,b=e._updateTags,_=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=Bs(e)),delete r[o])}(e,n);const x=i?null:Nl(bl(e));if(e._editable&&null!==x&&(a||null===l||l.dirty||!l.is(s))&&null!==r&&!b.has(Yr)){po=e,go=n;try{if(null!==g&&g.disconnect(),a||null===l||l.dirty){const t=e._blockCursorElement;null!==t&&Tl(t,e,r),function(e,t,n,r,i,o){const s=r.anchorNode,l=r.focusNode,a=r.anchorOffset,c=r.focusOffset,u=document.activeElement;if(i.has(Gr)&&u!==o||null!==u&&ms(u))return;if(!Mi(t))return void(null!==e&&ys(n,s,l)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.getNode(),p=h.getNode(),[f,m]=lo(n,g,d.offset),[y,b]=lo(n,p,h.offset),_=t.format,x=t.style,C=t.isCollapsed();let S=f,v=y,w=!1;var k,E,T,N,A;if("text"===d.type?(S=Es(f),w=g.getFormat()!==_||g.getStyle()!==x):Mi(e)&&"text"===e.anchor.type&&(w=!0),"text"===h.type&&(v=Es(y)),null!==S&&null!==v&&(C&&(null===e||w||Mi(e)&&(e.format!==_||e.style!==x))&&(k=_,E=x,T=m,N=d.key,A=performance.now(),Cr=[k,E,T,N,A]),a!==m||c!==b||s!==S||l!==v||"Range"===r.type&&C||(null!==u&&o.contains(u)||i.has(Xr)||o.focus({preventScroll:!0}),"element"===d.type))){if(so(r,S,m,v,b),!we||!t.isCollapsed()||null===o||i.has(Xr)||null!==document.activeElement&&o.contains(document.activeElement)||o.focus({preventScroll:!0}),!i.has(Jr)&&t.isCollapsed()&&null!==o&&o===document.activeElement){const e=Mi(t)&&"element"===t.anchor.type?S.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=hl(n),i=yl(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,l=0,a=0,c=n;for(;null!==c;){const t=c===r.body;if(t){l=0,a=bl(e).innerHeight;const t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),o=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(l+=n),isFinite(o)&&(a-=o)}else{const e=c.getBoundingClientRect();l=e.top,a=e.bottom}let n=0;if(o<l?n=-(l-o):s>a&&(n=s-a),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;o-=t,s-=t}if(t)break;c=dl(c)}}(n,t,o)}}pr=!0}}(s,l,e,x,b,r)}!function(e,t,n){let r=e._blockCursorElement;if(Mi(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,a=null;if(s===o.getChildrenSize())El(o.getChildAtIndex(s-1))&&(l=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&El(t)){const n=t.getPreviousSibling();(null===n||El(n))&&(l=!0,a=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(o.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=Va(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===a?n.appendChild(r):n.insertBefore(r,a))}}null!==r&&Tl(r,e,t)}(e,r,l)}finally{null!==g&&g.observe(r,bo),po=d,go=c}}null!==p&&function(e,t,n,r,i){const o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){const[s,l]=o[e];for(const e of l){const o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,p,b,f,o),Mi(l)||null===l||null!==s&&s.is(l)||e.dispatchCommand(dn,void 0);const C=e._pendingDecorators;null!==C&&(e._decorators=C,e._pendingDecorators=null,Fo("decorator",e,!0,C)),function(e,t,n){const r=$s(t),i=$s(n);r!==i&&Fo("textcontent",e,!0,i)}(e,t||o,n),Fo("update",e,!0,{dirtyElements:m,dirtyLeaves:f,editorState:n,mutatedNodes:p,normalizedNodes:y,prevEditorState:t||o,tags:b}),Ro(e,_),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;Mo(e,t,r)}}}(e)}function Fo(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=t._listeners[e],i=Array.from(n);for(const[e,t]of i){t&&t();const i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Io(e,t,n,r){const i=Vs(e);let o;for(let e=4;e>=0;e--)for(let s=0;s<i.length;s++){const l=i[s];if(s>0&&l._updating){o=l;break}const a=l._commands.get(t);if(void 0!==a){const t=a[e];if(t.size>0){let e=!1;if(Do(l,(()=>{for(const i of t)if(i(n,r))return void(e=!0)})),e)return e}}}return o&&o.update((()=>{Io(o,t,n,r)})),!1}function Ro(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Po(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t,o=e._pendingEditorState;let s;void 0!==i&&(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(null===o&&_e(191),o._flushSync=!0),s&&e._deferred.push(s),To(e,i.tag)),null==o?Mo(e,n,i):n()}}return r}function Mo(e,t,n){const r=e._updateTags;let i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,To(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let a=e._pendingEditorState,c=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=jo(a||l),c=!0),a._flushSync=s;const u=go,d=fo,h=po,g=e._updating;go=a,fo=!1,e._updating=!0,po=e;const p=e._headless||null===e.getRootElement();us(null);try{c&&(p?null!==l._selection&&(a._selection=l._selection.clone()):a._selection=function(e,t){const n=e.getEditorState()._selection,r=Nl(bl(e));return Mi(n)||null==n?Qi(n,r,e,t):n.clone()}(e,n&&n.event||null));const r=e._compositionKey;t(),o=Po(e,o),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(Mi(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(o?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);Ei(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Nt(t)}}(a,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=Is(),s=new Map;let l=n,a=l.size,c=r,u=c.size;for(;a>0||u>0;){if(a>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);Ei(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Nt(r),void 0!==r&&Eo(r,o)&&ko(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){yo++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],l=e[1];if(r.set(n,l),!l)continue;const a=i.get(n);void 0!==a&&Eo(a,o)&&ko(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,yo++}t._dirtyLeaves=n,t._dirtyElements=r}(a,e),Po(e),function(e,t,n,r){const i=e._nodeMap,o=t._nodeMap,s=[];for(const[e]of r){const t=o.get(e);void 0!==t&&(t.isAttached()||(Ho(t)&&nt(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(const e of s)o.delete(e);for(const e of n){const t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(l,a,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(Mi(i)){const e=a._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||_e(19)}else Bi(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Oo(e)}finally{go=u,fo=d,po=h,e._updating=g,yo=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);f?a._flushSync?(a._flushSync=!1,Oo(e)):c&&ps((()=>{Oo(e)})):(a._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Do(e,t,n){po===e&&void 0===n?t():Mo(e,t,n)}class Bo{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Bo(this.element,e,this.after)}withAfter(e){return new Bo(this.element,this.before,e)}withElement(e){return this.element===e?this:new Bo(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&_e(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&_e(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&_e(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(Oe||Ee||Ne);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.setProperty("display","inline","important"),e.style.setProperty("border","0px","important"),e.style.setProperty("margin","0px","important"),e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=$o(t,n);i.push(r);const o=$o(t,this.element);let s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){const t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function $o(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&_e(225),n.reverse()}class zo extends Ur{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ye[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=vo()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(Ei(t)&&e.push(t),Ho(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ho(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Ho(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return Ho(e)&&e.getLastDescendant()||e||null}const r=t[e];return Ho(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Rs(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&_e(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Rs(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&_e(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),Ho(i)&&r!==n-1&&!i.isInline()&&(e+=Ke)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),Ho(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){const t=Je[e];return 0!==(this.getFormat()&t)}return!1}hasTextFormat(e){const t=Ze[e];return 0!==(this.getTextFormat()&t)}getFormatFlags(e,t){return Ts(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){xo();const n=eo();let r=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(Ei(e)||Ho(e))return e.select(0,0)}else if(!(void 0!==e&&e!==o||void 0!==t&&t!==o)){const e=this.getLastChild();if(Ei(e)||Ho(e))return e.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return Mi(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):Gi(s,r,s,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e&&Je[e]||0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Kr(this)&&_e(324,this.__key,this.__type);const r=this.getChildrenSize(),i=this.getWritable();e+t<=r||_e(226,String(e),String(t),String(r));const o=i.__key,s=[],l=[],a=this.getChildAtIndex(e+t);let c=null,u=r-t+n.length;if(0!==e)if(e===r)c=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(c=t.getPreviousSibling())}if(t>0){let e=null===c?this.getFirstChild():c.getNextSibling();for(let n=0;n<t;n++){null===e&&_e(100);const t=e.getNextSibling(),n=e.__key;Ls(e.getWritable()),l.push(n),e=t}}let d=c;for(const e of n){null!==d&&e.is(d)&&(c=d=d.getPreviousSibling());const t=e.getWritable();t.__parent===o&&u--,Ls(t);const n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{const e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&_e(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(i.__size=u,l.length){const e=eo();if(Mi(e)){const t=new Set(l),n=new Set(s),{anchor:r,focus:i}=e;Ko(r,t,n)&&io(r,r.getNode(),this,c,a),Ko(i,t,n)&&io(i,i.getNode(),this,c,a),0!==u||this.canBeEmpty()||Cl(this)||this.remove()}}return i}getDOMSlot(e){return new Bo(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0===t&&""===n||Cl(this)||this.getChildren().some(Ei)||(0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=Bl(t).$getDOMSlot(this,e,t);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Ho(e){return e instanceof zo}function Ko(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Uo extends Ur{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Wo(e){return e instanceof Uo}class Vo extends zo{__cachedText;static getType(){return"root"}static clone(){return new Vo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){_e(51)}getTextContent(){const e=this.__cachedText;return!_o()&&0!==vo()._dirtyType||null===e?super.getTextContent():e}remove(){_e(52)}replace(e){_e(53)}insertBefore(e){_e(54)}insertAfter(e){_e(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Ho(e)||Wo(e)||_e(282);return super.splice(e,t,n)}static importJSON(e){return zs().updateFromJSON(e)}collapseAtStart(){return!0}}function qo(e){return e instanceof Vo}function jo(e){return new Jo(new Map(e._nodeMap))}function Zo(){return new Jo(new Map([["root",new Vo]]))}function Go(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&_e(130,n.name),Ho(e)){const r=t.children;Array.isArray(r)||_e(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=Go(i[e]);r.push(t)}}return t}class Jo{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return Lo(t&&t.editor||null,this,e)}clone(e){const t=new Jo(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return Lo(null,this,(()=>({root:Go(zs())})))}}class Yo extends zo{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Xo extends zo{static getType(){return"paragraph"}static clone(e){return new Xo(e.__key)}createDOM(e){const t=document.createElement("p"),n=il(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Qo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return es().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(void 0===e.textFormat||void 0===e.textStyle){const t=this.getChildren().find(Ei);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const n=es();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||Ei(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Qo(e){const t=es();if(e.style&&(t.setFormat(e.style.textAlign),Ul(e,t)),""===t.getFormatType()){const n=e.getAttribute("align");n&&n&&n in Je&&t.setFormat(n)}return{node:t}}function es(){return vl(new Xo)}function ts(e){return e instanceof Xo}function ns(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Zo(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function rs(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=ql(r),i=r.transform;if(!n.has(i)){n.add(i);const e=r.transform();e&&t.add(e)}if(e){const n=e.$transform;n&&t.add(n),r=e.extends}else{const e=Object.getPrototypeOf(r);r=e.prototype instanceof Ur&&e!==Ur?e:void 0}}return t}const is={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{const n=gs(t,e.getType());return n&&void 0!==n.exportDOM?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>Ho(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>(Ho(e)||_e(336,e.getKey(),e.getType()),e.getDOMSlot(t)),$shouldExclude:(e,t,n)=>Ho(e)&&e.excludeFromCopy("html"),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function os(e){const t=e||{},n=po,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Zo(),l=t.namespace||(null!==i?i._config.namespace:qs()),a=t.editorState,c=[Vo,mi,oi,Ni,Xo,Yo,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e<c.length;e++){let t=c[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}ql(t);const i=t.getType(),o=rs(t);g.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:yt(c[e]),transforms:o})}}const p=new as(s,i,g,{disableEvents:o,dom:{...is,...e&&e.dom},namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==a&&(p._pendingEditorState=a,p._dirtyType=2),function(e){e.registerCommand(pn,Nr,0),e.registerCommand(fn,Ar,0),e.registerCommand(mn,Lr,0),e.registerCommand(yn,Or,0),e.registerCommand(An,Ir,0)}(p),p}function ss(e,t){const n=e.get(t);e.delete(t),n&&n()}function ls(e,t,n){return e.set(t,n),ss.bind(null,e,t)}class as{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=qs(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){return ls(this._listeners.update,e)}registerEditableListener(e){return ls(this._listeners.editable,e)}registerDecoratorListener(e){return ls(this._listeners.decorator,e)}registerTextContentListener(e){return ls(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return Za(ls(t,e,e(this._rootElement,null)||void 0),(()=>function(e,t,n){const r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement])))}registerCommand(e,t,n){void 0===n&&_e(35);const r=this._commands;r.has(e)||r.set(e,[new tt,new tt,new tt,new tt,new tt]);const i=r.get(e);void 0===i&&_e(36,String(e));const o=function(e){return 7&e}(n),s=i[o];return o!==n?s.addFront(t):s.addBack(t),()=>{s.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&_e(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Hl(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=Hl(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=Rs(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:jr}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return cl(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=il(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,ns(this,t,e,r),null!==t&&(this._config.disableEvents||$r(t),null!=n&&t.classList.remove(...n)),null!==e){const t=yl(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,ht(this),this._updateTags.add(jr),Oo(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument;hr.set(e,n);const r=gr.get(n)??0;r<1&&n.addEventListener("selectionchange",Mr),gr.set(n,r+1),e.__lexicalEditor=t;const i=Rr(e);for(let n=0;n<lr.length;n++){const[r,o]=lr[n],s="function"==typeof o?e=>{Br(e)||(Dr(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(Br(e))return;Dr(e);const n=t.isEditable();switch(r){case"cut":return n&&cl(t,Yn,e);case"copy":return cl(t,Jn,e);case"paste":return n&&cl(t,Sn,e);case"dragstart":return n&&cl(t,jn,e);case"dragover":return n&&cl(t,Zn,e);case"dragend":return n&&cl(t,Gn,e);case"focus":return n&&cl(t,rr,e);case"blur":return n&&cl(t,ir,e);case"drop":return n&&cl(t,Vn,e)}};e.addEventListener(r,s),i.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(jr),Oo(this);Fo("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&_e(38);let n=e;n._readOnly&&(n=jo(e),n._selection=e._selection?e._selection.clone():null),dt(this);const r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),Oo(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||Oo(this)}parseEditorState(e,t){return function(e,t,n){const r=Zo(),i=go,o=fo,s=po,l=t._dirtyElements,a=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,go=r,fo=!1,po=t,us(null);try{const i=t._nodes;Ao(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=a,t._cloneNotNeeded=c,t._dirtyType=u,go=i,fo=o,po=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Oo(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Mo(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Do(this,(()=>{const r=eo(),i=zs();null!==r?r.dirty||Ks(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),pl("focus"),fl((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=Nl(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Fo("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}as.version="0.44.0+prod.esm";let cs=null;function us(e){cs=e}let ds=1;function hs(e,t){const n=gs(e,t);return void 0===n&&_e(30,t),n}function gs(e,t){return e._nodes.get(t)}const ps="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function fs(e){return Wo(Ds(e))}function ms(e){const t=document.activeElement;if(!Ol(t))return!1;const n=t.nodeName;return Wo(Ds(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==xs(t))}function ys(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!ms(t)&&_s(t)===e}catch(e){return!1}}function bs(e){return e instanceof as}function _s(e){let t=e;for(;null!=t;){const e=xs(t);if(bs(e))return e;t=dl(t)}return null}function xs(e){return e?e.__lexicalEditor:null}function Cs(e){return qe.test(e)?"rtl":je.test(e)?"ltr":null}function Ss(e){return Li(e)||e.isToken()}function vs(e){return Ss(e)||e.isSegmented()}function ws(e){return Fl(e)&&3===e.nodeType}function ks(e){return Fl(e)&&9===e.nodeType}function Es(e){let t=e;for(;null!=t;){if(ws(t))return t;t=t.firstChild}return null}function Ts(e,t,n){const r=Ze[t];if(null!==n&&(e&r)===(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function Ns(e){return Ei(e)||ai(e)||Wo(e)}function As(e,t){const n=function(){const e=cs;return cs=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);xo(),Co();const r=vo(),i=So(),o=""+ds++;i._nodeMap.set(o,e),Ho(e)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,e.__key=o}function Ls(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,a=null!==i?i.getWritable():null,c=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==a&&(a.__next=s),null!==c&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Os(e){Co(),Kr(e)&&_e(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=So(),i=vo(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);const l=t.__key;i._dirtyType=1,Ho(e)?s.set(l,!0):i._dirtyLeaves.add(l)}function Fs(e){xo();const t=vo(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Rs(n);null!==e&&e.getWritable()}if(null!==e){const t=Rs(e);null!==t&&t.getWritable()}}}function Is(){return _o()?null:vo()._compositionKey}function Rs(e,t){const n=(t||So())._nodeMap.get(e);return void 0===n?null:n}function Ps(e,t){const n=Ms(e,vo());return void 0!==n?Rs(n,t):null}function Ms(e,t){return e[`__lexicalKey_${t._key}`]}function Ds(e,t){let n=e;for(;null!=n;){const e=Ps(n,t);if(null!==e)return e;n=dl(n)}return null}function Bs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function $s(e){return e.read((()=>zs().getTextContent()))}function zs(){return Hs(So())}function Hs(e){return e._nodeMap.get("root")}function Ks(e){xo();const t=So();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Us(e){const t=vo(),n=function(e,t){let n=e;for(;null!=n;){const e=Ms(n,t);if(void 0!==e)return e;n=dl(n)}return null}(e,t);return null===n?e===t.getRootElement()?Rs("root"):null:Rs(n)}function Ws(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Vs(e){const t=[];for(let n=e;null!==n;n=n._parentEditor)t.push(n);return t}function qs(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function js(e){return ws(e)?e.nodeValue:null}function Zs(e,t,n){const r=Nl(bl(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=js(i);const r=Ds(i);if(null!==t&&Ei(r)){if((t===He||t===Ue)&&n){const e=n.length;t=n,o=e,s=e}null!==t&&Gs(r,t,o,s,e)}}}function Gs(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let l=t;if((s||i)&&(t.endsWith(He)&&(l=t.slice(0,-He.length)),i)){const e=Ue;let t;for(;-1!==(t=l.indexOf(e));)l=l.slice(0,t)+l.slice(t+e.length),null!==n&&n>t&&(n=Math.max(t,n-e.length)),null!==r&&r>t&&(r=Math.max(t,r-e.length))}const a=o.getTextContent();if(i||l!==a){if(""===l){if(Fs(null),Ne||Ee||Oe)o.remove();else{const e=vo();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=to(),a=o.getTextContentSize(),c=Is(),u=o.getKey();if(o.isToken()||null!==c&&u===c&&!s||Mi(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===a&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const d=eo();if(!Mi(d)||null===n||null===r)return void Js(o,l,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=ki(o.getTextContent());o.replace(e),o=e}Js(o,l,d)}}}function Js(e,t,n){if(e.setTextContent(t),Mi(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=da(e,i.offset,"clamp"))}}}function Ys(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Xs(e,t,n){if(!function(e,t){return Ys(e,t,"altKey")&&Ys(e,t,"ctrlKey")&&Ys(e,t,"shiftKey")&&Ys(e,t,"metaKey")}(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1)return!1;if(1===e.key.length&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith("Digit")&&/^\d$/.test(t))return e.code===`Digit${t}`;const r="Key"+t.toUpperCase();return e.code===r}const Qs={ctrlKey:!ve,metaKey:ve},el={altKey:ve,ctrlKey:!ve};function tl(e){return"Backspace"===e.key}function nl(e){return Xs(e,"a",Qs)}function rl(e){const t=zs();if(Mi(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),At(e),e}{const e=t.select(0,t.getChildrenSize());return Ks(At(e)),e}}function il(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=Va(i);return n[t]=e,e}return i}function ol(e,t,n,r,i){if(0===n.size)return;const o=r.__type,s=r.__key,l=t.get(o);void 0===l&&_e(33,o);const a=l.klass;let c=e.get(a);void 0===c&&(c=new Map,e.set(a,c));const u=c.get(s),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(s,d?"updated":i)}function sl(e,t,n){const r=e.getParent();let i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function ll(e,t){const n=e.offset;if("element"===e.type)return sl(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?sl(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function al(e){const t=bl(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function cl(e,t,n){return Io(e,t,n,e)}function ul(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&_e(75,t),n}function dl(e){const t=e.assignedSlot||e.parentElement;return Il(t)?t.host:t}function hl(e){return ks(e)?e:Ol(e)?e.ownerDocument:null}function gl(e){return vo()._updateTags.has(e)}function pl(e){xo(),vo()._updateTags.add(e)}function fl(e){xo(),vo()._deferred.push(e)}function ml(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function yl(e){const t=hl(e);return t?t.defaultView:null}function bl(e){const t=e._window;return null===t&&_e(78),t}function _l(e){return Ho(e)&&e.isInline()||Wo(e)&&e.isInline()}function xl(e){let t=e.getParentOrThrow();for(;null!==t;){if(Cl(t))return t;t=t.getParentOrThrow()}return t}function Cl(e){return qo(e)||Ho(e)&&e.isShadowRoot()}function Sl(e,t=!1){const n=e.constructor.clone(e);return As(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function vl(e){const t=vo(),n=e.getType(),r=gs(t,n);void 0===r&&_e(200,e.constructor.name,n);const{replace:i,replaceWithKlass:o}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==o?t instanceof o||_e(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||_e(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&_e(203,e.constructor.name,n,r.name,r.getType()),t}return e}function wl(e,t){!qo(e.getParent())||Ho(t)||Wo(t)||_e(99)}function kl(e){const t=Rs(e);return null===t&&_e(63,e),t}function El(e){return(Wo(e)||Ho(e)&&!e.canBeEmpty())&&!e.isInline()}function Tl(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function Nl(e){return Ce?(e||window).getSelection():null}function Al(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),Cl(e)&&_e(102);const r=e=>{const t=e.getParentOrThrow(),i=Cl(t),o=e!==n||i?Sl(e):e;if(i)return Ho(e)&&Ho(o)||_e(133),e.insertAfter(o),[e,o,o];{const[n,i,s]=r(t),l=e.getNextSiblings();return s.append(o,...l),[n,i,o]}},[i,o]=r(n);return[i,o]}function Ll(e){return Ol(e)&&"A"===e.tagName}function Ol(e){return Fl(e)&&1===e.nodeType}function Fl(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function Il(e){return Fl(e)&&11===e.nodeType}function Rl(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function Pl(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function Ml(e){if(Wo(e)&&!e.isInline())return!0;if(!Ho(e)||Cl(e))return!1;const t=e.getFirstChild(),n=null===t||ai(t)||Ei(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Dl(){return vo()}function Bl(e=Dl()){return e._config.dom||is}const $l=new WeakMap,zl=new Map;function Hl(e){if(!e._readOnly&&e.isEmpty())return zl;e._readOnly||_e(192);let t=$l.get(e);return t||(t=function(e){const t=new Map;for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),$l.set(e,t)),t}function Kl(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Ul(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Wl(e){return!0===e.__lexicalUnmanaged}function Vl(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Ur[t]}function ql(e){const t=et in e.prototype?e.prototype[et]():void 0,n=function(e){if(!(e===Ur||e.prototype instanceof Ur)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{as.version&&(n=JSON.parse(as.version))}catch(e){}_e(290,e.name,t,n)}return e===Uo||e===zo||e===Ur}(e),r=!n&&Vl(e,"getType")?e.getType():void 0;let i,o=r;if(t)if(r)i=t[r];else for(const[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(Vl(e,"getType")||(e.getType=()=>o),Vl(e,"clone")||(e.clone=t=>(us(t),new e)),Vl(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Vl(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const jl=(e,t)=>{let n=e;for(;null!=n&&!qo(n);){if(t(n))return n;n=n.getParent()}return null};function Zl(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=null===t?Rs(r):t.get(r);null==e&&_e(174),n.push(r),r=e.__next}return n}const Gl={next:"previous",previous:"next"};class Jl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return xa({hasNext:ia,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return ca(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ca(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();s.set(e.getKey(),e)}for(const e of r){if(s.size>0){const t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&_e(263,Array.from(s).join(" "))}else i.insert(e);i=ca(e,this.direction)}for(const e of s.values())e.remove();return this}}class Yl extends Jl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ga(e,this.direction)}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ql(this.direction);return ca(this.getNodeAtCaret(),e)||ga(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Yl&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Xl={root:qo,shadowRoot:Cl};function Ql(e){return Gl[e]}function ea(e,t="root"){return Xl[t](e)?null:e}class ta extends Jl{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ca(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ho(this.origin)?ga(this.origin,this.direction):null}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ql(this.direction);return ca(this.getNodeAtCaret(),e)||ga(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof ta&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof ta||e instanceof na)&&this.direction===e.direction&&this.origin.is(e.origin)}}class na extends Jl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ua(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){return ua(this.origin,Ql(this.direction),this.offset)}isSamePointCaret(e){return e instanceof na&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof ta||e instanceof na)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return ca(this.origin,this.direction)}}function ra(e){return e instanceof na}function ia(e){return e instanceof ta}function oa(e){return e instanceof Yl}const sa={next:class extends na{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends na{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},la={next:class extends ta{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends ta{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},aa={next:class extends Yl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Yl{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function ca(e,t){return e?new la[t](e):null}function ua(e,t,n){return e?new sa[t](e,da(e,n)):null}function da(e,t,n="error"){const r=e.getTextContentSize();let i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&xe(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function ha(e,t){return new ma(e,t)}function ga(e,t){return Ho(e)?new aa[t](e):null}function pa(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class fa{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new fa(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return ra(t)?function(e,t){const{direction:n,origin:r}=e;return ha(e,da(r,"focus"===t?Ql(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[ha(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=ra(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ra(n),i=t=>t.isSameNodeCaret(n)?null:pa(t)||t.getParentCaret(e);return xa({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class ma{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return ua(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function ya(e){return _a(e,ca(zs(),e.direction))}function ba(e){return _a(e,e)}function _a(e,t){return e.direction!==t.direction&&_e(265),new fa(e,t,e.direction)}function xa(e){const{initial:t,hasNext:n,step:r,map:i}=e;let o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const e={done:!1,value:i(o)};return o=r(o),e}}}function Ca(e,t){const n=ka(e.origin,t.origin);switch(null===n&&_e(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{const n="text"===e.type,r="text"===t.type;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Sa(n)}}function Sa(e){const{a:t,b:n}=e,r=t.__key,i=n.__key;let o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function va(e,t){return t.is(e)}function wa(e){return Ho(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function ka(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=wa(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=wa(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(va(e,r)||_e(276),{commonAncestor:r,type:"ancestor"}):null===i?(va(t,r)||_e(277),{commonAncestor:r,type:"descendant"}):((Ho(o)||va(e,o))&&(Ho(i)||va(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||_e(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function Ea(e,t){const{type:n,key:r,offset:i}=e,o=kl(e.key);return"text"===n?(Ei(o)||_e(266,o.getType(),r),ua(o,t,i)):(Ho(o)||_e(267,o.getType(),r),$a(o,e.offset,t))}function Ta(e,t){const{origin:n,direction:r}=t,i="next"===r;ra(t)?e.set(n.getKey(),t.offset,"text"):ia(t)?Ei(n)?e.set(n.getKey(),da(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(oa(t)&&Ho(n)||_e(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function Na(e){const t=eo(),n=Mi(t)?t:Ji();return Aa(n,e),Ks(n),n}function Aa(e,t){Ta(e.anchor,t.anchor),Ta(e.focus,t.focus)}function La(e){const{anchor:t,focus:n}=e,r=Ea(t,"next"),i=Ea(n,"next"),o=Ca(r,i)<=0?"next":"previous";return _a(Da(r,o),Da(i,o))}function Oa(e){const{direction:t,origin:n}=e,r=ca(n,Ql(t)).getNodeAtCaret();return r?ca(r,t):ga(n.getParentOrThrow(),t)}function Fa(e,t="root"){const n=[e];for(let r=oa(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(Oa(r));return n}function Ia(e){return!!e&&e.origin.isAttached()}function Ra(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=Ba(e,r),s=Fa(o.anchor,n),l=Fa(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(oa(e))a.add(e.origin.getKey());else if(ia(e)){const{origin:t}=e;Ho(t)&&!a.has(t.getKey())||c.push(t)}for(const e of c)e.remove();for(const e of o.getTextSlices()){if(!e)continue;const{origin:t}=e.caret,n=t.getTextContentSize(),o=Oa(ca(t,r)),a=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===i||"token"===a&&0!==e.distance)o.remove();else if(0!==e.distance){i="removeEmptySlices";let t=e.removeTextSlice();const n=e.caret.origin;if("segmented"===a){const e=t.origin,n=ki(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());o.replaceOrInsert(n),t=ua(n,r,t.offset)}n.is(s[0].origin)&&(s[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let u,d;for(const e of s)if(Ia(e)){u=Pa(e);break}for(const e of l)if(Ia(e)){d=Pa(e);break}const h=function(e,t,n){if(!e||!t)return null;const r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let a;for(a=0;a<l&&o[a]===s[a];a++);const c=(e,t)=>{let n;for(let r=a;r<e.length;r++){const i=e[r];if(Cl(i))return;!n&&t(i)&&(n=i)}return n},u=c(o,Ml),d=u&&c(s,(e=>n.has(e.getKey())&&Ml(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;ga(e,"previous").splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){const e=n;n=n.getParent(),e.remove(!0)}}const g=[u,d,...s,...l].find(Ia);if(g)return ba(Da(Pa(g),e.direction));_e(269,JSON.stringify(s.map((e=>e.origin.__key))))}function Pa(e){const t=function(e){let t=e;for(;oa(t);){const e=pa(t);if(!oa(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Ei(t.origin))return ra(t)?t:ua(t.origin,n,n);const r=t.getAdjacentCaret();return ia(r)&&Ei(r.origin)?ua(r.origin,n,Ql(n)):t}function Ma(e){return ra(e)&&e.offset!==da(e.origin,e.direction)}function Da(e,t){return e.direction===t?e:e.getFlipped()}function Ba(e,t){return e.direction===t?e:_a(Da(e.focus,t),Da(e.anchor,t))}function $a(e,t,n){let r=ga(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return Da(r,n)}function za(e,t="root"){let n=0,r=e,i=pa(r);for(;null===i;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=pa(r)}return i&&[i,n]}function Ha(e){const{origin:t,offset:n,direction:r}=e;if(n===da(t,r))return e.getSiblingCaret();if(n===da(t,Ql(r)))return Oa(e.getSiblingCaret());const[i]=t.splitText(n);return Ei(i)||_e(281),Da(ca(i,"next"),r)}function Ka(e,t){return!0}function Ua(e,{$copyElementNode:t=Sl,$splitTextPointCaretNext:n=Ha,rootMode:r="shadowRoot",$shouldSplit:i=Ka,removeEmptyDestination:o=!1}={}){if(ra(e))return n(e);const s=e.getParentCaret(r);if(s){const{origin:n}=s;if(oa(e)){const e=Oa(s);if(o&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,"first"))return e}const r=function(e){const t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(t(n).splice(0,0,r))}return s}function Wa(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}function Va(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function qa(e,...t){const n=Va(...t);n.length>0&&e.classList.add(...n)}function ja(e,...t){const n=Va(...t);n.length>0&&e.classList.remove(...n)}function Za(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Ga(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ja(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ya(e){const t=Dl().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Xa(e){return Ya(qo(e)?e:e.getParentOrThrow())}function Qa(e){const t=Xa(e);return null!==t&&"rtl"===t.direction}function ec(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!vs(t)&&null!==r){const[i,o]=r,s=e.isBackward(),l=i.getNode(),a=o.getNode(),c=t.is(l),u=t.is(a);if(c||u){const[r,i]=zi(e),o=l.is(a),c=t.is(s?a:l),u=t.is(s?l:a);let d,h=0;o?(h=r>i?i:r,d=r>i?r:i):c?(h=s?i:r,d=void 0):u&&(h=0,d=s?r:i);const g=t.__text.slice(h,d);g!==t.__text&&("clone"===n&&(t=function(e){return(t=Kl(e))[Hr]=!0,t;var t}(t)),t.__text=g)}}return t}function tc(e,t){(Mi(e)?e.isCollapsed():Ei(e)||Ho(e))||Ga(280);const n=ni(Mi(e)?e.style:Ei(e)?e.getStyle():e.getTextStyle()),r=Ja(Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}));Mi(e)||Ei(e)?e.setStyle(r):e.setTextStyle(r)}function nc(e){const t=eo();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(Mi(t))for(const e of La(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!Ei(t)||!t.canHaveFormat())continue;const[n,i]=r(t);i!==n&&(vs(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}Mi(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&rc(t)}function rc(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:o}=t;t.set(n.key,n.offset,n.type),n.set(r,i,o)}}function ic(e,t){const n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function oc(e,t,n=ic){if(null===e)return;const r=e.getStartEndPoints(),i=new Map;let o=null;if(r){const[e,t]=r;o=Ji(),o.anchor.set(e.key,e.offset,e.type),o.focus.set(t.key,t.offset,t.type);const n=jl(e.getNode(),Ml),s=jl(t.getNode(),Ml);Ho(n)&&i.set(n.getKey(),n),Ho(s)&&i.set(s.getKey(),s)}for(const t of e.getNodes())if(Ho(t)&&Ml(t))i.set(t.getKey(),t);else if(null===r){const e=jl(t,Ml);Ho(e)&&i.set(e.getKey(),e)}for(const[e,r]of i){const i=t();n(r,i),r.replace(i,!0),o&&(e===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,o.anchor.type),e===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,o.focus.type))}o&&e.is(eo())&&Ks(o)}function sc(e){const t=lc(e);return null!==t&&"vertical-rl"===t.writingMode}function lc(e){const t=e.anchor.getNode();return Ho(t)?Ya(t):Xa(t)}function ac(e,t){let n=sc(e)?!t:t;cc(e)&&(n=!n);const r=Ea(e.focus,n?"previous":"next");if(Ma(r))return!1;for(const e of ya(r)){if(oa(e))return!e.origin.isInline();if(!Ho(e.origin)){if(Wo(e.origin))return!0;break}}return!1}function cc(e){const t=lc(e);return null!==t&&"rtl"===t.direction}function uc(e,t,n){const r=cc(e);let i;i=sc(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function dc(e,t,n){const r=ni(e.getStyle());return null!==r&&r[t]||n}function hc(e,t,n=""){let r=null;const i=e.getNodes(),o=e.anchor,s=e.focus,l=e.isBackward(),a=l?s.getNode():o.getNode(),c=l?o.getNode():s.getNode(),u=l?s.offset:o.offset,d=l?o.offset:s.offset;if(Mi(e)&&e.isCollapsed()&&""!==e.style){const n=ni(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<i.length;e++){const o=i[e];if((0!==e||!o.is(a)||!Ei(o)||u!==o.getTextContentSize())&&(0===e||!o.is(c)||0!==d)&&Ei(o)){const e=dc(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}const gc=ni,pc=["class","contenteditable","href","src","style","title"],fc=["color","background-color"];function mc(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function yc(e,t,n,r){e.addEventListener(t,n,r);const i=new WeakRef(e),o=new WeakRef(n);return function(){const e=o.deref();e&&i.deref()?.removeEventListener(t,e,r)}}be.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...gc(t.attrValue)},n={};for(const t in e)fc.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Ja(n):t.keepAttr=!1}})),be.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class bc{#e=[];track(...e){this.#e.push(...e)}dispose(){for(;this.#e.length;){this.#e.pop()()}}}function _c(e){return t=>{const n=e(t);return n&&t.preventDefault(),n}}function xc(e,t,n=""){const r=document.createElement(e);for(const[e,n]of Object.entries(t||{}))"dataset"===e?Object.entries(n).forEach((([e,t])=>r.dataset[e]=t)):e in r?r[e]=n:null!=n&&r.setAttribute(e,n);return n&&(r.innerHTML=n),r}function Cc(e){return(new DOMParser).parseFromString(e,"text/html")}function Sc(e){return e.startsWith("image/")&&!e.includes("svg")}function vc(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function wc(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function kc(e=""){return Cc(e).body.textContent.trim()}function Ec(e){return e&&!e.disabled&&function(e,t){return e.checkVisibility?e.checkVisibility(t):Boolean(e.offsetParent)}(e)}function Tc(e,t){const n=document.activeElement;if(e.includes(n)){new Nc(e,t.key).selectNext(n)&&t.preventDefault()}}class Nc{constructor(e,t){this.elements=e,this.key=t}selectNext(e){const t=this.#t(e);if(t){const e=this.elements.filter((e=>e!==t));return this.#n(e),this.#r(t),!0}return!1}#t(e){switch(this.key){case"ArrowRight":case"ArrowDown":return this.#i(e);case"ArrowLeft":case"ArrowUp":return this.#o(e);case"Home":return this.#s();case"End":return this.#l()}}#s(e=this.elements){return e.find(Ec)}#l(e=this.elements){return e.findLast(Ec)}#i(e){const t=this.elements.slice(this.#a(e)+1);return this.#s(t)}#o(e){const t=this.elements.slice(0,this.#a(e));return this.#l(t)}#a(e){return this.elements.indexOf(e)}#r(e){Ec(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}var Ac='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.05273 1.88232C10.6866 1.88237 12.0033 2.20353 12.9529 2.89673L13.1272 3.0293C13.974 3.70864 14.4008 4.63245 14.4009 5.76562C14.4008 6.49354 14.2316 7.15281 13.8845 7.73145C13.6683 8.09188 13.3997 8.40162 13.0818 8.66016C13.5902 8.92606 14.0196 9.28599 14.3635 9.74121C14.8586 10.3834 15.0945 11.1743 15.0945 12.0879C15.0944 13.3698 14.5922 14.3931 13.5879 15.1106L13.5857 15.1128C12.5967 15.805 11.196 16.125 9.43799 16.125H3.10547V1.88232L9.05273 1.88232ZM6.36108 13.4084H9.28418C10.224 13.4084 10.8634 13.2491 11.2581 12.9851C11.6259 12.7389 11.8198 12.3768 11.8198 11.8367C11.8197 11.2968 11.6259 10.9351 11.2581 10.689C10.8634 10.425 10.2241 10.2649 9.28418 10.2649H6.36108V13.4084ZM6.36108 7.56812H8.78247C9.5163 7.56809 10.0547 7.45371 10.429 7.25757L10.5791 7.16895C10.9438 6.92178 11.1255 6.57934 11.1255 6.09302C11.1254 5.59017 10.9414 5.25227 10.5835 5.02002L10.5784 5.01636L10.5732 5.01343C10.1994 4.75387 9.61878 4.59818 8.78247 4.59814H6.36108V7.56812Z"/>\n </svg>',Lc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.1379 3.91187L14.1086 4.06421H11.4668L9.49805 13.9431H12.0981L11.7473 15.7852L11.7188 15.9375H4.16675L4.51758 14.0955L4.54614 13.9431H7.18799L9.17505 4.06421H6.55664L6.90747 2.22217L6.93677 2.06982H14.4888L14.1379 3.91187Z"/>\n </svg>',Oc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.3723 11.8015C14.3771 11.8858 14.3811 11.9756 14.3811 12.0681C14.3811 12.811 14.1777 13.4959 13.7725 14.1174L13.7717 14.1189C13.3624 14.7329 12.7463 15.2162 11.9377 15.5742L11.9348 15.5757C11.1214 15.9223 10.1306 16.092 8.96997 16.092C7.9356 16.092 6.93308 15.9348 5.96338 15.6204L5.96045 15.6189C5.00593 15.292 4.24112 14.8699 3.67676 14.3459L3.57568 14.2522L3.63501 14.1277L4.45605 12.397L4.64282 12.5654C5.13492 13.0083 5.76733 13.3759 6.54492 13.6648C7.33475 13.9406 8.14322 14.0786 8.96997 14.0786C10.0731 14.0786 10.8638 13.8932 11.3708 13.5513C11.8757 13.1982 12.1172 12.7464 12.1172 12.1838C12.1172 12.0662 12.1049 11.9556 12.0828 11.8513L12.0344 11.625H14.3621L14.3723 11.8015Z"/>\n <path d="M9.2981 1.91602C10.111 1.91604 10.9109 2.02122 11.6975 2.23096C12.4855 2.44111 13.1683 2.74431 13.7417 3.14429L13.8655 3.23071L13.8083 3.36987L13.1726 4.91235L13.0869 5.1189L12.8987 4.99878C12.3487 4.64881 11.761 4.38633 11.1365 4.21143L11.1328 4.20996C10.585 4.04564 10.0484 3.95419 9.52295 3.93384L9.2981 3.92944C8.22329 3.92944 7.44693 4.12611 6.94043 4.49121C6.44619 4.85665 6.20874 5.31616 6.20874 5.88135L6.21533 6.03296C6.24495 6.37662 6.37751 6.65526 6.61011 6.87964L6.72144 6.97632C6.98746 7.19529 7.30625 7.37584 7.68018 7.51538L8.05151 7.63184C8.45325 7.75061 8.94669 7.87679 9.53247 8.01123L9.53467 8.01196C10.1213 8.15305 10.6426 8.29569 11.0991 8.4375H15C15.5178 8.4375 15.9375 8.85723 15.9375 9.375C15.9375 9.89277 15.5178 10.3125 15 10.3125H3C2.48223 10.3125 2.0625 9.89277 2.0625 9.375C2.0625 8.85723 2.48223 8.4375 3 8.4375H4.93726C4.83783 8.34526 4.74036 8.24896 4.64795 8.146L4.64502 8.14233C4.1721 7.58596 3.94482 6.85113 3.94482 5.95825C3.94483 5.20441 4.14059 4.51965 4.53369 3.90967L4.53516 3.90747C4.94397 3.29427 5.55262 2.81114 6.34863 2.45288C7.15081 2.0919 8.13683 1.91602 9.2981 1.91602Z"/>\n </svg>',Fc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 14C14.5523 14 15 14.4477 15 15C15 15.5523 14.5523 16 14 16H4C3.44772 16 3 15.5523 3 15C3 14.4477 3.44772 14 4 14H14Z"/>\n <path d="M12.625 1.59375C13.25 1.59375 13.625 1.97656 13.625 2.64062V9.02344C13.625 11.4844 11.8516 13.1875 8.99219 13.1875C6.14062 13.1875 4.35938 11.4844 4.35938 9.02344V2.64062C4.35938 1.97656 4.74219 1.59375 5.36719 1.59375C6 1.59375 6.375 1.97656 6.375 2.64062V8.84375C6.375 10.3828 7.32031 11.4297 8.99219 11.4297C10.6641 11.4297 11.6172 10.3828 11.6172 8.84375V2.64062C11.6172 1.97656 11.9922 1.59375 12.625 1.59375Z"/>\n </svg>',Ic='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.5 2C12.0523 2 12.5 2.44772 12.5 3V3.5C12.5 4.05228 12.0523 4.5 11.5 4.5H8V15C8 15.5523 7.55228 16 7 16H6.5C5.94772 16 5.5 15.5523 5.5 15V4.5H2C1.44772 4.5 1 4.05228 1 3.5V3C1 2.44772 1.44772 2 2 2H11.5ZM16 7C16.5523 7 17 7.44772 17 8V8.5C17 9.05228 16.5523 9.5 16 9.5H15V15C15 15.5523 14.5523 16 14 16H13.5C12.9477 16 12.5 15.5523 12.5 15V9.5H11.5C10.9477 9.5 10.5 9.05228 10.5 8.5V8C10.5 7.44772 10.9477 7 11.5 7H16Z"/>\n </svg>',Rc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6445 4.19824C15.5244 4.19824 16.8984 5.34668 16.8984 6.91211C16.8984 7.8759 16.4335 8.7237 15.292 9.84473L13.3438 11.8135V11.9092H16.1875C16.8232 11.9092 17.2197 12.251 17.2197 12.8115C17.2196 13.3651 16.83 13.7002 16.1875 13.7002H11.5117C10.8487 13.7002 10.4112 13.3241 10.4111 12.75C10.4111 12.3399 10.6368 11.9843 11.3203 11.3145L13.6855 8.88086C14.4169 8.13583 14.7245 7.64349 14.7246 7.12402C14.7246 6.4541 14.2393 6.00293 13.5215 6.00293C12.9404 6.00293 12.5166 6.29688 12.2158 6.90527C11.9151 7.37002 11.6552 7.54785 11.2588 7.54785C10.7188 7.54785 10.3429 7.17861 10.3428 6.65918C10.3428 5.3877 11.7783 4.19824 13.6445 4.19824Z"/>\n </svg>',Pc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13.5967 4.19824C15.5928 4.19824 16.9873 5.23047 16.9873 6.7002C16.9872 7.705 16.2421 8.60059 15.2988 8.7168V8.86719C16.4199 8.94923 17.2607 9.89942 17.2607 11.0889C17.2606 12.7362 15.7362 13.9053 13.583 13.9053C11.6827 13.9053 10.1925 12.873 10.1924 11.7041C10.1924 11.1846 10.5547 10.8154 11.0537 10.8154C11.3818 10.8154 11.6553 10.9727 11.9629 11.3555C12.3799 11.9159 12.92 12.2031 13.583 12.2031C14.4853 12.2031 15.0731 11.7313 15.0732 11C15.0732 10.2754 14.4785 9.7832 13.5898 9.7832H13.0361C12.5645 9.7832 12.2159 9.4208 12.2158 8.92188C12.2158 8.44336 12.5576 8.07422 13.0361 8.07422H13.5693C14.3075 8.07422 14.8544 7.60928 14.8545 6.97363C14.8545 6.33789 14.3213 5.90039 13.5557 5.90039C12.9678 5.90039 12.5029 6.16016 12.0859 6.71387C11.8399 7.03508 11.5527 7.17871 11.1973 7.17871C10.671 7.17871 10.295 6.82314 10.2949 6.31738C10.2949 5.18945 11.751 4.19824 13.5967 4.19824ZM8.0332 4.30078C8.75781 4.30078 9.16797 4.74512 9.16797 5.51758V12.5518C9.1679 13.3241 8.75776 13.7686 8.0332 13.7686C7.30865 13.7686 6.90534 13.3309 6.90527 12.5518V9.87207H3.48047V12.5518C3.4804 13.3241 3.07026 13.7686 2.3457 13.7686C1.62115 13.7686 1.21784 13.3309 1.21777 12.5518V5.51758C1.21777 4.73828 1.62109 4.30078 2.3457 4.30078C3.07031 4.30078 3.48047 4.74512 3.48047 5.51758V8.07422H6.90527V5.51758C6.90527 4.73828 7.30859 4.30078 8.0332 4.30078Z"/>\n </svg>',Mc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.6357 4.22559C15.7432 4.22559 16.4336 4.80664 16.4336 5.73633V10.3164H16.7275C17.2881 10.3164 17.6436 10.6787 17.6436 11.2256C17.6435 11.7655 17.3017 12.1006 16.7275 12.1006H16.4336V12.6611C16.4335 13.3515 16.0234 13.7891 15.374 13.7891C14.7247 13.7891 14.3282 13.3583 14.3281 12.6611V12.1006H11.04C10.2335 12.1006 9.76863 11.6766 9.76855 10.918C9.76855 10.5762 9.85064 10.3026 10.1104 9.74219C10.7666 8.42289 11.5733 7.0146 12.5713 5.54492C13.2549 4.56738 13.7812 4.22559 14.6357 4.22559ZM7.88965 4.30078C8.61426 4.30078 9.02441 4.74512 9.02441 5.51758V12.5518C9.02435 13.3241 8.6142 13.7686 7.88965 13.7686C7.1651 13.7686 6.76178 13.3309 6.76172 12.5518V9.87207H3.33691V12.5518C3.33685 13.3241 2.9267 13.7686 2.20215 13.7686C1.4776 13.7686 1.07428 13.3309 1.07422 12.5518V5.51758C1.07422 4.73828 1.47754 4.30078 2.20215 4.30078C2.92676 4.30078 3.33691 4.74512 3.33691 5.51758V8.07422H6.76172V5.51758C6.76172 4.73828 7.16504 4.30078 7.88965 4.30078ZM14.2188 6.07812C13.6035 7.02841 12.2158 9.48929 11.7988 10.2686V10.3164H14.3281V6.07812H14.2188Z"/>\n </svg>',Dc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M9 12C9.55228 12 10 12.4477 10 13C10 13.5523 9.55228 14 9 14H3C2.44772 14 2 13.5523 2 13C2 12.4477 2.44772 12 3 12H9ZM15 8C15.5523 8 16 8.44772 16 9C16 9.55228 15.5523 10 15 10H3C2.44772 10 2 9.55228 2 9C2 8.44772 2.44772 8 3 8H15ZM15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H15Z"/>\n </svg>',Bc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M10.0607 2.07533C10.8417 1.29432 12.1078 1.2943 12.8888 2.07533L16.424 5.61049C17.205 6.39154 17.205 7.65854 16.424 8.43959L9.44937 15.4142C9.07435 15.7891 8.5656 16.0001 8.03531 16.0001H5.0148C4.55074 16.0001 4.10309 15.8385 3.74722 15.547L3.60074 15.4142L1.57534 13.3888C0.79431 12.6078 0.794336 11.3417 1.57534 10.5607L10.0607 2.07533ZM2.98941 11.9747L5.0148 14.0001H8.03531L9.71792 12.3165L6.18179 8.78139L2.98941 11.9747Z"/>\n </svg>',$c='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4564 14.4272C17.1356 15.5592 16.3204 17.0002 15.0003 17.0004C13.68 17.0004 12.864 15.5593 13.5433 14.4272L15.0003 12.0004L16.4564 14.4272ZM5.1214 1.70746C5.51192 1.31693 6.14494 1.31693 6.53546 1.70746L9.7171 4.8891L13.2532 8.42426C14.2295 9.40056 14.2295 10.9841 13.2532 11.9604L9.7171 15.4955C8.74078 16.4718 7.15822 16.4718 6.18195 15.4955L2.64679 11.9604C1.67048 10.9841 1.67048 9.40057 2.64679 8.42426L6.18195 4.8891C6.30299 4.76805 6.43323 4.66177 6.57062 4.57074L5.1214 3.12152C4.73091 2.73104 4.73099 2.09799 5.1214 1.70746ZM8.30304 6.30316C8.10776 6.10815 7.79119 6.10799 7.59601 6.30316L4.06085 9.83929L3.9964 9.91742C3.88661 10.0838 3.88645 10.3019 3.9964 10.4682L4.02277 10.5004H11.8763C12.0312 10.3043 12.02 10.0205 11.8392 9.83929L8.30304 6.30316Z"/>\n </svg>',zc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.8885 7.23091L13.9479 6.17155C14.5337 5.58576 14.5337 4.63602 13.9479 4.05023C13.3621 3.46444 12.4124 3.46444 11.8266 4.05023L8.29235 7.58446C7.9263 7.95051 7.90312 8.52994 8.2233 8.92271L8.36141 9.07463C8.68158 9.4674 8.65841 10.0468 8.29235 10.4129C7.90183 10.8034 7.26866 10.8034 6.87814 10.4129C5.70657 9.24131 5.70657 7.34182 6.87814 6.17025L10.4124 2.63602C11.7792 1.26918 13.9953 1.26918 15.3621 2.63602C16.729 4.00285 16.729 6.21893 15.3621 7.58576L14.3028 8.64512C13.9122 9.03564 13.2791 9.03564 12.8885 8.64512C12.498 8.2546 12.498 7.62143 12.8885 7.23091Z"/>\n <path d="M5.11038 10.7664L4.04843 11.8284C3.46264 12.4142 3.46264 13.3639 4.04842 13.9497C4.63421 14.5355 5.58396 14.5355 6.16975 13.9497L9.70657 10.4129C10.0726 10.0468 10.0958 9.46741 9.77563 9.07464L9.63752 8.92272C9.31734 8.52995 9.34052 7.95052 9.70657 7.58446C10.0971 7.19394 10.7303 7.19394 11.1208 7.58446C12.2924 8.75604 12.2924 10.6555 11.1208 11.8271L7.58396 15.3639C6.21712 16.7308 4.00105 16.7308 2.63421 15.3639C1.26738 13.9971 1.26738 11.781 2.63421 10.4142L3.69617 9.35223C4.08669 8.96171 4.71986 8.96171 5.11038 9.35223C5.5009 9.74275 5.5009 10.3759 5.11038 10.7664Z"/>\n </svg>',Hc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M4.96387 4.23438C6.8769 4.23438 8.42767 5.78522 8.42773 7.69824C8.42773 8.32925 8.25769 8.92015 7.96289 9.42969L7.96387 9.43066L5.11816 14.3584C4.77659 14.95 4.02038 15.153 3.42871 14.8115C2.83701 14.4699 2.63397 13.7128 2.97559 13.1211L4.16113 11.0674C2.63532 10.7052 1.5 9.33485 1.5 7.69824C1.50006 5.78524 3.05086 4.2344 4.96387 4.23438ZM13.0361 4.23438C14.9491 4.23449 16.4999 5.7853 16.5 7.69824C16.5 8.32921 16.3299 8.92017 16.0352 9.42969L16.0361 9.43066L13.1904 14.3584C12.8488 14.9501 12.0917 15.1531 11.5 14.8115C10.9085 14.4698 10.7063 13.7127 11.0479 13.1211L12.2324 11.0674C10.7069 10.7049 9.57227 9.33461 9.57227 7.69824C9.57233 5.78522 11.1231 4.23438 13.0361 4.23438Z"/>\n </svg>',Kc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.29289 3.79295C6.68342 3.40243 7.31643 3.40243 7.70696 3.79295C8.09748 4.18348 8.09748 4.81649 7.70696 5.20702L3.91399 8.99999L7.70696 12.793C8.09748 13.1835 8.09748 13.8165 7.70696 14.207C7.31643 14.5975 6.68342 14.5975 6.29289 14.207L1.79289 9.70702C1.40237 9.31649 1.40237 8.68348 1.79289 8.29295L6.29289 3.79295Z"/>\n <path d="M11.707 3.79295C11.3164 3.40243 10.6834 3.40243 10.2929 3.79295C9.90237 4.18348 9.90237 4.81649 10.2929 5.20702L14.0859 8.99999L10.2929 12.793C9.90237 13.1835 9.90237 13.8165 10.2929 14.207C10.6834 14.5975 11.3164 14.5975 11.707 14.207L16.207 9.70702C16.5975 9.31649 16.5975 8.68348 16.207 8.29295L11.707 3.79295Z"/>\n </svg>',Uc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 12.5C3.82843 12.5 4.5 13.1716 4.5 14C4.5 14.8284 3.82843 15.5 3 15.5C2.17157 15.5 1.5 14.8284 1.5 14C1.5 13.1716 2.17157 12.5 3 12.5ZM15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM3 7.5C3.82843 7.5 4.5 8.17157 4.5 9C4.5 9.82843 3.82843 10.5 3 10.5C2.17157 10.5 1.5 9.82843 1.5 9C1.5 8.17157 2.17157 7.5 3 7.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM3 2.5C3.82843 2.5 4.5 3.17157 4.5 4C4.5 4.82843 3.82843 5.5 3 5.5C2.17157 5.5 1.5 4.82843 1.5 4C1.5 3.17157 2.17157 2.5 3 2.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n </svg>',Wc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n <path d="M2.98657 16.0967C2.68042 16.0967 2.41187 16.0465 2.18091 15.9463C1.95174 15.846 1.77002 15.7046 1.63574 15.522C1.50146 15.3376 1.42448 15.1227 1.40479 14.8774L1.4021 14.8452H2.34204L2.34741 14.8748C2.35815 14.9589 2.39038 15.035 2.44409 15.103C2.49959 15.1711 2.5721 15.2248 2.66162 15.2642C2.75293 15.3035 2.86035 15.3232 2.98389 15.3232C3.10563 15.3232 3.21037 15.3027 3.2981 15.2615C3.38761 15.2185 3.45654 15.1603 3.50488 15.0869C3.55322 15.0135 3.57739 14.9294 3.57739 14.8345V14.8291C3.57739 14.6715 3.51921 14.5516 3.40283 14.4692C3.28646 14.3869 3.12085 14.3457 2.90601 14.3457H2.48706V13.677H2.90063C3.02775 13.677 3.13607 13.6582 3.22559 13.6206C3.31689 13.583 3.38672 13.5302 3.43506 13.4622C3.48519 13.3941 3.51025 13.3153 3.51025 13.2258V13.2205C3.51025 13.1256 3.48877 13.0441 3.4458 12.9761C3.40462 12.9062 3.34375 12.8534 3.26318 12.8176C3.18441 12.78 3.08952 12.7612 2.97852 12.7612C2.86572 12.7612 2.76636 12.7809 2.68042 12.8203C2.59627 12.8579 2.52913 12.9125 2.479 12.9841C2.43066 13.054 2.40112 13.1363 2.39038 13.2312L2.3877 13.2581H1.49341L1.49609 13.2205C1.514 12.977 1.58561 12.7666 1.71094 12.5894C1.83805 12.4103 2.00903 12.2725 2.22388 12.1758C2.44051 12.0773 2.69206 12.0281 2.97852 12.0281C3.27393 12.0281 3.52995 12.0728 3.74658 12.1624C3.96322 12.2501 4.13062 12.3727 4.24878 12.5303C4.36694 12.6878 4.42603 12.8722 4.42603 13.0835V13.0889C4.42603 13.2518 4.38932 13.3941 4.31592 13.5159C4.2443 13.6358 4.14762 13.7343 4.02588 13.8113C3.90592 13.8883 3.77254 13.942 3.62573 13.9724V13.9912C3.91756 14.0199 4.14941 14.1121 4.32129 14.2678C4.49316 14.4236 4.5791 14.6295 4.5791 14.8855V14.8909C4.5791 15.1344 4.51375 15.3474 4.38306 15.53C4.25236 15.7109 4.06795 15.8505 3.82983 15.949C3.59172 16.0474 3.31063 16.0967 2.98657 16.0967Z"/>\n <path d="M1.54443 11V10.342L2.76099 9.20874C2.95076 9.03507 3.09757 8.89274 3.20142 8.78174C3.30705 8.66895 3.37956 8.57316 3.41895 8.49438C3.46012 8.41382 3.48071 8.33415 3.48071 8.25537V8.24463C3.48071 8.14795 3.46012 8.0638 3.41895 7.99219C3.37777 7.92057 3.31779 7.86507 3.23901 7.82568C3.16024 7.7863 3.06714 7.7666 2.95972 7.7666C2.84692 7.7666 2.74756 7.78988 2.66162 7.83643C2.57747 7.88298 2.51123 7.94743 2.46289 8.02979C2.41455 8.11035 2.39038 8.20345 2.39038 8.30908V8.33057L1.48804 8.32788V8.31177C1.48804 8.05396 1.5507 7.82837 1.67603 7.63501C1.80314 7.44165 1.97949 7.29126 2.20508 7.18384C2.43245 7.07463 2.69653 7.02002 2.99731 7.02002C3.28556 7.02002 3.53711 7.06836 3.75195 7.16504C3.96859 7.25993 4.13688 7.39331 4.25684 7.56519C4.37858 7.73706 4.43945 7.93758 4.43945 8.16675V8.18018C4.43945 8.3252 4.40902 8.46932 4.34814 8.61255C4.28727 8.75578 4.18701 8.90885 4.04736 9.07178C3.90771 9.23291 3.71883 9.41642 3.48071 9.62231L2.58374 10.4092L2.85498 9.98486V10.4092L2.58374 10.2319H4.49048V11H1.54443Z"/>\n <path d="M2.84155 6V3.01367H2.79053L1.85596 3.64478V2.79614L2.84155 2.12476H3.82715V6H2.84155Z"/>\n </svg>',Vc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>\n </svg>',qc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13 13.5V6C13 4.067 11.433 2.5 9.5 2.5C7.567 2.5 6 4.067 6 6V13.5C6 14.6046 6.89543 15.5 8 15.5H8.23047C9.20759 15.5 10 14.7076 10 13.7305V7C10 6.72386 9.77614 6.5 9.5 6.5C9.22386 6.5 9 6.72386 9 7V12.5C9 13.0523 8.55228 13.5 8 13.5C7.44772 13.5 7 13.0523 7 12.5V7C7 5.61929 8.11929 4.5 9.5 4.5C10.8807 4.5 12 5.61929 12 7V13.7305C12 15.8122 10.3122 17.5 8.23047 17.5H8C5.79086 17.5 4 15.7091 4 13.5V6C4 2.96243 6.46243 0.5 9.5 0.5C12.5376 0.5 15 2.96243 15 6V13.5C15 14.0523 14.5523 14.5 14 14.5C13.4477 14.5 13 14.0523 13 13.5Z"/>\n </svg>',jc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15 1C16.1046 1 17 1.89543 17 3V15C17 16.1046 16.1046 17 15 17H3C1.89543 17 1 16.1046 1 15V3C1 1.89543 1.89543 1 3 1H15ZM3 15H8V10H3V15ZM10 10V15H15V10H10ZM10 8H15V3H10V8ZM3 8H8V3H3V8Z"/>\n </svg>',Zc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.75 12C13.1642 12 13.5 12.3358 13.5 12.75V14.25C13.5 14.6642 13.1642 15 12.75 15H5.25C4.83579 15 4.5 14.6642 4.5 14.25V12.75C4.5 12.3358 4.83579 12 5.25 12H12.75ZM15.4863 8C16.0461 8 16.5 8.44771 16.5 9C16.5 9.55229 16.0461 10 15.4863 10H2.51367C1.95392 10 1.5 9.55229 1.5 9C1.5 8.44771 1.95392 8 2.51367 8H15.4863ZM12.75 3C13.1642 3 13.5 3.33579 13.5 3.75V5.25C13.5 5.66421 13.1642 6 12.75 6H5.25C4.83579 6 4.5 5.66421 4.5 5.25V3.75C4.5 3.33579 4.83579 3 5.25 3H12.75Z"/>\n </svg>',Gc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.36612 5.36612C8.85427 4.87796 9.64554 4.87796 10.1337 5.36612C10.6218 5.85428 10.6218 6.64557 10.1337 7.13369L7.26748 9.9999H15.2499C18.1494 9.99996 20.4999 12.3504 20.4999 15.2499V19.2499C20.4999 19.9402 19.9402 20.4999 19.2499 20.4999C18.5596 20.4999 18 19.9402 17.9999 19.2499V15.2499C17.9999 13.7312 16.7686 12.5 15.2499 12.4999H7.26748L10.1337 15.3661C10.6218 15.8543 10.6218 16.6456 10.1337 17.1337C9.64557 17.6218 8.85428 17.6218 8.36612 17.1337L3.36612 12.1337C2.87796 11.6455 2.87796 10.8543 3.36612 10.3661L8.36612 5.36612Z"/>\n </svg>',Jc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.6338 5.1163C15.1456 4.62814 14.3543 4.62814 13.8662 5.1163C13.3781 5.60446 13.3781 6.39575 13.8662 6.88388L16.7324 9.75009H8.74997C5.85052 9.75014 3.49997 12.1006 3.49997 15.0001V19.0001C3.50002 19.6904 4.05969 20.25 4.74997 20.2501C5.4403 20.2501 5.99992 19.6904 5.99997 19.0001V15.0001C5.99997 13.4813 7.23123 12.2501 8.74997 12.2501H16.7324L13.8662 15.1163C13.3781 15.6045 13.3781 16.3958 13.8662 16.8839C14.3543 17.372 15.1456 17.3719 15.6338 16.8839L20.6338 11.8839C21.1219 11.3957 21.1219 10.6045 20.6338 10.1163L15.6338 5.1163Z" />\n </svg>',Yc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 6.75C4.24264 6.75 5.25 7.75736 5.25 9C5.25 10.2426 4.24264 11.25 3 11.25C1.75736 11.25 0.75 10.2426 0.75 9C0.75 7.75736 1.75736 6.75 3 6.75ZM9 6.75C10.2426 6.75 11.25 7.75736 11.25 9C11.25 10.2426 10.2426 11.25 9 11.25C7.75736 11.25 6.75 10.2426 6.75 9C6.75 7.75736 7.75736 6.75 9 6.75ZM15 6.75C16.2426 6.75 17.25 7.75736 17.25 9C17.25 10.2426 16.2426 11.25 15 11.25C13.7574 11.25 12.75 10.2426 12.75 9C12.75 7.75736 13.7574 6.75 15 6.75Z"/>\n </svg>';class Xc extends HTMLElement{static observedAttributes=["connected"];#e=new bc;#c=null;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.#u()}connectedCallback(){this.requestOverflowRefresh(),this.setAttribute("role","toolbar"),this.#d()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),cancelAnimationFrame(this.#c),this.editorElement=null,this.editor=null,this.selection=null,this.#c=null,this.#u()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}configure(e){if("object"==typeof e&&null!==e)for(const[t,n]of Object.entries(e))this.setAttribute(`data-${t}`,n)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#g(),this.#p(),this.#f(),this.#m(),this.#y(),this.requestOverflowRefresh(),this.#b(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}requestOverflowRefresh(){null==this.#c&&(this.#c=requestAnimationFrame((()=>{this.#_(),this.#c=null})))}closeDropdowns({except:e}={}){this.#x.forEach((t=>{t!==e&&t.close({focusEditor:!1})}))}#h(){this.disconnectedCallback(),this.connectedCallback()}async#u(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e})),this.editorElement=await this.editorPromise}#d(){const e=new ResizeObserver((()=>this.requestOverflowRefresh()));e.observe(this),this.#e.track((()=>e.disconnect()))}#g(){this.#e.track(yc(this,"click",this.#C))}#C=e=>{this.#S(e,"[data-command]",this.#v.bind(this))};#S(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#v(e,{dataset:{command:t,payload:n}}){const r=e instanceof PointerEvent&&-1===e.pointerId;this.editor.update((()=>{this.editor.dispatchCommand(t,n)}),{tag:r?Yr:void 0}),r||this.editor.focus()}#p(){this.#e.track(yc(this.editorElement,"keydown",this.#w))}#w=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#k(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#k(e){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#b(){this.#e.track(yc(this.editorElement,"lexxy:focus",this.#E),yc(this.editorElement,"lexxy:blur",this.#T),yc(this,"keydown",this.#N))}#E=()=>{const e=this.#A.find(Ec);e&&(e.tabIndex=0)};#T=()=>{this.#f()};#N=e=>{Tc(this.#A,e)};#f(){this.#A.forEach((e=>{e.tabIndex=-1}))}#m(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{this.#L(),this.closeDropdowns()}))})))}#y(){this.#e.track(this.editor.registerCommand(nr,(e=>{this.#O("undo",!e)}),1),this.editor.registerCommand(tr,(e=>{this.#O("redo",!e)}),1))}#L(){const e=eo();if(!Mi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isUnderline:i,isHighlight:o,isInLink:s,isInQuote:l,isInHeading:a,headingTag:c,isInCode:u,isInList:d,listType:h,isInTable:g}=this.selection.getFormat();this.#F("bold",t),this.#F("italic",n),this.#F("strikethrough",r),this.#F("underline",i),this.#F("format",a),this.#F("paragraph",!a),this.#F("heading-large","h2"===c),this.#F("heading-medium","h3"===c),this.#F("heading-small","h4"===c),this.#F("lists",d),this.#F("unordered-list",d&&"bullet"===h),this.#F("ordered-list",d&&"number"===h),this.#F("highlight",o),this.#F("link",s),this.#F("quote",l),this.#F("code",u),this.#F("table",g)}#F(e,t){const n=this.querySelector(`[name="${e}"]`);if(n){const e=t.toString();n.getAttribute("aria-pressed")!==e&&n.setAttribute("aria-pressed",e)}}#O(e,t){const n=this.querySelector(`[name="${e}"]`);if(n){n.disabled!==t&&(n.disabled=t);const e=t.toString();n.getAttribute("aria-disabled")!==e&&n.setAttribute("aria-disabled",e)}}#_(){this.#I(),this.#R(),this.#P(),this.#M();const e=this.#D.children.length>0;this.toggleAttribute("overflowing",e),this.#B(),this.#$(e)}#R(){const e=Array.from(this.#D.children);e.sort(((e,t)=>this.#z(t)-this.#z(e)));for(const t of e){const e=this.querySelector(`[data-position="${this.#z(t)+1}"]`)??this.#H;t.removeAttribute("role"),this.insertBefore(t,e)}}#$(e=!0){this.#D.toggleAttribute("disabled",!e),this.#H.style.display=e?"block":"none"}#I(){this.#$(!1)}#z(e){return parseInt(e.dataset.position??"999")}#P(){this.#K.forEach(((e,t)=>{e.dataset.position=t}))}#M(){const e=this.#U();if(e>0){this.#$();const t=this.#W(),n=t+this.#H.offsetWidth;this.#V(e+n,{gap:t})}}#U(){return this.scrollWidth-this.clientWidth}#V(e,{gap:t}){const n=this.#q,r=[];let i=0;for(;i<e&&n.length;){const e=n.pop();r.push(e),e.role="menuitem",i+=e.offsetWidth+t}this.#D.append(...r.reverse())}#B(){this.#H.setAttribute("nonce",mc())}#W(){return parseFloat(window.getComputedStyle(this).columnGap)||0}get#x(){return this.querySelectorAll(":scope .lexxy-editor__toolbar-dropdown")}get#H(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#D(){return this.#H?.querySelector(":scope > [data-dropdown-panel]")}get#q(){return Array.from(this.querySelectorAll(":scope > button:not([data-prevent-overflow])"))}get#A(){return Array.from(this.querySelectorAll(":scope button"))}get#K(){return Array.from(this.querySelectorAll(":scope > *:not(.lexxy-editor__toolbar-overflow)"))}static get defaultTemplate(){const e=wc("lexxy-link-url");return`\n <button class="lexxy-editor__toolbar-button" type="button" name="image" data-command="uploadImage" data-prevent-overflow="true" title="Add images and video">\n ${Vc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="file" data-command="uploadFile" title="Upload files">\n ${qc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n ${Ac}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n ${Lc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n ${Oc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="underline" data-command="underline" title="Underline">\n ${Fc}\n </button>\n\n <lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="format" title="Text formatting" aria-haspopup="menu" aria-expanded="false">\n ${Ic}\n </button>\n <div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-dropdown-list" hidden>\n <button type="button" name="paragraph" data-command="setFormatParagraph" title="Paragraph" role="menuitem">\n ${Dc} <span>Normal</span>\n </button>\n <button type="button" name="heading-large" data-command="setFormatHeadingLarge" title="Large heading" role="menuitem">\n ${Rc} <span>Large Heading</span>\n </button>\n <button type="button" name="heading-medium" data-command="setFormatHeadingMedium" title="Medium heading" role="menuitem">\n ${Pc} <span>Medium Heading</span>\n </button>\n <button class="lexxy-editor__toolbar-group-end" type="button" name="heading-small" data-command="setFormatHeadingSmall" title="Small heading" role="menuitem">\n ${Mc} <span>Small Heading</span>\n </button>\n <div class="lexxy-editor__toolbar-separator" role="separator"></div>\n <button type="button" name="clear-formatting" data-command="clearFormatting" title="Clear formatting" role="menuitem">\n ${Bc} <span>Clear formatting</span>\n </button>\n </div>\n </lexxy-toolbar-dropdown>\n\n <lexxy-highlight-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--highlight">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="highlight" title="Color highlight" aria-haspopup="menu" aria-expanded="false">\n ${$c}\n </button>\n <div data-dropdown-panel role="menu" hidden>\n <div class="lexxy-highlight-colors"></div>\n <button data-command="removeHighlight" type="button" class="lexxy-editor__toolbar-button lexxy-editor__toolbar-dropdown-reset" role="menuitem">Remove all coloring</button>\n </div>\n </lexxy-highlight-dropdown>\n\n <lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--link">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="link" title="Link" data-hotkey="cmd+k ctrl+k" aria-haspopup="dialog" aria-expanded="false">\n ${zc}\n </button>\n <div data-dropdown-panel role="dialog" aria-label="Link" hidden>\n <input type="url" placeholder="Enter a URL…" class="input" id="${e}">\n <div class="lexxy-editor__toolbar-dropdown-actions">\n <button type="button" class="lexxy-editor__toolbar-button" value="link">Link</button>\n <button type="button" class="lexxy-editor__toolbar-button" value="unlink">Unlink</button>\n </div>\n </div>\n </lexxy-link-dropdown>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n ${Hc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n ${Kc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n ${Uc}\n </button>\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n ${Wc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n ${jc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n ${Zc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--push-right" type="button" name="undo" data-command="undo" title="Undo" disabled aria-disabled="true">\n ${Gc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo" disabled aria-disabled="true">\n ${Jc}\n </button>\n\n <lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-button--push-right lexxy-editor__toolbar-overflow">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button" type="button" aria-haspopup="menu" aria-expanded="false" aria-label="Show more toolbar buttons">\n ${Yc}\n </button>\n <div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons" hidden></div>\n </lexxy-toolbar-dropdown>\n `}}function Qc(){return new Promise(requestAnimationFrame)}class eu extends HTMLElement{#e=new bc;connectedCallback(){this.#j((()=>{this.#Z(),this.editorReady()}))}disconnectedCallback(){this.#e.dispose()}editorReady(){}onOpen(){}onClose(){}get trigger(){return this.querySelector(":scope > [data-dropdown-trigger]")}get panel(){return this.querySelector(":scope > [data-dropdown-panel]")}get toolbar(){return this.closest("lexxy-toolbar")}get editorElement(){return this.toolbar?.editorElement}get editor(){return this.toolbar?.editor}get isOpen(){return!1===this.panel.hidden}get isClosed(){return!this.isOpen}track(...e){this.#e.track(...e)}open(){this.isOpen||(this.trigger.setAttribute("aria-expanded","true"),this.panel.hidden=!1,this.onOpen(),this.#G())}close({focusEditor:e=!0}={}){e&&this.editor?.focus(),this.isClosed||(this.trigger.setAttribute("aria-expanded","false"),this.panel.hidden=!0,this.onClose())}#Z(){this.#e.track(yc(this,"keydown",this.#J),yc(this.trigger,"click",this.#Y))}#Y=()=>{this.isOpen?this.close({focusEditor:!1}):(this.toolbar?.closeDropdowns({except:this}),this.open())};async#j(e){this.toolbar&&(await this.toolbar.getEditorElement(),this.isConnected&&this.toolbar&&e())}#J=e=>{"Escape"===e.key&&(e.stopPropagation(),this.close())};async#G(){this.#X[0]?.focus(),await this.#f()}async#f(){await Qc(),this.#A.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#X(){return Array.from(this.panel.querySelectorAll("button, input"))}get#A(){return Array.from(this.panel.querySelectorAll("button"))}}const tu="button.lexxy-highlight-button",nu=Symbol("no_style");class ru extends eu{editorReady(){this.#Q(),this.#ee()}onOpen(){this.editor.getEditorState().read((()=>{this.#te(eo())}))}#ee(){this.#ne.forEach((e=>{this.track(yc(e,"click",this.#re))}))}#Q(){this.#ie.innerHTML="";const e=this.editorElement.config.get("highlight.buttons");this.#oe("color",e.color),this.#oe("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.panel.style.setProperty("--max-colors",t)}#oe(e,t){t.forEach(((t,n)=>{this.#ie.appendChild(this.#se(e,t,n))}))}#se(e,t,n){return xc("button",{type:"button",dataset:{value:t,style:e},style:`${e}: ${t}`,class:"lexxy-editor__toolbar-button lexxy-highlight-button",name:`${e}-${n}`,role:"menuitem"})}#re=e=>{e.preventDefault();const t=e.target.closest(tu);if(!t)return;const{style:n,value:r}=t.dataset;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()};#te(e){if(!Mi(e))return;const t=hc(e,"color",nu),n=hc(e,"background-color",nu);this.#ne.forEach((e=>{const r=(e.dataset.value===t||e.dataset.value===n).toString();e.getAttribute("aria-pressed")!==r&&e.setAttribute("aria-pressed",r)}));const r=t!==nu||n!==nu;this.panel.querySelector("[data-command='removeHighlight']").disabled=!r}get#ie(){return this.panel.querySelector(".lexxy-highlight-colors")}get#ne(){return Array.from(this.panel.querySelectorAll(tu))}}function iu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ou="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,su=ou&&"documentMode"in document?document.documentMode:null,lu=ou&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);ou&&"InputEvent"in window&&!su&&new window.InputEvent("input");const au=lu;function cu(e,t){return Array.from(function(e){return function(e,t){const n=zs(),r=t||n,i=Ho(r)?ga(r,e):ca(r,e),o=function(e){let t=-1;for(let n=e;null!==n;n=n.getParent())t++;return t}(r),s=function(e,t){const n=za(ca(e,t));return n&&n[0]}(r,e);let l=o;return xa({hasNext:e=>null!==e,initial:i,map:e=>({depth:l,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;oa(e)&&l++;const t=za(e);return!t||t[0].isSameNodeCaret(s)?null:(l+=t[1],t[0])}})}("next",e)}(e))}function uu(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function du(e){const t=jl(e,(e=>Ho(e)&&!e.isInline()));return Ho(t)||iu(4,e.__key),t}function hu(e){const t=eo()||to();let n;if(Mi(t))n=Ea(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=ca(r,"next"))}n=n||ga(zs(),"previous").getFlipped().insert(es())}const r=gu(e,n),i=pa(r);return Na(ba(oa(i)?Pa(i):r)),e.getLatest()}function gu(e,t,n){let r=Da(t,"next");ra(r)&&(0===r.offset?r=ca(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=ca(r.origin,"next"))),r.origin.is(e)&&(ia(r)||iu(342,e.getKey(),e.getType()),r=Oa(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Ua(e,n))r=e;return ra(r)&&iu(283),r.insert(e.isInline()?es().append(e):e),Da(ca(e.getLatest(),"next"),t.direction)}function pu(e,t){const n=t();return e.replace(n),n.append(e),n}function fu(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function mu(e){const t=eo();if(!Mi(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){const i=r[t],o=i.getKey();if(n.has(o))continue;const s=jl(i,(e=>Ho(e)&&!e.isInline()));if(null===s)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function yu(e,t){ga(e,"next").insert(t)}function bu(e,t){return _u(e,t,null)}function _u(e,t,n){let r=!1;for(const i of Su(e))t(i)?null!==n&&n(i):(r=!0,Ho(i)&&_u(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function xu(e,t){const n=[],r=Array.from(e).reverse();for(let e=r.pop();void 0!==e;e=r.pop())if(t(e))n.push(e);else if(Ho(e))for(const t of Su(e))r.push(t);return n}function Cu(e){return vu(ga(e,"next"))}function Su(e){return vu(ga(e,"previous"))}function vu(e){return xa({hasNext:ia,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}const wu=Symbol.for("preact-signals");function ku(){if(Lu>1)return void Lu--;let e,t=!1;for(function(){let e=Au;for(Au=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==Tu;){let n=Tu;for(Tu=void 0,Ou++;void 0!==n;){const r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Du(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Ou=0,Lu--,t)throw e}let Eu,Tu;function Nu(e){const t=Eu;Eu=void 0;try{return e()}finally{Eu=t}}let Au,Lu=0,Ou=0,Fu=0,Iu=0;function Ru(e){if(void 0===Eu)return;let t=e.n;return void 0===t||t.t!==Eu?(t={i:0,S:e,p:Eu.s,n:void 0,t:Eu,e:void 0,x:void 0,r:t},void 0!==Eu.s&&(Eu.s.n=t),Eu.s=t,e.n=t,32&Eu.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Eu.s,t.n=void 0,Eu.s.n=t,Eu.s=t),t):void 0}function Pu(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Mu(e,t){return new Pu(e,t)}function Du(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Bu(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function $u(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function zu(e,t){Pu.call(this,void 0),this.x=e,this.s=void 0,this.g=Iu-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Hu(e){const t=e.m;if(e.m=void 0,"function"==typeof t){Lu++;const n=Eu;Eu=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Ku(e),t}finally{Eu=n,ku()}}}function Ku(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Hu(e)}function Uu(e){if(Eu!==this)throw new Error("Out-of-order effect");$u(this),Eu=e,this.f&=-2,8&this.f&&Ku(this),ku()}function Wu(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function Vu(e,t){const n=new Wu(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function qu(e,t={}){const n={};for(const r in e){const i=t[r],o=Mu(void 0===i?e[r]:i);n[r]=o}return n}function ju(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}function Zu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Gu(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=Gu(n[e],r[e]);return e}return t}Pu.prototype.brand=wu,Pu.prototype.h=function(){return!0},Pu.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Nu((()=>{var e;null==(e=this.W)||e.call(this)})))},Pu.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Nu((()=>{var e;null==(e=this.Z)||e.call(this)})))}},Pu.prototype.subscribe=function(e){return Vu((()=>{const t=this.value,n=Eu;Eu=void 0;try{e(t)}finally{Eu=n}}),{name:"sub"})},Pu.prototype.valueOf=function(){return this.value},Pu.prototype.toString=function(){return this.value+""},Pu.prototype.toJSON=function(){return this.value},Pu.prototype.peek=function(){const e=Eu;Eu=void 0;try{return this.value}finally{Eu=e}},Object.defineProperty(Pu.prototype,"value",{get(){const e=Ru(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ou>100)throw new Error("Cycle detected");!function(e){0!==Lu&&0===Ou&&e.l!==Fu&&(e.l=Fu,Au={S:e,v:e.v,i:e.i,o:Au})}(this),this.v=e,this.i++,Iu++,Lu++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{ku()}}}}),zu.prototype=new Pu,zu.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Iu)return!0;if(this.g=Iu,this.f|=1,this.i>0&&!Du(this))return this.f&=-2,!0;const e=Eu;try{Bu(this),Eu=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Eu=e,$u(this),this.f&=-2,!0},zu.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Pu.prototype.S.call(this,e)},zu.prototype.U=function(e){if(void 0!==this.t&&(Pu.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},zu.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(zu.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Ru(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Wu.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},Wu.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Hu(this),Bu(this),Lu++;const e=Eu;return Eu=this,Uu.bind(this,e)},Wu.prototype.N=function(){2&this.f||(this.f|=2,this.u=Tu,Tu=this)},Wu.prototype.d=function(){this.f|=8,1&this.f||Ku(this)},Wu.prototype.dispose=function(){this.d()},pt("format",{parse:e=>"number"==typeof e?e:0});function Ju(e){return 0===e.id}function Yu(e){return 2===e.id}const Xu=new Set;let Qu=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Wa;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Yu(t)||Zu(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let o;this.state=i,this.extension.init&&(o=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,o,r)}build(e){const t=this.state;let n;4!==t.id&&Zu(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&Zu(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&Zu(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&Zu(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&Zu(311),this._signal}getInitResult(){void 0===this.extension.init&&Zu(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||Zu(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||Zu(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Zu(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Zu(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||Zu(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Xu}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map((([e])=>e))),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||Zu(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const ed={tag:jr};function td(){const e=zs();e.isEmpty()&&e.append(es())}const nd={config:{setOptions:ed,updateOptions:ed},init:({$initialEditorState:e=td})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:r}=i;if(function(e){return e instanceof Jo}(r))e.setEditorState(r,n);else if("function"==typeof r)e.update((()=>{r(e)}),t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Vo,mi,oi,Ni,Xo]},rd=Symbol.for("@lexical/extension/LexicalBuilder");function id(){}function od(e){throw e}function sd(e){return Array.isArray(e)?e:[e]}const ld="0.44.0+prod.esm";let ad=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ld,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[sd(nd)];for(const e of t)n.push(sd(e));return new e(n)}static maybeFromEditor(t){const n=t[rd];return n&&(n.PACKAGE_VERSION!==ld&&Zu(292,n.PACKAGE_VERSION,ld),n instanceof e||Zu(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&Zu(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(os({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[rd]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=id;function t(){try{e()}finally{e=id}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Za(this.registerEditor(n),(()=>n.setRootElement(null))),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Zu(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Zu(296);const t=sd(e),[n]=t;"string"!=typeof n.name&&Zu(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&Zu(298,n.name),!r){r=new Qu(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&Zu(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&Zu(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=sd(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let i=n.state;if(Yu(i))return;const o=n.extension.name;var s;Ju(i)||Zu(300,o,r||"[unknown]"),Ju(s=i)||Zu(304,String(s.id),String(0)),i=Object.assign(s,{id:1}),n.state=i;const l=this.outgoingConfigEdges.get(o);if(l)for(const e of l.keys()){const n=this.extensionNameMap.get(e);n&&t(n,o)}i=function(e){return function(e){return 1===e.id}(e)||Zu(305,String(e.id),String(1)),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())Ju(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&Zu(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(const n of t){const t=n.register(e,i);t&&r.push(t)}for(const n of t){const t=n.afterRegistration(e);t&&r.push(t)}return Za(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(const l of s){const{extension:s}=l;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of ju(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Zu(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,l)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&Gu(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const l=Object.keys(i).length>0,a=r.size>0;(l||a)&&(e.html={},l&&(e.html.import=i),a&&(e.html.export=r));for(const t of s)t.init(e);return e.onError||(e.onError=od),e}};function cd(e,t){const n=ad.fromEditor(e).getExtensionRep(t);return void 0===n&&Zu(303,t.name),n.getExtensionDependency()}function ud(e,t){const n=ad.maybeFromEditor(e);if(!n)return;const r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}const dd=new Set(["http:","https:","mailto:","sms:","tel:"]);let hd=class e extends zo{__url;__target;__rel;__title;static getType(){return"link"}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e="",t={},n){super(n);const{target:r=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=o}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),qa(t,e.theme.link),t}updateLinkDOM(e,t,n){if(Ll(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:gd,priority:1})}}static importJSON(e){return pd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Sd(e);try{const t=new URL(Sd(e));if(!dd.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=Sl(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Mi(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function gd(e){let t=null;if(Ll(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=pd(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function pd(e="",t){return vl(new hd(e,t))}function fd(e){return e instanceof hd}let md=class e extends hd{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return"autolink"}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return yd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=yd(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function yd(e="",t){return vl(new md(e,t))}function bd(e){return e instanceof md}function _d(e,t){if("element"===e.type){const n=e.getNode();return Ho(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function xd(e,t={}){let n;if(e&&"object"==typeof e){const{url:r,...i}=e;n=r,t={...i,...t}}else n=e;const{target:r,title:i}=t,o=void 0===t.rel?"noreferrer":t.rel,s=eo();if(null===s||!Mi(s)&&!Bi(s))return;if(Bi(s)){const e=s.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===n){const t=jl(e,(e=>!bd(e)&&fd(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=jl(e,(e=>!bd(e)&&fd(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=pd(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}if(s.isCollapsed()&&null===n)for(const e of s.getNodes()){const t=jl(e,(e=>!bd(e)&&fd(e)));return void(null!==t&&(t.getChildren().forEach((e=>{t.insertBefore(e)})),t.remove()))}const l=s.extract();if(null===n){const e=new Set;return void l.forEach((t=>{const n=jl(t,(e=>!bd(e)&&fd(e)));if(null!==n){const t=n.getKey();if(e.has(t))return;!function(e,t){const n=new Set(t.filter((t=>e.isParentOf(t))).map((e=>e.getKey()))),r=e.getChildren(),i=r=>n.has(r.getKey())||Ho(r)&&t.some((t=>e.isParentOf(t)&&r.isParentOf(t))),o=r.filter(i);if(o.length===r.length)return r.forEach((t=>e.insertBefore(t))),void e.remove();const s=r.findIndex(i),l=r.findLastIndex(i),a=0===s,c=l===r.length-1;if(a)o.forEach((t=>e.insertBefore(t)));else if(c)for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);else{for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);const t=r.slice(l+1);if(t.length>0){const n=Sl(e);o[o.length-1].insertAfter(n),t.forEach((e=>n.append(e)))}}}(n,l),e.add(t)}}))}const a=new Set,c=e=>{a.has(e.getKey())||(a.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==o&&e.setRel(o),void 0!==i&&e.setTitle(i))};if(1===l.length){const e=l[0],t=jl(e,fd);if(null!==t)return c(t)}!function(e){const t=eo();if(!Mi(t))return e();const n=At(t),r=n.isBackward(),i=_d(n.anchor,r?-1:0),o=_d(n.focus,r?0:-1);if(e(),i||o){const e=eo();if(Mi(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(o){const e=o.getParent();e&&t.focus.set(e.getKey(),o.getIndexWithinParent()+(r?0:1),"element")}Ks(At(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=jl(t,fd);if(s){c(s);continue}if(Ho(t)){if(!t.isInline())continue;if(fd(t)){if(!(bd(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const l=t.getPreviousSibling();fd(l)&&l.is(e)?l.append(t):(e=pd(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const Cd=/^\+?[0-9\s()-]{5,}$/;function Sd(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Cd.test(e)?`tel:${e}`:`https://${e}`}class vd extends eu{editorReady(){this.input=this.panel.querySelector("input"),this.track(yc(this.input,"keydown",this.#le),yc(this.linkButton,"click",this.#ae),yc(this.unlinkButton,"click",this.#ce))}onOpen(){this.input.value=this.#ue,this.input.required=!0}onClose(){this.input.required=!1}get linkButton(){return this.panel.querySelector("[value='link']")}get unlinkButton(){return this.panel.querySelector("[value='unlink']")}#le=e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),this.#ae(e))};#ae=()=>{this.input.checkValidity()?(this.editor.dispatchCommand("link",this.input.value),this.close()):this.input.reportValidity()};#ce=()=>{this.editor.dispatchCommand("unlink"),this.close()};get#ue(){return this.editor.getEditorState().read((()=>{const e=this.editorElement.selection.nearestNodeOfType(hd);return e?.getURL()??""}))}}function wd(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function kd(e){let t=1,n=e.getParent();for(;null!=n;){if(Kd(n)){const e=n.getParent();if(Gd(e)){t++,n=e.getParent();continue}wd(40)}return t}return t}function Ed(e){let t=e.getParent();Gd(t)||wd(40);let n=t;for(;null!==n;)n=n.getParent(),Gd(n)&&(t=n);return t}function Td(e){let t=[];const n=e.getChildren().filter(Kd);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();Gd(i)?t=t.concat(Td(i)):t.push(r)}return t}function Nd(e){return Kd(e)&&Gd(e.getFirstChild())}function Ad(e){return Hd().append(e)}function Ld(e,t){return Kd(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function Od(e){const t=eo();if(null!==t){let n=t.getNodes();if(Mi(t)){const r=t.getStartEndPoints();null===r&&wd(143);const[i]=r,o=i.getNode(),s=o.getParent();if(Cl(o)){const e=o.getFirstChild();if(e)n=e.selectStart().getNodes();else{const e=es();o.append(e),n=e.select().getNodes()}}else if(Ld(o,n)){const t=Zd(e);if(Cl(s)){o.replace(t);const e=Hd();Ho(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(Kd(o)){const e=o.getParentOrThrow();Fd(t,e.getChildren()),e.replace(t)}return}}const r=new Set;for(let t=0;t<n.length;t++){const i=n[t];if(Ho(i)&&i.isEmpty()&&!Kd(i)&&!r.has(i.getKey())){Id(i,e);continue}let o=Ns(i)?i.getParent():Kd(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(Gd(o)){if(!r.has(t)){const n=Zd(e);Fd(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(Cl(n)&&!r.has(t)){r.add(t),Id(o,e);break}o=n}}}}}function Fd(e,t){e.splice(e.getChildrenSize(),0,t)}function Id(e,t){if(Gd(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=Hd();let o;if(Fd(i,e.getChildren()),Gd(n)&&t===n.getListType())n.append(i),Gd(r)&&t===r.getListType()&&(Fd(n,r.getChildren()),r.remove()),o=n;else if(Gd(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=Zd(t);n.append(i),e.replace(n),o=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());const s=eo();return Mi(s)&&(o.getKey()===s.anchor.key&&s.anchor.set(i.getKey(),s.anchor.offset,"element"),o.getKey()===s.focus.key&&s.focus.set(i.getKey(),s.focus.offset,"element")),e.remove(),o}function Rd(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&Nd(n)&&Nd(r)&&(Rd(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Pd(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())Kd(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),Gd(r.getFirstChild())||n++)}function Md(e){const t=new Set;if(Nd(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Nd(r)&&Nd(i)){const n=i.getFirstChild();if(Gd(n)){n.append(e);const i=r.getFirstChild();Gd(i)&&(Fd(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Nd(r)){const t=r.getFirstChild();if(Gd(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Nd(i)){const t=i.getFirstChild();Gd(t)&&t.append(e)}else if(Gd(n)){const t=Sl(e),o=Sl(n);t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Dd(e){if(Nd(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(Gd(n?n.getParent():void 0)&&Kd(n)&&Gd(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=Sl(e),i=Sl(t);r.append(i),e.getPreviousSiblings().forEach((e=>i.append(e)));const o=Sl(e),s=Sl(t);o.append(s),Fd(s,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(o),n.replace(e)}}}let Bd=class extends zo{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{const t=e.getParent();if(Gd(t))"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0);else if(t){const n=e.createParentElementNode();Gd(n)||wd(340);const r=[e];for(const t of["previous","next"]){r.reverse();for(const{origin:n}of ca(e,t)){if(!Kd(n))break;r.push(n)}}e.insertBefore(n),n.splice(0,0,r),Cl(t)||(gu(n,Oa(ca(n,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:zo,importDOM:{li:()=>({conversion:$d,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!Gd(r)||"check"!==r.getListType()||Gd(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],o=t.list,s=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),void 0!==s&&r.push(...Va(s)),o){const e=n.getParent(),t=Gd(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||i.push(o.listitemUnchecked),t&&s||i.push(o.listitemChecked),t&&r.push(s?o.listitemChecked:o.listitemUnchecked)}if(void 0!==l){const e=Va(l);n.getChildren().some((e=>Gd(e)))?r.push(...e):i.push(...e)}i.length>0&&ja(e,...i),r.length>0&&qa(e,...r)}(t,n.theme,this);const r=e?e.__style:"",i=this.__style;r!==i&&ii(t.style,i,r),function(e,t,n){const r=t.__textStyle,i=n?n.__textStyle:"";if(null!==n&&i===r)return;const o=ni(r);for(const t in o)e.style.setProperty(`--listitem-marker-${t}`,o[t]);if(""!==i)for(const t in ni(i))t in o||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),Nd(this)?{after(e){if(Ol(e)){const t=e.previousElementSibling;if(Ol(t)&&"LI"===t.nodeName){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Ho(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(Kd(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Gd(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=Sl(n);let r=this.getNextSibling();for(;r;){const e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(Ho(e)||wd(139),this.getChildren().forEach((t=>{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(Gd(n)||wd(39),Kd(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=Sl(n);r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Nd(t)&&Nd(n)&&(Rd(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){const n=Sl(this);return this.insertAfter(n,t),n}collapseAtStart(e){const t=es();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=Kd(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,o=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(o,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(o,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return Gd(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Kd(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&wd(117),(e=Math.floor(e))>=0||wd(199);let t=this.getIndent();for(;t!==e;)t<e?(Md(this),t++):(Dd(this),t--);return this}canInsertAfter(e){return Kd(e)}canReplaceWith(e){return Kd(e)}canMergeWith(e){return Kd(e)||ts(e)}extractWithChild(e,t){if(!Mi(t))return!1;const n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Zd("bullet")}canMergeWhenEmpty(){return!0}};function $d(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return zd(t);if(e.classList.contains("joplin-checkbox"))for(const t of e.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&"INPUT"===t.children[0].tagName)return zd(t.children[0]);const t=e.getAttribute("aria-checked");return{node:Hd("true"===t||"false"!==t&&void 0)}}function zd(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:Hd(e.hasAttribute("checked"))}}function Hd(e){return vl(new Bd(void 0,e))}function Kd(e){return e instanceof Bd}let Ud=class extends zo{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();Gd(t)&&e.getListType()===t.getListType()&&Rd(e,t)}(e),Pd(e)},extends:zo,importDOM:{ol:()=>({conversion:qd,priority:0}),ul:()=>({conversion:qd,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=jd[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,Wd(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Wd(t,n.theme,this),e.__start!==this.__start&&t.setAttribute("start",String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return Ol(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){const r=n.find(Kd)??this.getChildren().find(Kd),i=r?()=>Sl(r):Hd;let o=n;for(let e=0;e<n.length;e++){const t=n[e];Kd(t)||(o===n&&(o=[...n]),o[e]=i().append(!Ho(t)||Gd(t)||t.isInline()?t:ki(t.getTextContent())))}return super.splice(e,t,o)}extractWithChild(e){return Kd(e)}};function Wd(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=kd(n)-1,s=t%e.length,l=e[s],a=o[n.__tag];let c;const u=o.nested,d=o.checklist;if(void 0!==u&&u.list&&(c=u.list),void 0!==a&&r.push(a),void 0!==d&&"check"===n.__listType&&r.push(d),void 0!==l){r.push(...Va(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=Va(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&ja(e,...i),r.length>0&&qa(e,...r)}function Vd(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(Kd(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{Gd(e)&&t.push(Ad(e))}))}else t.push(Ad(r))}return t}function qd(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Zd("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list")||"1"===e.getAttribute("data-is-checklist"))return!0;for(const t of e.childNodes)if(Ol(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Zd("check"):Zd("bullet")),{after:Vd,node:n}}const jd={ol:"number",ul:"bullet"};function Zd(e="number",t=1){return vl(new Ud(e,t))}function Gd(e){return e instanceof Ud}const Jd=un("UPDATE_LIST_START_COMMAND"),Yd=un("INSERT_UNORDERED_LIST_COMMAND"),Xd=un("INSERT_ORDERED_LIST_COMMAND"),Qd=un("REMOVE_LIST_COMMAND");function eh(e,t){return Za(e.registerCommand(Xd,(()=>(Od("number"),!0)),1),e.registerCommand(Jd,(e=>{const{listNodeKey:t,newStart:n}=e,r=Rs(t);return!!Gd(r)&&("number"===r.getListType()&&(r.setStart(n),Pd(r)),!0)}),1),e.registerCommand(Yd,(()=>(Od("bullet"),!0)),1),e.registerCommand(Qd,(()=>(function(){const e=eo();if(Mi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Ld(r,n))t.add(Ed(r));else for(let e=0;e<n.length;e++){const r=n[e];if(Ns(r)){const e=uu(r,Bd);null!=e&&t.add(Ed(e))}}for(const n of t){let t=n;const r=Td(n);for(const n of r){const r=es().setTextStyle(e.style).setTextFormat(e.format);Fd(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Ta(e.anchor,Pa(ga(r,"next"))),n.__key===e.focus.key&&Ta(e.focus,Pa(ga(r,"next"))),n.remove()}n.remove()}}}(),!0)),1),e.registerCommand(xn,(()=>function(e=!1){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();let r=null;if(Kd(n)&&0===n.getChildrenSize())r=n;else if(Ei(n)){const e=n.getParent();Kd(e)&&e.getChildren().every((e=>Ei(e)&&""===e.getTextContent().trim()))&&(r=e)}if(null===r)return!1;const i=Ed(r),o=r.getParent();Gd(o)||wd(40);const s=o.getParent();let l;if(Cl(s))l=es(),i.insertAfter(l);else{if(!Kd(s))return!1;l=Sl(s),s.insertAfter(l)}l.setTextStyle(t.style).setTextFormat(t.format).select();const a=r.getNextSiblings();if(a.length>0){const t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(o,r):1,n=Sl(o).setStart(t);if(Kd(l)){const e=Sl(l);e.append(n),l.insertAfter(e)}else l.insertAfter(n);n.append(...a)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!Kd(e)&&!Gd(e))break;t=e}t.remove()}(r),!0}(!1)),1),e.registerNodeTransform(Bd,(e=>{const t=e.getFirstChild();if(t){if(Ei(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=eo();Mi(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}})),e.registerNodeTransform(mi,(e=>{const t=e.getParent();if(Kd(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function th(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let nh;function rh(e,t){const{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function ih(e){return nh&&nh.editor===e?nh:void 0}function oh(e,t){if("cfg"in t){const{cfg:n,updater:r}=t;return[n,r(rh(e,n))]}return t}function sh(e,t){let n=t;for(const r of e){const[e,i]=oh(n,r),o=e.key;if(n===t&&rh(n,e)===i)continue;const s=n||lh(t);s[o]=i,n=s}return n}function lh(e){return Object.create(e||null)}function ah(e,t){return[e,t]}const ch="@lexical/html/DOM",uh=Symbol.for("@lexical/html/DOMExportContext"),dh=()=>!0;function hh(e){return t=>t instanceof e}function gh(e,{nodes:t}){if("*"===t)return dh;let n={};const r=[];for(const i of t)if("getType"in i){const t=i.getType();if(n){const r=e[t];void 0===r&&th(339,i.name,t),n=Object.assign(n,r.types)}r.push(hh(i))}else n=void 0,r.push(i);return n||(1===r.length?r[0]:e=>{for(const t of r)if(t(e))return!0;return!1})}function ph(e){return(t,n,r)=>e(t,r)}function fh(e){return(t,n,r,i)=>e(t,n,i)}function mh(e){return(t,n,r,i,o)=>e(t,n,r,o)}function yh(e){return(t,n,r,i,o,s)=>e(t,n,r,i,s)}function bh(e,t){return(n,r)=>{const i=()=>e(n,r),o=t(n);return o?o(n,i,r):i()}}function _h(e,t){return(n,r,i)=>{const o=()=>e(n,r,i),s=t(n);return s?s(n,r,o,i):o()}}function xh(e,t){return(n,r,i,o)=>{const s=()=>e(n,r,i,o),l=t(n);return l?l(n,r,i,s,o):s()}}function Ch(e,t){return(n,r,i,o,s)=>{const l=()=>e(n,r,i,o,s),a=t(n);return a?a(n,r,i,o,l,s):l()}}function Sh(e,t){return(n,r,i,o)=>{e(n,r,i,o);const s=t(n);s&&s(n,r,i,o)}}function vh(e,t,n,r,i){let o=n[t];for(const n of e[t])if("function"==typeof n[0]){const[e,t]=n;o=r(o,(n=>e(n)&&t||void 0))}else{const e=n[1],t={};for(const n in e){const i=e[n];i&&(t[n]=i.reduce(((e,t)=>r(e,(()=>t))),o))}o=r(o,(e=>{const n=t[e.getType()];return n&&i(n)}))}n[t]=o}function wh(e,t,n,r){if(!r)return;const i=e[t];if("function"==typeof n)i.push([n,r]);else{const e=i[i.length-1];let t;e&&"types"===e[0]?t=e[1]:(t={},i.push(["types",t]));for(const e in n){const n=t[e]||[];t[e]=n,n.push(r)}}}function kh(e){return"*"===e.nodes}function Eh(e,t){const n=function(e){const t={},{nodes:n}=function(e){const t=new Set,n=new Set;for(const r of ju(e)){const e="function"==typeof r?r:r.replace;ql(e),t.add(e.getType()),n.add(e)}return{nodes:n,types:t}}(e);for(const e of n)t[e.getType()]={klass:e,types:{}};for(const e of Object.values(t))if(e){const n=e.klass.getType();for(let{klass:r}=e;Wr(r.prototype);r=Object.getPrototypeOf(r)){const{ownNodeType:e}=ql(r),i=e&&t[e];i&&(i.types[n]=!0)}}return t}(e),r={$createDOM:[],$decorateDOM:[],$exportDOM:[],$extractWithChild:[],$getDOMSlot:[],$shouldExclude:[],$shouldInclude:[],$updateDOM:[]};for(const e of function(e){const t=[],n=[],r=[];for(const i of e)if(kh(i))t.push(i);else if(Array.isArray(i.nodes))for(const e of i.nodes)Wr(e.prototype)?r.push(1===i.nodes.length?i:{...i,nodes:[e]}):n.push(1===i.nodes.length?i:{...i,nodes:[e]});const i=new Map,o=e=>{let t=i.get(e);if(void 0===t){t=0;for(let n=e;Wr(n.prototype);n=Object.getPrototypeOf(n))t++;i.set(e,t)}return t};return r.sort(((e,t)=>o(e.nodes[0])-o(t.nodes[0]))),[...r,...n,...t]}(t)){const t=gh(n,e);for(const n in r)wh(r,n,t,e[n])}return r}function Th(e){return e}const Nh={build:(e,t,n)=>({defaults:sh(t.contextDefaults,void 0)}),config:{contextDefaults:[],overrides:[]},html:{export:new Map([[Vo,()=>{const e=document.createElement("div");return e.role="textbox",{element:e}}]])},init(e,t){e.dom=function(e,{overrides:t}){const n=Eh(e,t),r={...is,...e.dom};return vh(n,"$createDOM",r,bh,ph),vh(n,"$exportDOM",r,bh,ph),vh(n,"$extractWithChild",r,Ch,yh),vh(n,"$getDOMSlot",r,_h,fh),vh(n,"$shouldExclude",r,_h,fh),vh(n,"$shouldInclude",r,_h,fh),vh(n,"$updateDOM",r,xh,mh),vh(n,"$decorateDOM",r,Sh,Th),r}(e,t)},mergeConfig(e,t){const n=Wa(e,t);for(const r of["overrides","contextDefaults"])t[r]&&(n[r]=[...e[r],...t[r]]);return n},name:ch};function Ah(e,t,n){return function(e,t,n,r){return Object.assign(pt(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}(uh,e,t,n)}Ah("root",Boolean);const Lh=Ah("isExport",Boolean);const Oh=function(e,t=()=>{}){return(n,r=Dl())=>i=>{const o=ih(r),s=o&&o[e],l=sh(n,s||t(r));return l&&l!==s?function(e,t,n,r=Dl()){const i=nh,o=ih(r);try{return nh={...o,editor:r,[e]:t},n()}finally{nh=i}}(e,l,i,r):i()}}(uh,(function(e){const t=ad.maybeFromEditor(e);return t&&t.hasExtensionByName(ch)?cd(e,Nh).output.defaults:void 0}));function Fh(e){return e.constructor.name===CSSStyleRule.name}const Ih=new Set(["STYLE","SCRIPT"]);function Rh(e,t){ks(t)&&function(e){if(null===e.querySelector("style"))return;const t=new Map;function n(e){let n=t.get(e);if(void 0===n){n=new Set;for(let t=0;t<e.style.length;t++)n.add(e.style[t]);t.set(e,n)}return n}try{for(const t of Array.from(e.styleSheets)){let r;try{r=t.cssRules}catch(e){continue}for(const t of Array.from(r)){if(!Fh(t))continue;let r;try{r=e.querySelectorAll(t.selectorText)}catch(e){continue}for(const e of Array.from(r)){if(!Ol(e))continue;const r=n(e);for(let n=0;n<t.style.length;n++){const i=t.style[n];r.has(i)||e.style.setProperty(i,t.style.getPropertyValue(i),t.style.getPropertyPriority(i))}}}}}catch(e){}}(t);const n=ks(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(const t of n)if(!Ih.has(t.nodeName)){const n=Dh(t,e,i,!1);if(null!==n)for(const e of n)r.push(e)}return function(e){for(const t of e)t.getParent()&&t.getNextSibling()instanceof Yo&&t.insertAfter(li());for(const t of e){const e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Ph(e,t=null){return("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)&&th(338),function(e,t=null,n=Dl()){return Oh([ah(Lh,!0)],n)((()=>{const r=zs(),i=Bl(n),o=e.append.bind(e);for(const e of r.getChildren())Mh(n,e,o,t,i);return e}))}(document.createElement("div"),t,e).innerHTML}function Mh(e,t,n,r=null,i=Bl(e)){let o=i.$shouldInclude(t,r,e);const s=i.$shouldExclude(t,r,e);let l=t;null!==r&&Ei(t)&&(l=ec(r,t,"clone"));const a=i.$exportDOM(l,e),{element:c,after:u,append:d,$getChildNodes:h}=a;if(!c)return!1;const g=document.createDocumentFragment(),p=h?h():Ho(l)?l.getChildren():[],f=g.append.bind(g);for(const n of p){const s=Mh(e,n,f,r,i);!o&&s&&i.$extractWithChild(t,n,r,"html",e)&&(o=!0)}if(o&&!s){if((Ol(c)||Il(c))&&(d?d(g):c.append(g)),n(c),u){const e=u.call(l,c);e&&(Il(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(g);return o}function Dh(e,t,n,r,i=new Map,o){const s=[];if(Ih.has(e.nodeName))return s;let l=null;const a=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let i=null;if(void 0!==r)for(const t of r){const n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(e,t),c=a?a(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(l=Array.isArray(t)?t[t.length-1]:t,null!==l){for(const[,e]of i)if(l=e(l,o),!l)break;l&&s.push(...Array.isArray(t)?t:[l])}null!=c.forChild&&i.set(e.nodeName,c.forChild)}const d=e.childNodes;let h=[];const g=(null==l||!Cl(l))&&(null!=l&&Zi(l)||r);for(let e=0;e<d.length;e++)h.push(...Dh(d[e],t,n,g,new Map(i),l));if(null!=u&&(h=u(h)),Pl(e)&&(h=function(e,t,n){const r=e.style.textAlign,i=[];let o=[];for(let e=0;e<t.length;e++){const s=t[e];if(Zi(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&Zi(t[e+1])){const e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(e,h,g?()=>{const e=new Yo;return n.push(e),e}:es)),null==l)if(h.length>0)for(const e of h)s.push(e);else Pl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(Rl(e.nextSibling)&&Rl(e.previousSibling))}(e)&&s.push(li());else Ho(l)&&l.append(...h);return s}function Bh(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $h(e,t=eo()){return null==t&&Bh(166),Mi(t)&&t.isCollapsed()||0===t.getNodes().length?"":Ph(e,t)}function zh(e,t=eo()){return null==t&&Bh(166),Mi(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=zs().getChildren();for(let i=0;i<r.length;i++)jh(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}function Hh(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function Kh(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return qh(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=No(e[n]);t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}const i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{return qh(n,Rh(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(i),"text/html")),t)}catch(e){console.error(e)}const s=o||e.getData("text/uri-list");if(null!=s)if(Mi(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=eo();if(Mi(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([Ai()]):n.insertText(r)}}}else t.insertRawText(s)}const Uh="application/x-lexical-drag";function Wh(e,t){const n={editorKey:t.getKey()};e.setData(Uh,JSON.stringify(n))}function Vh(e,t,n){const r=e.dataTransfer;if(null===r)return!1;const i=function(e){const t=e.getData(Uh);if(!t)return null;let n;try{n=JSON.parse(t)}catch(e){return null}return null!==(r=n)&&"object"==typeof r&&"editorKey"in r&&"string"==typeof r.editorKey?n:null;var r}(r);if(null===i)return!1;const o=function(e){const t=function(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}(e.clientX,e.clientY);if(null===t)return null;const n=Ds(t.node);if(null===n)return null;if(Ei(n))return ua(n,"next",t.offset);if(Ho(n))return $a(n,t.offset,"next");const r=n.getParent();return null===r?null:$a(r,n.getIndexWithinParent()+1,"next")}(e);if(null===o)return!1;const s=Ua(o);if(null===s)return!1;const l=i.editorKey===t.getKey(),a=eo();if(l){if(!Mi(a)||a.isCollapsed())return!1;if(function(e,t){const{anchor:n,focus:r}=Ba(La(t),"next");return Ca(n,e)<0&&Ca(e,r)<0}(o,a))return e.preventDefault(),!0;a.removeText()}if(!s.origin.isAttached())return e.preventDefault(),!0;if(n(r,Na(ba(s)),t),!l){const e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){const n=t.querySelectorAll('[data-lexical-editor="true"]');for(const t of Array.from(n)){const n=t.__lexicalEditor;if(n&&n.getKey()===e)return t}return null}(i.editorKey,n):null;null!==r&&r.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return e.preventDefault(),!0}function qh(e,t,n){e.dispatchCommand(hn,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(Mi(e)&&e.isCollapsed()){let t=null;const n=Ea(e.anchor,"previous");if(n)if(ra(n))t=n.origin;else{const e=_a(n,ga(zs(),"next").getFlipped());for(const n of e){if(Ei(n.origin)){t=n.origin;break}if(Ho(n.origin)&&!n.origin.isInline())break}}if(t&&Ei(t)){const n=t.getFormat(),r=t.getStyle();e.format===n&&e.style===r||(e.format=n,e.style=r,e.dirty=!0)}}}(n))}function jh(e,t,n,r=[]){let i=null===t||n.isSelected(t);const o=Ho(n)&&n.excludeFromCopy("html");let s=n;null!==t&&Ei(s)&&(s=ec(t,s,"clone"));const l=Ho(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Bh(58,n.name),Ho(e)){const e=t.children;Array.isArray(e)||Bh(59,n.name)}return t}(s);Ei(s)&&0===s.getTextContentSize()&&(i=!1);for(let r=0;r<l.length;r++){const o=l[r],s=jh(e,t,o,a.children);!i&&Ho(n)&&s&&n.extractWithChild(o,t,"clone")&&(i=!0)}if(i&&!o)r.push(a);else if(Array.isArray(a.children))for(let e=0;e<a.children.length;e++){const t=a.children[e];r.push(t)}return i}let Zh=null;async function Gh(e,t,n){if(null!==Zh)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Jh(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=i.document,s=Nl(i);if(null===r||null===s)return!1;const l=o.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(o.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise(((t,r)=>{const s=e.registerCommand(Jn,(r=>(fu(r,ClipboardEvent)&&(s(),null!==Zh&&(i.clearTimeout(Zh),Zh=null),t(Jh(e,r,n))),!0)),4);Zh=i.setTimeout((()=>{s(),Zh=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Jh(e,t,n){if(void 0===n){const t=Nl(e._window),r=eo();if(!r||r.isCollapsed())return!1;if(!t)return!1;const i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!ys(e,i,o))return!1;n=Xh(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(Qh(r,n),!0)}const Yh=[["text/html",$h],["application/x-lexical-editor",zh]];function Xh(e=eo()){return function(e,t){const n={"text/plain":""};for(const[r,i]of Object.entries(e)){const e=tg(i,t);null!==e&&(n[r]=e)}return n}(function(){const e=Dl(),t=ad.maybeFromEditor(e);return t&&t.hasExtensionByName(ng.name)?cd(e,ng).output:eg}(),e)}function Qh(e,t){for(const[n]of Yh)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}const eg={"application/x-lexical-editor":[(e,t)=>e?zh(Dl(),e):t()],"text/html":[(e,t)=>e?$h(Dl(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function tg(e,t){const n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}const ng={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:eg},mergeConfig(e,t){const n=Wa(e,t);if(t.$exportMimeType){const r={...e.$exportMimeType};for(const[e,n]of Object.entries(t.$exportMimeType))r[e]=[...r[e],...n];n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"};const rg={build:(e,t,n)=>qu(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>Vu((()=>n.getOutput().disabled.value?void 0:function(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,i,o,s,l]=t;e.update((()=>{const e=eo();if(Mi(e)){const t=e.anchor;let a=t.getNode(),c=0,u=0;if(Ei(a)&&r>=0&&i>=0&&(c=r,u=r+i,e.setTextNodeRange(a,c,a,u)),c===u&&""===o||(e.insertRawText(o),a=t.getNode()),Ei(a)){c=s,u=s+l;const t=a.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(a,c,a,u)}n.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}(e)))},ig="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,og=ig&&"documentMode"in document?document.documentMode:null,sg=ig&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lg=!(!ig||!("InputEvent"in window)||og)&&"getTargetRanges"in new window.InputEvent("input"),ag=ig&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,cg=ig&&/Android/.test(navigator.userAgent),ug=ig&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!cg,dg=ig&&/^(?=.*Chrome).*/i.test(navigator.userAgent),hg=ig&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&sg&&!dg;function gg(e,t){t.update((()=>{if(null!==e){const n=fu(e,KeyboardEvent)?null:e.clipboardData,r=eo();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=$h(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function pg(e){return Za(e.registerCommand(bn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteCharacter(e),!0)}),0),e.registerCommand(wn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(kn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Cn,(e=>{const t=eo();if(!Mi(t))return!1;if("string"==typeof e)t.insertText(e);else{const n=e.dataTransfer;if(null!=n)Hh(n,t);else{const n=e.data;n&&t.insertText(n)}}return!0}),0),e.registerCommand(vn,(()=>{const e=eo();return!!Mi(e)&&(e.removeText(),!0)}),0),e.registerCommand(_n,(e=>{const t=eo();return!!Mi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(xn,(()=>{const e=eo();return!!Mi(e)&&(e.insertLineBreak(),!0)}),0),e.registerCommand(Fn,(e=>{const t=eo();if(!Mi(t))return!1;const n=e,r=n.shiftKey;return!!ac(t,!0)&&(n.preventDefault(),uc(t,r,!0),!0)}),0),e.registerCommand(Ln,(e=>{const t=eo();if(!Mi(t))return!1;const n=e,r=n.shiftKey;return!!ac(t,!1)&&(n.preventDefault(),uc(t,r,!1),!0)}),0),e.registerCommand(Bn,(t=>!!Mi(eo())&&(!ag||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(bn,!0))),0),e.registerCommand(zn,(t=>!!Mi(eo())&&(t.preventDefault(),e.dispatchCommand(bn,!1))),0),e.registerCommand(Mn,(t=>{if(!Mi(eo()))return!1;if(null!==t){if((ag||ug||hg)&&lg)return!1;t.preventDefault()}return e.dispatchCommand(_n,!1)}),0),e.registerCommand(Xn,(()=>(rl(),!0)),0),e.registerCommand(Jn,(t=>!!Mi(eo())&&(gg(t,e),!0)),0),e.registerCommand(Yn,(t=>!!Mi(eo())&&(function(e,t){gg(e,t),t.update((()=>{const e=eo();Mi(e)&&e.removeText()}))}(t,e),!0)),0),e.registerCommand(Sn,(t=>!!Mi(eo())&&(function(e,t){e.preventDefault(),t.update((()=>{const t=eo(),n=fu(e,ClipboardEvent)?e.clipboardData:null;null!=n&&Mi(t)&&Hh(n,t)}),{tag:Zr})}(t,e),!0)),0),e.registerCommand(Vn,(t=>function(e,t){return Vh(e,t,((e,t)=>Hh(e,t)))}(t,e)),0),e.registerCommand(jn,(t=>{const n=eo();return!!Mi(n)&&(n.isCollapsed()||null===t.dataTransfer||Wh(t.dataTransfer,e),!0)}),0))}function fg(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const mg="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,yg=mg&&"documentMode"in document?document.documentMode:null,bg=mg&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),_g=!(!mg||!("InputEvent"in window)||yg)&&"getTargetRanges"in new window.InputEvent("input"),xg=mg&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Cg=mg&&/Android/.test(navigator.userAgent),Sg=mg&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Cg,vg=mg&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wg=mg&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bg&&!vg,kg=un("DRAG_DROP_PASTE_FILE");let Eg=class e extends zo{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return qa(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Fg,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Tg().updateFromJSON(e)}insertNewAfter(e,t){const n=es(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=es();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Tg(){return vl(new Eg)}function Ng(e){return e instanceof Eg}let Ag=class e extends zo{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e="h1",t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){const t=this.getWritable();return t.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){qa(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Og,priority:0}),h2:e=>({conversion:Og,priority:0}),h3:e=>({conversion:Og,priority:0}),h4:e=>({conversion:Og,priority:0}),h5:e=>({conversion:Og,priority:0}),h6:e=>({conversion:Og,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Lg(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Lg(e)?{conversion:e=>({node:Ig("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Ig(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?es():Ig(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=es();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?es():Ig(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Lg(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Og(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Ig(t),null!==e.style&&(Ul(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Fg(e){const t=Tg();return null!==e.style&&(t.setFormat(e.style.textAlign),Ul(e,t)),{node:t}}function Ig(e="h1"){return vl(new Ag(e))}function Rg(e){return e instanceof Ag}function Pg(e){let t=null;if(fu(e,DragEvent)?t=e.dataTransfer:fu(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function Mg(e){return Wo(Ds(e))}function Dg(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function Bg(e){return Za(e.registerCommand(gn,(e=>{const t=eo();return!!Bi(t)&&(t.clear(),!0)}),0),e.registerCommand(bn,(e=>{const t=eo();return Mi(t)?(t.deleteCharacter(e),!0):!!Bi(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(wn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(kn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Cn,(t=>{const n=eo();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Kh(r,n,e);else if(Mi(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(vn,(()=>{const e=eo();return!!Mi(e)&&(e.removeText(),!0)}),0),e.registerCommand(En,(e=>{const t=eo();return!!Mi(t)&&(t.formatText(e),!0)}),0),e.registerCommand(qn,(e=>{const t=eo();if(!Mi(t)&&!Bi(t))return!1;const n=t.getNodes();for(const t of n){const n=jl(t,(e=>Ho(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(_n,(e=>{const t=eo();return!!Mi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(xn,(()=>{const e=eo();return!!Mi(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Kn,(()=>{const e=Ai(),t=eo();return Mi(t)&&(e.setFormat(t.format),e.setStyle(t.style)),ao([e]),!0}),0),e.registerCommand(Un,(()=>mu((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Wn,(()=>mu((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(Rn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(Mi(t)){const n=ll(t.focus,!0);if(!e.shiftKey&&Wo(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(Pn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(Mi(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===zs().getChildrenSize()}(t))return e.preventDefault(),!0;const n=ll(t.focus,!1);if(!e.shiftKey&&Wo(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(Fn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Qa(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!Mi(t))return!1;if(ac(t,!0)){const n=e.shiftKey;return e.preventDefault(),uc(t,n,!0),!0}return!1}),0),e.registerCommand(Ln,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Qa(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!Mi(t))return!1;const n=e.shiftKey;return!!ac(t,!1)&&(e.preventDefault(),uc(t,n,!1),!0)}),0),e.registerCommand(Bn,(t=>{if(Mg(t.target))return!1;const n=eo();if(Mi(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(qo(n))return!1;const r=du(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Wn,void 0);if(xg&&"ko-KR"===navigator.language)return!1}else if(!Bi(n))return!1;return t.preventDefault(),e.dispatchCommand(bn,!0)}),0),e.registerCommand(zn,(t=>{if(Mg(t.target))return!1;const n=eo();return!(!Mi(n)&&!Bi(n))&&(t.preventDefault(),e.dispatchCommand(bn,!1))}),0),e.registerCommand(Mn,(t=>{const n=eo();if(!Mi(n))return!1;if(Dg(n),null!==t){if((xg||Sg||wg)&&_g)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(_n,!1)}return e.dispatchCommand(xn,void 0)}),0),e.registerCommand($n,(()=>!!Mi(eo())&&(e.blur(),!0)),0),e.registerCommand(Vn,(t=>{const[,n]=Pg(t);if(n.length>0){const r=fg(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=Ds(i);if(null!==o){const e=Ji();if(Ei(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{const t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Ks(At(e))}e.dispatchCommand(kg,n)}return t.preventDefault(),!0}return function(e,t){return Vh(e,t,Kh)}(t,e)}),0),e.registerCommand(jn,(t=>{const[n]=Pg(t),r=eo();return!(n&&!Mi(r)||(Mi(r)&&!r.isCollapsed()&&null!==t.dataTransfer&&(Qh(t.dataTransfer,Xh(r)),Wh(t.dataTransfer,e)),0))}),0),e.registerCommand(Zn,(e=>{const[t]=Pg(e),n=eo();if(t&&!Mi(n))return!1;const r=fg(e.clientX,e.clientY);if(null!==r){Wo(Ds(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Xn,(()=>(rl(),!0)),0),e.registerCommand(Jn,(t=>(Gh(e,fu(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Yn,(t=>(async function(e,t){await Gh(t,fu(e,ClipboardEvent)?e:null),t.update((()=>{const e=eo();Mi(e)?e.removeText():Bi(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Sn,(t=>{const[,n,r]=Pg(t);return n.length>0&&!r?(e.dispatchCommand(kg,n),!0):(!Fl(t.target)||!ms(t.target))&&(null!==eo()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=eo(),r=fu(e,InputEvent)||fu(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Kh(r,n,t)}),{tag:Zr})}(t,e),!0))}),0),e.registerCommand(Dn,(e=>{const t=eo();return Mi(t)&&Dg(t),!1}),0),e.registerCommand(Hn,(e=>{const t=eo();return Mi(t)&&Dg(t),!1}),0))}const $g={conflictsWith:["@lexical/plain-text"],dependencies:[rg],name:"@lexical/rich-text",nodes:()=>[Ag,Eg],register:Bg};function zg(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))Hg(e[r],i)&&(n[r]=zg(e[r],i));return n}function Hg(...e){return e.every((e=>e&&e.constructor==Object))}class Kg{#de={};constructor(...e){this.merge(...e)}merge(...e){return this.#de=e.reduce(zg,this.#de)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#de)}}function Ug(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const Wg=new Kg({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Vg=new Kg({default:{attachments:!0,markdown:!0,multiLine:!0,permittedAttachmentTypes:null,richText:!0,toolbar:{upload:"both"},highlight:{buttons:{color:Ug(1,9).map((e=>`var(--highlight-${e})`)),"background-color":Ug(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var qg={global:Wg,presets:Vg,configure({global:e,...t}){e&&Wg.merge(e),Vg.merge(t)}};function jg(e){be.clearConfig(),be.setConfig(function(e){const t={};for(const n of e)"string"==typeof n?t[n]||=[]:(t[n.tag]||=[],t[n.tag].push(...n.attributes));return{ALLOWED_TAGS:Object.keys(t),ALLOWED_ATTR:pc,ADD_ATTR:(e,n)=>t[n]?.includes(e),ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1}}(e))}function Zg(e){return be.sanitize(e)}function Gg(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}class Jg extends Uo{static getType(){return"custom_action_text_attachment"}static clone(e){return new Jg({...e},e.__key)}static importJSON(e){return new Jg({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(ki(" "));const r=function(e){try{return JSON.parse(e)}catch{return e}}(e.getAttribute("content"));t.push(new Jg({sgid:e.getAttribute("sgid"),innerHtml:r,plainText:e.textContent.trim()||kc(r),contentType:e.getAttribute("content-type")}));const i=e.nextSibling;return i&&i.nodeType===Node.TEXT_NODE&&/^\s/.test(i.textContent)&&t.push(ki(" ")),{node:t}},priority:2}:null}}static get TAG_NAME(){return qg.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r,plainText:i},o){super(o);const s=qg.global.get("attachmentContentTypeNamespace");this.tagName=e||Jg.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${s}.unknown`,this.innerHtml=r,this.plainText=i??kc(r)}createDOM(){const e=xc(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0,draggable:!0});e.dataset.lexicalNodeKey=this.__key,e.insertAdjacentHTML("beforeend",Zg(this.innerHtml));const t=xc("lexxy-node-delete-button");return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return"\ufeff"}getReadableTextContent(){return this.plainText||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:xc(this.tagName,{sgid:this.sgid,content:this.innerHtml,"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml,plainText:this.plainText}}decorate(){return null}}function Yg(e){return e instanceof Jg}function Xg(e){return/^(?:[a-z0-9]+:\/\/|www\.)[^\s]+$/i.test(e)}function Qg(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ep(e,t){const n=Qg(e),r=Qg(t);if(!r)return 0;const i=n.match(new RegExp(`(?<![\\p{L}\\p{N}])${o=r,o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"u"));var o;return i?i.index:-1}function tp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function np(e,t,n){let r=n(),i=0,o=r,s=0,l=null;return(a,c,u,d,h,g)=>{const p=n();if(g.has(Qr)&&(o=r,s=i,l=a),g.has(Vr))return i=0,r=p,2;g.has(ei)&&l&&(r=o,i=s,a=l);const f=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const o=t._selection,s=e._selection;if(i)return 1;if(!(Mi(o)&&Mi(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;const l=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||qo(n)||i.push(n)}return i}(t,n,r);if(0===l.length)return 0;if(l.length>1){const n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Ei(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}const a=l[0],c=e._nodeMap.get(a.__key);if(!Ei(c)||!Ei(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const h=o.anchor,g=s.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}(a,c,d,h,e.isComposing()),m=(()=>{const n=null===u||u.editor===e,o=g.has(qr);if(!o&&n&&g.has(jr))return 0;if(1===f)return 2;if(null===a)return 1;const s=c._selection;if(!(d.size>0||h.size>0))return null!==s?0:2;const l="number"==typeof t?t:t.peek();return!1===o&&0!==f&&f===i&&p<r+l&&n||1===d.size&&function(e,t,n){const r=t._nodeMap.get(e),i=n._nodeMap.get(e),o=t._selection,s=n._selection;return!(Mi(o)&&Mi(s)&&"element"===o.anchor.type&&"element"===o.focus.type&&"text"===s.anchor.type&&"text"===s.focus.type||!Ei(r)||!Ei(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(d)[0],a,c)?0:1})();return r=p,i=f,m}}function rp(e){e.undoStack=[],e.redoStack=[],e.current=null}const ip={build:(e,{delay:t,createInitialHistoryState:n,disabled:r,now:i})=>qu({delay:t,disabled:r,historyState:n(e),now:i}),config:{createInitialHistoryState:function(){return{current:null,redoStack:[],undoStack:[]}},delay:300,disabled:"undefined"==typeof window,now:Date.now},name:"@lexical/history/History",register:(e,t,n)=>{const r=n.getOutput();return Vu((()=>r.disabled.value?void 0:function(e,t,n,r=Date.now){const i=np(e,n,r);return Za(e.registerCommand(Tn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(tr,!0)),0===r.length&&e.dispatchCommand(nr,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Vr})}}(e,t),!0)),0),e.registerCommand(Nn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(nr,!0));const o=n.pop();0===n.length&&e.dispatchCommand(tr,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Vr})}}(e,t),!0)),0),e.registerCommand(Qn,(()=>(rp(t),!1)),0),e.registerCommand(er,(()=>(rp(t),e.dispatchCommand(tr,!1),e.dispatchCommand(nr,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:r,dirtyLeaves:o,dirtyElements:s,tags:l})=>{const a=t.current,c=t.redoStack,u=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;const h=i(r,n,a,o,s,l);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(tr,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(nr,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(e,r.historyState.value,r.delay,(()=>r.now.peek()()))))}};class op{#he;constructor(e){this.#he=e}get editorElement(){return this.#he}get editorConfig(){return this.#he.config}get enabled(){return!0}get lexicalExtension(){return null}get allowedElements(){return[]}initializeToolbar(e){}setEditorValidity(e,t){this.editorElement.setElementValidity(this,e,t)}dispose(){}}function sp(e){return Ho(e)&&Cl(e)&&!qo(e)}function lp(e){return function(e){return(Ho(e)||Wo(e))&&!e.isParentRequired()}(e)?e:e.getParent()?pu(e,(()=>e.createParentElementNode())):e.createParentElementNode().append(e)}function ap(e){const t=uu(e,Ud);return t?.getListType()??null}function cp(e){const t=e.getRootElement();return null!==t&&t.contains(document.activeElement)}function up(e,t=null){return null===t?up(e,!0)||up(e,!1):t?dp(e):function(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return Ho(t)||Ga(177),e.offset===t.getChildrenSize()}(e)}function dp(e){return 0===e.offset}function hp(e,...t){return gp(mi,e,((e,n)=>({...e,forChild:(r,i)=>{const o=e?.forChild??(e=>e);let s=o(r,i);if(Ei(s))return s=t.reduce(((e,t)=>t(e,n)??e),s),s}})))}function gp(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const o=i.conversion(r);return o?n(o,r)??o:o}}function pp(e){const t=e.anchor.getNode(),n=Ho(t)?t:t.getParentOrThrow(),r=n.getChildren();if(0===r.length)return!0;const i=r[r.length-1];if(t===n.getLatest()&&e.anchor.offset===r.length)return!0;if(t===i)return!0;const o=r.findLastIndex((e=>ai(e)));if(-1===o)return!0;return r.indexOf(t)>o}function fp(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren?.();return!t||0===t.length||t.every((e=>!!ai(e)||fp(e)))}function mp(e){for(const t of Su(e)){if(!fp(t))break;t.remove()}}function yp(e,t,n,r){return Ei(e)&&" "===e.getTextContent()&&n===r-1&&t instanceof Jg}function bp(e,t=e=>e.getTopLevelElement()){rc(e),function(e){if(e.isCollapsed())return;const t=e.anchor.getNode().getTopLevelElement(),n=e.focus.getNode().getTopLevelElement();if(!t||!n||t.is(n))return;if(r=e.anchor,i=t,_p(Ea(r,"next"),i)){const n=t.getNextSibling();n&&e.anchor.set(n.getKey(),0,"element")}var r,i;if(function(e,t){return _p(Ea(e,"previous"),t)}(e.focus,n)){const t=n.getPreviousSibling();t&&e.focus.set(t.getKey(),t.getChildrenSize(),"element")}}(e);const n=Ea(e.focus,"next"),r=Ea(e.anchor,"previous"),i=e.isCollapsed(),o=xp(n,i);let s=xp(r,i);o?.origin.is(s?.origin)&&(s=null);const l=o&&Cp(o),a=s&&Cp(s),c=a?.getNextSibling()??t(e.anchor.getNode()),u=l?.getPreviousSibling()??t(e.focus.getNode());c&&u&&Na(_a(Pa(ga(c,"next")),Da(Pa(ga(u,"previous")),"next")))}function _p(e,t){if(ra(e)&&Ma(e))return!1;let n=Pa(e);for(;n&&t.isParentOf(n.origin);){if(n.getNodeAtCaret())return!1;n=n.getParentCaret()}return!0}function xp(e,t=!1){const n=e.origin.getTopLevelElement();if(!n||!ts(n))return null;const r=(t?null:function(e,t){let n;if(oa(e)&&e.origin.is(t)||ra(e)&&Ma(e.getFlipped()))n=null;else if(ia(e)&&e.getParentAtCaret().is(t))n=e;else{const r=function(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);){if(n.getNodeAtCaret())return null;n=n.getParentCaret()}return n?.origin.getParent()?.is(t)?n:null}(e,t);n=r?Oa(r):null}return n&&ai(n.origin)?function(e){const t=e.getNodeAtCaret();return ai(t)?null:e.origin}(n):null}(e,n))??function(e,t){const n=function(e,t){return e.getParentAtCaret().is(t)?e:function(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);)n=n.getParentCaret();return n?.origin.getParent()?.is(t)?n:null}(e,t)}(e,t);if(!n)return null;for(const{origin:e}of n){if(!e.getParent().is(t))break;if(ai(e))return e}return null}(e,n);return r?ca(r,e.direction):null}function Cp(e){let t=null;if(null===e.getNodeAtCaret())e.origin.remove();else{const n=e.origin;Ua(Da(Oa(e),"next")),t=n.getTopLevelElement(),n.remove()}return t}function Sp(e){if("element"!==e.type)return!1;const t=e.getNode().getFirstChild();return(Ho(t)||Wo(t))&&!t.isInline()}function vp(e){return Mi(e)&&[e.anchor,e.focus].some(Sp)}const wp=un("REWRITE_HISTORY_COMMAND");class kp extends op{#ge=null;get lexicalExtension(){return{name:"lexxy/rewritable-history",dependencies:[ip],register:(e,t,n)=>{const r=n.getDependency(ip).output;return this.#ge=r.historyState.value,e.registerCommand(wp,(e=>this.#pe(e)),0)}}}get historyState(){return this.#ge}get#fe(){const e=Array.from(this.#ge.undoStack);return this.#ge.current&&e.push(this.#ge.current),e.concat(this.#ge.redoStack)}#pe(e){return this.#me(e),this.#ye(e),!0}#me(e){Dl().update((()=>{for(const[t,{patch:n,replace:r}]of Object.entries(e)){const e=Rs(t);e&&(n&&Object.assign(e.getWritable(),n),r&&e.replace(r))}}),{discrete:!0,tag:this.#be()})}#ye(e){const t=Object.keys(e);for(const n of this.#fe){if(!this.#_e(n,t))continue;const r=n.editorState=Ep(n.editorState);for(const[t,{patch:n,replace:i}]of Object.entries(e)){const e=r._nodeMap.get(t);e&&(n?this.#xe(r,e,n):i&&this.#Ce(r,e,i))}}}#_e(e,t){return t.some((t=>e.editorState._nodeMap.has(t)))}#be(){const e=[jr,Jr];return cp(this.editorElement.editor)||e.push(Yr),e}#xe(e,t,n){e._nodeMap.set(t.__key,function(e,t){const n=Kl(e);return Object.assign(n,t),n}(t,n))}#Ce(e,t,n){e._nodeMap.set(t.__key,function(e,t){const n=Kl(e);return n.__key=t.__key,n.__parent=t.__parent,n.__prev=t.__prev,n.__next=t.__next,n}(n,t))}}function Ep(e){const t=e.clone();return t._nodeMap=new Map(e._nodeMap),t}class Tp extends Uo{static getType(){return"action_text_attachment"}static clone(e){return new Tp({...e},e.__key)}static importJSON(e){return new Tp({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new Tp({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:()=>({conversion:e=>{const t=(e.getAttribute("src")??"").split("/").pop();return{node:new Tp({src:e.getAttribute("src"),fileName:t,caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}},priority:1}),video:()=>({conversion:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{node:new Tp({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return qg.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,src:n,previewSrc:r,previewable:i,previewStatusUrl:o,pendingPreview:s,altText:l,caption:a,contentType:c,fileName:u,fileSize:d,width:h,height:g,uploadError:p},f){var m;super(f),this.tagName=e||Tp.TAG_NAME,this.sgid=t,this.src=n,this.previewSrc=r,this.previewable="string"==typeof(m=i)?"true"===m:Boolean(m),this.previewStatusUrl=o,this.pendingPreview=s,this.altText=l||"",this.caption=a||"",this.contentType=c||"",this.fileName=u||"",this.fileSize=d,this.width=h,this.height=g,this.uploadError=p,this.editor=Dl()}createDOM(){if(this.uploadError)return this.createDOMForError();if(this.pendingPreview)return this.#Se();const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#ve()),e.appendChild(this.#we())):this.isVideo?(e.appendChild(this.#ke()),e.appendChild(this.#we())):(e.appendChild(this.#ke()),e.appendChild(this.#Ee())),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;const n=t.querySelector("figcaption textarea");return n&&this.caption&&(n.value=this.caption),!1}getTextContent(){return`[${this.caption||this.fileName}]\n\n`}isInline(){return this.isAttached()&&!this.getParent().is(xl(this))}exportDOM(){return{element:xc(this.tagName,{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,src:this.src,previewable:this.previewable,previewStatusUrl:this.previewStatusUrl,pendingPreview:this.pendingPreview,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createDOMForError(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild(xc("div",{innerText:`Error uploading ${this.fileName||"file"}`})),e}createAttachmentFigure(e=this.isPreviewableAttachment){const t=(n=this.contentType,r=e,i=this.fileName,xc("figure",{className:`attachment attachment--${r?"preview":"file"} attachment--${i?i.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":n}));var n,r,i;t.draggable=!0,t.dataset.lexicalNodeKey=this.__key;const o=xc("lexxy-node-delete-button");return t.appendChild(o),t}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return Sc(this.contentType)}get isVideo(){return this.contentType.startsWith("video/")}#Se(){const e=this.createAttachmentFigure(!1);return e.appendChild(this.#ke()),e.appendChild(this.#Ee()),this.#Te(e),e}patchAndRewriteHistory(e){this.editor.dispatchCommand(wp,{[this.getKey()]:{patch:e}})}replaceAndRewriteHistory(e){this.editor.dispatchCommand(wp,{[this.getKey()]:{replace:e}})}#ve(e={}){const t=xc("img",{src:this.previewSrc||this.src,draggable:!1,alt:this.altText,...this.#Ne,...e});this.previewable&&!this.isPreviewableImage&&(t.onerror=()=>this.#Ae(t)),this.previewSrc&&this.#Le(t);const n=xc("div",{className:"attachment__container"});return n.appendChild(t),n}#Le(e){const t=this.previewSrc,n=new Image;n.onload=()=>this.#Oe(e,t),n.onerror=()=>this.#Fe(t),n.src=this.src}#Oe(e,t){e.src=this.src,this.patchAndRewriteHistory({previewSrc:null}),this.#Ie(t)}#Fe(e){this.patchAndRewriteHistory({previewSrc:null,uploadError:!0}),this.#Ie(e)}#Ie(e){e?.startsWith("blob:")&&URL.revokeObjectURL(e)}#Ae(e){const t=e.closest("figure.attachment");t&&this.#Re(t,"attachment--preview","attachment--file",(()=>{t.appendChild(this.#ke()),t.appendChild(this.#Ee())}))}#Te(e){this.previewStatusUrl?this.#Pe(e):this.#Me(e)}#Pe(e){let t=0;const n=async()=>{if(this.editor.read((()=>this.isAttached())))try{const t=await fetch(this.previewStatusUrl,{credentials:"include",redirect:"manual"});if(!this.editor.read((()=>this.isAttached())))return;t.ok?r():this.#De(e,this.src)}catch{r()}},r=()=>{if(t++,t<20&&this.editor.read((()=>this.isAttached()))){const e=Math.min(2e3*Math.pow(1.5,t),12e4);setTimeout(n,e)}};setTimeout(n,3e3)}#Me(e){const t=new Image;t.onload=()=>{this.editor.read((()=>this.isAttached()))&&this.#De(e,this.src)},t.onerror=()=>{this.editor.read((()=>this.isAttached()))&&this.patchAndRewriteHistory({pendingPreview:!1})},t.src=this.src}#De(e,t){this.#Re(e,"attachment--file","attachment--preview",(()=>{const n=xc("img",{src:t,draggable:!1,alt:this.altText});n.onerror=()=>this.#Ae(n);const r=xc("div",{className:"attachment__container"});r.appendChild(n),e.appendChild(r),e.appendChild(this.#we())})),this.patchAndRewriteHistory({pendingPreview:!1})}#Re(e,t,n,r){e.className=e.className.replace(t,n);for(const t of[...e.querySelectorAll(".attachment__container, .attachment__icon, figcaption")])t.remove();r()}get#Ne(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#ke(){return xc("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#Ee(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=xc("span",{className:"attachment__size",textContent:Gg(this.fileSize)});e.appendChild(t)}return e}#we(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#Be(e))),t.addEventListener("keydown",(e=>this.#$e(e))),t.addEventListener("copy",(e=>e.stopPropagation())),t.addEventListener("cut",(e=>e.stopPropagation())),t.addEventListener("paste",(e=>e.stopPropagation())),e.appendChild(t),e}#Be(e){this.#ze(e.target)}#ze(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#$e(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:jr})),e.stopPropagation()}}function Np(...e){return new Tp(...e)}function Ap(e){return e instanceof Tp}function Lp(e,t){return(e instanceof Jg||e instanceof Tp)&&!t.permitsAttachmentContentType(e.contentType)}function Op(e){return e instanceof Tp&&/^data:image\/[^,]*;base64,/i.test(e.src??"")}function Fp(e,t){const n=function(e){try{const[t,n]=e.split(","),r=t.match(/^data:(image\/[A-Za-z0-9][A-Za-z0-9!#$&\-^_.+]*)/)?.[1];if(r){const e=Uint8Array.from(atob(n),(e=>e.charCodeAt(0))),t=function(e){return e?e.split("/")[1]:null}(r)??"png";return new File([e],`pasted-image-${Date.now()}.${t}`,{type:r})}return null}catch{return null}}(e.src);return n&&t.acceptsFile(n)?t.contents.$createUploadNode(n):null}function Ip(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Rp(e,t){let n=e;for(let r=ca(e,t);r&&(Qp(r.origin)||Li(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function Pp(e){return Rp(e,"previous")}function Mp(e){return Rp(e,"next")}function Dp(e,t){for(const n of e.childNodes){if(Ol(n)&&n.tagName===t)return!0;Dp(n,t)}return!1}const Bp="data-language",$p="data-highlight-language",zp="data-theme";let Hp=class e extends zo{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");qa(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Bp,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute($p,n));const r=this.getTheme();r&&t.setAttribute(zp,r);const i=this.getStyle();return i&&ii(t.style,i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(Bp,r):i&&t.removeAttribute(Bp);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute($p,r):t.removeAttribute($p):o&&r&&t.setAttribute($p,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(zp,s):l&&t.removeAttribute(zp);const a=this.__style,c=e.__style;return a!==c&&ii(t.style,a,c),!1}exportDOM(e){const t=document.createElement("pre");qa(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Bp,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute($p,n));const r=this.getTheme();r&&t.setAttribute(zp,r);const i=this.getStyle();return i&&ii(t.style,i),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||Dp(e,"BR"))?{conversion:Wp,priority:1}:null,div:()=>({conversion:Vp,priority:1}),pre:()=>({conversion:Wp,priority:0}),table:e=>Gp(e)?{conversion:qp,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Gp(n)?{conversion:jp,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Gp(t)?{conversion:jp,priority:3}:null}}}static importJSON(e){return Kp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!ud(Dl(),"@lexical/code")){const t=function(e){const{anchor:t}=e;if(e.isCollapsed()&&"element"===t.type){const e=t.getNode();if(Up(e)){const n=e.getChildrenSize();if(n>=2&&t.offset===n){const t=e.getLastChild();if(ai(t)&&ai(t.getPreviousSibling())){const t=es();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}(e);if(t)return t}const{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(Ei(i)){let e=Pp(i);const t=[];for(;;)if(Li(e))t.push(Ai()),e=e.getNextSibling();else{if(!Qp(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Xp(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const r=i.splitText(n.offset)[0],o=0===n.offset?0:1,s=r.getIndexWithinParent()+o,l=i.getParentOrThrow(),a=[li(),...t];l.splice(s,0,a);const c=t[t.length-1];c?c.select():0===n.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(Up(i)){const{offset:t}=e.anchor;i.splice(t,0,[li()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=es();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function Kp(e,t){return function(e){const t=Dl();return xo(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(Hp).setLanguage(e).setTheme(t)}function Up(e){return e instanceof Hp}function Wp(e){return{node:Kp(e.getAttribute(Bp))}}function Vp(e){const t=e,n=Zp(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Zp(t))return!0;t=t.parentElement}return!1}(t)?{node:n?Kp():null}:{node:null}}function qp(){return{node:Kp()}}function jp(){return{node:null}}function Zp(e){return null!==e.style.fontFamily.match("monospace")}function Gp(e){return e.classList.contains("js-file-line-container")}let Jp=class e extends mi{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return qa(t,Yp(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Yp(n.theme,e.__highlightType),o=Yp(n.theme,this.__highlightType);return i!==o&&(i&&ja(t,i),o&&qa(t,o)),r}static importJSON(e){return Xp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return Kp()}};function Yp(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Xp(e="",t){return vl(new Jp(e,t))}function Qp(e){return e instanceof Jp}function ef(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const tf=globalThis.Prism||window.Prism,nf={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function rf(e){return"string"==typeof e?e:Array.isArray(e)?e.map(rf).join(""):rf(e.content)}function of(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=tf.tokenize(r,tf.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=tf.languages[n],i={tokens:e},o=tf.languages.diff.PREFIXES;for(const e of i.tokens){if("string"==typeof e||!(e.type in o)||!Array.isArray(e.content))continue;const t=e.type;let n=0;const i=()=>(n++,new tf.Token("prefix",o[t],t.replace(/^(\w+).*/,"$1"))),s=e.content.filter((e=>"string"==typeof e||"prefix"!==e.type)),l=e.content.length-s.length,a=tf.tokenize(rf(s),r);a.unshift(i());const c=/\r\n|\n/g,u=e=>{const t=[];c.lastIndex=0;let r,o=0;for(;n<l&&(r=c.exec(e));){const n=r.index+r[0].length;t.push(e.slice(o,n)),o=n,t.push(i())}if(0!==t.length)return o<e.length&&t.push(e.slice(o)),t},d=e=>{for(let t=0;t<e.length&&n<l;t++){const n=e[t];if("string"==typeof n){const r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if("string"==typeof n.content){const e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(a),n<l&&a.push(i()),e.content=a}return i.tokens}(i,n[1])),sf(i)}function sf(e,t){const n=[];for(const r of e)if("string"==typeof r){const e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){const i=e[r];"\n"===i||"\r\n"===i?n.push(li()):"\t"===i?n.push(Ai()):i.length>0&&n.push(Xp(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...sf([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...sf(e,"unchanged"===r.type?void 0:r.type))}return n}const lf={$tokenize(e,t){return of(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return tf.tokenize(e,tf.languages[t||""]||tf.languages[this.defaultLanguage])}};function af(e,t,n,r){const i=r.getParent();Up(i)?uf(e,t,n,i):Qp(r)&&r.replace(ki(r.__text))}function cf(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let e=0;e<i;e++)ai(r[e])&&(o+="\n"+ ++s);n.setAttribute("data-gutter",o)}function uf(e,t,n,r){const{nodesCurrentlyHighlighting:i}=n,o=r.getKey();void 0===r.getLanguage()&&r.setLanguage(t.defaultLanguage);if(!function(e){const t=function(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}(e),n=t||e;try{return!!n&&tf.languages.hasOwnProperty(n)}catch(e){return!1}}(r.getLanguage()||t.defaultLanguage))return r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!1),void async function(){}();r.getIsSyntaxHighlightSupported()||r.setIsSyntaxHighlightSupported(!0),i.has(o)||(i.add(o),n.didTransform||(n.didTransform=!0,fl((()=>{n.didTransform=!1,i.clear()}))),function(e,t){const n=Rs(e);if(!Up(n)||!n.isAttached())return;const r=eo();if(!Mi(r))return void t();const i=r.anchor,o=i.offset,s="element"===i.type&&ai(n.getChildAtIndex(i.offset-1));let l=0;if(!s){const e=i.getNode();l=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(s?i.getNode().select(o,o):n.getChildren().some((e=>{const t=Ei(e);if(t||ai(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1})))}(o,(()=>{const e=Rs(o);if(!Up(e)||!e.isAttached())return!1;const n=e.getLanguage()||t.defaultLanguage,i=t.$tokenize(e,n),s=function(e,t){let n=0;for(;n<e.length&&df(e[n],t[n]);)n++;const r=e.length,i=t.length,o=Math.min(r,i)-n;let s=0;for(;s<o;)if(s++,!df(e[r-s],t[i-s])){s--;break}const l=r-s;return{from:n,nodesForReplacement:t.slice(n,i-s),to:l}}(e.getChildren(),i),{from:l,to:a,nodesForReplacement:c}=s;return!(l===a&&!c.length||(r.splice(l,a-l,c),0))})))}function df(e,t){return Qp(e)&&Qp(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Li(e)&&Li(t)||ai(e)&&ai(t)}function hf(e){if(!Mi(e))return!1;const t=e.anchor.getNode(),n=Up(t)?t:t.getParent(),r=e.focus.getNode(),i=Up(r)?r:r.getParent();return Up(n)&&n.is(i)}function gf(e){const t=e.getNodes(),n=[];if(1===t.length&&Up(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Qp(i)||Li(i)||ai(i)||ef(169),ai(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Fi(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function pf(e){const t=eo();if(!Mi(t)||!hf(t))return!1;const n=gf(t),r=n.length;if(0===r&&t.isCollapsed())return e===Un&&t.insertNodes([Ai()]),!0;if(0===r&&e===Un&&"\n"===t.getTextContent()){const e=Ai(),n=li(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),Na(Ba(_a(ua(e,"next",0),Pa(ca(n,"next"))),r)),!0}for(let i=0;i<r;i++){const r=n[i];if(r.length>0){let n=r[0];if(0===i&&(n=Pp(n)),e===Un){const e=Ai();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Fi(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Li(n)&&n.remove()}}return!0}function ff(e,t){const n=eo();if(!Mi(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),a=i.getNode(),c=e===Rn;if(!hf(n)||!Qp(l)&&!Li(l)||!Qp(a)&&!Li(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=l.getParentOrThrow();if(c&&0===o&&null===l.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&o===l.getTextContentSize()&&null===l.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(l.isBefore(a)?(u=Pp(l),d=Mp(a)):(u=Pp(a),d=Mp(l)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;e<h.length;e++){const t=h[e];if(!Qp(t)&&!Li(t)&&!ai(t))return!1}t.preventDefault(),t.stopPropagation();const g=c?u.getPreviousSibling():d.getNextSibling();if(!ai(g))return!0;const p=c?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;const f=Qp(p)||Li(p)||ai(p)?c?Pp(p):Mp(p):null;let m=null!=f?f:p;return g.remove(),h.forEach((e=>e.remove())),e===Rn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(l,o,a,s),!0}function mf(e,t){const n=eo();if(!Mi(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===In;if(!hf(n)||!Qp(o)&&!Li(o)||!Qp(s)&&!Li(s))return!1;const a=s;if("rtl"===function(e){const t=Pp(e),n=Mp(e);let r=t;for(;null!==r;){if(Qp(r)){const e=Cs(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(Ho(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}(a)?!l:l){const e=function(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(Qp(i)||Li(i)||ai(i)||Ip(167),ai(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Qp(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Qp(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Qp(t)&&(l=t.getTextContent()[0])}if(null!==l&&" "!==l)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!Qp(n)||r===o){if(n=n.getNextSibling(),null===n||ai(n))return null;Qp(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Qp(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}(a,i.offset);if(null!==e){const{node:t,offset:r}=e;ai(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else(function(e){const t=Mp(e);return ai(t)&&Ip(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}const yf={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},bf=function(e){return nf[e]||e},_f=function(e,t){if(!e.hasNodes([Hp,Jp]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=lf);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(Hp,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Rs(n);null!==t&&cf(t,e)}}))}),{skipInitialization:!1}));const r={didTransform:!1,nodesCurrentlyHighlighting:new Set};return n.push(e.registerNodeTransform(Hp,uf.bind(null,e,t,r)),e.registerNodeTransform(mi,af.bind(null,e,t,r)),e.registerNodeTransform(Jp,af.bind(null,e,t,r)),e.registerCommand(Hn,(t=>{const n=function(e){const t=eo();if(!Mi(t)||!hf(t))return null;const n=e?Wn:Un,r=e?Wn:Kn,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=gf(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&ef(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=Pp(l[0]),d=Mp(l[0]),h=Fi(u.getKey(),0,"text"),g=Fi(d.getKey(),d.getTextContentSize(),"text");return a.isBefore(h)||g.isBefore(c)?n:h.isBefore(a)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(Kn,(()=>!!hf(eo())&&(ao([Ai()]),!0)),1),e.registerCommand(Un,(e=>pf(Un)),1),e.registerCommand(Wn,(e=>pf(Wn)),1),e.registerCommand(Rn,(e=>{const t=eo();if(!Mi(t)||!hf(t))return!1;const n=zs().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ff(Rn,e)}),1),e.registerCommand(Pn,(e=>{const t=eo();if(!Mi(t)||!hf(t))return!1;const n=zs().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ff(Pn,e)}),1),e.registerCommand(In,(e=>mf(In,e)),1),e.registerCommand(On,(e=>mf(On,e)),1)),Za(...n)};function xf(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}const Cf=/[!-/:-@[-`{-~\s]/;function Sf(e){return e.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,((e,t)=>String.fromCodePoint(Number(t))))}function vf(e){return Ei(e)&&!e.hasFormat("code")}function wf(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const kf=pt("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-",resetOnCopyNode:!0}),Ef=pt("mdCodeFence",{parse:e=>"string"==typeof e&&/^`{3,}$/.test(e)?e:"```",resetOnCopyNode:!0}),Tf=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},Nf=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=Hd("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==kf.parse(a)?void 0:a;if(Gd(s)&&s.getListType()===e){c&&mt(s,kf,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(Gd(o)&&o.getListType()===e)c&&mt(o,kf,c),o.append(l),t.remove();else{const n=Zd(e,"number"===e?Number(r[2]):void 0);c&&mt(n,kf,c),n.append(l),t.replace(n)}l.append(...n),i||l.select(0,0);const u=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&l.setIndent(u)},Af=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(Kd(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(Gd(e)){r.push(Af(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=ft(e,kf),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";let u=t(s);"number"!==l&&(u=u.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),r.push(i+c+u),o++}return r.join("\n")},Lf={dependencies:[Ag],export:(e,t)=>{if(!Rg(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:Tf((e=>Ig("h"+e[1].length))),type:"element"},Of={dependencies:[Eg],export:(e,t)=>{if(!Ng(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(Ng(n))return n.splice(n.getChildrenSize(),0,[li(),...t]),void e.remove()}const i=Tg();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},Ff={dependencies:[Hp],export:e=>{if(!Up(e))return null;const t=e.getTextContent();let n=ft(e,Ef);if(t.indexOf(n)>-1){const e=t.match(/`{3,}/g);if(e){const t=Math.max(...e.map((e=>e.length)));n="`".repeat(t+1)}}return n+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n"+n},handleImportAfterStartMatch:({lines:e,rootNode:t,startLineIndex:n,startMatch:r})=>{const i=r[1],o=i.trim().length,s=e[n],l=r.index+i.length,a=s.slice(l),c=new RegExp(`\`{${o},}$`);if(c.test(a)){const e=a.match(c),i=a.slice(0,a.lastIndexOf(e[0])),o=[...r];return o[2]="",Ff.replace(t,null,o,e,[i],!0),[!0,n]}const u=new RegExp(`^[ \\t]*\`{${o},}$`);for(let i=n+1;i<e.length;i++){const o=e[i];if(u.test(o)){const l=o.match(u),a=e.slice(n+1,i),c=s.slice(r[0].length);return c.length>0&&a.unshift(c),Ff.replace(t,null,r,l,a,!0),[!0,i]}}const d=e.slice(n+1),h=s.slice(r[0].length);return h.length>0&&d.unshift(h),Ff.replace(t,null,r,null,d,!0),[!0,e.length-1]},regExpEnd:{optional:!0,regExp:/^[ \t]*`{3,}$/},regExpStart:/^([ \t]*`{3,})([\w-]+)?[ \t]?/,replace:(e,t,n,r,i,o)=>{let s,l;const a=n[1]?n[1].trim():"```",c=n[2]||void 0;if(!t&&i){if(1===i.length)r?(s=Kp(c),l=i[0]):(s=Kp(c),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{for(s=Kp(c),i.length>0&&(0===i[0].trim().length?i.shift():i[0].startsWith(" ")&&(i[0]=i[0].slice(1)));i.length>0&&!i[i.length-1].length;)i.pop();l=i.join("\n")}mt(s,Ef,a);const t=ki(l);s.append(t),e.append(s)}else t&&Tf((e=>Kp(e?e[2]:void 0)))(e,t,n,o)},type:"multiline-element"},If={dependencies:[Ud,Bd],export:(e,t)=>Gd(e)?Af(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:Nf("bullet"),type:"element"},Rf={dependencies:[Ud,Bd],export:(e,t)=>Gd(e)?Af(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:Nf("number"),type:"element"},Pf={dependencies:[hd],export:(e,t,n)=>{if(!fd(e)||bd(e))return null;const r=t(e);let i=e.getTitle();return null!=i&&(i=i.replace(/([\\"])/g,"\\$1")),i?`[${r}](${e.getURL()} "${i}")`:`[${r}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(jl(e,fd))return;const[,n,r,i]=t,o=pd(null!=r?Sf(r):void 0,{title:null!=i?Sf(i):void 0}),s=n.split("[").length-1,l=n.split("]").length-1;let a=n,c="";if(s<l)return;if(s>l){const e=n.split("[");c="["+e[0],a=e.slice(1).join("[")}const u=ki(a);return u.setFormat(e.getFormat()),o.append(u),e.replace(o),c&&o.insertBefore(ki(c)),u},trigger:")",type:"text-match"},Mf=[...[Lf,Of,If,Rf],...[Ff],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[Pf]];function Df(e,t,n,r,i){if(!Cl(e.getParent())||e.getFirstChild()!==t)return!1;const o=t.getTextContent();if(!i&&" "!==o[n-1])return!1;for(const{regExpStart:s,replace:l,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=o.match(s);if(r){const o=i||r[0].endsWith(" ")?n:n-1;if(r[0].length!==o)continue;const s=t.getNextSiblings(),[a,c]=t.splitText(n);if(!1!==l(e,c?[c,...s]:s,r,null,null,!1))return a.remove(),!0}}return!1}function Bf(e,t){let n=0;const r=e.getTextContent();for(let e=0;e<t;e++)"`"===r[e]&&n++;return n%2!=0}function $f(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(zf(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function zf(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function Hf(e,t=Mf){const n=function(e){const t=xf(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=xf(n.textFormat,(({tag:e})=>e[e.length-1])),i=xf(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||wf(173,n.getType())}}const o=(e,t,o)=>!!(function(e,t,n,r){if(!Cl(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:o,replace:s}of r){const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,l]=t.splitText(n);if(!1!==s(e,l?[l,...i]:i,r,!1))return o.remove(),!0}}return!1}(e,t,o,n.element)||Df(e,t,o,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t<r.length&&(r=r.slice(0,t));for(const t of i){if(!t.replace||!t.regExp)continue;const n=r.match(t.regExp);if(null===n)continue;const i=n.index||0,o=i+n[0].length;let s;return 0===i?[s]=e.splitText(o):[,s]=e.splitText(i,o),s.selectNext(0,0),t.replace(s,n),!0}return!1}(t,o,i)||function(e,t,n){const r=e.getTextContent(),i=t-1,o=r[i],s=n[o];if(!s)return!1;for(const t of s){const{tag:n}=t,s=n.length,l=i-s+1;if(s>1&&!zf(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!Cf.test(a))continue;const c=e;let u=c,d=$f(r,l,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!ai(h);)if(Ei(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=$f(e,e.length,n)}if(d<0)continue;if(u===c&&d+s===l)continue;const g=u.getTextContent();if(d>0&&g[d-1]===o)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Cf.test(p))continue;if(!t.format.includes("code")&&Bf(u,d))continue;const f=c.getTextContent(),m=f.slice(0,l)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+s));const b=eo(),_=Ji();Ks(_);const x=i-s*(u===c?2:1)+1;_.anchor.set(u.__key,d,"text"),_.focus.set(c.__key,x,"text");for(const e of t.format)_.hasFormat(e)||_.formatText(e);_.anchor.set(_.focus.key,_.focus.offset,_.focus.type);for(const e of t.format)_.hasFormat(e)&&_.toggleFormat(e);return Mi(b)&&(_.format=b.format),!0}return!1}(t,o,r));return Za(e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Gr)||t.has(Vr))return;if(e.isComposing())return;const s=r.read(eo),l=i.read(eo);if(!Mi(l)||!Mi(s)||!s.isCollapsed()||s.is(l))return;const a=s.anchor.key,c=s.anchor.offset,u=r._nodeMap.get(a);!Ei(u)||!n.has(a)||1!==c&&c>l.anchor.offset+1||e.update((()=>{if(!vf(u))return;const e=u.getParent();null===e||Up(e)||o(e,u,s.anchor.offset)&&pl(qr)}))})),e.registerCommand(Mn,(e=>{if(null!==e&&e.shiftKey)return!1;const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const r=t.anchor.offset,i=t.anchor.getNode();if(!Ei(i)||!vf(i))return!1;const o=i.getParent();return null!==o&&!Up(o)&&(r===i.getTextContent().length&&!!Df(o,i,r,n.multilineElement,!0)&&(null!==e&&e.preventDefault(),!0))}),1))}class Kf extends Uo{static getType(){return"horizontal_divider"}static clone(e){return new Kf(e.__key)}static importJSON(e){return new Kf}static importDOM(){return{hr:e=>({conversion:()=>({node:new Kf}),priority:1})}}constructor(e){super(e)}createDOM(){const e=xc("figure",{className:"horizontal-divider"}),t=xc("hr");e.appendChild(t);const n=xc("lexxy-node-delete-button");return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:xc("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Uf={dependencies:[Kf],export:e=>e instanceof Kf?"---":null,regExpStart:/^-{3,}\s?$/,replace:(e,t,n,r,i,o)=>{const s=new Kf;if(e.replace(s),!o){const e=es();s.insertAfter(e),e.select()}},type:"multiline-element"},Wf=/[^\w]/;function Vf(e,t,n){const r=n.tag,i=r.length,o=e.getTextContent(),s=t+i,l=o.indexOf(r,s);if(l<0)return;const a=o.slice(s,l);if(0===a.length)return;const c=o.slice(0,t),u=o.slice(l+i);e.setTextContent(c+a+u);const d=Ji();Ks(d),d.anchor.set(e.getKey(),t,"text"),d.focus.set(e.getKey(),t+a.length,"text");for(const e of n.format)d.hasFormat(e)||d.formatText(e);d.anchor.set(d.focus.key,d.focus.offset,d.focus.type);for(const e of n.format)d.hasFormat(e)&&d.toggleFormat(e)}var qf={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},tableCellHeader:"lexxy-content__table-cell--header",tableCellSelected:"lexxy-content__table-cell--selected",tableSelection:"lexxy-content__table--selection",tableScrollableWrapper:"lexxy-content__table-wrapper",tableCellHighlight:"lexxy-content__table-cell--highlight",tableCellFocus:"lexxy-content__table-cell--focus",list:{nested:{listitem:"lexxy-nested-listitem"}},codeHighlight:{addition:"code-token__selector",atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__comment",decorator:"code-token__function",deleted:"code-token__operator",deletion:"code-token__operator",directive:"code-token__attr","directive-hash":"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__function",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",line:"code-token__selector",namespace:"code-token__variable",number:"code-token__property",macro:"code-token__function",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation","raw-string":"code-token__operator",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function","type-definition":"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};class jf{#He=new Map;track(e,t){this.#He.set(e,t)}forget(e){this.#He.delete(e)}abort(e){const t=this.#He.get(e);t&&(this.#He.delete(e),t.abort())}clear(){this.#He.clear()}}const Zf=/^(\d+(?:\.\d+)?)px$/,Gf=3,Jf=2,Yf=0,Xf=1;let Qf=class e extends zo{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:tm,priority:0}),th:e=>({conversion:tm,priority:0})}}static importJSON(e){return nm().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Yf,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(t.style.backgroundColor=this.__backgroundColor),em(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),qa(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(Ol(t.element)){const e=t.element;e.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||"top",e.style.textAlign="start",null===this.__backgroundColor&&this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...em(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Gf){const n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Yf}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function em(e){return"middle"===e||"bottom"===e}function tm(e){const t=e,n=e.nodeName.toLowerCase();let r;Zf.test(t.style.width)&&(r=parseFloat(t.style.width));let i=Yf;if("th"===n){const e=t.getAttribute("scope");if("col"===e)i=Jf;else if("row"===e)i=Xf;else{const e=t.parentElement,n=Ol(e)&&"tr"===e.nodeName.toLowerCase()&&Ol(e.parentElement)&&("thead"===e.parentElement.nodeName.toLowerCase()||0===e.rowIndex),r=0===t.cellIndex;n&&(i|=Xf),r&&(i|=Jf),i===Yf&&(i=Xf)}}const o=nm(i,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;""!==s&&(o.__backgroundColor=s);const l=t.style.verticalAlign;em(l)&&(o.__verticalAlign=l);const a=t.style,c=(a&&a.textDecoration||"").split(" "),u="700"===a.fontWeight||"bold"===a.fontWeight,d=c.includes("line-through"),h="italic"===a.fontStyle,g=c.includes("underline"),p=a.color;return{after:e=>{const t=[];let n=null;const r=()=>{if(n){const e=n.getFirstChild();ai(e)&&1===n.getChildrenSize()&&e.remove()}};for(const i of e)if(_l(i)||Ei(i)||ai(i)){if(Ei(i)&&(u&&i.toggleFormat("bold"),d&&i.toggleFormat("strikethrough"),h&&i.toggleFormat("italic"),g&&i.toggleFormat("underline"),p)){const e=i.getStyle();e.includes("color:")||i.setStyle(e+`color: ${p};`)}n?n.append(i):(n=es().append(i),t.push(n))}else t.push(i),r(),n=null;return r(),0===t.length&&t.push(es()),t},node:o}}function nm(e=Yf,t=1,n){return vl(new Qf(e,t,n))}function rm(e){return e instanceof Qf}const im=un("INSERT_TABLE_COMMAND");function om(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let sm=class e extends zo{__height;static getType(){return"tablerow"}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:lm,priority:0})}}static importJSON(e){return am().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...void 0===e?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),qa(t,e.theme.tableRow),t}extractWithChild(e,t,n){return"html"===n}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function lm(e){const t=e;let n;return Zf.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>xu(e,rm),node:am(n)}}function am(e){return vl(new sm(e))}function cm(e){return e instanceof sm}const um="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,dm=um&&"documentMode"in document?document.documentMode:null,hm=um&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function gm(e){const t=jl(e,(e=>rm(e)));return rm(t)?t:null}function pm(e){const t=jl(e,(e=>cm(e)));if(cm(t))return t;throw new Error("Expected table cell to be inside of table row.")}function fm(e){const t=jl(e,(e=>wy(e)));if(wy(t))return t;throw new Error("Expected table cell to be inside of table.")}um&&"InputEvent"in window&&!dm&&new window.InputEvent("input");const mm=(e,t)=>e===Gf||e===t?t:Yf;function ym(e=!0){const t=eo();Mi(t)||Im(t)||om(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Nm(n),[o,,s]=Nm(r),[,l,a]=Em(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?bm(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):bm(u<c?o:i,!1)}function bm(e,t=!0){const[,,n]=Nm(e),[r,i]=Em(n,e,e),o=r[0].length,{startRow:s}=i;let l=null;if(t){const t=s+e.__rowSpan-1,i=r[t],a=am();for(let e=0;e<o;e++){const{cell:n,startRow:r}=i[e];if(r+n.__rowSpan-1<=t){const t=i[e].cell.__headerState,n=mm(t,Jf);a.append(nm(n).append(es()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);cm(c)||om(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=am();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=mm(e,Jf);i.append(nm(r).append(es()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);cm(a)||om(257),a.insertBefore(i),l=i}return l}function _m(e=!0){const t=eo();Mi(t)||Im(t)||om(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Nm(n),[o,,s]=Nm(r),[,l,a]=Em(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?xm(c+i.__colSpan>u+o.__colSpan?i:o,!0):xm(u<c?o:i,!1)}function xm(e,t=!0,n=!0){const[,,r]=Nm(e),[i,o]=Em(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();cm(c)||om(120);let u=null;function d(e=Yf){const t=nm(e).append(es());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();cm(e)||om(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=mm(n,Xf);if(a<0){Sm(h,d(r));continue}const{cell:o,startColumn:s,startRow:l}=t[a];if(s+o.__colSpan-1<=a){let n=o,i=l,s=a;for(;i!==e&&n.__rowSpan>1;){if(s-=o.__colSpan,!(s>=0)){h.append(d(r));continue e}{const{cell:e,startRow:r}=t[s];n=e,i=r}}n.insertAfter(d(r))}else o.setColSpan(o.__colSpan+1)}null!==u&&n&&Cm(u);const g=r.getColWidths();if(g){const e=[...g],t=a<0?0:a,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function Cm(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Sm(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function vm(e){if(0===e.length)return null;const t=fm(e[0]),[n]=Tm(t,null,null);let r=1/0,i=-1/0,o=1/0,s=-1/0;const l=new Set;for(const t of n)for(const n of t){if(!n||!n.cell)continue;const t=n.cell.getKey();if(!l.has(t)&&e.some((e=>e.is(n.cell)))){l.add(t);const e=n.startRow,a=n.startColumn,c=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+c-1),o=Math.min(o,a),s=Math.max(s,a+u-1)}}if(r===1/0||o===1/0)return null;const a=i-r+1,c=s-o+1,u=n[r][o];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const h=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=o;t<=s;t++){const r=n[e][t];if(!r.cell)continue;const i=r.cell,o=i.getKey();h.has(o)||(h.add(o),wm(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append(es()),d}function wm(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!ts(t)||!t.isEmpty())}function km(e){const[t,n,r]=Nm(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=Em(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Jf,d=Array.from({length:i},((e,t)=>{let n=u;for(let e=0;0!==n&&e<s.length;e++)n&=s[e][t+a].cell.__headerState;return n})),h=t.__headerState&Xf,g=Array.from({length:o},((e,t)=>{let n=h;for(let e=0;0!==n&&e<s[0].length;e++)n&=s[t+c][e].cell.__headerState;return n}));if(i>1){for(let e=1;e<i;e++)t.insertAfter(nm(d[e]|g[0]).append(es()));t.setColSpan(1)}if(o>1){let e;for(let t=1;t<o;t++){const r=c+t,o=s[r];e=(e||n).getNextSibling(),cm(e)||om(125);let l=null;for(let e=0;e<a;e++){const t=o[e],n=t.cell;t.startRow===r&&(l=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(null===l)for(let n=i-1;n>=0;n--)Sm(e,nm(d[n]|g[t]).append(es()));else for(let e=i-1;e>=0;e--)l.insertAfter(nm(d[e]|g[t]).append(es()))}t.setRowSpan(1)}}function Em(e,t,n){const[r,i,o]=Tm(e,t,n);return null===i&&om(207),null===o&&om(208),[r,i,o]}function Tm(e,t,n){const r=[];let i=null,o=null;function s(e){let t=r[e];return void 0===t&&(r[e]=t=[]),t}const l=e.getChildren();for(let e=0;e<l.length;e++){const r=l[e];cm(r)||om(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(rm(c)||om(147);void 0!==a[u];)u++;const r={cell:c,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:h}=c;for(let t=0;t<d&&!(e+t>=l.length);t++){const n=s(e+t);for(let e=0;e<h;e++)n[u+e]=r}null!==t&&null===i&&t.is(c)&&(i=r),null!==n&&null===o&&n.is(c)&&(o=r)}}return[r,i,o]}function Nm(e){let t;if(e instanceof Qf)t=e;else if("__type"in e){const n=jl(e,rm);rm(n)||om(148),t=n}else{const n=jl(e.getNode(),rm);rm(n)||om(148),t=n}const n=t.getParent();cm(n)||om(149);const r=n.getParent();return wy(r)||om(210),[t,n,r]}function Am(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),o=Math.min(t.startRow,n.startRow),s=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){const a=e[t][n];if(!a)continue;const c=a.startColumn+a.cell.__colSpan-1,u=a.startRow+a.cell.__rowSpan-1,d=a.startColumn<=s&&c>=i,h=a.startRow<=l&&u>=o;if(d&&h){const e=Math.min(i,a.startColumn),t=Math.max(s,c),n=Math.min(o,a.startRow),d=Math.max(l,u);e===i&&t===s&&n===o&&d===l||(i=e,s=t,o=n,l=d,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:i,minRow:o}}function Lm(e){const[t,,n]=Nm(e),r=n.getChildren(),i=r.length,o=r[0].getChildren().length,s=new Array(i);for(let e=0;e<i;e++)s[e]=new Array(o);for(let e=0;e<i;e++){const n=r[e].getChildren();let i=0;for(let r=0;r<n.length;r++){for(;s[e][i];)i++;const o=n[r],l=o.__rowSpan||1,a=o.__colSpan||1;for(let t=0;t<l;t++)for(let n=0;n<a;n++)s[e+t][i+n]=o;if(t===o)return{colSpan:a,columnIndex:i,rowIndex:e,rowSpan:l};i+=a}}return null}function Om(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=jl(n,rm);rm(r)||om(238,t,n.getKey(),n.getType());const i=r.getParent();cm(i)||om(239,t);const o=i.getParent();return wy(o)||om(240,t),[n,r,i,o]}));return i.is(a)||om(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class Fm{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if("root"===this.tableKey||"root"===this.anchor.key||"element"!==this.anchor.type||"root"===this.focus.key||"element"!==this.focus.type)return!1;const e=Rs(this.tableKey),t=Rs(this.anchor.key),n=Rs(this.focus.key);return null!==e&&null!==t&&null!==n}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Im(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new Fm(this.tableKey,Fi(this.anchor.key,this.anchor.offset,this.anchor.type),Fi(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(rm).forEach((e=>{const n=e.getFirstChild();ts(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ze[e])}insertNodes(e){const t=this.focus.getNode();Ho(t)||om(151),At(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Om(this),n=Lm(e);null===n&&om(153);const r=Lm(t);null===r&&om(155);const i=Math.min(n.columnIndex,r.columnIndex),o=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),s=Math.min(n.rowIndex,r.rowIndex),l=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,o),fromY:Math.min(s,l),toX:Math.max(i,o),toY:Math.max(s,l)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(null!==e)return e;const{anchorTable:t,anchorCell:n,focusCell:r}=Om(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&om(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&om(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=Em(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=Am(o,s,l),h=new Map([[t.getKey(),t]]);let g=null;for(let e=u;e<=d;e++)for(let t=a;t<=c;t++){const{cell:n}=o[e][t],r=n.getParent();cm(r)||om(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||Pm(n,(e=>{h.set(e.getKey(),e)}))}const p=Array.from(h.values());return _o()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter((e=>rm(e)));let t="";for(let n=0;n<e.length;n++){const r=e[n],i=r.__parent,o=(e[n+1]||{}).__parent;t+=r.getTextContent()+(o!==i?"\n":"\t")}return t}}function Im(e){return e instanceof Fm}function Rm(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=eo(),i=Im(r)?r.clone():function(){const e=Fi("root",0,"element"),t=Fi("root",0,"element");return new Fm("root",e,t)}();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function Pm(e,t){const n=[[e]];for(let e=n.at(-1);void 0!==e&&n.length>0;e=n.at(-1)){const r=e.pop();void 0===r?n.pop():!1!==t(r)&&Ho(r)&&n.push(r.getChildren())}}function Mm(e,t=Dl()){const n=Rs(e);wy(n)||om(231,e);const r=Hm(n,t.getElementByKey(e));return null===r&&om(232,e),{tableElement:r,tableNode:n}}class Dm{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}}class Bm{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Mm(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver((e=>{this.editor.getEditorState().read((()=>{let t=!1;for(let n=0;n<e.length;n++){const r=e[n].target.nodeName;if("TABLE"===r||"TBODY"===r||"THEAD"===r||"TR"===r){t=!0;break}}if(!t)return;const{tableNode:n,tableElement:r}=this.$lookup();this.table=Ym(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=Ym(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(e=!0){const t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:n,tableElement:r}=this.$lookup();Xm(t,Ym(n,r),null),e&&null!==eo()&&(Ks(null),t.dispatchCommand(dn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();ja(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();qa(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&om(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Xm(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=Nl(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const n=this.editor,{tableNode:r}=this.$lookup(),i=e.x,o=e.y;if(this.focusCell=e,this.isHighlightingCells||(t||this.anchorX!==i||this.anchorY!==o||null!=this.tableSelection&&null!=this.anchorCellNodeKey)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),-1!==this.focusX&&-1!==this.focusY&&i===this.focusX&&o===this.focusY)return!1;if(this.focusX=i,this.focusY=o,this.isHighlightingCells){const s=fy(r,e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey){let e=s;if(null===e&&t&&(e=r.getCellNodeFromCords(i,o,this.table)),null!==e){const t=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=Rm(r,t,e),Ks(this.tableSelection),n.dispatchCommand(dn,void 0),Xm(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?Rs(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&om(234),e}$getFocusTableCell(){return this.focusCellNodeKey?Rs(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&om(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),n=fy(t,e.elem);if(null!==n){const e=n.getKey();null!=this.tableSelection?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)):this.tableSelection=Rm(t,n,n),this.anchorCellNodeKey=e}}$formatCells(e){const t=eo();Im(t)||om(236);const n=Ji(),r=n.anchor,i=n.focus,o=t.getNodes().filter(rm);o.length>0||om(237);const s=o[0].getFirstChild(),l=ts(s)?s.getFormatFlags(e,null):null;o.forEach((t=>{r.set(t.getKey(),0,"element"),i.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e,l)})),Ks(t),this.editor.dispatchCommand(dn,void 0)}$clearText(){const{editor:e}=this,t=Rs(this.tableNodeKey);if(!wy(t))throw new Error("Expected TableNode.");const n=eo();Im(n)||om(253);const r=n.getNodes().filter(rm),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&cm(i)&&cm(o)&&r[0]===i.getFirstChild()&&r[r.length-1]===o.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void(qo(n)&&n.isEmpty()&&e.dispatchCommand(xn,void 0))}r.forEach((e=>{if(Ho(e)){const t=es(),n=ki();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Xm(e,this.table,null),Ks(null),e.dispatchCommand(dn,void 0)}}const $m="__lexicalTableSelection";function zm(e){return Ol(e)&&"TABLE"===e.nodeName}function Hm(e,t){if(!t)return t;const n=zm(t)?t:t.querySelector("table");return zm(n)||om(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function Km(e){return e._window}function Um(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;rm(n)&&(r=n)}return null}const Wm=[[Pn,"down"],[Rn,"up"],[Fn,"backward"],[Ln,"forward"]],Vm=[wn,kn,bn],qm=[Bn,zn];function jm(e,t,n){const r=eo(),i=to();r&&!r.is(i)&&(Im(r)||Im(i))&&n.tableSelection&&!n.tableSelection.is(i)&&(Im(r)&&r.tableKey===n.tableNodeKey?n.$updateTableTableSelection(r):!Im(r)&&Im(i)&&i.tableKey===n.tableNodeKey&&n.$updateTableTableSelection(null)),n.hasHijackedSelectionStyles&&!t.isSelected()?function(e,t){t.$enableHighlightStyle(),Qm(t.table,(t=>{const n=t.elem;t.highlighted=!1,ly(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(e,n):!n.hasHijackedSelectionStyles&&t.isSelected()&&function(e,t){t.$disableHighlightStyle(),Qm(t.table,(t=>{t.highlighted=!0,sy(e,t)}))}(e,n)}function Zm(e){return e[$m]||null}function Gm(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function Jm(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;null!=r;r=r.parentNode){if(r===e)return n;const t=r.nodeName;"TD"!==t&&"TH"!==t||(n=r._cell||null)}return null}function Ym(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Hm(e,t).querySelector("tr"),o=0,s=0;for(n.length=0;null!=i;){const e=i.nodeName;if("TD"===e||"TH"===e){const e={elem:i,hasBackgroundColor:""!==i.style.backgroundColor,highlighted:!1,x:o,y:s};i._cell=e;let t=n[s];void 0===t&&(t=n[s]=[]),t[o]=e}else{const e=i.firstChild;if(null!=e){i=e;continue}}const t=i.nextSibling;if(null!=t){o++,i=t;continue}const r=i.parentNode;if(null!=r){const e=r.nextSibling;if(null==e)break;s++,o=0,i=e}}return r.columns=o+1,r.rows=s+1,r}function Xm(e,t,n){const r=new Set(n?n.getNodes():[]);Qm(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,sy(e,t)):(t.highlighted=!1,ly(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function Qm(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const r=n[e];if(r)for(let n=0;n<r.length;n++){const i=r[n];if(!i)continue;const o=Ds(i.elem);null!==o&&t(i,o,{x:n,y:e})}}}const ey=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?oy(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?oy(t.getCellNodeFromCordsOrThrow(o?0:e.table.columns-1,r+(o?1:-1),e.table),o):o?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==r?oy(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?oy(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function ty(e,t){let n,r;if(t.startColumn===e.minColumn)n="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n="maxColumn"}if(t.startRow===e.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r="maxRow"}return[n,r]}function ny([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function ry(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&om(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&om(250,n,String(s)),l}function iy(e,t){if(Mi(e)||Im(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function oy(e,t){t?e.selectStart():e.selectEnd()}function sy(e,t){const n=t.elem,r=e._config.theme;rm(Ds(n))||om(131),qa(n,r.tableCellSelected)}function ly(e,t){const n=t.elem;rm(Ds(n))||om(131);ja(n,e._config.theme.tableCellSelected)}function ay(e){const t=jl(e,rm);return rm(t)?t:null}function cy(e){const t=jl(e,wy);return wy(t)?t:null}function uy(e,t,n,r,i,o){if(("up"===n||"down"===n)&&function(e){const t=e.getRootElement();return!!t&&(t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls"))}(e))return!1;const s=eo();if(!iy(s,r)){if(Mi(s)){if("backward"===n){if(s.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(Ho(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(s.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!wy(n)&&(dy(t),t.shiftKey?s.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=s.focus.getNode();if(!s.isCollapsed()&&("up"===n&&!s.isBackward()||"down"===n&&s.isBackward())){let i=jl(e,(e=>wy(e)));if(rm(i)&&(i=jl(i,wy)),i!==r)return!1;if(!i)return!1;const o="down"===n?i.getNextSibling():i.getPreviousSibling();if(!o)return!1;let l=0;"up"===n&&Ho(o)&&(l=o.getChildrenSize());let a=o;if("up"===n&&Ho(o)){a=o.getLastChild()||o,l=Ei(a)?a.getTextContentSize():0}const c=s.clone();return c.focus.set(a.getKey(),l,Ei(a)?"text":"element"),Ks(c),dy(t),!0}if(Cl(e)){const e="up"===n?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(e&&null!==Um(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Nm(e),[o]=Nm(t),s=r.getCordsFromCellNode(n,i.table),l=r.getCordsFromCellNode(o,i.table),a=r.getDOMCellFromCordsOrThrow(s.x,s.y,i.table),c=r.getDOMCellFromCordsOrThrow(l.x,l.y,i.table);return i.$setAnchorCellForSelection(a),i.$setFocusCellForSelection(c,!0),!0}return!1}{let r=jl(e,(e=>Ho(e)&&!e.isInline()));if(rm(r)&&(r=jl(r,wy)),!r)return!1;const o="down"===n?r.getNextSibling():r.getPreviousSibling();if(wy(o)&&i.tableNodeKey===o.getKey()){const e=o.getFirstDescendant(),r=o.getLastDescendant();if(!e||!r)return!1;const[i]=Nm(e),[l]=Nm(r),a=s.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),dy(t),Ks(a),!0}}}}return"down"===n&&_y(e)&&o.setShouldCheckSelectionForTable(r.getKey()),!1}if(Mi(s)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=Ea(n.focus,i?"previous":"next");if(Ma(l))return!1;let a=l;for(const e of ya(l).iterNodeCarets("shadowRoot")){if(!ia(e)||!Ho(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!rm(c))return!1;const u=c,d=function(e){for(const t of ya(e).iterNodeCarets("root")){const{origin:n}=t;if(rm(n)){if(oa(t))return ga(n,e.direction)}else if(!cm(n))break}return null}(ca(u,a.direction)),h=jl(u,wy);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=Gm(g);if(!g||!p)return!1;const f=Cy(e,h);if(s.table=f,d)if("extend"===r){const t=Gm(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=Pa(d);Ta(n.anchor,e),Ta(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=pa(e);return oa(t)?Pa(t):e}(ca(h,l.direction));Ta(n.anchor,e),Ta(n.focus,e)}return dy(t),!0}(e,t,s,t.shiftKey?"extend":"move","backward"===n,r,i);if(s.isCollapsed()){const{anchor:l,focus:a}=s,c=jl(l.getNode(),rm),u=jl(a.getNode(),rm);if(!rm(c)||!c.is(u))return!1;const d=cy(c);if(d!==r&&null!=d){const r=Hm(d,e.getElementByKey(d.getKey()));if(null!=r)return i.table=Ym(d,r),uy(e,t,n,d,i,o)}const h=e.getElementByKey(c.__key),g=e.getElementByKey(l.key);if(null==g||null==h)return!1;let p;if("element"===l.type)p=g.getBoundingClientRect();else{const t=Nl(Km(e));if(null===t||0===t.rangeCount)return!1;p=t.getRangeAt(0).getBoundingClientRect()}const f="up"===n?c.getFirstChild():c.getLastChild();if(null==f)return!1;const m=e.getElementByKey(f.__key);if(null==m)return!1;const y=m.getBoundingClientRect();if("up"===n?y.top>p.top-p.height:p.bottom+p.height>y.bottom){dy(t);const e=r.getCordsFromCellNode(c,i.table);if(!t.shiftKey)return ey(i,r,e.x,e.y,n);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,i.table);i.$setAnchorCellForSelection(t),i.$setFocusCellForSelection(t,!0)}return!0}}}else if(Im(s)){const{anchor:o,focus:l}=s,a=jl(o.getNode(),rm),c=jl(l.getNode(),rm),[u]=s.getNodes();wy(u)||om(251);const d=Hm(u,e.getElementByKey(u.getKey()));if(!rm(a)||!rm(c)||!wy(u)||null==d)return!1;i.$updateTableTableSelection(s);const h=Ym(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),dy(t),t.shiftKey){const[e,t,o]=Em(r,a,c);return function(e,t,n,r,i){const o=Am(t,n,r),s=function(e,t){const{minColumn:n,maxColumn:r,minRow:i,maxRow:o}=t;let s=1,l=1,a=1,c=1;const u=e[i],d=e[o];for(let e=n;e<=r;e++)s=Math.max(s,u[e].cell.__rowSpan),c=Math.max(c,d[e].cell.__rowSpan);for(let t=i;t<=o;t++)l=Math.max(l,e[t][n].cell.__colSpan),a=Math.max(a,e[t][r].cell.__colSpan);return{bottomSpan:c,leftSpan:l,rightSpan:a,topSpan:s}}(t,o),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,d=function(e,t){const n=ty(e,t);return null===n&&om(249,t.cell.getKey()),n}(o,n),[h,g]=ny(d);let p=o[h],f=o[g];"forward"===i?p+="maxColumn"===h?1:a:"backward"===i?p-="minColumn"===h?1:u:"down"===i?f+="maxRow"===g?1:l:"up"===i&&(f-="minRow"===g?1:c);const m=t[f];if(void 0===m)return!1;const y=m[p];if(void 0===y)return!1;const[b,_]=function(e,t,n){const r=Am(e,t,n),i=ty(r,t);if(i)return[ry(e,r,i),ry(e,r,ny(i))];const o=ty(r,n);if(o)return[ry(e,r,ny(o)),ry(e,r,o)];const s=["minColumn","minRow"];return[ry(e,r,s),ry(e,r,ny(s))]}(t,n,y),x=py(e,b.cell),C=py(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(C,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function dy(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function hy(e,t,n){const r=es();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function gy(e,t,n){const r=n.getParent();if(!r)return;const i=Nl(Km(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Hm(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=jl(t.anchor.getNode(),(e=>rm(e)));if(!a)return;const c=jl(a,(e=>wy(e)));if(!wy(c)||!c.is(n))return;const[u,d]=Em(n,a,a),h=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:p,startColumn:f}=d,m=p===h.startRow&&f===h.startColumn,y=p===g.startRow&&f===g.startColumn;return m?"first":y?"last":void 0}function py(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function fy(e,t,n){return Um(e,Ds(t,n))}function my(e,t,n){const r=e.querySelector("colgroup");if(!r)return;const i=[];for(let e=0;e<t;e++){const t=document.createElement("col"),r=n&&n[e];r&&(t.style.width=`${r}px`),i.push(t)}r.replaceChildren(...i)}function yy(e,t,n){if(!t.theme.tableAlignment)return;const r=[],i=[];for(const e of["center","right"]){const o=t.theme.tableAlignment[e];o&&(e===n?i:r).push(o)}ja(e,...r),qa(e,...i)}const by=new WeakSet;function _y(e=Dl()){return by.has(e)}class xy extends zo{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new xy(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Sy,priority:1})}}static importJSON(e){return vy().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return"html"===n}getDOMSlot(e){const t=zm(e)?e:e.querySelector("table");return zm(t)||om(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const n=document.createElement("table");this.__style&&ii(n.style,this.__style);const r=document.createElement("colgroup");if(n.appendChild(r),function(e){e.__lexicalUnmanaged=!0}(r),qa(n,e.theme.table),this.updateTableElement(null,n,e),_y(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?qa(t,r):t.style.overflowX="auto",t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(qa(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(ja(e,n.theme.tableFrozenColumn),t.removeAttribute("data-lexical-frozen-column"))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(qa(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(ja(e,n.theme.tableFrozenRow),t.removeAttribute("data-lexical-frozen-row"))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:"")&&ii(t.style,this.__style,e?e.__style:""),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(qa(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(ja(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping);const r=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===r&&this.getColWidths()===i||my(t,this.getColumnCount(),this.getColWidths()),yy(t,n,this.getFormatType())}updateDOM(e,t,n){const r=Hm(this,t);return t===r===_y()||(Ol(i=t)&&"DIV"===i.nodeName&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}scaleDOMColWidths(e,t){const n=this.getColWidths();n&&my(Hm(this,e),this.getColumnCount(),n.map((e=>e*t)))}exportDOM(e){const t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!zm(n)&&Ol(n)&&(n=n.querySelector("table")),!zm(n))return null;yy(n,e._config,this.getFormatType());const[r]=Tm(this,null,null),i=new Map;for(const e of r)for(const t of e){const e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}const o=new Set;for(const e of n.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const t=e.getAttribute("data-temporary-table-cell-lexical-key");if(t){const n=i.get(t);if(e.removeAttribute("data-temporary-table-cell-lexical-key"),n){i.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}const s=n.querySelector(":scope > colgroup");if(s){const e=Array.from(n.querySelectorAll(":scope > colgroup > col")).filter(((e,t)=>o.has(t)));s.replaceChildren(...e)}const l=n.querySelectorAll(":scope > tr");if(l.length>0){const e=document.createElement("tbody");for(const t of l)e.appendChild(t);n.append(e)}return n},element:!zm(n)&&Ol(n)?n.querySelector("table"):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:r}=t;for(let t=0;t<n;t++){const n=r[t];if(null!=n)for(let r=0;r<n.length;r++){const i=n[r];if(null==i)continue;const{elem:o}=i,s=fy(this,o);if(null!==s&&e.is(s))return{x:r,y:t}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:r}=n,i=r[t];if(null==i)return null;const o=i[e<i.length?e:i.length-1];return null==o?null:o}getDOMCellFromCordsOrThrow(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(null==r)return null;const i=Ds(r.elem);return rm(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){const r=this.getCellNodeFromCords(e,t,n);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return Boolean(this.getLatest().__rowStriping)}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach((e=>{rm(e)&&(t+=e.getColSpan())})),t}}function Cy(e,t){const n=e.getElementByKey(t.getKey());return null===n&&om(230),Ym(t,n)}function Sy(e){const t=vy();e.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),e.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),e.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const n=e.querySelector(":scope > colgroup");if(n){let e=[];for(const t of n.querySelectorAll(":scope > col")){let n=t.style.width||"";if(!Zf.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>xu(e,cm),node:t}}function vy(){return vl(new xy)}function wy(e){return e instanceof xy}function ky(e){cm(e.getParent())?e.isEmpty()&&e.append(es()):e.remove()}function Ey(e){wy(e.getParent())?bu(e,rm):e.remove()}function Ty(e){bu(e,cm);const[t]=Tm(e,null,null),n=t.reduce(((e,t)=>Math.max(e,t.length)),0),r=e.getChildren();for(let e=0;e<t.length;++e){const i=r[e];if(!i)continue;cm(i)||om(254,i.constructor.name,i.getType());const o=t[e].reduce(((e,t)=>t?1+e:e),0);if(o!==n)for(let e=o;e<n;++e){const e=nm();e.append(es()),i.append(e)}}const i=e.getColWidths(),o=e.getColumnCount();if(i&&i.length!==o){let t;if(o<i.length)t=i.slice(0,o);else if(i.length>0){const e=i[i.length-1];t=[...i,...Array(o-i.length).fill(e)]}e.setColWidths(t)}}function Ny(e){if(e.detail<3||!Fl(e.target))return!1;const t=Ds(e.target);if(null===t)return!1;const n=jl(t,(e=>Ho(e)&&!e.isInline()));return null!==n&&(!!rm(n.getParent())&&(n.select(0),!0))}function Ay(){const e=eo();if(!Mi(e))return!1;const t=cy(e.anchor.getNode());if(null===t)return!1;const n=zs();if(!n.is(t.getParent())||1!==n.getChildrenSize())return!1;const[r]=Tm(t,null,null);if(0===r.length||0===r[0].length)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const o=r[r.length-1],s=o[o.length-1];if(!s||!s.cell)return!1;return Ks(Rm(t,i.cell,s.cell)),!0}function Ly(e,t=!0){const n=new Dm,r=(r,i,o)=>{const s=Hm(r,o),l=function(e,t,n,r,i){const o=n.getRootElement(),s=Km(n);null!==o&&null!==s||om(246);const l=new Bm(n,e.getKey()),a=Hm(e,t);!function(e,t){null!==Zm(e)&&om(205),e[$m]=t}(a,l),l.listenersToRemove.add((()=>function(e,t){Zm(e)===t&&delete e[$m]}(a,l)));const c=e=>{e.detail>=3&&Fl(e.target)&&null!==Gm(e.target)&&e.preventDefault()};a.addEventListener("mousedown",c,l.listenerOptions),l.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));for(const[t,r]of Wm)l.listenersToRemove.add(n.registerCommand(t,(t=>uy(n,t,r,e,l,i)),3));l.listenersToRemove.add(n.registerCommand($n,(t=>{const n=eo();if(Im(n)){const r=Um(e,n.focus.getNode());if(null!==r)return dy(t),r.selectEnd(),!0}return!1}),3));const u=t=>()=>{const n=eo();if(!iy(n,e))return!1;if(Im(n))return l.$clearText(),!0;if(Mi(n)){if(!rm(Um(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),i=n.focus.getNode(),o=e.isParentOf(r),s=e.isParentOf(i);if(o&&!s||s&&!o)return l.$clearText(),!0;const a=jl(n.anchor.getNode(),(e=>Ho(e))),c=a&&jl(a,(e=>Ho(e)&&rm(e.getParent())));if(!Ho(c)||!Ho(a))return!1;if(t===kn&&null===c.getPreviousSibling())return!0}return!1};for(const e of Vm)l.listenersToRemove.add(n.registerCommand(e,u(e),3));const d=t=>{const n=eo();if(!Im(n)&&!Mi(n))return!1;const r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){const t=r?"anchor":"focus",i=r?"focus":"anchor",{key:o,offset:s,type:l}=n[i];return e[n[t].isBefore(n[i])?"selectPrevious":"selectNext"]()[i].set(o,s,l),!1}return!!iy(n,e)&&!!Im(n)&&(t&&(t.preventDefault(),t.stopPropagation()),l.$clearText(),!0)};for(const e of qm)l.listenersToRemove.add(n.registerCommand(e,d,3));return l.listenersToRemove.add(n.registerCommand(Yn,(e=>{const t=eo();if(t){if(!Im(t)&&!Mi(t))return!1;Gh(n,fu(e,ClipboardEvent)?e:null,Xh(t));const r=d(e);return Mi(t)?(t.removeText(),!0):r}return!1}),3)),l.listenersToRemove.add(n.registerCommand(En,(t=>{const n=eo();if(!iy(n,e))return!1;if(Im(n))return l.$formatCells(t),!0;if(Mi(n)){const e=jl(n.anchor.getNode(),(e=>rm(e)));if(!rm(e))return!1}return!1}),3)),l.listenersToRemove.add(n.registerCommand(qn,(t=>{const n=eo();if(!Im(n)||!iy(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!rm(r)||!rm(i))return!1;if(function(e,t){if(Im(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=Em(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;const[o,s,l]=Em(e,r,i),a=Math.max(s.startRow+s.cell.__rowSpan-1,l.startRow+l.cell.__rowSpan-1),c=Math.max(s.startColumn+s.cell.__colSpan-1,l.startColumn+l.cell.__colSpan-1),u=Math.min(s.startRow,l.startRow),d=Math.min(s.startColumn,l.startColumn),h=new Set;for(let e=u;e<=a;e++)for(let n=d;n<=c;n++){const r=o[e][n].cell;if(h.has(r))continue;h.add(r),r.setFormat(t);const i=r.getChildren();for(let e=0;e<i.length;e++){const n=i[e];Ho(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),3)),l.listenersToRemove.add(n.registerCommand(Cn,(t=>{const r=eo();if(!iy(r,e))return!1;if(Im(r))return l.$clearHighlight(),!1;if(Mi(r)){const i=jl(r.anchor.getNode(),(e=>rm(e)));if(!rm(i))return!1;if("string"==typeof t){const i=gy(n,r,e);if(i)return hy(i,e,[ki(t)]),!0}}return!1}),3)),r&&l.listenersToRemove.add(n.registerCommand(Hn,(t=>{const n=eo();if(!Mi(n)||!n.isCollapsed()||!iy(n,e))return!1;const r=ay(n.anchor.getNode());return!(null===r||!e.is(cy(r))||(dy(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",i=e[n]();if(Ho(i))return i.selectEnd();const o=jl(e,cm);null===o&&om(247);for(let e=o[n]();cm(e);e=e[n]()){const t=e[r]();if(Ho(t))return t.selectEnd()}const s=jl(o,wy);null===s&&om(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),3)),l.listenersToRemove.add(n.registerCommand(rr,(t=>e.isSelected()),3)),l.listenersToRemove.add(n.registerCommand(xn,(()=>{const t=eo();if(!Mi(t)||!t.isCollapsed()||!iy(t,e))return!1;const r=gy(n,t,e);return!!r&&(hy(r,e),!0)}),3)),l}(r,s,e,t,n);n.observers.set(i,[l,s])};return Za(function(e,t){const n=e.getRootElement(),r=e._window;if(!n||!r)return()=>{};const i=r=>{const i=r.target;if(0!==r.button||!Fl(i)||!n.contains(i))return;const o=function(e){const t=Gm(e);if(null===t)return null;let n=t.elem;for(;null!=n;){if("TABLE"===n.nodeName&&$m in n&&n[$m])return{cellElement:t,tableElement:n,tableObserver:n[$m]};n=n.parentNode}return null}(i);e.update((()=>{if(Im(eo())){for(const[e]of t.observers.values())e.$clearHighlight(!1);Ks(null),e.dispatchCommand(dn,void 0)}if(!o)return;const{tableObserver:n,tableElement:i,cellElement:s}=o;!function(e,t,n,r,i,o){const s=e._window;if(!s)return;i.pointerType=t.pointerType;const l=kl(i.tableNodeKey),a=to();if(hm&&t.shiftKey&&iy(a,l)&&(Mi(a)||Im(a))){const e=a.anchor.getNode(),r=Um(l,a.anchor.getNode());r?(i.$setAnchorCellForSelection(py(i,r)),i.$setFocusCellForSelection(n),dy(t)):(l.isBefore(e)?l.selectStart():l.selectEnd()).anchor.set(a.anchor.key,a.anchor.offset,a.anchor.type)}else"touch"!==t.pointerType&&i.$setAnchorCellForSelection(n);(t=>{if(i.isSelecting)return;i.isSelecting=!0,null!==t&&null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)}));const n=()=>{i.isSelecting=!1,s.removeEventListener("pointerup",n),s.removeEventListener("pointermove",l)},l=t=>{if(!(e=>!(1&~e.buttons))(t)&&i.isSelecting)return i.isSelecting=!1,s.removeEventListener("pointerup",n),void s.removeEventListener("pointermove",l);if(!Fl(t.target))return;let a=null;const c=!(hm||r.contains(t.target));if(c)a=Jm(r,t.target);else for(const e of document.elementsFromPoint(t.clientX,t.clientY))if(a=Jm(r,e),a)break;if(a){const t=a;null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)})),null!==i.focusCell&&a.elem===i.focusCell.elem||(o.setNextFocus({focusCell:a,override:c,tableKey:i.tableNodeKey}),e.dispatchCommand(dn,void 0))}};s.addEventListener("pointerup",n,i.listenerOptions),s.addEventListener("pointermove",l,i.listenerOptions)})(n)}(e,r,s,i,n,t)}))};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i)}}(e,n),e.registerCommand(dn,(()=>function(e,t){const n=eo(),r=to(),i=e.getAndClearNextFocus();if(null!==i){const{tableKey:t,focusCell:r}=i,o=e.observers.get(t);o||om(335,t);const[s]=o;if(Im(n)&&n.tableKey===s.tableNodeKey)return(r.x!==s.focusX||r.y!==s.focusY)&&(s.$setFocusCellForSelection(r),!0);if(null!==s.anchorCell&&null!==s.anchorCellNodeKey&&r.elem!==s.anchorCell.elem&&null!==s.tableSelection)return s.$setFocusCellForSelection(r,!0),!0}const o=e.getAndClearShouldCheckSelectionForTable();if(o&&Mi(r)&&Mi(n)&&n.isCollapsed()){const e=kl(o),t=n.anchor.getNode(),r=e.getFirstChild(),i=ay(t);if(null!==i&&cm(r)){const t=r.getFirstChild();if(rm(t)&&e.is(jl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}Im(n)&&function(e,t){const n=Km(e),r=to();if(!t.is(r))return;const i=kl(t.tableKey),o=Nl(n);if(o&&o.anchorNode&&o.focusNode){const n=Ds(o.focusNode),r=n&&!i.isParentOf(n),s=Ds(o.anchorNode),l=s&&i.isParentOf(s);if(r&&l&&o.rangeCount>0){const n=Xi(o,e);n&&(n.anchor.set(i.getKey(),t.isBackward()?i.getChildrenSize():0,"element"),o.removeAllRanges(),Ks(n))}}}(t,n),Mi(n)&&function(e,t){const n=to(),{anchor:r,focus:i}=e,o=r.getNode(),s=i.getNode(),l=ay(o),a=ay(s),c=l?cy(l):null,u=a?cy(a):null,d=e.isBackward(),h=l&&a&&c&&u&&c.is(u),g=u&&(!c||c.isParentOf(u)),p=c&&(!u||u.isParentOf(c));if(g){const t=e.clone(),[n]=Em(u,a,a),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.focus.set(d?r.getKey():i.getKey(),d?0:i.getChildrenSize(),"element"),Ks(t)}else if(p){const t=e.clone(),[n]=Em(c,l,l),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.anchor.set(d?i.getKey():r.getKey(),d?i.getChildrenSize():0,"element"),Ks(t)}else if(h){const r=t.observers.get(c.getKey());r||om(335,c.getKey());const[i]=r;if(l.is(a)||(i.$setAnchorCellForSelection(py(i,l)),i.$setFocusCellForSelection(py(i,a),!0)),"touch"===i.pointerType&&i.isSelecting&&e.isCollapsed()&&Mi(n)&&n.isCollapsed()){const e=ay(n.anchor.getNode());e&&!e.is(a)&&(i.$setAnchorCellForSelection(py(i,e)),i.$setFocusCellForSelection(py(i,a),!0),i.pointerType=null)}}}(n,e);const s=Array.from(e.observers.entries()).map((([e,[t]])=>({tableNode:kl(e),tableObserver:t})));for(const{tableNode:e,tableObserver:n}of s)jm(t,e,n);return!1}(n,e)),3),e.registerMutationListener(xy,(t=>{e.getEditorState().read((()=>{for(const[e,i]of t){const t=n.observers.get(e);if("created"===i||"updated"===i){const{tableNode:i,tableElement:o}=Mm(e);void 0===t?r(i,e,o):o!==t[1]&&(t[0].removeListeners(),n.observers.delete(e),r(i,e,o))}else"destroyed"===i&&void 0!==t&&(t[0].removeListeners(),n.observers.delete(e))}}),{editor:e})}),{skipInitialization:!1}),(()=>{for(const[,[e]]of n.observers)e.removeListeners()}))}function Oy(e,t){e.hasNodes([xy])||om(255);const{hasNestedTables:n=Mu(!1)}={};return Za(e.registerCommand(im,(e=>function({rows:e,columns:t,includeHeaders:n},r){const i=eo()||to();if(!i||!Mi(i))return!1;if(!r&&cy(i.anchor.getNode()))return!1;const o=function(e,t,n=!0){const r=vy();for(let i=0;i<e;i++){const e=am();for(let r=0;r<t;r++){let t=Yf;"object"==typeof n?(0===i&&n.rows&&(t|=Xf),0===r&&n.columns&&(t|=Jf)):n&&(0===i&&(t|=Xf),0===r&&(t|=Jf));const o=nm(t),s=es();s.append(ki()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);hu(o);const s=o.getFirstDescendant();return Ei(s)&&s.select(),!0}(e,n.peek())),0),e.registerCommand(hn,((t,r)=>e===r&&function(e,t){const{nodes:n,selection:r}=e;if(!n.some((e=>wy(e)||cu(e).some((e=>wy(e.node))))))return!1;const i=Im(r),o=Mi(r);return!!(o&&null!==jl(r.anchor.getNode(),(e=>rm(e)))&&null!==jl(r.focus.getNode(),(e=>rm(e)))||i)&&(1===n.length&&wy(n[0])?function(e,t){const n=t.getStartEndPoints(),r=Im(t);if(null===n)return!1;const[i,o]=n,[s,l,a]=Nm(i),c=jl(o.getNode(),(e=>rm(e)));if(!(rm(s)&&rm(c)&&cm(l)&&wy(a)))return!1;const[u,d,h]=Em(a,s,c),[g]=Tm(e,null,null),p=u.length,f=p>0?u[0].length:0;let m=d.startRow,y=d.startColumn,b=g.length,_=b>0?g[0].length:0;if(r){const e=Am(u,d,h),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;m=e.minRow,y=e.minColumn,b=Math.min(b,t),_=Math.min(_,n)}let x=!1;const C=Math.min(p,m+b)-1,S=Math.min(f,y+_)-1,v=new Set;for(let e=m;e<=C;e++)for(let t=y;t<=S;t++){const n=u[e][t];v.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(km(n.cell),v.add(n.cell.getKey()),x=!0)}let[w]=Tm(a.getWritable(),null,null);const k=b-p+m;for(let e=0;e<k;e++)bm(w[p-1][0].cell);const E=_-f+y;for(let e=0;e<E;e++)xm(w[0][f-1].cell,!0,!1);[w]=Tm(a.getWritable(),null,null);for(let e=m;e<m+b;e++)for(let t=y;t<y+_;t++){const n=e-m,r=t-y,i=g[n][r];if(i.startRow!==n||i.startColumn!==r)continue;const o=i.cell;if(1!==o.__rowSpan||1!==o.__colSpan){const n=[],r=Math.min(e+o.__rowSpan,m+b)-1,i=Math.min(t+o.__colSpan,y+_)-1;for(let o=e;o<=r;o++)for(let e=t;e<=i;e++){const t=w[o][e];n.push(t.cell)}vm(n),x=!0}const{cell:s}=w[e][t],l=o.getBackgroundColor();null!=l&&s.setBackgroundColor(l);const a=s.getChildren();o.getChildren().forEach((e=>{Ei(e)?(es().append(e),s.append(e)):s.append(e)})),a.forEach((e=>e.remove()))}if(r&&x){const[e]=Tm(a.getWritable(),null,null);e[d.startRow][d.startColumn].cell.selectEnd()}return!0}(n[0],r):!(o&&t.peek()&&!function(e){return!(!Im(e)||e.focus.getNode().is(e.anchor.getNode()))||!(!Mi(e)||!rm(e.anchor.getNode())||e.anchor.getNode().is(e.focus.getNode()))}(r)))}(t,n)),0),e.registerCommand(Xn,Ay,1),e.registerCommand(gn,Ny,0),e.registerNodeTransform(xy,Ty),e.registerNodeTransform(sm,Ey),e.registerNodeTransform(Qf,ky))}let Fy=null;function Iy(){return Fy&&Fy.isConnected||(Fy=document.createElement("div"),Fy.setAttribute("aria-hidden","true"),Fy.setAttribute("data-lexxy-style-resolver",""),Fy.style.cssText="contain: strict; position: fixed; top: 0; left: 0; visibility: hidden; pointer-events: none; width: 0; height: 0;",document.body.appendChild(Fy)),Fy}function Ry(e){return!!Mi(e)&&(e.isCollapsed()?Py(e.style):e.hasFormat("highlight"))}function Py(e){const t="string"==typeof e?gc(e):e;return!(!t.color&&!t["background-color"])}class My{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#Ke}applyCanonicalization(e){const t={...gc(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Ja(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#Ue(e)}get#Ke(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#Ue(e){let t=this.#We.indexOf(e);return-1===t&&(t=this.#We.indexOf(Dy(this._property,[e])[0])),-1===t?null:this._allowedValues[t]}get#We(){return this._computedAllowedValues||=Dy(this._property,this._allowedValues)}}function Dy(e,t){const n=document.createDocumentFragment(),r=t.map((t=>{const r=xc("span",{style:`display: none; ${e}: ${t};`});return n.appendChild(r),r}));Iy().appendChild(n);const i=r.map((t=>window.getComputedStyle(t).getPropertyValue(e)));return r.forEach((e=>e.remove())),i}const By=un(),$y=un(),zy={color:null,"background-color":null},Hy=pt("hasPastedStyles",{parse:e=>e||!1}),Ky=new WeakMap;class Uy extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[$g],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:Vy}},register(e,t){const n=function(e){return[new My("color",[...e.buttons.color,...e.permit.color]),new My("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return function(e){if(!e._htmlConversions)return;let t=e._htmlConversions.get("pre");t||(t=[],e._htmlConversions.set("pre",t));t.push(function(e){return function(t){const n=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t={};e.style?.color&&(t.color=e.style.color);e.style?.backgroundColor&&(t["background-color"]=e.style.backgroundColor);const n=Ja(t);return n.length>0?n:null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(t);return 0===n.length?null:{conversion:t=>{const r=Kp(t.getAttribute("data-language"));return qy(e).set(r.getKey(),n),{node:r}},priority:2}}}(e))}(e),Za(e.registerCommand(By,(t=>Jy(e,t)),2),e.registerCommand($y,(()=>Jy(e,zy)),2),e.registerNodeTransform(mi,tb),e.registerNodeTransform(Jp,nb),e.registerNodeTransform(mi,(e=>function(e,t=[]){if(function(e){return ft(e,Hy)}(e)){rb(e,!1);const n=function(e,t=[]){return t.reduce(((e,t)=>t.applyCanonicalization(e)),e)}(e.getStyle(),t);e.setStyle(n);const r=eo();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}(e,n))),e.registerMutationListener(Hp,(t=>{!function(e,t){const n=qy(e),r=[];for(const[e,i]of t)"destroyed"!==i&&n.has(e)&&r.push(e);if(0===r.length)return;e.update((()=>{for(const e of r){const t=n.get(e);if(n.delete(e),!t)continue;const r=Rs(e);r&&Up(r)&&jy(r,t)}}),{skipTransforms:!0,discrete:!0})}(e,t)}),{skipInitialization:!0}))}},this.editorConfig.get("highlight")]}}function Wy(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};gl(Zr)&&rb(e);const r=Ja(n);if(r.length)return e.setStyle(e.getStyle()+r)}function Vy(){return{conversion:hp("mark",Wy),priority:1}}function qy(e){let t=Ky.get(e);return t||(t=new Map,Ky.set(e,t)),t}function jy(e,t){if(0!==t.length)for(const{start:n,end:r,style:i}of t){const t=Zy(e);for(const{node:e,start:o,end:s}of t){if(!Qp(e))continue;const t=Math.max(n,o),l=Math.min(r,s);if(t>=l)continue;const a=t-o,c=l-o,u=s-o;if(0===a&&c===u)e.setStyle(i),Qy(e,!0);else{const t=e.getTextContent(),n=e.getHighlightType(),r=[];a>0&&r.push(Xp(t.slice(0,a),n));const o=Xp(t.slice(a,c),n);o.setStyle(i),Qy(o,!0),r.push(o),c<u&&r.push(Xp(t.slice(c),n));for(const t of r)e.insertBefore(t);e.remove()}}}}function Zy(e){const t=[];let n=0;for(const r of e.getChildren())if(Qp(r)||Ei(r)){const e=r.getTextContent();t.push({node:r,start:n,end:n+e.length}),n+=e.length}else n+=1;return t}function Gy(e){const t=[],n=Zy(e);for(const{node:e,start:r,end:i}of n){const n=e.getStyle();n&&Py(n)&&t.push({start:r,end:i,style:n})}return t}function Jy(e,t){const n=eo();if(!Mi(n))return;const r={};for(const e in t){const i=hc(n,e);r[e]=eb(i,t[e])}!function(e){const t=e.getNodes();return t.some((e=>Qp(e)||Ei(e)?Up(e.getParent()):Up(e)))}(n)?function(e,t){if(Mi(e)&&e.isCollapsed()){tc(e,t);const n=e.anchor.getNode();Ho(n)&&n.isEmpty()&&tc(n,t)}nc((e=>{tc(e,t)}));const n=e.getNodes();if(n.length>0){const e=new Set;for(const r of n){if(!Ho(r)||!r.canBeEmpty()||0!==r.getChildrenSize())continue;const n=r.getKey();e.has(n)||(e.add(n),tc(r,t))}}}(n,r):function(e,t,n){const r=t.getNodes().filter((e=>(Qp(e)||Ei(e))&&Up(e.getParent()))).map((e=>({key:e.getKey(),startOffset:Yy(e,t)[0],endOffset:Yy(e,t)[1],textSize:e.getTextContentSize()})));e.update((()=>{const t=new Set;for(const{key:e,startOffset:i,endOffset:o,textSize:s}of r){const r=Rs(e);if(!r)continue;const l=r.getParent();if(Up(l)&&i!==o)if(t.add(l),0===i&&o===s)Xy(r,n);else{Xy(r.splitText(i,o)[0===i?0:1],n)}}for(const n of t){const t=Gy(n);t.length>0&&qy(e).set(n.getKey(),t)}}),{skipTransforms:!0,discrete:!0})}(e,n,r)}function Yy(e,t){const n=e.getKey(),r=n===t.anchor.key,i=n===t.focus.key;let o=0,s=e.getTextContentSize();return!1===t.isBackward()?(r&&(o=t.anchor.offset),i&&(s=t.focus.offset)):(i&&(o=t.focus.offset),r&&(s=t.anchor.offset)),[o,s]}function Xy(e,t){const n={...gc(e.getStyle())};for(const[e,r]of Object.entries(t))null===r?delete n[e]:n[e]=r;const r=Ja(n);e.setStyle(r);const i=Py(r);i!==e.hasFormat("highlight")&&Qy(e,i)}function Qy(e,t){const n=e.getWritable();t?n.__format|=128:n.__format&=-129}function eb(e,t){return e===t?null:t}function tb(e){Py(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function nb(e){if(!Up(e.getParent()))return;const t=Py(e.getStyle());t!==e.hasFormat("highlight")&&Qy(e,t)}function rb(e,t=!0){mt(e,Hy,t)}const ib=["bold","italic","strikethrough","underline","link","unlink","toggleHighlight","removeHighlight","setFormatHeadingLarge","setFormatHeadingMedium","setFormatHeadingSmall","setFormatParagraph","clearFormatting","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","setCodeLanguage","insertHorizontalDivider","uploadImage","uploadFile","insertTable","undo","redo"];class ob{#Ve=null;#e=new bc;static configureFor(e){return new ob(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.#qe(),this.#je(),this.#Ze()}dispatchBold(){this.editor.dispatchCommand(En,"bold")}dispatchItalic(){this.editor.dispatchCommand(En,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(En,"strikethrough")}dispatchUnderline(){this.editor.dispatchCommand(En,"underline")}dispatchToggleHighlight(e){this.editor.dispatchCommand(By,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand($y)}dispatchLink(e){this.editor.update((()=>{const t=eo();if(!Mi(t))return;const n=t.anchor.getNode();if(t.isCollapsed()&&!uu(n,hd)){const n=yd(e),r=ki(e);n.append(r),t.insertNodes([n])}else xd(e)}))}dispatchUnlink(){this.editor.update((()=>{this.editorElement.adapter.unlinkFrozenNode?.()||xd(null)}))}dispatchInsertUnorderedList(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===ap(t)?this.contents.applyParagraphFormat():this.contents.applyUnorderedListFormat()}dispatchInsertOrderedList(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===ap(t)?this.contents.applyParagraphFormat():this.contents.applyOrderedListFormat()}dispatchInsertQuoteBlock(){this.contents.toggleBlockquote()}dispatchInsertCodeBlock(){this.selection.hasSelectedWordsInSingleLine?this.#Ge():this.contents.toggleCodeBlock()}#Ge(){const e=eo();if(Mi(e)){if(!e.isCollapsed()){const t=e.getNodes().filter(Ei);!t.every((e=>e.hasFormat("code")))&&this.#Je(e,t)}this.editor.dispatchCommand(En,"code")}}#Je(e,t){const n=e.isBackward(),r=n?e.focus:e.anchor,i=n?e.anchor:e.focus;for(let e=0;e<t.length;e++){const n=t[e];if(0===n.getFormat())continue;const o=0===e,s=e===t.length-1,l=o&&"text"===r.type?r.offset:0,a=s&&"text"===i.type?i.offset:n.getTextContentSize();if(0===l&&a===n.getTextContentSize())n.setFormat(0);else{const e=n.splitText(l,a),t=0===l?e[0]:e[1];t.setFormat(0),o&&"text"===r.type&&r.set(t.getKey(),0,"text"),s&&"text"===i.type&&i.set(t.getKey(),a-l,"text")}}}dispatchSetCodeLanguage(e){this.editor.update((()=>{if(!this.selection.isInsideCodeBlock)return;const t=this.selection.nearestNodeOfType(Hp);t&&t.setLanguage(e)}))}dispatchInsertHorizontalDivider(){hu(new Kf)}dispatchSetFormatHeadingLarge(){this.contents.applyHeadingFormat("h2")}dispatchSetFormatHeadingMedium(){this.contents.applyHeadingFormat("h3")}dispatchSetFormatHeadingSmall(){this.contents.applyHeadingFormat("h4")}dispatchSetFormatParagraph(){this.contents.applyParagraphFormat()}dispatchClearFormatting(){this.contents.clearFormatting()}dispatchUploadImage(){this.#Ye("image/*,video/*")}dispatchUploadFile(){this.#Ye()}#Ye(e=null){const t={type:"file",multiple:!0,style:"display: none;",onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}};e&&(t.accept=e);const n=xc("input",t);this.editorElement.appendChild(n),n.click(),setTimeout((()=>n.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(im,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(Tn,void 0)}dispatchRedo(){this.editor.dispatchCommand(Nn,void 0)}dispose(){this.#e.dispose()}#qe(){for(const t of ib){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#Xe(t,0,this[n].bind(this))}var e}#Xe(e,t,n){this.#e.track(this.editor.registerCommand(e,n,t))}#je(){this.#Xe(Ln,2,this.#Qe.bind(this)),this.#Xe(Hn,2,this.#et.bind(this)),this.#Xe(_n,3,this.#tt.bind(this)),this.#Xe(xn,3,this.#tt.bind(this))}#tt(){return function(e=eo()){!!vp(e)&&At(e)}(),!1}#Qe(e){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;if(this.selection.isInsideCodeBlock||!t.hasFormat("code"))return!1;const n=t.anchor.getNode();return!(!Ei(n)||t.anchor.offset!==n.getTextContentSize())&&(null===n.getNextSibling()&&(e.preventDefault(),t.toggleFormat("code"),!0))}#Ze(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.#e.track(this.editor.registerRootListener((e=>{if(e){const t=[yc(e,"dragover",this.#nt.bind(this)),yc(e,"drop",this.#rt.bind(this)),yc(e,"dragenter",this.#it.bind(this)),yc(e,"dragleave",this.#ot.bind(this))];return()=>t.forEach((e=>e()))}}))))}#it(e){this.#st(e)||(this.dragCounter++,1===this.dragCounter&&(this.#lt(),this.editor.getRootElement().classList.add("lexxy-editor--drag-over")))}#ot(e){this.#st(e)||(this.dragCounter--,0===this.dragCounter&&(this.#Ve=null,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")))}#nt(e){this.#st(e)||e.preventDefault()}#rt(e){if(this.#st(e))return;e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);n.length&&(this.#at(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#lt(){this.editor.getEditorState().read((()=>{this.#Ve=eo()?.clone()}))}#at(){this.#Ve&&(this.editor.update((()=>{Ks(this.#Ve)})),this.#Ve=null)}#st(e){return e.dataTransfer?.types.some((e=>e.startsWith("application/x-lexxy-")))}#et(e){return this.selection.isInsideList?this.#ct(e):!!this.selection.isInsideCodeBlock&&this.#ut()}#ct(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Wn:Un;return this.editor.dispatchCommand(t)}#ut(){const e=eo();return Mi(e)&&e.isCollapsed()}}class sb{#e=new bc;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#dt(),this.#ht(),this.#gt(),this.#pt()}get hasNodeSelection(){return this.editor.getEditorState().read((()=>{const e=eo();return null!==e&&Bi(e)}))}get cursorPosition(){let e=null;return this.editor.getEditorState().read((()=>{const t=this.#ft();if(!t)return;const n=this.#mt(t);this.#yt(n)||(e=this.#bt(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=zs(),t=e.getLastDescendant();t&&Ei(t)?t.selectEnd():e.selectEnd()}))}selectedNodeWithOffset(){const e=eo();if(!e)return{node:null,offset:0};if(Mi(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(Bi(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}getFormat(){const e=eo();if(!Mi(e))return{};const t=e.anchor.getNode();if(!t.getParent())return{};const n=t.getTopLevelElementOrThrow(),r=ap(t),i=this.#_t(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isUnderline:e.hasFormat("underline"),isHighlight:Ry(e),isInLink:null!==uu(t,hd),isInQuote:Ng(n),isInHeading:null!==i,isInCode:this.#xt(e,t),headingTag:i?.getTag()??null,isInList:null!==r,listType:r,isInTable:null!==gm(t)}}nearestNodeOfType(e){const t=eo()?.anchor?.getNode();return uu(t,e)}get hasSelectedWordsInSingleLine(){const e=eo();if(!Mi(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;const r=t.getTopLevelElement();if(!r)return!1;const i=Ho(t)?t:t.getParent();if(i!==(Ho(n)?n:n.getParent())&&i!==r)return!1;const o=e.getNodes();for(const e of o)if(ai(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(Bd)}get isInsideBlockQuote(){return this.nearestNodeOfType(Eg)}get isIndentedList(){const e=this.nearestNodeOfType(Ud);return e&&kd(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(Hp)}get isTableCellSelected(){const e=eo(),{anchor:t,focus:n}=e;return!(!Mi(e)||t.key!==n.key)&&null!==this.nearestNodeOfType(Qf)}get isOnPreviewableImage(){return null!=this.previewableImageNode}get previewableImageNode(){const e=eo()?.getNodes().at(0);return Ap(e)&&e.isPreviewableImage?e:null}get isAtNodeStart(){const{anchorNode:e,offset:t}=this.#Ct();return e&&0===t}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ct();return e?Ei(e)?this.#St(e,t):Ho(e)?this.#vt(e,t):this.#wt(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ct();if(!e)return null;if(Ei(e)){if(t===e.getTextContentSize())return this.#kt(e);if(this.#Et(e)){const t=e.getTopLevelElement();return t?t.getNextSibling():null}return null}return Ho(e)?this.#vt(e,t):this.#wt(e)}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ct();return e?Ei(e)?this.#Tt(e,t):Ho(e)?this.#Nt(e,t):this.#At(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ct();if(!e)return null;if(Ei(e)){if(0===t)return this.#Lt(e);if(this.#Ot(e)){const t=e.getTopLevelElement();return t?t.getPreviousSibling():null}return null}return Ho(e)?this.#Nt(e,t):this.#At(e)}dispose(){this.editorElement=null,this.editorContentElement=null,this.editor=null,this.previouslySelectedKeys=null,this.#e.dispose()}#xt(e,t){return null!==uu(t,Hp)||!!e.hasFormat("code")&&(Ei(t)&&t.hasFormat("code"))}#pt(){this.#e.track(this.editor.registerUpdateListener((({editorState:e,tags:t})=>{if(t.has("history-merge")||t.has("skip-dom-selection"))return;let n=!1;e.read((()=>{const e=eo();if(!Mi(e)||!e.isCollapsed())return;if(!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#xt(e,t)||(n=!0)})),n&&setTimeout((()=>{this.editor.update((()=>{const e=eo();if(!Mi(e)||!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#xt(e,t)||e.toggleFormat("code")}))}),0)})))}get#Ft(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;const e=eo();if(e&&Bi(e))for(const t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#ht(){this.#e.track(this.editor.registerCommand(Fn,_c(this.#It.bind(this)),1),this.editor.registerCommand(Ln,_c(this.#Rt.bind(this)),1),this.editor.registerCommand(Rn,_c(this.#Pt.bind(this)),1),this.editor.registerCommand(Pn,_c(this.#Mt.bind(this)),1),this.editor.registerCommand(bn,this.#Dt.bind(this),1),this.editor.registerCommand(dn,(()=>{this.#Bt()}),1))}#dt(){this.#e.track(this.editor.registerCommand(gn,(({target:e})=>{if(!Fl(e))return!1;const t=Ds(e);return Wo(t)&&this.#$t(t)}),1)),this.#e.track(this.editor.registerRootListener((e=>{if(e)return yc(e,"lexxy:internal:move-to-next-line",(()=>this.#zt()))})))}#gt(){this.#e.track(this.editor.registerRootListener((e=>{if(e){const t=e=>this.#Ht(e);return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)}})))}#Ht(e){if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}#Bt(){this.#Kt(),this.#Ut(),this.previouslySelectedKeys=this.#Ft,this.currentlySelectedKeys=null}#Kt(){for(const e of this.previouslySelectedKeys)if(!this.#Ft.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Ut(){for(const e of this.#Ft)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}#It(e){return e.shiftKey?this.#Wt((e=>(this.#Vt(e,"forward").modify("extend",!0,"character"),!0))):this.#Wt((e=>e.selectPrevious()))||this.#$t(this.nodeBeforeCursor)}#Rt(e){return e.shiftKey?this.#Wt((e=>(this.#Vt(e,"forward").modify("extend",!1,"character"),!0))):this.#Wt((e=>e.selectNext(0,0)))||this.#$t(this.nodeAfterCursor)}#Pt(){return this.#Wt((e=>e.getTopLevelElement().selectPrevious()))||this.#$t(this.topLevelNodeBeforeCursor)}#Mt(){return this.#Wt((e=>e.getTopLevelElement().selectNext(0,0)))||this.#$t(this.topLevelNodeAfterCursor)}#Wt(e){if(this.hasNodeSelection)return e(eo().getNodes()[0])}#Vt(e,t="forward"){if(Wo(e)){const[n,r]="forward"===t?[0,1]:[1,0],i=e.getIndexWithinParent();return e.getParent().select(i+n,i+r)}}async#zt(){this.editor.update((()=>{const e=this.#qt();e&&this.#jt(e)}))}#qt(){const e=eo();return e?Bi(e)?this.#Zt(e):Mi(e)?this.#Gt(e):null:null}#Zt(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Gt(e){return e.anchor.getNode().getTopLevelElement()}#_t(e){const t=e.getTopLevelElementOrThrow();let n=Rg(t)?t:null;if(!n){let t=e.getParent();for(;t;){if(Rg(t)){n=t;break}t=t.getParent()}}return n}#jt(e){const t=e.getNextSibling();t?t.selectStart():this.#Jt()}#Jt(){const e=zs(),t=es();e.append(t),t.selectStart()}#$t(e){if(Wo(e)){pl(jr);const t=function(...e){const t=Yi();return e.forEach((e=>t.add(e.getKey()))),t}(e);return Ks(t),t}return!1}#Dt(e){if(e&&this.#Yt())return!0;const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;if(!Wo(t))return!1;if(this.#Xt(t))return!0;this.#Qt();const n=this.#$t(t);return Boolean(n)}#Yt(){const e=eo();if(!Mi(e)||!e.isCollapsed())return!1;const t=uu(e.anchor.getNode(),Bd);if(!t)return!1;if(!function(e){const t=e.getChildren();for(const e of t){if(Wo(e))return!1;if(!ai(e))if(Ei(e)){if(""!==e.getTextContent().trim())return!1}else if(Ho(e)&&""!==e.getTextContent().trim())return!1}return!0}(t))return!1;const n=t.getNextSibling();if(!n)return!1;const r=t.getPreviousSibling(),i=uu(t,Ud);if(!i)return!1;if(r)r.selectEnd(),t.remove();else if(Ng(i.getParent()))n.selectStart(),t.remove();else{const e=es();i.insertBefore(e),t.remove(),e.selectStart()}return!0}#Xt(e){const t=eo()?.anchor?.getNode(),n=t&&uu(t,Bd);if(!n)return!1;if(n.isParentOf(e))return!1;const r=uu(n,Ud);if(!r)return!1;const i=es();return n.getChildren().forEach((e=>i.append(e))),1===r.getChildrenSize()?(r.insertBefore(i),r.remove()):(r.insertBefore(i),n.remove()),i.selectStart(),!0}#Qt(e=eo()?.anchor){const t=e?.getNode();Ho(t)&&t?.isEmpty()&&t.remove()}#ft(){const e=eo();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#mt(e){let t=e.getBoundingClientRect();if(this.#yt(t)){const n=this.#en(e);t=n.getBoundingClientRect(),this.#tn(n),n.remove()}return t}#yt(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#en(e){const t=this.#nn();return e.insertNode(t),t}#nn(){const e=document.createElement("span");return e.textContent="",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",mc()),e}#tn(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#bt(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#rn(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#rn(e){const t=window.getSelection().anchorNode,n=this.#in(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#in(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Ct(){const e=eo();if(!Mi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#St(e,t){return t===e.getTextContentSize()?this.#kt(e):null}#kt(e){const t=e.getNextSibling();if(Wo(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getNextSibling():null}#vt(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#wt(e)}#Tt(e,t){return 0===t?this.#Lt(e):null}#Lt(e){const t=e.getPreviousSibling();if(Wo(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getPreviousSibling():null}#Nt(e,t){return t>0?e.getChildAtIndex(t-1):this.#At(e)}#wt(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#At(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}#Ot(e){return this.#on(e,"first")}#Et(e){return this.#on(e,"last")}#on(e,t){const n=e.getTopLevelElement();if(!n)return!1;const r=this.editor.getElementByKey(n.getKey());if(!r)return!1;const i=window.getSelection();if(!i?.rangeCount)return!1;const o=this.#mt(i.getRangeAt(0));if(!o||this.#yt(o))return!1;const s=this.#sn(r,t);if(!s||this.#yt(s))return!1;const l=s.height>0?.5*s.height:5;return Math.abs(o.top-s.top)<l}#sn(e,t){const n=document.createTreeWalker(e,4);let r;if("first"===t)r=n.nextNode();else for(;n.nextNode();)r=n.currentNode;if(!r||0===r.length)return null;const i=document.createRange();return"first"===t?(i.setStart(r,0),i.setEnd(r,1)):(i.setStart(r,r.length-1),i.setEnd(r,r.length)),i.getBoundingClientRect()}}class lb{#he;#ln;constructor(e){this.#he=e,this.#ln=new Kg(qg.presets.get("default"),qg.presets.get(e.preset),this.#an)}get(e){return this.#ln.get(e)}get#an(){const e={};for(const t of this.#cn){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#he.hasAttribute(n)&&(e[t]=this.#un(n))}return e}get#cn(){return Object.keys(qg.presets.get("default"))}#un(e){const t=this.#he.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class ab extends zo{$config(){return this.config("image_gallery",{extends:zo})}static transform(){return e=>{e.unwrapEmptyNode()||e.replaceWithSingularChild()||e.splitAroundInvalidChild()}}static importDOM(){return{div:e=>this.#dn(e)?{conversion:()=>({node:cb()}),priority:2}:null}}static canCollapseWith(e){return ub(e)||this.isValidChild(e)}static isValidChild(e){return Ap(e)&&e.isPreviewableImage}static#dn(e){const t=e.querySelectorAll(`:scope > :is(${this.#hn.join()})`);return""===e.textContent.trim()&&t.length>0&&e.children.length===t.length}static get#hn(){return Object.keys(Tp.importDOM())}createDOM(){const e=document.createElement("div");return e.className=this.#gn,e}updateDOM(e,t){return t.className=this.#gn,!1}canBeEmpty(){return!0}collapseAtStart(e){return!0}insertNewAfter(e,t){if(e.anchor.getNode().is(this)&&e.anchor.offset==this.getChildrenSize()-1){const e=es();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}const n=cb();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(Ap)}exportDOM(){const e=document.createElement("div");return e.className=this.#gn,{element:e}}collapseWith(e,t){return!!ab.canCollapseWith(e)&&(t?yu(this,e):this.append(e),bu(this,ab.isValidChild),!0)}unwrapEmptyNode(){if(this.isEmpty()){const e=es();return this.replace(e)}}replaceWithSingularChild(){if(this.#pn){const e=this.getFirstChild();return this.replace(lp(e))}}splitAroundInvalidChild(){for(const e of Cu(this)){if(ab.isValidChild(e))continue;const t=lp(e),[n,r]=this.splitAtIndex(t.getIndexWithinParent());n.insertAfter(t),t.selectEnd(),r.isEmpty()&&r.remove();break}}splitAtIndex(e){return Al(this,e)}get#pn(){return 1===this.getChildrenSize()}get#gn(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}}function cb(){return new ab}function ub(e){return e instanceof ab}function db(e){if(!ab.canCollapseWith(e))return null;return uu(e,ab)??pu(e,cb)}class hb{#fn;static for(e,t,n={}){return new(gb.handle(e,t)?gb:hb)(e,t,n)}constructor(e,t,n={}){this.#fn=t,this.options=n,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#fn)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map((e=>this.#mn(e)))}#mn(e){return this.options.pending?this.contents.$createPendingUploadNode(e):this.contents.$createUploadNode(e)}$insertUploadNodes(){this.contents.insertAtCursor(...this.nodes)}}class gb extends hb{#yn;static handle(e,t){return this.isMultipleImageUpload(t)||this.gallerySelection(e.selection)}static isMultipleImageUpload(e){let t=0;for(const n of e)if(Sc(n.type)&&t++,t>1)return!0;return!1}static gallerySelection(e){return e.isOnPreviewableImage||this.selectionIsAfterGalleryEdge(e)}static selectionIsAfterGalleryEdge(e){return e.isAtNodeStart&&ab.canCollapseWith(e.nodeBeforeCursor)}$insertUploadNodes(){this.#bn(),this.#_n(),this.#xn()}#bn(){this.selection.isOnPreviewableImage?this.#yn=db(this.selection.previewableImageNode):this.#Cn?this.#yn=db(this.selection.nodeBeforeCursor):(this.#yn=cb(),this.contents.insertAtCursor(this.#yn))}get#Cn(){return this.constructor.selectionIsAfterGalleryEdge(this.selection)}get#Sn(){const{node:e}=this.selection.selectedNodeWithOffset();return e}get#vn(){if(this.#Cn)return this.#yn.getChildrenSize();const e=eo()?.anchor,t=e?.getNode().is(this.#yn);if(t)return e.offset;const n=this.#Sn,r=this.#yn.isParentOf(n)&&n.getIndexWithinParent();return!1!==r?r+1:0}get#wn(){return this.nodes.filter((e=>ab.isValidChild(e)))}get#kn(){return this.nodes.filter((e=>!ab.isValidChild(e)))}#_n(){this.#yn.splice(this.#vn,0,this.#wn)}#xn(){let e=this.#yn;for(const t of this.#kn)e.insertAfter(t),e=t}}class pb extends Tp{static getType(){return"action_text_attachment_upload"}static clone(e){return new pb({...e},e.__key)}static importJSON(e){return new pb({...e})}static importDOM(){return null}constructor(e,t){const{file:n,uploadUrl:r,blobUrlTemplate:i,progress:o,width:s,height:l,uploadError:a,fileName:c,contentType:u}=e;super({...e,contentType:n?.type??u},t),this.file=n??null,this.fileName=n?.name??c,this.uploadUrl=r,this.blobUrlTemplate=i,this.progress=o??null,this.width=s,this.height=l,this.uploadError=a}createDOM(){if(this.uploadError)return this.createDOMForError();this.#En();const e=this.isPreviewableAttachment&&null!=this.uploadUrl,t=this.createAttachmentFigure(e);if(e){const e=t.appendChild(this.#ve());(async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))})(this.file,e).then((e=>this.#Tn(e)))}else t.appendChild(this.#ke());return t.appendChild(this.#Nn()),t.appendChild(this.#An()),t}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;if(e.progress!==this.progress){t.querySelector("progress").value=this.progress??0}return!1}exportDOM(){return{element:null}}exportJSON(){return{...super.exportJSON(),type:"action_text_attachment_upload",version:1,fileName:this.fileName,contentType:this.contentType,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,progress:this.progress,width:this.width,height:this.height,uploadError:this.uploadError}}get#Ln(){return null!==this.progress}#ve(){return xc("img")}#ke(){return xc("span",{className:"attachment__icon",textContent:this.#On()})}#On(){return(this.fileName||"").split(".").pop().toLowerCase()}#Nn(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("span",{className:"attachment__name",textContent:this.caption||this.fileName||""}),n=xc("span",{className:"attachment__size",textContent:Gg(this.file?.size)});return e.appendChild(t),e.appendChild(n),e}#An(){return xc("progress",{value:this.progress??0,max:100})}#Tn({width:e,height:t}){this.#Fn||this.patchAndRewriteHistory({width:e,height:t})}get#Fn(){return Boolean(this.width&&this.height)}async#En(){if(this.#Ln)return;if(!this.uploadUrl)return;this.#In();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#Rn(),this.#Pn("lexxy:upload-start",{file:this.file}),t.create(((e,t)=>{this.#Mn(),e?(this.#Pn("lexxy:upload-end",{file:this.file,error:e}),this.#Dn(e)):(this.#Pn("lexxy:upload-end",{file:this.file,error:null}),this.editor.update((()=>{this.$showUploadedAttachment(t)})))}))}#Rn(){const e=qg.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0),this.#Bn(t);t.upload.addEventListener("progress",(e=>this.#$n(e,t)))}}}#Mn(){this.#he.uploadRequests.forget(this.getKey())}#Bn(e){this.#he.uploadRequests.track(this.getKey(),e)}get#he(){return this.editor.getRootElement()?.closest("lexxy-editor")}#In(){this.#zn(1)}#$n(e,t){const n=Math.round(e.loaded/e.total*100);try{this.#zn(n),this.#Pn("lexxy:upload-progress",{file:this.file,progress:n})}catch{t.abort()}}#zn(e){this.patchAndRewriteHistory({progress:e})}#Dn(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.patchAndRewriteHistory({uploadError:!0})}$showUploadedAttachment(e){const t=this.isPreviewableImage&&this.file?URL.createObjectURL(this.file):null,n=this.#Hn(e,t);return this.replaceAndRewriteHistory(n),n.getKey()}#Hn(e,t){return new fb(this,e,t).toAttachmentNode()}#Pn(e,t){const n=this.editor.getElementByKey(this.getKey());n&&vc(n,e,t)}}class fb{constructor(e,t,n){this.uploadNode=e,this.blob=t,this.previewSrc=n}toAttachmentNode(){return new Tp({...this.uploadNode,...this.#Kn,src:this.#Un,previewSrc:this.previewSrc,pendingPreview:this.blob.previewable&&!this.uploadNode.isPreviewableImage})}get#Kn(){const{blob:e}=this;return{sgid:e.attachable_sgid,altText:e.filename,contentType:e.content_type,fileName:e.filename,fileSize:e.byte_size,previewable:e.previewable,previewStatusUrl:e.preview_status_url}}get#Un(){return this.blob.previewable?this.blob.url:this.#Wn}get#Wn(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}function mb(...e){return new pb(...e)}class yb{constructor(e){this.selection=e}}const bb=[class extends yb{static handles(e){return uu(e.anchor?.getNode(),Hp)}insertNodes(e){this.selection.isCollapsed()||this.selection.removeText(),rc(this.selection);const t=this.selection.focus.getNode(),n=uu(t,Hp),r=$a(n,(t.is(n)?0:t.getIndexWithinParent())+1,"previous"),i=new Set(e.filter((e=>e.isAttached()))),o=[];for(const t of e){if(i.has(t)){if(!t.isAttached())continue}else if(!this.#Vn(t)){o.push(t);continue}r.getNodeAtCaret()&&Ho(t)&&r.insert(li()),r.insert(this.#qn(t))}const s=this.#jn(n,o)??r.getNodeAtCaret();s?.selectEnd()}#Vn(e){return Ei(e)||ai(e)}#jn(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return t.at(-1)}#qn(e){return ai(e)?e:(e.remove(),ki(e.getTextContent()))}},class extends yb{static handles(e){return sp(e?.anchor?.getNode())}insertNodes(e){const t=this.selection.anchor.getNode(),n=es();t.append(n),n.selectStart().insertNodes(e)}},class extends yb{static handles(e){return Bi(e)&&e.getNodes().length>0}insertNodes(e){let t=this.selection.getNodes().at(-1);for(const n of e){const e=this.#Zn(t)?lp(n):n;t=t.insertAfter(e)}}#Zn(e){return e.is(e.getTopLevelElement())}},class extends yb{static handles(e){return Mi(e)&&uu(e.anchor.getNode(),Bd)}insertNodes(e){e.some((e=>this.#Gn(e)))?this.#Jn(e):this.selection.insertNodes(e)}#Jn(e){this.selection.isCollapsed()||this.selection.removeText();const t=this.selection.anchor.getNode(),n=this.#Yn(t),r=this.#Xn(t,n),i=fp(r)?r.getPreviousSibling():r,o=i?i.getIndexWithinParent()+1:0,[s,l]=Al(n,o);fp(r)&&r.remove();let a=s??l;for(const t of e)a.insertAfter(t),a=t;this.#Qn(s),this.#Qn(l),e.at(-1).selectNext()}#Yn(e){return[e,...e.getParents()].reverse().find(Gd)}#Xn(e,t){return[e,...e.getParents()].find((e=>Kd(e)&&e.getParent()?.is(t)))}#Qn(e){Gd(e)&&e.isEmpty()&&e.remove()}#Gn(e){return Wo(e)&&!e.isInline()}},class extends yb{static handles(e){return vp(e)}insertNodes(e){At(this.selection),this.selection.insertNodes(e)}}];yb.for=e=>{const t=bb.find((t=>t.handles(e)));return t?new t(e):e};class _b{constructor(e){this.doc=e}format(){return this.#er(),this.#tr(),this.#nr(),this.#rr(),this.doc}#er(){for(const e of this.doc.querySelectorAll("a")){const t=e.getAttribute("href")||"";""!==t&&"#"!==t||e.replaceWith(...e.childNodes)}}#tr(){for(const e of this.doc.querySelectorAll("td, th"))e.style.removeProperty("background-color"),e.style.removeProperty("background"),e.style.removeProperty("color")}#nr(){for(const e of this.doc.querySelectorAll("ol, ul"))for(const t of Array.from(e.children)){if("OL"!==t.tagName&&"UL"!==t.tagName)continue;const e=t.previousElementSibling;e&&"LI"===e.tagName&&e.appendChild(t)}}#rr(){for(const e of this.doc.querySelectorAll("ol, ul"))for(const t of Array.from(e.childNodes))t.nodeType===Node.ELEMENT_NODE&&"LI"===t.tagName||e.removeChild(t)}}class xb{constructor(e){this.editorElement=e,this.editor=e.editor}dispose(){this.editorElement=null,this.editor=null}get selection(){return this.editorElement.selection}insertHtml(e,{tag:t}={}){this.insertDOM(Cc(e),{tag:t})}insertDOM(e,{tag:t}={}){this.editor.update((()=>{gl(Zr)&&this.#ir(e);const t=this.editorElement.$generateNodesFromDOM(e);gl(Zr)&&this.#or(t)||this.#sr(t)||this.insertAtCursor(...t)}),{tag:t})}insertText(e,{tag:t}={}){this.editor.update((()=>{const t=es();e.split("\n").forEach(((e,n)=>{n>0&&t.append(li()),t.append(ki(e))})),this.insertAtCursor(t)}),{tag:t})}insertAtCursor(...e){const t=this.#lr();yb.for(t).insertNodes(e)}applyParagraphFormat(){const e=eo();Mi(e)&&(bp(e,(e=>du(e))),oc(e,(()=>es())))}applyHeadingFormat(e){const t=eo();Mi(t)&&(bp(t),oc(t,(()=>Ig(e))))}applyUnorderedListFormat(){this.#ar("bullet",Yd)}applyOrderedListFormat(){this.#ar("number",Xd)}clearFormatting(){const e=eo();Mi(e)&&(nc((e=>{e.setFormat(0),e.setStyle("")})),xd(null),this.#cr(e).filter(Ng).forEach((e=>this.#ur(e))),oc(e,(()=>es())))}toggleCodeBlock(){const e=eo();if(!Mi(e))return;if(this.#dr(Kp("plain")))return;const t=this.#hr(e);if(t.every(Up))t.forEach((e=>this.#gr(e)));else{bp(e);const t=this.#pr(this.#hr(e));if(0===t.length)return;const n=Kp("plain");t.at(-1).insertAfter(n),n.selectEnd(),this.insertAtCursor(...t)}}toggleBlockquote(){const e=eo();if(!Mi(e))return;if(this.#dr(Tg()))return;const t=this.#cr(e);if(t.length>0&&t.every(Ng))t.forEach((e=>this.#ur(e)));else{t.filter(Ng).forEach((e=>this.#ur(e))),bp(e);const n=this.#cr(e);if(0===n.length)return;const r=Tg();n[0].insertBefore(r),n.forEach((e=>r.append(e)))}}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=eo();e=Mi(t)&&!t.isCollapsed()})),e}createLink(e){let t=null;return this.editor.update((()=>{const n=ki(e),r=pd(e);r.append(n);const i=eo();Mi(i)&&(yb.for(i).insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{xd(null),xd(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Ei(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s).lastIndexOf(e);-1!==l&&(t=o.slice(l+e.length,this.#fr(o,s)))})),t}#fr(e,t){const n=e.slice(t).search(/\s/);return-1===n?e.length:t+n}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Ei(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s);t=l.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t];const{anchorNode:n,offset:r}=this.#mr();if(!n)return;const i=this.#yr(n,r,e);-1!==i&&this.#br(n,i,e,t)}uploadFiles(e,{selectLast:t}={}){if(!this.editorElement)return;if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");const n=Array.from(e).filter((e=>this.editorElement.acceptsFile(e)));this.editor.update((()=>{const e=hb.for(this.editorElement,n);if(e.$uploadFiles(),t&&e.nodes?.length){e.nodes.at(-1).selectEnd(),this.#_r()}}))}$createUploadNode(e){return mb({file:e,uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}$createPendingUploadNode(e){return mb({file:e,uploadUrl:null,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}insertPendingAttachment(e){if(!this.editorElement.supportsAttachments)return null;let t=null;return this.editor.update((()=>{const n=this.$createPendingUploadNode(e);this.insertAtCursor(n),t=n.getKey()})),t?this.#xr(t):null}insertPendingAttachments(e){const t=Array.from(e);if(!this.editorElement.supportsAttachments||0===t.length)return[];let n=[];return this.editor.update((()=>{const e=hb.for(this.editorElement,t,{pending:!0});e.$uploadFiles(),n=(e.nodes??[]).map((e=>e.getKey()))})),n.map((e=>this.#xr(e)))}#xr(e){const t=this.editor;let n=e;return{setAttributes(e){t.update((()=>{const t=Rs(n);if(!(t instanceof pb))return;const r=t.$showUploadedAttachment(e);r&&(n=r)}),{tag:jr})},setUploadProgress(e){t.update((()=>{const t=Rs(n);t instanceof pb&&(t.getWritable().progress=e)}),{tag:jr})},remove(){t.update((()=>{const e=Rs(n);e&&e.remove()}))}}}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Rs(e);if(!r)return;const i=eo();let o=!1;if(Mi(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&Ks(null)}const s=n.attachment?this.#Cr(t,n.attachment):this.#Sr(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Rs(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#Cr(t,n.attachment):this.#Sr(t);i.insertAfter(o)}))}#lr(){const e=eo();return Bi(e)&&0===e.getNodes().length?zs().selectEnd():e??zs().selectEnd()}#ir(e){new _b(e).format()}#or(e){return this.editor.dispatchCommand(hn,{nodes:e,selection:eo()})}#dr(e){const t=eo();if(!Mi(t))return!1;const n=t.anchor.getNode();return!!Cl(n)&&(n.append(e),e.selectEnd(),!0)}#gr(e){const t=e.getChildren(),n=[[]];for(const e of t)ai(e)?n.push([]):n[n.length-1].push(e.getTextContent());for(const t of n){const n=es(),r=t.join("");r&&n.append(ki(r)),e.insertBefore(n)}e.remove()}#ar(e,t){this.selection.isInsideBlockQuote?this.#vr(e):(this.#wr(),this.editor.dispatchCommand(t))}#vr(e){for(const t of function(e){const t=[...e].sort(((e,t)=>e.getIndexWithinParent()-t.getIndexWithinParent())),n=[];for(const e of t){const t=n.at(-1),r=t?.at(-1);r&&r.getParent().is(e.getParent())&&r.getNextSibling()?.is(e)?t.push(e):n.push([e])}return n}(this.#kr()))this.#Er(t,e)}#kr(){const e=eo();if(!Mi(e))return[];return this.#pr(this.#hr(e)).filter((e=>Ng(e.getParent())))}#Er(e,t){const n=Zd(t);e[0].insertBefore(n);for(const t of e){const e=Hd();Gd(t)?e.append(...t.getChildren().flatMap((e=>e.getChildren()))):e.append(...t.getChildren()),n.append(e),t.remove()}}#wr(){if(this.selection.isInsideList)return;const e=eo();Mi(e)&&(bp(e),function(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}for(const e of t){if(!ts(e))continue;const t=e.getChildren();if(!t.some(ai))continue;const n=[[]];for(const e of t)ai(e)?(n.push([]),e.remove()):n[n.length-1].push(e);for(const t of n){if(0===t.length)continue;const n=es();t.forEach((e=>n.append(e))),e.insertBefore(n)}n.some((e=>e.length>0))&&e.remove()}}(e))}#hr(e){const t=new Set;for(const n of e.getNodes())t.add(du(n));return Array.from(t)}#cr(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}return Array.from(t)}#pr(e){return e.filter((t=>e.every((e=>e===t||!t.getParents().includes(e)))))}#sr(e){if(e.every(Ap)){const t=hb.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#ur(e){const t=e.getChildren();0==t.length?e.insertBefore(es()):t.forEach((t=>{if(Ei(t)&&""!==t.getTextContent().trim()){const n=es();n.append(t),e.insertBefore(n)}else ai(t)||e.insertBefore(t)})),e.remove()}#mr(){const e=eo();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Ei(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#yr(e,t,n){const r=e.getTextContent(),i=r.slice(0,t).lastIndexOf(n[0]);return-1!==i&&r.startsWith(n,i)?i:-1}#br(e,t,n,r){const i=e.getTextContent(),o=i.slice(0,t),s=i.slice(t+n.length),l=this.#Tr(e,o),a=this.#Tr(e,s||" ");e.replace(l);this.#Nr(l,r).insertAfter(a),this.#Ar(a.getParentOrThrow());const c=s?0:1;a.select(c,c)}#Tr(e,t){return ki(t).setFormat(e.getFormat()).setDetail(e.getDetail()).setMode(e.getMode()).setStyle(e.getStyle())}#Nr(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Ar(e){if(ts(e)&&this.editorElement.supportsMultiLine){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Ei(n)&&""===n.getTextContent()&&r&&!Ei(r)&&e.append(li())}}#Cr(e,t={}){const n="object"==typeof t?t:{},r=n.contentType||"text/html";return this.editorElement.permitsAttachmentContentType(r)?new Jg({sgid:n.sgid||null,contentType:r,innerHtml:e}):this.#Sr(e)}#Sr(e){return this.editorElement.$generateNodesFromDOM(Cc(e))[0]||es()}#_r(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();if(!sp(t))return;const n=es();t.append(n),n.selectStart()}}function Cb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Sb={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function vb(e){Sb=e}var wb={exec:()=>null};function kb(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(Eb.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Eb={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Tb=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Nb=/(?:[*+-]|\d{1,9}[.)])/,Ab=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Lb=kb(Ab).replace(/bull/g,Nb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ob=kb(Ab).replace(/bull/g,Nb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Fb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ib=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rb=kb(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ib).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pb=kb(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Nb).getRegex(),Mb="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Db=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Bb=kb("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Db).replace("tag",Mb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$b=kb(Fb).replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex(),zb={blockquote:kb(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$b).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Rb,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Tb,html:Bb,lheading:Lb,list:Pb,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:$b,table:wb,text:/^[^\n]+/},Hb=kb("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex(),Kb={...zb,lheading:Ob,table:Hb,paragraph:kb(Fb).replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Hb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex()},Ub={...zb,html:kb("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Db).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:wb,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:kb(Fb).replace("hr",Tb).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Lb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Wb=/^( {2,}|\\)\n(?!\s*$)/,Vb=/[\p{P}\p{S}]/u,qb=/[\s\p{P}\p{S}]/u,jb=/[^\s\p{P}\p{S}]/u,Zb=kb(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qb).getRegex(),Gb=/(?!~)[\p{P}\p{S}]/u,Jb=kb(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Yb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Xb=kb(Yb,"u").replace(/punct/g,Vb).getRegex(),Qb=kb(Yb,"u").replace(/punct/g,Gb).getRegex(),e_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",t_=kb(e_,"gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,qb).replace(/punct/g,Vb).getRegex(),n_=kb(e_,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Gb).getRegex(),r_=kb("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,qb).replace(/punct/g,Vb).getRegex(),i_=kb(/\\(punct)/,"gu").replace(/punct/g,Vb).getRegex(),o_=kb(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),s_=kb(Db).replace("(?:--\x3e|$)","--\x3e").getRegex(),l_=kb("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",s_).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),a_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,c_=kb(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",a_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),u_=kb(/^!?\[(label)\]\[(ref)\]/).replace("label",a_).replace("ref",Ib).getRegex(),d_=kb(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ib).getRegex(),h_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,g_={_backpedal:wb,anyPunctuation:i_,autolink:o_,blockSkip:Jb,br:Wb,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:wb,emStrongLDelim:Xb,emStrongRDelimAst:t_,emStrongRDelimUnd:r_,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:c_,nolink:d_,punctuation:Zb,reflink:u_,reflinkSearch:kb("reflink|nolink(?!\\()","g").replace("reflink",u_).replace("nolink",d_).getRegex(),tag:l_,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:wb},p_={...g_,link:kb(/^!?\[(label)\]\((.*?)\)/).replace("label",a_).getRegex(),reflink:kb(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",a_).getRegex()},f_={...g_,emStrongRDelimAst:n_,emStrongLDelim:Qb,url:kb(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",h_).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:kb(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",h_).getRegex()},m_={...f_,br:kb(Wb).replace("{2,}","*").getRegex(),text:kb(f_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},y_={normal:zb,gfm:Kb,pedantic:Ub},b_={normal:g_,gfm:f_,breaks:m_,pedantic:p_},__={"&":"&","<":"<",">":">",'"':""","'":"'"},x_=e=>__[e];function C_(e,t){if(t){if(Eb.escapeTest.test(e))return e.replace(Eb.escapeReplace,x_)}else if(Eb.escapeTestNoEncode.test(e))return e.replace(Eb.escapeReplaceNoEncode,x_);return e}function S_(e){try{e=encodeURI(e).replace(Eb.percentDecode,"%")}catch{return null}return e}function v_(e,t){let n=e.replace(Eb.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Eb.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Eb.slashPipe,"|");return r}function w_(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function k_(e,t,n,r,i){let o=t.href,s=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:s,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}var E_=class{options;rules;lexer;constructor(e){this.options=e||Sb}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:w_(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map((e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=w_(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:w_(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=w_(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,s=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))s.push(e[t]),o=!0;else{if(o)break;s.push(e[t])}e=e.slice(t);let l=s.join("\n"),a=l.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${l}`:l,r=r?`${r}\n${a}`:a;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(a,i,!0),this.lexer.state.top=c,0===e.length)break;let u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,o=t.raw+"\n"+e.join("\n"),s=this.blockquote(o);i[i.length-1]=s,n=n.substring(0,n.length-t.raw.length)+s.raw,r=r.substring(0,r.length-t.text.length)+s.text;break}if("list"!==u?.type);else{let t=u,o=t.raw+"\n"+e.join("\n"),s=this.list(o);i[i.length-1]=s,n=n.substring(0,n.length-u.raw.length)+s.raw,r=r.substring(0,r.length-t.raw.length)+s.raw,e=o.substring(i.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),s=!1;for(;e;){let n=!1,r="",l="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!a.trim(),d=0;if(this.options.pedantic?(d=2,l=a.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,l=a.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),o=this.rules.other.headingBeginRegex(d),s=this.rules.other.htmlBeginRegex(d);for(;e;){let h,g=e.split("\n",1)[0];if(c=g,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),h=c):h=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||s.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())l+="\n"+h.slice(d);else{if(u||a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(a)||o.test(a)||n.test(a))break;l+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),a=h.slice(d)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(l),g&&(h="[ ] "!==g[0],l=l.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:l,tokens:[]}),i.raw+=r}let l=i.items.at(-1);if(!l)return;l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=v_(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(let e of i)o.rows.push(v_(e,o.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]}))));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=w_(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),k_(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return k_(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,s=o,l=0,a="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=a.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){s+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){l+=i;continue}if(s-=i,s>0)continue;i=Math.min(i,i+s+l);let t=[...r[0]][0].length,a=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}let c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},T_=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Sb,this.options.tokenizer=this.options.tokenizer||new E_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Eb,block:y_.normal,inline:b_.normal};this.options.pedantic?(t.block=y_.pedantic,t.inline=b_.pedantic):this.options.gfm&&(t.block=y_.gfm,this.options.breaks?t.inline=b_.breaks:t.inline=b_.gfm),this.tokenizer.rules=t}static get rules(){return{block:y_,inline:b_}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Eb.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Eb.tabCharGlobal," ").replace(Eb.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&"paragraph"===o?.type?(o.raw+=(o.raw.endsWith("\n")?"":"\n")+r.raw,o.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,o="";for(;e;){let r;if(i||(o=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(o=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},N_=class{options;parser;constructor(e){this.options=e||Sb}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Eb.notSpaceStart)?.[0],i=e.replace(Eb.endingNewline,"")+"\n";return r?'<pre><code class="language-'+C_(r)+'">'+(n?i:C_(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:C_(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+C_(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${C_(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=S_(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+C_(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=S_(e);if(null===i)return C_(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${C_(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:C_(e.text)}},A_=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},L_=class e{options;renderer;textRenderer;constructor(e){this.options=e||Sb,this.options.renderer=this.options.renderer||new N_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new A_}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let o=i;switch(o.type){case"space":n+=this.renderer.space(o);continue;case"hr":n+=this.renderer.hr(o);continue;case"heading":n+=this.renderer.heading(o);continue;case"code":n+=this.renderer.code(o);continue;case"table":n+=this.renderer.table(o);continue;case"blockquote":n+=this.renderer.blockquote(o);continue;case"list":n+=this.renderer.list(o);continue;case"html":n+=this.renderer.html(o);continue;case"def":n+=this.renderer.def(o);continue;case"paragraph":n+=this.renderer.paragraph(o);continue;case"text":{let i=o,s=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],s+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let o=i;switch(o.type){case"escape":case"text":n+=t.text(o);break;case"html":n+=t.html(o);break;case"link":n+=t.link(o);break;case"image":n+=t.image(o);break;case"strong":n+=t.strong(o);break;case"em":n+=t.em(o);break;case"codespan":n+=t.codespan(o);break;case"br":n+=t.br(o);break;case"del":n+=t.del(o);break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},O_=class{options;block;constructor(e){this.options=e||Sb}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?T_.lex:T_.lexInline}provideParser(){return this.block?L_.parse:L_.parseInline}},F_=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=L_;Renderer=N_;TextRenderer=A_;Lexer=T_;Tokenizer=E_;Hooks=O_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){let t=this.defaults.renderer||new N_(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new E_(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new O_;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];O_.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&O_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return o.call(t,n)})();let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await o.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return T_.lex(e,t??this.defaults)}parser(e,t){return L_.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?T_.lex:T_.lexInline)(n,i),o=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(o,i.walkTokens));let s=await(i.hooks?await i.hooks.provideParser():e?L_.parse:L_.parseInline)(o,i);return i.hooks?await i.hooks.postprocess(s):s})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?T_.lex:T_.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?L_.parse:L_.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+C_(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function I_(e,t){return F_.parse(e,t)}I_.options=I_.setOptions=function(e){return F_.setOptions(e),I_.defaults=F_.defaults,vb(I_.defaults),I_},I_.getDefaults=Cb,I_.defaults=Sb,I_.use=function(...e){return F_.use(...e),I_.defaults=F_.defaults,vb(I_.defaults),I_},I_.walkTokens=function(e,t){return F_.walkTokens(e,t)},I_.parseInline=F_.parseInline,I_.Parser=L_,I_.parser=L_.parse,I_.Renderer=N_,I_.TextRenderer=A_,I_.Lexer=T_,I_.lexer=T_.lex,I_.Tokenizer=E_,I_.Hooks=O_,I_.parse=I_,I_.options,I_.setOptions,I_.use,I_.walkTokens,I_.parseInline,L_.parse,T_.lex;class R_{#e=new bc;constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents,this.#Lr()}dispose(){this.editorElement=null,this.editor=null,this.contents=null,this.#e.dispose()}paste(e){const t=e.clipboardData;if(!t)return!1;if(this.#Or())return this.#Fr(t),e.preventDefault(),!0;if(this.#Ir(t))return this.#Rr(t),e.preventDefault(),!0;const n=this.#Pr(t);return n&&e.preventDefault(),n}#Lr(){this.#e.track(this.editor.registerCommand(Sn,this.paste.bind(this),2),this.editor.registerCommand(hn,(e=>this.#Mr(e)),2))}#Mr({nodes:e,selection:t}){const n=function(e){if(1!==e.length)return null;const t=e[0];if(fd(t))return P_(t);if(ts(t)){const e=t.getChildren();if(1===e.length&&fd(e[0]))return P_(e[0])}return null}(e);if(n&&Mi(t))return this.#Dr(t,n),!0}#Ir(e){return this.#Br(e)||this.#$r(e)}#Br(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#$r(e){const t=Array.from(e.types);return t.length&&t.length<=2&&t.includes("text/uri-list")&&(t.length<2||t.includes("text/plain"))}#Or(){let e=!1;return this.editor.getEditorState().read((()=>{const t=eo();if(!Mi(t))return;let n=t.anchor.getNode();for(;n;){if(Up(n))return void(e=!0);n=n.getParent()}})),e}#Fr(e){const t=e.getData("text/plain");t&&this.editor.update((()=>{const e=eo();Mi(e)&&e.insertRawText(t)}),{tag:Zr})}#Rr(e){e.items[0].getAsString((t=>{if(Xg(t)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(t);else if(Xg(t)){const e=this.contents.createLink(t);this.#zr(e,{url:t})}else this.editorElement.supportsMarkdown?this.#Hr(t):this.#Kr(e)}))}#Dr(e,t){if(!Mi(e))return;if(!e.isCollapsed())return xd(null),void xd(t);const n=pd(t).append(ki(t));yb.for(e).insertNodes([n]),fl((()=>this.#zr(n.getKey(),{url:t})))}#zr(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};vc(this.editorElement,"lexxy:insert-link",{...t,...n})}#Hr(e){const t=Cc(I_(e,{breaks:!0}));if(this.#Ur(t))this.contents.insertText(e,{tag:Zr});else{const n=Object.freeze({markdown:e,document:t,addBlockSpacing:()=>function(e){for(const t of e.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *, blockquote > :not(h1, h2, h3, h4, h5, h6) + *")){const n=e.createElement("p");n.appendChild(e.createElement("br")),t.before(n)}}(t)});vc(this.editorElement,"lexxy:insert-markdown",n),this.contents.insertDOM(t,{tag:Zr})}}#Ur(e){const t=Array.from(e.body.children);if(1!==t.length)return!1;const n=t[0];return"P"===n.nodeName&&Array.from(n.childNodes).every((e=>e.nodeType===Node.TEXT_NODE||"BR"===e.nodeName))}#Kr(e){this.editor.update((()=>{const t=eo();Kh(e,t,this.editor)}),{tag:Zr})}#Pr(e){if(!this.editorElement.supportsAttachments)return!1;const t=e.getData("text/html"),n=e.files;return n.length&&this.#Wr(t)?(this.#Vr(n),!0):t&&!this.#qr(e)?(this.contents.insertHtml(t,{tag:Zr}),!0):!!n.length&&(this.#Vr(n),!0)}#qr(e){return Array.from(e.types).includes("application/x-lexical-editor")}#Wr(e){if(!e)return!1;const t=Cc(e),n=Array.from(t.body.children);return 1===n.length&&"IMG"===n[0].tagName}#Vr(e){this.#jr((()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})}))}async#jr(e){const t=window.scrollY,n=window.scrollX;e(),await Qc(),window.scrollTo(n,t),this.editor.focus()}}function P_(e){const t=e.getURL();return t&&e.getTextContent()===t?t:null}class M_{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#Zr()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){const e=this.#Gr;e&&(this.#Jr(e),this.#Yr(e),e.requestOverflowRefresh())}dispose(){for(;this.enabledExtensions.length;)this.enabledExtensions.pop().dispose()}#Jr(e){e.querySelectorAll("[data-lexxy-extension]").forEach((e=>e.remove()))}#Yr(e){this.enabledExtensions.forEach((t=>{const n=new Set(e.children);t.initializeToolbar(e);for(const t of e.children)n.has(t)||t.setAttribute("data-lexxy-extension","")}))}get allowedElements(){return this.enabledExtensions.flatMap((e=>e.allowedElements))}get#Gr(){return this.lexxyElement.toolbar}get#Xr(){return this.lexxyElement.baseExtensions}get#Qr(){return qg.global.get("extensions")}#Zr(){return this.#Xr.concat(this.#Qr).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}class D_{frozenLinkKey=null;dispatchAttributesChange(e,t,n,r){}dispatchEditorInitialized(e){}freeze(){}thaw(){}unlinkFrozenNode(){return!1}}function B_(e,t){const n=t.createDOM(e._config,e);n.style.whiteSpace="pre-wrap",t.hasFormat("lowercase")?n.style.textTransform="lowercase":t.hasFormat("uppercase")?n.style.textTransform="uppercase":t.hasFormat("capitalize")&&(n.style.textTransform="capitalize");let r=n;return t.hasFormat("bold")&&!$_(n,"strong")&&(r=z_(r,"b")),t.hasFormat("italic")&&!$_(n,"em")&&(r=z_(r,"i")),t.hasFormat("strikethrough")&&(r=z_(r,"s")),t.hasFormat("underline")&&(r=z_(r,"u")),{element:H_(r)}}function $_(e,t){const n=t.toUpperCase();return e.tagName===n||null!==e.querySelector(t)}function z_(e,t){const n=document.createElement(t);return n.appendChild(e),n}function H_(e){if("SPAN"===e.tagName)return e.firstChild;for(const t of e.querySelectorAll("span"))t.replaceWith(...t.childNodes);return e}class K_ extends Xo{$config(){return this.config("provisonal_paragraph",{extends:Xo,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!W_(e,"next")&&!W_(t,"previous")}createDOM(e){const t=super.createDOM(e),n=this.isSelected(eo());return t.classList.add("provisional-paragraph"),t.classList.toggle("hidden",!n),t}updateDOM(e,t){const n=this.isSelected(eo());return t.classList.toggle("hidden",!n),!1}getTextContent(){return""}exportDOM(){return{element:null}}isSelected(e=null){const t=e||eo();if(!t)return!1;if(t.getNodes().some((e=>e.is(this)||this.isParentOf(e))))return!0;if(Mi(t)&&t.isCollapsed()){const{anchor:e}=t,n=this.getParent();if(n&&e.getNode().is(n)&&"element"===e.type){const t=this.getIndexWithinParent();return e.offset===t||e.offset===t+1}}return!1}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(es(),!0)}get required(){return this.isDirectRootChild&&K_.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return Cl(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function U_(e){return e instanceof K_}function W_(e,t){return Ho(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class V_ extends op{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[K_],register:e=>Za(e.registerNodeTransform(Vo,q_),e.registerNodeTransform(Vo,j_),e.registerCommand(dn,Z_,3))}}}function q_(e){const t=function(e){const t=eo();return Cl(t?.anchor?.getNode())?e.getChildAtIndex(t.anchor.offset-1):null}(e),n=e.getFirstChild();K_.neededBetween(null,n)&&yu(e,new K_);for(const n of Cu(e)){const e=n.getNextSibling();K_.neededBetween(n,e)&&(n.insertAfter(new K_),n.is(t)&&n.selectNext())}}function j_(e){for(const t of G_(e))t.removeUnlessRequired()}function Z_(){pl(jr);for(const e of G_())e.markDirty()}function G_(e=zs()){return xu(e.getChildren(),U_)}const J_="language";class Y_ extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>X_(e,{conversion:hp("i",Wy),priority:1}),span:e=>X_(e,{conversion:hp("mark",Wy),priority:1}),strong:e=>X_(e,{conversion:hp("b",Wy),priority:1}),del:()=>({conversion:hp("s",Q_,Wy),priority:1}),pre:e=>function(e,t){return e.hasAttribute(J_)?t:null}(e,{conversion:gp(Hp,"pre",ex),priority:1})}}}}}function X_(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function Q_(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function ex(e,t){const n=bf(t.getAttribute(J_));e.node.setLanguage(n)}class tx extends xy{$config(){return this.config("wrapped_table_node",{extends:xy})}static importDOM(){return super.importDOM()}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}exportDOM(e){const t=super.exportDOM(e);return{...t,after:e=>{if(t.after){return xc("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class nx extends op{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return["figure","tbody"]}get lexicalExtension(){return{name:"lexxy/tables",nodes:[tx,{replace:xy,with:()=>new tx,withKlass:tx},Qf,sm],register:e=>(function(e){by.add(e)}(e),Za(Oy(e),e.registerRootListener((t=>{if(t)return Ly(e,!0)})),e.registerNodeTransform(Qf,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(Qf,(e=>{const t=e.getHeaderStyles();if(t!==Xf)return;const n=e.getParent(),r=n?.getParent();if(!r)return;const i=r.getChildren(),o=n.getChildren().indexOf(e),s=n.getChildren().every((e=>e.getHeaderStyles()!==Yf)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==Yf}));let a=Yf;s&&(a|=Xf),l&&(a|=Jf),a!==t&&e.setHeaderStyles(a,Gf)})),e.registerCommand("insertTableRowAfter",(()=>{ym(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{ym(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{_m(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{_m(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=eo();Mi(e)||Im(e)||om(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=Nm(t),[o]=Nm(n),[s,l,a]=Em(i,r,o),{startRow:c}=l,{startRow:u}=a,d=u+o.__rowSpan-1;if(s.length===d-c+1)return void i.remove();const h=s[0].length,g=s[d+1],p=i.getChildAtIndex(d+1);for(let e=d;e>=c;e--){for(let t=h-1;t>=0;t--){const{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<c||r+n.__rowSpan-1>d){const e=Math.max(r,c),t=Math.min(n.__rowSpan+r-1,d),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=c&&r+n.__rowSpan-1>d&&e===d){null===p&&om(122);let r=null;for(let n=0;n<t;n++){const t=g[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}null===r?Sm(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);cm(t)||om(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];Cm(e)}else{const e=s[c-1],{cell:t}=e[0];Cm(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=eo();Mi(e)||Im(e)||om(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=Nm(t),[o]=Nm(n),[s,l,a]=Em(i,r,o),{startColumn:c}=l,{startRow:u,startColumn:d}=a,h=Math.min(c,d),g=Math.max(c+r.__colSpan-1,d+o.__colSpan-1),p=g-h+1;if(s[0].length===g-h+1)return i.selectPrevious(),void i.remove();const f=s.length;for(let e=0;e<f;e++)for(let t=h;t<=g;t++){const{cell:n,startColumn:r}=s[e][t];if(r<h){if(t===h){const e=h-r;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(r+n.__colSpan-1>g){if(t===g){const e=g-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const m=s[u],y=c>d?m[c+r.__colSpan]:m[d+o.__colSpan];if(void 0!==y){const{cell:e}=y;Cm(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;Cm(t)}const b=i.getColWidths();if(b){const e=[...b];e.splice(h,p),i.setColWidths(e)}}()}),2),e.registerCommand("deleteTable",(()=>{const e=eo();if(!Mi(e))return!1;cy(e.anchor.getNode())?.remove()}),2)))}}}class rx{#ei;#ti=null;#ni=null;#ri=null;#e=new bc;constructor(e){this.#ei=e,this.#e.track(e.registerCommand(jn,(e=>this.#ii(e)),3),e.registerCommand(Vn,(e=>this.#rt(e)),3)),this.#e.track(e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#oi),t.removeEventListener("dragend",this.#si)),e&&(e.addEventListener("dragover",this.#oi),e.addEventListener("dragend",this.#si))})))}destroy(){this.#li(),this.#e.dispose()}#ii(e){if(e.target.closest?.("textarea"))return!1;const t=e.target.closest?.("figure.attachment[data-lexical-node-key]");return!!t&&(this.#ti=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-node-key",this.#ti),e.dataTransfer.effectAllowed="move",this.#ri=requestAnimationFrame((()=>{this.#ri=null,t.classList.add("lexxy-dragging")})),!0)}#oi=e=>{this.#ti&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#ni||(this.#ni=requestAnimationFrame((()=>{this.#ni=null,this.#ai(e)}))))};#rt(e){if(!this.#ti)return!1;e.preventDefault();const t=this.#ci(e),n=this.#ti;return this.#li(),t&&this.#ui(n,t),!0}#si=()=>{this.#li()};#ai(e){this.#di();const t=this.#ci(e);t&&("gallery"===t.type||"gallery-reorder"===t.type?t.element.classList.add(`lexxy-drop-target--gallery-${t.position}`):"list-item"===t.type?t.element.classList.add(`lexxy-drop-target--list-${t.position}`):t.element.classList.add(`lexxy-drop-target--block-${t.position}`))}#ci(e){const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=this.#ei.getRootElement();if(!n||!n.contains(t))return null;const r=t.closest("figure.attachment--preview[data-lexical-node-key]");if(r&&r.dataset.lexicalNodeKey!==this.#ti){const t=r.closest(".attachment-gallery");if(t){const i=n.querySelector(`[data-lexical-node-key="${this.#ti}"]`);if(i&&t.contains(i)){const t=this.#hi(r,e.clientX);return{type:"gallery-reorder",element:r,nodeKey:r.dataset.lexicalNodeKey,position:t}}}const i=this.#hi(r,e.clientX);return{type:"gallery",element:r,nodeKey:r.dataset.lexicalNodeKey,position:i}}if(r&&r.closest(".attachment-gallery"))return null;const i=t.closest(".attachment-gallery");if(i){let n=t.closest("figure.attachment[data-lexical-node-key]");if(n||(n=this.#gi(i,e.clientX)),n&&n.dataset.lexicalNodeKey!==this.#ti){const t=this.#hi(n,e.clientX);return{type:"gallery-reorder",element:n,nodeKey:n.dataset.lexicalNodeKey,position:t}}if(n)return null}const o=t.closest("li");if(o&&n.contains(o)){return{type:"list-item",element:o,position:this.#pi(o,e.clientY)}}const s=this.#fi(t,n,e.clientY);if(!s)return null;const l=this.#pi(s,e.clientY);return"before"===l&&s.previousElementSibling?{type:"block",element:s.previousElementSibling,position:"after"}:{type:"block",element:s,position:l}}#fi(e,t,n){let r=e;for(;r&&r!==t;){if(r.parentElement===t)return r;r=r.parentElement}let i=null,o=1/0;for(const e of t.children){const t=e.getBoundingClientRect(),r=Math.min(Math.abs(n-t.top),Math.abs(n-t.bottom));r<o&&(o=r,i=e)}return i}#pi(e,t){const n=e.getBoundingClientRect();return t<n.top+n.height/2?"before":"after"}#hi(e,t){const n=e.getBoundingClientRect();return t<n.left+n.width/2?"before":"after"}#gi(e,t){const n=e.querySelectorAll("figure.attachment[data-lexical-node-key]");let r=null,i=1/0;for(const e of n){const n=e.getBoundingClientRect(),o=n.left+n.width/2,s=Math.abs(t-o);s<i&&(i=s,r=e)}return r}static#mi=["lexxy-drop-target--gallery-before","lexxy-drop-target--gallery-after","lexxy-drop-target--list-before","lexxy-drop-target--list-after","lexxy-drop-target--block-before","lexxy-drop-target--block-after"];#di(){const e=this.#ei.getRootElement();if(e)for(const t of e.querySelectorAll("[class*='lexxy-drop-target--']"))t.classList.remove(...rx.#mi)}#ui(e,t){const n=Rs(e);n&&Ap(n)&&("gallery"===t.type?this.#yi(n,t.nodeKey,t.position):"gallery-reorder"===t.type?this.#bi(n,t.nodeKey,t.position):"list-item"===t.type?this.#_i(n,t):this.#xi(n,t),Ks(null))}#yi(e,t,n){const r=Rs(t);if(!r||!Ap(r))return;if(e.is(r))return;e.remove();db(r)&&("before"===n?r.insertBefore(e):r.insertAfter(e))}#bi(e,t,n){const r=Rs(t);r&&!e.is(r)&&(e.remove(),"before"===n?r.insertBefore(e):r.insertAfter(e))}#_i(e,t){const n=Ds(t.element);if(!n||!Kd(n))return;const r=n.getParent();if(!r||!Gd(r))return;const i=r.getChildren(),o=i.indexOf(n);if(-1===o)return;const s="before"===t.position?o:o+1;if(e.remove(),0===s)r.insertBefore(e);else if(s>=i.length)r.insertAfter(e);else{const[,t]=Al(r,s);t.insertBefore(e)}}#xi(e,t){const n=Ds(t.element);if(!n)return;const r=n.getTopLevelElement?.()||n;e.is(r)||(e.remove(),"before"===t.position?r.insertBefore(e):r.insertAfter(e))}#li(){if(this.#di(),this.#ti){const e=this.#ei.getRootElement();if(e){const t=e.querySelector(`[data-lexical-node-key="${this.#ti}"]`);t?.classList.remove("lexxy-dragging")}}this.#ti=null,this.#ni&&(cancelAnimationFrame(this.#ni),this.#ni=null),this.#ri&&(cancelAnimationFrame(this.#ri),this.#ri=null)}}const ix=["alt","caption","content","content-type","data-direct-upload-id","data-sgid","filename","filesize","height","presentation","previewable","sgid","url","width"];class ox extends op{#Ci=0;get enabled(){return this.editorElement.supportsAttachments}get allowedElements(){return[{tag:Tp.TAG_NAME,attributes:ix}]}get lexicalExtension(){return{name:"lexxy/action-text-attachments",nodes:[Tp,pb,ab],register:e=>{const t=new rx(e);return Za(e.registerNodeTransform(Tp,sx),e.registerCommand(bn,lx,2),e.registerMutationListener(pb,this.#Si.bind(this)),(()=>t.destroy()))}}}#Si(e){const t=this.#Ci;for(const[t,n]of e)"created"===n?this.#Ci++:"destroyed"===n&&(this.#Ci--,this.editorElement.uploadRequests.abort(t));this.#Ci!==t&&this.#vi()}#vi(){this.#Ci?this.setEditorValidity({customError:!0},"Please wait for all files to upload"):this.setEditorValidity({})}}function sx(e){const t=e.getParent();if(ts(t))if(1===t.getChildrenSize())t.replace(e);else{const n=e.getIndexWithinParent(),[r,i]=Al(t,n);r.insertAfter(e);for(const e of[r,i])e.isEmpty()&&e.remove()}}function lx(e){const t=eo()?.anchor;return!!t&&(!!function(e,t){const n=e.getNode();if(!ub(n))return!1;const r=up(e,t),i=t?n.getPreviousSibling():n.getNextSibling();if(r&&n.collapseWith(i,t)){const e=t?1:n.getChildrenSize()-1;return n.select(e,e),!0}return!1}(t,e)||!!e&&(function(e){const t=e.getNode();if(!t)return!1;const n=ts(t)&&t.isEmpty(),r=db(t.getPreviousSibling()),i=r?.getChildrenSize();return!(!n||!r?.collapseWith(t.getNextSibling()))&&(r.select(i,i),t.remove(),!0)}(t)||function(e){const t=e.getNode().getPreviousSibling();if(!ub(e.getNode())||!up(e,!0)||!t)return!1;if(Wo(t))return!1;t.isEmpty()?t.remove():t.selectEnd();return!0}(t)))}class ax extends Hp{$config(){return this.config("early_escape_code",{extends:Hp})}static $fromSelection(e){const t=e.anchor.getNode();return uu(t,ax)||(t instanceof ax?t:null)}insertNewAfter(e,t){return gl(Zr)||!e.isCollapsed()?super.insertNewAfter(e,t):this.#wi(e)?this.#ki():this.#Ei(e)?this.#Ti(e,t):this.#Ni(e)?this.#Ai():super.insertNewAfter(e,t)}#wi(e){const{anchor:t}=e;if(!dp(t))return!1;const n=t.getNode();return this.is(n)||this.getFirstChild()?.is(n)}#Ni(e){if(!pp(e))return!1;const t=this.getTextContent();return""===t||t.endsWith("\n")}#Ei(e){if(!pp(e))return!1;const t=this.getTextContent(),n=t.lastIndexOf("\n"),r=-1===n?t:t.slice(n+1);return r.length>0&&""===r.trim()}#ki(){return this.insertBefore(es()),null}#Ti(e,t){return super.insertNewAfter(e,t),this.getLastChild().remove(),null}#Ai(){mp(this);const e=es();return this.insertAfter(e),e}}class cx extends Bd{$config(){return this.config("early_escape_listitem",{extends:Bd})}insertNewAfter(e,t){return this.#Li(e)?this.#Oi():super.insertNewAfter(e,t)}get#Fi(){return Boolean(uu(this,Eg))}#Li(e){if(this.#Ii()||!this.#Fi)return!1;if(fp(this))return!0;{const t=uu(e.anchor.getNode(),Xo);return t&&fp(t)&&Kd(t.getParent())}}#Ii(){return gl(Zr)}#Oi(){const e=this.getParent();if(!e||!Gd(e))return;const t=e.getParent();if(t&&Ng(t)){if(this.getNextSiblings().some((e=>Kd(e)&&!fp(e))))return this.#Ri()}const n=es();return e.insertAfter(n),this.remove(),n}#Ri(){const e=Al(this.getParent(),this.getIndexWithinParent());this.remove();const t=es();return e[0].insertAfter(t),e.forEach(mp),t}}class ux extends op{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return[{tag:"ol",attributes:["start"]},{tag:"li",attributes:["value"]}]}get lexicalExtension(){return{name:"lexxy/format-escape",nodes:[ax,{replace:Hp,with:e=>new ax(e.getLanguage()),withKlass:ax},cx,{replace:Bd,with:()=>new cx,withKlass:cx}],register:e=>Za(e.registerCommand(xn,(()=>function(){const e=eo();if(!Mi(e)||!e.isCollapsed()||0!==e.anchor.offset)return!1;const t=uu(e.anchor.getNode(),Xo);if(t&&!fp(t)&&!t.getPreviousSibling()){const e=t.getParent();if(Ng(e))return e.insertBefore(es()),!0}return!1}()||function(){const e=uu(eo().anchor.getNode(),Xo);if(!e||!fp(e))return!1;const t=e.getParent();return!!Ng(t)&&(e.getNextSiblings().filter((e=>!fp(e))).length>0?function(e,t){const n=Al(e,t.getIndexWithinParent());n[0].insertAfter(t),n.forEach(mp),t.selectEnd()}(t,e):(t.insertAfter(e),e.selectStart()),!0)}()),3),e.registerCommand(Pn,(e=>function(e){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const n=ax.$fromSelection(t);if(!n)return!1;if(pp(t)&&!n.getNextSibling()){e?.preventDefault();const t=es();return n.insertAfter(t),t.selectEnd(),!0}return!1}(e)),2),e.registerNodeTransform(Eg,dx))}}}function dx(e){e.isEmpty()&&(e.append(es()),function(e,t=eo()){if(Mi(t)){const{commonAncestor:n}=ka(t.focus.getNode(),t.anchor.getNode());return jl(n,(t=>t.is(e)))}return!1}(e)&&e.getFirstChild().select())}class hx extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/link-opener",register:e=>Za(e.registerCommand(gn,this.#Pi.bind(this),2),yc(this.editorElement.editorContentElement,"auxclick",this.#Mi.bind(this)),yc(window,"keydown",this.#Di.bind(this)),yc(window,"keyup",this.#Di.bind(this)),yc(window,"focus",this.#Bi.bind(this)))}}#Pi(e){return!!this.#$i(e)&&gx(e.target)}#Mi(e){1===e.button&&this.editorElement.editor.read((()=>gx(e.target)))}#Di(e){this.#zi(e)}async#Bi(){await function(e){return new Promise((t=>setTimeout(t,e)))}(200),this.editorElement.addEventListener("mousemove",this.#zi.bind(this),{once:!0})}#zi(e){this.editorElement.toggleAttribute("data-links-openable",this.#$i(e))}#$i(e){return au?e.metaKey:e.ctrlKey}}function gx(e){const t=Ds(e),n=jl(t,fd);if(n){const e=n.sanitizeUrl(n.getURL());return window.open(e,"_blank","noopener,noreferrer"),!0}return!1}class px extends op{get lexicalExtension(){return{name:"lexxy/prevent-lexical-triple-click",register:e=>e.registerRootListener((e=>{if(e)return yc(e,"click",this.#Hi.bind(this),{capture:!0})}))}}#Hi(e){3===e.detail&&e.stopPropagation()}}class fx{#ei;#ti=null;#ri=null;#Ki=null;#Ui=null;#e=new bc;constructor(e){this.#ei=e,this.#e.track(e.registerCommand(jn,(e=>this.#ii(e)),3),e.registerCommand(Vn,(e=>this.#rt(e)),3)),this.#e.track(e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#oi),t.removeEventListener("dragend",this.#si)),e&&(e.addEventListener("dragover",this.#oi),e.addEventListener("dragend",this.#si))})))}destroy(){this.#li(),this.#Ui?.remove(),this.#Ui=null,this.#e.dispose()}#ii(e){const t=this.#Wi(e.target);return!!t&&(this.#ti=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-custom-attachment-key",this.#ti),e.dataTransfer.effectAllowed="move",this.#ri=requestAnimationFrame((()=>{this.#ri=null,t.classList.add("lexxy-dragging")})),!0)}#oi=e=>{this.#ti&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#Ki||(this.#Ki=requestAnimationFrame((()=>{this.#Ki=null,this.#Vi(e)}))))};#si=()=>{this.#li()};#rt(e){if(!this.#ti)return!1;e.preventDefault();const t=this.#qi(e),n=this.#ti;return this.#li(),t&&this.#ji(n,t),!0}#qi(e){const t=this.#ei.getRootElement();if(!t)return null;const n=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:n.offset}}else if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:n.startOffset}}return null}(e.clientX,e.clientY);if(!n||!t.contains(n.node))return null;if(n.node===t)return this.#Zi(t,e.clientY);const r=this.#Gi(n.node);return r?this.#Ji(r,e.clientX):n}#Zi(e,t){let n=null,r=1/0;for(const i of e.children){const e=i.getBoundingClientRect(),o=Math.min(Math.abs(t-e.top),Math.abs(t-e.bottom));o<r&&(r=o,n=i)}if(!n)return null;return t<n.getBoundingClientRect().top?{node:n,offset:0}:{node:n,offset:n.childNodes.length}}#Gi(e){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return t?.closest("[data-lexxy-decorator][data-lexical-node-key]")}#Ji(e,t){const n=e.getBoundingClientRect(),r=t>n.left+n.width/2?"after":"before";return{decoratorKey:e.dataset.lexicalNodeKey,placement:r}}#ji(e,t){this.#ei.update((()=>{const n=Rs(e);Yg(n)&&(t.decoratorKey?this.#Yi(n,t):this.#Xi(n,t))}))}#Yi(e,{decoratorKey:t,placement:n}){const r=Rs(t);r&&r!==e&&(e.remove(),"after"===n?r.insertAfter(e):r.insertBefore(e))}#Xi(e,t){const n=Xi({anchorNode:t.node,anchorOffset:t.offset,focusNode:t.node,focusOffset:t.offset},this.#ei);n&&(Ks(n),e.remove(),n.insertNodes([e]))}#Vi(e){this.#Qi();const t=this.#qi(e);t&&this.#eo(this.#to(t))}#to(e){if(e.decoratorKey)return this.#no(e);const{node:t,offset:n}=e,r=function(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=n.getBoundingClientRect();return r.height>0?r:null}(t,n);if(r)return r;const i=t.nodeType===Node.TEXT_NODE?t.parentElement:t;if(!i)return null;const o=i.getBoundingClientRect();return{left:o.left,top:o.top,height:o.height}}#no({decoratorKey:e,placement:t}){const n=this.#ei.getRootElement()?.querySelector(`[data-lexical-node-key="${e}"]`);if(!n)return null;const r=n.getBoundingClientRect();return{left:"after"===t?r.right:r.left,top:r.top,height:r.height}}#eo(e){if(!e)return;const t=this.#ro();t.style.blockSize=`${e.height}px`,t.style.insetInlineStart=`${e.left}px`,t.style.insetBlockStart=`${e.top}px`}#ro(){return this.#Ui||=xc("div",{className:"lexxy-drop-caret"}),this.#he().appendChild(this.#Ui),this.#Ui.style.display="block",this.#Ui}#he(){return this.#ei.getRootElement().closest("lexxy-editor")}#Qi(){this.#Ui&&(this.#Ui.style.display="none")}#Wi(e){return e?.closest?.("[data-lexxy-decorator][data-lexical-node-key]")}#li(){if(this.#ti){const e=this.#ei.getRootElement(),t=e?.querySelector(`[data-lexical-node-key="${this.#ti}"]`);t?.classList.remove("lexxy-dragging")}this.#Qi(),this.#ti=null,this.#ri&&(cancelAnimationFrame(this.#ri),this.#ri=null),this.#Ki&&(cancelAnimationFrame(this.#Ki),this.#Ki=null)}}class mx extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/custom-attachment-drag-and-drop",register:e=>{const t=new fx(e);return()=>t.destroy()}}}}class yx extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["autocapitalize","connected","required"];#io="";#oo=null;#so=!1;#lo=!1;#e=new bc;#ao=[];#ge={undo:!1,redo:!1};#co=new Map;#uo=document.createElement("textarea");#do;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}get uploadRequests(){return this.#do}connectedCallback(){this.id||=wc("lexxy-editor"),this.config=new lb(this),this.extensions=new M_(this),this.#ao.push(this.extensions),this.editor=this.#ho(),this.#ao.push(this.editor),this.#ao.push(this.#e),this.contents=new xb(this),this.#ao.push(this.contents),this.selection=new sb(this),this.#ao.push(this.selection),this.clipboard=new R_(this),this.#ao.push(this.clipboard),this.adapter=new D_,this.#do=new jf;const e=ob.configureFor(this);this.#ao.push(e),this.#go(),this.toggleAttribute("connected",!0),requestAnimationFrame((()=>{this.#po(),this.#fo(),this.#mo()}))}disconnectedCallback(){this.#so=!1,this.#lo=!1,this.#oo=null,this.valueBeforeDisconnect=this.value,this.#yo(),this.#bo()}attributeChangedCallback(e,t,n){"function"==typeof this[`${e}ChangedCallback`]&&this[`${e}ChangedCallback`](t,n)}autocapitalizeChangedCallback(){this.editorContentElement&&this.#_o(this.editorContentElement,"autocapitalize")}connectedChangedCallback(e,t){this.isConnected&&null!=e&&e!==t&&requestAnimationFrame((()=>this.#h()))}requiredChangedCallback(){this.isConnected&&this.#xo()}formResetCallback(){this.value=this.#io,this.editor.dispatchCommand(er,void 0)}toString(){return this.cachedStringValue??=this.editor?.read((()=>bx(zs())))}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get required(){return this.hasAttribute("required")}get validity(){return this.internals.validity}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}setElementValidity(e,t,n){this.#co.set(e,{flags:t,message:n}),this.#xo()}get toolbarElement(){return this.#Co?(this.toolbar??=this.#So(),this.toolbar):null}get baseExtensions(){return[V_,Uy,Y_,nx,kp,ox,ux,hx,px,mx]}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get permittedAttachmentTypes(){const e=this.config.get("permittedAttachmentTypes");if(null==e)return null;{const t=Array.isArray(e)?e:String(e).split(/\s+/);return Object.freeze(t.filter((e=>e&&"false"!==e)))}}permitsAttachmentContentType(e){if(this.supportsAttachments){const t=this.permittedAttachmentTypes;return null===t||t.includes(e)}return!1}acceptsFile(e){return vc(this,"lexxy:file-accept",{file:e},!0)}$generateNodesFromDOM(e,{editor:t=this.editor}={}){let n=Rh(t,e);return gl(Zr)&&(n=function(e,t){const n=e.map((e=>Op(e)?Fp(e,t):e)).filter((e=>null!==e));for(const e of n)for(const n of xu([e],Op)){const e=Fp(n,t);e?n.replace(e):n.remove()}return n}(n,this)),function(e,t){return e.filter((e=>!Lp(e,t))).map((e=>(xu([e],(e=>Lp(e,t))).forEach((e=>e.remove())),e)))}(n,this)}get isEmpty(){return["<p><br></p>","<p></p>",""].includes(this.value.trim())}get isBlank(){return this.isEmpty||null!==this.toString().match(/^\s*$/g)}get hasOpenPrompt(){return null!==this.querySelector(".lexxy-prompt-menu.lexxy-prompt-menu--visible")}get preset(){return this.getAttribute("preset")||"default"}get supportsAttachments(){return this.config.get("attachments")}get supportsMarkdown(){return this.supportsRichText&&this.config.get("markdown")}get supportsMultiLine(){return this.config.get("multiLine")&&!this.isSingleLineMode}get supportsRichText(){return this.config.get("richText")}registerAdapter(e){this.adapter=e,this.editor&&(this.#vo(),this.#wo())}freezeSelection(){this.adapter.freeze()}thawSelection(){this.adapter.thaw()}dispatchAttributesChange(){this.#wo()}dispatchEditorInitialized(){this.#vo()}get isSingleLineMode(){return this.hasAttribute("single-line")}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute("tabindex")??"0")}focus(){this.#ko||this.editor.focus((()=>this.#Eo()))}get#ko(){return!!this.editor&&cp(this.editor)}get value(){return this.cachedValue??=this.#To()}set value(e){const t=this.#ko;this.editor.update((()=>{t?fl((()=>this.editor.focus())):pl(Yr),this.#No(e),this.#Ao()}),{discrete:!0})}get canUndo(){return this.#ge.undo}get canRedo(){return this.#ge.redo}#To(){return this.editor?.read((()=>Zg(Ph(this.editor,null))))??null}#Lo(e,{editor:t=this.editor}={}){e||(e="<p></p>");return this.$generateNodesFromDOM(Cc(`${e}`),{editor:t}).filter(this.#Oo).map(this.#Fo)}#Oo(e){return!ai(e)&&(!Ei(e)||""!==e.getTextContent().trim())}#Fo(e){if(!Ei(e))return e;const t=es();return t.append(e),t}#go(){this.#Io(),this.#le(),this.#Ro(),this.#Po(),this.#Mo(),this.#Do(),this.#Bo(),this.#$o(),this.#zo(this.value,{suppressEvent:!0}),this.#Ho()}#Mo(){this.#e.track(yc(this,"lexxy:file-accept",(e=>{this.permitsAttachmentContentType(e.detail.file.type)||e.preventDefault()})))}#ho(){this.editorContentElement||=this.#Ko(),this.appendChild(this.editorContentElement);const e=function(...e){return ad.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:qf,nodes:this.#Uo,html:{export:new Map([[mi,B_],[Jp,B_]])},$initialEditorState:e=>{this.#Wo(e),this.#Vo(e)}},...this.extensions.lexicalExtensions);return e}#po(){this.editor.setEditable(!1),this.editor.setRootElement(this.editorContentElement),this.editor.setEditable(!0)}get#Uo(){const e=[Jg];return this.supportsRichText&&e.push(Eg,Ag,Ud,Bd,Hp,Jp,hd,md,Kf),e}#Ko(){const e=xc("div",{id:`${this.id}-content`,classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#qo,placeholder:this.getAttribute("placeholder")});return this.#jo.forEach((t=>e.setAttribute(t.name,t.value))),this.#_o(e,"autocapitalize"),this.#_o(e,"tabindex",{defaultValue:0,removeSource:!0}),e}#_o(e,t,{defaultValue:n=null,removeSource:r=!1}={}){this.hasAttribute(t)?e.setAttribute(t,this.getAttribute(t)):null!==n?e.setAttribute(t,n):e.removeAttribute(t),r&&this.removeAttribute(t)}get#qo(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#jo(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}#zo(e,{suppressEvent:t=!1}={}){const n=e!==this.#oo;this.internals.setFormValue(e),this.#oo=e,n&&!t&&vc(this,"lexxy:change")}#Vo(e){const t=this.valueBeforeDisconnect||this.getAttribute("value")||"<p><br></p>";this.#io=t,this.#No(t,{editor:e})}#No(e,{editor:t=this.editor}={}){zs().clear().selectEnd().insertNodes(this.#Lo(e,{editor:t}))}#$o(){this.#e.track(yc(document,"turbo:before-cache",this.#Zo))}#Zo=e=>{this.closest("[data-turbo-permanent]")||this.#bo()};#Ho(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{this.#yo(),this.#zo(this.value),this.#Ao(),this.#xo(),this.#wo()})))}async#xo(){await Qc(),this.isConnected&&this.#Go()}#Go(){this.#Jo();const{validity:e,message:t}=this.#Yo();this.internals.setValidity(e,t,this.editorContentElement)}#Jo(){this.#uo.required=this.required&&this.isBlank;const e=this.#uo.validity,t=this.#uo.validationMessage;this.#co.set(this,{flags:e,message:t})}#Yo(){const e={},t=[];for(const{flags:n,message:r}of this.#co.values())if(!0!==n.valid)for(const i in n)n[i]&&(e[i]=!0,t.push(r));return{validity:e,message:t.join("\n")}}#yo(){this.cachedValue=null,this.cachedStringValue=null}#Io(){const e=[];if(this.supportsRichText){if(e.push(Bg(this.editor),eh(this.editor)),this.#Xo(),this.#Qo(),this.supportsMarkdown){const t=[...Mf,Uf];e.push(Hf(this.editor,t),function(e,t){const n=t.filter((e=>"text-format"===e.type)).sort(((e,t)=>t.tag.length-e.tag.length));return e.registerUpdateListener((({tags:t,dirtyLeaves:r,editorState:i,prevEditorState:o})=>{if(t.has("historic")||t.has("collaboration"))return;if(e.isComposing())return;const s=i.read(eo),l=o.read(eo);if(!Mi(l)||!Mi(s)||!s.isCollapsed())return;const a=s.anchor.key,c=s.anchor.offset;if(!r.has(a))return;const u=i.read((()=>Rs(a)));if(!Ei(u))return;if(c<=(l.anchor.key===a?l.anchor.offset:0))return;const d=i.read((()=>u.getTextContent()));for(const t of n){const n=t.tag,r=n.length,i=c-r;if(i<0)continue;if(d.slice(i,c)!==n)continue;const o=n[0];if(i>0&&d[i-1]===o)continue;if(!1===t.intraword&&i>0){const e=d[i-1];if(e&&!Wf.test(e))continue}const s=c,l=d.indexOf(n,s);if(l<0)continue;if(d[l+r]===o)continue;if(l>0&&d[l-1]===o)continue;const u=l;if(!(u<=c)&&" "!==d[c]&&" "!==d[u-1]){if(!1===t.intraword){const e=d[l+r];if(e&&!Wf.test(e))continue}e.update((()=>{const e=Rs(a);if(!e||!Ei(e))return;const n=e.getParent();null===n||Up(n)||Vf(e,i,t)}));break}}}))}(this.editor,t))}}else e.push(pg(this.editor));this.#e.track(...e)}#Xo(){let e=this.querySelector("lexxy-table-tools");e??=xc("lexxy-table-tools"),this.append(e),this.#ao.push(e)}#Qo(){_f(this.editor);let e=this.querySelector("lexxy-code-language-picker");e??=xc("lexxy-code-language-picker"),this.append(e),this.#ao.push(e)}#le(){this.#e.track(this.editor.registerCommand(Mn,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2))}#Ro(){this.#e.track(yc(this,"focusin",this.#es),yc(this,"focusout",this.#ts))}#es(e){this.#ns(e.target)&&!this.currentlyFocused&&(this.#wo(),vc(this,"lexxy:focus"),this.currentlyFocused=!0)}#ts(e){this.#ns(e.relatedTarget)||(vc(this,"lexxy:blur"),this.currentlyFocused=!1)}#ns(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Eo(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#fo(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#Po(){this.#e.track(this.editor.registerCommand(nr,(e=>{this.#ge.undo=e}),2),this.editor.registerCommand(tr,(e=>{this.#ge.redo=e}),2))}#Do(){}#Bo(){this.#Co&&(this.toolbarElement.setEditor(this),"function"==typeof this.toolbarElement.dispose&&this.#ao.push(this.toolbarElement),this.extensions.initializeToolbars())}#So(){const e=this.config.get("toolbar");return"string"==typeof e?document.getElementById(e):this.querySelector("lexxy-toolbar")??this.#rs()}get#Co(){return this.supportsRichText&&!!this.config.get("toolbar")}#rs(){const e=xc("lexxy-toolbar");return e.innerHTML=Xc.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),e.configure(this.config.get("toolbar")),this.prepend(e),e}#Ao(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#Wo(e){jg(this.#is(e))}#is(e){return this.#os(e).concat(this.extensions.allowedElements)}#os(e){return Array.from(e._htmlConversions.keys()).filter((e=>!e.startsWith("#")))}#wo(){let e=null,t=null,n=null,r=null;this.editor.getEditorState().read((()=>{const i=eo();if(!Mi(i))return;const o=this.selection.getFormat();if(0===Object.keys(o).length)return;const s=uu(i.anchor.getNode(),hd);e={bold:{active:o.isBold,enabled:!0},italic:{active:o.isItalic,enabled:!0},strikethrough:{active:o.isStrikethrough,enabled:!0},code:{active:o.isInCode,enabled:!0},highlight:{active:o.isHighlight,enabled:!0},link:{active:o.isInLink,enabled:!0},quote:{active:o.isInQuote,enabled:!0},heading:{active:o.isInHeading,enabled:!0},"unordered-list":{active:o.isInList&&"bullet"===o.listType,enabled:!0},"ordered-list":{active:o.isInList&&"number"===o.listType,enabled:!0},undo:{active:!1,enabled:this.canUndo},redo:{active:!1,enabled:this.canRedo}},t=s?s.getURL():null,n=o.isHighlight?function(e){if(!Mi(e))return null;let t=gc(e.style);if(!t.color&&!t["background-color"]){const n=e.anchor.getNode();Ei(n)&&(t=gc(n.getStyle()))}const n=t.color||null,r=t["background-color"]||null;return n||r?{color:n,backgroundColor:r}:null}(i):null,r=o.headingTag??null})),e&&this.adapter.dispatchAttributesChange(e,t,n,r)}#vo(){this.adapter&&(this.#lo=!0,this.adapter.dispatchEditorInitialized({highlightColors:this.#ss,headingFormats:this.#ls}))}#mo(){this.isConnected&&this.adapter&&(this.#so||(this.#so=!0,vc(this,"lexxy:initialize")),this.#lo||this.#vo())}get#ss(){const e=this.config.get("highlight.buttons");if(!e)return null;return{colors:this.#as("color",e.color||[]),backgroundColors:this.#as("background-color",e["background-color"]||[])}}get#ls(){return this.supportsRichText?[{label:"Normal",command:"setFormatParagraph",tag:null},{label:"Large heading",command:"setFormatHeadingLarge",tag:"h2"},{label:"Medium heading",command:"setFormatHeadingMedium",tag:"h3"},{label:"Small heading",command:"setFormatHeadingSmall",tag:"h4"}]:[]}#as(e,t){const n=document.createElement("span");n.style.display="none";const r=t.map((t=>{const r=document.createElement("span");return r.style.setProperty(e,t),n.appendChild(r),{element:r,name:t}}));Iy().appendChild(n);const i=r.map((({element:t,name:n})=>({name:n,value:window.getComputedStyle(t).getPropertyValue(e)})));return n.remove(),i}#bo(){this.#cs(),this.#us(),this.#do?.clear(),this.editorContentElement?.remove(),this.editorContentElement=null,this.toolbar=null}#cs(){for(;this.#ao.length;)this.#ao.pop().dispose()}#h(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}#us(){this.#co=new Map}}function bx(e){if(e instanceof Jg)return e.getReadableTextContent();if(Ho(e)){let t="";const n=e.getChildren();for(let e=0;e<n.length;e++){const r=n[e];yp(r,n[e-1],e,n.length)||(t+=bx(r),Ho(r)&&e!==n.length-1&&!r.isInline()&&(t+="\n\n"))}return t}return e.getTextContent()}class _x{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=xc("li",{role:"option",id:wc("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=Cc(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class xx extends _x{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#ds(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#ds(e,t){if(this.promptItemByListItem=new WeakMap,!t)return this.#hs(e);const n=[];for(const r of e){const e=ep(r.getAttribute("search"),t);e>=0&&n.push({promptItem:r,position:e})}n.sort(((e,t)=>e.position-t.position));const r=[];for(const{promptItem:e}of n){if(r.length>=100)break;const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),r.push(t)}return r}#hs(e){const t=[];for(const n of e){if(t.length>=100)break;const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class Cx extends xx{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Sx extends xx{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class vx extends _x{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,o)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){o(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#gs(e));return this.#ds(t)}#gs(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#ds(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){if(t.length>=100)break;const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class wx extends HTMLElement{#ps=new bc;#fs=new bc;#ms=function(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>e(...r)),t)}}((()=>this.#ys()),50);constructor(){super(),this.showPopoverId=0}static observedAttributes=["connected"];connectedCallback(){this.source=this.#bs(),this.#_s(),this.#xs(),this.toggleAttribute("connected",!0)}disconnectedCallback(){this.#fs.dispose(),this.#ps.dispose(),this.source=null,this.#Cs()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get onlyAt(){return this.getAttribute("only-at")}get verticalDirection(){return this.getAttribute("vertical-direction")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#Ss(){return!this.supportsSpaceInSearches}#bs(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new vx(e):new Sx(e):new Cx(this.querySelectorAll("lexxy-prompt-item"))}#_s(){this.#vs&&this.#fs.track(this.#ei.registerUpdateListener((({editorState:e})=>{e.read((()=>{if(this.#ws.isInsideCodeBlock)return;const{node:e,offset:t}=this.#ws.selectedNodeWithOffset();if(e&&Ei(e)){const n=e.getTextContent(),r=this.trigger.length;if(t>=r){if(n.slice(t-r,t)===this.trigger){const n=function(e,t){const n=[];let r=!1;return function i(o){if(!r){if(o===e)return n.push(o.getTextContent().slice(0,t)),void(r=!0);if(Ho(o)){const e=o.getChildren();for(let t=0;t<e.length;t++){if(i(e[t]),r)return;const o=e[t];Ho(o)&&!o.isInline()&&t<e.length-1&&n.push("\n\n")}}else n.push(o.getTextContent())}}(zs()),n.join("")}(e,t-r);this.#ks.test(n)&&(this.#fs.dispose(),this.#Es())}}}}))})))}get#ks(){return new RegExp(`(?:${this.onlyAt??"^|[ \\n]"})$`)}get#vs(){if(this.hasAttribute("insert-editable-text"))return!0;const e=this.#he;if(e.supportsAttachments){const t=Array.from(this.querySelectorAll("template[type='editor']")),n=t.length?t.map((e=>e.getAttribute("content-type")||this.#Ts)):[this.#Ts];return n.some((t=>e.permitsAttachmentContentType(t)))}return!1}#Ns(){this.#fs.track(this.#ei.registerUpdateListener((({editorState:e})=>{this.closed||e.read((()=>{if(this.#ws.isInsideCodeBlock)return void this.#As();const{node:e,offset:t}=this.#ws.selectedNodeWithOffset();e&&(this.#Ls(e,t)?this.popoverElement.hasAttribute("data-anchored")||this.#Os():this.#As())}))})))}#Ls(e,t){if(!Ei(e)||0===t)return!1;const n=e.getTextContent().slice(0,t),r=n.lastIndexOf(this.trigger);if(-1===r)return!1;const i=n.slice(r+this.trigger.length);return!(this.supportsSpaceInSearches?/\n/:/[ \n]/).test(i)}get#ei(){return this.#he.editor}get#he(){return this.closest("lexxy-editor")}get#ws(){return this.#he.selection}async#Es(){const e=++this.showPopoverId;this.popoverElement??=await this.#Fs(),this.showPopoverId===e&&(this.#Is(),await this.#ys(),this.showPopoverId===e&&(this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#Rs(),this.#fs.track(yc(this.#he,"keydown",this.#Ps),yc(this.#he,"lexxy:change",this.#ms)),this.#Ms(),this.#Ns()))}#Ms(){this.#fs.track(this.#ei.registerCommand(Mn,this.#Ds.bind(this),4),this.#ei.registerCommand(Hn,this.#Ds.bind(this),4)),this.#Ss&&(this.#fs.track(this.#ei.registerCommand(Dn,this.#Ds.bind(this),4)),this.#fs.track(this.#ei.registerCommand(fn,this.#Bs.bind(this),4))),this.#fs.track(this.#ei.registerCommand(Rn,this.#$s.bind(this),4),this.#ei.registerCommand(Pn,this.#zs.bind(this),4))}#$s(e){return this.#Hs(),e.preventDefault(),!0}#zs(e){return this.#Ks(),e.preventDefault(),!0}#Rs(){const e=this.#Us[0];e&&this.#Ws(e)}get#Us(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#Ws(e,{scrollIntoView:t=!1}={}){this.#Vs(),e.toggleAttribute("aria-selected",!0),t&&e.scrollIntoView({block:"nearest",container:"nearest",behavior:"smooth"}),this.#qs("aria-controls",this.popoverElement.id),this.#qs("aria-activedescendant",e.id),this.#qs("aria-haspopup","listbox")}#Vs(){this.#Us.forEach((e=>{e.toggleAttribute("aria-selected",!1)}))}#js(){this.#Vs(),this.#Zs.removeAttribute("aria-controls"),this.#Zs.removeAttribute("aria-activedescendant"),this.#Zs.removeAttribute("aria-haspopup")}#qs(e,t){this.#Zs.getAttribute(e)!==t&&this.#Zs.setAttribute(e,t)}#Os(){const e=this.#ws.cursorPosition;if(!e)return;const{x:t,y:n,fontSize:r}=e,i=this.#he.getBoundingClientRect(),o=this.#Zs.getBoundingClientRect(),s=o.top-i.top;this.popoverElement.hasAttribute("data-anchored")||(this.#Gs(t),this.#Js(n+s),this.popoverElement.toggleAttribute("data-anchored",!0));const l=this.popoverElement.getBoundingClientRect();l.right>i.right&&this.popoverElement.toggleAttribute("data-clipped-at-right",!0);const a="top"===this.verticalDirection,c="bottom"===this.verticalDirection,u=l.bottom>window.innerHeight;c||!a&&!u||(this.#Js(o.height-n+r),this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#Gs(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-x",`${e}px`)}#Js(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-y",`${e}px`)}#Is(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-clipped-at-right"),this.popoverElement.removeAttribute("data-anchored")}async#As(){this.showPopoverId++,this.#js(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#fs.dispose(),await Qc(),this.#_s()}#xs(){this.#ps.track(yc(document,"turbo:before-cache",(()=>this.#Cs())))}#Cs(){this.#fs.dispose(),this.popoverElement?.remove(),this.popoverElement=null}#ys=async()=>{if(this.initialPrompt)this.initialPrompt=!1;else if(this.#Ys.containsTextBackUntil(this.trigger)){if(await this.#Xs(),!this.#Ys.containsTextBackUntil(this.trigger))return void this.#As();await Qc(),this.#Os()}else this.#As()};async#Xs(){const e=this.showPopoverId,t=this.#Ys.textBackUntil(this.trigger),n=await this.source.buildListItems(t);this.showPopoverId===e&&this.#Ys.containsTextBackUntil(this.trigger)&&(this.popoverElement.innerHTML="",n.length>0?this.#Qs(n):this.#el(),this.#Rs())}#Qs(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#el(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=xc("li",{textContent:this.#tl});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#tl(){return this.getAttribute("empty-results")||"Nothing found"}#Ps=e=>{"Escape"===e.key?(this.#As(),this.#he.focus(),e.stopPropagation()):","===e.key&&(e.preventDefault(),e.stopPropagation(),this.#nl(),this.#ei.update((()=>{const e=eo();Mi(e)&&e.insertText(",")})))};#Bs(e){if("insertText"===e.inputType&&" "===e.data)return this.#Ds(e)}#Ks(){const e=this.#rl+1;e<this.#Us.length&&this.#Ws(this.#Us[e],{scrollIntoView:!0})}#Hs(){const e=this.#rl-1;e>=0&&this.#Ws(this.#Us[e],{scrollIntoView:!0})}get#rl(){return this.#Us.findIndex((e=>e.hasAttribute("aria-selected")))}get#il(){return this.#Us[this.#rl]}#Ds(e){return e.preventDefault(),e.stopPropagation(),this.#nl(),!0}#nl(){this.#ol(),this.#As(),this.#he.focus()}#ol(){const e=this.source.promptItemFor(this.#il);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#Ys.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#sl(t,n):this.#ll(t,n,e.getAttribute("sgid"))}#sl(e,t){this.#ei.update((()=>{const n=e.flatMap((e=>this.#al(e)));this.#Ys.replaceTextBackUntil(t,n)}))}#al(e){return this.#he.$generateNodesFromDOM(Cc(`${e.innerHTML}`))}#ll(e,t,n=null){this.#ei.update((()=>{const r=this.#cl(e,n).flatMap((e=>[e,this.#ul()])).slice(0,-1);this.#Ys.replaceTextBackUntil(t,r)}))}#cl(e,t=null){return e.filter((e=>this.#he.permitsAttachmentContentType(e.getAttribute("content-type")||this.#Ts))).map((e=>this.#dl(e.innerHTML,e.getAttribute("content-type")||this.#Ts,e.getAttribute("sgid")||t)))}#ul(){return ki(" ")}get#Ts(){return`application/vnd.${qg.global.get("attachmentContentTypeNamespace")}.${this.name}`}#dl(e,t,n){return new Jg({sgid:n,contentType:t,innerHtml:e})}get#Ys(){return this.#he.contents}get#Zs(){return this.#he.editorContentElement}async#Fs(){const e=xc("ul",{role:"listbox",id:wc("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",mc()),e.append(...await this.source.buildListItems()),this.#ps.track(yc(e,"click",this.#hl)),this.#he.appendChild(e),e}#hl=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#Ws(t),this.#nl())};#h(){this.disconnectedCallback(),this.connectedCallback()}}class kx extends HTMLElement{#gl=null;#e=new bc;connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.#gl=new AbortController,this.#e.track((()=>this.#gl?.abort())),this.#pl(),this.#fl(),this.#ml()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose()}#pl(){this.languagePickerElement=this.#yl()??this.#bl();const e=this.#gl.signal;this.#e.track(yc(this.languagePickerElement,"change",(()=>{this.#_l(this.languagePickerElement.value)}),{signal:e})),this.#e.track(yc(this.languagePickerElement,"mousedown",(e=>{this.#xl(e)}),{signal:e})),this.languagePickerElement.setAttribute("nonce",mc()),this.appendChild(this.languagePickerElement)}#yl(){return this.querySelector("select")}#bl(){const e=xc("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Cl)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Cl(){const e={...yf};e.ruby||="Ruby",e.php||="PHP",e.go||="Go",e.bash||="Bash",e.json||="JSON",e.diff||="Diff",e.kotlin||="Kotlin",delete e.plain;const t=Object.entries(e).sort(((e,t)=>e[1].localeCompare(t[1])));return{plain:"Plain text",...Object.fromEntries(t)}}#xl(e){!vc(this.editorElement,"lexxy:code-language-picker-open",{languages:this.#Sl,currentLanguage:this.languagePickerElement.value},!0)&&e.preventDefault()}get#Sl(){return Object.entries(this.#Cl).map((([e,t])=>({key:e,name:t})))}#_l(e){this.editor.update((()=>{const t=this.#vl();t&&t.setLanguage(e)}))}#ml(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{const e=this.#vl();e?this.#wl(e):this.#fl()}))})))}#vl(){return this.editorElement.selection.nearestNodeOfType(Hp)}#wl(e){const t=e.getLanguage();this.#kl(t),this.#El(),this.#Tl(e)}#kl(e){if(this.languagePickerElement&&e){const t=bf(e);this.languagePickerElement.value=t}}#Tl(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top,o=r.right-n.right;this.style.top=`${i}px`,this.style.right=`${o}px`}#El(){this.hidden=!1}#fl(){this.hidden=!0}}class Ex extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.querySelector(".lexxy-node-delete")||this.#Nl()}disconnectedCallback(){this.editor=null,this.editorElement=null}#Nl(){const e=xc("div",{className:"lexxy-floating-controls__group"});this.deleteButton=xc("button",{className:"lexxy-node-delete",type:"button","aria-label":"Remove"}),this.deleteButton.tabIndex=-1,this.deleteButton.innerHTML='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n</svg>',this.handleDeleteClick=()=>this.#Al(),this.deleteButton.addEventListener("click",this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#Al(){this.editor.update((()=>{const e=Ds(this);e?.remove()}))}}class Tx{#e=new bc;constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#Ll()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#e.dispose()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=Rs(this.currentCellKey);return e instanceof Qf?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=Rs(this.currentTableNodeKey);return e instanceof xy?e:null})):null}get currentRowCells(){const e=this.currentRowIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t[e]?.getChildren()??null))??null:null}get currentRowIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){const t=pm(e);return fm(t).getChildren().findIndex((e=>e.is(t)))}(e)))??0:0}get currentColumnCells(){const e=this.currentColumnIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t.map((t=>t.getChildAtIndex(e)))))??null:null}get currentColumnIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){return pm(e).getChildren().findIndex((t=>t.is(e)))}(e)))??0:0}get tableRows(){return this.editor.getEditorState().read((()=>this.currentTableNode?.getChildren()))??null}updateSelectedTable(){let e=null,t=null;return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!this.selection.isTableCellSelected)return;const r=n.getNodes()[0];e=ay(r),t=cy(r)})),this.currentCellKey=e?.getKey()??null,this.currentTableNodeKey=t?.getKey()??null,t}executeTableCommand(e,t=null){"delete"!==e.action||"table"!==e.childType?"toggle"!==e.action?this.#Ol(e,t):this.#Fl(e):this.#Il()}#Ol(e,t=null){this.#Rl(),this.editor.dispatchCommand(this.#Pl(e)),this.#Ml(e,t)}#Fl(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=Xf):"column"===t&&(n=this.currentColumnCells,r=Jf),n&&0!==n.length&&this.editor.update((()=>{const e=gm(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#Dl(e,t,r)}))}))}#Il(){this.#Rl(),this.editor.dispatchCommand("deleteTable")}#Rl(){this.editor.update((()=>{const e=eo();if(!e)return;const t=e.getNodes()[0];ay(t)?.selectEnd()}))}#Pl(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${tp(n)}${"insert"==t?tp(r):""}`}#Dl(e,t,n){const r=gm(e);r?.setHeaderStyles(t,n)}async#Bl(e,t){if(await Qc(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=gm(r.getChildAtIndex(t));e?.selectEnd()}))}#Ml(e,t=null){const{childType:n,direction:r}=e;let i=this.currentRowIndex,o=null!==t?t:this.currentColumnIndex;const s="delete"===e.action?-1:0,l="after"===r?1:s;"row"===n?i+=l:"column"===n&&(o+=l),this.#Bl(i,o)}#$l(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#zl(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Hl(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Kl(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#Ul(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if(ts(t))t.selectStart();else{const e=es();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#Wl(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#Vl(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#ql(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#jl(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#Ll(){this.#e.track(this.editor.registerCommand(Bn,(e=>this.#Zl(e)),3),this.editor.registerCommand(Mn,(e=>this.#Gl(e)),3))}#Zl(e){return!!this.currentTableNode&&(this.#ql()&&this.#jl()?(e.preventDefault(),this.#Kl(),!0):!(!this.#Wl()||this.#jl())&&(e.preventDefault(),this.#zl(),!0))}#Gl(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#Vl()&&this.#ql()?this.#Ul():this.#Vl()?this.#Hl():this.#$l(),!0))}}var Nx={"insert-row-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 15C8.29055e-07 15.8284 0.671574 16.5 1.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V4.5L16.4922 4.34668C16.4154 3.59028 15.7767 3 15 3H13.5L13.5 4.5H15V9H1.5L1.5 4.5L3 4.5V3H1.5C0.671574 3 1.20956e-06 3.67157 1.24577e-06 4.5L7.86804e-07 15ZM15 10.5V15H1.5L1.5 10.5H15Z"/>\n <path d="M4.5 4.5H7.5V7.5H9V4.5H12L12 3L9 3V6.55671e-08L7.5 0V3L4.5 3V4.5Z"/>\n </svg>',"insert-row-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 13.5C7.50592e-07 14.3284 0.671574 15 1.5 15H3V13.5H1.5L1.5 9L15 9V13.5H13.5V15H15C15.7767 15 16.4154 14.4097 16.4922 13.6533L16.5 13.5V3L16.4922 2.84668C16.4205 2.14069 15.8593 1.57949 15.1533 1.50781L15 1.5L1.5 1.5C0.671574 1.5 1.28803e-06 2.17157 1.24577e-06 3L7.86804e-07 13.5ZM15 3V7.5L1.5 7.5L1.5 3L15 3Z"/>\n <path d="M7.5 15V18H9V15H12V13.5H9V10.5H7.5V13.5H4.5V15H7.5Z"/>\n </svg>',"delete-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4922 12.1533C16.4154 12.9097 15.7767 13.5 15 13.5L12 13.5V12H15V6L1.5 6L1.5 12H4.5V13.5H1.5C0.723337 13.5 0.0846104 12.9097 0.00781328 12.1533L7.86804e-07 12L1.04907e-06 6C1.17362e-06 5.22334 0.590278 4.58461 1.34668 4.50781L1.5 4.5L15 4.5C15.8284 4.5 16.5 5.17157 16.5 6V12L16.4922 12.1533Z"/>\n <path d="M10.3711 15.9316L8.25 13.8096L6.12793 15.9316L5.06738 14.8711L7.18945 12.75L5.06738 10.6289L6.12793 9.56836L8.25 11.6895L10.3711 9.56836L11.4316 10.6289L9.31055 12.75L11.4316 14.8711L10.3711 15.9316Z"/>\n </svg>',"toggle-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0.00781328 13.6533C0.0846108 14.4097 0.723337 15 1.5 15L15 15L15.1533 14.9922C15.8593 14.9205 16.4205 14.3593 16.4922 13.6533L16.5 13.5V4.5L16.4922 4.34668C16.4205 3.64069 15.8593 3.07949 15.1533 3.00781L15 3L1.5 3C0.671574 3 1.24863e-06 3.67157 1.18021e-06 4.5L7.86804e-07 13.5L0.00781328 13.6533ZM15 9V13.5L1.5 13.5L1.5 9L15 9Z"/>\n </svg>',"insert-column-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3H4.5V1.5H9V15H4.5V13.5H3V15C3 15.7767 3.59028 16.4154 4.34668 16.4922L4.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V1.5C16.5 0.671573 15.8284 6.03989e-09 15 0H4.5ZM15 15H10.5V1.5H15V15Z"/>\n <path d="M3 7.5H0V9H3V12H4.5V9H7.5V7.5H4.5V4.5H3V7.5Z"/>\n </svg>',"insert-column-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 0C14.3284 0 15 0.671573 15 1.5V3H13.5V1.5H9V15H13.5V13.5H15V15C15 15.7767 14.4097 16.4154 13.6533 16.4922L13.5 16.5H3L2.84668 16.4922C2.14069 16.4205 1.57949 15.8593 1.50781 15.1533L1.5 15V1.5C1.5 0.671573 2.17157 6.03989e-09 3 0H13.5ZM3 15H7.5V1.5H3V15Z"/>\n <path d="M15 7.5H18V9H15V12H13.5V9H10.5V7.5H13.5V4.5H15V7.5Z"/>\n </svg>',"delete-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1533 0.0078125C12.9097 0.0846097 13.5 0.723336 13.5 1.5V4.5H12V1.5H6V15H12V12H13.5V15C13.5 15.7767 12.9097 16.4154 12.1533 16.4922L12 16.5H6C5.22334 16.5 4.58461 15.9097 4.50781 15.1533L4.5 15V1.5C4.5 0.671573 5.17157 2.41596e-08 6 0H12L12.1533 0.0078125Z"/>\n <path d="M15.9316 6.12891L13.8105 8.24902L15.9326 10.3711L14.8711 11.4316L12.75 9.31055L10.6289 11.4316L9.56738 10.3711L11.6885 8.24902L9.56836 6.12891L10.6289 5.06836L12.75 7.18848L14.8711 5.06836L15.9316 6.12891Z"/>\n </svg>',"toggle-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.6533 17.9922C14.4097 17.9154 15 17.2767 15 16.5L15 3L14.9922 2.84668C14.9205 2.14069 14.3593 1.57949 13.6533 1.50781L13.5 1.5L4.5 1.5L4.34668 1.50781C3.59028 1.58461 3 2.22334 3 3L3 16.5C3 17.2767 3.59028 17.9154 4.34668 17.9922L4.5 18L13.5 18L13.6533 17.9922ZM9 3L13.5 3L13.5 16.5L9 16.5L9 3Z"/>\n </svg>',"delete-table":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n </svg>'};class Ax extends HTMLElement{#e=new bc;connectedCallback(){this.tableController=new Tx(this.#he),this.classList.add("lexxy-floating-controls"),this.#Q(),this.#fl(),this.#Jl(),this.#Yl()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),this.tableController?.destroy(),this.tableController=null}get#ei(){return this.#he.editor}get#he(){return this.closest("lexxy-editor")}get#Xl(){return Array.from(this.querySelectorAll("button, details > summary"))}#Q(){this.innerHTML="",this.appendChild(this.#Ql()),this.appendChild(this.#ea()),this.appendChild(this.#ta()),this.#e.track(yc(this,"keydown",this.#na))}#ra(e,t,n){const r=xc("div",{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#se(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#se(`Remove ${e}`,{action:"delete",childType:e},"−"),s=xc("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=xc("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#Ql(){return this.#ra("row",(e=>{this.rowCount=e}),this.#ia("row"))}#ea(){return this.#ra("column",(e=>{this.columnCount=e}),this.#ia("column"))}#ia(e){const t=xc("div",{className:"lexxy-floating-controls__group lexxy-table-control__more-menu-details"}),n=this.#se(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#se(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#se(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#se(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#ta(){const e=xc("div",{className:"lexxy-table-control lexxy-floating-controls__group"}),t=this.#se("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#se(e,t={},n=this.#oa(t)){const r=xc("button",{className:"lexxy-table-control__button","aria-label":e,type:"button"});return r.tabIndex=-1,r.innerHTML=`${n} <span>${e}</span>`,r.dataset.action=t.action,r.dataset.childType=t.childType,r.dataset.direction=t.direction,r.addEventListener("click",(()=>this.#sa(t))),r.addEventListener("mouseover",(()=>this.#la())),r.addEventListener("focus",(()=>this.#la())),r.addEventListener("mouseout",(()=>this.#la())),r}#Yl(){this.#e.track(this.#ei.registerCommand(An,this.#aa,3))}#aa=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#na=e=>{"Escape"===e.key?this.#ca():Tc(this.#Xl,e)};#ca(){const e=this.tableController.currentCell;e&&(this.#ei.update((()=>{e.select(),this.#ei.focus()})),this.#ua())}async#la(){await Qc(),this.#da();const e=this.querySelector("button:hover, button:focus");if(!e)return;const t={action:e.dataset.action,childType:e.dataset.childType,direction:e.dataset.direction};let n=null;switch(t.childType){case"row":n=this.tableController.currentRowCells;break;case"column":n=this.tableController.currentColumnCells;break;case"table":n=this.tableController.tableRows}n&&n.forEach((e=>{const n=this.#ei.getElementByKey(e.getKey());n&&(n.classList.toggle(qf.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#Jl(){this.#e.track(this.#ei.registerUpdateListener((()=>{this.#ei.getRootElement()&&this.tableController.updateSelectedTable()?this.#El():this.#fl()})))}#sa(e){this.tableController.executeTableCommand(e),this.#ua()}#El(){this.#ha(),this.style.display="flex",this.#ga(),this.#pa(),this.#la()}#fl(){this.style.display="none",this.#da()}#ua(){this.#ha(),this.#ga(),this.#pa(),this.#la()}#pa(){this.querySelector("details[open]")?.removeAttribute("open")}#ha(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#ei.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#he.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#ga(){const e=this.tableController.currentTableNode;if(!e)return;const t=Cy(this.#ei,e);if(!t)return;const n=t.rows,r=t.columns;this.rowCount.textContent=`${n} row${1===n?"":"s"}`,this.columnCount.textContent=`${r} column${1===r?"":"s"}`}#fa(){const e=this.tableController.currentCell;if(!e)return;const t=this.#ei.getElementByKey(e.getKey());t&&t.classList.add(qf.tableCellFocus)}#da(){this.#he.querySelectorAll(`.${qf.tableCellFocus}`)?.forEach((e=>{e.classList.remove(qf.tableCellFocus)})),this.#he.querySelectorAll(`.${qf.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(qf.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#fa()}#oa(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return Nx[r]}}function Lx(e=document){e.querySelectorAll("pre[data-language]:not([data-highlighted])").forEach((e=>{Ox(e)}))}function Ox(e){if("true"===e.dataset.highlighted)return;const t=e.getAttribute("data-language"),n=s.languages?.[t];if(!n)return;const{code:r,highlights:i}=function(e){const t=e.querySelector("code")||e,n=[];let r="";function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if("BR"===e.tagName)r+="\n";else if("MARK"===e.tagName){const t=r.length;for(const t of e.childNodes)i(t);const o=function(e){const t=[];e.style?.color&&t.push(`color: ${e.style.color};`);e.style?.backgroundColor&&t.push(`background-color: ${e.style.backgroundColor};`);return t.length>0?t.join(" "):null}(e);o&&n.push({start:t,end:r.length,style:o})}else for(const t of e.childNodes)i(t)}for(const e of t.childNodes)i(e);return{code:r,highlights:n}}(e),o=s.highlight(r,n,t);e.innerHTML=o,i.length>0&&function(e,t){for(const{start:n,end:r,style:i}of t)Fx(e,n,r,i)}(e,i),e.dataset.highlighted="true"}function Fx(e,t,n,r){const i=function(e){const t=[];let n=0;const r=document.createTreeWalker(e,4);let i;for(;i=r.nextNode();){const e=i.textContent.length;t.push({node:i,start:n,end:n+e}),n+=e}return t}(e);for(let e=i.length-1;e>=0;e--){const{node:o,start:s,end:l}=i[e],a=Math.max(t,s),c=Math.min(n,l);if(a>=c)continue;const u=a-s,d=c-s,h=o.textContent,g=o.parentNode,p=document.createElement("mark");p.setAttribute("style",r),p.textContent=h.slice(u,d),d<h.length&&g.insertBefore(document.createTextNode(h.slice(d)),o.nextSibling),g.insertBefore(p,o.nextSibling),u>0?o.textContent=h.slice(0,u):g.removeChild(o)}}class Ix{frozenLinkKey=null;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement}dispatchAttributesChange(e,t,n,r){vc(this.editorElement,"lexxy:attributes-change",{attributes:e,link:t?{href:t}:null,highlight:n,headingTag:r})}dispatchEditorInitialized(e){vc(this.editorElement,"lexxy:editor-initialized",e)}freeze(){let e=null;this.editorElement.editor?.getEditorState().read((()=>{const t=eo();if(!Mi(t))return;const n=uu(t.anchor.getNode(),hd);n&&(e=n.getKey())})),this.frozenLinkKey=e,this.editorContentElement.contentEditable="false"}thaw(){this.editorContentElement.contentEditable="true"}unlinkFrozenNode(){const e=this.frozenLinkKey;if(!e)return!1;const t=Rs(e);if(!fd(t))return this.frozenLinkKey=null,!1;const n=t.getChildren();for(const e of n)t.insertBefore(e);t.remove();const r=this.#ma(n),i=this.#ya(n);if(r&&i){const e=eo();Mi(e)&&(e.anchor.set(r.getKey(),0,"text"),e.focus.set(i.getKey(),i.getTextContent().length,"text"))}return this.frozenLinkKey=null,!0}#ma(e){for(const t of e){if(Ei(t))return t;if(Ho(t)){const e=this.#ma(t.getChildren());if(e)return e}}return null}#ya(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(Ei(n))return n;if(Ho(n)){const e=this.#ya(n.getChildren());if(e)return e}}return null}}const Rx=qg.configure;setTimeout((function(){const e={"lexxy-toolbar":Xc,"lexxy-toolbar-dropdown":eu,"lexxy-highlight-dropdown":ru,"lexxy-link-dropdown":vd,"lexxy-editor":yx,"lexxy-prompt":wx,"lexxy-code-language-picker":kx,"lexxy-node-delete-button":Ex,"lexxy-table-tools":Ax};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{Np as $createActionTextAttachmentNode,mb as $createActionTextAttachmentUploadNode,Ap as $isActionTextAttachmentNode,Yg as $isCustomActionTextAttachmentNode,Tp as ActionTextAttachmentNode,pb as ActionTextAttachmentUploadNode,Jg as CustomActionTextAttachmentNode,op as Extension,Kf as HorizontalDividerNode,Ix as NativeAdapter,wp as REWRITE_HISTORY_COMMAND,Rx as configure,Lx as highlightCode,Ox as highlightElement};
|
|
11
|
+
const{entries:p,setPrototypeOf:f,isFrozen:m,getPrototypeOf:y,getOwnPropertyDescriptor:b}=Object;let{freeze:_,seal:x,create:C}=Object,{apply:S,construct:v}="undefined"!=typeof Reflect&&Reflect;_||(_=function(e){return e}),x||(x=function(e){return e}),S||(S=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),v||(v=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const w=$(Array.prototype.forEach),k=$(Array.prototype.lastIndexOf),E=$(Array.prototype.pop),T=$(Array.prototype.push),N=$(Array.prototype.splice),A=$(String.prototype.toLowerCase),L=$(String.prototype.toString),O=$(String.prototype.match),F=$(String.prototype.replace),I=$(String.prototype.indexOf),R=$(String.prototype.trim),P=$(Object.prototype.hasOwnProperty),M=$(RegExp.prototype.test),D=(B=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v(B,t)});var B;function $(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S(e,t,r)}}function z(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A;f&&f(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(m(t)||(t[r]=e),i=e)}e[i]=!0}return e}function H(e){for(let t=0;t<e.length;t++){P(e,t)||(e[t]=null)}return e}function K(e){const t=C(null);for(const[n,r]of p(e)){P(e,n)&&(Array.isArray(r)?t[n]=H(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=K(r):t[n]=r)}return t}function U(e,t){for(;null!==e;){const n=b(e,t);if(n){if(n.get)return $(n.get);if("function"==typeof n.value)return $(n.value)}e=y(e)}return function(){return null}}const W=_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),q=_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),j=_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Z=_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),J=_(["#text"]),Y=_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),X=_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Q=_(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ee=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),te=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ne=x(/<%[\w\W]*|[\w\W]*%>/gm),re=x(/\$\{[\w\W]*/gm),ie=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=x(/^aria-[\-\w]+$/),se=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),le=x(/^(?:\w+script|data):/i),ae=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ce=x(/^html$/i),ue=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var de=Object.freeze({__proto__:null,ARIA_ATTR:oe,ATTR_WHITESPACE:ae,CUSTOM_ELEMENT:ue,DATA_ATTR:ie,DOCTYPE_NAME:ce,ERB_EXPR:ne,IS_ALLOWED_URI:se,IS_SCRIPT_OR_DATA:le,MUSTACHE_EXPR:te,TMPLIT_EXPR:re});const he=1,ge=3,pe=7,fe=8,me=9,ye=function(){return"undefined"==typeof window?null:window};var be=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ye();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==me||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:f}=t,m=c.prototype,y=U(m,"cloneNode"),b=U(m,"remove"),x=U(m,"nextSibling"),S=U(m,"childNodes"),v=U(m,"parentNode");if("function"==typeof l){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let B,$="";const{implementation:H,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:re}=r,{importNode:ie}=i;let oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof p&&"function"==typeof v&&H&&void 0!==H.createHTMLDocument;const{MUSTACHE_EXPR:le,ERB_EXPR:ae,TMPLIT_EXPR:ue,DATA_ATTR:be,ARIA_ATTR:_e,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Se}=de;let{IS_ALLOWED_URI:ve}=de,we=null;const ke=z({},[...W,...V,...q,...Z,...J]);let Ee=null;const Te=z({},[...Y,...X,...Q,...ee]);let Ne=Object.seal(C(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null;const Oe=Object.seal(C(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ie=!0,Re=!1,Pe=!0,Me=!1,De=!0,Be=!1,$e=!1,ze=!1,He=!1,Ke=!1,Ue=!1,We=!0,Ve=!1,qe=!0,je=!1,Ze={},Ge=null;const Je=z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Xe=z({},["audio","video","img","source","image","track"]);let Qe=null;const et=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let it=rt,ot=!1,st=null;const lt=z({},[tt,nt,rt],L);let at=z({},["mi","mo","mn","ms","mtext"]),ct=z({},["annotation-xml"]);const ut=z({},["title","style","font","a","script"]);let dt=null;const ht=["application/xhtml+xml","text/html"];let gt=null,pt=null;const ft=r.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=K(e),dt=-1===ht.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===dt?L:A,we=P(e,"ALLOWED_TAGS")?z({},e.ALLOWED_TAGS,gt):ke,Ee=P(e,"ALLOWED_ATTR")?z({},e.ALLOWED_ATTR,gt):Te,st=P(e,"ALLOWED_NAMESPACES")?z({},e.ALLOWED_NAMESPACES,L):lt,Qe=P(e,"ADD_URI_SAFE_ATTR")?z(K(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=P(e,"ADD_DATA_URI_TAGS")?z(K(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Ge=P(e,"FORBID_CONTENTS")?z({},e.FORBID_CONTENTS,gt):Je,Ae=P(e,"FORBID_TAGS")?z({},e.FORBID_TAGS,gt):K({}),Le=P(e,"FORBID_ATTR")?z({},e.FORBID_ATTR,gt):K({}),Ze=!!P(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Ie=!1!==e.ALLOW_DATA_ATTR,Re=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Me=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Be=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ke=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,ve=e.ALLOWED_URI_REGEXP||se,it=e.NAMESPACE||rt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,ct=e.HTML_INTEGRATION_POINTS||ct,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Ie=!1),Ke&&(He=!0),Ze&&(we=z({},J),Ee=[],!0===Ze.html&&(z(we,W),z(Ee,Y)),!0===Ze.svg&&(z(we,V),z(Ee,X),z(Ee,ee)),!0===Ze.svgFilters&&(z(we,q),z(Ee,X),z(Ee,ee)),!0===Ze.mathMl&&(z(we,Z),z(Ee,Q),z(Ee,ee))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(we===ke&&(we=K(we)),z(we,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Oe.attributeCheck=e.ADD_ATTR:(Ee===Te&&(Ee=K(Ee)),z(Ee,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&z(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ge===Je&&(Ge=K(Ge)),z(Ge,e.FORBID_CONTENTS,gt)),qe&&(we["#text"]=!0),Be&&z(we,["html","head","body"]),we.table&&(z(we,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');B=e.TRUSTED_TYPES_POLICY,$=B.createHTML("")}else void 0===B&&(B=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(f,o)),null!==B&&"string"==typeof $&&($=B.createHTML(""));_&&_(e),pt=e}},bt=z({},[...V,...q,...j]),_t=z({},[...Z,...G]),xt=function(e){T(n.removed,{element:e});try{v(e).removeChild(e)}catch(t){b(e)}},Ct=function(e,t){try{T(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){T(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(He||Ke)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},St=function(e){let t=null,n=null;if(ze)e="<remove></remove>"+e;else{const t=O(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===dt&&it===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=B?B.createHTML(e):e;if(it===rt)try{t=(new g).parseFromString(i,dt)}catch(e){}if(!t||!t.documentElement){t=H.createDocument(it,"template",null);try{t.documentElement.innerHTML=ot?$:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),it===rt?re.call(t,Be?"html":"body")[0]:Be?t.documentElement:o},vt=function(e){return te.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},kt=function(e){return"function"==typeof a&&e instanceof a};function Et(e,t,r){w(e,(e=>{e.call(n,t,r,pt)}))}const Tt=function(e){let t=null;if(Et(oe.beforeSanitizeElements,e,null),wt(e))return xt(e),!0;const r=gt(e.nodeName);if(Et(oe.uponSanitizeElement,e,{tagName:r,allowedTags:we}),De&&e.hasChildNodes()&&!kt(e.firstElementChild)&&M(/<[/\w!]/g,e.innerHTML)&&M(/<[/\w!]/g,e.textContent))return xt(e),!0;if(e.nodeType===pe)return xt(e),!0;if(De&&e.nodeType===fe&&M(/<[/\w]/g,e.data))return xt(e),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(r))&&(!we[r]||Ae[r])){if(!Ae[r]&&At(r)){if(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,r))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(r))return!1}if(qe&&!Ge[r]){const t=v(e)||e.parentNode,n=S(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=y(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,x(e))}}}return xt(e),!0}return e instanceof c&&!function(e){let t=v(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=A(e.tagName),r=A(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(bt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(_t[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!at[r])&&!_t[n]&&(ut[n]||!bt[n]):!("application/xhtml+xml"!==dt||!st[e.namespaceURI]))}(e)?(xt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!M(/<\/no(script|embed|frames)/i,e.innerHTML)?(Me&&e.nodeType===ge&&(t=e.textContent,w([le,ae,ue],(e=>{t=F(t,e," ")})),e.textContent!==t&&(T(n.removed,{element:e.cloneNode()}),e.textContent=t)),Et(oe.afterSanitizeElements,e,null),!1):(xt(e),!0)},Nt=function(e,t,n){if(We&&("id"===t||"name"===t)&&(n in r||n in ft))return!1;if(Ie&&!Le[t]&&M(be,t));else if(Fe&&M(_e,t));else if(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(t,e));else if(!Ee[t]||Le[t]){if(!(At(e)&&(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&M(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t,e))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&M(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Qe[t]);else if(M(ve,F(n,Ce,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==I(n,"data:")||!Ye[e]){if(Re&&!M(xe,F(n,Ce,"")));else if(n)return!1}else;return!0},At=function(e){return"annotation-xml"!==e&&O(e,Se)},Lt=function(e){Et(oe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||wt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:l,value:a}=o,c=gt(s),u=a;let d="value"===s?u:R(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(oe.uponSanitizeAttribute,e,r),d=r.attrValue,!Ve||"id"!==c&&"name"!==c||(Ct(s,e),d="user-content-"+d),De&&M(/((--!?|])>)|<\/(style|title|textarea)/i,d)){Ct(s,e);continue}if("attributename"===c&&O(d,"href")){Ct(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ct(s,e);continue}if(!Pe&&M(/\/>/i,d)){Ct(s,e);continue}Me&&w([le,ae,ue],(e=>{d=F(d,e," ")}));const h=gt(e.nodeName);if(Nt(h,c,d)){if(B&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(l);else switch(f.getAttributeType(h,c)){case"TrustedHTML":d=B.createHTML(d);break;case"TrustedScriptURL":d=B.createScriptURL(d)}if(d!==u)try{l?e.setAttributeNS(l,s,d):e.setAttribute(s,d),wt(e)?xt(e):E(n.removed)}catch(t){Ct(s,e)}}else Ct(s,e)}Et(oe.afterSanitizeAttributes,e,null)},Ot=function e(t){let n=null;const r=vt(t);for(Et(oe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Et(oe.uponSanitizeShadowNode,n,null),Tt(n),Lt(n),n.content instanceof s&&e(n.content);Et(oe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,l=null,c=null;if(ot=!e,ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!kt(e)){if("function"!=typeof e.toString)throw D("toString is not a function");if("string"!=typeof(e=e.toString()))throw D("dirty is not a string, aborting")}if(!n.isSupported)return e;if($e||yt(t),n.removed=[],"string"==typeof e&&(je=!1),je){if(e.nodeName){const t=gt(e.nodeName);if(!we[t]||Ae[t])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof a)r=St("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===he&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!He&&!Me&&!Be&&-1===e.indexOf("<"))return B&&Ue?B.createHTML(e):e;if(r=St(e),!r)return He?null:Ue?$:""}r&&ze&&xt(r.firstChild);const u=vt(je?e:r);for(;l=u.nextNode();)Tt(l),Lt(l),l.content instanceof s&&Ot(l.content);if(je)return e;if(He){if(Ke)for(c=ne.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(Ee.shadowroot||Ee.shadowrootmode)&&(c=ie.call(i,c,!0)),c}let d=Be?r.outerHTML:r.innerHTML;return Be&&we["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&M(ce,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Me&&w([le,ae,ue],(e=>{d=F(d,e," ")})),B&&Ue?B.createHTML(d):d},n.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),$e=!0},n.clearConfig=function(){pt=null,$e=!1},n.isValidAttribute=function(e,t,n){pt||yt({});const r=gt(e),i=gt(t);return Nt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&T(oe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=k(oe[e],t);return-1===n?void 0:N(oe[e],n,1)[0]}return E(oe[e])},n.removeHooks=function(e){oe[e]=[]},n.removeAllHooks=function(){oe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function _e(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function xe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ce="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Se=Ce&&"documentMode"in document?document.documentMode:null,ve=Ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),we=Ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ke=!(!Ce||!("InputEvent"in window)||Se)&&"getTargetRanges"in new window.InputEvent("input"),Ee=Ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Te=Ce&&/Android/.test(navigator.userAgent),Ne=Ce&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Te,Ae=Ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Le=Ce&&Te&&Ae,Oe=Ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ve&&!Ae,Fe=0,Ie=1,Re=2,Pe=1,Me=2,De=3,Be=4,$e=5,ze=6,He=Ne||Ee||Oe?" ":"",Ke="\n\n",Ue=we?" ":He,We="֑-߿יִ-﷽ﹰ-ﻼ",Ve="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",qe=new RegExp("^[^"+Ve+"]*["+We+"]"),je=new RegExp("^[^"+We+"]*["+Ve+"]"),Ze={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ge={directionless:1,unmergeable:2},Je={center:2,end:6,justify:4,left:1,right:3,start:5},Ye={[Me]:"center",[ze]:"end",[Be]:"justify",[Pe]:"left",[De]:"right",[$e]:"start"},Xe={normal:0,segmented:2,token:1},Qe={[Fe]:"normal",[Re]:"segmented",[Ie]:"token"},et="$config";let tt=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};function nt(e,t,n,r,i,o){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(Ho(s)&&nt(s,e,n,r,i,o),n.has(e)||o.delete(e),i.push(e)),s=s.getNextSibling()}}let rt=!1,it=0;function ot(e){it=e.timeStamp}function st(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==Ms(e,n)}function lt(e,t,n){const r=Nl(bl(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&Gs(t,s,i,o,!1)}function at(e,t,n){if(Mi(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return ws(t)&&n.isAttached()}function ct(e,t,n,r){for(let i=e;i&&!Wl(i);i=dl(i)){const e=Ms(i,t);if(void 0!==e){const t=Rs(e,n);if(t)return Wo(t)||!Ol(i)?void 0:[i,t]}else if(i===r)return[r,Hs(n)]}}function ut(e,t,n){rt=!0;const r=performance.now()-it>100;try{Do(e,(()=>{const i=eo()||function(e){return e.getEditorState().read((()=>{const e=eo();return null!==e?e.clone():null}))}(e),o=new Map,s=e.getRootElement(),l=e._editorState,a=e._blockCursorElement;let c=!1,u="";for(let n=0;n<t.length;n++){const d=t[n],h=d.type,g=d.target,p=ct(g,e,l,s);if(!p)continue;const[f,m]=p;if("characterData"===h)r&&Ei(m)&&ws(g)&&at(i,g,m)&<(g,m,e);else if("childList"===h){c=!0;const t=d.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=Ps(r),o=r.parentNode;if(null!=o&&r!==a&&null===i&&!st(r,o,e)){if(we){const e=(Ol(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}o.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(st(r,g,e)||a===r)&&(g.appendChild(r),t++)}r!==t&&o.set(f,m)}}}if(o.size>0)for(const[t,n]of o)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){const n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||st(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(c&&Ks(i),we&&al(e)&&i.insertRawText(u))}))}finally{rt=!1}}function dt(e){const t=e._observer;null!==t&&ut(e,t.takeRecords(),t)}function ht(e){!function(e){0===it&&bl(e).addEventListener("textInput",ot,!0)}(e),e._observer=new MutationObserver(((t,n)=>{ut(e,t,n)}))}let gt=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||St).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function pt(e,t){return new gt(e,t)}function ft(e,t,n="latest"){const r=("latest"===n?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function mt(e,t,n){let r;if(xo(),"function"==typeof n){const i=e.getLatest(),o=ft(i,t);if(r=n(o),t.isEqual(o,r))return i}else r=n;const i=e.getWritable();return _t(i).updateFromKnown(t,r),i}function yt(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=ql(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let bt=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Ct(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Ct(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function _t(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new bt(t,xt(t));return t.__state=n,n}function xt(e){return e.__state?e.__state.sharedNodeState:hs(Dl(),e.getType()).sharedNodeState}function Ct(e){if(e)for(const t in e)return e}function St(e){return e}function vt(e,t,n){for(const[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function wt(e,t,n){const{unknownState:r}=t,i=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0;return!1}function kt(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Et(e,t){const n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,l=t.__style,a=e.__state,c=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===e.__state||a===c||function(e,t){if(e===t)return!0;const n=new Set;return!(e&&vt(n,e,t)||t&&vt(n,t,e)||e&&wt(n,e,t)||t&&wt(n,t,e))}(a,c))}function Tt(e,t){const n=e.mergeWithSibling(t),r=vo()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Nt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Ei(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(Et(t,r)){r=Tt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Ei(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Et(r,n)){r=Tt(r,n);break}break}n.remove()}}else r.remove()}function At(e){return Lt(e.anchor),Lt(e.focus),e}function Lt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),Ei(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Ho(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let Ot,Ft,It,Rt,Pt,Mt,Dt,Bt,$t,zt,Ht,Kt="",Ut=null,Wt=null,Vt=!1,qt=!1;function jt(e,t){const n=Dt.get(e);if(null!==t){const n=cn(e);n.parentNode===t&&t.removeChild(n)}if(Bt.has(e)||Ft._keyToDOMMap.delete(e),Ho(n)){const e=Zl(n,Dt);Zt(e,0,e.length-1,null)}void 0!==n&&ol(zt,It,Rt,n,"destroyed")}function Zt(e,t,n,r){for(let i=t;i<=n;++i){const t=e[i];void 0!==t&&jt(t,r)}}function Gt(e,t){e.setProperty("text-align",t)}const Jt="40px";function Yt(e,t){const n=Ot.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(0===t)return void e.style.setProperty("padding-inline-start","");const r=getComputedStyle(Ft._rootElement||e).getPropertyValue("--lexical-indent-base-value")||Jt;e.style.setProperty("padding-inline-start",`calc(${t} * ${r})`)}function Xt(e,t){const n=e.style;0===t?Gt(n,""):1===t?Gt(n,"left"):2===t?Gt(n,"center"):3===t?Gt(n,"right"):4===t?Gt(n,"justify"):5===t?Gt(n,"start"):6===t&&Gt(n,"end")}function Qt(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if(qo(e))return null;const n=e.getParentOrThrow();return qo(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function en(e,t){const n=Bt.get(e);void 0===n&&_e(60);const r=Ht.$createDOM(n,Ft);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,Ft),Ei(n)?r.setAttribute("data-lexical-text","true"):Wo(n)&&r.setAttribute("data-lexical-decorator","true"),Ho(n)){const e=n.__indent,t=n.__size;if(Qt(r,n),0!==e&&Yt(r,e),0!==t){const e=t-1;tn(Zl(n,Bt),n,0,e,Ht.$getDOMSlot(n,r,Ft))}const i=n.__format;0!==i&&Xt(r,i),n.isInline()||rn(null,n,r)}else{const t=n.getTextContent();if(Wo(n)){const t=n.decorate(Ft,Ot);null!==t&&sn(e,t),r.contentEditable="false"}Kt+=t}return null!==t&&t.insertChild(r),Ht.$decorateDOM(n,null,r,Ft),ol(zt,It,Rt,n,"created"),r}function tn(e,t,n,r,i){const o=Kt;Kt="";let s=n;for(;s<=r;++s){en(e[s],i);const t=Bt.get(e[s]);null!==t&&Ei(t)?null===Ut&&(Ut=t.getFormat(),Wt=t.getStyle()):Ho(t)&&s<r&&!t.isInline()&&(Kt+=Ke)}i.element.__lexicalTextContent=Kt,Kt=o+Kt}function nn(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return ai(e)?"line-break":Wo(e)&&e.isInline()?"decorator":null}return"empty"}return null}function rn(e,t,n){const r=nn(e,Dt),i=nn(t,Bt);r!==i&&Ht.$getDOMSlot(t,n,Ft).setManagedLineBreak(i)}function on(e,t){const n=Dt.get(e);let r=Bt.get(e);void 0!==n&&void 0!==r||_e(61);const i=Vt||Mt.has(e)||Pt.has(e),o=ul(Ft,e);if(n===r&&!i){let e;if(Ho(n)){const t=o.__lexicalTextContent;"string"==typeof t?e=t:(e=n.getTextContent(),o.__lexicalTextContent=e)}else e=n.getTextContent();return Kt+=e,o}if(n!==r&&i&&ol(zt,It,Rt,r,"updated"),Ht.$updateDOM(r,n,o,Ft)){const n=en(e,null);return null===t&&_e(62),t.replaceChild(n,o),jt(e,null),n}if(Ho(n)){Ho(r)||_e(334,e);const t=r.__indent;(Vt||t!==n.__indent)&&Yt(o,t);const s=r.__format;if((Vt||s!==n.__format)&&Xt(o,s),i)(function(e,t,n){var r;Ut=null,Wt=null,function(e,t,n){const r=Kt,i=e.__size,o=t.__size;Kt="";const s=n.element;if(1===i&&1===o){const n=e.__first,i=t.__first;if(n===i)on(n,s);else{const e=cn(n),t=en(i,null);try{s.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${s.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(o)}throw r}jt(n,null)}const o=Bt.get(i);Ei(o)&&null===Ut&&(Ut=o.getFormat(),Wt=o.getStyle())}else{const r=Zl(e,Dt),l=Zl(t,Bt);if(r.length!==i&&_e(227),l.length!==o&&_e(228),0===i)0!==o&&tn(l,0,0,o-1,n);else if(0===o){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;Zt(r,0,i-1,e?null:s),e&&(s.textContent="")}}else!function(e,t,n,r,i,o){const s=r-1,l=i-1;let a,c,u=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=l;){const e=t[d],r=n[h];if(e===r)u=ln(on(r,o.element)),d++,h++;else{if(void 0===c&&(c=an(n,h)),void 0===a)a=an(t,d);else if(!a.has(e)){d++;continue}if(!c.has(e)){u=ln(cn(e)),jt(e,o.element),d++,a.delete(e);continue}if(a.has(r)){const e=ul(Ft,r);e!==u&&o.withBefore(u).insertChild(e),u=ln(on(r,o.element)),d++,h++}else en(r,o.withBefore(u)),h++}const i=Bt.get(r);null!==i&&Ei(i)?null===Ut&&(Ut=i.getFormat(),Wt=i.getStyle()):Ho(i)&&h<=l&&!i.isInline()&&(Kt+=Ke)}const g=d>s,p=h>l;if(g&&!p){const e=n[l+1],t=void 0===e?null:Ft.getElementByKey(e);tn(n,0,h,l,o.withBefore(t))}else p&&!g&&Zt(t,d,s,o.element)}(0,r,l,i,o,n)}s.__lexicalTextContent=Kt,Kt=r+Kt}(e,t,Ht.$getDOMSlot(t,n,Ft)),r=t,null==Ut||Ut===r.__textFormat||qt||r.setTextFormat(Ut),function(e){null==Wt||Wt===e.__textStyle||qt||e.setTextStyle(Wt)}(t)})(n,r,o),qo(r)||r.isInline()||rn(n,r,o);else{const e=o.__lexicalTextContent;let t;"string"==typeof e?t=e:(t=n.getTextContent(),o.__lexicalTextContent=t),Kt+=t}if((Vt||r.__dir!==n.__dir)&&(Qt(o,r),qo(r)&&!Vt))for(const e of r.getChildren())Ho(e)&&Qt(ul(Ft,e.getKey()),e)}else{const t=r.getTextContent();if(Wo(r)){const t=r.decorate(Ft,Ot);null!==t&&sn(e,t)}Kt+=t}if(!qt&&qo(r)&&r.__cachedText!==Kt){const e=r.getWritable();e.__cachedText=Kt,r=e}return Ht.$decorateDOM(r,n,o,Ft),o}function sn(e,t){let n=Ft._pendingDecorators;const r=Ft._decorators;if(null===n){if(r[e]===t)return;n=Bs(Ft)}n[e]=t}function ln(e){let t=e.nextSibling;return null!==t&&t===Ft._blockCursorElement&&(t=t.nextSibling),t}function an(e,t){const n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function cn(e){const t=$t.get(e);return void 0===t&&_e(75,e),t}function un(e){return{type:e}}const dn=un("SELECTION_CHANGE_COMMAND"),hn=un("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),gn=un("CLICK_COMMAND"),pn=un("BEFORE_INPUT_COMMAND"),fn=un("INPUT_COMMAND"),mn=un("COMPOSITION_START_COMMAND"),yn=un("COMPOSITION_END_COMMAND"),bn=un("DELETE_CHARACTER_COMMAND"),_n=un("INSERT_LINE_BREAK_COMMAND"),xn=un("INSERT_PARAGRAPH_COMMAND"),Cn=un("CONTROLLED_TEXT_INSERTION_COMMAND"),Sn=un("PASTE_COMMAND"),vn=un("REMOVE_TEXT_COMMAND"),wn=un("DELETE_WORD_COMMAND"),kn=un("DELETE_LINE_COMMAND"),En=un("FORMAT_TEXT_COMMAND"),Tn=un("UNDO_COMMAND"),Nn=un("REDO_COMMAND"),An=un("KEYDOWN_COMMAND"),Ln=un("KEY_ARROW_RIGHT_COMMAND"),On=un("MOVE_TO_END"),Fn=un("KEY_ARROW_LEFT_COMMAND"),In=un("MOVE_TO_START"),Rn=un("KEY_ARROW_UP_COMMAND"),Pn=un("KEY_ARROW_DOWN_COMMAND"),Mn=un("KEY_ENTER_COMMAND"),Dn=un("KEY_SPACE_COMMAND"),Bn=un("KEY_BACKSPACE_COMMAND"),$n=un("KEY_ESCAPE_COMMAND"),zn=un("KEY_DELETE_COMMAND"),Hn=un("KEY_TAB_COMMAND"),Kn=un("INSERT_TAB_COMMAND"),Un=un("INDENT_CONTENT_COMMAND"),Wn=un("OUTDENT_CONTENT_COMMAND"),Vn=un("DROP_COMMAND"),qn=un("FORMAT_ELEMENT_COMMAND"),jn=un("DRAGSTART_COMMAND"),Zn=un("DRAGOVER_COMMAND"),Gn=un("DRAGEND_COMMAND"),Jn=un("COPY_COMMAND"),Yn=un("CUT_COMMAND"),Xn=un("SELECT_ALL_COMMAND"),Qn=un("CLEAR_EDITOR_COMMAND"),er=un("CLEAR_HISTORY_COMMAND"),tr=un("CAN_REDO_COMMAND"),nr=un("CAN_UNDO_COMMAND"),rr=un("FOCUS_COMMAND"),ir=un("BLUR_COMMAND"),or=un("KEY_MODIFIER_COMMAND"),sr=Object.freeze({}),lr=[["keydown",function(e,t){ar=e.timeStamp,cr=e.key,t.isComposing()||cl(t,An,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;Fl(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Do(t,(()=>{fs(n)||(fr=!0)}))}],["compositionstart",function(e,t){cl(t,mn,e)}],["compositionend",function(e,t){we?yr=!0:Ee||!Ne&&!Oe?cl(t,yn,e):(br=!0,_r=e.data)}],["input",function(e,t){e.stopPropagation(),Do(t,(()=>{t.dispatchCommand(fn,e)}),{event:e}),dr=null}],["click",function(e,t){Do(t,(()=>{const n=eo(),r=Nl(bl(t)),i=to();if(r)if(Mi(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!qo(o)&&1===zs().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){const e=jl(o,(e=>Ho(e)&&!e.isInline()));Ho(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(Ol(n)||ws(n))&&Ks(Qi(i,r,t,e))}cl(t,gn,e)}))}],["cut",sr],["copy",sr],["dragstart",sr],["dragover",sr],["dragend",sr],["paste",sr],["focus",sr],["blur",sr],["drop",sr]];ke&&lr.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType;"deleteCompositionText"===n||we&&al(t)||"insertCompositionText"!==n&&cl(t,pn,e)}(e,t)]);let ar=0,cr=null,ur=0,dr=null;const hr=new WeakMap,gr=new WeakMap;let pr=!1,fr=!1,mr=!1,yr=!1,br=!1,_r="",xr=null,Cr=[0,"",0,"root",0];function Sr(e,t,n,r,i){const o=e.anchor,s=e.focus,l=o.getNode(),a=vo(),c=Nl(bl(a)),u=null!==c?c.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==s.key||!Ei(l)||(!i&&(!ke||ur<r+50)||l.isDirty()&&g<2||Ws(n))&&o.offset!==s.offset&&!l.isComposing()||vs(l)||l.isDirty()&&g>1||(i||!ke)&&null!==h&&!l.isComposing()&&u!==Es(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==e.format||l.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=Ss(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Ei(t)||Ho(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,l)}function vr(e,t){return ws(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function wr(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;pr&&(pr=!1,vr(r,i)&&vr(o,s)&&!xr)||Do(t,(()=>{if(!n)return void Ks(null);if(!ys(t,r,o))return;let l=eo();if(xr&&Mi(l)&&l.isCollapsed()){const e=l.anchor,t=xr.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(l=xr.clone(),Ks(l))}if(xr=null,Mi(l)){const n=l.anchor,r=n.getNode();if(l.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(l.dirty=!0);const i=bl(t).event,o=i?i.timeStamp:performance.now(),[s,a,c,u,d]=Cr,h=zs(),g=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===c&&n.key===u)kr(l,s,a);else if("text"===n.type)Ei(r)||_e(141),Er(l,r);else if("element"===n.type&&!g){Ho(r)||_e(259);const e=n.getNode();e.isEmpty()?function(e,t){kr(e,t.getTextFormat(),t.getTextStyle())}(l,e):kr(l,l.format,"")}}else{const e=n.key,t=l.focus.key,r=l.getNodes(),o=r.length,a=l.isBackward(),c=a?s:i,u=a?i:s,d=a?t:e,h=a?e:t;let g=2047,p=!1;for(let e=0;e<o;e++){const t=r[e],n=t.getTextContentSize();if(Ei(t)&&0!==n&&!(0===e&&t.__key===d&&c===n||e===o-1&&t.__key===h&&0===u)&&(p=!0,g&=t.getFormat(),0===g))break}l.format=p?g:0}}cl(t,dn,void 0)}))}function kr(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Er(e,t){kr(e,t.getFormat(),t.getStyle())}function Tr(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function Nr(e){const t=e.inputType,n=Tr(e),r=vo(),i=eo();if("deleteContentBackward"===t){if(null===i){const e=to();if(!Mi(e))return!0;Ks(e.clone())}if(Mi(i)){const t=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===cr&&o<ar+30&&r.isComposing()&&t){if(Fs(null),ar=0,setTimeout((()=>{Do(r,(()=>{Fs(null)}))}),30),Mi(i)){const e=i.anchor.getNode();e.markDirty(),Ei(e)||_e(142),Er(i,e)}}else{Fs(null),e.preventDefault();const n=i.anchor.getNode(),o=n.getTextContent(),s=n.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let a=Le&&t&&!l&&s;if(a&&i.isCollapsed()&&(a=!Wo(ll(i.anchor,!0))),!a){cl(r,bn,!0);const e=eo();Le&&Mi(e)&&e.isCollapsed()&&(xr=e,setTimeout((()=>xr=null)))}}return!0}}var o;if(!Mi(i))return!0;const s=e.data;null!==dr&&Zs(!1,r,dr),i.dirty&&null===dr||!i.isCollapsed()||qo(i.anchor.getNode())||null===n||i.applyDOMRange(n),dr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if("insertText"===t||"insertTranspose"===t){if("\n"===s)e.preventDefault(),cl(r,_n,!1);else if(s===Ke)e.preventDefault(),cl(r,xn,void 0);else if(null==s&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=s&&Sr(i,n,s,e.timeStamp,!0)?(e.preventDefault(),cl(r,Cn,s)):dr=s;return ur=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":cl(r,Cn,e);break;case"insertFromComposition":Fs(null),cl(r,Cn,e);break;case"insertLineBreak":Fs(null),cl(r,_n,!1);break;case"insertParagraph":Fs(null),mr&&!Ee?(mr=!1,cl(r,_n,!1)):cl(r,xn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":cl(r,Sn,e);break;case"deleteByComposition":(function(e,t){return e!==t||Ho(e)||Ho(t)||!Ss(e)||!Ss(t)})(c,u)&&cl(r,vn,e);break;case"deleteByDrag":pl(Xr),cl(r,vn,e);break;case"deleteByCut":cl(r,vn,e);break;case"deleteContent":cl(r,bn,!1);break;case"deleteWordBackward":cl(r,wn,!0);break;case"deleteWordForward":cl(r,wn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":cl(r,kn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":cl(r,kn,!1);break;case"formatStrikeThrough":cl(r,En,"strikethrough");break;case"formatBold":cl(r,En,"bold");break;case"formatItalic":cl(r,En,"italic");break;case"formatUnderline":cl(r,En,"underline");break;case"historyUndo":cl(r,Tn,void 0);break;case"historyRedo":cl(r,Nn,void 0)}return!0}function Ar(e){if(Ol(e.target)&&fs(e.target))return!0;const t=vo(),n=eo(),r=e.data,i=Tr(e);if(null!=r&&Mi(n)&&Sr(n,i,r,e.timeStamp,!1)){yr&&(Fr(t,r),yr=!1);const i=n.anchor.getNode(),o=Nl(bl(t));if(null===o)return!0;const s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,a=s?n.focus.offset:n.anchor.offset;ke&&!n.isCollapsed()&&Ei(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,l)+r+i.getTextContent().slice(l+a)===js(o.anchorNode)||cl(t,Cn,r);const c=r.length;we&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),Le&&t.isComposing()&&(ar=0,Fs(null))}else Zs(!1,t,null!==r?r:void 0),yr&&(Fr(t,r||void 0),yr=!1);return function(){xo();dt(vo())}(),!0}function Lr(e){const t=vo(),n=eo();if(Mi(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();Fs(r.key),pl(Qr),(e.timeStamp<ar+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Ei(i)&&i.getStyle()!==n.style)&&cl(t,Cn,Ue)}return!0}function Or(e){return Fr(vo(),e.data),pl(ei),!0}function Fr(e,t){const n=e._compositionKey;if(Fs(null),null!==n&&null!=t){if(""===t){const t=Rs(n),r=Es(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&Ei(t)){const n=Nl(bl(e));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Gs(t,r.nodeValue,i,o,!0)}return}if("\n"===t[t.length-1]){const t=eo();if(Mi(t)||Bi(t)){if(Mi(t)){const e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return void cl(e,Mn,null)}}}Zs(!0,e,t)}function Ir(e){const t=vo();if(null==e.key)return!0;if(br){if(tl(e))return Do(t,(()=>{Fr(t,_r)})),br=!1,_r="",!0;br=!1,_r=""}if(function(e){return Xs(e,"ArrowRight",{shiftKey:"any"})}(e))cl(t,Ln,e);else if(function(e){return Xs(e,"ArrowRight",Qs)}(e))cl(t,On,e);else if(function(e){return Xs(e,"ArrowLeft",{shiftKey:"any"})}(e))cl(t,Fn,e);else if(function(e){return Xs(e,"ArrowLeft",Qs)}(e))cl(t,In,e);else if(function(e){return Xs(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))cl(t,Rn,e);else if(function(e){return Xs(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))cl(t,Pn,e);else if(function(e){return Xs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))mr=!0,cl(t,Mn,e);else if(function(e){return" "===e.key}(e))cl(t,Dn,e);else if(function(e){return ve&&Xs(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),mr=!0,cl(t,_n,!0);else if(function(e){return Xs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))mr=!1,cl(t,Mn,e);else if(function(e){return Xs(e,"Backspace",{shiftKey:"any"})||ve&&Xs(e,"h",{ctrlKey:!0})}(e))tl(e)?cl(t,Bn,e):(e.preventDefault(),cl(t,bn,!0));else if(function(e){return"Escape"===e.key}(e))cl(t,$n,e);else if(function(e){return Xs(e,"Delete",{})||ve&&Xs(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),cl(t,bn,!1)):cl(t,zn,e);else if(function(e){return Xs(e,"Backspace",el)}(e))e.preventDefault(),cl(t,wn,!0);else if(function(e){return Xs(e,"Delete",el)}(e))e.preventDefault(),cl(t,wn,!1);else if(function(e){return ve&&Xs(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),cl(t,kn,!0);else if(function(e){return ve&&(Xs(e,"Delete",{metaKey:!0})||Xs(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),cl(t,kn,!1);else if(function(e){return Xs(e,"b",Qs)}(e))e.preventDefault(),cl(t,En,"bold");else if(function(e){return Xs(e,"u",Qs)}(e))e.preventDefault(),cl(t,En,"underline");else if(function(e){return Xs(e,"i",Qs)}(e))e.preventDefault(),cl(t,En,"italic");else if(function(e){return Xs(e,"Tab",{shiftKey:"any"})}(e))cl(t,Hn,e);else if(function(e){return Xs(e,"z",Qs)}(e))e.preventDefault(),cl(t,Tn,void 0);else if(function(e){return ve?Xs(e,"z",{metaKey:!0,shiftKey:!0}):Xs(e,"y",{ctrlKey:!0})||Xs(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),cl(t,Nn,void 0);else{const n=t._editorState._selection;null===n||Mi(n)?nl(e)&&(e.preventDefault(),cl(t,Xn,e)):function(e){return Xs(e,"c",Qs)}(e)?(e.preventDefault(),cl(t,Jn,e)):function(e){return Xs(e,"x",Qs)}(e)?(e.preventDefault(),cl(t,Yn,e)):nl(e)&&(e.preventDefault(),cl(t,Xn,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(or,e),!0}function Rr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Pr=new Map;function Mr(e){const t=function(e){const t=yl(e);return t?t.getSelection():null}(e.target);if(null===t)return;const n=_s(t.anchorNode);if(null===n)return;fr&&(fr=!1,Do(n,(()=>{const r=to(),i=t.anchorNode;(Ol(i)||ws(i))&&Ks(Qi(r,t,n,e))})));const r=Vs(n),i=r[r.length-1],o=i._key,s=Pr.get(o),l=s||i;l!==n&&wr(t,l,!1),wr(t,n,!0),n!==i?Pr.set(o,n):s&&Pr.delete(o)}function Dr(e){e._lexicalHandled=!0}function Br(e){return!0===e._lexicalHandled}function $r(e){const t=hr.get(e);if(void 0===t)return;const n=gr.get(t);if(void 0===n)return;const r=n-1;r>=0||_e(164),hr.delete(e),gr.set(t,r),0===r&&t.removeEventListener("selectionchange",Mr);const i=xs(e);bs(i)?(function(e){if(null!==e._parentEditor){const t=Vs(e),n=t[t.length-1]._key;Pr.get(n)===e&&Pr.delete(n)}else Pr.delete(e._key)}(i),e.__lexicalEditor=null):i&&_e(198);const o=Rr(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}function zr(e,t,n){xo();const r=e.__key,i=e.getParent();if(null===i)return;const o=function(e){const t=eo();if(!Mi(t)||!Ho(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return ml(i,e)&&n.set(e.__key,0,"element"),ml(o,e)&&r.set(e.__key,0,"element"),t}(e);let s=!1;if(Mi(o)&&t){const t=o.anchor,n=o.focus;t.key===r&&(io(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(io(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else Bi(o)&&t&&e.isSelected()&&e.selectPrevious();if(Mi(o)&&t&&!s){const t=e.getIndexWithinParent();Ls(e),no(o,i,t,-1)}else Ls(e);n||Cl(i)||i.canBeEmpty()||!i.isEmpty()||zr(i,t),t&&o&&qo(i)&&i.isEmpty()&&i.selectEnd()}const Hr=Symbol.for("ephemeral");function Kr(e){return e[Hr]||!1}let Ur=class{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=ql(this);return void 0===e&&_e(64,this.name),e}static clone(e){_e(65,this.name)}$config(){return{}}config(e,t){const n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),As(this,e)}getType(){return this.__type}isInline(){_e(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=Rs(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||eo();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(Ei(this))return n;if(Mi(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Wo(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Rs(e)}getParentOrThrow(){const e=this.getParent();return null===e&&_e(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(Cl(t))return Ho(e)||e===this&&Wo(e)||_e(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&_e(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Rs(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Rs(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Ho(this)?this:this.getParent(),n=Ho(e)?e:e.getParent(),r=t&&n?ka(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=ka(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Sa(t):("same"!==t.type&&"ancestor"!==t.type&&_e(279),!1)))}isParentOf(e){const t=ka(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;const s=Ho(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const a=i.getParentOrThrow();if(r.has(a.__key)||n.push(a),a===e)break;let c=null,u=a;do{if(null===u&&_e(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=vo()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(Kr(this))return this;const e=Rs(this.__key);return null===e&&_e(113),e}getWritable(){if(Kr(this))return this;xo();const e=So(),t=vo(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=eo();if(null!==s&&s.setCachedNodes(null),o.has(r))return Os(i),i;const l=Kl(i);return o.add(r),Os(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){_e(70)}updateDOM(e,t,n){_e(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){_e(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let i=r;for(const e of xt(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&_t(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){zr(this,!0,e)}replace(e,t){xo();let n=eo();null!==n&&(n=n.clone()),wl(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;Ls(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(zr(r,!1,!0),null===c?l.__first=o:c.getWritable().__next=o,s.__prev=d,null===u?l.__last=o:u.getWritable().__prev=o,s.__next=h,s.__parent=g,l.__size=a,t&&(Ho(this)&&Ho(s)||_e(139),this.getChildren().forEach((e=>{s.append(e)}))),Mi(n)){Ks(n);const e=n.anchor,t=n.focus;e.key===i&&Ri(e,s),t.key===i&&Ri(t,s)}return Is()===i&&Fs(o),s}insertAfter(e,t=!0){xo(),wl(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=eo();let s=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(Ls(r),Mi(o)){const e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===a?c.__last=u:a.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Mi(o)){const e=this.getIndexWithinParent();no(o,c,e+1);const t=c.__key;s&&o.anchor.set(t,e+2,"element"),l&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){xo(),wl(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;Ls(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const c=eo();return t&&Mi(c)&&no(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return es()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){xo();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Ho(n))return n.select();if(!Ei(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){xo();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Ho(n))return n.select(0,0);if(!Ei(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Wr(e){return e instanceof Ur}const Vr="historic",qr="history-push",jr="history-merge",Zr="paste",Gr="collaboration",Jr="skip-scroll-into-view",Yr="skip-dom-selection",Xr="skip-selection-focus",Qr="composition-start",ei="composition-end",ti=/\s*!important\s*$/i;function ni(e){const t={};if(!e)return t;let n="",r="",i=null,o=!1,s=!1,l=!1,a=0;for(let c=0;c<e.length;c++){const u=e[c];if(o)"*"===u&&"/"===e[c+1]&&(o=!1,c++);else if(s)l?r+=u:n+=u,s=!1;else if(null===i)if("/"!==u||"*"!==e[c+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==a){if(";"===u&&0===a){const e=n.trim(),i=r.trim();""!==e&&""!==i&&(t[e]=i),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else a=Math.max(0,a-1),l?r+=u:n+=u;else a++,l?r+=u:n+=u;else i=u,l?r+=u:n+=u;else o=!0,c++;else l?r+=u:n+=u,"\\"===u?s=!0:u===i&&(i=null)}const c=n.trim(),u=r.trim();return""!==c&&""!==u&&(t[c]=u),t}function ri(e,t,n){const r=ti.test(n)?"important":"",i=""===r?n:n.replace(ti,"").trim();e.setProperty(t,i,r)}function ii(e,t,n=""){if(t===n)return;const r=ni(n),i=ni(t);for(const t in i)delete r[t],ri(e,t,i[t]);for(const t in r)e.removeProperty(t)}class oi extends Ur{static getType(){return"linebreak"}static clone(e){return new oi(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&Pl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&ci(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&ci(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&Pl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&ci(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&ci(r))return!0}return!1}(e)?null:{conversion:si,priority:0}}}static importJSON(e){return li().updateFromJSON(e)}}function si(e){return{node:li()}}function li(){return vl(new oi)}function ai(e){return e instanceof oi}function ci(e){return ws(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function ui(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function di(e,t){return 1&t?"strong":2&t?"em":"span"}function hi(e,t,n,r,i){const o=r.classList;let s=il(i,"base");void 0!==s&&o.add(...s),s=il(i,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;void 0!==s&&(8&n&&4&n?(l=!0,a||o.add(...s)):a&&o.remove(...s));for(const e in Ze){const r=Ze[e];if(s=il(i,e),void 0!==s)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0===(t&r)||a&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function gi(e,t,n){const r=t.firstChild,i=n.isComposing(),o=e+(i?He:"");if(null==r)t.textContent=o;else{const e=r.nodeValue;if(e!==o)if(i||we){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function pi(e,t,n,r,i,o){gi(i,e,t);const s=o.theme.text;void 0!==s&&hi(0,0,r,e,s)}function fi(e,t){const n=document.createElement(t);return n.appendChild(e),n}class mi extends Ur{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new mi(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Qe[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Is()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ze[e];return 0!==(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ts(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const n=this.__format,r=ui(0,n),i=di(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l)),pi(l,this,0,n,this.__text,e);const a=this.__style;return""!==a&&ii(s.style,a),s}updateDOM(e,t,n){const r=this.__text,i=e.__format,o=this.__format,s=ui(0,i),l=ui(0,o),a=di(0,i),c=di(0,o);if((null===s?a:s)!==(null===l?c:l))return!0;if(s===l&&a!==c){const e=t.firstChild;null==e&&_e(48);const i=document.createElement(c);return pi(i,this,0,o,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==s&&(u=t.firstChild,null==u&&_e(49)),gi(r,u,this);const d=n.theme.text;void 0!==d&&i!==o&&hi(0,i,o,u,d);const h=e.__style,g=this.__style;return h!==g&&ii(t.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Ci,priority:0}),b:()=>({conversion:bi,priority:0}),code:()=>({conversion:wi,priority:0}),em:()=>({conversion:wi,priority:0}),i:()=>({conversion:wi,priority:0}),mark:()=>({conversion:wi,priority:0}),s:()=>({conversion:wi,priority:0}),span:()=>({conversion:yi,priority:0}),strong:()=>({conversion:wi,priority:0}),sub:()=>({conversion:wi,priority:0}),sup:()=>({conversion:wi,priority:0}),u:()=>({conversion:wi,priority:0})}}static importJSON(e){return ki().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Ol(t)||_e(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=fi(t,"b")),this.hasFormat("italic")&&(t=fi(t,"i")),this.hasFormat("strikethrough")&&(t=fi(t,"s")),this.hasFormat("underline")&&(t=fi(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Ze[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Ge[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ts(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Xe[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){xo();let n=e,r=t;const i=eo(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Mi(i))return Gi(s,n,s,r,"text","text");{const e=Is();e!==i.anchor.key&&e!==i.focus.key||Fs(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=e;l<0&&(l=s+l,l<0&&(l=0));const a=eo();if(r&&Mi(a)){const t=e+s;a.setTextNodeRange(i,t,i,t)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){xo();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Is(),o=n.length;e.sort(((e,t)=>e-t)),e.push(o);const s=[],l=e.length;for(let t=0,r=0;t<o&&r<=l;r++){const i=e[r];i>t&&(s.push(n.slice(t,i)),t=i)}const a=s.length;if(1===a)return[t];const c=s[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const b=eo();if(Mi(b)){const[e,t]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=ki(c),d.__format=h,d.__style=g,d.__detail=p,d.__state=kt(t,d),f=!0):d=t.setTextContent(c);const _=[d];for(let e=1;e<a;e++){const n=ki(s[e]);n.__format=h,n.__style=g,n.__detail=p,n.__state=kt(t,n);const o=n.__key;i===r&&Fs(o),_.push(n)}const x=m?m.offset:null,C=y?y.offset:null;let S=0;for(const e of _){if(!m&&!y)break;const t=S+e.getTextContentSize();if(null!==m&&null!==x&&x<=t&&x>=S&&(m.set(e.getKey(),x-S,"text"),x<t&&(m=null)),null!==y&&null!==C&&C<=t&&C>=S){y.set(e.getKey(),C-S,"text");break}S=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&Os(t),null!==n&&Os(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,_),this.remove()):e.splice(t,1,_),Mi(b)&&no(b,u,t,a-1)}return _}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||_e(50);const n=this.__key,r=e.__key,i=this.__text,o=i.length;Is()===r&&Fs(n);const s=eo();if(Mi(s)){const i=s.anchor,l=s.focus;null!==i&&i.key===r&&oo(i,t,n,e,o),null!==l&&l.key===r&&oo(l,t,n,e,o)}const l=e.__text,a=t?l+i:i+l;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function yi(e){return{forChild:Ti(e.style),node:null}}function bi(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Ti(t.style,n?void 0:"bold"),node:null}}const _i=new WeakMap;function xi(e){if(!Ol(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Ci(e){const t=e;null===e.parentElement&&_e(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=_i.get(n))&&!xi(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)_i.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(li()):"\t"===r?t.push(Ai()):""!==r&&t.push(ki(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=Si(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=Si(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:ki(n)}}function Si(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,Ol(n)){const e=n.style.display;if(""===e&&!Rl(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(ws(n))return n;if("BR"===n.nodeName)return null}}const vi={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function wi(e){const t=vi[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Ti(e.style,t),node:null}}function ki(e=""){return vl(new mi(e))}function Ei(e){return e instanceof mi}function Ti(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,l=r.includes("underline"),a=e.verticalAlign;return e=>Ei(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==a||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==a||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Ni extends mi{static getType(){return"tab"}static clone(e){return new Ni(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=il(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Ai().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&xe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||_e(286),this}setDetail(e){return 2!==e&&_e(127),this}setMode(e){return"normal"!==e&&_e(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ai(){return vl(new Ni)}function Li(e){return e instanceof Ni}class Oi{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Ca(Pa(Ea(this,"next")),Pa(Ea(e,"next")))<0}getNode(){const e=Rs(this.key);return null===e&&_e(20),e}set(e,t,n,r){const i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,_o()||(Is()===o&&Fs(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function Fi(e,t,n){return new Oi(e,t,n)}function Ii(e,t){let n=t.__key,r=e.offset,i="element";if(Ei(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!Ho(t)){const e=t.getNextSibling();if(Ei(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Ri(e,t){if(Ho(t)){const n=t.getLastDescendant();Ho(n)||Ei(n)?Ii(e,n):Ii(e,t)}else Ii(e,t)}class Pi{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Bi(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Pi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(Ei(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=Rs(e);null!==t&&n.push(t)}return _o()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){const e=this.getNodes();if((eo()||to())===this&&e[0]){const t=ca(e[0],"next");Na(_a(t,t))}for(const t of e)t.remove()}}function Mi(e){return e instanceof Di}class Di{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Mi(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=function(e){const t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);const i=new Set,o=new Set;for(const n of e)if(oa(n)){const{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{const{origin:e}=n;Ho(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),ia(e.focus)&&Ho(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=ga(e.focus.origin,"previous");oa(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=pa(n))i.delete(n.origin),t.pop();for(;t.length>1;){const e=t[t.length-1];if(!Ho(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=Pa(e.anchor),r=Pa(e.anchor.getFlipped()),i=e=>ra(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(Ba(La(this),"next"));return _o()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=zi(this);let a="",c=!0;for(let u=0;u<e.length;u++){const d=e[u];if(Ho(d)&&!d.isInline())c||(a+="\n"),c=!d.isEmpty();else if(c=!1,Ei(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<l?e.slice(s,l):e.slice(l,s)):e=o?e.slice(s):e.slice(l):d===n&&(e=o?e.slice(0,l):e.slice(0,s)),a+=e}else!Wo(d)&&!ai(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=vo(),n=t.getEditorState()._selection,r=ji(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),At(this)}clone(){const e=this.anchor,t=this.focus;return new Di(Fi(e.key,e.offset,e.type),Fi(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ts(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ze[e];return 0!==(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(li()):"\t"===r?n.push(Ai()):n.push(ki(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){const i=e.getNode(),o=i.getChildAtIndex(e.offset),s=ki();if(s.setFormat(n),s.setStyle(r),ts(o))o.splice(0,0,[s]);else{const e=qo(i)?es().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&Ta(s,Pa(Ea(s,"next")));const l=o.offset;let a=s.offset;const c=this.getNodes(),u=c.length;let d=c[0];Ei(d)||_e(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let p=c[u-1];if(1===u&&"element"===s.type&&(a=h,s.set(o.key,a,"text")),this.isCollapsed()&&l===h&&(vs(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Ei(t)&&t.canInsertTextBefore()&&!vs(t)||(t=ki(),t.setFormat(r),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(vs(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Ei(t)&&!vs(t)||(t=ki(),t.setFormat(r),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const e=ki(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){const t=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Ho(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),qi(this.anchor,this.focus),void this.insertText(e)}if(1===u){if(Ss(d)){const t=ki(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(l!==a||t===r&&n===i){if(Li(d)){const t=ki(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=ki(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)d.insertBefore(t,!1);else{const[e]=d.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}const o=a-l;d=d.spliceText(l,o,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{const t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=Ho(d)?d:d.getParentOrThrow();let r=Ho(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===s.type&&(0!==a||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<a)if(Ei(p)&&!Ss(p)&&a!==p.getTextContentSize()){if(p.isSegmented()){const e=ki(p.getTextContent());p.replace(e),p=e}qo(s.getNode())||"text"!==s.type||(p=p.spliceText(0,a,"")),t.add(p.__key)}else{const e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);const o=r.getChildren(),g=new Set(c),f=n.is(r),m=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){const t=o[e];if(t.is(d)||Ho(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Ss(d))if(l===h)d.select();else{const t=ki(e);t.select(),d.replace(t)}else d=d.spliceText(l,h-l,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<u;e++){const n=c[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const e=eo()===this;Aa(this,Ra(La(this))),e&&eo()!==this&&Ks(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Fs(null);const n=this.getNodes(),r=[];for(const e of n)Ei(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(Ho(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),Fs(null),void i(t);const s=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:s,u=a?s:l;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=o-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(vs(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||vs(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const b=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||vs(m)||([m]=m.splitText(y)),m.setFormat(b));for(let t=d+1;t<f;t++){const n=r[t],i=n.getFormatFlags(e,b);n.setFormat(i)}"text"===c.type&&c.set(h.__key,g,"text"),"text"===u.type&&u.set(m.__key,y,"text"),this.format=p|b}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const t=eo();return Mi(t)||_e(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=jl(t,Ml),r=e[e.length-1];if(Ho(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=co(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(Ho(e)||Wo(e))&&!e.isInline()))){Ho(n)||_e(211,t.constructor.name,t.getType());const i=co(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=es();let n=null;for(let r=0;r<e.length;r++){const i=e[r],o=ai(i);if(o||Wo(i)&&i.isInline()||Ho(i)&&i.isInline()||Ei(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),o=i.getLastDescendant(),s=i.getChildren(),l=Ho(n)&&n.isEmpty()?null:this.insertParagraph(),a=s[s.length-1];let c=s[0];var u;Ho(u=c)&&Ml(u)&&!u.isEmpty()&&Ho(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Ho(n)||_e(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=s[1]),c&&(null===n&&_e(212,t.constructor.name,t.getType()),function(e,t){const n=t.getParentOrThrow().getLastChild();let r=t;const i=[t];for(;r!==n;)r.getNextSibling()||_e(140),r=r.getNextSibling(),i.push(r);let o=e;for(const e of i)o=o.insertAfter(e)}(n,c));const d=jl(o,Ml);l&&Ho(d)&&(l.canMergeWhenEmpty()||Ml(a))&&(d.append(...l.getChildren()),l.remove()),Ho(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=Ho(n)?n.getLastChild():null;ai(h)&&d!==n&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const e=es();return zs().splice(this.anchor.offset,0,[e]),e.select(),e}const e=co(this),t=jl(this.anchor.getNode(),Ml);Ho(t)||_e(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=li();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=[...this.getNodes()],t=e.length;let n=e[0],r=e[t-1];const[i,o]=zi(this),s=this.isBackward(),[l,a]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,u]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(Ei(n)&&!this.isCollapsed()){const e=n.splitText(c,u),t=0===c?e[0]:e[1];return t?(l.set(t.getKey(),0,"text"),a.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(Ei(n)&&(c===n.getTextContentSize()?e.shift():0!==c&&([,n]=n.splitText(c),e[0]=n,l.set(n.getKey(),0,"text"))),Ei(r)){const t=r.getTextContent().length;0===u?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,a.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){if(ho(this,e,t,n))return;const r="move"===e,i=vo(),o=Nl(bl(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,a=this.focus.getNode();if(null===l||null===s||!Ho(a)||a.isInline()||a.canBeEmpty()||Tl(s,i,l),this.dirty){let e=ul(i,this.anchor.key),t=ul(i,this.focus.key);"text"===this.anchor.type&&(e=Es(e)),"text"===this.focus.type&&(t=Es(t)),e&&t&&so(o,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(o,e,t?"backward":"forward",n),o.rangeCount>0){const e=o.getRangeAt(0),n=this.anchor.getNode(),i=qo(n)?n:xl(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];ml(t,i)?r.push(t):s=!0}if(s&&r.length>0)if(t){const e=r[0];Ho(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Ho(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}o.anchorNode===e.startContainer&&o.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,o=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,o,!0)}(this)}}"lineboundary"===n&&ho(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Ho(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Ho(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=ya(Ea(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(oa(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Ho(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=Pa(t);Aa(this,_a(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(ia(t)){if(Ho(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(Wo(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Ho(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Yi();e.add(t.origin.getKey()),Ks(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return Aa(this,_a(!t.origin.isEmpty()&&n.isEmpty()?Oa(ca(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&Hi(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Ui(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Ui(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,o=r.offset,s=e<o,l=s?e:o,a=s?o:e,c=a-1;l!==c&&function(e){return!(Ws(e)||Ki(e))}(i.getTextContent().slice(l,a))&&(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&qo(e.getParent())&&null===e.getPreviousSibling()&&Hi(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Bi(e){return e instanceof Pi}function $i(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function zi(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[$i(n),$i(r)]}function Hi(e,t){for(let n=t;n;n=n.getParent()){if(Ho(n)){if(n.collapseAtStart(e))return!0;if(Cl(n))break}if(n.getPreviousSibling())break}return!1}const Ki=(()=>{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Ui(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let e=0;e<o;e++){const r=e===o-1;if(l=s,s+=i[e].length,t&&s===n||s>n||r){i.splice(e,1),r&&(l=void 0);break}}const a=i.join("").trim();""===a?r.remove():(r.setTextContent(a),r.select(l,l))}function Wi(e,t,n,r){let i,o=t;if(Ol(e)){let s=!1;const l=e.childNodes,a=l.length,c=r._blockCursorElement;o===a&&(s=!0,o=a-1);let u=l[o],d=!1;if(u===c)u=l[o+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&o--}if(i=Us(u),Ei(i))o=da(i,s?"next":"previous");else{let l=Us(e);if(null===l)return null;if(Ho(l)){const a=r.getElementByKey(l.getKey());null===a&&_e(214);const c=Bl(r).$getDOMSlot(l,a,r);[l,o]=c.resolveChildIndex(l,a,e,t),Ho(l)||_e(215),s&&o>=l.getChildrenSize()&&(o=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(o);if(Ho(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=s?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=Ho(u)?u:u.getParentOrThrow()),o=0}Ei(u)?(i=u,l=null,o=da(u,s?"next":"previous")):u!==l&&s&&!d&&(Ho(l)||_e(216),o=Math.min(l.getChildrenSize(),o+1))}else{const n=l.getIndexWithinParent();o=0===t&&Wo(l)&&Us(e)===l?n:n+1,l=l.getParentOrThrow()}if(Ho(l))return Fi(l.__key,o,"element")}}else i=Us(e);return Ei(i)?Fi(i.__key,da(i,o,"clamp"),"text"):null}function Vi(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&Ho(o)&&o.isInline()){const t=o.getPreviousSibling();Ei(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Ho(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Ei(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(t&&Ho(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Ho(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();Ei(t)&&e.set(t.__key,0,"text")}}}function qi(e,t,n){if("text"===e.type&&"text"===t.type){const n=e.isBefore(t),r=e.is(t);Vi(e,n,r),Vi(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function ji(e,t,n,r,i,o){if(null===e||null===n||!ys(i,e,n))return null;const s=Wi(e,t,Mi(o)?o.anchor:null,i);if(null===s)return null;const l=Wi(n,r,Mi(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const t=Us(e),r=Us(n);if(Wo(t)&&Wo(r))return null}return qi(s,l),[s,l]}function Zi(e){return Ho(e)&&!e.isInline()}function Gi(e,t,n,r,i,o){const s=So(),l=new Di(Fi(e,t,i),Fi(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Ji(){const e=Fi("root",0,"element"),t=Fi("root",0,"element");return new Di(e,t,0,"")}function Yi(){return new Pi(new Set)}function Xi(e,t){return Qi(null,e,t,null)}function Qi(e,t,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,a=!rt&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let c,u,d,h;if(Mi(e)&&!a)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,(l||void 0===s)&&Mi(e)&&!ys(n,c,u))return e.clone();const g=ji(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;let m=0,y="";if(Mi(e)){const t=e.anchor;if(p.key===t.key)m=e.format,y=e.style;else{const e=p.getNode();Ei(e)?(m=e.getFormat(),y=e.getStyle()):Ho(e)&&(m=e.getTextFormat(),y=e.getTextStyle())}}return new Di(p,f,m,y)}function eo(){return So()._selection}function to(){return vo()._editorState._selection}function no(e,t,n,r=1){const i=e.anchor,o=e.focus,s=i.getNode(),l=o.getNode();if(!t.is(s)&&!t.is(l))return;const a=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(a,n,"element"),o.set(a,n,"element"),ro(e)}}else{const s=e.isBackward(),l=s?o:i,c=l.getNode(),u=s?i:o,d=u.getNode();if(t.is(c)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(a,Math.max(0,e+r),"element")}if(t.is(d)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(a,Math.max(0,e+r),"element")}}ro(e)}function ro(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!Ho(o))return;const e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ei(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(Ho(o)){const e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ei(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Ho(s)){const e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(Ei(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function io(e,t,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,Ei(r)?(s=r.getTextContentSize(),l="text"):Ho(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,Ei(i)?l="text":Ho(i)&&(l="element")),null!==o&&null!==l?e.set(o,s,l):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function oo(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function so(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function lo(e,t,n){const r=ul(e,t.getKey());if(Ho(t)){const i=Bl(e).$getDOMSlot(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function ao(e){let t=eo()||to();null===t&&(t=zs().selectEnd()),t.insertNodes(e)}function co(e){let t=e;e.isCollapsed()||t.removeText();const n=eo();Mi(n)&&(t=n),Mi(t)||_e(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!Ml(i);){const e=i;if([i,o]=uo(i,o),e.is(i))break}return o}function uo(e,t){const n=e.getParent();if(!n){const e=es();return zs().append(e),e.select(),[zs(),0]}if(Ei(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Ho(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new Di(Fi(e.__key,t,"element"),Fi(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function ho(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const o=Ea(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!Ma(a)){for(const e of a){c=!1;const{origin:t}=e;if(!Wo(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of ya(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(oa(e))e.origin.isInline()||(a=e);else{if(Ho(e.origin))continue;Wo(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===o)return!1;if(l&&!s&&Wo(a.origin)&&a.origin.isKeyboardSelectable()){const e=Yi();return e.add(a.origin.getKey()),Ks(e),!0}return a=Pa(a),l&&Ta(e.anchor,a),Ta(e.focus,a),c||!s}let go=null,po=null,fo=!1,mo=!1,yo=0;const bo={characterData:!0,childList:!0,subtree:!0};function _o(){return fo||null!==go&&go._readOnly}function xo(){fo&&_e(13)}function Co(){yo>99&&_e(14)}function So(){return null===go&&_e(195,wo()),go}function vo(){return null===po&&_e(337,wo()),po}function wo(){let e=0;const t=new Set,n=as.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=xs(r);if(bs(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function ko(e,t,n){const r=t.__type,i=hs(e,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function Eo(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function To(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function No(e){return Ao(e,vo()._nodes)}function Ao(e,t){const n=e.type,r=t.get(n);void 0===r&&_e(17,n);const i=r.klass;e.type!==i.getType()&&_e(18,i.name);const o=i.importJSON(e),s=e.children;if(Ho(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){const n=Ao(s[e],t);o.append(n)}return o}function Lo(e,t,n){const r=go,i=fo,o=po;go=t,fo=!0,po=e;try{return n()}finally{go=r,fo=i,po=o}}function Oo(e,t){const n=e._pendingEditorState,r=e._rootElement,i=e._headless||null===r;if(null===n)return void(e._deferred.length>0&&Ro(e,e._deferred));const o=e._editorState,s=o._selection,l=n._selection,a=0!==e._dirtyType,c=go,u=fo,d=po,h=e._updating,g=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!i&&a&&null!==g){po=e,go=n,fo=!1,e._updating=!0;try{const t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),p=function(e,t,n,r,i,o){Kt="",Vt=2===r,Ft=n,Ot=n._config,Ht=n._config.dom||is,It=n._nodes,Rt=Ft._listeners.mutation,Pt=i,Mt=o,Dt=e._nodeMap,Bt=t._nodeMap,qt=t._readOnly,$t=new Map(n._keyToDOMMap);const s=new Map;return zt=s,on("root",null),Ft=void 0,It=void 0,Pt=void 0,Mt=void 0,Dt=void 0,Bt=void 0,Ot=void 0,$t=void 0,zt=void 0,Ht=is,s}(o,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),mo)throw t;return ns(e,null,r,n),ht(e),e._dirtyType=2,mo=!0,Oo(e,o),void(mo=!1)}finally{g.observe(r,bo),e._updating=h,go=c,fo=u,po=d}}n._readOnly||(n._readOnly=!0);const f=e._dirtyLeaves,m=e._dirtyElements,y=e._normalizedNodes,b=e._updateTags,_=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=Bs(e)),delete r[o])}(e,n);const x=i?null:Nl(bl(e));if(e._editable&&null!==x&&(a||null===l||l.dirty||!l.is(s))&&null!==r&&!b.has(Yr)){po=e,go=n;try{if(null!==g&&g.disconnect(),a||null===l||l.dirty){const t=e._blockCursorElement;null!==t&&Tl(t,e,r),function(e,t,n,r,i,o){const s=r.anchorNode,l=r.focusNode,a=r.anchorOffset,c=r.focusOffset,u=document.activeElement;if(i.has(Gr)&&u!==o||null!==u&&ms(u))return;if(!Mi(t))return void(null!==e&&ys(n,s,l)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.getNode(),p=h.getNode(),[f,m]=lo(n,g,d.offset),[y,b]=lo(n,p,h.offset),_=t.format,x=t.style,C=t.isCollapsed();let S=f,v=y,w=!1;var k,E,T,N,A;if("text"===d.type?(S=Es(f),w=g.getFormat()!==_||g.getStyle()!==x):Mi(e)&&"text"===e.anchor.type&&(w=!0),"text"===h.type&&(v=Es(y)),null!==S&&null!==v&&(C&&(null===e||w||Mi(e)&&(e.format!==_||e.style!==x))&&(k=_,E=x,T=m,N=d.key,A=performance.now(),Cr=[k,E,T,N,A]),a!==m||c!==b||s!==S||l!==v||"Range"===r.type&&C||(null!==u&&o.contains(u)||i.has(Xr)||o.focus({preventScroll:!0}),"element"===d.type))){if(so(r,S,m,v,b),!we||!t.isCollapsed()||null===o||i.has(Xr)||null!==document.activeElement&&o.contains(document.activeElement)||o.focus({preventScroll:!0}),!i.has(Jr)&&t.isCollapsed()&&null!==o&&o===document.activeElement){const e=Mi(t)&&"element"===t.anchor.type?S.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=hl(n),i=yl(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,l=0,a=0,c=n;for(;null!==c;){const t=c===r.body;if(t){l=0,a=bl(e).innerHeight;const t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),o=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(l+=n),isFinite(o)&&(a-=o)}else{const e=c.getBoundingClientRect();l=e.top,a=e.bottom}let n=0;if(o<l?n=-(l-o):s>a&&(n=s-a),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;o-=t,s-=t}if(t)break;c=dl(c)}}(n,t,o)}}pr=!0}}(s,l,e,x,b,r)}!function(e,t,n){let r=e._blockCursorElement;if(Mi(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,a=null;if(s===o.getChildrenSize())El(o.getChildAtIndex(s-1))&&(l=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&El(t)){const n=t.getPreviousSibling();(null===n||El(n))&&(l=!0,a=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(o.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=Va(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===a?n.appendChild(r):n.insertBefore(r,a))}}null!==r&&Tl(r,e,t)}(e,r,l)}finally{null!==g&&g.observe(r,bo),po=d,go=c}}null!==p&&function(e,t,n,r,i){const o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){const[s,l]=o[e];for(const e of l){const o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,p,b,f,o),Mi(l)||null===l||null!==s&&s.is(l)||e.dispatchCommand(dn,void 0);const C=e._pendingDecorators;null!==C&&(e._decorators=C,e._pendingDecorators=null,Fo("decorator",e,!0,C)),function(e,t,n){const r=$s(t),i=$s(n);r!==i&&Fo("textcontent",e,!0,i)}(e,t||o,n),Fo("update",e,!0,{dirtyElements:m,dirtyLeaves:f,editorState:n,mutatedNodes:p,normalizedNodes:y,prevEditorState:t||o,tags:b}),Ro(e,_),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;Mo(e,t,r)}}}(e)}function Fo(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=t._listeners[e],i=Array.from(n);for(const[e,t]of i){t&&t();const i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Io(e,t,n,r){const i=Vs(e);let o;for(let e=4;e>=0;e--)for(let s=0;s<i.length;s++){const l=i[s];if(s>0&&l._updating){o=l;break}const a=l._commands.get(t);if(void 0!==a){const t=a[e];if(t.size>0){let e=!1;if(Do(l,(()=>{for(const i of t)if(i(n,r))return void(e=!0)})),e)return e}}}return o&&o.update((()=>{Io(o,t,n,r)})),!1}function Ro(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Po(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t,o=e._pendingEditorState;let s;void 0!==i&&(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(null===o&&_e(191),o._flushSync=!0),s&&e._deferred.push(s),To(e,i.tag)),null==o?Mo(e,n,i):n()}}return r}function Mo(e,t,n){const r=e._updateTags;let i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,To(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let a=e._pendingEditorState,c=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=jo(a||l),c=!0),a._flushSync=s;const u=go,d=fo,h=po,g=e._updating;go=a,fo=!1,e._updating=!0,po=e;const p=e._headless||null===e.getRootElement();us(null);try{c&&(p?null!==l._selection&&(a._selection=l._selection.clone()):a._selection=function(e,t){const n=e.getEditorState()._selection,r=Nl(bl(e));return Mi(n)||null==n?Qi(n,r,e,t):n.clone()}(e,n&&n.event||null));const r=e._compositionKey;t(),o=Po(e,o),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(Mi(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(o?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);Ei(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Nt(t)}}(a,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=Is(),s=new Map;let l=n,a=l.size,c=r,u=c.size;for(;a>0||u>0;){if(a>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);Ei(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Nt(r),void 0!==r&&Eo(r,o)&&ko(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){yo++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],l=e[1];if(r.set(n,l),!l)continue;const a=i.get(n);void 0!==a&&Eo(a,o)&&ko(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,yo++}t._dirtyLeaves=n,t._dirtyElements=r}(a,e),Po(e),function(e,t,n,r){const i=e._nodeMap,o=t._nodeMap,s=[];for(const[e]of r){const t=o.get(e);void 0!==t&&(t.isAttached()||(Ho(t)&&nt(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(const e of s)o.delete(e);for(const e of n){const t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(l,a,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(Mi(i)){const e=a._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||_e(19)}else Bi(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Oo(e)}finally{go=u,fo=d,po=h,e._updating=g,yo=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);f?a._flushSync?(a._flushSync=!1,Oo(e)):c&&ps((()=>{Oo(e)})):(a._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Do(e,t,n){po===e&&void 0===n?t():Mo(e,t,n)}class Bo{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Bo(this.element,e,this.after)}withAfter(e){return new Bo(this.element,this.before,e)}withElement(e){return this.element===e?this:new Bo(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&_e(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&_e(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&_e(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(Oe||Ee||Ne);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.setProperty("display","inline","important"),e.style.setProperty("border","0px","important"),e.style.setProperty("margin","0px","important"),e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=$o(t,n);i.push(r);const o=$o(t,this.element);let s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){const t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function $o(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&_e(225),n.reverse()}class zo extends Ur{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ye[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=vo()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(Ei(t)&&e.push(t),Ho(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ho(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Ho(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return Ho(e)&&e.getLastDescendant()||e||null}const r=t[e];return Ho(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Rs(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&_e(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Rs(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&_e(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),Ho(i)&&r!==n-1&&!i.isInline()&&(e+=Ke)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),Ho(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){const t=Je[e];return 0!==(this.getFormat()&t)}return!1}hasTextFormat(e){const t=Ze[e];return 0!==(this.getTextFormat()&t)}getFormatFlags(e,t){return Ts(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){xo();const n=eo();let r=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(Ei(e)||Ho(e))return e.select(0,0)}else if(!(void 0!==e&&e!==o||void 0!==t&&t!==o)){const e=this.getLastChild();if(Ei(e)||Ho(e))return e.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return Mi(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):Gi(s,r,s,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e&&Je[e]||0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Kr(this)&&_e(324,this.__key,this.__type);const r=this.getChildrenSize(),i=this.getWritable();e+t<=r||_e(226,String(e),String(t),String(r));const o=i.__key,s=[],l=[],a=this.getChildAtIndex(e+t);let c=null,u=r-t+n.length;if(0!==e)if(e===r)c=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(c=t.getPreviousSibling())}if(t>0){let e=null===c?this.getFirstChild():c.getNextSibling();for(let n=0;n<t;n++){null===e&&_e(100);const t=e.getNextSibling(),n=e.__key;Ls(e.getWritable()),l.push(n),e=t}}let d=c;for(const e of n){null!==d&&e.is(d)&&(c=d=d.getPreviousSibling());const t=e.getWritable();t.__parent===o&&u--,Ls(t);const n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{const e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&_e(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(i.__size=u,l.length){const e=eo();if(Mi(e)){const t=new Set(l),n=new Set(s),{anchor:r,focus:i}=e;Ko(r,t,n)&&io(r,r.getNode(),this,c,a),Ko(i,t,n)&&io(i,i.getNode(),this,c,a),0!==u||this.canBeEmpty()||Cl(this)||this.remove()}}return i}getDOMSlot(e){return new Bo(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0===t&&""===n||Cl(this)||this.getChildren().some(Ei)||(0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=Bl(t).$getDOMSlot(this,e,t);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Ho(e){return e instanceof zo}function Ko(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Uo extends Ur{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Wo(e){return e instanceof Uo}class Vo extends zo{__cachedText;static getType(){return"root"}static clone(){return new Vo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){_e(51)}getTextContent(){const e=this.__cachedText;return!_o()&&0!==vo()._dirtyType||null===e?super.getTextContent():e}remove(){_e(52)}replace(e){_e(53)}insertBefore(e){_e(54)}insertAfter(e){_e(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Ho(e)||Wo(e)||_e(282);return super.splice(e,t,n)}static importJSON(e){return zs().updateFromJSON(e)}collapseAtStart(){return!0}}function qo(e){return e instanceof Vo}function jo(e){return new Jo(new Map(e._nodeMap))}function Zo(){return new Jo(new Map([["root",new Vo]]))}function Go(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&_e(130,n.name),Ho(e)){const r=t.children;Array.isArray(r)||_e(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=Go(i[e]);r.push(t)}}return t}class Jo{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return Lo(t&&t.editor||null,this,e)}clone(e){const t=new Jo(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return Lo(null,this,(()=>({root:Go(zs())})))}}class Yo extends zo{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Xo extends zo{static getType(){return"paragraph"}static clone(e){return new Xo(e.__key)}createDOM(e){const t=document.createElement("p"),n=il(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Qo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return es().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(void 0===e.textFormat||void 0===e.textStyle){const t=this.getChildren().find(Ei);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const n=es();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||Ei(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Qo(e){const t=es();if(e.style&&(t.setFormat(e.style.textAlign),Ul(e,t)),""===t.getFormatType()){const n=e.getAttribute("align");n&&n&&n in Je&&t.setFormat(n)}return{node:t}}function es(){return vl(new Xo)}function ts(e){return e instanceof Xo}function ns(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Zo(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function rs(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=ql(r),i=r.transform;if(!n.has(i)){n.add(i);const e=r.transform();e&&t.add(e)}if(e){const n=e.$transform;n&&t.add(n),r=e.extends}else{const e=Object.getPrototypeOf(r);r=e.prototype instanceof Ur&&e!==Ur?e:void 0}}return t}const is={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{const n=gs(t,e.getType());return n&&void 0!==n.exportDOM?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>Ho(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>(Ho(e)||_e(336,e.getKey(),e.getType()),e.getDOMSlot(t)),$shouldExclude:(e,t,n)=>Ho(e)&&e.excludeFromCopy("html"),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function os(e){const t=e||{},n=po,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Zo(),l=t.namespace||(null!==i?i._config.namespace:qs()),a=t.editorState,c=[Vo,mi,oi,Ni,Xo,Yo,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e<c.length;e++){let t=c[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}ql(t);const i=t.getType(),o=rs(t);g.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:yt(c[e]),transforms:o})}}const p=new as(s,i,g,{disableEvents:o,dom:{...is,...e&&e.dom},namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==a&&(p._pendingEditorState=a,p._dirtyType=2),function(e){e.registerCommand(pn,Nr,0),e.registerCommand(fn,Ar,0),e.registerCommand(mn,Lr,0),e.registerCommand(yn,Or,0),e.registerCommand(An,Ir,0)}(p),p}function ss(e,t){const n=e.get(t);e.delete(t),n&&n()}function ls(e,t,n){return e.set(t,n),ss.bind(null,e,t)}class as{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=qs(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){return ls(this._listeners.update,e)}registerEditableListener(e){return ls(this._listeners.editable,e)}registerDecoratorListener(e){return ls(this._listeners.decorator,e)}registerTextContentListener(e){return ls(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return Za(ls(t,e,e(this._rootElement,null)||void 0),(()=>function(e,t,n){const r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement])))}registerCommand(e,t,n){void 0===n&&_e(35);const r=this._commands;r.has(e)||r.set(e,[new tt,new tt,new tt,new tt,new tt]);const i=r.get(e);void 0===i&&_e(36,String(e));const o=function(e){return 7&e}(n),s=i[o];return o!==n?s.addFront(t):s.addBack(t),()=>{s.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&_e(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Hl(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=Hl(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=Rs(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:jr}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return cl(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=il(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,ns(this,t,e,r),null!==t&&(this._config.disableEvents||$r(t),null!=n&&t.classList.remove(...n)),null!==e){const t=yl(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,ht(this),this._updateTags.add(jr),Oo(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument;hr.set(e,n);const r=gr.get(n)??0;r<1&&n.addEventListener("selectionchange",Mr),gr.set(n,r+1),e.__lexicalEditor=t;const i=Rr(e);for(let n=0;n<lr.length;n++){const[r,o]=lr[n],s="function"==typeof o?e=>{Br(e)||(Dr(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(Br(e))return;Dr(e);const n=t.isEditable();switch(r){case"cut":return n&&cl(t,Yn,e);case"copy":return cl(t,Jn,e);case"paste":return n&&cl(t,Sn,e);case"dragstart":return n&&cl(t,jn,e);case"dragover":return n&&cl(t,Zn,e);case"dragend":return n&&cl(t,Gn,e);case"focus":return n&&cl(t,rr,e);case"blur":return n&&cl(t,ir,e);case"drop":return n&&cl(t,Vn,e)}};e.addEventListener(r,s),i.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(jr),Oo(this);Fo("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&_e(38);let n=e;n._readOnly&&(n=jo(e),n._selection=e._selection?e._selection.clone():null),dt(this);const r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),Oo(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||Oo(this)}parseEditorState(e,t){return function(e,t,n){const r=Zo(),i=go,o=fo,s=po,l=t._dirtyElements,a=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,go=r,fo=!1,po=t,us(null);try{const i=t._nodes;Ao(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=a,t._cloneNotNeeded=c,t._dirtyType=u,go=i,fo=o,po=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Oo(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Mo(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Do(this,(()=>{const r=eo(),i=zs();null!==r?r.dirty||Ks(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),pl("focus"),fl((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=Nl(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Fo("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}as.version="0.44.0+prod.esm";let cs=null;function us(e){cs=e}let ds=1;function hs(e,t){const n=gs(e,t);return void 0===n&&_e(30,t),n}function gs(e,t){return e._nodes.get(t)}const ps="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function fs(e){return Wo(Ds(e))}function ms(e){const t=document.activeElement;if(!Ol(t))return!1;const n=t.nodeName;return Wo(Ds(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==xs(t))}function ys(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!ms(t)&&_s(t)===e}catch(e){return!1}}function bs(e){return e instanceof as}function _s(e){let t=e;for(;null!=t;){const e=xs(t);if(bs(e))return e;t=dl(t)}return null}function xs(e){return e?e.__lexicalEditor:null}function Cs(e){return qe.test(e)?"rtl":je.test(e)?"ltr":null}function Ss(e){return Li(e)||e.isToken()}function vs(e){return Ss(e)||e.isSegmented()}function ws(e){return Fl(e)&&3===e.nodeType}function ks(e){return Fl(e)&&9===e.nodeType}function Es(e){let t=e;for(;null!=t;){if(ws(t))return t;t=t.firstChild}return null}function Ts(e,t,n){const r=Ze[t];if(null!==n&&(e&r)===(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function Ns(e){return Ei(e)||ai(e)||Wo(e)}function As(e,t){const n=function(){const e=cs;return cs=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);xo(),Co();const r=vo(),i=So(),o=""+ds++;i._nodeMap.set(o,e),Ho(e)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,e.__key=o}function Ls(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,a=null!==i?i.getWritable():null,c=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==a&&(a.__next=s),null!==c&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Os(e){Co(),Kr(e)&&_e(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=So(),i=vo(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);const l=t.__key;i._dirtyType=1,Ho(e)?s.set(l,!0):i._dirtyLeaves.add(l)}function Fs(e){xo();const t=vo(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Rs(n);null!==e&&e.getWritable()}if(null!==e){const t=Rs(e);null!==t&&t.getWritable()}}}function Is(){return _o()?null:vo()._compositionKey}function Rs(e,t){const n=(t||So())._nodeMap.get(e);return void 0===n?null:n}function Ps(e,t){const n=Ms(e,vo());return void 0!==n?Rs(n,t):null}function Ms(e,t){return e[`__lexicalKey_${t._key}`]}function Ds(e,t){let n=e;for(;null!=n;){const e=Ps(n,t);if(null!==e)return e;n=dl(n)}return null}function Bs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function $s(e){return e.read((()=>zs().getTextContent()))}function zs(){return Hs(So())}function Hs(e){return e._nodeMap.get("root")}function Ks(e){xo();const t=So();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Us(e){const t=vo(),n=function(e,t){let n=e;for(;null!=n;){const e=Ms(n,t);if(void 0!==e)return e;n=dl(n)}return null}(e,t);return null===n?e===t.getRootElement()?Rs("root"):null:Rs(n)}function Ws(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Vs(e){const t=[];for(let n=e;null!==n;n=n._parentEditor)t.push(n);return t}function qs(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function js(e){return ws(e)?e.nodeValue:null}function Zs(e,t,n){const r=Nl(bl(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=js(i);const r=Ds(i);if(null!==t&&Ei(r)){if((t===He||t===Ue)&&n){const e=n.length;t=n,o=e,s=e}null!==t&&Gs(r,t,o,s,e)}}}function Gs(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let l=t;if((s||i)&&(t.endsWith(He)&&(l=t.slice(0,-He.length)),i)){const e=Ue;let t;for(;-1!==(t=l.indexOf(e));)l=l.slice(0,t)+l.slice(t+e.length),null!==n&&n>t&&(n=Math.max(t,n-e.length)),null!==r&&r>t&&(r=Math.max(t,r-e.length))}const a=o.getTextContent();if(i||l!==a){if(""===l){if(Fs(null),Ne||Ee||Oe)o.remove();else{const e=vo();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=to(),a=o.getTextContentSize(),c=Is(),u=o.getKey();if(o.isToken()||null!==c&&u===c&&!s||Mi(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===a&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const d=eo();if(!Mi(d)||null===n||null===r)return void Js(o,l,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=ki(o.getTextContent());o.replace(e),o=e}Js(o,l,d)}}}function Js(e,t,n){if(e.setTextContent(t),Mi(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=da(e,i.offset,"clamp"))}}}function Ys(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Xs(e,t,n){if(!function(e,t){return Ys(e,t,"altKey")&&Ys(e,t,"ctrlKey")&&Ys(e,t,"shiftKey")&&Ys(e,t,"metaKey")}(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1)return!1;if(1===e.key.length&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith("Digit")&&/^\d$/.test(t))return e.code===`Digit${t}`;const r="Key"+t.toUpperCase();return e.code===r}const Qs={ctrlKey:!ve,metaKey:ve},el={altKey:ve,ctrlKey:!ve};function tl(e){return"Backspace"===e.key}function nl(e){return Xs(e,"a",Qs)}function rl(e){const t=zs();if(Mi(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),At(e),e}{const e=t.select(0,t.getChildrenSize());return Ks(At(e)),e}}function il(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=Va(i);return n[t]=e,e}return i}function ol(e,t,n,r,i){if(0===n.size)return;const o=r.__type,s=r.__key,l=t.get(o);void 0===l&&_e(33,o);const a=l.klass;let c=e.get(a);void 0===c&&(c=new Map,e.set(a,c));const u=c.get(s),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(s,d?"updated":i)}function sl(e,t,n){const r=e.getParent();let i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function ll(e,t){const n=e.offset;if("element"===e.type)return sl(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?sl(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function al(e){const t=bl(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function cl(e,t,n){return Io(e,t,n,e)}function ul(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&_e(75,t),n}function dl(e){const t=e.assignedSlot||e.parentElement;return Il(t)?t.host:t}function hl(e){return ks(e)?e:Ol(e)?e.ownerDocument:null}function gl(e){return vo()._updateTags.has(e)}function pl(e){xo(),vo()._updateTags.add(e)}function fl(e){xo(),vo()._deferred.push(e)}function ml(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function yl(e){const t=hl(e);return t?t.defaultView:null}function bl(e){const t=e._window;return null===t&&_e(78),t}function _l(e){return Ho(e)&&e.isInline()||Wo(e)&&e.isInline()}function xl(e){let t=e.getParentOrThrow();for(;null!==t;){if(Cl(t))return t;t=t.getParentOrThrow()}return t}function Cl(e){return qo(e)||Ho(e)&&e.isShadowRoot()}function Sl(e,t=!1){const n=e.constructor.clone(e);return As(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function vl(e){const t=vo(),n=e.getType(),r=gs(t,n);void 0===r&&_e(200,e.constructor.name,n);const{replace:i,replaceWithKlass:o}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==o?t instanceof o||_e(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||_e(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&_e(203,e.constructor.name,n,r.name,r.getType()),t}return e}function wl(e,t){!qo(e.getParent())||Ho(t)||Wo(t)||_e(99)}function kl(e){const t=Rs(e);return null===t&&_e(63,e),t}function El(e){return(Wo(e)||Ho(e)&&!e.canBeEmpty())&&!e.isInline()}function Tl(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function Nl(e){return Ce?(e||window).getSelection():null}function Al(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),Cl(e)&&_e(102);const r=e=>{const t=e.getParentOrThrow(),i=Cl(t),o=e!==n||i?Sl(e):e;if(i)return Ho(e)&&Ho(o)||_e(133),e.insertAfter(o),[e,o,o];{const[n,i,s]=r(t),l=e.getNextSiblings();return s.append(o,...l),[n,i,o]}},[i,o]=r(n);return[i,o]}function Ll(e){return Ol(e)&&"A"===e.tagName}function Ol(e){return Fl(e)&&1===e.nodeType}function Fl(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function Il(e){return Fl(e)&&11===e.nodeType}function Rl(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function Pl(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function Ml(e){if(Wo(e)&&!e.isInline())return!0;if(!Ho(e)||Cl(e))return!1;const t=e.getFirstChild(),n=null===t||ai(t)||Ei(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Dl(){return vo()}function Bl(e=Dl()){return e._config.dom||is}const $l=new WeakMap,zl=new Map;function Hl(e){if(!e._readOnly&&e.isEmpty())return zl;e._readOnly||_e(192);let t=$l.get(e);return t||(t=function(e){const t=new Map;for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),$l.set(e,t)),t}function Kl(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Ul(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Wl(e){return!0===e.__lexicalUnmanaged}function Vl(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Ur[t]}function ql(e){const t=et in e.prototype?e.prototype[et]():void 0,n=function(e){if(!(e===Ur||e.prototype instanceof Ur)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{as.version&&(n=JSON.parse(as.version))}catch(e){}_e(290,e.name,t,n)}return e===Uo||e===zo||e===Ur}(e),r=!n&&Vl(e,"getType")?e.getType():void 0;let i,o=r;if(t)if(r)i=t[r];else for(const[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(Vl(e,"getType")||(e.getType=()=>o),Vl(e,"clone")||(e.clone=t=>(us(t),new e)),Vl(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Vl(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const jl=(e,t)=>{let n=e;for(;null!=n&&!qo(n);){if(t(n))return n;n=n.getParent()}return null};function Zl(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=null===t?Rs(r):t.get(r);null==e&&_e(174),n.push(r),r=e.__next}return n}const Gl={next:"previous",previous:"next"};class Jl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return xa({hasNext:ia,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return ca(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ca(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();s.set(e.getKey(),e)}for(const e of r){if(s.size>0){const t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&_e(263,Array.from(s).join(" "))}else i.insert(e);i=ca(e,this.direction)}for(const e of s.values())e.remove();return this}}class Yl extends Jl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ga(e,this.direction)}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ql(this.direction);return ca(this.getNodeAtCaret(),e)||ga(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Yl&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Xl={root:qo,shadowRoot:Cl};function Ql(e){return Gl[e]}function ea(e,t="root"){return Xl[t](e)?null:e}class ta extends Jl{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ca(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ho(this.origin)?ga(this.origin,this.direction):null}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ql(this.direction);return ca(this.getNodeAtCaret(),e)||ga(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof ta&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof ta||e instanceof na)&&this.direction===e.direction&&this.origin.is(e.origin)}}class na extends Jl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ua(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return ca(ea(this.getParentAtCaret(),e),this.direction)}getFlipped(){return ua(this.origin,Ql(this.direction),this.offset)}isSamePointCaret(e){return e instanceof na&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof ta||e instanceof na)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return ca(this.origin,this.direction)}}function ra(e){return e instanceof na}function ia(e){return e instanceof ta}function oa(e){return e instanceof Yl}const sa={next:class extends na{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends na{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},la={next:class extends ta{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends ta{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},aa={next:class extends Yl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Yl{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function ca(e,t){return e?new la[t](e):null}function ua(e,t,n){return e?new sa[t](e,da(e,n)):null}function da(e,t,n="error"){const r=e.getTextContentSize();let i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&xe(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function ha(e,t){return new ma(e,t)}function ga(e,t){return Ho(e)?new aa[t](e):null}function pa(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class fa{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new fa(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return ra(t)?function(e,t){const{direction:n,origin:r}=e;return ha(e,da(r,"focus"===t?Ql(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[ha(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=ra(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ra(n),i=t=>t.isSameNodeCaret(n)?null:pa(t)||t.getParentCaret(e);return xa({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class ma{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return ua(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function ya(e){return _a(e,ca(zs(),e.direction))}function ba(e){return _a(e,e)}function _a(e,t){return e.direction!==t.direction&&_e(265),new fa(e,t,e.direction)}function xa(e){const{initial:t,hasNext:n,step:r,map:i}=e;let o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const e={done:!1,value:i(o)};return o=r(o),e}}}function Ca(e,t){const n=ka(e.origin,t.origin);switch(null===n&&_e(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{const n="text"===e.type,r="text"===t.type;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Sa(n)}}function Sa(e){const{a:t,b:n}=e,r=t.__key,i=n.__key;let o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function va(e,t){return t.is(e)}function wa(e){return Ho(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function ka(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=wa(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=wa(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(va(e,r)||_e(276),{commonAncestor:r,type:"ancestor"}):null===i?(va(t,r)||_e(277),{commonAncestor:r,type:"descendant"}):((Ho(o)||va(e,o))&&(Ho(i)||va(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||_e(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function Ea(e,t){const{type:n,key:r,offset:i}=e,o=kl(e.key);return"text"===n?(Ei(o)||_e(266,o.getType(),r),ua(o,t,i)):(Ho(o)||_e(267,o.getType(),r),$a(o,e.offset,t))}function Ta(e,t){const{origin:n,direction:r}=t,i="next"===r;ra(t)?e.set(n.getKey(),t.offset,"text"):ia(t)?Ei(n)?e.set(n.getKey(),da(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(oa(t)&&Ho(n)||_e(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function Na(e){const t=eo(),n=Mi(t)?t:Ji();return Aa(n,e),Ks(n),n}function Aa(e,t){Ta(e.anchor,t.anchor),Ta(e.focus,t.focus)}function La(e){const{anchor:t,focus:n}=e,r=Ea(t,"next"),i=Ea(n,"next"),o=Ca(r,i)<=0?"next":"previous";return _a(Da(r,o),Da(i,o))}function Oa(e){const{direction:t,origin:n}=e,r=ca(n,Ql(t)).getNodeAtCaret();return r?ca(r,t):ga(n.getParentOrThrow(),t)}function Fa(e,t="root"){const n=[e];for(let r=oa(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(Oa(r));return n}function Ia(e){return!!e&&e.origin.isAttached()}function Ra(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=Ba(e,r),s=Fa(o.anchor,n),l=Fa(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(oa(e))a.add(e.origin.getKey());else if(ia(e)){const{origin:t}=e;Ho(t)&&!a.has(t.getKey())||c.push(t)}for(const e of c)e.remove();for(const e of o.getTextSlices()){if(!e)continue;const{origin:t}=e.caret,n=t.getTextContentSize(),o=Oa(ca(t,r)),a=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===i||"token"===a&&0!==e.distance)o.remove();else if(0!==e.distance){i="removeEmptySlices";let t=e.removeTextSlice();const n=e.caret.origin;if("segmented"===a){const e=t.origin,n=ki(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());o.replaceOrInsert(n),t=ua(n,r,t.offset)}n.is(s[0].origin)&&(s[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let u,d;for(const e of s)if(Ia(e)){u=Pa(e);break}for(const e of l)if(Ia(e)){d=Pa(e);break}const h=function(e,t,n){if(!e||!t)return null;const r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let a;for(a=0;a<l&&o[a]===s[a];a++);const c=(e,t)=>{let n;for(let r=a;r<e.length;r++){const i=e[r];if(Cl(i))return;!n&&t(i)&&(n=i)}return n},u=c(o,Ml),d=u&&c(s,(e=>n.has(e.getKey())&&Ml(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;ga(e,"previous").splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){const e=n;n=n.getParent(),e.remove(!0)}}const g=[u,d,...s,...l].find(Ia);if(g)return ba(Da(Pa(g),e.direction));_e(269,JSON.stringify(s.map((e=>e.origin.__key))))}function Pa(e){const t=function(e){let t=e;for(;oa(t);){const e=pa(t);if(!oa(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Ei(t.origin))return ra(t)?t:ua(t.origin,n,n);const r=t.getAdjacentCaret();return ia(r)&&Ei(r.origin)?ua(r.origin,n,Ql(n)):t}function Ma(e){return ra(e)&&e.offset!==da(e.origin,e.direction)}function Da(e,t){return e.direction===t?e:e.getFlipped()}function Ba(e,t){return e.direction===t?e:_a(Da(e.focus,t),Da(e.anchor,t))}function $a(e,t,n){let r=ga(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return Da(r,n)}function za(e,t="root"){let n=0,r=e,i=pa(r);for(;null===i;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=pa(r)}return i&&[i,n]}function Ha(e){const{origin:t,offset:n,direction:r}=e;if(n===da(t,r))return e.getSiblingCaret();if(n===da(t,Ql(r)))return Oa(e.getSiblingCaret());const[i]=t.splitText(n);return Ei(i)||_e(281),Da(ca(i,"next"),r)}function Ka(e,t){return!0}function Ua(e,{$copyElementNode:t=Sl,$splitTextPointCaretNext:n=Ha,rootMode:r="shadowRoot",$shouldSplit:i=Ka,removeEmptyDestination:o=!1}={}){if(ra(e))return n(e);const s=e.getParentCaret(r);if(s){const{origin:n}=s;if(oa(e)){const e=Oa(s);if(o&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,"first"))return e}const r=function(e){const t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(t(n).splice(0,0,r))}return s}function Wa(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}function Va(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function qa(e,...t){const n=Va(...t);n.length>0&&e.classList.add(...n)}function ja(e,...t){const n=Va(...t);n.length>0&&e.classList.remove(...n)}function Za(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Ga(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ja(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ya(e){const t=Dl().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Xa(e){return Ya(qo(e)?e:e.getParentOrThrow())}function Qa(e){const t=Xa(e);return null!==t&&"rtl"===t.direction}function ec(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!vs(t)&&null!==r){const[i,o]=r,s=e.isBackward(),l=i.getNode(),a=o.getNode(),c=t.is(l),u=t.is(a);if(c||u){const[r,i]=zi(e),o=l.is(a),c=t.is(s?a:l),u=t.is(s?l:a);let d,h=0;o?(h=r>i?i:r,d=r>i?r:i):c?(h=s?i:r,d=void 0):u&&(h=0,d=s?r:i);const g=t.__text.slice(h,d);g!==t.__text&&("clone"===n&&(t=function(e){return(t=Kl(e))[Hr]=!0,t;var t}(t)),t.__text=g)}}return t}function tc(e,t){(Mi(e)?e.isCollapsed():Ei(e)||Ho(e))||Ga(280);const n=ni(Mi(e)?e.style:Ei(e)?e.getStyle():e.getTextStyle()),r=Ja(Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}));Mi(e)||Ei(e)?e.setStyle(r):e.setTextStyle(r)}function nc(e){const t=eo();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(Mi(t))for(const e of La(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!Ei(t)||!t.canHaveFormat())continue;const[n,i]=r(t);i!==n&&(vs(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}Mi(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&rc(t)}function rc(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:o}=t;t.set(n.key,n.offset,n.type),n.set(r,i,o)}}function ic(e,t){const n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function oc(e,t,n=ic){if(null===e)return;const r=e.getStartEndPoints(),i=new Map;let o=null;if(r){const[e,t]=r;o=Ji(),o.anchor.set(e.key,e.offset,e.type),o.focus.set(t.key,t.offset,t.type);const n=jl(e.getNode(),Ml),s=jl(t.getNode(),Ml);Ho(n)&&i.set(n.getKey(),n),Ho(s)&&i.set(s.getKey(),s)}for(const t of e.getNodes())if(Ho(t)&&Ml(t))i.set(t.getKey(),t);else if(null===r){const e=jl(t,Ml);Ho(e)&&i.set(e.getKey(),e)}for(const[e,r]of i){const i=t();n(r,i),r.replace(i,!0),o&&(e===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,o.anchor.type),e===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,o.focus.type))}o&&e.is(eo())&&Ks(o)}function sc(e){const t=lc(e);return null!==t&&"vertical-rl"===t.writingMode}function lc(e){const t=e.anchor.getNode();return Ho(t)?Ya(t):Xa(t)}function ac(e,t){let n=sc(e)?!t:t;cc(e)&&(n=!n);const r=Ea(e.focus,n?"previous":"next");if(Ma(r))return!1;for(const e of ya(r)){if(oa(e))return!e.origin.isInline();if(!Ho(e.origin)){if(Wo(e.origin))return!0;break}}return!1}function cc(e){const t=lc(e);return null!==t&&"rtl"===t.direction}function uc(e,t,n){const r=cc(e);let i;i=sc(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function dc(e,t,n){const r=ni(e.getStyle());return null!==r&&r[t]||n}function hc(e,t,n=""){let r=null;const i=e.getNodes(),o=e.anchor,s=e.focus,l=e.isBackward(),a=l?s.getNode():o.getNode(),c=l?o.getNode():s.getNode(),u=l?s.offset:o.offset,d=l?o.offset:s.offset;if(Mi(e)&&e.isCollapsed()&&""!==e.style){const n=ni(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<i.length;e++){const o=i[e];if((0!==e||!o.is(a)||!Ei(o)||u!==o.getTextContentSize())&&(0===e||!o.is(c)||0!==d)&&Ei(o)){const e=dc(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}const gc=ni,pc=["class","contenteditable","href","src","style","title"],fc=["color","background-color"];function mc(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function yc(e,t,n,r){e.addEventListener(t,n,r);const i=new WeakRef(e),o=new WeakRef(n);return function(){const e=o.deref();e&&i.deref()?.removeEventListener(t,e,r)}}be.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...gc(t.attrValue)},n={};for(const t in e)fc.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Ja(n):t.keepAttr=!1}})),be.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class bc{#e=[];track(...e){this.#e.push(...e)}dispose(){for(;this.#e.length;){this.#e.pop()()}}}function _c(e){return t=>{const n=e(t);return n&&t.preventDefault(),n}}function xc(e,t,n=""){const r=document.createElement(e);for(const[e,n]of Object.entries(t||{}))"dataset"===e?Object.entries(n).forEach((([e,t])=>r.dataset[e]=t)):e in r?r[e]=n:null!=n&&r.setAttribute(e,n);return n&&(r.innerHTML=n),r}function Cc(e){return(new DOMParser).parseFromString(e,"text/html")}function Sc(e){return e.startsWith("image/")&&!e.includes("svg")}function vc(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function wc(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function kc(e=""){return Cc(e).body.textContent.trim()}function Ec(e){return e&&!e.disabled&&function(e,t){return e.checkVisibility?e.checkVisibility(t):Boolean(e.offsetParent)}(e)}function Tc(e,t){const n=document.activeElement;if(e.includes(n)){new Nc(e,t.key).selectNext(n)&&t.preventDefault()}}class Nc{constructor(e,t){this.elements=e,this.key=t}selectNext(e){const t=this.#t(e);if(t){const e=this.elements.filter((e=>e!==t));return this.#n(e),this.#r(t),!0}return!1}#t(e){switch(this.key){case"ArrowRight":case"ArrowDown":return this.#i(e);case"ArrowLeft":case"ArrowUp":return this.#o(e);case"Home":return this.#s();case"End":return this.#l()}}#s(e=this.elements){return e.find(Ec)}#l(e=this.elements){return e.findLast(Ec)}#i(e){const t=this.elements.slice(this.#a(e)+1);return this.#s(t)}#o(e){const t=this.elements.slice(0,this.#a(e));return this.#l(t)}#a(e){return this.elements.indexOf(e)}#r(e){Ec(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}var Ac='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.05273 1.88232C10.6866 1.88237 12.0033 2.20353 12.9529 2.89673L13.1272 3.0293C13.974 3.70864 14.4008 4.63245 14.4009 5.76562C14.4008 6.49354 14.2316 7.15281 13.8845 7.73145C13.6683 8.09188 13.3997 8.40162 13.0818 8.66016C13.5902 8.92606 14.0196 9.28599 14.3635 9.74121C14.8586 10.3834 15.0945 11.1743 15.0945 12.0879C15.0944 13.3698 14.5922 14.3931 13.5879 15.1106L13.5857 15.1128C12.5967 15.805 11.196 16.125 9.43799 16.125H3.10547V1.88232L9.05273 1.88232ZM6.36108 13.4084H9.28418C10.224 13.4084 10.8634 13.2491 11.2581 12.9851C11.6259 12.7389 11.8198 12.3768 11.8198 11.8367C11.8197 11.2968 11.6259 10.9351 11.2581 10.689C10.8634 10.425 10.2241 10.2649 9.28418 10.2649H6.36108V13.4084ZM6.36108 7.56812H8.78247C9.5163 7.56809 10.0547 7.45371 10.429 7.25757L10.5791 7.16895C10.9438 6.92178 11.1255 6.57934 11.1255 6.09302C11.1254 5.59017 10.9414 5.25227 10.5835 5.02002L10.5784 5.01636L10.5732 5.01343C10.1994 4.75387 9.61878 4.59818 8.78247 4.59814H6.36108V7.56812Z"/>\n </svg>',Lc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.1379 3.91187L14.1086 4.06421H11.4668L9.49805 13.9431H12.0981L11.7473 15.7852L11.7188 15.9375H4.16675L4.51758 14.0955L4.54614 13.9431H7.18799L9.17505 4.06421H6.55664L6.90747 2.22217L6.93677 2.06982H14.4888L14.1379 3.91187Z"/>\n </svg>',Oc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.3723 11.8015C14.3771 11.8858 14.3811 11.9756 14.3811 12.0681C14.3811 12.811 14.1777 13.4959 13.7725 14.1174L13.7717 14.1189C13.3624 14.7329 12.7463 15.2162 11.9377 15.5742L11.9348 15.5757C11.1214 15.9223 10.1306 16.092 8.96997 16.092C7.9356 16.092 6.93308 15.9348 5.96338 15.6204L5.96045 15.6189C5.00593 15.292 4.24112 14.8699 3.67676 14.3459L3.57568 14.2522L3.63501 14.1277L4.45605 12.397L4.64282 12.5654C5.13492 13.0083 5.76733 13.3759 6.54492 13.6648C7.33475 13.9406 8.14322 14.0786 8.96997 14.0786C10.0731 14.0786 10.8638 13.8932 11.3708 13.5513C11.8757 13.1982 12.1172 12.7464 12.1172 12.1838C12.1172 12.0662 12.1049 11.9556 12.0828 11.8513L12.0344 11.625H14.3621L14.3723 11.8015Z"/>\n <path d="M9.2981 1.91602C10.111 1.91604 10.9109 2.02122 11.6975 2.23096C12.4855 2.44111 13.1683 2.74431 13.7417 3.14429L13.8655 3.23071L13.8083 3.36987L13.1726 4.91235L13.0869 5.1189L12.8987 4.99878C12.3487 4.64881 11.761 4.38633 11.1365 4.21143L11.1328 4.20996C10.585 4.04564 10.0484 3.95419 9.52295 3.93384L9.2981 3.92944C8.22329 3.92944 7.44693 4.12611 6.94043 4.49121C6.44619 4.85665 6.20874 5.31616 6.20874 5.88135L6.21533 6.03296C6.24495 6.37662 6.37751 6.65526 6.61011 6.87964L6.72144 6.97632C6.98746 7.19529 7.30625 7.37584 7.68018 7.51538L8.05151 7.63184C8.45325 7.75061 8.94669 7.87679 9.53247 8.01123L9.53467 8.01196C10.1213 8.15305 10.6426 8.29569 11.0991 8.4375H15C15.5178 8.4375 15.9375 8.85723 15.9375 9.375C15.9375 9.89277 15.5178 10.3125 15 10.3125H3C2.48223 10.3125 2.0625 9.89277 2.0625 9.375C2.0625 8.85723 2.48223 8.4375 3 8.4375H4.93726C4.83783 8.34526 4.74036 8.24896 4.64795 8.146L4.64502 8.14233C4.1721 7.58596 3.94482 6.85113 3.94482 5.95825C3.94483 5.20441 4.14059 4.51965 4.53369 3.90967L4.53516 3.90747C4.94397 3.29427 5.55262 2.81114 6.34863 2.45288C7.15081 2.0919 8.13683 1.91602 9.2981 1.91602Z"/>\n </svg>',Fc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 14C14.5523 14 15 14.4477 15 15C15 15.5523 14.5523 16 14 16H4C3.44772 16 3 15.5523 3 15C3 14.4477 3.44772 14 4 14H14Z"/>\n <path d="M12.625 1.59375C13.25 1.59375 13.625 1.97656 13.625 2.64062V9.02344C13.625 11.4844 11.8516 13.1875 8.99219 13.1875C6.14062 13.1875 4.35938 11.4844 4.35938 9.02344V2.64062C4.35938 1.97656 4.74219 1.59375 5.36719 1.59375C6 1.59375 6.375 1.97656 6.375 2.64062V8.84375C6.375 10.3828 7.32031 11.4297 8.99219 11.4297C10.6641 11.4297 11.6172 10.3828 11.6172 8.84375V2.64062C11.6172 1.97656 11.9922 1.59375 12.625 1.59375Z"/>\n </svg>',Ic='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.5 2C12.0523 2 12.5 2.44772 12.5 3V3.5C12.5 4.05228 12.0523 4.5 11.5 4.5H8V15C8 15.5523 7.55228 16 7 16H6.5C5.94772 16 5.5 15.5523 5.5 15V4.5H2C1.44772 4.5 1 4.05228 1 3.5V3C1 2.44772 1.44772 2 2 2H11.5ZM16 7C16.5523 7 17 7.44772 17 8V8.5C17 9.05228 16.5523 9.5 16 9.5H15V15C15 15.5523 14.5523 16 14 16H13.5C12.9477 16 12.5 15.5523 12.5 15V9.5H11.5C10.9477 9.5 10.5 9.05228 10.5 8.5V8C10.5 7.44772 10.9477 7 11.5 7H16Z"/>\n </svg>',Rc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6445 4.19824C15.5244 4.19824 16.8984 5.34668 16.8984 6.91211C16.8984 7.8759 16.4335 8.7237 15.292 9.84473L13.3438 11.8135V11.9092H16.1875C16.8232 11.9092 17.2197 12.251 17.2197 12.8115C17.2196 13.3651 16.83 13.7002 16.1875 13.7002H11.5117C10.8487 13.7002 10.4112 13.3241 10.4111 12.75C10.4111 12.3399 10.6368 11.9843 11.3203 11.3145L13.6855 8.88086C14.4169 8.13583 14.7245 7.64349 14.7246 7.12402C14.7246 6.4541 14.2393 6.00293 13.5215 6.00293C12.9404 6.00293 12.5166 6.29688 12.2158 6.90527C11.9151 7.37002 11.6552 7.54785 11.2588 7.54785C10.7188 7.54785 10.3429 7.17861 10.3428 6.65918C10.3428 5.3877 11.7783 4.19824 13.6445 4.19824Z"/>\n </svg>',Pc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13.5967 4.19824C15.5928 4.19824 16.9873 5.23047 16.9873 6.7002C16.9872 7.705 16.2421 8.60059 15.2988 8.7168V8.86719C16.4199 8.94923 17.2607 9.89942 17.2607 11.0889C17.2606 12.7362 15.7362 13.9053 13.583 13.9053C11.6827 13.9053 10.1925 12.873 10.1924 11.7041C10.1924 11.1846 10.5547 10.8154 11.0537 10.8154C11.3818 10.8154 11.6553 10.9727 11.9629 11.3555C12.3799 11.9159 12.92 12.2031 13.583 12.2031C14.4853 12.2031 15.0731 11.7313 15.0732 11C15.0732 10.2754 14.4785 9.7832 13.5898 9.7832H13.0361C12.5645 9.7832 12.2159 9.4208 12.2158 8.92188C12.2158 8.44336 12.5576 8.07422 13.0361 8.07422H13.5693C14.3075 8.07422 14.8544 7.60928 14.8545 6.97363C14.8545 6.33789 14.3213 5.90039 13.5557 5.90039C12.9678 5.90039 12.5029 6.16016 12.0859 6.71387C11.8399 7.03508 11.5527 7.17871 11.1973 7.17871C10.671 7.17871 10.295 6.82314 10.2949 6.31738C10.2949 5.18945 11.751 4.19824 13.5967 4.19824ZM8.0332 4.30078C8.75781 4.30078 9.16797 4.74512 9.16797 5.51758V12.5518C9.1679 13.3241 8.75776 13.7686 8.0332 13.7686C7.30865 13.7686 6.90534 13.3309 6.90527 12.5518V9.87207H3.48047V12.5518C3.4804 13.3241 3.07026 13.7686 2.3457 13.7686C1.62115 13.7686 1.21784 13.3309 1.21777 12.5518V5.51758C1.21777 4.73828 1.62109 4.30078 2.3457 4.30078C3.07031 4.30078 3.48047 4.74512 3.48047 5.51758V8.07422H6.90527V5.51758C6.90527 4.73828 7.30859 4.30078 8.0332 4.30078Z"/>\n </svg>',Mc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.6357 4.22559C15.7432 4.22559 16.4336 4.80664 16.4336 5.73633V10.3164H16.7275C17.2881 10.3164 17.6436 10.6787 17.6436 11.2256C17.6435 11.7655 17.3017 12.1006 16.7275 12.1006H16.4336V12.6611C16.4335 13.3515 16.0234 13.7891 15.374 13.7891C14.7247 13.7891 14.3282 13.3583 14.3281 12.6611V12.1006H11.04C10.2335 12.1006 9.76863 11.6766 9.76855 10.918C9.76855 10.5762 9.85064 10.3026 10.1104 9.74219C10.7666 8.42289 11.5733 7.0146 12.5713 5.54492C13.2549 4.56738 13.7812 4.22559 14.6357 4.22559ZM7.88965 4.30078C8.61426 4.30078 9.02441 4.74512 9.02441 5.51758V12.5518C9.02435 13.3241 8.6142 13.7686 7.88965 13.7686C7.1651 13.7686 6.76178 13.3309 6.76172 12.5518V9.87207H3.33691V12.5518C3.33685 13.3241 2.9267 13.7686 2.20215 13.7686C1.4776 13.7686 1.07428 13.3309 1.07422 12.5518V5.51758C1.07422 4.73828 1.47754 4.30078 2.20215 4.30078C2.92676 4.30078 3.33691 4.74512 3.33691 5.51758V8.07422H6.76172V5.51758C6.76172 4.73828 7.16504 4.30078 7.88965 4.30078ZM14.2188 6.07812C13.6035 7.02841 12.2158 9.48929 11.7988 10.2686V10.3164H14.3281V6.07812H14.2188Z"/>\n </svg>',Dc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M9 12C9.55228 12 10 12.4477 10 13C10 13.5523 9.55228 14 9 14H3C2.44772 14 2 13.5523 2 13C2 12.4477 2.44772 12 3 12H9ZM15 8C15.5523 8 16 8.44772 16 9C16 9.55228 15.5523 10 15 10H3C2.44772 10 2 9.55228 2 9C2 8.44772 2.44772 8 3 8H15ZM15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H15Z"/>\n </svg>',Bc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M10.0607 2.07533C10.8417 1.29432 12.1078 1.2943 12.8888 2.07533L16.424 5.61049C17.205 6.39154 17.205 7.65854 16.424 8.43959L9.44937 15.4142C9.07435 15.7891 8.5656 16.0001 8.03531 16.0001H5.0148C4.55074 16.0001 4.10309 15.8385 3.74722 15.547L3.60074 15.4142L1.57534 13.3888C0.79431 12.6078 0.794336 11.3417 1.57534 10.5607L10.0607 2.07533ZM2.98941 11.9747L5.0148 14.0001H8.03531L9.71792 12.3165L6.18179 8.78139L2.98941 11.9747Z"/>\n </svg>',$c='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4564 14.4272C17.1356 15.5592 16.3204 17.0002 15.0003 17.0004C13.68 17.0004 12.864 15.5593 13.5433 14.4272L15.0003 12.0004L16.4564 14.4272ZM5.1214 1.70746C5.51192 1.31693 6.14494 1.31693 6.53546 1.70746L9.7171 4.8891L13.2532 8.42426C14.2295 9.40056 14.2295 10.9841 13.2532 11.9604L9.7171 15.4955C8.74078 16.4718 7.15822 16.4718 6.18195 15.4955L2.64679 11.9604C1.67048 10.9841 1.67048 9.40057 2.64679 8.42426L6.18195 4.8891C6.30299 4.76805 6.43323 4.66177 6.57062 4.57074L5.1214 3.12152C4.73091 2.73104 4.73099 2.09799 5.1214 1.70746ZM8.30304 6.30316C8.10776 6.10815 7.79119 6.10799 7.59601 6.30316L4.06085 9.83929L3.9964 9.91742C3.88661 10.0838 3.88645 10.3019 3.9964 10.4682L4.02277 10.5004H11.8763C12.0312 10.3043 12.02 10.0205 11.8392 9.83929L8.30304 6.30316Z"/>\n </svg>',zc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.8885 7.23091L13.9479 6.17155C14.5337 5.58576 14.5337 4.63602 13.9479 4.05023C13.3621 3.46444 12.4124 3.46444 11.8266 4.05023L8.29235 7.58446C7.9263 7.95051 7.90312 8.52994 8.2233 8.92271L8.36141 9.07463C8.68158 9.4674 8.65841 10.0468 8.29235 10.4129C7.90183 10.8034 7.26866 10.8034 6.87814 10.4129C5.70657 9.24131 5.70657 7.34182 6.87814 6.17025L10.4124 2.63602C11.7792 1.26918 13.9953 1.26918 15.3621 2.63602C16.729 4.00285 16.729 6.21893 15.3621 7.58576L14.3028 8.64512C13.9122 9.03564 13.2791 9.03564 12.8885 8.64512C12.498 8.2546 12.498 7.62143 12.8885 7.23091Z"/>\n <path d="M5.11038 10.7664L4.04843 11.8284C3.46264 12.4142 3.46264 13.3639 4.04842 13.9497C4.63421 14.5355 5.58396 14.5355 6.16975 13.9497L9.70657 10.4129C10.0726 10.0468 10.0958 9.46741 9.77563 9.07464L9.63752 8.92272C9.31734 8.52995 9.34052 7.95052 9.70657 7.58446C10.0971 7.19394 10.7303 7.19394 11.1208 7.58446C12.2924 8.75604 12.2924 10.6555 11.1208 11.8271L7.58396 15.3639C6.21712 16.7308 4.00105 16.7308 2.63421 15.3639C1.26738 13.9971 1.26738 11.781 2.63421 10.4142L3.69617 9.35223C4.08669 8.96171 4.71986 8.96171 5.11038 9.35223C5.5009 9.74275 5.5009 10.3759 5.11038 10.7664Z"/>\n </svg>',Hc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M4.96387 4.23438C6.8769 4.23438 8.42767 5.78522 8.42773 7.69824C8.42773 8.32925 8.25769 8.92015 7.96289 9.42969L7.96387 9.43066L5.11816 14.3584C4.77659 14.95 4.02038 15.153 3.42871 14.8115C2.83701 14.4699 2.63397 13.7128 2.97559 13.1211L4.16113 11.0674C2.63532 10.7052 1.5 9.33485 1.5 7.69824C1.50006 5.78524 3.05086 4.2344 4.96387 4.23438ZM13.0361 4.23438C14.9491 4.23449 16.4999 5.7853 16.5 7.69824C16.5 8.32921 16.3299 8.92017 16.0352 9.42969L16.0361 9.43066L13.1904 14.3584C12.8488 14.9501 12.0917 15.1531 11.5 14.8115C10.9085 14.4698 10.7063 13.7127 11.0479 13.1211L12.2324 11.0674C10.7069 10.7049 9.57227 9.33461 9.57227 7.69824C9.57233 5.78522 11.1231 4.23438 13.0361 4.23438Z"/>\n </svg>',Kc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.29289 3.79295C6.68342 3.40243 7.31643 3.40243 7.70696 3.79295C8.09748 4.18348 8.09748 4.81649 7.70696 5.20702L3.91399 8.99999L7.70696 12.793C8.09748 13.1835 8.09748 13.8165 7.70696 14.207C7.31643 14.5975 6.68342 14.5975 6.29289 14.207L1.79289 9.70702C1.40237 9.31649 1.40237 8.68348 1.79289 8.29295L6.29289 3.79295Z"/>\n <path d="M11.707 3.79295C11.3164 3.40243 10.6834 3.40243 10.2929 3.79295C9.90237 4.18348 9.90237 4.81649 10.2929 5.20702L14.0859 8.99999L10.2929 12.793C9.90237 13.1835 9.90237 13.8165 10.2929 14.207C10.6834 14.5975 11.3164 14.5975 11.707 14.207L16.207 9.70702C16.5975 9.31649 16.5975 8.68348 16.207 8.29295L11.707 3.79295Z"/>\n </svg>',Uc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 12.5C3.82843 12.5 4.5 13.1716 4.5 14C4.5 14.8284 3.82843 15.5 3 15.5C2.17157 15.5 1.5 14.8284 1.5 14C1.5 13.1716 2.17157 12.5 3 12.5ZM15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM3 7.5C3.82843 7.5 4.5 8.17157 4.5 9C4.5 9.82843 3.82843 10.5 3 10.5C2.17157 10.5 1.5 9.82843 1.5 9C1.5 8.17157 2.17157 7.5 3 7.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM3 2.5C3.82843 2.5 4.5 3.17157 4.5 4C4.5 4.82843 3.82843 5.5 3 5.5C2.17157 5.5 1.5 4.82843 1.5 4C1.5 3.17157 2.17157 2.5 3 2.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n </svg>',Wc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n <path d="M2.98657 16.0967C2.68042 16.0967 2.41187 16.0465 2.18091 15.9463C1.95174 15.846 1.77002 15.7046 1.63574 15.522C1.50146 15.3376 1.42448 15.1227 1.40479 14.8774L1.4021 14.8452H2.34204L2.34741 14.8748C2.35815 14.9589 2.39038 15.035 2.44409 15.103C2.49959 15.1711 2.5721 15.2248 2.66162 15.2642C2.75293 15.3035 2.86035 15.3232 2.98389 15.3232C3.10563 15.3232 3.21037 15.3027 3.2981 15.2615C3.38761 15.2185 3.45654 15.1603 3.50488 15.0869C3.55322 15.0135 3.57739 14.9294 3.57739 14.8345V14.8291C3.57739 14.6715 3.51921 14.5516 3.40283 14.4692C3.28646 14.3869 3.12085 14.3457 2.90601 14.3457H2.48706V13.677H2.90063C3.02775 13.677 3.13607 13.6582 3.22559 13.6206C3.31689 13.583 3.38672 13.5302 3.43506 13.4622C3.48519 13.3941 3.51025 13.3153 3.51025 13.2258V13.2205C3.51025 13.1256 3.48877 13.0441 3.4458 12.9761C3.40462 12.9062 3.34375 12.8534 3.26318 12.8176C3.18441 12.78 3.08952 12.7612 2.97852 12.7612C2.86572 12.7612 2.76636 12.7809 2.68042 12.8203C2.59627 12.8579 2.52913 12.9125 2.479 12.9841C2.43066 13.054 2.40112 13.1363 2.39038 13.2312L2.3877 13.2581H1.49341L1.49609 13.2205C1.514 12.977 1.58561 12.7666 1.71094 12.5894C1.83805 12.4103 2.00903 12.2725 2.22388 12.1758C2.44051 12.0773 2.69206 12.0281 2.97852 12.0281C3.27393 12.0281 3.52995 12.0728 3.74658 12.1624C3.96322 12.2501 4.13062 12.3727 4.24878 12.5303C4.36694 12.6878 4.42603 12.8722 4.42603 13.0835V13.0889C4.42603 13.2518 4.38932 13.3941 4.31592 13.5159C4.2443 13.6358 4.14762 13.7343 4.02588 13.8113C3.90592 13.8883 3.77254 13.942 3.62573 13.9724V13.9912C3.91756 14.0199 4.14941 14.1121 4.32129 14.2678C4.49316 14.4236 4.5791 14.6295 4.5791 14.8855V14.8909C4.5791 15.1344 4.51375 15.3474 4.38306 15.53C4.25236 15.7109 4.06795 15.8505 3.82983 15.949C3.59172 16.0474 3.31063 16.0967 2.98657 16.0967Z"/>\n <path d="M1.54443 11V10.342L2.76099 9.20874C2.95076 9.03507 3.09757 8.89274 3.20142 8.78174C3.30705 8.66895 3.37956 8.57316 3.41895 8.49438C3.46012 8.41382 3.48071 8.33415 3.48071 8.25537V8.24463C3.48071 8.14795 3.46012 8.0638 3.41895 7.99219C3.37777 7.92057 3.31779 7.86507 3.23901 7.82568C3.16024 7.7863 3.06714 7.7666 2.95972 7.7666C2.84692 7.7666 2.74756 7.78988 2.66162 7.83643C2.57747 7.88298 2.51123 7.94743 2.46289 8.02979C2.41455 8.11035 2.39038 8.20345 2.39038 8.30908V8.33057L1.48804 8.32788V8.31177C1.48804 8.05396 1.5507 7.82837 1.67603 7.63501C1.80314 7.44165 1.97949 7.29126 2.20508 7.18384C2.43245 7.07463 2.69653 7.02002 2.99731 7.02002C3.28556 7.02002 3.53711 7.06836 3.75195 7.16504C3.96859 7.25993 4.13688 7.39331 4.25684 7.56519C4.37858 7.73706 4.43945 7.93758 4.43945 8.16675V8.18018C4.43945 8.3252 4.40902 8.46932 4.34814 8.61255C4.28727 8.75578 4.18701 8.90885 4.04736 9.07178C3.90771 9.23291 3.71883 9.41642 3.48071 9.62231L2.58374 10.4092L2.85498 9.98486V10.4092L2.58374 10.2319H4.49048V11H1.54443Z"/>\n <path d="M2.84155 6V3.01367H2.79053L1.85596 3.64478V2.79614L2.84155 2.12476H3.82715V6H2.84155Z"/>\n </svg>',Vc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>\n </svg>',qc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13 13.5V6C13 4.067 11.433 2.5 9.5 2.5C7.567 2.5 6 4.067 6 6V13.5C6 14.6046 6.89543 15.5 8 15.5H8.23047C9.20759 15.5 10 14.7076 10 13.7305V7C10 6.72386 9.77614 6.5 9.5 6.5C9.22386 6.5 9 6.72386 9 7V12.5C9 13.0523 8.55228 13.5 8 13.5C7.44772 13.5 7 13.0523 7 12.5V7C7 5.61929 8.11929 4.5 9.5 4.5C10.8807 4.5 12 5.61929 12 7V13.7305C12 15.8122 10.3122 17.5 8.23047 17.5H8C5.79086 17.5 4 15.7091 4 13.5V6C4 2.96243 6.46243 0.5 9.5 0.5C12.5376 0.5 15 2.96243 15 6V13.5C15 14.0523 14.5523 14.5 14 14.5C13.4477 14.5 13 14.0523 13 13.5Z"/>\n </svg>',jc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15 1C16.1046 1 17 1.89543 17 3V15C17 16.1046 16.1046 17 15 17H3C1.89543 17 1 16.1046 1 15V3C1 1.89543 1.89543 1 3 1H15ZM3 15H8V10H3V15ZM10 10V15H15V10H10ZM10 8H15V3H10V8ZM3 8H8V3H3V8Z"/>\n </svg>',Zc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.75 12C13.1642 12 13.5 12.3358 13.5 12.75V14.25C13.5 14.6642 13.1642 15 12.75 15H5.25C4.83579 15 4.5 14.6642 4.5 14.25V12.75C4.5 12.3358 4.83579 12 5.25 12H12.75ZM15.4863 8C16.0461 8 16.5 8.44771 16.5 9C16.5 9.55229 16.0461 10 15.4863 10H2.51367C1.95392 10 1.5 9.55229 1.5 9C1.5 8.44771 1.95392 8 2.51367 8H15.4863ZM12.75 3C13.1642 3 13.5 3.33579 13.5 3.75V5.25C13.5 5.66421 13.1642 6 12.75 6H5.25C4.83579 6 4.5 5.66421 4.5 5.25V3.75C4.5 3.33579 4.83579 3 5.25 3H12.75Z"/>\n </svg>',Gc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.36612 5.36612C8.85427 4.87796 9.64554 4.87796 10.1337 5.36612C10.6218 5.85428 10.6218 6.64557 10.1337 7.13369L7.26748 9.9999H15.2499C18.1494 9.99996 20.4999 12.3504 20.4999 15.2499V19.2499C20.4999 19.9402 19.9402 20.4999 19.2499 20.4999C18.5596 20.4999 18 19.9402 17.9999 19.2499V15.2499C17.9999 13.7312 16.7686 12.5 15.2499 12.4999H7.26748L10.1337 15.3661C10.6218 15.8543 10.6218 16.6456 10.1337 17.1337C9.64557 17.6218 8.85428 17.6218 8.36612 17.1337L3.36612 12.1337C2.87796 11.6455 2.87796 10.8543 3.36612 10.3661L8.36612 5.36612Z"/>\n </svg>',Jc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.6338 5.1163C15.1456 4.62814 14.3543 4.62814 13.8662 5.1163C13.3781 5.60446 13.3781 6.39575 13.8662 6.88388L16.7324 9.75009H8.74997C5.85052 9.75014 3.49997 12.1006 3.49997 15.0001V19.0001C3.50002 19.6904 4.05969 20.25 4.74997 20.2501C5.4403 20.2501 5.99992 19.6904 5.99997 19.0001V15.0001C5.99997 13.4813 7.23123 12.2501 8.74997 12.2501H16.7324L13.8662 15.1163C13.3781 15.6045 13.3781 16.3958 13.8662 16.8839C14.3543 17.372 15.1456 17.3719 15.6338 16.8839L20.6338 11.8839C21.1219 11.3957 21.1219 10.6045 20.6338 10.1163L15.6338 5.1163Z" />\n </svg>',Yc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 6.75C4.24264 6.75 5.25 7.75736 5.25 9C5.25 10.2426 4.24264 11.25 3 11.25C1.75736 11.25 0.75 10.2426 0.75 9C0.75 7.75736 1.75736 6.75 3 6.75ZM9 6.75C10.2426 6.75 11.25 7.75736 11.25 9C11.25 10.2426 10.2426 11.25 9 11.25C7.75736 11.25 6.75 10.2426 6.75 9C6.75 7.75736 7.75736 6.75 9 6.75ZM15 6.75C16.2426 6.75 17.25 7.75736 17.25 9C17.25 10.2426 16.2426 11.25 15 11.25C13.7574 11.25 12.75 10.2426 12.75 9C12.75 7.75736 13.7574 6.75 15 6.75Z"/>\n </svg>';class Xc extends HTMLElement{static observedAttributes=["connected"];#e=new bc;#c=null;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.#u()}connectedCallback(){this.requestOverflowRefresh(),this.setAttribute("role","toolbar"),this.#d()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),cancelAnimationFrame(this.#c),this.editorElement=null,this.editor=null,this.selection=null,this.#c=null,this.#u()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}configure(e){if("object"==typeof e&&null!==e)for(const[t,n]of Object.entries(e))this.setAttribute(`data-${t}`,n)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#g(),this.#p(),this.#f(),this.#m(),this.#y(),this.requestOverflowRefresh(),this.#b(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}requestOverflowRefresh(){null==this.#c&&(this.#c=requestAnimationFrame((()=>{this.#_(),this.#c=null})))}closeDropdowns({except:e}={}){this.#x.forEach((t=>{t!==e&&t.close({focusEditor:!1})}))}#h(){this.disconnectedCallback(),this.connectedCallback()}async#u(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e})),this.editorElement=await this.editorPromise}#d(){const e=new ResizeObserver((()=>this.requestOverflowRefresh()));e.observe(this),this.#e.track((()=>e.disconnect()))}#g(){this.#e.track(yc(this,"click",this.#C))}#C=e=>{this.#S(e,"[data-command]",this.#v.bind(this))};#S(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#v(e,{dataset:{command:t,payload:n}}){const r=e instanceof PointerEvent&&-1===e.pointerId;this.editor.update((()=>{this.editor.dispatchCommand(t,n)}),{tag:r?Yr:void 0}),r||this.editor.focus()}#p(){this.#e.track(yc(this.editorElement,"keydown",this.#w))}#w=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#k(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#k(e){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#b(){this.#e.track(yc(this.editorElement,"lexxy:focus",this.#E),yc(this.editorElement,"lexxy:blur",this.#T),yc(this,"keydown",this.#N))}#E=()=>{const e=this.#A.find(Ec);e&&(e.tabIndex=0)};#T=()=>{this.#f()};#N=e=>{Tc(this.#A,e)};#f(){this.#A.forEach((e=>{e.tabIndex=-1}))}#m(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{this.#L(),this.closeDropdowns()}))})))}#y(){this.#e.track(this.editor.registerCommand(nr,(e=>{this.#O("undo",!e)}),1),this.editor.registerCommand(tr,(e=>{this.#O("redo",!e)}),1))}#L(){const e=eo();if(!Mi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isUnderline:i,isHighlight:o,isInLink:s,isInQuote:l,isInHeading:a,headingTag:c,isInCode:u,isInList:d,listType:h,isInTable:g}=this.selection.getFormat();this.#F("bold",t),this.#F("italic",n),this.#F("strikethrough",r),this.#F("underline",i),this.#F("format",a),this.#F("paragraph",!a),this.#F("heading-large","h2"===c),this.#F("heading-medium","h3"===c),this.#F("heading-small","h4"===c),this.#F("lists",d),this.#F("unordered-list",d&&"bullet"===h),this.#F("ordered-list",d&&"number"===h),this.#F("highlight",o),this.#F("link",s),this.#F("quote",l),this.#F("code",u),this.#F("table",g)}#F(e,t){const n=this.querySelector(`[name="${e}"]`);if(n){const e=t.toString();n.getAttribute("aria-pressed")!==e&&n.setAttribute("aria-pressed",e)}}#O(e,t){const n=this.querySelector(`[name="${e}"]`);if(n){n.disabled!==t&&(n.disabled=t);const e=t.toString();n.getAttribute("aria-disabled")!==e&&n.setAttribute("aria-disabled",e)}}#_(){this.#I(),this.#R(),this.#P(),this.#M();const e=this.#D.children.length>0;this.toggleAttribute("overflowing",e),this.#B(),this.#$(e)}#R(){const e=Array.from(this.#D.children);e.sort(((e,t)=>this.#z(t)-this.#z(e)));for(const t of e){const e=this.querySelector(`[data-position="${this.#z(t)+1}"]`)??this.#H;t.removeAttribute("role"),this.insertBefore(t,e)}}#$(e=!0){this.#D.toggleAttribute("disabled",!e),this.#H.style.display=e?"block":"none"}#I(){this.#$(!1)}#z(e){return parseInt(e.dataset.position??"999")}#P(){this.#K.forEach(((e,t)=>{e.dataset.position=t}))}#M(){const e=this.#U();if(e>0){this.#$();const t=this.#W(),n=t+this.#H.offsetWidth;this.#V(e+n,{gap:t})}}#U(){return this.scrollWidth-this.clientWidth}#V(e,{gap:t}){const n=this.#q,r=[];let i=0;for(;i<e&&n.length;){const e=n.pop();r.push(e),e.role="menuitem",i+=e.offsetWidth+t}this.#D.append(...r.reverse())}#B(){this.#H.setAttribute("nonce",mc())}#W(){return parseFloat(window.getComputedStyle(this).columnGap)||0}get#x(){return this.querySelectorAll(":scope .lexxy-editor__toolbar-dropdown")}get#H(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#D(){return this.#H?.querySelector(":scope > [data-dropdown-panel]")}get#q(){return Array.from(this.querySelectorAll(":scope > button:not([data-prevent-overflow])"))}get#A(){return Array.from(this.querySelectorAll(":scope button"))}get#K(){return Array.from(this.querySelectorAll(":scope > *:not(.lexxy-editor__toolbar-overflow)"))}static get defaultTemplate(){const e=wc("lexxy-link-url");return`\n <button class="lexxy-editor__toolbar-button" type="button" name="image" data-command="uploadImage" data-prevent-overflow="true" title="Add images and video">\n ${Vc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="file" data-command="uploadFile" title="Upload files">\n ${qc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n ${Ac}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n ${Lc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n ${Oc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="underline" data-command="underline" title="Underline">\n ${Fc}\n </button>\n\n <lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="format" title="Text formatting" aria-haspopup="menu" aria-expanded="false">\n ${Ic}\n </button>\n <div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-dropdown-list" hidden>\n <button type="button" name="paragraph" data-command="setFormatParagraph" title="Paragraph" role="menuitem">\n ${Dc} <span>Normal</span>\n </button>\n <button type="button" name="heading-large" data-command="setFormatHeadingLarge" title="Large heading" role="menuitem">\n ${Rc} <span>Large Heading</span>\n </button>\n <button type="button" name="heading-medium" data-command="setFormatHeadingMedium" title="Medium heading" role="menuitem">\n ${Pc} <span>Medium Heading</span>\n </button>\n <button class="lexxy-editor__toolbar-group-end" type="button" name="heading-small" data-command="setFormatHeadingSmall" title="Small heading" role="menuitem">\n ${Mc} <span>Small Heading</span>\n </button>\n <div class="lexxy-editor__toolbar-separator" role="separator"></div>\n <button type="button" name="clear-formatting" data-command="clearFormatting" title="Clear formatting" role="menuitem">\n ${Bc} <span>Clear formatting</span>\n </button>\n </div>\n </lexxy-toolbar-dropdown>\n\n <lexxy-highlight-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--highlight">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="highlight" title="Color highlight" aria-haspopup="menu" aria-expanded="false">\n ${$c}\n </button>\n <div data-dropdown-panel role="menu" hidden>\n <div class="lexxy-highlight-colors"></div>\n <button data-command="removeHighlight" type="button" class="lexxy-editor__toolbar-button lexxy-editor__toolbar-dropdown-reset" role="menuitem">Remove all coloring</button>\n </div>\n </lexxy-highlight-dropdown>\n\n <lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--link">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="link" title="Link" data-hotkey="cmd+k ctrl+k" aria-haspopup="dialog" aria-expanded="false">\n ${zc}\n </button>\n <div data-dropdown-panel role="dialog" aria-label="Link" hidden>\n <input type="url" placeholder="Enter a URL…" class="input" id="${e}">\n <div class="lexxy-editor__toolbar-dropdown-actions">\n <button type="button" class="lexxy-editor__toolbar-button" value="link">Link</button>\n <button type="button" class="lexxy-editor__toolbar-button" value="unlink">Unlink</button>\n </div>\n </div>\n </lexxy-link-dropdown>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n ${Hc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n ${Kc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n ${Uc}\n </button>\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n ${Wc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n ${jc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n ${Zc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--push-right" type="button" name="undo" data-command="undo" title="Undo" disabled aria-disabled="true">\n ${Gc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo" disabled aria-disabled="true">\n ${Jc}\n </button>\n\n <lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-button--push-right lexxy-editor__toolbar-overflow">\n <button data-dropdown-trigger class="lexxy-editor__toolbar-button" type="button" aria-haspopup="menu" aria-expanded="false" aria-label="Show more toolbar buttons">\n ${Yc}\n </button>\n <div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons" hidden></div>\n </lexxy-toolbar-dropdown>\n `}}function Qc(){return new Promise(requestAnimationFrame)}class eu extends HTMLElement{#e=new bc;connectedCallback(){this.#j((()=>{this.#Z(),this.editorReady()}))}disconnectedCallback(){this.#e.dispose()}editorReady(){}onOpen(){}onClose(){}get trigger(){return this.querySelector(":scope > [data-dropdown-trigger]")}get panel(){return this.querySelector(":scope > [data-dropdown-panel]")}get toolbar(){return this.closest("lexxy-toolbar")}get editorElement(){return this.toolbar?.editorElement}get editor(){return this.toolbar?.editor}get isOpen(){return!1===this.panel.hidden}get isClosed(){return!this.isOpen}track(...e){this.#e.track(...e)}open(){this.isOpen||(this.trigger.setAttribute("aria-expanded","true"),this.panel.hidden=!1,this.onOpen(),this.#G())}close({focusEditor:e=!0}={}){e&&this.editor?.focus(),this.isClosed||(this.trigger.setAttribute("aria-expanded","false"),this.panel.hidden=!0,this.onClose())}#Z(){this.#e.track(yc(this,"keydown",this.#J),yc(this.trigger,"click",this.#Y))}#Y=()=>{this.isOpen?this.close({focusEditor:!1}):(this.toolbar?.closeDropdowns({except:this}),this.open())};async#j(e){this.toolbar&&(await this.toolbar.getEditorElement(),this.isConnected&&this.toolbar&&e())}#J=e=>{"Escape"===e.key&&(e.stopPropagation(),this.close())};async#G(){this.#X[0]?.focus(),await this.#f()}async#f(){await Qc(),this.#A.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#X(){return Array.from(this.panel.querySelectorAll("button, input"))}get#A(){return Array.from(this.panel.querySelectorAll("button"))}}const tu="button.lexxy-highlight-button",nu=Symbol("no_style");class ru extends eu{editorReady(){this.#Q(),this.#ee()}onOpen(){this.editor.getEditorState().read((()=>{this.#te(eo())}))}#ee(){this.#ne.forEach((e=>{this.track(yc(e,"click",this.#re))}))}#Q(){this.#ie.innerHTML="";const e=this.editorElement.config.get("highlight.buttons");this.#oe("color",e.color),this.#oe("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.panel.style.setProperty("--max-colors",t)}#oe(e,t){t.forEach(((t,n)=>{this.#ie.appendChild(this.#se(e,t,n))}))}#se(e,t,n){return xc("button",{type:"button",dataset:{value:t,style:e},style:`${e}: ${t}`,class:"lexxy-editor__toolbar-button lexxy-highlight-button",name:`${e}-${n}`,role:"menuitem"})}#re=e=>{e.preventDefault();const t=e.target.closest(tu);if(!t)return;const{style:n,value:r}=t.dataset;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()};#te(e){if(!Mi(e))return;const t=hc(e,"color",nu),n=hc(e,"background-color",nu);this.#ne.forEach((e=>{const r=(e.dataset.value===t||e.dataset.value===n).toString();e.getAttribute("aria-pressed")!==r&&e.setAttribute("aria-pressed",r)}));const r=t!==nu||n!==nu;this.panel.querySelector("[data-command='removeHighlight']").disabled=!r}get#ie(){return this.panel.querySelector(".lexxy-highlight-colors")}get#ne(){return Array.from(this.panel.querySelectorAll(tu))}}function iu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ou="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,su=ou&&"documentMode"in document?document.documentMode:null,lu=ou&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);ou&&"InputEvent"in window&&!su&&new window.InputEvent("input");const au=lu;function cu(e,t){return Array.from(function(e){return function(e,t){const n=zs(),r=t||n,i=Ho(r)?ga(r,e):ca(r,e),o=function(e){let t=-1;for(let n=e;null!==n;n=n.getParent())t++;return t}(r),s=function(e,t){const n=za(ca(e,t));return n&&n[0]}(r,e);let l=o;return xa({hasNext:e=>null!==e,initial:i,map:e=>({depth:l,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;oa(e)&&l++;const t=za(e);return!t||t[0].isSameNodeCaret(s)?null:(l+=t[1],t[0])}})}("next",e)}(e))}function uu(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function du(e){const t=jl(e,(e=>Ho(e)&&!e.isInline()));return Ho(t)||iu(4,e.__key),t}function hu(e){const t=eo()||to();let n;if(Mi(t))n=Ea(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=ca(r,"next"))}n=n||ga(zs(),"previous").getFlipped().insert(es())}const r=gu(e,n),i=pa(r);return Na(ba(oa(i)?Pa(i):r)),e.getLatest()}function gu(e,t,n){let r=Da(t,"next");ra(r)&&(0===r.offset?r=ca(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=ca(r.origin,"next"))),r.origin.is(e)&&(ia(r)||iu(342,e.getKey(),e.getType()),r=Oa(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Ua(e,n))r=e;return ra(r)&&iu(283),r.insert(e.isInline()?es().append(e):e),Da(ca(e.getLatest(),"next"),t.direction)}function pu(e,t){const n=t();return e.replace(n),n.append(e),n}function fu(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function mu(e){const t=eo();if(!Mi(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){const i=r[t],o=i.getKey();if(n.has(o))continue;const s=jl(i,(e=>Ho(e)&&!e.isInline()));if(null===s)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function yu(e,t){ga(e,"next").insert(t)}function bu(e,t){return _u(e,t,null)}function _u(e,t,n){let r=!1;for(const i of Su(e))t(i)?null!==n&&n(i):(r=!0,Ho(i)&&_u(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function xu(e,t){const n=[],r=Array.from(e).reverse();for(let e=r.pop();void 0!==e;e=r.pop())if(t(e))n.push(e);else if(Ho(e))for(const t of Su(e))r.push(t);return n}function Cu(e){return vu(ga(e,"next"))}function Su(e){return vu(ga(e,"previous"))}function vu(e){return xa({hasNext:ia,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}const wu=Symbol.for("preact-signals");function ku(){if(Lu>1)return void Lu--;let e,t=!1;for(function(){let e=Au;for(Au=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==Tu;){let n=Tu;for(Tu=void 0,Ou++;void 0!==n;){const r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Du(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Ou=0,Lu--,t)throw e}let Eu,Tu;function Nu(e){const t=Eu;Eu=void 0;try{return e()}finally{Eu=t}}let Au,Lu=0,Ou=0,Fu=0,Iu=0;function Ru(e){if(void 0===Eu)return;let t=e.n;return void 0===t||t.t!==Eu?(t={i:0,S:e,p:Eu.s,n:void 0,t:Eu,e:void 0,x:void 0,r:t},void 0!==Eu.s&&(Eu.s.n=t),Eu.s=t,e.n=t,32&Eu.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Eu.s,t.n=void 0,Eu.s.n=t,Eu.s=t),t):void 0}function Pu(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Mu(e,t){return new Pu(e,t)}function Du(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Bu(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function $u(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function zu(e,t){Pu.call(this,void 0),this.x=e,this.s=void 0,this.g=Iu-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Hu(e){const t=e.m;if(e.m=void 0,"function"==typeof t){Lu++;const n=Eu;Eu=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Ku(e),t}finally{Eu=n,ku()}}}function Ku(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Hu(e)}function Uu(e){if(Eu!==this)throw new Error("Out-of-order effect");$u(this),Eu=e,this.f&=-2,8&this.f&&Ku(this),ku()}function Wu(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function Vu(e,t){const n=new Wu(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function qu(e,t={}){const n={};for(const r in e){const i=t[r],o=Mu(void 0===i?e[r]:i);n[r]=o}return n}function ju(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}function Zu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Gu(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=Gu(n[e],r[e]);return e}return t}Pu.prototype.brand=wu,Pu.prototype.h=function(){return!0},Pu.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Nu((()=>{var e;null==(e=this.W)||e.call(this)})))},Pu.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Nu((()=>{var e;null==(e=this.Z)||e.call(this)})))}},Pu.prototype.subscribe=function(e){return Vu((()=>{const t=this.value,n=Eu;Eu=void 0;try{e(t)}finally{Eu=n}}),{name:"sub"})},Pu.prototype.valueOf=function(){return this.value},Pu.prototype.toString=function(){return this.value+""},Pu.prototype.toJSON=function(){return this.value},Pu.prototype.peek=function(){const e=Eu;Eu=void 0;try{return this.value}finally{Eu=e}},Object.defineProperty(Pu.prototype,"value",{get(){const e=Ru(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ou>100)throw new Error("Cycle detected");!function(e){0!==Lu&&0===Ou&&e.l!==Fu&&(e.l=Fu,Au={S:e,v:e.v,i:e.i,o:Au})}(this),this.v=e,this.i++,Iu++,Lu++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{ku()}}}}),zu.prototype=new Pu,zu.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Iu)return!0;if(this.g=Iu,this.f|=1,this.i>0&&!Du(this))return this.f&=-2,!0;const e=Eu;try{Bu(this),Eu=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Eu=e,$u(this),this.f&=-2,!0},zu.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Pu.prototype.S.call(this,e)},zu.prototype.U=function(e){if(void 0!==this.t&&(Pu.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},zu.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(zu.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Ru(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Wu.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},Wu.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Hu(this),Bu(this),Lu++;const e=Eu;return Eu=this,Uu.bind(this,e)},Wu.prototype.N=function(){2&this.f||(this.f|=2,this.u=Tu,Tu=this)},Wu.prototype.d=function(){this.f|=8,1&this.f||Ku(this)},Wu.prototype.dispose=function(){this.d()},pt("format",{parse:e=>"number"==typeof e?e:0});function Ju(e){return 0===e.id}function Yu(e){return 2===e.id}const Xu=new Set;let Qu=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Wa;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Yu(t)||Zu(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let o;this.state=i,this.extension.init&&(o=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,o,r)}build(e){const t=this.state;let n;4!==t.id&&Zu(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&Zu(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&Zu(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&Zu(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&Zu(311),this._signal}getInitResult(){void 0===this.extension.init&&Zu(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||Zu(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||Zu(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Zu(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Zu(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||Zu(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Xu}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map((([e])=>e))),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||Zu(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const ed={tag:jr};function td(){const e=zs();e.isEmpty()&&e.append(es())}const nd={config:{setOptions:ed,updateOptions:ed},init:({$initialEditorState:e=td})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:r}=i;if(function(e){return e instanceof Jo}(r))e.setEditorState(r,n);else if("function"==typeof r)e.update((()=>{r(e)}),t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Vo,mi,oi,Ni,Xo]},rd=Symbol.for("@lexical/extension/LexicalBuilder");function id(){}function od(e){throw e}function sd(e){return Array.isArray(e)?e:[e]}const ld="0.44.0+prod.esm";let ad=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ld,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[sd(nd)];for(const e of t)n.push(sd(e));return new e(n)}static maybeFromEditor(t){const n=t[rd];return n&&(n.PACKAGE_VERSION!==ld&&Zu(292,n.PACKAGE_VERSION,ld),n instanceof e||Zu(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&Zu(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(os({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[rd]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=id;function t(){try{e()}finally{e=id}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Za(this.registerEditor(n),(()=>n.setRootElement(null))),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Zu(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Zu(296);const t=sd(e),[n]=t;"string"!=typeof n.name&&Zu(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&Zu(298,n.name),!r){r=new Qu(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&Zu(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&Zu(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=sd(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let i=n.state;if(Yu(i))return;const o=n.extension.name;var s;Ju(i)||Zu(300,o,r||"[unknown]"),Ju(s=i)||Zu(304,String(s.id),String(0)),i=Object.assign(s,{id:1}),n.state=i;const l=this.outgoingConfigEdges.get(o);if(l)for(const e of l.keys()){const n=this.extensionNameMap.get(e);n&&t(n,o)}i=function(e){return function(e){return 1===e.id}(e)||Zu(305,String(e.id),String(1)),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())Ju(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&Zu(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(const n of t){const t=n.register(e,i);t&&r.push(t)}for(const n of t){const t=n.afterRegistration(e);t&&r.push(t)}return Za(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(const l of s){const{extension:s}=l;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of ju(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Zu(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,l)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&Gu(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const l=Object.keys(i).length>0,a=r.size>0;(l||a)&&(e.html={},l&&(e.html.import=i),a&&(e.html.export=r));for(const t of s)t.init(e);return e.onError||(e.onError=od),e}};function cd(e,t){const n=ad.fromEditor(e).getExtensionRep(t);return void 0===n&&Zu(303,t.name),n.getExtensionDependency()}function ud(e,t){const n=ad.maybeFromEditor(e);if(!n)return;const r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}const dd=new Set(["http:","https:","mailto:","sms:","tel:"]);let hd=class e extends zo{__url;__target;__rel;__title;static getType(){return"link"}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e="",t={},n){super(n);const{target:r=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=o}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),qa(t,e.theme.link),t}updateLinkDOM(e,t,n){if(Ll(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:gd,priority:1})}}static importJSON(e){return pd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Sd(e);try{const t=new URL(Sd(e));if(!dd.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=Sl(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Mi(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function gd(e){let t=null;if(Ll(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=pd(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function pd(e="",t){return vl(new hd(e,t))}function fd(e){return e instanceof hd}let md=class e extends hd{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return"autolink"}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return yd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=yd(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function yd(e="",t){return vl(new md(e,t))}function bd(e){return e instanceof md}function _d(e,t){if("element"===e.type){const n=e.getNode();return Ho(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function xd(e,t={}){let n;if(e&&"object"==typeof e){const{url:r,...i}=e;n=r,t={...i,...t}}else n=e;const{target:r,title:i}=t,o=void 0===t.rel?"noreferrer":t.rel,s=eo();if(null===s||!Mi(s)&&!Bi(s))return;if(Bi(s)){const e=s.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===n){const t=jl(e,(e=>!bd(e)&&fd(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=jl(e,(e=>!bd(e)&&fd(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=pd(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}if(s.isCollapsed()&&null===n)for(const e of s.getNodes()){const t=jl(e,(e=>!bd(e)&&fd(e)));return void(null!==t&&(t.getChildren().forEach((e=>{t.insertBefore(e)})),t.remove()))}const l=s.extract();if(null===n){const e=new Set;return void l.forEach((t=>{const n=jl(t,(e=>!bd(e)&&fd(e)));if(null!==n){const t=n.getKey();if(e.has(t))return;!function(e,t){const n=new Set(t.filter((t=>e.isParentOf(t))).map((e=>e.getKey()))),r=e.getChildren(),i=r=>n.has(r.getKey())||Ho(r)&&t.some((t=>e.isParentOf(t)&&r.isParentOf(t))),o=r.filter(i);if(o.length===r.length)return r.forEach((t=>e.insertBefore(t))),void e.remove();const s=r.findIndex(i),l=r.findLastIndex(i),a=0===s,c=l===r.length-1;if(a)o.forEach((t=>e.insertBefore(t)));else if(c)for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);else{for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);const t=r.slice(l+1);if(t.length>0){const n=Sl(e);o[o.length-1].insertAfter(n),t.forEach((e=>n.append(e)))}}}(n,l),e.add(t)}}))}const a=new Set,c=e=>{a.has(e.getKey())||(a.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==o&&e.setRel(o),void 0!==i&&e.setTitle(i))};if(1===l.length){const e=l[0],t=jl(e,fd);if(null!==t)return c(t)}!function(e){const t=eo();if(!Mi(t))return e();const n=At(t),r=n.isBackward(),i=_d(n.anchor,r?-1:0),o=_d(n.focus,r?0:-1);if(e(),i||o){const e=eo();if(Mi(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(o){const e=o.getParent();e&&t.focus.set(e.getKey(),o.getIndexWithinParent()+(r?0:1),"element")}Ks(At(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=jl(t,fd);if(s){c(s);continue}if(Ho(t)){if(!t.isInline())continue;if(fd(t)){if(!(bd(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const l=t.getPreviousSibling();fd(l)&&l.is(e)?l.append(t):(e=pd(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const Cd=/^\+?[0-9\s()-]{5,}$/;function Sd(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Cd.test(e)?`tel:${e}`:`https://${e}`}class vd extends eu{editorReady(){this.input=this.panel.querySelector("input"),this.track(yc(this.input,"keydown",this.#le),yc(this.linkButton,"click",this.#ae),yc(this.unlinkButton,"click",this.#ce))}onOpen(){this.input.value=this.#ue,this.input.required=!0}onClose(){this.input.required=!1}get linkButton(){return this.panel.querySelector("[value='link']")}get unlinkButton(){return this.panel.querySelector("[value='unlink']")}#le=e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),this.#ae(e))};#ae=()=>{this.input.checkValidity()?(this.editor.dispatchCommand("link",this.input.value),this.close()):this.input.reportValidity()};#ce=()=>{this.editor.dispatchCommand("unlink"),this.close()};get#ue(){return this.editor.getEditorState().read((()=>{const e=this.editorElement.selection.nearestNodeOfType(hd);return e?.getURL()??""}))}}function wd(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function kd(e){let t=1,n=e.getParent();for(;null!=n;){if(Kd(n)){const e=n.getParent();if(Gd(e)){t++,n=e.getParent();continue}wd(40)}return t}return t}function Ed(e){let t=e.getParent();Gd(t)||wd(40);let n=t;for(;null!==n;)n=n.getParent(),Gd(n)&&(t=n);return t}function Td(e){let t=[];const n=e.getChildren().filter(Kd);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();Gd(i)?t=t.concat(Td(i)):t.push(r)}return t}function Nd(e){return Kd(e)&&Gd(e.getFirstChild())}function Ad(e){return Hd().append(e)}function Ld(e,t){return Kd(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function Od(e){const t=eo();if(null!==t){let n=t.getNodes();if(Mi(t)){const r=t.getStartEndPoints();null===r&&wd(143);const[i]=r,o=i.getNode(),s=o.getParent();if(Cl(o)){const e=o.getFirstChild();if(e)n=e.selectStart().getNodes();else{const e=es();o.append(e),n=e.select().getNodes()}}else if(Ld(o,n)){const t=Zd(e);if(Cl(s)){o.replace(t);const e=Hd();Ho(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(Kd(o)){const e=o.getParentOrThrow();Fd(t,e.getChildren()),e.replace(t)}return}}const r=new Set;for(let t=0;t<n.length;t++){const i=n[t];if(Ho(i)&&i.isEmpty()&&!Kd(i)&&!r.has(i.getKey())){Id(i,e);continue}let o=Ns(i)?i.getParent():Kd(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(Gd(o)){if(!r.has(t)){const n=Zd(e);Fd(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(Cl(n)&&!r.has(t)){r.add(t),Id(o,e);break}o=n}}}}}function Fd(e,t){e.splice(e.getChildrenSize(),0,t)}function Id(e,t){if(Gd(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=Hd();let o;if(Fd(i,e.getChildren()),Gd(n)&&t===n.getListType())n.append(i),Gd(r)&&t===r.getListType()&&(Fd(n,r.getChildren()),r.remove()),o=n;else if(Gd(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=Zd(t);n.append(i),e.replace(n),o=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());const s=eo();return Mi(s)&&(o.getKey()===s.anchor.key&&s.anchor.set(i.getKey(),s.anchor.offset,"element"),o.getKey()===s.focus.key&&s.focus.set(i.getKey(),s.focus.offset,"element")),e.remove(),o}function Rd(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&Nd(n)&&Nd(r)&&(Rd(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Pd(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())Kd(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),Gd(r.getFirstChild())||n++)}function Md(e){const t=new Set;if(Nd(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Nd(r)&&Nd(i)){const n=i.getFirstChild();if(Gd(n)){n.append(e);const i=r.getFirstChild();Gd(i)&&(Fd(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Nd(r)){const t=r.getFirstChild();if(Gd(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Nd(i)){const t=i.getFirstChild();Gd(t)&&t.append(e)}else if(Gd(n)){const t=Sl(e),o=Sl(n);t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Dd(e){if(Nd(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(Gd(n?n.getParent():void 0)&&Kd(n)&&Gd(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=Sl(e),i=Sl(t);r.append(i),e.getPreviousSiblings().forEach((e=>i.append(e)));const o=Sl(e),s=Sl(t);o.append(s),Fd(s,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(o),n.replace(e)}}}let Bd=class extends zo{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{const t=e.getParent();if(Gd(t))"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0);else if(t){const n=e.createParentElementNode();Gd(n)||wd(340);const r=[e];for(const t of["previous","next"]){r.reverse();for(const{origin:n}of ca(e,t)){if(!Kd(n))break;r.push(n)}}e.insertBefore(n),n.splice(0,0,r),Cl(t)||(gu(n,Oa(ca(n,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:zo,importDOM:{li:()=>({conversion:$d,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!Gd(r)||"check"!==r.getListType()||Gd(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],o=t.list,s=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),void 0!==s&&r.push(...Va(s)),o){const e=n.getParent(),t=Gd(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||i.push(o.listitemUnchecked),t&&s||i.push(o.listitemChecked),t&&r.push(s?o.listitemChecked:o.listitemUnchecked)}if(void 0!==l){const e=Va(l);n.getChildren().some((e=>Gd(e)))?r.push(...e):i.push(...e)}i.length>0&&ja(e,...i),r.length>0&&qa(e,...r)}(t,n.theme,this);const r=e?e.__style:"",i=this.__style;r!==i&&ii(t.style,i,r),function(e,t,n){const r=t.__textStyle,i=n?n.__textStyle:"";if(null!==n&&i===r)return;const o=ni(r);for(const t in o)e.style.setProperty(`--listitem-marker-${t}`,o[t]);if(""!==i)for(const t in ni(i))t in o||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),Nd(this)?{after(e){if(Ol(e)){const t=e.previousElementSibling;if(Ol(t)&&"LI"===t.nodeName){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Ho(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(Kd(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Gd(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=Sl(n);let r=this.getNextSibling();for(;r;){const e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(Ho(e)||wd(139),this.getChildren().forEach((t=>{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(Gd(n)||wd(39),Kd(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=Sl(n);r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Nd(t)&&Nd(n)&&(Rd(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){const n=Sl(this);return this.insertAfter(n,t),n}collapseAtStart(e){const t=es();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=Kd(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,o=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(o,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(o,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return Gd(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Kd(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&wd(117),(e=Math.floor(e))>=0||wd(199);let t=this.getIndent();for(;t!==e;)t<e?(Md(this),t++):(Dd(this),t--);return this}canInsertAfter(e){return Kd(e)}canReplaceWith(e){return Kd(e)}canMergeWith(e){return Kd(e)||ts(e)}extractWithChild(e,t){if(!Mi(t))return!1;const n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Zd("bullet")}canMergeWhenEmpty(){return!0}};function $d(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return zd(t);if(e.classList.contains("joplin-checkbox"))for(const t of e.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&"INPUT"===t.children[0].tagName)return zd(t.children[0]);const t=e.getAttribute("aria-checked");return{node:Hd("true"===t||"false"!==t&&void 0)}}function zd(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:Hd(e.hasAttribute("checked"))}}function Hd(e){return vl(new Bd(void 0,e))}function Kd(e){return e instanceof Bd}let Ud=class extends zo{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();Gd(t)&&e.getListType()===t.getListType()&&Rd(e,t)}(e),Pd(e)},extends:zo,importDOM:{ol:()=>({conversion:qd,priority:0}),ul:()=>({conversion:qd,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=jd[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,Wd(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Wd(t,n.theme,this),e.__start!==this.__start&&t.setAttribute("start",String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return Ol(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){const r=n.find(Kd)??this.getChildren().find(Kd),i=r?()=>Sl(r):Hd;let o=n;for(let e=0;e<n.length;e++){const t=n[e];Kd(t)||(o===n&&(o=[...n]),o[e]=i().append(!Ho(t)||Gd(t)||t.isInline()?t:ki(t.getTextContent())))}return super.splice(e,t,o)}extractWithChild(e){return Kd(e)}};function Wd(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=kd(n)-1,s=t%e.length,l=e[s],a=o[n.__tag];let c;const u=o.nested,d=o.checklist;if(void 0!==u&&u.list&&(c=u.list),void 0!==a&&r.push(a),void 0!==d&&"check"===n.__listType&&r.push(d),void 0!==l){r.push(...Va(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=Va(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&ja(e,...i),r.length>0&&qa(e,...r)}function Vd(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(Kd(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{Gd(e)&&t.push(Ad(e))}))}else t.push(Ad(r))}return t}function qd(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Zd("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list")||"1"===e.getAttribute("data-is-checklist"))return!0;for(const t of e.childNodes)if(Ol(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Zd("check"):Zd("bullet")),{after:Vd,node:n}}const jd={ol:"number",ul:"bullet"};function Zd(e="number",t=1){return vl(new Ud(e,t))}function Gd(e){return e instanceof Ud}const Jd=un("UPDATE_LIST_START_COMMAND"),Yd=un("INSERT_UNORDERED_LIST_COMMAND"),Xd=un("INSERT_ORDERED_LIST_COMMAND"),Qd=un("REMOVE_LIST_COMMAND");function eh(e,t){return Za(e.registerCommand(Xd,(()=>(Od("number"),!0)),1),e.registerCommand(Jd,(e=>{const{listNodeKey:t,newStart:n}=e,r=Rs(t);return!!Gd(r)&&("number"===r.getListType()&&(r.setStart(n),Pd(r)),!0)}),1),e.registerCommand(Yd,(()=>(Od("bullet"),!0)),1),e.registerCommand(Qd,(()=>(function(){const e=eo();if(Mi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Ld(r,n))t.add(Ed(r));else for(let e=0;e<n.length;e++){const r=n[e];if(Ns(r)){const e=uu(r,Bd);null!=e&&t.add(Ed(e))}}for(const n of t){let t=n;const r=Td(n);for(const n of r){const r=es().setTextStyle(e.style).setTextFormat(e.format);Fd(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Ta(e.anchor,Pa(ga(r,"next"))),n.__key===e.focus.key&&Ta(e.focus,Pa(ga(r,"next"))),n.remove()}n.remove()}}}(),!0)),1),e.registerCommand(xn,(()=>function(e=!1){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();let r=null;if(Kd(n)&&0===n.getChildrenSize())r=n;else if(Ei(n)){const e=n.getParent();Kd(e)&&e.getChildren().every((e=>Ei(e)&&""===e.getTextContent().trim()))&&(r=e)}if(null===r)return!1;const i=Ed(r),o=r.getParent();Gd(o)||wd(40);const s=o.getParent();let l;if(Cl(s))l=es(),i.insertAfter(l);else{if(!Kd(s))return!1;l=Sl(s),s.insertAfter(l)}l.setTextStyle(t.style).setTextFormat(t.format).select();const a=r.getNextSiblings();if(a.length>0){const t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(o,r):1,n=Sl(o).setStart(t);if(Kd(l)){const e=Sl(l);e.append(n),l.insertAfter(e)}else l.insertAfter(n);n.append(...a)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!Kd(e)&&!Gd(e))break;t=e}t.remove()}(r),!0}(!1)),1),e.registerNodeTransform(Bd,(e=>{const t=e.getFirstChild();if(t){if(Ei(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=eo();Mi(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}})),e.registerNodeTransform(mi,(e=>{const t=e.getParent();if(Kd(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function th(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let nh;function rh(e,t){const{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function ih(e){return nh&&nh.editor===e?nh:void 0}function oh(e,t){if("cfg"in t){const{cfg:n,updater:r}=t;return[n,r(rh(e,n))]}return t}function sh(e,t){let n=t;for(const r of e){const[e,i]=oh(n,r),o=e.key;if(n===t&&rh(n,e)===i)continue;const s=n||lh(t);s[o]=i,n=s}return n}function lh(e){return Object.create(e||null)}function ah(e,t){return[e,t]}const ch="@lexical/html/DOM",uh=Symbol.for("@lexical/html/DOMExportContext"),dh=()=>!0;function hh(e){return t=>t instanceof e}function gh(e,{nodes:t}){if("*"===t)return dh;let n={};const r=[];for(const i of t)if("getType"in i){const t=i.getType();if(n){const r=e[t];void 0===r&&th(339,i.name,t),n=Object.assign(n,r.types)}r.push(hh(i))}else n=void 0,r.push(i);return n||(1===r.length?r[0]:e=>{for(const t of r)if(t(e))return!0;return!1})}function ph(e){return(t,n,r)=>e(t,r)}function fh(e){return(t,n,r,i)=>e(t,n,i)}function mh(e){return(t,n,r,i,o)=>e(t,n,r,o)}function yh(e){return(t,n,r,i,o,s)=>e(t,n,r,i,s)}function bh(e,t){return(n,r)=>{const i=()=>e(n,r),o=t(n);return o?o(n,i,r):i()}}function _h(e,t){return(n,r,i)=>{const o=()=>e(n,r,i),s=t(n);return s?s(n,r,o,i):o()}}function xh(e,t){return(n,r,i,o)=>{const s=()=>e(n,r,i,o),l=t(n);return l?l(n,r,i,s,o):s()}}function Ch(e,t){return(n,r,i,o,s)=>{const l=()=>e(n,r,i,o,s),a=t(n);return a?a(n,r,i,o,l,s):l()}}function Sh(e,t){return(n,r,i,o)=>{e(n,r,i,o);const s=t(n);s&&s(n,r,i,o)}}function vh(e,t,n,r,i){let o=n[t];for(const n of e[t])if("function"==typeof n[0]){const[e,t]=n;o=r(o,(n=>e(n)&&t||void 0))}else{const e=n[1],t={};for(const n in e){const i=e[n];i&&(t[n]=i.reduce(((e,t)=>r(e,(()=>t))),o))}o=r(o,(e=>{const n=t[e.getType()];return n&&i(n)}))}n[t]=o}function wh(e,t,n,r){if(!r)return;const i=e[t];if("function"==typeof n)i.push([n,r]);else{const e=i[i.length-1];let t;e&&"types"===e[0]?t=e[1]:(t={},i.push(["types",t]));for(const e in n){const n=t[e]||[];t[e]=n,n.push(r)}}}function kh(e){return"*"===e.nodes}function Eh(e,t){const n=function(e){const t={},{nodes:n}=function(e){const t=new Set,n=new Set;for(const r of ju(e)){const e="function"==typeof r?r:r.replace;ql(e),t.add(e.getType()),n.add(e)}return{nodes:n,types:t}}(e);for(const e of n)t[e.getType()]={klass:e,types:{}};for(const e of Object.values(t))if(e){const n=e.klass.getType();for(let{klass:r}=e;Wr(r.prototype);r=Object.getPrototypeOf(r)){const{ownNodeType:e}=ql(r),i=e&&t[e];i&&(i.types[n]=!0)}}return t}(e),r={$createDOM:[],$decorateDOM:[],$exportDOM:[],$extractWithChild:[],$getDOMSlot:[],$shouldExclude:[],$shouldInclude:[],$updateDOM:[]};for(const e of function(e){const t=[],n=[],r=[];for(const i of e)if(kh(i))t.push(i);else if(Array.isArray(i.nodes))for(const e of i.nodes)Wr(e.prototype)?r.push(1===i.nodes.length?i:{...i,nodes:[e]}):n.push(1===i.nodes.length?i:{...i,nodes:[e]});const i=new Map,o=e=>{let t=i.get(e);if(void 0===t){t=0;for(let n=e;Wr(n.prototype);n=Object.getPrototypeOf(n))t++;i.set(e,t)}return t};return r.sort(((e,t)=>o(e.nodes[0])-o(t.nodes[0]))),[...r,...n,...t]}(t)){const t=gh(n,e);for(const n in r)wh(r,n,t,e[n])}return r}function Th(e){return e}const Nh={build:(e,t,n)=>({defaults:sh(t.contextDefaults,void 0)}),config:{contextDefaults:[],overrides:[]},html:{export:new Map([[Vo,()=>{const e=document.createElement("div");return e.role="textbox",{element:e}}]])},init(e,t){e.dom=function(e,{overrides:t}){const n=Eh(e,t),r={...is,...e.dom};return vh(n,"$createDOM",r,bh,ph),vh(n,"$exportDOM",r,bh,ph),vh(n,"$extractWithChild",r,Ch,yh),vh(n,"$getDOMSlot",r,_h,fh),vh(n,"$shouldExclude",r,_h,fh),vh(n,"$shouldInclude",r,_h,fh),vh(n,"$updateDOM",r,xh,mh),vh(n,"$decorateDOM",r,Sh,Th),r}(e,t)},mergeConfig(e,t){const n=Wa(e,t);for(const r of["overrides","contextDefaults"])t[r]&&(n[r]=[...e[r],...t[r]]);return n},name:ch};function Ah(e,t,n){return function(e,t,n,r){return Object.assign(pt(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}(uh,e,t,n)}Ah("root",Boolean);const Lh=Ah("isExport",Boolean);const Oh=function(e,t=()=>{}){return(n,r=Dl())=>i=>{const o=ih(r),s=o&&o[e],l=sh(n,s||t(r));return l&&l!==s?function(e,t,n,r=Dl()){const i=nh,o=ih(r);try{return nh={...o,editor:r,[e]:t},n()}finally{nh=i}}(e,l,i,r):i()}}(uh,(function(e){const t=ad.maybeFromEditor(e);return t&&t.hasExtensionByName(ch)?cd(e,Nh).output.defaults:void 0}));function Fh(e){return e.constructor.name===CSSStyleRule.name}const Ih=new Set(["STYLE","SCRIPT"]);function Rh(e,t){ks(t)&&function(e){if(null===e.querySelector("style"))return;const t=new Map;function n(e){let n=t.get(e);if(void 0===n){n=new Set;for(let t=0;t<e.style.length;t++)n.add(e.style[t]);t.set(e,n)}return n}try{for(const t of Array.from(e.styleSheets)){let r;try{r=t.cssRules}catch(e){continue}for(const t of Array.from(r)){if(!Fh(t))continue;let r;try{r=e.querySelectorAll(t.selectorText)}catch(e){continue}for(const e of Array.from(r)){if(!Ol(e))continue;const r=n(e);for(let n=0;n<t.style.length;n++){const i=t.style[n];r.has(i)||e.style.setProperty(i,t.style.getPropertyValue(i),t.style.getPropertyPriority(i))}}}}}catch(e){}}(t);const n=ks(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(const t of n)if(!Ih.has(t.nodeName)){const n=Dh(t,e,i,!1);if(null!==n)for(const e of n)r.push(e)}return function(e){for(const t of e)t.getParent()&&t.getNextSibling()instanceof Yo&&t.insertAfter(li());for(const t of e){const e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Ph(e,t=null){return("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)&&th(338),function(e,t=null,n=Dl()){return Oh([ah(Lh,!0)],n)((()=>{const r=zs(),i=Bl(n),o=e.append.bind(e);for(const e of r.getChildren())Mh(n,e,o,t,i);return e}))}(document.createElement("div"),t,e).innerHTML}function Mh(e,t,n,r=null,i=Bl(e)){let o=i.$shouldInclude(t,r,e);const s=i.$shouldExclude(t,r,e);let l=t;null!==r&&Ei(t)&&(l=ec(r,t,"clone"));const a=i.$exportDOM(l,e),{element:c,after:u,append:d,$getChildNodes:h}=a;if(!c)return!1;const g=document.createDocumentFragment(),p=h?h():Ho(l)?l.getChildren():[],f=g.append.bind(g);for(const n of p){const s=Mh(e,n,f,r,i);!o&&s&&i.$extractWithChild(t,n,r,"html",e)&&(o=!0)}if(o&&!s){if((Ol(c)||Il(c))&&(d?d(g):c.append(g)),n(c),u){const e=u.call(l,c);e&&(Il(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(g);return o}function Dh(e,t,n,r,i=new Map,o){const s=[];if(Ih.has(e.nodeName))return s;let l=null;const a=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let i=null;if(void 0!==r)for(const t of r){const n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(e,t),c=a?a(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(l=Array.isArray(t)?t[t.length-1]:t,null!==l){for(const[,e]of i)if(l=e(l,o),!l)break;l&&s.push(...Array.isArray(t)?t:[l])}null!=c.forChild&&i.set(e.nodeName,c.forChild)}const d=e.childNodes;let h=[];const g=(null==l||!Cl(l))&&(null!=l&&Zi(l)||r);for(let e=0;e<d.length;e++)h.push(...Dh(d[e],t,n,g,new Map(i),l));if(null!=u&&(h=u(h)),Pl(e)&&(h=function(e,t,n){const r=e.style.textAlign,i=[];let o=[];for(let e=0;e<t.length;e++){const s=t[e];if(Zi(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&Zi(t[e+1])){const e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(e,h,g?()=>{const e=new Yo;return n.push(e),e}:es)),null==l)if(h.length>0)for(const e of h)s.push(e);else Pl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(Rl(e.nextSibling)&&Rl(e.previousSibling))}(e)&&s.push(li());else Ho(l)&&l.append(...h);return s}function Bh(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $h(e,t=eo()){return null==t&&Bh(166),Mi(t)&&t.isCollapsed()||0===t.getNodes().length?"":Ph(e,t)}function zh(e,t=eo()){return null==t&&Bh(166),Mi(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=zs().getChildren();for(let i=0;i<r.length;i++)jh(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}function Hh(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function Kh(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return qh(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=No(e[n]);t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}const i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{return qh(n,Rh(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(i),"text/html")),t)}catch(e){console.error(e)}const s=o||e.getData("text/uri-list");if(null!=s)if(Mi(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=eo();if(Mi(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([Ai()]):n.insertText(r)}}}else t.insertRawText(s)}const Uh="application/x-lexical-drag";function Wh(e,t){const n={editorKey:t.getKey()};e.setData(Uh,JSON.stringify(n))}function Vh(e,t,n){const r=e.dataTransfer;if(null===r)return!1;const i=function(e){const t=e.getData(Uh);if(!t)return null;let n;try{n=JSON.parse(t)}catch(e){return null}return null!==(r=n)&&"object"==typeof r&&"editorKey"in r&&"string"==typeof r.editorKey?n:null;var r}(r);if(null===i)return!1;const o=function(e){const t=function(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}(e.clientX,e.clientY);if(null===t)return null;const n=Ds(t.node);if(null===n)return null;if(Ei(n))return ua(n,"next",t.offset);if(Ho(n))return $a(n,t.offset,"next");const r=n.getParent();return null===r?null:$a(r,n.getIndexWithinParent()+1,"next")}(e);if(null===o)return!1;const s=Ua(o);if(null===s)return!1;const l=i.editorKey===t.getKey(),a=eo();if(l){if(!Mi(a)||a.isCollapsed())return!1;if(function(e,t){const{anchor:n,focus:r}=Ba(La(t),"next");return Ca(n,e)<0&&Ca(e,r)<0}(o,a))return e.preventDefault(),!0;a.removeText()}if(!s.origin.isAttached())return e.preventDefault(),!0;if(n(r,Na(ba(s)),t),!l){const e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){const n=t.querySelectorAll('[data-lexical-editor="true"]');for(const t of Array.from(n)){const n=t.__lexicalEditor;if(n&&n.getKey()===e)return t}return null}(i.editorKey,n):null;null!==r&&r.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return e.preventDefault(),!0}function qh(e,t,n){e.dispatchCommand(hn,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(Mi(e)&&e.isCollapsed()){let t=null;const n=Ea(e.anchor,"previous");if(n)if(ra(n))t=n.origin;else{const e=_a(n,ga(zs(),"next").getFlipped());for(const n of e){if(Ei(n.origin)){t=n.origin;break}if(Ho(n.origin)&&!n.origin.isInline())break}}if(t&&Ei(t)){const n=t.getFormat(),r=t.getStyle();e.format===n&&e.style===r||(e.format=n,e.style=r,e.dirty=!0)}}}(n))}function jh(e,t,n,r=[]){let i=null===t||n.isSelected(t);const o=Ho(n)&&n.excludeFromCopy("html");let s=n;null!==t&&Ei(s)&&(s=ec(t,s,"clone"));const l=Ho(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Bh(58,n.name),Ho(e)){const e=t.children;Array.isArray(e)||Bh(59,n.name)}return t}(s);Ei(s)&&0===s.getTextContentSize()&&(i=!1);for(let r=0;r<l.length;r++){const o=l[r],s=jh(e,t,o,a.children);!i&&Ho(n)&&s&&n.extractWithChild(o,t,"clone")&&(i=!0)}if(i&&!o)r.push(a);else if(Array.isArray(a.children))for(let e=0;e<a.children.length;e++){const t=a.children[e];r.push(t)}return i}let Zh=null;async function Gh(e,t,n){if(null!==Zh)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Jh(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=i.document,s=Nl(i);if(null===r||null===s)return!1;const l=o.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(o.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise(((t,r)=>{const s=e.registerCommand(Jn,(r=>(fu(r,ClipboardEvent)&&(s(),null!==Zh&&(i.clearTimeout(Zh),Zh=null),t(Jh(e,r,n))),!0)),4);Zh=i.setTimeout((()=>{s(),Zh=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Jh(e,t,n){if(void 0===n){const t=Nl(e._window),r=eo();if(!r||r.isCollapsed())return!1;if(!t)return!1;const i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!ys(e,i,o))return!1;n=Xh(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(Qh(r,n),!0)}const Yh=[["text/html",$h],["application/x-lexical-editor",zh]];function Xh(e=eo()){return function(e,t){const n={"text/plain":""};for(const[r,i]of Object.entries(e)){const e=tg(i,t);null!==e&&(n[r]=e)}return n}(function(){const e=Dl(),t=ad.maybeFromEditor(e);return t&&t.hasExtensionByName(ng.name)?cd(e,ng).output:eg}(),e)}function Qh(e,t){for(const[n]of Yh)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}const eg={"application/x-lexical-editor":[(e,t)=>e?zh(Dl(),e):t()],"text/html":[(e,t)=>e?$h(Dl(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function tg(e,t){const n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}const ng={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:eg},mergeConfig(e,t){const n=Wa(e,t);if(t.$exportMimeType){const r={...e.$exportMimeType};for(const[e,n]of Object.entries(t.$exportMimeType))r[e]=[...r[e],...n];n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"};const rg={build:(e,t,n)=>qu(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>Vu((()=>n.getOutput().disabled.value?void 0:function(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,i,o,s,l]=t;e.update((()=>{const e=eo();if(Mi(e)){const t=e.anchor;let a=t.getNode(),c=0,u=0;if(Ei(a)&&r>=0&&i>=0&&(c=r,u=r+i,e.setTextNodeRange(a,c,a,u)),c===u&&""===o||(e.insertRawText(o),a=t.getNode()),Ei(a)){c=s,u=s+l;const t=a.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(a,c,a,u)}n.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}(e)))},ig="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,og=ig&&"documentMode"in document?document.documentMode:null,sg=ig&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lg=!(!ig||!("InputEvent"in window)||og)&&"getTargetRanges"in new window.InputEvent("input"),ag=ig&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,cg=ig&&/Android/.test(navigator.userAgent),ug=ig&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!cg,dg=ig&&/^(?=.*Chrome).*/i.test(navigator.userAgent),hg=ig&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&sg&&!dg;function gg(e,t){t.update((()=>{if(null!==e){const n=fu(e,KeyboardEvent)?null:e.clipboardData,r=eo();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=$h(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function pg(e){return Za(e.registerCommand(bn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteCharacter(e),!0)}),0),e.registerCommand(wn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(kn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Cn,(e=>{const t=eo();if(!Mi(t))return!1;if("string"==typeof e)t.insertText(e);else{const n=e.dataTransfer;if(null!=n)Hh(n,t);else{const n=e.data;n&&t.insertText(n)}}return!0}),0),e.registerCommand(vn,(()=>{const e=eo();return!!Mi(e)&&(e.removeText(),!0)}),0),e.registerCommand(_n,(e=>{const t=eo();return!!Mi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(xn,(()=>{const e=eo();return!!Mi(e)&&(e.insertLineBreak(),!0)}),0),e.registerCommand(Fn,(e=>{const t=eo();if(!Mi(t))return!1;const n=e,r=n.shiftKey;return!!ac(t,!0)&&(n.preventDefault(),uc(t,r,!0),!0)}),0),e.registerCommand(Ln,(e=>{const t=eo();if(!Mi(t))return!1;const n=e,r=n.shiftKey;return!!ac(t,!1)&&(n.preventDefault(),uc(t,r,!1),!0)}),0),e.registerCommand(Bn,(t=>!!Mi(eo())&&(!ag||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(bn,!0))),0),e.registerCommand(zn,(t=>!!Mi(eo())&&(t.preventDefault(),e.dispatchCommand(bn,!1))),0),e.registerCommand(Mn,(t=>{if(!Mi(eo()))return!1;if(null!==t){if((ag||ug||hg)&&lg)return!1;t.preventDefault()}return e.dispatchCommand(_n,!1)}),0),e.registerCommand(Xn,(()=>(rl(),!0)),0),e.registerCommand(Jn,(t=>!!Mi(eo())&&(gg(t,e),!0)),0),e.registerCommand(Yn,(t=>!!Mi(eo())&&(function(e,t){gg(e,t),t.update((()=>{const e=eo();Mi(e)&&e.removeText()}))}(t,e),!0)),0),e.registerCommand(Sn,(t=>!!Mi(eo())&&(function(e,t){e.preventDefault(),t.update((()=>{const t=eo(),n=fu(e,ClipboardEvent)?e.clipboardData:null;null!=n&&Mi(t)&&Hh(n,t)}),{tag:Zr})}(t,e),!0)),0),e.registerCommand(Vn,(t=>function(e,t){return Vh(e,t,((e,t)=>Hh(e,t)))}(t,e)),0),e.registerCommand(jn,(t=>{const n=eo();return!!Mi(n)&&(n.isCollapsed()||null===t.dataTransfer||Wh(t.dataTransfer,e),!0)}),0))}function fg(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const mg="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,yg=mg&&"documentMode"in document?document.documentMode:null,bg=mg&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),_g=!(!mg||!("InputEvent"in window)||yg)&&"getTargetRanges"in new window.InputEvent("input"),xg=mg&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Cg=mg&&/Android/.test(navigator.userAgent),Sg=mg&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Cg,vg=mg&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wg=mg&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bg&&!vg,kg=un("DRAG_DROP_PASTE_FILE");let Eg=class e extends zo{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return qa(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Fg,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Tg().updateFromJSON(e)}insertNewAfter(e,t){const n=es(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=es();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Tg(){return vl(new Eg)}function Ng(e){return e instanceof Eg}let Ag=class e extends zo{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e="h1",t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){const t=this.getWritable();return t.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){qa(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Og,priority:0}),h2:e=>({conversion:Og,priority:0}),h3:e=>({conversion:Og,priority:0}),h4:e=>({conversion:Og,priority:0}),h5:e=>({conversion:Og,priority:0}),h6:e=>({conversion:Og,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Lg(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Lg(e)?{conversion:e=>({node:Ig("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Ol(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Ig(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?es():Ig(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=es();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?es():Ig(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Lg(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Og(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Ig(t),null!==e.style&&(Ul(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Fg(e){const t=Tg();return null!==e.style&&(t.setFormat(e.style.textAlign),Ul(e,t)),{node:t}}function Ig(e="h1"){return vl(new Ag(e))}function Rg(e){return e instanceof Ag}function Pg(e){let t=null;if(fu(e,DragEvent)?t=e.dataTransfer:fu(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function Mg(e){return Wo(Ds(e))}function Dg(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function Bg(e){return Za(e.registerCommand(gn,(e=>{const t=eo();return!!Bi(t)&&(t.clear(),!0)}),0),e.registerCommand(bn,(e=>{const t=eo();return Mi(t)?(t.deleteCharacter(e),!0):!!Bi(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(wn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(kn,(e=>{const t=eo();return!!Mi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Cn,(t=>{const n=eo();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Kh(r,n,e);else if(Mi(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(vn,(()=>{const e=eo();return!!Mi(e)&&(e.removeText(),!0)}),0),e.registerCommand(En,(e=>{const t=eo();return!!Mi(t)&&(t.formatText(e),!0)}),0),e.registerCommand(qn,(e=>{const t=eo();if(!Mi(t)&&!Bi(t))return!1;const n=t.getNodes();for(const t of n){const n=jl(t,(e=>Ho(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(_n,(e=>{const t=eo();return!!Mi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(xn,(()=>{const e=eo();return!!Mi(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Kn,(()=>{const e=Ai(),t=eo();return Mi(t)&&(e.setFormat(t.format),e.setStyle(t.style)),ao([e]),!0}),0),e.registerCommand(Un,(()=>mu((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Wn,(()=>mu((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(Rn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(Mi(t)){const n=ll(t.focus,!0);if(!e.shiftKey&&Wo(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(Pn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(Mi(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===zs().getChildrenSize()}(t))return e.preventDefault(),!0;const n=ll(t.focus,!1);if(!e.shiftKey&&Wo(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(Fn,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Qa(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!Mi(t))return!1;if(ac(t,!0)){const n=e.shiftKey;return e.preventDefault(),uc(t,n,!0),!0}return!1}),0),e.registerCommand(Ln,(e=>{const t=eo();if(Bi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Qa(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!Mi(t))return!1;const n=e.shiftKey;return!!ac(t,!1)&&(e.preventDefault(),uc(t,n,!1),!0)}),0),e.registerCommand(Bn,(t=>{if(Mg(t.target))return!1;const n=eo();if(Mi(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(qo(n))return!1;const r=du(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Wn,void 0);if(xg&&"ko-KR"===navigator.language)return!1}else if(!Bi(n))return!1;return t.preventDefault(),e.dispatchCommand(bn,!0)}),0),e.registerCommand(zn,(t=>{if(Mg(t.target))return!1;const n=eo();return!(!Mi(n)&&!Bi(n))&&(t.preventDefault(),e.dispatchCommand(bn,!1))}),0),e.registerCommand(Mn,(t=>{const n=eo();if(!Mi(n))return!1;if(Dg(n),null!==t){if((xg||Sg||wg)&&_g)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(_n,!1)}return e.dispatchCommand(xn,void 0)}),0),e.registerCommand($n,(()=>!!Mi(eo())&&(e.blur(),!0)),0),e.registerCommand(Vn,(t=>{const[,n]=Pg(t);if(n.length>0){const r=fg(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=Ds(i);if(null!==o){const e=Ji();if(Ei(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{const t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Ks(At(e))}e.dispatchCommand(kg,n)}return t.preventDefault(),!0}return function(e,t){return Vh(e,t,Kh)}(t,e)}),0),e.registerCommand(jn,(t=>{const[n]=Pg(t),r=eo();return!(n&&!Mi(r)||(Mi(r)&&!r.isCollapsed()&&null!==t.dataTransfer&&(Qh(t.dataTransfer,Xh(r)),Wh(t.dataTransfer,e)),0))}),0),e.registerCommand(Zn,(e=>{const[t]=Pg(e),n=eo();if(t&&!Mi(n))return!1;const r=fg(e.clientX,e.clientY);if(null!==r){Wo(Ds(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Xn,(()=>(rl(),!0)),0),e.registerCommand(Jn,(t=>(Gh(e,fu(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Yn,(t=>(async function(e,t){await Gh(t,fu(e,ClipboardEvent)?e:null),t.update((()=>{const e=eo();Mi(e)?e.removeText():Bi(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Sn,(t=>{const[,n,r]=Pg(t);return n.length>0&&!r?(e.dispatchCommand(kg,n),!0):(!Fl(t.target)||!ms(t.target))&&(null!==eo()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=eo(),r=fu(e,InputEvent)||fu(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Kh(r,n,t)}),{tag:Zr})}(t,e),!0))}),0),e.registerCommand(Dn,(e=>{const t=eo();return Mi(t)&&Dg(t),!1}),0),e.registerCommand(Hn,(e=>{const t=eo();return Mi(t)&&Dg(t),!1}),0))}const $g={conflictsWith:["@lexical/plain-text"],dependencies:[rg],name:"@lexical/rich-text",nodes:()=>[Ag,Eg],register:Bg};function zg(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))Hg(e[r],i)&&(n[r]=zg(e[r],i));return n}function Hg(...e){return e.every((e=>e&&e.constructor==Object))}class Kg{#de={};constructor(...e){this.merge(...e)}merge(...e){return this.#de=e.reduce(zg,this.#de)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#de)}}function Ug(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const Wg=new Kg({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Vg=new Kg({default:{attachments:!0,markdown:!0,multiLine:!0,permittedAttachmentTypes:null,richText:!0,toolbar:{upload:"both"},highlight:{buttons:{color:Ug(1,9).map((e=>`var(--highlight-${e})`)),"background-color":Ug(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var qg={global:Wg,presets:Vg,configure({global:e,...t}){e&&Wg.merge(e),Vg.merge(t)}};function jg(e){be.clearConfig(),be.setConfig(function(e){const t={};for(const n of e)"string"==typeof n?t[n]||=[]:(t[n.tag]||=[],t[n.tag].push(...n.attributes));return{ALLOWED_TAGS:Object.keys(t),ALLOWED_ATTR:pc,ADD_ATTR:(e,n)=>t[n]?.includes(e),ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1}}(e))}function Zg(e){return be.sanitize(e)}function Gg(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}class Jg extends Uo{static getType(){return"custom_action_text_attachment"}static clone(e){return new Jg({...e},e.__key)}static importJSON(e){return new Jg({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(ki(" "));const r=function(e){try{return JSON.parse(e)}catch{return e}}(e.getAttribute("content"));t.push(new Jg({sgid:e.getAttribute("sgid"),innerHtml:r,plainText:e.textContent.trim()||kc(r),contentType:e.getAttribute("content-type")}));const i=e.nextSibling;return i&&i.nodeType===Node.TEXT_NODE&&/^\s/.test(i.textContent)&&t.push(ki(" ")),{node:t}},priority:2}:null}}static get TAG_NAME(){return qg.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r,plainText:i},o){super(o);const s=qg.global.get("attachmentContentTypeNamespace");this.tagName=e||Jg.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${s}.unknown`,this.innerHtml=r,this.plainText=i??kc(r)}createDOM(){const e=xc(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0,draggable:!0});e.dataset.lexicalNodeKey=this.__key,e.insertAdjacentHTML("beforeend",Zg(this.innerHtml));const t=xc("lexxy-node-delete-button");return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return"\ufeff"}getReadableTextContent(){return this.plainText||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:xc(this.tagName,{sgid:this.sgid,content:this.innerHtml,"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml,plainText:this.plainText}}decorate(){return null}}function Yg(e){return e instanceof Jg}function Xg(e){return/^(?:[a-z0-9]+:\/\/|www\.)[^\s]+$/i.test(e)}function Qg(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ep(e,t){const n=Qg(e),r=Qg(t);if(!r)return 0;const i=n.match(new RegExp(`(?<![\\p{L}\\p{N}])${o=r,o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"u"));var o;return i?i.index:-1}function tp(e){return e.charAt(0).toUpperCase()+e.slice(1)}function np(e,t,n){let r=n(),i=0,o=r,s=0,l=null;return(a,c,u,d,h,g)=>{const p=n();if(g.has(Qr)&&(o=r,s=i,l=a),g.has(Vr))return i=0,r=p,2;g.has(ei)&&l&&(r=o,i=s,a=l);const f=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const o=t._selection,s=e._selection;if(i)return 1;if(!(Mi(o)&&Mi(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;const l=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||qo(n)||i.push(n)}return i}(t,n,r);if(0===l.length)return 0;if(l.length>1){const n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Ei(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}const a=l[0],c=e._nodeMap.get(a.__key);if(!Ei(c)||!Ei(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const h=o.anchor,g=s.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}(a,c,d,h,e.isComposing()),m=(()=>{const n=null===u||u.editor===e,o=g.has(qr);if(!o&&n&&g.has(jr))return 0;if(1===f)return 2;if(null===a)return 1;const s=c._selection;if(!(d.size>0||h.size>0))return null!==s?0:2;const l="number"==typeof t?t:t.peek();return!1===o&&0!==f&&f===i&&p<r+l&&n||1===d.size&&function(e,t,n){const r=t._nodeMap.get(e),i=n._nodeMap.get(e),o=t._selection,s=n._selection;return!(Mi(o)&&Mi(s)&&"element"===o.anchor.type&&"element"===o.focus.type&&"text"===s.anchor.type&&"text"===s.focus.type||!Ei(r)||!Ei(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(d)[0],a,c)?0:1})();return r=p,i=f,m}}function rp(e){e.undoStack=[],e.redoStack=[],e.current=null}const ip={build:(e,{delay:t,createInitialHistoryState:n,disabled:r,now:i})=>qu({delay:t,disabled:r,historyState:n(e),now:i}),config:{createInitialHistoryState:function(){return{current:null,redoStack:[],undoStack:[]}},delay:300,disabled:"undefined"==typeof window,now:Date.now},name:"@lexical/history/History",register:(e,t,n)=>{const r=n.getOutput();return Vu((()=>r.disabled.value?void 0:function(e,t,n,r=Date.now){const i=np(e,n,r);return Za(e.registerCommand(Tn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(tr,!0)),0===r.length&&e.dispatchCommand(nr,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Vr})}}(e,t),!0)),0),e.registerCommand(Nn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(nr,!0));const o=n.pop();0===n.length&&e.dispatchCommand(tr,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Vr})}}(e,t),!0)),0),e.registerCommand(Qn,(()=>(rp(t),!1)),0),e.registerCommand(er,(()=>(rp(t),e.dispatchCommand(tr,!1),e.dispatchCommand(nr,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:r,dirtyLeaves:o,dirtyElements:s,tags:l})=>{const a=t.current,c=t.redoStack,u=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;const h=i(r,n,a,o,s,l);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(tr,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(nr,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(e,r.historyState.value,r.delay,(()=>r.now.peek()()))))}};class op{#he;constructor(e){this.#he=e}get editorElement(){return this.#he}get editorConfig(){return this.#he.config}get enabled(){return!0}get lexicalExtension(){return null}get allowedElements(){return[]}initializeToolbar(e){}setEditorValidity(e,t){this.editorElement.setElementValidity(this,e,t)}dispose(){}}function sp(e){return Ho(e)&&Cl(e)&&!qo(e)}function lp(e){return function(e){return(Ho(e)||Wo(e))&&!e.isParentRequired()}(e)?e:e.getParent()?pu(e,(()=>e.createParentElementNode())):e.createParentElementNode().append(e)}function ap(e){const t=uu(e,Ud);return t?.getListType()??null}function cp(e){const t=e.getRootElement();return null!==t&&t.contains(document.activeElement)}function up(e,t=null){return null===t?up(e,!0)||up(e,!1):t?dp(e):function(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return Ho(t)||Ga(177),e.offset===t.getChildrenSize()}(e)}function dp(e){return 0===e.offset}function hp(e,...t){return gp(mi,e,((e,n)=>({...e,forChild:(r,i)=>{const o=e?.forChild??(e=>e);let s=o(r,i);if(Ei(s))return s=t.reduce(((e,t)=>t(e,n)??e),s),s}})))}function gp(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const o=i.conversion(r);return o?n(o,r)??o:o}}function pp(e){const t=e.anchor.getNode(),n=Ho(t)?t:t.getParentOrThrow(),r=n.getChildren();if(0===r.length)return!0;const i=r[r.length-1];if(t===n.getLatest()&&e.anchor.offset===r.length)return!0;if(t===i)return!0;const o=r.findLastIndex((e=>ai(e)));if(-1===o)return!0;return r.indexOf(t)>o}function fp(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren?.();return!t||0===t.length||t.every((e=>!!ai(e)||fp(e)))}function mp(e){for(const t of Su(e)){if(!fp(t))break;t.remove()}}function yp(e,t,n,r){return Ei(e)&&" "===e.getTextContent()&&n===r-1&&t instanceof Jg}function bp(e,t=e=>e.getTopLevelElement()){rc(e),function(e){if(e.isCollapsed())return;const t=e.anchor.getNode().getTopLevelElement(),n=e.focus.getNode().getTopLevelElement();if(!t||!n||t.is(n))return;if(r=e.anchor,i=t,_p(Ea(r,"next"),i)){const n=t.getNextSibling();n&&e.anchor.set(n.getKey(),0,"element")}var r,i;if(function(e,t){return _p(Ea(e,"previous"),t)}(e.focus,n)){const t=n.getPreviousSibling();t&&e.focus.set(t.getKey(),t.getChildrenSize(),"element")}}(e);const n=Ea(e.focus,"next"),r=Ea(e.anchor,"previous"),i=e.isCollapsed(),o=xp(n,i);let s=xp(r,i);o?.origin.is(s?.origin)&&(s=null);const l=o&&Cp(o),a=s&&Cp(s),c=a?.getNextSibling()??t(e.anchor.getNode()),u=l?.getPreviousSibling()??t(e.focus.getNode());c&&u&&Na(_a(Pa(ga(c,"next")),Da(Pa(ga(u,"previous")),"next")))}function _p(e,t){if(ra(e)&&Ma(e))return!1;let n=Pa(e);for(;n&&t.isParentOf(n.origin);){if(n.getNodeAtCaret())return!1;n=n.getParentCaret()}return!0}function xp(e,t=!1){const n=e.origin.getTopLevelElement();if(!n||!ts(n))return null;const r=(t?null:function(e,t){let n;if(oa(e)&&e.origin.is(t)||ra(e)&&Ma(e.getFlipped()))n=null;else if(ia(e)&&e.getParentAtCaret().is(t))n=e;else{const r=function(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);){if(n.getNodeAtCaret())return null;n=n.getParentCaret()}return n?.origin.getParent()?.is(t)?n:null}(e,t);n=r?Oa(r):null}return n&&ai(n.origin)?function(e){const t=e.getNodeAtCaret();return ai(t)?null:e.origin}(n):null}(e,n))??function(e,t){const n=function(e,t){return e.getParentAtCaret().is(t)?e:function(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);)n=n.getParentCaret();return n?.origin.getParent()?.is(t)?n:null}(e,t)}(e,t);if(!n)return null;for(const{origin:e}of n){if(!e.getParent().is(t))break;if(ai(e))return e}return null}(e,n);return r?ca(r,e.direction):null}function Cp(e){let t=null;if(null===e.getNodeAtCaret())e.origin.remove();else{const n=e.origin;Ua(Da(Oa(e),"next")),t=n.getTopLevelElement(),n.remove()}return t}function Sp(e){if("element"!==e.type)return!1;const t=e.getNode().getFirstChild();return(Ho(t)||Wo(t))&&!t.isInline()}function vp(e){return Mi(e)&&[e.anchor,e.focus].some(Sp)}const wp=un("REWRITE_HISTORY_COMMAND");class kp extends op{#ge=null;get lexicalExtension(){return{name:"lexxy/rewritable-history",dependencies:[ip],register:(e,t,n)=>{const r=n.getDependency(ip).output;return this.#ge=r.historyState.value,e.registerCommand(wp,(e=>this.#pe(e)),0)}}}get historyState(){return this.#ge}get#fe(){const e=Array.from(this.#ge.undoStack);return this.#ge.current&&e.push(this.#ge.current),e.concat(this.#ge.redoStack)}#pe(e){return this.#me(e),this.#ye(e),!0}#me(e){Dl().update((()=>{for(const[t,{patch:n,replace:r}]of Object.entries(e)){const e=Rs(t);e&&(n&&Object.assign(e.getWritable(),n),r&&e.replace(r))}}),{discrete:!0,tag:this.#be()})}#ye(e){const t=Object.keys(e);for(const n of this.#fe){if(!this.#_e(n,t))continue;const r=n.editorState=Ep(n.editorState);for(const[t,{patch:n,replace:i}]of Object.entries(e)){const e=r._nodeMap.get(t);e&&(n?this.#xe(r,e,n):i&&this.#Ce(r,e,i))}}}#_e(e,t){return t.some((t=>e.editorState._nodeMap.has(t)))}#be(){const e=[jr,Jr];return cp(this.editorElement.editor)||e.push(Yr),e}#xe(e,t,n){e._nodeMap.set(t.__key,function(e,t){const n=Kl(e);return Object.assign(n,t),n}(t,n))}#Ce(e,t,n){e._nodeMap.set(t.__key,function(e,t){const n=Kl(e);return n.__key=t.__key,n.__parent=t.__parent,n.__prev=t.__prev,n.__next=t.__next,n}(n,t))}}function Ep(e){const t=e.clone();return t._nodeMap=new Map(e._nodeMap),t}class Tp extends Uo{static getType(){return"action_text_attachment"}static clone(e){return new Tp({...e},e.__key)}static importJSON(e){return new Tp({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new Tp({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:()=>({conversion:e=>{const t=(e.getAttribute("src")??"").split("/").pop();return{node:new Tp({src:e.getAttribute("src"),fileName:t,caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}},priority:1}),video:()=>({conversion:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{node:new Tp({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return qg.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,src:n,previewSrc:r,previewable:i,previewStatusUrl:o,pendingPreview:s,altText:l,caption:a,contentType:c,fileName:u,fileSize:d,width:h,height:g,uploadError:p},f){var m;super(f),this.tagName=e||Tp.TAG_NAME,this.sgid=t,this.src=n,this.previewSrc=r,this.previewable="string"==typeof(m=i)?"true"===m:Boolean(m),this.previewStatusUrl=o,this.pendingPreview=s,this.altText=l||"",this.caption=a||"",this.contentType=c||"",this.fileName=u||"",this.fileSize=d,this.width=h,this.height=g,this.uploadError=p,this.editor=Dl()}createDOM(){if(this.uploadError)return this.createDOMForError();if(this.pendingPreview)return this.#Se();const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#ve()),e.appendChild(this.#we())):this.isVideo?(e.appendChild(this.#ke()),e.appendChild(this.#we())):(e.appendChild(this.#ke()),e.appendChild(this.#Ee())),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;const n=t.querySelector("figcaption textarea");return n&&this.caption&&(n.value=this.caption),!1}getTextContent(){return`[${this.caption||this.fileName}]\n\n`}isInline(){return this.isAttached()&&!this.getParent().is(xl(this))}exportDOM(){return{element:xc(this.tagName,{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,src:this.src,previewable:this.previewable,previewStatusUrl:this.previewStatusUrl,pendingPreview:this.pendingPreview,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createDOMForError(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild(xc("div",{innerText:`Error uploading ${this.fileName||"file"}`})),e}createAttachmentFigure(e=this.isPreviewableAttachment){const t=(n=this.contentType,r=e,i=this.fileName,xc("figure",{className:`attachment attachment--${r?"preview":"file"} attachment--${i?i.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":n}));var n,r,i;t.draggable=!0,t.dataset.lexicalNodeKey=this.__key;const o=xc("lexxy-node-delete-button");return t.appendChild(o),t}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return Sc(this.contentType)}get isVideo(){return this.contentType.startsWith("video/")}#Se(){const e=this.createAttachmentFigure(!1);return e.appendChild(this.#ke()),e.appendChild(this.#Ee()),this.#Te(e),e}patchAndRewriteHistory(e){this.editor.dispatchCommand(wp,{[this.getKey()]:{patch:e}})}replaceAndRewriteHistory(e){this.editor.dispatchCommand(wp,{[this.getKey()]:{replace:e}})}#ve(e={}){const t=xc("img",{src:this.previewSrc||this.src,draggable:!1,alt:this.altText,...this.#Ne,...e});this.previewable&&!this.isPreviewableImage&&(t.onerror=()=>this.#Ae(t)),this.previewSrc&&this.#Le(t);const n=xc("div",{className:"attachment__container"});return n.appendChild(t),n}#Le(e){const t=this.previewSrc,n=new Image;n.onload=()=>this.#Oe(e,t),n.onerror=()=>this.#Fe(t),n.src=this.src}#Oe(e,t){e.src=this.src,this.patchAndRewriteHistory({previewSrc:null}),this.#Ie(t)}#Fe(e){this.patchAndRewriteHistory({previewSrc:null,uploadError:!0}),this.#Ie(e)}#Ie(e){e?.startsWith("blob:")&&URL.revokeObjectURL(e)}#Ae(e){const t=e.closest("figure.attachment");t&&this.#Re(t,"attachment--preview","attachment--file",(()=>{t.appendChild(this.#ke()),t.appendChild(this.#Ee())}))}#Te(e){this.previewStatusUrl?this.#Pe(e):this.#Me(e)}#Pe(e){let t=0;const n=async()=>{if(this.editor.read((()=>this.isAttached())))try{const t=await fetch(this.previewStatusUrl,{credentials:"include",redirect:"manual"});if(!this.editor.read((()=>this.isAttached())))return;t.ok?r():this.#De(e,this.src)}catch{r()}},r=()=>{if(t++,t<20&&this.editor.read((()=>this.isAttached()))){const e=Math.min(2e3*Math.pow(1.5,t),12e4);setTimeout(n,e)}};setTimeout(n,3e3)}#Me(e){const t=new Image;t.onload=()=>{this.editor.read((()=>this.isAttached()))&&this.#De(e,this.src)},t.onerror=()=>{this.editor.read((()=>this.isAttached()))&&this.patchAndRewriteHistory({pendingPreview:!1})},t.src=this.src}#De(e,t){this.#Re(e,"attachment--file","attachment--preview",(()=>{const n=xc("img",{src:t,draggable:!1,alt:this.altText});n.onerror=()=>this.#Ae(n);const r=xc("div",{className:"attachment__container"});r.appendChild(n),e.appendChild(r),e.appendChild(this.#we())})),this.patchAndRewriteHistory({pendingPreview:!1})}#Re(e,t,n,r){e.className=e.className.replace(t,n);for(const t of[...e.querySelectorAll(".attachment__container, .attachment__icon, figcaption")])t.remove();r()}get#Ne(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#ke(){return xc("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#Ee(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=xc("span",{className:"attachment__size",textContent:Gg(this.fileSize)});e.appendChild(t)}return e}#we(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#Be(e))),t.addEventListener("keydown",(e=>this.#$e(e))),t.addEventListener("copy",(e=>e.stopPropagation())),t.addEventListener("cut",(e=>e.stopPropagation())),t.addEventListener("paste",(e=>e.stopPropagation())),e.appendChild(t),e}#Be(e){this.#ze(e.target)}#ze(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#$e(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:jr})),e.stopPropagation()}}function Np(...e){return new Tp(...e)}function Ap(e){return e instanceof Tp}function Lp(e,t){return(e instanceof Jg||e instanceof Tp)&&!t.permitsAttachmentContentType(e.contentType)}function Op(e){return e instanceof Tp&&/^data:image\/[^,]*;base64,/i.test(e.src??"")}function Fp(e,t){const n=function(e){try{const[t,n]=e.split(","),r=t.match(/^data:(image\/[A-Za-z0-9][A-Za-z0-9!#$&\-^_.+]*)/)?.[1];if(r){const e=Uint8Array.from(atob(n),(e=>e.charCodeAt(0))),t=function(e){return e?e.split("/")[1]:null}(r)??"png";return new File([e],`pasted-image-${Date.now()}.${t}`,{type:r})}return null}catch{return null}}(e.src);return n&&t.acceptsFile(n)?t.contents.$createUploadNode(n):null}function Ip(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Rp(e,t){let n=e;for(let r=ca(e,t);r&&(Qp(r.origin)||Li(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function Pp(e){return Rp(e,"previous")}function Mp(e){return Rp(e,"next")}function Dp(e,t){for(const n of e.childNodes){if(Ol(n)&&n.tagName===t)return!0;Dp(n,t)}return!1}const Bp="data-language",$p="data-highlight-language",zp="data-theme";let Hp=class e extends zo{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");qa(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Bp,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute($p,n));const r=this.getTheme();r&&t.setAttribute(zp,r);const i=this.getStyle();return i&&ii(t.style,i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(Bp,r):i&&t.removeAttribute(Bp);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute($p,r):t.removeAttribute($p):o&&r&&t.setAttribute($p,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(zp,s):l&&t.removeAttribute(zp);const a=this.__style,c=e.__style;return a!==c&&ii(t.style,a,c),!1}exportDOM(e){const t=document.createElement("pre");qa(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Bp,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute($p,n));const r=this.getTheme();r&&t.setAttribute(zp,r);const i=this.getStyle();return i&&ii(t.style,i),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||Dp(e,"BR"))?{conversion:Wp,priority:1}:null,div:()=>({conversion:Vp,priority:1}),pre:()=>({conversion:Wp,priority:0}),table:e=>Gp(e)?{conversion:qp,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Gp(n)?{conversion:jp,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Gp(t)?{conversion:jp,priority:3}:null}}}static importJSON(e){return Kp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!ud(Dl(),"@lexical/code")){const t=function(e){const{anchor:t}=e;if(e.isCollapsed()&&"element"===t.type){const e=t.getNode();if(Up(e)){const n=e.getChildrenSize();if(n>=2&&t.offset===n){const t=e.getLastChild();if(ai(t)&&ai(t.getPreviousSibling())){const t=es();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}(e);if(t)return t}const{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(Ei(i)){let e=Pp(i);const t=[];for(;;)if(Li(e))t.push(Ai()),e=e.getNextSibling();else{if(!Qp(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Xp(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const r=i.splitText(n.offset)[0],o=0===n.offset?0:1,s=r.getIndexWithinParent()+o,l=i.getParentOrThrow(),a=[li(),...t];l.splice(s,0,a);const c=t[t.length-1];c?c.select():0===n.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(Up(i)){const{offset:t}=e.anchor;i.splice(t,0,[li()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=es();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function Kp(e,t){return function(e){const t=Dl();return xo(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(Hp).setLanguage(e).setTheme(t)}function Up(e){return e instanceof Hp}function Wp(e){return{node:Kp(e.getAttribute(Bp))}}function Vp(e){const t=e,n=Zp(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Zp(t))return!0;t=t.parentElement}return!1}(t)?{node:n?Kp():null}:{node:null}}function qp(){return{node:Kp()}}function jp(){return{node:null}}function Zp(e){return null!==e.style.fontFamily.match("monospace")}function Gp(e){return e.classList.contains("js-file-line-container")}let Jp=class e extends mi{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return qa(t,Yp(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Yp(n.theme,e.__highlightType),o=Yp(n.theme,this.__highlightType);return i!==o&&(i&&ja(t,i),o&&qa(t,o)),r}static importJSON(e){return Xp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return Kp()}};function Yp(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Xp(e="",t){return vl(new Jp(e,t))}function Qp(e){return e instanceof Jp}function ef(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const tf=globalThis.Prism||window.Prism,nf={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function rf(e){return"string"==typeof e?e:Array.isArray(e)?e.map(rf).join(""):rf(e.content)}function of(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=tf.tokenize(r,tf.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=tf.languages[n],i={tokens:e},o=tf.languages.diff.PREFIXES;for(const e of i.tokens){if("string"==typeof e||!(e.type in o)||!Array.isArray(e.content))continue;const t=e.type;let n=0;const i=()=>(n++,new tf.Token("prefix",o[t],t.replace(/^(\w+).*/,"$1"))),s=e.content.filter((e=>"string"==typeof e||"prefix"!==e.type)),l=e.content.length-s.length,a=tf.tokenize(rf(s),r);a.unshift(i());const c=/\r\n|\n/g,u=e=>{const t=[];c.lastIndex=0;let r,o=0;for(;n<l&&(r=c.exec(e));){const n=r.index+r[0].length;t.push(e.slice(o,n)),o=n,t.push(i())}if(0!==t.length)return o<e.length&&t.push(e.slice(o)),t},d=e=>{for(let t=0;t<e.length&&n<l;t++){const n=e[t];if("string"==typeof n){const r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if("string"==typeof n.content){const e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(a),n<l&&a.push(i()),e.content=a}return i.tokens}(i,n[1])),sf(i)}function sf(e,t){const n=[];for(const r of e)if("string"==typeof r){const e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){const i=e[r];"\n"===i||"\r\n"===i?n.push(li()):"\t"===i?n.push(Ai()):i.length>0&&n.push(Xp(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...sf([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...sf(e,"unchanged"===r.type?void 0:r.type))}return n}const lf={$tokenize(e,t){return of(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return tf.tokenize(e,tf.languages[t||""]||tf.languages[this.defaultLanguage])}};function af(e,t,n,r){const i=r.getParent();Up(i)?uf(e,t,n,i):Qp(r)&&r.replace(ki(r.__text))}function cf(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let e=0;e<i;e++)ai(r[e])&&(o+="\n"+ ++s);n.setAttribute("data-gutter",o)}function uf(e,t,n,r){const{nodesCurrentlyHighlighting:i}=n,o=r.getKey();void 0===r.getLanguage()&&r.setLanguage(t.defaultLanguage);if(!function(e){const t=function(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}(e),n=t||e;try{return!!n&&tf.languages.hasOwnProperty(n)}catch(e){return!1}}(r.getLanguage()||t.defaultLanguage))return r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!1),void async function(){}();r.getIsSyntaxHighlightSupported()||r.setIsSyntaxHighlightSupported(!0),i.has(o)||(i.add(o),n.didTransform||(n.didTransform=!0,fl((()=>{n.didTransform=!1,i.clear()}))),function(e,t){const n=Rs(e);if(!Up(n)||!n.isAttached())return;const r=eo();if(!Mi(r))return void t();const i=r.anchor,o=i.offset,s="element"===i.type&&ai(n.getChildAtIndex(i.offset-1));let l=0;if(!s){const e=i.getNode();l=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(s?i.getNode().select(o,o):n.getChildren().some((e=>{const t=Ei(e);if(t||ai(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1})))}(o,(()=>{const e=Rs(o);if(!Up(e)||!e.isAttached())return!1;const n=e.getLanguage()||t.defaultLanguage,i=t.$tokenize(e,n),s=function(e,t){let n=0;for(;n<e.length&&df(e[n],t[n]);)n++;const r=e.length,i=t.length,o=Math.min(r,i)-n;let s=0;for(;s<o;)if(s++,!df(e[r-s],t[i-s])){s--;break}const l=r-s;return{from:n,nodesForReplacement:t.slice(n,i-s),to:l}}(e.getChildren(),i),{from:l,to:a,nodesForReplacement:c}=s;return!(l===a&&!c.length||(r.splice(l,a-l,c),0))})))}function df(e,t){return Qp(e)&&Qp(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Li(e)&&Li(t)||ai(e)&&ai(t)}function hf(e){if(!Mi(e))return!1;const t=e.anchor.getNode(),n=Up(t)?t:t.getParent(),r=e.focus.getNode(),i=Up(r)?r:r.getParent();return Up(n)&&n.is(i)}function gf(e){const t=e.getNodes(),n=[];if(1===t.length&&Up(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Qp(i)||Li(i)||ai(i)||ef(169),ai(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Fi(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function pf(e){const t=eo();if(!Mi(t)||!hf(t))return!1;const n=gf(t),r=n.length;if(0===r&&t.isCollapsed())return e===Un&&t.insertNodes([Ai()]),!0;if(0===r&&e===Un&&"\n"===t.getTextContent()){const e=Ai(),n=li(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),Na(Ba(_a(ua(e,"next",0),Pa(ca(n,"next"))),r)),!0}for(let i=0;i<r;i++){const r=n[i];if(r.length>0){let n=r[0];if(0===i&&(n=Pp(n)),e===Un){const e=Ai();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Fi(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Li(n)&&n.remove()}}return!0}function ff(e,t){const n=eo();if(!Mi(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),a=i.getNode(),c=e===Rn;if(!hf(n)||!Qp(l)&&!Li(l)||!Qp(a)&&!Li(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=l.getParentOrThrow();if(c&&0===o&&null===l.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&o===l.getTextContentSize()&&null===l.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(l.isBefore(a)?(u=Pp(l),d=Mp(a)):(u=Pp(a),d=Mp(l)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;e<h.length;e++){const t=h[e];if(!Qp(t)&&!Li(t)&&!ai(t))return!1}t.preventDefault(),t.stopPropagation();const g=c?u.getPreviousSibling():d.getNextSibling();if(!ai(g))return!0;const p=c?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;const f=Qp(p)||Li(p)||ai(p)?c?Pp(p):Mp(p):null;let m=null!=f?f:p;return g.remove(),h.forEach((e=>e.remove())),e===Rn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(l,o,a,s),!0}function mf(e,t){const n=eo();if(!Mi(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===In;if(!hf(n)||!Qp(o)&&!Li(o)||!Qp(s)&&!Li(s))return!1;const a=s;if("rtl"===function(e){const t=Pp(e),n=Mp(e);let r=t;for(;null!==r;){if(Qp(r)){const e=Cs(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(Ho(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}(a)?!l:l){const e=function(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(Qp(i)||Li(i)||ai(i)||Ip(167),ai(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Qp(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Qp(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Qp(t)&&(l=t.getTextContent()[0])}if(null!==l&&" "!==l)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!Qp(n)||r===o){if(n=n.getNextSibling(),null===n||ai(n))return null;Qp(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Qp(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}(a,i.offset);if(null!==e){const{node:t,offset:r}=e;ai(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else(function(e){const t=Mp(e);return ai(t)&&Ip(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}const yf={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},bf=function(e){return nf[e]||e},_f=function(e,t){if(!e.hasNodes([Hp,Jp]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=lf);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(Hp,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Rs(n);null!==t&&cf(t,e)}}))}),{skipInitialization:!1}));const r={didTransform:!1,nodesCurrentlyHighlighting:new Set};return n.push(e.registerNodeTransform(Hp,uf.bind(null,e,t,r)),e.registerNodeTransform(mi,af.bind(null,e,t,r)),e.registerNodeTransform(Jp,af.bind(null,e,t,r)),e.registerCommand(Hn,(t=>{const n=function(e){const t=eo();if(!Mi(t)||!hf(t))return null;const n=e?Wn:Un,r=e?Wn:Kn,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=gf(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&ef(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=Pp(l[0]),d=Mp(l[0]),h=Fi(u.getKey(),0,"text"),g=Fi(d.getKey(),d.getTextContentSize(),"text");return a.isBefore(h)||g.isBefore(c)?n:h.isBefore(a)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(Kn,(()=>!!hf(eo())&&(ao([Ai()]),!0)),1),e.registerCommand(Un,(e=>pf(Un)),1),e.registerCommand(Wn,(e=>pf(Wn)),1),e.registerCommand(Rn,(e=>{const t=eo();if(!Mi(t)||!hf(t))return!1;const n=zs().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ff(Rn,e)}),1),e.registerCommand(Pn,(e=>{const t=eo();if(!Mi(t)||!hf(t))return!1;const n=zs().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ff(Pn,e)}),1),e.registerCommand(In,(e=>mf(In,e)),1),e.registerCommand(On,(e=>mf(On,e)),1)),Za(...n)};function xf(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}const Cf=/[!-/:-@[-`{-~\s]/;function Sf(e){return e.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,((e,t)=>String.fromCodePoint(Number(t))))}function vf(e){return Ei(e)&&!e.hasFormat("code")}function wf(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const kf=pt("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-",resetOnCopyNode:!0}),Ef=pt("mdCodeFence",{parse:e=>"string"==typeof e&&/^`{3,}$/.test(e)?e:"```",resetOnCopyNode:!0}),Tf=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},Nf=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=Hd("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==kf.parse(a)?void 0:a;if(Gd(s)&&s.getListType()===e){c&&mt(s,kf,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(Gd(o)&&o.getListType()===e)c&&mt(o,kf,c),o.append(l),t.remove();else{const n=Zd(e,"number"===e?Number(r[2]):void 0);c&&mt(n,kf,c),n.append(l),t.replace(n)}l.append(...n),i||l.select(0,0);const u=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&l.setIndent(u)},Af=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(Kd(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(Gd(e)){r.push(Af(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=ft(e,kf),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";let u=t(s);"number"!==l&&(u=u.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),r.push(i+c+u),o++}return r.join("\n")},Lf={dependencies:[Ag],export:(e,t)=>{if(!Rg(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:Tf((e=>Ig("h"+e[1].length))),type:"element"},Of={dependencies:[Eg],export:(e,t)=>{if(!Ng(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(Ng(n))return n.splice(n.getChildrenSize(),0,[li(),...t]),void e.remove()}const i=Tg();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},Ff={dependencies:[Hp],export:e=>{if(!Up(e))return null;const t=e.getTextContent();let n=ft(e,Ef);if(t.indexOf(n)>-1){const e=t.match(/`{3,}/g);if(e){const t=Math.max(...e.map((e=>e.length)));n="`".repeat(t+1)}}return n+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n"+n},handleImportAfterStartMatch:({lines:e,rootNode:t,startLineIndex:n,startMatch:r})=>{const i=r[1],o=i.trim().length,s=e[n],l=r.index+i.length,a=s.slice(l),c=new RegExp(`\`{${o},}$`);if(c.test(a)){const e=a.match(c),i=a.slice(0,a.lastIndexOf(e[0])),o=[...r];return o[2]="",Ff.replace(t,null,o,e,[i],!0),[!0,n]}const u=new RegExp(`^[ \\t]*\`{${o},}$`);for(let i=n+1;i<e.length;i++){const o=e[i];if(u.test(o)){const l=o.match(u),a=e.slice(n+1,i),c=s.slice(r[0].length);return c.length>0&&a.unshift(c),Ff.replace(t,null,r,l,a,!0),[!0,i]}}const d=e.slice(n+1),h=s.slice(r[0].length);return h.length>0&&d.unshift(h),Ff.replace(t,null,r,null,d,!0),[!0,e.length-1]},regExpEnd:{optional:!0,regExp:/^[ \t]*`{3,}$/},regExpStart:/^([ \t]*`{3,})([\w-]+)?[ \t]?/,replace:(e,t,n,r,i,o)=>{let s,l;const a=n[1]?n[1].trim():"```",c=n[2]||void 0;if(!t&&i){if(1===i.length)r?(s=Kp(c),l=i[0]):(s=Kp(c),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{for(s=Kp(c),i.length>0&&(0===i[0].trim().length?i.shift():i[0].startsWith(" ")&&(i[0]=i[0].slice(1)));i.length>0&&!i[i.length-1].length;)i.pop();l=i.join("\n")}mt(s,Ef,a);const t=ki(l);s.append(t),e.append(s)}else t&&Tf((e=>Kp(e?e[2]:void 0)))(e,t,n,o)},type:"multiline-element"},If={dependencies:[Ud,Bd],export:(e,t)=>Gd(e)?Af(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:Nf("bullet"),type:"element"},Rf={dependencies:[Ud,Bd],export:(e,t)=>Gd(e)?Af(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:Nf("number"),type:"element"},Pf={dependencies:[hd],export:(e,t,n)=>{if(!fd(e)||bd(e))return null;const r=t(e);let i=e.getTitle();return null!=i&&(i=i.replace(/([\\"])/g,"\\$1")),i?`[${r}](${e.getURL()} "${i}")`:`[${r}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(jl(e,fd))return;const[,n,r,i]=t,o=pd(null!=r?Sf(r):void 0,{title:null!=i?Sf(i):void 0}),s=n.split("[").length-1,l=n.split("]").length-1;let a=n,c="";if(s<l)return;if(s>l){const e=n.split("[");c="["+e[0],a=e.slice(1).join("[")}const u=ki(a);return u.setFormat(e.getFormat()),o.append(u),e.replace(o),c&&o.insertBefore(ki(c)),u},trigger:")",type:"text-match"},Mf=[...[Lf,Of,If,Rf],...[Ff],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[Pf]];function Df(e,t,n,r,i){if(!Cl(e.getParent())||e.getFirstChild()!==t)return!1;const o=t.getTextContent();if(!i&&" "!==o[n-1])return!1;for(const{regExpStart:s,replace:l,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=o.match(s);if(r){const o=i||r[0].endsWith(" ")?n:n-1;if(r[0].length!==o)continue;const s=t.getNextSiblings(),[a,c]=t.splitText(n);if(!1!==l(e,c?[c,...s]:s,r,null,null,!1))return a.remove(),!0}}return!1}function Bf(e,t){let n=0;const r=e.getTextContent();for(let e=0;e<t;e++)"`"===r[e]&&n++;return n%2!=0}function $f(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(zf(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function zf(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function Hf(e,t=Mf){const n=function(e){const t=xf(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=xf(n.textFormat,(({tag:e})=>e[e.length-1])),i=xf(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||wf(173,n.getType())}}const o=(e,t,o)=>!!(function(e,t,n,r){if(!Cl(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:o,replace:s}of r){const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,l]=t.splitText(n);if(!1!==s(e,l?[l,...i]:i,r,!1))return o.remove(),!0}}return!1}(e,t,o,n.element)||Df(e,t,o,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t<r.length&&(r=r.slice(0,t));for(const t of i){if(!t.replace||!t.regExp)continue;const n=r.match(t.regExp);if(null===n)continue;const i=n.index||0,o=i+n[0].length;let s;return 0===i?[s]=e.splitText(o):[,s]=e.splitText(i,o),s.selectNext(0,0),t.replace(s,n),!0}return!1}(t,o,i)||function(e,t,n){const r=e.getTextContent(),i=t-1,o=r[i],s=n[o];if(!s)return!1;for(const t of s){const{tag:n}=t,s=n.length,l=i-s+1;if(s>1&&!zf(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!Cf.test(a))continue;const c=e;let u=c,d=$f(r,l,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!ai(h);)if(Ei(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=$f(e,e.length,n)}if(d<0)continue;if(u===c&&d+s===l)continue;const g=u.getTextContent();if(d>0&&g[d-1]===o)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Cf.test(p))continue;if(!t.format.includes("code")&&Bf(u,d))continue;const f=c.getTextContent(),m=f.slice(0,l)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+s));const b=eo(),_=Ji();Ks(_);const x=i-s*(u===c?2:1)+1;_.anchor.set(u.__key,d,"text"),_.focus.set(c.__key,x,"text");for(const e of t.format)_.hasFormat(e)||_.formatText(e);_.anchor.set(_.focus.key,_.focus.offset,_.focus.type);for(const e of t.format)_.hasFormat(e)&&_.toggleFormat(e);return Mi(b)&&(_.format=b.format),!0}return!1}(t,o,r));return Za(e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Gr)||t.has(Vr))return;if(e.isComposing())return;const s=r.read(eo),l=i.read(eo);if(!Mi(l)||!Mi(s)||!s.isCollapsed()||s.is(l))return;const a=s.anchor.key,c=s.anchor.offset,u=r._nodeMap.get(a);!Ei(u)||!n.has(a)||1!==c&&c>l.anchor.offset+1||e.update((()=>{if(!vf(u))return;const e=u.getParent();null===e||Up(e)||o(e,u,s.anchor.offset)&&pl(qr)}))})),e.registerCommand(Mn,(e=>{if(null!==e&&e.shiftKey)return!1;const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const r=t.anchor.offset,i=t.anchor.getNode();if(!Ei(i)||!vf(i))return!1;const o=i.getParent();return null!==o&&!Up(o)&&(r===i.getTextContent().length&&!!Df(o,i,r,n.multilineElement,!0)&&(null!==e&&e.preventDefault(),!0))}),1))}class Kf extends Uo{static getType(){return"horizontal_divider"}static clone(e){return new Kf(e.__key)}static importJSON(e){return new Kf}static importDOM(){return{hr:e=>({conversion:()=>({node:new Kf}),priority:1})}}constructor(e){super(e)}createDOM(){const e=xc("figure",{className:"horizontal-divider"}),t=xc("hr");e.appendChild(t);const n=xc("lexxy-node-delete-button");return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:xc("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Uf={dependencies:[Kf],export:e=>e instanceof Kf?"---":null,regExpStart:/^-{3,}\s?$/,replace:(e,t,n,r,i,o)=>{const s=new Kf;if(e.replace(s),!o){const e=es();s.insertAfter(e),e.select()}},type:"multiline-element"},Wf=/[^\w]/;function Vf(e,t,n){const r=n.tag,i=r.length,o=e.getTextContent(),s=t+i,l=o.indexOf(r,s);if(l<0)return;const a=o.slice(s,l);if(0===a.length)return;const c=o.slice(0,t),u=o.slice(l+i);e.setTextContent(c+a+u);const d=Ji();Ks(d),d.anchor.set(e.getKey(),t,"text"),d.focus.set(e.getKey(),t+a.length,"text");for(const e of n.format)d.hasFormat(e)||d.formatText(e);d.anchor.set(d.focus.key,d.focus.offset,d.focus.type);for(const e of n.format)d.hasFormat(e)&&d.toggleFormat(e)}var qf={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},tableCellHeader:"lexxy-content__table-cell--header",tableCellSelected:"lexxy-content__table-cell--selected",tableSelection:"lexxy-content__table--selection",tableScrollableWrapper:"lexxy-content__table-wrapper",tableCellHighlight:"lexxy-content__table-cell--highlight",tableCellFocus:"lexxy-content__table-cell--focus",list:{nested:{listitem:"lexxy-nested-listitem"}},codeHighlight:{addition:"code-token__selector",atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__comment",decorator:"code-token__function",deleted:"code-token__operator",deletion:"code-token__operator",directive:"code-token__attr","directive-hash":"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__function",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",line:"code-token__selector",namespace:"code-token__variable",number:"code-token__property",macro:"code-token__function",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation","raw-string":"code-token__operator",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function","type-definition":"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};class jf{#He=new Map;track(e,t){this.#He.set(e,t)}forget(e){this.#He.delete(e)}abort(e){const t=this.#He.get(e);t&&(this.#He.delete(e),t.abort())}clear(){this.#He.clear()}}const Zf=/^(\d+(?:\.\d+)?)px$/,Gf=3,Jf=2,Yf=0,Xf=1;let Qf=class e extends zo{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:tm,priority:0}),th:e=>({conversion:tm,priority:0})}}static importJSON(e){return nm().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Yf,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(t.style.backgroundColor=this.__backgroundColor),em(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),qa(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(Ol(t.element)){const e=t.element;e.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||"top",e.style.textAlign="start",null===this.__backgroundColor&&this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...em(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Gf){const n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Yf}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function em(e){return"middle"===e||"bottom"===e}function tm(e){const t=e,n=e.nodeName.toLowerCase();let r;Zf.test(t.style.width)&&(r=parseFloat(t.style.width));let i=Yf;if("th"===n){const e=t.getAttribute("scope");if("col"===e)i=Jf;else if("row"===e)i=Xf;else{const e=t.parentElement,n=Ol(e)&&"tr"===e.nodeName.toLowerCase()&&Ol(e.parentElement)&&("thead"===e.parentElement.nodeName.toLowerCase()||0===e.rowIndex),r=0===t.cellIndex;n&&(i|=Xf),r&&(i|=Jf),i===Yf&&(i=Xf)}}const o=nm(i,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;""!==s&&(o.__backgroundColor=s);const l=t.style.verticalAlign;em(l)&&(o.__verticalAlign=l);const a=t.style,c=(a&&a.textDecoration||"").split(" "),u="700"===a.fontWeight||"bold"===a.fontWeight,d=c.includes("line-through"),h="italic"===a.fontStyle,g=c.includes("underline"),p=a.color;return{after:e=>{const t=[];let n=null;const r=()=>{if(n){const e=n.getFirstChild();ai(e)&&1===n.getChildrenSize()&&e.remove()}};for(const i of e)if(_l(i)||Ei(i)||ai(i)){if(Ei(i)&&(u&&i.toggleFormat("bold"),d&&i.toggleFormat("strikethrough"),h&&i.toggleFormat("italic"),g&&i.toggleFormat("underline"),p)){const e=i.getStyle();e.includes("color:")||i.setStyle(e+`color: ${p};`)}n?n.append(i):(n=es().append(i),t.push(n))}else t.push(i),r(),n=null;return r(),0===t.length&&t.push(es()),t},node:o}}function nm(e=Yf,t=1,n){return vl(new Qf(e,t,n))}function rm(e){return e instanceof Qf}const im=un("INSERT_TABLE_COMMAND");function om(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let sm=class e extends zo{__height;static getType(){return"tablerow"}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:lm,priority:0})}}static importJSON(e){return am().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...void 0===e?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),qa(t,e.theme.tableRow),t}extractWithChild(e,t,n){return"html"===n}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function lm(e){const t=e;let n;return Zf.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>xu(e,rm),node:am(n)}}function am(e){return vl(new sm(e))}function cm(e){return e instanceof sm}const um="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,dm=um&&"documentMode"in document?document.documentMode:null,hm=um&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function gm(e){const t=jl(e,(e=>rm(e)));return rm(t)?t:null}function pm(e){const t=jl(e,(e=>cm(e)));if(cm(t))return t;throw new Error("Expected table cell to be inside of table row.")}function fm(e){const t=jl(e,(e=>wy(e)));if(wy(t))return t;throw new Error("Expected table cell to be inside of table.")}um&&"InputEvent"in window&&!dm&&new window.InputEvent("input");const mm=(e,t)=>e===Gf||e===t?t:Yf;function ym(e=!0){const t=eo();Mi(t)||Im(t)||om(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Nm(n),[o,,s]=Nm(r),[,l,a]=Em(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?bm(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):bm(u<c?o:i,!1)}function bm(e,t=!0){const[,,n]=Nm(e),[r,i]=Em(n,e,e),o=r[0].length,{startRow:s}=i;let l=null;if(t){const t=s+e.__rowSpan-1,i=r[t],a=am();for(let e=0;e<o;e++){const{cell:n,startRow:r}=i[e];if(r+n.__rowSpan-1<=t){const t=i[e].cell.__headerState,n=mm(t,Jf);a.append(nm(n).append(es()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);cm(c)||om(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=am();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=mm(e,Jf);i.append(nm(r).append(es()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);cm(a)||om(257),a.insertBefore(i),l=i}return l}function _m(e=!0){const t=eo();Mi(t)||Im(t)||om(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Nm(n),[o,,s]=Nm(r),[,l,a]=Em(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?xm(c+i.__colSpan>u+o.__colSpan?i:o,!0):xm(u<c?o:i,!1)}function xm(e,t=!0,n=!0){const[,,r]=Nm(e),[i,o]=Em(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();cm(c)||om(120);let u=null;function d(e=Yf){const t=nm(e).append(es());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();cm(e)||om(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=mm(n,Xf);if(a<0){Sm(h,d(r));continue}const{cell:o,startColumn:s,startRow:l}=t[a];if(s+o.__colSpan-1<=a){let n=o,i=l,s=a;for(;i!==e&&n.__rowSpan>1;){if(s-=o.__colSpan,!(s>=0)){h.append(d(r));continue e}{const{cell:e,startRow:r}=t[s];n=e,i=r}}n.insertAfter(d(r))}else o.setColSpan(o.__colSpan+1)}null!==u&&n&&Cm(u);const g=r.getColWidths();if(g){const e=[...g],t=a<0?0:a,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function Cm(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Sm(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function vm(e){if(0===e.length)return null;const t=fm(e[0]),[n]=Tm(t,null,null);let r=1/0,i=-1/0,o=1/0,s=-1/0;const l=new Set;for(const t of n)for(const n of t){if(!n||!n.cell)continue;const t=n.cell.getKey();if(!l.has(t)&&e.some((e=>e.is(n.cell)))){l.add(t);const e=n.startRow,a=n.startColumn,c=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+c-1),o=Math.min(o,a),s=Math.max(s,a+u-1)}}if(r===1/0||o===1/0)return null;const a=i-r+1,c=s-o+1,u=n[r][o];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const h=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=o;t<=s;t++){const r=n[e][t];if(!r.cell)continue;const i=r.cell,o=i.getKey();h.has(o)||(h.add(o),wm(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append(es()),d}function wm(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!ts(t)||!t.isEmpty())}function km(e){const[t,n,r]=Nm(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=Em(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Jf,d=Array.from({length:i},((e,t)=>{let n=u;for(let e=0;0!==n&&e<s.length;e++)n&=s[e][t+a].cell.__headerState;return n})),h=t.__headerState&Xf,g=Array.from({length:o},((e,t)=>{let n=h;for(let e=0;0!==n&&e<s[0].length;e++)n&=s[t+c][e].cell.__headerState;return n}));if(i>1){for(let e=1;e<i;e++)t.insertAfter(nm(d[e]|g[0]).append(es()));t.setColSpan(1)}if(o>1){let e;for(let t=1;t<o;t++){const r=c+t,o=s[r];e=(e||n).getNextSibling(),cm(e)||om(125);let l=null;for(let e=0;e<a;e++){const t=o[e],n=t.cell;t.startRow===r&&(l=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(null===l)for(let n=i-1;n>=0;n--)Sm(e,nm(d[n]|g[t]).append(es()));else for(let e=i-1;e>=0;e--)l.insertAfter(nm(d[e]|g[t]).append(es()))}t.setRowSpan(1)}}function Em(e,t,n){const[r,i,o]=Tm(e,t,n);return null===i&&om(207),null===o&&om(208),[r,i,o]}function Tm(e,t,n){const r=[];let i=null,o=null;function s(e){let t=r[e];return void 0===t&&(r[e]=t=[]),t}const l=e.getChildren();for(let e=0;e<l.length;e++){const r=l[e];cm(r)||om(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(rm(c)||om(147);void 0!==a[u];)u++;const r={cell:c,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:h}=c;for(let t=0;t<d&&!(e+t>=l.length);t++){const n=s(e+t);for(let e=0;e<h;e++)n[u+e]=r}null!==t&&null===i&&t.is(c)&&(i=r),null!==n&&null===o&&n.is(c)&&(o=r)}}return[r,i,o]}function Nm(e){let t;if(e instanceof Qf)t=e;else if("__type"in e){const n=jl(e,rm);rm(n)||om(148),t=n}else{const n=jl(e.getNode(),rm);rm(n)||om(148),t=n}const n=t.getParent();cm(n)||om(149);const r=n.getParent();return wy(r)||om(210),[t,n,r]}function Am(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),o=Math.min(t.startRow,n.startRow),s=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){const a=e[t][n];if(!a)continue;const c=a.startColumn+a.cell.__colSpan-1,u=a.startRow+a.cell.__rowSpan-1,d=a.startColumn<=s&&c>=i,h=a.startRow<=l&&u>=o;if(d&&h){const e=Math.min(i,a.startColumn),t=Math.max(s,c),n=Math.min(o,a.startRow),d=Math.max(l,u);e===i&&t===s&&n===o&&d===l||(i=e,s=t,o=n,l=d,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:i,minRow:o}}function Lm(e){const[t,,n]=Nm(e),r=n.getChildren(),i=r.length,o=r[0].getChildren().length,s=new Array(i);for(let e=0;e<i;e++)s[e]=new Array(o);for(let e=0;e<i;e++){const n=r[e].getChildren();let i=0;for(let r=0;r<n.length;r++){for(;s[e][i];)i++;const o=n[r],l=o.__rowSpan||1,a=o.__colSpan||1;for(let t=0;t<l;t++)for(let n=0;n<a;n++)s[e+t][i+n]=o;if(t===o)return{colSpan:a,columnIndex:i,rowIndex:e,rowSpan:l};i+=a}}return null}function Om(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=jl(n,rm);rm(r)||om(238,t,n.getKey(),n.getType());const i=r.getParent();cm(i)||om(239,t);const o=i.getParent();return wy(o)||om(240,t),[n,r,i,o]}));return i.is(a)||om(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class Fm{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if("root"===this.tableKey||"root"===this.anchor.key||"element"!==this.anchor.type||"root"===this.focus.key||"element"!==this.focus.type)return!1;const e=Rs(this.tableKey),t=Rs(this.anchor.key),n=Rs(this.focus.key);return null!==e&&null!==t&&null!==n}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Im(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new Fm(this.tableKey,Fi(this.anchor.key,this.anchor.offset,this.anchor.type),Fi(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(rm).forEach((e=>{const n=e.getFirstChild();ts(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ze[e])}insertNodes(e){const t=this.focus.getNode();Ho(t)||om(151),At(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Om(this),n=Lm(e);null===n&&om(153);const r=Lm(t);null===r&&om(155);const i=Math.min(n.columnIndex,r.columnIndex),o=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),s=Math.min(n.rowIndex,r.rowIndex),l=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,o),fromY:Math.min(s,l),toX:Math.max(i,o),toY:Math.max(s,l)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(null!==e)return e;const{anchorTable:t,anchorCell:n,focusCell:r}=Om(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&om(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&om(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=Em(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=Am(o,s,l),h=new Map([[t.getKey(),t]]);let g=null;for(let e=u;e<=d;e++)for(let t=a;t<=c;t++){const{cell:n}=o[e][t],r=n.getParent();cm(r)||om(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||Pm(n,(e=>{h.set(e.getKey(),e)}))}const p=Array.from(h.values());return _o()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter((e=>rm(e)));let t="";for(let n=0;n<e.length;n++){const r=e[n],i=r.__parent,o=(e[n+1]||{}).__parent;t+=r.getTextContent()+(o!==i?"\n":"\t")}return t}}function Im(e){return e instanceof Fm}function Rm(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=eo(),i=Im(r)?r.clone():function(){const e=Fi("root",0,"element"),t=Fi("root",0,"element");return new Fm("root",e,t)}();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function Pm(e,t){const n=[[e]];for(let e=n.at(-1);void 0!==e&&n.length>0;e=n.at(-1)){const r=e.pop();void 0===r?n.pop():!1!==t(r)&&Ho(r)&&n.push(r.getChildren())}}function Mm(e,t=Dl()){const n=Rs(e);wy(n)||om(231,e);const r=Hm(n,t.getElementByKey(e));return null===r&&om(232,e),{tableElement:r,tableNode:n}}class Dm{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}}class Bm{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Mm(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver((e=>{this.editor.getEditorState().read((()=>{let t=!1;for(let n=0;n<e.length;n++){const r=e[n].target.nodeName;if("TABLE"===r||"TBODY"===r||"THEAD"===r||"TR"===r){t=!0;break}}if(!t)return;const{tableNode:n,tableElement:r}=this.$lookup();this.table=Ym(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=Ym(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(e=!0){const t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:n,tableElement:r}=this.$lookup();Xm(t,Ym(n,r),null),e&&null!==eo()&&(Ks(null),t.dispatchCommand(dn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();ja(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();qa(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&om(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Xm(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=Nl(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const n=this.editor,{tableNode:r}=this.$lookup(),i=e.x,o=e.y;if(this.focusCell=e,this.isHighlightingCells||(t||this.anchorX!==i||this.anchorY!==o||null!=this.tableSelection&&null!=this.anchorCellNodeKey)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),-1!==this.focusX&&-1!==this.focusY&&i===this.focusX&&o===this.focusY)return!1;if(this.focusX=i,this.focusY=o,this.isHighlightingCells){const s=fy(r,e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey){let e=s;if(null===e&&t&&(e=r.getCellNodeFromCords(i,o,this.table)),null!==e){const t=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=Rm(r,t,e),Ks(this.tableSelection),n.dispatchCommand(dn,void 0),Xm(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?Rs(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&om(234),e}$getFocusTableCell(){return this.focusCellNodeKey?Rs(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&om(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),n=fy(t,e.elem);if(null!==n){const e=n.getKey();null!=this.tableSelection?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)):this.tableSelection=Rm(t,n,n),this.anchorCellNodeKey=e}}$formatCells(e){const t=eo();Im(t)||om(236);const n=Ji(),r=n.anchor,i=n.focus,o=t.getNodes().filter(rm);o.length>0||om(237);const s=o[0].getFirstChild(),l=ts(s)?s.getFormatFlags(e,null):null;o.forEach((t=>{r.set(t.getKey(),0,"element"),i.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e,l)})),Ks(t),this.editor.dispatchCommand(dn,void 0)}$clearText(){const{editor:e}=this,t=Rs(this.tableNodeKey);if(!wy(t))throw new Error("Expected TableNode.");const n=eo();Im(n)||om(253);const r=n.getNodes().filter(rm),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&cm(i)&&cm(o)&&r[0]===i.getFirstChild()&&r[r.length-1]===o.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void(qo(n)&&n.isEmpty()&&e.dispatchCommand(xn,void 0))}r.forEach((e=>{if(Ho(e)){const t=es(),n=ki();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Xm(e,this.table,null),Ks(null),e.dispatchCommand(dn,void 0)}}const $m="__lexicalTableSelection";function zm(e){return Ol(e)&&"TABLE"===e.nodeName}function Hm(e,t){if(!t)return t;const n=zm(t)?t:t.querySelector("table");return zm(n)||om(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function Km(e){return e._window}function Um(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;rm(n)&&(r=n)}return null}const Wm=[[Pn,"down"],[Rn,"up"],[Fn,"backward"],[Ln,"forward"]],Vm=[wn,kn,bn],qm=[Bn,zn];function jm(e,t,n){const r=eo(),i=to();r&&!r.is(i)&&(Im(r)||Im(i))&&n.tableSelection&&!n.tableSelection.is(i)&&(Im(r)&&r.tableKey===n.tableNodeKey?n.$updateTableTableSelection(r):!Im(r)&&Im(i)&&i.tableKey===n.tableNodeKey&&n.$updateTableTableSelection(null)),n.hasHijackedSelectionStyles&&!t.isSelected()?function(e,t){t.$enableHighlightStyle(),Qm(t.table,(t=>{const n=t.elem;t.highlighted=!1,ly(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(e,n):!n.hasHijackedSelectionStyles&&t.isSelected()&&function(e,t){t.$disableHighlightStyle(),Qm(t.table,(t=>{t.highlighted=!0,sy(e,t)}))}(e,n)}function Zm(e){return e[$m]||null}function Gm(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function Jm(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;null!=r;r=r.parentNode){if(r===e)return n;const t=r.nodeName;"TD"!==t&&"TH"!==t||(n=r._cell||null)}return null}function Ym(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Hm(e,t).querySelector("tr"),o=0,s=0;for(n.length=0;null!=i;){const e=i.nodeName;if("TD"===e||"TH"===e){const e={elem:i,hasBackgroundColor:""!==i.style.backgroundColor,highlighted:!1,x:o,y:s};i._cell=e;let t=n[s];void 0===t&&(t=n[s]=[]),t[o]=e}else{const e=i.firstChild;if(null!=e){i=e;continue}}const t=i.nextSibling;if(null!=t){o++,i=t;continue}const r=i.parentNode;if(null!=r){const e=r.nextSibling;if(null==e)break;s++,o=0,i=e}}return r.columns=o+1,r.rows=s+1,r}function Xm(e,t,n){const r=new Set(n?n.getNodes():[]);Qm(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,sy(e,t)):(t.highlighted=!1,ly(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function Qm(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const r=n[e];if(r)for(let n=0;n<r.length;n++){const i=r[n];if(!i)continue;const o=Ds(i.elem);null!==o&&t(i,o,{x:n,y:e})}}}const ey=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?oy(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?oy(t.getCellNodeFromCordsOrThrow(o?0:e.table.columns-1,r+(o?1:-1),e.table),o):o?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==r?oy(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?oy(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function ty(e,t){let n,r;if(t.startColumn===e.minColumn)n="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n="maxColumn"}if(t.startRow===e.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r="maxRow"}return[n,r]}function ny([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function ry(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&om(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&om(250,n,String(s)),l}function iy(e,t){if(Mi(e)||Im(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function oy(e,t){t?e.selectStart():e.selectEnd()}function sy(e,t){const n=t.elem,r=e._config.theme;rm(Ds(n))||om(131),qa(n,r.tableCellSelected)}function ly(e,t){const n=t.elem;rm(Ds(n))||om(131);ja(n,e._config.theme.tableCellSelected)}function ay(e){const t=jl(e,rm);return rm(t)?t:null}function cy(e){const t=jl(e,wy);return wy(t)?t:null}function uy(e,t,n,r,i,o){if(("up"===n||"down"===n)&&function(e){const t=e.getRootElement();return!!t&&(t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls"))}(e))return!1;const s=eo();if(!iy(s,r)){if(Mi(s)){if("backward"===n){if(s.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(Ho(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(s.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!wy(n)&&(dy(t),t.shiftKey?s.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=s.focus.getNode();if(!s.isCollapsed()&&("up"===n&&!s.isBackward()||"down"===n&&s.isBackward())){let i=jl(e,(e=>wy(e)));if(rm(i)&&(i=jl(i,wy)),i!==r)return!1;if(!i)return!1;const o="down"===n?i.getNextSibling():i.getPreviousSibling();if(!o)return!1;let l=0;"up"===n&&Ho(o)&&(l=o.getChildrenSize());let a=o;if("up"===n&&Ho(o)){a=o.getLastChild()||o,l=Ei(a)?a.getTextContentSize():0}const c=s.clone();return c.focus.set(a.getKey(),l,Ei(a)?"text":"element"),Ks(c),dy(t),!0}if(Cl(e)){const e="up"===n?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(e&&null!==Um(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Nm(e),[o]=Nm(t),s=r.getCordsFromCellNode(n,i.table),l=r.getCordsFromCellNode(o,i.table),a=r.getDOMCellFromCordsOrThrow(s.x,s.y,i.table),c=r.getDOMCellFromCordsOrThrow(l.x,l.y,i.table);return i.$setAnchorCellForSelection(a),i.$setFocusCellForSelection(c,!0),!0}return!1}{let r=jl(e,(e=>Ho(e)&&!e.isInline()));if(rm(r)&&(r=jl(r,wy)),!r)return!1;const o="down"===n?r.getNextSibling():r.getPreviousSibling();if(wy(o)&&i.tableNodeKey===o.getKey()){const e=o.getFirstDescendant(),r=o.getLastDescendant();if(!e||!r)return!1;const[i]=Nm(e),[l]=Nm(r),a=s.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),dy(t),Ks(a),!0}}}}return"down"===n&&_y(e)&&o.setShouldCheckSelectionForTable(r.getKey()),!1}if(Mi(s)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=Ea(n.focus,i?"previous":"next");if(Ma(l))return!1;let a=l;for(const e of ya(l).iterNodeCarets("shadowRoot")){if(!ia(e)||!Ho(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!rm(c))return!1;const u=c,d=function(e){for(const t of ya(e).iterNodeCarets("root")){const{origin:n}=t;if(rm(n)){if(oa(t))return ga(n,e.direction)}else if(!cm(n))break}return null}(ca(u,a.direction)),h=jl(u,wy);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=Gm(g);if(!g||!p)return!1;const f=Cy(e,h);if(s.table=f,d)if("extend"===r){const t=Gm(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=Pa(d);Ta(n.anchor,e),Ta(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=pa(e);return oa(t)?Pa(t):e}(ca(h,l.direction));Ta(n.anchor,e),Ta(n.focus,e)}return dy(t),!0}(e,t,s,t.shiftKey?"extend":"move","backward"===n,r,i);if(s.isCollapsed()){const{anchor:l,focus:a}=s,c=jl(l.getNode(),rm),u=jl(a.getNode(),rm);if(!rm(c)||!c.is(u))return!1;const d=cy(c);if(d!==r&&null!=d){const r=Hm(d,e.getElementByKey(d.getKey()));if(null!=r)return i.table=Ym(d,r),uy(e,t,n,d,i,o)}const h=e.getElementByKey(c.__key),g=e.getElementByKey(l.key);if(null==g||null==h)return!1;let p;if("element"===l.type)p=g.getBoundingClientRect();else{const t=Nl(Km(e));if(null===t||0===t.rangeCount)return!1;p=t.getRangeAt(0).getBoundingClientRect()}const f="up"===n?c.getFirstChild():c.getLastChild();if(null==f)return!1;const m=e.getElementByKey(f.__key);if(null==m)return!1;const y=m.getBoundingClientRect();if("up"===n?y.top>p.top-p.height:p.bottom+p.height>y.bottom){dy(t);const e=r.getCordsFromCellNode(c,i.table);if(!t.shiftKey)return ey(i,r,e.x,e.y,n);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,i.table);i.$setAnchorCellForSelection(t),i.$setFocusCellForSelection(t,!0)}return!0}}}else if(Im(s)){const{anchor:o,focus:l}=s,a=jl(o.getNode(),rm),c=jl(l.getNode(),rm),[u]=s.getNodes();wy(u)||om(251);const d=Hm(u,e.getElementByKey(u.getKey()));if(!rm(a)||!rm(c)||!wy(u)||null==d)return!1;i.$updateTableTableSelection(s);const h=Ym(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),dy(t),t.shiftKey){const[e,t,o]=Em(r,a,c);return function(e,t,n,r,i){const o=Am(t,n,r),s=function(e,t){const{minColumn:n,maxColumn:r,minRow:i,maxRow:o}=t;let s=1,l=1,a=1,c=1;const u=e[i],d=e[o];for(let e=n;e<=r;e++)s=Math.max(s,u[e].cell.__rowSpan),c=Math.max(c,d[e].cell.__rowSpan);for(let t=i;t<=o;t++)l=Math.max(l,e[t][n].cell.__colSpan),a=Math.max(a,e[t][r].cell.__colSpan);return{bottomSpan:c,leftSpan:l,rightSpan:a,topSpan:s}}(t,o),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,d=function(e,t){const n=ty(e,t);return null===n&&om(249,t.cell.getKey()),n}(o,n),[h,g]=ny(d);let p=o[h],f=o[g];"forward"===i?p+="maxColumn"===h?1:a:"backward"===i?p-="minColumn"===h?1:u:"down"===i?f+="maxRow"===g?1:l:"up"===i&&(f-="minRow"===g?1:c);const m=t[f];if(void 0===m)return!1;const y=m[p];if(void 0===y)return!1;const[b,_]=function(e,t,n){const r=Am(e,t,n),i=ty(r,t);if(i)return[ry(e,r,i),ry(e,r,ny(i))];const o=ty(r,n);if(o)return[ry(e,r,ny(o)),ry(e,r,o)];const s=["minColumn","minRow"];return[ry(e,r,s),ry(e,r,ny(s))]}(t,n,y),x=py(e,b.cell),C=py(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(C,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function dy(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function hy(e,t,n){const r=es();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function gy(e,t,n){const r=n.getParent();if(!r)return;const i=Nl(Km(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Hm(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=jl(t.anchor.getNode(),(e=>rm(e)));if(!a)return;const c=jl(a,(e=>wy(e)));if(!wy(c)||!c.is(n))return;const[u,d]=Em(n,a,a),h=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:p,startColumn:f}=d,m=p===h.startRow&&f===h.startColumn,y=p===g.startRow&&f===g.startColumn;return m?"first":y?"last":void 0}function py(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function fy(e,t,n){return Um(e,Ds(t,n))}function my(e,t,n){const r=e.querySelector("colgroup");if(!r)return;const i=[];for(let e=0;e<t;e++){const t=document.createElement("col"),r=n&&n[e];r&&(t.style.width=`${r}px`),i.push(t)}r.replaceChildren(...i)}function yy(e,t,n){if(!t.theme.tableAlignment)return;const r=[],i=[];for(const e of["center","right"]){const o=t.theme.tableAlignment[e];o&&(e===n?i:r).push(o)}ja(e,...r),qa(e,...i)}const by=new WeakSet;function _y(e=Dl()){return by.has(e)}class xy extends zo{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new xy(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Sy,priority:1})}}static importJSON(e){return vy().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return"html"===n}getDOMSlot(e){const t=zm(e)?e:e.querySelector("table");return zm(t)||om(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const n=document.createElement("table");this.__style&&ii(n.style,this.__style);const r=document.createElement("colgroup");if(n.appendChild(r),function(e){e.__lexicalUnmanaged=!0}(r),qa(n,e.theme.table),this.updateTableElement(null,n,e),_y(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?qa(t,r):t.style.overflowX="auto",t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(qa(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(ja(e,n.theme.tableFrozenColumn),t.removeAttribute("data-lexical-frozen-column"))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(qa(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(ja(e,n.theme.tableFrozenRow),t.removeAttribute("data-lexical-frozen-row"))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:"")&&ii(t.style,this.__style,e?e.__style:""),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(qa(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(ja(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping);const r=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===r&&this.getColWidths()===i||my(t,this.getColumnCount(),this.getColWidths()),yy(t,n,this.getFormatType())}updateDOM(e,t,n){const r=Hm(this,t);return t===r===_y()||(Ol(i=t)&&"DIV"===i.nodeName&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}scaleDOMColWidths(e,t){const n=this.getColWidths();n&&my(Hm(this,e),this.getColumnCount(),n.map((e=>e*t)))}exportDOM(e){const t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!zm(n)&&Ol(n)&&(n=n.querySelector("table")),!zm(n))return null;yy(n,e._config,this.getFormatType());const[r]=Tm(this,null,null),i=new Map;for(const e of r)for(const t of e){const e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}const o=new Set;for(const e of n.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const t=e.getAttribute("data-temporary-table-cell-lexical-key");if(t){const n=i.get(t);if(e.removeAttribute("data-temporary-table-cell-lexical-key"),n){i.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}const s=n.querySelector(":scope > colgroup");if(s){const e=Array.from(n.querySelectorAll(":scope > colgroup > col")).filter(((e,t)=>o.has(t)));s.replaceChildren(...e)}const l=n.querySelectorAll(":scope > tr");if(l.length>0){const e=document.createElement("tbody");for(const t of l)e.appendChild(t);n.append(e)}return n},element:!zm(n)&&Ol(n)?n.querySelector("table"):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:r}=t;for(let t=0;t<n;t++){const n=r[t];if(null!=n)for(let r=0;r<n.length;r++){const i=n[r];if(null==i)continue;const{elem:o}=i,s=fy(this,o);if(null!==s&&e.is(s))return{x:r,y:t}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:r}=n,i=r[t];if(null==i)return null;const o=i[e<i.length?e:i.length-1];return null==o?null:o}getDOMCellFromCordsOrThrow(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(null==r)return null;const i=Ds(r.elem);return rm(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){const r=this.getCellNodeFromCords(e,t,n);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return Boolean(this.getLatest().__rowStriping)}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach((e=>{rm(e)&&(t+=e.getColSpan())})),t}}function Cy(e,t){const n=e.getElementByKey(t.getKey());return null===n&&om(230),Ym(t,n)}function Sy(e){const t=vy();e.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),e.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),e.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const n=e.querySelector(":scope > colgroup");if(n){let e=[];for(const t of n.querySelectorAll(":scope > col")){let n=t.style.width||"";if(!Zf.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>xu(e,cm),node:t}}function vy(){return vl(new xy)}function wy(e){return e instanceof xy}function ky(e){cm(e.getParent())?e.isEmpty()&&e.append(es()):e.remove()}function Ey(e){wy(e.getParent())?bu(e,rm):e.remove()}function Ty(e){bu(e,cm);const[t]=Tm(e,null,null),n=t.reduce(((e,t)=>Math.max(e,t.length)),0),r=e.getChildren();for(let e=0;e<t.length;++e){const i=r[e];if(!i)continue;cm(i)||om(254,i.constructor.name,i.getType());const o=t[e].reduce(((e,t)=>t?1+e:e),0);if(o!==n)for(let e=o;e<n;++e){const e=nm();e.append(es()),i.append(e)}}const i=e.getColWidths(),o=e.getColumnCount();if(i&&i.length!==o){let t;if(o<i.length)t=i.slice(0,o);else if(i.length>0){const e=i[i.length-1];t=[...i,...Array(o-i.length).fill(e)]}e.setColWidths(t)}}function Ny(e){if(e.detail<3||!Fl(e.target))return!1;const t=Ds(e.target);if(null===t)return!1;const n=jl(t,(e=>Ho(e)&&!e.isInline()));return null!==n&&(!!rm(n.getParent())&&(n.select(0),!0))}function Ay(){const e=eo();if(!Mi(e))return!1;const t=cy(e.anchor.getNode());if(null===t)return!1;const n=zs();if(!n.is(t.getParent())||1!==n.getChildrenSize())return!1;const[r]=Tm(t,null,null);if(0===r.length||0===r[0].length)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const o=r[r.length-1],s=o[o.length-1];if(!s||!s.cell)return!1;return Ks(Rm(t,i.cell,s.cell)),!0}function Ly(e,t=!0){const n=new Dm,r=(r,i,o)=>{const s=Hm(r,o),l=function(e,t,n,r,i){const o=n.getRootElement(),s=Km(n);null!==o&&null!==s||om(246);const l=new Bm(n,e.getKey()),a=Hm(e,t);!function(e,t){null!==Zm(e)&&om(205),e[$m]=t}(a,l),l.listenersToRemove.add((()=>function(e,t){Zm(e)===t&&delete e[$m]}(a,l)));const c=e=>{e.detail>=3&&Fl(e.target)&&null!==Gm(e.target)&&e.preventDefault()};a.addEventListener("mousedown",c,l.listenerOptions),l.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));for(const[t,r]of Wm)l.listenersToRemove.add(n.registerCommand(t,(t=>uy(n,t,r,e,l,i)),3));l.listenersToRemove.add(n.registerCommand($n,(t=>{const n=eo();if(Im(n)){const r=Um(e,n.focus.getNode());if(null!==r)return dy(t),r.selectEnd(),!0}return!1}),3));const u=t=>()=>{const n=eo();if(!iy(n,e))return!1;if(Im(n))return l.$clearText(),!0;if(Mi(n)){if(!rm(Um(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),i=n.focus.getNode(),o=e.isParentOf(r),s=e.isParentOf(i);if(o&&!s||s&&!o)return l.$clearText(),!0;const a=jl(n.anchor.getNode(),(e=>Ho(e))),c=a&&jl(a,(e=>Ho(e)&&rm(e.getParent())));if(!Ho(c)||!Ho(a))return!1;if(t===kn&&null===c.getPreviousSibling())return!0}return!1};for(const e of Vm)l.listenersToRemove.add(n.registerCommand(e,u(e),3));const d=t=>{const n=eo();if(!Im(n)&&!Mi(n))return!1;const r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){const t=r?"anchor":"focus",i=r?"focus":"anchor",{key:o,offset:s,type:l}=n[i];return e[n[t].isBefore(n[i])?"selectPrevious":"selectNext"]()[i].set(o,s,l),!1}return!!iy(n,e)&&!!Im(n)&&(t&&(t.preventDefault(),t.stopPropagation()),l.$clearText(),!0)};for(const e of qm)l.listenersToRemove.add(n.registerCommand(e,d,3));return l.listenersToRemove.add(n.registerCommand(Yn,(e=>{const t=eo();if(t){if(!Im(t)&&!Mi(t))return!1;Gh(n,fu(e,ClipboardEvent)?e:null,Xh(t));const r=d(e);return Mi(t)?(t.removeText(),!0):r}return!1}),3)),l.listenersToRemove.add(n.registerCommand(En,(t=>{const n=eo();if(!iy(n,e))return!1;if(Im(n))return l.$formatCells(t),!0;if(Mi(n)){const e=jl(n.anchor.getNode(),(e=>rm(e)));if(!rm(e))return!1}return!1}),3)),l.listenersToRemove.add(n.registerCommand(qn,(t=>{const n=eo();if(!Im(n)||!iy(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!rm(r)||!rm(i))return!1;if(function(e,t){if(Im(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=Em(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;const[o,s,l]=Em(e,r,i),a=Math.max(s.startRow+s.cell.__rowSpan-1,l.startRow+l.cell.__rowSpan-1),c=Math.max(s.startColumn+s.cell.__colSpan-1,l.startColumn+l.cell.__colSpan-1),u=Math.min(s.startRow,l.startRow),d=Math.min(s.startColumn,l.startColumn),h=new Set;for(let e=u;e<=a;e++)for(let n=d;n<=c;n++){const r=o[e][n].cell;if(h.has(r))continue;h.add(r),r.setFormat(t);const i=r.getChildren();for(let e=0;e<i.length;e++){const n=i[e];Ho(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),3)),l.listenersToRemove.add(n.registerCommand(Cn,(t=>{const r=eo();if(!iy(r,e))return!1;if(Im(r))return l.$clearHighlight(),!1;if(Mi(r)){const i=jl(r.anchor.getNode(),(e=>rm(e)));if(!rm(i))return!1;if("string"==typeof t){const i=gy(n,r,e);if(i)return hy(i,e,[ki(t)]),!0}}return!1}),3)),r&&l.listenersToRemove.add(n.registerCommand(Hn,(t=>{const n=eo();if(!Mi(n)||!n.isCollapsed()||!iy(n,e))return!1;const r=ay(n.anchor.getNode());return!(null===r||!e.is(cy(r))||(dy(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",i=e[n]();if(Ho(i))return i.selectEnd();const o=jl(e,cm);null===o&&om(247);for(let e=o[n]();cm(e);e=e[n]()){const t=e[r]();if(Ho(t))return t.selectEnd()}const s=jl(o,wy);null===s&&om(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),3)),l.listenersToRemove.add(n.registerCommand(rr,(t=>e.isSelected()),3)),l.listenersToRemove.add(n.registerCommand(xn,(()=>{const t=eo();if(!Mi(t)||!t.isCollapsed()||!iy(t,e))return!1;const r=gy(n,t,e);return!!r&&(hy(r,e),!0)}),3)),l}(r,s,e,t,n);n.observers.set(i,[l,s])};return Za(function(e,t){const n=e.getRootElement(),r=e._window;if(!n||!r)return()=>{};const i=r=>{const i=r.target;if(0!==r.button||!Fl(i)||!n.contains(i))return;const o=function(e){const t=Gm(e);if(null===t)return null;let n=t.elem;for(;null!=n;){if("TABLE"===n.nodeName&&$m in n&&n[$m])return{cellElement:t,tableElement:n,tableObserver:n[$m]};n=n.parentNode}return null}(i);e.update((()=>{if(Im(eo())){for(const[e]of t.observers.values())e.$clearHighlight(!1);Ks(null),e.dispatchCommand(dn,void 0)}if(!o)return;const{tableObserver:n,tableElement:i,cellElement:s}=o;!function(e,t,n,r,i,o){const s=e._window;if(!s)return;i.pointerType=t.pointerType;const l=kl(i.tableNodeKey),a=to();if(hm&&t.shiftKey&&iy(a,l)&&(Mi(a)||Im(a))){const e=a.anchor.getNode(),r=Um(l,a.anchor.getNode());r?(i.$setAnchorCellForSelection(py(i,r)),i.$setFocusCellForSelection(n),dy(t)):(l.isBefore(e)?l.selectStart():l.selectEnd()).anchor.set(a.anchor.key,a.anchor.offset,a.anchor.type)}else"touch"!==t.pointerType&&i.$setAnchorCellForSelection(n);(t=>{if(i.isSelecting)return;i.isSelecting=!0,null!==t&&null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)}));const n=()=>{i.isSelecting=!1,s.removeEventListener("pointerup",n),s.removeEventListener("pointermove",l)},l=t=>{if(!(e=>!(1&~e.buttons))(t)&&i.isSelecting)return i.isSelecting=!1,s.removeEventListener("pointerup",n),void s.removeEventListener("pointermove",l);if(!Fl(t.target))return;let a=null;const c=!(hm||r.contains(t.target));if(c)a=Jm(r,t.target);else for(const e of document.elementsFromPoint(t.clientX,t.clientY))if(a=Jm(r,e),a)break;if(a){const t=a;null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)})),null!==i.focusCell&&a.elem===i.focusCell.elem||(o.setNextFocus({focusCell:a,override:c,tableKey:i.tableNodeKey}),e.dispatchCommand(dn,void 0))}};s.addEventListener("pointerup",n,i.listenerOptions),s.addEventListener("pointermove",l,i.listenerOptions)})(n)}(e,r,s,i,n,t)}))};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i)}}(e,n),e.registerCommand(dn,(()=>function(e,t){const n=eo(),r=to(),i=e.getAndClearNextFocus();if(null!==i){const{tableKey:t,focusCell:r}=i,o=e.observers.get(t);o||om(335,t);const[s]=o;if(Im(n)&&n.tableKey===s.tableNodeKey)return(r.x!==s.focusX||r.y!==s.focusY)&&(s.$setFocusCellForSelection(r),!0);if(null!==s.anchorCell&&null!==s.anchorCellNodeKey&&r.elem!==s.anchorCell.elem&&null!==s.tableSelection)return s.$setFocusCellForSelection(r,!0),!0}const o=e.getAndClearShouldCheckSelectionForTable();if(o&&Mi(r)&&Mi(n)&&n.isCollapsed()){const e=kl(o),t=n.anchor.getNode(),r=e.getFirstChild(),i=ay(t);if(null!==i&&cm(r)){const t=r.getFirstChild();if(rm(t)&&e.is(jl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}Im(n)&&function(e,t){const n=Km(e),r=to();if(!t.is(r))return;const i=kl(t.tableKey),o=Nl(n);if(o&&o.anchorNode&&o.focusNode){const n=Ds(o.focusNode),r=n&&!i.isParentOf(n),s=Ds(o.anchorNode),l=s&&i.isParentOf(s);if(r&&l&&o.rangeCount>0){const n=Xi(o,e);n&&(n.anchor.set(i.getKey(),t.isBackward()?i.getChildrenSize():0,"element"),o.removeAllRanges(),Ks(n))}}}(t,n),Mi(n)&&function(e,t){const n=to(),{anchor:r,focus:i}=e,o=r.getNode(),s=i.getNode(),l=ay(o),a=ay(s),c=l?cy(l):null,u=a?cy(a):null,d=e.isBackward(),h=l&&a&&c&&u&&c.is(u),g=u&&(!c||c.isParentOf(u)),p=c&&(!u||u.isParentOf(c));if(g){const t=e.clone(),[n]=Em(u,a,a),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.focus.set(d?r.getKey():i.getKey(),d?0:i.getChildrenSize(),"element"),Ks(t)}else if(p){const t=e.clone(),[n]=Em(c,l,l),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.anchor.set(d?i.getKey():r.getKey(),d?i.getChildrenSize():0,"element"),Ks(t)}else if(h){const r=t.observers.get(c.getKey());r||om(335,c.getKey());const[i]=r;if(l.is(a)||(i.$setAnchorCellForSelection(py(i,l)),i.$setFocusCellForSelection(py(i,a),!0)),"touch"===i.pointerType&&i.isSelecting&&e.isCollapsed()&&Mi(n)&&n.isCollapsed()){const e=ay(n.anchor.getNode());e&&!e.is(a)&&(i.$setAnchorCellForSelection(py(i,e)),i.$setFocusCellForSelection(py(i,a),!0),i.pointerType=null)}}}(n,e);const s=Array.from(e.observers.entries()).map((([e,[t]])=>({tableNode:kl(e),tableObserver:t})));for(const{tableNode:e,tableObserver:n}of s)jm(t,e,n);return!1}(n,e)),3),e.registerMutationListener(xy,(t=>{e.getEditorState().read((()=>{for(const[e,i]of t){const t=n.observers.get(e);if("created"===i||"updated"===i){const{tableNode:i,tableElement:o}=Mm(e);void 0===t?r(i,e,o):o!==t[1]&&(t[0].removeListeners(),n.observers.delete(e),r(i,e,o))}else"destroyed"===i&&void 0!==t&&(t[0].removeListeners(),n.observers.delete(e))}}),{editor:e})}),{skipInitialization:!1}),(()=>{for(const[,[e]]of n.observers)e.removeListeners()}))}function Oy(e,t){e.hasNodes([xy])||om(255);const{hasNestedTables:n=Mu(!1)}={};return Za(e.registerCommand(im,(e=>function({rows:e,columns:t,includeHeaders:n},r){const i=eo()||to();if(!i||!Mi(i))return!1;if(!r&&cy(i.anchor.getNode()))return!1;const o=function(e,t,n=!0){const r=vy();for(let i=0;i<e;i++){const e=am();for(let r=0;r<t;r++){let t=Yf;"object"==typeof n?(0===i&&n.rows&&(t|=Xf),0===r&&n.columns&&(t|=Jf)):n&&(0===i&&(t|=Xf),0===r&&(t|=Jf));const o=nm(t),s=es();s.append(ki()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);hu(o);const s=o.getFirstDescendant();return Ei(s)&&s.select(),!0}(e,n.peek())),0),e.registerCommand(hn,((t,r)=>e===r&&function(e,t){const{nodes:n,selection:r}=e;if(!n.some((e=>wy(e)||cu(e).some((e=>wy(e.node))))))return!1;const i=Im(r),o=Mi(r);return!!(o&&null!==jl(r.anchor.getNode(),(e=>rm(e)))&&null!==jl(r.focus.getNode(),(e=>rm(e)))||i)&&(1===n.length&&wy(n[0])?function(e,t){const n=t.getStartEndPoints(),r=Im(t);if(null===n)return!1;const[i,o]=n,[s,l,a]=Nm(i),c=jl(o.getNode(),(e=>rm(e)));if(!(rm(s)&&rm(c)&&cm(l)&&wy(a)))return!1;const[u,d,h]=Em(a,s,c),[g]=Tm(e,null,null),p=u.length,f=p>0?u[0].length:0;let m=d.startRow,y=d.startColumn,b=g.length,_=b>0?g[0].length:0;if(r){const e=Am(u,d,h),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;m=e.minRow,y=e.minColumn,b=Math.min(b,t),_=Math.min(_,n)}let x=!1;const C=Math.min(p,m+b)-1,S=Math.min(f,y+_)-1,v=new Set;for(let e=m;e<=C;e++)for(let t=y;t<=S;t++){const n=u[e][t];v.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(km(n.cell),v.add(n.cell.getKey()),x=!0)}let[w]=Tm(a.getWritable(),null,null);const k=b-p+m;for(let e=0;e<k;e++)bm(w[p-1][0].cell);const E=_-f+y;for(let e=0;e<E;e++)xm(w[0][f-1].cell,!0,!1);[w]=Tm(a.getWritable(),null,null);for(let e=m;e<m+b;e++)for(let t=y;t<y+_;t++){const n=e-m,r=t-y,i=g[n][r];if(i.startRow!==n||i.startColumn!==r)continue;const o=i.cell;if(1!==o.__rowSpan||1!==o.__colSpan){const n=[],r=Math.min(e+o.__rowSpan,m+b)-1,i=Math.min(t+o.__colSpan,y+_)-1;for(let o=e;o<=r;o++)for(let e=t;e<=i;e++){const t=w[o][e];n.push(t.cell)}vm(n),x=!0}const{cell:s}=w[e][t],l=o.getBackgroundColor();null!=l&&s.setBackgroundColor(l);const a=s.getChildren();o.getChildren().forEach((e=>{Ei(e)?(es().append(e),s.append(e)):s.append(e)})),a.forEach((e=>e.remove()))}if(r&&x){const[e]=Tm(a.getWritable(),null,null);e[d.startRow][d.startColumn].cell.selectEnd()}return!0}(n[0],r):!(o&&t.peek()&&!function(e){return!(!Im(e)||e.focus.getNode().is(e.anchor.getNode()))||!(!Mi(e)||!rm(e.anchor.getNode())||e.anchor.getNode().is(e.focus.getNode()))}(r)))}(t,n)),0),e.registerCommand(Xn,Ay,1),e.registerCommand(gn,Ny,0),e.registerNodeTransform(xy,Ty),e.registerNodeTransform(sm,Ey),e.registerNodeTransform(Qf,ky))}let Fy=null;function Iy(){return Fy&&Fy.isConnected||(Fy=document.createElement("div"),Fy.setAttribute("aria-hidden","true"),Fy.setAttribute("data-lexxy-style-resolver",""),Fy.style.cssText="contain: strict; position: fixed; top: 0; left: 0; visibility: hidden; pointer-events: none; width: 0; height: 0;",document.body.appendChild(Fy)),Fy}function Ry(e){return!!Mi(e)&&(e.isCollapsed()?Py(e.style):e.hasFormat("highlight"))}function Py(e){const t="string"==typeof e?gc(e):e;return!(!t.color&&!t["background-color"])}class My{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#Ke}applyCanonicalization(e){const t={...gc(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Ja(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#Ue(e)}get#Ke(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#Ue(e){let t=this.#We.indexOf(e);return-1===t&&(t=this.#We.indexOf(Dy(this._property,[e])[0])),-1===t?null:this._allowedValues[t]}get#We(){return this._computedAllowedValues||=Dy(this._property,this._allowedValues)}}function Dy(e,t){const n=document.createDocumentFragment(),r=t.map((t=>{const r=xc("span",{style:`display: none; ${e}: ${t};`});return n.appendChild(r),r}));Iy().appendChild(n);const i=r.map((t=>window.getComputedStyle(t).getPropertyValue(e)));return r.forEach((e=>e.remove())),i}const By=un(),$y=un(),zy={color:null,"background-color":null},Hy=pt("hasPastedStyles",{parse:e=>e||!1}),Ky=new WeakMap;class Uy extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[$g],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:Vy}},register(e,t){const n=function(e){return[new My("color",[...e.buttons.color,...e.permit.color]),new My("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return function(e){if(!e._htmlConversions)return;let t=e._htmlConversions.get("pre");t||(t=[],e._htmlConversions.set("pre",t));t.push(function(e){return function(t){const n=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t={};e.style?.color&&(t.color=e.style.color);e.style?.backgroundColor&&(t["background-color"]=e.style.backgroundColor);const n=Ja(t);return n.length>0?n:null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(t);return 0===n.length?null:{conversion:t=>{const r=Kp(t.getAttribute("data-language"));return qy(e).set(r.getKey(),n),{node:r}},priority:2}}}(e))}(e),Za(e.registerCommand(By,(t=>Jy(e,t)),2),e.registerCommand($y,(()=>Jy(e,zy)),2),e.registerNodeTransform(mi,tb),e.registerNodeTransform(Jp,nb),e.registerNodeTransform(mi,(e=>function(e,t=[]){if(function(e){return ft(e,Hy)}(e)){rb(e,!1);const n=function(e,t=[]){return t.reduce(((e,t)=>t.applyCanonicalization(e)),e)}(e.getStyle(),t);e.setStyle(n);const r=eo();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}(e,n))),e.registerMutationListener(Hp,(t=>{!function(e,t){const n=qy(e),r=[];for(const[e,i]of t)"destroyed"!==i&&n.has(e)&&r.push(e);if(0===r.length)return;e.update((()=>{for(const e of r){const t=n.get(e);if(n.delete(e),!t)continue;const r=Rs(e);r&&Up(r)&&jy(r,t)}}),{skipTransforms:!0,discrete:!0})}(e,t)}),{skipInitialization:!0}))}},this.editorConfig.get("highlight")]}}function Wy(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};gl(Zr)&&rb(e);const r=Ja(n);if(r.length)return e.setStyle(e.getStyle()+r)}function Vy(){return{conversion:hp("mark",Wy),priority:1}}function qy(e){let t=Ky.get(e);return t||(t=new Map,Ky.set(e,t)),t}function jy(e,t){if(0!==t.length)for(const{start:n,end:r,style:i}of t){const t=Zy(e);for(const{node:e,start:o,end:s}of t){if(!Qp(e))continue;const t=Math.max(n,o),l=Math.min(r,s);if(t>=l)continue;const a=t-o,c=l-o,u=s-o;if(0===a&&c===u)e.setStyle(i),Qy(e,!0);else{const t=e.getTextContent(),n=e.getHighlightType(),r=[];a>0&&r.push(Xp(t.slice(0,a),n));const o=Xp(t.slice(a,c),n);o.setStyle(i),Qy(o,!0),r.push(o),c<u&&r.push(Xp(t.slice(c),n));for(const t of r)e.insertBefore(t);e.remove()}}}}function Zy(e){const t=[];let n=0;for(const r of e.getChildren())if(Qp(r)||Ei(r)){const e=r.getTextContent();t.push({node:r,start:n,end:n+e.length}),n+=e.length}else n+=1;return t}function Gy(e){const t=[],n=Zy(e);for(const{node:e,start:r,end:i}of n){const n=e.getStyle();n&&Py(n)&&t.push({start:r,end:i,style:n})}return t}function Jy(e,t){const n=eo();if(!Mi(n))return;const r={};for(const e in t){const i=hc(n,e);r[e]=eb(i,t[e])}!function(e){const t=e.getNodes();return t.some((e=>Qp(e)||Ei(e)?Up(e.getParent()):Up(e)))}(n)?function(e,t){if(Mi(e)&&e.isCollapsed()){tc(e,t);const n=e.anchor.getNode();Ho(n)&&n.isEmpty()&&tc(n,t)}nc((e=>{tc(e,t)}));const n=e.getNodes();if(n.length>0){const e=new Set;for(const r of n){if(!Ho(r)||!r.canBeEmpty()||0!==r.getChildrenSize())continue;const n=r.getKey();e.has(n)||(e.add(n),tc(r,t))}}}(n,r):function(e,t,n){const r=t.getNodes().filter((e=>(Qp(e)||Ei(e))&&Up(e.getParent()))).map((e=>({key:e.getKey(),startOffset:Yy(e,t)[0],endOffset:Yy(e,t)[1],textSize:e.getTextContentSize()})));e.update((()=>{const t=new Set;for(const{key:e,startOffset:i,endOffset:o,textSize:s}of r){const r=Rs(e);if(!r)continue;const l=r.getParent();if(Up(l)&&i!==o)if(t.add(l),0===i&&o===s)Xy(r,n);else{Xy(r.splitText(i,o)[0===i?0:1],n)}}for(const n of t){const t=Gy(n);t.length>0&&qy(e).set(n.getKey(),t)}}),{skipTransforms:!0,discrete:!0})}(e,n,r)}function Yy(e,t){const n=e.getKey(),r=n===t.anchor.key,i=n===t.focus.key;let o=0,s=e.getTextContentSize();return!1===t.isBackward()?(r&&(o=t.anchor.offset),i&&(s=t.focus.offset)):(i&&(o=t.focus.offset),r&&(s=t.anchor.offset)),[o,s]}function Xy(e,t){const n={...gc(e.getStyle())};for(const[e,r]of Object.entries(t))null===r?delete n[e]:n[e]=r;const r=Ja(n);e.setStyle(r);const i=Py(r);i!==e.hasFormat("highlight")&&Qy(e,i)}function Qy(e,t){const n=e.getWritable();t?n.__format|=128:n.__format&=-129}function eb(e,t){return e===t?null:t}function tb(e){Py(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function nb(e){if(!Up(e.getParent()))return;const t=Py(e.getStyle());t!==e.hasFormat("highlight")&&Qy(e,t)}function rb(e,t=!0){mt(e,Hy,t)}const ib=["bold","italic","strikethrough","underline","link","unlink","toggleHighlight","removeHighlight","setFormatHeadingLarge","setFormatHeadingMedium","setFormatHeadingSmall","setFormatParagraph","clearFormatting","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","setCodeLanguage","insertHorizontalDivider","uploadImage","uploadFile","insertTable","undo","redo"];class ob{#Ve=null;#e=new bc;static configureFor(e){return new ob(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.#qe(),this.#je(),this.#Ze()}dispatchBold(){this.editor.dispatchCommand(En,"bold")}dispatchItalic(){this.editor.dispatchCommand(En,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(En,"strikethrough")}dispatchUnderline(){this.editor.dispatchCommand(En,"underline")}dispatchToggleHighlight(e){this.editor.dispatchCommand(By,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand($y)}dispatchLink(e){this.editor.update((()=>{const t=eo();if(!Mi(t))return;const n=t.anchor.getNode();if(t.isCollapsed()&&!uu(n,hd)){const n=yd(e),r=ki(e);n.append(r),t.insertNodes([n])}else xd(e)}))}dispatchUnlink(){this.editor.update((()=>{this.editorElement.adapter.unlinkFrozenNode?.()||xd(null)}))}dispatchInsertUnorderedList(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===ap(t)?this.contents.applyParagraphFormat():this.contents.applyUnorderedListFormat()}dispatchInsertOrderedList(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===ap(t)?this.contents.applyParagraphFormat():this.contents.applyOrderedListFormat()}dispatchInsertQuoteBlock(){this.contents.toggleBlockquote()}dispatchInsertCodeBlock(){this.selection.hasSelectedWordsInSingleLine?this.#Ge():this.contents.toggleCodeBlock()}#Ge(){const e=eo();if(Mi(e)){if(!e.isCollapsed()){const t=e.getNodes().filter(Ei);!t.every((e=>e.hasFormat("code")))&&this.#Je(e,t)}this.editor.dispatchCommand(En,"code")}}#Je(e,t){const n=e.isBackward(),r=n?e.focus:e.anchor,i=n?e.anchor:e.focus;for(let e=0;e<t.length;e++){const n=t[e];if(0===n.getFormat())continue;const o=0===e,s=e===t.length-1,l=o&&"text"===r.type?r.offset:0,a=s&&"text"===i.type?i.offset:n.getTextContentSize();if(0===l&&a===n.getTextContentSize())n.setFormat(0);else{const e=n.splitText(l,a),t=0===l?e[0]:e[1];t.setFormat(0),o&&"text"===r.type&&r.set(t.getKey(),0,"text"),s&&"text"===i.type&&i.set(t.getKey(),a-l,"text")}}}dispatchSetCodeLanguage(e){this.editor.update((()=>{if(!this.selection.isInsideCodeBlock)return;const t=this.selection.nearestNodeOfType(Hp);t&&t.setLanguage(e)}))}dispatchInsertHorizontalDivider(){hu(new Kf)}dispatchSetFormatHeadingLarge(){this.contents.applyHeadingFormat("h2")}dispatchSetFormatHeadingMedium(){this.contents.applyHeadingFormat("h3")}dispatchSetFormatHeadingSmall(){this.contents.applyHeadingFormat("h4")}dispatchSetFormatParagraph(){this.contents.applyParagraphFormat()}dispatchClearFormatting(){this.contents.clearFormatting()}dispatchUploadImage(){this.#Ye("image/*,video/*")}dispatchUploadFile(){this.#Ye()}#Ye(e=null){const t={type:"file",multiple:!0,style:"display: none;",onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}};e&&(t.accept=e);const n=xc("input",t);this.editorElement.appendChild(n),n.click(),setTimeout((()=>n.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(im,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(Tn,void 0)}dispatchRedo(){this.editor.dispatchCommand(Nn,void 0)}dispose(){this.#e.dispose()}#qe(){for(const t of ib){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#Xe(t,0,this[n].bind(this))}var e}#Xe(e,t,n){this.#e.track(this.editor.registerCommand(e,n,t))}#je(){this.#Xe(Ln,2,this.#Qe.bind(this)),this.#Xe(Hn,2,this.#et.bind(this)),this.#Xe(_n,3,this.#tt.bind(this)),this.#Xe(xn,3,this.#tt.bind(this))}#tt(){return function(e=eo()){!!vp(e)&&At(e)}(),!1}#Qe(e){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;if(this.selection.isInsideCodeBlock||!t.hasFormat("code"))return!1;const n=t.anchor.getNode();return!(!Ei(n)||t.anchor.offset!==n.getTextContentSize())&&(null===n.getNextSibling()&&(e.preventDefault(),t.toggleFormat("code"),!0))}#Ze(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.#e.track(this.editor.registerRootListener((e=>{if(e){const t=[yc(e,"dragover",this.#nt.bind(this)),yc(e,"drop",this.#rt.bind(this)),yc(e,"dragenter",this.#it.bind(this)),yc(e,"dragleave",this.#ot.bind(this))];return()=>t.forEach((e=>e()))}}))))}#it(e){this.#st(e)||(this.dragCounter++,1===this.dragCounter&&(this.#lt(),this.editor.getRootElement().classList.add("lexxy-editor--drag-over")))}#ot(e){this.#st(e)||(this.dragCounter--,0===this.dragCounter&&(this.#Ve=null,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")))}#nt(e){this.#st(e)||e.preventDefault()}#rt(e){if(this.#st(e))return;e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);n.length&&(this.#at(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#lt(){this.editor.getEditorState().read((()=>{this.#Ve=eo()?.clone()}))}#at(){this.#Ve&&(this.editor.update((()=>{Ks(this.#Ve)})),this.#Ve=null)}#st(e){return e.dataTransfer?.types.some((e=>e.startsWith("application/x-lexxy-")))}#et(e){return this.selection.isInsideList?this.#ct(e):!!this.selection.isInsideCodeBlock&&this.#ut()}#ct(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Wn:Un;return this.editor.dispatchCommand(t)}#ut(){const e=eo();return Mi(e)&&e.isCollapsed()}}class sb{#e=new bc;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#dt(),this.#ht(),this.#gt(),this.#pt()}get hasNodeSelection(){return this.editor.getEditorState().read((()=>{const e=eo();return null!==e&&Bi(e)}))}get cursorPosition(){let e=null;return this.editor.getEditorState().read((()=>{const t=this.#ft();if(!t)return;const n=this.#mt(t);this.#yt(n)||(e=this.#bt(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=zs(),t=e.getLastDescendant();t&&Ei(t)?t.selectEnd():e.selectEnd()}))}selectedNodeWithOffset(){const e=eo();if(!e)return{node:null,offset:0};if(Mi(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(Bi(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}getFormat(){const e=eo();if(!Mi(e))return{};const t=e.anchor.getNode();if(!t.getParent())return{};const n=t.getTopLevelElementOrThrow(),r=ap(t),i=this.#_t(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isUnderline:e.hasFormat("underline"),isHighlight:Ry(e),isInLink:null!==uu(t,hd),isInQuote:Ng(n),isInHeading:null!==i,isInCode:this.#xt(e,t),headingTag:i?.getTag()??null,isInList:null!==r,listType:r,isInTable:null!==gm(t)}}nearestNodeOfType(e){const t=eo()?.anchor?.getNode();return uu(t,e)}get hasSelectedWordsInSingleLine(){const e=eo();if(!Mi(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;const r=t.getTopLevelElement();if(!r)return!1;const i=Ho(t)?t:t.getParent();if(i!==(Ho(n)?n:n.getParent())&&i!==r)return!1;const o=e.getNodes();for(const e of o)if(ai(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(Bd)}get isInsideBlockQuote(){return this.nearestNodeOfType(Eg)}get isIndentedList(){const e=this.nearestNodeOfType(Ud);return e&&kd(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(Hp)}get isTableCellSelected(){const e=eo(),{anchor:t,focus:n}=e;return!(!Mi(e)||t.key!==n.key)&&null!==this.nearestNodeOfType(Qf)}get isOnPreviewableImage(){return null!=this.previewableImageNode}get previewableImageNode(){const e=eo()?.getNodes().at(0);return Ap(e)&&e.isPreviewableImage?e:null}get isAtNodeStart(){const{anchorNode:e,offset:t}=this.#Ct();return e&&0===t}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ct();return e?Ei(e)?this.#St(e,t):Ho(e)?this.#vt(e,t):this.#wt(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ct();if(!e)return null;if(Ei(e)){if(t===e.getTextContentSize())return this.#kt(e);if(this.#Et(e)){const t=e.getTopLevelElement();return t?t.getNextSibling():null}return null}return Ho(e)?this.#vt(e,t):this.#wt(e)}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ct();return e?Ei(e)?this.#Tt(e,t):Ho(e)?this.#Nt(e,t):this.#At(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ct();if(!e)return null;if(Ei(e)){if(0===t)return this.#Lt(e);if(this.#Ot(e)){const t=e.getTopLevelElement();return t?t.getPreviousSibling():null}return null}return Ho(e)?this.#Nt(e,t):this.#At(e)}dispose(){this.editorElement=null,this.editorContentElement=null,this.editor=null,this.previouslySelectedKeys=null,this.#e.dispose()}#xt(e,t){return null!==uu(t,Hp)||!!e.hasFormat("code")&&(Ei(t)&&t.hasFormat("code"))}#pt(){this.#e.track(this.editor.registerUpdateListener((({editorState:e,tags:t})=>{if(t.has("history-merge")||t.has("skip-dom-selection"))return;let n=!1;e.read((()=>{const e=eo();if(!Mi(e)||!e.isCollapsed())return;if(!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#xt(e,t)||(n=!0)})),n&&setTimeout((()=>{this.editor.update((()=>{const e=eo();if(!Mi(e)||!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#xt(e,t)||e.toggleFormat("code")}))}),0)})))}get#Ft(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;const e=eo();if(e&&Bi(e))for(const t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#ht(){this.#e.track(this.editor.registerCommand(Fn,_c(this.#It.bind(this)),1),this.editor.registerCommand(Ln,_c(this.#Rt.bind(this)),1),this.editor.registerCommand(Rn,_c(this.#Pt.bind(this)),1),this.editor.registerCommand(Pn,_c(this.#Mt.bind(this)),1),this.editor.registerCommand(bn,this.#Dt.bind(this),1),this.editor.registerCommand(dn,(()=>{this.#Bt()}),1))}#dt(){this.#e.track(this.editor.registerCommand(gn,(({target:e})=>{if(!Fl(e))return!1;const t=Ds(e);return Wo(t)&&this.#$t(t)}),1)),this.#e.track(this.editor.registerRootListener((e=>{if(e)return yc(e,"lexxy:internal:move-to-next-line",(()=>this.#zt()))})))}#gt(){this.#e.track(this.editor.registerRootListener((e=>{if(e){const t=e=>this.#Ht(e);return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)}})))}#Ht(e){if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}#Bt(){this.#Kt(),this.#Ut(),this.previouslySelectedKeys=this.#Ft,this.currentlySelectedKeys=null}#Kt(){for(const e of this.previouslySelectedKeys)if(!this.#Ft.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Ut(){for(const e of this.#Ft)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}#It(e){return e.shiftKey?this.#Wt((e=>(this.#Vt(e,"forward").modify("extend",!0,"character"),!0))):this.#Wt((e=>e.selectPrevious()))||this.#$t(this.nodeBeforeCursor)}#Rt(e){return e.shiftKey?this.#Wt((e=>(this.#Vt(e,"forward").modify("extend",!1,"character"),!0))):this.#Wt((e=>e.selectNext(0,0)))||this.#$t(this.nodeAfterCursor)}#Pt(){return this.#Wt((e=>e.getTopLevelElement().selectPrevious()))||this.#$t(this.topLevelNodeBeforeCursor)}#Mt(){return this.#Wt((e=>e.getTopLevelElement().selectNext(0,0)))||this.#$t(this.topLevelNodeAfterCursor)}#Wt(e){if(this.hasNodeSelection)return e(eo().getNodes()[0])}#Vt(e,t="forward"){if(Wo(e)){const[n,r]="forward"===t?[0,1]:[1,0],i=e.getIndexWithinParent();return e.getParent().select(i+n,i+r)}}async#zt(){this.editor.update((()=>{const e=this.#qt();e&&this.#jt(e)}))}#qt(){const e=eo();return e?Bi(e)?this.#Zt(e):Mi(e)?this.#Gt(e):null:null}#Zt(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Gt(e){return e.anchor.getNode().getTopLevelElement()}#_t(e){const t=e.getTopLevelElementOrThrow();let n=Rg(t)?t:null;if(!n){let t=e.getParent();for(;t;){if(Rg(t)){n=t;break}t=t.getParent()}}return n}#jt(e){const t=e.getNextSibling();t?t.selectStart():this.#Jt()}#Jt(){const e=zs(),t=es();e.append(t),t.selectStart()}#$t(e){if(Wo(e)){pl(jr);const t=function(...e){const t=Yi();return e.forEach((e=>t.add(e.getKey()))),t}(e);return Ks(t),t}return!1}#Dt(e){if(e&&this.#Yt())return!0;const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;if(!Wo(t))return!1;if(this.#Xt(t))return!0;this.#Qt();const n=this.#$t(t);return Boolean(n)}#Yt(){const e=eo();if(!Mi(e)||!e.isCollapsed())return!1;const t=uu(e.anchor.getNode(),Bd);if(!t)return!1;if(!function(e){const t=e.getChildren();for(const e of t){if(Wo(e))return!1;if(!ai(e))if(Ei(e)){if(""!==e.getTextContent().trim())return!1}else if(Ho(e)&&""!==e.getTextContent().trim())return!1}return!0}(t))return!1;const n=t.getNextSibling();if(!n)return!1;const r=t.getPreviousSibling(),i=uu(t,Ud);if(!i)return!1;if(r)r.selectEnd(),t.remove();else if(Ng(i.getParent()))n.selectStart(),t.remove();else{const e=es();i.insertBefore(e),t.remove(),e.selectStart()}return!0}#Xt(e){const t=eo()?.anchor?.getNode(),n=t&&uu(t,Bd);if(!n)return!1;if(n.isParentOf(e))return!1;const r=uu(n,Ud);if(!r)return!1;const i=es();return n.getChildren().forEach((e=>i.append(e))),1===r.getChildrenSize()?(r.insertBefore(i),r.remove()):(r.insertBefore(i),n.remove()),i.selectStart(),!0}#Qt(e=eo()?.anchor){const t=e?.getNode();Ho(t)&&t?.isEmpty()&&t.remove()}#ft(){const e=eo();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#mt(e){let t=e.getBoundingClientRect();if(this.#yt(t)){const n=this.#en(e);t=n.getBoundingClientRect(),this.#tn(n),n.remove()}return t}#yt(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#en(e){const t=this.#nn();return e.insertNode(t),t}#nn(){const e=document.createElement("span");return e.textContent="",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",mc()),e}#tn(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#bt(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#rn(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#rn(e){const t=window.getSelection().anchorNode,n=this.#in(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#in(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Ct(){const e=eo();if(!Mi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#St(e,t){return t===e.getTextContentSize()?this.#kt(e):null}#kt(e){const t=e.getNextSibling();if(Wo(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getNextSibling():null}#vt(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#wt(e)}#Tt(e,t){return 0===t?this.#Lt(e):null}#Lt(e){const t=e.getPreviousSibling();if(Wo(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getPreviousSibling():null}#Nt(e,t){return t>0?e.getChildAtIndex(t-1):this.#At(e)}#wt(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#At(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}#Ot(e){return this.#on(e,"first")}#Et(e){return this.#on(e,"last")}#on(e,t){const n=e.getTopLevelElement();if(!n)return!1;const r=this.editor.getElementByKey(n.getKey());if(!r)return!1;const i=window.getSelection();if(!i?.rangeCount)return!1;const o=this.#mt(i.getRangeAt(0));if(!o||this.#yt(o))return!1;const s=this.#sn(r,t);if(!s||this.#yt(s))return!1;const l=s.height>0?.5*s.height:5;return Math.abs(o.top-s.top)<l}#sn(e,t){const n=document.createTreeWalker(e,4);let r;if("first"===t)r=n.nextNode();else for(;n.nextNode();)r=n.currentNode;if(!r||0===r.length)return null;const i=document.createRange();return"first"===t?(i.setStart(r,0),i.setEnd(r,1)):(i.setStart(r,r.length-1),i.setEnd(r,r.length)),i.getBoundingClientRect()}}class lb{#he;#ln;constructor(e){this.#he=e,this.#ln=new Kg(qg.presets.get("default"),qg.presets.get(e.preset),this.#an)}get(e){return this.#ln.get(e)}get#an(){const e={};for(const t of this.#cn){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#he.hasAttribute(n)&&(e[t]=this.#un(n))}return e}get#cn(){return Object.keys(qg.presets.get("default"))}#un(e){const t=this.#he.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class ab extends zo{$config(){return this.config("image_gallery",{extends:zo})}static transform(){return e=>{e.unwrapEmptyNode()||e.replaceWithSingularChild()||e.splitAroundInvalidChild()}}static importDOM(){return{div:e=>this.#dn(e)?{conversion:()=>({node:cb()}),priority:2}:null}}static canCollapseWith(e){return ub(e)||this.isValidChild(e)}static isValidChild(e){return Ap(e)&&e.isPreviewableImage}static#dn(e){const t=e.querySelectorAll(`:scope > :is(${this.#hn.join()})`);return""===e.textContent.trim()&&t.length>0&&e.children.length===t.length}static get#hn(){return Object.keys(Tp.importDOM())}createDOM(){const e=document.createElement("div");return e.className=this.#gn,e}updateDOM(e,t){return t.className=this.#gn,!1}canBeEmpty(){return!0}collapseAtStart(e){return!0}insertNewAfter(e,t){if(e.anchor.getNode().is(this)&&e.anchor.offset==this.getChildrenSize()-1){const e=es();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}const n=cb();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(Ap)}exportDOM(){const e=document.createElement("div");return e.className=this.#gn,{element:e}}collapseWith(e,t){return!!ab.canCollapseWith(e)&&(t?yu(this,e):this.append(e),bu(this,ab.isValidChild),!0)}unwrapEmptyNode(){if(this.isEmpty()){const e=es();return this.replace(e)}}replaceWithSingularChild(){if(this.#pn){const e=this.getFirstChild();return this.replace(lp(e))}}splitAroundInvalidChild(){for(const e of Cu(this)){if(ab.isValidChild(e))continue;const t=lp(e),[n,r]=this.splitAtIndex(t.getIndexWithinParent());n.insertAfter(t),t.selectEnd(),r.isEmpty()&&r.remove();break}}splitAtIndex(e){return Al(this,e)}get#pn(){return 1===this.getChildrenSize()}get#gn(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}}function cb(){return new ab}function ub(e){return e instanceof ab}function db(e){if(!ab.canCollapseWith(e))return null;return uu(e,ab)??pu(e,cb)}class hb{#fn;static for(e,t,n={}){return new(gb.handle(e,t)?gb:hb)(e,t,n)}constructor(e,t,n={}){this.#fn=t,this.options=n,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#fn)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map((e=>this.#mn(e)))}#mn(e){return this.options.pending?this.contents.$createPendingUploadNode(e):this.contents.$createUploadNode(e)}$insertUploadNodes(){this.contents.insertAtCursor(...this.nodes)}}class gb extends hb{#yn;static handle(e,t){return this.isMultipleImageUpload(t)||this.gallerySelection(e.selection)}static isMultipleImageUpload(e){let t=0;for(const n of e)if(Sc(n.type)&&t++,t>1)return!0;return!1}static gallerySelection(e){return e.isOnPreviewableImage||this.selectionIsAfterGalleryEdge(e)}static selectionIsAfterGalleryEdge(e){return e.isAtNodeStart&&ab.canCollapseWith(e.nodeBeforeCursor)}$insertUploadNodes(){this.#bn(),this.#_n(),this.#xn()}#bn(){this.selection.isOnPreviewableImage?this.#yn=db(this.selection.previewableImageNode):this.#Cn?this.#yn=db(this.selection.nodeBeforeCursor):(this.#yn=cb(),this.contents.insertAtCursor(this.#yn))}get#Cn(){return this.constructor.selectionIsAfterGalleryEdge(this.selection)}get#Sn(){const{node:e}=this.selection.selectedNodeWithOffset();return e}get#vn(){if(this.#Cn)return this.#yn.getChildrenSize();const e=eo()?.anchor,t=e?.getNode().is(this.#yn);if(t)return e.offset;const n=this.#Sn,r=this.#yn.isParentOf(n)&&n.getIndexWithinParent();return!1!==r?r+1:0}get#wn(){return this.nodes.filter((e=>ab.isValidChild(e)))}get#kn(){return this.nodes.filter((e=>!ab.isValidChild(e)))}#_n(){this.#yn.splice(this.#vn,0,this.#wn)}#xn(){let e=this.#yn;for(const t of this.#kn)e.insertAfter(t),e=t}}class pb extends Tp{static getType(){return"action_text_attachment_upload"}static clone(e){return new pb({...e},e.__key)}static importJSON(e){return new pb({...e})}static importDOM(){return null}constructor(e,t){const{file:n,uploadUrl:r,blobUrlTemplate:i,progress:o,width:s,height:l,uploadError:a,fileName:c,contentType:u}=e;super({...e,contentType:n?.type??u},t),this.file=n??null,this.fileName=n?.name??c,this.uploadUrl=r,this.blobUrlTemplate=i,this.progress=o??null,this.width=s,this.height=l,this.uploadError=a}createDOM(){if(this.uploadError)return this.createDOMForError();this.#En();const e=this.isPreviewableAttachment&&null!=this.uploadUrl,t=this.createAttachmentFigure(e);if(e){const e=t.appendChild(this.#ve());(async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))})(this.file,e).then((e=>this.#Tn(e)))}else t.appendChild(this.#ke());return t.appendChild(this.#Nn()),t.appendChild(this.#An()),t}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;if(e.progress!==this.progress){t.querySelector("progress").value=this.progress??0}return!1}exportDOM(){return{element:null}}exportJSON(){return{...super.exportJSON(),type:"action_text_attachment_upload",version:1,fileName:this.fileName,contentType:this.contentType,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,progress:this.progress,width:this.width,height:this.height,uploadError:this.uploadError}}get#Ln(){return null!==this.progress}#ve(){return xc("img")}#ke(){return xc("span",{className:"attachment__icon",textContent:this.#On()})}#On(){return(this.fileName||"").split(".").pop().toLowerCase()}#Nn(){const e=xc("figcaption",{className:"attachment__caption"}),t=xc("span",{className:"attachment__name",textContent:this.caption||this.fileName||""}),n=xc("span",{className:"attachment__size",textContent:Gg(this.file?.size)});return e.appendChild(t),e.appendChild(n),e}#An(){return xc("progress",{value:this.progress??0,max:100})}#Tn({width:e,height:t}){this.#Fn||this.patchAndRewriteHistory({width:e,height:t})}get#Fn(){return Boolean(this.width&&this.height)}async#En(){if(this.#Ln)return;if(!this.uploadUrl)return;this.#In();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#Rn(),this.#Pn("lexxy:upload-start",{file:this.file}),t.create(((e,t)=>{this.#Mn(),e?(this.#Pn("lexxy:upload-end",{file:this.file,error:e}),this.#Dn(e)):(this.#Pn("lexxy:upload-end",{file:this.file,error:null}),this.editor.update((()=>{this.$showUploadedAttachment(t)})))}))}#Rn(){const e=qg.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0),this.#Bn(t);t.upload.addEventListener("progress",(e=>this.#$n(e,t)))}}}#Mn(){this.#he.uploadRequests.forget(this.getKey())}#Bn(e){this.#he.uploadRequests.track(this.getKey(),e)}get#he(){return this.editor.getRootElement()?.closest("lexxy-editor")}#In(){this.#zn(1)}#$n(e,t){const n=Math.round(e.loaded/e.total*100);try{this.#zn(n),this.#Pn("lexxy:upload-progress",{file:this.file,progress:n})}catch{t.abort()}}#zn(e){this.patchAndRewriteHistory({progress:e})}#Dn(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.patchAndRewriteHistory({uploadError:!0})}$showUploadedAttachment(e){const t=this.isPreviewableImage&&this.file?URL.createObjectURL(this.file):null,n=this.#Hn(e,t);return this.replaceAndRewriteHistory(n),n.getKey()}#Hn(e,t){return new fb(this,e,t).toAttachmentNode()}#Pn(e,t){const n=this.editor.getElementByKey(this.getKey());n&&vc(n,e,t)}}class fb{constructor(e,t,n){this.uploadNode=e,this.blob=t,this.previewSrc=n}toAttachmentNode(){return new Tp({...this.uploadNode,...this.#Kn,src:this.#Un,previewSrc:this.previewSrc,pendingPreview:this.blob.previewable&&!this.uploadNode.isPreviewableImage})}get#Kn(){const{blob:e}=this;return{sgid:e.attachable_sgid,altText:e.filename,contentType:e.content_type,fileName:e.filename,fileSize:e.byte_size,previewable:e.previewable,previewStatusUrl:e.preview_status_url}}get#Un(){return this.blob.previewable?this.blob.url:this.#Wn}get#Wn(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}function mb(...e){return new pb(...e)}class yb{constructor(e){this.selection=e}}const bb=[class extends yb{static handles(e){return uu(e.anchor?.getNode(),Hp)}insertNodes(e){this.selection.isCollapsed()||this.selection.removeText(),rc(this.selection);const t=this.selection.focus.getNode(),n=uu(t,Hp),r=$a(n,(t.is(n)?0:t.getIndexWithinParent())+1,"previous"),i=new Set(e.filter((e=>e.isAttached()))),o=[];for(const t of e){if(i.has(t)){if(!t.isAttached())continue}else if(!this.#Vn(t)){o.push(t);continue}r.getNodeAtCaret()&&Ho(t)&&r.insert(li()),r.insert(this.#qn(t))}const s=this.#jn(n,o)??r.getNodeAtCaret();s?.selectEnd()}#Vn(e){return Ei(e)||ai(e)}#jn(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return t.at(-1)}#qn(e){return ai(e)?e:(e.remove(),ki(e.getTextContent()))}},class extends yb{static handles(e){return sp(e?.anchor?.getNode())}insertNodes(e){const t=this.selection.anchor.getNode(),n=es();t.append(n),n.selectStart().insertNodes(e)}},class extends yb{static handles(e){return Bi(e)&&e.getNodes().length>0}insertNodes(e){let t=this.selection.getNodes().at(-1);for(const n of e){const e=this.#Zn(t)?lp(n):n;t=t.insertAfter(e)}}#Zn(e){return e.is(e.getTopLevelElement())}},class extends yb{static handles(e){return Mi(e)&&uu(e.anchor.getNode(),Bd)}insertNodes(e){e.some((e=>this.#Gn(e)))?this.#Jn(e):this.selection.insertNodes(e)}#Jn(e){this.selection.isCollapsed()||this.selection.removeText();const t=this.selection.anchor.getNode(),n=this.#Yn(t),r=this.#Xn(t,n),i=fp(r)?r.getPreviousSibling():r,o=i?i.getIndexWithinParent()+1:0,[s,l]=Al(n,o);fp(r)&&r.remove();let a=s??l;for(const t of e)a.insertAfter(t),a=t;this.#Qn(s),this.#Qn(l),e.at(-1).selectNext()}#Yn(e){return[e,...e.getParents()].reverse().find(Gd)}#Xn(e,t){return[e,...e.getParents()].find((e=>Kd(e)&&e.getParent()?.is(t)))}#Qn(e){Gd(e)&&e.isEmpty()&&e.remove()}#Gn(e){return Wo(e)&&!e.isInline()}},class extends yb{static handles(e){return vp(e)}insertNodes(e){At(this.selection),this.selection.insertNodes(e)}}];yb.for=e=>{const t=bb.find((t=>t.handles(e)));return t?new t(e):e};class _b{constructor(e){this.doc=e}format(){return this.#er(),this.#tr(),this.#nr(),this.#rr(),this.doc}#er(){for(const e of this.doc.querySelectorAll("a")){const t=e.getAttribute("href")||"";""!==t&&"#"!==t||e.replaceWith(...e.childNodes)}}#tr(){for(const e of this.doc.querySelectorAll("td, th"))e.style.removeProperty("background-color"),e.style.removeProperty("background"),e.style.removeProperty("color")}#nr(){for(const e of this.doc.querySelectorAll("ol, ul"))for(const t of Array.from(e.children)){if("OL"!==t.tagName&&"UL"!==t.tagName)continue;const e=t.previousElementSibling;e&&"LI"===e.tagName&&e.appendChild(t)}}#rr(){for(const e of this.doc.querySelectorAll("ol, ul"))for(const t of Array.from(e.childNodes))t.nodeType===Node.ELEMENT_NODE&&"LI"===t.tagName||e.removeChild(t)}}class xb{constructor(e){this.editorElement=e,this.editor=e.editor}dispose(){this.editorElement=null,this.editor=null}get selection(){return this.editorElement.selection}insertHtml(e,{tag:t}={}){this.insertDOM(Cc(e),{tag:t})}insertDOM(e,{tag:t}={}){this.editor.update((()=>{gl(Zr)&&this.#ir(e);const t=this.editorElement.$generateNodesFromDOM(e);gl(Zr)&&this.#or(t)||this.#sr(t)||this.insertAtCursor(...t)}),{tag:t})}insertText(e,{tag:t}={}){this.editor.update((()=>{const t=es();e.split("\n").forEach(((e,n)=>{n>0&&t.append(li()),t.append(ki(e))})),this.insertAtCursor(t)}),{tag:t})}insertAtCursor(...e){const t=this.#lr();yb.for(t).insertNodes(e)}applyParagraphFormat(){const e=eo();Mi(e)&&(bp(e,(e=>du(e))),oc(e,(()=>es())))}applyHeadingFormat(e){const t=eo();Mi(t)&&(bp(t),oc(t,(()=>Ig(e))))}applyUnorderedListFormat(){this.#ar("bullet",Yd)}applyOrderedListFormat(){this.#ar("number",Xd)}clearFormatting(){const e=eo();Mi(e)&&(nc((e=>{e.setFormat(0),e.setStyle("")})),xd(null),this.#cr(e).filter(Ng).forEach((e=>this.#ur(e))),oc(e,(()=>es())))}toggleCodeBlock(){const e=eo();if(!Mi(e))return;if(this.#dr(Kp("plain")))return;const t=this.#hr(e);if(t.every(Up))t.forEach((e=>this.#gr(e)));else{bp(e);const t=this.#pr(this.#hr(e));if(0===t.length)return;const n=Kp("plain");t.at(-1).insertAfter(n),n.selectEnd(),this.insertAtCursor(...t)}}toggleBlockquote(){const e=eo();if(!Mi(e))return;if(this.#dr(Tg()))return;const t=this.#cr(e);if(t.length>0&&t.every(Ng))t.forEach((e=>this.#ur(e)));else{t.filter(Ng).forEach((e=>this.#ur(e))),bp(e);const n=this.#cr(e);if(0===n.length)return;const r=Tg();n[0].insertBefore(r),n.forEach((e=>r.append(e)))}}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=eo();e=Mi(t)&&!t.isCollapsed()})),e}createLink(e){let t=null;return this.editor.update((()=>{const n=ki(e),r=pd(e);r.append(n);const i=eo();Mi(i)&&(yb.for(i).insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{xd(null),xd(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Ei(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s).lastIndexOf(e);-1!==l&&(t=o.slice(l+e.length,this.#fr(o,s)))})),t}#fr(e,t){const n=e.slice(t).search(/\s/);return-1===n?e.length:t+n}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Ei(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s);t=l.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t];const{anchorNode:n,offset:r}=this.#mr();if(!n)return;const i=this.#yr(n,r,e);-1!==i&&this.#br(n,i,e,t)}uploadFiles(e,{selectLast:t}={}){if(!this.editorElement)return;if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");const n=Array.from(e).filter((e=>this.editorElement.acceptsFile(e)));this.editor.update((()=>{const e=hb.for(this.editorElement,n);if(e.$uploadFiles(),t&&e.nodes?.length){e.nodes.at(-1).selectEnd(),this.#_r()}}))}$createUploadNode(e){return mb({file:e,uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}$createPendingUploadNode(e){return mb({file:e,uploadUrl:null,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}insertPendingAttachment(e){if(!this.editorElement.supportsAttachments)return null;let t=null;return this.editor.update((()=>{const n=this.$createPendingUploadNode(e);this.insertAtCursor(n),t=n.getKey()})),t?this.#xr(t):null}insertPendingAttachments(e){const t=Array.from(e);if(!this.editorElement.supportsAttachments||0===t.length)return[];let n=[];return this.editor.update((()=>{const e=hb.for(this.editorElement,t,{pending:!0});e.$uploadFiles(),n=(e.nodes??[]).map((e=>e.getKey()))})),n.map((e=>this.#xr(e)))}#xr(e){const t=this.editor;let n=e;return{setAttributes(e){t.update((()=>{const t=Rs(n);if(!(t instanceof pb))return;const r=t.$showUploadedAttachment(e);r&&(n=r)}),{tag:jr})},setUploadProgress(e){t.update((()=>{const t=Rs(n);t instanceof pb&&(t.getWritable().progress=e)}),{tag:jr})},remove(){t.update((()=>{const e=Rs(n);e&&e.remove()}))}}}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Rs(e);if(!r)return;const i=eo();let o=!1;if(Mi(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&Ks(null)}const s=n.attachment?this.#Cr(t,n.attachment):this.#Sr(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Rs(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#Cr(t,n.attachment):this.#Sr(t);i.insertAfter(o)}))}#lr(){const e=eo();return Bi(e)&&0===e.getNodes().length?zs().selectEnd():e??zs().selectEnd()}#ir(e){new _b(e).format()}#or(e){return this.editor.dispatchCommand(hn,{nodes:e,selection:eo()})}#dr(e){const t=eo();if(!Mi(t))return!1;const n=t.anchor.getNode();return!!Cl(n)&&(n.append(e),e.selectEnd(),!0)}#gr(e){const t=e.getChildren(),n=[[]];for(const e of t)ai(e)?n.push([]):n[n.length-1].push(e.getTextContent());for(const t of n){const n=es(),r=t.join("");r&&n.append(ki(r)),e.insertBefore(n)}e.remove()}#ar(e,t){this.selection.isInsideBlockQuote?this.#vr(e):(this.#wr(),this.editor.dispatchCommand(t))}#vr(e){for(const t of function(e){const t=[...e].sort(((e,t)=>e.getIndexWithinParent()-t.getIndexWithinParent())),n=[];for(const e of t){const t=n.at(-1),r=t?.at(-1);r&&r.getParent().is(e.getParent())&&r.getNextSibling()?.is(e)?t.push(e):n.push([e])}return n}(this.#kr()))this.#Er(t,e)}#kr(){const e=eo();if(!Mi(e))return[];return this.#pr(this.#hr(e)).filter((e=>Ng(e.getParent())))}#Er(e,t){const n=Zd(t);e[0].insertBefore(n);for(const t of e){const e=Hd();Gd(t)?e.append(...t.getChildren().flatMap((e=>e.getChildren()))):e.append(...t.getChildren()),n.append(e),t.remove()}}#wr(){if(this.selection.isInsideList)return;const e=eo();Mi(e)&&(bp(e),function(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}for(const e of t){if(!ts(e))continue;const t=e.getChildren();if(!t.some(ai))continue;const n=[[]];for(const e of t)ai(e)?(n.push([]),e.remove()):n[n.length-1].push(e);for(const t of n){if(0===t.length)continue;const n=es();t.forEach((e=>n.append(e))),e.insertBefore(n)}n.some((e=>e.length>0))&&e.remove()}}(e))}#hr(e){const t=new Set;for(const n of e.getNodes())t.add(du(n));return Array.from(t)}#cr(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}return Array.from(t)}#pr(e){return e.filter((t=>e.every((e=>e===t||!t.getParents().includes(e)))))}#sr(e){if(e.every(Ap)){const t=hb.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#ur(e){const t=e.getChildren();0==t.length?e.insertBefore(es()):t.forEach((t=>{if(Ei(t)&&""!==t.getTextContent().trim()){const n=es();n.append(t),e.insertBefore(n)}else ai(t)||e.insertBefore(t)})),e.remove()}#mr(){const e=eo();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Ei(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#yr(e,t,n){const r=e.getTextContent(),i=r.slice(0,t).lastIndexOf(n[0]);return-1!==i&&r.startsWith(n,i)?i:-1}#br(e,t,n,r){const i=e.getTextContent(),o=i.slice(0,t),s=i.slice(t+n.length),l=this.#Tr(e,o),a=this.#Tr(e,s||" ");e.replace(l);this.#Nr(l,r).insertAfter(a),this.#Ar(a.getParentOrThrow());const c=s?0:1;a.select(c,c)}#Tr(e,t){return ki(t).setFormat(e.getFormat()).setDetail(e.getDetail()).setMode(e.getMode()).setStyle(e.getStyle())}#Nr(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Ar(e){if(ts(e)&&this.editorElement.supportsMultiLine){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Ei(n)&&""===n.getTextContent()&&r&&!Ei(r)&&e.append(li())}}#Cr(e,t={}){const n="object"==typeof t?t:{},r=n.contentType||"text/html";return this.editorElement.permitsAttachmentContentType(r)?new Jg({sgid:n.sgid||null,contentType:r,innerHtml:e}):this.#Sr(e)}#Sr(e){return this.editorElement.$generateNodesFromDOM(Cc(e))[0]||es()}#_r(){const e=eo();if(!Mi(e))return;const t=e.anchor.getNode();if(!sp(t))return;const n=es();t.append(n),n.selectStart()}}function Cb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Sb={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function vb(e){Sb=e}var wb={exec:()=>null};function kb(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(Eb.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Eb={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Tb=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Nb=/(?:[*+-]|\d{1,9}[.)])/,Ab=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Lb=kb(Ab).replace(/bull/g,Nb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ob=kb(Ab).replace(/bull/g,Nb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Fb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ib=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rb=kb(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ib).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pb=kb(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Nb).getRegex(),Mb="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Db=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Bb=kb("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Db).replace("tag",Mb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$b=kb(Fb).replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex(),zb={blockquote:kb(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$b).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Rb,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Tb,html:Bb,lheading:Lb,list:Pb,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:$b,table:wb,text:/^[^\n]+/},Hb=kb("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex(),Kb={...zb,lheading:Ob,table:Hb,paragraph:kb(Fb).replace("hr",Tb).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Hb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mb).getRegex()},Ub={...zb,html:kb("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Db).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:wb,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:kb(Fb).replace("hr",Tb).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Lb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Wb=/^( {2,}|\\)\n(?!\s*$)/,Vb=/[\p{P}\p{S}]/u,qb=/[\s\p{P}\p{S}]/u,jb=/[^\s\p{P}\p{S}]/u,Zb=kb(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qb).getRegex(),Gb=/(?!~)[\p{P}\p{S}]/u,Jb=kb(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Yb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Xb=kb(Yb,"u").replace(/punct/g,Vb).getRegex(),Qb=kb(Yb,"u").replace(/punct/g,Gb).getRegex(),e_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",t_=kb(e_,"gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,qb).replace(/punct/g,Vb).getRegex(),n_=kb(e_,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Gb).getRegex(),r_=kb("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,qb).replace(/punct/g,Vb).getRegex(),i_=kb(/\\(punct)/,"gu").replace(/punct/g,Vb).getRegex(),o_=kb(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),s_=kb(Db).replace("(?:--\x3e|$)","--\x3e").getRegex(),l_=kb("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",s_).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),a_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,c_=kb(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",a_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),u_=kb(/^!?\[(label)\]\[(ref)\]/).replace("label",a_).replace("ref",Ib).getRegex(),d_=kb(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ib).getRegex(),h_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,g_={_backpedal:wb,anyPunctuation:i_,autolink:o_,blockSkip:Jb,br:Wb,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:wb,emStrongLDelim:Xb,emStrongRDelimAst:t_,emStrongRDelimUnd:r_,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:c_,nolink:d_,punctuation:Zb,reflink:u_,reflinkSearch:kb("reflink|nolink(?!\\()","g").replace("reflink",u_).replace("nolink",d_).getRegex(),tag:l_,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:wb},p_={...g_,link:kb(/^!?\[(label)\]\((.*?)\)/).replace("label",a_).getRegex(),reflink:kb(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",a_).getRegex()},f_={...g_,emStrongRDelimAst:n_,emStrongLDelim:Qb,url:kb(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",h_).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:kb(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",h_).getRegex()},m_={...f_,br:kb(Wb).replace("{2,}","*").getRegex(),text:kb(f_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},y_={normal:zb,gfm:Kb,pedantic:Ub},b_={normal:g_,gfm:f_,breaks:m_,pedantic:p_},__={"&":"&","<":"<",">":">",'"':""","'":"'"},x_=e=>__[e];function C_(e,t){if(t){if(Eb.escapeTest.test(e))return e.replace(Eb.escapeReplace,x_)}else if(Eb.escapeTestNoEncode.test(e))return e.replace(Eb.escapeReplaceNoEncode,x_);return e}function S_(e){try{e=encodeURI(e).replace(Eb.percentDecode,"%")}catch{return null}return e}function v_(e,t){let n=e.replace(Eb.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Eb.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Eb.slashPipe,"|");return r}function w_(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function k_(e,t,n,r,i){let o=t.href,s=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:s,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}var E_=class{options;rules;lexer;constructor(e){this.options=e||Sb}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:w_(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map((e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=w_(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:w_(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=w_(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,s=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))s.push(e[t]),o=!0;else{if(o)break;s.push(e[t])}e=e.slice(t);let l=s.join("\n"),a=l.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${l}`:l,r=r?`${r}\n${a}`:a;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(a,i,!0),this.lexer.state.top=c,0===e.length)break;let u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,o=t.raw+"\n"+e.join("\n"),s=this.blockquote(o);i[i.length-1]=s,n=n.substring(0,n.length-t.raw.length)+s.raw,r=r.substring(0,r.length-t.text.length)+s.text;break}if("list"!==u?.type);else{let t=u,o=t.raw+"\n"+e.join("\n"),s=this.list(o);i[i.length-1]=s,n=n.substring(0,n.length-u.raw.length)+s.raw,r=r.substring(0,r.length-t.raw.length)+s.raw,e=o.substring(i.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),s=!1;for(;e;){let n=!1,r="",l="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!a.trim(),d=0;if(this.options.pedantic?(d=2,l=a.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,l=a.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),o=this.rules.other.headingBeginRegex(d),s=this.rules.other.htmlBeginRegex(d);for(;e;){let h,g=e.split("\n",1)[0];if(c=g,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),h=c):h=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||s.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())l+="\n"+h.slice(d);else{if(u||a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(a)||o.test(a)||n.test(a))break;l+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),a=h.slice(d)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(l),g&&(h="[ ] "!==g[0],l=l.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:l,tokens:[]}),i.raw+=r}let l=i.items.at(-1);if(!l)return;l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=v_(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(let e of i)o.rows.push(v_(e,o.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]}))));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=w_(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),k_(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return k_(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,s=o,l=0,a="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=a.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){s+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){l+=i;continue}if(s-=i,s>0)continue;i=Math.min(i,i+s+l);let t=[...r[0]][0].length,a=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}let c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},T_=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Sb,this.options.tokenizer=this.options.tokenizer||new E_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Eb,block:y_.normal,inline:b_.normal};this.options.pedantic?(t.block=y_.pedantic,t.inline=b_.pedantic):this.options.gfm&&(t.block=y_.gfm,this.options.breaks?t.inline=b_.breaks:t.inline=b_.gfm),this.tokenizer.rules=t}static get rules(){return{block:y_,inline:b_}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Eb.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Eb.tabCharGlobal," ").replace(Eb.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&"paragraph"===o?.type?(o.raw+=(o.raw.endsWith("\n")?"":"\n")+r.raw,o.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,o="";for(;e;){let r;if(i||(o=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(o=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},N_=class{options;parser;constructor(e){this.options=e||Sb}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Eb.notSpaceStart)?.[0],i=e.replace(Eb.endingNewline,"")+"\n";return r?'<pre><code class="language-'+C_(r)+'">'+(n?i:C_(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:C_(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+C_(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${C_(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=S_(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+C_(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=S_(e);if(null===i)return C_(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${C_(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:C_(e.text)}},A_=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},L_=class e{options;renderer;textRenderer;constructor(e){this.options=e||Sb,this.options.renderer=this.options.renderer||new N_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new A_}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let o=i;switch(o.type){case"space":n+=this.renderer.space(o);continue;case"hr":n+=this.renderer.hr(o);continue;case"heading":n+=this.renderer.heading(o);continue;case"code":n+=this.renderer.code(o);continue;case"table":n+=this.renderer.table(o);continue;case"blockquote":n+=this.renderer.blockquote(o);continue;case"list":n+=this.renderer.list(o);continue;case"html":n+=this.renderer.html(o);continue;case"def":n+=this.renderer.def(o);continue;case"paragraph":n+=this.renderer.paragraph(o);continue;case"text":{let i=o,s=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],s+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let o=i;switch(o.type){case"escape":case"text":n+=t.text(o);break;case"html":n+=t.html(o);break;case"link":n+=t.link(o);break;case"image":n+=t.image(o);break;case"strong":n+=t.strong(o);break;case"em":n+=t.em(o);break;case"codespan":n+=t.codespan(o);break;case"br":n+=t.br(o);break;case"del":n+=t.del(o);break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},O_=class{options;block;constructor(e){this.options=e||Sb}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?T_.lex:T_.lexInline}provideParser(){return this.block?L_.parse:L_.parseInline}},F_=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=L_;Renderer=N_;TextRenderer=A_;Lexer=T_;Tokenizer=E_;Hooks=O_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){let t=this.defaults.renderer||new N_(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new E_(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new O_;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];O_.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&O_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return o.call(t,n)})();let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await o.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return T_.lex(e,t??this.defaults)}parser(e,t){return L_.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?T_.lex:T_.lexInline)(n,i),o=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(o,i.walkTokens));let s=await(i.hooks?await i.hooks.provideParser():e?L_.parse:L_.parseInline)(o,i);return i.hooks?await i.hooks.postprocess(s):s})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?T_.lex:T_.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?L_.parse:L_.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+C_(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function I_(e,t){return F_.parse(e,t)}I_.options=I_.setOptions=function(e){return F_.setOptions(e),I_.defaults=F_.defaults,vb(I_.defaults),I_},I_.getDefaults=Cb,I_.defaults=Sb,I_.use=function(...e){return F_.use(...e),I_.defaults=F_.defaults,vb(I_.defaults),I_},I_.walkTokens=function(e,t){return F_.walkTokens(e,t)},I_.parseInline=F_.parseInline,I_.Parser=L_,I_.parser=L_.parse,I_.Renderer=N_,I_.TextRenderer=A_,I_.Lexer=T_,I_.lexer=T_.lex,I_.Tokenizer=E_,I_.Hooks=O_,I_.parse=I_,I_.options,I_.setOptions,I_.use,I_.walkTokens,I_.parseInline,L_.parse,T_.lex;class R_{#e=new bc;constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents,this.#Lr()}dispose(){this.editorElement=null,this.editor=null,this.contents=null,this.#e.dispose()}paste(e){const t=e.clipboardData;if(!t)return!1;if(this.#Or())return this.#Fr(t),e.preventDefault(),!0;if(this.#Ir(t))return this.#Rr(t),e.preventDefault(),!0;const n=this.#Pr(t);return n&&e.preventDefault(),n}#Lr(){this.#e.track(this.editor.registerCommand(Sn,this.paste.bind(this),2),this.editor.registerCommand(hn,(e=>this.#Mr(e)),2))}#Mr({nodes:e,selection:t}){const n=function(e){if(1!==e.length)return null;const t=e[0];if(fd(t))return P_(t);if(ts(t)){const e=t.getChildren();if(1===e.length&&fd(e[0]))return P_(e[0])}return null}(e);if(n&&Mi(t))return this.#Dr(t,n),!0}#Ir(e){return this.#Br(e)||this.#$r(e)}#Br(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#$r(e){if(this.#zr(e))return!1;const t=Array.from(e.types);if(t.includes("text/uri-list"))return t.every((e=>"text/plain"===e||"text/uri-list"===e));if(e.files.length)return!1;const n=e.getData("text/plain").trim();if(!Xg(n))return!1;const r=e.getData("text/html");return!r||this.#Hr(r,n)}#Hr(e,t){const n=Cc(e);if(n.body.textContent.trim()!==t)return!1;const r=n.body.querySelectorAll("a");return 0===r.length||1===r.length&&r[0].getAttribute("href")===t}#Or(){let e=!1;return this.editor.getEditorState().read((()=>{const t=eo();if(!Mi(t))return;let n=t.anchor.getNode();for(;n;){if(Up(n))return void(e=!0);n=n.getParent()}})),e}#Fr(e){const t=e.getData("text/plain");t&&this.editor.update((()=>{const e=eo();Mi(e)&&e.insertRawText(t)}),{tag:Zr})}#Rr(e){this.#Kr(e).getAsString((t=>{const n=t.trim();Xg(n)?this.#Ur(n):this.editorElement.supportsMarkdown?this.#Wr(t):this.#Vr(e)}))}#Kr(e){const t=Array.from(e.items);return t.find((e=>"text/plain"===e.type))||t.find((e=>"text/uri-list"===e.type))}#Ur(e){if(this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else{const t=this.contents.createLink(e);this.#qr(t,{url:e})}}#Dr(e,t){if(!Mi(e))return;if(!e.isCollapsed())return xd(null),void xd(t);const n=pd(t).append(ki(t));yb.for(e).insertNodes([n]),fl((()=>this.#qr(n.getKey(),{url:t})))}#qr(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};vc(this.editorElement,"lexxy:insert-link",{...t,...n})}#Wr(e){const t=Cc(I_(e,{breaks:!0}));if(this.#jr(t))this.contents.insertText(e,{tag:Zr});else{const n=Object.freeze({markdown:e,document:t,addBlockSpacing:()=>function(e){for(const t of e.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *, blockquote > :not(h1, h2, h3, h4, h5, h6) + *")){const n=e.createElement("p");n.appendChild(e.createElement("br")),t.before(n)}}(t)});vc(this.editorElement,"lexxy:insert-markdown",n),this.contents.insertDOM(t,{tag:Zr})}}#jr(e){const t=Array.from(e.body.children);if(1!==t.length)return!1;const n=t[0];return"P"===n.nodeName&&Array.from(n.childNodes).every((e=>e.nodeType===Node.TEXT_NODE||"BR"===e.nodeName))}#Vr(e){this.editor.update((()=>{const t=eo();Kh(e,t,this.editor)}),{tag:Zr})}#Pr(e){if(!this.editorElement.supportsAttachments)return!1;const t=e.getData("text/html"),n=e.files;return n.length&&this.#Zr(t)?(this.#Gr(n),!0):t&&!this.#zr(e)?(this.contents.insertHtml(t,{tag:Zr}),!0):!!n.length&&(this.#Gr(n),!0)}#zr(e){return Array.from(e.types).includes("application/x-lexical-editor")}#Zr(e){if(!e)return!1;const t=Cc(e),n=Array.from(t.body.children);return 1===n.length&&"IMG"===n[0].tagName}#Gr(e){this.#Jr((()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})}))}async#Jr(e){const t=window.scrollY,n=window.scrollX;e(),await Qc(),window.scrollTo(n,t),this.editor.focus()}}function P_(e){const t=e.getURL();return t&&e.getTextContent()===t?t:null}class M_{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#Yr()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){const e=this.#Xr;e&&(this.#Qr(e),this.#ei(e),e.requestOverflowRefresh())}dispose(){for(;this.enabledExtensions.length;)this.enabledExtensions.pop().dispose()}#Qr(e){e.querySelectorAll("[data-lexxy-extension]").forEach((e=>e.remove()))}#ei(e){this.enabledExtensions.forEach((t=>{const n=new Set(e.children);t.initializeToolbar(e);for(const t of e.children)n.has(t)||t.setAttribute("data-lexxy-extension","")}))}get allowedElements(){return this.enabledExtensions.flatMap((e=>e.allowedElements))}get#Xr(){return this.lexxyElement.toolbar}get#ti(){return this.lexxyElement.baseExtensions}get#ni(){return qg.global.get("extensions")}#Yr(){return this.#ti.concat(this.#ni).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}class D_{frozenLinkKey=null;dispatchAttributesChange(e,t,n,r){}dispatchEditorInitialized(e){}freeze(){}thaw(){}unlinkFrozenNode(){return!1}}function B_(e,t){const n=t.createDOM(e._config,e);n.style.whiteSpace="pre-wrap",t.hasFormat("lowercase")?n.style.textTransform="lowercase":t.hasFormat("uppercase")?n.style.textTransform="uppercase":t.hasFormat("capitalize")&&(n.style.textTransform="capitalize");let r=n;return t.hasFormat("bold")&&!$_(n,"strong")&&(r=z_(r,"b")),t.hasFormat("italic")&&!$_(n,"em")&&(r=z_(r,"i")),t.hasFormat("strikethrough")&&(r=z_(r,"s")),t.hasFormat("underline")&&(r=z_(r,"u")),{element:H_(r)}}function $_(e,t){const n=t.toUpperCase();return e.tagName===n||null!==e.querySelector(t)}function z_(e,t){const n=document.createElement(t);return n.appendChild(e),n}function H_(e){if("SPAN"===e.tagName)return e.firstChild;for(const t of e.querySelectorAll("span"))t.replaceWith(...t.childNodes);return e}class K_ extends Xo{$config(){return this.config("provisonal_paragraph",{extends:Xo,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!W_(e,"next")&&!W_(t,"previous")}createDOM(e){const t=super.createDOM(e),n=this.isSelected(eo());return t.classList.add("provisional-paragraph"),t.classList.toggle("hidden",!n),t}updateDOM(e,t){const n=this.isSelected(eo());return t.classList.toggle("hidden",!n),!1}getTextContent(){return""}exportDOM(){return{element:null}}isSelected(e=null){const t=e||eo();if(!t)return!1;if(t.getNodes().some((e=>e.is(this)||this.isParentOf(e))))return!0;if(Mi(t)&&t.isCollapsed()){const{anchor:e}=t,n=this.getParent();if(n&&e.getNode().is(n)&&"element"===e.type){const t=this.getIndexWithinParent();return e.offset===t||e.offset===t+1}}return!1}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(es(),!0)}get required(){return this.isDirectRootChild&&K_.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return Cl(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function U_(e){return e instanceof K_}function W_(e,t){return Ho(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class V_ extends op{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[K_],register:e=>Za(e.registerNodeTransform(Vo,q_),e.registerNodeTransform(Vo,j_),e.registerCommand(dn,Z_,3))}}}function q_(e){const t=function(e){const t=eo();return Cl(t?.anchor?.getNode())?e.getChildAtIndex(t.anchor.offset-1):null}(e),n=e.getFirstChild();K_.neededBetween(null,n)&&yu(e,new K_);for(const n of Cu(e)){const e=n.getNextSibling();K_.neededBetween(n,e)&&(n.insertAfter(new K_),n.is(t)&&n.selectNext())}}function j_(e){for(const t of G_(e))t.removeUnlessRequired()}function Z_(){pl(jr);for(const e of G_())e.markDirty()}function G_(e=zs()){return xu(e.getChildren(),U_)}const J_="language";class Y_ extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>X_(e,{conversion:hp("i",Wy),priority:1}),span:e=>X_(e,{conversion:hp("mark",Wy),priority:1}),strong:e=>X_(e,{conversion:hp("b",Wy),priority:1}),del:()=>({conversion:hp("s",Q_,Wy),priority:1}),pre:e=>function(e,t){return e.hasAttribute(J_)?t:null}(e,{conversion:gp(Hp,"pre",ex),priority:1})}}}}}function X_(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function Q_(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function ex(e,t){const n=bf(t.getAttribute(J_));e.node.setLanguage(n)}class tx extends xy{$config(){return this.config("wrapped_table_node",{extends:xy})}static importDOM(){return super.importDOM()}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}exportDOM(e){const t=super.exportDOM(e);return{...t,after:e=>{if(t.after){return xc("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class nx extends op{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return["figure","tbody"]}get lexicalExtension(){return{name:"lexxy/tables",nodes:[tx,{replace:xy,with:()=>new tx,withKlass:tx},Qf,sm],register:e=>(function(e){by.add(e)}(e),Za(Oy(e),e.registerRootListener((t=>{if(t)return Ly(e,!0)})),e.registerNodeTransform(Qf,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(Qf,(e=>{const t=e.getHeaderStyles();if(t!==Xf)return;const n=e.getParent(),r=n?.getParent();if(!r)return;const i=r.getChildren(),o=n.getChildren().indexOf(e),s=n.getChildren().every((e=>e.getHeaderStyles()!==Yf)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==Yf}));let a=Yf;s&&(a|=Xf),l&&(a|=Jf),a!==t&&e.setHeaderStyles(a,Gf)})),e.registerCommand("insertTableRowAfter",(()=>{ym(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{ym(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{_m(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{_m(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=eo();Mi(e)||Im(e)||om(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=Nm(t),[o]=Nm(n),[s,l,a]=Em(i,r,o),{startRow:c}=l,{startRow:u}=a,d=u+o.__rowSpan-1;if(s.length===d-c+1)return void i.remove();const h=s[0].length,g=s[d+1],p=i.getChildAtIndex(d+1);for(let e=d;e>=c;e--){for(let t=h-1;t>=0;t--){const{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<c||r+n.__rowSpan-1>d){const e=Math.max(r,c),t=Math.min(n.__rowSpan+r-1,d),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=c&&r+n.__rowSpan-1>d&&e===d){null===p&&om(122);let r=null;for(let n=0;n<t;n++){const t=g[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}null===r?Sm(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);cm(t)||om(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];Cm(e)}else{const e=s[c-1],{cell:t}=e[0];Cm(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=eo();Mi(e)||Im(e)||om(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=Nm(t),[o]=Nm(n),[s,l,a]=Em(i,r,o),{startColumn:c}=l,{startRow:u,startColumn:d}=a,h=Math.min(c,d),g=Math.max(c+r.__colSpan-1,d+o.__colSpan-1),p=g-h+1;if(s[0].length===g-h+1)return i.selectPrevious(),void i.remove();const f=s.length;for(let e=0;e<f;e++)for(let t=h;t<=g;t++){const{cell:n,startColumn:r}=s[e][t];if(r<h){if(t===h){const e=h-r;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(r+n.__colSpan-1>g){if(t===g){const e=g-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const m=s[u],y=c>d?m[c+r.__colSpan]:m[d+o.__colSpan];if(void 0!==y){const{cell:e}=y;Cm(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;Cm(t)}const b=i.getColWidths();if(b){const e=[...b];e.splice(h,p),i.setColWidths(e)}}()}),2),e.registerCommand("deleteTable",(()=>{const e=eo();if(!Mi(e))return!1;cy(e.anchor.getNode())?.remove()}),2)))}}}class rx{#ri;#ii=null;#oi=null;#si=null;#e=new bc;constructor(e){this.#ri=e,this.#e.track(e.registerCommand(jn,(e=>this.#li(e)),3),e.registerCommand(Vn,(e=>this.#rt(e)),3)),this.#e.track(e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#ai),t.removeEventListener("dragend",this.#ci)),e&&(e.addEventListener("dragover",this.#ai),e.addEventListener("dragend",this.#ci))})))}destroy(){this.#ui(),this.#e.dispose()}#li(e){if(e.target.closest?.("textarea"))return!1;const t=e.target.closest?.("figure.attachment[data-lexical-node-key]");return!!t&&(this.#ii=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-node-key",this.#ii),e.dataTransfer.effectAllowed="move",this.#si=requestAnimationFrame((()=>{this.#si=null,t.classList.add("lexxy-dragging")})),!0)}#ai=e=>{this.#ii&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#oi||(this.#oi=requestAnimationFrame((()=>{this.#oi=null,this.#di(e)}))))};#rt(e){if(!this.#ii)return!1;e.preventDefault();const t=this.#hi(e),n=this.#ii;return this.#ui(),t&&this.#gi(n,t),!0}#ci=()=>{this.#ui()};#di(e){this.#pi();const t=this.#hi(e);t&&("gallery"===t.type||"gallery-reorder"===t.type?t.element.classList.add(`lexxy-drop-target--gallery-${t.position}`):"list-item"===t.type?t.element.classList.add(`lexxy-drop-target--list-${t.position}`):t.element.classList.add(`lexxy-drop-target--block-${t.position}`))}#hi(e){const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=this.#ri.getRootElement();if(!n||!n.contains(t))return null;const r=t.closest("figure.attachment--preview[data-lexical-node-key]");if(r&&r.dataset.lexicalNodeKey!==this.#ii){const t=r.closest(".attachment-gallery");if(t){const i=n.querySelector(`[data-lexical-node-key="${this.#ii}"]`);if(i&&t.contains(i)){const t=this.#fi(r,e.clientX);return{type:"gallery-reorder",element:r,nodeKey:r.dataset.lexicalNodeKey,position:t}}}const i=this.#fi(r,e.clientX);return{type:"gallery",element:r,nodeKey:r.dataset.lexicalNodeKey,position:i}}if(r&&r.closest(".attachment-gallery"))return null;const i=t.closest(".attachment-gallery");if(i){let n=t.closest("figure.attachment[data-lexical-node-key]");if(n||(n=this.#mi(i,e.clientX)),n&&n.dataset.lexicalNodeKey!==this.#ii){const t=this.#fi(n,e.clientX);return{type:"gallery-reorder",element:n,nodeKey:n.dataset.lexicalNodeKey,position:t}}if(n)return null}const o=t.closest("li");if(o&&n.contains(o)){return{type:"list-item",element:o,position:this.#yi(o,e.clientY)}}const s=this.#bi(t,n,e.clientY);if(!s)return null;const l=this.#yi(s,e.clientY);return"before"===l&&s.previousElementSibling?{type:"block",element:s.previousElementSibling,position:"after"}:{type:"block",element:s,position:l}}#bi(e,t,n){let r=e;for(;r&&r!==t;){if(r.parentElement===t)return r;r=r.parentElement}let i=null,o=1/0;for(const e of t.children){const t=e.getBoundingClientRect(),r=Math.min(Math.abs(n-t.top),Math.abs(n-t.bottom));r<o&&(o=r,i=e)}return i}#yi(e,t){const n=e.getBoundingClientRect();return t<n.top+n.height/2?"before":"after"}#fi(e,t){const n=e.getBoundingClientRect();return t<n.left+n.width/2?"before":"after"}#mi(e,t){const n=e.querySelectorAll("figure.attachment[data-lexical-node-key]");let r=null,i=1/0;for(const e of n){const n=e.getBoundingClientRect(),o=n.left+n.width/2,s=Math.abs(t-o);s<i&&(i=s,r=e)}return r}static#_i=["lexxy-drop-target--gallery-before","lexxy-drop-target--gallery-after","lexxy-drop-target--list-before","lexxy-drop-target--list-after","lexxy-drop-target--block-before","lexxy-drop-target--block-after"];#pi(){const e=this.#ri.getRootElement();if(e)for(const t of e.querySelectorAll("[class*='lexxy-drop-target--']"))t.classList.remove(...rx.#_i)}#gi(e,t){const n=Rs(e);n&&Ap(n)&&("gallery"===t.type?this.#xi(n,t.nodeKey,t.position):"gallery-reorder"===t.type?this.#Ci(n,t.nodeKey,t.position):"list-item"===t.type?this.#Si(n,t):this.#vi(n,t),Ks(null))}#xi(e,t,n){const r=Rs(t);if(!r||!Ap(r))return;if(e.is(r))return;e.remove();db(r)&&("before"===n?r.insertBefore(e):r.insertAfter(e))}#Ci(e,t,n){const r=Rs(t);r&&!e.is(r)&&(e.remove(),"before"===n?r.insertBefore(e):r.insertAfter(e))}#Si(e,t){const n=Ds(t.element);if(!n||!Kd(n))return;const r=n.getParent();if(!r||!Gd(r))return;const i=r.getChildren(),o=i.indexOf(n);if(-1===o)return;const s="before"===t.position?o:o+1;if(e.remove(),0===s)r.insertBefore(e);else if(s>=i.length)r.insertAfter(e);else{const[,t]=Al(r,s);t.insertBefore(e)}}#vi(e,t){const n=Ds(t.element);if(!n)return;const r=n.getTopLevelElement?.()||n;e.is(r)||(e.remove(),"before"===t.position?r.insertBefore(e):r.insertAfter(e))}#ui(){if(this.#pi(),this.#ii){const e=this.#ri.getRootElement();if(e){const t=e.querySelector(`[data-lexical-node-key="${this.#ii}"]`);t?.classList.remove("lexxy-dragging")}}this.#ii=null,this.#oi&&(cancelAnimationFrame(this.#oi),this.#oi=null),this.#si&&(cancelAnimationFrame(this.#si),this.#si=null)}}const ix=["alt","caption","content","content-type","data-direct-upload-id","data-sgid","filename","filesize","height","presentation","previewable","sgid","url","width"];class ox extends op{#wi=0;get enabled(){return this.editorElement.supportsAttachments}get allowedElements(){return[{tag:Tp.TAG_NAME,attributes:ix}]}get lexicalExtension(){return{name:"lexxy/action-text-attachments",nodes:[Tp,pb,ab],register:e=>{const t=new rx(e);return Za(e.registerNodeTransform(Tp,sx),e.registerCommand(bn,lx,2),e.registerMutationListener(pb,this.#ki.bind(this)),(()=>t.destroy()))}}}#ki(e){const t=this.#wi;for(const[t,n]of e)"created"===n?this.#wi++:"destroyed"===n&&(this.#wi--,this.editorElement.uploadRequests.abort(t));this.#wi!==t&&this.#Ei()}#Ei(){this.#wi?this.setEditorValidity({customError:!0},"Please wait for all files to upload"):this.setEditorValidity({})}}function sx(e){const t=e.getParent();if(ts(t))if(1===t.getChildrenSize())t.replace(e);else{const n=e.getIndexWithinParent(),[r,i]=Al(t,n);r.insertAfter(e);for(const e of[r,i])e.isEmpty()&&e.remove()}}function lx(e){const t=eo()?.anchor;return!!t&&(!!function(e,t){const n=e.getNode();if(!ub(n))return!1;const r=up(e,t),i=t?n.getPreviousSibling():n.getNextSibling();if(r&&n.collapseWith(i,t)){const e=t?1:n.getChildrenSize()-1;return n.select(e,e),!0}return!1}(t,e)||!!e&&(function(e){const t=e.getNode();if(!t)return!1;const n=ts(t)&&t.isEmpty(),r=db(t.getPreviousSibling()),i=r?.getChildrenSize();return!(!n||!r?.collapseWith(t.getNextSibling()))&&(r.select(i,i),t.remove(),!0)}(t)||function(e){const t=e.getNode().getPreviousSibling();if(!ub(e.getNode())||!up(e,!0)||!t)return!1;if(Wo(t))return!1;t.isEmpty()?t.remove():t.selectEnd();return!0}(t)))}class ax extends Hp{$config(){return this.config("early_escape_code",{extends:Hp})}static $fromSelection(e){const t=e.anchor.getNode();return uu(t,ax)||(t instanceof ax?t:null)}insertNewAfter(e,t){return gl(Zr)||!e.isCollapsed()?super.insertNewAfter(e,t):this.#Ti(e)?this.#Ni():this.#Ai(e)?this.#Li(e,t):this.#Oi(e)?this.#Fi():super.insertNewAfter(e,t)}#Ti(e){const{anchor:t}=e;if(!dp(t))return!1;const n=t.getNode();return this.is(n)||this.getFirstChild()?.is(n)}#Oi(e){if(!pp(e))return!1;const t=this.getTextContent();return""===t||t.endsWith("\n")}#Ai(e){if(!pp(e))return!1;const t=this.getTextContent(),n=t.lastIndexOf("\n"),r=-1===n?t:t.slice(n+1);return r.length>0&&""===r.trim()}#Ni(){return this.insertBefore(es()),null}#Li(e,t){return super.insertNewAfter(e,t),this.getLastChild().remove(),null}#Fi(){mp(this);const e=es();return this.insertAfter(e),e}}class cx extends Bd{$config(){return this.config("early_escape_listitem",{extends:Bd})}insertNewAfter(e,t){return this.#Ii(e)?this.#Ri():super.insertNewAfter(e,t)}get#Pi(){return Boolean(uu(this,Eg))}#Ii(e){if(this.#Mi()||!this.#Pi)return!1;if(fp(this))return!0;{const t=uu(e.anchor.getNode(),Xo);return t&&fp(t)&&Kd(t.getParent())}}#Mi(){return gl(Zr)}#Ri(){const e=this.getParent();if(!e||!Gd(e))return;const t=e.getParent();if(t&&Ng(t)){if(this.getNextSiblings().some((e=>Kd(e)&&!fp(e))))return this.#Di()}const n=es();return e.insertAfter(n),this.remove(),n}#Di(){const e=Al(this.getParent(),this.getIndexWithinParent());this.remove();const t=es();return e[0].insertAfter(t),e.forEach(mp),t}}class ux extends op{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return[{tag:"ol",attributes:["start"]},{tag:"li",attributes:["value"]}]}get lexicalExtension(){return{name:"lexxy/format-escape",nodes:[ax,{replace:Hp,with:e=>new ax(e.getLanguage()),withKlass:ax},cx,{replace:Bd,with:()=>new cx,withKlass:cx}],register:e=>Za(e.registerCommand(xn,(()=>function(){const e=eo();if(!Mi(e)||!e.isCollapsed()||0!==e.anchor.offset)return!1;const t=uu(e.anchor.getNode(),Xo);if(t&&!fp(t)&&!t.getPreviousSibling()){const e=t.getParent();if(Ng(e))return e.insertBefore(es()),!0}return!1}()||function(){const e=uu(eo().anchor.getNode(),Xo);if(!e||!fp(e))return!1;const t=e.getParent();return!!Ng(t)&&(e.getNextSiblings().filter((e=>!fp(e))).length>0?function(e,t){const n=Al(e,t.getIndexWithinParent());n[0].insertAfter(t),n.forEach(mp),t.selectEnd()}(t,e):(t.insertAfter(e),e.selectStart()),!0)}()),3),e.registerCommand(Pn,(e=>function(e){const t=eo();if(!Mi(t)||!t.isCollapsed())return!1;const n=ax.$fromSelection(t);if(!n)return!1;if(pp(t)&&!n.getNextSibling()){e?.preventDefault();const t=es();return n.insertAfter(t),t.selectEnd(),!0}return!1}(e)),2),e.registerNodeTransform(Eg,dx))}}}function dx(e){e.isEmpty()&&(e.append(es()),function(e,t=eo()){if(Mi(t)){const{commonAncestor:n}=ka(t.focus.getNode(),t.anchor.getNode());return jl(n,(t=>t.is(e)))}return!1}(e)&&e.getFirstChild().select())}class hx extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/link-opener",register:e=>Za(e.registerCommand(gn,this.#Bi.bind(this),2),yc(this.editorElement.editorContentElement,"auxclick",this.#$i.bind(this)),yc(window,"keydown",this.#zi.bind(this)),yc(window,"keyup",this.#zi.bind(this)),yc(window,"focus",this.#Hi.bind(this)))}}#Bi(e){return!!this.#Ki(e)&&gx(e.target)}#$i(e){1===e.button&&this.editorElement.editor.read((()=>gx(e.target)))}#zi(e){this.#Ui(e)}async#Hi(){await function(e){return new Promise((t=>setTimeout(t,e)))}(200),this.editorElement.addEventListener("mousemove",this.#Ui.bind(this),{once:!0})}#Ui(e){this.editorElement.toggleAttribute("data-links-openable",this.#Ki(e))}#Ki(e){return au?e.metaKey:e.ctrlKey}}function gx(e){const t=Ds(e),n=jl(t,fd);if(n){const e=n.sanitizeUrl(n.getURL());return window.open(e,"_blank","noopener,noreferrer"),!0}return!1}class px extends op{get lexicalExtension(){return{name:"lexxy/prevent-lexical-triple-click",register:e=>e.registerRootListener((e=>{if(e)return yc(e,"click",this.#Wi.bind(this),{capture:!0})}))}}#Wi(e){3===e.detail&&e.stopPropagation()}}class fx{#ri;#ii=null;#si=null;#Vi=null;#qi=null;#e=new bc;constructor(e){this.#ri=e,this.#e.track(e.registerCommand(jn,(e=>this.#li(e)),3),e.registerCommand(Vn,(e=>this.#rt(e)),3)),this.#e.track(e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#ai),t.removeEventListener("dragend",this.#ci)),e&&(e.addEventListener("dragover",this.#ai),e.addEventListener("dragend",this.#ci))})))}destroy(){this.#ui(),this.#qi?.remove(),this.#qi=null,this.#e.dispose()}#li(e){const t=this.#ji(e.target);return!!t&&(this.#ii=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-custom-attachment-key",this.#ii),e.dataTransfer.effectAllowed="move",this.#si=requestAnimationFrame((()=>{this.#si=null,t.classList.add("lexxy-dragging")})),!0)}#ai=e=>{this.#ii&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#Vi||(this.#Vi=requestAnimationFrame((()=>{this.#Vi=null,this.#Zi(e)}))))};#ci=()=>{this.#ui()};#rt(e){if(!this.#ii)return!1;e.preventDefault();const t=this.#Gi(e),n=this.#ii;return this.#ui(),t&&this.#Ji(n,t),!0}#Gi(e){const t=this.#ri.getRootElement();if(!t)return null;const n=function(e,t){if(document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:n.offset}}else if(document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:n.startOffset}}return null}(e.clientX,e.clientY);if(!n||!t.contains(n.node))return null;if(n.node===t)return this.#Yi(t,e.clientY);const r=this.#Xi(n.node);return r?this.#Qi(r,e.clientX):n}#Yi(e,t){let n=null,r=1/0;for(const i of e.children){const e=i.getBoundingClientRect(),o=Math.min(Math.abs(t-e.top),Math.abs(t-e.bottom));o<r&&(r=o,n=i)}if(!n)return null;return t<n.getBoundingClientRect().top?{node:n,offset:0}:{node:n,offset:n.childNodes.length}}#Xi(e){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return t?.closest("[data-lexxy-decorator][data-lexical-node-key]")}#Qi(e,t){const n=e.getBoundingClientRect(),r=t>n.left+n.width/2?"after":"before";return{decoratorKey:e.dataset.lexicalNodeKey,placement:r}}#Ji(e,t){this.#ri.update((()=>{const n=Rs(e);Yg(n)&&(t.decoratorKey?this.#eo(n,t):this.#to(n,t))}))}#eo(e,{decoratorKey:t,placement:n}){const r=Rs(t);r&&r!==e&&(e.remove(),"after"===n?r.insertAfter(e):r.insertBefore(e))}#to(e,t){const n=Xi({anchorNode:t.node,anchorOffset:t.offset,focusNode:t.node,focusOffset:t.offset},this.#ri);n&&(Ks(n),e.remove(),n.insertNodes([e]))}#Zi(e){this.#no();const t=this.#Gi(e);t&&this.#ro(this.#io(t))}#io(e){if(e.decoratorKey)return this.#oo(e);const{node:t,offset:n}=e,r=function(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=n.getBoundingClientRect();return r.height>0?r:null}(t,n);if(r)return r;const i=t.nodeType===Node.TEXT_NODE?t.parentElement:t;if(!i)return null;const o=i.getBoundingClientRect();return{left:o.left,top:o.top,height:o.height}}#oo({decoratorKey:e,placement:t}){const n=this.#ri.getRootElement()?.querySelector(`[data-lexical-node-key="${e}"]`);if(!n)return null;const r=n.getBoundingClientRect();return{left:"after"===t?r.right:r.left,top:r.top,height:r.height}}#ro(e){if(!e)return;const t=this.#so();t.style.blockSize=`${e.height}px`,t.style.insetInlineStart=`${e.left}px`,t.style.insetBlockStart=`${e.top}px`}#so(){return this.#qi||=xc("div",{className:"lexxy-drop-caret"}),this.#he().appendChild(this.#qi),this.#qi.style.display="block",this.#qi}#he(){return this.#ri.getRootElement().closest("lexxy-editor")}#no(){this.#qi&&(this.#qi.style.display="none")}#ji(e){return e?.closest?.("[data-lexxy-decorator][data-lexical-node-key]")}#ui(){if(this.#ii){const e=this.#ri.getRootElement(),t=e?.querySelector(`[data-lexical-node-key="${this.#ii}"]`);t?.classList.remove("lexxy-dragging")}this.#no(),this.#ii=null,this.#si&&(cancelAnimationFrame(this.#si),this.#si=null),this.#Vi&&(cancelAnimationFrame(this.#Vi),this.#Vi=null)}}class mx extends op{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/custom-attachment-drag-and-drop",register:e=>{const t=new fx(e);return()=>t.destroy()}}}}class yx extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["autocapitalize","connected","required"];#lo="";#ao=null;#co=!1;#uo=!1;#e=new bc;#do=[];#ge={undo:!1,redo:!1};#ho=new Map;#go=document.createElement("textarea");#po;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}get uploadRequests(){return this.#po}connectedCallback(){this.id||=wc("lexxy-editor"),this.config=new lb(this),this.extensions=new M_(this),this.#do.push(this.extensions),this.editor=this.#fo(),this.#do.push(this.editor),this.#do.push(this.#e),this.contents=new xb(this),this.#do.push(this.contents),this.selection=new sb(this),this.#do.push(this.selection),this.clipboard=new R_(this),this.#do.push(this.clipboard),this.adapter=new D_,this.#po=new jf;const e=ob.configureFor(this);this.#do.push(e),this.#mo(),this.toggleAttribute("connected",!0),requestAnimationFrame((()=>{this.#yo(),this.#bo(),this.#_o()}))}disconnectedCallback(){this.#co=!1,this.#uo=!1,this.#ao=null,this.valueBeforeDisconnect=this.value,this.#xo(),this.#Co()}attributeChangedCallback(e,t,n){"function"==typeof this[`${e}ChangedCallback`]&&this[`${e}ChangedCallback`](t,n)}autocapitalizeChangedCallback(){this.editorContentElement&&this.#So(this.editorContentElement,"autocapitalize")}connectedChangedCallback(e,t){this.isConnected&&null!=e&&e!==t&&requestAnimationFrame((()=>this.#h()))}requiredChangedCallback(){this.isConnected&&this.#vo()}formResetCallback(){this.value=this.#lo,this.editor.dispatchCommand(er,void 0)}toString(){return this.cachedStringValue??=this.editor?.read((()=>bx(zs())))}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get required(){return this.hasAttribute("required")}get validity(){return this.internals.validity}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}setElementValidity(e,t,n){this.#ho.set(e,{flags:t,message:n}),this.#vo()}get toolbarElement(){return this.#wo?(this.toolbar??=this.#ko(),this.toolbar):null}get baseExtensions(){return[V_,Uy,Y_,nx,kp,ox,ux,hx,px,mx]}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get permittedAttachmentTypes(){const e=this.config.get("permittedAttachmentTypes");if(null==e)return null;{const t=Array.isArray(e)?e:String(e).split(/\s+/);return Object.freeze(t.filter((e=>e&&"false"!==e)))}}permitsAttachmentContentType(e){if(this.supportsAttachments){const t=this.permittedAttachmentTypes;return null===t||t.includes(e)}return!1}acceptsFile(e){return vc(this,"lexxy:file-accept",{file:e},!0)}$generateNodesFromDOM(e,{editor:t=this.editor}={}){let n=Rh(t,e);return gl(Zr)&&(n=function(e,t){const n=e.map((e=>Op(e)?Fp(e,t):e)).filter((e=>null!==e));for(const e of n)for(const n of xu([e],Op)){const e=Fp(n,t);e?n.replace(e):n.remove()}return n}(n,this)),function(e,t){return e.filter((e=>!Lp(e,t))).map((e=>(xu([e],(e=>Lp(e,t))).forEach((e=>e.remove())),e)))}(n,this)}get isEmpty(){return["<p><br></p>","<p></p>",""].includes(this.value.trim())}get isBlank(){return this.isEmpty||null!==this.toString().match(/^\s*$/g)}get hasOpenPrompt(){return null!==this.querySelector(".lexxy-prompt-menu.lexxy-prompt-menu--visible")}get preset(){return this.getAttribute("preset")||"default"}get supportsAttachments(){return this.config.get("attachments")}get supportsMarkdown(){return this.supportsRichText&&this.config.get("markdown")}get supportsMultiLine(){return this.config.get("multiLine")&&!this.isSingleLineMode}get supportsRichText(){return this.config.get("richText")}registerAdapter(e){this.adapter=e,this.editor&&(this.#Eo(),this.#To())}freezeSelection(){this.adapter.freeze()}thawSelection(){this.adapter.thaw()}dispatchAttributesChange(){this.#To()}dispatchEditorInitialized(){this.#Eo()}get isSingleLineMode(){return this.hasAttribute("single-line")}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute("tabindex")??"0")}focus(){this.#No||this.editor.focus((()=>this.#Ao()))}get#No(){return!!this.editor&&cp(this.editor)}get value(){return this.cachedValue??=this.#Lo()}set value(e){const t=this.#No;this.editor.update((()=>{t?fl((()=>this.editor.focus())):pl(Yr),this.#Oo(e),this.#Fo()}),{discrete:!0})}get canUndo(){return this.#ge.undo}get canRedo(){return this.#ge.redo}#Lo(){return this.editor?.read((()=>Zg(Ph(this.editor,null))))??null}#Io(e,{editor:t=this.editor}={}){e||(e="<p></p>");return this.$generateNodesFromDOM(Cc(`${e}`),{editor:t}).filter(this.#Ro).map(this.#Po)}#Ro(e){return!ai(e)&&(!Ei(e)||""!==e.getTextContent().trim())}#Po(e){if(!Ei(e))return e;const t=es();return t.append(e),t}#mo(){this.#Mo(),this.#le(),this.#Do(),this.#Bo(),this.#$o(),this.#zo(),this.#Ho(),this.#Ko(),this.#Uo(this.value,{suppressEvent:!0}),this.#Wo()}#$o(){this.#e.track(yc(this,"lexxy:file-accept",(e=>{this.permitsAttachmentContentType(e.detail.file.type)||e.preventDefault()})))}#fo(){this.editorContentElement||=this.#Vo(),this.appendChild(this.editorContentElement);const e=function(...e){return ad.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:qf,nodes:this.#qo,html:{export:new Map([[mi,B_],[Jp,B_]])},$initialEditorState:e=>{this.#jo(e),this.#Zo(e)}},...this.extensions.lexicalExtensions);return e}#yo(){this.editor.setEditable(!1),this.editor.setRootElement(this.editorContentElement),this.editor.setEditable(!0)}get#qo(){const e=[Jg];return this.supportsRichText&&e.push(Eg,Ag,Ud,Bd,Hp,Jp,hd,md,Kf),e}#Vo(){const e=xc("div",{id:`${this.id}-content`,classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#Go,placeholder:this.getAttribute("placeholder")});return this.#Jo.forEach((t=>e.setAttribute(t.name,t.value))),this.#So(e,"autocapitalize"),this.#So(e,"tabindex",{defaultValue:0,removeSource:!0}),e}#So(e,t,{defaultValue:n=null,removeSource:r=!1}={}){this.hasAttribute(t)?e.setAttribute(t,this.getAttribute(t)):null!==n?e.setAttribute(t,n):e.removeAttribute(t),r&&this.removeAttribute(t)}get#Go(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#Jo(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}#Uo(e,{suppressEvent:t=!1}={}){const n=e!==this.#ao;this.internals.setFormValue(e),this.#ao=e,n&&!t&&vc(this,"lexxy:change")}#Zo(e){const t=this.valueBeforeDisconnect||this.getAttribute("value")||"<p><br></p>";this.#lo=t,this.#Oo(t,{editor:e})}#Oo(e,{editor:t=this.editor}={}){zs().clear().selectEnd().insertNodes(this.#Io(e,{editor:t}))}#Ko(){this.#e.track(yc(document,"turbo:before-cache",this.#Yo))}#Yo=e=>{this.closest("[data-turbo-permanent]")||this.#Co()};#Wo(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{this.#xo(),this.#Uo(this.value),this.#Fo(),this.#vo(),this.#To()})))}async#vo(){await Qc(),this.isConnected&&this.#Xo()}#Xo(){this.#Qo();const{validity:e,message:t}=this.#es();this.internals.setValidity(e,t,this.editorContentElement)}#Qo(){this.#go.required=this.required&&this.isBlank;const e=this.#go.validity,t=this.#go.validationMessage;this.#ho.set(this,{flags:e,message:t})}#es(){const e={},t=[];for(const{flags:n,message:r}of this.#ho.values())if(!0!==n.valid)for(const i in n)n[i]&&(e[i]=!0,t.push(r));return{validity:e,message:t.join("\n")}}#xo(){this.cachedValue=null,this.cachedStringValue=null}#Mo(){const e=[];if(this.supportsRichText){if(e.push(Bg(this.editor),eh(this.editor)),this.#ts(),this.#ns(),this.supportsMarkdown){const t=[...Mf,Uf];e.push(Hf(this.editor,t),function(e,t){const n=t.filter((e=>"text-format"===e.type)).sort(((e,t)=>t.tag.length-e.tag.length));return e.registerUpdateListener((({tags:t,dirtyLeaves:r,editorState:i,prevEditorState:o})=>{if(t.has("historic")||t.has("collaboration"))return;if(e.isComposing())return;const s=i.read(eo),l=o.read(eo);if(!Mi(l)||!Mi(s)||!s.isCollapsed())return;const a=s.anchor.key,c=s.anchor.offset;if(!r.has(a))return;const u=i.read((()=>Rs(a)));if(!Ei(u))return;if(c<=(l.anchor.key===a?l.anchor.offset:0))return;const d=i.read((()=>u.getTextContent()));for(const t of n){const n=t.tag,r=n.length,i=c-r;if(i<0)continue;if(d.slice(i,c)!==n)continue;const o=n[0];if(i>0&&d[i-1]===o)continue;if(!1===t.intraword&&i>0){const e=d[i-1];if(e&&!Wf.test(e))continue}const s=c,l=d.indexOf(n,s);if(l<0)continue;if(d[l+r]===o)continue;if(l>0&&d[l-1]===o)continue;const u=l;if(!(u<=c)&&" "!==d[c]&&" "!==d[u-1]){if(!1===t.intraword){const e=d[l+r];if(e&&!Wf.test(e))continue}e.update((()=>{const e=Rs(a);if(!e||!Ei(e))return;const n=e.getParent();null===n||Up(n)||Vf(e,i,t)}));break}}}))}(this.editor,t))}}else e.push(pg(this.editor));this.#e.track(...e)}#ts(){let e=this.querySelector("lexxy-table-tools");e??=xc("lexxy-table-tools"),this.append(e),this.#do.push(e)}#ns(){_f(this.editor);let e=this.querySelector("lexxy-code-language-picker");e??=xc("lexxy-code-language-picker"),this.append(e),this.#do.push(e)}#le(){this.#e.track(this.editor.registerCommand(Mn,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2))}#Do(){this.#e.track(yc(this,"focusin",this.#rs),yc(this,"focusout",this.#is))}#rs(e){this.#os(e.target)&&!this.currentlyFocused&&(this.#To(),vc(this,"lexxy:focus"),this.currentlyFocused=!0)}#is(e){this.#os(e.relatedTarget)||(vc(this,"lexxy:blur"),this.currentlyFocused=!1)}#os(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Ao(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#bo(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#Bo(){this.#e.track(this.editor.registerCommand(nr,(e=>{this.#ge.undo=e}),2),this.editor.registerCommand(tr,(e=>{this.#ge.redo=e}),2))}#zo(){}#Ho(){this.#wo&&(this.toolbarElement.setEditor(this),"function"==typeof this.toolbarElement.dispose&&this.#do.push(this.toolbarElement),this.extensions.initializeToolbars())}#ko(){const e=this.config.get("toolbar");return"string"==typeof e?document.getElementById(e):this.querySelector("lexxy-toolbar")??this.#ss()}get#wo(){return this.supportsRichText&&!!this.config.get("toolbar")}#ss(){const e=xc("lexxy-toolbar");return e.innerHTML=Xc.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),e.configure(this.config.get("toolbar")),this.prepend(e),e}#Fo(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#jo(e){jg(this.#ls(e))}#ls(e){return this.#as(e).concat(this.extensions.allowedElements)}#as(e){return Array.from(e._htmlConversions.keys()).filter((e=>!e.startsWith("#")))}#To(){let e=null,t=null,n=null,r=null;this.editor.getEditorState().read((()=>{const i=eo();if(!Mi(i))return;const o=this.selection.getFormat();if(0===Object.keys(o).length)return;const s=uu(i.anchor.getNode(),hd);e={bold:{active:o.isBold,enabled:!0},italic:{active:o.isItalic,enabled:!0},strikethrough:{active:o.isStrikethrough,enabled:!0},code:{active:o.isInCode,enabled:!0},highlight:{active:o.isHighlight,enabled:!0},link:{active:o.isInLink,enabled:!0},quote:{active:o.isInQuote,enabled:!0},heading:{active:o.isInHeading,enabled:!0},"unordered-list":{active:o.isInList&&"bullet"===o.listType,enabled:!0},"ordered-list":{active:o.isInList&&"number"===o.listType,enabled:!0},undo:{active:!1,enabled:this.canUndo},redo:{active:!1,enabled:this.canRedo}},t=s?s.getURL():null,n=o.isHighlight?function(e){if(!Mi(e))return null;let t=gc(e.style);if(!t.color&&!t["background-color"]){const n=e.anchor.getNode();Ei(n)&&(t=gc(n.getStyle()))}const n=t.color||null,r=t["background-color"]||null;return n||r?{color:n,backgroundColor:r}:null}(i):null,r=o.headingTag??null})),e&&this.adapter.dispatchAttributesChange(e,t,n,r)}#Eo(){this.adapter&&(this.#uo=!0,this.adapter.dispatchEditorInitialized({highlightColors:this.#cs,headingFormats:this.#us}))}#_o(){this.isConnected&&this.adapter&&(this.#co||(this.#co=!0,vc(this,"lexxy:initialize")),this.#uo||this.#Eo())}get#cs(){const e=this.config.get("highlight.buttons");if(!e)return null;return{colors:this.#ds("color",e.color||[]),backgroundColors:this.#ds("background-color",e["background-color"]||[])}}get#us(){return this.supportsRichText?[{label:"Normal",command:"setFormatParagraph",tag:null},{label:"Large heading",command:"setFormatHeadingLarge",tag:"h2"},{label:"Medium heading",command:"setFormatHeadingMedium",tag:"h3"},{label:"Small heading",command:"setFormatHeadingSmall",tag:"h4"}]:[]}#ds(e,t){const n=document.createElement("span");n.style.display="none";const r=t.map((t=>{const r=document.createElement("span");return r.style.setProperty(e,t),n.appendChild(r),{element:r,name:t}}));Iy().appendChild(n);const i=r.map((({element:t,name:n})=>({name:n,value:window.getComputedStyle(t).getPropertyValue(e)})));return n.remove(),i}#Co(){this.#hs(),this.#gs(),this.#po?.clear(),this.editorContentElement?.remove(),this.editorContentElement=null,this.toolbar=null}#hs(){for(;this.#do.length;)this.#do.pop().dispose()}#h(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}#gs(){this.#ho=new Map}}function bx(e){if(e instanceof Jg)return e.getReadableTextContent();if(Ho(e)){let t="";const n=e.getChildren();for(let e=0;e<n.length;e++){const r=n[e];yp(r,n[e-1],e,n.length)||(t+=bx(r),Ho(r)&&e!==n.length-1&&!r.isInline()&&(t+="\n\n"))}return t}return e.getTextContent()}class _x{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=xc("li",{role:"option",id:wc("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=Cc(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class xx extends _x{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#ps(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#ps(e,t){if(this.promptItemByListItem=new WeakMap,!t)return this.#fs(e);const n=[];for(const r of e){const e=ep(r.getAttribute("search"),t);e>=0&&n.push({promptItem:r,position:e})}n.sort(((e,t)=>e.position-t.position));const r=[];for(const{promptItem:e}of n){if(r.length>=100)break;const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),r.push(t)}return r}#fs(e){const t=[];for(const n of e){if(t.length>=100)break;const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class Cx extends xx{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Sx extends xx{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class vx extends _x{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,o)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){o(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#ms(e));return this.#ps(t)}#ms(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#ps(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){if(t.length>=100)break;const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class wx extends HTMLElement{#ys=new bc;#bs=new bc;#_s=function(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>e(...r)),t)}}((()=>this.#xs()),50);constructor(){super(),this.showPopoverId=0}static observedAttributes=["connected"];connectedCallback(){this.source=this.#Cs(),this.#Ss(),this.#vs(),this.toggleAttribute("connected",!0)}disconnectedCallback(){this.#bs.dispose(),this.#ys.dispose(),this.source=null,this.#ws()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get onlyAt(){return this.getAttribute("only-at")}get verticalDirection(){return this.getAttribute("vertical-direction")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#ks(){return!this.supportsSpaceInSearches}#Cs(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new vx(e):new Sx(e):new Cx(this.querySelectorAll("lexxy-prompt-item"))}#Ss(){this.#Es&&this.#bs.track(this.#ri.registerUpdateListener((({editorState:e})=>{e.read((()=>{if(this.#Ts.isInsideCodeBlock)return;const{node:e,offset:t}=this.#Ts.selectedNodeWithOffset();if(e&&Ei(e)){const n=e.getTextContent(),r=this.trigger.length;if(t>=r){if(n.slice(t-r,t)===this.trigger){const n=function(e,t){const n=[];let r=!1;return function i(o){if(!r){if(o===e)return n.push(o.getTextContent().slice(0,t)),void(r=!0);if(Ho(o)){const e=o.getChildren();for(let t=0;t<e.length;t++){if(i(e[t]),r)return;const o=e[t];Ho(o)&&!o.isInline()&&t<e.length-1&&n.push("\n\n")}}else n.push(o.getTextContent())}}(zs()),n.join("")}(e,t-r);this.#Ns.test(n)&&(this.#bs.dispose(),this.#As())}}}}))})))}get#Ns(){return new RegExp(`(?:${this.onlyAt??"^|[ \\n]"})$`)}get#Es(){if(this.hasAttribute("insert-editable-text"))return!0;const e=this.#he;if(e.supportsAttachments){const t=Array.from(this.querySelectorAll("template[type='editor']")),n=t.length?t.map((e=>e.getAttribute("content-type")||this.#Ls)):[this.#Ls];return n.some((t=>e.permitsAttachmentContentType(t)))}return!1}#Os(){this.#bs.track(this.#ri.registerUpdateListener((({editorState:e})=>{this.closed||e.read((()=>{if(this.#Ts.isInsideCodeBlock)return void this.#Fs();const{node:e,offset:t}=this.#Ts.selectedNodeWithOffset();e&&(this.#Is(e,t)?this.popoverElement.hasAttribute("data-anchored")||this.#Rs():this.#Fs())}))})))}#Is(e,t){if(!Ei(e)||0===t)return!1;const n=e.getTextContent().slice(0,t),r=n.lastIndexOf(this.trigger);if(-1===r)return!1;const i=n.slice(r+this.trigger.length);return!(this.supportsSpaceInSearches?/\n/:/[ \n]/).test(i)}get#ri(){return this.#he.editor}get#he(){return this.closest("lexxy-editor")}get#Ts(){return this.#he.selection}async#As(){const e=++this.showPopoverId;this.popoverElement??=await this.#Ps(),this.showPopoverId===e&&(this.#Ms(),await this.#xs(),this.showPopoverId===e&&(this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#Ds(),this.#bs.track(yc(this.#he,"keydown",this.#Bs),yc(this.#he,"lexxy:change",this.#_s)),this.#$s(),this.#Os()))}#$s(){this.#bs.track(this.#ri.registerCommand(Mn,this.#zs.bind(this),4),this.#ri.registerCommand(Hn,this.#zs.bind(this),4)),this.#ks&&(this.#bs.track(this.#ri.registerCommand(Dn,this.#zs.bind(this),4)),this.#bs.track(this.#ri.registerCommand(fn,this.#Hs.bind(this),4))),this.#bs.track(this.#ri.registerCommand(Rn,this.#Ks.bind(this),4),this.#ri.registerCommand(Pn,this.#Us.bind(this),4))}#Ks(e){return this.#Ws(),e.preventDefault(),!0}#Us(e){return this.#Vs(),e.preventDefault(),!0}#Ds(){const e=this.#qs[0];e&&this.#js(e)}get#qs(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#js(e,{scrollIntoView:t=!1}={}){this.#Zs(),e.toggleAttribute("aria-selected",!0),t&&e.scrollIntoView({block:"nearest",container:"nearest",behavior:"smooth"}),this.#Gs("aria-controls",this.popoverElement.id),this.#Gs("aria-activedescendant",e.id),this.#Gs("aria-haspopup","listbox")}#Zs(){this.#qs.forEach((e=>{e.toggleAttribute("aria-selected",!1)}))}#Js(){this.#Zs(),this.#Ys.removeAttribute("aria-controls"),this.#Ys.removeAttribute("aria-activedescendant"),this.#Ys.removeAttribute("aria-haspopup")}#Gs(e,t){this.#Ys.getAttribute(e)!==t&&this.#Ys.setAttribute(e,t)}#Rs(){const e=this.#Ts.cursorPosition;if(!e)return;const{x:t,y:n,fontSize:r}=e,i=this.#he.getBoundingClientRect(),o=this.#Ys.getBoundingClientRect(),s=o.top-i.top;this.popoverElement.hasAttribute("data-anchored")||(this.#Xs(t),this.#Qs(n+s),this.popoverElement.toggleAttribute("data-anchored",!0));const l=this.popoverElement.getBoundingClientRect();l.right>i.right&&this.popoverElement.toggleAttribute("data-clipped-at-right",!0);const a="top"===this.verticalDirection,c="bottom"===this.verticalDirection,u=l.bottom>window.innerHeight;c||!a&&!u||(this.#Qs(o.height-n+r),this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#Xs(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-x",`${e}px`)}#Qs(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-y",`${e}px`)}#Ms(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-clipped-at-right"),this.popoverElement.removeAttribute("data-anchored")}async#Fs(){this.showPopoverId++,this.#Js(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#bs.dispose(),await Qc(),this.#Ss()}#vs(){this.#ys.track(yc(document,"turbo:before-cache",(()=>this.#ws())))}#ws(){this.#bs.dispose(),this.popoverElement?.remove(),this.popoverElement=null}#xs=async()=>{if(this.initialPrompt)this.initialPrompt=!1;else if(this.#el.containsTextBackUntil(this.trigger)){if(await this.#tl(),!this.#el.containsTextBackUntil(this.trigger))return void this.#Fs();await Qc(),this.#Rs()}else this.#Fs()};async#tl(){const e=this.showPopoverId,t=this.#el.textBackUntil(this.trigger),n=await this.source.buildListItems(t);this.showPopoverId===e&&this.#el.containsTextBackUntil(this.trigger)&&(this.popoverElement.innerHTML="",n.length>0?this.#nl(n):this.#rl(),this.#Ds())}#nl(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#rl(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=xc("li",{textContent:this.#il});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#il(){return this.getAttribute("empty-results")||"Nothing found"}#Bs=e=>{"Escape"===e.key?(this.#Fs(),this.#he.focus(),e.stopPropagation()):","===e.key&&(e.preventDefault(),e.stopPropagation(),this.#ol(),this.#ri.update((()=>{const e=eo();Mi(e)&&e.insertText(",")})))};#Hs(e){if("insertText"===e.inputType&&" "===e.data)return this.#zs(e)}#Vs(){const e=this.#sl+1;e<this.#qs.length&&this.#js(this.#qs[e],{scrollIntoView:!0})}#Ws(){const e=this.#sl-1;e>=0&&this.#js(this.#qs[e],{scrollIntoView:!0})}get#sl(){return this.#qs.findIndex((e=>e.hasAttribute("aria-selected")))}get#ll(){return this.#qs[this.#sl]}#zs(e){return e.preventDefault(),e.stopPropagation(),this.#ol(),!0}#ol(){this.#al(),this.#Fs(),this.#he.focus()}#al(){const e=this.source.promptItemFor(this.#ll);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#el.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#cl(t,n):this.#ul(t,n,e.getAttribute("sgid"))}#cl(e,t){this.#ri.update((()=>{const n=e.flatMap((e=>this.#dl(e)));this.#el.replaceTextBackUntil(t,n)}))}#dl(e){return this.#he.$generateNodesFromDOM(Cc(`${e.innerHTML}`))}#ul(e,t,n=null){this.#ri.update((()=>{const r=this.#hl(e,n).flatMap((e=>[e,this.#gl()])).slice(0,-1);this.#el.replaceTextBackUntil(t,r)}))}#hl(e,t=null){return e.filter((e=>this.#he.permitsAttachmentContentType(e.getAttribute("content-type")||this.#Ls))).map((e=>this.#pl(e.innerHTML,e.getAttribute("content-type")||this.#Ls,e.getAttribute("sgid")||t)))}#gl(){return ki(" ")}get#Ls(){return`application/vnd.${qg.global.get("attachmentContentTypeNamespace")}.${this.name}`}#pl(e,t,n){return new Jg({sgid:n,contentType:t,innerHtml:e})}get#el(){return this.#he.contents}get#Ys(){return this.#he.editorContentElement}async#Ps(){const e=xc("ul",{role:"listbox",id:wc("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",mc()),e.append(...await this.source.buildListItems()),this.#ys.track(yc(e,"click",this.#fl)),this.#he.appendChild(e),e}#fl=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#js(t),this.#ol())};#h(){this.disconnectedCallback(),this.connectedCallback()}}class kx extends HTMLElement{#ml=null;#e=new bc;connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.#ml=new AbortController,this.#e.track((()=>this.#ml?.abort())),this.#yl(),this.#bl(),this.#_l()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose()}#yl(){this.languagePickerElement=this.#xl()??this.#Cl();const e=this.#ml.signal;this.#e.track(yc(this.languagePickerElement,"change",(()=>{this.#Sl(this.languagePickerElement.value)}),{signal:e})),this.#e.track(yc(this.languagePickerElement,"mousedown",(e=>{this.#vl(e)}),{signal:e})),this.languagePickerElement.setAttribute("nonce",mc()),this.appendChild(this.languagePickerElement)}#xl(){return this.querySelector("select")}#Cl(){const e=xc("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#wl)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#wl(){const e={...yf};e.ruby||="Ruby",e.php||="PHP",e.go||="Go",e.bash||="Bash",e.json||="JSON",e.diff||="Diff",e.kotlin||="Kotlin",delete e.plain;const t=Object.entries(e).sort(((e,t)=>e[1].localeCompare(t[1])));return{plain:"Plain text",...Object.fromEntries(t)}}#vl(e){!vc(this.editorElement,"lexxy:code-language-picker-open",{languages:this.#kl,currentLanguage:this.languagePickerElement.value},!0)&&e.preventDefault()}get#kl(){return Object.entries(this.#wl).map((([e,t])=>({key:e,name:t})))}#Sl(e){this.editor.update((()=>{const t=this.#El();t&&t.setLanguage(e)}))}#_l(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{const e=this.#El();e?this.#Tl(e):this.#bl()}))})))}#El(){return this.editorElement.selection.nearestNodeOfType(Hp)}#Tl(e){const t=e.getLanguage();this.#Nl(t),this.#Al(),this.#Ll(e)}#Nl(e){if(this.languagePickerElement&&e){const t=bf(e);this.languagePickerElement.value=t}}#Ll(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top,o=r.right-n.right;this.style.top=`${i}px`,this.style.right=`${o}px`}#Al(){this.hidden=!1}#bl(){this.hidden=!0}}class Ex extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.querySelector(".lexxy-node-delete")||this.#Ol()}disconnectedCallback(){this.editor=null,this.editorElement=null}#Ol(){const e=xc("div",{className:"lexxy-floating-controls__group"});this.deleteButton=xc("button",{className:"lexxy-node-delete",type:"button","aria-label":"Remove"}),this.deleteButton.tabIndex=-1,this.deleteButton.innerHTML='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n</svg>',this.handleDeleteClick=()=>this.#Fl(),this.deleteButton.addEventListener("click",this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#Fl(){this.editor.update((()=>{const e=Ds(this);e?.remove()}))}}class Tx{#e=new bc;constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#Il()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#e.dispose()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=Rs(this.currentCellKey);return e instanceof Qf?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=Rs(this.currentTableNodeKey);return e instanceof xy?e:null})):null}get currentRowCells(){const e=this.currentRowIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t[e]?.getChildren()??null))??null:null}get currentRowIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){const t=pm(e);return fm(t).getChildren().findIndex((e=>e.is(t)))}(e)))??0:0}get currentColumnCells(){const e=this.currentColumnIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t.map((t=>t.getChildAtIndex(e)))))??null:null}get currentColumnIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){return pm(e).getChildren().findIndex((t=>t.is(e)))}(e)))??0:0}get tableRows(){return this.editor.getEditorState().read((()=>this.currentTableNode?.getChildren()))??null}updateSelectedTable(){let e=null,t=null;return this.editor.getEditorState().read((()=>{const n=eo();if(!n||!this.selection.isTableCellSelected)return;const r=n.getNodes()[0];e=ay(r),t=cy(r)})),this.currentCellKey=e?.getKey()??null,this.currentTableNodeKey=t?.getKey()??null,t}executeTableCommand(e,t=null){"delete"!==e.action||"table"!==e.childType?"toggle"!==e.action?this.#Rl(e,t):this.#Pl(e):this.#Ml()}#Rl(e,t=null){this.#Dl(),this.editor.dispatchCommand(this.#Bl(e)),this.#$l(e,t)}#Pl(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=Xf):"column"===t&&(n=this.currentColumnCells,r=Jf),n&&0!==n.length&&this.editor.update((()=>{const e=gm(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#zl(e,t,r)}))}))}#Ml(){this.#Dl(),this.editor.dispatchCommand("deleteTable")}#Dl(){this.editor.update((()=>{const e=eo();if(!e)return;const t=e.getNodes()[0];ay(t)?.selectEnd()}))}#Bl(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${tp(n)}${"insert"==t?tp(r):""}`}#zl(e,t,n){const r=gm(e);r?.setHeaderStyles(t,n)}async#Hl(e,t){if(await Qc(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=gm(r.getChildAtIndex(t));e?.selectEnd()}))}#$l(e,t=null){const{childType:n,direction:r}=e;let i=this.currentRowIndex,o=null!==t?t:this.currentColumnIndex;const s="delete"===e.action?-1:0,l="after"===r?1:s;"row"===n?i+=l:"column"===n&&(o+=l),this.#Hl(i,o)}#Kl(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#Ul(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Wl(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Vl(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#ql(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if(ts(t))t.selectStart();else{const e=es();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#jl(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#Zl(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#Gl(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#Jl(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#Il(){this.#e.track(this.editor.registerCommand(Bn,(e=>this.#Yl(e)),3),this.editor.registerCommand(Mn,(e=>this.#Xl(e)),3))}#Yl(e){return!!this.currentTableNode&&(this.#Gl()&&this.#Jl()?(e.preventDefault(),this.#Vl(),!0):!(!this.#jl()||this.#Jl())&&(e.preventDefault(),this.#Ul(),!0))}#Xl(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#Zl()&&this.#Gl()?this.#ql():this.#Zl()?this.#Wl():this.#Kl(),!0))}}var Nx={"insert-row-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 15C8.29055e-07 15.8284 0.671574 16.5 1.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V4.5L16.4922 4.34668C16.4154 3.59028 15.7767 3 15 3H13.5L13.5 4.5H15V9H1.5L1.5 4.5L3 4.5V3H1.5C0.671574 3 1.20956e-06 3.67157 1.24577e-06 4.5L7.86804e-07 15ZM15 10.5V15H1.5L1.5 10.5H15Z"/>\n <path d="M4.5 4.5H7.5V7.5H9V4.5H12L12 3L9 3V6.55671e-08L7.5 0V3L4.5 3V4.5Z"/>\n </svg>',"insert-row-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 13.5C7.50592e-07 14.3284 0.671574 15 1.5 15H3V13.5H1.5L1.5 9L15 9V13.5H13.5V15H15C15.7767 15 16.4154 14.4097 16.4922 13.6533L16.5 13.5V3L16.4922 2.84668C16.4205 2.14069 15.8593 1.57949 15.1533 1.50781L15 1.5L1.5 1.5C0.671574 1.5 1.28803e-06 2.17157 1.24577e-06 3L7.86804e-07 13.5ZM15 3V7.5L1.5 7.5L1.5 3L15 3Z"/>\n <path d="M7.5 15V18H9V15H12V13.5H9V10.5H7.5V13.5H4.5V15H7.5Z"/>\n </svg>',"delete-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4922 12.1533C16.4154 12.9097 15.7767 13.5 15 13.5L12 13.5V12H15V6L1.5 6L1.5 12H4.5V13.5H1.5C0.723337 13.5 0.0846104 12.9097 0.00781328 12.1533L7.86804e-07 12L1.04907e-06 6C1.17362e-06 5.22334 0.590278 4.58461 1.34668 4.50781L1.5 4.5L15 4.5C15.8284 4.5 16.5 5.17157 16.5 6V12L16.4922 12.1533Z"/>\n <path d="M10.3711 15.9316L8.25 13.8096L6.12793 15.9316L5.06738 14.8711L7.18945 12.75L5.06738 10.6289L6.12793 9.56836L8.25 11.6895L10.3711 9.56836L11.4316 10.6289L9.31055 12.75L11.4316 14.8711L10.3711 15.9316Z"/>\n </svg>',"toggle-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0.00781328 13.6533C0.0846108 14.4097 0.723337 15 1.5 15L15 15L15.1533 14.9922C15.8593 14.9205 16.4205 14.3593 16.4922 13.6533L16.5 13.5V4.5L16.4922 4.34668C16.4205 3.64069 15.8593 3.07949 15.1533 3.00781L15 3L1.5 3C0.671574 3 1.24863e-06 3.67157 1.18021e-06 4.5L7.86804e-07 13.5L0.00781328 13.6533ZM15 9V13.5L1.5 13.5L1.5 9L15 9Z"/>\n </svg>',"insert-column-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3H4.5V1.5H9V15H4.5V13.5H3V15C3 15.7767 3.59028 16.4154 4.34668 16.4922L4.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V1.5C16.5 0.671573 15.8284 6.03989e-09 15 0H4.5ZM15 15H10.5V1.5H15V15Z"/>\n <path d="M3 7.5H0V9H3V12H4.5V9H7.5V7.5H4.5V4.5H3V7.5Z"/>\n </svg>',"insert-column-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 0C14.3284 0 15 0.671573 15 1.5V3H13.5V1.5H9V15H13.5V13.5H15V15C15 15.7767 14.4097 16.4154 13.6533 16.4922L13.5 16.5H3L2.84668 16.4922C2.14069 16.4205 1.57949 15.8593 1.50781 15.1533L1.5 15V1.5C1.5 0.671573 2.17157 6.03989e-09 3 0H13.5ZM3 15H7.5V1.5H3V15Z"/>\n <path d="M15 7.5H18V9H15V12H13.5V9H10.5V7.5H13.5V4.5H15V7.5Z"/>\n </svg>',"delete-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1533 0.0078125C12.9097 0.0846097 13.5 0.723336 13.5 1.5V4.5H12V1.5H6V15H12V12H13.5V15C13.5 15.7767 12.9097 16.4154 12.1533 16.4922L12 16.5H6C5.22334 16.5 4.58461 15.9097 4.50781 15.1533L4.5 15V1.5C4.5 0.671573 5.17157 2.41596e-08 6 0H12L12.1533 0.0078125Z"/>\n <path d="M15.9316 6.12891L13.8105 8.24902L15.9326 10.3711L14.8711 11.4316L12.75 9.31055L10.6289 11.4316L9.56738 10.3711L11.6885 8.24902L9.56836 6.12891L10.6289 5.06836L12.75 7.18848L14.8711 5.06836L15.9316 6.12891Z"/>\n </svg>',"toggle-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.6533 17.9922C14.4097 17.9154 15 17.2767 15 16.5L15 3L14.9922 2.84668C14.9205 2.14069 14.3593 1.57949 13.6533 1.50781L13.5 1.5L4.5 1.5L4.34668 1.50781C3.59028 1.58461 3 2.22334 3 3L3 16.5C3 17.2767 3.59028 17.9154 4.34668 17.9922L4.5 18L13.5 18L13.6533 17.9922ZM9 3L13.5 3L13.5 16.5L9 16.5L9 3Z"/>\n </svg>',"delete-table":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n </svg>'};class Ax extends HTMLElement{#e=new bc;connectedCallback(){this.tableController=new Tx(this.#he),this.classList.add("lexxy-floating-controls"),this.#Q(),this.#bl(),this.#Ql(),this.#ea()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),this.tableController?.destroy(),this.tableController=null}get#ri(){return this.#he.editor}get#he(){return this.closest("lexxy-editor")}get#ta(){return Array.from(this.querySelectorAll("button, details > summary"))}#Q(){this.innerHTML="",this.appendChild(this.#na()),this.appendChild(this.#ra()),this.appendChild(this.#ia()),this.#e.track(yc(this,"keydown",this.#oa))}#sa(e,t,n){const r=xc("div",{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#se(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#se(`Remove ${e}`,{action:"delete",childType:e},"−"),s=xc("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=xc("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#na(){return this.#sa("row",(e=>{this.rowCount=e}),this.#la("row"))}#ra(){return this.#sa("column",(e=>{this.columnCount=e}),this.#la("column"))}#la(e){const t=xc("div",{className:"lexxy-floating-controls__group lexxy-table-control__more-menu-details"}),n=this.#se(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#se(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#se(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#se(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#ia(){const e=xc("div",{className:"lexxy-table-control lexxy-floating-controls__group"}),t=this.#se("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#se(e,t={},n=this.#aa(t)){const r=xc("button",{className:"lexxy-table-control__button","aria-label":e,type:"button"});return r.tabIndex=-1,r.innerHTML=`${n} <span>${e}</span>`,r.dataset.action=t.action,r.dataset.childType=t.childType,r.dataset.direction=t.direction,r.addEventListener("click",(()=>this.#ca(t))),r.addEventListener("mouseover",(()=>this.#ua())),r.addEventListener("focus",(()=>this.#ua())),r.addEventListener("mouseout",(()=>this.#ua())),r}#ea(){this.#e.track(this.#ri.registerCommand(An,this.#da,3))}#da=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#oa=e=>{"Escape"===e.key?this.#ha():Tc(this.#ta,e)};#ha(){const e=this.tableController.currentCell;e&&(this.#ri.update((()=>{e.select(),this.#ri.focus()})),this.#ga())}async#ua(){await Qc(),this.#pa();const e=this.querySelector("button:hover, button:focus");if(!e)return;const t={action:e.dataset.action,childType:e.dataset.childType,direction:e.dataset.direction};let n=null;switch(t.childType){case"row":n=this.tableController.currentRowCells;break;case"column":n=this.tableController.currentColumnCells;break;case"table":n=this.tableController.tableRows}n&&n.forEach((e=>{const n=this.#ri.getElementByKey(e.getKey());n&&(n.classList.toggle(qf.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#Ql(){this.#e.track(this.#ri.registerUpdateListener((()=>{this.#ri.getRootElement()&&this.tableController.updateSelectedTable()?this.#Al():this.#bl()})))}#ca(e){this.tableController.executeTableCommand(e),this.#ga()}#Al(){this.#fa(),this.style.display="flex",this.#ma(),this.#ya(),this.#ua()}#bl(){this.style.display="none",this.#pa()}#ga(){this.#fa(),this.#ma(),this.#ya(),this.#ua()}#ya(){this.querySelector("details[open]")?.removeAttribute("open")}#fa(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#ri.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#he.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#ma(){const e=this.tableController.currentTableNode;if(!e)return;const t=Cy(this.#ri,e);if(!t)return;const n=t.rows,r=t.columns;this.rowCount.textContent=`${n} row${1===n?"":"s"}`,this.columnCount.textContent=`${r} column${1===r?"":"s"}`}#ba(){const e=this.tableController.currentCell;if(!e)return;const t=this.#ri.getElementByKey(e.getKey());t&&t.classList.add(qf.tableCellFocus)}#pa(){this.#he.querySelectorAll(`.${qf.tableCellFocus}`)?.forEach((e=>{e.classList.remove(qf.tableCellFocus)})),this.#he.querySelectorAll(`.${qf.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(qf.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#ba()}#aa(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return Nx[r]}}function Lx(e=document){e.querySelectorAll("pre[data-language]:not([data-highlighted])").forEach((e=>{Ox(e)}))}function Ox(e){if("true"===e.dataset.highlighted)return;const t=e.getAttribute("data-language"),n=s.languages?.[t];if(!n)return;const{code:r,highlights:i}=function(e){const t=e.querySelector("code")||e,n=[];let r="";function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if("BR"===e.tagName)r+="\n";else if("MARK"===e.tagName){const t=r.length;for(const t of e.childNodes)i(t);const o=function(e){const t=[];e.style?.color&&t.push(`color: ${e.style.color};`);e.style?.backgroundColor&&t.push(`background-color: ${e.style.backgroundColor};`);return t.length>0?t.join(" "):null}(e);o&&n.push({start:t,end:r.length,style:o})}else for(const t of e.childNodes)i(t)}for(const e of t.childNodes)i(e);return{code:r,highlights:n}}(e),o=s.highlight(r,n,t);e.innerHTML=o,i.length>0&&function(e,t){for(const{start:n,end:r,style:i}of t)Fx(e,n,r,i)}(e,i),e.dataset.highlighted="true"}function Fx(e,t,n,r){const i=function(e){const t=[];let n=0;const r=document.createTreeWalker(e,4);let i;for(;i=r.nextNode();){const e=i.textContent.length;t.push({node:i,start:n,end:n+e}),n+=e}return t}(e);for(let e=i.length-1;e>=0;e--){const{node:o,start:s,end:l}=i[e],a=Math.max(t,s),c=Math.min(n,l);if(a>=c)continue;const u=a-s,d=c-s,h=o.textContent,g=o.parentNode,p=document.createElement("mark");p.setAttribute("style",r),p.textContent=h.slice(u,d),d<h.length&&g.insertBefore(document.createTextNode(h.slice(d)),o.nextSibling),g.insertBefore(p,o.nextSibling),u>0?o.textContent=h.slice(0,u):g.removeChild(o)}}class Ix{frozenLinkKey=null;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement}dispatchAttributesChange(e,t,n,r){vc(this.editorElement,"lexxy:attributes-change",{attributes:e,link:t?{href:t}:null,highlight:n,headingTag:r})}dispatchEditorInitialized(e){vc(this.editorElement,"lexxy:editor-initialized",e)}freeze(){let e=null;this.editorElement.editor?.getEditorState().read((()=>{const t=eo();if(!Mi(t))return;const n=uu(t.anchor.getNode(),hd);n&&(e=n.getKey())})),this.frozenLinkKey=e,this.editorContentElement.contentEditable="false"}thaw(){this.editorContentElement.contentEditable="true"}unlinkFrozenNode(){const e=this.frozenLinkKey;if(!e)return!1;const t=Rs(e);if(!fd(t))return this.frozenLinkKey=null,!1;const n=t.getChildren();for(const e of n)t.insertBefore(e);t.remove();const r=this.#_a(n),i=this.#xa(n);if(r&&i){const e=eo();Mi(e)&&(e.anchor.set(r.getKey(),0,"text"),e.focus.set(i.getKey(),i.getTextContent().length,"text"))}return this.frozenLinkKey=null,!0}#_a(e){for(const t of e){if(Ei(t))return t;if(Ho(t)){const e=this.#_a(t.getChildren());if(e)return e}}return null}#xa(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(Ei(n))return n;if(Ho(n)){const e=this.#xa(n.getChildren());if(e)return e}}return null}}const Rx=qg.configure;setTimeout((function(){const e={"lexxy-toolbar":Xc,"lexxy-toolbar-dropdown":eu,"lexxy-highlight-dropdown":ru,"lexxy-link-dropdown":vd,"lexxy-editor":yx,"lexxy-prompt":wx,"lexxy-code-language-picker":kx,"lexxy-node-delete-button":Ex,"lexxy-table-tools":Ax};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{Np as $createActionTextAttachmentNode,mb as $createActionTextAttachmentUploadNode,Ap as $isActionTextAttachmentNode,Yg as $isCustomActionTextAttachmentNode,Tp as ActionTextAttachmentNode,pb as ActionTextAttachmentUploadNode,Jg as CustomActionTextAttachmentNode,op as Extension,Kf as HorizontalDividerNode,Ix as NativeAdapter,wp as REWRITE_HISTORY_COMMAND,Rx as configure,Lx as highlightCode,Ox as highlightElement};
|