lexxy 0.1.5.beta → 0.1.6.beta

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d97469124d8bd00ee856e66f48d8d8e7899188baf9d25b1692e72a1387bb5434
4
- data.tar.gz: 0abfd04d0c32c8d4a6ee07d86deef71529370e9ab19755f64745d239e7d89002
3
+ metadata.gz: 95dd70e9626785ed8e6000a8059604fd9167dac784f0f519df7073d956d026f9
4
+ data.tar.gz: e19dbed9210bdcab8b18d1f600f649203d82d1aded49d787f17a3d6ecac03cdc
5
5
  SHA512:
6
- metadata.gz: 1331cfd0fd69bb5cbd89e23b398fea9bde0540fbf23e5cfe41a2bd3c40f451fa12d0d680606d50f1d881496bf8011a7e6008636cbffab91a161a6e59b86dcb81
7
- data.tar.gz: 215fccc8ae0711d1a644c1f34b21f4c96ec642405ef3947e51f731b921d50c755783c9b1ffe0e903ce41c09c687db0aa83fb8209a51fafe73ba8bd7778428e0f
6
+ metadata.gz: fff87ce1ccab767b8354f348af41d1829c359ba1b6f0b6dcefe337b0f70ae9de3ab66a3a909873460ea41b60cedf0d10f92adee638cdd40f0c92385728d71a9e
7
+ data.tar.gz: 77cf044d28b81ec57555a1fa880d848f29fa2e8b917e80a97f91217c2a023a160cf4d0b8f46e2d10c33a05bafd33d4cef7549c92b0941e0a77196a6e5be50d95
data/README.md CHANGED
@@ -75,7 +75,7 @@ You can opt out of this behavior by disabling this option in `application.rb`:
75
75
  config.lexxy.override_action_text_defaults = false
76
76
  ```
77
77
 
78
- If you do this, you can invoke Lexxy explicitly using the same helpers with a `lexxy_preffix`: `lexxy_rich_textarea_tag` and `form.lexxy_rich_text_area`.
78
+ If you do this, you can invoke Lexxy explicitly using the same helpers with a `lexxy` preffix: `lexxy_rich_textarea_tag` and `form.lexxy_rich_text_area`.
79
79
 
80
80
  This path is meant to let you incrementally move to Lexxy, or to use it in specific places while keeping Trix in others.
81
81
 
@@ -5827,10 +5827,6 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
5827
5827
  if (error) {
5828
5828
  this.#handleUploadError(figure);
5829
5829
  } else {
5830
- this.src = this.blobUrlTemplate
5831
- .replace(":signed_id", blob.signed_id)
5832
- .replace(":filename", encodeURIComponent(blob.filename));
5833
-
5834
5830
  this.#loadFigurePreviewFromBlob(blob, figure).then(() => {
5835
5831
  this.#showUploadedAttachment(figure, blob);
5836
5832
  });
@@ -5848,11 +5844,14 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
5848
5844
  this.editor.update(() => {
5849
5845
  const image = figure.querySelector("img");
5850
5846
 
5847
+ const src = this.blobUrlTemplate
5848
+ .replace(":signed_id", blob.signed_id)
5849
+ .replace(":filename", encodeURIComponent(blob.filename));
5851
5850
  const latest = us(this.getKey());
5852
5851
  if (latest) {
5853
5852
  latest.replace(new ActionTextAttachmentNode({
5854
5853
  sgid: blob.attachable_sgid,
5855
- src: blob.previewable ? blob.url : this.src,
5854
+ src: blob.previewable ? blob.url : src,
5856
5855
  altText: blob.filename,
5857
5856
  contentType: blob.content_type,
5858
5857
  fileName: blob.filename,
@@ -8550,4 +8549,9 @@ function highlightElement(preElement) {
8550
8549
  preElement.replaceWith(codeElement);
8551
8550
  }
8552
8551
 
8552
+ // Manual highlighting mode to prevent invocation on every page. See https://prismjs.com/docs/prism
8553
+ // This must happen before importing any Prism components
8554
+ window.Prism = window.Prism || {};
8555
+ Prism.manual = true;
8556
+
8553
8557
  export { highlightAll };
Binary file
Binary file
@@ -7,4 +7,4 @@ import{DirectUpload as e}from"@rails/activestorage";function t(e,...t){const n=n
7
7
  * @namespace
8
8
  * @public
9
9
  */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.`)}"undefined"!=typeof module&&module.exports&&(module.exports=Ja),"undefined"!=typeof global&&(global.Prism=Ja),Ja.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]},Ja.languages.markup.tag.inside["attr-value"].inside.entity=Ja.languages.markup.entity,Ja.languages.markup.doctype.inside["internal-subset"].inside=Ja.languages.markup,Ja.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(Ja.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Ja.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Ja.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},Ja.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Ja.languages.markup.tag,"addAttribute",{value:function(e,t){Ja.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:Ja.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Ja.languages.html=Ja.languages.markup,Ja.languages.mathml=Ja.languages.markup,Ja.languages.svg=Ja.languages.markup,Ja.languages.xml=Ja.languages.extend("markup",{}),Ja.languages.ssml=Ja.languages.xml,Ja.languages.atom=Ja.languages.xml,Ja.languages.rss=Ja.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"))}(Ja),Ja.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:/[{}[\];(),.:]/},Ja.languages.javascript=Ja.languages.extend("clike",{"class-name":[Ja.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}|\?\?=?|\?\.?|[~:]/}),Ja.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Ja.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:Ja.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:Ja.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Ja.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Ja.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:Ja.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Ja.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:Ja.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"}}),Ja.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Ja.languages.markup&&(Ja.languages.markup.tag.addInlined("script","javascript"),Ja.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")),Ja.languages.js=Ja.languages.javascript,function(){if(void 0!==Ja&&"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",n="loading",r="loaded",i="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+n+'"])';Ja.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),Ja.hooks.add("before-sanity-check",(function(s){var o=s.element;if(o.matches(i)){s.code="",o.setAttribute(t,n);var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=o.getAttribute("data-src"),c=s.language;if("none"===c){var u=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[u]||u}Ja.util.setLanguage(a,c),Ja.util.setLanguage(o,c);var d=Ja.plugins.autoloader;d&&d.loadLanguages(c),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)}(l,(function(e){o.setAttribute(t,r);var n=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]}}(o.getAttribute("data-range"));if(n){var i=e.split(/\r\n?|\n/g),s=n[0],l=null==n[1]?i.length:n[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(s,l).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(s+1))}a.textContent=e,Ja.highlightElement(a)}),(function(e){o.setAttribute(t,"failed"),a.textContent=e}))}})),Ja.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(i),r=0;t=n[r++];)Ja.highlightElement(t)}};var s=!1;Ja.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),Ja.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.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:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.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}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.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:Prism.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:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.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:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.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:Prism.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"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.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")),Prism.languages.js=Prism.languages.javascript,Prism.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]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.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},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.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:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.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})),s=/\|?[ \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+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),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 s=i.content[1],o=i.content[3];if(s&&o&&"code-language"===s.type&&"code-block"===o.type&&"string"==typeof s.content){var a=s.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(a=(/[a-z][\w-]*/i.exec(a)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,l]:o.alias.push(l):o.alias=[l]}}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 s=t.classes[r],c=/language-(.+)/.exec(s);if(c){n=c[1];break}}var u=e.languages[n];if(u)t.content=e.highlight(function(e){var t=e.replace(o,"");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)),l(n);var r=a[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 o=RegExp(e.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.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|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.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},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.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:Prism.languages.c}}}}),Prism.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 Prism.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"))}(Prism),Prism.languages.objectivec=Prism.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 Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.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:/[;[\]()`,.]/},function(e){var t=e.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:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.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:/![sra](?=[:}]$)/,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:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,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}(Prism),Prism.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:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),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}(Prism),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:/\./}}})}(Prism),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"])}(Prism);const Va=globalThis.Prism||window.Prism,Za=e=>{try{return!!e&&Va.languages.hasOwnProperty(e)}catch(e){return!1}};function Ya(e,t){for(const n of e.childNodes){if(gs(n)&&n.tagName===t)return!0;Ya(n,t)}return!1}const Xa="data-language",Qa="data-highlight-language";let el=class e extends Rr{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=Za(e)}createDOM(e){const t=document.createElement("code");Ao(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(Xa,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Qa,n)),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;return r?r!==i&&(t.setAttribute(Xa,r),this.__isSyntaxHighlightSupported&&t.setAttribute(Qa,r)):i&&(t.removeAttribute(Xa),e.__isSyntaxHighlightSupported&&t.removeAttribute(Qa)),!1}exportDOM(e){const t=document.createElement("pre");Ao(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(Xa,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Qa,n)),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||Ya(e,"BR"))?{conversion:rl,priority:1}:null,div:()=>({conversion:il,priority:1}),pre:()=>({conversion:rl,priority:0}),table:e=>ll(e)?{conversion:sl,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&ll(n)?{conversion:ol,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&ll(t)?{conversion:ol,priority:3}:null}}}static importJSON(e){return tl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,t=!0){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=ei();return this.insertAfter(e,t),e}const{anchor:i,focus:s}=e,o=(i.isBefore(s)?i:s).getNode();if(Cn(o)){let e=ml(o);const t=[];for(;;)if(Ln(e))t.push(An()),e=e.getNextSibling();else{if(!pl(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(gl(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const n=o.splitText(i.offset)[0],r=0===i.offset?0:1,s=n.getIndexWithinParent()+r,a=o.getParentOrThrow(),l=[an(),...t];a.splice(s,0,l);const c=t[t.length-1];c?c.select():0===i.offset?n.selectPrevious():n.getNextSibling().selectNext(0,0)}if(nl(o)){const{offset:t}=e.anchor;o.splice(t,0,[an()]),o.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=ei();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.__isSyntaxHighlightSupported=Za(e),t}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function tl(e){return as(new el(e))}function nl(e){return e instanceof el}function rl(e){return{node:tl(e.getAttribute(Xa))}}function il(e){const t=e,n=al(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(al(t))return!0;t=t.parentElement}return!1}(t)?{node:n?tl():null}:{node:null}}function sl(){return{node:tl()}}function ol(){return{node:null}}function al(e){return null!==e.style.fontFamily.match("monospace")}function ll(e){return e.classList.contains("js-file-line-container")}const cl={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"},ul={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};class dl extends mn{constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new dl(e.__text,e.__highlightType||void 0,e.__key)}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 Ao(t,hl(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=hl(n.theme,e.__highlightType),s=hl(n.theme,this.__highlightType);return i!==s&&(i&&Lo(t,i),s&&Ao(t,s)),r}static importJSON(e){return gl().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 tl()}}function hl(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function gl(e="",t){return as(new dl(e,t))}function pl(e){return e instanceof dl}function fl(e,t){let n=e;for(let r=Us(e,t);r&&(pl(r.origin)||Ln(r.origin));r=Po(r))n=r.origin;return n}function ml(e){return fl(e,"previous")}function yl(e){return fl(e,"next")}const _l={defaultLanguage:"javascript",tokenize(e,t){return Va.tokenize(e,Va.languages[t||""]||Va.languages[this.defaultLanguage])}};function bl(e,t,n){const r=e.getParent();nl(r)?Sl(r,t,n):pl(e)&&e.replace(Tn(e.__text))}function xl(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 s="1",o=1;for(let e=0;e<i;e++)ln(r[e])&&(s+="\n"+ ++o);n.setAttribute("data-gutter",s)}const kl=new Set;function Sl(e,t,n){const r=e.getKey();kl.has(r)||(kl.add(r),void 0===e.getLanguage()&&e.setLanguage(n.defaultLanguage),t.update((()=>{!function(e,t){const n=vi(e);if(!nl(n)||!n.isAttached())return;const r=Qn();if(!Mn(r))return void t();const i=r.anchor,s=i.offset,o="element"===i.type&&ln(n.getChildAtIndex(i.offset-1));let a=0;if(!o){const e=i.getNode();a=s+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(o?i.getNode().select(s,s):n.getChildren().some((e=>{const t=Cn(e);if(t||ln(e)){const n=e.getTextContentSize();if(t&&n>=a)return e.select(a,a),!0;a-=n}return!1})))}(r,(()=>{const t=vi(r);if(!nl(t)||!t.isAttached())return!1;const i=t.getTextContent(),s=vl(n.tokenize(i,t.getLanguage()||n.defaultLanguage)),o=function(e,t){let n=0;for(;n<e.length&&wl(e[n],t[n]);)n++;const r=e.length,i=t.length,s=Math.min(r,i)-n;let o=0;for(;o<s;)if(o++,!wl(e[r-o],t[i-o])){o--;break}const a=r-o;return{from:n,nodesForReplacement:t.slice(n,i-o),to:a}}(t.getChildren(),s),{from:a,to:l,nodesForReplacement:c}=o;return!(a===l&&!c.length||(e.splice(a,l-a,c),0))}))}),{onUpdate:()=>{kl.delete(r)},skipTransforms:!0}))}function vl(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(an()):"\t"===i?n.push(An()):i.length>0&&n.push(gl(i,t))}}else{const{content:e}=r;"string"==typeof e?n.push(...vl([e],r.type)):Array.isArray(e)&&n.push(...vl(e,r.type))}return n}function wl(e,t){return pl(e)&&pl(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Ln(e)&&Ln(t)||ln(e)&&ln(t)}function Tl(e){if(!Mn(e))return!1;const t=e.anchor.getNode(),n=nl(t)?t:t.getParent(),r=e.focus.getNode(),i=nl(r)?r:r.getParent();return nl(n)&&n.is(i)}function Cl(e){const t=e.getNodes(),n=[];if(1===t.length&&nl(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];pl(i)||Ln(i)||ln(i)||Ga(169),ln(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Fn(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function El(e){const t=Qn();if(!Mn(t)||!Tl(t))return!1;const n=Cl(t),r=n.length;if(0===r&&t.isCollapsed())return e===dt&&t.insertNodes([An()]),!0;if(0===r&&e===dt&&"\n"===t.getTextContent()){const e=An(),n=an(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),so(mo(Zs(Ws(e,"next",0),go(Us(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=ml(n)),e===dt){const e=An();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Fn(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Ln(n)&&n.remove()}}return!0}function Nl(e,t){const n=Qn();if(!Mn(n))return!1;const{anchor:r,focus:i}=n,s=r.offset,o=i.offset,a=r.getNode(),l=i.getNode(),c=e===nt;if(!Tl(n)||!pl(a)&&!Ln(a)||!pl(l)&&!Ln(l))return!1;if(!t.altKey){if(n.isCollapsed()){const e=a.getParentOrThrow();if(c&&0===s&&null===a.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&s===a.getTextContentSize()&&null===a.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(a.isBefore(l)?(u=ml(a),d=yl(l)):(u=ml(l),d=yl(a)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;e<h.length;e++){const t=h[e];if(!pl(t)&&!Ln(t)&&!ln(t))return!1}t.preventDefault(),t.stopPropagation();const g=c?u.getPreviousSibling():d.getNextSibling();if(!ln(g))return!0;const p=c?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;const f=pl(p)||Ln(p)||ln(p)?c?ml(p):yl(p):null;let m=null!=f?f:p;return g.remove(),h.forEach((e=>e.remove())),e===nt?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(a,s,l,o),!0}function Al(e,t){const n=Qn();if(!Mn(n))return!1;const{anchor:r,focus:i}=n,s=r.getNode(),o=i.getNode(),a=e===tt;if(!Tl(n)||!pl(s)&&!Ln(s)||!pl(o)&&!Ln(o))return!1;if(a){const e=function(e,t){let n=null,r=null,i=e,s=t,o=e.getTextContent();for(;;){if(0===s){if(i=i.getPreviousSibling(),null===i)break;if(pl(i)||Ln(i)||ln(i)||Ga(167),ln(i)){n={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const e=o[s];pl(i)&&" "!==e&&(r={node:i,offset:s})}if(null!==r)return r;let a=null;if(t<e.getTextContentSize())pl(e)&&(a=e.getTextContent()[t]);else{const t=e.getNextSibling();pl(t)&&(a=t.getTextContent()[0])}if(null!==a&&" "!==a)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),s=e.getTextContentSize();for(;;){if(!pl(n)||r===s){if(n=n.getNextSibling(),null===n||ln(n))return null;pl(n)&&(r=0,i=n.getTextContent(),s=n.getTextContentSize())}if(pl(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}(o,i.offset);if(null!==e){const{node:t,offset:r}=e;ln(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else o.getParentOrThrow().selectStart()}else(function(e){const t=yl(e);return ln(t)&&Ga(168),t})(o).select();return t.preventDefault(),t.stopPropagation(),!0}const Ll=new Set(["http:","https:","mailto:","sms:","tel:"]);let Pl=class e extends Rr{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:s=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),Ao(t,e.theme.link),t}updateLinkDOM(e,t,n){if(hs(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:Fl,priority:1})}}static importJSON(e){return Ol().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=Wl(e);try{const t=new URL(Wl(e));if(!Ll.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=Ol(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Mn(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://")}};function Fl(e){let t=null;if(hs(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Ol(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Ol(e="",t){return as(new Pl(e,t))}function Il(e){return e instanceof Pl}let Rl=class e extends Pl{constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.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)}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 Ml().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=this.getParentOrThrow().insertNewAfter(e,t);if(Mr(n)){const e=Ml(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function Ml(e="",t){return as(new Rl(e,t))}function Dl(e){return e instanceof Rl}function zl(e,t){if("element"===e.type){const n=e.getNode();return Mr(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 Bl(e,t={}){const{target:n,title:r}=t,i=void 0===t.rel?"noreferrer":t.rel,s=Qn();if(null===s||!Mn(s)&&!zn(s))return;if(zn(s)){const t=s.getNodes();if(0===t.length)return;return void t.forEach((t=>{if(null===e){const e=Io(t,(e=>!Dl(e)&&Il(e)));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const r=Io(t,(e=>!Dl(e)&&Il(e)));if(r)r.setURL(e),void 0!==n&&r.setTarget(n),void 0!==i&&r.setRel(i);else{const r=Ol(e,{rel:i,target:n});t.insertBefore(r),r.append(t)}}}))}const o=s.extract();if(null===e)return void o.forEach((e=>{const t=Io(e,(e=>!Dl(e)&&Il(e)));if(t){const e=t.getChildren();for(let n=0;n<e.length;n++)t.insertBefore(e[n]);t.remove()}}));const a=new Set,l=t=>{a.has(t.getKey())||(a.add(t.getKey()),t.setURL(e),void 0!==n&&t.setTarget(n),void 0!==i&&t.setRel(i),void 0!==r&&t.setTitle(r))};if(1===o.length){const e=$l(o[0],Il);if(null!==e)return l(e)}!function(e){const t=Qn();if(!Mn(t))return e();const n=Q(t),r=n.isBackward(),i=zl(n.anchor,r?-1:0),s=zl(n.focus,r?0:-1);if(e(),i||s){const e=Qn();if(Mn(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(s){const e=s.getParent();e&&t.focus.set(e.getKey(),s.getIndexWithinParent()+(r?0:1),"element")}Pi(Q(t))}}}((()=>{let t=null;for(const s of o){if(!s.isAttached())continue;const o=$l(s,Il);if(o){l(o);continue}if(Mr(s)){if(!s.isInline())continue;if(Il(s)){if(!(Dl(s)||null!==t&&t.getParentOrThrow().isParentOf(s))){l(s),t=s;continue}for(const e of s.getChildren())s.insertBefore(e);s.remove();continue}}const a=s.getPreviousSibling();Il(a)&&a.is(t)?a.append(s):(t=Ol(e,{rel:i,target:n,title:r}),s.insertAfter(t),t.append(s))}}))}function $l(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}const Ul=/^\+?[0-9\s()-]{5,}$/;function Wl(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Ul.test(e)?`tel:${e}`:`https://${e}`}function Kl(e){let t=e;for(;null!==t;){if(Qo(t))return t;t=t.getParent()}return null}function Hl(e){let t=e;for(;t;){if(oa(t))return t.getListType();t=t.getParent()}return null}class jl extends HTMLElement{constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar"}connectedCallback(){this.#e(),window.addEventListener("resize",this.#e)}disconnectedCallback(){window.removeEventListener("resize",this.#e)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.#t(),this.#n(),this.#r(),this.#i()}#t(){this.addEventListener("click",this.#s.bind(this))}#s({target:e}){this.#o(e,"[data-command]",this.#a.bind(this)),this.#o(e,"[data-dialog-target]",this.#l.bind(this))}#o(e,t,n){const r=e.closest(t);r&&n(r)}#a(e){const{command:t,payload:n}=e.dataset;this.editor.dispatchCommand(t,n)}#l(e){const t=document.getElementById(e.dataset.dialogTarget).parentNode;t.open?t.close():t.show()}#n(){this.editorElement.addEventListener("keydown",(e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#c(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))}))}#c(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("+")}#r(){const e=parseInt(this.editorElement.editorContentElement.getAttribute("tabindex")??"0");this.#u.forEach(((t,n)=>{t.setAttribute("tabindex",`${e+n+1}`)}))}#i(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#d()}))}))}#d(){const e=Qn();if(!Mn(e))return;const t=e.anchor.getNode();if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e.hasFormat("bold"),i=e.hasFormat("italic"),s=nl(n)||e.hasFormat("code"),o=this.#h(t),a=Hl(t),l=Ra(n),c=Ua(n),u=this.#g(t);this.#p("bold",r),this.#p("italic",i),this.#p("code",s),this.#p("unordered-list",o&&"bullet"===a),this.#p("ordered-list",o&&"number"===a),this.#p("quote",l),this.#p("heading",c),this.#p("link",u)}#f(e){return e.getNodes().some((e=>{if(pl(e))return!0;if(Cn(e)){const t=e.getParent();if(t&&pl(t))return!0}return!1}))}#h(e){let t=e;for(;t;){if(oa(t)||Qo(t))return!0;t=t.getParent()}return!1}#g(e){let t=e;for(;t;){if(Il(t))return!0;t=t.getParent()}return!1}#p(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#m(){return this.scrollWidth>this.clientWidth}#e=()=>{this.#y(),this.#_(),this.#b.style.display=this.#x.children.length?"block":"none"};get#b(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#x(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}#y(){for(;this.#x.children.length>0;)this.insertBefore(this.#x.children[0],this.#b)}#_(){const e=this.#u.reverse();let t=!1;for(const n of e){if(!this.#m()){t&&this.#x.appendChild(n);break}this.#x.appendChild(n),t=!0}}get#u(){return Array.from(this.querySelectorAll(":scope > button"))}static get defaultTemplate(){return'\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5 22V2h8.183c1.764 0 3.174.435 4.228 1.304 1.055.87 1.582 2.076 1.582 3.62 0 .8-.148 1.503-.445 2.109a3.94 3.94 0 01-1.194 1.465 4.866 4.866 0 01-1.726.806v.176c.786.078 1.51.312 2.172.703a4.293 4.293 0 011.596 1.627c.403.693.604 1.543.604 2.549 0 1.192-.292 2.207-.877 3.048-.585.84-1.39 1.484-2.416 1.934-1.026.44-2.206.659-3.538.659H5zM8.854 4.974v5.348h2.56c.873 0 1.582-.107 2.129-.322.556-.215.963-.523 1.222-.923.269-.41.403-.904.403-1.48 0-.82-.254-1.46-.762-1.92-.499-.468-1.204-.703-2.115-.703H8.854zm0 8.103v5.949h2.877c1.534 0 2.636-.245 3.307-.733.671-.498 1.007-1.221 1.007-2.168 0-.635-.134-1.178-.403-1.627-.268-.459-.666-.81-1.193-1.055-.518-.244-1.156-.366-1.913-.366H8.854z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.1 4h-1.5l-3.2 16h1.5l-.4 2h-7l.4-2h1.5l3.2-16h-1.5l.4-2h7l-.4 2z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="link" title="Link" data-dialog-target="link-dialog" data-hotkey="cmd+k ctrl+k">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.111 9.546a1.5 1.5 0 012.121 0 5.5 5.5 0 010 7.778l-2.828 2.828a5.5 5.5 0 01-7.778 0 5.498 5.498 0 010-7.777l2.828-2.83a1.5 1.5 0 01.355-.262 6.52 6.52 0 00.351 3.799l-1.413 1.414a2.499 2.499 0 000 3.535 2.499 2.499 0 003.535 0l2.83-2.828a2.5 2.5 0 000-3.536 1.5 1.5 0 010-2.121z"/><path d="M12.111 3.89a5.5 5.5 0 117.778 7.777l-2.828 2.829a1.496 1.496 0 01-.355.262 6.522 6.522 0 00-.351-3.8l1.413-1.412a2.5 2.5 0 10-3.536-3.535l-2.828 2.828a2.5 2.5 0 000 3.536 1.5 1.5 0 01-2.122 2.12 5.5 5.5 0 010-7.777l2.83-2.829z"/></svg>\n </button>\n\n <lexxy-link-dialog class="lexxy-link-dialog">\n <dialog id="link-dialog" closedby="any">\n <form method="dialog">\n <input type="url" placeholder="Enter a URL…" class="input" required>\n <div class="lexxy-dialog-actions">\n <button type="submit" class="btn" value="link">Link</button>\n <button type="button" class="btn" value="unlink">Unlink</button>\n </div>\n </form>\n </dialog>\n </lexxy-link-dialog>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 5C8.985 5 11 7.09 11 9.667c0 2.694-.962 5.005-2.187 6.644-.613.82-1.3 1.481-1.978 1.943-.668.454-1.375.746-2.022.746a.563.563 0 01-.52-.36.602.602 0 01.067-.57l.055-.066.009-.009.041-.048a4.25 4.25 0 00.168-.21c.143-.188.336-.47.53-.84a6.743 6.743 0 00.75-2.605C3.705 13.994 2 12.038 2 9.667 2 7.089 4.015 5 6.5 5zM17.5 5C19.985 5 22 7.09 22 9.667c0 2.694-.962 5.005-2.187 6.644-.613.82-1.3 1.481-1.978 1.943-.668.454-1.375.746-2.023.746a.563.563 0 01-.52-.36.602.602 0 01.068-.57l.055-.066.009-.009.041-.048c.039-.045.097-.115.168-.21a6.16 6.16 0 00.53-.84 6.745 6.745 0 00.75-2.605C14.705 13.994 13 12.038 13 9.667 13 7.089 15.015 5 17.5 5z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="heading" data-command="rotateHeadingFormat" title="Heading">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M15.322 5.315H9.64V22H5.684V5.315H0v-3.31h15.322v3.31z"/><path d="M23.957 11.79H19.92V22h-3.402V11.79H12.48V9.137h11.477v2.653z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M10.121 6l-6 6 6 6-2.12 2.121-7.061-7.06a1.5 1.5 0 010-2.121L8 3.879 10.121 6zM23.06 10.94a1.5 1.5 0 010 2.12L16 20.121 13.88 18l6-6-6-6L16 3.879l7.06 7.06z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5 5a2 2 0 11-4 0 2 2 0 014 0zM5 12a2 2 0 11-4 0 2 2 0 014 0zM5 19a2 2 0 11-4 0 2 2 0 014 0zM7 5.25C7 4.56 7.56 4 8.25 4h13.5a1.25 1.25 0 110 2.5H8.25C7.56 6.5 7 5.94 7 5.25zM7 12.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM7 19.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.25C7 4.56 7.56 4 8.25 4h13.5a1.25 1.25 0 110 2.5H8.25C7.56 6.5 7 5.94 7 5.25zM7 12.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM7 19.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM4.438 8H3.39V3.684H3.34c-.133.093-.267.188-.402.285l-.407.289a129.5 129.5 0 00-.402.285v-.969l.633-.453c.21-.15.42-.302.629-.453h1.046V8zM2.672 11.258h-1v-.051c0-.206.036-.405.11-.598.075-.195.188-.37.34-.527.15-.156.339-.281.566-.375.229-.094.498-.14.808-.14.367 0 .688.065.961.195s.484.308.633.535c.15.224.226.478.226.762 0 .244-.046.463-.14.656-.091.19-.209.368-.352.535-.14.164-.289.332-.445.504L3.168 14.09v.05h2.238V15H1.723v-.656l1.949-2.102c.096-.101.19-.207.281-.316.091-.112.167-.232.227-.36a.953.953 0 00.09-.41.712.712 0 00-.387-.648.845.845 0 00-.41-.098.81.81 0 00-.43.11.75.75 0 00-.277.293.824.824 0 00-.094.386V11.258zM2.852 19.66v-.812h.562a.917.917 0 00.43-.098.742.742 0 00.293-.266.673.673 0 00.101-.379.654.654 0 00-.234-.523.87.87 0 00-.59-.2.987.987 0 00-.336.055.837.837 0 00-.258.149.712.712 0 00-.172.215.66.66 0 00-.066.25h-.98c.007-.209.053-.403.136-.582.084-.18.203-.336.36-.469.156-.135.346-.24.57-.316.227-.076.486-.115.777-.118a2.33 2.33 0 01.965.176c.271.12.48.285.63.496.15.209.227.448.23.719a1.11 1.11 0 01-.16.637 1.28 1.28 0 01-.825.586v.054c.162.016.33.07.504.164.177.094.328.232.453.415.125.18.189.411.192.695a1.37 1.37 0 01-.157.676c-.104.197-.25.365-.437.503-.188.136-.404.24-.649.313-.242.07-.5.105-.777.105-.401 0-.743-.067-1.027-.203a1.608 1.608 0 01-.649-.547 1.46 1.46 0 01-.238-.75h.969c.01.128.057.243.14.344a.885.885 0 00.332.238c.141.058.3.088.477.09.195 0 .366-.034.512-.101a.798.798 0 00.336-.29.744.744 0 00.117-.425.74.74 0 00-.446-.695 1.082 1.082 0 00-.496-.106h-.59z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="upload" data-command="uploadAttachments" title="Upload file">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16 8a2 2 0 110 4 2 2 0 010-4z""/><path d="M22 2a1 1 0 011 1v18a1 1 0 01-1 1H2a1 1 0 01-1-1V3a1 1 0 011-1h20zM3 18.714L9 11l5.25 6.75L17 15l4 4V4H3v14.714z"/></svg>\n </button>\n\n <details class="lexxy-editor__toolbar-overflow">\n <summary class="lexxy-editor__toolbar-button" aria-label="Show more toolbar buttons">•••</summary>\n <div class="lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons"></div>\n </details>\n '}}function ql(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}customElements.define("lexxy-toolbar",jl);const Jl=/[!-/:-@[-`{-~\s]/;function Gl(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 Vl(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(Zl(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function Zl(e,t,n,r,i){for(let s=0;s<i;s++)if(e[t+s]!==n[r+s])return!1;return!0}function Yl(e,t=ac){const n=function(e){const t=ql(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=ql(n.textFormat,(({tag:e})=>e[e.length-1])),i=ql(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)||Gl(173,n.getType())}}const s=(e,t,s)=>{(function(e,t,n,r){if(!os(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:s,replace:o}of r){const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,!1))return s.remove(),!0}}return!1})(e,t,s,n.element)||function(e,t,n,r){if(!os(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:s,replace:o,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,null,null,!1))return s.remove(),!0}}return!1}(e,t,s,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,s=i+n[0].length;let o;return 0===i?[o]=e.splitText(s):[,o]=e.splitText(i,s),o.selectNext(0,0),t.replace(o,n),!0}return!1}(t,s,i)||function(e,t,n){const r=e.getTextContent(),i=t-1,s=r[i],o=n[s];if(!o)return!1;for(const t of o){const{tag:n}=t,o=n.length,a=i-o+1;if(o>1&&!Zl(r,a,n,0,o))continue;if(" "===r[a-1])continue;const l=r[i+1];if(!1===t.intraword&&l&&!Jl.test(l))continue;const c=e;let u=c,d=Vl(r,a,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!ln(h);)if(Cn(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=Vl(e,e.length,n)}if(d<0)continue;if(u===c&&d+o===a)continue;const g=u.getTextContent();if(d>0&&g[d-1]===s)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Jl.test(p))continue;const f=c.getTextContent(),m=f.slice(0,a)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+o));const _=Qn(),b=Zn();Pi(b);const x=i-o*(u===c?2:1)+1;b.anchor.set(u.__key,d,"text"),b.focus.set(c.__key,x,"text");for(const e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return Mn(_)&&(b.format=_.format),!0}}(t,s,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Gr)||t.has(qr))return;if(e.isComposing())return;const o=r.read(Qn),a=i.read(Qn);if(!Mn(a)||!Mn(o)||!o.isCollapsed()||o.is(a))return;const l=o.anchor.key,c=o.anchor.offset,u=r._nodeMap.get(l);!Cn(u)||!n.has(l)||1!==c&&c>a.anchor.offset+1||e.update((()=>{if(!function(e){return Cn(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||nl(e)||s(e,u,o.anchor.offset)}))}))}const Xl=e=>(t,n,r,i)=>{const s=e(r);s.append(...n),t.replace(s),i||s.select(0,0)},Ql=e=>(t,n,r,i)=>{const s=t.getPreviousSibling(),o=t.getNextSibling(),a=Xo("check"===e?"x"===r[3]:void 0);if(oa(o)&&o.getListType()===e){const e=o.getFirstChild();null!==e?e.insertBefore(a):o.append(a),t.remove()}else if(oa(s)&&s.getListType()===e)s.append(a),t.remove();else{const n=sa(e,"number"===e?Number(r[2]):void 0);n.append(a),t.replace(n)}a.append(...n),i||a.select(0,0);const l=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]);l&&a.setIndent(l)},ec=(e,t,n)=>{const r=[],i=e.getChildren();let s=0;for(const o of i)if(Qo(o)){if(1===o.getChildrenSize()){const e=o.getFirstChild();if(oa(e)){r.push(ec(e,t,n+1));continue}}const i=" ".repeat(4*n),a=e.getListType(),l="number"===a?`${e.getStart()+s}. `:"check"===a?`- [${o.getChecked()?"x":" "}] `:"- ";r.push(i+l+t(o)),s++}return r.join("\n")},tc={dependencies:[Ma],export:(e,t)=>{if(!Ua(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:Xl((e=>$a("h"+e[1].length))),type:"element"},nc={dependencies:[Oa],export:(e,t)=>{if(!Ra(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(Ra(n))return n.splice(n.getChildrenSize(),0,[an(),...t]),void e.remove()}const i=Ia();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},rc={dependencies:[el],export:e=>{if(!nl(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```(\w+)?/,replace:(e,t,n,r,i,s)=>{let o,a;if(!t&&i){if(1===i.length)r?(o=tl(),a=n[1]+i[0]):(o=tl(n[1]),a=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(o=tl(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();a=i.join("\n")}const t=Tn(a);o.append(t),e.append(o)}else t&&Xl((e=>tl(e?e[1]:void 0)))(e,t,n,s)},type:"multiline-element"},ic={dependencies:[ea,Vo],export:(e,t)=>oa(e)?ec(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ql("bullet"),type:"element"},sc={dependencies:[ea,Vo],export:(e,t)=>oa(e)?ec(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:Ql("number"),type:"element"},oc={dependencies:[Pl],export:(e,t,n)=>{if(!Il(e)||Dl(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,s=Ol(r,{title:i}),o=Tn(n);return o.setFormat(e.getFormat()),s.append(o),e.replace(s),o},trigger:")",type:"text-match"},ac=[...[tc,nc,ic,sc],...[rc],...[{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"}],...[oc]];function lc(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const s=t._selection,o=e._selection;if(i)return 1;if(!(Mn(s)&&Mn(o)&&o.isCollapsed()&&s.isCollapsed()))return 0;const a=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||Ur(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){const n=t._nodeMap,r=n.get(s.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Cn(r)&&1===r.__text.length&&1===s.anchor.offset?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!Cn(c)||!Cn(l)||c.__mode!==l.__mode)return 0;const u=c.__text,d=l.__text;if(u===d)return 0;const h=s.anchor,g=o.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}function cc(e,t){let n=Date.now(),r=0;return(i,s,o,a,l,c)=>{const u=Date.now();if(c.has(qr))return r=0,n=u,2;const d=lc(i,s,a,l,e.isComposing()),h=(()=>{const h=null===o||o.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Jr))return 0;if(null===i)return 1;const p=s._selection;return a.size>0||l.size>0?!1===g&&0!==d&&d===r&&u<n+t&&h||1===a.size&&function(e,t,n){const r=t._nodeMap.get(e),i=n._nodeMap.get(e),s=t._selection,o=n._selection;return!(Mn(s)&&Mn(o)&&"element"===s.anchor.type&&"element"===s.focus.type&&"text"===o.anchor.type&&"text"===o.focus.type||!Cn(r)||!Cn(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(a)[0],i,s)?0:1:null!==p?0:2})();return n=u,r=d,h}}function uc(e){e.undoStack=[],e.redoStack=[],e.current=null}var dc={codeHighlight:{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__property",decorator:"code-token__function",deleted:"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__variable",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",namespace:"code-token__variable",number:"code-token__property",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation",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",url:"code-token__operator",variable:"code-token__variable"}};
10
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:hc,setPrototypeOf:gc,isFrozen:pc,getPrototypeOf:fc,getOwnPropertyDescriptor:mc}=Object;let{freeze:yc,seal:_c,create:bc}=Object,{apply:xc,construct:kc}="undefined"!=typeof Reflect&&Reflect;yc||(yc=function(e){return e}),_c||(_c=function(e){return e}),xc||(xc=function(e,t,n){return e.apply(t,n)}),kc||(kc=function(e,t){return new e(...t)});const Sc=Dc(Array.prototype.forEach),vc=Dc(Array.prototype.lastIndexOf),wc=Dc(Array.prototype.pop),Tc=Dc(Array.prototype.push),Cc=Dc(Array.prototype.splice),Ec=Dc(String.prototype.toLowerCase),Nc=Dc(String.prototype.toString),Ac=Dc(String.prototype.match),Lc=Dc(String.prototype.replace),Pc=Dc(String.prototype.indexOf),Fc=Dc(String.prototype.trim),Oc=Dc(Object.prototype.hasOwnProperty),Ic=Dc(RegExp.prototype.test),Rc=(Mc=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return kc(Mc,t)});var Mc;function Dc(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 xc(e,t,r)}}function zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ec;gc&&gc(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(pc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Bc(e){for(let t=0;t<e.length;t++){Oc(e,t)||(e[t]=null)}return e}function $c(e){const t=bc(null);for(const[n,r]of hc(e)){Oc(e,n)&&(Array.isArray(r)?t[n]=Bc(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=$c(r):t[n]=r)}return t}function Uc(e,t){for(;null!==e;){const n=mc(e,t);if(n){if(n.get)return Dc(n.get);if("function"==typeof n.value)return Dc(n.value)}e=fc(e)}return function(){return null}}const Wc=yc(["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","section","select","shadow","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"]),Kc=yc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hc=yc(["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"]),jc=yc(["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"]),qc=yc(["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"]),Jc=yc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=yc(["#text"]),Vc=yc(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Zc=yc(["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","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"]),Yc=yc(["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"]),Xc=yc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qc=_c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eu=_c(/<%[\w\W]*|[\w\W]*%>/gm),tu=_c(/\$\{[\w\W]*/gm),nu=_c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ru=_c(/^aria-[\-\w]+$/),iu=_c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),su=_c(/^(?:\w+script|data):/i),ou=_c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),au=_c(/^html$/i),lu=_c(/^[a-z][.\w]*(-[.\w]+)+$/i);var cu=Object.freeze({__proto__:null,ARIA_ATTR:ru,ATTR_WHITESPACE:ou,CUSTOM_ELEMENT:lu,DATA_ATTR:nu,DOCTYPE_NAME:au,ERB_EXPR:eu,IS_ALLOWED_URI:iu,IS_SCRIPT_OR_DATA:su,MUSTACHE_EXPR:Qc,TMPLIT_EXPR:tu});const uu=1,du=3,hu=7,gu=8,pu=9,fu=function(){return"undefined"==typeof window?null:window};var mu=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fu();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==pu||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:p}=t,f=c.prototype,m=Uc(f,"cloneNode"),y=Uc(f,"remove"),_=Uc(f,"nextSibling"),b=Uc(f,"childNodes"),x=Uc(f,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let k,S="";const{implementation:v,createNodeIterator:w,createDocumentFragment:T,getElementsByTagName:C}=r,{importNode:E}=i;let N={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof hc&&"function"==typeof x&&v&&void 0!==v.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:L,TMPLIT_EXPR:P,DATA_ATTR:F,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:M}=cu;let{IS_ALLOWED_URI:D}=cu,z=null;const B=zc({},[...Wc,...Kc,...Hc,...qc,...Gc]);let $=null;const U=zc({},[...Vc,...Zc,...Yc,...Xc]);let W=Object.seal(bc(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}})),K=null,H=null,j=!0,q=!0,J=!1,G=!0,V=!1,Z=!0,Y=!1,X=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!0,ie=!1,se=!0,oe=!1,ae={},le=null;const ce=zc({},["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 ue=null;const de=zc({},["audio","video","img","source","image","track"]);let he=null;const ge=zc({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",fe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,_e=!1,be=null;const xe=zc({},[pe,fe,me],Nc);let ke=zc({},["mi","mo","mn","ms","mtext"]),Se=zc({},["annotation-xml"]);const ve=zc({},["title","style","font","a","script"]);let we=null;const Te=["application/xhtml+xml","text/html"];let Ce=null,Ee=null;const Ne=r.createElement("form"),Ae=function(e){return e instanceof RegExp||e instanceof Function},Le=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=$c(e),we=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ce="application/xhtml+xml"===we?Nc:Ec,z=Oc(e,"ALLOWED_TAGS")?zc({},e.ALLOWED_TAGS,Ce):B,$=Oc(e,"ALLOWED_ATTR")?zc({},e.ALLOWED_ATTR,Ce):U,be=Oc(e,"ALLOWED_NAMESPACES")?zc({},e.ALLOWED_NAMESPACES,Nc):xe,he=Oc(e,"ADD_URI_SAFE_ATTR")?zc($c(ge),e.ADD_URI_SAFE_ATTR,Ce):ge,ue=Oc(e,"ADD_DATA_URI_TAGS")?zc($c(de),e.ADD_DATA_URI_TAGS,Ce):de,le=Oc(e,"FORBID_CONTENTS")?zc({},e.FORBID_CONTENTS,Ce):ce,K=Oc(e,"FORBID_TAGS")?zc({},e.FORBID_TAGS,Ce):$c({}),H=Oc(e,"FORBID_ATTR")?zc({},e.FORBID_ATTR,Ce):$c({}),ae=!!Oc(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,V=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,Y=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,re=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||iu,ye=e.NAMESPACE||me,ke=e.MATHML_TEXT_INTEGRATION_POINTS||ke,Se=e.HTML_INTEGRATION_POINTS||Se,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(W.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(q=!1),te&&(ee=!0),ae&&(z=zc({},Gc),$=[],!0===ae.html&&(zc(z,Wc),zc($,Vc)),!0===ae.svg&&(zc(z,Kc),zc($,Zc),zc($,Xc)),!0===ae.svgFilters&&(zc(z,Hc),zc($,Zc),zc($,Xc)),!0===ae.mathMl&&(zc(z,qc),zc($,Yc),zc($,Xc))),e.ADD_TAGS&&(z===B&&(z=$c(z)),zc(z,e.ADD_TAGS,Ce)),e.ADD_ATTR&&($===U&&($=$c($)),zc($,e.ADD_ATTR,Ce)),e.ADD_URI_SAFE_ATTR&&zc(he,e.ADD_URI_SAFE_ATTR,Ce),e.FORBID_CONTENTS&&(le===ce&&(le=$c(le)),zc(le,e.FORBID_CONTENTS,Ce)),se&&(z["#text"]=!0),Y&&zc(z,["html","head","body"]),z.table&&(zc(z,["tbody"]),delete K.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Rc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Rc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=e.TRUSTED_TYPES_POLICY,S=k.createHTML("")}else void 0===k&&(k=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}}(p,s)),null!==k&&"string"==typeof S&&(S=k.createHTML(""));yc&&yc(e),Ee=e}},Pe=zc({},[...Kc,...Hc,...jc]),Fe=zc({},[...qc,...Jc]),Oe=function(e){Tc(n.removed,{element:e});try{x(e).removeChild(e)}catch(t){y(e)}},Ie=function(e,t){try{Tc(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Tc(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=Ac(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===we&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=k?k.createHTML(e):e;if(ye===me)try{t=(new g).parseFromString(i,we)}catch(e){}if(!t||!t.documentElement){t=v.createDocument(ye,"template",null);try{t.documentElement.innerHTML=_e?S:i}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),ye===me?C.call(t,Y?"html":"body")[0]:Y?t.documentElement:s},Me=function(e){return w.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},De=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)},ze=function(e){return"function"==typeof l&&e instanceof l};function Be(e,t,r){Sc(e,(e=>{e.call(n,t,r,Ee)}))}const $e=function(e){let t=null;if(Be(N.beforeSanitizeElements,e,null),De(e))return Oe(e),!0;const r=Ce(e.nodeName);if(Be(N.uponSanitizeElement,e,{tagName:r,allowedTags:z}),Z&&e.hasChildNodes()&&!ze(e.firstElementChild)&&Ic(/<[/\w!]/g,e.innerHTML)&&Ic(/<[/\w!]/g,e.textContent))return Oe(e),!0;if(e.nodeType===hu)return Oe(e),!0;if(Z&&e.nodeType===gu&&Ic(/<[/\w]/g,e.data))return Oe(e),!0;if(!z[r]||K[r]){if(!K[r]&&We(r)){if(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,r))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(r))return!1}if(se&&!le[r]){const t=x(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=m(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,_(e))}}}return Oe(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Ec(e.tagName),r=Ec(t.tagName);return!!be[e.namespaceURI]&&(e.namespaceURI===fe?t.namespaceURI===me?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===r||ke[r]):Boolean(Pe[n]):e.namespaceURI===pe?t.namespaceURI===me?"math"===n:t.namespaceURI===fe?"math"===n&&Se[r]:Boolean(Fe[n]):e.namespaceURI===me?!(t.namespaceURI===fe&&!Se[r])&&!(t.namespaceURI===pe&&!ke[r])&&!Fe[n]&&(ve[n]||!Pe[n]):!("application/xhtml+xml"!==we||!be[e.namespaceURI]))}(e)?(Oe(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Ic(/<\/no(script|embed|frames)/i,e.innerHTML)?(V&&e.nodeType===du&&(t=e.textContent,Sc([A,L,P],(e=>{t=Lc(t,e," ")})),e.textContent!==t&&(Tc(n.removed,{element:e.cloneNode()}),e.textContent=t)),Be(N.afterSanitizeElements,e,null),!1):(Oe(e),!0)},Ue=function(e,t,n){if(re&&("id"===t||"name"===t)&&(n in r||n in Ne))return!1;if(q&&!H[t]&&Ic(F,t));else if(j&&Ic(O,t));else if(!$[t]||H[t]){if(!(We(e)&&(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&Ic(W.attributeNameCheck,t)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(t))||"is"===t&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,n)||W.tagNameCheck instanceof Function&&W.tagNameCheck(n))))return!1}else if(he[t]);else if(Ic(D,Lc(n,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Pc(n,"data:")||!ue[e]){if(J&&!Ic(I,Lc(n,R,"")));else if(n)return!1}else;return!0},We=function(e){return"annotation-xml"!==e&&Ac(e,M)},Ke=function(e){Be(N.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||De(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let i=t.length;for(;i--;){const s=t[i],{name:o,namespaceURI:a,value:l}=s,c=Ce(o),u=l;let d="value"===o?u:Fc(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Be(N.uponSanitizeAttribute,e,r),d=r.attrValue,!ie||"id"!==c&&"name"!==c||(Ie(o,e),d="user-content-"+d),Z&&Ic(/((--!?|])>)|<\/(style|title)/i,d)){Ie(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ie(o,e);continue}if(!G&&Ic(/\/>/i,d)){Ie(o,e);continue}V&&Sc([A,L,P],(e=>{d=Lc(d,e," ")}));const h=Ce(e.nodeName);if(Ue(h,c,d)){if(k&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(a);else switch(p.getAttributeType(h,c)){case"TrustedHTML":d=k.createHTML(d);break;case"TrustedScriptURL":d=k.createScriptURL(d)}if(d!==u)try{a?e.setAttributeNS(a,o,d):e.setAttribute(o,d),De(e)?Oe(e):wc(n.removed)}catch(t){Ie(o,e)}}else Ie(o,e)}Be(N.afterSanitizeAttributes,e,null)},He=function e(t){let n=null;const r=Me(t);for(Be(N.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Be(N.uponSanitizeShadowNode,n,null),$e(n),Ke(n),n.content instanceof o&&e(n.content);Be(N.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,s=null,a=null,c=null;if(_e=!e,_e&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ze(e)){if("function"!=typeof e.toString)throw Rc("toString is not a function");if("string"!=typeof(e=e.toString()))throw Rc("dirty is not a string, aborting")}if(!n.isSupported)return e;if(X||Le(t),n.removed=[],"string"==typeof e&&(oe=!1),oe){if(e.nodeName){const t=Ce(e.nodeName);if(!z[t]||K[t])throw Rc("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Re("\x3c!----\x3e"),s=r.ownerDocument.importNode(e,!0),s.nodeType===uu&&"BODY"===s.nodeName||"HTML"===s.nodeName?r=s:r.appendChild(s);else{if(!ee&&!V&&!Y&&-1===e.indexOf("<"))return k&&ne?k.createHTML(e):e;if(r=Re(e),!r)return ee?null:ne?S:""}r&&Q&&Oe(r.firstChild);const u=Me(oe?e:r);for(;a=u.nextNode();)$e(a),Ke(a),a.content instanceof o&&He(a.content);if(oe)return e;if(ee){if(te)for(c=T.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return($.shadowroot||$.shadowrootmode)&&(c=E.call(i,c,!0)),c}let d=Y?r.outerHTML:r.innerHTML;return Y&&z["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Ic(au,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),V&&Sc([A,L,P],(e=>{d=Lc(d,e," ")})),k&&ne?k.createHTML(d):d},n.setConfig=function(){Le(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),X=!0},n.clearConfig=function(){Ee=null,X=!1},n.isValidAttribute=function(e,t,n){Ee||Le({});const r=Ce(e),i=Ce(t);return Ue(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&Tc(N[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=vc(N[e],t);return-1===n?void 0:Cc(N[e],n,1)[0]}return wc(N[e])},n.removeHooks=function(e){N[e]=[]},n.removeAllHooks=function(){N={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function yu(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]}`}const _u=["img","video","audio","iframe","embed","object","picture","source","canvas","svg","math","form","input","textarea","select","button","code","blockquote"].join(","),bu=["a","action-text-attachment","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","i","img","li","ol","p","pre","q","strong","ul"],xu=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","title","url","width"];function ku(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function Su(e){return(new DOMParser).parseFromString(e,"text/html")}function vu(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function wu(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Tu(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Cu extends zr{static getType(){return"action_text_attachment"}static clone(e){return new Cu({...e},e.__key)}static importJSON(e){return new Cu({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Cu({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:e=>({conversion:()=>({node:new Cu({src:e.getAttribute("src"),contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1})}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:s,fileName:o,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=s||"",this.fileName=o,this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#k(e)})),this.isPreviewableAttachment?(e.appendChild(this.#S()),e.appendChild(this.#v())):(e.appendChild(this.#w()),e.appendChild(this.#T())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:ku("action-text-attachment",{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,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,ku("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#C(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#C||this.previewable}#S(){return ku("img",{src:this.src,alt:this.altText,...this.#E})}get#E(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#w(){return ku("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#T(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("strong",{className:"attachment__name",textContent:this.caption||this.fileName}),n=ku("span",{className:"attachment__size",textContent:yu(this.fileSize)});return e.appendChild(t),e.appendChild(n),e}#k(e){vu(e,"lexxy:internal:select-node",{key:this.getKey()})}#v(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("input",{type:"text",class:"input",value:this.caption,placeholder:this.fileName});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#N.bind(this)),t.addEventListener("keydown",this.#A.bind(this)),e.appendChild(t),e}#L(e){}#N(e){const t=e.target;t.placeholder=this.fileName,this.#P(t)}#P(e){vu(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#A(e){"Enter"===e.key&&(this.#P(e.target),vu(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Eu extends Cu{static getType(){return"action_text_attachment_upload"}static clone(e){return new Eu({...e},e.__key)}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},s){super({contentType:e.type},s),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#S()):e.appendChild(this.#w()),e.appendChild(this.#F());const t=ku("progress",{value:this.progress,max:100});return e.appendChild(t),this.#O(e).then((()=>this.#I(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}#S(){return ku("img")}#w(){return ku("span",{className:"attachment__icon",textContent:this.#R()})}#R(){return this.file.name.split(".").pop().toLowerCase()}#F(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("span",{className:"attachment__name",textContent:this.file.name||""}),n=ku("span",{className:"attachment__size",textContent:yu(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#O(e){const t=e.querySelector("img");return t?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,t):Promise.resolve()}#I(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#M(n):(this.src=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),this.#D(t,n).then((()=>{this.#z(n,t)})))}))}#M(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(ku("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#z(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=vi(this.getKey());r&&r.replace(new Cu({sgid:t.attachable_sgid,src:t.previewable?t.url:this.src,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Jr})}async#D(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#S();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}const Nu=["bold","rotateHeadingFormat","italic","link","unlink","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","uploadAttachments"];class Au{static configureFor(e){new Au(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#B(),this.#$()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(Ge,"bold")}dispatchItalic(){this.editor.dispatchCommand(Ge,"italic")}dispatchLink(e){this.#U(e)}dispatchUnlink(){this.#U(null)}dispatchInsertUnorderedList(){const e=Qn().anchor.getNode();this.selection.isInsideList&&e&&"bullet"===Hl(e)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(aa,void 0)}dispatchInsertOrderedList(){const e=Qn().anchor.getNode();this.selection.isInsideList&&e&&"number"===Hl(e)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(la,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedLines((e=>Ra(e)),(()=>Ia()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(Ge,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>nl(e)),(()=>new el("plain")))}))}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Ua(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>$a(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=ku("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}#B(){for(const t of Nu){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#W(t,0,this[n].bind(this))}var e;this.#W(He,1,this.dispatchPaste.bind(this))}#W(e,t,n){this.editor.registerCommand(e,n,t)}#U(e){this.editor.update((()=>{Bl(null===e?null:e)}))}#$(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#K.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#H.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#j.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#q.bind(this)))}#j(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#q(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#K(e){e.preventDefault()}#H(e){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);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}}function Lu(){return new Promise(requestAnimationFrame)}class Pu{constructor(e){this.editorElement=e,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#J(),this.#G()}clear(){this.current=null}set current(e){zn(e)?(this._current=Qn(),this.#V()):this.editor.update((()=>{this.#V(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#Z();if(!t)return;const n=this.#Y(t);n&&(e=this.#X(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{Ai().selectEnd()}))}get hasSelectedWordsInSingleLine(){const e=Qn();if(!Mn(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if(ln(e))return!1;return!0}get isInsideList(){const e=Qn();if(!Mn(e))return!1;return null!==Kl(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Q();return e?Cn(e)?this.#ee(e,t):Mr(e)?this.#te(e,t):this.#ne(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Q();return e?Cn(e)?this.#re(e,t):Mr(e)?this.#ie(e,t):this.#se(e):null}get#oe(){return this.editorElement.contents}get#ae(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;if(this._currentlySelectedKeys=new Set,this.current)for(const e of this.current.getNodes())this._currentlySelectedKeys.add(e.getKey());return this._currentlySelectedKeys}#G(){this.editor.registerCommand(et,this.#le.bind(this),1),this.editor.registerCommand(nt,this.#le.bind(this),1),this.editor.registerCommand(Xe,this.#ce.bind(this),1),this.editor.registerCommand(rt,this.#ce.bind(this),1),this.editor.registerCommand(lt,this.#ue.bind(this),1),this.editor.registerCommand(ot,this.#de.bind(this),1),this.editor.registerCommand(De,(()=>{this.current=Qn()}),1)}#J(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Lu();const{key:t}=e.detail;this.editor.update((()=>{const e=vi(t);if(e){const t=Yn();t.add(e.getKey()),Pi(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#he()}))}#V(){this.#ge(),this.#pe(),this.previouslySelectedKeys=this.#ae,this._currentlySelectedKeys=null}#ge(){for(const e of this.previouslySelectedKeys)if(!this.#ae.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#pe(){for(const e of this.#ae)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#le(){this.current?await this.#fe((e=>e.selectPrevious())):this.#me(this.nodeBeforeCursor)}async#ce(){this.current?await this.#fe((e=>e.selectNext(0,0))):this.#me(this.nodeAfterCursor)}async#fe(e){await Lu(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#he(){this.editor.update((()=>{const e=this.#ye();e&&this.#_e(e)}))}#ye(){const e=Qn();return e?zn(e)?this.#be(e):Mn(e)?this.#xe(e):null:null}#be(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#xe(e){return e.anchor.getNode().getTopLevelElement()}#_e(e){const t=e.getNextSibling();t?t.selectStart():this.#ke()}#ke(){const e=Ai(),t=ei();e.append(t),t.selectStart()}#me(e){e&&e instanceof zr&&this.editor.update((()=>{const t=Yn();t.add(e.getKey()),Pi(t)}))}#ue(){const e=this.nodeAfterCursor;return e instanceof zr?this.#me(e):this.#oe.deleteSelectedNodes(),!0}#de(){const e=this.nodeBeforeCursor;return e instanceof zr?this.#me(e):this.#oe.deleteSelectedNodes(),!0}#Z(){const e=Qn();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#Y(e){let t=e.getBoundingClientRect();if(this.#Se(t)){const n=this.#ve(e);t=n.getBoundingClientRect(),this.#we(n),n.remove()}return t}#Se(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#ve(e){const t=this.#Te();return e.insertNode(t),t}#Te(){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}#we(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#X(e,t){const n=this.editor.getRootElement().getBoundingClientRect();let r=e.left-n.left,i=e.top-n.top;const s=this.#Ce(t);return isNaN(s)||(i+=s),{x:r,y:i,fontSize:s}}#Ce(e){const t=window.getSelection().anchorNode,n=this.#Ee(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#Ee(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Q(){const e=Qn();if(!Mn(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#ee(e,t){return t===e.getTextContentSize()?this.#Ne(e):null}#Ne(e){if(e.getNextSibling()instanceof zr)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#te(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#ne(e)}#re(e,t){return 0===t?this.#Ae(e):null}#Ae(e){if(e.getPreviousSibling()instanceof zr)return e.getPreviousSibling();return e.getParent().getPreviousSibling()}#ie(e,t){return t>0?e.getChildAtIndex(t-1):this.#se(e)}#ne(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#se(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class Fu{constructor(e){this.editorElement=e,this.editor=e.editor}insertHtml(e){this.editor.update((()=>{const t=Qn();if(!Mn(t))return;const n=da(this.editor,Su(e));t.insertNodes(n)}))}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=Qn();if(!Mn(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=Qn();if(!Mn(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.insertNodeWrappingAllSelectedLines(t)}))}insertNodeWrappingAllSelectedLines(e){this.editor.update((()=>{const t=Qn();Mn(t)&&(t.isCollapsed()?this.#Le(t,e):this.#Pe(t,e))}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=ei();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=Qn();e=Mn(t)&&!t.isCollapsed()})),e}hasSelectedWords(){let e=!1;return this.editor.update((()=>{const t=Qn();Mn(t)&&(e=!t.isCollapsed()&&t.anchor.getNode().getTopLevelElement()===t.focus.getNode().getTopLevelElement())})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const{listItems:t,parentLists:n}=this.#Fe(e);if(t.size>0){const e=this.#Oe(t);this.#Ie(n),this.#Re(e)}}))}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{const t=Qn(),n=t.getTextContent(),r=Ol(e);r.append(Tn(n)),t.insertNodes([r])}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=Qn();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Cn(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=Qn();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Cn(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#Me();if(!n)return;const i=this.#De(n,r,e);-1!==i&&this.#ze(n,r,i,t)}))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#Be(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=Qn(),i=r?.anchor.getNode(),s=i?.getTopLevelElement(),o=new Eu({file:e,uploadUrl:t,blobUrlTemplate:n,editor:this.editor});s&&ti(s)&&0===s.getChildrenSize()?s.replace(o):s&&Mr(s)?s.insertAfter(o):or([o])}),{tag:Jr})}deleteSelectedNodes(){this.editor.update((()=>{if(zn(this.#$e.current)){let e=!1;if(this.#$e.current.getNodes().forEach((t=>{const n=t.getParent();t.remove(),"root"===n.getType()&&0===n.getChildrenSize()&&n.append(ei()),e=!0})),e)return this.#$e.clear(),this.editor.focus(),!0}}))}get#$e(){return this.editorElement.selection}#Le(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else or([t()])}#Pe(e,t){const n=this.#Ue(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#We(n);if(0===r.size)return;const s=this.#Ke(t,r);this.#He(e,s),this.#je(i)}#Ue(e){const t=e.extract().map((e=>this.#qe(e))).filter(Boolean);return Pi(null),t}#qe(e){return ti(e)?e:Cn(e)&&e.getParent()&&ti(e.getParent())?e.getParent():null}#We(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#Ke(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Tn(e)),t<r.length-1&&n.append(an())})),n}#He(e,t){const n=e.anchor.getNode().getParent();n&&n.replace(t)}#je(e){e.forEach((e=>e.remove()))}#Fe(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Kl(e);if(t){n.add(t);const e=t.getParent();e&&oa(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#Oe(e){const t=[];for(const n of e){const e=this.#Je(n);e&&t.push(e)}return t}#Je(e){const t=e.getParent();if(!t||!oa(t))return null;const n=ei(),r=this.#Ge(e,n);return e.insertAfter(n),this.#Ve(n,r),e.remove(),n}#Ge(e,t){const n=[];return e.getChildren().forEach((e=>{oa(e)?n.push(e):t.append(e)})),n}#Ve(e,t){t.forEach((t=>{e.insertAfter(t)}))}#Ie(e){for(const t of e)oa(t)&&0===t.getChildrenSize()&&t.remove()}#Re(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#Ze(t,n)}#Ze(e,t){e.selectStart();const n=Qn();n&&Mn(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#Me(){const e=Qn();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Cn(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#De(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#ze(e,t,n,r){const i=e.getTextContent(),s=i.slice(0,n),o=i.slice(t),a=Tn(s),l=Tn(o||" ");e.replace(a);this.#Ye(a,r).insertAfter(l),this.#Xe(l.getParentOrThrow()),l.select(0,0)}#Ye(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Xe(e){if(ti(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Cn(n)&&""===n.getTextContent()&&r&&!Cn(r)&&e.append(an())}}#Be(e){return wu(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function Ou(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Iu={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Ru(e){Iu=e}var Mu={exec:()=>null};function Du(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(zu.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var zu={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")},Bu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$u=/(?:[*+-]|\d{1,9}[.)])/,Uu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wu=Du(Uu).replace(/bull/g,$u).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(),Ku=Du(Uu).replace(/bull/g,$u).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(),Hu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ju=/(?!\s*\])(?:\\.|[^\[\]\\])+/,qu=Du(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ju).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ju=Du(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$u).getRegex(),Gu="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",Vu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zu=Du("^ {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",Vu).replace("tag",Gu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yu=Du(Hu).replace("hr",Bu).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",Gu).getRegex(),Xu={blockquote:Du(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yu).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:qu,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Bu,html:Zu,lheading:Wu,list:Ju,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Yu,table:Mu,text:/^[^\n]+/},Qu=Du("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bu).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",Gu).getRegex(),ed={...Xu,lheading:Ku,table:Qu,paragraph:Du(Hu).replace("hr",Bu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qu).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",Gu).getRegex()},td={...Xu,html:Du("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Vu).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:Mu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Du(Hu).replace("hr",Bu).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nd=/^( {2,}|\\)\n(?!\s*$)/,rd=/[\p{P}\p{S}]/u,id=/[\s\p{P}\p{S}]/u,sd=/[^\s\p{P}\p{S}]/u,od=Du(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,id).getRegex(),ad=/(?!~)[\p{P}\p{S}]/u,ld=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,cd=Du(ld,"u").replace(/punct/g,rd).getRegex(),ud=Du(ld,"u").replace(/punct/g,ad).getRegex(),dd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hd=Du(dd,"gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),gd=Du(dd,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,ad).getRegex(),pd=Du("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),fd=Du(/\\(punct)/,"gu").replace(/punct/g,rd).getRegex(),md=Du(/^<(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(),yd=Du(Vu).replace("(?:--\x3e|$)","--\x3e").getRegex(),_d=Du("^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",yd).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bd=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xd=Du(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",bd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kd=Du(/^!?\[(label)\]\[(ref)\]/).replace("label",bd).replace("ref",ju).getRegex(),Sd=Du(/^!?\[(ref)\](?:\[\])?/).replace("ref",ju).getRegex(),vd={_backpedal:Mu,anyPunctuation:fd,autolink:md,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:nd,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Mu,emStrongLDelim:cd,emStrongRDelimAst:hd,emStrongRDelimUnd:pd,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:xd,nolink:Sd,punctuation:od,reflink:kd,reflinkSearch:Du("reflink|nolink(?!\\()","g").replace("reflink",kd).replace("nolink",Sd).getRegex(),tag:_d,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Mu},wd={...vd,link:Du(/^!?\[(label)\]\((.*?)\)/).replace("label",bd).getRegex(),reflink:Du(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bd).getRegex()},Td={...vd,emStrongRDelimAst:gd,emStrongLDelim:ud,url:Du(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Cd={...Td,br:Du(nd).replace("{2,}","*").getRegex(),text:Du(Td.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ed={normal:Xu,gfm:ed,pedantic:td},Nd={normal:vd,gfm:Td,breaks:Cd,pedantic:wd},Ad={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ld=e=>Ad[e];function Pd(e,t){if(t){if(zu.escapeTest.test(e))return e.replace(zu.escapeReplace,Ld)}else if(zu.escapeTestNoEncode.test(e))return e.replace(zu.escapeReplaceNoEncode,Ld);return e}function Fd(e){try{e=encodeURI(e).replace(zu.percentDecode,"%")}catch{return null}return e}function Od(e,t){let n=e.replace(zu.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(zu.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(zu.slashPipe,"|");return r}function Id(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 Rd(e,t,n,r,i){let s=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}var Md=class{options;rules;lexer;constructor(e){this.options=e||Iu}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:Id(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=Id(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:Id(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Id(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),s=!0;else{if(s)break;o.push(e[t])}e=e.slice(t);let a=o.join("\n"),l=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,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,s=t.raw+"\n"+e.join("\n"),o=this.blockquote(s);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if("list"!==u?.type);else{let t=u,s=t.raw+"\n"+e.join("\n"),o=this.list(s);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=s.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 s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.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),s=this.rules.other.headingBeginRegex(d),o=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)||s.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+h.slice(d);else{if(u||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),l=h.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(a),g&&(h="[ ] "!==g[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.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=Od(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of i)s.rows.push(Od(e,s.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]}))));return s}}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=Id(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)),Rd(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 Rd(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,s=[...r[0]].length-1,o=s,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=l.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]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,l=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,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}}}},Dd=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Iu,this.options.tokenizer=this.options.tokenizer||new Md,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:zu,block:Ed.normal,inline:Nd.normal};this.options.pedantic?(t.block=Ed.pedantic,t.inline=Nd.pedantic):this.options.gfm&&(t.block=Ed.gfm,this.options.breaks?t.inline=Nd.breaks:t.inline=Nd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ed,inline:Nd}}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(zu.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(zu.tabCharGlobal," ").replace(zu.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"+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"+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});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 s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+="\n"+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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"+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);let i=!1,s="";for(;e;){let r;if(i||(s=""),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,s)){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 o=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&&(o=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=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}},zd=class{options;parser;constructor(e){this.options=e||Iu}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(zu.notSpaceStart)?.[0],i=e.replace(zu.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Pd(r)+'">'+(n?i:Pd(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Pd(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}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+" "+Pd(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>${Pd(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=Fd(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+Pd(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Fd(e);if(null===i)return Pd(n);let s=`<img src="${e=i}" alt="${n}"`;return t&&(s+=` title="${Pd(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Pd(e.text)}},Bd=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""}},$d=class e{options;renderer;textRenderer;constructor(e){this.options=e||Iu,this.options.renderer=this.options.renderer||new zd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bd}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","paragraph","text"].includes(e.type)){n+=t||"";continue}}let s=i;switch(s.type){case"space":n+=this.renderer.space(s);continue;case"hr":n+=this.renderer.hr(s);continue;case"heading":n+=this.renderer.heading(s);continue;case"code":n+=this.renderer.code(s);continue;case"table":n+=this.renderer.table(s);continue;case"blockquote":n+=this.renderer.blockquote(s);continue;case"list":n+=this.renderer.list(s);continue;case"html":n+=this.renderer.html(s);continue;case"paragraph":n+=this.renderer.paragraph(s);continue;case"text":{let i=s,o=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],o+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):o;continue}default:{let e='Token with "'+s.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 s=i;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},Ud=class{options;block;constructor(e){this.options=e||Iu}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Dd.lex:Dd.lexInline}provideParser(){return this.block?$d.parse:$d.parseInline}},Wd=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=$d;Renderer=zd;TextRenderer=Bd;Lexer=Dd;Tokenizer=Md;Hooks=Ud;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 zd(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Md(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ud;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],s=t[r];Ud.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>s.call(t,e)));let n=i.call(t,e);return s.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.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 Dd.lex(e,t??this.defaults)}parser(e,t){return $d.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(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 s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Dd.lex:Dd.lexInline,a=i.hooks?i.hooks.provideParser():e?$d.parse:$d.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>o(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return s(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>"+Pd(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Kd(e,t){return Wd.parse(e,t)}function Hd(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}Kd.options=Kd.setOptions=function(e){return Wd.setOptions(e),Kd.defaults=Wd.defaults,Ru(Kd.defaults),Kd},Kd.getDefaults=Ou,Kd.defaults=Iu,Kd.use=function(...e){return Wd.use(...e),Kd.defaults=Wd.defaults,Ru(Kd.defaults),Kd},Kd.walkTokens=function(e,t){return Wd.walkTokens(e,t)},Kd.parseInline=Wd.parseInline,Kd.Parser=$d,Kd.parser=$d.parse,Kd.Renderer=zd,Kd.TextRenderer=Bd,Kd.Lexer=Dd,Kd.lexer=Dd.lex,Kd.Tokenizer=Md,Kd.Hooks=Ud,Kd.parse=Kd,Kd.options,Kd.setOptions,Kd.use,Kd.walkTokens,Kd.parseInline,$d.parse,Dd.lex;class jd{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#Qe(t)?(this.#et(t),e.preventDefault(),!0):void this.#tt(t))}#Qe(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#et(e){e.items[0].getAsString((e=>{(function(e){try{return new URL(e),!0}catch(e){return!1}})(e)&&this.contents.hasSelectedText()?this.contents.createLinkWithSelectedText(e):this.#nt(e)}))}#nt(e){const t=Kd(e);this.contents.insertHtml(t)}#tt(e){this.editorElement.supportsAttachments&&this.#rt((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#rt(e){const t=window.scrollY,n=window.scrollX;e(),await Lu(),window.scrollTo(n,t),this.editor.focus()}}class qd extends zr{static getType(){return"custom_action_text_attachment"}static clone(e){return new qd({...e},e.__key)}static importJSON(e){return new qd({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Tn(" ")),n.push(new qd({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Tn(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=ku("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{vu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:ku("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class Jd extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic",""];static observedAttributes=["connected"];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Tu("lexxy-editor"),this.editor=this.#it(),this.contents=new Fu(this),this.selection=new Pu(this),this.clipboard=new jd(this),Au.configureFor(this),this.#st(),requestAnimationFrame((()=>wu(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#ot()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#at()))}get form(){return this.internals.form}get toolbarElement(){return this.#lt?(this.toolbar=this.toolbar||this.#ct(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return mu.sanitize(e,{ALLOWED_TAGS:bu,ALLOWED_ATTR:xu,SAFE_FOR_XML:!1})}(ha(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{ns(Zr);const t=Ai();t.clear(),t.append(...this.#ut(e)),t.select(),this.#dt(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#ut(e){e||(e="<p></p>");return da(this.editor,Su(`<div>${e}</div>`)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof zr&&!t.isInline())return t}return e}))}#st(){this.#ht(),this.#gt(),this.#pt(),this.#ft(),this.#mt(),this.#yt(),this.#_t(),this.#bt()}#it(){this.editorContentElement=this.editorContentElement||this.#xt();const e=ri({namespace:"LexicalEditor",onError(e){throw e},theme:dc,nodes:this.#kt});return e.setRootElement(this.editorContentElement),e}get#kt(){const e=[Oa,Ma,ea,Vo,el,dl,Pl,Rl,qd];return this.supportsAttachments&&e.push(Cu,Eu),e}#xt(){const e=ku("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#St,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#vt.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#St(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#vt(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#wt(e){const t=void 0!==this.#wt&&this.#wt!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,t&&wu(this,"lexxy:change")}get#wt(){return this._internalFormValue}#_t(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=e}#bt(){document.addEventListener("turbo:before-cache",this.#Tt)}#Tt=e=>{this.#ot()};#ht(){this.#Ct(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#wt=this.value,this.#dt()})))}#Ct(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#Et(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#gt(){qa(this.editor),function(e,t,n){const r=cc(e,n),i=No(e.registerCommand(Ve,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,s=r.pop();null!==i&&(n.push(i),e.dispatchCommand(vt,!0)),0===r.length&&e.dispatchCommand(wt,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:qr})}}(e,t),!0)),0),e.registerCommand(Ze,(()=>(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(wt,!0));const s=n.pop();0===n.length&&e.dispatchCommand(vt,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:qr})}}(e,t),!0)),0),e.registerCommand(kt,(()=>(uc(t),!1)),0),e.registerCommand(St,(()=>(uc(t),e.dispatchCommand(vt,!1),e.dispatchCommand(wt,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:s,dirtyElements:o,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,s,o,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(vt,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(wt,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(this.editor,{current:null,redoStack:[],undoStack:[]},20),ua(this.editor),this.#Nt(),Yl(this.editor,ac)}#Nt(){!function(e,t){if(!e.hasNodes([el,dl]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=_l);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(el,(t=>{e.update((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=vi(n);null!==t&&xl(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(el,(n=>Sl(n,e,t))),e.registerNodeTransform(mn,(n=>bl(n,e,t))),e.registerNodeTransform(dl,(n=>bl(n,e,t))),e.registerCommand(ct,(t=>{const n=function(e){const t=Qn();if(!Mn(t)||!Tl(t))return null;const n=e?ht:dt,r=e?ht:ut,i=t.anchor,s=t.focus;if(i.is(s))return r;const o=Cl(t);if(1!==o.length)return n;const a=o[0];let l,c;0===a.length&&Ga(285),t.isBackward()?(l=s,c=i):(l=i,c=s);const u=ml(a[0]),d=yl(a[0]),h=Fn(u.getKey(),0,"text"),g=Fn(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(ut,(()=>!!Tl(Qn())&&(or([An()]),!0)),1),e.registerCommand(dt,(e=>El(dt)),1),e.registerCommand(ht,(e=>El(ht)),1),e.registerCommand(nt,(e=>{const t=Qn();if(!Mn(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Tl(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&nl(r.getParentOrThrow())?(e.preventDefault(),!0):Nl(nt,e))}),1),e.registerCommand(rt,(e=>{const t=Qn();if(!Mn(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Tl(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&nl(r.getParentOrThrow())?(e.preventDefault(),!0):Nl(rt,e))}),1),e.registerCommand(tt,(e=>Al(tt,e)),1),e.registerCommand(Qe,(e=>Al(Qe,e)),1)),No(...n)}(this.editor),this.append(ku("lexxy-code-language-picker"))}#pt(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=vi(t);if(e instanceof Cu){const t=e.getWritable();Object.assign(t,n)}}))}))}#ft(){this.editor.registerCommand(it,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#mt(){Jd.debug&&this.#Ct(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#yt(){this.#lt&&this.toolbarElement.setEditor(this)}#ct(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#At()}get#lt(){return"false"!==this.getAttribute("toolbar")}#At(){const e=ku("lexxy-toolbar");return e.innerHTML=jl.defaultTemplate,this.prepend(e),e}#dt(){this.classList.toggle("lexxy-editor--empty",this.#Lt)}get#Lt(){return!this.editorContentElement.textContent.trim()&&!this.editorContentElement.querySelector(_u)}#ot(){this.#Et(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Tt)}#at(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",Jd);class Gd extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Pt.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Ft.bind(this)),this.addEventListener("keydown",this.#Ot.bind(this))}show(e){this.input.value=this.#It,this.dialog.show()}close(){this.dialog.close()}#Pt(e){const t=e.submitter?.value;this.#Rt.dispatchCommand(t,this.input.value)}#Ft(e){this.#Rt.dispatchCommand("unlink"),this.close()}#Ot(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#It(){let e="";return this.#Rt.getEditorState().read((()=>{const t=Qn();if(!Mn(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(Il(n)){e=n.getURL();break}n=n.getParent()}})),e}get#Rt(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",Gd);class Vd{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=ku("li",{role:"option",id:Tu("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=Su(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class Zd extends Vd{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Mt(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Mt(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Hd(e).includes(Hd(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class Yd extends Zd{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Xd extends Zd{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class Qd extends Vd{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,s)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){s(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.#Dt(e));return this.#Mt(t)}#Dt(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Mt(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class eh extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#zt(),this.#Bt()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get#$t(){return!this.supportsSpaceInSearches}#zt(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new Qd(e):new Xd(e):new Yd(this.querySelectorAll("lexxy-prompt-item"))}#Bt(){const e=this.#Rt.registerUpdateListener((()=>{this.#Rt.read((()=>{const t=Qn();if(!t)return;let n;if(Mn(t)?n=t.anchor.getNode():zn(t)&&([n]=t.getNodes()),n&&Cn(n)){[...n.getTextContent().trim()].pop()===this.trigger&&(e(),this.#Ut())}}))}))}get#Rt(){return this.#Wt.editor}get#Wt(){return this.closest("lexxy-editor")}get#$e(){return this.#Wt.selection}async#Ut(){this.popoverElement??=await this.#Kt(),await this.#Ht(),this.#jt(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#qt(),this.#Wt.addEventListener("keydown",this.#Jt),this.#Wt.addEventListener("lexxy:change",this.#Ht),this.#Gt()}#Gt(){this.keyListeners.push(this.#Rt.registerCommand(it,this.#Vt.bind(this),3)),this.keyListeners.push(this.#Rt.registerCommand(ct,this.#Vt.bind(this),3)),this.#$t&&this.keyListeners.push(this.#Rt.registerCommand(st,this.#Vt.bind(this),3))}#qt(){const e=this.#Zt[0];e&&this.#Yt(e)}get#Zt(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#Yt(e){this.#Xt(),e.toggleAttribute("aria-selected",!0),e.focus(),this.#Wt.focus(),this.#Qt.setAttribute("aria-controls",this.popoverElement.id),this.#Qt.setAttribute("aria-activedescendant",e.id),this.#Qt.setAttribute("aria-haspopup","listbox")}#Xt(){this.#Zt.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#Qt.removeAttribute("aria-controls"),this.#Qt.removeAttribute("aria-activedescendant"),this.#Qt.removeAttribute("aria-haspopup")}#jt(){const{x:e,y:t,fontSize:n}=this.#$e.cursorPosition,r=this.#Wt.getBoundingClientRect(),i=this.#Qt.getBoundingClientRect().top-r.top;this.popoverElement.style.left=`${e}px`,this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";this.popoverElement.getBoundingClientRect().bottom>window.innerHeight&&(this.popoverElement.style.bottom=`${t-i+n}px`,this.popoverElement.style.top="auto")}async#en(){this.#Xt(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#Wt.removeEventListener("lexxy:change",this.#Ht),this.#Wt.removeEventListener("keydown",this.#Jt),this.#tn(),await Lu(),this.#Bt()}#tn(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#Ht=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#nn.containsTextBackUntil(this.trigger)?await this.#rn():this.#en()};async#rn(){const e=this.#nn.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#in(t):this.#sn(),this.#qt()}#in(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#sn(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=ku("li",{innerHTML:this.#on});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#on(){return this.getAttribute("empty-results")||"Nothing found"}#Jt=e=>{"Escape"===e.key?(this.#en(),this.#Wt.focus(),e.stopPropagation()):"ArrowDown"===e.key?(this.#an(),e.preventDefault(),e.stopPropagation()):"ArrowUp"===e.key&&(this.#ln(),e.preventDefault(),e.stopPropagation())};#an(){const e=this.#cn+1;e<this.#Zt.length&&this.#Yt(this.#Zt[e])}#ln(){const e=this.#cn-1;e>=0&&this.#Yt(this.#Zt[e])}get#cn(){return this.#Zt.findIndex((e=>e.hasAttribute("aria-selected")))}get#un(){return this.#Zt[this.#cn]}#Vt(e){return" "!==e.key&&e.preventDefault(),e.stopPropagation(),this.#dn(),!0}#dn(){this.#hn(),this.#en(),this.#Wt.focus()}#hn(){const e=this.source.promptItemFor(this.#un);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#nn.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#gn(t,n):this.#pn(e,t,n)}#gn(e,t){this.#Rt.update((()=>{const n=da(this.#Rt,Su(`${e.innerHTML}`));this.#nn.replaceTextBackUntil(t,n)}))}#pn(e,t,n){this.#Rt.update((()=>{const r=new qd({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#nn.replaceTextBackUntil(n,r)}))}get#nn(){return this.#Wt.contents}get#Qt(){return this.#Wt.editorContentElement}async#Kt(){const e=ku("ul",{role:"listbox",id:Tu("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#fn),this.#Wt.appendChild(e),e}#fn=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#Yt(t),this.#dn())}}customElements.define("lexxy-prompt",eh);class th extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#mn(),this.#yn()}#mn(){this.languagePickerElement=this.#_n(),this.languagePickerElement.addEventListener("change",(()=>{this.#bn(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.editorElement.appendChild(this.languagePickerElement)}#_n(){const e=ku("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#xn)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#xn(){const e={...cl};e.ruby||(e.ruby="Ruby");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#bn(e){this.editor.update((()=>{const t=this.#kn();t&&t.setLanguage(e)}))}#yn(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#kn();e?this.#Sn(e):this.#vn()}))}))}#kn(){const e=Qn();if(!Mn(e))return null;const t=e.anchor.getNode(),n=t.getParent();return nl(t)?t:nl(n)?n:null}#Sn(e){const t=e.getLanguage();this.#wn(t),this.#Tn(),this.#Cn(e)}#wn(e){if(this.languagePickerElement&&e){const t=function(e){return ul[e]||e}(e);this.languagePickerElement.value=t}}#Cn(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#Tn(){this.languagePickerElement.hidden=!1}#vn(){this.languagePickerElement.hidden=!0}}function nh(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(/<br\s*\/?>/gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),s=ku("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}customElements.define("lexxy-code-language-picker",th),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}(Prism);export{nh as highlightAll};
10
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:hc,setPrototypeOf:gc,isFrozen:pc,getPrototypeOf:fc,getOwnPropertyDescriptor:mc}=Object;let{freeze:yc,seal:_c,create:bc}=Object,{apply:xc,construct:kc}="undefined"!=typeof Reflect&&Reflect;yc||(yc=function(e){return e}),_c||(_c=function(e){return e}),xc||(xc=function(e,t,n){return e.apply(t,n)}),kc||(kc=function(e,t){return new e(...t)});const Sc=Dc(Array.prototype.forEach),vc=Dc(Array.prototype.lastIndexOf),wc=Dc(Array.prototype.pop),Tc=Dc(Array.prototype.push),Cc=Dc(Array.prototype.splice),Ec=Dc(String.prototype.toLowerCase),Nc=Dc(String.prototype.toString),Ac=Dc(String.prototype.match),Lc=Dc(String.prototype.replace),Pc=Dc(String.prototype.indexOf),Fc=Dc(String.prototype.trim),Oc=Dc(Object.prototype.hasOwnProperty),Ic=Dc(RegExp.prototype.test),Rc=(Mc=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return kc(Mc,t)});var Mc;function Dc(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 xc(e,t,r)}}function zc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ec;gc&&gc(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(pc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Bc(e){for(let t=0;t<e.length;t++){Oc(e,t)||(e[t]=null)}return e}function $c(e){const t=bc(null);for(const[n,r]of hc(e)){Oc(e,n)&&(Array.isArray(r)?t[n]=Bc(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=$c(r):t[n]=r)}return t}function Uc(e,t){for(;null!==e;){const n=mc(e,t);if(n){if(n.get)return Dc(n.get);if("function"==typeof n.value)return Dc(n.value)}e=fc(e)}return function(){return null}}const Wc=yc(["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","section","select","shadow","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"]),Kc=yc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hc=yc(["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"]),jc=yc(["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"]),qc=yc(["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"]),Jc=yc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=yc(["#text"]),Vc=yc(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Zc=yc(["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","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"]),Yc=yc(["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"]),Xc=yc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qc=_c(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eu=_c(/<%[\w\W]*|[\w\W]*%>/gm),tu=_c(/\$\{[\w\W]*/gm),nu=_c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ru=_c(/^aria-[\-\w]+$/),iu=_c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),su=_c(/^(?:\w+script|data):/i),ou=_c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),au=_c(/^html$/i),lu=_c(/^[a-z][.\w]*(-[.\w]+)+$/i);var cu=Object.freeze({__proto__:null,ARIA_ATTR:ru,ATTR_WHITESPACE:ou,CUSTOM_ELEMENT:lu,DATA_ATTR:nu,DOCTYPE_NAME:au,ERB_EXPR:eu,IS_ALLOWED_URI:iu,IS_SCRIPT_OR_DATA:su,MUSTACHE_EXPR:Qc,TMPLIT_EXPR:tu});const uu=1,du=3,hu=7,gu=8,pu=9,fu=function(){return"undefined"==typeof window?null:window};var mu=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fu();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==pu||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:g,trustedTypes:p}=t,f=c.prototype,m=Uc(f,"cloneNode"),y=Uc(f,"remove"),_=Uc(f,"nextSibling"),b=Uc(f,"childNodes"),x=Uc(f,"parentNode");if("function"==typeof a){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let k,S="";const{implementation:v,createNodeIterator:w,createDocumentFragment:T,getElementsByTagName:C}=r,{importNode:E}=i;let N={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof hc&&"function"==typeof x&&v&&void 0!==v.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:L,TMPLIT_EXPR:P,DATA_ATTR:F,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:M}=cu;let{IS_ALLOWED_URI:D}=cu,z=null;const B=zc({},[...Wc,...Kc,...Hc,...qc,...Gc]);let $=null;const U=zc({},[...Vc,...Zc,...Yc,...Xc]);let W=Object.seal(bc(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}})),K=null,H=null,j=!0,q=!0,J=!1,G=!0,V=!1,Z=!0,Y=!1,X=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!0,ie=!1,se=!0,oe=!1,ae={},le=null;const ce=zc({},["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 ue=null;const de=zc({},["audio","video","img","source","image","track"]);let he=null;const ge=zc({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",fe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,_e=!1,be=null;const xe=zc({},[pe,fe,me],Nc);let ke=zc({},["mi","mo","mn","ms","mtext"]),Se=zc({},["annotation-xml"]);const ve=zc({},["title","style","font","a","script"]);let we=null;const Te=["application/xhtml+xml","text/html"];let Ce=null,Ee=null;const Ne=r.createElement("form"),Ae=function(e){return e instanceof RegExp||e instanceof Function},Le=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=$c(e),we=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ce="application/xhtml+xml"===we?Nc:Ec,z=Oc(e,"ALLOWED_TAGS")?zc({},e.ALLOWED_TAGS,Ce):B,$=Oc(e,"ALLOWED_ATTR")?zc({},e.ALLOWED_ATTR,Ce):U,be=Oc(e,"ALLOWED_NAMESPACES")?zc({},e.ALLOWED_NAMESPACES,Nc):xe,he=Oc(e,"ADD_URI_SAFE_ATTR")?zc($c(ge),e.ADD_URI_SAFE_ATTR,Ce):ge,ue=Oc(e,"ADD_DATA_URI_TAGS")?zc($c(de),e.ADD_DATA_URI_TAGS,Ce):de,le=Oc(e,"FORBID_CONTENTS")?zc({},e.FORBID_CONTENTS,Ce):ce,K=Oc(e,"FORBID_TAGS")?zc({},e.FORBID_TAGS,Ce):$c({}),H=Oc(e,"FORBID_ATTR")?zc({},e.FORBID_ATTR,Ce):$c({}),ae=!!Oc(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,V=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,Y=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,re=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||iu,ye=e.NAMESPACE||me,ke=e.MATHML_TEXT_INTEGRATION_POINTS||ke,Se=e.HTML_INTEGRATION_POINTS||Se,W=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(W.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(W.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(W.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(q=!1),te&&(ee=!0),ae&&(z=zc({},Gc),$=[],!0===ae.html&&(zc(z,Wc),zc($,Vc)),!0===ae.svg&&(zc(z,Kc),zc($,Zc),zc($,Xc)),!0===ae.svgFilters&&(zc(z,Hc),zc($,Zc),zc($,Xc)),!0===ae.mathMl&&(zc(z,qc),zc($,Yc),zc($,Xc))),e.ADD_TAGS&&(z===B&&(z=$c(z)),zc(z,e.ADD_TAGS,Ce)),e.ADD_ATTR&&($===U&&($=$c($)),zc($,e.ADD_ATTR,Ce)),e.ADD_URI_SAFE_ATTR&&zc(he,e.ADD_URI_SAFE_ATTR,Ce),e.FORBID_CONTENTS&&(le===ce&&(le=$c(le)),zc(le,e.FORBID_CONTENTS,Ce)),se&&(z["#text"]=!0),Y&&zc(z,["html","head","body"]),z.table&&(zc(z,["tbody"]),delete K.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Rc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Rc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=e.TRUSTED_TYPES_POLICY,S=k.createHTML("")}else void 0===k&&(k=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}}(p,s)),null!==k&&"string"==typeof S&&(S=k.createHTML(""));yc&&yc(e),Ee=e}},Pe=zc({},[...Kc,...Hc,...jc]),Fe=zc({},[...qc,...Jc]),Oe=function(e){Tc(n.removed,{element:e});try{x(e).removeChild(e)}catch(t){y(e)}},Ie=function(e,t){try{Tc(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Tc(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,n=null;if(Q)e="<remove></remove>"+e;else{const t=Ac(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===we&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=k?k.createHTML(e):e;if(ye===me)try{t=(new g).parseFromString(i,we)}catch(e){}if(!t||!t.documentElement){t=v.createDocument(ye,"template",null);try{t.documentElement.innerHTML=_e?S:i}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(r.createTextNode(n),s.childNodes[0]||null),ye===me?C.call(t,Y?"html":"body")[0]:Y?t.documentElement:s},Me=function(e){return w.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},De=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)},ze=function(e){return"function"==typeof l&&e instanceof l};function Be(e,t,r){Sc(e,(e=>{e.call(n,t,r,Ee)}))}const $e=function(e){let t=null;if(Be(N.beforeSanitizeElements,e,null),De(e))return Oe(e),!0;const r=Ce(e.nodeName);if(Be(N.uponSanitizeElement,e,{tagName:r,allowedTags:z}),Z&&e.hasChildNodes()&&!ze(e.firstElementChild)&&Ic(/<[/\w!]/g,e.innerHTML)&&Ic(/<[/\w!]/g,e.textContent))return Oe(e),!0;if(e.nodeType===hu)return Oe(e),!0;if(Z&&e.nodeType===gu&&Ic(/<[/\w]/g,e.data))return Oe(e),!0;if(!z[r]||K[r]){if(!K[r]&&We(r)){if(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,r))return!1;if(W.tagNameCheck instanceof Function&&W.tagNameCheck(r))return!1}if(se&&!le[r]){const t=x(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=m(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,_(e))}}}return Oe(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Ec(e.tagName),r=Ec(t.tagName);return!!be[e.namespaceURI]&&(e.namespaceURI===fe?t.namespaceURI===me?"svg"===n:t.namespaceURI===pe?"svg"===n&&("annotation-xml"===r||ke[r]):Boolean(Pe[n]):e.namespaceURI===pe?t.namespaceURI===me?"math"===n:t.namespaceURI===fe?"math"===n&&Se[r]:Boolean(Fe[n]):e.namespaceURI===me?!(t.namespaceURI===fe&&!Se[r])&&!(t.namespaceURI===pe&&!ke[r])&&!Fe[n]&&(ve[n]||!Pe[n]):!("application/xhtml+xml"!==we||!be[e.namespaceURI]))}(e)?(Oe(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Ic(/<\/no(script|embed|frames)/i,e.innerHTML)?(V&&e.nodeType===du&&(t=e.textContent,Sc([A,L,P],(e=>{t=Lc(t,e," ")})),e.textContent!==t&&(Tc(n.removed,{element:e.cloneNode()}),e.textContent=t)),Be(N.afterSanitizeElements,e,null),!1):(Oe(e),!0)},Ue=function(e,t,n){if(re&&("id"===t||"name"===t)&&(n in r||n in Ne))return!1;if(q&&!H[t]&&Ic(F,t));else if(j&&Ic(O,t));else if(!$[t]||H[t]){if(!(We(e)&&(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&Ic(W.attributeNameCheck,t)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(t))||"is"===t&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&Ic(W.tagNameCheck,n)||W.tagNameCheck instanceof Function&&W.tagNameCheck(n))))return!1}else if(he[t]);else if(Ic(D,Lc(n,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Pc(n,"data:")||!ue[e]){if(J&&!Ic(I,Lc(n,R,"")));else if(n)return!1}else;return!0},We=function(e){return"annotation-xml"!==e&&Ac(e,M)},Ke=function(e){Be(N.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||De(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let i=t.length;for(;i--;){const s=t[i],{name:o,namespaceURI:a,value:l}=s,c=Ce(o),u=l;let d="value"===o?u:Fc(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Be(N.uponSanitizeAttribute,e,r),d=r.attrValue,!ie||"id"!==c&&"name"!==c||(Ie(o,e),d="user-content-"+d),Z&&Ic(/((--!?|])>)|<\/(style|title)/i,d)){Ie(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ie(o,e);continue}if(!G&&Ic(/\/>/i,d)){Ie(o,e);continue}V&&Sc([A,L,P],(e=>{d=Lc(d,e," ")}));const h=Ce(e.nodeName);if(Ue(h,c,d)){if(k&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(a);else switch(p.getAttributeType(h,c)){case"TrustedHTML":d=k.createHTML(d);break;case"TrustedScriptURL":d=k.createScriptURL(d)}if(d!==u)try{a?e.setAttributeNS(a,o,d):e.setAttribute(o,d),De(e)?Oe(e):wc(n.removed)}catch(t){Ie(o,e)}}else Ie(o,e)}Be(N.afterSanitizeAttributes,e,null)},He=function e(t){let n=null;const r=Me(t);for(Be(N.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Be(N.uponSanitizeShadowNode,n,null),$e(n),Ke(n),n.content instanceof o&&e(n.content);Be(N.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,s=null,a=null,c=null;if(_e=!e,_e&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ze(e)){if("function"!=typeof e.toString)throw Rc("toString is not a function");if("string"!=typeof(e=e.toString()))throw Rc("dirty is not a string, aborting")}if(!n.isSupported)return e;if(X||Le(t),n.removed=[],"string"==typeof e&&(oe=!1),oe){if(e.nodeName){const t=Ce(e.nodeName);if(!z[t]||K[t])throw Rc("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Re("\x3c!----\x3e"),s=r.ownerDocument.importNode(e,!0),s.nodeType===uu&&"BODY"===s.nodeName||"HTML"===s.nodeName?r=s:r.appendChild(s);else{if(!ee&&!V&&!Y&&-1===e.indexOf("<"))return k&&ne?k.createHTML(e):e;if(r=Re(e),!r)return ee?null:ne?S:""}r&&Q&&Oe(r.firstChild);const u=Me(oe?e:r);for(;a=u.nextNode();)$e(a),Ke(a),a.content instanceof o&&He(a.content);if(oe)return e;if(ee){if(te)for(c=T.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return($.shadowroot||$.shadowrootmode)&&(c=E.call(i,c,!0)),c}let d=Y?r.outerHTML:r.innerHTML;return Y&&z["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Ic(au,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),V&&Sc([A,L,P],(e=>{d=Lc(d,e," ")})),k&&ne?k.createHTML(d):d},n.setConfig=function(){Le(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),X=!0},n.clearConfig=function(){Ee=null,X=!1},n.isValidAttribute=function(e,t,n){Ee||Le({});const r=Ce(e),i=Ce(t);return Ue(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&Tc(N[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=vc(N[e],t);return-1===n?void 0:Cc(N[e],n,1)[0]}return wc(N[e])},n.removeHooks=function(e){N[e]=[]},n.removeAllHooks=function(){N={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function yu(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]}`}const _u=["img","video","audio","iframe","embed","object","picture","source","canvas","svg","math","form","input","textarea","select","button","code","blockquote"].join(","),bu=["a","action-text-attachment","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","i","img","li","ol","p","pre","q","strong","ul"],xu=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","title","url","width"];function ku(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function Su(e){return(new DOMParser).parseFromString(e,"text/html")}function vu(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function wu(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Tu(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Cu extends zr{static getType(){return"action_text_attachment"}static clone(e){return new Cu({...e},e.__key)}static importJSON(e){return new Cu({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Cu({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:e=>({conversion:()=>({node:new Cu({src:e.getAttribute("src"),contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1})}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:s,fileName:o,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=s||"",this.fileName=o,this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#k(e)})),this.isPreviewableAttachment?(e.appendChild(this.#S()),e.appendChild(this.#v())):(e.appendChild(this.#w()),e.appendChild(this.#T())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:ku("action-text-attachment",{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,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,ku("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#C(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#C||this.previewable}#S(){return ku("img",{src:this.src,alt:this.altText,...this.#E})}get#E(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#w(){return ku("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#T(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("strong",{className:"attachment__name",textContent:this.caption||this.fileName}),n=ku("span",{className:"attachment__size",textContent:yu(this.fileSize)});return e.appendChild(t),e.appendChild(n),e}#k(e){vu(e,"lexxy:internal:select-node",{key:this.getKey()})}#v(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("input",{type:"text",class:"input",value:this.caption,placeholder:this.fileName});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#N.bind(this)),t.addEventListener("keydown",this.#A.bind(this)),e.appendChild(t),e}#L(e){}#N(e){const t=e.target;t.placeholder=this.fileName,this.#P(t)}#P(e){vu(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#A(e){"Enter"===e.key&&(this.#P(e.target),vu(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Eu extends Cu{static getType(){return"action_text_attachment_upload"}static clone(e){return new Eu({...e},e.__key)}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},s){super({contentType:e.type},s),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#S()):e.appendChild(this.#w()),e.appendChild(this.#F());const t=ku("progress",{value:this.progress,max:100});return e.appendChild(t),this.#O(e).then((()=>this.#I(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}#S(){return ku("img")}#w(){return ku("span",{className:"attachment__icon",textContent:this.#R()})}#R(){return this.file.name.split(".").pop().toLowerCase()}#F(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("span",{className:"attachment__name",textContent:this.file.name||""}),n=ku("span",{className:"attachment__size",textContent:yu(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#O(e){const t=e.querySelector("img");return t?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,t):Promise.resolve()}#I(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#M(n):this.#D(t,n).then((()=>{this.#z(n,t)}))}))}#M(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(ku("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#z(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),i=vi(this.getKey());i&&i.replace(new Cu({sgid:t.attachable_sgid,src:t.previewable?t.url:r,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Jr})}async#D(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#S();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}const Nu=["bold","rotateHeadingFormat","italic","link","unlink","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","uploadAttachments"];class Au{static configureFor(e){new Au(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#B(),this.#$()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(Ge,"bold")}dispatchItalic(){this.editor.dispatchCommand(Ge,"italic")}dispatchLink(e){this.#U(e)}dispatchUnlink(){this.#U(null)}dispatchInsertUnorderedList(){const e=Qn().anchor.getNode();this.selection.isInsideList&&e&&"bullet"===Hl(e)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(aa,void 0)}dispatchInsertOrderedList(){const e=Qn().anchor.getNode();this.selection.isInsideList&&e&&"number"===Hl(e)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(la,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedLines((e=>Ra(e)),(()=>Ia()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(Ge,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>nl(e)),(()=>new el("plain")))}))}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Ua(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>$a(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=ku("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}#B(){for(const t of Nu){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#W(t,0,this[n].bind(this))}var e;this.#W(He,1,this.dispatchPaste.bind(this))}#W(e,t,n){this.editor.registerCommand(e,n,t)}#U(e){this.editor.update((()=>{Bl(null===e?null:e)}))}#$(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#K.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#H.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#j.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#q.bind(this)))}#j(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#q(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#K(e){e.preventDefault()}#H(e){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);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}}function Lu(){return new Promise(requestAnimationFrame)}class Pu{constructor(e){this.editorElement=e,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#J(),this.#G()}clear(){this.current=null}set current(e){zn(e)?(this._current=Qn(),this.#V()):this.editor.update((()=>{this.#V(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#Z();if(!t)return;const n=this.#Y(t);n&&(e=this.#X(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{Ai().selectEnd()}))}get hasSelectedWordsInSingleLine(){const e=Qn();if(!Mn(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if(ln(e))return!1;return!0}get isInsideList(){const e=Qn();if(!Mn(e))return!1;return null!==Kl(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Q();return e?Cn(e)?this.#ee(e,t):Mr(e)?this.#te(e,t):this.#ne(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Q();return e?Cn(e)?this.#re(e,t):Mr(e)?this.#ie(e,t):this.#se(e):null}get#oe(){return this.editorElement.contents}get#ae(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;if(this._currentlySelectedKeys=new Set,this.current)for(const e of this.current.getNodes())this._currentlySelectedKeys.add(e.getKey());return this._currentlySelectedKeys}#G(){this.editor.registerCommand(et,this.#le.bind(this),1),this.editor.registerCommand(nt,this.#le.bind(this),1),this.editor.registerCommand(Xe,this.#ce.bind(this),1),this.editor.registerCommand(rt,this.#ce.bind(this),1),this.editor.registerCommand(lt,this.#ue.bind(this),1),this.editor.registerCommand(ot,this.#de.bind(this),1),this.editor.registerCommand(De,(()=>{this.current=Qn()}),1)}#J(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Lu();const{key:t}=e.detail;this.editor.update((()=>{const e=vi(t);if(e){const t=Yn();t.add(e.getKey()),Pi(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#he()}))}#V(){this.#ge(),this.#pe(),this.previouslySelectedKeys=this.#ae,this._currentlySelectedKeys=null}#ge(){for(const e of this.previouslySelectedKeys)if(!this.#ae.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#pe(){for(const e of this.#ae)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#le(){this.current?await this.#fe((e=>e.selectPrevious())):this.#me(this.nodeBeforeCursor)}async#ce(){this.current?await this.#fe((e=>e.selectNext(0,0))):this.#me(this.nodeAfterCursor)}async#fe(e){await Lu(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#he(){this.editor.update((()=>{const e=this.#ye();e&&this.#_e(e)}))}#ye(){const e=Qn();return e?zn(e)?this.#be(e):Mn(e)?this.#xe(e):null:null}#be(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#xe(e){return e.anchor.getNode().getTopLevelElement()}#_e(e){const t=e.getNextSibling();t?t.selectStart():this.#ke()}#ke(){const e=Ai(),t=ei();e.append(t),t.selectStart()}#me(e){e&&e instanceof zr&&this.editor.update((()=>{const t=Yn();t.add(e.getKey()),Pi(t)}))}#ue(){const e=this.nodeAfterCursor;return e instanceof zr?this.#me(e):this.#oe.deleteSelectedNodes(),!0}#de(){const e=this.nodeBeforeCursor;return e instanceof zr?this.#me(e):this.#oe.deleteSelectedNodes(),!0}#Z(){const e=Qn();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#Y(e){let t=e.getBoundingClientRect();if(this.#Se(t)){const n=this.#ve(e);t=n.getBoundingClientRect(),this.#we(n),n.remove()}return t}#Se(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#ve(e){const t=this.#Te();return e.insertNode(t),t}#Te(){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}#we(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#X(e,t){const n=this.editor.getRootElement().getBoundingClientRect();let r=e.left-n.left,i=e.top-n.top;const s=this.#Ce(t);return isNaN(s)||(i+=s),{x:r,y:i,fontSize:s}}#Ce(e){const t=window.getSelection().anchorNode,n=this.#Ee(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#Ee(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Q(){const e=Qn();if(!Mn(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#ee(e,t){return t===e.getTextContentSize()?this.#Ne(e):null}#Ne(e){if(e.getNextSibling()instanceof zr)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#te(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#ne(e)}#re(e,t){return 0===t?this.#Ae(e):null}#Ae(e){if(e.getPreviousSibling()instanceof zr)return e.getPreviousSibling();return e.getParent().getPreviousSibling()}#ie(e,t){return t>0?e.getChildAtIndex(t-1):this.#se(e)}#ne(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#se(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class Fu{constructor(e){this.editorElement=e,this.editor=e.editor}insertHtml(e){this.editor.update((()=>{const t=Qn();if(!Mn(t))return;const n=da(this.editor,Su(e));t.insertNodes(n)}))}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=Qn();if(!Mn(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=Qn();if(!Mn(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.insertNodeWrappingAllSelectedLines(t)}))}insertNodeWrappingAllSelectedLines(e){this.editor.update((()=>{const t=Qn();Mn(t)&&(t.isCollapsed()?this.#Le(t,e):this.#Pe(t,e))}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=ei();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=Qn();e=Mn(t)&&!t.isCollapsed()})),e}hasSelectedWords(){let e=!1;return this.editor.update((()=>{const t=Qn();Mn(t)&&(e=!t.isCollapsed()&&t.anchor.getNode().getTopLevelElement()===t.focus.getNode().getTopLevelElement())})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=Qn();if(!Mn(e))return;const{listItems:t,parentLists:n}=this.#Fe(e);if(t.size>0){const e=this.#Oe(t);this.#Ie(n),this.#Re(e)}}))}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{const t=Qn(),n=t.getTextContent(),r=Ol(e);r.append(Tn(n)),t.insertNodes([r])}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=Qn();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Cn(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=Qn();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Cn(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#Me();if(!n)return;const i=this.#De(n,r,e);-1!==i&&this.#ze(n,r,i,t)}))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#Be(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=Qn(),i=r?.anchor.getNode(),s=i?.getTopLevelElement(),o=new Eu({file:e,uploadUrl:t,blobUrlTemplate:n,editor:this.editor});s&&ti(s)&&0===s.getChildrenSize()?s.replace(o):s&&Mr(s)?s.insertAfter(o):or([o])}),{tag:Jr})}deleteSelectedNodes(){this.editor.update((()=>{if(zn(this.#$e.current)){let e=!1;if(this.#$e.current.getNodes().forEach((t=>{const n=t.getParent();t.remove(),"root"===n.getType()&&0===n.getChildrenSize()&&n.append(ei()),e=!0})),e)return this.#$e.clear(),this.editor.focus(),!0}}))}get#$e(){return this.editorElement.selection}#Le(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else or([t()])}#Pe(e,t){const n=this.#Ue(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#We(n);if(0===r.size)return;const s=this.#Ke(t,r);this.#He(e,s),this.#je(i)}#Ue(e){const t=e.extract().map((e=>this.#qe(e))).filter(Boolean);return Pi(null),t}#qe(e){return ti(e)?e:Cn(e)&&e.getParent()&&ti(e.getParent())?e.getParent():null}#We(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#Ke(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Tn(e)),t<r.length-1&&n.append(an())})),n}#He(e,t){const n=e.anchor.getNode().getParent();n&&n.replace(t)}#je(e){e.forEach((e=>e.remove()))}#Fe(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Kl(e);if(t){n.add(t);const e=t.getParent();e&&oa(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#Oe(e){const t=[];for(const n of e){const e=this.#Je(n);e&&t.push(e)}return t}#Je(e){const t=e.getParent();if(!t||!oa(t))return null;const n=ei(),r=this.#Ge(e,n);return e.insertAfter(n),this.#Ve(n,r),e.remove(),n}#Ge(e,t){const n=[];return e.getChildren().forEach((e=>{oa(e)?n.push(e):t.append(e)})),n}#Ve(e,t){t.forEach((t=>{e.insertAfter(t)}))}#Ie(e){for(const t of e)oa(t)&&0===t.getChildrenSize()&&t.remove()}#Re(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#Ze(t,n)}#Ze(e,t){e.selectStart();const n=Qn();n&&Mn(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#Me(){const e=Qn();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Cn(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#De(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#ze(e,t,n,r){const i=e.getTextContent(),s=i.slice(0,n),o=i.slice(t),a=Tn(s),l=Tn(o||" ");e.replace(a);this.#Ye(a,r).insertAfter(l),this.#Xe(l.getParentOrThrow()),l.select(0,0)}#Ye(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Xe(e){if(ti(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Cn(n)&&""===n.getTextContent()&&r&&!Cn(r)&&e.append(an())}}#Be(e){return wu(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function Ou(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Iu={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Ru(e){Iu=e}var Mu={exec:()=>null};function Du(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(zu.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var zu={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")},Bu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$u=/(?:[*+-]|\d{1,9}[.)])/,Uu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wu=Du(Uu).replace(/bull/g,$u).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(),Ku=Du(Uu).replace(/bull/g,$u).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(),Hu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ju=/(?!\s*\])(?:\\.|[^\[\]\\])+/,qu=Du(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ju).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ju=Du(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$u).getRegex(),Gu="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",Vu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zu=Du("^ {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",Vu).replace("tag",Gu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yu=Du(Hu).replace("hr",Bu).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",Gu).getRegex(),Xu={blockquote:Du(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yu).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:qu,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Bu,html:Zu,lheading:Wu,list:Ju,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Yu,table:Mu,text:/^[^\n]+/},Qu=Du("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bu).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",Gu).getRegex(),ed={...Xu,lheading:Ku,table:Qu,paragraph:Du(Hu).replace("hr",Bu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qu).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",Gu).getRegex()},td={...Xu,html:Du("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Vu).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:Mu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Du(Hu).replace("hr",Bu).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nd=/^( {2,}|\\)\n(?!\s*$)/,rd=/[\p{P}\p{S}]/u,id=/[\s\p{P}\p{S}]/u,sd=/[^\s\p{P}\p{S}]/u,od=Du(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,id).getRegex(),ad=/(?!~)[\p{P}\p{S}]/u,ld=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,cd=Du(ld,"u").replace(/punct/g,rd).getRegex(),ud=Du(ld,"u").replace(/punct/g,ad).getRegex(),dd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hd=Du(dd,"gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),gd=Du(dd,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,ad).getRegex(),pd=Du("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),fd=Du(/\\(punct)/,"gu").replace(/punct/g,rd).getRegex(),md=Du(/^<(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(),yd=Du(Vu).replace("(?:--\x3e|$)","--\x3e").getRegex(),_d=Du("^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",yd).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bd=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xd=Du(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",bd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kd=Du(/^!?\[(label)\]\[(ref)\]/).replace("label",bd).replace("ref",ju).getRegex(),Sd=Du(/^!?\[(ref)\](?:\[\])?/).replace("ref",ju).getRegex(),vd={_backpedal:Mu,anyPunctuation:fd,autolink:md,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:nd,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Mu,emStrongLDelim:cd,emStrongRDelimAst:hd,emStrongRDelimUnd:pd,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:xd,nolink:Sd,punctuation:od,reflink:kd,reflinkSearch:Du("reflink|nolink(?!\\()","g").replace("reflink",kd).replace("nolink",Sd).getRegex(),tag:_d,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Mu},wd={...vd,link:Du(/^!?\[(label)\]\((.*?)\)/).replace("label",bd).getRegex(),reflink:Du(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bd).getRegex()},Td={...vd,emStrongRDelimAst:gd,emStrongLDelim:ud,url:Du(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Cd={...Td,br:Du(nd).replace("{2,}","*").getRegex(),text:Du(Td.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ed={normal:Xu,gfm:ed,pedantic:td},Nd={normal:vd,gfm:Td,breaks:Cd,pedantic:wd},Ad={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ld=e=>Ad[e];function Pd(e,t){if(t){if(zu.escapeTest.test(e))return e.replace(zu.escapeReplace,Ld)}else if(zu.escapeTestNoEncode.test(e))return e.replace(zu.escapeReplaceNoEncode,Ld);return e}function Fd(e){try{e=encodeURI(e).replace(zu.percentDecode,"%")}catch{return null}return e}function Od(e,t){let n=e.replace(zu.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(zu.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(zu.slashPipe,"|");return r}function Id(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 Rd(e,t,n,r,i){let s=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}var Md=class{options;rules;lexer;constructor(e){this.options=e||Iu}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:Id(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=Id(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:Id(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Id(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),s=!0;else{if(s)break;o.push(e[t])}e=e.slice(t);let a=o.join("\n"),l=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,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,s=t.raw+"\n"+e.join("\n"),o=this.blockquote(s);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if("list"!==u?.type);else{let t=u,s=t.raw+"\n"+e.join("\n"),o=this.list(s);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=s.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 s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.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),s=this.rules.other.headingBeginRegex(d),o=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)||s.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+h.slice(d);else{if(u||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),l=h.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(a),g&&(h="[ ] "!==g[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.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=Od(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of i)s.rows.push(Od(e,s.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]}))));return s}}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=Id(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)),Rd(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 Rd(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,s=[...r[0]].length-1,o=s,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=l.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]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,l=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,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}}}},Dd=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Iu,this.options.tokenizer=this.options.tokenizer||new Md,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:zu,block:Ed.normal,inline:Nd.normal};this.options.pedantic?(t.block=Ed.pedantic,t.inline=Nd.pedantic):this.options.gfm&&(t.block=Ed.gfm,this.options.breaks?t.inline=Nd.breaks:t.inline=Nd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ed,inline:Nd}}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(zu.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(zu.tabCharGlobal," ").replace(zu.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"+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"+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});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 s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+="\n"+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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"+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);let i=!1,s="";for(;e;){let r;if(i||(s=""),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,s)){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 o=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&&(o=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=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}},zd=class{options;parser;constructor(e){this.options=e||Iu}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(zu.notSpaceStart)?.[0],i=e.replace(zu.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Pd(r)+'">'+(n?i:Pd(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Pd(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}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+" "+Pd(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>${Pd(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=Fd(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+Pd(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Fd(e);if(null===i)return Pd(n);let s=`<img src="${e=i}" alt="${n}"`;return t&&(s+=` title="${Pd(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Pd(e.text)}},Bd=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""}},$d=class e{options;renderer;textRenderer;constructor(e){this.options=e||Iu,this.options.renderer=this.options.renderer||new zd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bd}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","paragraph","text"].includes(e.type)){n+=t||"";continue}}let s=i;switch(s.type){case"space":n+=this.renderer.space(s);continue;case"hr":n+=this.renderer.hr(s);continue;case"heading":n+=this.renderer.heading(s);continue;case"code":n+=this.renderer.code(s);continue;case"table":n+=this.renderer.table(s);continue;case"blockquote":n+=this.renderer.blockquote(s);continue;case"list":n+=this.renderer.list(s);continue;case"html":n+=this.renderer.html(s);continue;case"paragraph":n+=this.renderer.paragraph(s);continue;case"text":{let i=s,o=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],o+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):o;continue}default:{let e='Token with "'+s.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 s=i;switch(s.type){case"escape":case"text":n+=t.text(s);break;case"html":n+=t.html(s);break;case"link":n+=t.link(s);break;case"image":n+=t.image(s);break;case"strong":n+=t.strong(s);break;case"em":n+=t.em(s);break;case"codespan":n+=t.codespan(s);break;case"br":n+=t.br(s);break;case"del":n+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},Ud=class{options;block;constructor(e){this.options=e||Iu}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Dd.lex:Dd.lexInline}provideParser(){return this.block?$d.parse:$d.parseInline}},Wd=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=$d;Renderer=zd;TextRenderer=Bd;Lexer=Dd;Tokenizer=Md;Hooks=Ud;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 zd(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Md(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ud;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],s=t[r];Ud.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>s.call(t,e)));let n=i.call(t,e);return s.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.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 Dd.lex(e,t??this.defaults)}parser(e,t){return $d.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(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 s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Dd.lex:Dd.lexInline,a=i.hooks?i.hooks.provideParser():e?$d.parse:$d.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>o(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return s(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>"+Pd(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Kd(e,t){return Wd.parse(e,t)}function Hd(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}Kd.options=Kd.setOptions=function(e){return Wd.setOptions(e),Kd.defaults=Wd.defaults,Ru(Kd.defaults),Kd},Kd.getDefaults=Ou,Kd.defaults=Iu,Kd.use=function(...e){return Wd.use(...e),Kd.defaults=Wd.defaults,Ru(Kd.defaults),Kd},Kd.walkTokens=function(e,t){return Wd.walkTokens(e,t)},Kd.parseInline=Wd.parseInline,Kd.Parser=$d,Kd.parser=$d.parse,Kd.Renderer=zd,Kd.TextRenderer=Bd,Kd.Lexer=Dd,Kd.lexer=Dd.lex,Kd.Tokenizer=Md,Kd.Hooks=Ud,Kd.parse=Kd,Kd.options,Kd.setOptions,Kd.use,Kd.walkTokens,Kd.parseInline,$d.parse,Dd.lex;class jd{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#Qe(t)?(this.#et(t),e.preventDefault(),!0):void this.#tt(t))}#Qe(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#et(e){e.items[0].getAsString((e=>{(function(e){try{return new URL(e),!0}catch(e){return!1}})(e)&&this.contents.hasSelectedText()?this.contents.createLinkWithSelectedText(e):this.#nt(e)}))}#nt(e){const t=Kd(e);this.contents.insertHtml(t)}#tt(e){this.editorElement.supportsAttachments&&this.#rt((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#rt(e){const t=window.scrollY,n=window.scrollX;e(),await Lu(),window.scrollTo(n,t),this.editor.focus()}}class qd extends zr{static getType(){return"custom_action_text_attachment"}static clone(e){return new qd({...e},e.__key)}static importJSON(e){return new qd({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Tn(" ")),n.push(new qd({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Tn(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=ku("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{vu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:ku("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class Jd extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic",""];static observedAttributes=["connected"];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Tu("lexxy-editor"),this.editor=this.#it(),this.contents=new Fu(this),this.selection=new Pu(this),this.clipboard=new jd(this),Au.configureFor(this),this.#st(),requestAnimationFrame((()=>wu(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#ot()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#at()))}get form(){return this.internals.form}get toolbarElement(){return this.#lt?(this.toolbar=this.toolbar||this.#ct(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return mu.sanitize(e,{ALLOWED_TAGS:bu,ALLOWED_ATTR:xu,SAFE_FOR_XML:!1})}(ha(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{ns(Zr);const t=Ai();t.clear(),t.append(...this.#ut(e)),t.select(),this.#dt(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#ut(e){e||(e="<p></p>");return da(this.editor,Su(`<div>${e}</div>`)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof zr&&!t.isInline())return t}return e}))}#st(){this.#ht(),this.#gt(),this.#pt(),this.#ft(),this.#mt(),this.#yt(),this.#_t(),this.#bt()}#it(){this.editorContentElement=this.editorContentElement||this.#xt();const e=ri({namespace:"LexicalEditor",onError(e){throw e},theme:dc,nodes:this.#kt});return e.setRootElement(this.editorContentElement),e}get#kt(){const e=[Oa,Ma,ea,Vo,el,dl,Pl,Rl,qd];return this.supportsAttachments&&e.push(Cu,Eu),e}#xt(){const e=ku("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#St,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#vt.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#St(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#vt(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#wt(e){const t=void 0!==this.#wt&&this.#wt!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,t&&wu(this,"lexxy:change")}get#wt(){return this._internalFormValue}#_t(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=e}#bt(){document.addEventListener("turbo:before-cache",this.#Tt)}#Tt=e=>{this.#ot()};#ht(){this.#Ct(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#wt=this.value,this.#dt()})))}#Ct(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#Et(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#gt(){qa(this.editor),function(e,t,n){const r=cc(e,n),i=No(e.registerCommand(Ve,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,s=r.pop();null!==i&&(n.push(i),e.dispatchCommand(vt,!0)),0===r.length&&e.dispatchCommand(wt,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:qr})}}(e,t),!0)),0),e.registerCommand(Ze,(()=>(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(wt,!0));const s=n.pop();0===n.length&&e.dispatchCommand(vt,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:qr})}}(e,t),!0)),0),e.registerCommand(kt,(()=>(uc(t),!1)),0),e.registerCommand(St,(()=>(uc(t),e.dispatchCommand(vt,!1),e.dispatchCommand(wt,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:s,dirtyElements:o,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,s,o,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(vt,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(wt,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(this.editor,{current:null,redoStack:[],undoStack:[]},20),ua(this.editor),this.#Nt(),Yl(this.editor,ac)}#Nt(){!function(e,t){if(!e.hasNodes([el,dl]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=_l);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(el,(t=>{e.update((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=vi(n);null!==t&&xl(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(el,(n=>Sl(n,e,t))),e.registerNodeTransform(mn,(n=>bl(n,e,t))),e.registerNodeTransform(dl,(n=>bl(n,e,t))),e.registerCommand(ct,(t=>{const n=function(e){const t=Qn();if(!Mn(t)||!Tl(t))return null;const n=e?ht:dt,r=e?ht:ut,i=t.anchor,s=t.focus;if(i.is(s))return r;const o=Cl(t);if(1!==o.length)return n;const a=o[0];let l,c;0===a.length&&Ga(285),t.isBackward()?(l=s,c=i):(l=i,c=s);const u=ml(a[0]),d=yl(a[0]),h=Fn(u.getKey(),0,"text"),g=Fn(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(ut,(()=>!!Tl(Qn())&&(or([An()]),!0)),1),e.registerCommand(dt,(e=>El(dt)),1),e.registerCommand(ht,(e=>El(ht)),1),e.registerCommand(nt,(e=>{const t=Qn();if(!Mn(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Tl(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&nl(r.getParentOrThrow())?(e.preventDefault(),!0):Nl(nt,e))}),1),e.registerCommand(rt,(e=>{const t=Qn();if(!Mn(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Tl(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&nl(r.getParentOrThrow())?(e.preventDefault(),!0):Nl(rt,e))}),1),e.registerCommand(tt,(e=>Al(tt,e)),1),e.registerCommand(Qe,(e=>Al(Qe,e)),1)),No(...n)}(this.editor),this.append(ku("lexxy-code-language-picker"))}#pt(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=vi(t);if(e instanceof Cu){const t=e.getWritable();Object.assign(t,n)}}))}))}#ft(){this.editor.registerCommand(it,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#mt(){Jd.debug&&this.#Ct(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#yt(){this.#lt&&this.toolbarElement.setEditor(this)}#ct(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#At()}get#lt(){return"false"!==this.getAttribute("toolbar")}#At(){const e=ku("lexxy-toolbar");return e.innerHTML=jl.defaultTemplate,this.prepend(e),e}#dt(){this.classList.toggle("lexxy-editor--empty",this.#Lt)}get#Lt(){return!this.editorContentElement.textContent.trim()&&!this.editorContentElement.querySelector(_u)}#ot(){this.#Et(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Tt)}#at(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",Jd);class Gd extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Pt.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Ft.bind(this)),this.addEventListener("keydown",this.#Ot.bind(this))}show(e){this.input.value=this.#It,this.dialog.show()}close(){this.dialog.close()}#Pt(e){const t=e.submitter?.value;this.#Rt.dispatchCommand(t,this.input.value)}#Ft(e){this.#Rt.dispatchCommand("unlink"),this.close()}#Ot(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#It(){let e="";return this.#Rt.getEditorState().read((()=>{const t=Qn();if(!Mn(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(Il(n)){e=n.getURL();break}n=n.getParent()}})),e}get#Rt(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",Gd);class Vd{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=ku("li",{role:"option",id:Tu("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=Su(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class Zd extends Vd{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Mt(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Mt(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Hd(e).includes(Hd(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class Yd extends Zd{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Xd extends Zd{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class Qd extends Vd{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,s)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){s(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.#Dt(e));return this.#Mt(t)}#Dt(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Mt(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class eh extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#zt(),this.#Bt()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get#$t(){return!this.supportsSpaceInSearches}#zt(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new Qd(e):new Xd(e):new Yd(this.querySelectorAll("lexxy-prompt-item"))}#Bt(){const e=this.#Rt.registerUpdateListener((()=>{this.#Rt.read((()=>{const t=Qn();if(!t)return;let n;if(Mn(t)?n=t.anchor.getNode():zn(t)&&([n]=t.getNodes()),n&&Cn(n)){[...n.getTextContent().trim()].pop()===this.trigger&&(e(),this.#Ut())}}))}))}get#Rt(){return this.#Wt.editor}get#Wt(){return this.closest("lexxy-editor")}get#$e(){return this.#Wt.selection}async#Ut(){this.popoverElement??=await this.#Kt(),await this.#Ht(),this.#jt(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#qt(),this.#Wt.addEventListener("keydown",this.#Jt),this.#Wt.addEventListener("lexxy:change",this.#Ht),this.#Gt()}#Gt(){this.keyListeners.push(this.#Rt.registerCommand(it,this.#Vt.bind(this),3)),this.keyListeners.push(this.#Rt.registerCommand(ct,this.#Vt.bind(this),3)),this.#$t&&this.keyListeners.push(this.#Rt.registerCommand(st,this.#Vt.bind(this),3))}#qt(){const e=this.#Zt[0];e&&this.#Yt(e)}get#Zt(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#Yt(e){this.#Xt(),e.toggleAttribute("aria-selected",!0),e.focus(),this.#Wt.focus(),this.#Qt.setAttribute("aria-controls",this.popoverElement.id),this.#Qt.setAttribute("aria-activedescendant",e.id),this.#Qt.setAttribute("aria-haspopup","listbox")}#Xt(){this.#Zt.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#Qt.removeAttribute("aria-controls"),this.#Qt.removeAttribute("aria-activedescendant"),this.#Qt.removeAttribute("aria-haspopup")}#jt(){const{x:e,y:t,fontSize:n}=this.#$e.cursorPosition,r=this.#Wt.getBoundingClientRect(),i=this.#Qt.getBoundingClientRect().top-r.top;this.popoverElement.style.left=`${e}px`,this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";this.popoverElement.getBoundingClientRect().bottom>window.innerHeight&&(this.popoverElement.style.bottom=`${t-i+n}px`,this.popoverElement.style.top="auto")}async#en(){this.#Xt(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#Wt.removeEventListener("lexxy:change",this.#Ht),this.#Wt.removeEventListener("keydown",this.#Jt),this.#tn(),await Lu(),this.#Bt()}#tn(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#Ht=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#nn.containsTextBackUntil(this.trigger)?await this.#rn():this.#en()};async#rn(){const e=this.#nn.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#in(t):this.#sn(),this.#qt()}#in(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#sn(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=ku("li",{innerHTML:this.#on});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#on(){return this.getAttribute("empty-results")||"Nothing found"}#Jt=e=>{"Escape"===e.key?(this.#en(),this.#Wt.focus(),e.stopPropagation()):"ArrowDown"===e.key?(this.#an(),e.preventDefault(),e.stopPropagation()):"ArrowUp"===e.key&&(this.#ln(),e.preventDefault(),e.stopPropagation())};#an(){const e=this.#cn+1;e<this.#Zt.length&&this.#Yt(this.#Zt[e])}#ln(){const e=this.#cn-1;e>=0&&this.#Yt(this.#Zt[e])}get#cn(){return this.#Zt.findIndex((e=>e.hasAttribute("aria-selected")))}get#un(){return this.#Zt[this.#cn]}#Vt(e){return" "!==e.key&&e.preventDefault(),e.stopPropagation(),this.#dn(),!0}#dn(){this.#hn(),this.#en(),this.#Wt.focus()}#hn(){const e=this.source.promptItemFor(this.#un);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#nn.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#gn(t,n):this.#pn(e,t,n)}#gn(e,t){this.#Rt.update((()=>{const n=da(this.#Rt,Su(`${e.innerHTML}`));this.#nn.replaceTextBackUntil(t,n)}))}#pn(e,t,n){this.#Rt.update((()=>{const r=new qd({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#nn.replaceTextBackUntil(n,r)}))}get#nn(){return this.#Wt.contents}get#Qt(){return this.#Wt.editorContentElement}async#Kt(){const e=ku("ul",{role:"listbox",id:Tu("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#fn),this.#Wt.appendChild(e),e}#fn=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#Yt(t),this.#dn())}}customElements.define("lexxy-prompt",eh);class th extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#mn(),this.#yn()}#mn(){this.languagePickerElement=this.#_n(),this.languagePickerElement.addEventListener("change",(()=>{this.#bn(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.editorElement.appendChild(this.languagePickerElement)}#_n(){const e=ku("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#xn)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#xn(){const e={...cl};e.ruby||(e.ruby="Ruby");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#bn(e){this.editor.update((()=>{const t=this.#kn();t&&t.setLanguage(e)}))}#yn(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#kn();e?this.#Sn(e):this.#vn()}))}))}#kn(){const e=Qn();if(!Mn(e))return null;const t=e.anchor.getNode(),n=t.getParent();return nl(t)?t:nl(n)?n:null}#Sn(e){const t=e.getLanguage();this.#wn(t),this.#Tn(),this.#Cn(e)}#wn(e){if(this.languagePickerElement&&e){const t=function(e){return ul[e]||e}(e);this.languagePickerElement.value=t}}#Cn(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#Tn(){this.languagePickerElement.hidden=!1}#vn(){this.languagePickerElement.hidden=!0}}function nh(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(/<br\s*\/?>/gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),s=ku("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}customElements.define("lexxy-code-language-picker",th),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}(Prism),window.Prism=window.Prism||{},Prism.manual=!0;export{nh as highlightAll};
Binary file
Binary file
@@ -11,7 +11,7 @@ module Lexxy
11
11
 
12
12
  add_default_name_and_id(options)
13
13
  options["input"] ||= dom_id(object, [ options["id"], :trix_input ].compact.join("_")) if object
14
- html_tag = @template_object.lexxy_rich_textarea_tag(options.delete("name"), options.fetch("value") { value }, options.except("value"), &@block)
14
+ html_tag = @template_object.rich_textarea_tag(options.delete("name"), options.fetch("value") { value }, options.except("value"), &@block)
15
15
  error_wrapping(html_tag)
16
16
  end
17
17
  end
data/lib/lexxy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lexxy
2
- VERSION = "0.1.5.beta"
2
+ VERSION = "0.1.6.beta"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.beta
4
+ version: 0.1.6.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-10 00:00:00.000000000 Z
10
+ date: 2025-09-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails