lexxy-realtime 0.4.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +129 -0
- data/app/assets/javascript/lexxy_realtime/lexical.js +11418 -0
- data/app/assets/javascript/lexxy_realtime/lexical.js.map +1 -0
- data/app/assets/javascript/lexxy_realtime/lexical.min.js +17 -0
- data/app/assets/javascript/lexxy_realtime/lexxy-realtime.js +15357 -0
- data/app/assets/javascript/lexxy_realtime/lexxy-realtime.js.map +1 -0
- data/app/assets/javascript/lexxy_realtime/lexxy-realtime.min.js +6 -0
- data/app/assets/javascript/lexxy_realtime/lexxy.js +30472 -0
- data/app/assets/javascript/lexxy_realtime/lexxy.js.map +1 -0
- data/app/assets/javascript/lexxy_realtime/lexxy.min.js +306 -0
- data/lib/generators/lexxy_realtime/install/USAGE +15 -0
- data/lib/generators/lexxy_realtime/install/install_generator.rb +84 -0
- data/lib/generators/lexxy_realtime/install/templates/application_cable_channel.rb +6 -0
- data/lib/generators/lexxy_realtime/install/templates/application_cable_connection.rb +13 -0
- data/lib/generators/lexxy_realtime/install/templates/document_channel.rb +57 -0
- data/lib/lexxy-realtime.rb +4 -0
- data/lib/lexxy_realtime/collaborative.rb +84 -0
- data/lib/lexxy_realtime/engine.rb +26 -0
- data/lib/lexxy_realtime/form_builder.rb +41 -0
- data/lib/lexxy_realtime/version.rb +5 -0
- data/lib/lexxy_realtime.rb +38 -0
- metadata +123 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import*as e from"lexical";import{$addUpdateTag as t,$applyNodeReplacement as n,$caretFromPoint as r,$caretRangeFromSelection as i,$cloneWithProperties as a,$cloneWithProperties as o,$cloneWithPropertiesEphemeral as s,$comparePointCaretNext as c,$copyNode as l,$create as u,$createLineBreakNode as d,$createNodeSelection as f,$createParagraphNode as p,$createPoint as m,$createRangeSelection as h,$createRangeSelectionFromDom as g,$createTabNode as _,$createTextNode as v,$extendCaretToRange as y,$findMatchingParent as b,$findMatchingParent as ee,$getAdjacentChildCaret as x,$getAdjacentNode as te,$getAdjacentSiblingOrParentSiblingCaret as ne,$getAdjacentSiblingOrParentSiblingCaret as re,$getCaretInDirection as ie,$getCaretRange as ae,$getCaretRangeInDirection as oe,$getCharacterOffsets as se,$getChildCaret as ce,$getChildCaretAtIndex as le,$getChildCaretOrSelf as ue,$getCollapsedCaretRange as de,$getCommonAncestor as fe,$getEditor as pe,$getEditorDOMRenderConfig as S,$getNearestNodeFromDOMNode as me,$getNearestRootOrShadowRoot as he,$getNodeByKey as C,$getNodeByKeyOrThrow as ge,$getNodeFromDOMNode as _e,$getPreviousSelection as ve,$getRoot as ye,$getSelection as w,$getSiblingCaret as be,$getState as T,$getTextPointCaret as xe,$hasAncestor as Se,$hasUpdateTag as Ce,$insertNodes as we,$isBlockElementNode as Te,$isChildCaret as Ee,$isDecoratorNode as De,$isEditorState as Oe,$isElementNode as E,$isExtendableTextPointCaret as ke,$isInlineElementOrDecoratorNode as Ae,$isLeafNode as je,$isLexicalNode as Me,$isLineBreakNode as D,$isNodeSelection as Ne,$isParagraphNode as Pe,$isRangeSelection as O,$isRootNode as Fe,$isRootOrShadowRoot as Ie,$isSiblingCaret as Le,$isTabNode as k,$isTextNode as A,$isTextPointCaret as Re,$isTokenOrSegmented as ze,$normalizeCaret as Be,$normalizeSelection__EXPERIMENTAL as Ve,$onUpdate as He,$parseSerializedNode as Ue,$removeTextFromCaretRange as We,$rewindSiblingCaret as Ge,$selectAll as Ke,$selectAll as qe,$setPointFromCaret as Je,$setSelection as j,$setSelectionFromCaretRange as Ye,$setState as Xe,$splitAtPointCaretNext as Ze,$splitNode as Qe,$splitNode as $e,ArtificialNode__DO_NOT_USE as et,CAN_REDO_COMMAND as tt,CAN_UNDO_COMMAND as nt,CLEAR_EDITOR_COMMAND as rt,CLEAR_HISTORY_COMMAND as it,CLICK_COMMAND as at,COLLABORATION_TAG as ot,COMMAND_PRIORITY_CRITICAL as st,COMMAND_PRIORITY_EDITOR as M,COMMAND_PRIORITY_HIGH as N,COMMAND_PRIORITY_LOW as P,COMMAND_PRIORITY_NORMAL as ct,COMPOSITION_END_TAG as lt,COMPOSITION_START_TAG as ut,CONTROLLED_TEXT_INSERTION_COMMAND as dt,COPY_COMMAND as ft,CUT_COMMAND as pt,DEFAULT_EDITOR_DOM_CONFIG as mt,DELETE_CHARACTER_COMMAND as ht,DELETE_LINE_COMMAND as gt,DELETE_WORD_COMMAND as _t,DRAGOVER_COMMAND as vt,DRAGSTART_COMMAND as yt,DROP_COMMAND as bt,DecoratorNode as xt,ElementNode as St,FOCUS_COMMAND as Ct,FORMAT_ELEMENT_COMMAND as wt,FORMAT_TEXT_COMMAND as Tt,HISTORIC_TAG as Et,HISTORY_MERGE_TAG as Dt,HISTORY_PUSH_TAG as Ot,INDENT_CONTENT_COMMAND as kt,INPUT_COMMAND as At,INSERT_LINE_BREAK_COMMAND as jt,INSERT_PARAGRAPH_COMMAND as Mt,INSERT_TAB_COMMAND as Nt,INTERNAL_$isBlock as Pt,KEY_ARROW_DOWN_COMMAND as Ft,KEY_ARROW_LEFT_COMMAND as It,KEY_ARROW_RIGHT_COMMAND as Lt,KEY_ARROW_UP_COMMAND as Rt,KEY_BACKSPACE_COMMAND as zt,KEY_DELETE_COMMAND as Bt,KEY_DOWN_COMMAND as Vt,KEY_ENTER_COMMAND as Ht,KEY_ESCAPE_COMMAND as Ut,KEY_SPACE_COMMAND as Wt,KEY_TAB_COMMAND as Gt,LineBreakNode as Kt,MOVE_TO_END as qt,MOVE_TO_START as Jt,OUTDENT_CONTENT_COMMAND as Yt,PASTE_COMMAND as Xt,PASTE_TAG as Zt,ParagraphNode as Qt,REDO_COMMAND as $t,REMOVE_TEXT_COMMAND as en,RootNode as tn,SELECTION_CHANGE_COMMAND as nn,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as rn,SELECT_ALL_COMMAND as an,SKIP_DOM_SELECTION_TAG as on,SKIP_SCROLL_INTO_VIEW_TAG as sn,SKIP_SELECTION_FOCUS_TAG as cn,TEXT_TYPE_TO_FORMAT as ln,TabNode as un,TextNode as dn,UNDO_COMMAND as fn,addClassNamesToElement as pn,addClassNamesToElement as mn,buildImportMap as hn,configExtension as gn,configExtension as _n,createCommand as vn,createEditor as yn,createState as bn,declarePeerDependency as xn,defineExtension as F,defineExtension as Sn,getDOMSelection as Cn,getDOMTextNode as wn,getNearestEditorFromDOMNode as Tn,getStaticNodeConfig as En,getStyleObjectFromCSS as Dn,getTextDirection as On,isBlockDomNode as kn,isBlockDomNode as An,isCurrentlyReadOnlyMode as jn,isDOMDocumentNode as Mn,isDOMNode as Nn,isDocumentFragment as Pn,isHTMLAnchorElement as Fn,isHTMLElement as In,isHTMLElement as Ln,isInlineDomNode as Rn,isInlineDomNode as zn,isSelectionCapturedInDecoratorInput as Bn,isSelectionWithinEditor as Vn,makeStepwiseIterator as Hn,mergeRegister as Un,mergeRegister as Wn,normalizeClassNames as Gn,removeClassNamesFromElement as Kn,removeClassNamesFromElement as qn,safeCast as Jn,safeCast as Yn,setDOMStyleFromCSS as Xn,setDOMUnmanaged as Zn,setNodeIndentFromDOM as Qn,shallowMergeConfig as $n,shallowMergeConfig as er,toggleTextFormatType as tr}from"lexical";var nr=Object.create,rr=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,ar=Object.getOwnPropertyNames,or=Object.getPrototypeOf,sr=Object.prototype.hasOwnProperty,cr=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),lr=(e,t)=>{let n={};for(var r in e)rr(n,r,{get:e[r],enumerable:!0});return t||rr(n,Symbol.toStringTag,{value:`Module`}),n},ur=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ar(t),a=0,o=i.length,s;a<o;a++)s=i[a],!sr.call(e,s)&&s!==n&&rr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ir(t,s))||r.enumerable});return e},dr=((e,t,n)=>(n=e==null?{}:nr(or(e)),ur(t||!e||!e.__esModule||!sr.call(e,`default`)?rr(n,`default`,{value:e,enumerable:!0}):n,e)))(cr(((e,t)=>{
|
|
2
|
+
/**
|
|
3
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
4
|
+
*
|
|
5
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
6
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
7
|
+
* @namespace
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&`).replace(/</g,`<`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){n||={};var r,a;switch(i.util.type(t)){case`Object`:if(a=i.util.objId(t),n[a])return n[a];for(var o in r={},n[a]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case`Array`:return a=i.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return`none`},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,`gi`),``),e.classList.add(`language-`+n)},currentScript:function(){if(typeof document>`u`)return null;if(document.currentScript&&document.currentScript.tagName===`SCRIPT`)return document.currentScript;try{throw Error()}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName(`script`);for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=i.languages;var a=r[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=r[e];return r[e]=o,i.languages.DFS(i.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,r,a){a||={};var o=i.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var c=t[s],l=i.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:`code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code`};i.hooks.run(`before-highlightall`,r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run(`before-all-elements-highlight`,r);for(var a=0,o;o=r.elements[a++];)i.highlightElement(o,t===!0,r.callback)},highlightElement:function(t,n,r){var a=i.util.getLanguage(t),o=i.languages[a];i.util.setLanguage(t,a);var s=t.parentElement;s&&s.nodeName.toLowerCase()===`pre`&&i.util.setLanguage(s,a);var c={element:t,language:a,grammar:o,code:t.textContent};function l(e){c.highlightedCode=e,i.hooks.run(`before-insert`,c),c.element.innerHTML=c.highlightedCode,i.hooks.run(`after-highlight`,c),i.hooks.run(`complete`,c),r&&r.call(c.element)}if(i.hooks.run(`before-sanity-check`,c),s=c.element.parentElement,s&&s.nodeName.toLowerCase()===`pre`&&!s.hasAttribute(`tabindex`)&&s.setAttribute(`tabindex`,`0`),!c.code){i.hooks.run(`complete`,c),r&&r.call(c.element);return}if(i.hooks.run(`before-highlight`,c),!c.grammar){l(i.util.encode(c.code));return}if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){l(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else l(i.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run(`after-tokenize`,r),a.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new c;return l(i,i.head,e),s(e,i,t,i.head,0),d(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:a};e.Prism=i;function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}a.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var r=``;return t.forEach(function(t){r+=e(t,n)}),r}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),i.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`"`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function o(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function s(e,t,n,r,c,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var ee=h.pattern||h,x=r.next,te=c;x!==t.tail&&!(d&&te>=d.reach);te+=x.value.length,x=x.next){var ne=x.value;if(t.length>e.length)return;if(!(ne instanceof a)){var re=1,ie;if(v){if(ie=o(ee,te,e,_),!ie||ie.index>=e.length)break;var ae=ie.index,oe=ie.index+ie[0].length,se=te;for(se+=x.value.length;ae>=se;)x=x.next,se+=x.value.length;if(se-=x.value.length,te=se,x.value instanceof a)continue;for(var ce=x;ce!==t.tail&&(se<oe||typeof ce.value==`string`);ce=ce.next)re++,se+=ce.value.length;re--,ne=e.slice(te,se),ie.index-=te}else if(ie=o(ee,0,ne,_),!ie)continue;var ae=ie.index,le=ie[0],ue=ne.slice(0,ae),de=ne.slice(ae+le.length),fe=te+ne.length;d&&fe>d.reach&&(d.reach=fe);var pe=x.prev;ue&&(pe=l(t,pe,ue),te+=ue.length),u(t,pe,re);var S=new a(f,g?i.tokenize(le,g):le,y,le);if(x=l(t,pe,S),de&&l(t,x,de),re>1){var me={cause:f+`,`+m,reach:fe};s(e,t,n,x.prev,te,me),d&&me.reach>d.reach&&(d.reach=me.reach)}}}}}}function c(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function d(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}if(!e.document)return e.addEventListener&&(i.disableWorkerMessageHandler||e.addEventListener(`message`,function(t){var n=JSON.parse(t.data),r=n.language,a=n.code,o=n.immediateClose;e.postMessage(i.highlight(a,i.languages[r],r)),o&&e.close()},!1)),i;var f=i.util.currentScript();f&&(i.filename=f.src,f.hasAttribute(`data-manual`)&&(i.manual=!0));function p(){i.manual||i.highlightAll()}if(!i.manual){var m=document.readyState;m===`loading`||m===`interactive`&&f&&f.defer?document.addEventListener(`DOMContentLoaded`,p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return i}(typeof window<`u`?window:typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope?self:{});t!==void 0&&t.exports&&(t.exports=n),typeof global<`u`&&(global.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside[`attr-value`].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside[`internal-subset`].inside=n.languages.markup,n.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&/,`&`))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var a={};a[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend(`markup`,{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),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])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend(`clike`,{"class-name":[n.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),n.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),n.languages.markup&&(n.languages.markup.tag.addInlined(`script`,`javascript`),n.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),n.languages.js=n.languages.javascript,(function(){if(n===void 0||typeof document>`u`)return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=`Loading…`,t=function(e,t){return`✖ Error `+e+` while fetching file: `+t},r=`✖ Error: File does not exist or is empty`,i={js:`javascript`,py:`python`,rb:`ruby`,ps1:`powershell`,psm1:`powershell`,sh:`bash`,bat:`batch`,h:`c`,tex:`latex`},a=`data-src-status`,o=`loading`,s=`loaded`,c=`failed`,l=`pre[data-src]:not([`+a+`="`+s+`"]):not([`+a+`="`+o+`"])`;function u(e,n,i){var a=new XMLHttpRequest;a.open(`GET`,e,!0),a.onreadystatechange=function(){a.readyState==4&&(a.status<400&&a.responseText?n(a.responseText):a.status>=400?i(t(a.status,a.statusText)):i(r))},a.send(null)}function d(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]}}n.hooks.add(`before-highlightall`,function(e){e.selector+=`, `+l}),n.hooks.add(`before-sanity-check`,function(t){var r=t.element;if(r.matches(l)){t.code=``,r.setAttribute(a,o);var f=r.appendChild(document.createElement(`CODE`));f.textContent=e;var p=r.getAttribute(`data-src`),m=t.language;if(m===`none`){var h=(/\.(\w+)$/.exec(p)||[,`none`])[1];m=i[h]||h}n.util.setLanguage(f,m),n.util.setLanguage(r,m);var g=n.plugins.autoloader;g&&g.loadLanguages(m),u(p,function(e){r.setAttribute(a,s);var t=d(r.getAttribute(`data-range`));if(t){var i=e.split(/\r\n?|\n/g),o=t[0],c=t[1]==null?i.length:t[1];o<0&&(o+=i.length),o=Math.max(0,Math.min(o-1,i.length)),c<0&&(c+=i.length),c=Math.max(0,Math.min(c,i.length)),e=i.slice(o,c).join(`
|
|
11
|
+
`),r.hasAttribute(`data-start`)||r.setAttribute(`data-start`,String(o+1))}f.textContent=e,n.highlightElement(f)},function(e){r.setAttribute(a,c),f.textContent=e})}}),n.plugins.fileHighlight={highlight:function(e){for(var t=(e||document).querySelectorAll(l),r=0,i;i=t[r++];)n.highlightElement(i)}};var f=!1;n.fileHighlight=function(){f||=(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()}))(),1);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:/[{}[\];(),.:]/},(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach(function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
|
|
12
|
+
?|
|
|
13
|
+
|(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(Prism),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$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),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*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),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)`,`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){e.type===`entity`&&(e.attributes.title=e.content.replace(/&/,`&`))}),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])*?(?=<\\/__>)`.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])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`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){function t(e){return e=e.replace(/<inner>/g,function(){return`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var n="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",r=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return n}),i=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`;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(`^`+r+i+`(?:`+r+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+r+i+`)(?:`+r+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+r+`)`+i+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+r+`$`),inside:{"table-header":{pattern:RegExp(n),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:t(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(`(~~?)(?:(?!~)<inner>)+\\2`),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:t(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),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){if(e.language!==`markdown`&&e.language!==`md`)return;function t(e){if(!(!e||typeof e==`string`))for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i.type!==`code`){t(i.content);continue}var a=i.content[1],o=i.content[3];if(a&&o&&a.type===`code-language`&&o.type===`code-block`&&typeof a.content==`string`){var s=a.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`);s=(/[a-z][\w-]*/i.exec(s)||[``])[0].toLowerCase();var c=`language-`+s;o.alias?typeof o.alias==`string`?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}}t(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],o=/language-(.+)/.exec(a);if(o){n=o[1];break}}var s=e.languages[n];if(s)t.content=e.highlight(c(t.content),s,n);else if(n&&n!==`none`&&e.plugins.autoloader){var l=`md-`+new Date().valueOf()+`-`+Math.floor(Math.random()*0x2386f26fc10000);t.attributes.id=l,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(l);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})}}});var a=RegExp(e.languages.markup.tag.pattern.source,`gi`),o={amp:`&`,lt:`<`,gt:`>`,quot:`"`},s=String.fromCodePoint||String.fromCharCode;function c(e){var t=e.replace(a,``);return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){return t=t.toLowerCase(),t[0]===`#`?s(t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1))):o[t]||e}),t}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)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),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])*)\\)`,`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://,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>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+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(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),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*)*`,r={pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),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.])`+n+`[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),lookbehind:!0,inside:r.inside},{pattern:RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)`+n+`[A-Z]\\w*\\b`),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+)`+n+`(?:[A-Z]\\w*|\\*)(?=\\s*;)`),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(`(\\bimport\\s+static\\s+)`+n+`(?:\\w+|\\*)(?=\\s*;)`),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*)*\\.?`.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`.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+`.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+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.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),(function(e){function t(e,t){return`___`+e.toUpperCase()+t+`___`}Object.defineProperties(e.languages[`markup-templating`]={},{buildPlaceholders:{value:function(n,r,i,a){if(n.language===r){var o=n.tokenStack=[];n.code=n.code.replace(i,function(e){if(typeof a==`function`&&!a(e))return e;for(var i=o.length,s;n.code.indexOf(s=t(r,i))!==-1;)++i;return o[i]=e,s}),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language!==r||!n.tokenStack)return;n.grammar=e.languages[r];var i=0,a=Object.keys(n.tokenStack);function o(s){for(var c=0;c<s.length&&!(i>=a.length);c++){var l=s[c];if(typeof l==`string`||l.content&&typeof l.content==`string`){var u=a[i],d=n.tokenStack[u],f=typeof l==`string`?l:l.content,p=t(r,u),m=f.indexOf(p);if(m>-1){++i;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),`language-`+r,d),_=f.substring(m+p.length),v=[];h&&v.push.apply(v,o([h])),v.push(g),_&&v.push.apply(v,o([_])),typeof l==`string`?s.splice.apply(s,[c,1].concat(v)):l.content=v}}else l.content&&o(l.content)}return s}o(n.tokens)}}})})(Prism),(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`,`\\((?:[^()\\\\]|\\\\[\\s\\S]|\\((?:[^()\\\\]|\\\\[\\s\\S])*\\))*\\)`,`\\{(?:[^{}\\\\]|\\\\[\\s\\S]|\\{(?:[^{}\\\\]|\\\\[\\s\\S])*\\})*\\}`,`\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S]|\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S])*\\])*\\]`,`<(?:[^<>\\\\]|\\\\[\\s\\S]|<(?:[^<>\\\\]|\\\\[\\s\\S])*>)*>`].join(`|`)+`)`,r=`(?:"(?:\\\\.|[^"\\\\\\r\\n])*"|(?:\\b[a-zA-Z_]\\w*|[^\\s\\0-\\x7F]+)[?!]?|\\$.)`;e.languages.insertBefore(`ruby`,`keyword`,{"regex-literal":[{pattern:RegExp(`%r`+n+`[egimnosux]{0,6}`),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(`(^|[^:]):`+r),lookbehind:!0,greedy:!0},{pattern:RegExp(`([\\r\\n{(,][ \\t]*)`+r+`(?=:(?!:))`),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]?`+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`+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),(function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:`boolean`},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,a=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:`important`},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:`class-name`},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:`function`},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:`type-casting`,greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:`type-hint`,greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:`return-type`,greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:`type-declaration`,greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:`type-declaration`,greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:`static-context`,greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:`class-name-fully-qualified`,greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:`class-name-fully-qualified`,greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:`class-name-fully-qualified`,greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:`type-declaration`,greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:[`class-name-fully-qualified`,`type-declaration`],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:`static-context`,greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:[`class-name-fully-qualified`,`static-context`],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:`type-hint`,greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:[`class-name-fully-qualified`,`type-hint`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:`return-type`,greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:[`class-name-fully-qualified`,`return-type`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:i,punctuation:a};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},s=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:`nowdoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:`symbol`,inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:`heredoc-string`,greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:`symbol`,inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:`backtick-quoted-string`,greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:`single-quoted-string`,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:`double-quoted-string`,greedy:!0,inside:{interpolation:o}}];e.languages.insertBefore(`php`,`variable`,{string:s,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:s,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:`class-name`,greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:[`class-name`,`class-name-fully-qualified`],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:i,punctuation:a}},delimiter:{pattern:/^#\[|\]$/,alias:`punctuation`}}}}),e.hooks.add(`before-tokenize`,function(t){/<\?/.test(t.code)&&e.languages[`markup-templating`].buildPlaceholders(t,`php`,/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)}),e.hooks.add(`after-tokenize`,function(t){e.languages[`markup-templating`].tokenizePlaceholders(t,`php`)})})(Prism),Prism.languages.go=Prism.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go[`class-name`],(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},Prism.languages.webmanifest=Prism.languages.json,(function(e){e.languages.kotlin=e.languages.extend(`clike`,{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin[`class-name`];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:`punctuation`},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore(`kotlin`,`string`,{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:`multiline`,inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:`singleline`,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore(`kotlin`,`keyword`,{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:`builtin`}}),e.languages.insertBefore(`kotlin`,`function`,{label:{pattern:/\b\w+@|@\w+\b/,alias:`symbol`}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin})(Prism),window.Prism||={},window.Prism.manual=!0;function fr(e=document){e.querySelectorAll(`pre[data-language]:not([data-highlighted])`).forEach(e=>{pr(e)})}function pr(e){if(e.dataset.highlighted===`true`)return;let t=e.getAttribute(`data-language`),n=dr.default.languages?.[t];if(!n)return;let{code:r,highlights:i}=mr(e);e.innerHTML=dr.default.highlight(r,n,t),i.length>0&&gr(e,i),e.dataset.highlighted=`true`}function mr(e){let t=e.querySelector(`code`)||e,n=[],r=``;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if(e.tagName===`BR`)r+=`
|
|
14
|
+
`;else if(e.tagName===`MARK`){let t=r.length;for(let t of e.childNodes)i(t);let a=hr(e);a&&n.push({start:t,end:r.length,style:a})}else for(let t of e.childNodes)i(t)}for(let e of t.childNodes)i(e);return{code:r,highlights:n}}function hr(e){let t=[];return e.style?.color&&t.push(`color: ${e.style.color};`),e.style?.backgroundColor&&t.push(`background-color: ${e.style.backgroundColor};`),t.length>0?t.join(` `):null}function gr(e,t){for(let{start:n,end:r,style:i}of t)_r(e,n,r,i)}function _r(e,t,n,r){let i=vr(e);for(let e=i.length-1;e>=0;e--){let{node:a,start:o,end:s}=i[e],c=Math.max(t,o),l=Math.min(n,s);if(c>=l)continue;let u=c-o,d=l-o,f=a.textContent,p=a.parentNode,m=document.createElement(`mark`);m.setAttribute(`style`,r),m.textContent=f.slice(u,d),d<f.length&&p.insertBefore(document.createTextNode(f.slice(d)),a.nextSibling),p.insertBefore(m,a.nextSibling),u>0?a.textContent=f.slice(0,u):p.removeChild(a)}}function vr(e){let t=[],n=0,r=document.createTreeWalker(e,4),i;for(;i=r.nextNode();){let e=i.textContent.length;t.push({node:i,start:n,end:n+e}),n+=e}return t}
|
|
15
|
+
/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */
|
|
16
|
+
function yr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function br(e){if(Array.isArray(e))return e}function xr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Sr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
17
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cr(e,t){return br(e)||xr(e,t)||wr(e,t)||Sr()}function wr(e,t){if(e){if(typeof e==`string`)return yr(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yr(e,t):void 0}}const Tr=Object.entries,Er=Object.setPrototypeOf,Dr=Object.isFrozen,Or=Object.getPrototypeOf,kr=Object.getOwnPropertyDescriptor;let Ar=Object.freeze,jr=Object.seal,Mr=Object.create,Nr=typeof Reflect<`u`&&Reflect,Pr=Nr.apply,Fr=Nr.construct;Ar||=function(e){return e},jr||=function(e){return e},Pr||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Fr||=function(e){return new e(...[...arguments].slice(1))};const Ir=ni(Array.prototype.forEach),Lr=ni(Array.prototype.lastIndexOf),Rr=ni(Array.prototype.pop),zr=ni(Array.prototype.push),Br=ni(Array.prototype.splice),Vr=Array.isArray,Hr=ni(String.prototype.toLowerCase),Ur=ni(String.prototype.toString),Wr=ni(String.prototype.match),Gr=ni(String.prototype.replace),Kr=ni(String.prototype.indexOf),qr=ni(String.prototype.trim),Jr=ni(Number.prototype.toString),Yr=ni(Boolean.prototype.toString),Xr=typeof BigInt>`u`?null:ni(BigInt.prototype.toString),Zr=typeof Symbol>`u`?null:ni(Symbol.prototype.toString),Qr=ni(Object.prototype.hasOwnProperty),$r=ni(Object.prototype.toString),ei=ni(RegExp.prototype.test),ti=ri(TypeError);function ni(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Pr(e,t,n)}}function ri(e){return function(){return Fr(e,[...arguments])}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hr;if(Er&&Er(e,null),!Vr(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Dr(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ii(e){for(let t=0;t<e.length;t++)Qr(e,t)||(e[t]=null);return e}function ai(e){let t=Mr(null);for(let r of Tr(e)){var n=Cr(r,2);let i=n[0],a=n[1];Qr(e,i)&&(t[i]=Vr(a)?ii(a):a&&typeof a==`object`&&a.constructor===Object?ai(a):a)}return t}function oi(e){switch(typeof e){case`string`:return e;case`number`:return Jr(e);case`boolean`:return Yr(e);case`bigint`:return Xr?Xr(e):`0`;case`symbol`:return Zr?Zr(e):`Symbol()`;case`undefined`:return $r(e);case`function`:case`object`:{if(e===null)return $r(e);let t=e,n=si(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:$r(e)}return $r(e)}default:return $r(e)}}function si(e,t){for(;e!==null;){let n=kr(e,t);if(n){if(n.get)return ni(n.get);if(typeof n.value==`function`)return ni(n.value)}e=Or(e)}function n(){return null}return n}function ci(e){try{return ei(e,``),!0}catch{return!1}}const li=Ar(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ui=Ar(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),di=Ar([`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`]),fi=Ar([`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`]),pi=Ar(`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`.split(`.`)),mi=Ar([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),hi=Ar([`#text`]),gi=Ar(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),_i=Ar(`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.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.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`.split(`.`)),vi=Ar(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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`.split(`.`)),yi=Ar([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),bi=jr(/{{[\w\W]*|^[\w\W]*}}/g),xi=jr(/<%[\w\W]*|^[\w\W]*%>/g),Si=jr(/\${[\w\W]*/g),Ci=jr(/^data-[\-\w.\u00B7-\uFFFF]+$/),wi=jr(/^aria-[\-\w]+$/),Ti=jr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ei=jr(/^(?:\w+script|data):/i),Di=jr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Oi=jr(/^html$/i),ki=jr(/^[a-z][.\w]*(-[.\w]+)+$/i),Ai=jr(/<[/\w!]/g),ji=jr(/<[/\w]/g),Mi=jr(/<\/no(script|embed|frames)/i),Ni=jr(/\/>/i),Pi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Fi=function(){return typeof window>`u`?null:window},Ii=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Li=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ri=function(e,t,n,r){return Qr(e,t)&&Vr(e[t])?I(r.base?ai(r.base):{},e[t],r.transform):n};function zi(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fi(),t=e=>zi(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==Pi.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=si(d,`cloneNode`),p=si(d,`remove`),m=si(d,`nextSibling`),h=si(d,`childNodes`),g=si(d,`parentNode`),_=si(d,`shadowRoot`),v=si(d,`attributes`),y=o&&o.prototype?si(o.prototype,`nodeType`):null,b=o&&o.prototype?si(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let ee,x=``,te,ne=!1,re=0,ie=function(){if(re>0)throw ti(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ae=function(e){ie(),re++;try{return ee.createHTML(e)}finally{re--}},oe=function(e){ie(),re++;try{return ee.createScriptURL(e)}finally{re--}},se=function(){return ne||=(te=Ii(u,i),!0),te},ce=n,le=ce.implementation,ue=ce.createNodeIterator,de=ce.createDocumentFragment,fe=ce.getElementsByTagName,pe=r.importNode,S=Li();t.isSupported=typeof Tr==`function`&&typeof g==`function`&&le&&le.createHTMLDocument!==void 0;let me=bi,he=xi,C=Si,ge=Ci,_e=wi,ve=Ei,ye=Di,w=ki,be=Ti,T=null,xe=I({},[...li,...ui,...di,...pi,...hi]),Se=null,Ce=I({},[...gi,..._i,...vi,...yi]),we=Object.seal(Mr(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}})),Te=null,Ee=null,De=Object.seal(Mr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,E=!0,ke=!1,Ae=!0,je=!1,Me=!0,D=!1,Ne=!1,Pe=null,O=null,Fe=!1,Ie=!1,Le=!1,k=!1,A=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He={},Ue=null,We=I({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ge=null,Ke=I({},[`audio`,`video`,`img`,`source`,`image`,`track`]),qe=null,Je=I({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),j=`http://www.w3.org/1998/Math/MathML`,Ye=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=I({},[j,Ye,Xe],Ur),tt=Ar([`mi`,`mo`,`mn`,`ms`,`mtext`]),nt=I({},tt),rt=Ar([`annotation-xml`]),it=I({},rt),at=I({},[`title`,`style`,`font`,`a`,`script`]),ot=null,st=[`application/xhtml+xml`,`text/html`],M=null,N=null,P=n.createElement(`form`),ct=function(e){return e instanceof RegExp||e instanceof Function},lt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(N&&N===e)return;(!e||typeof e!=`object`)&&(e={}),e=ai(e),ot=st.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,M=ot===`application/xhtml+xml`?Ur:Hr,T=Ri(e,`ALLOWED_TAGS`,xe,{transform:M}),Se=Ri(e,`ALLOWED_ATTR`,Ce,{transform:M}),$e=Ri(e,`ALLOWED_NAMESPACES`,et,{transform:Ur}),qe=Ri(e,`ADD_URI_SAFE_ATTR`,Je,{transform:M,base:Je}),Ge=Ri(e,`ADD_DATA_URI_TAGS`,Ke,{transform:M,base:Ke}),Ue=Ri(e,`FORBID_CONTENTS`,We,{transform:M}),Te=Ri(e,`FORBID_TAGS`,ai({}),{transform:M}),Ee=Ri(e,`FORBID_ATTR`,ai({}),{transform:M}),He=Qr(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ai(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,E=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,D=e.WHOLE_DOCUMENT||!1,Ie=e.RETURN_DOM||!1,Le=e.RETURN_DOM_FRAGMENT||!1,k=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,A=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,be=ci(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ti,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,nt=Qr(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?ai(e.MATHML_TEXT_INTEGRATION_POINTS):I({},tt),it=Qr(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?ai(e.HTML_INTEGRATION_POINTS):I({},rt);let t=Qr(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?ai(e.CUSTOM_ELEMENT_HANDLING):Mr(null);if(we=Mr(null),Qr(t,`tagNameCheck`)&&ct(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),Qr(t,`attributeNameCheck`)&&ct(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),Qr(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),jr(we),je&&(E=!1),Le&&(Ie=!0),He&&(T=I({},hi),Se=Mr(null),He.html===!0&&(I(T,li),I(Se,gi)),He.svg===!0&&(I(T,ui),I(Se,_i),I(Se,yi)),He.svgFilters===!0&&(I(T,di),I(Se,_i),I(Se,yi)),He.mathMl===!0&&(I(T,pi),I(Se,vi),I(Se,yi))),De.tagCheck=null,De.attributeCheck=null,Qr(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:Vr(e.ADD_TAGS)&&(T===xe&&(T=ai(T)),I(T,e.ADD_TAGS,M))),Qr(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:Vr(e.ADD_ATTR)&&(Se===Ce&&(Se=ai(Se)),I(Se,e.ADD_ATTR,M))),Qr(e,`ADD_URI_SAFE_ATTR`)&&Vr(e.ADD_URI_SAFE_ATTR)&&I(qe,e.ADD_URI_SAFE_ATTR,M),Qr(e,`FORBID_CONTENTS`)&&Vr(e.FORBID_CONTENTS)&&(Ue===We&&(Ue=ai(Ue)),I(Ue,e.FORBID_CONTENTS,M)),Qr(e,`ADD_FORBID_CONTENTS`)&&Vr(e.ADD_FORBID_CONTENTS)&&(Ue===We&&(Ue=ai(Ue)),I(Ue,e.ADD_FORBID_CONTENTS,M)),Be&&(T[`#text`]=!0),D&&I(T,[`html`,`head`,`body`]),T.table&&(I(T,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ti(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ti(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=ee;ee=e.TRUSTED_TYPES_POLICY;try{x=ae(``)}catch(e){throw ee=t,e}}else e.TRUSTED_TYPES_POLICY===null?(ee=void 0,x=``):(ee===void 0&&(ee=se()),ee&&typeof x==`string`&&(x=ae(``)));Ar&&Ar(e),N=e},ut=I({},[...ui,...di,...fi]),dt=I({},[...pi,...mi]),ft=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===j?e===`svg`&&(n===`annotation-xml`||nt[n]):!!ut[e]},pt=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===Ye?e===`math`&&it[n]:!!dt[e]},mt=function(e,t,n){return t.namespaceURI===Ye&&!it[n]||t.namespaceURI===j&&!nt[n]?!1:!dt[e]&&(at[e]||!ut[e])},ht=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ze,tagName:`template`});let n=Hr(e.tagName),r=Hr(t.tagName);return $e[e.namespaceURI]?e.namespaceURI===Ye?ft(n,t,r):e.namespaceURI===j?pt(n,t,r):e.namespaceURI===Xe?mt(n,t,r):!!(ot===`application/xhtml+xml`&&$e[e.namespaceURI]):!1},gt=function(e){zr(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw ti(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},_t=function(e){bt(e);let t=h(e);if(t){let e=[];Ir(t,t=>{zr(e,t)}),Ir(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},vt=function(e,n){try{zr(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{zr(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ie||Le)try{gt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},yt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||Se[M(i)]))try{e.removeAttribute(i)}catch{}}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===Pi.element&&yt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===Pi.processingInstruction||n===Pi.comment&&ei(ji,e.data)){try{p(e)}catch{}continue}if(n===Pi.element){let t=e,n=M(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},St=function(e){let t=null,r=null;if(Fe)e=`<remove></remove>`+e;else{let t=Wr(e,/^[\r\n\t ]+/);r=t&&t[0]}ot===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=ee?ae(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,ot)}catch{}if(!t||!t.documentElement){t=le.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?fe.call(t,D?`html`:`body`)[0]:D?t.documentElement:a},Ct=function(e){return ue.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},wt=function(e){return e=Gr(e,me,` `),e=Gr(e,he,` `),e=Gr(e,C,` `),e},Tt=function(e){e.normalize();let t=ue.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=wt(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ir(r,e=>{Dt(e.content)&&Tt(e.content)})},Et=function(e){let t=b?b(e):null;return typeof t!=`string`||M(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},Dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===Pi.documentFragment}catch{return!1}},Ot=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function kt(e,n,r){e.length!==0&&Ir(e,e=>{e.call(t,n,r,N)})}let At=function(e,t){return!!(Me&&e.hasChildNodes()&&!Ot(e.firstElementChild)&&ei(Ai,e.textContent)&&ei(Ai,e.innerHTML)||Me&&e.namespaceURI===Xe&&t===`style`&&Ot(e.firstElementChild)||e.nodeType===Pi.processingInstruction||Me&&e.nodeType===Pi.comment&&ei(ji,e.data))},jt=function(e,t){if(!Te[t]&&Ft(t)&&(we.tagNameCheck instanceof RegExp&&ei(we.tagNameCheck,t)||we.tagNameCheck instanceof Function&&we.tagNameCheck(t)))return!1;if(Be&&!Ue[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ve?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return gt(e),!0},Mt=function(e,n){if(kt(S.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(Et(e))return gt(e),!0;let r=M(b?b(e):e.nodeName);if(kt(S.uponSanitizeElement,e,{tagName:r,allowedTags:T}),e!==n&&g(e)===null)return!0;if(At(e,r))return gt(e),!0;if(Te[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!T[r]){let t=jt(e,r);return t===!1&&kt(S.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===Pi.element&&!ht(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ei(Mi,e.innerHTML))return gt(e),!0;if(je&&e.nodeType===Pi.text){let n=wt(e.textContent);e.textContent!==n&&(zr(t.removed,{element:e.cloneNode()}),e.textContent=n)}return kt(S.afterSanitizeElements,e,null),!1},Nt=function(e,t,r){if(Ee[t]||Me&&t===`patchsrc`||Me&&t===`for`&&e!==`label`&&e!==`output`||A&&(t===`id`||t===`name`)&&(r in n||r in P))return!1;let i=Se[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);if(!(E&&ei(ge,t))&&!(Oe&&ei(_e,t))){if(!i){if(!(Ft(e)&&(we.tagNameCheck instanceof RegExp&&ei(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&ei(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t,e))||t===`is`&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&ei(we.tagNameCheck,r)||we.tagNameCheck instanceof Function&&we.tagNameCheck(r))))return!1}else if(!qe[t]&&!ei(be,Gr(r,ye,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Kr(r,`data:`)===0&&Ge[e])&&!(ke&&!ei(ve,Gr(r,ye,``)))&&r)return!1}return!0},Pt=I({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ft=function(e){return!Pt[Hr(e)]&&ei(w,e)},It=function(e,t,n,r){if(ee&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ae(r);case`TrustedScriptURL`:return oe(r)}return r},Lt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Et(e)?gt(e):Rr(t.removed)}catch{vt(n,e)}},Rt=function(e){kt(S.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Et(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0},r=t.length,i=M(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=M(o),u=c,d=o===`value`?u:qr(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,kt(S.uponSanitizeAttribute,e,n),d=n.attrValue,Re&&(l===`id`||l===`name`)&&Kr(d,ze)!==0&&(vt(o,e),d=ze+d),Me&&ei(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){vt(o,e);continue}if(l===`attributename`&&Wr(d,`href`)){vt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){vt(o,e);continue}if(!Ae&&ei(Ni,d)){vt(o,e);continue}if(je&&(d=wt(d)),!Nt(i,l,d)){vt(o,e);continue}d=It(i,l,s,d),d!==u&&Lt(e,o,s,d)}}kt(S.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=Ct(e);for(kt(S.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(kt(S.uponSanitizeShadowNode,t,null),Mt(t,e),Rt(t),Dt(t.content)&&zt(t.content),(y?y(t):t.nodeType)===Pi.element){let e=_(t);Dt(e)&&(Bt(e),zt(e))}kt(S.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===Pi.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&M(e)===`template`){let e=n.content;Dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);Dt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!Ot(e)&&(e=oi(e),typeof e!=`string`))throw ti(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ne?(T=Pe,Se=O):lt(n),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(T=ai(T)),S.uponSanitizeAttribute.length>0&&(Se=ai(Se)),t.removed=[];let c=Ve&&typeof e!=`string`&&Ot(e);if(c){xt(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=M(t);if(!T[n]||Te[n])throw _t(e),ti(`root node is forbidden and cannot be sanitized in-place`)}if(Et(e))throw _t(e),ti(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw _t(e),t}}else if(Ot(e))i=St(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Pi.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(a);else{if(!Ie&&!je&&!D&&e.indexOf(`<`)===-1)return ee&&k?ae(e):e;if(i=St(e),!i)return Ie?null:k?x:``}i&&Fe&>(i.firstChild);let l=c?e:i,u=Ct(l);try{for(;o=u.nextNode();)Mt(o,l),Rt(o),Dt(o.content)&&zt(o.content)}catch(n){throw c&&(_t(e),Ir(t.removed,e=>{e.element&&bt(e.element)})),n}if(c)return Ir(t.removed,e=>{e.element&&bt(e.element)}),je&&Tt(e),e;if(Ie){if(je&&Tt(i),Le)for(s=de.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Se.shadowroot||Se.shadowrootmode)&&(s=pe.call(r,s,!0)),s}let d=D?i.outerHTML:i.innerHTML;return D&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ei(Oi,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
18
|
+
`+d),je&&(d=wt(d)),ee&&k?ae(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(e),Ne=!0,Pe=T,O=Se},t.clearConfig=function(){N=null,Ne=!1,Pe=null,O=null,ee=te,x=``},t.isValidAttribute=function(e,t,n){N||lt({});let r=M(e),i=M(t);return Nt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Qr(S,e)&&zr(S[e],t)},t.removeHook=function(e,t){if(Qr(S,e)){if(t!==void 0){let n=Lr(S[e],t);return n===-1?void 0:Br(S[e],n,1)[0]}return Rr(S[e])}},t.removeHooks=function(e){Qr(S,e)&&(S[e]=[])},t.removeAllHooks=function(){S=Li()},t}var Bi=zi(),Vi=lr({$addNodeStyle:()=>ea,$cloneWithProperties:()=>o,$copyBlockFormatIndent:()=>aa,$ensureForwardRangeSelection:()=>ia,$forEachSelectedTextNode:()=>ra,$getComputedStyleForElement:()=>Ji,$getComputedStyleForParent:()=>Yi,$getSelectionStyleValueForProperty:()=>va,$isAtNodeEnd:()=>Qi,$isParentElementRTL:()=>ha,$isParentRTL:()=>Xi,$moveCaretSelection:()=>ma,$moveCharacter:()=>ga,$patchStyleText:()=>na,$selectAll:()=>qe,$setBlocksType:()=>oa,$shouldOverrideDefaultCharacterSelection:()=>pa,$sliceSelectedTextNodeContent:()=>Zi,$trimTextContentFromAnchor:()=>$i,$wrapNodes:()=>la,createDOMRange:()=>Gi,createRectsFromDOMRange:()=>Ki,getCSSFromStyleObject:()=>qi,getStyleObjectFromCSS:()=>ya,trimTextContentFromAnchor:()=>ba});function Hi(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 Ui(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function Wi(e){let t=e.parentNode;if(t==null)throw Error(`Should never happen`);return[t,Array.from(t.childNodes).indexOf(e)]}function Gi(e,t,n,r,i){let a=t.getKey(),o=r.getKey(),s=document.createRange(),c=e.getElementByKey(a),l=e.getElementByKey(o),u=n,d=i;if(A(t)&&(c=Ui(c)),A(r)&&(l=Ui(l)),t===void 0||r===void 0||c===null||l===null)return null;c.nodeName===`BR`&&([c,u]=Wi(c)),l.nodeName===`BR`&&([l,d]=Wi(l));let f=c.firstChild;c===l&&f!=null&&f.nodeName===`BR`&&u===0&&d===0&&(d=1);try{s.setStart(c,u),s.setEnd(l,d)}catch{return null}return!s.collapsed||u===d&&a===o||(s.setStart(l,d),s.setEnd(c,u)),s}function Ki(e,t){let n=e.getRootElement();if(n===null)return[];let r=n.getBoundingClientRect(),i=getComputedStyle(n),a=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=Array.from(t.getClientRects()),s,c=o.length;o.sort((e,t)=>{let n=e.top-t.top;return Math.abs(n)<=3?e.left-t.left:n});for(let e=0;e<c;e++){let t=o[e],n=s&&s.top<=t.top&&s.top+s.height>t.top&&s.left+s.width>t.left,i=t.width+a===r.width;n||i?(o.splice(e--,1),c--):s=t}return o}function qi(e){let t=``;for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ji(e){let t=pe().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Yi(e){return Ji(Fe(e)?e:e.getParentOrThrow())}function Xi(e){let t=Yi(e);return t!==null&&t.direction===`rtl`}function Zi(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!ze(t)&&r!==null){let[i,a]=r,o=e.isBackward(),c=i.getNode(),l=a.getNode(),u=t.is(c),d=t.is(l);if(u||d){let[r,i]=se(e),a=c.is(l),u=t.is(o?l:c),d=t.is(o?c:l),f,p=0;a?(p=r>i?i:r,f=r>i?r:i):u?(p=o?i:r,f=void 0):d&&(p=0,f=o?r:i);let m=t.__text.slice(p,f);m!==t.__text&&(n===`clone`&&(t=s(t)),t.__text=m)}}return t}function Qi(e){if(e.type===`text`)return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return E(t)||Hi(177),e.offset===t.getChildrenSize()}function $i(e,t,n){let r=t.getNode(),i=n;if(E(r)){let e=r.getDescendantByIndex(t.offset);e!==null&&(r=e)}for(;i>0&&r!==null;){if(E(r)){let e=r.getLastDescendant();e!==null&&(r=e)}let n=r.getPreviousSibling(),a=0;if(n===null){let e=r.getParentOrThrow(),t=e.getPreviousSibling();for(;t===null;){if(e=e.getParent(),e===null){n=null;break}t=e.getPreviousSibling()}e!==null&&(a=e.isInline()?0:2,n=t)}let o=r.getTextContent();o===``&&E(r)&&!r.isInline()&&(o=`
|
|
19
|
+
|
|
20
|
+
`);let s=o.length;if(!A(r)||i>=s){let e=r.getParent();r.remove(),e==null||e.getChildrenSize()!==0||Fe(e)||e.remove(),i-=s+a,r=n}else{let n=r.getKey(),a=e.getEditorState().read(()=>{let e=C(n);return A(e)&&e.isSimpleText()?e.getTextContent():null}),c=s-i,l=o.slice(0,c);if(a!==null&&a!==o){let e=ve(),t=r;if(r.isSimpleText())r.setTextContent(a);else{let e=v(a);r.replace(e),t=e}if(O(e)&&e.isCollapsed()){let n=e.anchor.offset;t.select(n,n)}}else if(r.isSimpleText()){let e=t.key===n,a=t.offset;a<i&&(a=s);let o=e?a-i:0,l=e?a:c;if(e&&o===0){let[e]=r.splitText(o,l);e.remove()}else{let[,e]=r.splitText(o,l);e.remove()}}else{let e=v(l);r.replace(e)}i=0}}}const ea=()=>{};function ta(e,t){(O(e)?e.isCollapsed():A(e)||E(e))||Hi(280);let n=Dn(O(e)?e.style:A(e)?e.getStyle():e.getTextStyle()),r=qi(Object.entries(t).reduce((t,[r,i])=>(typeof i==`function`?t[r]=i(n[r],e):i===null?delete t[r]:t[r]=i,t),{...n}));O(e)||A(e)?e.setStyle(r):e.setTextStyle(r)}function na(e,t){if(O(e)&&e.isCollapsed()){ta(e,t);let n=e.anchor.getNode();E(n)&&n.isEmpty()&&ta(n,t)}ra(e=>{ta(e,t)});let n=e.getNodes();if(n.length>0){let e=new Set;for(let r of n){if(!E(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let n=r.getKey();e.has(n)||(e.add(n),ta(r,t))}}}function ra(e){let t=w();if(!t)return;let n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(O(t))for(let e of i(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());let a=t.getNodes();for(let t of a){if(!A(t)||!t.canHaveFormat())continue;let[n,i]=r(t);i!==n&&(ze(t)||n===0&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[n===0?0:1]))}O(t)&&t.anchor.type===`text`&&t.focus.type===`text`&&t.anchor.key===t.focus.key&&ia(t)}function ia(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:r,offset:i,type:a}=t;t.set(n.key,n.offset,n.type),n.set(r,i,a)}}function aa(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function oa(e,t,n=aa){if(e===null)return;let r=e.getStartEndPoints(),i=new Map,a=null;if(r){let[e,t]=r;a=h(),a.anchor.set(e.key,e.offset,e.type),a.focus.set(t.key,t.offset,t.type);let n=b(e.getNode(),Pt),o=b(t.getNode(),Pt);E(n)&&i.set(n.getKey(),n),E(o)&&i.set(o.getKey(),o)}for(let t of e.getNodes())if(E(t)&&Pt(t))i.set(t.getKey(),t);else if(r===null){let e=b(t,Pt);E(e)&&i.set(e.getKey(),e)}for(let[e,r]of i){let i=t();n(r,i),r.replace(i,!0),a&&(e===a.anchor.key&&a.anchor.set(i.getKey(),a.anchor.offset,a.anchor.type),e===a.focus.key&&a.focus.set(i.getKey(),a.focus.offset,a.focus.type))}a&&e.is(w())&&j(a)}function sa(e){return e.getNode().isAttached()}function ca(e){let t=e;for(;t!==null&&!Ie(t);){let e=t.getLatest(),n=t.getParent();e.getChildrenSize()===0&&t.remove(!0),t=n}}function la(e,t,n=null){let r=e.getStartEndPoints(),i=r?r[0]:null,a=e.getNodes(),o=a.length;if(i!==null&&(o===0||o===1&&i.type===`element`&&i.getNode().getChildrenSize()===0)){let e=i.type===`text`?i.getNode().getParentOrThrow():i.getNode(),r=e.getChildren(),a=t();a.setFormat(e.getFormatType()),a.setIndent(e.getIndent()),r.forEach(e=>a.append(e)),n&&(a=n.append(a)),e.replace(a);return}let s=null,c=[];for(let r=0;r<o;r++){let i=a[r];Ie(i)?(ua(e,c,c.length,t,n),c=[],s=i):s===null||s!==null&&Se(i,s)?c.push(i):(ua(e,c,c.length,t,n),c=[i])}ua(e,c,c.length,t,n)}function ua(e,t,n,r,i=null){if(t.length===0)return;let a=t[0],o=new Map,s=[],c=E(a)?a:a.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let l=!1;for(;c!==null;){let e=c.getPreviousSibling();if(e!==null){c=e,l=!0;break}if(c=c.getParentOrThrow(),Ie(c))break}let u=new Set;for(let e=0;e<n;e++){let n=t[e];E(n)&&n.getChildrenSize()===0&&u.add(n.getKey())}let d=new Set;for(let e=0;e<n;e++){let n=t[e],i=n.getParent();if(i!==null&&i.isInline()&&(i=i.getParent()),i!==null&&je(n)&&!d.has(n.getKey())){let e=i.getKey();if(o.get(e)===void 0){let t=r();t.setFormat(i.getFormatType()),t.setIndent(i.getIndent()),s.push(t),o.set(e,t),i.getChildren().forEach(e=>{t.append(e),d.add(e.getKey()),E(e)&&e.getChildrenKeys().forEach(e=>d.add(e))}),ca(i)}}else if(u.has(n.getKey())){E(n)||Hi(179);let e=r();e.setFormat(n.getFormatType()),e.setIndent(n.getIndent()),s.push(e),n.remove(!0)}}if(i!==null)for(let e=0;e<s.length;e++){let t=s[e];i.append(t)}let f=null;if(Ie(c))if(l)if(i!==null)c.insertAfter(i);else for(let e=s.length-1;e>=0;e--){let t=s[e];c.insertAfter(t)}else{let e=c.getFirstChild();if(E(e)&&(c=e),e===null)if(i)c.append(i);else for(let e=0;e<s.length;e++){let t=s[e];c.append(t),f=t}else if(i!==null)e.insertBefore(i);else for(let t=0;t<s.length;t++){let n=s[t];e.insertBefore(n),f=n}}else if(i)c.insertAfter(i);else for(let e=s.length-1;e>=0;e--){let t=s[e];c.insertAfter(t),f=t}let p=ve();O(p)&&sa(p.anchor)&&sa(p.focus)?j(p.clone()):f===null?e.dirty=!0:f.selectEnd()}function da(e){let t=fa(e);return t!==null&&t.writingMode===`vertical-rl`}function fa(e){let t=e.anchor.getNode();return E(t)?Ji(t):Yi(t)}function pa(e,t){let n=da(e)?!t:t;ha(e)&&(n=!n);let i=r(e.focus,n?`previous`:`next`);if(ke(i))return!1;for(let e of y(i)){if(Ee(e))return!e.origin.isInline();if(!E(e.origin)){if(De(e.origin))return!0;break}}return!1}function ma(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function ha(e){let t=fa(e);return t!==null&&t.direction===`rtl`}function ga(e,t,n){let r=ha(e),i;i=da(e)||r?!n:n,ma(e,t,i,`character`)}function _a(e,t,n){let r=e.getStyle(),i=Dn(r);return i!==null&&i[t]||n}function va(e,t,n=``){let r=null,i=e.getNodes(),a=e.anchor,o=e.focus,s=e.isBackward(),c=s?o.getNode():a.getNode(),l=s?a.getNode():o.getNode(),u=s?o.offset:a.offset,d=s?a.offset:o.offset;if(O(e)&&e.isCollapsed()&&e.style!==``){let n=e.style,r=Dn(n);if(r!==null&&t in r)return r[t]}for(let e=0;e<i.length;e++){let a=i[e];if((e!==0||!a.is(c)||!A(a)||u!==a.getTextContentSize())&&(e===0||!a.is(l)||d!==0)&&A(a)){let e=_a(a,t,n);if(r===null)r=e;else if(r!==e){r=``;break}}}return r===null?n:r}const ya=Dn,ba=$i,xa=Vi,Sa=xa.$addNodeStyle;xa.$cloneWithProperties,xa.$copyBlockFormatIndent;const Ca=xa.$ensureForwardRangeSelection,wa=xa.$forEachSelectedTextNode;xa.$getComputedStyleForElement,xa.$getComputedStyleForParent;const Ta=xa.$getSelectionStyleValueForProperty,Ea=xa.$isAtNodeEnd;xa.$isParentElementRTL;const Da=xa.$isParentRTL;xa.$moveCaretSelection;const Oa=xa.$moveCharacter,ka=xa.$patchStyleText;xa.$selectAll;const Aa=xa.$setBlocksType,ja=xa.$shouldOverrideDefaultCharacterSelection,Ma=xa.$sliceSelectedTextNodeContent;xa.$trimTextContentFromAnchor,xa.$wrapNodes,xa.createDOMRange;const Na=xa.createRectsFromDOMRange,Pa=xa.getCSSFromStyleObject,Fa=xa.getStyleObjectFromCSS;xa.trimTextContentFromAnchor;var Ia=lr({$descendantsMatching:()=>Ho,$dfs:()=>ho,$dfsIterator:()=>vo,$filter:()=>Po,$findMatchingParent:()=>ee,$firstToLastIterator:()=>Uo,$getAdjacentCaret:()=>go,$getAdjacentSiblingOrParentSiblingCaret:()=>re,$getDepth:()=>So,$getNearestBlockElementAncestorOrThrow:()=>Eo,$getNearestNodeOfType:()=>To,$getNextRightPreorderNode:()=>Co,$getNextSiblingOrParentSibling:()=>xo,$handleIndentAndOutdent:()=>Fo,$insertFirst:()=>Io,$insertNodeIntoLeaf:()=>jo,$insertNodeToNearestRoot:()=>ko,$insertNodeToNearestRootAtCaret:()=>Ao,$isEditorIsNestedEditor:()=>zo,$lastToFirstIterator:()=>Wo,$restoreEditorState:()=>Oo,$reverseDfs:()=>_o,$reverseDfsIterator:()=>wo,$splitNode:()=>$e,$unwrapAndFilterDescendants:()=>Bo,$unwrapNode:()=>Ko,$wrapNodeInElement:()=>Mo,CAN_USE_BEFORE_INPUT:()=>no,CAN_USE_DOM:()=>ro,IS_ANDROID:()=>io,IS_ANDROID_CHROME:()=>ao,IS_APPLE:()=>oo,IS_APPLE_WEBKIT:()=>so,IS_CHROME:()=>co,IS_FIREFOX:()=>lo,IS_IOS:()=>uo,IS_SAFARI:()=>fo,addClassNamesToElement:()=>mn,calculateZoomLevel:()=>Ro,isBlockDomNode:()=>An,isHTMLAnchorElement:()=>Fn,isHTMLElement:()=>Ln,isInlineDomNode:()=>zn,isMimeType:()=>po,makeStateWrapper:()=>qo,markSelection:()=>eo,mediaFileReader:()=>mo,mergeRegister:()=>Wn,objectKlassEquals:()=>No,positionNodeOnRange:()=>Za,registerNestedElementResolver:()=>Do,removeClassNamesFromElement:()=>qn,selectionAlwaysOnDisplay:()=>to});function La(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ra=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,za=Ra&&`documentMode`in document?document.documentMode:null,Ba=Ra&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Va=Ra&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ha=!(!Ra||!(`InputEvent`in window)||za)&&`getTargetRanges`in new window.InputEvent(`input`),Ua=Ra&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Wa=Ra&&/Android/.test(navigator.userAgent),Ga=Ra&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Wa,Ka=Ra&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qa=Ra&&Wa&&Ka,Ja=Ra&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ba&&!Ka;function Ya(e){return`${e}px`}const Xa={attributes:!0,characterData:!0,childList:!0,subtree:!0};function Za(e,t,n){let r=null,i=null,a=null,o=[],s=document.createElement(`div`);function c(){r===null&&La(182),i===null&&La(183);let{left:a,top:c}=i.getBoundingClientRect(),l=Na(e,t);var u,d;s.isConnected||(d=s,(u=i).insertBefore(d,u.firstChild));let f=!1;for(let e=0;e<l.length;e++){let t=l[e],n=o[e]||document.createElement(`div`),r=n.style;r.position!==`absolute`&&(r.position=`absolute`,f=!0);let i=Ya(t.left-a);r.left!==i&&(r.left=i,f=!0);let u=Ya(t.top-c);r.top!==u&&(n.style.top=u,f=!0);let d=Ya(t.width);r.width!==d&&(n.style.width=d,f=!0);let p=Ya(t.height);r.height!==p&&(n.style.height=p,f=!0),n.parentNode!==s&&(s.append(n),f=!0),o[e]=n}for(;o.length>l.length;)o.pop();f&&n(o)}function l(){i=null,r=null,a!==null&&a.disconnect(),a=null,s.remove();for(let e of o)e.remove();o=[]}s.style.position=`relative`;let u=e.registerRootListener(function t(){let n=e.getRootElement();if(n===null)return l();let o=n.parentElement;if(!In(o))return l();l(),r=n,i=o,a=new MutationObserver(n=>{let a=e.getRootElement(),o=a&&a.parentElement;if(a!==r||o!==i)return t();for(let e of n)if(!s.contains(e.target))return c()}),a.observe(o,Xa),c()});return()=>{u(),l()}}function Qa(e,t,n){if(e.type!==`text`&&E(t)){let r=pe(),i=S(r).$getDOMSlot(t,n,r);return[i.element,i.getFirstChildOffset()+e.offset]}return[wn(n)||n,e.offset]}function $a(e){for(let t of e){let e=t.style;e.background!==`Highlight`&&(e.background=`Highlight`),e.color!==`HighlightText`&&(e.color=`HighlightText`),e.marginTop!==Ya(-1.5)&&(e.marginTop=Ya(-1.5)),e.paddingTop!==Ya(4)&&(e.paddingTop=Ya(4)),e.paddingBottom!==Ya(0)&&(e.paddingBottom=Ya(0))}}function eo(e,t=$a){let n=null,r=null,i=null,a=null,o=null,s=null,c=()=>{};function l(l){l.read(()=>{let l=w();if(!O(l))return n=null,i=null,a=null,s=null,c(),void(c=()=>{});let[u,d]=function(e){let t=e.getStartEndPoints();return e.isBackward()?[t[1],t[0]]:t}(l),f=u.getNode(),p=f.getKey(),m=u.offset,h=d.getNode(),g=h.getKey(),_=d.offset,v=e.getElementByKey(p),y=e.getElementByKey(g),b=n===null||v!==r||m!==i||p!==n.getKey(),ee=a===null||y!==o||_!==s||g!==a.getKey();if((b||ee)&&v!==null&&y!==null){let n=function(e,t,n,r,i,a,o){let s=(e._window?e._window.document:document).createRange();return s.setStart(...Qa(t,n,r)),s.setEnd(...Qa(i,a,o)),s}(e,u,f,v,d,h,y);c(),c=Za(e,n,t)}n=f,r=v,i=m,a=h,o=y,s=_})}return l(e.getEditorState()),Un(e.registerUpdateListener(({editorState:e})=>l(e)),()=>{c()})}function to(e,t){let n=null,r=()=>{let r=getSelection(),i=r&&r.anchorNode,a=e.getRootElement();i!==null&&a!==null&&a.contains(i)?n!==null&&(n(),n=null):n===null&&(n=eo(e,t))};return e.registerRootListener(e=>{if(e){let t=e.ownerDocument;return t.addEventListener(`selectionchange`,r),r(),()=>{n!==null&&n(),t.removeEventListener(`selectionchange`,r)}}})}const no=Ha,ro=Ra,io=Wa,ao=qa,oo=Ba,so=Ja,co=Ka,lo=Va,uo=Ua,fo=Ga;function po(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function mo(e,t){let n=e[Symbol.iterator]();return new Promise((e,r)=>{let i=[],a=()=>{let{done:o,value:s}=n.next();if(o)return e(i);let c=new FileReader;c.addEventListener(`error`,r),c.addEventListener(`load`,()=>{let e=c.result;typeof e==`string`&&i.push({file:s,result:e}),a()}),po(s,t)?c.readAsDataURL(s):a()};a()})}function ho(e,t){return Array.from(vo(e,t))}function go(e){return e?e.getAdjacentCaret():null}function _o(e,t){return Array.from(wo(e,t))}function vo(e,t){return bo(`next`,e,t)}function yo(e,t){let n=ne(be(e,t));return n&&n[0]}function bo(e,t,n){let r=ye(),i=t||r,a=E(i)?ce(i,e):be(i,e),o=So(i),s=n?x(ue(be(n,e)))||yo(n,e):yo(i,e),c=o;return Hn({hasNext:e=>e!==null,initial:a,map:e=>({depth:c,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;Ee(e)&&c++;let t=ne(e);return!t||t[0].isSameNodeCaret(s)?null:(c+=t[1],t[0])}})}function xo(e){let t=ne(be(e,`next`));return t&&[t[0].origin,t[1]]}function So(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function Co(e){let t=ue(be(e,`previous`)),n=ne(t,`root`);return n&&n[0].origin}function wo(e,t){return bo(`previous`,e,t)}function To(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function Eo(e){let t=b(e,e=>E(e)&&!e.isInline());return E(t)||La(4,e.__key),t}function Do(e,t,n,r){let i=e=>e instanceof t;return e.registerNodeTransform(t,e=>{let t=(e=>{let t=e.getChildren();for(let e=0;e<t.length;e++){let n=t[e];if(i(n))return null}let n=e,r=e;for(;n!==null;)if(r=n,n=n.getParent(),i(n))return{child:r,parent:n};return null})(e);if(t!==null){let{child:i,parent:a}=t;if(i.is(e)){r(a,e);let t=i.getNextSiblings(),o=t.length;if(a.insertAfter(i),o!==0){let e=n(a);i.insertAfter(e);for(let n=0;n<o;n++)e.append(t[n])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})}function Oo(e,t){let n=new Map,r=e._pendingEditorState;for(let[e,r]of t._nodeMap)n.set(e,a(r));r&&(r._nodeMap=n),e._dirtyType=2;let i=t._selection;j(i===null?null:i.clone())}function ko(e){let t=w()||ve(),n;if(O(t))n=r(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=be(r,`next`))}n||=ce(ye(),`previous`).getFlipped().insert(p())}let i=Ao(e,n),a=x(i),o=Ee(a)?Be(a):i;return Ye(de(o)),e.getLatest()}function Ao(e,t,n){let r=ie(t,`next`);Re(r)&&(r.offset===0?r=be(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=be(r.origin,`next`))),r.origin.is(e)&&(Le(r)||La(342,e.getKey(),e.getType()),r=Ge(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Ze(e,n))r=e;return Re(r)&&La(283),r.insert(e.isInline()?p().append(e):e),ie(be(e.getLatest(),`next`),t.direction)}function jo(e){let t=w();if(!O(t))return void(t&&t.insertNodes([e]));let n=i(t),r=oe(We(n),`next`).anchor;if(Re(r)){let e=Ze(r);if(!e)return;r=e}let a=r.getFlipped();a.insert(e),Ye(ae(a,a))}function Mo(e,t){let n=t();return e.replace(n),n.append(e),n}function No(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function Po(e,t){let n=[];for(let r=0;r<e.length;r++){let i=t(e[r]);i!==null&&n.push(i)}return n}function Fo(e){let t=w();if(!O(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=b(i,e=>E(e)&&!e.isInline());if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}function Io(e,t){ce(e,`next`).insert(t)}let Lo=!(lo||!ro)&&void 0;function Ro(e,t=!1){let n=1;if(function(){if(Lo===void 0){let e=document.createElement(`div`);e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`100px`,e.style.left=`-1000px`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),Lo=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return Lo}()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue(`zoom`)),e=e.parentElement;return n}function zo(e){return e._parentEditor!==null}function Bo(e,t){return Vo(e,t,null)}function Vo(e,t,n){let r=!1;for(let i of Wo(e))t(i)?n!==null&&n(i):(r=!0,E(i)&&Vo(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function Ho(e,t){let n=[],r=Array.from(e).reverse();for(let e=r.pop();e!==void 0;e=r.pop())if(t(e))n.push(e);else if(E(e))for(let t of Wo(e))r.push(t);return n}function Uo(e){return Go(ce(e,`next`))}function Wo(e){return Go(ce(e,`previous`))}function Go(e){return Hn({hasNext:Le,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function Ko(e){Ge(be(e,`next`)).splice(1,e.getChildren())}function qo(e){let t=t=>T(t,e),n=(t,n)=>Xe(t,e,n);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(e){return n(this,e)},stateConfig:e}}const L=Ia,Jo=L.$descendantsMatching,Yo=L.$dfs;L.$dfsIterator,L.$filter;const R=L.$findMatchingParent,Xo=L.$firstToLastIterator;L.$getAdjacentCaret,L.$getAdjacentSiblingOrParentSiblingCaret,L.$getDepth;const Zo=L.$getNearestBlockElementAncestorOrThrow,Qo=L.$getNearestNodeOfType;L.$getNextRightPreorderNode,L.$getNextSiblingOrParentSibling;const $o=L.$handleIndentAndOutdent,es=L.$insertFirst;L.$insertNodeIntoLeaf;const ts=L.$insertNodeToNearestRoot,ns=L.$insertNodeToNearestRootAtCaret;L.$isEditorIsNestedEditor;const rs=L.$lastToFirstIterator;L.$restoreEditorState,L.$reverseDfs,L.$reverseDfsIterator,L.$splitNode;const is=L.$unwrapAndFilterDescendants;L.$unwrapNode;const as=L.$wrapNodeInElement;L.CAN_USE_BEFORE_INPUT,L.CAN_USE_DOM,L.IS_ANDROID,L.IS_ANDROID_CHROME;const os=L.IS_APPLE;L.IS_APPLE_WEBKIT,L.IS_CHROME,L.IS_FIREFOX,L.IS_IOS,L.IS_SAFARI;const ss=L.addClassNamesToElement,cs=L.calculateZoomLevel;L.isBlockDomNode;const ls=L.isHTMLAnchorElement,us=L.isHTMLElement;L.isInlineDomNode,L.isMimeType,L.makeStateWrapper,L.markSelection,L.mediaFileReader;const ds=L.mergeRegister,fs=L.objectKlassEquals;L.positionNodeOnRange,L.registerNestedElementResolver;const ps=L.removeClassNamesFromElement,ms=L.selectionAlwaysOnDisplay;var hs=lr({$createHorizontalRuleNode:()=>Dc,$isDecoratorTextNode:()=>Ys,$isHorizontalRuleNode:()=>Oc,AutoFocusExtension:()=>Vs,ClearEditorExtension:()=>Ws,DecoratorTextExtension:()=>ec,DecoratorTextNode:()=>Js,EditorStateExtension:()=>nc,HorizontalRuleExtension:()=>kc,HorizontalRuleNode:()=>Tc,INSERT_HORIZONTAL_RULE_COMMAND:()=>wc,InitialStateExtension:()=>dc,LexicalBuilder:()=>vc,NestedEditorExtension:()=>Ac,NodeSelectionExtension:()=>Cc,SelectionAlwaysOnDisplayExtension:()=>jc,TabIndentationExtension:()=>Pc,applyFormatFromStyle:()=>Xs,applyFormatToDom:()=>Zs,batch:()=>vs,buildEditorFromExtensions:()=>pc,computed:()=>Ps,configExtension:()=>_n,declarePeerDependency:()=>xn,defineExtension:()=>Sn,effect:()=>zs,getExtensionDependencyFromEditor:()=>yc,getKnownTypesAndNodes:()=>Gs,getPeerDependencyFromEditor:()=>bc,getPeerDependencyFromEditorOrThrow:()=>xc,namedSignals:()=>Bs,registerClearEditor:()=>Us,registerTabIndentation:()=>Nc,safeCast:()=>Yn,shallowMergeConfig:()=>er,signal:()=>ks,untracked:()=>bs,watchedSignal:()=>tc});const gs=Symbol.for(`preact-signals`);function _s(){if(Ss>1)return void Ss--;let e,t=!1;for(function(){let e=xs;for(xs=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();ys!==void 0;){let n=ys;for(ys=void 0,Cs++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&As(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Cs=0,Ss--,t)throw e}function vs(e){if(Ss>0)return e();Ts=++ws,Ss++;try{return e()}finally{_s()}}let z,ys;function bs(e){let t=z;z=void 0;try{return e()}finally{z=t}}let xs,Ss=0,Cs=0,ws=0,Ts=0,Es=0;function Ds(e){if(z===void 0)return;let t=e.n;return t===void 0||t.t!==z?(t={i:0,S:e,p:z.s,n:void 0,t:z,e:void 0,x:void 0,r:t},z.s!==void 0&&(z.s.n=t),z.s=t,e.n=t,32&z.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=z.s,t.n=void 0,z.s.n=t,z.s=t),t):void 0}function Os(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ks(e,t){return new Os(e,t)}function As(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function js(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Ms(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function Ns(e,t){Os.call(this,void 0),this.x=e,this.s=void 0,this.g=Es-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Ps(e,t){return new Ns(e,t)}function Fs(e){let t=e.m;if(e.m=void 0,typeof t==`function`){Ss++;let n=z;z=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Is(e),t}finally{z=n,_s()}}}function Is(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Fs(e)}function Ls(e){if(z!==this)throw Error(`Out-of-order effect`);Ms(this),z=e,this.f&=-2,8&this.f&&Is(this),_s()}function Rs(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function zs(e,t){let n=new Rs(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Bs(e,t={}){let n={};for(let r in e){let i=t[r];n[r]=ks(i===void 0?e[r]:i)}return n}Os.prototype.brand=gs,Os.prototype.h=function(){return!0},Os.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?bs(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},Os.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&bs(()=>{var e;(e=this.Z)==null||e.call(this)}))}},Os.prototype.subscribe=function(e){return zs(()=>{let t=this.value,n=z;z=void 0;try{e(t)}finally{z=n}},{name:`sub`})},Os.prototype.valueOf=function(){return this.value},Os.prototype.toString=function(){return this.value+``},Os.prototype.toJSON=function(){return this.value},Os.prototype.peek=function(){let e=z;z=void 0;try{return this.value}finally{z=e}},Object.defineProperty(Os.prototype,"value",{get(){let e=Ds(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Cs>100)throw Error(`Cycle detected`);(function(e){Ss!==0&&Cs===0&&e.l!==Ts&&(e.l=Ts,xs={S:e,v:e.v,i:e.i,o:xs})})(this),this.v=e,this.i++,Es++,Ss++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{_s()}}}}),Ns.prototype=new Os,Ns.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Es))return!0;if(this.g=Es,this.f|=1,this.i>0&&!As(this))return this.f&=-2,!0;let e=z;try{js(this),z=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return z=e,Ms(this),this.f&=-2,!0},Ns.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Os.prototype.S.call(this,e)},Ns.prototype.U=function(e){if(this.t!==void 0&&(Os.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Ns.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Ns.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=Ds(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Rs.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},Rs.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Fs(this),js(this),Ss++;let e=z;return z=this,Ls.bind(this,e)},Rs.prototype.N=function(){2&this.f||(this.f|=2,this.u=ys,ys=this)},Rs.prototype.d=function(){this.f|=8,1&this.f||Is(this)},Rs.prototype.dispose=function(){this.d()};const Vs=F({build:(e,t,n)=>Bs(t),config:Jn({defaultSelection:`rootEnd`,disabled:!1}),name:`@lexical/extension/AutoFocus`,register(e,t,n){let r=n.getOutput();return zs(()=>r.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{let e=document.activeElement;t===null||e!==null&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:r.defaultSelection.peek()})}))}});function Hs(){let e=ye(),t=w(),n=p();e.clear(),e.append(n),t!==null&&n.select(),O(t)&&(t.format=0)}function Us(e,t=Hs){return e.registerCommand(rt,n=>(e.update(t),!0),M)}const Ws=F({build:(e,t,n)=>Bs(t),config:Jn({$onClear:Hs}),name:`@lexical/extension/ClearEditor`,register(e,t,n){let{$onClear:r}=n.getOutput();return zs(()=>Us(e,r.value))}});function Gs(e){let t=new Set,n=new Set;for(let r of Ks(e)){let e=typeof r==`function`?r:r.replace;En(e),t.add(e.getType()),n.add(e)}return{nodes:n,types:t}}function Ks(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}const qs=bn(`format`,{parse:e=>typeof e==`number`?e:0});var Js=class extends xt{$config(){return this.config(`decorator-text`,{extends:xt,stateConfigs:[{flat:!0,stateConfig:qs}]})}getFormat(){return T(this,qs)}getFormatFlags(e,t){return tr(this.getFormat(),e,t)}hasFormat(e){let t=ln[e];return(this.getFormat()&t)!==0}setFormat(e){return Xe(this,qs,e)}toggleFormat(e){let t=this.getFormat(),n=tr(t,e,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement(`span`)}updateDOM(){return!1}};function Ys(e){return e instanceof Js}function Xs(e,t,n){let r=t.fontWeight,i=t.textDecoration.split(` `),a=r===`700`||r===`bold`,o=i.includes(`line-through`),s=t.fontStyle===`italic`,c=i.includes(`underline`),l=t.verticalAlign;return a&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),o&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),s&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),c&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),l!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),l!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function Zs(e,t,n=$s){for(let[r,i]of Object.entries(n))e.hasFormat(i)&&(t=Qs(t,r));return t}function Qs(e,t){let n=document.createElement(t);return n.appendChild(e),n}const $s={b:`bold`,code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`},ec=F({name:`@lexical/extension/DecoratorText`,nodes:()=>[Js],register:(e,t,n)=>e.registerCommand(Tt,e=>{let t=w();if(Ne(t)||O(t))for(let n of t.getNodes())Ys(n)&&n.toggleFormat(e);return!1},P)});function tc(e,t){let n;return ks(e(),{unwatched(){n&&=(n(),void 0)},watched(){this.value=e(),n=t(this)}})}const nc=F({build:e=>tc(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:`@lexical/extension/EditorState`});function B(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 rc(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)n[e]=rc(n[e],r[e]);return e}return t}function ic(e){return e.id===0}function ac(e){return e.id===2}function oc(e){return function(e){return e.id===1}(e)||B(305,String(e.id),`1`),Object.assign(e,{id:2})}const sc=new Set;var cc=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):$n;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;ac(t)||B(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==4&&B(307,String(t.id),`5`),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==5&&B(308,String(n.id),`5`);let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{let e=this.state;e.id!==7&&B(309,String(n.id),`7`),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==6&&B(310,String(t.id),`6`),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return this._signal===void 0&&B(311),this._signal}getInitResult(){this.extension.init===void 0&&B(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||B(313,String(e.id),`4`),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=3}(e)||B(314,String(e.id),`3`),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&B(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&B(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||B(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||sc}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=5})(e)||B(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const lc={tag:Dt};function uc(){let e=ye();e.isEmpty()&&e.append(p())}const dc=F({config:Jn({setOptions:lc,updateOptions:lc}),init:({$initialEditorState:e=uc})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Oe(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[tn,dn,Kt,un,Qt]}),fc=Symbol.for(`@lexical/extension/LexicalBuilder`);function pc(...e){return vc.fromExtensions(e).buildEditor()}function mc(){}function hc(e){throw e}function gc(e){return Array.isArray(e)?e:[e]}const _c=`0.44.0+prod.esm`;var vc=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=_c,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[gc(dc)];for(let e of t)n.push(gc(e));return new e(n)}static maybeFromEditor(t){let n=t[fc];return n&&(n.PACKAGE_VERSION!==_c&&B(292,n.PACKAGE_VERSION,_c),n instanceof e||B(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&B(294),n}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(yn({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[fc]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=mc;function t(){try{e()}finally{e=mc}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Un(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&B(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&B(296);let[t]=gc(e);typeof t.name!=`string`&&B(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&B(298,t.name),!n){n=new cc(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&B(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&B(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=gc(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(ac(i))return;let a=n.extension.name;var o;ic(i)||B(300,a,r||`[unknown]`),ic(o=i)||B(304,String(o.id),`0`),i=Object.assign(o,{id:1}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=oc(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())ic(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&B(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return Un(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Ks(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&B(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&rc(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=hc,e}};function yc(e,t){let n=vc.fromEditor(e).getExtensionRep(t);return n===void 0&&B(303,t.name),n.getExtensionDependency()}function bc(e,t){let n=vc.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function xc(e,t){let n=bc(e,t);return n===void 0&&B(291,t),n}const Sc=new Set,Cc=F({build(e,t,n){let r=n.getDependency(nc).output,i=ks({watchedNodeKeys:new Map}),a=tc(()=>{},()=>zs(()=>{let e=a.peek(),{watchedNodeKeys:t}=i.value,n,o=!1;r.value.read(()=>{if(w())for(let[r,i]of t.entries()){if(i.size===0){t.delete(r);continue}let a=C(r),s=a&&a.isSelected()||!1;o||=s!==(!!e&&e.has(r)),s&&(n||=new Set,n.add(r))}}),!o&&n&&e&&n.size===e.size||(a.value=n)}));return{watchNodeKey:function(e){let t=Ps(()=>(a.value||Sc).has(e)),{watchedNodeKeys:n}=i.peek(),r=n.get(e),o=r!==void 0;return r||=new Set,r.add(t),o||(n.set(e,r),i.value={watchedNodeKeys:n}),t}}},dependencies:[nc],name:`@lexical/extension/NodeSelection`}),wc=vn(`INSERT_HORIZONTAL_RULE_COMMAND`);var Tc=class e extends xt{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return Dc().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Ec,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return pn(t,e.theme.hr),t}getTextContent(){return`
|
|
21
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Ec(){return{node:Dc()}}function Dc(){return u(Tc)}function Oc(e){return e instanceof Tc}const kc=F({dependencies:[nc,Cc],name:`@lexical/extension/HorizontalRule`,nodes:()=>[Tc],register(e,t,n){let{watchNodeKey:r}=n.getDependency(Cc).output,i=ks({nodeSelections:new Map}),a=e._config.theme.hrSelected??`selected`;return Un(e.registerCommand(wc,e=>{let t=w();if(!O(t))return!1;if(t.focus.getNode()!==null){let e=Dc();ts(e)}return!0},M),e.registerCommand(at,e=>{if(Nn(e.target)){let t=_e(e.target);if(Oc(t))return function(e,t=!1){let n=w(),r=e.isSelected(),i=e.getKey(),a;t&&Ne(n)?a=n:(a=f(),j(a)),r?a.delete(i):a.add(i)}(t,e.shiftKey),!0}return!1},P),e.registerMutationListener(Tc,(t,n)=>{vs(()=>{let n=!1,{nodeSelections:a}=i.peek();for(let[i,o]of t.entries())if(o===`destroyed`)a.delete(i),n=!0;else{let t=a.get(i),o=e.getElementByKey(i);t?t.domNode.value=o:(n=!0,a.set(i,{domNode:ks(o),selectedSignal:r(i)}))}n&&(i.value={nodeSelections:a})})}),zs(()=>{let e=[];for(let{domNode:t,selectedSignal:n}of i.value.nodeSelections.values())e.push(zs(()=>{let e=t.value;e&&(n.value?pn(e,a):Kn(e,a))}));return Un(...e)}))}}),Ac=F({build:(e,t)=>Bs({inheritEditableFromParent:t.inheritEditableFromParent}),config:Jn({$getParentEditor:function(){let e=pe();return vc.fromEditor(e),e},inheritEditableFromParent:!1}),init:(e,t,n)=>{let r=t.$getParentEditor();e.parentEditor=r,e.theme=e.theme||r._config.theme},name:`@lexical/extension/NestedEditor`,register:(e,t,n)=>zs(()=>{let t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})}),jc=F({build:(e,t,n)=>Bs(t),config:Jn({disabled:!1,onReposition:void 0}),name:`@lexical/utils/SelectionAlwaysOnDisplay`,register:(e,t,n)=>{let r=n.getOutput();return zs(()=>{if(!r.disabled.value)return ms(e,r.onReposition.value)})}});function Mc(e){return e.canBeEmpty()}function Nc(e,t,n=Mc){return Un(e.registerCommand(Gt,t=>{let n=w();if(!O(n))return!1;t.preventDefault();let r=function(e){if(e.getNodes().filter(e=>Te(e)&&e.canIndent()).length>0)return!0;let t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,i=r.getNode(),a=Zo(i);if(a.canIndent()){let e=a.getKey(),t=h();if(t.anchor.set(e,0,`element`),t.focus.set(e,0,`element`),t=Ve(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?Yt:kt:Nt;return e.dispatchCommand(r,void 0)},M),e.registerCommand(kt,()=>{let e=typeof t==`number`?t:t?t.peek():null,r=w();if(!O(r))return!1;let i=typeof n==`function`?n:n.peek();return $o(t=>{if(i(t)){let n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},st))}const Pc=F({build:(e,t,n)=>Bs(t),config:Jn({$canIndent:Mc,disabled:!1,maxIndent:null}),name:`@lexical/extension/TabIndentation`,register(e,t,n){let{disabled:r,maxIndent:i,$canIndent:a}=n.getOutput();return zs(()=>{if(!r.value)return Nc(e,i,a)})}}),V=hs;V.$createHorizontalRuleNode,V.$isDecoratorTextNode,V.$isHorizontalRuleNode,V.AutoFocusExtension,V.ClearEditorExtension,V.DecoratorTextExtension,V.DecoratorTextNode,V.EditorStateExtension,V.HorizontalRuleExtension,V.HorizontalRuleNode,V.INSERT_HORIZONTAL_RULE_COMMAND,V.InitialStateExtension;const Fc=V.LexicalBuilder;V.NestedEditorExtension,V.NodeSelectionExtension,V.SelectionAlwaysOnDisplayExtension,V.TabIndentationExtension,V.applyFormatFromStyle,V.applyFormatToDom;const Ic=V.batch,Lc=V.buildEditorFromExtensions;V.computed,V.configExtension,V.declarePeerDependency,V.defineExtension;const Rc=V.effect,zc=V.getExtensionDependencyFromEditor,Bc=V.getKnownTypesAndNodes,Vc=V.getPeerDependencyFromEditor;V.getPeerDependencyFromEditorOrThrow;const Hc=V.namedSignals;V.registerClearEditor,V.registerTabIndentation,V.safeCast,V.shallowMergeConfig;const Uc=V.signal;V.untracked,V.watchedSignal;var Wc=lr({$createAutoLinkNode:()=>el,$createLinkNode:()=>Zc,$isAutoLinkNode:()=>tl,$isLinkNode:()=>Qc,$toggleLink:()=>il,AutoLinkExtension:()=>El,AutoLinkNode:()=>$c,ClickableLinkExtension:()=>ul,LinkExtension:()=>cl,LinkNode:()=>Kc,TOGGLE_LINK_COMMAND:()=>nl,createLinkMatcherWithRegExp:()=>dl,formatUrl:()=>ol,registerAutoLink:()=>Tl,registerClickableLink:()=>ll,registerLink:()=>sl,toggleLink:()=>Dl});const Gc=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]);var Kc=class e extends St{__url;__target;__rel;__title;static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){let t=document.createElement(`a`);return this.updateLinkDOM(null,t,e),ss(t,e.theme.link),t}updateLinkDOM(e,t,n){if(ls(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let 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:Xc,priority:1})}}static importJSON(e){return Zc().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=ol(e);try{let t=new URL(ol(e));if(!Gc.has(t.protocol))return`about:blank`}catch{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){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=l(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!O(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function qc(e){let t=r(e,`next`);return[t,t.getFlipped()]}function Jc(e,t){for(let n of t)if(n.origin.isAttached()){let t=Be(n);Je(e,t);return}}function Yc(e){let t=w(),n=null,r=null;function i(){O(t)&&(Jc(t.anchor,n),Jc(t.focus,r),Ve(t))}O(t)&&(n=qc(t.anchor),r=qc(t.focus));let a=!1;for(let t of ce(e,`next`)){let n=t.origin;if(E(n)&&!n.isInline()){let r=n.getChildren();if(r.length>0){let t=l(e);t.append(...r),n.append(t),a=!0}ns(n,Ge(t),{$shouldSplit:()=>!1})}}function o(e,t,n){let[r,i]=e,a=e=>Le(e)&&e.origin.is(t);if(!a(r)&&!a(i))return e;let o=Be(ce(n,`next`));return[o,o.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(Qc(t)&&t.shouldMergeAdjacentLink(e))return n&&=o(n,t,e),r&&=o(r,t,e),t.append(...e.getChildren()),e.remove(),void i();let s=e.getNextSibling();Qc(s)&&e.shouldMergeAdjacentLink(s)&&(n&&=o(n,e,s),r&&=o(r,e,s),e.append(...s.getChildren()),s.remove(),a=!0)}if(a){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}i()}}function Xc(e){let t=null;if(ls(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=Zc(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function Zc(e=``,t){return n(new Kc(e,t))}function Qc(e){return e instanceof Kc}var $c=class e extends Kc{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let 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 el().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){let n=el(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function el(e=``,t){return n(new $c(e,t))}function tl(e){return e instanceof $c}const nl=vn(`TOGGLE_LINK_COMMAND`);function rl(e,t){if(e.type===`element`){let n=e.getNode();return E(n)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 il(e,t={}){let n;if(e&&typeof e==`object`){let{url:r,...i}=e;n=r,t={...i,...t}}else n=e;let{target:r,title:i}=t,a=t.rel===void 0?`noreferrer`:t.rel,o=w();if(o===null||!O(o)&&!Ne(o))return;if(Ne(o)){let e=o.getNodes();if(e.length===0)return;e.forEach(e=>{if(n===null){let t=R(e,e=>!tl(e)&&Qc(e));t&&(t.insertBefore(e),t.getChildren().length===0&&t.remove())}else{let t=R(e,e=>!tl(e)&&Qc(e));if(t)t.setURL(n),r!==void 0&&t.setTarget(r),a!==void 0&&t.setRel(a);else{let t=Zc(n,{rel:a,target:r});e.insertBefore(t),t.append(e)}}});return}if(o.isCollapsed()&&n===null)for(let e of o.getNodes()){let t=R(e,e=>!tl(e)&&Qc(e));t!==null&&(t.getChildren().forEach(e=>{t.insertBefore(e)}),t.remove());return}let s=o.extract();if(n===null){let e=new Set;s.forEach(t=>{let n=R(t,e=>!tl(e)&&Qc(e));if(n!==null){let t=n.getKey();if(e.has(t))return;(function(e,t){let n=new Set(t.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),r=e.getChildren(),i=r=>n.has(r.getKey())||E(r)&&t.some(t=>e.isParentOf(t)&&r.isParentOf(t)),a=r.filter(i);if(a.length===r.length)return r.forEach(t=>e.insertBefore(t)),void e.remove();let o=r.findIndex(i),s=r.findLastIndex(i),c=o===0,u=s===r.length-1;if(c)a.forEach(t=>e.insertBefore(t));else if(u)for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);else{for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);let t=r.slice(s+1);if(t.length>0){let n=l(e);a[a.length-1].insertAfter(n),t.forEach(e=>n.append(e))}}})(n,s),e.add(t)}});return}let c=new Set,u=e=>{c.has(e.getKey())||(c.add(e.getKey()),e.setURL(n),r!==void 0&&e.setTarget(r),a!==void 0&&e.setRel(a),i!==void 0&&e.setTitle(i))};if(s.length===1){let e=s[0],t=R(e,Qc);if(t!==null)return u(t)}(function(e){let t=w();if(!O(t))return e();let n=Ve(t),r=n.isBackward(),i=rl(n.anchor,r?-1:0),a=rl(n.focus,r?0:-1);if(e(),i||a){let e=w();if(O(e)){let t=e.clone();if(i){let e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+ +!!r,`element`)}if(a){let e=a.getParent();e&&t.focus.set(e.getKey(),a.getIndexWithinParent()+ +!r,`element`)}j(Ve(t))}}})(()=>{let e=null;for(let t of s){if(!t.isAttached())continue;let o=R(t,Qc);if(o){u(o);continue}if(E(t)){if(!t.isInline())continue;if(Qc(t)){if(!(tl(t)||e!==null&&e.getParentOrThrow().isParentOf(t))){u(t),e=t;continue}for(let e of t.getChildren())t.insertBefore(e);t.remove();continue}}let s=t.getPreviousSibling();Qc(s)&&s.is(e)?s.append(t):(e=Zc(n,{rel:a,target:r,title:i}),t.insertAfter(e),e.append(t))}})}const al=/^\+?[0-9\s()-]{5,}$/;function ol(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:al.test(e)?`tel:${e}`:`https://${e}`}function sl(e,t){return ds(e.registerNodeTransform(Kc,Yc),e.registerCommand(nl,e=>{let n=t.validateUrl.peek(),r=t.attributes.peek();if(e===null)return il(null),!0;if(typeof e==`string`)return!(n!==void 0&&!n(e))&&(il(e,r),!0);{let{url:t,target:n,rel:i,title:a}=e;return il(t,{...r,rel:i,target:n,title:a}),!0}},M),Rc(()=>{let n=t.validateUrl.value;if(!n)return;let r=t.attributes.value;return e.registerCommand(Xt,t=>{let i=w();if(!O(i)||i.isCollapsed()||!fs(t,ClipboardEvent)||t.clipboardData===null)return!1;let a=t.clipboardData.getData(`text`);return!!n(a)&&!i.getNodes().some(e=>E(e))&&(e.dispatchCommand(nl,{...r,url:a}),t.preventDefault(),!0)},P)}))}const cl=F({build:(e,t,n)=>Hc(t),config:{attributes:void 0,validateUrl:void 0},mergeConfig(e,t){let n=$n(e,t);return e.attributes&&(n.attributes=$n(e.attributes,n.attributes)),n},name:`@lexical/link/Link`,nodes:()=>[Kc],register:(e,t,n)=>sl(e,n.getOutput())});function ll(e,t,n={}){let r=n=>{let r=n.target;if(!Nn(r))return;let i=Tn(r);if(i===null)return;let a=null,o=null;if(i.update(()=>{let e=me(r);if(e!==null){let n=R(e,E);if(!t.disabled.peek())if(Qc(n))a=n.sanitizeUrl(n.getURL()),o=n.getTarget();else{let e=function(e,t){let n=e;for(;n!=null;){if(t(n))return n;n=n.parentNode}return null}(r,ls);e!==null&&(a=e.href,o=e.target)}}}),a===null||a===``)return;let s=e.getEditorState().read(w,{editor:e});if(O(s)&&!s.isCollapsed())return void n.preventDefault();let c=n.type===`auxclick`&&n.button===1;window.open(a,t.newTab.peek()||c||n.metaKey||n.ctrlKey||o===`_blank`?`_blank`:`_self`),n.preventDefault()},i=e=>{e.button===1&&r(e)};return e.registerRootListener(e=>{if(e)return e.addEventListener(`click`,r,n),e.addEventListener(`mouseup`,i,n),()=>{e.removeEventListener(`click`,r),e.removeEventListener(`mouseup`,i)}})}const ul=F({build:(e,t,n)=>Hc(t),config:Jn({disabled:!1,newTab:!1}),dependencies:[cl],name:`@lexical/link/ClickableLink`,register:(e,t,n)=>ll(e,n.getOutput())});function dl(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function fl(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}const pl=/[.,;\s]/;function ml(e,t){return t.test(e)}function hl(e,t){return ml(e[e.length-1],t)}function gl(e,t){return ml(e[0],t)}function _l(e,t){let n=e.getPreviousSibling();return E(n)&&(n=n.getLastDescendant()),n===null||D(n)||A(n)&&hl(n.getTextContent(),t)}function vl(e,t){let n=e.getNextSibling();return E(n)&&(n=n.getFirstDescendant()),n===null||D(n)||A(n)&&gl(n.getTextContent(),t)}function yl(e,t,n,r,i){return(e>0?ml(r[e-1],n):_l(i[0],n))?t<r.length?ml(r[t],n):vl(i[i.length-1],n):!1}function bl(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function xl(e,t,n,r){let i=el(r.url,r.attributes);if(e.length===1){let a,o=e[0];t===0?[a,o]=o.splitText(n):[,a,o]=o.splitText(t,n);let s=v(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),o}if(e.length>1){let r=e[0],a,o=r.getTextContent().length;t===0?a=r:[,a]=r.splitText(t);let s=[],c;for(let t=1;t<e.length;t++){let r=e[t],i=r.getTextContent().length,a=o;if(a<n)if(o+i<=n)s.push(r);else{let[e,t]=r.splitText(n-a);s.push(e),c=t}o+=i}let l=w(),u=l?l.getNodes().find(A):void 0,d=v(a.getTextContent());return d.setFormat(a.getFormat()),d.setDetail(a.getDetail()),d.setStyle(a.getStyle()),i.append(d,...s),u&&u===a&&(O(l)?d.select(l.anchor.offset,l.focus.offset):Ne(l)&&d.select(0,d.getTextContent().length)),a.replace(i),c}}function Sl(e,t,n,r){let i=e.getChildren(),a=i.length;for(let t=0;t<a;t++){let r=i[t];if(!A(r)||!r.isSimpleText())return Cl(e),void n(null,e.getURL())}let o=e.getTextContent(),s=fl(o,t);if(s===null||s.text!==o||!_l(e,r)||!vl(e,r))return Cl(e),void n(null,e.getURL());let c=e.getURL();if(c!==s.url&&(e.setURL(s.url),n(s.url,c)),s.attributes){let t=e.getRel();t!==s.attributes.rel&&(e.setRel(s.attributes.rel||null),n(s.attributes.rel||null,t));let r=e.getTarget();r!==s.attributes.target&&(e.setTarget(s.attributes.target||null),n(s.attributes.target||null,r))}}function Cl(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}const wl={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:pl};function Tl(e,t=wl){let{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:a=pl}=t,o=(e,t)=>{for(let n of r)n(e,t)};return ds(e.registerNodeTransform(dn,e=>{let t=e.getParentOrThrow(),r=e.getPreviousSibling();tl(t)?Sl(t,n,o,a):!Qc(t)&&!i.some(e=>e(t))&&(e.isSimpleText()&&(gl(e.getTextContent(),a)||!tl(r))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(tl(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=fl(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(yl(c+e,c+t,r,a,i)){let[r,,a,l]=bl(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(tl(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=xl(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let t=[e],n=e.getNextSibling();for(;n!==null&&A(n)&&n.isSimpleText()&&(t.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return t}(e),n,o,a),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!tl(i)||i.getIsUnlinked()){if(tl(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!gl(s,r))return Cl(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=fl(i,t);o!==null&&o.text===i&&(a.append(e),Sl(a,t,n,r),n(null,a.getURL()))}}var c;!tl(o)||o.getIsUnlinked()||hl(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(Cl(o),n(null,o.getURL()))}})(e,n,o,a))}),e.registerCommand(nl,e=>{let t=w();return e!==null||!O(t)||t.extract().forEach(e=>{let t=e.getParent();tl(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1},P))}const El=F({config:wl,dependencies:[cl],mergeConfig(e,t){let n=$n(e,t);for(let r of[`matchers`,`changeHandlers`,`excludeParents`]){let i=t[r];Array.isArray(i)&&(n[r]=[...e[r],...i])}return n},name:`@lexical/link/AutoLink`,nodes:[$c],register:Tl}),Dl=il,Ol=Wc,kl=Ol.$createAutoLinkNode,Al=Ol.$createLinkNode,jl=Ol.$isAutoLinkNode,Ml=Ol.$isLinkNode,Nl=Ol.$toggleLink;Ol.AutoLinkExtension;const Pl=Ol.AutoLinkNode;Ol.ClickableLinkExtension,Ol.LinkExtension;const Fl=Ol.LinkNode;Ol.TOGGLE_LINK_COMMAND,Ol.createLinkMatcherWithRegExp,Ol.formatUrl,Ol.registerAutoLink,Ol.registerClickableLink,Ol.registerLink,Ol.toggleLink;var Il=lr({$createListItemNode:()=>nu,$createListNode:()=>cu,$getListDepth:()=>Rl,$handleListInsertParagraph:()=>Ql,$insertList:()=>Wl,$isListItemNode:()=>H,$isListNode:()=>U,$removeList:()=>Jl,CheckListExtension:()=>wu,INSERT_CHECK_LIST_COMMAND:()=>lu,INSERT_ORDERED_LIST_COMMAND:()=>_u,INSERT_UNORDERED_LIST_COMMAND:()=>gu,ListExtension:()=>Cu,ListItemNode:()=>$l,ListNode:()=>ru,REMOVE_LIST_COMMAND:()=>vu,UPDATE_LIST_START_COMMAND:()=>hu,insertList:()=>xu,registerCheckList:()=>uu,registerList:()=>yu,registerListStrictIndentTransform:()=>bu,removeList:()=>Su});function Ll(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 Rl(e){let t=1,n=e.getParent();for(;n!=null;){if(H(n)){let e=n.getParent();if(U(e)){t++,n=e.getParent();continue}Ll(40)}return t}return t}function zl(e){let t=e.getParent();U(t)||Ll(40);let n=t;for(;n!==null;)n=n.getParent(),U(n)&&(t=n);return t}function Bl(e){let t=[],n=e.getChildren().filter(H);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();U(i)?t=t.concat(Bl(i)):t.push(r)}return t}function Vl(e){return H(e)&&U(e.getFirstChild())}function Hl(e){return nu().append(e)}function Ul(e,t){return H(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function Wl(e){let t=w();if(t!==null){let n=t.getNodes();if(O(t)){let r=t.getStartEndPoints();r===null&&Ll(143);let[i]=r,a=i.getNode(),o=a.getParent();if(Ie(a)){let e=a.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=p();a.append(e),n=e.select().getNodes()}}else if(Ul(a,n)){let t=cu(e);if(Ie(o)){a.replace(t);let e=nu();E(a)&&(e.setFormat(a.getFormatType()),e.setIndent(a.getIndent())),t.append(e)}else if(H(a)){let e=a.getParentOrThrow();Gl(t,e.getChildren()),e.replace(t)}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(E(i)&&i.isEmpty()&&!H(i)&&!r.has(i.getKey())){Kl(i,e);continue}let a=je(i)?i.getParent():H(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(U(a)){if(!r.has(t)){let n=cu(e);Gl(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(Ie(n)&&!r.has(t)){r.add(t),Kl(a,e);break}a=n}}}}}function Gl(e,t){e.splice(e.getChildrenSize(),0,t)}function Kl(e,t){if(U(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=nu(),a;if(Gl(i,e.getChildren()),U(n)&&t===n.getListType())n.append(i),U(r)&&t===r.getListType()&&(Gl(n,r.getChildren()),r.remove()),a=n;else if(U(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=cu(t);n.append(i),e.replace(n),a=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());let o=w();return O(o)&&(a.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,`element`),a.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,`element`)),e.remove(),a}function ql(e,t){let n=e.getLastChild(),r=t.getFirstChild();n&&r&&Vl(n)&&Vl(r)&&(ql(n.getFirstChild(),r.getFirstChild()),r.remove());let i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Jl(){let e=w();if(O(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Ul(r,n))t.add(zl(r));else for(let e=0;e<n.length;e++){let r=n[e];if(je(r)){let e=Qo(r,$l);e!=null&&t.add(zl(e))}}for(let n of t){let t=n,r=Bl(n);for(let n of r){let r=p().setTextStyle(e.style).setTextFormat(e.format);Gl(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Je(e.anchor,Be(ce(r,`next`))),n.__key===e.focus.key&&Je(e.focus,Be(ce(r,`next`))),n.remove()}n.remove()}}}function Yl(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())H(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),U(r.getFirstChild())||n++)}function Xl(e){let t=new Set;if(Vl(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Vl(r)&&Vl(i)){let n=i.getFirstChild();if(U(n)){n.append(e);let i=r.getFirstChild();U(i)&&(Gl(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Vl(r)){let t=r.getFirstChild();if(U(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(Vl(i)){let t=i.getFirstChild();U(t)&&t.append(e)}else if(U(n)){let t=l(e),a=l(n);t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Zl(e){if(Vl(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(U(n?n.getParent():void 0)&&H(n)&&U(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=l(e),i=l(t);r.append(i),e.getPreviousSiblings().forEach(e=>i.append(e));let a=l(e),o=l(t);a.append(o),Gl(o,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(a),n.replace(e)}}}function Ql(e=!1){let t=w();if(!O(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=null;if(H(n)&&n.getChildrenSize()===0)r=n;else if(A(n)){let e=n.getParent();H(e)&&e.getChildren().every(e=>A(e)&&e.getTextContent().trim()===``)&&(r=e)}if(r===null)return!1;let i=zl(r),a=r.getParent();U(a)||Ll(40);let o=a.getParent(),s;if(Ie(o))s=p(),i.insertAfter(s);else{if(!H(o))return!1;s=l(o),o.insertAfter(s)}s.setTextStyle(t.style).setTextFormat(t.format).select();let c=r.getNextSiblings();if(c.length>0){let t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(a,r):1,n=l(a).setStart(t);if(H(s)){let e=l(s);e.append(n),s.insertAfter(e)}else s.insertAfter(n);n.append(...c)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!H(e)&&!U(e))break;t=e}t.remove()}(r),!0}var $l=class extends St{__value;__checked;$config(){return this.config(`listitem`,{$transform:e=>{let t=e.getParent();if(U(t))t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){let n=e.createParentElementNode();U(n)||Ll(340);let r=[e];for(let t of[`previous`,`next`]){r.reverse();for(let{origin:n}of be(e,t)){if(!H(n))break;r.push(n)}}e.insertBefore(n),n.splice(0,0,r),Ie(t)||(ns(n,Ge(be(n,`next`)),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:St,importDOM:hn({li:()=>({conversion:eu,priority:0})})})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let t=document.createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){(function(e,t,n){let r=t.getParent();!U(r)||r.getListType()!==`check`||U(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),n&&t.__checked===n.__checked||e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))})(t,this,e),t.value=this.__value,function(e,t,n){let r=[],i=[],a=t.list,o=a?a.listitem:void 0,s;if(a&&a.nested&&(s=a.nested.listitem),o!==void 0&&r.push(...Gn(o)),a){let e=n.getParent(),t=U(e)&&e.getListType()===`check`,o=n.getChecked();t&&!o||i.push(a.listitemUnchecked),t&&o||i.push(a.listitemChecked),t&&r.push(o?a.listitemChecked:a.listitemUnchecked)}if(s!==void 0){let e=Gn(s);n.getChildren().some(e=>U(e))?r.push(...e):i.push(...e)}i.length>0&&ps(e,...i),r.length>0&&ss(e,...r)}(t,n.theme,this);let r=e?e.__style:``,i=this.__style;r!==i&&Xn(t.style,i,r),function(e,t,n){let r=t.__textStyle,i=n?n.__textStyle:``;if(n!==null&&i===r)return;let a=Dn(r);for(let t in a)e.style.setProperty(`--listitem-marker-${t}`,a[t]);if(i!==``)for(let t in Dn(i))t in a||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),Vl(this)?{after(e){if(In(e)){let t=e.previousElementSibling;if(In(t)&&t.nodeName===`LI`){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(E(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(H(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!U(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=l(n),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(E(e)||Ll(139),this.getChildren().forEach(t=>{e.append(t)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(U(n)||Ll(39),H(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=l(n);r.forEach(e=>i.append(e)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Vl(t)&&Vl(n)&&(ql(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){let n=l(this);return this.insertAfter(n,t),n}collapseAtStart(e){let t=p();this.getChildren().forEach(e=>t.append(e));let n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=H(r);if(n.getChildrenSize()===1)if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();let r=e.anchor,i=e.focus,a=t.getKey();r.type===`element`&&r.getNode().is(this)&&r.set(a,r.offset,`element`),i.type===`element`&&i.getNode().is(this)&&i.set(a,i.offset,`element`)}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return U(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;H(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&Ll(117),(e=Math.floor(e))>=0||Ll(199);let t=this.getIndent();for(;t!==e;)t<e?(Xl(this),t++):(Zl(this),t--);return this}canInsertAfter(e){return H(e)}canReplaceWith(e){return H(e)}canMergeWith(e){return H(e)||Pe(e)}extractWithChild(e,t){if(!O(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return cu(`bullet`)}canMergeWhenEmpty(){return!0}};function eu(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return tu(t)}if(e.classList.contains(`joplin-checkbox`)){for(let t of e.children)if(t.classList.contains(`checkbox-wrapper`)&&t.children.length>0&&t.children[0].tagName===`INPUT`)return tu(t.children[0])}let t=e.getAttribute(`aria-checked`);return{node:nu(t===`true`||t!==`false`&&void 0)}}function tu(e){return e.getAttribute(`type`)===`checkbox`?{node:nu(e.hasAttribute(`checked`))}:{node:null}}function nu(e){return n(new $l(void 0,e))}function H(e){return e instanceof $l}var ru=class extends St{__tag;__start;__listType;$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.getNextSibling();U(t)&&e.getListType()===t.getListType()&&ql(e,t)})(e),Yl(e)},extends:St,importDOM:hn({ol:()=>({conversion:ou,priority:0}),ul:()=>({conversion:ou,priority:0})})})}constructor(e=`number`,t=1,n){super(n);let r=su[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=document.createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,iu(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(iu(t,n.theme,this),e.__start!==this.__start&&t.setAttribute(`start`,String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let t=this.createDOM(e._config,e);return us(t)&&(this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`)),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n.find(H)??this.getChildren().find(H),i=r?()=>l(r):nu,a=n;for(let e=0;e<n.length;e++){let t=n[e];H(t)||(a===n&&(a=[...n]),a[e]=i().append(!E(t)||U(t)||t.isInline()?t:v(t.getTextContent())))}return super.splice(e,t,a)}extractWithChild(e){return H(e)}};function iu(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=Rl(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...Gn(s));for(let t=0;t<e.length;t++)t!==o&&i.push(n.__tag+t)}if(l!==void 0){let e=Gn(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&ps(e,...i),r.length>0&&ss(e,...r)}function au(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(H(r)){t.push(r);let e=r.getChildren();e.length>1&&e.forEach(e=>{U(e)&&t.push(Hl(e))})}else t.push(Hl(r))}return t}function ou(e){let t=e.nodeName.toLowerCase(),n=null;return t===`ol`?n=cu(`number`,e.start):t===`ul`&&(n=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`)||e.getAttribute(`data-is-checklist`)===`1`)return!0;for(let t of e.childNodes)if(us(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?cu(`check`):cu(`bullet`)),{after:au,node:n}}const su={ol:`number`,ul:`bullet`};function cu(e=`number`,t=1){return n(new ru(e,t))}function U(e){return e instanceof ru}const lu=vn(`INSERT_CHECK_LIST_COMMAND`);function uu(e,t){let n=t&&t.disableTakeFocusOnClick||!1,r=typeof n==`boolean`?()=>n:n.peek.bind(n),i=e=>{let t=e.target;if(!us(t))return!1;let n=t.__lexicalCheckListLastHandled;return n!==void 0&&e.timeStamp-n<500},a=e=>{let t=e.target;us(t)&&(t.__lexicalCheckListLastHandled=e.timeStamp)},o=e=>{i(e)||(a(e),fu(e,r()))},s=e=>{e.pointerType===`touch`&&(i(e)||(a(e),fu(e,r())))},c=e=>{(function(e,t){du(e,()=>{e.preventDefault(),t&&e.stopPropagation()})})(e,r())};return ds(e.registerCommand(lu,()=>(Wl(`check`),!0),P),e.registerCommand(Ft,t=>mu(t,e,!1),P),e.registerCommand(Rt,t=>mu(t,e,!0),P),e.registerCommand(Ut,()=>pu()!=null&&(e.getRootElement()?.focus(),!0),P),e.registerCommand(Wt,t=>{let n=pu();return!(n==null||!e.isEditable())&&(e.update(()=>{let e=me(n);H(e)&&(t.preventDefault(),e.toggleChecked())}),!0)},P),e.registerCommand(It,t=>e.getEditorState().read(()=>{let n=w();if(O(n)&&n.isCollapsed()){let{anchor:r}=n,i=r.type===`element`;if(i||r.offset===0){let n=r.getNode(),a=R(n,e=>E(e)&&!e.isInline());if(H(a)){let r=a.getParent();if(U(r)&&r.getListType()===`check`&&(i||a.getFirstDescendant()===n)){let n=e.getElementByKey(a.__key);if(n!=null&&document.activeElement!==n)return n.focus(),t.preventDefault(),!0}}}}return!1}),P),e.registerRootListener(e=>{if(e!==null)return e.addEventListener(`click`,o),e.addEventListener(`pointerup`,s),e.addEventListener(`pointerdown`,c,{capture:!0}),e.addEventListener(`mousedown`,c,{capture:!0}),e.addEventListener(`touchstart`,c,{capture:!0,passive:!1}),()=>{e.removeEventListener(`click`,o),e.removeEventListener(`pointerup`,s),e.removeEventListener(`pointerdown`,c,{capture:!0}),e.removeEventListener(`mousedown`,c,{capture:!0}),e.removeEventListener(`touchstart`,c,{capture:!0})}}))}function du(e,t){let n=e.target;if(!us(n))return;let r=n.firstChild;if(us(r)&&(r.tagName===`UL`||r.tagName===`OL`))return;let i=n.parentNode;if(!i||i.__lexicalListType!==`check`)return;let a=null,o=null;if(`clientX`in e)a=e.clientX;else if(`touches`in e){let t=e.touches;t.length>0&&(a=t[0].clientX,o=`touch`)}if(a==null)return;let s=n.getBoundingClientRect(),c=a/cs(n),l=window.getComputedStyle?window.getComputedStyle(n,`::before`):{width:`0px`},u=parseFloat(l.width),d=o===`touch`||`pointerType`in e&&e.pointerType===`touch`?32:0;(n.dir===`rtl`?c<s.right+d&&c>s.right-u-d:c>s.left-d&&c<s.left+u+d)&&t()}function fu(e,n){du(e,()=>{if(us(e.target)){let r=e.target,i=Tn(r);i!=null&&i.isEditable()&&i.update(()=>{let e=me(r);H(e)&&(n?(t(cn),t(on)):r.focus(),e.toggleChecked())})}})}function pu(){let e=document.activeElement;return us(e)&&e.tagName===`LI`&&e.parentNode!=null&&e.parentNode.__lexicalListType===`check`?e:null}function mu(e,t,n){let r=pu();return r!=null&&t.update(()=>{let i=me(r);if(!H(i))return;let a=function(e,t){let n=t?e.getPreviousSibling():e.getNextSibling(),r=e;for(;n==null&&H(r);)r=r.getParentOrThrow().getParent(),r!=null&&(n=t?r.getPreviousSibling():r.getNextSibling());for(;H(n);){let e=t?n.getLastChild():n.getFirstChild();if(!U(e))return n;n=t?e.getLastChild():e.getFirstChild()}return null}(i,n);if(a!=null){a.selectStart();let n=t.getElementByKey(a.__key);n!=null&&(e.preventDefault(),setTimeout(()=>{n.focus()},0))}}),!1}const hu=vn(`UPDATE_LIST_START_COMMAND`),gu=vn(`INSERT_UNORDERED_LIST_COMMAND`),_u=vn(`INSERT_ORDERED_LIST_COMMAND`),vu=vn(`REMOVE_LIST_COMMAND`);function yu(e,t){return ds(e.registerCommand(_u,()=>(Wl(`number`),!0),P),e.registerCommand(hu,e=>{let{listNodeKey:t,newStart:n}=e,r=C(t);return!!U(r)&&(r.getListType()===`number`&&(r.setStart(n),Yl(r)),!0)},P),e.registerCommand(gu,()=>(Wl(`bullet`),!0),P),e.registerCommand(vu,()=>(Jl(),!0),P),e.registerCommand(Mt,()=>Ql(!!(t&&t.restoreNumbering)),P),e.registerNodeTransform($l,e=>{let t=e.getFirstChild();if(t){if(A(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=w();O(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}}),e.registerNodeTransform(dn,e=>{let t=e.getParent();if(H(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}}))}function bu(e){let t=e=>{let t=e.getParent();if(U(e.getFirstChild())||!U(t))return;let n=R(e,e=>H(e)&&U(e.getParent())&&H(e.getPreviousSibling()));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(H(n)){let r=n.getPreviousSibling();if(H(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;U(n);){let e=n.getLastChild();if(!H(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(U(n)){let r=Rl(n);r+1<Rl(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(ru,e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(U(e)){for(let r of e.getChildren())if(H(r)){t(r);let e=r.getFirstChild();U(e)&&n.push(e)}}}})}function xu(e,t){e.update(()=>Wl(t))}function Su(e){e.update(()=>Jl())}const Cu=F({build:(e,t,n)=>Hc(t),config:Jn({hasStrictIndent:!1,shouldPreserveNumbering:!1}),name:`@lexical/list/List`,nodes:()=>[ru,$l],register(e,t,n){let r=n.getOutput();return ds(Rc(()=>yu(e,{restoreNumbering:r.shouldPreserveNumbering.value})),Rc(()=>r.hasStrictIndent.value?bu(e):void 0))}}),wu=F({build:(e,t)=>Hc(t),config:Jn({disableTakeFocusOnClick:!1}),dependencies:[Cu],name:`@lexical/list/CheckList`,register:(e,t,n)=>uu(e,n.getOutput())}),Tu=Il,Eu=Tu.$createListItemNode,Du=Tu.$createListNode,Ou=Tu.$getListDepth;Tu.$handleListInsertParagraph,Tu.$insertList;const ku=Tu.$isListItemNode,Au=Tu.$isListNode;Tu.$removeList,Tu.CheckListExtension,Tu.INSERT_CHECK_LIST_COMMAND;const ju=Tu.INSERT_ORDERED_LIST_COMMAND,Mu=Tu.INSERT_UNORDERED_LIST_COMMAND;Tu.ListExtension;const Nu=Tu.ListItemNode,Pu=Tu.ListNode;Tu.REMOVE_LIST_COMMAND,Tu.UPDATE_LIST_START_COMMAND,Tu.insertList,Tu.registerCheckList;const Fu=Tu.registerList;Tu.registerListStrictIndentTransform,Tu.removeList;var Iu=lr({$generateDOMFromNodes:()=>Cd,$generateDOMFromRoot:()=>wd,$generateHtmlFromNodes:()=>Td,$generateNodesFromDOM:()=>Sd,$getRenderContextValue:()=>_d,$withRenderContext:()=>vd,DOMRenderExtension:()=>dd,RenderContextExport:()=>md,RenderContextRoot:()=>pd,contextUpdater:()=>Gu,contextValue:()=>Wu,createRenderState:()=>fd,domOverride:()=>yd});function Lu(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Ru;function zu(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Bu(e){return Ru&&Ru.editor===e?Ru:void 0}function Vu(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(zu(e,n))]}return t}function Hu(e,t){let n=t;for(let r of e){let[e,i]=Vu(n,r),a=e.key;if(n===t&&zu(n,e)===i)continue;let o=n||Uu(t);o[a]=i,n=o}return n}function Uu(e){return Object.create(e||null)}function Wu(e,t){return[e,t]}function Gu(e,t){return{cfg:e,updater:t}}const Ku=`@lexical/html/DOM`,qu=Symbol.for(`@lexical/html/DOMExportContext`),Ju=()=>!0;function Yu(e){return t=>t instanceof e}function Xu(e,{nodes:t}){if(t===`*`)return Ju;let n={},r=[];for(let i of t)if(`getType`in i){let t=i.getType();if(n){let r=e[t];r===void 0&&Lu(339,i.name,t),n=Object.assign(n,r.types)}r.push(Yu(i))}else n=void 0,r.push(i);return n||(r.length===1?r[0]:e=>{for(let t of r)if(t(e))return!0;return!1})}function Zu(e){return(t,n,r)=>e(t,r)}function Qu(e){return(t,n,r,i)=>e(t,n,i)}function $u(e){return(t,n,r,i,a)=>e(t,n,r,a)}function ed(e){return(t,n,r,i,a,o)=>e(t,n,r,i,o)}function td(e,t){return(n,r)=>{let i=()=>e(n,r),a=t(n);return a?a(n,i,r):i()}}function nd(e,t){return(n,r,i)=>{let a=()=>e(n,r,i),o=t(n);return o?o(n,r,a,i):a()}}function rd(e,t){return(n,r,i,a)=>{let o=()=>e(n,r,i,a),s=t(n);return s?s(n,r,i,o,a):o()}}function id(e,t){return(n,r,i,a,o)=>{let s=()=>e(n,r,i,a,o),c=t(n);return c?c(n,r,i,a,s,o):s()}}function ad(e,t){return(n,r,i,a)=>{e(n,r,i,a);let o=t(n);o&&o(n,r,i,a)}}function od(e,t,n,r,i){let a=n[t];for(let n of e[t])if(typeof n[0]==`function`){let[e,t]=n;a=r(a,n=>e(n)&&t||void 0)}else{let e=n[1],t={};for(let n in e){let i=e[n];i&&(t[n]=i.reduce((e,t)=>r(e,()=>t),a))}a=r(a,e=>{let n=t[e.getType()];return n&&i(n)})}n[t]=a}function sd(e,t,n,r){if(!r)return;let i=e[t];if(typeof n==`function`)i.push([n,r]);else{let e=i[i.length-1],t;e&&e[0]===`types`?t=e[1]:(t={},i.push([`types`,t]));for(let e in n){let n=t[e]||[];t[e]=n,n.push(r)}}}function cd(e){return e.nodes===`*`}function ld(e,t){let n=function(e){let t={},{nodes:n}=Bc(e);for(let e of n)t[e.getType()]={klass:e,types:{}};for(let e of Object.values(t))if(e){let n=e.klass.getType();for(let{klass:r}=e;Me(r.prototype);r=Object.getPrototypeOf(r)){let{ownNodeType:e}=En(r),i=e&&t[e];i&&(i.types[n]=!0)}}return t}(e),r={$createDOM:[],$decorateDOM:[],$exportDOM:[],$extractWithChild:[],$getDOMSlot:[],$shouldExclude:[],$shouldInclude:[],$updateDOM:[]};for(let e of function(e){let t=[],n=[],r=[];for(let i of e)if(cd(i))t.push(i);else if(Array.isArray(i.nodes))for(let e of i.nodes)Me(e.prototype)?r.push(i.nodes.length===1?i:{...i,nodes:[e]}):n.push(i.nodes.length===1?i:{...i,nodes:[e]});let i=new Map,a=e=>{let t=i.get(e);if(t===void 0){t=0;for(let n=e;Me(n.prototype);n=Object.getPrototypeOf(n))t++;i.set(e,t)}return t};return r.sort((e,t)=>a(e.nodes[0])-a(t.nodes[0])),[...r,...n,...t]}(t)){let t=Xu(n,e);for(let n in r)sd(r,n,t,e[n])}return r}function ud(e){return e}const dd=F({build:(e,t,n)=>({defaults:Hu(t.contextDefaults,void 0)}),config:{contextDefaults:[],overrides:[]},html:{export:new Map([[tn,()=>{let e=document.createElement(`div`);return e.role=`textbox`,{element:e}}]])},init(e,t){e.dom=function(e,{overrides:t}){let n=ld(e,t),r={...mt,...e.dom};return od(n,`$createDOM`,r,td,Zu),od(n,`$exportDOM`,r,td,Zu),od(n,`$extractWithChild`,r,id,ed),od(n,`$getDOMSlot`,r,nd,Qu),od(n,`$shouldExclude`,r,nd,Qu),od(n,`$shouldInclude`,r,nd,Qu),od(n,`$updateDOM`,r,rd,$u),od(n,`$decorateDOM`,r,ad,ud),r}(e,t)},mergeConfig(e,t){let n=$n(e,t);for(let r of[`overrides`,`contextDefaults`])t[r]&&(n[r]=[...e[r],...t[r]]);return n},name:Ku});function fd(e,t,n){return function(e,t,n,r){return Object.assign(bn(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}(qu,e,t,n)}const pd=fd(`root`,Boolean),md=fd(`isExport`,Boolean);function hd(e){let t=Fc.maybeFromEditor(e);return t&&t.hasExtensionByName(Ku)?zc(e,dd).output.defaults:void 0}function gd(e){return function(e,t){let n=Bu(t);return n&&n[e]}(qu,e)||hd(e)}function _d(e,t=pe()){return zu(gd(t),e)}const vd=function(e,t=()=>{}){return(n,r=pe())=>i=>{let a=Bu(r),o=a&&a[e],s=Hu(n,o||t(r));return s&&s!==o?function(e,t,n,r=pe()){let i=Ru,a=Bu(r);try{return Ru={...a,editor:r,[e]:t},n()}finally{Ru=i}}(e,s,i,r):i()}}(qu,hd);function yd(e,t){return{...t,nodes:e}}function bd(e){return e.constructor.name===CSSStyleRule.name}const xd=new Set([`STYLE`,`SCRIPT`]);function Sd(e,t){Mn(t)&&function(e){if(e.querySelector(`style`)===null)return;let t=new Map;function n(e){let n=t.get(e);if(n===void 0){n=new Set;for(let t=0;t<e.style.length;t++)n.add(e.style[t]);t.set(e,n)}return n}try{for(let t of Array.from(e.styleSheets)){let r;try{r=t.cssRules}catch{continue}for(let t of Array.from(r)){if(!bd(t))continue;let r;try{r=e.querySelectorAll(t.selectorText)}catch{continue}for(let e of Array.from(r)){if(!In(e))continue;let r=n(e);for(let n=0;n<t.style.length;n++){let i=t.style[n];r.has(i)||e.style.setProperty(i,t.style.getPropertyValue(i),t.style.getPropertyPriority(i))}}}}}catch{}}(t);let n=Mn(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!xd.has(t.nodeName)){let n=Dd(t,e,i,!1);if(n!==null)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof et&&t.insertAfter(d());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Cd(e,t=null,n=pe()){return vd([Wu(md,!0)],n)(()=>{let r=ye(),i=S(n),a=e.append.bind(e);for(let e of r.getChildren())Ed(n,e,a,t,i);return e})}function wd(e,t=ye()){let n=pe();return vd([Wu(md,!0),Wu(pd,!0)],n)(()=>{let r=S(n),i=e.append.bind(e);return Ed(n,t,i,null,r),e})}function Td(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Lu(338),Cd(document.createElement(`div`),t,e).innerHTML}function Ed(e,t,n,r=null,i=S(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&A(t)&&(s=Ma(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=document.createDocumentFragment(),p=d?d():E(s)?s.getChildren():[],m=f.append.bind(f);for(let n of p){let o=Ed(e,n,m,r,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((In(c)||Pn(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(Pn(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function Dd(e,t,n,r,i=new Map,a){let o=[];if(xd.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let f=e.childNodes,m=[],h=(s==null||!Ie(s))&&(s!=null&&Te(s)||r);for(let e=0;e<f.length;e++)m.push(...Dd(f[e],t,n,h,new Map(i),s));if(u!=null&&(m=u(m)),kn(e)&&(m=Od(e,m,h?()=>{let e=new et;return n.push(e),e}:p)),s==null)if(m.length>0)for(let e of m)o.push(e);else kn(e)&&function(e){return e.nextSibling==null||e.previousSibling==null?!1:Rn(e.nextSibling)&&Rn(e.previousSibling)}(e)&&o.push(d());else E(s)&&s.append(...m);return o}function Od(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if(Te(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&Te(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}const kd=Iu;kd.$generateDOMFromNodes,kd.$generateDOMFromRoot;const Ad=kd.$generateHtmlFromNodes,jd=kd.$generateNodesFromDOM;kd.$getRenderContextValue,kd.$withRenderContext,kd.DOMRenderExtension,kd.RenderContextExport,kd.RenderContextRoot,kd.contextUpdater,kd.contextValue,kd.createRenderState,kd.domOverride;var Md=lr({$generateJSONFromSelectedNodes:()=>Kd,$generateNodesFromSerializedNodes:()=>qd,$getClipboardDataFromSelection:()=>Qd,$getHtmlContent:()=>Pd,$getLexicalContent:()=>Fd,$handlePlainTextDrop:()=>Ud,$handleRichTextDrop:()=>Hd,$insertDataTransferForPlainText:()=>Id,$insertDataTransferForRichText:()=>Ld,$insertGeneratedNodes:()=>Wd,$writeDragSourceToDataTransfer:()=>zd,copyToClipboard:()=>Yd,setLexicalClipboardDataTransfer:()=>$d});function Nd(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 Pd(e,t=w()){return t??Nd(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?``:Ad(e,t)}function Fd(e,t=w()){return t??Nd(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(Kd(e,t))}function Id(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}function Ld(e,t,n){let r=e.getData(`application/x-lexical-editor`);if(r)try{let e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return Wd(n,qd(e.nodes),t)}catch(e){console.error(e)}let i=e.getData(`text/html`),a=e.getData(`text/plain`);if(i&&a!==i)try{let e=new DOMParser().parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}(i),`text/html`);return Wd(n,jd(n,e),t)}catch(e){console.error(e)}let o=a||e.getData(`text/uri-list`);if(o!=null)if(O(t)){let e=o.split(/(\r?\n|\t)/);e[e.length-1]===``&&e.pop();for(let t=0;t<e.length;t++){let n=w();if(O(n)){let r=e[t];r===`
|
|
22
|
+
`||r===`\r
|
|
23
|
+
`?n.insertParagraph():r===` `?n.insertNodes([_()]):n.insertText(r)}}}else t.insertRawText(o)}const Rd=`application/x-lexical-drag`;function zd(e,t){let n={editorKey:t.getKey()};e.setData(Rd,JSON.stringify(n))}function Bd(e){let t=function(e,t){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!==`undefined`){let n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}(e.clientX,e.clientY);if(t===null)return null;let n=me(t.node);if(n===null)return null;if(A(n))return xe(n,`next`,t.offset);if(E(n))return le(n,t.offset,`next`);let r=n.getParent();return r===null?null:le(r,n.getIndexWithinParent()+1,`next`)}function Vd(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let a=function(e){let t=e.getData(Rd);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(a===null)return!1;let o=Bd(e);if(o===null)return!1;let s=Ze(o);if(s===null)return!1;let l=a.editorKey===t.getKey(),u=w();if(l){if(!O(u)||u.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=oe(i(t),`next`);return c(n,e)<0&&c(e,r)<0}(o,u))return e.preventDefault(),!0;u.removeText()}if(!s.origin.isAttached())return e.preventDefault(),!0;if(n(r,Ye(de(s)),t),!l){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){let n=t.querySelectorAll(`[data-lexical-editor="true"]`);for(let t of Array.from(n)){let n=t.__lexicalEditor;if(n&&n.getKey()===e)return t}return null}(a.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function Hd(e,t){return Vd(e,t,Ld)}function Ud(e,t){return Vd(e,t,(e,t)=>Id(e,t))}function Wd(e,t,n){e.dispatchCommand(rn,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(O(e)&&e.isCollapsed()){let t=e.anchor,n=null,i=r(t,`previous`);if(i)if(Re(i))n=i.origin;else{let e=ae(i,ce(ye(),`next`).getFlipped());for(let t of e){if(A(t.origin)){n=t.origin;break}if(E(t.origin)&&!t.origin.isInline())break}}if(n&&A(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function Gd(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=E(n)&&n.excludeFromCopy(`html`),o=n;t!==null&&A(o)&&(o=Ma(t,o,`clone`));let s=E(o)?o.getChildren():[],c=function(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Nd(58,n.name),E(e)){let e=t.children;Array.isArray(e)||Nd(59,n.name)}return t}(o);A(o)&&o.getTextContentSize()===0&&(i=!1);for(let r=0;r<s.length;r++){let a=s[r],o=Gd(e,t,a,c.children);!i&&E(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a)r.push(c);else if(Array.isArray(c.children))for(let e=0;e<c.children.length;e++){let t=c.children[e];r.push(t)}return i}function Kd(e,t){let n=[],r=ye().getChildren();for(let i=0;i<r.length;i++)Gd(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}function qd(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=Ue(r);A(i)&&Sa(i),t.push(i)}return t}let Jd=null;async function Yd(e,t,n){if(Jd!==null)return!1;if(t!==null)return new Promise((r,i)=>{e.update(()=>{r(Xd(e,t,n))})});let r=e.getRootElement(),i=e._window||window,a=i.document,o=Cn(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.position=`fixed`,s.style.top=`-1000px`,s.append(a.createTextNode(`#`)),r.append(s);let c=new Range;return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise((t,r)=>{let o=e.registerCommand(ft,r=>(fs(r,ClipboardEvent)&&(o(),Jd!==null&&(i.clearTimeout(Jd),Jd=null),t(Xd(e,r,n))),!0),st);Jd=i.setTimeout(()=>{o(),Jd=null,t(!1)},50),a.execCommand(`copy`),s.remove()})}function Xd(e,t,n){if(n===void 0){let t=Cn(e._window),r=w();if(!r||r.isCollapsed()||!t)return!1;let i=t.anchorNode,a=t.focusNode;if(i!==null&&a!==null&&!Vn(e,i,a))return!1;n=Qd(r)}t.preventDefault();let r=t.clipboardData;return r!==null&&($d(r,n),!0)}const Zd=[[`text/html`,Pd],[`application/x-lexical-editor`,Fd]];function Qd(e=w()){return function(e,t){let n={"text/plain":``};for(let[r,i]of Object.entries(e)){let e=tf(i,t);e!==null&&(n[r]=e)}return n}(function(){let e=pe(),t=Fc.maybeFromEditor(e);return t&&t.hasExtensionByName(nf.name)?zc(e,nf).output:ef}(),e)}function $d(e,t){for(let[n]of Zd)t[n]===void 0&&e.setData(n,``);for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}const ef={"application/x-lexical-editor":[(e,t)=>e?Fd(pe(),e):t()],"text/html":[(e,t)=>e?Pd(pe(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function tf(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}const nf=F({build:(e,t,n)=>t.$exportMimeType,config:Jn({$exportMimeType:ef}),mergeConfig(e,t){let n=$n(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))r[e]=[...r[e],...n];n.$exportMimeType=r}return n},name:`@lexical/clipboard/GetClipboardData`}),rf=Md;rf.$generateJSONFromSelectedNodes,rf.$generateNodesFromSerializedNodes;const af=rf.$getClipboardDataFromSelection,of=rf.$getHtmlContent;rf.$getLexicalContent;const sf=rf.$handlePlainTextDrop,cf=rf.$handleRichTextDrop,lf=rf.$insertDataTransferForPlainText,uf=rf.$insertDataTransferForRichText;rf.$insertGeneratedNodes;const df=rf.$writeDragSourceToDataTransfer,ff=rf.copyToClipboard,pf=rf.setLexicalClipboardDataTransfer;var mf=lr({DragonExtension:()=>gf,registerDragonSupport:()=>hf});function hf(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if(typeof i==`string`){let t;try{t=JSON.parse(i)}catch{return}if(t&&t.protocol===`nuanria_messaging`&&t.type===`request`){let r=t.payload;if(r&&r.functionId===`makeChanges`){let t=r.args;if(t){let[r,i,a,o,s]=t;e.update(()=>{let e=w();if(O(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(A(c)&&r>=0&&i>=0&&(l=r,u=r+i,e.setTextNodeRange(c,l,c,u)),l===u&&a===``||(e.insertRawText(a),c=t.getNode()),A(c)){l=o,u=o+s;let t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener(`message`,n,!0),()=>{window.removeEventListener(`message`,n,!0)}}const gf=F({build:(e,t,n)=>Hc(t),config:Jn({disabled:typeof window>`u`}),name:`@lexical/dragon`,register:(e,t,n)=>Rc(()=>n.getOutput().disabled.value?void 0:hf(e))}),_f=mf,vf=_f.DragonExtension;_f.registerDragonSupport;var yf=lr({PlainTextExtension:()=>jf,registerPlainText:()=>Af});const bf=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,xf=bf&&`documentMode`in document?document.documentMode:null,Sf=bf&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Cf=!(!bf||!(`InputEvent`in window)||xf)&&`getTargetRanges`in new window.InputEvent(`input`),wf=bf&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Tf=bf&&/Android/.test(navigator.userAgent),Ef=bf&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Tf,Df=bf&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Of=bf&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sf&&!Df;function kf(e,t){t.update(()=>{if(e!==null){let n=fs(e,KeyboardEvent)?null:e.clipboardData,r=w();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=of(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Af(e){return ds(e.registerCommand(ht,e=>{let t=w();return!!O(t)&&(t.deleteCharacter(e),!0)},M),e.registerCommand(_t,e=>{let t=w();return!!O(t)&&(t.deleteWord(e),!0)},M),e.registerCommand(gt,e=>{let t=w();return!!O(t)&&(t.deleteLine(e),!0)},M),e.registerCommand(dt,e=>{let t=w();if(!O(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)lf(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},M),e.registerCommand(en,()=>{let e=w();return!!O(e)&&(e.removeText(),!0)},M),e.registerCommand(jt,e=>{let t=w();return!!O(t)&&(t.insertLineBreak(e),!0)},M),e.registerCommand(Mt,()=>{let e=w();return!!O(e)&&(e.insertLineBreak(),!0)},M),e.registerCommand(It,e=>{let t=w();if(!O(t))return!1;let n=e,r=n.shiftKey;return!!ja(t,!0)&&(n.preventDefault(),Oa(t,r,!0),!0)},M),e.registerCommand(Lt,e=>{let t=w();if(!O(t))return!1;let n=e,r=n.shiftKey;return!!ja(t,!1)&&(n.preventDefault(),Oa(t,r,!1),!0)},M),e.registerCommand(zt,t=>{let n=w();return!!O(n)&&(!wf||navigator.language!==`ko-KR`)&&(t.preventDefault(),e.dispatchCommand(ht,!0))},M),e.registerCommand(Bt,t=>{let n=w();return!!O(n)&&(t.preventDefault(),e.dispatchCommand(ht,!1))},M),e.registerCommand(Ht,t=>{let n=w();if(!O(n))return!1;if(t!==null){if((wf||Ef||Of)&&Cf)return!1;t.preventDefault()}return e.dispatchCommand(jt,!1)},M),e.registerCommand(an,()=>(Ke(),!0),M),e.registerCommand(ft,t=>{let n=w();return!!O(n)&&(kf(t,e),!0)},M),e.registerCommand(pt,t=>{let n=w();return!!O(n)&&(function(e,t){kf(e,t),t.update(()=>{let e=w();O(e)&&e.removeText()})}(t,e),!0)},M),e.registerCommand(Xt,t=>{let n=w();return!!O(n)&&(function(e,t){e.preventDefault(),t.update(()=>{let t=w(),n=fs(e,ClipboardEvent)?e.clipboardData:null;n!=null&&O(t)&&lf(n,t)},{tag:Zt})}(t,e),!0)},M),e.registerCommand(bt,t=>sf(t,e),M),e.registerCommand(yt,t=>{let n=w();return!!O(n)&&(n.isCollapsed()||t.dataTransfer===null||df(t.dataTransfer,e),!0)},M))}const jf=F({conflictsWith:[`@lexical/rich-text`],dependencies:[vf],name:`@lexical/plain-text`,register:Af}),Mf=yf;Mf.PlainTextExtension;const Nf=Mf.registerPlainText;var Pf=lr({$createHeadingNode:()=>$f,$createQuoteNode:()=>qf,$isHeadingNode:()=>ep,$isQuoteNode:()=>Jf,DRAG_DROP_PASTE:()=>Gf,HeadingNode:()=>Yf,QuoteNode:()=>Kf,RichTextExtension:()=>ap,eventFiles:()=>tp,registerRichText:()=>ip});function Ff(e,t){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!==`undefined`){let n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}const If=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Lf=If&&`documentMode`in document?document.documentMode:null,Rf=If&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zf=!(!If||!(`InputEvent`in window)||Lf)&&`getTargetRanges`in new window.InputEvent(`input`),Bf=If&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Vf=If&&/Android/.test(navigator.userAgent),Hf=If&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Vf,Uf=If&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Wf=If&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Rf&&!Uf,Gf=vn(`DRAG_DROP_PASTE_FILE`);var Kf=class e extends St{static getType(){return`quote`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`blockquote`);return ss(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Qf,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(us(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return qf().updateFromJSON(e)}insertNewAfter(e,t){let n=p(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){let e=p();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function qf(){return n(new Kf)}function Jf(e){return e instanceof Kf}var Yf=class e extends St{__tag;static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];ss(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Zf,priority:0}),h2:e=>({conversion:Zf,priority:0}),h3:e=>({conversion:Zf,priority:0}),h4:e=>({conversion:Zf,priority:0}),h5:e=>({conversion:Zf,priority:0}),h6:e=>({conversion:Zf,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&Xf(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Xf(e)?{conversion:e=>({node:$f(`h1`)}),priority:3}:null}}exportDOM(e){let{element:t}=super.exportDOM(e);if(us(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return $f(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){let n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?p():$f(this.getTag()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){let e=p();e.select(),this.replace(e,!0)}return i}collapseAtStart(){let e=this.isEmpty()?p():$f(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}};function Xf(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function Zf(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=$f(t),e.style!==null&&(Qn(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Qf(e){let t=qf();return e.style!==null&&(t.setFormat(e.style.textAlign),Qn(e,t)),{node:t}}function $f(e=`h1`){return n(new Yf(e))}function ep(e){return e instanceof Yf}function tp(e){let t=null;if(fs(e,DragEvent)?t=e.dataTransfer:fs(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function np(e){let t=me(e);return De(t)}function rp(e){for(let t of[`lowercase`,`uppercase`,`capitalize`])e.hasFormat(t)&&e.toggleFormat(t)}function ip(e){return ds(e.registerCommand(at,e=>{let t=w();return!!Ne(t)&&(t.clear(),!0)},M),e.registerCommand(ht,e=>{let t=w();return O(t)?(t.deleteCharacter(e),!0):!!Ne(t)&&(t.deleteNodes(),!0)},M),e.registerCommand(_t,e=>{let t=w();return!!O(t)&&(t.deleteWord(e),!0)},M),e.registerCommand(gt,e=>{let t=w();return!!O(t)&&(t.deleteLine(e),!0)},M),e.registerCommand(dt,t=>{let n=w();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)uf(r,n,e);else if(O(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},M),e.registerCommand(en,()=>{let e=w();return!!O(e)&&(e.removeText(),!0)},M),e.registerCommand(Tt,e=>{let t=w();return!!O(t)&&(t.formatText(e),!0)},M),e.registerCommand(wt,e=>{let t=w();if(!O(t)&&!Ne(t))return!1;let n=t.getNodes();for(let t of n){let n=R(t,e=>E(e)&&!e.isInline());n!==null&&n.setFormat(e)}return!0},M),e.registerCommand(jt,e=>{let t=w();return!!O(t)&&(t.insertLineBreak(e),!0)},M),e.registerCommand(Mt,()=>{let e=w();return!!O(e)&&(e.insertParagraph(),!0)},M),e.registerCommand(Nt,()=>{let e=_(),t=w();return O(t)&&(e.setFormat(t.format),e.setStyle(t.style)),we([e]),!0},M),e.registerCommand(kt,()=>$o(e=>{let t=e.getIndent();e.setIndent(t+1)}),M),e.registerCommand(Yt,()=>$o(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),M),e.registerCommand(Rt,e=>{let t=w();if(Ne(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(O(t)){let n=te(t.focus,!0);if(!e.shiftKey&&De(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},M),e.registerCommand(Ft,e=>{let t=w();if(Ne(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(O(t)){if(function(e){let t=e.focus;return t.key===`root`&&t.offset===ye().getChildrenSize()}(t))return e.preventDefault(),!0;let n=te(t.focus,!1);if(!e.shiftKey&&De(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},M),e.registerCommand(It,e=>{let t=w();if(Ne(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),Da(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!O(t))return!1;if(ja(t,!0)){let n=e.shiftKey;return e.preventDefault(),Oa(t,n,!0),!0}return!1},M),e.registerCommand(Lt,e=>{let t=w();if(Ne(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),Da(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!O(t))return!1;let n=e.shiftKey;return!!ja(t,!1)&&(e.preventDefault(),Oa(t,n,!1),!0)},M),e.registerCommand(zt,t=>{if(np(t.target))return!1;let n=w();if(O(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(Fe(n))return!1;let r=Zo(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Yt,void 0);if(Bf&&navigator.language===`ko-KR`)return!1}else if(!Ne(n))return!1;return t.preventDefault(),e.dispatchCommand(ht,!0)},M),e.registerCommand(Bt,t=>{if(np(t.target))return!1;let n=w();return!(!O(n)&&!Ne(n))&&(t.preventDefault(),e.dispatchCommand(ht,!1))},M),e.registerCommand(Ht,t=>{let n=w();if(!O(n))return!1;if(rp(n),t!==null){if((Bf||Hf||Wf)&&zf)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(jt,!1)}return e.dispatchCommand(Mt,void 0)},M),e.registerCommand(Ut,()=>{let t=w();return!!O(t)&&(e.blur(),!0)},M),e.registerCommand(bt,t=>{let[,n]=tp(t);if(n.length>0){let r=Ff(t.clientX,t.clientY);if(r!==null){let{offset:t,node:i}=r,a=me(i);if(a!==null){let e=h();if(A(a))e.anchor.set(a.getKey(),t,`text`),e.focus.set(a.getKey(),t,`text`);else{let t=a.getParentOrThrow().getKey(),n=a.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}let n=Ve(e);j(n)}e.dispatchCommand(Gf,n)}return t.preventDefault(),!0}return cf(t,e)},M),e.registerCommand(yt,t=>{let[n]=tp(t),r=w();return!(n&&!O(r))&&(O(r)&&!r.isCollapsed()&&t.dataTransfer!==null&&(pf(t.dataTransfer,af(r)),df(t.dataTransfer,e)),!0)},M),e.registerCommand(vt,e=>{let[t]=tp(e),n=w();if(t&&!O(n))return!1;let r=Ff(e.clientX,e.clientY);if(r!==null){let t=me(r.node);De(t)&&e.preventDefault()}return!0},M),e.registerCommand(an,()=>(Ke(),!0),M),e.registerCommand(ft,t=>(ff(e,fs(t,ClipboardEvent)?t:null),!0),M),e.registerCommand(pt,t=>(async function(e,t){await ff(t,fs(e,ClipboardEvent)?e:null),t.update(()=>{let e=w();O(e)?e.removeText():Ne(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),M),e.registerCommand(Xt,t=>{let[,n,r]=tp(t);return n.length>0&&!r?(e.dispatchCommand(Gf,n),!0):Nn(t.target)&&Bn(t.target)?!1:w()!==null&&(function(e,t){e.preventDefault(),t.update(()=>{let n=w(),r=fs(e,InputEvent)||fs(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&uf(r,n,t)},{tag:Zt})}(t,e),!0)},M),e.registerCommand(Wt,e=>{let t=w();return O(t)&&rp(t),!1},M),e.registerCommand(Gt,e=>{let t=w();return O(t)&&rp(t),!1},M))}const ap=F({conflictsWith:[`@lexical/plain-text`],dependencies:[vf],name:`@lexical/rich-text`,nodes:()=>[Yf,Kf],register:ip}),op=Pf,sp=op.$createHeadingNode,cp=op.$createQuoteNode,lp=op.$isHeadingNode,up=op.$isQuoteNode;op.DRAG_DROP_PASTE;const dp=op.HeadingNode,fp=op.QuoteNode,pp=op.RichTextExtension;op.eventFiles;const mp=op.registerRichText;var hp=lr({HistoryExtension:()=>xp,SharedHistoryExtension:()=>Sp,createEmptyHistoryState:()=>bp,registerHistory:()=>yp});function gp(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(O(a)&&O(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Fe(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&A(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!A(l)||!A(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function _p(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(ut)&&(a=r,o=i,s=c),p.has(Et))return i=0,r=m,2;p.has(lt)&&s&&(r=a,i=o,c=s);let h=gp(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(Ot);if(!a&&n&&p.has(Dt))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(O(a)&&O(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!A(r)||!A(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function vp(e){e.undoStack=[],e.redoStack=[],e.current=null}function yp(e,t,n,r=Date.now){let i=_p(e,n,r);return ds(e.registerCommand(fn,()=>(function(e,t){let n=t.redoStack,r=t.undoStack;if(r.length!==0){let i=t.current,a=r.pop();i!==null&&(n.push(i),e.dispatchCommand(tt,!0)),r.length===0&&e.dispatchCommand(nt,!1),t.current=a||null,a&&a.editor.setEditorState(a.editorState,{tag:Et})}}(e,t),!0),M),e.registerCommand($t,()=>(function(e,t){let n=t.redoStack,r=t.undoStack;if(n.length!==0){let i=t.current;i!==null&&(r.push(i),e.dispatchCommand(nt,!0));let a=n.pop();n.length===0&&e.dispatchCommand(tt,!1),t.current=a||null,a&&a.editor.setEditorState(a.editorState,{tag:Et})}}(e,t),!0),M),e.registerCommand(rt,()=>(vp(t),!1),M),e.registerCommand(it,()=>(vp(t),e.dispatchCommand(tt,!1),e.dispatchCommand(nt,!1),!0),M),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:a,dirtyElements:o,tags:s})=>{let c=t.current,l=t.redoStack,u=t.undoStack,d=c===null?null:c.editorState;if(c!==null&&n===d)return;let f=i(r,n,c,a,o,s);if(f===1)l.length!==0&&(t.redoStack=[],e.dispatchCommand(tt,!1)),c!==null&&(u.push({...c}),e.dispatchCommand(nt,!0));else if(f===2)return;t.current={editor:e,editorState:n}}))}function bp(){return{current:null,redoStack:[],undoStack:[]}}const xp=F({build:(e,{delay:t,createInitialHistoryState:n,disabled:r,now:i})=>Hc({delay:t,disabled:r,historyState:n(e),now:i}),config:Jn({createInitialHistoryState:bp,delay:300,disabled:typeof window>`u`,now:Date.now}),name:`@lexical/history/History`,register:(e,t,n)=>{let r=n.getOutput();return Rc(()=>r.disabled.value?void 0:yp(e,r.historyState.value,r.delay,()=>r.now.peek()()))}}),Sp=F({build:(e,{disabled:t,parentEditor:n})=>Hc({disabled:t,parentEditor:n||e._parentEditor}),config:Jn({disabled:!1,parentEditor:null}),dependencies:[gn(xp,{disabled:!0})],name:`@lexical/history/SharedHistory`,register:(e,t,n)=>Rc(()=>{let{disabled:e,parentEditor:t}=n.getOutput();if(!e.value){let{output:e}=n.getDependency(xp),r=function(e){return e?Vc(e,xp.name):null}(t.value);if(!r)return;let i=r.output;Ic(()=>{e.delay.value=i.delay.value,e.historyState.value=i.historyState.value,e.now.value=i.now.value,e.disabled.value=i.disabled.value})}})}),Cp=hp,wp=Cp.HistoryExtension;Cp.SharedHistoryExtension,Cp.createEmptyHistoryState,Cp.registerHistory;var Tp=lr({$createCodeHighlightNode:()=>Zp,$createCodeNode:()=>Bp,$getCodeLineDirection:()=>Ap,$getEndOfCodeInLine:()=>Mp,$getFirstCodeNodeOfLine:()=>Op,$getLastCodeNodeOfLine:()=>kp,$getStartOfCodeInLine:()=>jp,$isCodeHighlightNode:()=>Qp,$isCodeNode:()=>Vp,CodeExtension:()=>$p,CodeHighlightNode:()=>Yp,CodeNode:()=>zp,DEFAULT_CODE_LANGUAGE:()=>Np,getDefaultCodeLanguage:()=>Pp});function Ep(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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 Dp(e,t){let n=e;for(let r=be(e,t);r&&(Qp(r.origin)||k(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function Op(e){return Dp(e,`previous`)}function kp(e){return Dp(e,`next`)}function Ap(e){let t=Op(e),n=kp(e),r=t;for(;r!==null;){if(Qp(r)){let e=On(r.getTextContent());if(e!==null)return e}if(r===n)break;r=r.getNextSibling()}let i=t.getParent();if(E(i)){let e=i.getDirection();if(e===`ltr`||e===`rtl`)return e}return null}function jp(e,t){let n=null,r=null,i=e,a=t,o=e.getTextContent();for(;;){if(a===0){if(i=i.getPreviousSibling(),i===null)break;if(Qp(i)||k(i)||D(i)||Ep(167),D(i)){n={node:i,offset:1};break}a=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else a--;let e=o[a];Qp(i)&&e!==` `&&(r={node:i,offset:a})}if(r!==null)return r;let s=null;if(t<e.getTextContentSize())Qp(e)&&(s=e.getTextContent()[t]);else{let t=e.getNextSibling();Qp(t)&&(s=t.getTextContent()[0])}if(s!==null&&s!==` `)return n;{let r=function(e,t){let n=e,r=t,i=e.getTextContent(),a=e.getTextContentSize();for(;;){if(!Qp(n)||r===a){if(n=n.getNextSibling(),n===null||D(n))return null;Qp(n)&&(r=0,i=n.getTextContent(),a=n.getTextContentSize())}if(Qp(n)){if(i[r]!==` `)return{node:n,offset:r};r++}}}(e,t);return r===null?n:r}}function Mp(e){let t=kp(e);return D(t)&&Ep(168),t}const Np=`javascript`,Pp=()=>Np;function Fp(e,t){for(let n of e.childNodes){if(In(n)&&n.tagName===t)return!0;Fp(n,t)}return!1}const Ip=`data-language`,Lp=`data-highlight-language`,Rp=`data-theme`;var zp=class e extends St{__language;__theme;__isSyntaxHighlightSupported;static getType(){return`code`}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){let t=document.createElement(`code`);pn(t,e.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(Ip,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Lp,n));let r=this.getTheme();r&&t.setAttribute(Rp,r);let i=this.getStyle();return i&&Xn(t.style,i),t}updateDOM(e,t,n){let r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(Ip,r):i&&t.removeAttribute(Ip);let a=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?a&&r?r!==i&&t.setAttribute(Lp,r):t.removeAttribute(Lp):a&&r&&t.setAttribute(Lp,r);let o=this.__theme,s=e.__theme;o?o!==s&&t.setAttribute(Rp,o):s&&t.removeAttribute(Rp);let c=this.__style,l=e.__style;return c!==l&&Xn(t.style,c,l),!1}exportDOM(e){let t=document.createElement(`pre`);pn(t,e._config.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(Ip,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Lp,n));let r=this.getTheme();r&&t.setAttribute(Rp,r);let i=this.getStyle();return i&&Xn(t.style,i),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||Fp(e,`BR`))?{conversion:Hp,priority:1}:null,div:()=>({conversion:Up,priority:1}),pre:()=>({conversion:Hp,priority:0}),table:e=>qp(e)?{conversion:Wp,priority:3}:null,td:e=>{let t=e,n=t.closest(`table`);return t.classList.contains(`js-file-line`)||n&&qp(n)?{conversion:Gp,priority:3}:null},tr:e=>{let t=e.closest(`table`);return t&&qp(t)?{conversion:Gp,priority:3}:null}}}static importJSON(e){return Bp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!Vc(pe(),`@lexical/code`)){let t=Jp(e);if(t)return t}let{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(A(i)){let e=Op(i),t=[];for(;;)if(k(e))t.push(_()),e=e.getNextSibling();else{if(!Qp(e))break;{let n=0,r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&r[n]===` `;)n++;if(n!==0&&t.push(Zp(` `.repeat(n))),n!==i)break;e=e.getNextSibling()}}let r=i.splitText(n.offset)[0],a=n.offset===0?0:1,o=r.getIndexWithinParent()+a,s=i.getParentOrThrow(),c=[d(),...t];s.splice(o,0,c);let l=t[t.length-1];l?l.select():n.offset===0?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(Vp(i)){let{offset:t}=e.anchor;i.splice(t,0,[d()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){let e=p();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){let t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){let t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){let t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function Bp(e,t){return u(zp).setLanguage(e).setTheme(t)}function Vp(e){return e instanceof zp}function Hp(e){return{node:Bp(e.getAttribute(Ip))}}function Up(e){let t=e,n=Kp(t);return n||function(e){let t=e.parentElement;for(;t!==null;){if(Kp(t))return!0;t=t.parentElement}return!1}(t)?{node:n?Bp():null}:{node:null}}function Wp(){return{node:Bp()}}function Gp(){return{node:null}}function Kp(e){return e.style.fontFamily.match(`monospace`)!==null}function qp(e){return e.classList.contains(`js-file-line-container`)}function Jp(e){let{anchor:t}=e;if(e.isCollapsed()&&t.type===`element`){let e=t.getNode();if(Vp(e)){let n=e.getChildrenSize();if(n>=2&&t.offset===n){let t=e.getLastChild();if(D(t)&&D(t.getPreviousSibling())){let t=p();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}var Yp=class e extends dn{__highlightType;constructor(e=``,t,n){super(e,n),this.__highlightType=t}static getType(){return`code-highlight`}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){let t=super.createDOM(e),n=Xp(e.theme,this.__highlightType);return pn(t,n),t}updateDOM(e,t,n){let r=super.updateDOM(e,t,n),i=Xp(n.theme,e.__highlightType),a=Xp(n.theme,this.__highlightType);return i!==a&&(i&&Kn(t,i),a&&pn(t,a)),r}static importJSON(e){return Zp().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 Bp()}};function Xp(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Zp(e=``,t){return n(new Yp(e,t))}function Qp(e){return e instanceof Yp}const $p=F({name:`@lexical/code`,nodes:()=>[zp,Yp],register:e=>e.registerCommand(Ht,e=>{let t=w();return!(!O(t)||!Jp(t))&&(e.preventDefault(),!0)},P)}),em=Tp,tm=em.$createCodeHighlightNode,nm=em.$createCodeNode,rm=em.$getCodeLineDirection,im=em.$getEndOfCodeInLine,am=em.$getFirstCodeNodeOfLine,om=em.$getLastCodeNodeOfLine,sm=em.$getStartOfCodeInLine,cm=em.$isCodeHighlightNode,lm=em.$isCodeNode,um=em.CodeExtension,dm=em.CodeHighlightNode,fm=em.CodeNode,pm=em.DEFAULT_CODE_LANGUAGE,mm=em.getDefaultCodeLanguage;function hm(e){throw Error(e)}(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach(function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
|
|
24
|
+
?|
|
|
25
|
+
|(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(Prism);const gm=globalThis.Prism||window.Prism;function _m(e){let t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}function vm(e){let t=_m(e)||e;try{return t?gm.languages.hasOwnProperty(t):!1}catch{return!1}}async function ym(e,t,n){}function bm(e){return typeof e==`string`?e:Array.isArray(e)?e.map(bm).join(``):bm(e.content)}function xm(e,t){let n=t,r=gm.languages[n],i={tokens:e},a=gm.languages.diff.PREFIXES;for(let e of i.tokens){if(typeof e==`string`||!(e.type in a)||!Array.isArray(e.content))continue;let t=e.type,n=0,i=()=>(n++,new gm.Token(`prefix`,a[t],t.replace(/^(\w+).*/,`$1`))),o=e.content.filter(e=>typeof e==`string`||e.type!==`prefix`),s=e.content.length-o.length,c=gm.tokenize(bm(o),r);c.unshift(i());let l=/\r\n|\n/g,u=e=>{let t=[];l.lastIndex=0;let r=0,a;for(;n<s&&(a=l.exec(e));){let n=a.index+a[0].length;t.push(e.slice(r,n)),r=n,t.push(i())}if(t.length!==0)return r<e.length&&t.push(e.slice(r)),t},d=e=>{for(let t=0;t<e.length&&n<s;t++){let n=e[t];if(typeof n==`string`){let r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if(typeof n.content==`string`){let e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(c),n<s&&c.push(i()),e.content=c}return i.tokens}function Sm(e,t){let n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent(),i=gm.tokenize(r,gm.languages[n?`diff`:t]);return n&&(i=xm(i,n[1])),Cm(i)}function Cm(e,t){let n=[];for(let r of e)if(typeof r==`string`){let e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){let i=e[r];i===`
|
|
26
|
+
`||i===`\r
|
|
27
|
+
`?n.push(d()):i===` `?n.push(_()):i.length>0&&n.push(tm(i,t))}}else{let{content:e,alias:t}=r;typeof e==`string`?n.push(...Cm([e],r.type===`prefix`&&typeof t==`string`?t:r.type)):Array.isArray(e)&&n.push(...Cm(e,r.type===`unchanged`?void 0:r.type))}return n}const wm={$tokenize(e,t){return Sm(e,t||this.defaultLanguage)},defaultLanguage:pm,tokenize(e,t){return gm.tokenize(e,gm.languages[t||``]||gm.languages[this.defaultLanguage])}};function Tm(e,t,n,r){let i=r.getParent();lm(i)?Dm(e,t,n,i):cm(r)&&r.replace(v(r.__text))}function Em(e,t){let n=t.getElementByKey(e.getKey());if(n===null)return;let r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let a=`1`,o=1;for(let e=0;e<i;e++)D(r[e])&&(a+=`
|
|
28
|
+
`+ ++o);n.setAttribute(`data-gutter`,a)}function Dm(e,t,n,r){let{nodesCurrentlyHighlighting:i}=n,a=r.getKey();r.getLanguage()===void 0&&r.setLanguage(t.defaultLanguage);let o=r.getLanguage()||t.defaultLanguage;if(vm(o))r.getIsSyntaxHighlightSupported()||r.setIsSyntaxHighlightSupported(!0);else{r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!1),ym(o,e,a);return}i.has(a)||(i.add(a),n.didTransform||(n.didTransform=!0,He(()=>{n.didTransform=!1,i.clear()})),Om(a,()=>{let e=C(a);if(!lm(e)||!e.isAttached())return!1;let n=e.getLanguage()||t.defaultLanguage,i=t.$tokenize(e,n),{from:o,to:s,nodesForReplacement:c}=km(e.getChildren(),i);return o!==s||c.length?(r.splice(o,s-o,c),!0):!1}))}function Om(e,t){let n=C(e);if(!lm(n)||!n.isAttached())return;let r=w();if(!O(r)){t();return}let i=r.anchor,a=i.offset,o=i.type===`element`&&D(n.getChildAtIndex(i.offset-1)),s=0;if(o||(s=a+i.getNode().getPreviousSiblings().reduce((e,t)=>e+t.getTextContentSize(),0)),t()){if(o){i.getNode().select(a,a);return}n.getChildren().some(e=>{let t=A(e);if(t||D(e)){let n=e.getTextContentSize();if(t&&n>=s)return e.select(s,s),!0;s-=n}return!1})}}function km(e,t){let n=0;for(;n<e.length&&Am(e[n],t[n]);)n++;let r=e.length,i=t.length,a=Math.min(r,i)-n,o=0;for(;o<a;)if(o++,!Am(e[r-o],t[i-o])){o--;break}let s=n,c=r-o;return{from:s,nodesForReplacement:t.slice(n,i-o),to:c}}function Am(e,t){return cm(e)&&cm(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||k(e)&&k(t)||D(e)&&D(t)}function jm(e){if(!O(e))return!1;let t=e.anchor.getNode(),n=lm(t)?t:t.getParent(),r=e.focus.getNode(),i=lm(r)?r:r.getParent();return lm(n)&&n.is(i)}function Mm(e){let t=e.getNodes(),n=[];if(t.length===1&&lm(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){let i=t[e];cm(i)||k(i)||D(i)||hm(`Expected selection to be inside CodeBlock and consisting of CodeHighlightNode, TabNode and LineBreakNode`),D(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){let t=e.isBackward()?e.anchor:e.focus,i=m(r[0].getKey(),0,`text`);t.is(i)||n.push(r)}return n}function Nm(e){let t=w();if(!O(t)||!jm(t))return null;let n=e?Yt:kt,r=e?Yt:Nt,i=t.anchor,a=t.focus;if(i.is(a))return r;let o=Mm(t);if(o.length!==1)return n;let s=o[0];s.length===0&&hm(`$getCodeLines only extracts non-empty lines`);let c,l;t.isBackward()?(c=a,l=i):(c=i,l=a);let u=am(s[0]),d=om(s[0]),f=m(u.getKey(),0,`text`),p=m(d.getKey(),d.getTextContentSize(),`text`);return c.isBefore(f)||p.isBefore(l)?n:f.isBefore(c)||l.isBefore(p)?r:n}function Pm(e){let t=w();if(!O(t)||!jm(t))return!1;let n=Mm(t),r=n.length;if(r===0&&t.isCollapsed())return e===kt&&t.insertNodes([_()]),!0;if(r===0&&e===kt&&t.getTextContent()===`
|
|
29
|
+
`){let e=_(),n=d(),r=t.isBackward()?`previous`:`next`;return t.insertNodes([e,n]),Ye(oe(ae(xe(e,`next`,0),Be(be(n,`next`))),r)),!0}for(let i=0;i<r;i++){let r=n[i];if(r.length>0){let n=r[0];if(i===0&&(n=am(n)),e===kt){let e=_();if(n.insertBefore(e),i===0){let r=t.isBackward()?`focus`:`anchor`,i=m(n.getKey(),0,`text`);t[r].is(i)&&t[r].set(e.getKey(),0,`text`)}}else k(n)&&n.remove()}}return!0}function Fm(e,t){let n=w();if(!O(n))return!1;let{anchor:r,focus:i}=n,a=r.offset,o=i.offset,s=r.getNode(),c=i.getNode(),l=e===Rt;if(!jm(n)||!(cm(s)||k(s))||!(cm(c)||k(c)))return!1;if(!t.altKey){if(n.isCollapsed()){let e=s.getParentOrThrow();if(l&&a===0&&s.getPreviousSibling()===null){if(e.getPreviousSibling()===null)return e.selectPrevious(),t.preventDefault(),!0}else if(!l&&a===s.getTextContentSize()&&s.getNextSibling()===null&&e.getNextSibling()===null)return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(s.isBefore(c)?(u=am(s),d=om(c)):(u=am(c),d=om(s)),u==null||d==null)return!1;let f=u.getNodesBetween(d);for(let e=0;e<f.length;e++){let t=f[e];if(!cm(t)&&!k(t)&&!D(t))return!1}t.preventDefault(),t.stopPropagation();let p=l?u.getPreviousSibling():d.getNextSibling();if(!D(p))return!0;let m=l?p.getPreviousSibling():p.getNextSibling();if(m==null)return!0;let h=(cm(m)||k(m)||D(m)?l?am(m):om(m):null)??m;return p.remove(),f.forEach(e=>e.remove()),e===Rt?(f.forEach(e=>h.insertBefore(e)),h.insertBefore(p)):(h.insertAfter(p),h=p,f.forEach(e=>{h.insertAfter(e),h=e})),n.setTextNodeRange(s,a,c,o),!0}function Im(e,t){let n=w();if(!O(n))return!1;let{anchor:r,focus:i}=n,a=r.getNode(),o=i.getNode(),s=e===Jt;if(!jm(n)||!(cm(a)||k(a))||!(cm(o)||k(o)))return!1;let c=o;if(rm(c)===`rtl`?!s:s){let e=sm(c,i.offset);if(e!==null){let{node:t,offset:r}=e;D(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else c.getParentOrThrow().selectStart()}else im(c).select();return t.preventDefault(),t.stopPropagation(),!0}function Lm(e,t){if(!e.hasNodes([fm,dm]))throw Error(`CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor`);t??=wm;let n=[];e._headless!==!0&&n.push(e.registerMutationListener(fm,t=>{e.getEditorState().read(()=>{for(let[n,r]of t)if(r!==`destroyed`){let t=C(n);t!==null&&Em(t,e)}})},{skipInitialization:!1}));let r={didTransform:!1,nodesCurrentlyHighlighting:new Set};return n.push(e.registerNodeTransform(fm,Dm.bind(null,e,t,r)),e.registerNodeTransform(dn,Tm.bind(null,e,t,r)),e.registerNodeTransform(dm,Tm.bind(null,e,t,r)),e.registerCommand(Gt,t=>{let n=Nm(t.shiftKey);return n!==null&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)},P),e.registerCommand(Nt,()=>jm(w())?(we([_()]),!0):!1,P),e.registerCommand(kt,e=>Pm(kt),P),e.registerCommand(Yt,e=>Pm(Yt),P),e.registerCommand(Rt,e=>{let t=w();if(!O(t)||!jm(t))return!1;let n=ye().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return n&&i&&n.getKey()===i.getKey()?!1:Fm(Rt,e)},P),e.registerCommand(Ft,e=>{let t=w();if(!O(t)||!jm(t))return!1;let n=ye().getLastDescendant(),{anchor:r}=t,i=r.getNode();return n&&i&&n.getKey()===i.getKey()?!1:Fm(Ft,e)},P),e.registerCommand(Jt,e=>Im(Jt,e),P),e.registerCommand(qt,e=>Im(qt,e),P)),Un(...n)}F({build:(e,t)=>Hc(t),config:Jn({disabled:!1,tokenizer:wm}),dependencies:[um],name:`@lexical/code-prism`,register:(e,t,n)=>{let r=n.getOutput();return Rc(()=>{if(!r.disabled.value)return Lm(e,r.tokenizer.value)})}});var Rm=lr({CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>Vm,CODE_LANGUAGE_MAP:()=>Hm,CodePrismExtension:()=>uh,PrismTokenizer:()=>$m,getCodeLanguageOptions:()=>Km,getCodeLanguages:()=>Gm,getCodeThemeOptions:()=>qm,getLanguageFriendlyName:()=>Wm,isCodeLanguageLoaded:()=>Jm,loadCodeLanguage:()=>Ym,normalizeCodeLanguage:()=>Um,registerCodeHighlighting:()=>lh});function zm(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach(function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
|
|
30
|
+
?|
|
|
31
|
+
|(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(Prism);const Bm=globalThis.Prism||window.Prism,Vm={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`},Hm={cpp:`cpp`,java:`java`,javascript:`js`,md:`markdown`,plaintext:`plain`,python:`py`,text:`plain`,ts:`typescript`};function Um(e){return Hm[e]||e}function Wm(e){let t=Um(e);return Vm[t]||t}const Gm=()=>Object.keys(Bm.languages).filter(e=>typeof Bm.languages[e]!=`function`).sort();function Km(){let e=[];for(let[t,n]of Object.entries(Vm))e.push([t,n]);return e}function qm(){return[]}function Jm(e){let t=function(e){let t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}(e)||e;try{return!!t&&Bm.languages.hasOwnProperty(t)}catch{return!1}}async function Ym(e,t,n){}function Xm(e){return typeof e==`string`?e:Array.isArray(e)?e.map(Xm).join(``):Xm(e.content)}function Zm(e,t){let n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent(),i=Bm.tokenize(r,Bm.languages[n?`diff`:t]);return n&&(i=function(e,t){let n=t,r=Bm.languages[n],i={tokens:e},a=Bm.languages.diff.PREFIXES;for(let e of i.tokens){if(typeof e==`string`||!(e.type in a)||!Array.isArray(e.content))continue;let t=e.type,n=0,i=()=>(n++,new Bm.Token(`prefix`,a[t],t.replace(/^(\w+).*/,`$1`))),o=e.content.filter(e=>typeof e==`string`||e.type!==`prefix`),s=e.content.length-o.length,c=Bm.tokenize(Xm(o),r);c.unshift(i());let l=/\r\n|\n/g,u=e=>{let t=[];l.lastIndex=0;let r,a=0;for(;n<s&&(r=l.exec(e));){let n=r.index+r[0].length;t.push(e.slice(a,n)),a=n,t.push(i())}if(t.length!==0)return a<e.length&&t.push(e.slice(a)),t},d=e=>{for(let t=0;t<e.length&&n<s;t++){let n=e[t];if(typeof n==`string`){let r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if(typeof n.content==`string`){let e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(c),n<s&&c.push(i()),e.content=c}return i.tokens}(i,n[1])),Qm(i)}function Qm(e,t){let n=[];for(let r of e)if(typeof r==`string`){let e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){let i=e[r];i===`
|
|
32
|
+
`||i===`\r
|
|
33
|
+
`?n.push(d()):i===` `?n.push(_()):i.length>0&&n.push(tm(i,t))}}else{let{content:e,alias:t}=r;typeof e==`string`?n.push(...Qm([e],r.type===`prefix`&&typeof t==`string`?t:r.type)):Array.isArray(e)&&n.push(...Qm(e,r.type===`unchanged`?void 0:r.type))}return n}const $m={$tokenize(e,t){return Zm(e,t||this.defaultLanguage)},defaultLanguage:pm,tokenize(e,t){return Bm.tokenize(e,Bm.languages[t||``]||Bm.languages[this.defaultLanguage])}};function eh(e,t,n,r){let i=r.getParent();lm(i)?nh(e,t,n,i):cm(r)&&r.replace(v(r.__text))}function th(e,t){let n=t.getElementByKey(e.getKey());if(n===null)return;let r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let a=`1`,o=1;for(let e=0;e<i;e++)D(r[e])&&(a+=`
|
|
34
|
+
`+ ++o);n.setAttribute(`data-gutter`,a)}function nh(e,t,n,r){let{nodesCurrentlyHighlighting:i}=n,a=r.getKey();if(r.getLanguage()===void 0&&r.setLanguage(t.defaultLanguage),!Jm(r.getLanguage()||t.defaultLanguage))return r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!1),void Ym();r.getIsSyntaxHighlightSupported()||r.setIsSyntaxHighlightSupported(!0),i.has(a)||(i.add(a),n.didTransform||(n.didTransform=!0,He(()=>{n.didTransform=!1,i.clear()})),function(e,t){let n=C(e);if(!lm(n)||!n.isAttached())return;let r=w();if(!O(r))return void t();let i=r.anchor,a=i.offset,o=i.type===`element`&&D(n.getChildAtIndex(i.offset-1)),s=0;if(o||(s=a+i.getNode().getPreviousSiblings().reduce((e,t)=>e+t.getTextContentSize(),0)),t()){if(o)return void i.getNode().select(a,a);n.getChildren().some(e=>{let t=A(e);if(t||D(e)){let n=e.getTextContentSize();if(t&&n>=s)return e.select(s,s),!0;s-=n}return!1})}}(a,()=>{let e=C(a);if(!lm(e)||!e.isAttached())return!1;let n=e.getLanguage()||t.defaultLanguage,i=t.$tokenize(e,n),{from:o,to:s,nodesForReplacement:c}=function(e,t){let n=0;for(;n<e.length&&rh(e[n],t[n]);)n++;let r=e.length,i=t.length,a=Math.min(r,i)-n,o=0;for(;o<a;)if(o++,!rh(e[r-o],t[i-o])){o--;break}let s=n,c=r-o;return{from:s,nodesForReplacement:t.slice(n,i-o),to:c}}(e.getChildren(),i);return!(o===s&&!c.length)&&(r.splice(o,s-o,c),!0)}))}function rh(e,t){return cm(e)&&cm(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||k(e)&&k(t)||D(e)&&D(t)}function ih(e){if(!O(e))return!1;let t=e.anchor.getNode(),n=lm(t)?t:t.getParent(),r=e.focus.getNode(),i=lm(r)?r:r.getParent();return lm(n)&&n.is(i)}function ah(e){let t=e.getNodes(),n=[];if(t.length===1&&lm(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){let i=t[e];cm(i)||k(i)||D(i)||zm(169),D(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){let t=e.isBackward()?e.anchor:e.focus,i=m(r[0].getKey(),0,`text`);t.is(i)||n.push(r)}return n}function oh(e){let t=w();if(!O(t)||!ih(t))return!1;let n=ah(t),r=n.length;if(r===0&&t.isCollapsed())return e===kt&&t.insertNodes([_()]),!0;if(r===0&&e===kt&&t.getTextContent()===`
|
|
35
|
+
`){let e=_(),n=d(),r=t.isBackward()?`previous`:`next`;return t.insertNodes([e,n]),Ye(oe(ae(xe(e,`next`,0),Be(be(n,`next`))),r)),!0}for(let i=0;i<r;i++){let r=n[i];if(r.length>0){let n=r[0];if(i===0&&(n=am(n)),e===kt){let e=_();if(n.insertBefore(e),i===0){let r=t.isBackward()?`focus`:`anchor`,i=m(n.getKey(),0,`text`);t[r].is(i)&&t[r].set(e.getKey(),0,`text`)}}else k(n)&&n.remove()}}return!0}function sh(e,t){let n=w();if(!O(n))return!1;let{anchor:r,focus:i}=n,a=r.offset,o=i.offset,s=r.getNode(),c=i.getNode(),l=e===Rt;if(!ih(n)||!cm(s)&&!k(s)||!cm(c)&&!k(c))return!1;if(!t.altKey){if(n.isCollapsed()){let e=s.getParentOrThrow();if(l&&a===0&&s.getPreviousSibling()===null){if(e.getPreviousSibling()===null)return e.selectPrevious(),t.preventDefault(),!0}else if(!l&&a===s.getTextContentSize()&&s.getNextSibling()===null&&e.getNextSibling()===null)return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(s.isBefore(c)?(u=am(s),d=om(c)):(u=am(c),d=om(s)),u==null||d==null)return!1;let f=u.getNodesBetween(d);for(let e=0;e<f.length;e++){let t=f[e];if(!cm(t)&&!k(t)&&!D(t))return!1}t.preventDefault(),t.stopPropagation();let p=l?u.getPreviousSibling():d.getNextSibling();if(!D(p))return!0;let m=l?p.getPreviousSibling():p.getNextSibling();if(m==null)return!0;let h=(cm(m)||k(m)||D(m)?l?am(m):om(m):null)??m;return p.remove(),f.forEach(e=>e.remove()),e===Rt?(f.forEach(e=>h.insertBefore(e)),h.insertBefore(p)):(h.insertAfter(p),h=p,f.forEach(e=>{h.insertAfter(e),h=e})),n.setTextNodeRange(s,a,c,o),!0}function ch(e,t){let n=w();if(!O(n))return!1;let{anchor:r,focus:i}=n,a=r.getNode(),o=i.getNode(),s=e===Jt;if(!ih(n)||!cm(a)&&!k(a)||!cm(o)&&!k(o))return!1;let c=o;if(rm(c)===`rtl`?!s:s){let e=sm(c,i.offset);if(e!==null){let{node:t,offset:r}=e;D(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else c.getParentOrThrow().selectStart()}else im(c).select();return t.preventDefault(),t.stopPropagation(),!0}function lh(e,t){if(!e.hasNodes([fm,dm]))throw Error(`CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor`);t??=$m;let n=[];!0!==e._headless&&n.push(e.registerMutationListener(fm,t=>{e.getEditorState().read(()=>{for(let[n,r]of t)if(r!==`destroyed`){let t=C(n);t!==null&&th(t,e)}})},{skipInitialization:!1}));let r={didTransform:!1,nodesCurrentlyHighlighting:new Set};return n.push(e.registerNodeTransform(fm,nh.bind(null,e,t,r)),e.registerNodeTransform(dn,eh.bind(null,e,t,r)),e.registerNodeTransform(dm,eh.bind(null,e,t,r)),e.registerCommand(Gt,t=>{let n=function(e){let t=w();if(!O(t)||!ih(t))return null;let n=e?Yt:kt,r=e?Yt:Nt,i=t.anchor,a=t.focus;if(i.is(a))return r;let o=ah(t);if(o.length!==1)return n;let s=o[0],c,l;s.length===0&&zm(285),t.isBackward()?(c=a,l=i):(c=i,l=a);let u=am(s[0]),d=om(s[0]),f=m(u.getKey(),0,`text`),p=m(d.getKey(),d.getTextContentSize(),`text`);return c.isBefore(f)||p.isBefore(l)?n:f.isBefore(c)||l.isBefore(p)?r:n}(t.shiftKey);return n!==null&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)},P),e.registerCommand(Nt,()=>!!ih(w())&&(we([_()]),!0),P),e.registerCommand(kt,e=>oh(kt),P),e.registerCommand(Yt,e=>oh(Yt),P),e.registerCommand(Rt,e=>{let t=w();if(!O(t)||!ih(t))return!1;let n=ye().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&sh(Rt,e)},P),e.registerCommand(Ft,e=>{let t=w();if(!O(t)||!ih(t))return!1;let n=ye().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&sh(Ft,e)},P),e.registerCommand(Jt,e=>ch(Jt,e),P),e.registerCommand(qt,e=>ch(qt,e),P)),Un(...n)}const uh=F({build:(e,t)=>Hc(t),config:Jn({disabled:!1,tokenizer:$m}),dependencies:[um],name:`@lexical/code-prism`,register:(e,t,n)=>{let r=n.getOutput();return Rc(()=>{if(!r.disabled.value)return lh(e,r.tokenizer.value)})}}),dh=Rm,fh=dh.CODE_LANGUAGE_FRIENDLY_NAME_MAP,ph=dh.CODE_LANGUAGE_MAP;dh.CodePrismExtension;const mh=dh.PrismTokenizer,hh=dh.getCodeLanguageOptions,gh=dh.getCodeLanguages,_h=dh.getCodeThemeOptions,vh=dh.getLanguageFriendlyName;dh.isCodeLanguageLoaded,dh.loadCodeLanguage;const yh=dh.normalizeCodeLanguage,bh=dh.registerCodeHighlighting;var xh=lr({$createCodeHighlightNode:()=>tm,$createCodeNode:()=>nm,$getCodeLineDirection:()=>rm,$getEndOfCodeInLine:()=>im,$getFirstCodeNodeOfLine:()=>am,$getLastCodeNodeOfLine:()=>om,$getStartOfCodeInLine:()=>sm,$isCodeHighlightNode:()=>cm,$isCodeNode:()=>lm,CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>Sh,CODE_LANGUAGE_MAP:()=>Ch,CodeExtension:()=>um,CodeHighlightNode:()=>dm,CodeNode:()=>fm,DEFAULT_CODE_LANGUAGE:()=>pm,PrismTokenizer:()=>Ah,getCodeLanguageOptions:()=>wh,getCodeLanguages:()=>Th,getCodeThemeOptions:()=>Eh,getDefaultCodeLanguage:()=>mm,getLanguageFriendlyName:()=>Dh,normalizeCodeLang:()=>Oh,normalizeCodeLanguage:()=>kh,registerCodeHighlighting:()=>jh});const Sh=fh,Ch=ph,wh=hh,Th=gh,Eh=_h,Dh=vh,Oh=yh,kh=yh,Ah=mh,jh=bh,Mh=xh,Nh=Mh.$createCodeHighlightNode,Ph=Mh.$createCodeNode;Mh.$getCodeLineDirection,Mh.$getEndOfCodeInLine,Mh.$getFirstCodeNodeOfLine,Mh.$getLastCodeNodeOfLine,Mh.$getStartOfCodeInLine;const Fh=Mh.$isCodeHighlightNode,Ih=Mh.$isCodeNode,Lh=Mh.CODE_LANGUAGE_FRIENDLY_NAME_MAP;Mh.CODE_LANGUAGE_MAP,Mh.CodeExtension;const Rh=Mh.CodeHighlightNode,zh=Mh.CodeNode;Mh.DEFAULT_CODE_LANGUAGE;const Bh=Mh.PrismTokenizer;Mh.getCodeLanguageOptions,Mh.getCodeLanguages,Mh.getCodeThemeOptions,Mh.getDefaultCodeLanguage,Mh.getLanguageFriendlyName;const Vh=Mh.normalizeCodeLang;Mh.normalizeCodeLanguage;const Hh=Mh.registerCodeHighlighting;var Uh=lr({$convertFromMarkdownString:()=>i_,$convertToMarkdownString:()=>a_,BOLD_ITALIC_STAR:()=>Bg,BOLD_ITALIC_UNDERSCORE:()=>Vg,BOLD_STAR:()=>Hg,BOLD_UNDERSCORE:()=>Ug,CHECK_LIST:()=>Ig,CODE:()=>Pg,ELEMENT_TRANSFORMERS:()=>Jg,HEADING:()=>Mg,HIGHLIGHT:()=>zg,INLINE_CODE:()=>Rg,ITALIC_STAR:()=>Gg,ITALIC_UNDERSCORE:()=>Kg,LINK:()=>qg,MULTILINE_ELEMENT_TRANSFORMERS:()=>Yg,ORDERED_LIST:()=>Lg,QUOTE:()=>Ng,STRIKETHROUGH:()=>Wg,TEXT_FORMAT_TRANSFORMERS:()=>Xg,TEXT_MATCH_TRANSFORMERS:()=>Zg,TRANSFORMERS:()=>Qg,UNORDERED_LIST:()=>Fg,registerMarkdownShortcuts:()=>r_});function Wh(e,t){let n={};for(let r of e){let e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}function Gh(e){let t=Wh(e,e=>e.type);return{element:t.element||[],multilineElement:t[`multiline-element`]||[],textFormat:t[`text-format`]||[],textMatch:t[`text-match`]||[]}}const Kh=/[!-/:-@[-`{-~\s]/,qh=/[ \t\n\r\f]/,Jh=/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/,Yh=/^\s{0,3}$/;function Xh(e){if(!Pe(e))return!1;let t=e.getFirstChild();return t==null||e.getChildrenSize()===1&&A(t)&&Yh.test(t.getTextContent())}function Zh(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`).replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t)))}function Qh(e,t,n,r,i){for(let a of t){if(!a.export)continue;let t=a.export(e,e=>$h(e,n,r,void 0,void 0,i));if(t!=null)return t}return E(e)?$h(e,n,r,void 0,void 0,i):De(e)?e.getTextContent():null}function $h(e,t,n,r,i,a=!1){let o=[],s=e.getChildren();r||=[],i||=[];t:for(let e of s){for(let s of n){if(!s.export)continue;let c=s.export(e,e=>$h(e,t,n,r,[...i,...r],a),(e,n)=>eg(e,n,t,r,i,a));if(c!=null){o.push(c);continue t}}D(e)?o.push(`
|
|
36
|
+
`):A(e)?o.push(eg(e,e.getTextContent(),t,r,i,a)):E(e)?o.push($h(e,t,n,r,i,a)):De(e)&&o.push(e.getTextContent())}return o.join(``)}function eg(e,t,n,r,i,a=!1){let o=t;e.hasFormat(`code`)||(o=a?o.replace(/([*_`~])/g,`\\$1`):o.replace(/([*_`~\\])/g,`\\$1`));let s=o.match(/^(\s*)(.*?)(\s*)$/s)||[``,``,o,``],c=s[1],l=s[2],u=s[3],d=l===``,f=``,p=``,m=``,h=tg(e,!0),g=tg(e,!1),_=new Set;for(let t of n){let n=t.format[0],i=t.tag;rg(e,n)&&!_.has(n)&&(_.add(n),rg(h,n)&&r.find(e=>e.tag===i)||(r.push({format:n,tag:i}),f+=i))}for(let t=0;t<r.length;t++){let n=ng(e,r[t].format),a=ng(g,r[t].format);if(n&&a)continue;let o=[...r];for(;o.length>t;){let e=o.pop();i&&e&&i.find(t=>t.tag===e.tag)||(e&&typeof e.tag==`string`&&(n?a||(m+=e.tag):p+=e.tag),r.pop())}break}return d&&!e.hasFormat(`code`)?p+o:p+c+f+l+m+u}function tg(e,t){let n=t?e.getPreviousSibling():e.getNextSibling();return A(n)?n:null}function ng(e,t){return A(e)&&e.hasFormat(t)}function rg(e,t){return!!ng(e,t)&&(t===`code`||!e||!/^\s*$/.test(e.getTextContent()))}function ig(e,t){let n=e.getTextContent(),r=t.fullMatchRegExpByTag["`"],i=t.transformersByTag["`"],a=[],o=null;if(r&&i){let e=new RegExp(r.source,`g`),t=Array.from(n.matchAll(e));for(let e of t){let t=e.index+e[1].length,n=e.index+e[0].length;o||={content:e[3],endIndex:n,startIndex:t,tag:"`"},a.push({end:n,start:t})}}let s=function(e,t,n=[]){let r=[],i=new Set(Object.keys(t.transformersByTag).filter(e=>e[0]!=="`").map(e=>e[0])),a=t=>{let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1},o=e=>n.some(t=>e>=t.start&&e<t.end),s=0;for(;s<e.length;){let t=e[s];if(!i.has(t)||a(s)||o(s)){s++;continue}let n=1;for(;s+n<e.length&&e[s+n]===t;)n++;let c=ag(t,e,s,n,!0),l=ag(t,e,s,n,!1);(c||l)&&r.push({active:!0,canClose:l,canOpen:c,char:t,index:s,length:n,originalLength:n}),s+=n}return r}(n,t,a),c=s.length>0?function(e,t,n){let r={},i=0,a=null;for(;i<t.length;){let o=t[i];if(!o.active||!o.canClose||o.length===0){i++;continue}let s=`${o.char}${o.canOpen}`,c=r[s]??-1,l=!1;for(let r=i-1;r>c;r--){let s=t[r];if(!s.active||!s.canOpen||s.length===0||s.char!==o.char||(s.canClose||o.canOpen)&&(s.originalLength+o.originalLength)%3==0&&s.originalLength%3!=0&&o.originalLength%3!=0)continue;let c=Math.min(s.length,o.length),u=Object.keys(n.transformersByTag).filter(e=>e[0]===s.char&&e.length<=c).sort((e,t)=>t.length-e.length)[0];if(!u)continue;l=!0;let d=u.length,f={content:e.slice(s.index+s.length,o.index),endIndex:o.index+d,startIndex:s.index+(s.length-d),tag:u};(!a||f.startIndex<a.startIndex||f.startIndex===a.startIndex&&f.endIndex>a.endIndex)&&(a=f);for(let e=r+1;e<i;e++)t[e].active=!1;s.length-=d,o.length-=d,s.active=s.length>0,o.length>0?o.index+=d:(o.active=!1,i++);break}l||(r[s]=i-1,o.canOpen||(o.active=!1),i++)}return a}(n,s,t):null,l=null,u=null;if(o&&c?c.startIndex<=o.startIndex&&c.endIndex>=o.endIndex?(l=c,u=t.transformersByTag[c.tag]):(l=o,u=i):o?(l=o,u=i):c&&(l=c,u=t.transformersByTag[c.tag]),!l||!u)return null;let d=[n.slice(l.startIndex,l.endIndex),l.tag,l.content];return d.index=l.startIndex,d.input=n,{endIndex:l.endIndex,match:d,startIndex:l.startIndex,transformer:u}}function ag(e,t,n,r,i){if(!og(t,n,r,i))return!1;if(e===`*`)return!0;if(e===`_`){if(!og(t,n,r,!i))return!0;let e=i?t[n-1]:t[n+r];return e!==void 0&&Jh.test(e)}return!0}function og(e,t,n,r){let i=e[t-1],a=e[t+n],[o,s]=r?[a,i]:[i,a];return o!==void 0&&!qh.test(o)&&(!Jh.test(o)||s===void 0||qh.test(s)||Jh.test(s))}function sg(e){return A(e)&&!e.hasFormat(`code`)}function cg(e,t,n){let r=ig(e,t),i=function(e,t){let n=e,r,i,a,o;for(let e of t){if(!e.replace||!e.importRegExp)continue;let t=n.getTextContent().match(e.importRegExp);if(!t)continue;let s=t.index||0,c=e.getEndIndex?e.getEndIndex(n,t):s+t[0].length;!1!==c&&(r===void 0||i===void 0||s<r&&(c>i||c<=r))&&(r=s,i=c,a=e,o=t)}return r===void 0||i===void 0||a===void 0||o===void 0?null:{endIndex:i,match:o,startIndex:r,transformer:a}}(e,n);if(r&&i&&(r.startIndex<=i.startIndex&&r.endIndex>=i.endIndex||i.startIndex>r.endIndex?i=null:r=null),r){let i=function(e,t,n,r,i){let a=e.getTextContent(),o,s,c;if(i[0]===a?o=e:t===0?[o,s]=e.splitText(n):[c,o,s]=e.splitText(t,n),o.setTextContent(i[2]),r)for(let e of r.format)o.hasFormat(e)||o.toggleFormat(e);return{nodeAfter:s,nodeBefore:c,transformedNode:o}}(e,r.startIndex,r.endIndex,r.transformer,r.match);sg(i.nodeAfter)&&cg(i.nodeAfter,t,n),sg(i.nodeBefore)&&cg(i.nodeBefore,t,n),sg(i.transformedNode)&&cg(i.transformedNode,t,n)}else if(i){let r=function(e,t,n,r,i){let a,o,s;return t===0?[a,o]=e.splitText(n):[s,a,o]=e.splitText(t,n),r.replace?{nodeAfter:o,nodeBefore:s,transformedNode:r.replace(a,i)||void 0}:null}(e,i.startIndex,i.endIndex,i.transformer,i.match);if(!r)return;sg(r.nodeAfter)&&cg(r.nodeAfter,t,n),sg(r.nodeBefore)&&cg(r.nodeBefore,t,n),sg(r.transformedNode)&&cg(r.transformedNode,t,n)}let a=Zh(e.getTextContent());e.setTextContent(a)}function lg(e,t=!1){let n=Gh(e),r=function(e){let t={},n={},r=[];for(let i of e){let{tag:e}=i;t[e]=i;let a=e.replace(/(\*|\^|\+)/g,`\\$1`);r.push(a),n[e]=e.length===1?RegExp(e==="`"?"(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)":`(^|[^\\\\${a}])(${a})((\\\\${a})?.*?[^${a}\\s](\\\\${a})?)(${a})(?![\\\\${a}])`):RegExp(`(^|[^\\\\])(${a})((\\\\${a})?.*?[^\\s](\\\\${a})?)(${a})(?!\\\\)`)}return{fullMatchRegExpByTag:n,openTagsRegExp:RegExp(`(${r.join(`|`)})`,`g`),transformersByTag:t}}(n.textFormat);return(e,i)=>{let a=e.split(`
|
|
37
|
+
`),o=a.length,s=i||ye();s.clear();for(let e=0;e<o;e++){let i=a[e],[o,c]=ug(a,e,n.multilineElement,s);o?e=c:dg(i,s,n.element,r,n.textMatch,t)}let c=s.getChildren();for(let e of c)if(!t&&Xh(e)&&s.getChildrenSize()>1)e.remove();else if(E(e))for(let t of e.getAllTextNodes())fg(t);w()!==null&&s.selectStart()}}function ug(e,t,n,r){for(let i of n){let{handleImportAfterStartMatch:n,regExpEnd:a,regExpStart:o,replace:s}=i,c=e[t].match(o);if(!c)continue;if(n){let a=n({lines:e,rootNode:r,startLineIndex:t,startMatch:c,transformer:i});if(a===null)continue;if(a)return a}let l=typeof a==`object`&&`regExp`in a?a.regExp:a,u=a&&typeof a==`object`&&`optional`in a?a.optional:!a,d=t,f=e.length;for(;d<f;){let n=l?e[d].match(l):null;if(!n&&(!u||u&&d<f-1)){d++;continue}if(n&&t===d&&n.index===c.index){d++;continue}let i=[];if(n&&t===d)i.push(e[t].slice(c[0].length,-n[0].length));else for(let r=t;r<=d;r++)if(r===t){let t=e[r].slice(c[0].length);i.push(t)}else if(r===d&&n){let t=e[r].slice(0,-n[0].length);i.push(t)}else i.push(e[r]);if(!1!==s(r,null,c,n,i,!0))return[!0,d];break}}return[!1,t]}function dg(e,t,n,r,i,a){let o=v(e),s=p();s.append(o),t.append(s);for(let{regExp:t,replace:r}of n){let n=e.match(t);if(n&&(o.setTextContent(e.slice(n[0].length)),!1!==r(s,[o],n,!0)))break}if(cg(o,r,i),s.isAttached()&&e.length>0){let e=s.getPreviousSibling();if(!a&&(Pe(e)||up(e)||Au(e))){let t=e;if(Au(e)){let n=e.getLastDescendant();t=n==null?null:R(n,ku)}if(t!=null&&t.getTextContentSize()>0){let e=t.getLastChild();if(A(e)){let t=e.getTextContent();t.endsWith(`\\`)?e.setTextContent(t.slice(0,-1)):/ {2,}$/.test(t)&&e.setTextContent(t.replace(/ {2,}$/,``))}t.splice(t.getChildrenSize(),0,[d(),...s.getChildren()]),s.remove()}}}}function fg(e){let t=new Set,n=e.getTextContent(),r=n.indexOf(` `);for(;r!==-1;)t.add(r),t.add(r+1),r=n.indexOf(` `,r+1);e.splitText(...t).forEach(e=>{e.getTextContent()===` `&&e.replace(_())})}function pg(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const mg=/^(\s*)(\d{1,})\.\s/,hg=/^(\s*)[-*+]\s/,gg=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,_g=/^(#{1,6})\s/,vg=/^>\s/,yg=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,bg=/^[ \t]*`{3,}$/,xg=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Sg=/^(?:\|)(.+)(?:\|)\s?$/,Cg=/^(\| ?:?-*:? ?)+\|\s?$/,wg=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Tg=/^<\/[a-z_][\w-]*\s*>/i,Eg=e=>RegExp(`(?:${e.source})$`,e.flags),Dg=bn(`mdListMarker`,{parse:e=>typeof e==`string`&&/^[-*+]$/.test(e)?e:`-`,resetOnCopyNode:!0}),Og=bn(`mdCodeFence`,{parse:e=>typeof e==`string`&&/^`{3,}$/.test(e)?e:"```",resetOnCopyNode:!0}),kg=e=>(t,n,r,i)=>{let a=e(r);a.append(...n),t.replace(a),i||a.select(0,0)},Ag=e=>(t,n,r,i)=>{let a=t.getPreviousSibling(),o=t.getNextSibling(),s=Eu(e===`check`?r[3]===`x`:void 0),c=r[0].trim()[0],l=e!==`bullet`&&e!==`check`||c!==Dg.parse(c)?void 0:c;if(Au(o)&&o.getListType()===e){l&&Xe(o,Dg,l);let e=o.getFirstChild();e===null?o.append(s):e.insertBefore(s),t.remove()}else if(Au(a)&&a.getListType()===e)l&&Xe(a,Dg,l),a.append(s),t.remove();else{let n=Du(e,e===`number`?Number(r[2]):void 0);l&&Xe(n,Dg,l),n.append(s),t.replace(n)}s.append(...n),i||s.select(0,0);let u=function(e){let t=e.match(/\t/g),n=e.match(/ /g),r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&s.setIndent(u)},jg=(e,t,n)=>{let r=[],i=e.getChildren(),a=0;for(let o of i)if(ku(o)){if(o.getChildrenSize()===1){let e=o.getFirstChild();if(Au(e)){r.push(jg(e,t,n+1));continue}}let i=` `.repeat(4*n),s=e.getListType(),c=T(e,Dg),l=s===`number`?`${e.getStart()+a}. `:s===`check`?`${c} [${o.getChecked()?`x`:` `}] `:c+` `,u=t(o);s!==`number`&&(u=u.replace(/^(\s{0,3}\d+)(\.\s)/,`$1\\$2`)),r.push(i+l+u),a++}return r.join(`
|
|
38
|
+
`)},Mg={dependencies:[dp],export:(e,t)=>{if(!lp(e))return null;let n=Number(e.getTag().slice(1));return`#`.repeat(n)+` `+t(e)},regExp:_g,replace:kg(e=>{let t=`h`+e[1].length;return sp(t)}),type:`element`},Ng={dependencies:[fp],export:(e,t)=>{if(!up(e))return null;let n=t(e).split(`
|
|
39
|
+
`),r=[];for(let e of n)r.push(`> `+e);return r.join(`
|
|
40
|
+
`)},regExp:vg,replace:(e,t,n,r)=>{if(r){let n=e.getPreviousSibling();if(up(n))return n.splice(n.getChildrenSize(),0,[d(),...t]),void e.remove()}let i=cp();i.append(...t),e.replace(i),r||i.select(0,0)},type:`element`},Pg={dependencies:[fm],export:e=>{if(!lm(e))return null;let t=e.getTextContent(),n=T(e,Og);if(t.indexOf(n)>-1){let e=t.match(/`{3,}/g);if(e){let t=Math.max(...e.map(e=>e.length));n="`".repeat(t+1)}}return n+(e.getLanguage()||``)+(t?`
|
|
41
|
+
`+t:``)+`
|
|
42
|
+
`+n},handleImportAfterStartMatch:({lines:e,rootNode:t,startLineIndex:n,startMatch:r})=>{let i=r[1],a=i.trim().length,o=e[n],s=r.index+i.length,c=o.slice(s),l=RegExp(`\`{${a},}$`);if(l.test(c)){let e=c.match(l),i=c.slice(0,c.lastIndexOf(e[0])),a=[...r];return a[2]=``,Pg.replace(t,null,a,e,[i],!0),[!0,n]}let u=RegExp(`^[ \\t]*\`{${a},}$`);for(let i=n+1;i<e.length;i++){let a=e[i];if(u.test(a)){let s=a.match(u),c=e.slice(n+1,i),l=o.slice(r[0].length);return l.length>0&&c.unshift(l),Pg.replace(t,null,r,s,c,!0),[!0,i]}}let d=e.slice(n+1),f=o.slice(r[0].length);return f.length>0&&d.unshift(f),Pg.replace(t,null,r,null,d,!0),[!0,e.length-1]},regExpEnd:{optional:!0,regExp:bg},regExpStart:yg,replace:(e,t,n,r,i,a)=>{let o,s,c=n[1]?n[1].trim():"```",l=n[2]||void 0;if(!t&&i){if(i.length===1)r?(o=nm(l),s=i[0]):(o=nm(l),s=i[0].startsWith(` `)?i[0].slice(1):i[0]);else{for(o=nm(l),i.length>0&&(i[0].trim().length===0?i.shift():i[0].startsWith(` `)&&(i[0]=i[0].slice(1)));i.length>0&&!i[i.length-1].length;)i.pop();s=i.join(`
|
|
43
|
+
`)}Xe(o,Og,c);let t=v(s);o.append(t),e.append(o)}else t&&kg(e=>nm(e?e[2]:void 0))(e,t,n,a)},type:`multiline-element`},Fg={dependencies:[Pu,Nu],export:(e,t)=>Au(e)?jg(e,t,0):null,regExp:hg,replace:Ag(`bullet`),type:`element`},Ig={dependencies:[Pu,Nu],export:(e,t)=>Au(e)?jg(e,t,0):null,regExp:gg,replace:Ag(`check`),type:`element`},Lg={dependencies:[Pu,Nu],export:(e,t)=>Au(e)?jg(e,t,0):null,regExp:mg,replace:Ag(`number`),type:`element`},Rg={format:[`code`],tag:"`",type:`text-format`},zg={format:[`highlight`],tag:`==`,type:`text-format`},Bg={format:[`bold`,`italic`],tag:`***`,type:`text-format`},Vg={format:[`bold`,`italic`],intraword:!1,tag:`___`,type:`text-format`},Hg={format:[`bold`],tag:`**`,type:`text-format`},Ug={format:[`bold`],intraword:!1,tag:`__`,type:`text-format`},Wg={format:[`strikethrough`],tag:`~~`,type:`text-format`},Gg={format:[`italic`],tag:`*`,type:`text-format`},Kg={format:[`italic`],intraword:!1,tag:`_`,type:`text-format`},qg={dependencies:[Fl],export:(e,t,n)=>{if(!Ml(e)||jl(e))return null;let r=t(e),i=e.getTitle();return i!=null&&(i=i.replace(/([\\"])/g,`\\$1`)),i?`[${r}](${e.getURL()} "${i}")`:`[${r}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(b(e,Ml))return;let[,n,r,i]=t,a=r==null?void 0:Zh(r),o=i==null?void 0:Zh(i),s=Al(a,{title:o}),c=n.split(`[`).length-1,l=n.split(`]`).length-1,u=n,d=``;if(c<l)return;if(c>l){let e=n.split(`[`);d=`[`+e[0],u=e.slice(1).join(`[`)}let f=v(u);return f.setFormat(e.getFormat()),s.append(f),e.replace(s),d&&s.insertBefore(v(d)),f},trigger:`)`,type:`text-match`},Jg=[Mg,Ng,Fg,Lg],Yg=[Pg],Xg=[Rg,Bg,Vg,Hg,Ug,zg,Gg,Kg,Wg],Zg=[qg],Qg=[...Jg,...Yg,...Xg,...Zg];function $g(e,t,n,r,i){let a=e.getParent();if(!Ie(a)||e.getFirstChild()!==t)return!1;let o=t.getTextContent();if(!i&&o[n-1]!==` `)return!1;for(let{regExpStart:a,replace:s,regExpEnd:c}of r){if(c&&!(`optional`in c)||c&&`optional`in c&&!c.optional)continue;let r=o.match(a);if(r){let a=i||r[0].endsWith(` `)?n:n-1;if(r[0].length!==a)continue;let o=t.getNextSiblings(),[c,l]=t.splitText(n);if(!1!==s(e,l?[l,...o]:o,r,null,null,!1))return c.remove(),!0}}return!1}function e_(e,t){let n=0,r=e.getTextContent();for(let e=0;e<t;e++)r[e]==="`"&&n++;return n%2!=0}function t_(e,t,n){let r=n.length;for(let i=t;i>=r;i--){let t=i-r;if(n_(e,t,n,0,r)&&e[t+r]!==` `)return t}return-1}function n_(e,t,n,r,i){for(let a=0;a<i;a++)if(e[t+a]!==n[r+a])return!1;return!0}function r_(e,n=Qg){let r=Gh(n),i=Wh(r.textFormat,({tag:e})=>e[e.length-1]),a=Wh(r.textMatch,({trigger:e})=>e);for(let t of n){let n=t.type;if(n===`element`||n===`text-match`||n===`multiline-element`){let n=t.dependencies;for(let t of n)e.hasNode(t)||pg(173,t.getType())}}let o=(e,t,n)=>!!function(e,t,n,r){let i=e.getParent();if(!Ie(i)||e.getFirstChild()!==t)return!1;let a=t.getTextContent();if(a[n-1]!==` `)return!1;for(let{regExp:i,replace:o}of r){let r=a.match(i);if(r&&r[0].length===(r[0].endsWith(` `)?n:n-1)){let i=t.getNextSiblings(),[a,s]=t.splitText(n);if(!1!==o(e,s?[s,...i]:i,r,!1))return a.remove(),!0}}return!1}(e,t,n,r.element)||!!$g(e,t,n,r.multilineElement)||!!function(e,t,n){let r=e.getTextContent(),i=n[r[t-1]];if(i==null)return!1;t<r.length&&(r=r.slice(0,t));for(let t of i){if(!t.replace||!t.regExp)continue;let n=r.match(t.regExp);if(n===null)continue;let i=n.index||0,a=i+n[0].length,o;return i===0?[o]=e.splitText(a):[,o]=e.splitText(i,a),o.selectNext(0,0),t.replace(o,n),!0}return!1}(t,n,a)||!!function(e,t,n){let r=e.getTextContent(),i=t-1,a=r[i],o=n[a];if(!o)return!1;for(let t of o){let{tag:n}=t,o=n.length,s=i-o+1;if(o>1&&!n_(r,s,n,0,o)||r[s-1]===` `)continue;let c=r[i+1];if(!1===t.intraword&&c&&!Kh.test(c))continue;let l=e,u=l,d=t_(r,s,n),f=u;for(;d<0&&(f=f.getPreviousSibling())&&!D(f);)if(A(f)){if(f.hasFormat(`code`))continue;let e=f.getTextContent();u=f,d=t_(e,e.length,n)}if(d<0||u===l&&d+o===s)continue;let p=u.getTextContent();if(d>0&&p[d-1]===a)continue;let m=p[d-1];if(!1===t.intraword&&m&&!Kh.test(m)||!t.format.includes(`code`)&&e_(u,d))continue;let g=l.getTextContent(),_=g.slice(0,s)+g.slice(i+1);l.setTextContent(_);let v=u===l?_:p;u.setTextContent(v.slice(0,d)+v.slice(d+o));let y=w(),b=h();j(b);let ee=i-o*(u===l?2:1)+1;b.anchor.set(u.__key,d,`text`),b.focus.set(l.__key,ee,`text`);for(let e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(let e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return O(y)&&(b.format=y.format),!0}return!1}(t,n,i);return Un(e.registerUpdateListener(({tags:n,dirtyLeaves:r,editorState:i,prevEditorState:a})=>{if(n.has(ot)||n.has(Et)||e.isComposing())return;let s=i.read(w),c=a.read(w);if(!O(c)||!O(s)||!s.isCollapsed()||s.is(c))return;let l=s.anchor.key,u=s.anchor.offset,d=i._nodeMap.get(l);!A(d)||!r.has(l)||u!==1&&u>c.anchor.offset+1||e.update(()=>{if(!sg(d))return;let e=d.getParent();e===null||lm(e)||o(e,d,s.anchor.offset)&&t(Ot)})}),e.registerCommand(Ht,e=>{if(e!==null&&e.shiftKey)return!1;let t=w();if(!O(t)||!t.isCollapsed())return!1;let n=t.anchor.offset,i=t.anchor.getNode();if(!A(i)||!sg(i))return!1;let a=i.getParent();return a===null||lm(a)?!1:n===i.getTextContent().length&&!!$g(a,i,n,r.multilineElement,!0)&&(e!==null&&e.preventDefault(),!0)},P))}function i_(e,t=Qg,n,r=!1,i=!1){let a=r?e:function(e,t=!1){let n=e.split(`
|
|
44
|
+
`),r=!1,i=[];for(let e=0;e<n.length;e++){let a=n[e],o=a.trimEnd(),s=i[i.length-1];xg.test(o)?i.push(o):yg.test(o)||bg.test(o)?(r=!r,i.push(o)):r?i.push(a):o===``||s===``||!s||_g.test(s)||_g.test(o)||vg.test(o)||mg.test(o)||hg.test(o)||gg.test(o)||Sg.test(o)||Cg.test(o)||!t||wg.test(o)||Tg.test(o)||Eg(Tg).test(s)||Eg(wg).test(s)||bg.test(s)?i.push(t||o===``?o:a):i[i.length-1]=s+` `+o.trimStart()}return i.join(`
|
|
45
|
+
`)}(e,i);return lg(t,r)(a,n)}function a_(e=Qg,t,n=!1){return function(e,t=!1){let n=Gh(e),r=[...n.multilineElement,...n.element],i=!t,a=n.textFormat.filter(e=>e.format.length===1).sort((e,t)=>Number(e.format.includes(`code`))-Number(t.format.includes(`code`)));return e=>{let o=[],s=(e||ye()).getChildren();for(let e=0;e<s.length;e++){let c=s[e],l=Qh(c,r,a,n.textMatch,t);l!=null&&o.push(i&&e>0&&!Xh(c)&&!Xh(s[e-1])?`
|
|
46
|
+
${l}`:l)}return o.join(`
|
|
47
|
+
`)}}(e,n)(t)}const o_=Uh;o_.$convertFromMarkdownString,o_.$convertToMarkdownString,o_.BOLD_ITALIC_STAR,o_.BOLD_ITALIC_UNDERSCORE,o_.BOLD_STAR,o_.BOLD_UNDERSCORE,o_.CHECK_LIST,o_.CODE,o_.ELEMENT_TRANSFORMERS,o_.HEADING,o_.HIGHLIGHT,o_.INLINE_CODE,o_.ITALIC_STAR,o_.ITALIC_UNDERSCORE,o_.LINK,o_.MULTILINE_ELEMENT_TRANSFORMERS,o_.ORDERED_LIST,o_.QUOTE,o_.STRIKETHROUGH,o_.TEXT_FORMAT_TRANSFORMERS,o_.TEXT_MATCH_TRANSFORMERS;const s_=o_.TRANSFORMERS;o_.UNORDERED_LIST;const c_=o_.registerMarkdownShortcuts;var l_=lr({$computeTableMap:()=>X_,$computeTableMapSkipCellCheck:()=>Z_,$createTableCellNode:()=>m_,$createTableNode:()=>ty,$createTableNodeWithDimensions:()=>S_,$createTableRowNode:()=>v_,$createTableSelection:()=>av,$createTableSelectionFrom:()=>ov,$deleteTableColumn:()=>z_,$deleteTableColumnAtSelection:()=>H_,$deleteTableColumn__EXPERIMENTAL:()=>U_,$deleteTableRowAtSelection:()=>B_,$deleteTableRow__EXPERIMENTAL:()=>V_,$findCellNode:()=>Rv,$findTableNode:()=>zv,$getElementForTableNode:()=>$v,$getNodeTriplet:()=>Q_,$getTableAndElementByKey:()=>cv,$getTableCellNodeFromLexicalNode:()=>C_,$getTableCellNodeRect:()=>nv,$getTableColumnIndexFromTableCellNode:()=>D_,$getTableNodeFromLexicalNodeOrThrow:()=>T_,$getTableRowIndexFromTableCellNode:()=>E_,$getTableRowNodeFromTableCellNodeOrThrow:()=>w_,$insertTableColumn:()=>F_,$insertTableColumnAtSelection:()=>I_,$insertTableColumn__EXPERIMENTAL:()=>L_,$insertTableRow:()=>A_,$insertTableRowAtSelection:()=>M_,$insertTableRow__EXPERIMENTAL:()=>N_,$isScrollableTablesActive:()=>Xv,$isSimpleTable:()=>ev,$isTableCellNode:()=>G,$isTableNode:()=>ny,$isTableRowNode:()=>q,$isTableSelection:()=>J,$mergeCells:()=>K_,$moveTableColumn:()=>tv,$removeTableRowAtIndex:()=>k_,$unmergeCell:()=>J_,INSERT_TABLE_COMMAND:()=>h_,TableCellHeaderStates:()=>W,TableCellNode:()=>d_,TableExtension:()=>dy,TableNode:()=>Qv,TableObserver:()=>uv,TableRowNode:()=>g_,applyTableHandlers:()=>bv,getDOMCellFromTarget:()=>wv,getTableElement:()=>pv,getTableObserverFromTableElement:()=>Cv,registerTableCellUnmergeTransform:()=>cy,registerTablePlugin:()=>uy,registerTableSelectionObserver:()=>ly,setScrollableTablesActive:()=>Zv});const u_=/^(\d+(?:\.\d+)?)px$/,W={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};var d_=class e extends St{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return`tablecell`}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:p_,priority:0}),th:e=>({conversion:p_,priority:0})}}static importJSON(e){return m_().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=W.NO_STATUS,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),f_(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),ss(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){let t=super.exportDOM(e);if(In(t.element)){let e=t.element;e.setAttribute(`data-temporary-table-cell-lexical-key`,this.getKey()),e.style.border=`1px solid black`,this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||`top`,e.style.textAlign=`start`,this.__backgroundColor===null&&this.hasHeader()&&(e.style.backgroundColor=`#f2f3f5`)}return t}exportJSON(){return{...super.exportJSON(),...f_(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?`th`:`td`}setHeaderStyles(e,t=W.BOTH){let n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){let t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==W.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function f_(e){return e===`middle`||e===`bottom`}function p_(e){let t=e,n=e.nodeName.toLowerCase(),r;u_.test(t.style.width)&&(r=parseFloat(t.style.width));let i=W.NO_STATUS;if(n===`th`){let e=t.getAttribute(`scope`);if(e===`col`)i=W.COLUMN;else if(e===`row`)i=W.ROW;else{let e=t.parentElement,n=In(e)&&e.nodeName.toLowerCase()===`tr`&&In(e.parentElement)&&(e.parentElement.nodeName.toLowerCase()===`thead`||e.rowIndex===0),r=t.cellIndex===0;n&&(i|=W.ROW),r&&(i|=W.COLUMN),i===W.NO_STATUS&&(i=W.ROW)}}let a=m_(i,t.colSpan,r);a.__rowSpan=t.rowSpan;let o=t.style.backgroundColor;o!==``&&(a.__backgroundColor=o);let s=t.style.verticalAlign;f_(s)&&(a.__verticalAlign=s);let c=t.style,l=(c&&c.textDecoration||``).split(` `),u=c.fontWeight===`700`||c.fontWeight===`bold`,d=l.includes(`line-through`),f=c.fontStyle===`italic`,m=l.includes(`underline`),h=c.color;return{after:e=>{let t=[],n=null,r=()=>{if(n){let e=n.getFirstChild();D(e)&&n.getChildrenSize()===1&&e.remove()}};for(let i of e)if(Ae(i)||A(i)||D(i)){if(A(i)&&(u&&i.toggleFormat(`bold`),d&&i.toggleFormat(`strikethrough`),f&&i.toggleFormat(`italic`),m&&i.toggleFormat(`underline`),h)){let e=i.getStyle();e.includes(`color:`)||i.setStyle(e+`color: ${h};`)}n?n.append(i):(n=p().append(i),t.push(n))}else t.push(i),r(),n=null;return r(),t.length===0&&t.push(p()),t},node:a}}function m_(e=W.NO_STATUS,t=1,r){return n(new d_(e,t,r))}function G(e){return e instanceof d_}const h_=vn(`INSERT_TABLE_COMMAND`);function K(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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.`)}var g_=class e extends St{__height;static getType(){return`tablerow`}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:__,priority:0})}}static importJSON(e){return v_().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let t=document.createElement(`tr`);return this.__height&&(t.style.height=`${this.__height}px`),ss(t,e.theme.tableRow),t}extractWithChild(e,t,n){return n===`html`}isShadowRoot(){return!0}setHeight(e){let t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function __(e){let t=e,n;return u_.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>Jo(e,G),node:v_(n)}}function v_(e){return n(new g_(e))}function q(e){return e instanceof g_}const y_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,b_=y_&&`documentMode`in document?document.documentMode:null,x_=y_&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function S_(e,t,n=!0){let r=ty();for(let i=0;i<e;i++){let e=v_();for(let r=0;r<t;r++){let t=W.NO_STATUS;typeof n==`object`?(i===0&&n.rows&&(t|=W.ROW),r===0&&n.columns&&(t|=W.COLUMN)):n&&(i===0&&(t|=W.ROW),r===0&&(t|=W.COLUMN));let a=m_(t),o=p();o.append(v()),a.append(o),e.append(a)}r.append(e)}return r}function C_(e){let t=R(e,e=>G(e));return G(t)?t:null}function w_(e){let t=R(e,e=>q(e));if(q(t))return t;throw Error(`Expected table cell to be inside of table row.`)}function T_(e){let t=R(e,e=>ny(e));if(ny(t))return t;throw Error(`Expected table cell to be inside of table.`)}function E_(e){let t=w_(e);return T_(t).getChildren().findIndex(e=>e.is(t))}function D_(e){return w_(e).getChildren().findIndex(t=>t.is(e))}function O_(e,t){let n=T_(e),{x:r,y:i}=n.getCordsFromCellNode(e,t);return{above:n.getCellNodeFromCords(r,i-1,t),below:n.getCellNodeFromCords(r,i+1,t),left:n.getCellNodeFromCords(r-1,i,t),right:n.getCellNodeFromCords(r+1,i,t)}}function k_(e,t){let n=e.getChildren();if(t>=n.length||t<0)throw Error(`Expected table cell to be inside of table row.`);return n[t].remove(),e}function A_(e,t,n=!0,r,i){let a=e.getChildren();if(t>=a.length||t<0)throw Error(`Table row target index out of range`);let o=a[t];if(!q(o))throw Error(`Row before insertion index does not exist.`);for(let e=0;e<r;e++){let e=o.getChildren(),t=e.length,r=v_();for(let n=0;n<t;n++){let t=e[n];G(t)||K(12);let{above:a,below:o}=O_(t,i),s=W.NO_STATUS,c=a&&a.getWidth()||o&&o.getWidth()||void 0;(a&&a.hasHeaderState(W.COLUMN)||o&&o.hasHeaderState(W.COLUMN))&&(s|=W.COLUMN);let l=m_(s,1,c);l.append(p()),r.append(l)}n?o.insertAfter(r):o.insertBefore(r)}return e}y_&&`InputEvent`in window&&!b_&&new window.InputEvent(`input`);const j_=(e,t)=>e===W.BOTH||e===t?t:W.NO_STATUS;function M_(e=!0){let t=w();O(t)||J(t)||K(188);let n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Q_(n),[a,,o]=Q_(r),[,s,c]=X_(o,a,i),{startRow:l}=c,{startRow:u}=s;return e?P_(l+i.__rowSpan>u+a.__rowSpan?i:a,!0):P_(u<l?a:i,!1)}const N_=M_;function P_(e,t=!0){let[,,n]=Q_(e),[r,i]=X_(n,e,e),a=r[0].length,{startRow:o}=i,s=null;if(t){let t=o+e.__rowSpan-1,i=r[t],c=v_();for(let e=0;e<a;e++){let{cell:n,startRow:r}=i[e];if(r+n.__rowSpan-1<=t){let t=i[e].cell.__headerState,n=j_(t,W.COLUMN);c.append(m_(n).append(p()))}else n.setRowSpan(n.__rowSpan+1)}let l=n.getChildAtIndex(t);q(l)||K(256),l.insertAfter(c),s=c}else{let e=o,t=r[e],i=v_();for(let n=0;n<a;n++){let{cell:r,startRow:a}=t[n];if(a===e){let e=t[n].cell.__headerState,r=j_(e,W.COLUMN);i.append(m_(r).append(p()))}else r.setRowSpan(r.__rowSpan+1)}let c=n.getChildAtIndex(e);q(c)||K(257),c.insertBefore(i),s=i}return s}function F_(e,t,n=!0,r,i){let a=e.getChildren(),o=[];for(let e=0;e<a.length;e++){let n=a[e];if(q(n))for(let e=0;e<r;e++){let e=n.getChildren();if(t>=e.length||t<0)throw Error(`Table column target index out of range`);let r=e[t];G(r)||K(12);let{left:a,right:s}=O_(r,i),c=W.NO_STATUS;(a&&a.hasHeaderState(W.ROW)||s&&s.hasHeaderState(W.ROW))&&(c|=W.ROW);let l=m_(c);l.append(p()),o.push({newTableCell:l,targetCell:r})}}return o.forEach(({newTableCell:e,targetCell:t})=>{n?t.insertAfter(e):t.insertBefore(e)}),e}function I_(e=!0){let t=w();O(t)||J(t)||K(188);let n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Q_(n),[a,,o]=Q_(r),[,s,c]=X_(o,a,i),{startColumn:l}=c,{startColumn:u}=s;return e?R_(l+i.__colSpan>u+a.__colSpan?i:a,!0):R_(u<l?a:i,!1)}const L_=I_;function R_(e,t=!0,n=!0){let[,,r]=Q_(e),[i,a]=X_(r,e,e),o=i.length,{startColumn:s}=a,c=t?s+e.__colSpan-1:s-1,l=r.getFirstChild();q(l)||K(120);let u=null;function d(e=W.NO_STATUS){let t=m_(e).append(p());return u===null&&(u=t),t}let f=l;e:for(let e=0;e<o;e++){if(e!==0){let e=f.getNextSibling();q(e)||K(121),f=e}let t=i[e],n=t[c<0?0:c].cell.__headerState,r=j_(n,W.ROW);if(c<0){G_(f,d(r));continue}let{cell:a,startColumn:o,startRow:s}=t[c];if(o+a.__colSpan-1<=c){let n=a,i=s,o=c;for(;i!==e&&n.__rowSpan>1;){if(o-=a.__colSpan,!(o>=0)){f.append(d(r));continue e}{let{cell:e,startRow:r}=t[o];n=e,i=r}}n.insertAfter(d(r))}else a.setColSpan(a.__colSpan+1)}u!==null&&n&&W_(u);let m=r.getColWidths();if(m){let e=[...m],t=c<0?0:c,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function z_(e,t){let n=e.getChildren();for(let e=0;e<n.length;e++){let r=n[e];if(q(r)){let e=r.getChildren();if(t>=e.length||t<0)throw Error(`Table column target index out of range`);e[t].remove()}}return e}function B_(){let e=w();O(e)||J(e)||K(188);let[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=Q_(t),[a]=Q_(n),[o,s,c]=X_(i,r,a),{startRow:l}=s,{startRow:u}=c,d=u+a.__rowSpan-1;if(o.length===d-l+1)return void i.remove();let f=o[0].length,p=o[d+1],m=i.getChildAtIndex(d+1);for(let e=d;e>=l;e--){for(let t=f-1;t>=0;t--){let{cell:n,startRow:r,startColumn:i}=o[e][t];if(i===t){if(r<l||r+n.__rowSpan-1>d){let e=Math.max(r,l),t=Math.min(n.__rowSpan+r-1,d),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=l&&r+n.__rowSpan-1>d&&e===d){m===null&&K(122);let r=null;for(let n=0;n<t;n++){let t=p[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}r===null?G_(m,n):r.insertAfter(n)}}}let t=i.getChildAtIndex(e);q(t)||K(206,String(e)),t.remove()}if(p!==void 0){let{cell:e}=p[0];W_(e)}else{let{cell:e}=o[l-1][0];W_(e)}}const V_=B_;function H_(){let e=w();O(e)||J(e)||K(188);let t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=Q_(t),[a]=Q_(n),[o,s,c]=X_(i,r,a),{startColumn:l}=s,{startRow:u,startColumn:d}=c,f=Math.min(l,d),p=Math.max(l+r.__colSpan-1,d+a.__colSpan-1),m=p-f+1;if(o[0].length===p-f+1)return i.selectPrevious(),void i.remove();let h=o.length;for(let e=0;e<h;e++)for(let t=f;t<=p;t++){let{cell:n,startColumn:r}=o[e][t];if(r<f){if(t===f){let e=f-r;n.setColSpan(n.__colSpan-Math.min(m,n.__colSpan-e))}}else if(r+n.__colSpan-1>p){if(t===p){let e=p-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}let g=o[u],_=l>d?g[l+r.__colSpan]:g[d+a.__colSpan];if(_!==void 0){let{cell:e}=_;W_(e)}else{let{cell:e}=d<l?g[d-1]:g[l-1];W_(e)}let v=i.getColWidths();if(v){let e=[...v];e.splice(f,m),i.setColWidths(e)}}const U_=H_;function W_(e){let t=e.getFirstDescendant();t==null?e.selectStart():t.getParentOrThrow().selectStart()}function G_(e,t){let n=e.getFirstChild();n===null?e.append(t):n.insertBefore(t)}function K_(e){if(e.length===0)return null;let[t]=Z_(T_(e[0]),null,null),n=1/0,r=-1/0,i=1/0,a=-1/0,o=new Set;for(let s of t)for(let t of s){if(!t||!t.cell)continue;let s=t.cell.getKey();if(!o.has(s)&&e.some(e=>e.is(t.cell))){o.add(s);let e=t.startRow,c=t.startColumn,l=t.cell.__rowSpan||1,u=t.cell.__colSpan||1;n=Math.min(n,e),r=Math.max(r,e+l-1),i=Math.min(i,c),a=Math.max(a,c+u-1)}}if(n===1/0||i===1/0)return null;let s=r-n+1,c=a-i+1,l=t[n][i];if(!l.cell)return null;let u=l.cell;u.setColSpan(c),u.setRowSpan(s);let d=new Set([u.getKey()]);for(let e=n;e<=r;e++)for(let n=i;n<=a;n++){let r=t[e][n];if(!r.cell)continue;let i=r.cell,a=i.getKey();d.has(a)||(d.add(a),q_(i)||u.append(...i.getChildren()),i.remove())}return u.getChildrenSize()===0&&u.append(p()),u}function q_(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Pe(t)||!t.isEmpty())}function J_(){let e=w();O(e)||J(e)||K(188);let t=e.anchor.getNode(),n=R(t,G);return G(n)||K(148),Y_(n)}function Y_(e){let[t,n,r]=Q_(e),i=t.__colSpan,a=t.__rowSpan;if(i===1&&a===1)return;let[o,s]=X_(r,t,t),{startColumn:c,startRow:l}=s,u=t.__headerState&W.COLUMN,d=Array.from({length:i},(e,t)=>{let n=u;for(let e=0;n!==0&&e<o.length;e++)n&=o[e][t+c].cell.__headerState;return n}),f=t.__headerState&W.ROW,m=Array.from({length:a},(e,t)=>{let n=f;for(let e=0;n!==0&&e<o[0].length;e++)n&=o[t+l][e].cell.__headerState;return n});if(i>1){for(let e=1;e<i;e++)t.insertAfter(m_(d[e]|m[0]).append(p()));t.setColSpan(1)}if(a>1){let e;for(let t=1;t<a;t++){let r=l+t,a=o[r];e=(e||n).getNextSibling(),q(e)||K(125);let s=null;for(let e=0;e<c;e++){let t=a[e],n=t.cell;t.startRow===r&&(s=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(s===null)for(let n=i-1;n>=0;n--)G_(e,m_(d[n]|m[t]).append(p()));else for(let e=i-1;e>=0;e--)s.insertAfter(m_(d[e]|m[t]).append(p()))}t.setRowSpan(1)}}function X_(e,t,n){let[r,i,a]=Z_(e,t,n);return i===null&&K(207),a===null&&K(208),[r,i,a]}function Z_(e,t,n){let r=[],i=null,a=null;function o(e){let t=r[e];return t===void 0&&(r[e]=t=[]),t}let s=e.getChildren();for(let e=0;e<s.length;e++){let r=s[e];q(r)||K(209);let c=o(e);for(let l=r.getFirstChild(),u=0;l!=null;l=l.getNextSibling()){for(G(l)||K(147);c[u]!==void 0;)u++;let r={cell:l,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:f}=l;for(let t=0;t<d&&!(e+t>=s.length);t++){let n=o(e+t);for(let e=0;e<f;e++)n[u+e]=r}t!==null&&i===null&&t.is(l)&&(i=r),n!==null&&a===null&&n.is(l)&&(a=r)}}return[r,i,a]}function Q_(e){let t;if(e instanceof d_)t=e;else if(`__type`in e){let n=R(e,G);G(n)||K(148),t=n}else{let n=R(e.getNode(),G);G(n)||K(148),t=n}let n=t.getParent();q(n)||K(149);let r=n.getParent();return ny(r)||K(210),[t,n,r]}function $_(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),a=Math.min(t.startRow,n.startRow),o=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),s=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){let c=e[t][n];if(!c)continue;let l=c.startColumn+c.cell.__colSpan-1,u=c.startRow+c.cell.__rowSpan-1,d=c.startColumn<=o&&l>=i,f=c.startRow<=s&&u>=a;if(d&&f){let e=Math.min(i,c.startColumn),t=Math.max(o,l),n=Math.min(a,c.startRow),d=Math.max(s,u);e===i&&t===o&&n===a&&d===s||(i=e,o=t,a=n,s=d,r=!0)}}}while(r);return{maxColumn:o,maxRow:s,minColumn:i,minRow:a}}function ev(e){let t=e.getChildren(),n=null;for(let e of t){if(!q(e)||(n===null&&(n=e.getChildrenSize()),e.getChildrenSize()!==n))return!1;let t=e.getChildren();for(let e of t)if(!G(e)||e.getRowSpan()!==1||e.getColSpan()!==1)return!1}return(n||0)>0}function tv(e,t,n){if(t===n)return;let r=e.getColumnCount();if(t<0||t>=r||n<0||n>=r||!ev(e))return;e.getChildren().filter(q).forEach(e=>{let r=e.getChildren(),[i]=r.splice(t,1);r.splice(n,0,i),e.splice(0,r.length,r)});let i=e.getColWidths();if(i&&i.length===r){let r=[...i],[a]=r.splice(t,1);r.splice(n,0,a),e.setColWidths(r)}}function nv(e){let[t,,n]=Q_(e),r=n.getChildren(),i=r.length,a=r[0].getChildren().length,o=Array(i);for(let e=0;e<i;e++)o[e]=Array(a);for(let e=0;e<i;e++){let n=r[e].getChildren(),i=0;for(let r=0;r<n.length;r++){for(;o[e][i];)i++;let a=n[r],s=a.__rowSpan||1,c=a.__colSpan||1;for(let t=0;t<s;t++)for(let n=0;n<c;n++)o[e+t][i+n]=a;if(t===a)return{colSpan:c,columnIndex:i,rowIndex:e,rowSpan:s};i+=c}}return null}function rv(e){let[[t,n,r,i],[a,o,s,c]]=[`anchor`,`focus`].map(t=>{let n=e[t].getNode(),r=R(n,G);G(r)||K(238,t,n.getKey(),n.getType());let i=r.getParent();q(i)||K(239,t);let a=i.getParent();return ny(a)||K(240,t),[n,r,i,a]});return i.is(c)||K(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:o,focusNode:a,focusRow:s,focusTable:c}}var iv=class e{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey===`root`||this.anchor.key===`root`||this.anchor.type!==`element`||this.focus.key===`root`||this.focus.type!==`element`)return!1;let e=C(this.tableKey),t=C(this.anchor.key),n=C(this.focus.key);return e!==null&&t!==null&&n!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return J(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new e(this.tableKey,m(this.anchor.key,this.anchor.offset,this.anchor.type),m(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(G).forEach(e=>{let n=e.getFirstChild();Pe(n)&&(t|=n.getTextFormat())});let n=ln[e];return(t&n)!==0}insertNodes(e){let t=this.focus.getNode();E(t)||K(151),Ve(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:t}=rv(this),n=nv(e);n===null&&K(153);let r=nv(t);r===null&&K(155);let i=Math.min(n.columnIndex,r.columnIndex),a=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),o=Math.min(n.rowIndex,r.rowIndex),s=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,a),fromY:Math.min(o,s),toX:Math.max(i,a),toY:Math.max(o,s)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:t,anchorCell:n,focusCell:r}=rv(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){let e=i.getParent();e??K(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{let e=t.getParent();e??K(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}let[a,o,s]=X_(t,n,r),{minColumn:c,maxColumn:l,minRow:u,maxRow:d}=$_(a,o,s),f=new Map([[t.getKey(),t]]),p=null;for(let e=u;e<=d;e++)for(let t=c;t<=l;t++){let{cell:n}=a[e][t],r=n.getParent();q(r)||K(160),r!==p&&(f.set(r.getKey(),r),p=r),f.has(n.getKey())||sv(n,e=>{f.set(e.getKey(),e)})}let m=Array.from(f.values());return jn()||(this._cachedNodes=m),m}getTextContent(){let e=this.getNodes().filter(e=>G(e)),t=``;for(let n=0;n<e.length;n++){let r=e[n],i=r.__parent,a=(e[n+1]||{}).__parent;t+=r.getTextContent()+(a===i?` `:`
|
|
48
|
+
`)}return t}};function J(e){return e instanceof iv}function av(){return new iv(`root`,m(`root`,0,`element`),m(`root`,0,`element`))}function ov(e,t,n){e.getKey(),t.getKey(),n.getKey();let r=w(),i=J(r)?r.clone():av();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function sv(e,t){let n=[[e]];for(let e=n.at(-1);e!==void 0&&n.length>0;e=n.at(-1)){let r=e.pop();r===void 0?n.pop():!1!==t(r)&&E(r)&&n.push(r.getChildren())}}function cv(e,t=pe()){let n=C(e);ny(n)||K(231,e);let r=pv(n,t.getElementByKey(e));return r===null&&K(232,e),{tableElement:r,tableNode:n}}var lv=class{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){let{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}},uv=class{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort(`removeListeners`),Array.from(this.listenersToRemove).forEach(e=>e()),this.listenersToRemove.clear()}$lookup(){return cv(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver(e=>{this.editor.getEditorState().read(()=>{let t=!1;for(let n=0;n<e.length;n++){let r=e[n].target.nodeName;if(r===`TABLE`||r===`TBODY`||r===`THEAD`||r===`TR`){t=!0;break}}if(!t)return;let{tableNode:n,tableElement:r}=this.$lookup();this.table=Ev(n,r)},{editor:this.editor})});this.editor.getEditorState().read(()=>{let{tableNode:t,tableElement:n}=this.$lookup();this.table=Ev(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})},{editor:this.editor})}$clearHighlight(e=!0){let t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:n,tableElement:r}=this.$lookup();Dv(t,Ev(n,r),null),e&&w()!==null&&(j(null),t.dispatchCommand(nn,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:t}=this.$lookup();ps(t,e._config.theme.tableSelection),t.classList.remove(`disable-selection`),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();ss(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&K(233,e.tableKey,this.tableNodeKey);let t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Dv(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=Cn(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){let n=this.editor,{tableNode:r}=this.$lookup(),i=e.x,a=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(t||this.anchorX!==i||this.anchorY!==a||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&i===this.focusX&&a===this.focusY)return!1;if(this.focusX=i,this.focusY=a,this.isHighlightingCells){let o=Kv(r,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let e=o;if(e===null&&t&&(e=r.getCellNodeFromCords(i,a,this.table)),e!==null){let t=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=ov(r,t,e),j(this.tableSelection),n.dispatchCommand(nn,void 0),Dv(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?C(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&K(234),e}$getFocusTableCell(){return this.focusCellNodeKey?C(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&K(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;let{tableNode:t}=this.$lookup(),n=Kv(t,e.elem);if(n!==null){let e=n.getKey();this.tableSelection==null?this.tableSelection=ov(t,n,n):(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)),this.anchorCellNodeKey=e}}$formatCells(e){let t=w();J(t)||K(236);let n=h(),r=n.anchor,i=n.focus,a=t.getNodes().filter(G);a.length>0||K(237);let o=a[0].getFirstChild(),s=Pe(o)?o.getFormatFlags(e,null):null;a.forEach(t=>{r.set(t.getKey(),0,`element`),i.set(t.getKey(),t.getChildrenSize(),`element`),n.formatText(e,s)}),j(t),this.editor.dispatchCommand(nn,void 0)}$clearText(){let{editor:e}=this,t=C(this.tableNodeKey);if(!ny(t))throw Error(`Expected TableNode.`);let n=w();J(n)||K(253);let r=n.getNodes().filter(G),i=t.getFirstChild(),a=t.getLastChild();if(r.length>0&&i!==null&&a!==null&&q(i)&&q(a)&&r[0]===i.getFirstChild()&&r[r.length-1]===a.getLastChild()){t.selectPrevious();let n=t.getParent();t.remove(),Fe(n)&&n.isEmpty()&&e.dispatchCommand(Mt,void 0);return}r.forEach(e=>{if(E(e)){let t=p(),n=v();t.append(n),e.append(t),e.getChildren().forEach(e=>{e!==t&&e.remove()})}}),Dv(e,this.table,null),j(null),e.dispatchCommand(nn,void 0)}};const dv=`__lexicalTableSelection`;function fv(e){return In(e)&&e.nodeName===`TABLE`}function pv(e,t){if(!t)return t;let n=fv(t)?t:t.querySelector(`table`);return fv(n)||K(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function mv(e){return e._window}function hv(e,t){for(let n=t,r=null;n!==null;n=n.getParent()){if(e.is(n))return r;G(n)&&(r=n)}return null}const gv=[[Ft,`down`],[Rt,`up`],[It,`backward`],[Lt,`forward`]],_v=[_t,gt,ht],vv=[zt,Bt];function yv(e,t){let n=e.getRootElement(),r=e._window;if(!n||!r)return()=>{};let i=r=>{let i=r.target;if(r.button!==0||!Nn(i)||!n.contains(i))return;let a=function(e){let t=wv(e);if(t===null)return null;let n=t.elem;for(;n!=null;){if(n.nodeName===`TABLE`&&dv in n&&n[dv])return{cellElement:t,tableElement:n,tableObserver:n[dv]};n=n.parentNode}return null}(i);e.update(()=>{if(J(w())){for(let[e]of t.observers.values())e.$clearHighlight(!1);j(null),e.dispatchCommand(nn,void 0)}if(!a)return;let{tableObserver:n,tableElement:i,cellElement:o}=a;(function(e,t,n,r,i,a){let o=e._window;if(!o)return;let s=t=>{if(i.isSelecting)return;i.isSelecting=!0,t!==null&&i.anchorCell===null&&e.update(()=>{i.$setAnchorCellForSelection(t)});let n=()=>{i.isSelecting=!1,o.removeEventListener(`pointerup`,n),o.removeEventListener(`pointermove`,s)},s=t=>{if(!(e=>!(1&~e.buttons))(t)&&i.isSelecting)return i.isSelecting=!1,o.removeEventListener(`pointerup`,n),void o.removeEventListener(`pointermove`,s);if(!Nn(t.target))return;let c=null,l=!(x_||r.contains(t.target));if(l)c=Tv(r,t.target);else for(let e of document.elementsFromPoint(t.clientX,t.clientY))if(c=Tv(r,e),c)break;if(c){let t=c;i.anchorCell===null&&e.update(()=>{i.$setAnchorCellForSelection(t)}),i.focusCell!==null&&c.elem===i.focusCell.elem||(a.setNextFocus({focusCell:c,override:l,tableKey:i.tableNodeKey}),e.dispatchCommand(nn,void 0))}};o.addEventListener(`pointerup`,n,i.listenerOptions),o.addEventListener(`pointermove`,s,i.listenerOptions)};i.pointerType=t.pointerType;let c=ge(i.tableNodeKey),l=ve();if(x_&&t.shiftKey&&Pv(l,c)&&(O(l)||J(l))){let e=l.anchor.getNode(),r=hv(c,l.anchor.getNode());r?(i.$setAnchorCellForSelection(Gv(i,r)),i.$setFocusCellForSelection(n),Hv(t)):(c.isBefore(e)?c.selectStart():c.selectEnd()).anchor.set(l.anchor.key,l.anchor.offset,l.anchor.type)}else t.pointerType!==`touch`&&i.$setAnchorCellForSelection(n);s(n)})(e,r,o,i,n,t)})};return r.addEventListener(`pointerdown`,i),()=>{r.removeEventListener(`pointerdown`,i)}}function bv(e,t,n,r,i){let a=n.getRootElement(),o=mv(n);a!==null&&o!==null||K(246);let s=new uv(n,e.getKey()),c=pv(e,t);(function(e,t){Cv(e)!==null&&K(205),e[dv]=t})(c,s),s.listenersToRemove.add(()=>function(e,t){Cv(e)===t&&delete e[dv]}(c,s));let l=e=>{e.detail>=3&&Nn(e.target)&&wv(e.target)!==null&&e.preventDefault()};c.addEventListener(`mousedown`,l,s.listenerOptions),s.listenersToRemove.add(()=>{c.removeEventListener(`mousedown`,l)});for(let[t,r]of gv)s.listenersToRemove.add(n.registerCommand(t,t=>Vv(n,t,r,e,s,i),N));s.listenersToRemove.add(n.registerCommand(Ut,t=>{let n=w();if(J(n)){let r=hv(e,n.focus.getNode());if(r!==null)return Hv(t),r.selectEnd(),!0}return!1},N));let u=t=>()=>{let n=w();if(!Pv(n,e))return!1;if(J(n))return s.$clearText(),!0;if(O(n)){if(!G(hv(e,n.anchor.getNode())))return!1;let r=n.anchor.getNode(),i=n.focus.getNode(),a=e.isParentOf(r),o=e.isParentOf(i);if(a&&!o||o&&!a)return s.$clearText(),!0;let c=R(n.anchor.getNode(),e=>E(e)),l=c&&R(c,e=>E(e)&&G(e.getParent()));if(!E(l)||!E(c))return!1;if(t===gt&&l.getPreviousSibling()===null)return!0}return!1};for(let e of _v)s.listenersToRemove.add(n.registerCommand(e,u(e),N));let d=t=>{let n=w();if(!J(n)&&!O(n))return!1;let r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){let t=r?`anchor`:`focus`,i=r?`focus`:`anchor`,{key:a,offset:o,type:s}=n[i];return e[n[t].isBefore(n[i])?`selectPrevious`:`selectNext`]()[i].set(a,o,s),!1}return!!Pv(n,e)&&!!J(n)&&(t&&(t.preventDefault(),t.stopPropagation()),s.$clearText(),!0)};for(let e of vv)s.listenersToRemove.add(n.registerCommand(e,d,N));return s.listenersToRemove.add(n.registerCommand(pt,e=>{let t=w();if(t){if(!J(t)&&!O(t))return!1;ff(n,fs(e,ClipboardEvent)?e:null,af(t));let r=d(e);return O(t)?(t.removeText(),!0):r}return!1},N)),s.listenersToRemove.add(n.registerCommand(Tt,t=>{let n=w();return Pv(n,e)?J(n)?(s.$formatCells(t),!0):(O(n)&&G(R(n.anchor.getNode(),e=>G(e))),!1):!1},N)),s.listenersToRemove.add(n.registerCommand(wt,t=>{let n=w();if(!J(n)||!Pv(n,e))return!1;let r=n.anchor.getNode(),i=n.focus.getNode();if(!G(r)||!G(i))return!1;if(function(e,t){if(J(e)){let n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){let[e]=X_(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;let[a,o,s]=X_(e,r,i),c=Math.max(o.startRow+o.cell.__rowSpan-1,s.startRow+s.cell.__rowSpan-1),l=Math.max(o.startColumn+o.cell.__colSpan-1,s.startColumn+s.cell.__colSpan-1),u=Math.min(o.startRow,s.startRow),d=Math.min(o.startColumn,s.startColumn),f=new Set;for(let e=u;e<=c;e++)for(let n=d;n<=l;n++){let r=a[e][n].cell;if(f.has(r))continue;f.add(r),r.setFormat(t);let i=r.getChildren();for(let e=0;e<i.length;e++){let n=i[e];E(n)&&!n.isInline()&&n.setFormat(t)}}return!0},N)),s.listenersToRemove.add(n.registerCommand(dt,t=>{let r=w();if(!Pv(r,e))return!1;if(J(r))return s.$clearHighlight(),!1;if(O(r)){if(!G(R(r.anchor.getNode(),e=>G(e))))return!1;if(typeof t==`string`){let i=Wv(n,r,e);if(i)return Uv(i,e,[v(t)]),!0}}return!1},N)),r&&s.listenersToRemove.add(n.registerCommand(Gt,t=>{let n=w();if(!O(n)||!n.isCollapsed()||!Pv(n,e))return!1;let r=Rv(n.anchor.getNode());return!(r===null||!e.is(zv(r)))&&(Hv(t),function(e,t){let n=t===`next`?`getNextSibling`:`getPreviousSibling`,r=t===`next`?`getFirstChild`:`getLastChild`,i=e[n]();if(E(i))return i.selectEnd();let a=R(e,q);a===null&&K(247);for(let e=a[n]();q(e);e=e[n]()){let t=e[r]();if(E(t))return t.selectEnd()}let o=R(a,ny);o===null&&K(248),t===`next`?o.selectNext():o.selectPrevious()}(r,t.shiftKey?`previous`:`next`),!0)},N)),s.listenersToRemove.add(n.registerCommand(Ct,t=>e.isSelected(),N)),s.listenersToRemove.add(n.registerCommand(Mt,()=>{let t=w();if(!O(t)||!t.isCollapsed()||!Pv(t,e))return!1;let r=Wv(n,t,e);return!!r&&(Uv(r,e),!0)},N)),s}function xv(e,t){let n=w(),r=ve(),i=e.getAndClearNextFocus();if(i!==null){let{tableKey:t,focusCell:r}=i,a=e.observers.get(t);a||K(335,t);let[o]=a;if(J(n)&&n.tableKey===o.tableNodeKey)return(r.x!==o.focusX||r.y!==o.focusY)&&(o.$setFocusCellForSelection(r),!0);if(o.anchorCell!==null&&o.anchorCellNodeKey!==null&&r.elem!==o.anchorCell.elem&&o.tableSelection!==null)return o.$setFocusCellForSelection(r,!0),!0}let a=e.getAndClearShouldCheckSelectionForTable();if(a&&O(r)&&O(n)&&n.isCollapsed()){let e=ge(a),t=n.anchor.getNode(),r=e.getFirstChild(),i=Rv(t);if(i!==null&&q(r)){let t=r.getFirstChild();if(G(t)&&e.is(R(i,n=>n.is(e)||n.is(t))))return t.selectStart(),!0}}J(n)&&function(e,t){let n=mv(e),r=ve();if(!t.is(r))return;let i=ge(t.tableKey),a=Cn(n);if(a&&a.anchorNode&&a.focusNode){let n=me(a.focusNode),r=n&&!i.isParentOf(n),o=me(a.anchorNode),s=o&&i.isParentOf(o);if(r&&s&&a.rangeCount>0){let n=g(a,e);n&&(n.anchor.set(i.getKey(),t.isBackward()?i.getChildrenSize():0,`element`),a.removeAllRanges(),j(n))}}}(t,n),O(n)&&function(e,t){let n=ve(),{anchor:r,focus:i}=e,a=r.getNode(),o=i.getNode(),s=Rv(a),c=Rv(o),l=s?zv(s):null,u=c?zv(c):null,d=e.isBackward(),f=s&&c&&l&&u&&l.is(u),p=u&&(!l||l.isParentOf(u)),m=l&&(!u||u.isParentOf(l));if(p){let t=e.clone(),[n]=X_(u,c,c),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.focus.set(d?r.getKey():i.getKey(),d?0:i.getChildrenSize(),`element`),j(t)}else if(m){let t=e.clone(),[n]=X_(l,s,s),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.anchor.set(d?i.getKey():r.getKey(),d?i.getChildrenSize():0,`element`),j(t)}else if(f){let r=t.observers.get(l.getKey());r||K(335,l.getKey());let[i]=r;if(s.is(c)||(i.$setAnchorCellForSelection(Gv(i,s)),i.$setFocusCellForSelection(Gv(i,c),!0)),i.pointerType===`touch`&&i.isSelecting&&e.isCollapsed()&&O(n)&&n.isCollapsed()){let e=Rv(n.anchor.getNode());e&&!e.is(c)&&(i.$setAnchorCellForSelection(Gv(i,e)),i.$setFocusCellForSelection(Gv(i,c),!0),i.pointerType=null)}}}(n,e);let o=Array.from(e.observers.entries()).map(([e,[t]])=>({tableNode:ge(e),tableObserver:t}));for(let{tableNode:e,tableObserver:n}of o)Sv(t,e,n);return!1}function Sv(e,t,n){let r=w(),i=ve();r&&!r.is(i)&&(J(r)||J(i))&&n.tableSelection&&!n.tableSelection.is(i)&&(J(r)&&r.tableKey===n.tableNodeKey?n.$updateTableTableSelection(r):!J(r)&&J(i)&&i.tableKey===n.tableNodeKey&&n.$updateTableTableSelection(null)),n.hasHijackedSelectionStyles&&!t.isSelected()?function(e,t){t.$enableHighlightStyle(),Ov(t.table,t=>{let n=t.elem;t.highlighted=!1,Lv(e,t),n.getAttribute(`style`)||n.removeAttribute(`style`)})}(e,n):!n.hasHijackedSelectionStyles&&t.isSelected()&&function(e,t){t.$disableHighlightStyle(),Ov(t.table,t=>{t.highlighted=!0,Iv(e,t)})}(e,n)}function Cv(e){return e[dv]||null}function wv(e){let t=e;for(;t!=null;){let e=t.nodeName;if(e===`TD`||e===`TH`){let e=t._cell;return e===void 0?null:e}t=t.parentNode}return null}function Tv(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;r!=null;r=r.parentNode){if(r===e)return n;let t=r.nodeName;t!==`TD`&&t!==`TH`||(n=r._cell||null)}return null}function Ev(e,t){let n=[],r={columns:0,domRows:n,rows:0},i=pv(e,t).querySelector(`tr`),a=0,o=0;for(n.length=0;i!=null;){let e=i.nodeName;if(e===`TD`||e===`TH`){let e={elem:i,hasBackgroundColor:i.style.backgroundColor!==``,highlighted:!1,x:a,y:o};i._cell=e;let t=n[o];t===void 0&&(t=n[o]=[]),t[a]=e}else{let e=i.firstChild;if(e!=null){i=e;continue}}let t=i.nextSibling;if(t!=null){a++,i=t;continue}let r=i.parentNode;if(r!=null){let e=r.nextSibling;if(e==null)break;o++,a=0,i=e}}return r.columns=a+1,r.rows=o+1,r}function Dv(e,t,n){let r=new Set(n?n.getNodes():[]);Ov(t,(t,n)=>{let i=t.elem;r.has(n)?(t.highlighted=!0,Iv(e,t)):(t.highlighted=!1,Lv(e,t),i.getAttribute(`style`)||i.removeAttribute(`style`))})}function Ov(e,t){let{domRows:n}=e;for(let e=0;e<n.length;e++){let r=n[e];if(r)for(let n=0;n<r.length;n++){let i=r[n];if(!i)continue;let a=me(i.elem);a!==null&&t(i,a,{x:n,y:e})}}}const kv=(e,t,n,r,i)=>{let a=i===`forward`;switch(i){case`backward`:case`forward`:return n===(a?e.table.columns-1:0)?r===(a?e.table.rows-1:0)?a?t.selectNext():t.selectPrevious():Fv(t.getCellNodeFromCordsOrThrow(a?0:e.table.columns-1,r+(a?1:-1),e.table),a):Fv(t.getCellNodeFromCordsOrThrow(n+(a?1:-1),r,e.table),a),!0;case`up`:return r===0?t.selectPrevious():Fv(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1),!0;case`down`:return r===e.table.rows-1?t.selectNext():Fv(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0),!0;default:return!1}};function Av(e,t){let n,r;if(t.startColumn===e.minColumn)n=`minColumn`;else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n=`maxColumn`}if(t.startRow===e.minRow)r=`minRow`;else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r=`maxRow`}return[n,r]}function jv([e,t]){return[e===`minColumn`?`maxColumn`:`minColumn`,t===`minRow`?`maxRow`:`minRow`]}function Mv(e,t,[n,r]){let i=t[r],a=e[i];a===void 0&&K(250,r,String(i));let o=t[n],s=a[o];return s===void 0&&K(250,n,String(o)),s}function Nv(e,t,n,r,i){let a=$_(t,n,r),{topSpan:o,leftSpan:s,bottomSpan:c,rightSpan:l}=function(e,t){let{minColumn:n,maxColumn:r,minRow:i,maxRow:a}=t,o=1,s=1,c=1,l=1,u=e[i],d=e[a];for(let e=n;e<=r;e++)o=Math.max(o,u[e].cell.__rowSpan),l=Math.max(l,d[e].cell.__rowSpan);for(let t=i;t<=a;t++)s=Math.max(s,e[t][n].cell.__colSpan),c=Math.max(c,e[t][r].cell.__colSpan);return{bottomSpan:l,leftSpan:s,rightSpan:c,topSpan:o}}(t,a),[u,d]=jv(function(e,t){let n=Av(e,t);return n===null&&K(249,t.cell.getKey()),n}(a,n)),f=a[u],p=a[d];i===`forward`?f+=u===`maxColumn`?1:s:i===`backward`?f-=u===`minColumn`?1:l:i===`down`?p+=d===`maxRow`?1:o:i===`up`&&(p-=d===`minRow`?1:c);let m=t[p];if(m===void 0)return!1;let h=m[f];if(h===void 0)return!1;let[g,_]=function(e,t,n){let r=$_(e,t,n),i=Av(r,t);if(i)return[Mv(e,r,i),Mv(e,r,jv(i))];let a=Av(r,n);if(a)return[Mv(e,r,jv(a)),Mv(e,r,a)];let o=[`minColumn`,`minRow`];return[Mv(e,r,o),Mv(e,r,jv(o))]}(t,n,h),v=Gv(e,g.cell),y=Gv(e,_.cell);return e.$setAnchorCellForSelection(v),e.$setFocusCellForSelection(y,!0),!0}function Pv(e,t){if(O(e)||J(e)){let n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function Fv(e,t){t?e.selectStart():e.selectEnd()}function Iv(e,t){let n=t.elem,r=e._config.theme;G(me(n))||K(131),ss(n,r.tableCellSelected)}function Lv(e,t){let n=t.elem;G(me(n))||K(131);let r=e._config.theme;ps(n,r.tableCellSelected)}function Rv(e){let t=R(e,G);return G(t)?t:null}function zv(e){let t=R(e,ny);return ny(t)?t:null}function Bv(e,t,n,i,a,o,s){let c=r(n.focus,a?`previous`:`next`);if(ke(c))return!1;let l=c;for(let e of y(c).iterNodeCarets(`shadowRoot`)){if(!Le(e)||!E(e.origin))return!1;l=e}let u=l.getParentAtCaret();if(!G(u))return!1;let d=u,f=function(e){for(let t of y(e).iterNodeCarets(`root`)){let{origin:n}=t;if(G(n)){if(Ee(t))return ce(n,e.direction)}else if(!q(n))break}return null}(be(d,l.direction)),p=R(d,ny);if(!p||!p.is(o))return!1;let m=e.getElementByKey(d.getKey()),h=wv(m);if(!m||!h)return!1;if(s.table=$v(e,p),f)if(i===`extend`){let t=wv(e.getElementByKey(f.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(t,!0)}else{let e=Be(f);Je(n.anchor,e),Je(n.focus,e)}else if(i===`extend`)s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{let e=function(e){let t=x(e);return Ee(t)?Be(t):e}(be(p,c.direction));Je(n.anchor,e),Je(n.focus,e)}return Hv(t),!0}function Vv(e,t,n,r,i,a){if((n===`up`||n===`down`)&&function(e){let t=e.getRootElement();return t?t.hasAttribute(`aria-controls`)&&t.getAttribute(`aria-controls`)===`typeahead-menu`:!1}(e))return!1;let o=w();if(!Pv(o,r)){if(O(o)){if(n===`backward`){if(o.focus.offset>0)return!1;let e=function(e){for(let t=e,n=e;n!==null;t=n,n=n.getParent())if(E(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(o.focus.getNode());if(!e)return!1;let n=e.getPreviousSibling();return!!ny(n)&&(Hv(t),t.shiftKey?o.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),`element`):n.selectEnd(),!0)}if(t.shiftKey&&(n===`up`||n===`down`)){let e=o.focus.getNode();if(!o.isCollapsed()&&(n===`up`&&!o.isBackward()||n===`down`&&o.isBackward())){let i=R(e,e=>ny(e));if(G(i)&&(i=R(i,ny)),i!==r||!i)return!1;let a=n===`down`?i.getNextSibling():i.getPreviousSibling();if(!a)return!1;let s=0;n===`up`&&E(a)&&(s=a.getChildrenSize());let c=a;n===`up`&&E(a)&&(c=a.getLastChild()||a,s=A(c)?c.getTextContentSize():0);let l=o.clone();return l.focus.set(c.getKey(),s,A(c)?`text`:`element`),j(l),Hv(t),!0}if(Ie(e)){let e=n===`up`?o.getNodes()[o.getNodes().length-1]:o.getNodes()[0];if(e&&hv(r,e)!==null){let e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;let[n]=Q_(e),[a]=Q_(t),o=r.getCordsFromCellNode(n,i.table),s=r.getCordsFromCellNode(a,i.table),c=r.getDOMCellFromCordsOrThrow(o.x,o.y,i.table),l=r.getDOMCellFromCordsOrThrow(s.x,s.y,i.table);return i.$setAnchorCellForSelection(c),i.$setFocusCellForSelection(l,!0),!0}return!1}{let r=R(e,e=>E(e)&&!e.isInline());if(G(r)&&(r=R(r,ny)),!r)return!1;let a=n===`down`?r.getNextSibling():r.getPreviousSibling();if(ny(a)&&i.tableNodeKey===a.getKey()){let e=a.getFirstDescendant(),r=a.getLastDescendant();if(!e||!r)return!1;let[i]=Q_(e),[s]=Q_(r),c=o.clone();return c.focus.set((n===`up`?i:s).getKey(),n===`up`?0:s.getChildrenSize(),`element`),Hv(t),j(c),!0}}}}return n===`down`&&Xv(e)&&a.setShouldCheckSelectionForTable(r.getKey()),!1}if(O(o)){if(n===`backward`||n===`forward`)return Bv(e,t,o,t.shiftKey?`extend`:`move`,n===`backward`,r,i);if(o.isCollapsed()){let{anchor:s,focus:c}=o,l=R(s.getNode(),G),u=R(c.getNode(),G);if(!G(l)||!l.is(u))return!1;let d=zv(l);if(d!==r&&d!=null){let r=pv(d,e.getElementByKey(d.getKey()));if(r!=null)return i.table=Ev(d,r),Vv(e,t,n,d,i,a)}let f=e.getElementByKey(l.__key),p=e.getElementByKey(s.key);if(p==null||f==null)return!1;let m;if(s.type===`element`)m=p.getBoundingClientRect();else{let t=Cn(mv(e));if(t===null||t.rangeCount===0)return!1;m=t.getRangeAt(0).getBoundingClientRect()}let h=n===`up`?l.getFirstChild():l.getLastChild();if(h==null)return!1;let g=e.getElementByKey(h.__key);if(g==null)return!1;let _=g.getBoundingClientRect();if(n===`up`?_.top>m.top-m.height:m.bottom+m.height>_.bottom){Hv(t);let e=r.getCordsFromCellNode(l,i.table);if(!t.shiftKey)return kv(i,r,e.x,e.y,n);{let t=r.getDOMCellFromCordsOrThrow(e.x,e.y,i.table);i.$setAnchorCellForSelection(t),i.$setFocusCellForSelection(t,!0)}return!0}}}else if(J(o)){let{anchor:a,focus:s}=o,c=R(a.getNode(),G),l=R(s.getNode(),G),[u]=o.getNodes();ny(u)||K(251);let d=pv(u,e.getElementByKey(u.getKey()));if(!G(c)||!G(l)||!ny(u)||d==null)return!1;i.$updateTableTableSelection(o);let f=Ev(u,d),p=r.getCordsFromCellNode(c,f),m=r.getDOMCellFromCordsOrThrow(p.x,p.y,f);if(i.$setAnchorCellForSelection(m),Hv(t),t.shiftKey){let[e,t,a]=X_(r,c,l);return Nv(i,e,t,a,n)}return l.selectEnd(),!0}return!1}function Hv(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function Uv(e,t,n){let r=p();e===`first`?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function Wv(e,t,n){let r=n.getParent();if(!r)return;let i=Cn(mv(e));if(!i)return;let a=i.anchorNode,o=e.getElementByKey(r.getKey()),s=pv(n,e.getElementByKey(n.getKey()));if(!a||!o||!s||!o.contains(a)||s.contains(a))return;let c=R(t.anchor.getNode(),e=>G(e));if(!c)return;let l=R(c,e=>ny(e));if(!ny(l)||!l.is(n))return;let[u,d]=X_(n,c,c),f=u[0][0],p=u[u.length-1][u[0].length-1],{startRow:m,startColumn:h}=d,g=m===f.startRow&&h===f.startColumn,_=m===p.startRow&&h===p.startColumn;return g?`first`:_?`last`:void 0}function Gv(e,t){let{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function Kv(e,t,n){return hv(e,me(t,n))}function qv(e,t,n){let r=e.querySelector(`colgroup`);if(!r)return;let i=[];for(let e=0;e<t;e++){let t=document.createElement(`col`),r=n&&n[e];r&&(t.style.width=`${r}px`),i.push(t)}r.replaceChildren(...i)}function Jv(e,t,n){if(!t.theme.tableAlignment)return;let r=[],i=[];for(let e of[`center`,`right`]){let a=t.theme.tableAlignment[e];a&&(e===n?i:r).push(a)}ps(e,...r),ss(e,...i)}const Yv=new WeakSet;function Xv(e=pe()){return Yv.has(e)}function Zv(e,t){t?Yv.add(e):Yv.delete(e)}var Qv=class e extends St{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return`table`}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let t=this.getWritable();return t.__colWidths=e,t}static clone(t){return new e(t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:ey,priority:1})}}static importJSON(e){return ty().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return n===`html`}getDOMSlot(e){let t=fv(e)?e:e.querySelector(`table`);return fv(t)||K(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(`colgroup`))}createDOM(e,t){let n=document.createElement(`table`);this.__style&&Xn(n.style,this.__style);let r=document.createElement(`colgroup`);if(n.appendChild(r),Zn(r),ss(n,e.theme.table),this.updateTableElement(null,n,e),Xv(t)){let t=document.createElement(`div`),r=e.theme.tableScrollableWrapper;return r?ss(t,r):t.style.overflowX=`auto`,t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(ss(e,n.theme.tableFrozenColumn),t.setAttribute(`data-lexical-frozen-column`,`true`)):(ps(e,n.theme.tableFrozenColumn),t.removeAttribute(`data-lexical-frozen-column`))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(ss(e,n.theme.tableFrozenRow),t.setAttribute(`data-lexical-frozen-row`,`true`)):(ps(e,n.theme.tableFrozenRow),t.removeAttribute(`data-lexical-frozen-row`))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:``)&&Xn(t.style,this.__style,e?e.__style:``),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(ss(e,t.theme.tableRowStriping),e.setAttribute(`data-lexical-row-striping`,`true`)):(ps(e,t.theme.tableRowStriping),e.removeAttribute(`data-lexical-row-striping`))}(t,n,this.__rowStriping);let r=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===r&&this.getColWidths()===i||qv(t,this.getColumnCount(),this.getColWidths()),Jv(t,n,this.getFormatType())}updateDOM(e,t,n){let r=pv(this,t);return t===r===Xv()||(us(i=t)&&i.nodeName===`DIV`&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}scaleDOMColWidths(e,t){let n=this.getColWidths();n&&qv(pv(this,e),this.getColumnCount(),n.map(e=>e*t))}exportDOM(e){let t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!fv(n)&&us(n)&&(n=n.querySelector(`table`)),!fv(n))return null;Jv(n,e._config,this.getFormatType());let[r]=Z_(this,null,null),i=new Map;for(let e of r)for(let t of e){let e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}let a=new Set;for(let e of n.querySelectorAll(`:scope > tr > [data-temporary-table-cell-lexical-key]`)){let t=e.getAttribute(`data-temporary-table-cell-lexical-key`);if(t){let n=i.get(t);if(e.removeAttribute(`data-temporary-table-cell-lexical-key`),n){i.delete(t);for(let e=0;e<n.colSpan;e++)a.add(e+n.startColumn)}}}let o=n.querySelector(`:scope > colgroup`);if(o){let e=Array.from(n.querySelectorAll(`:scope > colgroup > col`)).filter((e,t)=>a.has(t));o.replaceChildren(...e)}let s=n.querySelectorAll(`:scope > tr`);if(s.length>0){let e=document.createElement(`tbody`);for(let t of s)e.appendChild(t);n.append(e)}return n},element:!fv(n)&&us(n)?n.querySelector(`table`):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){let{rows:n,domRows:r}=t;for(let t=0;t<n;t++){let n=r[t];if(n!=null)for(let r=0;r<n.length;r++){let i=n[r];if(i==null)continue;let{elem:a}=i,o=Kv(this,a);if(o!==null&&e.is(o))return{x:r,y:t}}}throw Error(`Cell not found in table.`)}getDOMCellFromCords(e,t,n){let{domRows:r}=n,i=r[t];return i==null?null:i[e<i.length?e:i.length-1]??null}getDOMCellFromCordsOrThrow(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(!r)throw Error(`Cell not found at cords.`);return r}getCellNodeFromCords(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(r==null)return null;let i=me(r.elem);return G(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){let r=this.getCellNodeFromCords(e,t,n);if(!r)throw Error(`Node at cords not TableCellNode.`);return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){let t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach(e=>{G(e)&&(t+=e.getColSpan())}),t}};function $v(e,t){let n=e.getElementByKey(t.getKey());return n===null&&K(230),Ev(t,n)}function ey(e){let t=ty();e.hasAttribute(`data-lexical-row-striping`)&&t.setRowStriping(!0),e.hasAttribute(`data-lexical-frozen-column`)&&t.setFrozenColumns(1),e.hasAttribute(`data-lexical-frozen-row`)&&t.setFrozenRows(1);let n=e.querySelector(`:scope > colgroup`);if(n){let e=[];for(let t of n.querySelectorAll(`:scope > col`)){let n=t.style.width||``;if(!u_.test(n)&&(n=t.getAttribute(`width`)||``,!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>Jo(e,q),node:t}}function ty(){return n(new Qv)}function ny(e){return e instanceof Qv}function ry(e){q(e.getParent())?e.isEmpty()&&e.append(p()):e.remove()}function iy(e){ny(e.getParent())?is(e,G):e.remove()}function ay(e){is(e,q);let[t]=Z_(e,null,null),n=t.reduce((e,t)=>Math.max(e,t.length),0),r=e.getChildren();for(let e=0;e<t.length;++e){let i=r[e];if(!i)continue;q(i)||K(254,i.constructor.name,i.getType());let a=t[e].reduce((e,t)=>t?1+e:e,0);if(a!==n)for(let e=a;e<n;++e){let e=m_();e.append(p()),i.append(e)}}let i=e.getColWidths(),a=e.getColumnCount();if(i&&i.length!==a){let t;if(a<i.length)t=i.slice(0,a);else if(i.length>0){let e=i[i.length-1];t=[...i,...Array(a-i.length).fill(e)]}e.setColWidths(t)}}function oy(e){if(e.detail<3||!Nn(e.target))return!1;let t=me(e.target);if(t===null)return!1;let n=R(t,e=>E(e)&&!e.isInline());return n!==null&&!!G(n.getParent())&&(n.select(0),!0)}function sy(){let e=w();if(!O(e))return!1;let t=zv(e.anchor.getNode());if(t===null)return!1;let n=ye();if(!n.is(t.getParent())||n.getChildrenSize()!==1)return!1;let[r]=Z_(t,null,null);if(r.length===0||r[0].length===0)return!1;let i=r[0][0];if(!i||!i.cell)return!1;let a=r[r.length-1],o=a[a.length-1];if(!o||!o.cell)return!1;let s=ov(t,i.cell,o.cell);return j(s),!0}function cy(e){return e.registerNodeTransform(d_,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,t]=Q_(e),[n]=X_(t,e,e),r=n.length,i=n[0].length,a=t.getFirstChild();q(a)||K(175);let o=[];for(let e=0;e<r;e++){e!==0&&(a=a.getNextSibling(),q(a)||K(175));let t=null;for(let r=0;r<i;r++){let i=n[e][r],s=i.cell;if(i.startRow===e&&i.startColumn===r)t=s,o.push(s);else if(s.getColSpan()>1||s.getRowSpan()>1){G(s)||K(176);let e=m_(s.__headerState);t===null?es(a,e):t.insertAfter(e)}}}for(let e of o)e.setColSpan(1),e.setRowSpan(1)}})}function ly(e,t=!0){let n=new lv,r=(r,i,a)=>{let o=pv(r,a),s=bv(r,o,e,t,n);n.observers.set(i,[s,o])};return ds(yv(e,n),e.registerCommand(nn,()=>xv(n,e),N),e.registerMutationListener(Qv,t=>{e.getEditorState().read(()=>{for(let[e,i]of t){let t=n.observers.get(e);if(i===`created`||i===`updated`){let{tableNode:i,tableElement:a}=cv(e);t===void 0?r(i,e,a):a!==t[1]&&(t[0].removeListeners(),n.observers.delete(e),r(i,e,a))}else i===`destroyed`&&t!==void 0&&(t[0].removeListeners(),n.observers.delete(e))}},{editor:e})},{skipInitialization:!1}),()=>{for(let[,[e]]of n.observers)e.removeListeners()})}function uy(e,t){e.hasNodes([Qv])||K(255);let{hasNestedTables:n=Uc(!1)}=t??{};return ds(e.registerCommand(h_,e=>function({rows:e,columns:t,includeHeaders:n},r){let i=w()||ve();if(!i||!O(i)||!r&&zv(i.anchor.getNode()))return!1;let a=S_(Number(e),Number(t),n);ts(a);let o=a.getFirstDescendant();return A(o)&&o.select(),!0}(e,n.peek()),M),e.registerCommand(rn,(t,r)=>e===r&&function(e,t){let{nodes:n,selection:r}=e;if(!n.some(e=>ny(e)||Yo(e).some(e=>ny(e.node))))return!1;let i=J(r),a=O(r);return a&&R(r.anchor.getNode(),e=>G(e))!==null&&R(r.focus.getNode(),e=>G(e))!==null||i?n.length===1&&ny(n[0])?function(e,t){let n=t.getStartEndPoints(),r=J(t);if(n===null)return!1;let[i,a]=n,[o,s,c]=Q_(i),l=R(a.getNode(),e=>G(e));if(!(G(o)&&G(l)&&q(s)&&ny(c)))return!1;let[u,d,f]=X_(c,o,l),[m]=Z_(e,null,null),h=u.length,g=h>0?u[0].length:0,_=d.startRow,v=d.startColumn,y=m.length,b=y>0?m[0].length:0;if(r){let e=$_(u,d,f),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;_=e.minRow,v=e.minColumn,y=Math.min(y,t),b=Math.min(b,n)}let ee=!1,x=Math.min(h,_+y)-1,te=Math.min(g,v+b)-1,ne=new Set;for(let e=_;e<=x;e++)for(let t=v;t<=te;t++){let n=u[e][t];ne.has(n.cell.getKey())||n.cell.__rowSpan===1&&n.cell.__colSpan===1||(Y_(n.cell),ne.add(n.cell.getKey()),ee=!0)}let[re]=Z_(c.getWritable(),null,null),ie=y-h+_;for(let e=0;e<ie;e++)P_(re[h-1][0].cell);let ae=b-g+v;for(let e=0;e<ae;e++)R_(re[0][g-1].cell,!0,!1);[re]=Z_(c.getWritable(),null,null);for(let e=_;e<_+y;e++)for(let t=v;t<v+b;t++){let n=e-_,r=t-v,i=m[n][r];if(i.startRow!==n||i.startColumn!==r)continue;let a=i.cell;if(a.__rowSpan!==1||a.__colSpan!==1){let n=[],r=Math.min(e+a.__rowSpan,_+y)-1,i=Math.min(t+a.__colSpan,v+b)-1;for(let a=e;a<=r;a++)for(let e=t;e<=i;e++){let t=re[a][e];n.push(t.cell)}K_(n),ee=!0}let{cell:o}=re[e][t],s=a.getBackgroundColor();s!=null&&o.setBackgroundColor(s);let c=o.getChildren();a.getChildren().forEach(e=>{A(e)&&p().append(e),o.append(e)}),c.forEach(e=>e.remove())}if(r&&ee){let[e]=Z_(c.getWritable(),null,null);e[d.startRow][d.startColumn].cell.selectEnd()}return!0}(n[0],r):!(a&&t.peek()&&!function(e){return!!(J(e)&&!e.focus.getNode().is(e.anchor.getNode())||O(e)&&G(e.anchor.getNode())&&!e.anchor.getNode().is(e.focus.getNode()))}(r)):!1}(t,n),M),e.registerCommand(an,sy,P),e.registerCommand(at,oy,M),e.registerNodeTransform(Qv,ay),e.registerNodeTransform(g_,iy),e.registerNodeTransform(d_,ry))}const dy=F({build:(e,t,n)=>Hc(t),config:Jn({hasCellBackgroundColor:!0,hasCellMerge:!0,hasHorizontalScroll:!0,hasNestedTables:!1,hasTabHandler:!0}),name:`@lexical/table/Table`,nodes:()=>[Qv,g_,d_],register(e,t,n){let r=n.getOutput();return ds(Rc(()=>{let t=r.hasHorizontalScroll.value;Xv(e)!==t&&(Zv(e,t),e.registerNodeTransform(Qv,()=>{})())}),uy(e,r),Rc(()=>ly(e,r.hasTabHandler.value)),Rc(()=>r.hasCellMerge.value?void 0:cy(e)),Rc(()=>r.hasCellBackgroundColor.value?void 0:e.registerNodeTransform(d_,e=>{e.getBackgroundColor()!==null&&e.setBackgroundColor(null)})))}}),Y=l_;Y.$computeTableMap,Y.$computeTableMapSkipCellCheck,Y.$createTableCellNode,Y.$createTableNode,Y.$createTableNodeWithDimensions,Y.$createTableRowNode,Y.$createTableSelection,Y.$createTableSelectionFrom,Y.$deleteTableColumn;const fy=Y.$deleteTableColumnAtSelection;Y.$deleteTableColumn__EXPERIMENTAL;const py=Y.$deleteTableRowAtSelection;Y.$deleteTableRow__EXPERIMENTAL;const my=Y.$findCellNode,hy=Y.$findTableNode,gy=Y.$getElementForTableNode;Y.$getNodeTriplet,Y.$getTableAndElementByKey;const _y=Y.$getTableCellNodeFromLexicalNode;Y.$getTableCellNodeRect;const vy=Y.$getTableColumnIndexFromTableCellNode;Y.$getTableNodeFromLexicalNodeOrThrow;const yy=Y.$getTableRowIndexFromTableCellNode;Y.$getTableRowNodeFromTableCellNodeOrThrow,Y.$insertTableColumn;const by=Y.$insertTableColumnAtSelection;Y.$insertTableColumn__EXPERIMENTAL,Y.$insertTableRow;const xy=Y.$insertTableRowAtSelection;Y.$insertTableRow__EXPERIMENTAL,Y.$isScrollableTablesActive,Y.$isSimpleTable,Y.$isTableCellNode,Y.$isTableNode,Y.$isTableRowNode,Y.$isTableSelection,Y.$mergeCells,Y.$moveTableColumn,Y.$removeTableRowAtIndex,Y.$unmergeCell;const Sy=Y.INSERT_TABLE_COMMAND,Cy=Y.TableCellHeaderStates,wy=Y.TableCellNode;Y.TableExtension;const Ty=Y.TableNode;Y.TableObserver;const Ey=Y.TableRowNode;Y.applyTableHandlers,Y.getDOMCellFromTarget,Y.getTableElement,Y.getTableObserverFromTableElement,Y.registerTableCellUnmergeTransform;const Dy=Y.registerTablePlugin,Oy=Y.registerTableSelectionObserver,ky=Y.setScrollableTablesActive;function Ay(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jy=Ay();function My(e){jy=e}var Ny={exec:()=>null};function X(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Fy.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Py=(()=>{try{return!!RegExp(`(?<=1)(?<!1)`)}catch{return!1}})(),Fy={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=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},Iy=/^(?:[ \t]*(?:\n|$))+/,Ly=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ry=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,zy=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,By=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vy=/(?:[*+-]|\d{1,9}[.)])/,Hy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uy=X(Hy).replace(/bull/g,Vy).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(),Wy=X(Hy).replace(/bull/g,Vy).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(),Gy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ky=/^[^\n]+/,qy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Jy=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,qy).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Yy=X(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Vy).getRegex(),Xy=`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`,Zy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qy=X(`^ {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[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Zy).replace(`tag`,Xy).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$y=X(Gy).replace(`hr`,zy).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`,Xy).getRegex(),eb={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,$y).getRegex(),code:Ly,def:Jy,fences:Ry,heading:By,hr:zy,html:Qy,lheading:Uy,list:Yy,newline:Iy,paragraph:$y,table:Ny,text:Ky},tb=X(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,zy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\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`,Xy).getRegex(),nb={...eb,lheading:Wy,table:tb,paragraph:X(Gy).replace(`hr`,zy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,tb).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`,Xy).getRegex()},rb={...eb,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Zy).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:Ny,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Gy).replace(`hr`,zy).replace(`heading`,` *#{1,6} *[^
|
|
49
|
+
]`).replace(`lheading`,Uy).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ib=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ab=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ob=/^( {2,}|\\)\n(?!\s*$)/,sb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cb=/[\p{P}\p{S}]/u,lb=/[\s\p{P}\p{S}]/u,ub=/[^\s\p{P}\p{S}]/u,db=X(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,lb).getRegex(),fb=/(?!~)[\p{P}\p{S}]/u,pb=/(?!~)[\s\p{P}\p{S}]/u,mb=/(?:[^\s\p{P}\p{S}]|~)/u,hb=X(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Py?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),gb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_b=X(gb,`u`).replace(/punct/g,cb).getRegex(),vb=X(gb,`u`).replace(/punct/g,fb).getRegex(),yb=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,bb=X(yb,`gu`).replace(/notPunctSpace/g,ub).replace(/punctSpace/g,lb).replace(/punct/g,cb).getRegex(),xb=X(yb,`gu`).replace(/notPunctSpace/g,mb).replace(/punctSpace/g,pb).replace(/punct/g,fb).getRegex(),Sb=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ub).replace(/punctSpace/g,lb).replace(/punct/g,cb).getRegex(),Cb=X(/\\(punct)/,`gu`).replace(/punct/g,cb).getRegex(),wb=X(/^<(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(),Tb=X(Zy).replace(`(?:-->|$)`,`-->`).getRegex(),Eb=X(`^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`,Tb).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Db=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ob=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Db).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kb=X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Db).replace(`ref`,qy).getRegex(),Ab=X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,qy).getRegex(),jb=X(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,kb).replace(`nolink`,Ab).getRegex(),Mb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Nb={_backpedal:Ny,anyPunctuation:Cb,autolink:wb,blockSkip:hb,br:ob,code:ab,del:Ny,emStrongLDelim:_b,emStrongRDelimAst:bb,emStrongRDelimUnd:Sb,escape:ib,link:Ob,nolink:Ab,punctuation:db,reflink:kb,reflinkSearch:jb,tag:Eb,text:sb,url:Ny},Pb={...Nb,link:X(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Db).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Db).getRegex()},Fb={...Nb,emStrongRDelimAst:xb,emStrongLDelim:vb,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Mb).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Mb).getRegex()},Ib={...Fb,br:X(ob).replace(`{2,}`,`*`).getRegex(),text:X(Fb.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Lb={normal:eb,gfm:nb,pedantic:rb},Rb={normal:Nb,gfm:Fb,breaks:Ib,pedantic:Pb},zb={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Bb=e=>zb[e];function Vb(e,t){if(t){if(Fy.escapeTest.test(e))return e.replace(Fy.escapeReplace,Bb)}else if(Fy.escapeTestNoEncode.test(e))return e.replace(Fy.escapeReplaceNoEncode,Bb);return e}function Hb(e){try{e=encodeURI(e).replace(Fy.percentDecode,`%`)}catch{return null}return e}function Ub(e,t){let n=e.replace(Fy.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Fy.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Fy.slashPipe,`|`);return n}function Wb(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Gb(e,t){if(e.indexOf(t[1])===-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}function Kb(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function qb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
50
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
51
|
+
`)}var Jb=class{options;rules;lexer;constructor(e){this.options=e||jy}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:Wb(e,`
|
|
52
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=qb(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=Wb(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:Wb(t[0],`
|
|
53
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Wb(t[0],`
|
|
54
|
+
`).split(`
|
|
55
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
56
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
57
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
58
|
+
${s}`:s,r=r?`${r}
|
|
59
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
60
|
+
`+e.join(`
|
|
61
|
+
`),o=this.blockquote(a);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(u?.type===`list`){let t=u,a=t.raw+`
|
|
62
|
+
`+e.join(`
|
|
63
|
+
`),o=this.list(a);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=a.substring(i.at(-1).raw.length).split(`
|
|
64
|
+
`);continue}}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 a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
65
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
66
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
67
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
68
|
+
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
69
|
+
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
70
|
+
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
71
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;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=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}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:t[1]===`pre`||t[1]===`script`||t[1]===`style`,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=Ub(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
72
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ub(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}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=t[1].charAt(t[1].length-1)===`
|
|
73
|
+
`?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=Wb(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Gb(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?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)),Kb(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 Kb(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=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}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=t[1]===`www.`?`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}}}},Yb=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jy,this.options.tokenizer=this.options.tokenizer||new Jb,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:Fy,block:Lb.normal,inline:Rb.normal};this.options.pedantic?(t.block=Lb.pedantic,t.inline=Rb.pedantic):this.options.gfm&&(t.block=Lb.gfm,t.inline=this.options.breaks?Rb.breaks:Rb.gfm),this.tokenizer.rules=t}static get rules(){return{block:Lb,inline:Rb}}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(Fy.carriageReturn,`
|
|
74
|
+
`),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(Fy.tabCharGlobal,` `).replace(Fy.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):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
75
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
76
|
+
`)?``:`
|
|
77
|
+
`)+r.raw,n.text+=`
|
|
78
|
+
`+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);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
79
|
+
`)?``:`
|
|
80
|
+
`)+r.raw,n.text+=`
|
|
81
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
82
|
+
`)?``:`
|
|
83
|
+
`)+r.raw,a.text+=`
|
|
84
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
85
|
+
`)?``:`
|
|
86
|
+
`)+r.raw,n.text+=`
|
|
87
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw 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(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)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(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))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);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},Xb=class{options;parser;constructor(e){this.options=e||jy}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Fy.notSpaceStart)?.[0],i=e.replace(Fy.endingNewline,``)+`
|
|
88
|
+
`;return r?`<pre><code class="language-`+Vb(r)+`">`+(n?i:Vb(i,!0))+`</code></pre>
|
|
89
|
+
`:`<pre><code>`+(n?i:Vb(i,!0))+`</code></pre>
|
|
90
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
91
|
+
${this.parser.parse(e)}</blockquote>
|
|
92
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
93
|
+
`}hr(e){return`<hr>
|
|
94
|
+
`}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`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
95
|
+
`+r+`</`+i+`>
|
|
96
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+Vb(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>
|
|
97
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
98
|
+
`}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&&=`<tbody>${r}</tbody>`,`<table>
|
|
99
|
+
<thead>
|
|
100
|
+
`+t+`</thead>
|
|
101
|
+
`+r+`</table>
|
|
102
|
+
`}tablerow({text:e}){return`<tr>
|
|
103
|
+
${e}</tr>
|
|
104
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
105
|
+
`}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>${Vb(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=Hb(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Vb(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Hb(e);if(i===null)return Vb(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Vb(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Vb(e.text)}},Zb=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``}},Qb=class e{options;renderer;textRenderer;constructor(e){this.options=e||jy,this.options.renderer=this.options.renderer||new Xb,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zb}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(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`def`:n+=this.renderer.def(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
106
|
+
`+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 "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw 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(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},$b=class{options;block;constructor(e){this.options=e||jy}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Yb.lex:Yb.lexInline}provideParser(){return this.block?Qb.parse:Qb.parseInline}},ex=new class{defaults=Ay();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Qb;Renderer=Xb;TextRenderer=Zb;Lexer=Yb;Tokenizer=Jb;Hooks=$b;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 Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw 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&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(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 Xb(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Jb(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new $b;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=$b.passThroughHooks.has(n)?e=>{if(this.defaults.async&&$b.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.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 Yb.lex(e,t??this.defaults)}parser(e,t){return Qb.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?Yb.lex:Yb.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?Qb.parse:Qb.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?Yb.lex:Yb.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?Qb.parse:Qb.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
107
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Vb(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Z(e,t){return ex.parse(e,t)}Z.options=Z.setOptions=function(e){return ex.setOptions(e),Z.defaults=ex.defaults,My(Z.defaults),Z},Z.getDefaults=Ay,Z.defaults=jy,Z.use=function(...e){return ex.use(...e),Z.defaults=ex.defaults,My(Z.defaults),Z},Z.walkTokens=function(e,t){return ex.walkTokens(e,t)},Z.parseInline=ex.parseInline,Z.Parser=Qb,Z.parser=Qb.parse,Z.Renderer=Xb,Z.TextRenderer=Zb,Z.Lexer=Yb,Z.lexer=Yb.lex,Z.Tokenizer=Jb,Z.Hooks=$b,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,Qb.parse,Yb.lex;const tx=[`class`,`contenteditable`,`href`,`src`,`style`,`title`],nx=[`color`,`background-color`];function rx(e,t){if(t.attrName===`style`&&t.attrValue){let e={...Fa(t.attrValue)},n={};for(let t in e)nx.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Pa(n):t.keepAttr=!1}}Bi.addHook(`uponSanitizeAttribute`,rx),Bi.addHook(`uponSanitizeElement`,(e,t)=>{(t.tagName===`strong`||t.tagName===`em`)&&e.removeAttribute(`class`)});function ix(e){let t={};for(let n of e)typeof n==`string`?t[n]||=[]:(t[n.tag]||=[],t[n.tag].push(...n.attributes));return{ALLOWED_TAGS:Object.keys(t),ALLOWED_ATTR:tx,ADD_ATTR:(e,n)=>t[n]?.includes(e),ADD_URI_SAFE_ATTR:[`caption`,`filename`],SAFE_FOR_XML:!1}}function ax(){return document.head.querySelector(`meta[name=csp-nonce]`)?.content}function Q(e,t,n,r){e.addEventListener(t,n,r);let i=new WeakRef(e),a=new WeakRef(n);return function(){let e=a.deref();e&&i.deref()?.removeEventListener(t,e,r)}}var ox=class{#e=[];track(...e){this.#e.push(...e)}dispose(){for(;this.#e.length;)this.#e.pop()()}};function sx(e){return t=>{let n=e(t);return n&&t.preventDefault(),n}}function $(e,t,n=``){let r=document.createElement(e);for(let[e,n]of Object.entries(t||{}))e===`dataset`?Object.entries(n).forEach(([e,t])=>r.dataset[e]=t):e in r?r[e]=n:n!=null&&r.setAttribute(e,n);return n&&(r.innerHTML=n),r}function cx(e){return new DOMParser().parseFromString(e,`text/html`)}function lx(e,t,n){let r=n?n.split(`.`).pop().toLowerCase():`unknown`;return $(`figure`,{className:`attachment attachment--${t?`preview`:`file`} attachment--${r}`,"data-content-type":e})}function ux(e){return e.startsWith(`image/`)&&!e.includes(`svg`)}function dx(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function fx(e){for(let t of e.querySelectorAll(`body > :not(h1, h2, h3, h4, h5, h6) + *, blockquote > :not(h1, h2, h3, h4, h5, h6) + *`)){let n=e.createElement(`p`);n.appendChild(e.createElement(`br`)),t.before(n)}}function px(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function mx(e=``){return cx(e).body.textContent.trim()}function hx(e){return e&&!e.disabled&&gx(e)}function gx(e,t){return e.checkVisibility?e.checkVisibility(t):!!e.offsetParent}function _x(e,t){let n=document.activeElement;e.includes(n)&&new vx(e,t.key).selectNext(n)&&t.preventDefault()}var vx=class{constructor(e,t){this.elements=e,this.key=t}selectNext(e){let t=this.#e(e);if(t){let e=this.elements.filter(e=>e!==t);return this.#s(e),this.#o(t),!0}return!1}#e(e){switch(this.key){case`ArrowRight`:case`ArrowDown`:return this.#r(e);case`ArrowLeft`:case`ArrowUp`:return this.#i(e);case`Home`:return this.#t();case`End`:return this.#n()}}#t(e=this.elements){return e.find(hx)}#n(e=this.elements){return e.findLast(hx)}#r(e){let t=this.elements.slice(this.#a(e)+1);return this.#t(t)}#i(e){let t=this.elements.slice(0,this.#a(e));return this.#n(t)}#a(e){return this.elements.indexOf(e)}#o(e){hx(e)&&(e.tabIndex=0,e.focus())}#s(e){e.forEach(e=>e.tabIndex=-1)}},yx={bold:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
108
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.05273 1.88232C10.6866 1.88237 12.0033 2.20353 12.9529 2.89673L13.1272 3.0293C13.974 3.70864 14.4008 4.63245 14.4009 5.76562C14.4008 6.49354 14.2316 7.15281 13.8845 7.73145C13.6683 8.09188 13.3997 8.40162 13.0818 8.66016C13.5902 8.92606 14.0196 9.28599 14.3635 9.74121C14.8586 10.3834 15.0945 11.1743 15.0945 12.0879C15.0944 13.3698 14.5922 14.3931 13.5879 15.1106L13.5857 15.1128C12.5967 15.805 11.196 16.125 9.43799 16.125H3.10547V1.88232L9.05273 1.88232ZM6.36108 13.4084H9.28418C10.224 13.4084 10.8634 13.2491 11.2581 12.9851C11.6259 12.7389 11.8198 12.3768 11.8198 11.8367C11.8197 11.2968 11.6259 10.9351 11.2581 10.689C10.8634 10.425 10.2241 10.2649 9.28418 10.2649H6.36108V13.4084ZM6.36108 7.56812H8.78247C9.5163 7.56809 10.0547 7.45371 10.429 7.25757L10.5791 7.16895C10.9438 6.92178 11.1255 6.57934 11.1255 6.09302C11.1254 5.59017 10.9414 5.25227 10.5835 5.02002L10.5784 5.01636L10.5732 5.01343C10.1994 4.75387 9.61878 4.59818 8.78247 4.59814H6.36108V7.56812Z"/>
|
|
109
|
+
</svg>`,italic:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
110
|
+
<path d="M14.1379 3.91187L14.1086 4.06421H11.4668L9.49805 13.9431H12.0981L11.7473 15.7852L11.7188 15.9375H4.16675L4.51758 14.0955L4.54614 13.9431H7.18799L9.17505 4.06421H6.55664L6.90747 2.22217L6.93677 2.06982H14.4888L14.1379 3.91187Z"/>
|
|
111
|
+
</svg>`,strikethrough:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
112
|
+
<path d="M14.3723 11.8015C14.3771 11.8858 14.3811 11.9756 14.3811 12.0681C14.3811 12.811 14.1777 13.4959 13.7725 14.1174L13.7717 14.1189C13.3624 14.7329 12.7463 15.2162 11.9377 15.5742L11.9348 15.5757C11.1214 15.9223 10.1306 16.092 8.96997 16.092C7.9356 16.092 6.93308 15.9348 5.96338 15.6204L5.96045 15.6189C5.00593 15.292 4.24112 14.8699 3.67676 14.3459L3.57568 14.2522L3.63501 14.1277L4.45605 12.397L4.64282 12.5654C5.13492 13.0083 5.76733 13.3759 6.54492 13.6648C7.33475 13.9406 8.14322 14.0786 8.96997 14.0786C10.0731 14.0786 10.8638 13.8932 11.3708 13.5513C11.8757 13.1982 12.1172 12.7464 12.1172 12.1838C12.1172 12.0662 12.1049 11.9556 12.0828 11.8513L12.0344 11.625H14.3621L14.3723 11.8015Z"/>
|
|
113
|
+
<path d="M9.2981 1.91602C10.111 1.91604 10.9109 2.02122 11.6975 2.23096C12.4855 2.44111 13.1683 2.74431 13.7417 3.14429L13.8655 3.23071L13.8083 3.36987L13.1726 4.91235L13.0869 5.1189L12.8987 4.99878C12.3487 4.64881 11.761 4.38633 11.1365 4.21143L11.1328 4.20996C10.585 4.04564 10.0484 3.95419 9.52295 3.93384L9.2981 3.92944C8.22329 3.92944 7.44693 4.12611 6.94043 4.49121C6.44619 4.85665 6.20874 5.31616 6.20874 5.88135L6.21533 6.03296C6.24495 6.37662 6.37751 6.65526 6.61011 6.87964L6.72144 6.97632C6.98746 7.19529 7.30625 7.37584 7.68018 7.51538L8.05151 7.63184C8.45325 7.75061 8.94669 7.87679 9.53247 8.01123L9.53467 8.01196C10.1213 8.15305 10.6426 8.29569 11.0991 8.4375H15C15.5178 8.4375 15.9375 8.85723 15.9375 9.375C15.9375 9.89277 15.5178 10.3125 15 10.3125H3C2.48223 10.3125 2.0625 9.89277 2.0625 9.375C2.0625 8.85723 2.48223 8.4375 3 8.4375H4.93726C4.83783 8.34526 4.74036 8.24896 4.64795 8.146L4.64502 8.14233C4.1721 7.58596 3.94482 6.85113 3.94482 5.95825C3.94483 5.20441 4.14059 4.51965 4.53369 3.90967L4.53516 3.90747C4.94397 3.29427 5.55262 2.81114 6.34863 2.45288C7.15081 2.0919 8.13683 1.91602 9.2981 1.91602Z"/>
|
|
114
|
+
</svg>`,underline:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
+
<path d="M14 14C14.5523 14 15 14.4477 15 15C15 15.5523 14.5523 16 14 16H4C3.44772 16 3 15.5523 3 15C3 14.4477 3.44772 14 4 14H14Z"/>
|
|
116
|
+
<path d="M12.625 1.59375C13.25 1.59375 13.625 1.97656 13.625 2.64062V9.02344C13.625 11.4844 11.8516 13.1875 8.99219 13.1875C6.14062 13.1875 4.35938 11.4844 4.35938 9.02344V2.64062C4.35938 1.97656 4.74219 1.59375 5.36719 1.59375C6 1.59375 6.375 1.97656 6.375 2.64062V8.84375C6.375 10.3828 7.32031 11.4297 8.99219 11.4297C10.6641 11.4297 11.6172 10.3828 11.6172 8.84375V2.64062C11.6172 1.97656 11.9922 1.59375 12.625 1.59375Z"/>
|
|
117
|
+
</svg>`,heading:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
118
|
+
<path d="M11.5 2C12.0523 2 12.5 2.44772 12.5 3V3.5C12.5 4.05228 12.0523 4.5 11.5 4.5H8V15C8 15.5523 7.55228 16 7 16H6.5C5.94772 16 5.5 15.5523 5.5 15V4.5H2C1.44772 4.5 1 4.05228 1 3.5V3C1 2.44772 1.44772 2 2 2H11.5ZM16 7C16.5523 7 17 7.44772 17 8V8.5C17 9.05228 16.5523 9.5 16 9.5H15V15C15 15.5523 14.5523 16 14 16H13.5C12.9477 16 12.5 15.5523 12.5 15V9.5H11.5C10.9477 9.5 10.5 9.05228 10.5 8.5V8C10.5 7.44772 10.9477 7 11.5 7H16Z"/>
|
|
119
|
+
</svg>`,h1:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
120
|
+
<path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.8418 4.125H14.8271C15.543 4.125 16.0449 4.56934 16.0449 5.23828V12.7207C16.0449 13.4111 15.6348 13.8486 14.9854 13.8486C14.336 13.8486 13.9395 13.418 13.9395 12.7207V6.11133H13.8887L12.9541 6.74219C12.7354 6.88574 12.5303 6.95312 12.3047 6.95312C11.7646 6.95312 11.3955 6.58398 11.3955 6.06445C11.3955 5.69531 11.5801 5.42578 11.9766 5.15625L13.4023 4.32031C13.5459 4.23633 13.6826 4.17578 13.8418 4.125Z"/>
|
|
121
|
+
</svg>`,h2:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
122
|
+
<path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6445 4.19824C15.5244 4.19824 16.8984 5.34668 16.8984 6.91211C16.8984 7.8759 16.4335 8.7237 15.292 9.84473L13.3438 11.8135V11.9092H16.1875C16.8232 11.9092 17.2197 12.251 17.2197 12.8115C17.2196 13.3651 16.83 13.7002 16.1875 13.7002H11.5117C10.8487 13.7002 10.4112 13.3241 10.4111 12.75C10.4111 12.3399 10.6368 11.9843 11.3203 11.3145L13.6855 8.88086C14.4169 8.13583 14.7245 7.64349 14.7246 7.12402C14.7246 6.4541 14.2393 6.00293 13.5215 6.00293C12.9404 6.00293 12.5166 6.29688 12.2158 6.90527C11.9151 7.37002 11.6552 7.54785 11.2588 7.54785C10.7188 7.54785 10.3429 7.17861 10.3428 6.65918C10.3428 5.3877 11.7783 4.19824 13.6445 4.19824Z"/>
|
|
123
|
+
</svg>`,h3:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
124
|
+
<path d="M13.5967 4.19824C15.5928 4.19824 16.9873 5.23047 16.9873 6.7002C16.9872 7.705 16.2421 8.60059 15.2988 8.7168V8.86719C16.4199 8.94923 17.2607 9.89942 17.2607 11.0889C17.2606 12.7362 15.7362 13.9053 13.583 13.9053C11.6827 13.9053 10.1925 12.873 10.1924 11.7041C10.1924 11.1846 10.5547 10.8154 11.0537 10.8154C11.3818 10.8154 11.6553 10.9727 11.9629 11.3555C12.3799 11.9159 12.92 12.2031 13.583 12.2031C14.4853 12.2031 15.0731 11.7313 15.0732 11C15.0732 10.2754 14.4785 9.7832 13.5898 9.7832H13.0361C12.5645 9.7832 12.2159 9.4208 12.2158 8.92188C12.2158 8.44336 12.5576 8.07422 13.0361 8.07422H13.5693C14.3075 8.07422 14.8544 7.60928 14.8545 6.97363C14.8545 6.33789 14.3213 5.90039 13.5557 5.90039C12.9678 5.90039 12.5029 6.16016 12.0859 6.71387C11.8399 7.03508 11.5527 7.17871 11.1973 7.17871C10.671 7.17871 10.295 6.82314 10.2949 6.31738C10.2949 5.18945 11.751 4.19824 13.5967 4.19824ZM8.0332 4.30078C8.75781 4.30078 9.16797 4.74512 9.16797 5.51758V12.5518C9.1679 13.3241 8.75776 13.7686 8.0332 13.7686C7.30865 13.7686 6.90534 13.3309 6.90527 12.5518V9.87207H3.48047V12.5518C3.4804 13.3241 3.07026 13.7686 2.3457 13.7686C1.62115 13.7686 1.21784 13.3309 1.21777 12.5518V5.51758C1.21777 4.73828 1.62109 4.30078 2.3457 4.30078C3.07031 4.30078 3.48047 4.74512 3.48047 5.51758V8.07422H6.90527V5.51758C6.90527 4.73828 7.30859 4.30078 8.0332 4.30078Z"/>
|
|
125
|
+
</svg>`,h4:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
126
|
+
<path d="M14.6357 4.22559C15.7432 4.22559 16.4336 4.80664 16.4336 5.73633V10.3164H16.7275C17.2881 10.3164 17.6436 10.6787 17.6436 11.2256C17.6435 11.7655 17.3017 12.1006 16.7275 12.1006H16.4336V12.6611C16.4335 13.3515 16.0234 13.7891 15.374 13.7891C14.7247 13.7891 14.3282 13.3583 14.3281 12.6611V12.1006H11.04C10.2335 12.1006 9.76863 11.6766 9.76855 10.918C9.76855 10.5762 9.85064 10.3026 10.1104 9.74219C10.7666 8.42289 11.5733 7.0146 12.5713 5.54492C13.2549 4.56738 13.7812 4.22559 14.6357 4.22559ZM7.88965 4.30078C8.61426 4.30078 9.02441 4.74512 9.02441 5.51758V12.5518C9.02435 13.3241 8.6142 13.7686 7.88965 13.7686C7.1651 13.7686 6.76178 13.3309 6.76172 12.5518V9.87207H3.33691V12.5518C3.33685 13.3241 2.9267 13.7686 2.20215 13.7686C1.4776 13.7686 1.07428 13.3309 1.07422 12.5518V5.51758C1.07422 4.73828 1.47754 4.30078 2.20215 4.30078C2.92676 4.30078 3.33691 4.74512 3.33691 5.51758V8.07422H6.76172V5.51758C6.76172 4.73828 7.16504 4.30078 7.88965 4.30078ZM14.2188 6.07812C13.6035 7.02841 12.2158 9.48929 11.7988 10.2686V10.3164H14.3281V6.07812H14.2188Z"/>
|
|
127
|
+
</svg>`,h5:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
128
|
+
<path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM16.1191 4.30078C16.6934 4.30078 17.0762 4.63672 17.0762 5.16602C17.0762 5.69531 16.6934 6.03125 16.1191 6.03125H13.3457L12.9219 8.25586H13.0176C13.248 8.03711 13.6855 7.84375 14.2871 7.84375C15.9277 7.84375 17.1445 9.07422 17.1445 10.7832C17.1445 12.5605 15.8184 13.9053 13.7695 13.9053C11.9512 13.9053 10.6934 12.9277 10.5566 11.7178C10.5566 11.2021 10.9121 10.8193 11.4277 10.8193C11.8379 10.8193 12.1328 11.0244 12.3516 11.4893C12.625 12.0361 13.1133 12.2549 13.7285 12.2549C14.5488 12.2549 15.1367 11.6533 15.1367 10.7695C15.1367 9.92188 14.5625 9.31348 13.7559 9.31348C13.1953 9.31348 12.7578 9.56055 12.4629 10.0254C12.2168 10.3887 11.9355 10.5527 11.5527 10.5527C10.9648 10.5527 10.5684 10.1699 10.5684 9.55469C10.5684 9.42773 10.582 9.30762 10.6094 9.17383L11.2383 5.55273C11.3516 4.88379 11.7207 4.30078 12.6797 4.30078H16.1191Z"/>
|
|
129
|
+
</svg>`,h6:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
130
|
+
<path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6719 13.9258C15.5518 13.9258 17.1445 12.37306 17.1445 10.35451V10.05763C17.1445 8.10744 16.6016 6.59574 15.5928 5.58694C14.8613 4.85544 13.8975 4.42384 12.7285 4.25294C12.4199 4.21194 12.1592 4.19824 11.8643 4.19824C11.2627 4.19824 10.8389 4.59474 10.8389 5.14164C10.8389 5.65724 11.2354 6.02054 11.7783 6.04784C12.1758 6.06834 12.4844 6.10944 12.7656 6.19144C13.5176 6.42384 14.0742 6.95314 14.3965 7.75974L14.4922 8.00584H14.3828C14.0605 7.56834 13.4863 7.25974 12.6523 7.25974C11.1406 7.25974 10.0674 8.42384 10.0674 10.02345V10.27736C10.0674 12.2549 11.4668 13.9258 13.6719 13.9258ZM13.5215 12.24123C12.6797 12.24123 12.0918 11.48244 12.0918 10.4131V10.1592C12.0918 9.26174 12.6523 8.71291 13.5352 8.71291C14.3965 8.71291 14.9844 9.27638 14.9844 10.1592V10.4131C14.9844 11.48244 14.3828 12.24123 13.5215 12.24123Z"/>
|
|
131
|
+
</svg>`,paragraph:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
132
|
+
<path d="M9 12C9.55228 12 10 12.4477 10 13C10 13.5523 9.55228 14 9 14H3C2.44772 14 2 13.5523 2 13C2 12.4477 2.44772 12 3 12H9ZM15 8C15.5523 8 16 8.44772 16 9C16 9.55228 15.5523 10 15 10H3C2.44772 10 2 9.55228 2 9C2 8.44772 2.44772 8 3 8H15ZM15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H15Z"/>
|
|
133
|
+
</svg>`,clearFormatting:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
134
|
+
<path d="M10.0607 2.07533C10.8417 1.29432 12.1078 1.2943 12.8888 2.07533L16.424 5.61049C17.205 6.39154 17.205 7.65854 16.424 8.43959L9.44937 15.4142C9.07435 15.7891 8.5656 16.0001 8.03531 16.0001H5.0148C4.55074 16.0001 4.10309 15.8385 3.74722 15.547L3.60074 15.4142L1.57534 13.3888C0.79431 12.6078 0.794336 11.3417 1.57534 10.5607L10.0607 2.07533ZM2.98941 11.9747L5.0148 14.0001H8.03531L9.71792 12.3165L6.18179 8.78139L2.98941 11.9747Z"/>
|
|
135
|
+
</svg>`,highlight:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
136
|
+
<path d="M16.4564 14.4272C17.1356 15.5592 16.3204 17.0002 15.0003 17.0004C13.68 17.0004 12.864 15.5593 13.5433 14.4272L15.0003 12.0004L16.4564 14.4272ZM5.1214 1.70746C5.51192 1.31693 6.14494 1.31693 6.53546 1.70746L9.7171 4.8891L13.2532 8.42426C14.2295 9.40056 14.2295 10.9841 13.2532 11.9604L9.7171 15.4955C8.74078 16.4718 7.15822 16.4718 6.18195 15.4955L2.64679 11.9604C1.67048 10.9841 1.67048 9.40057 2.64679 8.42426L6.18195 4.8891C6.30299 4.76805 6.43323 4.66177 6.57062 4.57074L5.1214 3.12152C4.73091 2.73104 4.73099 2.09799 5.1214 1.70746ZM8.30304 6.30316C8.10776 6.10815 7.79119 6.10799 7.59601 6.30316L4.06085 9.83929L3.9964 9.91742C3.88661 10.0838 3.88645 10.3019 3.9964 10.4682L4.02277 10.5004H11.8763C12.0312 10.3043 12.02 10.0205 11.8392 9.83929L8.30304 6.30316Z"/>
|
|
137
|
+
</svg>`,link:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
138
|
+
<path d="M12.8885 7.23091L13.9479 6.17155C14.5337 5.58576 14.5337 4.63602 13.9479 4.05023C13.3621 3.46444 12.4124 3.46444 11.8266 4.05023L8.29235 7.58446C7.9263 7.95051 7.90312 8.52994 8.2233 8.92271L8.36141 9.07463C8.68158 9.4674 8.65841 10.0468 8.29235 10.4129C7.90183 10.8034 7.26866 10.8034 6.87814 10.4129C5.70657 9.24131 5.70657 7.34182 6.87814 6.17025L10.4124 2.63602C11.7792 1.26918 13.9953 1.26918 15.3621 2.63602C16.729 4.00285 16.729 6.21893 15.3621 7.58576L14.3028 8.64512C13.9122 9.03564 13.2791 9.03564 12.8885 8.64512C12.498 8.2546 12.498 7.62143 12.8885 7.23091Z"/>
|
|
139
|
+
<path d="M5.11038 10.7664L4.04843 11.8284C3.46264 12.4142 3.46264 13.3639 4.04842 13.9497C4.63421 14.5355 5.58396 14.5355 6.16975 13.9497L9.70657 10.4129C10.0726 10.0468 10.0958 9.46741 9.77563 9.07464L9.63752 8.92272C9.31734 8.52995 9.34052 7.95052 9.70657 7.58446C10.0971 7.19394 10.7303 7.19394 11.1208 7.58446C12.2924 8.75604 12.2924 10.6555 11.1208 11.8271L7.58396 15.3639C6.21712 16.7308 4.00105 16.7308 2.63421 15.3639C1.26738 13.9971 1.26738 11.781 2.63421 10.4142L3.69617 9.35223C4.08669 8.96171 4.71986 8.96171 5.11038 9.35223C5.5009 9.74275 5.5009 10.3759 5.11038 10.7664Z"/>
|
|
140
|
+
</svg>`,quote:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
141
|
+
<path d="M4.96387 4.23438C6.8769 4.23438 8.42767 5.78522 8.42773 7.69824C8.42773 8.32925 8.25769 8.92015 7.96289 9.42969L7.96387 9.43066L5.11816 14.3584C4.77659 14.95 4.02038 15.153 3.42871 14.8115C2.83701 14.4699 2.63397 13.7128 2.97559 13.1211L4.16113 11.0674C2.63532 10.7052 1.5 9.33485 1.5 7.69824C1.50006 5.78524 3.05086 4.2344 4.96387 4.23438ZM13.0361 4.23438C14.9491 4.23449 16.4999 5.7853 16.5 7.69824C16.5 8.32921 16.3299 8.92017 16.0352 9.42969L16.0361 9.43066L13.1904 14.3584C12.8488 14.9501 12.0917 15.1531 11.5 14.8115C10.9085 14.4698 10.7063 13.7127 11.0479 13.1211L12.2324 11.0674C10.7069 10.7049 9.57227 9.33461 9.57227 7.69824C9.57233 5.78522 11.1231 4.23438 13.0361 4.23438Z"/>
|
|
142
|
+
</svg>`,code:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
143
|
+
<path d="M6.29289 3.79295C6.68342 3.40243 7.31643 3.40243 7.70696 3.79295C8.09748 4.18348 8.09748 4.81649 7.70696 5.20702L3.91399 8.99999L7.70696 12.793C8.09748 13.1835 8.09748 13.8165 7.70696 14.207C7.31643 14.5975 6.68342 14.5975 6.29289 14.207L1.79289 9.70702C1.40237 9.31649 1.40237 8.68348 1.79289 8.29295L6.29289 3.79295Z"/>
|
|
144
|
+
<path d="M11.707 3.79295C11.3164 3.40243 10.6834 3.40243 10.2929 3.79295C9.90237 4.18348 9.90237 4.81649 10.2929 5.20702L14.0859 8.99999L10.2929 12.793C9.90237 13.1835 9.90237 13.8165 10.2929 14.207C10.6834 14.5975 11.3164 14.5975 11.707 14.207L16.207 9.70702C16.5975 9.31649 16.5975 8.68348 16.207 8.29295L11.707 3.79295Z"/>
|
|
145
|
+
</svg>`,ul:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
146
|
+
<path d="M3 12.5C3.82843 12.5 4.5 13.1716 4.5 14C4.5 14.8284 3.82843 15.5 3 15.5C2.17157 15.5 1.5 14.8284 1.5 14C1.5 13.1716 2.17157 12.5 3 12.5ZM15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM3 7.5C3.82843 7.5 4.5 8.17157 4.5 9C4.5 9.82843 3.82843 10.5 3 10.5C2.17157 10.5 1.5 9.82843 1.5 9C1.5 8.17157 2.17157 7.5 3 7.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM3 2.5C3.82843 2.5 4.5 3.17157 4.5 4C4.5 4.82843 3.82843 5.5 3 5.5C2.17157 5.5 1.5 4.82843 1.5 4C1.5 3.17157 2.17157 2.5 3 2.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>
|
|
147
|
+
</svg>`,ol:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
148
|
+
<path d="M15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>
|
|
149
|
+
<path d="M2.98657 16.0967C2.68042 16.0967 2.41187 16.0465 2.18091 15.9463C1.95174 15.846 1.77002 15.7046 1.63574 15.522C1.50146 15.3376 1.42448 15.1227 1.40479 14.8774L1.4021 14.8452H2.34204L2.34741 14.8748C2.35815 14.9589 2.39038 15.035 2.44409 15.103C2.49959 15.1711 2.5721 15.2248 2.66162 15.2642C2.75293 15.3035 2.86035 15.3232 2.98389 15.3232C3.10563 15.3232 3.21037 15.3027 3.2981 15.2615C3.38761 15.2185 3.45654 15.1603 3.50488 15.0869C3.55322 15.0135 3.57739 14.9294 3.57739 14.8345V14.8291C3.57739 14.6715 3.51921 14.5516 3.40283 14.4692C3.28646 14.3869 3.12085 14.3457 2.90601 14.3457H2.48706V13.677H2.90063C3.02775 13.677 3.13607 13.6582 3.22559 13.6206C3.31689 13.583 3.38672 13.5302 3.43506 13.4622C3.48519 13.3941 3.51025 13.3153 3.51025 13.2258V13.2205C3.51025 13.1256 3.48877 13.0441 3.4458 12.9761C3.40462 12.9062 3.34375 12.8534 3.26318 12.8176C3.18441 12.78 3.08952 12.7612 2.97852 12.7612C2.86572 12.7612 2.76636 12.7809 2.68042 12.8203C2.59627 12.8579 2.52913 12.9125 2.479 12.9841C2.43066 13.054 2.40112 13.1363 2.39038 13.2312L2.3877 13.2581H1.49341L1.49609 13.2205C1.514 12.977 1.58561 12.7666 1.71094 12.5894C1.83805 12.4103 2.00903 12.2725 2.22388 12.1758C2.44051 12.0773 2.69206 12.0281 2.97852 12.0281C3.27393 12.0281 3.52995 12.0728 3.74658 12.1624C3.96322 12.2501 4.13062 12.3727 4.24878 12.5303C4.36694 12.6878 4.42603 12.8722 4.42603 13.0835V13.0889C4.42603 13.2518 4.38932 13.3941 4.31592 13.5159C4.2443 13.6358 4.14762 13.7343 4.02588 13.8113C3.90592 13.8883 3.77254 13.942 3.62573 13.9724V13.9912C3.91756 14.0199 4.14941 14.1121 4.32129 14.2678C4.49316 14.4236 4.5791 14.6295 4.5791 14.8855V14.8909C4.5791 15.1344 4.51375 15.3474 4.38306 15.53C4.25236 15.7109 4.06795 15.8505 3.82983 15.949C3.59172 16.0474 3.31063 16.0967 2.98657 16.0967Z"/>
|
|
150
|
+
<path d="M1.54443 11V10.342L2.76099 9.20874C2.95076 9.03507 3.09757 8.89274 3.20142 8.78174C3.30705 8.66895 3.37956 8.57316 3.41895 8.49438C3.46012 8.41382 3.48071 8.33415 3.48071 8.25537V8.24463C3.48071 8.14795 3.46012 8.0638 3.41895 7.99219C3.37777 7.92057 3.31779 7.86507 3.23901 7.82568C3.16024 7.7863 3.06714 7.7666 2.95972 7.7666C2.84692 7.7666 2.74756 7.78988 2.66162 7.83643C2.57747 7.88298 2.51123 7.94743 2.46289 8.02979C2.41455 8.11035 2.39038 8.20345 2.39038 8.30908V8.33057L1.48804 8.32788V8.31177C1.48804 8.05396 1.5507 7.82837 1.67603 7.63501C1.80314 7.44165 1.97949 7.29126 2.20508 7.18384C2.43245 7.07463 2.69653 7.02002 2.99731 7.02002C3.28556 7.02002 3.53711 7.06836 3.75195 7.16504C3.96859 7.25993 4.13688 7.39331 4.25684 7.56519C4.37858 7.73706 4.43945 7.93758 4.43945 8.16675V8.18018C4.43945 8.3252 4.40902 8.46932 4.34814 8.61255C4.28727 8.75578 4.18701 8.90885 4.04736 9.07178C3.90771 9.23291 3.71883 9.41642 3.48071 9.62231L2.58374 10.4092L2.85498 9.98486V10.4092L2.58374 10.2319H4.49048V11H1.54443Z"/>
|
|
151
|
+
<path d="M2.84155 6V3.01367H2.79053L1.85596 3.64478V2.79614L2.84155 2.12476H3.82715V6H2.84155Z"/>
|
|
152
|
+
</svg>`,image:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
153
|
+
<path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>
|
|
154
|
+
</svg>`,attachment:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
155
|
+
<path d="M13 13.5V6C13 4.067 11.433 2.5 9.5 2.5C7.567 2.5 6 4.067 6 6V13.5C6 14.6046 6.89543 15.5 8 15.5H8.23047C9.20759 15.5 10 14.7076 10 13.7305V7C10 6.72386 9.77614 6.5 9.5 6.5C9.22386 6.5 9 6.72386 9 7V12.5C9 13.0523 8.55228 13.5 8 13.5C7.44772 13.5 7 13.0523 7 12.5V7C7 5.61929 8.11929 4.5 9.5 4.5C10.8807 4.5 12 5.61929 12 7V13.7305C12 15.8122 10.3122 17.5 8.23047 17.5H8C5.79086 17.5 4 15.7091 4 13.5V6C4 2.96243 6.46243 0.5 9.5 0.5C12.5376 0.5 15 2.96243 15 6V13.5C15 14.0523 14.5523 14.5 14 14.5C13.4477 14.5 13 14.0523 13 13.5Z"/>
|
|
156
|
+
</svg>`,table:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
157
|
+
<path d="M15 1C16.1046 1 17 1.89543 17 3V15C17 16.1046 16.1046 17 15 17H3C1.89543 17 1 16.1046 1 15V3C1 1.89543 1.89543 1 3 1H15ZM3 15H8V10H3V15ZM10 10V15H15V10H10ZM10 8H15V3H10V8ZM3 8H8V3H3V8Z"/>
|
|
158
|
+
</svg>`,hr:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
159
|
+
<path d="M12.75 12C13.1642 12 13.5 12.3358 13.5 12.75V14.25C13.5 14.6642 13.1642 15 12.75 15H5.25C4.83579 15 4.5 14.6642 4.5 14.25V12.75C4.5 12.3358 4.83579 12 5.25 12H12.75ZM15.4863 8C16.0461 8 16.5 8.44771 16.5 9C16.5 9.55229 16.0461 10 15.4863 10H2.51367C1.95392 10 1.5 9.55229 1.5 9C1.5 8.44771 1.95392 8 2.51367 8H15.4863ZM12.75 3C13.1642 3 13.5 3.33579 13.5 3.75V5.25C13.5 5.66421 13.1642 6 12.75 6H5.25C4.83579 6 4.5 5.66421 4.5 5.25V3.75C4.5 3.33579 4.83579 3 5.25 3H12.75Z"/>
|
|
160
|
+
</svg>`,undo:`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
161
|
+
<path d="M8.36612 5.36612C8.85427 4.87796 9.64554 4.87796 10.1337 5.36612C10.6218 5.85428 10.6218 6.64557 10.1337 7.13369L7.26748 9.9999H15.2499C18.1494 9.99996 20.4999 12.3504 20.4999 15.2499V19.2499C20.4999 19.9402 19.9402 20.4999 19.2499 20.4999C18.5596 20.4999 18 19.9402 17.9999 19.2499V15.2499C17.9999 13.7312 16.7686 12.5 15.2499 12.4999H7.26748L10.1337 15.3661C10.6218 15.8543 10.6218 16.6456 10.1337 17.1337C9.64557 17.6218 8.85428 17.6218 8.36612 17.1337L3.36612 12.1337C2.87796 11.6455 2.87796 10.8543 3.36612 10.3661L8.36612 5.36612Z"/>
|
|
162
|
+
</svg>`,redo:`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
163
|
+
<path d="M15.6338 5.1163C15.1456 4.62814 14.3543 4.62814 13.8662 5.1163C13.3781 5.60446 13.3781 6.39575 13.8662 6.88388L16.7324 9.75009H8.74997C5.85052 9.75014 3.49997 12.1006 3.49997 15.0001V19.0001C3.50002 19.6904 4.05969 20.25 4.74997 20.2501C5.4403 20.2501 5.99992 19.6904 5.99997 19.0001V15.0001C5.99997 13.4813 7.23123 12.2501 8.74997 12.2501H16.7324L13.8662 15.1163C13.3781 15.6045 13.3781 16.3958 13.8662 16.8839C14.3543 17.372 15.1456 17.3719 15.6338 16.8839L20.6338 11.8839C21.1219 11.3957 21.1219 10.6045 20.6338 10.1163L15.6338 5.1163Z" />
|
|
164
|
+
</svg>`,overflow:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
165
|
+
<path d="M3 6.75C4.24264 6.75 5.25 7.75736 5.25 9C5.25 10.2426 4.24264 11.25 3 11.25C1.75736 11.25 0.75 10.2426 0.75 9C0.75 7.75736 1.75736 6.75 3 6.75ZM9 6.75C10.2426 6.75 11.25 7.75736 11.25 9C11.25 10.2426 10.2426 11.25 9 11.25C7.75736 11.25 6.75 10.2426 6.75 9C6.75 7.75736 7.75736 6.75 9 6.75ZM15 6.75C16.2426 6.75 17.25 7.75736 17.25 9C17.25 10.2426 16.2426 11.25 15 11.25C13.7574 11.25 12.75 10.2426 12.75 9C12.75 7.75736 13.7574 6.75 15 6.75Z"/>
|
|
166
|
+
</svg>`},bx=class extends HTMLElement{static observedAttributes=[`connected`];#e=new ox;#t=null;constructor(){super(),this.internals=this.attachInternals(),this.internals.role=`toolbar`,this.#r()}connectedCallback(){this.requestOverflowRefresh(),this.setAttribute(`role`,`toolbar`),this.#i()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),cancelAnimationFrame(this.#t),this.editorElement=null,this.editor=null,this.selection=null,this.#t=null,this.#r()}attributeChangedCallback(e,t,n){e===`connected`&&this.isConnected&&t!=null&&t!==n&&requestAnimationFrame(()=>this.#n())}configure(e){if(typeof e==`object`&&e)for(let[t,n]of Object.entries(e))this.setAttribute(`data-${t}`,n)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#a(),this.#l(),this.#g(),this.#_(),this.#v(),this.requestOverflowRefresh(),this.#f(),this.resolveEditorPromise(e),this.toggleAttribute(`connected`,!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}requestOverflowRefresh(){this.#t??=requestAnimationFrame(()=>{this.#S(),this.#t=null})}closeDropdowns({except:e}={}){this.#N.forEach(t=>{t!==e&&t.close({focusEditor:!1})})}#n(){this.disconnectedCallback(),this.connectedCallback()}async#r(){this.editorPromise=new Promise(e=>{this.resolveEditorPromise=e}),this.editorElement=await this.editorPromise}#i(){let e=new ResizeObserver(()=>this.requestOverflowRefresh());e.observe(this),this.#e.track(()=>e.disconnect())}#a(){this.#e.track(Q(this,`click`,this.#o))}#o=e=>{this.#s(e,`[data-command]`,this.#c.bind(this))};#s(e,t,n){let r=e.target.closest(t);r&&n(e,r)}#c(e,{dataset:{command:t,payload:n}}){let r=e instanceof PointerEvent&&e.pointerId===-1;this.editor.update(()=>{this.editor.dispatchCommand(t,n)},{tag:r?on:void 0}),r||this.editor.focus()}#l(){this.#e.track(Q(this.editorElement,`keydown`,this.#u))}#u=e=>{this.querySelectorAll(`[data-hotkey]`).forEach(t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#d(e))&&(e.preventDefault(),e.stopPropagation(),t.click())})};#d(e){let 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(`+`)}#f(){this.#e.track(Q(this.editorElement,`lexxy:focus`,this.#p),Q(this.editorElement,`lexxy:blur`,this.#m),Q(this,`keydown`,this.#h))}#p=()=>{let e=this.#L.find(hx);e&&(e.tabIndex=0)};#m=()=>{this.#g()};#h=e=>{_x(this.#L,e)};#g(){this.#L.forEach(e=>{e.tabIndex=-1})}#_(){this.#e.track(this.editor.registerUpdateListener(({editorState:e})=>{e.read(()=>{this.#y(),this.closeDropdowns()})}))}#v(){this.#e.track(this.editor.registerCommand(nt,e=>{this.#x(`undo`,!e)},P),this.editor.registerCommand(tt,e=>{this.#x(`redo`,!e)},P))}#y(){let e=w();if(!O(e)||!e.anchor.getNode().getParent())return;let{isBold:t,isItalic:n,isStrikethrough:r,isUnderline:i,isHighlight:a,isInLink:o,isInQuote:s,isInHeading:c,headingTag:l,isInCode:u,isInList:d,listType:f,isInTable:p}=this.selection.getFormat();this.#b(`bold`,t),this.#b(`italic`,n),this.#b(`strikethrough`,r),this.#b(`underline`,i),this.#b(`format`,c),this.#b(`paragraph`,!c),this.querySelector(`lexxy-heading-dropdown`)?.updateActiveHeading(l),this.#b(`lists`,d),this.#b(`unordered-list`,d&&f===`bullet`),this.#b(`ordered-list`,d&&f===`number`),this.#b(`highlight`,a),this.#b(`link`,o),this.#b(`quote`,s),this.#b(`code`,u),this.#b(`table`,p)}#b(e,t){let n=this.querySelector(`[name="${e}"]`);if(n){let e=t.toString();n.getAttribute(`aria-pressed`)!==e&&n.setAttribute(`aria-pressed`,e)}}#x(e,t){let n=this.querySelector(`[name="${e}"]`);if(n){n.disabled!==t&&(n.disabled=t);let e=t.toString();n.getAttribute(`aria-disabled`)!==e&&n.setAttribute(`aria-disabled`,e)}}#S(){this.#T(),this.#C(),this.#D(),this.#O();let e=this.#F.children.length>0;this.toggleAttribute(`overflowing`,e),this.#j(),this.#w(e)}#C(){let e=Array.from(this.#F.children);e.sort((e,t)=>this.#E(t)-this.#E(e));for(let t of e){let e=this.querySelector(`[data-position="${this.#E(t)+1}"]`)??this.#P;t.removeAttribute(`role`),this.insertBefore(t,e)}}#w(e=!0){this.#F.toggleAttribute(`disabled`,!e),this.#P.style.display=e?`block`:`none`}#T(){this.#w(!1)}#E(e){return parseInt(e.dataset.position??`999`)}#D(){this.#R.forEach((e,t)=>{e.dataset.position=t})}#O(){let e=this.#k();if(e>0){this.#w();let t=this.#M(),n=t+this.#P.offsetWidth;this.#A(e+n,{gap:t})}}#k(){return this.scrollWidth-this.clientWidth}#A(e,{gap:t}){let n=this.#I,r=[],i=0;for(;i<e&&n.length;){let e=n.pop();r.push(e),e.role=`menuitem`,i+=e.offsetWidth+t}this.#F.append(...r.reverse())}#j(){this.#P.setAttribute(`nonce`,ax())}#M(){return parseFloat(window.getComputedStyle(this).columnGap)||0}get#N(){return this.querySelectorAll(`:scope .lexxy-editor__toolbar-dropdown`)}get#P(){return this.querySelector(`.lexxy-editor__toolbar-overflow`)}get#F(){return this.#P?.querySelector(`:scope > [data-dropdown-panel]`)}get#I(){return Array.from(this.querySelectorAll(`:scope > button:not([data-prevent-overflow])`))}get#L(){return Array.from(this.querySelectorAll(`:scope button`))}get#R(){return Array.from(this.querySelectorAll(`:scope > *:not(.lexxy-editor__toolbar-overflow)`))}static get defaultTemplate(){let e=px(`lexxy-link-url`);return`
|
|
167
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="image" data-command="uploadImage" data-prevent-overflow="true" title="Add images and video">
|
|
168
|
+
${yx.image}
|
|
169
|
+
</button>
|
|
170
|
+
|
|
171
|
+
<button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="file" data-command="uploadFile" title="Upload files">
|
|
172
|
+
${yx.attachment}
|
|
173
|
+
</button>
|
|
174
|
+
|
|
175
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">
|
|
176
|
+
${yx.bold}
|
|
177
|
+
</button>
|
|
178
|
+
|
|
179
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">
|
|
180
|
+
${yx.italic}
|
|
181
|
+
</button>
|
|
182
|
+
|
|
183
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">
|
|
184
|
+
${yx.strikethrough}
|
|
185
|
+
</button>
|
|
186
|
+
|
|
187
|
+
<button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="underline" data-command="underline" title="Underline">
|
|
188
|
+
${yx.underline}
|
|
189
|
+
</button>
|
|
190
|
+
|
|
191
|
+
<lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown">
|
|
192
|
+
<button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="format" title="Text formatting" aria-haspopup="menu" aria-expanded="false">
|
|
193
|
+
${yx.heading}
|
|
194
|
+
</button>
|
|
195
|
+
<div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-dropdown-list" hidden>
|
|
196
|
+
<button type="button" name="paragraph" data-command="setFormatParagraph" title="Paragraph" role="menuitem">
|
|
197
|
+
${yx.paragraph} <span>Normal</span>
|
|
198
|
+
</button>
|
|
199
|
+
<lexxy-heading-dropdown>
|
|
200
|
+
<div class="lexxy-heading-options"></div>
|
|
201
|
+
</lexxy-heading-dropdown>
|
|
202
|
+
<div class="lexxy-editor__toolbar-separator" role="separator"></div>
|
|
203
|
+
<button type="button" name="clear-formatting" data-command="clearFormatting" title="Clear formatting" role="menuitem">
|
|
204
|
+
${yx.clearFormatting} <span>Clear formatting</span>
|
|
205
|
+
</button>
|
|
206
|
+
</div>
|
|
207
|
+
</lexxy-toolbar-dropdown>
|
|
208
|
+
|
|
209
|
+
<lexxy-highlight-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--highlight">
|
|
210
|
+
<button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--chevron" type="button" name="highlight" title="Color highlight" aria-haspopup="menu" aria-expanded="false">
|
|
211
|
+
${yx.highlight}
|
|
212
|
+
</button>
|
|
213
|
+
<div data-dropdown-panel role="menu" hidden>
|
|
214
|
+
<div class="lexxy-highlight-colors"></div>
|
|
215
|
+
<button data-command="removeHighlight" type="button" class="lexxy-editor__toolbar-button lexxy-editor__toolbar-dropdown-reset" role="menuitem">Remove all coloring</button>
|
|
216
|
+
</div>
|
|
217
|
+
</lexxy-highlight-dropdown>
|
|
218
|
+
|
|
219
|
+
<lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--link">
|
|
220
|
+
<button data-dropdown-trigger class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="link" title="Link" data-hotkey="cmd+k ctrl+k" aria-haspopup="dialog" aria-expanded="false">
|
|
221
|
+
${yx.link}
|
|
222
|
+
</button>
|
|
223
|
+
<div data-dropdown-panel role="dialog" aria-label="Link" hidden>
|
|
224
|
+
<input type="url" placeholder="Enter a URL…" class="input" id="${e}">
|
|
225
|
+
<div class="lexxy-editor__toolbar-dropdown-actions">
|
|
226
|
+
<button type="button" class="lexxy-editor__toolbar-button" value="link">Link</button>
|
|
227
|
+
<button type="button" class="lexxy-editor__toolbar-button" value="unlink">Unlink</button>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</lexxy-link-dropdown>
|
|
231
|
+
|
|
232
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">
|
|
233
|
+
${yx.quote}
|
|
234
|
+
</button>
|
|
235
|
+
|
|
236
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">
|
|
237
|
+
${yx.code}
|
|
238
|
+
</button>
|
|
239
|
+
|
|
240
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">
|
|
241
|
+
${yx.ul}
|
|
242
|
+
</button>
|
|
243
|
+
<button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">
|
|
244
|
+
${yx.ol}
|
|
245
|
+
</button>
|
|
246
|
+
|
|
247
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">
|
|
248
|
+
${yx.table}
|
|
249
|
+
</button>
|
|
250
|
+
|
|
251
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">
|
|
252
|
+
${yx.hr}
|
|
253
|
+
</button>
|
|
254
|
+
|
|
255
|
+
<button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-button--push-right" type="button" name="undo" data-command="undo" title="Undo" disabled aria-disabled="true">
|
|
256
|
+
${yx.undo}
|
|
257
|
+
</button>
|
|
258
|
+
|
|
259
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo" disabled aria-disabled="true">
|
|
260
|
+
${yx.redo}
|
|
261
|
+
</button>
|
|
262
|
+
|
|
263
|
+
<lexxy-toolbar-dropdown class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-button--push-right lexxy-editor__toolbar-overflow">
|
|
264
|
+
<button data-dropdown-trigger class="lexxy-editor__toolbar-button" type="button" aria-haspopup="menu" aria-expanded="false" aria-label="Show more toolbar buttons">
|
|
265
|
+
${yx.overflow}
|
|
266
|
+
</button>
|
|
267
|
+
<div data-dropdown-panel role="menu" class="lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons" hidden></div>
|
|
268
|
+
</lexxy-toolbar-dropdown>
|
|
269
|
+
`}};function xx(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function Sx(e,t){let n;return(...r)=>(clearTimeout(n),new Promise((i,a)=>{n=setTimeout(async()=>{try{i(await e(...r))}catch(e){a(e)}},t)}))}function Cx(e){return new Promise(t=>setTimeout(t,e))}function wx(){return new Promise(requestAnimationFrame)}var Tx=class extends HTMLElement{#e=new ox;connectedCallback(){this.#r(()=>{this.#t(),this.editorReady()})}disconnectedCallback(){this.#e.dispose()}editorReady(){}onOpen(){}onClose(){}get trigger(){return this.querySelector(`:scope > [data-dropdown-trigger]`)}get panel(){return this.querySelector(`:scope > [data-dropdown-panel]`)}get toolbar(){return this.closest(`lexxy-toolbar`)}get editorElement(){return this.toolbar?.editorElement}get editor(){return this.toolbar?.editor}get isOpen(){return this.panel.hidden===!1}get isClosed(){return!this.isOpen}track(...e){this.#e.track(...e)}open(){this.isOpen||(this.trigger.setAttribute(`aria-expanded`,`true`),this.panel.hidden=!1,this.onOpen(),this.#a())}close({focusEditor:e=!0}={}){e&&this.editor?.focus(),!this.isClosed&&(this.trigger.setAttribute(`aria-expanded`,`false`),this.panel.hidden=!0,this.onClose())}#t(){this.#e.track(Q(this,`keydown`,this.#i),Q(this.trigger,`click`,this.#n))}#n=()=>{this.isOpen?this.close({focusEditor:!1}):(this.toolbar?.closeDropdowns({except:this}),this.open())};async#r(e){this.toolbar&&(await this.toolbar.getEditorElement(),this.isConnected&&this.toolbar&&e())}#i=e=>{e.key===`Escape`&&(e.stopPropagation(),this.close())};async#a(){this.#s[0]?.focus(),await this.#o()}async#o(){await wx(),this.#c.forEach((e,t)=>{e.setAttribute(`tabindex`,t===0?0:`-1`)})}get#s(){return Array.from(this.panel.querySelectorAll(`button, input`))}get#c(){return Array.from(this.panel.querySelectorAll(`button`))}};const Ex=[{label:`Large Heading`,name:`heading-large`,command:`setFormatHeadingLarge`},{label:`Medium Heading`,name:`heading-medium`,command:`setFormatHeadingMedium`},{label:`Small Heading`,name:`heading-small`,command:`setFormatHeadingSmall`}];var Dx=class e extends HTMLElement{static labelFor(e,t){if(t<Ex.length)return Ex[t].label;{let t=e.match(/^h(\d+)$/)?.[1];return t?`Heading ${t}`:e.toUpperCase()}}static nameFor(e,t){if(t<Ex.length)return Ex[t].name;{let t=e.match(/^h(\d+)$/)?.[1];return t?`heading-${t}`:`heading-${e}`}}static commandFor(e){return e<Ex.length?Ex[e].command:`applyHeadingFormat`}#e=new ox;connectedCallback(){this.style.display=`contents`,this.#i(()=>{this.#u.style.display=`contents`,this.#a(),this.#s(),this.#c()})}disconnectedCallback(){this.#e.dispose()}updateActiveHeading(e){this.#d.forEach(t=>{let n=(t.dataset.heading===e).toString();t.getAttribute(`aria-pressed`)!==n&&t.setAttribute(`aria-pressed`,n)})}get#t(){return this.closest(`lexxy-toolbar`)}get#n(){return this.#t?.editorElement}get#r(){return this.#t?.editor}async#i(e){let t=this.#t;t&&(await t.getEditorElement(),this.isConnected&&this.#t&&e())}#a(){this.#u.innerHTML=``,this.#l.forEach((e,t)=>{this.#u.appendChild(this.#o(e,t))})}#o(t,n){let r=e.labelFor(t,n),i=e.nameFor(t,n),a=yx[t]||``,o=document.createElement(`button`);return o.type=`button`,o.dataset.heading=t,o.dataset.command=e.commandFor(n),o.classList.add(`lexxy-heading-button`),o.name=i,o.title=r,o.setAttribute(`role`,`menuitem`),o.innerHTML=`${a} <span>${r}</span>`,o}#s(){this.#d.forEach(e=>{this.#e.track(Q(e,`click`,t=>{this.#r&&(t.preventDefault(),this.#r.dispatchCommand(e.dataset.command,e.dataset.heading),this.#r.focus())}))})}#c(){let{headingTag:e}=this.#r.read(()=>this.#n.selection.getFormat());this.updateActiveHeading(e??null)}get#l(){return this.#n.config.get(`headings`)}get#u(){return this.querySelector(`.lexxy-heading-options`)}get#d(){return Array.from(this.querySelectorAll(`button.lexxy-heading-button`))}};const Ox=`button.lexxy-highlight-button`,kx=Symbol(`no_style`);var Ax=class extends Tx{editorReady(){this.#t(),this.#e()}onOpen(){this.editor.getEditorState().read(()=>{this.#a(w())})}#e(){this.#s.forEach(e=>{this.track(Q(e,`click`,this.#i))})}#t(){this.#o.innerHTML=``;let e=this.editorElement.config.get(`highlight.buttons`);this.#n(`color`,e.color),this.#n(`background-color`,e[`background-color`]);let t=Math.max(e.color.length,e[`background-color`].length);this.panel.style.setProperty(`--max-colors`,t)}#n(e,t){t.forEach((t,n)=>{this.#o.appendChild(this.#r(e,t,n))})}#r(e,t,n){return $(`button`,{type:`button`,dataset:{value:t,style:e},style:`${e}: ${t}`,class:`lexxy-editor__toolbar-button lexxy-highlight-button`,name:`${e}-${n}`,role:`menuitem`})}#i=e=>{e.preventDefault();let t=e.target.closest(Ox);if(!t)return;let{style:n,value:r}=t.dataset;this.editor.dispatchCommand(`toggleHighlight`,{[n]:r}),this.close()};#a(e){if(!O(e))return;let t=Ta(e,`color`,kx),n=Ta(e,`background-color`,kx);this.#s.forEach(e=>{let r=(e.dataset.value===t||e.dataset.value===n).toString();e.getAttribute(`aria-pressed`)!==r&&e.setAttribute(`aria-pressed`,r)});let r=t!==kx||n!==kx;this.panel.querySelector(`[data-command='removeHighlight']`).disabled=!r}get#o(){return this.panel.querySelector(`.lexxy-highlight-colors`)}get#s(){return Array.from(this.panel.querySelectorAll(Ox))}},jx=class extends Tx{editorReady(){this.input=this.panel.querySelector(`input`),this.track(Q(this.input,`keydown`,this.#e),Q(this.linkButton,`click`,this.#t),Q(this.unlinkButton,`click`,this.#n))}onOpen(){this.input.value=this.#r,this.input.required=!0}onClose(){this.input.required=!1}get linkButton(){return this.panel.querySelector(`[value='link']`)}get unlinkButton(){return this.panel.querySelector(`[value='unlink']`)}#e=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.#t(e))};#t=()=>{if(!this.input.checkValidity()){this.input.reportValidity();return}this.editor.dispatchCommand(`link`,this.input.value),this.close()};#n=()=>{this.editor.dispatchCommand(`unlink`),this.close()};get#r(){return this.editor.getEditorState().read(()=>this.editorElement.selection.nearestNodeOfType(Fl)?.getURL()??``)}};function Mx(e,t){let n={...e,...t};for(let[r,i]of Object.entries(t))Nx(e[r],i)&&(n[r]=Mx(e[r],i));return n}function Nx(...e){return e.every(e=>e&&e.constructor==Object)}var Px=class{#e={};constructor(...e){this.merge(...e)}merge(...e){return this.#e=e.reduce(Mx,this.#e)}get(e){return e.split(`.`).reduce((e,t)=>e[t],this.#e)}};function Fx(e,t){return[...Array(1+t-e).keys()].map(t=>t+e)}const Ix=new Px({attachmentTagName:`action-text-attachment`,attachmentContentTypeNamespace:`actiontext`,authenticatedUploads:!1,extensions:[]}),Lx=new Px({default:{attachments:!0,markdown:!0,multiLine:!0,permittedAttachmentTypes:null,richText:!0,toolbar:{upload:`both`},headings:[`h2`,`h3`,`h4`],highlight:{buttons:{color:Fx(1,9).map(e=>`var(--highlight-${e})`),"background-color":Fx(1,9).map(e=>`var(--highlight-bg-${e})`)},permit:{color:[],"background-color":[]}}}});var Rx={global:Ix,presets:Lx,configure({global:e,...t}){e&&Ix.merge(e),Lx.merge(t)}};function zx(e){Bi.clearConfig(),Bi.setConfig(ix(e))}function Bx(e){return Bi.sanitize(e)}function Vx(e){if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**n).toFixed(2)} ${t[n]}`}function Hx(e){return e.split(`/`).pop()}function Ux(e){try{return JSON.parse(e)}catch{return e}}function Wx(e){return e?e.split(`/`)[1]:null}var Gx=class e extends xt{static getType(){return`custom_action_text_attachment`}static clone(t){return new e({...t},t.__key)}static importJSON(t){return new e({...t})}static importDOM(){return{[this.TAG_NAME]:t=>t.getAttribute(`content`)?{conversion:t=>{let n=[],r=t.previousSibling;r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(v(` `));let i=Ux(t.getAttribute(`content`));n.push(new e({sgid:t.getAttribute(`sgid`),innerHtml:i,plainText:t.textContent.trim()||mx(i),contentType:t.getAttribute(`content-type`)}));let a=t.nextSibling;return a&&a.nodeType===Node.TEXT_NODE&&/^\s/.test(a.textContent)&&n.push(v(` `)),{node:n}},priority:2}:null}}static get TAG_NAME(){return Rx.global.get(`attachmentTagName`)}constructor({tagName:t,sgid:n,contentType:r,innerHtml:i,plainText:a}={},o){super(o);let s=Rx.global.get(`attachmentContentTypeNamespace`);this.tagName=t||e.TAG_NAME,this.sgid=n,this.contentType=r||`application/vnd.${s}.unknown`,this.innerHtml=i,this.plainText=a??mx(i)}createDOM(){let e=$(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0,draggable:!0});e.dataset.lexicalNodeKey=this.__key,e.insertAdjacentHTML(`beforeend`,Bx(this.innerHtml));let t=$(`lexxy-node-delete-button`);return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return``}getReadableTextContent(){return this.plainText||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:$(this.tagName,{sgid:this.sgid,content:this.innerHtml,"content-type":this.contentType})}}exportJSON(){return{type:`custom_action_text_attachment`,version:1,tagName:this.tagName,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml,plainText:this.plainText}}decorate(){return null}};function Kx(e){return e instanceof Gx}function qx(e){return e.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Jx(e){return/^(?:[a-z0-9]+:\/\/|www\.)[^\s]+$/i.test(e)}function Yx(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}function Xx(e,t){let n=Yx(e),r=Yx(t);if(!r)return 0;let i=n.match(RegExp(`(?<![\\p{L}\\p{N}])${Qx(r)}`,`u`));return i?i.index:-1}function Zx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $x(e){return typeof e==`string`?e===`true`:!!e}var eS=class{#e;constructor(e){this.#e=e}get editorElement(){return this.#e}get editorConfig(){return this.#e.config}get enabled(){return!0}get lexicalExtension(){return null}get allowedElements(){return[]}defineExtension(...e){return F(...e)}initializeToolbar(e){}setEditorValidity(e,t){this.editorElement.setElementValidity(this,e,t)}dispose(){}};function tS(e,t=w()){if(O(t)){let{commonAncestor:n}=fe(t.focus.getNode(),t.anchor.getNode());return b(n,t=>t.is(e))}return!1}function nS(...e){let t=f();return e.forEach(e=>t.add(e.getKey())),t}function rS(e){return E(e)&&Ie(e)&&!Fe(e)}function iS(e){return(E(e)||De(e))&&!e.isParentRequired()}function aS(e){return iS(e)?e:e.getParent()?as(e,()=>e.createParentElementNode()):e.createParentElementNode().append(e)}function oS(e){return Qo(e,Pu)?.getListType()??null}function sS(e){let t=e.getRootElement();return t!==null&&t.contains(document.activeElement)}function cS(e,t=null){return t===null?cS(e,!0)||cS(e,!1):t?lS(e):Ea(e)}function lS(e){return e.offset===0}function uS(e,...t){return dS(dn,e,(e,n)=>({...e,forChild:(r,i)=>{let a=(e?.forChild??(e=>e))(r,i);if(A(a))return a=t.reduce((e,t)=>t(e,n)??e,a),a}}))}function dS(e,t,n=(e=>e)){return r=>{let i=e.importDOM()?.[t]?.(r);if(!i)return null;let a=i.conversion(r);return a&&(n(a,r)??a)}}function fS(e){let t=e.anchor.getNode(),n=E(t)?t:t.getParentOrThrow(),r=n.getChildren();if(r.length===0)return!0;let i=r[r.length-1];if(t===n.getLatest()&&e.anchor.offset===r.length||t===i)return!0;let a=r.findLastIndex(e=>D(e));return a===-1||r.indexOf(t)>a}function pS(e){if(e.getTextContent().trim()!==``)return!1;let t=e.getChildren?.();return!t||t.length===0||t.every(e=>D(e)?!0:pS(e))}function mS(e){for(let t of rs(e))if(pS(t))t.remove();else break}function hS(e){let t=e.getChildren();for(let e of t){if(De(e))return!1;if(!D(e)){if(A(e)){if(e.getTextContent().trim()!==``)return!1}else if(E(e)&&e.getTextContent().trim()!==``)return!1}}return!0}function gS(e,t){let n=[],r=!1;function i(a){if(!r){if(a===e){n.push(a.getTextContent().slice(0,t)),r=!0;return}if(E(a)){let e=a.getChildren();for(let t=0;t<e.length;t++){if(i(e[t]),r)return;let a=e[t];E(a)&&!a.isInline()&&t<e.length-1&&n.push(`
|
|
270
|
+
|
|
271
|
+
`)}}else n.push(a.getTextContent())}}return i(ye()),n.join(``)}function _S(e,t,n,r){return A(e)&&e.getTextContent()===` `&&n===r-1&&t instanceof Gx}function vS(e){let t=new Set;for(let n of e.getNodes()){let e=n.getTopLevelElement();e&&t.add(e)}for(let e of t){if(!Pe(e))continue;let t=e.getChildren();if(!t.some(D))continue;let n=[[]];for(let e of t)D(e)?(n.push([]),e.remove()):n[n.length-1].push(e);for(let t of n){if(t.length===0)continue;let n=p();t.forEach(e=>n.append(e)),e.insertBefore(n)}n.some(e=>e.length>0)&&e.remove()}}function yS(e,t=e=>e.getTopLevelElement()){Ca(e),bS(e);let n=r(e.focus,`next`),i=r(e.anchor,`previous`),a=e.isCollapsed(),o=TS(n,a),s=TS(i,a);o?.origin.is(s?.origin)&&(s=null);let c=o&&MS(o),l=(s&&MS(s))?.getNextSibling()??t(e.anchor.getNode()),u=c?.getPreviousSibling()??t(e.focus.getNode());!l||!u||Ye(ae(Be(ce(l,`next`)),ie(Be(ce(u,`previous`)),`next`)))}function bS(e){if(e.isCollapsed())return;let t=e.anchor.getNode().getTopLevelElement(),n=e.focus.getNode().getTopLevelElement();if(!(!t||!n||t.is(n))){if(SS(e.anchor,t)){let n=xS(t,`next`);n&&e.anchor.set(n.getKey(),0,`element`)}if(CS(e.focus,n)){let t=xS(n,`previous`);t&&e.focus.set(t.getKey(),t.getChildrenSize(),`element`)}Ca(e)}}function xS(e,t){let n=e;do n=t===`next`?n.getNextSibling():n.getPreviousSibling();while(n&&!E(n));return n}function SS(e,t){return wS(r(e,`next`),t)}function CS(e,t){return wS(r(e,`previous`),t)}function wS(e,t){if(Re(e)&&ke(e))return!1;let n=Be(e);for(;n&&t.isParentOf(n.origin);){if(n.getNodeAtCaret())return!1;n=n.getParentCaret()}return!0}function TS(e,t=!1){let n=e.origin.getTopLevelElement();if(!n||!Pe(n))return null;let r=(t?null:ES(e,n))??OS(e,n);return r?be(r,e.direction):null}function ES(e,t){let n;if(Ee(e)&&e.origin.is(t)||Re(e)&&ke(e.getFlipped()))n=null;else if(Le(e)&&e.getParentAtCaret().is(t))n=e;else{let r=jS(e,t);n=r?Ge(r):null}return n&&D(n.origin)?DS(n):null}function DS(e){let t=e.getNodeAtCaret();return D(t)?null:e.origin}function OS(e,t){let n=kS(e,t);if(!n)return null;for(let{origin:e}of n){if(!e.getParent().is(t))break;if(D(e))return e}return null}function kS(e,t){return e.getParentAtCaret().is(t)?e:AS(e,t)}function AS(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);)n=n.getParentCaret();return n?.origin.getParent()?.is(t)?n:null}function jS(e,t){let n=e.getSiblingCaret();for(;n&&!n.origin.getParent()?.is(t);){if(n.getNodeAtCaret())return null;n=n.getParentCaret()}return n?.origin.getParent()?.is(t)?n:null}function MS(e){let t=null;if(e.getNodeAtCaret()===null)e.origin.remove();else{let n=e.origin,r=ie(Ge(e),`next`);Ze(r),t=n.getTopLevelElement(),n.remove()}return t}function NS(e){if(e.type!==`element`)return!1;let t=e.getNode().getFirstChild();return(E(t)||De(t))&&!t.isInline()}function PS(e){return O(e)&&[e.anchor,e.focus].some(NS)}function FS(e=w()){return PS(e)?(Ve(e),!0):!1}function IS(e){let t=[...e].sort((e,t)=>e.getIndexWithinParent()-t.getIndexWithinParent()),n=[];for(let e of t){let t=n.at(-1),r=t?.at(-1);r&&r.getParent().is(e.getParent())&&r.getNextSibling()?.is(e)?t.push(e):n.push([e])}return n}const LS=vn(`REWRITE_HISTORY_COMMAND`);var RS=class extends eS{#e=null;get lexicalExtension(){return F({name:`lexxy/rewritable-history`,dependencies:[wp],register:(e,t,n)=>{let r=n.getDependency(wp).output;return this.#e=r.historyState.value,e.registerCommand(LS,e=>this.#n(e),M)}})}get historyState(){return this.#e}get#t(){let e=Array.from(this.#e.undoStack);return this.#e.current&&e.push(this.#e.current),e.concat(this.#e.redoStack)}#n(e){return this.#r(e),this.#i(e),!0}#r(e){pe().update(()=>{for(let[t,{patch:n,replace:r}]of Object.entries(e)){let e=C(t);e&&(n&&Object.assign(e.getWritable(),n),r&&e.replace(r))}},{discrete:!0,tag:this.#o()})}#i(e){let t=Object.keys(e);for(let n of this.#t){if(!this.#a(n,t))continue;let r=n.editorState=VS(n.editorState);for(let[t,{patch:n,replace:i}]of Object.entries(e)){let e=r._nodeMap.get(t);e&&(n?this.#s(r,e,n):i&&this.#c(r,e,i))}}}#a(e,t){return t.some(t=>e.editorState._nodeMap.has(t))}#o(){let e=[Dt,sn];return sS(this.editorElement.editor)||e.push(on),e}#s(e,t,n){e._nodeMap.set(t.__key,zS(t,n))}#c(e,t,n){e._nodeMap.set(t.__key,BS(n,t))}};function zS(e,t){let n=a(e);return Object.assign(n,t),n}function BS(e,t){let n=a(e);return n.__key=t.__key,n.__parent=t.__parent,n.__prev=t.__prev,n.__next=t.__next,n}function VS(e){let t=e.clone();return t._nodeMap=new Map(e._nodeMap),t}var HS=class e extends xt{static getType(){return`action_text_attachment`}static clone(t){return new e({...t},t.__key)}static importJSON(t){return new e({...t})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:t=>({node:new e({sgid:t.getAttribute(`sgid`),src:t.getAttribute(`url`),previewable:t.getAttribute(`previewable`),altText:t.getAttribute(`alt`),caption:t.getAttribute(`caption`),contentType:t.getAttribute(`content-type`),fileName:t.getAttribute(`filename`),fileSize:t.getAttribute(`filesize`),width:t.getAttribute(`width`),height:t.getAttribute(`height`)})}),priority:1}),img:()=>({conversion:t=>{let n=Hx(t.getAttribute(`src`)??``);return{node:new e({src:t.getAttribute(`src`),fileName:n,caption:t.getAttribute(`alt`)||``,contentType:`image/*`,width:t.getAttribute(`width`),height:t.getAttribute(`height`)})}},priority:1}),video:()=>({conversion:t=>{let n=t.getAttribute(`src`)||t.querySelector(`source`)?.src,r=n?.split(`/`)?.pop(),i=t.querySelector(`source`)?.getAttribute(`content-type`)||`video/*`;return{node:new e({src:n,fileName:r,contentType:i})}},priority:1})}}static get TAG_NAME(){return Rx.global.get(`attachmentTagName`)}constructor({tagName:t,sgid:n,src:r,previewSrc:i,previewable:a,previewStatusUrl:o,pendingPreview:s,altText:c,caption:l,contentType:u,fileName:d,fileSize:f,width:p,height:m,uploadError:h}={},g){super(g),this.tagName=t||e.TAG_NAME,this.sgid=n,this.src=r,this.previewSrc=i,this.previewable=$x(a),this.previewStatusUrl=o,this.pendingPreview=s,this.altText=c||``,this.caption=l||``,this.contentType=u||``,this.fileName=d||``,this.fileSize=f,this.width=p,this.height=m,this.uploadError=h,this.editor=pe()}createDOM(){if(this.uploadError)return this.createDOMForError();if(this.pendingPreview)return this.#e();let e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#t()),e.appendChild(this.#h())):this.isVideo?(e.appendChild(this.#p()),e.appendChild(this.#h())):(e.appendChild(this.#p()),e.appendChild(this.#m())),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;let n=t.querySelector(`figcaption textarea`);return n&&this.caption&&(n.value=this.caption),!1}getTextContent(){return`[${this.caption||this.fileName}]\n\n`}isInline(){return this.isAttached()&&!this.getParent().is(he(this))}exportDOM(){return{element:$(this.tagName,{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:`gallery`})}}exportJSON(){return{type:`action_text_attachment`,version:1,tagName:this.tagName,sgid:this.sgid,src:this.src,previewable:this.previewable,previewStatusUrl:this.previewStatusUrl,pendingPreview:this.pendingPreview,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createDOMForError(){let e=this.createAttachmentFigure();return e.classList.add(`attachment--error`),e.appendChild($(`div`,{innerText:`Error uploading ${this.fileName||`file`}`})),e}createAttachmentFigure(e=this.isPreviewableAttachment){let t=lx(this.contentType,e,this.fileName);t.draggable=!0,t.dataset.lexicalNodeKey=this.__key;let n=$(`lexxy-node-delete-button`);return t.appendChild(n),t}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return ux(this.contentType)}get isVideo(){return this.contentType.startsWith(`video/`)}#e(){let e=this.createAttachmentFigure(!1);return e.appendChild(this.#p()),e.appendChild(this.#m()),this.#s(e),e}patchAndRewriteHistory(e){this.editor.dispatchCommand(LS,{[this.getKey()]:{patch:e}})}replaceAndRewriteHistory(e){this.editor.dispatchCommand(LS,{[this.getKey()]:{replace:e}})}#t(e={}){let t=$(`img`,{src:this.previewSrc||this.src,draggable:!1,alt:this.altText,...this.#f,...e});this.previewable&&!this.isPreviewableImage&&(t.onerror=()=>this.#o(t)),this.previewSrc&&this.#n(t);let n=$(`div`,{className:`attachment__container`});return n.appendChild(t),n}#n(e){let t=this.previewSrc,n=new Image;n.onload=()=>this.#r(e,t),n.onerror=()=>this.#i(t),n.src=this.src}#r(e,t){e.src=this.src,this.patchAndRewriteHistory({previewSrc:null}),this.#a(t)}#i(e){this.patchAndRewriteHistory({previewSrc:null,uploadError:!0}),this.#a(e)}#a(e){e?.startsWith(`blob:`)&&URL.revokeObjectURL(e)}#o(e){let t=e.closest(`figure.attachment`);t&&this.#d(t,`attachment--preview`,`attachment--file`,()=>{t.appendChild(this.#p()),t.appendChild(this.#m())})}#s(e){this.previewStatusUrl?this.#c(e):this.#l(e)}#c(e){let t=0,n=async()=>{if(this.editor.read(()=>this.isAttached()))try{let t=await fetch(this.previewStatusUrl,{credentials:`include`,redirect:`manual`});if(!this.editor.read(()=>this.isAttached()))return;t.ok?r():this.#u(e,this.src)}catch{r()}},r=()=>{if(t++,t<20&&this.editor.read(()=>this.isAttached())){let e=Math.min(2e3*1.5**t,12e4);setTimeout(n,e)}};setTimeout(n,3e3)}#l(e){let t=new Image;t.onload=()=>{this.editor.read(()=>this.isAttached())&&this.#u(e,this.src)},t.onerror=()=>{this.editor.read(()=>this.isAttached())&&this.patchAndRewriteHistory({pendingPreview:!1})},t.src=this.src}#u(e,t){this.#d(e,`attachment--file`,`attachment--preview`,()=>{let n=$(`img`,{src:t,draggable:!1,alt:this.altText});n.onerror=()=>this.#o(n);let r=$(`div`,{className:`attachment__container`});r.appendChild(n),e.appendChild(r),e.appendChild(this.#h())}),this.patchAndRewriteHistory({pendingPreview:!1})}#d(e,t,n,r){e.className=e.className.replace(t,n);for(let t of[...e.querySelectorAll(`.attachment__container, .attachment__icon, figcaption`)])t.remove();r()}get#f(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#p(){return $(`span`,{className:`attachment__icon`,textContent:`${this.fileName?this.fileName.split(`.`).pop().toLowerCase():`unknown`}`})}#m(){let e=$(`figcaption`,{className:`attachment__caption`}),t=$(`strong`,{className:`attachment__name`,textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){let t=$(`span`,{className:`attachment__size`,textContent:Vx(this.fileSize)});e.appendChild(t)}return e}#h(){let e=$(`figcaption`,{className:`attachment__caption`}),t=$(`textarea`,{value:this.caption,placeholder:this.fileName,rows:`1`});return t.addEventListener(`focusin`,()=>t.placeholder=`Add caption...`),t.addEventListener(`blur`,e=>this.#g(e)),t.addEventListener(`keydown`,e=>this.#v(e)),t.addEventListener(`copy`,e=>e.stopPropagation()),t.addEventListener(`cut`,e=>e.stopPropagation()),t.addEventListener(`paste`,e=>e.stopPropagation()),e.appendChild(t),e}#g(e){this.#_(e.target)}#_(e){e.placeholder=this.fileName,this.editor.update(()=>{this.getWritable().caption=e.value})}#v(e){e.key===`Enter`&&(e.preventDefault(),e.target.blur(),this.editor.update(()=>{this.selectNext(0,0)},{tag:Dt})),e.stopPropagation()}};function US(...e){return new HS(...e)}function WS(e){return e instanceof HS}function GS(e,t){return e.filter(e=>!KS(e,t)).map(e=>(Jo([e],e=>KS(e,t)).forEach(e=>e.remove()),e))}function KS(e,t){return(e instanceof Gx||e instanceof HS)&&!t.permitsAttachmentContentType(e.contentType)}function qS(e,t){let n=e.map(e=>JS(e)?YS(e,t):e).filter(e=>e!==null);for(let e of n)for(let n of Jo([e],JS)){let e=YS(n,t);e?n.replace(e):n.remove()}return n}function JS(e){return e instanceof HS&&/^data:image\/[^,]*;base64,/i.test(e.src??``)}function YS(e,t){let n=XS(e.src);return n&&t.acceptsFile(n)?t.contents.$createUploadNode(n):null}function XS(e){try{let[t,n]=e.split(`,`),r=t.match(/^data:(image\/[A-Za-z0-9][A-Za-z0-9!#$&\-^_.+]*)/)?.[1];if(r){let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0)),t=Wx(r)??`png`;return new File([e],`pasted-image-${Date.now()}.${t}`,{type:r})}return null}catch{return null}}var ZS=class e extends xt{static getType(){return`horizontal_divider`}static clone(t){return new e(t.__key)}static importJSON(t){return new e}static importDOM(){return{hr:t=>({conversion:()=>({node:new e}),priority:1})}}constructor(e){super(e)}createDOM(){let e=$(`figure`,{className:`horizontal-divider`}),t=$(`hr`);e.appendChild(t);let n=$(`lexxy-node-delete-button`);return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return`┄
|
|
272
|
+
|
|
273
|
+
`}isInline(){return!1}exportDOM(){return{element:$(`hr`)}}exportJSON(){return{type:`horizontal_divider`,version:1}}decorate(){return null}};const QS={dependencies:[ZS],export:e=>e instanceof ZS?`---`:null,regExpStart:/^-{3,}\s?$/,replace:(e,t,n,r,i,a)=>{let o=new ZS;if(e.replace(o),!a){let e=p();o.insertAfter(e),e.select()}},type:`multiline-element`},$S=/[^\w]/;function eC(e,t){let n=t.filter(e=>e.type===`text-format`).sort((e,t)=>t.tag.length-e.tag.length);return e.registerUpdateListener(({tags:t,dirtyLeaves:r,editorState:i,prevEditorState:a})=>{if(t.has(`historic`)||t.has(`collaboration`)||e.isComposing())return;let o=i.read(w),s=a.read(w);if(!O(s)||!O(o)||!o.isCollapsed())return;let c=o.anchor.key,l=o.anchor.offset;if(!r.has(c))return;let u=i.read(()=>C(c));if(!A(u)||l<=(s.anchor.key===c?s.anchor.offset:0))return;let d=i.read(()=>u.getTextContent());for(let t of n){let n=t.tag,r=n.length,i=l-r;if(i<0||d.slice(i,l)!==n)continue;let a=n[0];if(i>0&&d[i-1]===a)continue;if(t.intraword===!1&&i>0){let e=d[i-1];if(e&&!$S.test(e))continue}let o=l,s=d.indexOf(n,o);if(s<0||d[s+r]===a||s>0&&d[s-1]===a)continue;let u=l,f=s;if(!(f<=u)&&d[u]!==` `&&d[f-1]!==` `){if(t.intraword===!1){let e=d[s+r];if(e&&!$S.test(e))continue}e.update(()=>{let e=C(c);if(!e||!A(e))return;let n=e.getParent();n===null||Ih(n)||tC(e,i,t)});break}}})}function tC(e,t,n){let r=n.tag,i=r.length,a=e.getTextContent(),o=t+i,s=a.indexOf(r,o);if(s<0)return;let c=a.slice(o,s);if(c.length===0)return;let l=a.slice(0,t),u=a.slice(s+i);e.setTextContent(l+c+u);let d=h();j(d),d.anchor.set(e.getKey(),t,`text`),d.focus.set(e.getKey(),t+c.length,`text`);for(let e of n.format)d.hasFormat(e)||d.formatText(e);d.anchor.set(d.focus.key,d.focus.offset,d.focus.type);for(let e of n.format)d.hasFormat(e)&&d.toggleFormat(e)}var nC={text:{bold:`lexxy-content__bold`,italic:`lexxy-content__italic`,strikethrough:`lexxy-content__strikethrough`,underline:`lexxy-content__underline`,highlight:`lexxy-content__highlight`},tableCellHeader:`lexxy-content__table-cell--header`,tableCellSelected:`lexxy-content__table-cell--selected`,tableSelection:`lexxy-content__table--selection`,tableScrollableWrapper:`lexxy-content__table-wrapper`,tableCellHighlight:`lexxy-content__table-cell--highlight`,tableCellFocus:`lexxy-content__table-cell--focus`,list:{nested:{listitem:`lexxy-nested-listitem`}},codeHighlight:{addition:`code-token__selector`,atrule:`code-token__attr`,attr:`code-token__attr`,"attr-name":`code-token__attr`,"attr-value":`code-token__selector`,boolean:`code-token__property`,bold:`code-token__variable`,builtin:`code-token__selector`,cdata:`code-token__comment`,char:`code-token__selector`,class:`code-token__function`,"class-name":`code-token__function`,color:`code-token__property`,comment:`code-token__comment`,constant:`code-token__property`,coord:`code-token__comment`,decorator:`code-token__function`,deleted:`code-token__operator`,deletion:`code-token__operator`,directive:`code-token__attr`,"directive-hash":`code-token__property`,doctype:`code-token__comment`,entity:`code-token__operator`,function:`code-token__function`,hexcode:`code-token__property`,important:`code-token__function`,inserted:`code-token__selector`,italic:`code-token__comment`,keyword:`code-token__attr`,line:`code-token__selector`,namespace:`code-token__variable`,number:`code-token__property`,macro:`code-token__function`,operator:`code-token__operator`,parameter:`code-token__variable`,prolog:`code-token__comment`,property:`code-token__property`,punctuation:`code-token__punctuation`,"raw-string":`code-token__operator`,regex:`code-token__variable`,script:`code-token__function`,selector:`code-token__selector`,string:`code-token__selector`,style:`code-token__function`,symbol:`code-token__property`,tag:`code-token__property`,title:`code-token__function`,"type-definition":`code-token__function`,url:`code-token__operator`,variable:`code-token__variable`}},rC=class{#e=new Map;track(e,t){this.#e.set(e,t)}forget(e){this.#e.delete(e)}abort(e){let t=this.#e.get(e);t&&(this.#e.delete(e),t.abort())}clear(){this.#e.clear()}};let iC=null;function aC(){return iC&&iC.isConnected?iC:(iC=document.createElement(`div`),iC.setAttribute(`aria-hidden`,`true`),iC.setAttribute(`data-lexxy-style-resolver`,``),iC.style.cssText=`contain: strict; position: fixed; top: 0; left: 0; visibility: hidden; pointer-events: none; width: 0; height: 0;`,document.body.appendChild(iC),iC)}function oC(e){return O(e)?e.isCollapsed()?cC(e.style):e.hasFormat(`highlight`):!1}function sC(e){if(!O(e))return null;let t=Fa(e.style);if(!t.color&&!t[`background-color`]){let n=e.anchor.getNode();A(n)&&(t=Fa(n.getStyle()))}let n=t.color||null,r=t[`background-color`]||null;return!n&&!r?null:{color:n,backgroundColor:r}}function cC(e){let t=typeof e==`string`?Fa(e):e;return!!(t.color||t[`background-color`])}function lC(e,t=[]){return t.reduce((e,t)=>t.applyCanonicalization(e),e)}var uC=class{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#e}applyCanonicalization(e){let t={...Fa(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Pa(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#t(e)}get#e(){return this._allowedValues.reduce((e,t)=>({...e,[t]:t}),{})}#t(e){let t=this.#n.indexOf(e);return t===-1&&(t=this.#n.indexOf(dC(this._property,[e])[0])),t===-1?null:this._allowedValues[t]}get#n(){return this._computedAllowedValues||=dC(this._property,this._allowedValues)}};function dC(e,t){let n=document.createDocumentFragment(),r=t.map(t=>{let r=$(`span`,{style:`display: none; ${e}: ${t};`});return n.appendChild(r),r});aC().appendChild(n);let i=r.map(t=>window.getComputedStyle(t).getPropertyValue(e));return r.forEach(e=>e.remove()),i}const fC=vn(),pC=vn(),mC={color:null,"background-color":null},hC=bn(`hasPastedStyles`,{parse:e=>e||!1}),gC=new WeakMap;var _C=class extends eS{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[F({dependencies:[pp],name:`lexxy/highlight`,config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:yC}},register(e,t){let n=NC(t);return bC(e),ds(e.registerCommand(fC,t=>PC(e,t),ct),e.registerCommand(pC,()=>PC(e,mC),ct),e.registerNodeTransform(dn,VC),e.registerNodeTransform(Rh,HC),e.registerNodeTransform(dn,e=>UC(e,n)))}}),this.editorConfig.get(`highlight`)]}};function vC(e,t){let n={color:t.style?.color,"background-color":t.style?.backgroundColor};Ce(Zt)&&WC(e);let r=Pa(n);if(r.length)return e.setStyle(e.getStyle()+r)}function yC(){return{conversion:uS(`mark`,vC),priority:1}}function bC(e){if(!e._htmlConversions)return;let t=e._htmlConversions.get(`pre`);t||(t=[],e._htmlConversions.set(`pre`,t)),t.push(xC(e))}function xC(e){return function(t){let n=SC(t);return n.length===0?null:{conversion:t=>{let r=t.getAttribute(`data-language`),i=Ph(r);return CC(e).set(i.getKey(),n),{node:i}},priority:2}}}function SC(e){let t=[],n=e.querySelector(`code`)||e,r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if(e.tagName===`BR`){r+=1;return}let n=e.tagName===`MARK`,a=r;for(let t of e.childNodes)i(t);if(n){let n=wC(e);n&&t.push({start:a,end:r,style:n})}}}for(let e of n.childNodes)i(e);return t}function CC(e){let t=gC.get(e);return t||(t=new Map,gC.set(e,t)),t}function wC(e){let t={};e.style?.color&&(t.color=e.style.color),e.style?.backgroundColor&&(t[`background-color`]=e.style.backgroundColor);let n=Pa(t);return n.length>0?n:null}function TC(e){return{defaultLanguage:Bh.defaultLanguage,tokenize(e,t){return Bh.tokenize(e,t)},$tokenize(t,n){return DC(Bh.$tokenize(t,n),EC(e,t))}}}function EC(e,t){let n=CC(e),r=t.getKey();if(n.has(r)){let e=n.get(r);return n.delete(r),e}return t.getChildren().some(Fh)?MC(t):[]}function DC(e,t){if(t.length===0)return e;let n=[],r=0;for(let i of e)Fh(i)?n.push(...OC(i,r,t)):n.push(i),r+=i.getTextContentSize();return n}function OC(e,t,n){let r=e.getTextContent(),i=kC(r,t,n);if(i.length===1){let[t]=i;return t.style&&AC(e,t.style),[e]}return i.map(t=>{let n=Nh(r.slice(t.start,t.end),e.getHighlightType());return t.style&&AC(n,t.style),n})}function kC(e,t,n){let r=[],i=0;for(let{start:a,end:o,style:s}of n){let n=Math.max(a-t,i),c=Math.min(o-t,e.length);n<c&&(n>i&&r.push({start:i,end:n,style:null}),r.push({start:n,end:c,style:s}),i=c)}return i<e.length&&r.push({start:i,end:e.length,style:null}),r}function AC(e,t){e.setStyle(t),zC(e,!0)}function jC(e){let t=[],n=0;for(let r of e.getChildren())if(Fh(r)||A(r)){let e=r.getTextContent();t.push({node:r,start:n,end:n+e.length}),n+=e.length}else n+=1;return t}function MC(e){let t=[],n=jC(e);for(let{node:e,start:r,end:i}of n){let n=e.getStyle();n&&cC(n)&&t.push({start:r,end:i,style:n})}return t}function NC(e){return[new uC(`color`,[...e.buttons.color,...e.permit.color]),new uC(`background-color`,[...e.buttons[`background-color`],...e.permit[`background-color`]])]}function PC(e,t){let n=w();if(!O(n))return;let r={};for(let e in t)r[e]=BC(Ta(n,e),t[e]);FC(n)?IC(e,n,r):ka(n,r)}function FC(e){return e.getNodes().some(e=>Fh(e)||A(e)?Ih(e.getParent()):Ih(e))}function IC(e,t,n){let r=t.getNodes().filter(e=>(Fh(e)||A(e))&&Ih(e.getParent())).map(e=>({key:e.getKey(),startOffset:LC(e,t)[0],endOffset:LC(e,t)[1],textSize:e.getTextContentSize()}));e.update(()=>{for(let{key:e,startOffset:t,endOffset:i,textSize:a}of r){let r=C(e);if(!r)continue;let o=r.getParent();if(Ih(o)&&t!==i)if(t===0&&i===a)RC(r,n);else{let e=r.splitText(t,i)[t===0?0:1];RC(e,n)}}},{skipTransforms:!0,discrete:!0})}function LC(e,t){let n=e.getKey(),r=t.anchor.key,i=t.focus.key,a=e.getTextContentSize(),o=n===r,s=n===i,c=t.isBackward()===!1,l=0,u=a;return c?(o&&(l=t.anchor.offset),s&&(u=t.focus.offset)):(s&&(l=t.focus.offset),o&&(u=t.anchor.offset)),[l,u]}function RC(e,t){let n={...Fa(e.getStyle())};for(let[e,r]of Object.entries(t))r===null?delete n[e]:n[e]=r;let r=Pa(n);e.setStyle(r);let i=cC(r);i!==e.hasFormat(`highlight`)&&zC(e,i)}function zC(e,t){let n=e.getWritable();t?n.__format|=128:n.__format&=-129}function BC(e,t){return e===t?null:t}function VC(e){cC(e.getStyle())!==e.hasFormat(`highlight`)&&e.toggleFormat(`highlight`)}function HC(e){let t=e.getParent();if(!Ih(t))return;let n=cC(e.getStyle());n!==e.hasFormat(`highlight`)&&zC(e,n)}function UC(e,t=[]){if(GC(e)){WC(e,!1);let n=lC(e.getStyle(),t);e.setStyle(n);let r=w();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}function WC(e,t=!0){Xe(e,hC,t)}function GC(e){return T(e,hC)}const KC=[`bold`,`italic`,`strikethrough`,`underline`,`link`,`unlink`,`toggleHighlight`,`removeHighlight`,`setFormatHeadingLarge`,`setFormatHeadingMedium`,`setFormatHeadingSmall`,`setFormatParagraph`,`applyHeadingFormat`,`clearFormatting`,`insertUnorderedList`,`insertOrderedList`,`insertQuoteBlock`,`insertCodeBlock`,`setCodeLanguage`,`insertHorizontalDivider`,`uploadImage`,`uploadFile`,`insertTable`,`undo`,`redo`];var qC=class e{#e=null;#t=new ox;static configureFor(t){return new e(t)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.#o(),this.#c(),this.#d()}dispatchBold(){this.editor.dispatchCommand(Tt,`bold`)}dispatchItalic(){this.editor.dispatchCommand(Tt,`italic`)}dispatchStrikethrough(){this.editor.dispatchCommand(Tt,`strikethrough`)}dispatchUnderline(){this.editor.dispatchCommand(Tt,`underline`)}dispatchToggleHighlight(e){this.editor.dispatchCommand(fC,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand(pC)}dispatchLink(e){this.editor.update(()=>{let t=w();if(!O(t))return;let n=t.anchor.getNode();if(t.isCollapsed()&&!Qo(n,Fl)){let n=kl(e),r=v(e);n.append(r),t.insertNodes([n])}else Nl(e)})}dispatchUnlink(){this.editor.update(()=>{this.editorElement.adapter.unlinkFrozenNode?.()||Nl(null)})}dispatchInsertUnorderedList(){let e=w();if(!O(e))return;let t=e.anchor.getNode();this.selection.isInsideList&&t&&oS(t)===`bullet`?this.contents.applyParagraphFormat():this.contents.applyUnorderedListFormat()}dispatchInsertOrderedList(){let e=w();if(!O(e))return;let t=e.anchor.getNode();this.selection.isInsideList&&t&&oS(t)===`number`?this.contents.applyParagraphFormat():this.contents.applyOrderedListFormat()}dispatchInsertQuoteBlock(){this.contents.toggleBlockquote()}dispatchInsertCodeBlock(){this.selection.hasSelectedWordsInSingleLine?this.#n():this.contents.toggleCodeBlock()}#n(){let e=w();if(O(e)){if(!e.isCollapsed()){let t=e.getNodes().filter(A);t.every(e=>e.hasFormat(`code`))||this.#r(e,t)}this.editor.dispatchCommand(Tt,`code`)}}#r(e,t){let n=e.isBackward(),r=n?e.focus:e.anchor,i=n?e.anchor:e.focus;for(let e=0;e<t.length;e++){let n=t[e];if(n.getFormat()===0)continue;let a=e===0,o=e===t.length-1,s=a&&r.type===`text`?r.offset:0,c=o&&i.type===`text`?i.offset:n.getTextContentSize();if(s===0&&c===n.getTextContentSize())n.setFormat(0);else{let e=n.splitText(s,c),t=s===0?e[0]:e[1];t.setFormat(0),a&&r.type===`text`&&r.set(t.getKey(),0,`text`),o&&i.type===`text`&&i.set(t.getKey(),c-s,`text`)}}}dispatchSetCodeLanguage(e){this.editor.update(()=>{if(!this.selection.isInsideCodeBlock)return;let t=this.selection.nearestNodeOfType(zh);t&&t.setLanguage(e)})}dispatchInsertHorizontalDivider(){ts(new ZS)}dispatchSetFormatHeadingLarge(){this.#a(0)}dispatchSetFormatHeadingMedium(){this.#a(1)}dispatchSetFormatHeadingSmall(){this.#a(2)}dispatchSetFormatParagraph(){this.contents.applyParagraphFormat()}dispatchApplyHeadingFormat(e){this.contents.applyHeadingFormat(e)}dispatchClearFormatting(){this.contents.clearFormatting()}dispatchUploadImage(){this.#i(`image/*,video/*`)}dispatchUploadFile(){this.#i()}#i(e=null){let t={type:`file`,multiple:!0,style:`display: none;`,onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}};e&&(t.accept=e);let n=$(`input`,t);this.editorElement.appendChild(n),n.click(),setTimeout(()=>n.remove(),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(Sy,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(fn,void 0)}dispatchRedo(){this.editor.dispatchCommand($t,void 0)}dispose(){this.#t.dispose()}#a(e){let t=this.editorElement.config.get(`headings`)[e];t&&this.contents.applyHeadingFormat(t)}#o(){for(let e of KC){let t=`dispatch${JC(e)}`;this.#s(e,0,this[t].bind(this))}}#s(e,t,n){this.#t.track(this.editor.registerCommand(e,n,t))}#c(){this.#s(Lt,ct,this.#u.bind(this)),this.#s(Gt,ct,this.#y.bind(this)),this.#s(jt,N,this.#l.bind(this)),this.#s(Mt,N,this.#l.bind(this))}#l(){return FS(),!1}#u(e){let t=w();if(!O(t)||!t.isCollapsed()||this.selection.isInsideCodeBlock||!t.hasFormat(`code`))return!1;let n=t.anchor.getNode();return!A(n)||t.anchor.offset!==n.getTextContentSize()||n.getNextSibling()!==null?!1:(e.preventDefault(),t.toggleFormat(`code`),!0)}#d(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.#t.track(this.editor.registerRootListener(e=>{if(e){let t=[Q(e,`dragover`,this.#m.bind(this)),Q(e,`drop`,this.#h.bind(this)),Q(e,`dragenter`,this.#f.bind(this)),Q(e,`dragleave`,this.#p.bind(this))];return()=>t.forEach(e=>e())}})))}#f(e){this.#v(e)||(this.dragCounter++,this.dragCounter===1&&(this.#g(),this.editor.getRootElement().classList.add(`lexxy-editor--drag-over`)))}#p(e){this.#v(e)||(this.dragCounter--,this.dragCounter===0&&(this.#e=null,this.editor.getRootElement().classList.remove(`lexxy-editor--drag-over`)))}#m(e){this.#v(e)||e.preventDefault()}#h(e){if(this.#v(e))return;e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove(`lexxy-editor--drag-over`);let t=e.dataTransfer;if(!t)return;let n=Array.from(t.files);n.length&&(this.#_(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#g(){this.editor.getEditorState().read(()=>{this.#e=w()?.clone()})}#_(){this.#e&&=(this.editor.update(()=>{j(this.#e)}),null)}#v(e){return e.dataTransfer?.types.some(e=>e.startsWith(`application/x-lexxy-`))}#y(e){return this.selection.isInsideList?this.#b(e):this.selection.isInsideCodeBlock?this.#x():!1}#b(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();let t=e.shiftKey?Yt:kt;return this.editor.dispatchCommand(t)}#x(){let e=w();return O(e)&&e.isCollapsed()}};function JC(e){return e.charAt(0).toUpperCase()+e.slice(1)}var YC=class{#e=new ox;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#s(),this.#i(),this.#c(),this.#n()}get hasNodeSelection(){return this.editor.getEditorState().read(()=>{let e=w();return e!==null&&Ne(e)})}get cursorPosition(){let e=null;return this.editor.getEditorState().read(()=>{let t=this.#j();if(!t)return;let n=this.#M(t);this.#N(n)||(e=this.#L(n,t))}),e}placeCursorAtTheEnd(){this.editor.update(()=>{let e=ye(),t=e.getLastDescendant();t&&A(t)?t.selectEnd():e.selectEnd()})}selectedNodeWithOffset(){let e=w();if(!e)return{node:null,offset:0};if(O(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(Ne(e)){let[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}getFormat(){let e=w();if(!O(e))return{};let t=e.anchor.getNode();if(!t.getParent())return{};let n=t.getTopLevelElementOrThrow(),r=oS(t),i=this.#C(t);return{isBold:e.hasFormat(`bold`),isItalic:e.hasFormat(`italic`),isStrikethrough:e.hasFormat(`strikethrough`),isUnderline:e.hasFormat(`underline`),isHighlight:oC(e),isInLink:Qo(t,Fl)!==null,isInQuote:up(n),isInHeading:i!==null,isInCode:this.#t(e,t),headingTag:i?.getTag()??null,isInList:r!==null,listType:r,isInTable:_y(t)!==null}}nearestNodeOfType(e){let t=w()?.anchor?.getNode();return Qo(t,e)}get hasSelectedWordsInSingleLine(){let e=w();if(!O(e)||e.isCollapsed())return!1;let t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;let r=t.getTopLevelElement();if(!r)return!1;let i=E(t)?t:t.getParent();if(i!==(E(n)?n:n.getParent())&&i!==r)return!1;let a=e.getNodes();for(let e of a)if(D(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(Nu)}get isInsideBlockQuote(){return this.nearestNodeOfType(fp)}get isIndentedList(){let e=this.nearestNodeOfType(Pu);return e&&Ou(e)>1}get isInsideCodeBlock(){return this.nearestNodeOfType(zh)!==null}get isTableCellSelected(){let e=w(),{anchor:t,focus:n}=e;return!O(e)||t.key!==n.key?!1:this.nearestNodeOfType(wy)!==null}get isOnPreviewableImage(){return this.previewableImageNode!=null}get previewableImageNode(){let e=w()?.getNodes().at(0);return WS(e)&&e.isPreviewableImage?e:null}get isAtNodeStart(){let{anchorNode:e,offset:t}=this.#B();return e&&t===0}get nodeAfterCursor(){let{anchorNode:e,offset:t}=this.#B();return e?A(e)?this.#V(e,t):E(e)?this.#U(e,t):this.#q(e):null}get topLevelNodeAfterCursor(){let{anchorNode:e,offset:t}=this.#B();if(!e)return null;if(A(e)){if(t===e.getTextContentSize())return this.#H(e);if(this.#X(e)){let t=e.getTopLevelElement();return t?t.getNextSibling():null}return null}return E(e)?this.#U(e,t):this.#q(e)}get nodeBeforeCursor(){let{anchorNode:e,offset:t}=this.#B();return e?A(e)?this.#W(e,t):E(e)?this.#K(e,t):this.#J(e):null}get topLevelNodeBeforeCursor(){let{anchorNode:e,offset:t}=this.#B();if(!e)return null;if(A(e)){if(t===0)return this.#G(e);if(this.#Y(e)){let t=e.getTopLevelElement();return t?t.getPreviousSibling():null}return null}return E(e)?this.#K(e,t):this.#J(e)}dispose(){this.editorElement=null,this.editorContentElement=null,this.editor=null,this.previouslySelectedKeys=null,this.#e.dispose()}#t(e,t){return Qo(t,zh)===null?e.hasFormat(`code`)?A(t)&&t.hasFormat(`code`):!1:!0}#n(){this.#e.track(this.editor.registerUpdateListener(({editorState:e,tags:t})=>{if(t.has(`history-merge`)||t.has(`skip-dom-selection`))return;let n=!1;e.read(()=>{let e=w();if(!O(e)||!e.isCollapsed()||!e.hasFormat(`code`))return;let t=e.anchor.getNode();this.#t(e,t)||(n=!0)}),n&&setTimeout(()=>{this.editor.update(()=>{let e=w();if(!O(e)||!e.hasFormat(`code`))return;let t=e.anchor.getNode();this.#t(e,t)||e.toggleFormat(`code`)})},0)}))}get#r(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;let e=w();if(e&&Ne(e))for(let t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#i(){this.#e.track(this.editor.registerCommand(It,sx(this.#p.bind(this)),P),this.editor.registerCommand(Lt,sx(this.#m.bind(this)),P),this.editor.registerCommand(Rt,sx(this.#h.bind(this)),P),this.editor.registerCommand(Ft,sx(this.#g.bind(this)),P),this.editor.registerCommand(ht,this.#D.bind(this),P),this.editor.registerCommand(nn,()=>{this.#u()},P),this.editor.registerCommand(nn,()=>(this.#a(),!1),st))}#a(){this.#o&&t(on)}get#o(){let e=this.editor.getRootElement(),t=e?.ownerDocument.activeElement;return t&&!e.contains(t)&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)}#s(){this.#e.track(this.editor.registerCommand(at,({target:e})=>{if(!Nn(e))return!1;let t=me(e);return De(t)&&this.#E(t)},P)),this.#e.track(this.editor.registerRootListener(e=>{if(e)return Q(e,`lexxy:internal:move-to-next-line`,()=>this.#y())}))}#c(){this.#e.track(this.editor.registerRootListener(e=>{if(e){let t=e=>this.#l(e);return e.addEventListener(`keydown`,t,!0),()=>e.removeEventListener(`keydown`,t,!0)}}))}#l(e){if(e.key===`ArrowUp`){let t=this.editor.getRootElement().querySelector(`[data-lexical-cursor]`);if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute(`data-lexical-cursor`);)n=n.previousElementSibling;n||e.preventDefault()}}if(e.key===`ArrowDown`){let t=this.editor.getRootElement().querySelector(`[data-lexical-cursor]`);if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute(`data-lexical-cursor`);)n=n.nextElementSibling;n||e.preventDefault()}}}#u(){this.#d(),this.#f(),this.previouslySelectedKeys=this.#r,this.currentlySelectedKeys=null}#d(){for(let e of this.previouslySelectedKeys)if(!this.#r.has(e)){let t=this.editor.getElementByKey(e);t&&t.classList.remove(`node--selected`)}}#f(){for(let e of this.#r)if(!this.previouslySelectedKeys.has(e)){let t=this.editor.getElementByKey(e);t&&t.classList.add(`node--selected`)}}#p(e){return e.shiftKey?this.#_(e=>(this.#v(e,`forward`).modify(`extend`,!0,`character`),!0)):this.#_(e=>e.selectPrevious())||this.#E(this.nodeBeforeCursor)}#m(e){return e.shiftKey?this.#_(e=>(this.#v(e,`forward`).modify(`extend`,!1,`character`),!0)):this.#_(e=>e.selectNext(0,0))||this.#E(this.nodeAfterCursor)}#h(){return this.#_(e=>e.getTopLevelElement().selectPrevious())||this.#E(this.topLevelNodeBeforeCursor)}#g(){return this.#_(e=>e.getTopLevelElement().selectNext(0,0))||this.#E(this.topLevelNodeAfterCursor)}#_(e){if(this.hasNodeSelection)return e(w().getNodes()[0])}#v(e,t=`forward`){if(De(e)){let[n,r]=t===`forward`?[0,1]:[1,0],i=e.getIndexWithinParent();return e.getParent().select(i+n,i+r)}}async#y(){this.editor.update(()=>{let e=this.#b();e&&this.#w(e)})}#b(){let e=w();return e?Ne(e)?this.#x(e):O(e)?this.#S(e):null:null}#x(e){let t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#S(e){return e.anchor.getNode().getTopLevelElement()}#C(e){let t=e.getTopLevelElementOrThrow(),n=lp(t)?t:null;if(!n){let t=e.getParent();for(;t;){if(lp(t)){n=t;break}t=t.getParent()}}return n}#w(e){let t=e.getNextSibling();t?t.selectStart():this.#T()}#T(){let e=ye(),t=p();e.append(t),t.selectStart()}#E(e){if(De(e)){t(Dt);let n=nS(e);return j(n),n}return!1}#D(e){if(e&&this.#O())return!0;let t=e?this.nodeBeforeCursor:this.nodeAfterCursor;return De(t)?this.#k(t)?!0:(this.#A(),!!this.#E(t)):!1}#O(){let e=w();if(!O(e)||!e.isCollapsed())return!1;let t=e.anchor.getNode(),n=Qo(t,Nu);if(!n||!hS(n))return!1;let r=n.getNextSibling();if(!r)return!1;let i=n.getPreviousSibling(),a=Qo(n,Pu);if(!a)return!1;if(i)i.selectEnd(),n.remove();else if(up(a.getParent()))r.selectStart(),n.remove();else{let e=p();a.insertBefore(e),n.remove(),e.selectStart()}return!0}#k(e){let t=w()?.anchor?.getNode(),n=t&&Qo(t,Nu);if(!n||n.isParentOf(e))return!1;let r=Qo(n,Pu);if(!r)return!1;let i=p();return n.getChildren().forEach(e=>i.append(e)),r.getChildrenSize()===1?(r.insertBefore(i),r.remove()):(r.insertBefore(i),n.remove()),i.selectStart(),!0}#A(e=w()?.anchor){let t=e?.getNode();E(t)&&t?.isEmpty()&&t.remove()}#j(){let e=w();if(!e||!e.isCollapsed())return null;let t=window.getSelection();return!t||t.rangeCount===0?null:t.getRangeAt(0)}#M(e){let t=e.getBoundingClientRect();if(this.#N(t)){let n=this.#P(e);t=n.getBoundingClientRect(),this.#I(n),n.remove()}return t}#N(e){return e.width===0&&e.height===0||e.top===0&&e.left===0}#P(e){let t=this.#F();return e.insertNode(t),t}#F(){let e=document.createElement(`span`);return e.textContent=``,e.style.display=`inline-block`,e.style.width=`1px`,e.style.height=`1em`,e.style.lineHeight=`normal`,e.setAttribute(`nonce`,ax()),e}#I(e){let t=window.getSelection();t.removeAllRanges();let n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#L(e,t){let n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left,i=e.top-n.top,a=this.#R(t);return isNaN(a)||(i+=a),{x:r,y:i,fontSize:a}}#R(e){let t=window.getSelection().anchorNode,n=this.#z(t);if(n instanceof HTMLElement){let e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#z(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#B(){let e=w();if(!O(e)||!e.isCollapsed())return{anchorNode:null,offset:0};let{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#V(e,t){return t===e.getTextContentSize()?this.#H(e):null}#H(e){let t=e.getNextSibling();if(De(t))return t;if(t!=null)return null;let n=e.getParent();return n?n.getNextSibling():null}#U(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#q(e)}#W(e,t){return t===0?this.#G(e):null}#G(e){let t=e.getPreviousSibling();if(De(t))return t;if(t!=null)return null;let n=e.getParent();return n?n.getPreviousSibling():null}#K(e,t){return t>0?e.getChildAtIndex(t-1):this.#J(e)}#q(e){let t=e;for(;t&&t.getNextSibling()==null;)t=t.getParent();return t?t.getNextSibling():null}#J(e){let t=e;for(;t&&t.getPreviousSibling()==null;)t=t.getParent();return t?t.getPreviousSibling():null}#Y(e){return this.#Z(e,`first`)}#X(e){return this.#Z(e,`last`)}#Z(e,t){let n=e.getTopLevelElement();if(!n)return!1;let r=this.editor.getElementByKey(n.getKey());if(!r)return!1;let i=window.getSelection();if(!i?.rangeCount)return!1;let a=this.#M(i.getRangeAt(0));if(!a||this.#N(a))return!1;let o=this.#Q(r,t);if(!o||this.#N(o))return!1;let s=o.height>0?o.height*.5:5;return Math.abs(a.top-o.top)<s}#Q(e,t){let n=document.createTreeWalker(e,4),r;if(t===`first`)r=n.nextNode();else for(;n.nextNode();)r=n.currentNode;if(!r||r.length===0)return null;let i=document.createRange();return t===`first`?(i.setStart(r,0),i.setEnd(r,1)):(i.setStart(r,r.length-1),i.setEnd(r,r.length)),i.getBoundingClientRect()}},XC=class{#e;#t;constructor(e){this.#e=e,this.#t=new Px(Rx.presets.get(`default`),Rx.presets.get(e.preset),this.#n)}get(e){return this.#t.get(e)}get#n(){let e={};for(let t of this.#r){let n=qx(t);this.#e.hasAttribute(n)&&(e[t]=this.#i(n))}return e}get#r(){return Object.keys(Rx.presets.get(`default`))}#i(e){let t=this.#e.getAttribute(e);try{return JSON.parse(t)}catch{return t}}},ZC=class e extends St{$config(){return this.config(`image_gallery`,{extends:St})}static transform(){return e=>{e.unwrapEmptyNode()||e.replaceWithSingularChild()||e.splitAroundInvalidChild()}}static importDOM(){return{div:e=>this.#e(e)?{conversion:()=>({node:QC()}),priority:2}:null}}static canCollapseWith(e){return $C(e)||this.isValidChild(e)}static isValidChild(e){return WS(e)&&e.isPreviewableImage}static#e(e){let t=e.querySelectorAll(`:scope > :is(${this.#t.join()})`);return e.textContent.trim()===``&&t.length>0&&e.children.length===t.length}static get#t(){return Object.keys(HS.importDOM())}createDOM(){let e=document.createElement(`div`);return e.className=this.#r,e}updateDOM(e,t){return t.className=this.#r,!1}canBeEmpty(){return!0}collapseAtStart(e){return!0}insertNewAfter(e,t){if(e.anchor.getNode().is(this)&&e.anchor.offset==this.getChildrenSize()-1){let e=p();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}let n=QC();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(WS)}exportDOM(){let e=document.createElement(`div`);return e.className=this.#r,{element:e}}collapseWith(t,n){return e.canCollapseWith(t)?(n?es(this,t):this.append(t),is(this,e.isValidChild),!0):!1}unwrapEmptyNode(){if(this.isEmpty()){let e=p();return this.replace(e)}}replaceWithSingularChild(){if(this.#n){let e=this.getFirstChild();return this.replace(aS(e))}}splitAroundInvalidChild(){for(let t of Xo(this)){if(e.isValidChild(t))continue;let n=aS(t),[r,i]=this.splitAtIndex(n.getIndexWithinParent());r.insertAfter(n),n.selectEnd(),i.isEmpty()&&i.remove();break}}splitAtIndex(e){return Qe(this,e)}get#n(){return this.getChildrenSize()===1}get#r(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}};function QC(){return new ZC}function $C(e){return e instanceof ZC}function ew(e){return ZC.canCollapseWith(e)?Qo(e,ZC)??as(e,QC):null}var tw=class e{#e;static for(t,n,r={}){return new(nw.handle(t,n)?nw:e)(t,n,r)}constructor(e,t,n={}){this.#e=t,this.options=n,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#e)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map(e=>this.#t(e))}#t(e){return this.options.pending?this.contents.$createPendingUploadNode(e):this.contents.$createUploadNode(e)}$insertUploadNodes(){this.contents.insertAtCursor(...this.nodes)}},nw=class extends tw{#e;static handle(e,t){return this.isMultipleImageUpload(t)||this.gallerySelection(e.selection)}static isMultipleImageUpload(e){let t=0;for(let n of e)if(ux(n.type)&&t++,t>1)return!0;return!1}static gallerySelection(e){return e.isOnPreviewableImage||this.selectionIsAfterGalleryEdge(e)}static selectionIsAfterGalleryEdge(e){return e.isAtNodeStart&&ZC.canCollapseWith(e.nodeBeforeCursor)}$insertUploadNodes(){this.#t(),this.#s(),this.#c()}#t(){this.selection.isOnPreviewableImage?this.#e=ew(this.selection.previewableImageNode):this.#n?this.#e=ew(this.selection.nodeBeforeCursor):(this.#e=QC(),this.contents.insertAtCursor(this.#e))}get#n(){return this.constructor.selectionIsAfterGalleryEdge(this.selection)}get#r(){let{node:e}=this.selection.selectedNodeWithOffset();return e}get#i(){if(this.#n)return this.#e.getChildrenSize();let e=w()?.anchor;if(e?.getNode().is(this.#e))return e.offset;let t=this.#r,n=this.#e.isParentOf(t)&&t.getIndexWithinParent();return n===!1?0:n+1}get#a(){return this.nodes.filter(e=>ZC.isValidChild(e))}get#o(){return this.nodes.filter(e=>!ZC.isValidChild(e))}#s(){this.#e.splice(this.#i,0,this.#a)}#c(){let e=this.#e;for(let t of this.#o)e.insertAfter(t),e=t}};async function rw(e,t){return new Promise(n=>{let r=new FileReader;t.addEventListener(`load`,()=>{n(t)}),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)})}var iw=class e extends HS{static getType(){return`action_text_attachment_upload`}static clone(t){return new e({...t},t.__key)}static importJSON(t){return new e({...t})}static importDOM(){return null}constructor(e={},t){let{file:n,uploadUrl:r,blobUrlTemplate:i,progress:a,width:o,height:s,uploadError:c,fileName:l,contentType:u}=e;super({...e,contentType:n?.type??u},t),this.file=n??null,this.fileName=n?.name??l,this.uploadUrl=r,this.blobUrlTemplate=i,this.progress=a??null,this.width=o,this.height=s,this.uploadError=c}createDOM(){if(this.uploadError)return this.createDOMForError();this.#c();let e=this.isPreviewableAttachment&&this.uploadUrl!=null&&this.file!=null,t=this.createAttachmentFigure(e);if(e){let e=t.appendChild(this.#t());rw(this.file,e).then(e=>this.#o(e))}else t.appendChild(this.#n());return t.appendChild(this.#i()),t.appendChild(this.#a()),t}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;if(e.progress!==this.progress){let e=t.querySelector(`progress`);e.value=this.progress??0}return!1}exportDOM(){return{element:null}}exportJSON(){return{...super.exportJSON(),type:`action_text_attachment_upload`,version:1,fileName:this.fileName,contentType:this.contentType,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,progress:this.progress,width:this.width,height:this.height,uploadError:this.uploadError}}get#e(){return this.progress!==null}#t(){return $(`img`)}#n(){return $(`span`,{className:`attachment__icon`,textContent:this.#r()})}#r(){return(this.fileName||``).split(`.`).pop().toLowerCase()}#i(){let e=$(`figcaption`,{className:`attachment__caption`}),t=$(`span`,{className:`attachment__name`,textContent:this.caption||this.fileName||``});if(e.appendChild(t),this.file){let t=$(`span`,{className:`attachment__size`,textContent:Vx(this.file.size)});e.appendChild(t)}return e}#a(){return $(`progress`,{value:this.progress??0,max:100})}#o({width:e,height:t}){this.#s||this.patchAndRewriteHistory({width:e,height:t})}get#s(){return!!(this.width&&this.height)}async#c(){if(this.#e||!this.uploadUrl||!this.file)return;this.#p();let{DirectUpload:e}=await import(`@rails/activestorage`),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#l(),this.#v(`lexxy:upload-start`,{file:this.file}),t.create((e,t)=>{this.#u(),e?(this.#v(`lexxy:upload-end`,{file:this.file,error:e}),this.#g(e)):(this.#v(`lexxy:upload-end`,{file:this.file,error:null}),this.editor.update(()=>{this.$showUploadedAttachment(t)}))})}#l(){let e=Rx.global.get(`authenticatedUploads`);return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0),this.#d(t),t.upload.addEventListener(`progress`,e=>this.#m(e,t))}}}#u(){this.#f?.uploadRequests.forget(this.getKey())}#d(e){this.#f?.uploadRequests.track(this.getKey(),e)}get#f(){return this.editor.getRootElement()?.closest(`lexxy-editor`)}#p(){this.#h(1)}#m(e,t){let n=Math.round(e.loaded/e.total*100);try{this.#h(n),this.#v(`lexxy:upload-progress`,{file:this.file,progress:n})}catch{t.abort()}}#h(e){this.patchAndRewriteHistory({progress:e})}#g(e){console.warn(`Upload error for ${this.file?.name??`file`}: ${e}`),this.patchAndRewriteHistory({uploadError:!0})}$showUploadedAttachment(e){let t=this.isPreviewableImage&&this.file?URL.createObjectURL(this.file):null,n=this.#_(e,t);return this.replaceAndRewriteHistory(n),n.getKey()}#_(e,t){return new aw(this,e,t).toAttachmentNode()}#v(e,t){let n=this.editor.getElementByKey(this.getKey());n&&dx(n,e,t)}},aw=class{constructor(e,t,n){this.uploadNode=e,this.blob=t,this.previewSrc=n}toAttachmentNode(){return new HS({...this.uploadNode,...this.#e,src:this.#t,previewSrc:this.previewSrc,pendingPreview:this.blob.previewable&&!this.uploadNode.isPreviewableImage})}get#e(){let{blob:e}=this;return{sgid:e.attachable_sgid,altText:e.filename,contentType:e.content_type,fileName:e.filename,fileSize:e.byte_size,previewable:e.previewable,previewStatusUrl:e.preview_status_url}}get#t(){return this.blob.previewable?this.blob.url:this.#n}get#n(){return this.uploadNode.blobUrlTemplate.replace(`:signed_id`,this.blob.signed_id).replace(`:filename`,encodeURIComponent(this.blob.filename))}};function ow(...e){return new iw(...e)}var sw=class{constructor(e){this.selection=e}};const cw=[class extends sw{static handles(e){return Qo(e.anchor?.getNode(),zh)}insertNodes(e){this.selection.isCollapsed()||this.selection.removeText(),Ca(this.selection);let t=this.selection.focus.getNode(),n=Qo(t,zh),r=t.is(n)?0:t.getIndexWithinParent(),i=le(n,r+1,`previous`),a=new Set(e.filter(e=>e.isAttached())),o=[];for(let t of e){if(a.has(t)){if(!t.isAttached())continue}else if(!this.#e(t)){o.push(t);continue}i.getNodeAtCaret()&&E(t)&&i.insert(d()),i.insert(this.#n(t))}(this.#t(n,o)??i.getNodeAtCaret())?.selectEnd()}#e(e){return A(e)||D(e)}#t(e,t){let n=e;for(let e of t)n.insertAfter(e),n=e;return t.at(-1)}#n(e){return D(e)?e:(e.remove(),v(e.getTextContent()))}},class extends sw{static handles(e){return rS(e?.anchor?.getNode())}insertNodes(e){let t=this.selection.anchor.getNode(),n=p();t.append(n),n.selectStart().insertNodes(e)}},class extends sw{static handles(e){return Ne(e)&&e.getNodes().length>0}insertNodes(e){let t=this.selection.getNodes().at(-1);for(let n of e){let e=this.#e(t)?aS(n):n;t=t.insertAfter(e)}}#e(e){return e.is(e.getTopLevelElement())}},class extends sw{static handles(e){return O(e)&&Qo(e.anchor.getNode(),Nu)}insertNodes(e){e.some(e=>this.#i(e))?this.#e(e):this.selection.insertNodes(e)}#e(e){this.selection.isCollapsed()||this.selection.removeText();let t=this.selection.anchor.getNode(),n=this.#t(t),r=this.#n(t,n),i=pS(r)?r.getPreviousSibling():r,a=i?i.getIndexWithinParent()+1:0,[o,s]=Qe(n,a);pS(r)&&r.remove();let c=o??s;for(let t of e)c.insertAfter(t),c=t;this.#r(o),this.#r(s),e.at(-1).selectNext()}#t(e){return[e,...e.getParents()].reverse().find(Au)}#n(e,t){return[e,...e.getParents()].find(e=>ku(e)&&e.getParent()?.is(t))}#r(e){Au(e)&&e.isEmpty()&&e.remove()}#i(e){return De(e)&&!e.isInline()}},class extends sw{static handles(e){return PS(e)}insertNodes(e){Ve(this.selection),this.selection.insertNodes(e)}}];sw.for=e=>{let t=cw.find(t=>t.handles(e));return t?new t(e):e};var lw=class{constructor(e){this.doc=e}format(){for(let e of this.#e())this.#r(e)}#e(){let e=[],t=new Set;for(let n of this.doc.querySelectorAll(`p[style*='mso-list']`)){if(t.has(n)||this.#s(n)===null)continue;let r=[],i=n;for(;i;)r.push(i),t.add(i),i=this.#t(i);e.push(r)}return e}#t(e){let t=e.nextSibling;for(;t&&this.#n(t);)t=t.nextSibling;return t&&t.nodeType===Node.ELEMENT_NODE&&this.#s(t)!==null?t:null}#n(e){return e.nodeType===Node.COMMENT_NODE||e.nodeType===Node.TEXT_NODE&&e.textContent.trim()===``}#r(e){let t=e.map(e=>this.#s(e)),n=Math.min(...t),r=[],i=[];e.forEach((e,a)=>{let o=t[a]-n+1,s=this.#a(e);for(;i.length>o;)i.pop();for(i.length===o&&i[o-1].tagName!==s.toUpperCase()&&i.pop();i.length<o;){let e=this.doc.createElement(s);i.length===0?r.push(e):this.#i(i[i.length-1]).appendChild(e),i.push(e)}i[i.length-1].appendChild(this.#o(e))}),e[0].replaceWith(...r);for(let t of e.slice(1))t.remove()}#i(e){return e.lastElementChild||e.appendChild(this.doc.createElement(`li`)),e.lastElementChild}#a(e){let t=e.querySelector(`[style*='mso-list:Ignore']`)?.textContent||``;return/\d/.test(t)||/^\(?[A-Za-z]+[.)]/.test(t)?`ol`:`ul`}#o(e){for(let t of e.querySelectorAll(`[style*='mso-list:Ignore']`))t.remove();let t=this.doc.createElement(`li`);return t.append(...e.childNodes),t}#s(e){let t=/mso-list:[^;"']*\blevel(\d+)/.exec(e.getAttribute(`style`)||``);return t?parseInt(t[1],10):null}};const uw={p:[`margin-top`,`margin-bottom`]};var dw=class{constructor(e){this.doc=e}format(){return this.#e(),this.#t(),this.#n(),this.#r(),new lw(this.doc).format(),this.#i(),this.#o(),this.#s(),this.#h(),this.doc}#e(){let e=this.#c();if(e.length!==0)for(let[t,n]of Object.entries(uw))for(let r of this.doc.querySelectorAll(t))this.#l(r,n,e)}#t(){for(let e of this.doc.querySelectorAll(`style`))e.remove()}#n(){for(let e of this.doc.querySelectorAll(`a`)){let t=e.getAttribute(`href`)||``;(t===``||t===`#`)&&e.replaceWith(...e.childNodes)}}#r(){for(let e of this.doc.querySelectorAll(`td, th`))e.style.removeProperty(`background-color`),e.style.removeProperty(`background`),e.style.removeProperty(`color`)}#i(){for(let e of this.doc.querySelectorAll(`ol, ul`)){let t=this.#a(e);for(;t;)t.replaceWith(...t.childNodes),t=this.#a(e)}}#a(e){for(let t of e.children)if(t.tagName!==`LI`&&!this.#p(t)&&this.#m(t))return t;return null}#o(){for(let e of this.doc.querySelectorAll(`ol, ul`))for(let t of Array.from(e.children)){if(t.tagName!==`OL`&&t.tagName!==`UL`)continue;let e=t.previousElementSibling;e&&e.tagName===`LI`&&e.appendChild(t)}}#s(){for(let e of this.doc.querySelectorAll(`ol, ul`)){let t=this.#f(e);for(;t;)this.#m(t)?t.replaceWith(...t.childNodes):t.remove(),t=this.#f(e)}}#c(){let e=Array.from(this.doc.querySelectorAll(`style`),e=>e.textContent).join(`
|
|
274
|
+
`);if(e.trim()===``)return[];let t=new CSSStyleSheet;t.replaceSync(e);let n=[];for(let e of t.cssRules)e instanceof CSSStyleRule&&n.push(e);return n}#l(e,t,n){for(let r of t)if(e.style.getPropertyValue(r)===``){let t=this.#u(n,e,r);t&&this.#d(e,r,t)}}#u(e,t,n){let r=new Set;for(let i of e){let e=i.style.getPropertyValue(n);e!==``&&t.matches(i.selectorText)&&r.add(e)}return r.size===1?r.values().next().value:null}#d(e,t,n){let r=e.getAttribute(`style`),i=`${t}:${n}`;r===null||r.trim()===``?e.setAttribute(`style`,i):e.setAttribute(`style`,`${r.replace(/;\s*$/,``)};${i}`)}#f(e){for(let t of e.childNodes)if(t.nodeType!==Node.ELEMENT_NODE||t.tagName!==`LI`)return t;return null}#p(e){return e.nodeType===Node.ELEMENT_NODE&&(e.tagName===`OL`||e.tagName===`UL`)}#m(e){return e.nodeType===Node.ELEMENT_NODE&&e.querySelector(`li`)!==null}#h(){for(let e of this.doc.querySelectorAll(`img[data-emoji]`)){let t=e.dataset.emoji;t===e.alt&&e.replaceWith(t)}}},fw=class{constructor(e){this.editorElement=e,this.editor=e.editor}dispose(){this.editorElement=null,this.editor=null}get selection(){return this.editorElement.selection}insertHtml(e,{tag:t}={}){this.insertDOM(cx(e),{tag:t})}insertDOM(e,{tag:t}={}){this.editor.update(()=>{Ce(Zt)&&this.#a(e);let t=this.editorElement.$generateNodesFromDOM(e);(!Ce(Zt)||!this.#o(t))&&(this.#_(t)||this.insertAtCursor(...t))},{tag:t})}insertText(e,{tag:t}={}){this.editor.update(()=>{let t=p();e.split(`
|
|
275
|
+
`).forEach((e,n)=>{n>0&&t.append(d()),t.append(v(e))}),this.insertAtCursor(t)},{tag:t})}insertAtCursor(...e){let t=this.#i();sw.for(t).insertNodes(e)}applyParagraphFormat(){let e=w();O(e)&&(yS(e,e=>Zo(e)),Aa(e,()=>p()))}applyHeadingFormat(e){let t=w();O(t)&&(yS(t),Aa(t,()=>sp(e)))}applyUnorderedListFormat(){this.#l(`bullet`,Mu)}applyOrderedListFormat(){this.#l(`number`,ju)}clearFormatting(){let e=w();O(e)&&(wa(e=>{e.setFormat(0),e.setStyle(``)}),Nl(null),this.#h(e).filter(up).forEach(e=>this.#v(e)),Aa(e,()=>p()))}toggleCodeBlock(){let e=w();if(!O(e)||this.#s(Ph(`plain`)))return;let t=this.#m(e);if(t.every(Ih))t.forEach(e=>this.#c(e));else{yS(e);let t=this.#g(this.#m(e));if(t.length===0)return;let n=Ph(`plain`);t.at(-1).insertAfter(n),n.selectEnd(),this.insertAtCursor(...t)}}toggleBlockquote(){let e=w();if(!O(e)||this.#s(cp()))return;let t=this.#h(e);if(t.length>0&&t.every(up))t.forEach(e=>this.#v(e));else{t.filter(up).forEach(e=>this.#v(e)),yS(e);let n=this.#h(e);if(n.length===0)return;let r=cp();n[0].insertBefore(r),n.forEach(e=>r.append(e))}}hasSelectedText(){let e=!1;return this.editor.read(()=>{let t=w();e=O(t)&&!t.isCollapsed()}),e}createLink(e){let t=null;return this.editor.update(()=>{let n=v(e),r=Al(e);r.append(n);let i=w();O(i)&&(sw.for(i).insertNodes([r]),t=r.getKey())}),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update(()=>{Nl(null),Nl(e)})}textBackUntil(e){let t=``;return this.editor.getEditorState().read(()=>{let n=w();if(!n||!n.isCollapsed())return;let r=n.anchor,i=r.getNode();if(!A(i))return;let a=i.getTextContent(),o=r.offset,s=a.slice(0,o).lastIndexOf(e);s!==-1&&(t=a.slice(s+e.length,this.#e(a,o)))}),t}#e(e,t){for(let n=t;n<e.length;n++)if(this.#t(e,n))return n;return e.length}#t(e,t){let n=e[t];return/\s/.test(n)?!0:/\p{P}/u.test(n)?!(this.#n(e[t-1])&&this.#n(e[t+1])):!1}#n(e){return e!=null&&/[\p{L}\p{N}]/u.test(e)}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read(()=>{let n=w();if(!n||!n.isCollapsed())return;let r=n.anchor,i=r.getNode();if(!A(i))return;let a=i.getTextContent(),o=r.offset;t=a.slice(0,o).includes(e)}),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t];let{anchorNode:n,offset:r}=this.#y();if(!n)return;let i=this.#b(n,r,e);i!==-1&&this.#x(n,i,e,t)}uploadFiles(e,{selectLast:t}={}){if(!this.editorElement)return;if(!this.editorElement.supportsAttachments){console.warn(`This editor does not supports attachments (it's configured with [attachments=false])`);return}let n=Array.from(e).filter(e=>this.editorElement.acceptsFile(e));this.editor.update(()=>{let e=tw.for(this.editorElement,n);e.$uploadFiles(),t&&e.nodes?.length&&(e.nodes.at(-1).selectEnd(),this.#D())})}$createUploadNode(e){return ow({file:e,uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}$createPendingUploadNode(e){return ow({file:e,uploadUrl:null,blobUrlTemplate:this.editorElement.blobUrlTemplate,contentType:e.type})}insertPendingAttachment(e){if(!this.editorElement.supportsAttachments)return null;let t=null;return this.editor.update(()=>{let n=this.$createPendingUploadNode(e);this.insertAtCursor(n),t=n.getKey()}),t?this.#r(t):null}insertPendingAttachments(e){let t=Array.from(e);if(!this.editorElement.supportsAttachments||t.length===0)return[];let n=[];return this.editor.update(()=>{let e=tw.for(this.editorElement,t,{pending:!0});e.$uploadFiles(),n=(e.nodes??[]).map(e=>e.getKey())}),n.map(e=>this.#r(e))}#r(e){let t=this.editor,n=e;return{setAttributes(e){t.update(()=>{let t=C(n);if(!(t instanceof iw))return;let r=t.$showUploadedAttachment(e);r&&(n=r)},{tag:Dt})},setUploadProgress(e){t.update(()=>{let t=C(n);t instanceof iw&&(t.getWritable().progress=e)},{tag:Dt})},remove(){t.update(()=>{let e=C(n);e&&e.remove()})}}}replaceNodeWithHTML(e,t,n={}){this.editor.update(()=>{let r=C(e);if(!r)return;let i=w(),a=!1;if(O(i)){let e=i.getNodes();a=e.includes(r)||e.some(e=>e.getParent()===r),a&&j(null)}let o=n.attachment?this.#T(t,n.attachment):this.#E(t);r.replace(o),a&&o.selectEnd()})}insertHTMLBelowNode(e,t,n={}){this.editor.update(()=>{let r=C(e);if(!r)return;let i=r.getTopLevelElement()||r,a=n.attachment?this.#T(t,n.attachment):this.#E(t);i.insertAfter(a)})}#i(){let e=w();return Ne(e)&&e.getNodes().length===0?ye().selectEnd():e??ye().selectEnd()}#a(e){new dw(e).format()}#o(e){return this.editor.dispatchCommand(rn,{nodes:e,selection:w()})}#s(e){let t=w();if(!O(t))return!1;let n=t.anchor.getNode();return Ie(n)?(n.append(e),e.selectEnd(),!0):!1}#c(e){let t=e.getChildren(),n=[[]];for(let e of t)D(e)?n.push([]):n[n.length-1].push(e.getTextContent());for(let t of n){let n=p(),r=t.join(``);r&&n.append(v(r)),e.insertBefore(n)}e.remove()}#l(e,t){this.selection.isInsideBlockQuote?this.#u(e):(this.#p(),this.editor.dispatchCommand(t))}#u(e){for(let t of IS(this.#d()))this.#f(t,e)}#d(){let e=w();return O(e)?this.#g(this.#m(e)).filter(e=>up(e.getParent())):[]}#f(e,t){let n=Du(t);e[0].insertBefore(n);for(let t of e){let e=Eu();Au(t)?e.append(...t.getChildren().flatMap(e=>e.getChildren())):e.append(...t.getChildren()),n.append(e),t.remove()}}#p(){if(this.selection.isInsideList)return;let e=w();O(e)&&(yS(e),vS(e))}#m(e){let t=new Set;for(let n of e.getNodes())t.add(Zo(n));return Array.from(t)}#h(e){let t=new Set;for(let n of e.getNodes()){let e=n.getTopLevelElement();e&&t.add(e)}return Array.from(t)}#g(e){return e.filter(t=>e.every(e=>e===t||!t.getParents().includes(e)))}#_(e){if(e.every(WS)){let t=tw.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#v(e){let t=e.getChildren();t.length==0?e.insertBefore(p()):t.forEach(t=>{if(A(t)&&t.getTextContent().trim()!==``){let n=p();n.append(t),e.insertBefore(n)}else D(t)||e.insertBefore(t)}),e.remove()}#y(){let e=w();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};let t=e.anchor,n=t.getNode();return A(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#b(e,t,n){return t===0?-1:e.getTextContent().lastIndexOf(n,t-1)}#x(e,t,n,r){let i=e.getTextContent(),a=i.slice(0,t),o=i.slice(t+n.length),s=this.#S(e,a),c=this.#S(e,o||` `);e.replace(s),this.#C(s,r).insertAfter(c),this.#w(c.getParentOrThrow());let l=+!o;c.select(l,l)}#S(e,t){return v(t).setFormat(e.getFormat()).setDetail(e.getDetail()).setMode(e.getMode()).setStyle(e.getStyle())}#C(e,t){let n=e;for(let e of t)n.insertAfter(e),n=e;return n}#w(e){if(Pe(e)&&this.editorElement.supportsMultiLine){let t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];A(n)&&n.getTextContent()===``&&r&&!A(r)&&e.append(d())}}#T(e,t={}){let n=typeof t==`object`?t:{},r=n.contentType||`text/html`;return this.editorElement.permitsAttachmentContentType(r)?new Gx({sgid:n.sgid||null,contentType:r,innerHtml:e}):this.#E(e)}#E(e){return this.editorElement.$generateNodesFromDOM(cx(e))[0]||p()}#D(){let e=w();if(!O(e))return;let t=e.anchor.getNode();if(!rS(t))return;let n=p();t.append(n),n.selectStart()}},pw=class{#e=new ox;constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents,this.#t()}dispose(){this.editorElement=null,this.editor=null,this.contents=null,this.#e.dispose()}paste(e){let t=e.clipboardData;if(!t)return!1;if(this.#s())return this.#c(t),e.preventDefault(),!0;if(this.#r(t))return this.#l(t),e.preventDefault(),!0;let n=this.#_(t);return n&&e.preventDefault(),n}#t(){this.#e.track(this.editor.registerCommand(Xt,this.paste.bind(this),ct),this.editor.registerCommand(rn,e=>this.#n(e),ct))}#n({nodes:e,selection:t}){let n=mw(e);if(n&&O(t))return this.#f(t,n),!0}#r(e){return this.#i(e)||this.#a(e)}#i(e){let t=Array.from(e.types);return t.length===1&&t[0]===`text/plain`}#a(e){if(this.#v(e))return!1;let t=Array.from(e.types);if(t.includes(`text/uri-list`))return t.every(e=>e===`text/plain`||e===`text/uri-list`);if(e.files.length)return!1;let n=e.getData(`text/plain`).trim();if(!Jx(n))return!1;let r=e.getData(`text/html`);return!r||this.#o(r,n)}#o(e,t){let n=cx(e);if(n.body.textContent.trim()!==t)return!1;let r=n.body.querySelectorAll(`a`);return r.length===0||r.length===1&&r[0].getAttribute(`href`)===t}#s(){let e=!1;return this.editor.getEditorState().read(()=>{let t=w();if(!O(t))return;let n=t.anchor.getNode();for(;n;){if(Ih(n)){e=!0;return}n=n.getParent()}}),e}#c(e){let t=e.getData(`text/plain`);t&&this.editor.update(()=>{let e=w();O(e)&&e.insertRawText(t)},{tag:Zt})}#l(e){this.#u(e).getAsString(t=>{let n=t.trim();Jx(n)?this.#d(n):this.editorElement.supportsMarkdown?this.#m(t):this.#g(e)})}#u(e){let t=Array.from(e.items);return t.find(e=>e.type===`text/plain`)||t.find(e=>e.type===`text/uri-list`)}#d(e){if(this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else{let t=this.contents.createLink(e);this.#p(t,{url:e})}}#f(e,t){if(!O(e))return;if(!e.isCollapsed()){Nl(null),Nl(t);return}let n=Al(t).append(v(t));sw.for(e).insertNodes([n]),He(()=>this.#p(n.getKey(),{url:t}))}#p(e,t){let n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};dx(this.editorElement,`lexxy:insert-link`,{...t,...n})}#m(e){let t=cx(Z(e,{breaks:!0}));if(this.#h(t))this.contents.insertText(e,{tag:Zt});else{let n=Object.freeze({markdown:e,document:t,addBlockSpacing:()=>fx(t)});dx(this.editorElement,`lexxy:insert-markdown`,n),this.contents.insertDOM(t,{tag:Zt})}}#h(e){let t=Array.from(e.body.children);if(t.length!==1)return!1;let n=t[0];return n.nodeName===`P`&&Array.from(n.childNodes).every(e=>e.nodeType===Node.TEXT_NODE||e.nodeName===`BR`)}#g(e){this.editor.update(()=>{let t=w();uf(e,t,this.editor)},{tag:Zt})}#_(e){if(!this.editorElement.supportsAttachments)return!1;let t=e.getData(`text/html`),n=e.files;return n.length&&this.#y(t)?(this.#b(n),!0):t&&!this.#v(e)?(this.contents.insertHtml(t,{tag:Zt}),!0):n.length?(this.#b(n),!0):!1}#v(e){return Array.from(e.types).includes(`application/x-lexical-editor`)}#y(e){if(!e)return!1;let t=cx(e),n=Array.from(t.body.children);return n.length===1&&n[0].tagName===`IMG`}#b(e){this.#x(()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})})}async#x(e){let t=window.scrollY,n=window.scrollX;e(),await wx(),window.scrollTo(n,t),this.editor.focus()}};function mw(e){if(e.length!==1)return null;let t=e[0];if(Ml(t))return hw(t);if(Pe(t)){let e=t.getChildren();if(e.length===1&&Ml(e[0]))return hw(e[0])}return null}function hw(e){let t=e.getURL();return t&&e.getTextContent()===t?t:null}var gw=class{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#a()}get lexicalExtensions(){return this.enabledExtensions.map(e=>e.lexicalExtension).filter(Boolean)}initializeToolbars(){let e=this.#n;e&&(this.#e(e),this.#t(e),e.requestOverflowRefresh())}dispose(){for(;this.enabledExtensions.length;)this.enabledExtensions.pop().dispose()}#e(e){e.querySelectorAll(`[data-lexxy-extension]`).forEach(e=>e.remove())}#t(e){this.enabledExtensions.forEach(t=>{let n=new Set(e.children);t.initializeToolbar(e);for(let t of e.children)n.has(t)||t.setAttribute(`data-lexxy-extension`,``)})}get allowedElements(){return this.enabledExtensions.flatMap(e=>e.allowedElements)}get#n(){return this.lexxyElement.toolbar}get#r(){return this.lexxyElement.baseExtensions}get#i(){return Rx.global.get(`extensions`)}#a(){return this.#r.concat(this.#i).map(e=>new e(this.lexxyElement)).filter(e=>e.enabled)}},_w=class{frozenLinkKey=null;dispatchAttributesChange(e,t,n,r){}dispatchEditorInitialized(e){}freeze(){}thaw(){}unlinkFrozenNode(){return!1}};function vw(e,t){let n=t.createDOM(e._config,e);n.style.whiteSpace=`pre-wrap`,t.hasFormat(`lowercase`)?n.style.textTransform=`lowercase`:t.hasFormat(`uppercase`)?n.style.textTransform=`uppercase`:t.hasFormat(`capitalize`)&&(n.style.textTransform=`capitalize`);let r=n;return t.hasFormat(`bold`)&&!yw(n,`strong`)&&(r=bw(r,`b`)),t.hasFormat(`italic`)&&!yw(n,`em`)&&(r=bw(r,`i`)),t.hasFormat(`strikethrough`)&&(r=bw(r,`s`)),t.hasFormat(`underline`)&&(r=bw(r,`u`)),{element:xw(r)}}function yw(e,t){let n=t.toUpperCase();return e.tagName===n||e.querySelector(t)!==null}function bw(e,t){let n=document.createElement(t);return n.appendChild(e),n}function xw(e){if(e.tagName===`SPAN`)return e.firstChild;for(let t of e.querySelectorAll(`span`))t.replaceWith(...t.childNodes);return e}var Sw=class e extends Qt{$config(){return this.config(`provisonal_paragraph`,{extends:Qt,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!ww(e,`next`)&&!ww(t,`previous`)}createDOM(e){let t=super.createDOM(e),n=this.isSelected(w());return t.classList.add(`provisional-paragraph`),t.classList.toggle(`hidden`,!n),t}updateDOM(e,t){let n=this.isSelected(w());return t.classList.toggle(`hidden`,!n),!1}getTextContent(){return``}exportDOM(){return{element:null}}isSelected(e=null){let t=e||w();if(!t)return!1;if(t.getNodes().some(e=>e.is(this)||this.isParentOf(e)))return!0;if(O(t)&&t.isCollapsed()){let{anchor:e}=t,n=this.getParent();if(n&&e.getNode().is(n)&&e.type===`element`){let t=this.getIndexWithinParent();return e.offset===t||e.offset===t+1}}return!1}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(p(),!0)}get required(){return this.isDirectRootChild&&e.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){let e=this.getParent();return Ie(e)}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}};function Cw(e){return e instanceof Sw}function ww(e,t){return E(e)&&(t===`next`?e.canInsertTextBefore():e.canInsertTextAfter())}var Tw=class extends eS{get lexicalExtension(){return F({name:`lexxy/provisional-paragraph`,nodes:[Sw],register(e){return ds(e.registerNodeTransform(tn,Ew),e.registerNodeTransform(tn,Ow),e.registerCommand(nn,kw,N))}})}};function Ew(e){let t=Dw(e),n=e.getFirstChild();Sw.neededBetween(null,n)&&es(e,new Sw);for(let n of Xo(e)){let e=n.getNextSibling();Sw.neededBetween(n,e)&&(n.insertAfter(new Sw),n.is(t)&&n.selectNext())}}function Dw(e){let t=w();return Ie(t?.anchor?.getNode())?e.getChildAtIndex(t.anchor.offset-1):null}function Ow(e){for(let t of Aw(e))t.removeUnlessRequired()}function kw(){t(Dt);for(let e of Aw())e.markDirty()}function Aw(e=ye()){return Jo(e.getChildren(),Cw)}var jw=class extends eS{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return F({name:`lexxy/code-highlighting`,register(e){return Hh(e,TC(e))}})}};const Mw=`language`;var Nw=class extends eS{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return F({name:`lexxy/trix-content`,html:{import:{em:e=>Pw(e,{conversion:uS(`i`,vC),priority:1}),span:e=>Pw(e,{conversion:uS(`mark`,vC),priority:1}),strong:e=>Pw(e,{conversion:uS(`b`,vC),priority:1}),del:()=>({conversion:uS(`s`,Fw,vC),priority:1}),pre:e=>Iw(e,{conversion:dS(zh,`pre`,Lw),priority:1})}}})}};function Pw(e,t){return e.style.color!==``||e.style.backgroundColor!==``?t:null}function Fw(e){return e.hasFormat(`strikethrough`)||e.toggleFormat(`strikethrough`),e}function Iw(e,t){return e.hasAttribute(Mw)?t:null}function Lw(e,t){let n=Vh(t.getAttribute(Mw));e.node.setLanguage(n)}var Rw=class extends Ty{$config(){return this.config(`wrapped_table_node`,{extends:Ty})}static importDOM(){return super.importDOM()}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}exportDOM(e){let t=super.exportDOM(e);return{...t,after:e=>t.after?(e=t.after(e),$(`figure`,{className:`lexxy-content__table-wrapper`},e.cloneNode(!0).outerHTML)):e}}},zw=class extends eS{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return[`figure`,`tbody`]}get lexicalExtension(){return F({name:`lexxy/tables`,nodes:[Rw,{replace:Ty,with:()=>new Rw,withKlass:Rw},wy,Ey],register(e){return ky(e,!0),ds(Dy(e),e.registerRootListener(t=>{if(t)return Oy(e,!0)}),e.registerNodeTransform(wy,e=>{e.getBackgroundColor()!==``&&e.setBackgroundColor(``)}),e.registerNodeTransform(wy,e=>{let t=e.getHeaderStyles();if(t!==Cy.ROW)return;let n=e.getParent(),r=n?.getParent();if(!r)return;let i=r.getChildren(),a=n.getChildren().indexOf(e),o=n.getChildren().every(e=>e.getHeaderStyles()!==Cy.NO_STATUS),s=i.every(e=>{let t=e.getChildren()[a];return t&&t.getHeaderStyles()!==Cy.NO_STATUS}),c=Cy.NO_STATUS;o&&(c|=Cy.ROW),s&&(c|=Cy.COLUMN),c!==t&&e.setHeaderStyles(c,Cy.BOTH)}),e.registerCommand(`insertTableRowAfter`,()=>{xy(!0)},ct),e.registerCommand(`insertTableRowBefore`,()=>{xy(!1)},ct),e.registerCommand(`insertTableColumnAfter`,()=>{by(!0)},ct),e.registerCommand(`insertTableColumnBefore`,()=>{by(!1)},ct),e.registerCommand(`deleteTableRow`,()=>{py()},ct),e.registerCommand(`deleteTableColumn`,()=>{fy()},ct),e.registerCommand(`deleteTable`,()=>{let e=w();if(!O(e))return!1;hy(e.anchor.getNode())?.remove()},ct))}})}},Bw=class e{#e;#t=null;#n=null;#r=null;#i=new ox;constructor(e){this.#e=e,this.#i.track(e.registerCommand(yt,e=>this.#a(e),N),e.registerCommand(bt,e=>this.#s(e),N)),this.#i.track(e.registerRootListener((e,t)=>{t&&(t.removeEventListener(`dragover`,this.#o),t.removeEventListener(`dragend`,this.#c)),e&&(e.addEventListener(`dragover`,this.#o),e.addEventListener(`dragend`,this.#c))}))}destroy(){this.#S(),this.#i.dispose()}#a(e){if(e.target.closest?.(`textarea`))return!1;let t=e.target.closest?.(`figure.attachment[data-lexical-node-key]`);return t?(this.#t=t.dataset.lexicalNodeKey,e.dataTransfer.setData(`application/x-lexxy-node-key`,this.#t),e.dataTransfer.effectAllowed=`move`,this.#r=requestAnimationFrame(()=>{this.#r=null,t.classList.add(`lexxy-dragging`)}),!0):!1}#o=e=>{this.#t&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,this.#n||=requestAnimationFrame(()=>{this.#n=null,this.#l(e)}))};#s(e){if(!this.#t)return!1;e.preventDefault();let t=this.#u(e),n=this.#t;return this.#S(),t&&this.#_(n,t),!0}#c=()=>{this.#S()};#l(e){this.#g();let t=this.#u(e);t&&(t.type===`gallery`||t.type===`gallery-reorder`?t.element.classList.add(`lexxy-drop-target--gallery-${t.position}`):t.type===`list-item`?t.element.classList.add(`lexxy-drop-target--list-${t.position}`):t.element.classList.add(`lexxy-drop-target--block-${t.position}`))}#u(e){let t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;let n=this.#e.getRootElement();if(!n||!n.contains(t))return null;let r=t.closest(`figure.attachment--preview[data-lexical-node-key]`);if(r&&r.dataset.lexicalNodeKey!==this.#t){let t=r.closest(`.attachment-gallery`);if(t){let i=n.querySelector(`[data-lexical-node-key="${this.#t}"]`);if(i&&t.contains(i)){let t=this.#p(r,e.clientX);return{type:`gallery-reorder`,element:r,nodeKey:r.dataset.lexicalNodeKey,position:t}}}let i=this.#p(r,e.clientX);return{type:`gallery`,element:r,nodeKey:r.dataset.lexicalNodeKey,position:i}}if(r&&r.closest(`.attachment-gallery`))return null;let i=t.closest(`.attachment-gallery`);if(i){let n=t.closest(`figure.attachment[data-lexical-node-key]`);if(n||=this.#m(i,e.clientX),n&&n.dataset.lexicalNodeKey!==this.#t){let t=this.#p(n,e.clientX);return{type:`gallery-reorder`,element:n,nodeKey:n.dataset.lexicalNodeKey,position:t}}if(n)return null}let a=t.closest(`li`);if(a&&n.contains(a))return{type:`list-item`,element:a,position:this.#f(a,e.clientY)};let o=this.#d(t,n,e.clientY);if(!o)return null;let s=this.#f(o,e.clientY);return s===`before`&&o.previousElementSibling?{type:`block`,element:o.previousElementSibling,position:`after`}:{type:`block`,element:o,position:s}}#d(e,t,n){let r=e;for(;r&&r!==t;){if(r.parentElement===t)return r;r=r.parentElement}let i=null,a=1/0;for(let e of t.children){let t=e.getBoundingClientRect(),r=Math.min(Math.abs(n-t.top),Math.abs(n-t.bottom));r<a&&(a=r,i=e)}return i}#f(e,t){let n=e.getBoundingClientRect();return t<n.top+n.height/2?`before`:`after`}#p(e,t){let n=e.getBoundingClientRect();return t<n.left+n.width/2?`before`:`after`}#m(e,t){let n=e.querySelectorAll(`figure.attachment[data-lexical-node-key]`),r=null,i=1/0;for(let e of n){let n=e.getBoundingClientRect(),a=n.left+n.width/2,o=Math.abs(t-a);o<i&&(i=o,r=e)}return r}static#h=[`lexxy-drop-target--gallery-before`,`lexxy-drop-target--gallery-after`,`lexxy-drop-target--list-before`,`lexxy-drop-target--list-after`,`lexxy-drop-target--block-before`,`lexxy-drop-target--block-after`];#g(){let t=this.#e.getRootElement();if(t)for(let n of t.querySelectorAll(`[class*='lexxy-drop-target--']`))n.classList.remove(...e.#h)}#_(e,t){let n=C(e);!n||!WS(n)||(t.type===`gallery`?this.#v(n,t.nodeKey,t.position):t.type===`gallery-reorder`?this.#y(n,t.nodeKey,t.position):t.type===`list-item`?this.#b(n,t):this.#x(n,t),j(null))}#v(e,t,n){let r=C(t);!r||!WS(r)||e.is(r)||(e.remove(),ew(r)&&(n===`before`?r.insertBefore(e):r.insertAfter(e)))}#y(e,t,n){let r=C(t);!r||e.is(r)||(e.remove(),n===`before`?r.insertBefore(e):r.insertAfter(e))}#b(e,t){let n=me(t.element);if(!n||!ku(n))return;let r=n.getParent();if(!r||!Au(r))return;let i=r.getChildren(),a=i.indexOf(n);if(a===-1)return;let o=t.position===`before`?a:a+1;if(e.remove(),o===0)r.insertBefore(e);else if(o>=i.length)r.insertAfter(e);else{let[,t]=Qe(r,o);t.insertBefore(e)}}#x(e,t){let n=me(t.element);if(!n)return;let r=n.getTopLevelElement?.()||n;e.is(r)||(e.remove(),t.position===`before`?r.insertBefore(e):r.insertAfter(e))}#S(){if(this.#g(),this.#t){let e=this.#e.getRootElement();e&&e.querySelector(`[data-lexical-node-key="${this.#t}"]`)?.classList.remove(`lexxy-dragging`)}this.#t=null,this.#n&&=(cancelAnimationFrame(this.#n),null),this.#r&&=(cancelAnimationFrame(this.#r),null)}};const Vw=[`alt`,`caption`,`content`,`content-type`,`data-direct-upload-id`,`data-sgid`,`filename`,`filesize`,`height`,`presentation`,`previewable`,`sgid`,`url`,`width`];var Hw=class extends eS{#e=0;get enabled(){return this.editorElement.supportsAttachments}get allowedElements(){return[{tag:HS.TAG_NAME,attributes:Vw}]}get lexicalExtension(){return F({name:`lexxy/action-text-attachments`,nodes:[HS,iw,ZC],register:e=>{let t=new Bw(e);return ds(e.registerNodeTransform(HS,Uw),e.registerCommand(ht,Ww,ct),e.registerMutationListener(iw,this.#t.bind(this)),()=>t.destroy())}})}#t(e){let t=this.#e;for(let[t,n]of e)n===`created`?this.#e++:n===`destroyed`&&(this.#e--,this.editorElement.uploadRequests.abort(t));this.#e!==t&&this.#n()}#n(){this.#e?this.setEditorValidity({customError:!0},`Please wait for all files to upload`):this.setEditorValidity({})}};function Uw(e){let t=e.getParent();if(Pe(t))if(t.getChildrenSize()===1)t.replace(e);else{let n=e.getIndexWithinParent(),[r,i]=Qe(t,n);r.insertAfter(e);for(let e of[r,i])e.isEmpty()&&e.remove()}}function Ww(e){let t=w()?.anchor;return t?Kw(t,e)?!0:e?Gw(t)||qw(t):!1:!1}function Gw(e){let t=e.getNode();if(!t)return!1;let n=Pe(t)&&t.isEmpty(),r=ew(t.getPreviousSibling()),i=r?.getChildrenSize();return n&&r?.collapseWith(t.getNextSibling())?(r.select(i,i),t.remove(),!0):!1}function Kw(e,t){let n=e.getNode();if(!$C(n))return!1;let r=cS(e,t),i=t?n.getPreviousSibling():n.getNextSibling();if(r&&n.collapseWith(i,t)){let e=t?1:n.getChildrenSize()-1;return n.select(e,e),!0}return!1}function qw(e){let t=e.getNode().getPreviousSibling();return!$C(e.getNode())||!cS(e,!0)||!t||De(t)?!1:(t.isEmpty()?t.remove():t.selectEnd(),!0)}var Jw=class e extends zh{$config(){return this.config(`early_escape_code`,{extends:zh})}static $fromSelection(t){let n=t.anchor.getNode();return Qo(n,e)||(n instanceof e?n:null)}insertNewAfter(e,t){return Ce(Zt)||!e.isCollapsed()?super.insertNewAfter(e,t):this.#e(e)?this.#r():this.#n(e)?this.#i(e,t):this.#t(e)?this.#a():super.insertNewAfter(e,t)}#e(e){let{anchor:t}=e;if(!lS(t))return!1;let n=t.getNode();return this.is(n)||this.getFirstChild()?.is(n)}#t(e){if(!fS(e))return!1;let t=this.getTextContent();return t===``||t.endsWith(`
|
|
276
|
+
`)}#n(e){if(!fS(e))return!1;let t=this.getTextContent(),n=t.lastIndexOf(`
|
|
277
|
+
`),r=n===-1?t:t.slice(n+1);return r.length>0&&r.trim()===``}#r(){return this.insertBefore(p()),null}#i(e,t){return super.insertNewAfter(e,t),this.getLastChild().remove(),null}#a(){mS(this);let e=p();return this.insertAfter(e),e}},Yw=class extends Nu{$config(){return this.config(`early_escape_listitem`,{extends:Nu})}insertNewAfter(e,t){return this.#t(e)?this.#r():super.insertNewAfter(e,t)}get#e(){return!!Qo(this,fp)}#t(e){if(this.#n()||!this.#e)return!1;if(pS(this))return!0;{let t=Qo(e.anchor.getNode(),Qt);return t&&pS(t)&&ku(t.getParent())}}#n(){return Ce(Zt)}#r(){let e=this.getParent();if(!e||!Au(e))return;let t=e.getParent();if(t&&up(t)&&this.getNextSiblings().some(e=>ku(e)&&!pS(e)))return this.#i();let n=p();return e.insertAfter(n),this.remove(),n}#i(){let e=Qe(this.getParent(),this.getIndexWithinParent());this.remove();let t=p();return e[0].insertAfter(t),e.forEach(mS),t}},Xw=class extends eS{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return[{tag:`ol`,attributes:[`start`]},{tag:`li`,attributes:[`value`]}]}get lexicalExtension(){return F({name:`lexxy/format-escape`,nodes:[Jw,{replace:zh,with:e=>new Jw(e.getLanguage()),withKlass:Jw},Yw,{replace:Nu,with:()=>new Yw,withKlass:Yw}],register(e){return ds(e.registerCommand(Mt,()=>Zw(),N),e.registerCommand(Ft,e=>tT(e),ct),e.registerNodeTransform(fp,nT))}})}};function Zw(){return Qw()||$w()}function Qw(){let e=w();if(!O(e)||!e.isCollapsed()||e.anchor.offset!==0)return!1;let t=Qo(e.anchor.getNode(),Qt);if(t&&!pS(t)&&!t.getPreviousSibling()){let e=t.getParent();if(up(e))return e.insertBefore(p()),!0}return!1}function $w(){let e=w().anchor.getNode(),t=Qo(e,Qt);if(!t||!pS(t))return!1;let n=t.getParent();return up(n)?(t.getNextSiblings().filter(e=>!pS(e)).length>0?eT(n,t):(n.insertAfter(t),t.selectStart()),!0):!1}function eT(e,t){let n=Qe(e,t.getIndexWithinParent());n[0].insertAfter(t),n.forEach(mS),t.selectEnd()}function tT(e){let t=w();if(!O(t)||!t.isCollapsed())return!1;let n=Jw.$fromSelection(t);if(!n)return!1;if(fS(t)&&!n.getNextSibling()){e?.preventDefault();let t=p();return n.insertAfter(t),t.selectEnd(),!0}return!1}function nT(e){e.isEmpty()&&(e.append(p()),tS(e)&&e.getFirstChild().select())}var rT=class extends eS{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return F({name:`lexxy/link-opener`,register:e=>Un(e.registerCommand(at,this.#e.bind(this),ct),Q(this.editorElement.editorContentElement,`auxclick`,this.#t.bind(this)),Q(window,`keydown`,this.#n.bind(this)),Q(window,`keyup`,this.#n.bind(this)),Q(window,`focus`,this.#r.bind(this)))})}#e(e){return this.#a(e)?iT(e.target):!1}#t(e){e.button===1&&this.editorElement.editor.read(()=>iT(e.target))}#n(e){this.#i(e)}async#r(){await Cx(200),this.editorElement.addEventListener(`mousemove`,this.#i.bind(this),{once:!0})}#i(e){this.editorElement.toggleAttribute(`data-links-openable`,this.#a(e))}#a(e){return os?e.metaKey:e.ctrlKey}};function iT(e){let t=me(e),n=b(t,Ml);if(n){let e=n.sanitizeUrl(n.getURL());return window.open(e,`_blank`,`noopener,noreferrer`),!0}return!1}var aT=class extends eS{get lexicalExtension(){return F({name:`lexxy/prevent-lexical-triple-click`,register:e=>e.registerRootListener(e=>{if(e)return Q(e,`click`,this.#e.bind(this),{capture:!0})})})}#e(e){e.detail===3&&e.stopPropagation()}};function oT(e,t){let n=document.createRange();n.setStart(e,t),n.collapse(!0);let r=n.getBoundingClientRect();return r.height>0?r:null}function sT(e,t){if(document.caretPositionFromPoint){let n=document.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:n.offset}}else if(document.caretRangeFromPoint){let n=document.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:n.startOffset}}return null}var cT=class{#e;#t=null;#n=null;#r=null;#i=null;#a=new ox;constructor(e){this.#e=e,this.#a.track(e.registerCommand(yt,e=>this.#o(e),N),e.registerCommand(bt,e=>this.#l(e),N)),this.#a.track(e.registerRootListener((e,t)=>{t&&(t.removeEventListener(`dragover`,this.#s),t.removeEventListener(`dragend`,this.#c)),e&&(e.addEventListener(`dragover`,this.#s),e.addEventListener(`dragend`,this.#c))}))}destroy(){this.#T(),this.#i?.remove(),this.#i=null,this.#a.dispose()}#o(e){let t=this.#w(e.target);return t?(this.#t=t.dataset.lexicalNodeKey,e.dataTransfer.setData(`application/x-lexxy-custom-attachment-key`,this.#t),e.dataTransfer.effectAllowed=`move`,this.#n=requestAnimationFrame(()=>{this.#n=null,t.classList.add(`lexxy-dragging`)}),!0):!1}#s=e=>{this.#t&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,this.#r||=requestAnimationFrame(()=>{this.#r=null,this.#_(e)}))};#c=()=>{this.#T()};#l(e){if(!this.#t)return!1;e.preventDefault();let t=this.#u(e),n=this.#t;return this.#T(),t&&this.#m(n,t),!0}#u(e){let t=this.#e.getRootElement();if(!t)return null;let n=sT(e.clientX,e.clientY);if(!n||!t.contains(n.node))return null;if(n.node===t)return this.#d(t,e.clientY);let r=this.#f(n.node);return r?this.#p(r,e.clientX):n}#d(e,t){let n=null,r=1/0;for(let i of e.children){let e=i.getBoundingClientRect(),a=Math.min(Math.abs(t-e.top),Math.abs(t-e.bottom));a<r&&(r=a,n=i)}return n?t<n.getBoundingClientRect().top?{node:n,offset:0}:{node:n,offset:n.childNodes.length}:null}#f(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(`[data-lexxy-decorator][data-lexical-node-key]`)}#p(e,t){let n=e.getBoundingClientRect(),r=t>n.left+n.width/2?`after`:`before`;return{decoratorKey:e.dataset.lexicalNodeKey,placement:r}}#m(e,t){this.#e.update(()=>{let n=C(e);Kx(n)&&(t.decoratorKey?this.#h(n,t):this.#g(n,t))})}#h(e,{decoratorKey:t,placement:n}){let r=C(t);!r||r===e||(e.remove(),n===`after`?r.insertAfter(e):r.insertBefore(e))}#g(e,t){let n=g({anchorNode:t.node,anchorOffset:t.offset,focusNode:t.node,focusOffset:t.offset},this.#e);n&&(j(n),e.remove(),n.insertNodes([e]))}#_(e){this.#C();let t=this.#u(e);t&&this.#b(this.#v(t))}#v(e){if(e.decoratorKey)return this.#y(e);let{node:t,offset:n}=e,r=oT(t,n);if(r)return r;let i=t.nodeType===Node.TEXT_NODE?t.parentElement:t;if(!i)return null;let a=i.getBoundingClientRect();return{left:a.left,top:a.top,height:a.height}}#y({decoratorKey:e,placement:t}){let n=this.#e.getRootElement()?.querySelector(`[data-lexical-node-key="${e}"]`);if(!n)return null;let r=n.getBoundingClientRect();return{left:t===`after`?r.right:r.left,top:r.top,height:r.height}}#b(e){if(!e)return;let t=this.#x();t.style.blockSize=`${e.height}px`,t.style.insetInlineStart=`${e.left}px`,t.style.insetBlockStart=`${e.top}px`}#x(){return this.#i||=$(`div`,{className:`lexxy-drop-caret`}),this.#S().appendChild(this.#i),this.#i.style.display=`block`,this.#i}#S(){return this.#e.getRootElement().closest(`lexxy-editor`)}#C(){this.#i&&(this.#i.style.display=`none`)}#w(e){return e?.closest?.(`[data-lexxy-decorator][data-lexical-node-key]`)}#T(){this.#t&&(this.#e.getRootElement()?.querySelector(`[data-lexical-node-key="${this.#t}"]`))?.classList.remove(`lexxy-dragging`),this.#C(),this.#t=null,this.#n&&=(cancelAnimationFrame(this.#n),null),this.#r&&=(cancelAnimationFrame(this.#r),null)}},lT=class extends eS{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return F({name:`lexxy/custom-attachment-drag-and-drop`,register:e=>{let t=new cT(e);return()=>t.destroy()}})}};const uT=/\r\n|[\n\r\u2028\u2029]/;var dT=class extends eS{get lexicalExtension(){return this.defineExtension({name:`lexxy/line-separators`,register(e){return e.registerNodeTransform(dn,fT)}})}};function fT(e){let t=e.getTextContent().match(uT);if(t){let n;t.index===0?[n]=e.splitText(t[0].length):[,n]=e.splitText(t.index,t.index+t[0].length),n.replace(d())}}var pT=class extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=[`bold`,`italic`,`strikethrough`];static observedAttributes=[`autocapitalize`,`connected`,`required`];#e=``;#t=null;#n=!1;#r=!1;#i=new ox;#a=[];#o={undo:!1,redo:!1};#s=new Map;#c=document.createElement(`textarea`);#l;constructor(){super(),this.internals=this.attachInternals(),this.internals.role=`presentation`}get uploadRequests(){return this.#l}connectedCallback(){this.id||=px(`lexxy-editor`),this.config=new XC(this),this.extensions=new gw(this),this.#a.push(this.extensions),this.editor=this.#_(),this.#a.push(this.editor),this.#a.push(this.#i),this.contents=new fw(this),this.#a.push(this.contents),this.selection=new YC(this),this.#a.push(this.selection),this.clipboard=new pw(this),this.#a.push(this.clipboard),this.adapter=new _w,this.#l=new rC;let e=qC.configureFor(this);this.#a.push(e),this.#h(),this.toggleAttribute(`connected`,!0),requestAnimationFrame(()=>{this.#v(),this.#W(),this.#re()})}disconnectedCallback(){this.#n=!1,this.#r=!1,this.#t=null,this.valueBeforeDisconnect=this.value,this.#P(),this.#se()}attributeChangedCallback(e,t,n){typeof this[`${e}ChangedCallback`]==`function`&&this[`${e}ChangedCallback`](t,n)}autocapitalizeChangedCallback(){this.editorContentElement&&this.#x(this.editorContentElement,`autocapitalize`)}connectedChangedCallback(e,t){this.isConnected&&e!=null&&e!==t&&requestAnimationFrame(()=>this.#le())}requiredChangedCallback(){this.isConnected&&this.#A()}formResetCallback(){this.value=this.#e,this.editor.dispatchCommand(it,void 0)}toString(){return this.cachedStringValue??=this.editor?.read(()=>mT(ye()))}get form(){return this.internals.form}get name(){return this.getAttribute(`name`)}get required(){return this.hasAttribute(`required`)}get validity(){return this.internals.validity}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}setElementValidity(e,t,n){this.#s.set(e,{flags:t,message:n}),this.#A()}get toolbarElement(){return this.#Y?(this.toolbar??=this.#J(),this.toolbar):null}get baseExtensions(){return[Tw,jw,_C,Nw,zw,RS,Hw,Xw,rT,aT,lT,dT]}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get permittedAttachmentTypes(){let e=this.config.get(`permittedAttachmentTypes`);if(e==null)return null;{let t=Array.isArray(e)?e:String(e).split(/\s+/);return Object.freeze(t.filter(e=>e&&e!==`false`))}}permitsAttachmentContentType(e){if(this.supportsAttachments){let t=this.permittedAttachmentTypes;return t===null||t.includes(e)}return!1}acceptsFile(e){return dx(this,`lexxy:file-accept`,{file:e},!0)}$generateNodesFromDOM(e,{editor:t=this.editor}={}){let n=jd(t,e);return Ce(Zt)&&(n=qS(n,this)),GS(n,this)}get isEmpty(){return[`<p><br></p>`,`<p></p>`,``].includes(this.value.trim())}get isBlank(){return this.isEmpty||this.toString().match(/^\s*$/g)!==null}get hasOpenPrompt(){return this.querySelector(`.lexxy-prompt-menu.lexxy-prompt-menu--visible`)!==null}get preset(){return this.getAttribute(`preset`)||`default`}get supportsAttachments(){return this.config.get(`attachments`)}get supportsMarkdown(){return this.supportsRichText&&this.config.get(`markdown`)}get supportsMultiLine(){return this.config.get(`multiLine`)&&!this.isSingleLineMode}get supportsRichText(){return this.config.get(`richText`)}registerAdapter(e){this.adapter=e,this.editor&&(this.#ne(),this.#te())}freezeSelection(){this.adapter.freeze()}thawSelection(){this.adapter.thaw()}dispatchAttributesChange(){this.#te()}dispatchEditorInitialized(){this.#ne()}get isSingleLineMode(){return this.hasAttribute(`single-line`)}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute(`tabindex`)??`0`)}focus(){this.#u||this.editor.focus(()=>this.#U())}get#u(){return!!this.editor&&sS(this.editor)}get value(){return this.cachedValue??=this.#d()}set value(e){let n=this.#u;this.editor.update(()=>{n?He(()=>this.editor.focus()):t(on),this.#E(e),this.#Z()},{discrete:!0})}get canUndo(){return this.#o.undo}get canRedo(){return this.#o.redo}#d(){return this.editor?.read(()=>Bx(Ad(this.editor,null)))??null}#f(e,{editor:t=this.editor}={}){return e||=`<p></p>`,this.$generateNodesFromDOM(cx(`${e}`),{editor:t}).filter(this.#p).map(this.#m)}#p(e){return!(D(e)||A(e)&&e.getTextContent().trim()===``)}#m(e){if(!A(e))return e;let t=p();return t.append(e),t}#h(){this.#F(),this.#R(),this.#z(),this.#G(),this.#g(),this.#K(),this.#q(),this.#D(),this.#w(this.value,{suppressEvent:!0}),this.#k()}#g(){this.#i.track(Q(this,`lexxy:file-accept`,e=>{this.permitsAttachmentContentType(e.detail.file.type)||e.preventDefault()}))}#_(){return this.editorContentElement||=this.#b(),this.appendChild(this.editorContentElement),Lc({name:`lexxy/core`,namespace:`Lexxy`,theme:nC,nodes:this.#y,html:{export:new Map([[dn,vw],[Rh,vw]])},$initialEditorState:e=>{this.#Q(e),this.#T(e)}},...this.extensions.lexicalExtensions)}#v(){this.editor.setEditable(!1),this.editor.setRootElement(this.editorContentElement),this.editor.setEditable(!0)}get#y(){let e=[Gx];return this.supportsRichText&&e.push(fp,dp,Pu,Nu,zh,Rh,Fl,Pl,ZS),e}#b(){let e=$(`div`,{id:`${this.id}-content`,classList:`lexxy-editor__content`,contenteditable:!0,role:`textbox`,"aria-multiline":!0,"aria-label":this.#S,placeholder:this.getAttribute(`placeholder`)});return this.#C.forEach(t=>e.setAttribute(t.name,t.value)),this.#x(e,`autocapitalize`),this.#x(e,`tabindex`,{defaultValue:0,removeSource:!0}),e}#x(e,t,{defaultValue:n=null,removeSource:r=!1}={}){this.hasAttribute(t)?e.setAttribute(t,this.getAttribute(t)):n===null?e.removeAttribute(t):e.setAttribute(t,n),r&&this.removeAttribute(t)}get#S(){return Array.from(this.internals.labels).map(e=>e.textContent).join(` `)}get#C(){return Array.from(this.attributes).filter(e=>e.name.startsWith(`aria-`))}#w(e,{suppressEvent:t=!1}={}){let n=e!==this.#t;this.internals.setFormValue(e),this.#t=e,n&&!t&&dx(this,`lexxy:change`)}#T(e){let t=this.valueBeforeDisconnect||this.getAttribute(`value`)||`<p><br></p>`;this.#e=t,this.#E(t,{editor:e})}#E(e,{editor:t=this.editor}={}){ye().clear().selectEnd().insertNodes(this.#f(e,{editor:t}))}#D(){this.#i.track(Q(document,`turbo:before-cache`,this.#O))}#O=e=>{this.closest(`[data-turbo-permanent]`)||this.#se()};#k(){this.#i.track(this.editor.registerUpdateListener(({editorState:e})=>{this.#P(),this.#w(this.value),this.#Z(),this.#A(),this.#te()}))}async#A(){await wx(),this.isConnected&&this.#j()}#j(){this.#M();let{validity:e,message:t}=this.#N();this.internals.setValidity(e,t,this.editorContentElement)}#M(){this.#c.required=this.required&&this.isBlank;let e=this.#c.validity,t=this.#c.validationMessage;this.#s.set(this,{flags:e,message:t})}#N(){let e={},t=[];for(let{flags:n,message:r}of this.#s.values())if(n.valid!==!0)for(let i in n)n[i]&&(e[i]=!0,t.push(r));return{validity:e,message:t.join(`
|
|
278
|
+
`)}}#P(){this.cachedValue=null,this.cachedStringValue=null}#F(){let e=[];if(this.supportsRichText){if(e.push(mp(this.editor),Fu(this.editor)),this.#I(),this.#L(),this.supportsMarkdown){let t=[...s_,QS];e.push(c_(this.editor,t),eC(this.editor,t))}}else e.push(Nf(this.editor));this.#i.track(...e)}#I(){let e=this.querySelector(`lexxy-table-tools`);e??=$(`lexxy-table-tools`),this.append(e),this.#a.push(e)}#L(){let e=this.querySelector(`lexxy-code-language-picker`);e??=$(`lexxy-code-language-picker`),this.append(e),this.#a.push(e)}#R(){this.#i.track(this.editor.registerCommand(Ht,e=>e.ctrlKey||e.metaKey||!this.supportsMultiLine?(e.preventDefault(),!0):!1,ct))}#z(){this.#i.track(Q(this,`focusin`,this.#B),Q(this,`focusout`,this.#V))}#B(e){this.#H(e.target)&&!this.currentlyFocused&&(this.#te(),dx(this,`lexxy:focus`),this.currentlyFocused=!0)}#V(e){this.#H(e.relatedTarget)||(dx(this,`lexxy:blur`),this.currentlyFocused=!1)}#H(e){return this.contains(e)||this.toolbarElement?.contains(e)}#U(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#W(){document.querySelector(`:focus`)||this.hasAttribute(`autofocus`)&&document.querySelector(`[autofocus]`)===this&&this.focus()}#G(){this.#i.track(this.editor.registerCommand(nt,e=>{this.#o.undo=e},ct),this.editor.registerCommand(tt,e=>{this.#o.redo=e},ct))}#K(){}#q(){this.#Y&&(this.toolbarElement.setEditor(this),typeof this.toolbarElement.dispose==`function`&&this.#a.push(this.toolbarElement),this.extensions.initializeToolbars())}#J(){let e=this.config.get(`toolbar`);return typeof e==`string`?document.getElementById(e):this.querySelector(`lexxy-toolbar`)??this.#X()}get#Y(){return this.supportsRichText&&!!this.config.get(`toolbar`)}#X(){let e=$(`lexxy-toolbar`);return e.innerHTML=bx.defaultTemplate,e.setAttribute(`data-attachments`,this.supportsAttachments),e.configure(this.config.get(`toolbar`)),this.prepend(e),e}#Z(){this.classList.toggle(`lexxy-editor--empty`,this.isEmpty)}#Q(e){zx(this.#$(e))}#$(e){return this.#ee(e).concat(this.extensions.allowedElements)}#ee(e){return Array.from(e._htmlConversions.keys()).filter(e=>!e.startsWith(`#`))}#te(){let e=null,t=null,n=null,r=null;this.editor.getEditorState().read(()=>{let i=w();if(!O(i))return;let a=this.selection.getFormat();if(Object.keys(a).length===0)return;let o=i.anchor.getNode(),s=Qo(o,Fl);e={bold:{active:a.isBold,enabled:!0},italic:{active:a.isItalic,enabled:!0},strikethrough:{active:a.isStrikethrough,enabled:!0},code:{active:a.isInCode,enabled:!0},highlight:{active:a.isHighlight,enabled:!0},link:{active:a.isInLink,enabled:!0},quote:{active:a.isInQuote,enabled:!0},heading:{active:a.isInHeading,enabled:!0},"unordered-list":{active:a.isInList&&a.listType===`bullet`,enabled:!0},"ordered-list":{active:a.isInList&&a.listType===`number`,enabled:!0},undo:{active:!1,enabled:this.canUndo},redo:{active:!1,enabled:this.canRedo}},t=s?s.getURL():null,n=a.isHighlight?sC(i):null,r=a.headingTag??null}),e&&this.adapter.dispatchAttributesChange(e,t,n,r)}#ne(){this.adapter&&(this.#r=!0,this.adapter.dispatchEditorInitialized({highlightColors:this.#ie,headingFormats:this.#ae}))}#re(){this.isConnected&&this.adapter&&(this.#n||(this.#n=!0,dx(this,`lexxy:initialize`)),this.#r||this.#ne())}get#ie(){let e=this.config.get(`highlight.buttons`);return e?{colors:this.#oe(`color`,e.color||[]),backgroundColors:this.#oe(`background-color`,e[`background-color`]||[])}:null}get#ae(){return this.supportsRichText?[{label:`Normal`,command:`setFormatParagraph`,tag:null},...this.config.get(`headings`).map((e,t)=>({label:Dx.labelFor(e,t),command:Dx.commandFor(t),tag:e}))]:[]}#oe(e,t){let n=document.createElement(`span`);n.style.display=`none`;let r=t.map(t=>{let r=document.createElement(`span`);return r.style.setProperty(e,t),n.appendChild(r),{element:r,name:t}});aC().appendChild(n);let i=r.map(({element:t,name:n})=>({name:n,value:window.getComputedStyle(t).getPropertyValue(e)}));return n.remove(),i}#se(){this.#ce(),this.#ue(),this.#l?.clear(),this.editorContentElement?.remove(),this.editorContentElement=null,this.toolbar=null}#ce(){for(;this.#a.length;)this.#a.pop().dispose()}#le(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}#ue(){this.#s=new Map}};function mT(e){if(e instanceof Gx)return e.getReadableTextContent();if(E(e)){let t=``,n=e.getChildren();for(let e=0;e<n.length;e++){let r=n[e],i=n[e-1];_S(r,i,e,n.length)||(t+=mT(r),E(r)&&e!==n.length-1&&!r.isInline()&&(t+=`
|
|
279
|
+
|
|
280
|
+
`))}return t}return e.getTextContent()}var hT=class{async buildListItems(e=``){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){let t=e.querySelector(`template[type='menu']`).content.cloneNode(!0),n=$(`li`,{role:`option`,id:px(`prompt-item`),tabindex:`0`});return n.classList.add(`lexxy-prompt-menu__item`),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{let t=cx(await(await fetch(e)).text()).querySelectorAll(`lexxy-prompt-item`);return Promise.resolve(Array.from(t))}catch(e){return Promise.reject(e)}}},gT=class extends hT{async buildListItems(e=``){let t=await this.fetchPromptItems();return this.#e(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#e(e,t){if(this.promptItemByListItem=new WeakMap,!t)return this.#t(e);let n=[];for(let r of e){let e=Xx(r.getAttribute(`search`),t);e>=0&&n.push({promptItem:r,position:e})}n.sort((e,t)=>e.position-t.position);let r=[];for(let{promptItem:e}of n){if(r.length>=100)break;let t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),r.push(t)}return r}#t(e){let t=[];for(let n of e){if(t.length>=100)break;let e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}},_T=class extends gT{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}},vT=class extends gT{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}},yT=class extends hT{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=Sx(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=``){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){let t=await this.loadPromptItemsFromUrl(this.#e(e));return this.#t(t)}#e(e){let t=new URL(this.baseURL,window.location.origin);return t.searchParams.append(`filter`,e),t.toString()}#t(e){let t=[];this.promptItemByListItem=new WeakMap;for(let n of e){if(t.length>=100)break;let e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}},bT=class extends HTMLElement{#e=new ox;#t=new ox;#n=xx(()=>this.#A(),50);constructor(){super(),this.showPopoverId=0}static observedAttributes=[`connected`];connectedCallback(){this.source=this.#i(),this.#a(),this.#O(),this.toggleAttribute(`connected`,!0)}disconnectedCallback(){this.#t.dispose(),this.#e.dispose(),this.source=null,this.#k()}attributeChangedCallback(e,t,n){e===`connected`&&this.isConnected&&t!=null&&t!==n&&requestAnimationFrame(()=>this.#te())}get name(){return this.getAttribute(`name`)}get trigger(){return this.getAttribute(`trigger`)}get supportsSpaceInSearches(){return this.hasAttribute(`supports-space-in-searches`)}get onlyAt(){return this.getAttribute(`only-at`)}get verticalDirection(){return this.getAttribute(`vertical-direction`)}get open(){return this.popoverElement?.classList?.contains(`lexxy-prompt-menu--visible`)}get closed(){return!this.open}get#r(){return!this.supportsSpaceInSearches}#i(){let e=this.getAttribute(`src`);return e?this.hasAttribute(`remote-filtering`)?new yT(e):new vT(e):new _T(this.querySelectorAll(`lexxy-prompt-item`))}#a(){this.#s&&this.#t.track(this.#u.registerUpdateListener(({editorState:e})=>{e.read(()=>{if(this.#f.isInsideCodeBlock)return;let{node:e,offset:t}=this.#f.selectedNodeWithOffset();if(e&&A(e)){let n=e.getTextContent(),r=this.trigger.length;if(t>=r&&n.slice(t-r,t)===this.trigger){let n=gS(e,t-r);this.#o.test(n)&&(this.#t.dispose(),this.#p())}}})}))}get#o(){return RegExp(`(?:${this.onlyAt??`^|[ \\n]`})$`)}get#s(){if(this.hasAttribute(`insert-editable-text`))return!0;let e=this.#d;if(e.supportsAttachments){let t=Array.from(this.querySelectorAll(`template[type='editor']`));return(t.length?t.map(e=>e.getAttribute(`content-type`)||this.#Y):[this.#Y]).some(t=>e.permitsAttachmentContentType(t))}return!1}#c(){this.#t.track(this.#u.registerUpdateListener(({editorState:e})=>{this.closed||e.read(()=>{if(this.#f.isInsideCodeBlock){this.#D();return}let{node:e,offset:t}=this.#f.selectedNodeWithOffset();e&&(this.#l(e,t)?this.popoverElement.hasAttribute(`data-anchored`)||this.#C():this.#D())})}))}#l(e,t){if(!A(e)||t===0)return!1;let n=e.getTextContent().slice(0,t),r=n.lastIndexOf(this.trigger);if(r===-1)return!1;let i=n.slice(r+this.trigger.length);return!(this.supportsSpaceInSearches?/\n/:/[ \n]/).test(i)}get#u(){return this.#d.editor}get#d(){return this.closest(`lexxy-editor`)}get#f(){return this.#d.selection}async#p(){let e=++this.showPopoverId;this.popoverElement??=await this.#$(),this.showPopoverId===e&&(this.#E(),await this.#A(),this.showPopoverId===e&&(this.popoverElement.classList.toggle(`lexxy-prompt-menu--visible`,!0),this.#_(),this.#t.track(Q(this.#d,`keydown`,this.#F),Q(this.#d,`lexxy:change`,this.#n)),this.#m(),this.#c()))}#m(){this.#t.track(this.#u.registerCommand(Ht,this.#V.bind(this),st),this.#u.registerCommand(Gt,this.#V.bind(this),st)),this.#r&&(this.#t.track(this.#u.registerCommand(Wt,this.#V.bind(this),st)),this.#t.track(this.#u.registerCommand(At,this.#I.bind(this),st))),this.#t.track(this.#u.registerCommand(Rt,this.#h.bind(this),st),this.#u.registerCommand(Ft,this.#g.bind(this),st))}#h(e){return this.#R(),e.preventDefault(),!0}#g(e){return this.#L(),e.preventDefault(),!0}#_(){let e=this.#v[0];e&&this.#y(e)}get#v(){return Array.from(this.popoverElement.querySelectorAll(`.lexxy-prompt-menu__item`))}#y(e,{scrollIntoView:t=!1}={}){this.#b(),e.toggleAttribute(`aria-selected`,!0),t&&e.scrollIntoView({block:`nearest`,container:`nearest`,behavior:`smooth`}),this.#S(`aria-controls`,this.popoverElement.id),this.#S(`aria-activedescendant`,e.id),this.#S(`aria-haspopup`,`listbox`)}#b(){this.#v.forEach(e=>{e.toggleAttribute(`aria-selected`,!1)})}#x(){this.#b(),this.#Q.removeAttribute(`aria-controls`),this.#Q.removeAttribute(`aria-activedescendant`),this.#Q.removeAttribute(`aria-haspopup`)}#S(e,t){this.#Q.getAttribute(e)!==t&&this.#Q.setAttribute(e,t)}#C(){let e=this.#f.cursorPosition;if(!e)return;let{x:t,y:n,fontSize:r}=e,i=this.#d.getBoundingClientRect(),a=this.#Q.getBoundingClientRect(),o=a.top-i.top;this.popoverElement.hasAttribute(`data-anchored`)||(this.#w(t),this.#T(n+o),this.popoverElement.toggleAttribute(`data-anchored`,!0));let s=this.popoverElement.getBoundingClientRect();s.right>i.right&&this.popoverElement.toggleAttribute(`data-clipped-at-right`,!0);let c=this.verticalDirection===`top`,l=this.verticalDirection===`bottom`,u=s.bottom>window.innerHeight;!l&&(c||u)&&(this.#T(a.height-n+r),this.popoverElement.toggleAttribute(`data-clipped-at-bottom`,!0))}#w(e){this.popoverElement.style.setProperty(`--lexxy-prompt-offset-x`,`${e}px`)}#T(e){this.popoverElement.style.setProperty(`--lexxy-prompt-offset-y`,`${e}px`)}#E(){this.popoverElement.removeAttribute(`data-clipped-at-bottom`),this.popoverElement.removeAttribute(`data-clipped-at-right`),this.popoverElement.removeAttribute(`data-anchored`)}async#D(){this.showPopoverId++,this.#x(),this.popoverElement.classList.toggle(`lexxy-prompt-menu--visible`,!1),this.#t.dispose(),await wx(),this.#a()}#O(){this.#e.track(Q(document,`turbo:before-cache`,()=>this.#k()))}#k(){this.#t.dispose(),this.popoverElement?.remove(),this.popoverElement=null}#A=async()=>{if(this.initialPrompt){this.initialPrompt=!1;return}if(this.#Z.containsTextBackUntil(this.trigger)){if(await this.#j(),!this.#Z.containsTextBackUntil(this.trigger)){this.#D();return}await wx(),this.#C()}else this.#D()};async#j(){let e=this.showPopoverId,t=this.#Z.textBackUntil(this.trigger),n=await this.source.buildListItems(t);this.showPopoverId===e&&this.#Z.containsTextBackUntil(this.trigger)&&(this.popoverElement.innerHTML=``,n.length>0?this.#M(n):this.#N(),this.#_())}#M(e){this.popoverElement.classList.remove(`lexxy-prompt-menu--empty`),this.popoverElement.append(...e)}#N(){this.popoverElement.classList.add(`lexxy-prompt-menu--empty`);let e=$(`li`,{textContent:this.#P});e.classList.add(`lexxy-prompt-menu__item--empty`),this.popoverElement.append(e)}get#P(){return this.getAttribute(`empty-results`)||`Nothing found`}#F=e=>{e.key===`Escape`?(this.#D(),this.#d.focus(),e.stopPropagation()):e.key===`,`&&(e.preventDefault(),e.stopPropagation(),this.#H(),this.#u.update(()=>{let e=w();O(e)&&e.insertText(`,`)}))};#I(e){if(e.inputType===`insertText`&&e.data===` `)return this.#V(e)}#L(){let e=this.#z+1;e<this.#v.length&&this.#y(this.#v[e],{scrollIntoView:!0})}#R(){let e=this.#z-1;e>=0&&this.#y(this.#v[e],{scrollIntoView:!0})}get#z(){return this.#v.findIndex(e=>e.hasAttribute(`aria-selected`))}get#B(){return this.#v[this.#z]}#V(e){return e.preventDefault(),e.stopPropagation(),this.#H(),!0}#H(){this.#U(),this.#D(),this.#d.focus()}#U(){let e=this.source.promptItemFor(this.#B);if(!e)return;let t=Array.from(e.querySelectorAll(`template[type='editor']`)),n=`${this.trigger}${this.#Z.textBackUntil(this.trigger)}`;this.hasAttribute(`insert-editable-text`)?this.#W(t,n):this.#K(t,n,e.getAttribute(`sgid`))}#W(e,t){this.#u.update(()=>{let n=e.flatMap(e=>this.#G(e));this.#Z.replaceTextBackUntil(t,n)})}#G(e){return this.#d.$generateNodesFromDOM(cx(`${e.innerHTML}`))}#K(e,t,n=null){this.#u.update(()=>{let r=this.#q(e,n).flatMap(e=>[e,this.#J()]).slice(0,-1);this.#Z.replaceTextBackUntil(t,r)})}#q(e,t=null){return e.filter(e=>this.#d.permitsAttachmentContentType(e.getAttribute(`content-type`)||this.#Y)).map(e=>this.#X(e.innerHTML,e.getAttribute(`content-type`)||this.#Y,e.getAttribute(`sgid`)||t))}#J(){return v(` `)}get#Y(){return`application/vnd.${Rx.global.get(`attachmentContentTypeNamespace`)}.${this.name}`}#X(e,t,n){return new Gx({sgid:n,contentType:t,innerHtml:e})}get#Z(){return this.#d.contents}get#Q(){return this.#d.editorContentElement}async#$(){let e=$(`ul`,{role:`listbox`,id:px(`prompt-popover`)});return e.classList.add(`lexxy-prompt-menu`),e.style.position=`absolute`,e.setAttribute(`nonce`,ax()),e.append(...await this.source.buildListItems()),this.#e.track(Q(e,`click`,this.#ee)),this.#d.appendChild(e),e}#ee=e=>{let t=e.target.closest(`.lexxy-prompt-menu__item`);t&&(this.#y(t),this.#H())};#te(){this.disconnectedCallback(),this.connectedCallback()}},xT=class extends HTMLElement{#e=null;#t=new ox;connectedCallback(){this.editorElement=this.closest(`lexxy-editor`),this.editor=this.editorElement.editor,this.classList.add(`lexxy-floating-controls`),this.#e=new AbortController,this.#t.track(()=>this.#e?.abort()),this.#n(),this.#h(),this.#l()}disconnectedCallback(){this.dispose()}dispose(){this.#t.dispose()}#n(){this.languagePickerElement=this.#r()??this.#i();let e=this.#e.signal;this.#t.track(Q(this.languagePickerElement,`change`,()=>{this.#c(this.languagePickerElement.value)},{signal:e})),this.#t.track(Q(this.languagePickerElement,`mousedown`,e=>{this.#o(e)},{signal:e})),this.languagePickerElement.setAttribute(`nonce`,ax()),this.appendChild(this.languagePickerElement)}#r(){return this.querySelector(`select`)}#i(){let e=$(`select`,{className:`lexxy-code-language-picker`,"aria-label":`Pick a language…`,name:`lexxy-code-language`});for(let[t,n]of Object.entries(this.#a)){let r=document.createElement(`option`);r.value=t,r.textContent=n,e.appendChild(r)}return e}get#a(){let e={...Lh};e.ruby||=`Ruby`,e.php||=`PHP`,e.go||=`Go`,e.bash||=`Bash`,e.json||=`JSON`,e.diff||=`Diff`,e.kotlin||=`Kotlin`,delete e.plain;let t=Object.entries(e).sort((e,t)=>e[1].localeCompare(t[1]));return{plain:`Plain text`,...Object.fromEntries(t)}}#o(e){dx(this.editorElement,`lexxy:code-language-picker-open`,{languages:this.#s,currentLanguage:this.languagePickerElement.value},!0)||e.preventDefault()}get#s(){return Object.entries(this.#a).map(([e,t])=>({key:e,name:t}))}#c(e){this.editor.update(()=>{let t=this.#u();t&&t.setLanguage(e)})}#l(){this.#t.track(this.editor.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=this.#u();e?this.#d(e):this.#h()})}))}#u(){return this.editorElement.selection.nearestNodeOfType(zh)}#d(e){let t=e.getLanguage();this.#f(t),this.#m(),this.#p(e)}#f(e){if(this.languagePickerElement&&e){let t=Vh(e);this.languagePickerElement.value=t}}#p(e){let t=this.editor.getElementByKey(e.getKey());if(!t)return;let n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top,a=r.right-n.right;this.style.top=`${i}px`,this.style.right=`${a}px`}#m(){this.hidden=!1}#h(){this.hidden=!0}},ST=class extends HTMLElement{connectedCallback(){this.editorElement=this.closest(`lexxy-editor`),this.editor=this.editorElement.editor,this.classList.add(`lexxy-floating-controls`),this.querySelector(`.lexxy-node-delete`)||this.#e()}disconnectedCallback(){this.editor=null,this.editorElement=null}#e(){let e=$(`div`,{className:`lexxy-floating-controls__group`});this.deleteButton=$(`button`,{className:`lexxy-node-delete`,type:`button`,"aria-label":`Remove`}),this.deleteButton.tabIndex=-1,this.deleteButton.innerHTML=`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
281
|
+
<path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>
|
|
282
|
+
</svg>`,this.handleDeleteClick=()=>this.#t(),this.deleteButton.addEventListener(`click`,this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#t(){this.editor.update(()=>{me(this)?.remove()})}},CT=class{#e=new ox;constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#v()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#e.dispose()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read(()=>{let e=C(this.currentCellKey);return e instanceof wy?e:null}):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read(()=>{let e=C(this.currentTableNodeKey);return e instanceof Ty?e:null}):null}get currentRowCells(){let e=this.currentRowIndex,t=this.tableRows;return t?this.editor.getEditorState().read(()=>t[e]?.getChildren()??null)??null:null}get currentRowIndex(){let e=this.currentCell;return e?this.editor.getEditorState().read(()=>yy(e))??0:0}get currentColumnCells(){let e=this.currentColumnIndex,t=this.tableRows;return t?this.editor.getEditorState().read(()=>t.map(t=>t.getChildAtIndex(e)))??null:null}get currentColumnIndex(){let e=this.currentCell;return e?this.editor.getEditorState().read(()=>vy(e))??0:0}get tableRows(){return this.editor.getEditorState().read(()=>this.currentTableNode?.getChildren())??null}updateSelectedTable(){let e=null,t=null;return this.editor.getEditorState().read(()=>{let n=w();if(!n||!this.selection.isTableCellSelected)return;let r=n.getNodes()[0];e=my(r),t=hy(r)}),this.currentCellKey=e?.getKey()??null,this.currentTableNodeKey=t?.getKey()??null,t}executeTableCommand(e,t=null){if(e.action===`delete`&&e.childType===`table`){this.#r();return}if(e.action===`toggle`){this.#n(e);return}this.#t(e,t)}#t(e,t=null){this.#i(),this.editor.dispatchCommand(this.#a(e)),this.#c(e,t)}#n(e){let t=e.childType,n=null,r=null;t===`row`?(n=this.currentRowCells,r=Cy.ROW):t===`column`&&(n=this.currentColumnCells,r=Cy.COLUMN),!(!n||n.length===0)&&this.editor.update(()=>{let e=_y(n[0]);if(!e)return;let t=e.getHeaderStyles()^r;n.forEach(e=>{this.#o(e,t,r)})})}#r(){this.#i(),this.editor.dispatchCommand(`deleteTable`)}#i(){this.editor.update(()=>{let e=w();if(!e)return;let t=e.getNodes()[0];my(t)?.selectEnd()})}#a(e){let{action:t,childType:n,direction:r}=e;return`${t}Table${Zx(n)}${t==`insert`?Zx(r):``}`}#o(e,t,n){_y(e)?.setHeaderStyles(t,n)}async#s(e,t){if(await wx(),!this.currentTableNode)return;let n=this.tableRows;if(!n)return;let r=n[e];r&&this.editor.update(()=>{_y(r.getChildAtIndex(t))?.selectEnd()})}#c(e,t=null){let{childType:n,direction:r}=e,i=this.currentRowIndex,a=t===null?this.currentColumnIndex:t,o=e.action===`delete`?-1:0,s=r===`after`?1:o;n===`row`?i+=s:n===`column`&&(a+=s),this.#s(i,a)}#l(){let e=this.tableRows;if(!e)return;let t=e.at(this.currentRowIndex+1);t&&this.editor.update(()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()})}#u(){let e=this.currentCell;e&&this.editor.update(()=>{e.selectPrevious()})}#d(){this.executeTableCommand({action:`insert`,childType:`row`,direction:`after`},0)}#f(){this.executeTableCommand({action:`delete`,childType:`row`},-1)}#p(){let e=this.currentTableNode;this.executeTableCommand({action:`delete`,childType:`row`}),this.editor.update(()=>{let t=e?.getNextSibling();if(Pe(t))t.selectStart();else{let e=p();this.currentTableNode.insertAfter(e),e.selectStart()}})}#m(){if(!this.currentTableNode)return!1;let e=this.currentCell;return e?e.getTextContent().trim()===``:!1}#h(){if(!this.currentTableNode)return!1;let e=this.tableRows;return e?e.length===this.currentRowIndex+1:!1}#g(){if(!this.currentTableNode)return!1;let e=this.currentRowCells;return e?e.every(e=>e.getTextContent().trim()===``):!1}#_(){if(!this.currentTableNode)return!1;let e=this.currentRowCells;return e?e.indexOf(this.currentCell)===0:!1}#v(){this.#e.track(this.editor.registerCommand(zt,e=>this.#y(e),N),this.editor.registerCommand(Ht,e=>this.#b(e),N))}#y(e){return this.currentTableNode?this.#g()&&this.#_()?(e.preventDefault(),this.#f(),!0):this.#m()&&!this.#_()?(e.preventDefault(),this.#u(),!0):!1:!1}#b(e){return e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode||this.selection.isInsideList||this.selection.isInsideCodeBlock?!1:(e.preventDefault(),this.#h()&&this.#g()?this.#p():this.#h()?this.#d():this.#l(),!0)}},wT={"insert-row-before":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
283
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 15C8.29055e-07 15.8284 0.671574 16.5 1.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V4.5L16.4922 4.34668C16.4154 3.59028 15.7767 3 15 3H13.5L13.5 4.5H15V9H1.5L1.5 4.5L3 4.5V3H1.5C0.671574 3 1.20956e-06 3.67157 1.24577e-06 4.5L7.86804e-07 15ZM15 10.5V15H1.5L1.5 10.5H15Z"/>
|
|
284
|
+
<path d="M4.5 4.5H7.5V7.5H9V4.5H12L12 3L9 3V6.55671e-08L7.5 0V3L4.5 3V4.5Z"/>
|
|
285
|
+
</svg>`,"insert-row-after":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
286
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 13.5C7.50592e-07 14.3284 0.671574 15 1.5 15H3V13.5H1.5L1.5 9L15 9V13.5H13.5V15H15C15.7767 15 16.4154 14.4097 16.4922 13.6533L16.5 13.5V3L16.4922 2.84668C16.4205 2.14069 15.8593 1.57949 15.1533 1.50781L15 1.5L1.5 1.5C0.671574 1.5 1.28803e-06 2.17157 1.24577e-06 3L7.86804e-07 13.5ZM15 3V7.5L1.5 7.5L1.5 3L15 3Z"/>
|
|
287
|
+
<path d="M7.5 15V18H9V15H12V13.5H9V10.5H7.5V13.5H4.5V15H7.5Z"/>
|
|
288
|
+
</svg>`,"delete-row":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
289
|
+
<path d="M16.4922 12.1533C16.4154 12.9097 15.7767 13.5 15 13.5L12 13.5V12H15V6L1.5 6L1.5 12H4.5V13.5H1.5C0.723337 13.5 0.0846104 12.9097 0.00781328 12.1533L7.86804e-07 12L1.04907e-06 6C1.17362e-06 5.22334 0.590278 4.58461 1.34668 4.50781L1.5 4.5L15 4.5C15.8284 4.5 16.5 5.17157 16.5 6V12L16.4922 12.1533Z"/>
|
|
290
|
+
<path d="M10.3711 15.9316L8.25 13.8096L6.12793 15.9316L5.06738 14.8711L7.18945 12.75L5.06738 10.6289L6.12793 9.56836L8.25 11.6895L10.3711 9.56836L11.4316 10.6289L9.31055 12.75L11.4316 14.8711L10.3711 15.9316Z"/>
|
|
291
|
+
</svg>`,"toggle-row":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
292
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.00781328 13.6533C0.0846108 14.4097 0.723337 15 1.5 15L15 15L15.1533 14.9922C15.8593 14.9205 16.4205 14.3593 16.4922 13.6533L16.5 13.5V4.5L16.4922 4.34668C16.4205 3.64069 15.8593 3.07949 15.1533 3.00781L15 3L1.5 3C0.671574 3 1.24863e-06 3.67157 1.18021e-06 4.5L7.86804e-07 13.5L0.00781328 13.6533ZM15 9V13.5L1.5 13.5L1.5 9L15 9Z"/>
|
|
293
|
+
</svg>`,"insert-column-before":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
294
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3H4.5V1.5H9V15H4.5V13.5H3V15C3 15.7767 3.59028 16.4154 4.34668 16.4922L4.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V1.5C16.5 0.671573 15.8284 6.03989e-09 15 0H4.5ZM15 15H10.5V1.5H15V15Z"/>
|
|
295
|
+
<path d="M3 7.5H0V9H3V12H4.5V9H7.5V7.5H4.5V4.5H3V7.5Z"/>
|
|
296
|
+
</svg>`,"insert-column-after":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
297
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 0C14.3284 0 15 0.671573 15 1.5V3H13.5V1.5H9V15H13.5V13.5H15V15C15 15.7767 14.4097 16.4154 13.6533 16.4922L13.5 16.5H3L2.84668 16.4922C2.14069 16.4205 1.57949 15.8593 1.50781 15.1533L1.5 15V1.5C1.5 0.671573 2.17157 6.03989e-09 3 0H13.5ZM3 15H7.5V1.5H3V15Z"/>
|
|
298
|
+
<path d="M15 7.5H18V9H15V12H13.5V9H10.5V7.5H13.5V4.5H15V7.5Z"/>
|
|
299
|
+
</svg>`,"delete-column":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
300
|
+
<path d="M12.1533 0.0078125C12.9097 0.0846097 13.5 0.723336 13.5 1.5V4.5H12V1.5H6V15H12V12H13.5V15C13.5 15.7767 12.9097 16.4154 12.1533 16.4922L12 16.5H6C5.22334 16.5 4.58461 15.9097 4.50781 15.1533L4.5 15V1.5C4.5 0.671573 5.17157 2.41596e-08 6 0H12L12.1533 0.0078125Z"/>
|
|
301
|
+
<path d="M15.9316 6.12891L13.8105 8.24902L15.9326 10.3711L14.8711 11.4316L12.75 9.31055L10.6289 11.4316L9.56738 10.3711L11.6885 8.24902L9.56836 6.12891L10.6289 5.06836L12.75 7.18848L14.8711 5.06836L15.9316 6.12891Z"/>
|
|
302
|
+
</svg>`,"toggle-column":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
303
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6533 17.9922C14.4097 17.9154 15 17.2767 15 16.5L15 3L14.9922 2.84668C14.9205 2.14069 14.3593 1.57949 13.6533 1.50781L13.5 1.5L4.5 1.5L4.34668 1.50781C3.59028 1.58461 3 2.22334 3 3L3 16.5C3 17.2767 3.59028 17.9154 4.34668 17.9922L4.5 18L13.5 18L13.6533 17.9922ZM9 3L13.5 3L13.5 16.5L9 16.5L9 3Z"/>
|
|
304
|
+
</svg>`,"delete-table":`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
305
|
+
<path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>
|
|
306
|
+
</svg>`},TT=class extends HTMLElement{#e=new ox;connectedCallback(){this.tableController=new CT(this.#n),this.classList.add(`lexxy-floating-controls`),this.role=`toolbar`,this.#i(),this.#b(),this.#_(),this.#d()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),this.tableController?.destroy(),this.tableController=null}get#t(){return this.#n.editor}get#n(){return this.closest(`lexxy-editor`)}get#r(){return Array.from(this.querySelectorAll(`button, details > summary`))}#i(){this.innerHTML=``,this.appendChild(this.#o()),this.appendChild(this.#s()),this.appendChild(this.#l()),this.#e.track(Q(this,`keydown`,this.#m))}#a(e,t,n){let r=$(`div`,{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#u(`Add ${e}`,{action:`insert`,childType:e,direction:`after`},`+`),a=this.#u(`Remove ${e}`,{action:`delete`,childType:e},`−`),o=$(`details`,{className:`lexxy-table-control__more-menu`});o.setAttribute(`name`,`lexxy-dropdown`),o.tabIndex=-1;let s=$(`summary`,{},`_ ${e}s`);return t(s),o.appendChild(s),o.appendChild(n),r.appendChild(a),r.appendChild(o),r.appendChild(i),r}#o(){return this.#a(`row`,e=>{this.rowCount=e},this.#c(`row`))}#s(){return this.#a(`column`,e=>{this.columnCount=e},this.#c(`column`))}#c(e){let t=$(`div`,{className:`lexxy-floating-controls__group lexxy-table-control__more-menu-details`}),n=this.#u(`Add ${e} before`,{action:`insert`,childType:e,direction:`before`}),r=this.#u(`Add ${e} after`,{action:`insert`,childType:e,direction:`after`}),i=this.#u(`Toggle ${e} style`,{action:`toggle`,childType:e}),a=this.#u(`Remove ${e}`,{action:`delete`,childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(a),t}#l(){let e=$(`div`,{className:`lexxy-table-control lexxy-floating-controls__group`}),t=this.#u(`Delete this table?`,{action:`delete`,childType:`table`});return t.classList.add(`lexxy-table-control__button--delete-table`),e.appendChild(t),this.deleteContainer=e,e}#u(e,t={},n=this.#D(t)){let r=$(`button`,{className:`lexxy-table-control__button`,"aria-label":e,type:`button`});return r.tabIndex=-1,r.innerHTML=`${n} <span>${e}</span>`,r.dataset.action=t.action,r.dataset.childType=t.childType,r.dataset.direction=t.direction,r.addEventListener(`click`,()=>this.#v(t)),r.addEventListener(`mouseover`,()=>this.#g()),r.addEventListener(`focus`,()=>this.#g()),r.addEventListener(`mouseout`,()=>this.#g()),r}#d(){this.#e.track(this.#t.registerCommand(Vt,this.#f,N))}#f=e=>this.#p&&e.altKey&&e.key===`F10`?(e.preventDefault(),this.#r[0]?.focus({focusVisible:!0}),!0):!1;get#p(){return this.tableController?.currentTableNodeKey!=null}#m=e=>{e.key===`Escape`?this.#h():_x(this.#r,e)};#h(){let e=this.tableController.currentCell;e&&(this.#t.update(()=>{e.select(),this.#t.focus()}),this.#x())}async#g(){await wx(),this.#E();let e=this.querySelector(`button:hover, button:focus`);if(!e)return;let t={action:e.dataset.action,childType:e.dataset.childType,direction:e.dataset.direction},n=null;switch(t.childType){case`row`:n=this.tableController.currentRowCells;break;case`column`:n=this.tableController.currentColumnCells;break;case`table`:n=this.tableController.tableRows}n&&n.forEach(e=>{let n=this.#t.getElementByKey(e.getKey());n&&(n.classList.toggle(nC.tableCellHighlight,!0),Object.assign(n.dataset,t))})}#_(){this.#e.track(this.#t.registerUpdateListener(()=>{this.#t.getRootElement()&&this.tableController.updateSelectedTable()?this.#y():this.#b()}))}#v(e){this.tableController.executeTableCommand(e),this.#x()}#y(){this.#C(),this.style.display=`flex`,this.#w(),this.#S(),this.#g()}#b(){this.style.display=`none`,this.#E()}#x(){this.#C(),this.#w(),this.#S(),this.#g()}#S(){this.querySelector(`details[open]`)?.removeAttribute(`open`)}#C(){let e=this.tableController.currentTableNode;if(!e)return;let t=this.#t.getElementByKey(e.getKey());if(!t)return;let n=t.getBoundingClientRect(),r=this.#n.getBoundingClientRect(),i=n.top-r.top,a=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${a}px`}#w(){let e=this.tableController.currentTableNode;if(!e)return;let t=gy(this.#t,e);if(!t)return;let n=t.rows,r=t.columns;this.rowCount.textContent=`${n} row${n===1?``:`s`}`,this.columnCount.textContent=`${r} column${r===1?``:`s`}`}#T(){let e=this.tableController.currentCell;if(!e)return;let t=this.#t.getElementByKey(e.getKey());t&&t.classList.add(nC.tableCellFocus)}#E(){this.#n.querySelectorAll(`.${nC.tableCellFocus}`)?.forEach(e=>{e.classList.remove(nC.tableCellFocus)}),this.#n.querySelectorAll(`.${nC.tableCellHighlight}`)?.forEach(e=>{e.classList.remove(nC.tableCellHighlight),e.removeAttribute(`data-action`),e.removeAttribute(`data-child-type`),e.removeAttribute(`data-direction`)}),this.#T()}#D(e){let{action:t,childType:n}=e;return wT[[t,n,t==`insert`?e.direction:null].filter(Boolean).join(`-`)]}};function ET(){Object.entries({"lexxy-toolbar":bx,"lexxy-toolbar-dropdown":Tx,"lexxy-heading-dropdown":Dx,"lexxy-highlight-dropdown":Ax,"lexxy-link-dropdown":jx,"lexxy-editor":pT,"lexxy-prompt":bT,"lexxy-code-language-picker":xT,"lexxy-node-delete-button":ST,"lexxy-table-tools":TT}).forEach(([e,t])=>{customElements.define(e,t)})}var DT=class{frozenLinkKey=null;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement}dispatchAttributesChange(e,t,n,r){dx(this.editorElement,`lexxy:attributes-change`,{attributes:e,link:t?{href:t}:null,highlight:n,headingTag:r})}dispatchEditorInitialized(e){dx(this.editorElement,`lexxy:editor-initialized`,e)}freeze(){let e=null;this.editorElement.editor?.getEditorState().read(()=>{let t=w();if(!O(t))return;let n=Qo(t.anchor.getNode(),Fl);n&&(e=n.getKey())}),this.frozenLinkKey=e,this.editorContentElement.contentEditable=`false`}thaw(){this.editorContentElement.contentEditable=`true`}unlinkFrozenNode(){let e=this.frozenLinkKey;if(!e)return!1;let t=C(e);if(!Ml(t))return this.frozenLinkKey=null,!1;let n=t.getChildren();for(let e of n)t.insertBefore(e);t.remove();let r=this.#e(n),i=this.#t(n);if(r&&i){let e=w();O(e)&&(e.anchor.set(r.getKey(),0,`text`),e.focus.set(i.getKey(),i.getTextContent().length,`text`))}return this.frozenLinkKey=null,!0}#e(e){for(let t of e){if(A(t))return t;if(E(t)){let e=this.#e(t.getChildren());if(e)return e}}return null}#t(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(A(n))return n;if(E(n)){let e=this.#t(n.getChildren());if(e)return e}}return null}};const OT=Rx.configure;setTimeout(ET,0);export{US as $createActionTextAttachmentNode,ow as $createActionTextAttachmentUploadNode,WS as $isActionTextAttachmentNode,Kx as $isCustomActionTextAttachmentNode,HS as ActionTextAttachmentNode,iw as ActionTextAttachmentUploadNode,Gx as CustomActionTextAttachmentNode,eS as Extension,ZS as HorizontalDividerNode,e as Lexical,DT as NativeAdapter,LS as REWRITE_HISTORY_COMMAND,OT as configure,fr as highlightCode,pr as highlightElement};
|