diff --git a/app/assets/javascript/lexxy.js b/app/assets/javascript/lexxy.js index b1a4a42b4..b11a49092 100644 --- a/app/assets/javascript/lexxy.js +++ b/app/assets/javascript/lexxy.js @@ -1,6 +1,7 @@ import { DirectUpload } from '@rails/activestorage'; +import { marked } from 'marked'; -/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */ +/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */ const { entries, @@ -29,18 +30,12 @@ if (!seal) { }; } if (!apply) { - apply = function apply(func, thisArg) { - for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - return func.apply(thisArg, args); + apply = function apply(fun, thisValue, args) { + return fun.apply(thisValue, args); }; } if (!construct) { - construct = function construct(Func) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } + construct = function construct(Func, args) { return new Func(...args); }; } @@ -69,8 +64,8 @@ function unapply(func) { if (thisArg instanceof RegExp) { thisArg.lastIndex = 0; } - for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { - args[_key3 - 1] = arguments[_key3]; + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; @@ -81,12 +76,12 @@ function unapply(func) { * @param func - The constructor function to be wrapped and called. * @returns A new function that constructs an instance of the given constructor function with the provided arguments. */ -function unconstruct(Func) { +function unconstruct(func) { return function () { - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; } - return construct(Func, args); + return construct(func, args); }; } /** @@ -185,8 +180,8 @@ function lookupGetter(object, prop) { return fallbackValue; } -const html$1 = freeze(['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']); -const svg$1 = freeze(['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']); +const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); +const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); const svgFilters = freeze(['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']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace @@ -199,8 +194,8 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); const text = freeze(['#text']); -const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']); -const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); +const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']); +const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); @@ -298,7 +293,7 @@ const _createHooksMap = function _createHooksMap() { function createDOMPurify() { let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); const DOMPurify = root => createDOMPurify(root); - DOMPurify.version = '3.3.0'; + DOMPurify.version = '3.2.6'; DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) { // Not running in a browser, provide a factory function @@ -409,21 +404,6 @@ function createDOMPurify() { let FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ let FORBID_ATTR = null; - /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */ - const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, { - tagCheck: { - writable: true, - configurable: false, - enumerable: true, - value: null - }, - attributeCheck: { - writable: true, - configurable: false, - enumerable: true, - value: null - } - })); /* Decide if ARIA attributes are okay */ let ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ @@ -616,24 +596,16 @@ function createDOMPurify() { } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { - if (typeof cfg.ADD_TAGS === 'function') { - EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS; - } else { - if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { - ALLOWED_TAGS = clone(ALLOWED_TAGS); - } - addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); } + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { - if (typeof cfg.ADD_ATTR === 'function') { - EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR; - } else { - if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { - ALLOWED_ATTR = clone(ALLOWED_ATTR); - } - addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); } + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); @@ -941,7 +913,7 @@ function createDOMPurify() { return true; } /* Remove element if anything forbids its presence */ - if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) { + if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { /* Check if we have a custom element to handle */ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { @@ -1013,12 +985,12 @@ function createDOMPurify() { (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes) XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804) We don't need to check the value; it's always URI safe. */ - if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { + if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck - _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || + _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else { @@ -1097,12 +1069,7 @@ function createDOMPurify() { value = SANITIZE_NAMED_PROPS_PREFIX + value; } /* Work around a security issue with comments inside attributes */ - if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) { - _removeAttribute(name, currentNode); - continue; - } - /* Make sure we cannot easily use animated hrefs, even if animations are allowed */ - if (lcName === 'attributename' && stringMatch(value, 'href')) { + if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) { _removeAttribute(name, currentNode); continue; } @@ -1377,7 +1344,7 @@ var purify = createDOMPurify(); * */ -function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u;function h$1(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const g$1=0,_$2=1,p=2,T$3=128,b$4=1,w$4=2,E$4=3,O$2=4,M$5=5,A$3=6,P$3=l||c||d?" ":"​",D$4="\n\n",F$5=o?" ":P$3,L$2="֑-߿יִ-﷽ﹰ-ﻼ",I$3="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",K$5=new RegExp("^[^"+I$3+"]*["+L$2+"]"),z$4=new RegExp("^[^"+L$2+"]*["+I$3+"]"),R$5={bold:1,capitalize:1024,code:16,highlight:T$3,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},B$3={directionless:1,unmergeable:2},W$6={center:2,end:6,justify:4,left:1,right:3,start:5},J$5={[w$4]:"center",[A$3]:"end",[O$2]:"justify",[b$4]:"left",[E$4]:"right",[M$5]:"start"},j$3={normal:0,segmented:2,token:1},$$4={[g$1]:"normal",[p]:"segmented",[_$2]:"token"},V$5="$config";function Y$4(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Si(s)&&Y$4(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling();}}let q$4=false,H$3=0;function G$4(t){H$3=t.timeStamp;}function X$4(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==So(t,n)}function Q$5(t,e,n){const r=ps(ss(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&Fo(e,s,i,o,false);}function Z$4(t,e,n){if(yr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return co(e)&&n.isAttached()}function tt$3(t,e,n,r){for(let i=t;i&&!Fs(i);i=Zo(i)){const t=So(i,e);if(void 0!==t){const e=xo(t,n);if(e)return Ti(e)||!Cs(i)?void 0:[i,e]}else if(i===r)return [r,bo(n)]}}function et$4(t,e,n){q$4=true;const r=performance.now()-H$3>100;try{yi(t,()=>{const i=Lr()||function(t){return t.getEditorState().read(()=>{const t=Lr();return null!==t?t.clone():null})}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n0){let e=0;for(let i=0;i0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e{et$4(t,e,n);});}let it$3 = class it{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||gt$3).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0);}};function ot$4(t,e){return new it$3(t,e)}function st$4(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function ct$4(t,e,n){let r;if(ei(),"function"==typeof n){const i=t.getLatest(),o=st$4(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return ft$2(i).updateFromKnown(e,r),i}function at$2(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Is(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t);}}return {flatKeys:n,sharedConfigMap:e}}let ut$3 = class ut{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(o,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return ht$4(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new ut(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o);}return r}(e.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=ht$4(i)),this.size++),r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);}};function ft$2(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new ut$3(e,dt$3(e));return e.__state=n,n}function dt$3(t){return t.__state?t.__state.sharedNodeState:Gi(bs(),t.getType()).sharedNodeState}function ht$4(t){if(t)for(const e in t)return t}function gt$3(t){return t}function _t$3(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return true}return false}function pt$3(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return true}return false}function yt$3(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function mt$1(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set;return !(t&&_t$3(n,t,e)||e&&_t$3(n,e,t)||t&&pt$3(n,t,e)||e&&pt$3(n,e,t))}(c,a))}function xt$5(t,e){const n=t.mergeWithSibling(e),r=ii()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function Ct$4(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&lr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(mt$1(e,r)){r=xt$5(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&lr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(mt$1(r,n)){r=xt$5(r,n);break}break}n.remove();}}else r.remove();}function St$5(t){return vt$3(t.anchor),vt$3(t.focus),t}function vt$3(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),lr(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!Si(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let kt$5,Tt$4,Nt$4,bt$5,wt$5,Et$4,Ot$3,Mt$3,At$4,Pt$4,Dt$3="",Ft$2=null,Lt$4="",It$3="",Kt$2=false,zt$2=false;function Rt$2(t,e){const n=Ot$3.get(t);if(null!==e){const n=ne$1(t);n.parentNode===e&&e.removeChild(n);}if(Mt$3.has(t)||Tt$4._keyToDOMMap.delete(t),Si(n)){const t=Xt(n,Ot$3);Bt$2(t,0,t.length-1,null);} void 0!==n&&Uo(Pt$4,Nt$4,bt$5,n,"destroyed");}function Bt$2(t,e,n,r){let i=e;for(;i<=n;++i){const e=t[i];void 0!==e&&Rt$2(e,r);}}function Wt$1(t,e){t.setProperty("text-align",e);}const Jt$1="40px";function jt$3(t,e){const n=kt$5.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||Jt$1;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`);}function $t$1(t,e){const n=t.style;0===e?Wt$1(n,""):1===e?Wt$1(n,"left"):2===e?Wt$1(n,"center"):3===e?Wt$1(n,"right"):4===e?Wt$1(n,"justify"):5===e?Wt$1(n,"start"):6===e&&Wt$1(n,"end");}function Ut$2(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(bi(t))return null;const n=t.getParentOrThrow();return bi(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir");}function Vt(e,n){const r=Mt$3.get(e);void 0===r&&t(60);const i=r.createDOM(kt$5,Tt$4);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,Tt$4),lr(r)?i.setAttribute("data-lexical-text","true"):Ti(r)&&i.setAttribute("data-lexical-decorator","true"),Si(r)){const t=r.__indent,e=r.__size;if(Ut$2(i,r),0!==t&&jt$3(i,t),0!==e){const t=e-1;Yt(Xt(r,Mt$3),r,0,t,r.getDOMSlot(i));}const n=r.__format;0!==n&&$t$1(i,n),r.isInline()||Ht$1(null,r,i),Xo(r)&&(Dt$3+=D$4,It$3+=D$4);}else {const t=r.getTextContent();if(Ti(r)){const t=r.decorate(Tt$4,kt$5);null!==t&&Zt(e,t),i.contentEditable="false";}Dt$3+=t,It$3+=t;}return null!==n&&n.insertChild(i),Uo(Pt$4,Nt$4,bt$5,r,"created"),i}function Yt(t,e,n,r,i){const o=Dt$3;Dt$3="";let s=n;for(;s<=r;++s){Vt(t[s],i);const e=Mt$3.get(t[s]);null!==e&&lr(e)&&(null===Ft$2&&(Ft$2=e.getFormat()),""===Lt$4&&(Lt$4=e.getStyle()));}Xo(e)&&(Dt$3+=D$4);i.element.__lexicalTextContent=Dt$3,Dt$3=o+Dt$3;}function qt(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return jn(t)?"line-break":Ti(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Ht$1(t,e,n){const r=qt(t,Ot$3),i=qt(e,Mt$3);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function Gt$1(e,n,r){var i;Ft$2=null,Lt$4="",function(e,n,r){const i=Dt$3,o=e.__size,s=n.__size;Dt$3="";const l=r.element;if(1===o&&1===s){const t=e.__first,r=n.__first;if(t===r)Qt(t,l);else {const e=ne$1(t),n=Vt(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const o=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw i}Rt$2(t,null);}const i=Mt$3.get(r);lr(i)&&(null===Ft$2&&(Ft$2=i.getFormat()),""===Lt$4&&(Lt$4=i.getStyle()));}else {const i=Xt(e,Ot$3),c=Xt(n,Mt$3);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&Yt(c,n,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Bt$2(i,0,o-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=te$1(Qt(r,o.element)),f++,d++;else { void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const i=a.has(t),s=c.has(r);if(i)if(s){const t=Qo(Tt$4,r);t===u?u=te$1(Qt(r,o.element)):(o.withBefore(u).insertChild(t),Qt(r,o.element)),f++,d++;}else Vt(r,o.withBefore(u)),d++;else u=te$1(ne$1(t)),Rt$2(t,o.element),f++;}const i=Mt$3.get(r);null!==i&&lr(i)&&(null===Ft$2&&(Ft$2=i.getFormat()),""===Lt$4&&(Lt$4=i.getStyle()));}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Tt$4.getElementByKey(e);Yt(n,t,d,l,o.withBefore(r));}else g&&!h&&Bt$2(e,f,s,o.element);}(n,i,c,o,s,r);}Xo(n)&&(Dt$3+=D$4);l.__lexicalTextContent=Dt$3,Dt$3=i+Dt$3;}(e,n,n.getDOMSlot(r)),i=n,null==Ft$2||Ft$2===i.__textFormat||zt$2||i.setTextFormat(Ft$2),function(t){""===Lt$4||Lt$4===t.__textStyle||zt$2||t.setTextStyle(Lt$4);}(n);}function Xt(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function Qt(e,n){const r=Ot$3.get(e);let i=Mt$3.get(e);void 0!==r&&void 0!==i||t(61);const o=Kt$2||Et$4.has(e)||wt$5.has(e),s=Qo(Tt$4,e);if(r===i&&!o){if(Si(r)){const t=s.__lexicalTextContent;void 0!==t&&(Dt$3+=t,It$3+=t);}else {const t=r.getTextContent();It$3+=t,Dt$3+=t;}return s}if(r!==i&&o&&Uo(Pt$4,Nt$4,bt$5,i,"updated"),i.updateDOM(r,s,kt$5)){const r=Vt(e,null);return null===n&&t(62),n.replaceChild(r,s),Rt$2(e,null),r}if(Si(r)&&Si(i)){const t=i.__indent;(Kt$2||t!==r.__indent)&&jt$3(s,t);const e=i.__format;if((Kt$2||e!==r.__format)&&$t$1(s,e),o&&(Gt$1(r,i,s),bi(i)||i.isInline()||Ht$1(r,i,s)),Xo(i)&&(Dt$3+=D$4,It$3+=D$4),(Kt$2||i.__dir!==r.__dir)&&(Ut$2(s,i),bi(i)&&!Kt$2))for(const t of i.getChildren())if(Si(t)){Ut$2(Qo(Tt$4,t.getKey()),t);}}else {const t=i.getTextContent();if(Ti(i)){const t=i.decorate(Tt$4,kt$5);null!==t&&Zt(e,t);}Dt$3+=t,It$3+=t;}if(!zt$2&&bi(i)&&i.__cachedText!==It$3){const t=i.getWritable();t.__cachedText=It$3,i=t;}return s}function Zt(t,e){let n=Tt$4._pendingDecorators;const r=Tt$4._decorators;if(null===n){if(r[t]===e)return;n=ko(Tt$4);}n[t]=e;}function te$1(t){let e=t.nextSibling;return null!==e&&e===Tt$4._blockCursorElement&&(e=e.nextSibling),e}function ee$1(t,e,n,r,i,o){Dt$3="",It$3="",Kt$2=2===r,Tt$4=n,kt$5=n._config,Nt$4=n._nodes,bt$5=Tt$4._listeners.mutation,wt$5=i,Et$4=o,Ot$3=t._nodeMap,Mt$3=e._nodeMap,zt$2=e._readOnly,At$4=new Map(n._keyToDOMMap);const s=new Map;return Pt$4=s,Qt("root",null),Tt$4=void 0,Nt$4=void 0,wt$5=void 0,Et$4=void 0,Ot$3=void 0,Mt$3=void 0,kt$5=void 0,At$4=void 0,Pt$4=void 0,s}function ne$1(e){const n=At$4.get(e);return void 0===n&&t(75,e),n}function re$1(t){return {type:t}}const ie$1=re$1("SELECTION_CHANGE_COMMAND"),oe$2=re$1("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),se$1=re$1("CLICK_COMMAND"),le$2=re$1("DELETE_CHARACTER_COMMAND"),ce$1=re$1("INSERT_LINE_BREAK_COMMAND"),ae$1=re$1("INSERT_PARAGRAPH_COMMAND"),ue$1=re$1("CONTROLLED_TEXT_INSERTION_COMMAND"),fe$1=re$1("PASTE_COMMAND"),de$1=re$1("REMOVE_TEXT_COMMAND"),he$1=re$1("DELETE_WORD_COMMAND"),ge$1=re$1("DELETE_LINE_COMMAND"),_e$1=re$1("FORMAT_TEXT_COMMAND"),pe$1=re$1("UNDO_COMMAND"),ye$1=re$1("REDO_COMMAND"),me$1=re$1("KEYDOWN_COMMAND"),xe=re$1("KEY_ARROW_RIGHT_COMMAND"),Ce$1=re$1("MOVE_TO_END"),Se$1=re$1("KEY_ARROW_LEFT_COMMAND"),ve$1=re$1("MOVE_TO_START"),ke$1=re$1("KEY_ARROW_UP_COMMAND"),Te$1=re$1("KEY_ARROW_DOWN_COMMAND"),Ne$1=re$1("KEY_ENTER_COMMAND"),be$1=re$1("KEY_SPACE_COMMAND"),we$1=re$1("KEY_BACKSPACE_COMMAND"),Ee$1=re$1("KEY_ESCAPE_COMMAND"),Oe$1=re$1("KEY_DELETE_COMMAND"),Me$1=re$1("KEY_TAB_COMMAND"),Ae$1=re$1("INSERT_TAB_COMMAND"),Pe$1=re$1("INDENT_CONTENT_COMMAND"),De$1=re$1("OUTDENT_CONTENT_COMMAND"),Fe$1=re$1("DROP_COMMAND"),Le$1=re$1("FORMAT_ELEMENT_COMMAND"),Ie$1=re$1("DRAGSTART_COMMAND"),Ke$1=re$1("DRAGOVER_COMMAND"),ze$1=re$1("DRAGEND_COMMAND"),Re$1=re$1("COPY_COMMAND"),Be$1=re$1("CUT_COMMAND"),We$1=re$1("SELECT_ALL_COMMAND"),Je$1=re$1("CLEAR_EDITOR_COMMAND"),je$1=re$1("CLEAR_HISTORY_COMMAND"),$e$1=re$1("CAN_REDO_COMMAND"),Ue$1=re$1("CAN_UNDO_COMMAND"),Ve$1=re$1("FOCUS_COMMAND"),Ye=re$1("BLUR_COMMAND"),qe$1=re$1("KEY_MODIFIER_COMMAND"),He$1=Object.freeze({}),Ge$1=[["keydown",function(t,e){if(Xe$1=t.timeStamp,Qe$1=t.key,e.isComposing())return;if(Go(e,me$1,t))return;if(null==t.key)return;if(cn&&Wo(t))return yi(e,()=>{mn(e,an);}),cn=false,void(an="");if(function(t){return zo(t,"ArrowRight",{shiftKey:"any"})}(t))Go(e,xe,t);else if(function(t){return zo(t,"ArrowRight",Ro)}(t))Go(e,Ce$1,t);else if(function(t){return zo(t,"ArrowLeft",{shiftKey:"any"})}(t))Go(e,Se$1,t);else if(function(t){return zo(t,"ArrowLeft",Ro)}(t))Go(e,ve$1,t);else if(function(t){return zo(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Go(e,ke$1,t);else if(function(t){return zo(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Go(e,Te$1,t);else if(function(t){return zo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))sn=true,Go(e,Ne$1,t);else if(function(t){return " "===t.key}(t))Go(e,be$1,t);else if(function(t){return i&&zo(t,"o",{ctrlKey:true})}(t))t.preventDefault(),sn=true,Go(e,ce$1,true);else if(function(t){return zo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))sn=false,Go(e,Ne$1,t);else if(function(t){return zo(t,"Backspace",{shiftKey:"any"})||i&&zo(t,"h",{ctrlKey:true})}(t))Wo(t)?Go(e,we$1,t):(t.preventDefault(),Go(e,le$2,true));else if(function(t){return "Escape"===t.key}(t))Go(e,Ee$1,t);else if(function(t){return zo(t,"Delete",{})||i&&zo(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),Go(e,le$2,false)):Go(e,Oe$1,t);else if(function(t){return zo(t,"Backspace",Bo)}(t))t.preventDefault(),Go(e,he$1,true);else if(function(t){return zo(t,"Delete",Bo)}(t))t.preventDefault(),Go(e,he$1,false);else if(function(t){return i&&zo(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),Go(e,ge$1,true);else if(function(t){return i&&(zo(t,"Delete",{metaKey:true})||zo(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),Go(e,ge$1,false);else if(function(t){return zo(t,"b",Ro)}(t))t.preventDefault(),Go(e,_e$1,"bold");else if(function(t){return zo(t,"u",Ro)}(t))t.preventDefault(),Go(e,_e$1,"underline");else if(function(t){return zo(t,"i",Ro)}(t))t.preventDefault(),Go(e,_e$1,"italic");else if(function(t){return zo(t,"Tab",{shiftKey:"any"})}(t))Go(e,Me$1,t);else if(function(t){return zo(t,"z",Ro)}(t))t.preventDefault(),Go(e,pe$1,void 0);else if(function(t){if(i)return zo(t,"z",{metaKey:true,shiftKey:true});return zo(t,"y",{ctrlKey:true})||zo(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),Go(e,ye$1,void 0);else {const n=e._editorState._selection;null===n||yr(n)?Jo(t)&&(t.preventDefault(),Go(e,We$1,t)):!function(t){return zo(t,"c",Ro)}(t)?!function(t){return zo(t,"x",Ro)}(t)?Jo(t)&&(t.preventDefault(),Go(e,We$1,t)):(t.preventDefault(),Go(e,Be$1,t)):(t.preventDefault(),Go(e,Re$1,t));}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&Go(e,qe$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ss(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&yi(e,()=>{Zi(n)||(on=true);});}],["compositionstart",function(t,e){yi(e,()=>{const n=Lr();if(yr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();yo(r.key),(t.timeStamp{mn(e,t.data);}):(cn=true,an=t.data);}],["input",function(t,e){t.stopPropagation(),yi(e,()=>{if(Cs(t.target)&&Zi(t.target))return;const n=Lr(),r=t.data,i=yn(t);if(null!=r&&yr(n)&&dn(n,i,r,t.timeStamp,false)){ln&&(mn(e,r),ln=false);const i=n.anchor.getNode(),a=ps(ss(e));if(null===a)return;const u=n.isBackward(),f=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&lr(i)&&null!==a.anchorNode&&i.getTextContent().slice(0,f)+r+i.getTextContent().slice(f+h)===Po(a.anchorNode)||Go(e,ue$1,r);const g=r.length;o&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(Xe$1=0,yo(null));}else {Do(false,e,null!==r?r:void 0),ln&&(mn(e,r||void 0),ln=false);}!function(){ei();const t=ii();nt$4(t);}();},{event:t}),tn=null;}],["click",function(t,e){yi(e,()=>{const n=Lr(),r=ps(ss(e)),i=Ir();if(r)if(yr(n)){const e=n.anchor,o=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!bi(o)&&1===No().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(o!==n.focus.getNode()){const t=zs(o,t=>Si(t)&&!t.isInline());Si(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Cs(n)||co(n)){wo(Fr(i,r,e,t));}}Go(e,se$1,t);});}],["cut",He$1],["copy",He$1],["dragstart",He$1],["dragover",He$1],["dragend",He$1],["paste",He$1],["focus",He$1],["blur",He$1],["drop",He$1]];s&&Ge$1.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,i=yn(e);if("deleteCompositionText"===r||o&&Ho(n))return;if("insertCompositionText"===r)return;yi(n,()=>{const o=Lr();if("deleteContentBackward"===r){if(null===o){const t=Ir();if(!yr(t))return;wo(t.clone());}if(yr(o)){const r=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===Qe$1&&s{yi(n,()=>{yo(null);});},30),yr(o)){const e=o.anchor.getNode();e.markDirty(),lr(e)||t(142),pn(o,e);}}else {yo(null),e.preventDefault();const t=o.anchor.getNode(),i=t.getTextContent(),s=t.canInsertTextAfter(),l=0===o.anchor.offset&&o.focus.offset===i.length;let c=f&&r&&!l&&s;if(c&&o.isCollapsed()&&(c=!Ti(qo(o.anchor,true))),!c){Go(n,le$2,true);const t=Lr();f&&yr(t)&&t.isCollapsed()&&(un=t,setTimeout(()=>un=null));}}return}}var s;if(!yr(o))return;const l=e.data;null!==tn&&Do(false,n,tn),o.dirty&&null===tn||!o.isCollapsed()||bi(o.anchor.getNode())||null===i||o.applyDOMRange(i),tn=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":Go(n,ue$1,e);break;case "insertFromComposition":yo(null),Go(n,ue$1,e);break;case "insertLineBreak":yo(null),Go(n,ce$1,false);break;case "insertParagraph":yo(null),sn&&!c?(sn=false,Go(n,ce$1,false)):Go(n,ae$1,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":Go(n,fe$1,e);break;case "deleteByComposition":(function(t,e){return t!==e||Si(t)||Si(e)||!so(t)||!so(e)})(d,h)&&Go(n,de$1,e);break;case "deleteByDrag":case "deleteByCut":Go(n,de$1,e);break;case "deleteContent":Go(n,le$2,false);break;case "deleteWordBackward":Go(n,he$1,true);break;case "deleteWordForward":Go(n,he$1,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":Go(n,ge$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":Go(n,ge$1,false);break;case "formatStrikeThrough":Go(n,_e$1,"strikethrough");break;case "formatBold":Go(n,_e$1,"bold");break;case "formatItalic":Go(n,_e$1,"italic");break;case "formatUnderline":Go(n,_e$1,"underline");break;case "historyUndo":Go(n,pe$1,void 0);break;case "historyRedo":Go(n,ye$1,void 0);}else {if("\n"===l)e.preventDefault(),Go(n,ce$1,false);else if(l===D$4)e.preventDefault(),Go(n,ae$1,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t);}else null!=l&&dn(o,i,l,e.timeStamp,true)?(e.preventDefault(),Go(n,ue$1,l)):tn=l;Ze$1=e.timeStamp;}});}(e,n)]);let Xe$1=0,Qe$1=null,Ze$1=0,tn=null;const en=new WeakMap,nn=new WeakMap;let rn=false,on=false,sn=false,ln=false,cn=false,an="",un=null,fn=[0,"",0,"root",0];function dn(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=ii(),u=ps(ss(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!lr(c)||(!i&&(!s||Ze$11||(i||!s)&&null!==h&&!c.isComposing()&&f!==uo(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=so(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (lr(e)||Si(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function hn(t,e){return co(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function gn(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;rn&&(rn=false,hn(i,o)&&hn(s,l)&&!un)||yi(n,()=>{if(!r)return void wo(null);if(!eo(n,i,s))return;let c=Lr();if(un&&yr(c)&&c.isCollapsed()){const t=c.anchor,e=un.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=un.clone(),wo(c));}if(un=null,yr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const o=ss(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=fn,h=No(),g=false===n.isComposing()&&""===h.getTextContent();if(s{const r=Ir(),i=e.anchorNode;if(Cs(i)||co(i)){wo(Fr(r,e,n,t));}}));const r=Mo(n),i=r[r.length-1],o=i._key,s=Cn.get(o),l=s||i;l!==n&&gn(e,l,false),gn(e,n,true),n!==i?Cn.set(o,n):s&&Cn.delete(o);}function vn(t){t._lexicalHandled=true;}function kn(t){return true===t._lexicalHandled}function Nn(e){const n=en.get(e);if(void 0===n)return void 0;const r=nn.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),en.delete(e),nn.set(n,i),0===i&&n.removeEventListener("selectionchange",Sn);const o=io(e);no(o)?(!function(t){if(null!==t._parentEditor){const e=Mo(t),n=e[e.length-1]._key;Cn.get(n)===t&&Cn.delete(n);}else Cn.delete(t._key);}(o),e.__lexicalEditor=null):o&&t(198);const s=xn(e);for(let t=0;tt.__key===this.__key);if(lr(this))return n;if(yr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(Ti(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:xo(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(as(n))return Si(e)||e===this&&Ti(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:xo(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:xo(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Si(this)?this:this.getParent(),n=Si(t)?t:t.getParent(),r=e&&n?ml(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=ml(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===_l(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=ml(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=Si(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);o=u;}return n||r.reverse(),r}isDirty(){const t=ii()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(On(this))return this;const e=xo(this.__key);return null===e&&t(113),e}getWritable(){if(On(this))return this;ei();const t=ri(),e=ii(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=Lr();if(null!==s&&s.setCachedNodes(null),o.has(r))return po(i),i;const l=Ms(i);return o.add(r),po(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of dt$3(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return (n.__state||i)&&ft$2(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){bn(this,true,t);}replace(e,n){ei();let r=Lr();null!==r&&(r=r.clone()),ds(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;_o(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(bn(i,false,true),null===u)c.__first=s;else {u.getWritable().__next=s;}if(l.__prev=d,null===f)c.__last=s;else {f.getWritable().__prev=s;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Si(this)&&Si(l)||t(139),this.getChildren().forEach(t=>{l.append(t);})),yr(r)){wo(r);const t=r.anchor,e=r.focus;t.key===o&&_r(t,l),e.key===o&&_r(e,l);}return mo()===o&&yo(s),l}insertAfter(t,e=true){ei(),ds(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=Lr();let s=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(_o(r),yr(o)){const t=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&yr(o)){const t=this.getIndexWithinParent();Kr(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){ei(),ds(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;_o(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===o)s.__first=i;else {o.getWritable().__next=i;}s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Lr();if(e&&yr(a)){Kr(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Li()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){ei();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Si(n))return n.select();if(!lr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){ei();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Si(n))return n.select(0,0);if(!lr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}const An="historic",Pn="history-push",Dn="history-merge",Fn="paste",Ln="collaboration",Kn="skip-scroll-into-view",zn="skip-dom-selection",Rn="skip-selection-focus";class Bn extends Mn{static getType(){return "linebreak"}static clone(t){return new Bn(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&Ts(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&$n(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&$n(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&Ts(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&$n(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&$n(r))return true}return false}(t)?null:{conversion:Wn,priority:0}}}static importJSON(t){return Jn().updateFromJSON(t)}}function Wn(t){return {node:Jn()}}function Jn(){return fs(new Bn)}function jn(t){return t instanceof Bn}function $n(t){return co(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Un(t,e){return 16&e?"code":e&T$3?"mark":32&e?"sub":64&e?"sup":null}function Vn(t,e){return 1&e?"strong":2&e?"em":"span"}function Yn(t,e,n,r,i){const o=r.classList;let s=$o(i,"base");void 0!==s&&o.add(...s),s=$o(i,"underlineStrikethrough");let l=false;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=true,c||o.add(...s)):c&&o.remove(...s));for(const t in R$5){const r=R$5[t];if(s=$o(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s);}else e&r&&o.remove(...s);}}function qn(t,e,n){const r=e.firstChild,i=n.isComposing(),s=t+(i?P$3:"");if(null==r)e.textContent=s;else {const t=r.nodeValue;if(t!==s)if(i||o){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i({conversion:nr,priority:0}),b:()=>({conversion:Zn,priority:0}),code:()=>({conversion:or,priority:0}),em:()=>({conversion:or,priority:0}),i:()=>({conversion:or,priority:0}),mark:()=>({conversion:or,priority:0}),s:()=>({conversion:or,priority:0}),span:()=>({conversion:Qn,priority:0}),strong:()=>({conversion:or,priority:0}),sub:()=>({conversion:or,priority:0}),sup:()=>({conversion:or,priority:0}),u:()=>({conversion:or,priority:0})}}static importJSON(t){return sr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Cs(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Gn(n,"b")),this.hasFormat("italic")&&(n=Gn(n,"i")),this.hasFormat("strikethrough")&&(n=Gn(n,"s")),this.hasFormat("underline")&&(n=Gn(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?R$5[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?B$3[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=fo(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=j$3[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){ei();let n=t,r=e;const i=Lr(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!yr(i))return Mr(s,n,s,r,"text","text");{const t=mo();t!==i.anchor.key&&t!==i.focus.key||yo(s),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=Lr();if(r&&yr(c)){const e=t+s;c.setTextNodeRange(i,e,i,e);}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){ei();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=mo(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;ee&&(s.push(n.slice(e,i)),e=i);}const c=s.length;if(1===c)return [e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=Lr();if(yr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=sr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=yt$3(e,f),_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t=v&&(p.set(t.getKey(),C-v,"text"),C=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&po(e);null!==n&&po(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),yr(m)&&Kr(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;mo()===i&&yo(r);const l=Lr();if(yr(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Br(t,n,r,e,s),null!==o&&o.key===i&&Br(o,n,r,e,s);}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function Qn(t){return {forChild:cr(t.style),node:null}}function Zn(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:cr(e.style,n?void 0:"bold"),node:null}}const tr=new WeakMap;function er(t){if(!Cs(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function nr(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=tr.get(n))&&!er(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=rr(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:sr(r)}}function rr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,Cs(n)){const t=n.style.display;if(""===t&&!ks(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(co(n))return n;if("BR"===n.nodeName)return null}}const ir={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function or(t){const e=ir[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:cr(t.style,e),node:null}}function sr(t=""){return fs(new Xn(t))}function lr(t){return t instanceof Xn}function cr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>lr(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class ar extends Xn{static getType(){return "tab"}static clone(t){return new ar(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=$o(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return ur().updateFromJSON(t)}setTextContent(t){return "\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function ur(){return fs(new ar)}function fr(t){return t instanceof ar}class dr{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offsett&&(r=t);}else if(!Si(e)){const t=e.getNextSibling();if(lr(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function _r(t,e){if(Si(e)){const n=e.getLastDescendant();Si(n)||lr(n)?gr(t,n):gr(t,e);}else gr(t,e);}class pr{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!xr(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new pr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(lr(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t1;){const t=e[e.length-1];if(!Si(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=El(t.anchor),r=El(t.anchor.getFlipped()),i=t=>Ys(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o);}return e}(Al(kl(this),"next"));return ti()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=Sr(this);let c="",a=true;for(let u=0;u=0;t--){const e=o[t];if(e.is(d)||Si(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(so(d))if(c===h)d.select();else {const t=sr(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach(n=>{if(Si(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}});},o=r.length;if(0===o)return this.toggleFormat(t),yo(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(lo(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||lo(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||lo(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Lr();return yr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=zs(n,Ns),i=e[e.length-1];if(Si(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=Ur(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some(t=>(Si(t)||Ti(t))&&!t.isInline())){Si(r)||t(211,n.constructor.name,n.getType());const o=Ur(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Li();let n=null;for(let r=0;r0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=bi(n)?n:cs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let s=false;for(let t=0;t0)if(e){const t=r[0];Si(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];Si(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,o,true);}(this);}}"lineboundary"===n&&Yr(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Si(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Si(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=ul(xl(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(Gs(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Si(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=El(e);vl(this,dl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(Hs(e)){if(Si(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(Ti(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Si(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=Pr();t.add(e.origin.getKey()),wo(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return vl(this,dl(!e.origin.isEmpty()&&n.isEmpty()?Tl(tl(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&vr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void Tr(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void Tr(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return ()=>false})();function Tr(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;tn||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function Nr(e,n,r,i){let o,s=n;if(Cs(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;s===a&&(l=true,s=a-1);let f=c[s],d=false;if(f===u)f=c[s+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--;}}if(o=Eo(f),lr(o))s=nl(o,l?"next":"previous");else {let c=Eo(e);if(null===c)return null;if(Si(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Si(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Si(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Si(f)?f:f.getParentOrThrow()),s=0;}lr(f)?(o=f,c=null,s=nl(f,l?"next":"previous")):f!==c&&l&&!d&&(Si(c)||t(216),s=Math.min(c.getChildrenSize(),s+1));}else {const t=c.getIndexWithinParent();s=0===n&&Ti(c)&&Eo(e)===c?t:t+1,c=c.getParentOrThrow();}if(Si(c))return hr(c.__key,s,"element")}}else o=Eo(e);return lr(o)?hr(o.__key,nl(o,s,"clamp"),"text"):null}function br(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&Si(o)&&o.isInline()){const e=o.getPreviousSibling();lr(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else Si(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):lr(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&Si(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Si(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();lr(e)&&t.set(e.__key,0,"text");}}}function wr(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),i=t.is(e);br(t,r,i),br(e,!r,i),i&&e.set(t.key,t.offset,t.type);const o=ii();if(o.isComposing()&&o._compositionKey!==t.key&&yr(n)){const r=n.anchor,i=n.focus;t.set(r.key,r.offset,r.type,true),e.set(i.key,i.offset,i.type,true);}}}function Er(t,e,n,r,i,o){if(null===t||null===n||!eo(i,t,n))return null;const s=Nr(t,e,yr(o)?o.anchor:null,i);if(null===s)return null;const l=Nr(n,r,yr(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Eo(t),r=Eo(n);if(Ti(e)&&Ti(r))return null}return wr(s,l,o),[s,l]}function Or(t){return Si(t)&&!t.isInline()}function Mr(t,e,n,r,i,o){const s=ri(),l=new mr(hr(t,e,i),hr(n,r,o),0,"");return l.dirty=true,s._selection=l,l}function Ar(){const t=hr("root",0,"element"),e=hr("root",0,"element");return new mr(t,e,0,"")}function Pr(){return new pr(new Set)}function Fr(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!q$4&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(yr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&yr(t)&&!eo(n,a,u))return t.clone();const h=Er(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new mr(g,_,yr(t)?t.format:0,yr(t)?t.style:"")}function Lr(){return ri()._selection}function Ir(){return ii()._editorState._selection}function Kr(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n0||n0||n=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(lr(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text");}return}if(Si(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(lr(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(Si(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(lr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}function Rr(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,lr(r)?(s=r.getTextContentSize(),l="text"):Si(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,lr(i)?l="text":Si(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"));}function Br(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Wr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Jr(t,e,n,r,i,o,s){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has(Ln)&&f!==o||null!==f&&to(f))return;if(!yr(e))return void(null!==t&&eo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Qo(n,g),y=Qo(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,v=e.isCollapsed();let k=p,T=y,N=false;if("text"===d.type){k=uo(p);const t=d.getNode();N=t.getFormat()!==C||t.getStyle()!==S;}else yr(t)&&"text"===t.anchor.type&&(N=true);var b,w,E,O,M;if(("text"===h.type&&(T=uo(y)),null!==k&&null!==T)&&(v&&(null===t||N||yr(t)&&(t.format!==C||t.style!==S))&&(b=C,w=S,E=m,O=g,M=performance.now(),fn=[b,w,E,O,M]),a!==m||u!==x||l!==k||c!==T||"Range"===r.type&&v||(null!==f&&o.contains(f)||i.has(Rn)||o.focus({preventScroll:true}),"element"===d.type))){if(Wr(r,k,m,T,x),!i.has(Kn)&&e.isCollapsed()&&null!==o&&o===document.activeElement){const t=yr(e)&&"element"===e.anchor.type?k.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=ts(n),i=os(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=ss(t).innerHeight;else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(oc&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e;}if(e)break;a=Zo(a);}}(n,e,o);}}rn=true;}}function jr(t){let e=Lr()||Ir();null===e&&(e=No().selectEnd()),e.insertNodes(t);}function Ur(e){let n=e;e.isCollapsed()||n.removeText();const r=Lr();yr(r)&&(n=r),yr(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!Ns(o);){const t=o;if([o,s]=Vr(o,s),t.is(o))break}return s}function Vr(t,e){const n=t.getParent();if(!n){const t=Li();return No().append(t),t.select(),[No(),0]}if(lr(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!Si(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new mr(hr(t.__key,e,"element"),hr(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function Yr(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const o=xl(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!Ol(c)){for(const t of c){a=false;const{origin:e}=t;if(!Ti(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of ul(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(Gs(t))t.origin.isInline()||(c=t);else {if(Si(t.origin))continue;Ti(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===o)return false;if(l&&!s&&Ti(c.origin)&&c.origin.isKeyboardSelectable()){const t=Pr();return t.add(c.origin.getKey()),wo(t),true}return c=El(c),l&&Cl(t.anchor,c),Cl(t.focus,c),a||!s}let qr=null,Hr=null,Gr=false,Xr=false,Qr=0;const Zr={characterData:true,childList:true,subtree:true};function ti(){return Gr||null!==qr&&qr._readOnly}function ei(){Gr&&t(13);}function ni(){Qr>99&&t(14);}function ri(){return null===qr&&t(195,oi()),qr}function ii(){return null===Hr&&t(196,oi()),Hr}function oi(){let t=0;const e=new Set,n=Ui.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=io(r);if(no(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function si(){return Hr}function li(t,e,n){const r=e.__type,i=Gi(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);lr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ct$4(r),void 0!==r&&ci(r,o)&&li(e,r,s),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){Qr++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&ci(c,o)&&li(e,c,s);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Qr++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),_i(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(Si(e)&&Y$4(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)));}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(yr(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else xr(o)&&0===o._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void hi(e)}finally{qr=f,Gr=d,Hr=h,e._updating=g,Qr=0;}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,hi(e)):u&&Qi(()=>{hi(e);}):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function yi(t,e,n){Hr===t&&void 0===n?e():pi(t,e,n);}class mi{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new mi(this.element,t,this.after)}withAfter(t){return new mi(this.element,this.before,t)}withElement(t){return this.element===t?this:new mi(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(d||c||l);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=xi(e,n);i.push(r);const o=xi(e,this.element);let s=t.getIndexWithinParent();for(let t=0;tn){s+=1;break}}return [t.getParentOrThrow(),s]}}function xi(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class Ci extends Mn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return J$5[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=ii()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(lr(e)&&t.push(e),Si(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Si(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;Si(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Si(t)&&t.getLastDescendant()||t||null}const r=e[t];return Si(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:xo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:xo(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;rt.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?W$6[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){On(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling());}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function Si(t){return t instanceof Ci}function vi(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class ki extends Mn{decorate(t,e){return null}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function Ti(t){return t instanceof ki}class Ni extends Ci{__cachedText;static getType(){return "root"}static clone(){return new Ni}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !ti()&&0!==ii()._dirtyType||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)Si(e)||Ti(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return No().updateFromJSON(t)}collapseAtStart(){return true}}function bi(t){return t instanceof Ni}function wi(t){return new Ai(new Map(t._nodeMap))}function Ei(){return new Ai(new Map([["root",new Ni]]))}function Oi(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Si(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t({root:Oi(No())}))}}class Pi extends Ci{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Di extends Ci{static getType(){return "paragraph"}static clone(t){return new Di(t.__key)}createDOM(t){const e=document.createElement("p"),n=$o(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:Fi,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Li().updateFromJSON(t)}exportJSON(){return {...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=Li();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||lr(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function Fi(t){const e=Li();return t.style&&(e.setFormat(t.style.textAlign),Ps(t,e)),{node:e}}function Li(){return fs(new Di)}function Ii(t){return t instanceof Di}const Ki=0,zi=1,Ri=2,Bi=3,Wi=4;function Ji(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=Ei(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const o=t._observer;null!==o&&(o.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function ji(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=Is(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t);}if(t){const n=t.$transform;n&&e.add(n),r=t.extends;}else {const t=Object.getPrototypeOf(r);r=t.prototype instanceof Mn&&t!==Mn?t:void 0;}}return e}function $i(t){const e=t||{},n=si(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||false,s=Ei(),l=e.namespace||(null!==i?i._config.namespace:Ao()),c=e.editorState,a=[Ni,Xn,Bn,ar,Di,Pi,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);});};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),g}class Ui{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ao(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t);}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t);}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t);}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t);}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t);}}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=i.get(e);void 0===o&&t(36,String(e));const s=o[r];return s.add(n),()=>{s.delete(n),o.every(t=>0===t.size)&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Os(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=Os(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=xo(e);t&&t.markDirty();}},null===t._pendingEditorState?{tag:Dn}:void 0);}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Go(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=$o(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Ji(this,e,t,r),null!==e&&(this._config.disableEvents||Nn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=os(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,rt$3(this),this._updateTags.add(Dn),hi(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;en.set(t,n);const r=nn.get(n)??0;r<1&&n.addEventListener("selectionchange",Sn),nn.set(n,r+1),t.__lexicalEditor=e;const i=xn(t);for(let n=0;n{kn(t)||(vn(t),(e.isEditable()||"click"===r)&&o(t,e));}:t=>{if(kn(t))return;vn(t);const n=e.isEditable();switch(r){case "cut":return n&&Go(e,Be$1,t);case "copy":return Go(e,Re$1,t);case "paste":return n&&Go(e,fe$1,t);case "dragstart":return n&&Go(e,Ie$1,t);case "dragover":return n&&Go(e,Ke$1,t);case "dragend":return n&&Go(e,ze$1,t);case "focus":return n&&Go(e,Ve$1,t);case "blur":return n&&Go(e,Ye,t);case "drop":return n&&Go(e,Fe$1,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s);});}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Dn),hi(this);gi("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=wi(e),r._selection=e._selection?e._selection.clone():null),nt$4(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),hi(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",false),this._compositionKey=null,null!=s&&o.add(s),this._updating||hi(this);}parseEditorState(t,e){return function(t,e,n){const r=Ei(),i=qr,o=Gr,s=Hr,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,qr=r,Gr=false,Hr=e,Yi(null);try{const i=e._nodes;fi(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,qr=i,Gr=o,Hr=s;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return hi(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):pi(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),yi(this,()=>{const r=Lr(),i=No();null!==r?r.dirty||wo(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),ns("focus"),rs(()=>{n.removeAttribute("autocapitalize"),t&&t();});}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=ps(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,gi("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}Ui.version="0.38.2+prod.esm";let Vi=null;function Yi(t){Vi=t;}let qi=1;function Gi(e,n){const r=Xi(e,n);return void 0===r&&t(30,n),r}function Xi(t,e){return t._nodes.get(e)}const Qi="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function Zi(t){return Ti(vo(t))}function to(t){const e=document.activeElement;if(!Cs(e))return false;const n=e.nodeName;return Ti(vo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==io(e))}function eo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!to(e)&&ro(e)===t}catch(t){return false}}function no(t){return t instanceof Ui}function ro(t){let e=t;for(;null!=e;){const t=io(e);if(no(t))return t;e=Zo(e);}return null}function io(t){return t?t.__lexicalEditor:null}function oo(t){return K$5.test(t)?"rtl":z$4.test(t)?"ltr":null}function so(t){return fr(t)||t.isToken()}function lo(t){return so(t)||t.isSegmented()}function co(t){return Ss(t)&&3===t.nodeType}function ao(t){return Ss(t)&&9===t.nodeType}function uo(t){let e=t;for(;null!=e;){if(co(e))return e;e=e.firstChild;}return null}function fo(t,e,n){const r=R$5[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function ho(t){return lr(t)||jn(t)||Ti(t)}function go(t,e){const n=function(){const t=Vi;return Vi=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);ei(),ni();const r=ii(),i=ri(),o=""+qi++;i._nodeMap.set(o,t),Si(t)?r._dirtyElements.set(o,true):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,t.__key=o;}function _o(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function po(e){ni(),On(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=ri(),o=ii(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(r,s,l);const c=n.__key;o._dirtyType=1,Si(e)?l.set(c,true):o._dirtyLeaves.add(c);}function yo(t){ei();const e=ii(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=xo(n);null!==t&&t.getWritable();}if(null!==t){const e=xo(t);null!==e&&e.getWritable();}}}function mo(){if(ti())return null;return ii()._compositionKey}function xo(t,e){const n=(e||ri())._nodeMap.get(t);return void 0===n?null:n}function Co(t,e){const n=So(t,ii());return void 0!==n?xo(n,e):null}function So(t,e){return t[`__lexicalKey_${e._key}`]}function vo(t,e){let n=t;for(;null!=n;){const t=Co(n,e);if(null!==t)return t;n=Zo(n);}return null}function ko(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function To(t){return t.read(()=>No().getTextContent())}function No(){return bo(ri())}function bo(t){return t._nodeMap.get("root")}function wo(t){ei();const e=ri();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function Eo(t){const e=ii(),n=function(t,e){let n=t;for(;null!=n;){const t=So(n,e);if(void 0!==t)return t;n=Zo(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?xo("root"):null}return xo(n)}function Oo(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Mo(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function Ao(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Po(t){return co(t)?t.nodeValue:null}function Do(t,e,n){const r=ps(ss(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=Po(i);const r=vo(i);if(null!==e&&lr(r)){if(e===P$3&&n){const t=n.length;e=n,o=t,s=t;}null!==e&&Fo(r,e,o,s,t);}}}function Fo(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let a=e;(s||i)&&e[e.length-1]===P$3&&(a=e.slice(0,-1));const u=o.getTextContent();if(i||a!==u){if(""===a){if(yo(null),l||c||d)o.remove();else {const t=ii();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove();});},20);}return}const e=o.getParent(),i=Ir(),u=o.getTextContentSize(),f=mo(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||yr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=Lr();if(!yr(g)||null===n||null===r)return void Lo(o,a,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=sr(o.getTextContent());o.replace(t),o=t;}Lo(o,a,g);}}}function Lo(t,e,n){if(t.setTextContent(e),yr(n)){const e=t.getKey();for(const r of ["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===e&&(i.offset=nl(t,i.offset,"clamp"));}}}function Io(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Ko(t,e){return Io(t,e,"altKey")&&Io(t,e,"ctrlKey")&&Io(t,e,"shiftKey")&&Io(t,e,"metaKey")}function zo(t,e,n){return Ko(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const Ro={ctrlKey:!i,metaKey:i},Bo={altKey:i,ctrlKey:!i};function Wo(t){return "Backspace"===t.key}function Jo(t){return zo(t,"a",Ro)}function jo(t){const e=No();if(yr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),St$5(t),t}{const t=e.select(0,e.getChildrenSize());return wo(St$5(t)),t}}function $o(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=h$1(i);return n[e]=t,t}return i}function Uo(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o);}function Yo(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function qo(t,e){const n=t.offset;if("element"===t.type){return Yo(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Yo(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Ho(t){const e=ss(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Go(t,e,n){return function(t,e,n){const r=Mo(t);for(let i=4;i>=0;i--)for(let o=0;o{for(let e=0;es),Ls(e,"clone")||(e.clone=t=>(Yi(t),new e)),Ls(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!Ls(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t);}return {ownNodeConfig:o,ownNodeType:s}}function Ks(t){const e=bs();ei();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const zs=(t,e)=>{let n=t;for(;null!=n&&!bi(n);){if(e(n))return n;n=n.getParent();}return null},Rs={next:"previous",previous:"next"};class Bs{origin;constructor(t){this.origin=t;}[Symbol.iterator](){return hl({hasNext:Hs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return tl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return tl(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else {const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else o.insert(e);o=tl(e,this.direction);}for(const t of l.values())t.remove();return this}}class Ws extends Bs{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:il(t,this.direction)}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=js(this.direction);return tl(this.getNodeAtCaret(),t)||il(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Ws&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Js={root:bi,shadowRoot:as};function js(t){return Rs[t]}function $s(t,e="root"){return Js[e](t)?null:t}class Us extends Bs{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:tl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Si(this.origin)?il(this.origin,this.direction):null}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=js(this.direction);return tl(this.getNodeAtCaret(),t)||il(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Us&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof Us||t instanceof Vs)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Vs extends Bs{type="text";offset;constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:el(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){return el(this.origin,js(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Vs&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof Us||t instanceof Vs)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return tl(this.origin,this.direction)}}function Ys(t){return t instanceof Vs}function Hs(t){return t instanceof Us}function Gs(t){return t instanceof Ws}const Xs={next:class extends Vs{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Vs{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Qs={next:class extends Us{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Us{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Zs={next:class extends Ws{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Ws{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function tl(t,e){return t?new Qs[e](t):null}function el(t,e,n){return t?new Xs[e](t,nl(t,n)):null}function nl(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return (o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function rl(t,e){return new cl(t,e)}function il(t,e){return Si(t)?new Zs[e](t):null}function ol(t){return t&&t.getChildCaret()||t}function sl(t){return t&&ol(t.getAdjacentCaret())}class ll{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new ll(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return Ys(e)?function(t,e){const{direction:n,origin:r}=t,i=nl(r,"focus"===e?js(n):n);return rl(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [rl(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=Ys(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Ys(n),i=e=>e.isSameNodeCaret(n)?null:sl(e)||e.getParentCaret(t);return hl({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class cl{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n{let n;for(let r=c;rn.has(t.getKey())&&Ns(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;il(t,"previous").splice(0,e.getChildren()),e.remove();}const g=[f,d,...l,...c].find(bl);if(g){return fl(Ml(El(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)));}function El(t){const e=function(t){let e=t;for(;Gs(e);){const t=sl(e);if(!Gs(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(lr(e.origin))return Ys(e)?e:el(e.origin,n,n);const r=e.getAdjacentCaret();return Hs(r)&&lr(r.origin)?el(r.origin,n,js(n)):e}function Ol(t){return Ys(t)&&t.offset!==nl(t.origin,t.direction)}function Ml(t,e){return t.direction===e?t:t.getFlipped()}function Al(t,e){return t.direction===e?t:dl(Ml(t.focus,e),Ml(t.anchor,e))}function Pl(t,e,n){let r=il(t,"next");for(let t=0;tZ$3;try{ci(t,(()=>{const s=Nr()||function(t){return t.getEditorState().read((()=>{const t=Nr();return null!==t?t.clone():null}))}(t),o=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n0){let e=0;for(let i=0;i0)for(const[e,n]of o)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e{lt$2(t,e,n);}));}let pt$4 = class pt{constructor(t,e=new Map,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedConfigMap=e,this.unknownState=n,this.knownState=r;const s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(e,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);return yt$4(t)?{[X$3]:t}:{}}getWritable(t){if(this.node===t)return this;const e=new Map(this.knownState),n=yt$4(r=this.unknownState)&&{...r};var r;if(n)for(const t of e.keys())delete n[t.key];return new pt(t,this.sharedConfigMap,yt$4(n),e,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||this.size++,r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState={},t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);this.unknownState=yt$4(this.unknownState);}};function yt$4(t){if(t)for(const e in t)return t}function mt$4(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new pt$4(e);return e.__state=n,n}function xt$3(t,e){const n=t.__mode,r=t.__format,i=t.__style,s=e.__mode,o=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===s)&&(null===r||r===o)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set,r=(t,e)=>{for(const[r,i]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const t=e?e.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return true}return false},i=(t,e)=>{const{unknownState:r}=t,i=e?e.unknownState:void 0;if(r)for(const[t,e]of Object.entries(r))if(!n.has(t)&&(n.add(t),e!==(i?i[t]:void 0)))return true;return false};return !(t&&r(t,e)||e&&r(e,t)||t&&i(t,e)||e&&i(e,t))}(c,a))}function Ct$2(t,e){const n=t.mergeWithSibling(e),r=qr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function St$3(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Qn(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(xt$3(e,r)){r=Ct$2(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&Qn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(xt$3(r,n)){r=Ct$2(r,n);break}break}n.remove();}}else r.remove();}function vt$4(t){return kt$1(t.anchor),kt$1(t.focus),t}function kt$1(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),Qn(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!di(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let Tt$3,bt$1,Nt$3,wt$3,Et$2,Mt$1,At$1,Ot$1,Dt$1,Pt$2,Ft$2="",Lt$2="",It$2=null,zt="",Kt="",Bt$1=false,Rt$1=false,Wt=null;function Jt(t,e){const n=At$1.get(t);if(null!==e){const n=se(t);n.parentNode===e&&e.removeChild(n);}if(Ot$1.has(t)||bt$1._keyToDOMMap.delete(t),di(n)){const t=te(n,At$1);Ut(t,0,t.length-1,null);} void 0!==n&&Is(Pt$2,Nt$3,wt$3,n,"destroyed");}function Ut(t,e,n,r){let i=e;for(;i<=n;++i){const e=t[i];void 0!==e&&Jt(e,r);}}function $t$1(t,e){t.setProperty("text-align",e);}const jt="40px";function Vt(t,e){const n=Tt$3.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||jt;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`);}function Yt(t,e){const n=t.style;0===e?$t$1(n,""):e===D$3?$t$1(n,"left"):e===P$2?$t$1(n,"center"):e===F$2?$t$1(n,"right"):e===L$3?$t$1(n,"justify"):e===I$4?$t$1(n,"start"):e===z$4&&$t$1(n,"end");}function Ht(e,n){const r=Ot$1.get(e);void 0===r&&t(60);const i=r.createDOM(Tt$3,bt$1);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,bt$1),Qn(r)?i.setAttribute("data-lexical-text","true"):_i(r)&&i.setAttribute("data-lexical-decorator","true"),di(r)){const t=r.__indent,e=r.__size;if(0!==t&&Vt(i,t),0!==e){const t=e-1;!function(t,e,n,r){const i=Lt$2;Lt$2="",qt(t,n,0,e,n.getDOMSlot(r)),Qt(n,r),Lt$2=i;}(te(r,Ot$1),t,r,i);}const n=r.__format;0!==n&&Yt(i,n),r.isInline()||Xt(null,r,i),Js(r)&&(Ft$2+=B$2,Kt+=B$2);}else {const t=r.getTextContent();if(_i(r)){const t=r.decorate(bt$1,Tt$3);null!==t&&ne(e,t),i.contentEditable="false";}else Qn(r)&&(r.isDirectionless()||(Lt$2+=t));Ft$2+=t,Kt+=t;}return null!==n&&n.insertChild(i),Is(Pt$2,Nt$3,wt$3,r,"created"),i}function qt(t,e,n,r,i){const s=Ft$2;Ft$2="";let o=n;for(;o<=r;++o){Ht(t[o],i);const e=Ot$1.get(t[o]);null!==e&&Qn(e)&&(null===It$2&&(It$2=e.getFormat()),""===zt&&(zt=e.getStyle()));}Js(e)&&(Ft$2+=B$2);i.element.__lexicalTextContent=Ft$2,Ft$2=s+Ft$2;}function Gt(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Fn(t)?"line-break":_i(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Xt(t,e,n){const r=Gt(t,At$1),i=Gt(e,Ot$1);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function Qt(t,e){const n=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(n!==Lt$2||r!==Wt){const n=""===Lt$2,i=n?Wt:function(t){if(U$3.test(t))return "rtl";if($$3.test(t))return "ltr";return null}(Lt$2);if(i!==r){const s=e.classList,o=Tt$3.theme;let l=null!==r?o[r]:void 0,c=null!==i?o[i]:void 0;if(void 0!==l){if("string"==typeof l){const t=d$1(l);l=o[r]=t;}s.remove(...l);}if(null===i||n&&"ltr"===i)e.removeAttribute("dir");else {if(void 0!==c){if("string"==typeof c){const t=d$1(c);c=o[i]=t;} void 0!==c&&s.add(...c);}e.dir=i;}if(!Rt$1){t.getWritable().__dir=i;}}Wt=i,e.__lexicalDirTextContent=Lt$2,e.__lexicalDir=i;}}function Zt(e,n,r){const i=Lt$2;var s;Lt$2="",It$2=null,zt="",function(e,n,r){const i=Ft$2,s=e.__size,o=n.__size;Ft$2="";const l=r.element;if(1===s&&1===o){const t=e.__first,r=n.__first;if(t===r)ee(t,l);else {const e=se(t),n=Ht(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const s=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(s)}throw i}Jt(t,null);}const i=Ot$1.get(r);Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}else {const i=te(e,At$1),c=te(n,Ot$1);if(i.length!==s&&t(227),c.length!==o&&t(228),0===s)0!==o&&qt(c,n,0,o-1,r);else if(0===o){if(0!==s){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Ut(i,0,s-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,s){const o=r-1,l=i-1;let c,a,u=s.getFirstChild(),f=0,d=0;for(;f<=o&&d<=l;){const t=e[f],r=n[d];if(t===r)u=re(ee(r,s.element)),f++,d++;else { void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const i=a.has(t),o=c.has(r);if(i)if(o){const t=Us(bt$1,r);t===u?u=re(ee(r,s.element)):(s.withBefore(u).insertChild(t),ee(r,s.element)),f++,d++;}else Ht(r,s.withBefore(u)),d++;else u=re(se(t)),Jt(t,s.element),f++;}const i=Ot$1.get(r);null!==i&&Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}const h=f>o,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:bt$1.getElementByKey(e);qt(n,t,d,l,s.withBefore(r));}else g&&!h&&Ut(e,f,o,s.element);}(n,i,c,s,o,r);}Js(n)&&(Ft$2+=B$2);l.__lexicalTextContent=Ft$2,Ft$2=i+Ft$2;}(e,n,n.getDOMSlot(r)),Qt(n,r),s=n,null==It$2||It$2===s.__textFormat||Rt$1||s.setTextFormat(It$2),function(t){""===zt||zt===t.__textStyle||Rt$1||t.setTextStyle(zt);}(n),Lt$2=i;}function te(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function ee(e,n){const r=At$1.get(e);let i=Ot$1.get(e);void 0!==r&&void 0!==i||t(61);const s=Bt$1||Mt$1.has(e)||Et$2.has(e),o=Us(bt$1,e);if(r===i&&!s){if(di(r)){const t=o.__lexicalTextContent;void 0!==t&&(Ft$2+=t,Kt+=t);const e=o.__lexicalDirTextContent;void 0!==e&&(Lt$2+=e);}else {const t=r.getTextContent();Qn(r)&&!r.isDirectionless()&&(Lt$2+=t),Kt+=t,Ft$2+=t;}return o}if(r!==i&&s&&Is(Pt$2,Nt$3,wt$3,i,"updated"),i.updateDOM(r,o,Tt$3)){const r=Ht(e,null);return null===n&&t(62),n.replaceChild(r,o),Jt(e,null),r}if(di(r)&&di(i)){const t=i.__indent;t!==r.__indent&&Vt(o,t);const e=i.__format;e!==r.__format&&Yt(o,e),s&&(Zt(r,i,o),yi(i)||i.isInline()||Xt(r,i,o)),Js(i)&&(Ft$2+=B$2,Kt+=B$2);}else {const t=i.getTextContent();if(_i(i)){const t=i.decorate(bt$1,Tt$3);null!==t&&ne(e,t);}else Qn(i)&&!i.isDirectionless()&&(Lt$2+=t);Ft$2+=t,Kt+=t;}if(!Rt$1&&yi(i)&&i.__cachedText!==Kt){const t=i.getWritable();t.__cachedText=Kt,i=t;}return o}function ne(t,e){let n=bt$1._pendingDecorators;const r=bt$1._decorators;if(null===n){if(r[t]===e)return;n=gs(bt$1);}n[t]=e;}function re(t){let e=t.nextSibling;return null!==e&&e===bt$1._blockCursorElement&&(e=e.nextSibling),e}function ie(t,e,n,r,i,s){Ft$2="",Kt="",Lt$2="",Bt$1=r===x$3,Wt=null,bt$1=n,Tt$3=n._config,Nt$3=n._nodes,wt$3=bt$1._listeners.mutation,Et$2=i,Mt$1=s,At$1=t._nodeMap,Ot$1=e._nodeMap,Rt$1=e._readOnly,Dt$1=new Map(n._keyToDOMMap);const o=new Map;return Pt$2=o,ee("root",null),bt$1=void 0,Nt$3=void 0,Et$2=void 0,Mt$1=void 0,At$1=void 0,Ot$1=void 0,Tt$3=void 0,Dt$1=void 0,Pt$2=void 0,o}function se(e){const n=Dt$1.get(e);return void 0===n&&t(75,e),n}function oe(t){return {type:t}}const le=oe("SELECTION_CHANGE_COMMAND"),ce=oe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ae=oe("CLICK_COMMAND"),ue=oe("DELETE_CHARACTER_COMMAND"),fe=oe("INSERT_LINE_BREAK_COMMAND"),de=oe("INSERT_PARAGRAPH_COMMAND"),he=oe("CONTROLLED_TEXT_INSERTION_COMMAND"),ge=oe("PASTE_COMMAND"),_e=oe("REMOVE_TEXT_COMMAND"),pe=oe("DELETE_WORD_COMMAND"),ye=oe("DELETE_LINE_COMMAND"),me=oe("FORMAT_TEXT_COMMAND"),xe=oe("UNDO_COMMAND"),Ce=oe("REDO_COMMAND"),Se=oe("KEYDOWN_COMMAND"),ve=oe("KEY_ARROW_RIGHT_COMMAND"),ke=oe("MOVE_TO_END"),Te=oe("KEY_ARROW_LEFT_COMMAND"),be=oe("MOVE_TO_START"),Ne=oe("KEY_ARROW_UP_COMMAND"),we=oe("KEY_ARROW_DOWN_COMMAND"),Ee=oe("KEY_ENTER_COMMAND"),Me=oe("KEY_SPACE_COMMAND"),Ae=oe("KEY_BACKSPACE_COMMAND"),Oe=oe("KEY_ESCAPE_COMMAND"),De=oe("KEY_DELETE_COMMAND"),Pe=oe("KEY_TAB_COMMAND"),Fe=oe("INSERT_TAB_COMMAND"),Le=oe("INDENT_CONTENT_COMMAND"),Ie=oe("OUTDENT_CONTENT_COMMAND"),ze=oe("DROP_COMMAND"),Ke=oe("FORMAT_ELEMENT_COMMAND"),Be=oe("DRAGSTART_COMMAND"),Re=oe("DRAGOVER_COMMAND"),We=oe("DRAGEND_COMMAND"),Je=oe("COPY_COMMAND"),Ue=oe("CUT_COMMAND"),$e=oe("SELECT_ALL_COMMAND"),je=oe("CLEAR_EDITOR_COMMAND"),Ve=oe("CLEAR_HISTORY_COMMAND"),Ye=oe("CAN_REDO_COMMAND"),He=oe("CAN_UNDO_COMMAND"),qe=oe("FOCUS_COMMAND"),Ge=oe("BLUR_COMMAND"),Xe=oe("KEY_MODIFIER_COMMAND"),Qe=Object.freeze({}),Ze=30,tn=[["keydown",function(t,e){if(en=t.timeStamp,nn=t.key,e.isComposing())return;if(Ws(e,Se,t))return;if(null==t.key)return;if(fn&&Ds(t))return ci(e,(()=>{Sn(e,dn);})),fn=false,void(dn="");if(function(t){return Ms(t,"ArrowRight",{shiftKey:"any"})}(t))Ws(e,ve,t);else if(function(t){return Ms(t,"ArrowRight",As)}(t))Ws(e,ke,t);else if(function(t){return Ms(t,"ArrowLeft",{shiftKey:"any"})}(t))Ws(e,Te,t);else if(function(t){return Ms(t,"ArrowLeft",As)}(t))Ws(e,be,t);else if(function(t){return Ms(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Ws(e,Ne,t);else if(function(t){return Ms(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Ws(e,we,t);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))an=true,Ws(e,Ee,t);else if(function(t){return " "===t.key}(t))Ws(e,Me,t);else if(function(t){return r&&Ms(t,"o",{ctrlKey:true})}(t))t.preventDefault(),an=true,Ws(e,fe,true);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))an=false,Ws(e,Ee,t);else if(function(t){return Ms(t,"Backspace",{shiftKey:"any"})||r&&Ms(t,"h",{ctrlKey:true})}(t))Ds(t)?Ws(e,Ae,t):(t.preventDefault(),Ws(e,ue,true));else if(function(t){return "Escape"===t.key}(t))Ws(e,Oe,t);else if(function(t){return Ms(t,"Delete",{})||r&&Ms(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),Ws(e,ue,false)):Ws(e,De,t);else if(function(t){return Ms(t,"Backspace",Os)}(t))t.preventDefault(),Ws(e,pe,true);else if(function(t){return Ms(t,"Delete",Os)}(t))t.preventDefault(),Ws(e,pe,false);else if(function(t){return r&&Ms(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),Ws(e,ye,true);else if(function(t){return r&&(Ms(t,"Delete",{metaKey:true})||Ms(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),Ws(e,ye,false);else if(function(t){return Ms(t,"b",As)}(t))t.preventDefault(),Ws(e,me,"bold");else if(function(t){return Ms(t,"u",As)}(t))t.preventDefault(),Ws(e,me,"underline");else if(function(t){return Ms(t,"i",As)}(t))t.preventDefault(),Ws(e,me,"italic");else if(function(t){return Ms(t,"Tab",{shiftKey:"any"})}(t))Ws(e,Pe,t);else if(function(t){return Ms(t,"z",As)}(t))t.preventDefault(),Ws(e,xe,void 0);else if(function(t){if(r)return Ms(t,"z",{metaKey:true,shiftKey:true});return Ms(t,"y",{ctrlKey:true})||Ms(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),Ws(e,Ce,void 0);else {const n=e._editorState._selection;null===n||cr(n)?Ps(t)&&(t.preventDefault(),Ws(e,$e,t)):!function(t){return Ms(t,"c",As)}(t)?!function(t){return Ms(t,"x",As)}(t)?Ps(t)&&(t.preventDefault(),Ws(e,$e,t)):(t.preventDefault(),Ws(e,Ue,t)):(t.preventDefault(),Ws(e,Je,t));}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&Ws(e,Xe,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;ho(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&ci(e,(()=>{Vi(n)||(cn=true);}));}],["compositionstart",function(t,e){ci(e,(()=>{const n=Nr();if(cr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();cs(r.key),(t.timeStamp{Sn(e,t.data);})):(fn=true,dn=t.data);}],["input",function(t,e){t.stopPropagation(),ci(e,(()=>{if(fo(t.target)&&Vi(t.target))return;const n=Nr(),r=t.data,c=Cn(t);if(null!=r&&cr(n)&&_n(n,c,r,t.timeStamp,false)){un&&(Sn(e,r),un=false);const c=n.anchor.getNode(),a=lo(Xs(e));if(null===a)return;const u=n.isBackward(),d=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Qn(c)&&null!==a.anchorNode&&c.getTextContent().slice(0,d)+r+c.getTextContent().slice(d+h)===Ts(a.anchorNode)||Ws(e,he,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),o||l||f$1||!e.isComposing()||(en=0,cs(null));}else {bs(false,e,null!==r?r:void 0),un&&(Sn(e,r||void 0),un=false);}!function(){Vr();const t=qr();ct$3(t);}();}),{event:t}),sn=null;}],["click",function(t,e){ci(e,(()=>{const n=Nr(),r=lo(Xs(e)),i=wr();if(r)if(cr(n)){const e=n.anchor,s=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!yi(s)&&1===ps().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(s!==n.focus.getNode()){const t=function(t,e){let n=t;for(;n!==ps()&&null!=n;){if(e(n))return n;n=n.getParent();}return null}(s,(t=>di(t)&&!t.isInline()));di(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(fo(n)||ts(n)){ms(br(i,r,e,t));}}Ws(e,ae,t);}));}],["cut",Qe],["copy",Qe],["dragstart",Qe],["dragover",Qe],["dragend",Qe],["paste",Qe],["focus",Qe],["blur",Qe],["drop",Qe]];s&&tn.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,s=Cn(e);if("deleteCompositionText"===r||i&&Rs(n))return;if("insertCompositionText"===r)return;ci(n,(()=>{const i=Nr();if("deleteContentBackward"===r){if(null===i){const t=wr();if(!cr(t))return;ms(t.clone());}if(cr(i)){const r=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===nn&&o{ci(n,(()=>{cs(null);}));}),Ze),cr(i)){const e=i.anchor.getNode();e.markDirty(),Qn(e)||t(142),xn(i,e);}}else {cs(null),e.preventDefault();const t=i.anchor.getNode(),s=t.getTextContent(),o=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===s.length;let c=u&&r&&!l&&o;if(c&&i.isCollapsed()&&(c=!_i(Bs(i.anchor,true))),!c){Ws(n,ue,true);const t=Nr();u&&cr(t)&&t.isCollapsed()&&(hn=t,setTimeout((()=>hn=null)));}}return}}var o;if(!cr(i))return;const c=e.data;null!==sn&&bs(false,n,sn),i.dirty&&null===sn||!i.isCollapsed()||yi(i.anchor.getNode())||null===s||i.applyDOMRange(s),sn=null;const a=i.anchor,f=i.focus,d=a.getNode(),h=f.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":Ws(n,he,e);break;case "insertFromComposition":cs(null),Ws(n,he,e);break;case "insertLineBreak":cs(null),Ws(n,fe,false);break;case "insertParagraph":cs(null),an&&!l?(an=false,Ws(n,fe,false)):Ws(n,de,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":Ws(n,ge,e);break;case "deleteByComposition":(function(t,e){return t!==e||di(t)||di(e)||!Qi(t)||!Qi(e)})(d,h)&&Ws(n,_e,e);break;case "deleteByDrag":case "deleteByCut":Ws(n,_e,e);break;case "deleteContent":Ws(n,ue,false);break;case "deleteWordBackward":Ws(n,pe,true);break;case "deleteWordForward":Ws(n,pe,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":Ws(n,ye,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":Ws(n,ye,false);break;case "formatStrikeThrough":Ws(n,me,"strikethrough");break;case "formatBold":Ws(n,me,"bold");break;case "formatItalic":Ws(n,me,"italic");break;case "formatUnderline":Ws(n,me,"underline");break;case "historyUndo":Ws(n,xe,void 0);break;case "historyRedo":Ws(n,Ce,void 0);}else {if("\n"===c)e.preventDefault(),Ws(n,fe,false);else if(c===B$2)e.preventDefault(),Ws(n,de,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t);}else null!=c&&_n(i,s,c,e.timeStamp,true)?(e.preventDefault(),Ws(n,he,c)):sn=c;rn=e.timeStamp;}}));}(e,n)]);let en=0,nn=null,rn=0,sn=null;const on=new WeakMap;let ln=false,cn=false,an=false,un=false,fn=false,dn="",hn=null,gn=[0,"",0,"root",0];function _n(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=qr(),u=lo(Xs(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Qn(c)||(!i&&(!s||rn1||(i||!s)&&null!==h&&!c.isComposing()&&f!==ns(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=Qi(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (Qn(e)||di(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function pn(t,e){return ts(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function yn(e,n,r){const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=e;ln&&(ln=false,pn(i,s)&&pn(o,l)&&!hn)||ci(n,(()=>{if(!r)return void ms(null);if(!Hi(n,i,o))return;let c=Nr();if(hn&&cr(c)&&c.isCollapsed()){const t=c.anchor,e=hn.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=hn.clone(),ms(c));}if(hn=null,cr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const s=Xs(n).event,o=s?s.timeStamp:performance.now(),[l,a,u,f,d]=gn,h=ps(),g=false===n.isComposing()&&""===h.getTextContent();if(o{const r=wr(),i=e.anchorNode;if(fo(i)||ts(i)){ms(br(r,e,n,t));}})));const r=vs(n),i=r[r.length-1],s=i._key,o=kn.get(s),l=o||i;l!==n&&yn(e,l,false),yn(e,n,true),n!==i?kn.set(s,n):o&&kn.delete(s);}function bn(t){t._lexicalHandled=true;}function Nn(t){return true===t._lexicalHandled}function En(e){const n=e.ownerDocument,r=on.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),on.set(n,i),0===i&&n.removeEventListener("selectionchange",Tn);const s=Xi(e);qi(s)?(!function(t){if(null!==t._parentEditor){const e=vs(t),n=e[e.length-1]._key;kn.get(n)===t&&kn.delete(n);}else kn.delete(t._key);}(s),e.__lexicalEditor=null):s&&t(198);const o=vn(e);for(let t=0;tt.__key===this.__key));if(Qn(this))return n;if(cr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(_i(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:us(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(to(n))return di(e)||e===this&&_i(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:us(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:us(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=di(this)?this:this.getParent(),n=di(t)?t:t.getParent(),r=e&&n?ol(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=ol(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===rl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=ol(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let s=this;for(;null!==s;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const l=di(s)?n?s.getFirstChild():s.getLastChild():null;if(null!==l){s=l;continue}const c=n?s.getNextSibling():s.getPreviousSibling();if(null!==c){s=c;continue}const a=s.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);s=u;}return n||r.reverse(),r}isDirty(){const t=qr()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){const e=us(this.__key);return null===e&&t(113),e}getWritable(){Vr();const t=Hr(),e=qr(),n=t._nodeMap,r=this.__key,i=this.getLatest(),s=e._cloneNotNeeded,o=Nr();if(null!==o&&o.setCachedNodes(null),s.has(r))return ls(i),i;const l=ko(i);return s.add(r),ls(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable();return (e||n.__state)&&mt$4(t).updateFromJSON(e),n}(this,t.$)}static transform(){return null}remove(t){Mn(this,true,t);}replace(e,n){Vr();let r=Nr();null!==r&&(r=r.clone()),ro(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;os(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(Mn(i,false,true),null===u)c.__first=o;else {u.getWritable().__next=o;}if(l.__prev=d,null===f)c.__last=o;else {f.getWritable().__prev=o;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(di(this)&&di(l)||t(139),this.getChildren().forEach((t=>{l.append(t);}))),cr(r)){ms(r);const t=r.anchor,e=r.focus;t.key===s&&or(t,l),e.key===s&&or(e,l);}return as()===s&&cs(o),l}insertAfter(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),s=Nr();let o=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(os(r),cr(s)){const t=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&cr(s)){const t=this.getIndexWithinParent();Er(s,a,t+1);const e=a.__key;o&&s.anchor.set(e,t+2,"element"),l&&s.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;os(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===s)o.__first=i;else {s.getWritable().__next=i;}o.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Nr();if(e&&cr(a)){Er(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Pi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Vr();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(di(n))return n.select();if(!Qn(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Vr();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(di(n))return n.select(0,0);if(!Qn(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}class On extends An{static getType(){return "linebreak"}static clone(t){return new On(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&Ln(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&Ln(r))return true}return false}(t)?null:{conversion:Dn,priority:0}}}static importJSON(t){return Pn().updateFromJSON(t)}}function Dn(t){return {node:Pn()}}function Pn(){return no(new On)}function Fn(t){return t instanceof On}function Ln(t){return ts(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function In(t,e){return 16&e?"code":e&A$3?"mark":32&e?"sub":64&e?"sup":null}function zn(t,e){return 1&e?"strong":2&e?"em":"span"}function Kn(t,e,n,r,i){const s=r.classList;let o=Ls(i,"base");void 0!==o&&s.add(...o),o=Ls(i,"underlineStrikethrough");let l=false;const c=e&N$3&&e&b$1;void 0!==o&&(n&N$3&&n&b$1?(l=true,c||s.add(...o)):c&&s.remove(...o));for(const t in j$3){const r=j$3[t];if(o=Ls(i,t),void 0!==o)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&s.remove(...o);continue}e&r&&(!c||"underline"!==t)&&"strikethrough"!==t||s.add(...o);}else e&r&&s.remove(...o);}}function Bn(t,e,n){const r=e.firstChild,s=n.isComposing(),o=t+(s?K$2:"");if(null==r)e.textContent=o;else {const t=r.nodeValue;if(t!==o)if(s||i){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,s=0;for(;i({conversion:Yn,priority:0}),b:()=>({conversion:$n,priority:0}),code:()=>({conversion:Gn,priority:0}),em:()=>({conversion:Gn,priority:0}),i:()=>({conversion:Gn,priority:0}),mark:()=>({conversion:Gn,priority:0}),s:()=>({conversion:Gn,priority:0}),span:()=>({conversion:Un,priority:0}),strong:()=>({conversion:Gn,priority:0}),sub:()=>({conversion:Gn,priority:0}),sup:()=>({conversion:Gn,priority:0}),u:()=>({conversion:Gn,priority:0})}}static importJSON(t){return Xn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return fo(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Wn(n,"b")),this.hasFormat("italic")&&(n=Wn(n,"i")),this.hasFormat("strikethrough")&&(n=Wn(n,"s")),this.hasFormat("underline")&&(n=Wn(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?j$3[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?V$2[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=rs(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=q$3[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Vr();let n=t,r=e;const i=Nr(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const t=s.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!cr(i))return Sr(o,n,o,r,"text","text");{const t=as();t!==i.anchor.key&&t!==i.focus.key||cs(o),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let l=t;l<0&&(l=o+l,l<0&&(l=0));const c=Nr();if(r&&cr(c)){const e=t+o;c.setTextNodeRange(i,e,i,e);}const a=s.slice(0,l)+n+s.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){Vr();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=as(),s=n.length;t.sort(((t,e)=>t-e)),t.push(s);const o=[],l=t.length;for(let e=0,r=0;ee&&(o.push(n.slice(e,i)),e=i);}const c=o.length;if(1===c)return [e];const a=o[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=Nr();if(cr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=Xn(a),f.__format=d,f.__style=h,f.__detail=g,_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t=v&&(p.set(t.getKey(),C-v,"text"),C=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&ls(e);null!==n&&ls(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),cr(m)&&Er(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;as()===i&&cs(r);const l=Nr();if(cr(l)){const t=l.anchor,s=l.focus;null!==t&&t.key===i&&Or(t,n,r,e,o),null!==s&&s.key===i&&Or(s,n,r,e,o);}const c=e.__text,a=n?c+s:s+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function Un(t){return {forChild:Zn(t.style),node:null}}function $n(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:Zn(e.style,n?void 0:"bold"),node:null}}const jn=new WeakMap;function Vn(t){if(!fo(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function Yn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=jn.get(n))&&!Vn(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=Hn(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:Xn(r)}}function Hn(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,fo(n)){const t=n.style.display;if(""===t&&!_o(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(ts(n))return n;if("BR"===n.nodeName)return null}}const qn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Gn(t){const e=qn[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Zn(t.style,e),node:null}}function Xn(t=""){return no(new Jn(t))}function Qn(t){return t instanceof Jn}function Zn(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Qn(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),s&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),o&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class tr extends Jn{static getType(){return "tab"}static clone(t){return new tr(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=Ls(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return er().updateFromJSON(t)}setTextContent(e){return "\t"!==e&&""!==e&&t(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function er(){return no(new tr)}function nr(t){return t instanceof tr}class rr{constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offsett&&(r=t);}else if(!di(e)){const t=e.getNextSibling();if(Qn(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function or(t,e){if(di(e)){const n=e.getLastDescendant();di(n)||Qn(n)?sr(t,n):sr(t,e);}else sr(t,e);}class lr{constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!ur(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every((t=>n.has(t)))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new lr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(Qn(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t1;){const t=e[e.length-1];if(!di(t)||s.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=pl(t.anchor),r=pl(t.anchor.getFlipped()),i=t=>Lo(t)?t.origin:t.getNodeAtCaret(),s=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(s);}return e}(xl(fl(this),"next"));return jr()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,l]=dr(this);let c="",a=true;for(let u=0;u=0;t--){const e=s[t];if(e.is(d)||di(e)&&e.isParentOf(d))break;e.isAttached()&&(!o.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(Qi(d))if(c===h)d.select();else {const t=Xn(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(di(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}}));},s=r.length;if(0===s)return this.toggleFormat(t),cs(null),void i(e);const o=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:o,u=c?o:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=s-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(Zi(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||Zi(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Zi(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Nr();return cr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=mo(n,yo),i=e[e.length-1];if(di(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=Ir(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some((t=>(di(t)||_i(t))&&!t.isInline()))){di(r)||t(211,n.constructor.name,n.getType());const s=Ir(this);return r.splice(s,0,e),void i.selectEnd()}const s=function(t){const e=Pi();let n=null;for(let r=0;rc?c:l,e=l>c?l:c,n=s.splitText(t,e),r=0===t?n[0]:n[1];return null!=r?[r]:[]}return [s]}const a=r.isBefore(i);if(Qn(s)){const e=a?l:c;e===s.getTextContentSize()?t.shift():0!==e&&([,s]=s.splitText(e),t[0]=s);}if(Qn(o)){const e=o.getTextContent().length,r=a?c:l;0===r?t.pop():r!==e&&([o]=o.splitText(r),t[n]=o);}return t}modify(t,e,n){if(Kr(this,t,e,n))return;const r="move"===t,i=qr(),s=lo(Xs(i));if(!s)return;const o=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===o||!di(c)||c.isInline()||c.canBeEmpty()||oo(o,i,l),this.dirty){let t=Us(i,this.anchor.key),e=Us(i,this.focus.key);"text"===this.anchor.type&&(t=ns(t)),"text"===this.focus.type&&(e=ns(e)),t&&e&&Dr(s,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(s,t,e?"backward":"forward",n),s.rangeCount>0){const t=s.getRangeAt(0),n=this.anchor.getNode(),i=yi(n)?n:Zs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let o=false;for(let t=0;t0)if(e){const t=r[0];di(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];di(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}s.anchorNode===t.startContainer&&s.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,s=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,s,true);}(this);}}"lineboundary"===n&&Kr(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&di(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(di(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=Qo(ll(e,t?"previous":"next"));if(r.getTextSlices().every((t=>null===t||0===t.distance))){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(Ko(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(di(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=pl(e);ul(this,tl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(zo(e)){if(di(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(_i(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&di(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=kr();t.add(e.origin.getKey()),ms(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return ul(this,tl(!e.origin.isEmpty()&&n.isEmpty()?dl(Jo(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&hr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,s=r.getTextContentSize();if(r.is(n)||t&&e!==s||!t&&0!==e)return void _r(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,s=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==s)return void _r(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),s=r.getNode();if(i===s&&"text"===n.type&&"text"===r.type){const t=n.offset,s=r.offset,o=t{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return ()=>false})();function _r(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let t=0;tn||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function pr(e,n,r,i){let s,o=n;if(fo(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;o===a&&(l=true,o=a-1);let f=c[o],d=false;if(f===u)f=c[o+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&o--;}}if(s=xs(f),Qn(s))o=Cs(s,l);else {let c=xs(e);if(null===c)return null;if(di(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,o]=u.resolveChildIndex(c,a,e,n),di(c)||t(215),l&&o>=c.getChildrenSize()&&(o=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(o);if(di(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=di(f)?f:f.getParentOrThrow()),o=0;}Qn(f)?(s=f,c=null,o=Cs(f,l)):f!==c&&l&&!d&&(di(c)||t(216),o=Math.min(c.getChildrenSize(),o+1));}else {const t=c.getIndexWithinParent();o=0===n&&_i(c)&&xs(e)===c?t:t+1,c=c.getParentOrThrow();}if(di(c))return ir(c.__key,o,"element")}}else s=xs(e);return Qn(s)?ir(s.__key,o,"text"):null}function yr(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(e){if((n||!e)&&null===r&&di(s)&&s.isInline()){const e=s.getPreviousSibling();Qn(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else di(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Qn(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(e&&di(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&di(s)&&s.isInline()&&!s.canInsertTextAfter()){const e=s.getNextSibling();Qn(e)&&t.set(e.__key,0,"text");}}}function mr(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),i=t.is(e);yr(t,r,i),yr(e,!r,i),i&&e.set(t.key,t.offset,t.type);const s=qr();if(s.isComposing()&&s._compositionKey!==t.key&&cr(n)){const r=n.anchor,i=n.focus;t.set(r.key,r.offset,r.type,true),e.set(i.key,i.offset,i.type,true);}}}function xr(t,e,n,r,i,s){if(null===t||null===n||!Hi(i,t,n))return null;const o=pr(t,e,cr(s)?s.anchor:null,i);if(null===o)return null;const l=pr(n,r,cr(s)?s.focus:null,i);if(null===l)return null;if("element"===o.type&&"element"===l.type){const e=xs(t),r=xs(n);if(_i(e)&&_i(r))return null}return mr(o,l,s),[o,l]}function Cr(t){return di(t)&&!t.isInline()}function Sr(t,e,n,r,i,s){const o=Hr(),l=new ar(ir(t,e,i),ir(n,r,s),0,"");return l.dirty=true,o._selection=l,l}function vr(){const t=ir("root",0,"element"),e=ir("root",0,"element");return new ar(t,e,0,"")}function kr(){return new lr(new Set)}function br(t,e,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,l="selectionchange"===o,c=!tt$2&&(l||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let a,u,f,d;if(cr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&cr(t)&&!Hi(n,a,u))return t.clone();const h=xr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new ar(g,_,cr(t)?t.format:0,cr(t)?t.style:"")}function Nr(){return Hr()._selection}function wr(){return qr()._editorState._selection}function Er(t,e,n,r=1){const i=t.anchor,s=t.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n0||n0||n=t,o=i?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(o)){let t=0;i&&(t=o.getTextContentSize()),e.set(o.__key,t,"text"),r.set(o.__key,t,"text");}}else {if(di(s)){const t=s.getChildrenSize(),r=n>=t,i=r?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(di(o)){const t=o.getChildrenSize(),e=i>=t,n=e?o.getChildAtIndex(t-1):o.getChildAtIndex(i);if(Qn(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}}function Ar(t,e,n,r,i){let s=null,o=0,l=null;null!==r?(s=r.__key,Qn(r)?(o=r.getTextContentSize(),l="text"):di(r)&&(o=r.getChildrenSize(),l="element")):null!==i&&(s=i.__key,Qn(i)?l="text":di(i)&&(l="element")),null!==s&&null!==l?t.set(s,o,l):(o=e.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),t.set(n.__key,o,"element"));}function Or(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Dr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Pr(t,e,n,r,i,s,o){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has(Ni)&&f!==s||null!==f&&Yi(f))return;if(!cr(e))return void(null!==t&&Hi(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Us(n,g),y=Us(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,v=e.isCollapsed();let k=p,T=y,b=false;if("text"===d.type){k=ns(p);const t=d.getNode();b=t.getFormat()!==C||t.getStyle()!==S;}else cr(t)&&"text"===t.anchor.type&&(b=true);var N,w,E,M,A;if(("text"===h.type&&(T=ns(y)),null!==k&&null!==T)&&(v&&(null===t||b||cr(t)&&(t.format!==C||t.style!==S))&&(N=C,w=S,E=m,M=g,A=performance.now(),gn=[N,w,E,M,A]),a!==m||u!==x||l!==k||c!==T||"Range"===r.type&&v||(null!==f&&s.contains(f)||s.focus({preventScroll:true}),"element"===d.type))){if(Dr(r,k,m,T,x),!i.has(Ei)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=cr(e)&&"element"===e.anchor.type?k.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=js(n),i=Gs(r);if(null===r||null===i)return;let{top:s,bottom:o}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=Xs(t).innerHeight;else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(sc&&(n=o-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;s-=e,o-=e;}if(e)break;a=$s(a);}}(n,e,s);}}ln=true;}}function Fr(t){let e=Nr()||wr();null===e&&(e=ps().selectEnd()),e.insertNodes(t);}function Ir(e){let n=e;e.isCollapsed()||n.removeText();const r=Nr();cr(r)&&(n=r),cr(n)||t(161);const i=n.anchor;let s=i.getNode(),o=i.offset;for(;!yo(s);){const t=s;if([s,o]=zr(s,o),t.is(s))break}return o}function zr(t,e){const n=t.getParent();if(!n){const t=Pi();return ps().append(t),t.select(),[ps(),0]}if(Qn(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!di(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new ar(ir(t.__key,e,"element"),ir(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function Kr(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const s=ll(t.focus,n?"previous":"next"),o="lineboundary"===r,l="move"===e;let c=s,a="decorators-and-blocks"===i;if(!yl(c)){for(const t of c){a=false;const{origin:e}=t;if(!_i(e)||e.isIsolated()||(c=t,!o||!e.isInline()))break}if(a)for(const t of Qo(s).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(Ko(t))t.origin.isInline()||(c=t);else {if(di(t.origin))continue;_i(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===s)return false;if(l&&!o&&_i(c.origin)&&c.origin.isKeyboardSelectable()){const t=kr();return t.add(c.origin.getKey()),ms(t),true}return c=pl(c),l&&cl(t.anchor,c),cl(t.focus,c),a||!o}let Br=null,Rr=null,Wr=false,Jr=false,Ur=0;const $r={characterData:true,childList:true,subtree:true};function jr(){return Wr||null!==Br&&Br._readOnly}function Vr(){Wr&&t(13);}function Yr(){Ur>99&&t(14);}function Hr(){return null===Br&&t(195,Gr()),Br}function qr(){return null===Rr&&t(196,Gr()),Rr}function Gr(){let t=0;const e=new Set,n=Ji.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=Xi(r);if(qi(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Xr(){return Rr}function Qr(e,n,r){const i=n.__type,s=function(e,n){const r=e._nodes.get(n);void 0===r&&t(30,n);return r}(e,i);let o=r.get(i);void 0===o&&(o=Array.from(s.transforms),r.set(i,o));const l=o.length;for(let t=0;t0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);Qn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&St$3(r),void 0!==r&&Zr(r,s)&&Qr(e,r,o),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){Ur++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&Zr(c,s)&&Qr(e,c,o);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Ur++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),oi(e),function(t,e,n,r){const i=t._nodeMap,s=e._nodeMap,o=[];for(const[t]of r){const e=s.get(t);void 0!==e&&(e.isAttached()||(di(e)&&Q$3(e,t,i,s,o,r),i.has(t)||r.delete(t),o.push(t)));}for(const t of o)s.delete(t);for(const t of n){const e=s.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),s.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const s=a._selection;if(cr(s)){const e=a._nodeMap,n=s.anchor.key,r=s.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else ur(s)&&0===s._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=x$3,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void ii(e)}finally{Br=f,Wr=d,Rr=h,e._updating=g,Ur=0;}const p=e._dirtyType!==y$3||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,ii(e)):u&&ji((()=>{ii(e);})):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function ci(t,e,n){Rr===t&&void 0===n?e():li(t,e,n);}class ai{constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new ai(this.element,t,this.after)}withAfter(t){return new ai(this.element,this.before,t)}withElement(t){return this.element===t?this:new ai(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(l||o);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=ui(e,n);i.push(r);const s=ui(e,this.element);let o=t.getIndexWithinParent();for(let t=0;tn){o+=1;break}}return [t.getParentOrThrow(),o]}}function ui(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class fi extends An{constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__first=t.__first,this.__last=t.__last,this.__size=t.__size,this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return H$1[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=qr()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Qn(e)&&t.push(e),di(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;di(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;di(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return di(t)&&t.getLastDescendant()||t||null}const r=e[t];return di(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:us(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:us(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;rt.remove())),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?Y$4[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){const i=r.length,s=this.getChildrenSize(),o=this.getWritable();e+n<=s||t(226,String(e),String(n),String(s));const l=o.__key,c=[],a=[],u=this.getChildAtIndex(e+n);let f=null,d=s-n+i;if(0!==e)if(e===s)f=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(f=t.getPreviousSibling());}if(n>0){let e=null===f?this.getFirstChild():f.getNextSibling();for(let r=0;r0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function di(t){return t instanceof fi}function hi(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class gi extends An{decorate(e,n){t(47);}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function _i(t){return t instanceof gi}class pi extends fi{static getType(){return "root"}static clone(){return new pi}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !jr()&&qr()._dirtyType!==y$3||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)di(e)||_i(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return ps().updateFromJSON(t)}collapseAtStart(){return true}}function yi(t){return t instanceof pi}function mi(t){return new Si(new Map(t._nodeMap))}function xi(){return new Si(new Map([["root",new pi]]))}function Ci(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),di(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const s=e.getChildren();for(let t=0;t({root:Ci(ps())})))}}const vi="historic",ki="history-push",Ti="history-merge",bi="paste",Ni="collaboration",Ei="skip-scroll-into-view",Mi="skip-dom-selection";class Ai extends fi{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Oi extends fi{static getType(){return "paragraph"}static clone(t){return new Oi(t.__key)}createDOM(t){const e=document.createElement("p"),n=Ls(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:Di,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Pi().updateFromJSON(t)}exportJSON(){return {...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=Pi();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Qn(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function Di(t){const e=Pi();return t.style&&(e.setFormat(t.style.textAlign),To(t,e)),{node:e}}function Pi(){return no(new Oi)}function Fi(t){return t instanceof Oi}const Li=0,Ii=1,zi=2,Ki=3,Bi=4;function Ri(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=xi(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=y$3,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function Wi(t){const e=t||{},n=Xr(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,s=e.disableEvents||false,o=xi(),l=e.namespace||(null!==i?i._config.namespace:ks()),c=e.editorState,a=[pi,Jn,On,tr,Oi,Ai,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t{Object.keys(t).forEach((e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);}));};return t.forEach((t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);})),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=x$3),g}class Ji{constructor(t,e,n,r,i,s,o,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=y$3,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=ks(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t);}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t);}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t);}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t);}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t);}}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);void 0===s&&t(36,String(e));const o=s[r];return o.add(n),()=>{o.delete(n),s.every((t=>0===t.size))&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;i.set(e,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=vo(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=vo(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update((()=>{for(const t of r)for(const e of t.keys()){const t=us(e);t&&t.markDirty();}}),null===t._pendingEditorState?{tag:Ti}:void 0);}(this,r.map((t=>t.klass.getType()))),()=>{r.forEach((t=>t.transforms.delete(e)));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Ws(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=Ls(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Ri(this,e,t,r),null!==e&&(this._config.disableEvents||En(e),null!=n&&e.classList.remove(...n)),null!==t){const e=Gs(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=x$3,at$1(this),this._updateTags.add(Ti),ii(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument,r=on.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Tn),on.set(n,(r||0)+1),t.__lexicalEditor=e;const i=vn(t);for(let n=0;n{Nn(t)||(bn(t),(e.isEditable()||"click"===r)&&s(t,e));}:t=>{if(Nn(t))return;bn(t);const n=e.isEditable();switch(r){case "cut":return n&&Ws(e,Ue,t);case "copy":return Ws(e,Je,t);case "paste":return n&&Ws(e,ge,t);case "dragstart":return n&&Ws(e,Be,t);case "dragover":return n&&Ws(e,Re,t);case "dragend":return n&&Ws(e,We,t);case "focus":return n&&Ws(e,qe,t);case "blur":return n&&Ws(e,Ge,t);case "drop":return n&&Ws(e,ze,t)}};t.addEventListener(r,o),i.push((()=>{t.removeEventListener(r,o);}));}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Ti),ii(this);si("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=mi(e),r._selection=e._selection?e._selection.clone():null),ct$3(this);const i=this._pendingEditorState,s=this._updateTags,o=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=o&&s.add(o),ii(this)),this._pendingEditorState=r,this._dirtyType=x$3,this._dirtyElements.set("root",false),this._compositionKey=null,null!=o&&s.add(o),this._updating||ii(this);}parseEditorState(t,e){return function(t,e,n){const r=xi(),i=Br,s=Wr,o=Rr,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Br=r,Wr=false,Rr=e;try{const i=e._nodes;ni(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,Br=i,Wr=s,Rr=o;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return ii(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):li(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),ci(this,(()=>{const r=Nr(),i=ps();null!==r?r.dirty||ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),Ys("focus"),Hs((()=>{n.removeAttribute("autocapitalize"),t&&t();}));})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=lo(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,si("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}Ji.version="0.32.1+prod.esm";let Ui=1;const ji="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function Vi(t){return _i(hs(t))}function Yi(t){const e=document.activeElement;if(!fo(e))return false;const n=e.nodeName;return _i(hs(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Xi(e))}function Hi(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Yi(e)&&Gi(e)===t}catch(t){return false}}function qi(t){return t instanceof Ji}function Gi(t){let e=t;for(;null!=e;){const t=Xi(e);if(qi(t))return t;e=$s(e);}return null}function Xi(t){return t?t.__lexicalEditor:null}function Qi(t){return nr(t)||t.isToken()}function Zi(t){return Qi(t)||t.isSegmented()}function ts(t){return ho(t)&&t.nodeType===g$3}function es(t){return ho(t)&&t.nodeType===_$2}function ns(t){let e=t;for(;null!=e;){if(ts(e))return e;e=e.firstChild;}return null}function rs(t,e,n){const r=j$3[e];if(null!==n&&(t&r)==(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function is(t){return Qn(t)||Fn(t)||_i(t)}function ss(t,e){if(null!=e)return void(t.__key=e);Vr(),Yr();const n=qr(),r=Hr(),i=""+Ui++;r._nodeMap.set(i,t),di(t)?n._dirtyElements.set(i,true):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=m$3,t.__key=i;}function os(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),s=t.getNextSibling(),o=null!==s?s.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=l),null!==c&&(c.__next=o),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function ls(t){Yr();const e=t.getLatest(),n=e.__parent,r=Hr(),i=qr(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(n,s,o);const l=e.__key;i._dirtyType=m$3,di(t)?o.set(l,true):i._dirtyLeaves.add(l);}function cs(t){Vr();const e=qr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=us(n);null!==t&&t.getWritable();}if(null!==t){const e=us(t);null!==e&&e.getWritable();}}}function as(){if(jr())return null;return qr()._compositionKey}function us(t,e){const n=(e||Hr())._nodeMap.get(t);return void 0===n?null:n}function fs(t,e){const n=ds(t,qr());return void 0!==n?us(n,e):null}function ds(t,e){return t[`__lexicalKey_${e._key}`]}function hs(t,e){let n=t;for(;null!=n;){const t=fs(n,e);if(null!==t)return t;n=$s(n);}return null}function gs(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function _s(t){return t.read((()=>ps().getTextContent()))}function ps(){return ys(Hr())}function ys(t){return t._nodeMap.get("root")}function ms(t){Vr();const e=Hr();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function xs(t){const e=qr(),n=function(t,e){let n=t;for(;null!=n;){const t=ds(n,e);if(void 0!==t)return t;n=$s(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?us("root"):null}return us(n)}function Cs(t,e){return e?t.getTextContentSize():0}function Ss(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function vs(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function ks(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ts(t){return ts(t)?t.nodeValue:null}function bs(t,e,n){const r=lo(Xs(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let e=Ts(i);const r=hs(i);if(null!==e&&Qn(r)){if(e===K$2&&n){const t=n.length;e=n,s=t,o=t;}null!==e&&Ns(r,e,s,o,t);}}}function Ns(t,e,n,r,i){let s=t;if(s.isAttached()&&(i||!s.isDirty())){const c=s.isComposing();let a=e;(c||i)&&e[e.length-1]===K$2&&(a=e.slice(0,-1));const u=s.getTextContent();if(i||a!==u){if(""===a){if(cs(null),o||l||f$1)s.remove();else {const t=qr();setTimeout((()=>{t.update((()=>{s.isAttached()&&s.remove();}));}),20);}return}const e=s.getParent(),i=wr(),u=s.getTextContentSize(),d=as(),h=s.getKey();if(s.isToken()||null!==d&&h===d&&!c||cr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!c||i.focus.key===t.__key&&i.focus.offset===u&&!s.canInsertTextAfter()&&!c))return void s.markDirty();const g=Nr();if(!cr(g)||null===n||null===r)return void s.setTextContent(a);if(g.setTextNodeRange(s,n,s,r),s.isSegmented()){const t=Xn(s.getTextContent());s.replace(t),s=t;}s.setTextContent(a);}}}function ws(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Es(t,e){return ws(t,e,"altKey")&&ws(t,e,"ctrlKey")&&ws(t,e,"shiftKey")&&ws(t,e,"metaKey")}function Ms(t,e,n){return Es(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const As={ctrlKey:!r,metaKey:r},Os={altKey:r,ctrlKey:!r};function Ds(t){return "Backspace"===t.key}function Ps(t){return Ms(t,"a",As)}function Fs(t){const e=ps();if(cr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),vt$4(t),t}{const t=e.select(0,e.getChildrenSize());return ms(vt$4(t)),t}}function Ls(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=d$1(i);return n[e]=t,t}return i}function Is(e,n,r,i,s){if(0===r.size)return;const o=i.__type,l=i.__key,c=n.get(o);void 0===c&&t(33,o);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===s;(void 0===f||d)&&u.set(l,d?"updated":s);}function Ks(t,e,n){const r=t.getParent();let i=n,s=t;return null!==r&&(e&&0===n?(i=s.getIndexWithinParent(),s=r):e||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function Bs(t,e){const n=t.offset;if("element"===t.type){return Ks(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Ks(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Rs(t){const e=Xs(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Ws(t,e,n){return function(t,e,n){const r=vs(t);for(let i=4;i>=0;i--)for(let s=0;s{for(let e=0;et,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Jo(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jo(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let t=s.getAdjacentCaret();null!==t&&l.size0){const n=s.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||s.origin.is(e));else {const t=e.getParent();t&&t.is(o)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else s.insert(e);s=Jo(e,this.direction);}for(const t of l.values())t.remove();return this}}class Mo extends Eo{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Vo(t,this.direction)}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Mo&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Ao={root:yi,shadowRoot:to};function Oo(t){return wo[t]}function Do(t,e="root"){return Ao[e](t)?null:t}class Po extends Eo{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Jo(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return di(this.origin)?Vo(this.origin,this.direction):null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Po&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Fo extends Eo{type="text";constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Uo(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Uo(this.origin,Oo(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Fo&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Jo(this.origin,this.direction)}}function Lo(t){return t instanceof Fo}function zo(t){return t instanceof Po}function Ko(t){return t instanceof Mo}const Bo={next:class extends Fo{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fo{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Ro={next:class extends Po{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Po{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Wo={next:class extends Mo{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Mo{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Jo(t,e){return t?new Ro[e](t):null}function Uo(t,e,n){return t?new Bo[e](t,$o(t,n)):null}function $o(t,e){const n=t.getTextContentSize();let r="next"===e?n:"previous"===e?0:e;return (r<0||r>n)&&(!function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}(284,String(e),String(n),t.getKey()),r=r<0?0:n),r}function jo(t,e){return new Go(t,e)}function Vo(t,e){return di(t)?new Wo[e](t):null}function Yo(t){return t&&t.getChildCaret()||t}function Ho(t){return t&&Yo(t.getAdjacentCaret())}class qo{type="node-caret-range";constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new qo(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return Lo(e)?function(t,e){const{direction:n,origin:r}=t,i=$o(r,"focus"===e?Oo(n):n);return jo(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [jo(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=Lo(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Lo(n),i=e=>e.isSameNodeCaret(n)?null:Ho(e)||e.getParentCaret(t);return el({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Go{type="slice";constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n{let n;for(let r=c;rn.has(t.getKey())&&yo(t)));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;Vo(t,"previous").splice(0,e.getChildren()),e.remove();}const g=[f,d,...l,...c].find(gl);if(g){return Zo(ml(pl(g),e.direction))}t(269,JSON.stringify(l.map((t=>t.origin.__key))));}function pl(t){const e=function(t){let e=t;for(;Ko(e);){const t=Ho(e);if(!Ko(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(Qn(e.origin))return Lo(e)?e:Uo(e.origin,n,n);const r=e.getAdjacentCaret();return zo(r)&&Qn(r.origin)?Uo(r.origin,n,Oo(n)):e}function yl(t){return Lo(t)&&t.offset!==$o(t.origin,t.direction)}function ml(t,e){return t.direction===e?t:t.getFlipped()}function xl(t,e){return t.direction===e?t:tl(ml(t.focus,e),ml(t.anchor,e))}function Cl(t,e,n){let r=Vo(t,"next");for(let t=0;tl?l:o,d=o>l?o:l;else if(f){p=s?l:o,d=void 0;}else if(u){p=0,d=s?o:l;}const h=t.__text.slice(p,d);h!==t.__text&&("clone"===n&&(t=As(t)),t.__text=h);}}return t}function $$3(e){const t=e.getStyle(),n=F$4(t);P$2.set(t,n);}function D$3(t,n){(yr(t)?t.isCollapsed():lr(t)||Si(t))||K$4(280);const l=b$3(yr(t)?t.style:lr(t)?t.getStyle():t.getTextStyle()),r=Object.entries(n).reduce((e,[n,o])=>("function"==typeof o?e[n]=o(l[n],t):null===o?delete e[n]:e[n]=o,e),{...l}),s=R$4(r);yr(t)||lr(t)?t.setStyle(s):t.setTextStyle(s),P$2.set(s,r);}function U$5(e,t){if(yr(e)&&e.isCollapsed()){D$3(e,t);const n=e.anchor.getNode();Si(n)&&n.isEmpty()&&D$3(n,t);}j$2(e=>{D$3(e,t);});}function j$2(t){const n=Lr();if(!n)return;const o=new Map,l=e=>o.get(e.getKey())||[0,e.getTextContentSize()];if(yr(n))for(const e of kl(n).getTextSlices())e&&o.set(e.caret.origin.getKey(),e.getSliceIndices());const r=n.getNodes();for(const n of r){if(!lr(n)||!n.canHaveFormat())continue;const[o,r]=l(n);if(r!==o)if(lo(n)||0===o&&r===n.getTextContentSize())t(n);else {t(n.splitText(o,r)[0===o?0:1]);}}yr(n)&&"text"===n.anchor.type&&"text"===n.focus.type&&n.anchor.key===n.focus.key&&H$2(n);}function H$2(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:l,type:r}=t;t.set(n.key,n.offset,n.type),n.set(o,l,r);}}function Q$4(e){const t=Y$3(e);return null!==t&&"vertical-rl"===t.writingMode}function Y$3(e){const t=e.anchor.getNode();return Si(t)?O$1(t):z$3(t)}function Z$3(e,t){let n=Q$4(e)?!t:t;te(e)&&(n=!n);const l=xl(e.focus,n?"previous":"next");if(Ol(l))return false;for(const e of ul(l)){if(Gs(e))return !e.origin.isInline();if(!Si(e.origin)){if(Ti(e.origin))return true;break}}return false}function ee(e,t,n,o){e.modify(t?"extend":"move",n,o);}function te(e){const t=Y$3(e);return null!==t&&"rtl"===t.direction}function ne(e,t,n){const o=te(e);let l;l=Q$4(e)||o?!n:n,ee(e,t,l,"character");}function oe$1(e,t,n){const o=b$3(e.getStyle());return null!==o&&o[t]||n}function le$1(t,n,o=""){let l=null;const r=t.getNodes(),s=t.anchor,c=t.focus,f=t.isBackward(),u=f?c.offset:s.offset,g=f?c.getNode():s.getNode();if(yr(t)&&t.isCollapsed()&&""!==t.style){const e=b$3(t.style);if(null!==e&&n in e)return e[n]}for(let t=0;tl?l:t,g=t>l?t:l;else if(f){a=s?l:t,g=void 0;}else if(u){a=0,g=s?t:l;}o.__text=o.__text.slice(a,g);}}return o}function z$3(e){const t=e.getStyle(),n=I$3(t);C$1.set(t,n);}function A$2(t,n){(cr(t)?t.isCollapsed():Qn(t)||di(t))||N$2(280);const l=B$1(cr(t)?t.style:Qn(t)?t.getStyle():t.getTextStyle()),r=Object.entries(n).reduce(((e,[n,o])=>("function"==typeof o?e[n]=o(l[n],t):null===o?delete e[n]:e[n]=o,e)),{...l}),s=F$1(r);cr(t)||Qn(t)?t.setStyle(s):t.setTextStyle(s),C$1.set(s,r);}function M$6(e,t){if(cr(e)&&e.isCollapsed()){A$2(e,t);const n=e.anchor.getNode();di(n)&&n.isEmpty()&&A$2(n,t);}L$2((e=>{A$2(e,t);}));}function L$2(n){const o=Nr();if(!o)return;const l=new Map;if(cr(o))for(const e of fl(o).getTextSlices())e&&l.set(e.caret.origin.getKey(),e.getSliceIndices());const r=o.getNodes();for(const o of r){if(!Qn(o)||!o.canHaveFormat())continue;const[r,i]=(s=o,l.get(s.getKey())||[0,s.getTextContentSize()]);if(i!==r)if(Zi(o)||0===r&&i===o.getTextContentSize())n(o);else {n(o.splitText(r,i)[0===r?0:1]);}}var s;cr(o)&&"text"===o.anchor.type&&"text"===o.focus.type&&o.anchor.key===o.focus.key&&$$2(o);}function $$2(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:l,type:r}=t;t.set(n.key,n.offset,n.type),n.set(o,l,r);}}function W$2(e){const t=e.anchor.getNode(),n=yi(t)?t:t.getParentOrThrow(),o=xo().getElementByKey(n.getKey());if(null===o)return false;const r=o.ownerDocument.defaultView;if(null===r)return false;return "vertical-rl"===r.getComputedStyle(o).writingMode}function X$2(e,t){const n=W$2(e)?!t:t,l=ll(e.focus,n?"previous":"next");if(yl(l))return false;for(const e of Qo(l)){if(Ko(e))return !e.origin.isInline();if(!di(e.origin)){if(_i(e.origin))return true;break}}return false}function q$2(e,t,n,o){e.modify(t?"extend":"move",n,o);}function G$2(e){const t=e.anchor.getNode();return "rtl"===(yi(t)?t:t.getParentOrThrow()).getDirection()}function J$3(e,t,n){const o=G$2(e);let l;l=W$2(e)||o?!n:n,q$2(e,t,l,"character");}function Q$2(e,t,n){const o=B$1(e.getStyle());return null!==o&&o[t]||n}function Y$3(t,n,o=""){let l=null;const r=t.getNodes(),s=t.anchor,i=t.focus,f=t.isBackward(),u=f?i.offset:s.offset,g=f?i.getNode():s.getNode();if(cr(t)&&t.isCollapsed()&&""!==t.style){const e=B$1(t.style);if(null!==e&&n in e)return e[n]}for(let t=0;t{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function lt$3(t,...e){const n=F$3(...e);n.length>0&&t.classList.add(...n);}function ut$2(t,...e){const n=F$3(...e);n.length>0&&t.classList.remove(...n);}function ft$1(t){return t?t.getAdjacentCaret():null}function wt$4(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function xt$4(t){const e=zs(t,t=>Si(t)&&!t.isInline());return Si(e)||R$3(4,t.__key),e}function Lt$3(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name} - -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -const T$1=Symbol.for("preact-signals");function B$1(){if(Z$2>1)return void Z$2--;let t,e=false;for(;void 0!==V$4;){let n=V$4;for(V$4=void 0,J$4++;void 0!==n;){const i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Y$2(n))try{n.c();}catch(n){e||(t=n,e=true);}n=i;}}if(J$4=0,Z$2--,e)throw t}function F$2(t){if(Z$2>0)return t();Z$2++;try{return t()}finally{B$1();}}let G$3,V$4;function W$5(t){const e=G$3;G$3=void 0;try{return t()}finally{G$3=e;}}let Z$2=0,J$4=0,H$1=0;function q$3(t){if(void 0===G$3)return;let e=t.n;return void 0===e||e.t!==G$3?(e={i:0,S:t,p:G$3.s,n:void 0,t:G$3,e:void 0,x:void 0,r:e},void 0!==G$3.s&&(G$3.s.n=e),G$3.s=e,t.n=e,32&G$3.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=G$3.s,e.n=void 0,G$3.s.n=e,G$3.s=e),e):void 0}function Q$3(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function X$3(t,e){return new Q$3(t,e)}function Y$2(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return true;return false}function tt$2(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function et$3(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t;}t.s=e;}function nt$3(t,e){Q$3.call(this,void 0),this.x=t,this.s=void 0,this.g=H$1-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function ot$3(t){const e=t.u;if(t.u=void 0,"function"==typeof e){Z$2++;const n=G$3;G$3=void 0;try{e();}catch(e){throw t.f&=-2,t.f|=8,st$3(t),e}finally{G$3=n,B$1();}}}function st$3(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ot$3(t);}function rt$2(t){if(G$3!==this)throw new Error("Out-of-order effect");et$3(this),G$3=t,this.f&=-2,8&this.f&&st$3(this),B$1();}function ct$3(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==e?void 0:e.name;}function dt$2(t,e){const n=new ct$3(t,e);try{n.c();}catch(t){throw n.d(),t}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function at$1(t,e={}){const n={};for(const i in t){const o=e[i],s=X$3(void 0===o?t[i]:o);n[i]=s;}return n}Q$3.prototype.brand=T$1,Q$3.prototype.h=function(){return true},Q$3.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:W$5(()=>{var t;null==(t=this.W)||t.call(this);}));},Q$3.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&W$5(()=>{var t;null==(t=this.Z)||t.call(this);}));}},Q$3.prototype.subscribe=function(t){return dt$2(()=>{const e=this.value,n=G$3;G$3=void 0;try{t(e);}finally{G$3=n;}},{name:"sub"})},Q$3.prototype.valueOf=function(){return this.value},Q$3.prototype.toString=function(){return this.value+""},Q$3.prototype.toJSON=function(){return this.value},Q$3.prototype.peek=function(){const t=G$3;G$3=void 0;try{return this.value}finally{G$3=t;}},Object.defineProperty(Q$3.prototype,"value",{get(){const t=q$3(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(J$4>100)throw new Error("Cycle detected");this.v=t,this.i++,H$1++,Z$2++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N();}finally{B$1();}}}}),nt$3.prototype=new Q$3,nt$3.prototype.h=function(){if(this.f&=-3,1&this.f)return false;if(32==(36&this.f))return true;if(this.f&=-5,this.g===H$1)return true;if(this.g=H$1,this.f|=1,this.i>0&&!Y$2(this))return this.f&=-2,true;const t=G$3;try{tt$2(this),G$3=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++);}catch(t){this.v=t,this.f|=16,this.i++;}return G$3=t,et$3(this),this.f&=-2,true},nt$3.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t);}Q$3.prototype.S.call(this,t);},nt$3.prototype.U=function(t){if(void 0!==this.t&&(Q$3.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t);}},nt$3.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N();}},Object.defineProperty(nt$3.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=q$3(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),ct$3.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t);}finally{t();}},ct$3.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ot$3(this),tt$2(this),Z$2++;const t=G$3;return G$3=this,rt$2.bind(this,t)},ct$3.prototype.N=function(){2&this.f||(this.f|=2,this.o=V$4,V$4=this);},ct$3.prototype.d=function(){this.f|=8,1&this.f||st$3(this);},ct$3.prototype.dispose=function(){this.d();};function pt$2(t){return ("function"==typeof t.nodes?t.nodes():t.nodes)||[]}function xt$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function yt$2(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)n[t]=yt$2(n[t],i[t]);return t}return e}const St$4=0,Et$3=1,bt$4=2,wt$3=3,Nt$3=4,Ot$2=5,Rt$1=6,Mt$2=7;function Ct$3(t){return t.id===St$4}function Dt$2(t){return t.id===bt$4}function _t$2(t){return function(t){return t.id===Et$3}(t)||xt$3(305,String(t.id),String(Et$3)),Object.assign(t,{id:bt$4})}const It$2=new Set;let jt$2 = class jt{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:St$4};}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Wl;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Dt$2(e)||xt$3(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(t,e,n){return Object.assign(t,{config:e,id:wt$3,registerState:n})}(e,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(t,o.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:Nt$3,initResult:e,registerState:n})}(o,s,i);}build(t){const e=this.state;let n;e.id!==Nt$3&&xt$3(307,String(e.id),String(Ot$2)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:Ot$2,output:e,registerState:n})}(e,n,i);}register(t,e){this._signal=e;const n=this.state;n.id!==Ot$2&&xt$3(308,String(n.id),String(Ot$2));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:Rt$1})}(n),()=>{const t=this.state;t.id!==Mt$2&&xt$3(309,String(n.id),String(Mt$2)),this.state=function(t){return Object.assign(t,{id:Ot$2})}(t),i&&i();}}afterRegistration(t){const e=this.state;let n;return e.id!==Rt$1&&xt$3(310,String(e.id),String(Rt$1)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:Mt$2})}(e),n}getSignal(){return void 0===this._signal&&xt$3(311),this._signal}getInitResult(){ void 0===this.extension.init&&xt$3(312,this.extension.name);const t=this.state;return function(t){return t.id>=Nt$3}(t)||xt$3(313,String(t.id),String(Nt$3)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=wt$3}(t)||xt$3(314,String(t.id),String(wt$3)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&xt$3(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&xt$3(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=Mt$2}(t)||xt$3(316,String(t.id),String(Mt$2)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||It$2}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;((function(t){return t.id>=Ot$2}))(t)||xt$3(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output};}return this._dependency}};const At$3={tag:Dn};function Pt$3(){const t=No();t.isEmpty()&&t.append(Li());}const Kt$1=Kl({config:Bl({setOptions:At$3,updateOptions:At$3}),init:({$initialEditorState:t=Pt$3})=>({$initialEditorState:t,initialized:false}),afterRegistration(t,{updateOptions:e,setOptions:n},i){const o=i.getInitResult();if(!o.initialized){o.initialized=true;const{$initialEditorState:i}=o;if(Mi(i))t.setEditorState(i,n);else if("function"==typeof i)t.update(()=>{i(t);},e);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,n);}}return ()=>{}},name:"@lexical/extension/InitialState",nodes:[Ni,Xn,Bn,ar,Di]}),kt$4=Symbol.for("@lexical/extension/LexicalBuilder");function zt$1(){}function Ut$1(t){throw t}function Lt$2(t){return Array.isArray(t)?t:[t]}const Tt$3="0.38.2+prod.esm";let Bt$1 = class Bt{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Tt$3,this.roots=t;for(const e of t)this.addExtension(e);}static fromExtensions(t){const e=[Lt$2(Kt$1)];for(const n of t)e.push(Lt$2(n));return new Bt(e)}static maybeFromEditor(t){const e=t[kt$4];return e&&(e.PACKAGE_VERSION!==Tt$3&&xt$3(292,e.PACKAGE_VERSION,Tt$3),e instanceof Bt||xt$3(293)),e}static fromEditor(t){const e=Bt.maybeFromEditor(t);return void 0===e&&xt$3(294),e}constructEditor(){const{$initialEditorState:t,onError:e,...n}=this.buildCreateEditorArgs(),i=Object.assign($i({...n,...e?{onError:t=>{e(t,i);}}:{}}),{[kt$4]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=zt$1;function e(){try{t();}finally{t=zt$1;}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=U$4(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&xt$3(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);i?i.set(e,n):this.outgoingConfigEdges.set(t,new Map([[e,n]]));const o=this.incomingEdges.get(e);o?o.add(t):this.incomingEdges.set(e,new Set([t]));}addExtension(t){ void 0!==this._sortedExtensionReps&&xt$3(296);const e=Lt$2(t),[n]=e;"string"!=typeof n.name&&xt$3(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&xt$3(298,n.name),!i){i=new jt$2(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&xt$3(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&xt$3(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=Lt$2(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e);}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[]);}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let o=n.state;if(Dt$2(o))return;const s=n.extension.name;var r;Ct$3(o)||xt$3(300,s,i||"[unknown]"),Ct$3(r=o)||xt$3(304,String(r.id),String(St$4)),o=Object.assign(r,{id:Et$3}),n.state=o;const c=this.outgoingConfigEdges.get(s);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,s);}o=_t$2(o),n.state=o,t.push(n);};for(const t of this.extensionNameMap.values())Ct$3(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t);}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&xt$3(301,t.name);for(const t of e)n.configs.add(t);}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),n=new AbortController,i=[()=>n.abort()],o=n.signal;for(const n of e){const e=n.register(t,o);e&&i.push(e);}for(const n of e){const e=n.afterRegistration(t);e&&i.push(e);}return U$4(...i)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const c of r){const{extension:r}=c;if(void 0!==r.onError&&(t.onError=r.onError),void 0!==r.disableEvents&&(t.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(t.parentEditor=r.parentEditor),void 0!==r.editable&&(t.editable=r.editable),void 0!==r.namespace&&(t.namespace=r.namespace),void 0!==r.$initialEditorState&&(t.$initialEditorState=r.$initialEditorState),r.nodes)for(const t of pt$2(r)){if("function"!=typeof t){const e=n.get(t.replace);e&&xt$3(302,r.name,t.replace.name,e.extension.name),n.set(t.replace,c);}e.add(t);}if(r.html){if(r.html.export)for(const[t,e]of r.html.export.entries())i.set(t,e);r.html.import&&Object.assign(o,r.html.import);}r.theme&&yt$2(s,r.theme);}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=[...e]);const c=Object.keys(o).length>0,d=i.size>0;(c||d)&&(t.html={},c&&(t.html.import=o),d&&(t.html.export=i));for(const e of r)e.init(t);return t.onError||(t.onError=Ut$1),t}};function Gt(t,e){const n=Bt$1.fromEditor(t).extensionNameMap.get(e);return n?n.getExtensionDependency():void 0} +function P$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M$5="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R$3=M$5&&"documentMode"in document?document.documentMode:null;!(!M$5||!("InputEvent"in window)||R$3)&&"getTargetRanges"in new window.InputEvent("input");function I$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function j$2(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function rt$2(t,...e){const n=I$2(...e);n.length>0&&t.classList.add(...n);}function it$3(t,...e){const n=I$2(...e);n.length>0&&t.classList.remove(...n);}function ct$2(t){return t?t.getAdjacentCaret():null}function vt$3(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function yt$3(t){const e=wt$2(t,(t=>di(t)&&!t.isInline()));return di(e)||P$1(4,t.__key),e}const wt$2=(t,e)=>{let n=t;for(;n!==ps()&&null!=n;){if(e(n))return n;n=n.getParent();}return null};function Lt$1(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name} /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -1464,7 +1421,7 @@ const T$1=Symbol.for("preact-signals");function B$1(){if(Z$2>1)return void Z$2-- * */ -function K$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function W$4(t){let e=1,n=t.getParent();for(;null!=n;){if(ot$2(n)){const t=n.getParent();if(dt$1(t)){e++,n=t.getParent();continue}K$3(40);}return e}return e}function J$3(t){let e=t.getParent();dt$1(e)||K$3(40);let n=e;for(;null!==n;)n=n.getParent(),dt$1(n)&&(e=n);return e}function U$3(t){let e=[];const n=t.getChildren().filter(ot$2);for(let t=0;t0&&t.append(...i),e.remove();}function G$2(){const t=Lr();if(yr(t)){const e=new Set,r=t.getNodes(),i=t.anchor.getNode();if(z$2(i,r))e.add(J$3(i));else for(let t=0;ts.append(t));const o=st$2(),l=ht$3(r);o.append(l),q$2(l,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(t);}}}function tt$1(){const t=Lr();if(!yr(t)||!t.isCollapsed())return false;const e=t.anchor.getNode();if(!ot$2(e)||0!==e.getChildrenSize())return false;const n=J$3(e),r=e.getParent();dt$1(r)||K$3(40);const i=r.getParent();let s;if(as(i))s=Li(),n.insertAfter(s);else {if(!ot$2(i))return false;s=st$2(),i.insertAfter(s);}s.setTextStyle(t.style).setTextFormat(t.format).select();const o=e.getNextSiblings();if(o.length>0){const t=ht$3(r.getListType());if(ot$2(s)){const e=st$2();e.append(t),s.insertAfter(e);}else s.insertAfter(t);t.append(...o);}return function(t){let e=t;for(;null==e.getNextSibling()&&null==e.getPreviousSibling();){const t=e.getParent();if(null==t||!ot$2(t)&&!dt$1(t))break;e=t;}e.remove();}(e),true}function et$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}let nt$2 = class nt extends Ci{__value;__checked;$config(){return this.config("listitem",{$transform:t=>{if(null==t.__checked)return;const e=t.getParent();dt$1(e)&&"check"!==e.getListType()&&null!=t.getChecked()&&t.setChecked(void 0);},extends:Ci,importDOM:wn({li:()=>({conversion:rt$1,priority:0})})})}constructor(t=1,e=void 0,n){super(n),this.__value=void 0===t?1:t,this.__checked=e;}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked;}createDOM(t){const e=document.createElement("li");return this.updateListItemDOM(null,e,t),e}updateListItemDOM(t,e,n){!function(t,e,n){const r=e.getParent();!dt$1(r)||"check"!==r.getListType()||dt$1(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"));}(e,this,t),e.value=this.__value,function(t,e,n){const s=[],o=[],l=e.list,c=l?l.listitem:void 0;let a;l&&l.nested&&(a=l.nested.listitem);void 0!==c&&s.push(...et$2(c));if(l){const t=n.getParent(),e=dt$1(t)&&"check"===t.getListType(),r=n.getChecked();e&&!r||o.push(l.listitemUnchecked),e&&r||o.push(l.listitemChecked),e&&s.push(r?l.listitemChecked:l.listitemUnchecked);}if(void 0!==a){const t=et$2(a);n.getChildren().some(t=>dt$1(t))?s.push(...t):o.push(...t);}o.length>0&&ut$2(t,...o);s.length>0&<$3(t,...s);}(e,n.theme,this);const s=t?t.__style:"",o=this.__style;s!==o&&(""===o?e.removeAttribute("style"):e.style.cssText=o),function(t,e,n){const r=b$3(e.__textStyle);for(const e in r)t.style.setProperty(`--listitem-marker-${e}`,r[e]);if(n)for(const e in b$3(n.__textStyle))e in r||t.style.removeProperty(`--listitem-marker-${e}`);}(e,this,t);}updateDOM(t,e,n){const r=e;return this.updateListItemDOM(t,r,n),false}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const e=this.createDOM(t._config),n=this.getFormatType();n&&(e.style.textAlign=n);const r=this.getDirection();return r&&(e.dir=r),{element:e}}exportJSON(){return {...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let e=0;e{t.append(e);})),this.remove(),0===n.getChildrenSize()&&n.remove(),t}insertAfter(t,e=true){const n=this.getParentOrThrow();if(dt$1(n)||K$3(39),ot$2(t))return super.insertAfter(t,e);const r=this.getNextSiblings();if(n.insertAfter(t,e),0!==r.length){const i=ht$3(n.getListType());r.forEach(t=>i.append(t)),t.insertAfter(i,e);}return t}remove(t){const e=this.getPreviousSibling(),n=this.getNextSibling();super.remove(t),e&&n&&$$2(e)&&$$2(n)&&(X$2(e.getFirstChild(),n.getFirstChild()),n.remove());}insertNewAfter(t,e=true){const n=st$2().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,e),n}collapseAtStart(t){const e=Li();this.getChildren().forEach(t=>e.append(t));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=ot$2(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else {n.insertBefore(e),n.remove();const r=t.anchor,i=t.focus,s=e.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,i.offset,"element");}else n.insertBefore(e),this.remove();return true}getValue(){return this.getLatest().__value}setValue(t){const e=this.getWritable();return e.__value=t,e}getChecked(){const t=this.getLatest();let e;const n=this.getParent();return dt$1(n)&&(e=n.getListType()),"check"===e?Boolean(t.__checked):void 0}setChecked(t){const e=this.getWritable();return e.__checked=t,e}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(null===t||!this.isAttached())return this.getLatest().__indent;let e=t.getParentOrThrow(),n=0;for(;ot$2(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){"number"!=typeof t&&K$3(117),(t=Math.floor(t))>=0||K$3(199);let e=this.getIndent();for(;e!==t;)e0&&"INPUT"===e.children[0].tagName)return it$2(e.children[0]);const e=t.getAttribute("aria-checked");return {node:st$2("true"===e||"false"!==e&&void 0)}}function it$2(t){if(!("checkbox"===t.getAttribute("type")))return {node:null};return {node:st$2(t.hasAttribute("checked"))}}function st$2(t){return fs(new nt$2(void 0,t))}function ot$2(t){return t instanceof nt$2}let lt$2 = class lt extends Ci{__tag;__start;__listType;$config(){return this.config("list",{$transform:t=>{!function(t){const e=t.getNextSibling();dt$1(e)&&t.getListType()===e.getListType()&&X$2(t,e);}(t),Q$2(t);},extends:Ci,importDOM:wn({ol:()=>({conversion:gt$2,priority:0}),ul:()=>({conversion:gt$2,priority:0})})})}constructor(t="number",e=1,n){super(n);const r=ut$1[t]||t;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=e;}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start;}getTag(){return this.getLatest().__tag}setListType(t){const e=this.getWritable();return e.__listType=t,e.__tag="number"===t?"ol":"ul",e}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const e=this.getWritable();return e.__start=t,e}createDOM(t,e){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,ct$2(r,t.theme,this),r}updateDOM(t,e,n){return t.__tag!==this.__tag||t.__listType!==this.__listType||(ct$2(e,n.theme,this),false)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const e=this.createDOM(t._config,t);return Cs(e)&&(1!==this.__start&&e.setAttribute("start",String(this.__start)),"check"===this.__listType&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return {...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return false}canIndent(){return false}splice(t,e,n){let r=n;for(let t=0;t1?s.push(...t):o.push(...t);}}o.length>0&&ut$2(t,...o),s.length>0&<$3(t,...s);}function at(t){const e=[];for(let n=0;n1&&t.forEach(t=>{dt$1(t)&&e.push(V$3(t));});}else e.push(V$3(r));}return e}function gt$2(t){const e=t.nodeName.toLowerCase();let n=null;if("ol"===e){n=ht$3("number",t.start);}else "ul"===e&&(n=function(t){if("check"===t.getAttribute("__lexicallisttype")||t.classList.contains("contains-task-list")||"1"===t.getAttribute("data-is-checklist"))return true;for(const e of t.childNodes)if(Cs(e)&&e.hasAttribute("aria-checked"))return true;return false}(t)?ht$3("check"):ht$3("bullet"));return {after:at,node:n}}const ut$1={ol:"number",ul:"bullet"};function ht$3(t="number",e=1){return fs(new lt$2(t,e))}function dt$1(t){return t instanceof lt$2}const vt$2=re$1("UPDATE_LIST_START_COMMAND"),St$3=re$1("INSERT_UNORDERED_LIST_COMMAND"),xt$2=re$1("INSERT_ORDERED_LIST_COMMAND"),kt$3=re$1("REMOVE_LIST_COMMAND");function bt$3(t){return U$4(t.registerCommand(xt$2,()=>(j$1("number"),true),zi),t.registerCommand(vt$2,t=>{const{listNodeKey:e,newStart:n}=t,r=xo(e);return !!dt$1(r)&&("number"===r.getListType()&&(r.setStart(n),Q$2(r)),true)},zi),t.registerCommand(St$3,()=>(j$1("bullet"),true),zi),t.registerCommand(kt$3,()=>(G$2(),true),zi),t.registerCommand(ae$1,()=>tt$1(),zi),t.registerNodeTransform(nt$2,t=>{const e=t.getFirstChild();if(e){if(lr(e)){const n=e.getStyle(),r=e.getFormat();t.getTextStyle()!==n&&t.setTextStyle(n),t.getTextFormat()!==r&&t.setTextFormat(r);}}else {const e=Lr();yr(e)&&(e.style!==t.getTextStyle()||e.format!==t.getTextFormat())&&e.isCollapsed()&&t.is(e.anchor.getNode())&&t.setTextStyle(e.style).setTextFormat(e.format);}}),t.registerNodeTransform(Xn,t=>{const e=t.getParent();if(ot$2(e)&&t.is(e.getFirstChild())){const n=t.getStyle(),r=t.getFormat();n===e.getTextStyle()&&r===e.getTextFormat()||e.setTextStyle(n).setTextFormat(r);}}))} +function w$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function I$1(t){let e=1,n=t.getParent();for(;null!=n;){if(Z$2(n)){const t=n.getParent();if(ot$2(t)){e++,n=t.getParent();continue}w$1(40);}return e}return e}function D$2(t){let e=t.getParent();ot$2(e)||w$1(40);let n=e;for(;null!==n;)n=n.getParent(),ot$2(n)&&(e=n);return e}function M$4(t){let e=[];const n=t.getChildren().filter(Z$2);for(let t=0;t0&&t.append(...i),e.remove();}function z$2(){const e=Nr();if(cr(e)){const n=new Set,r=e.getNodes(),i=e.anchor.getNode();if(B(i,r))n.add(D$2(i));else for(let e=0;es.append(t)));const o=Y$2(),l=st$2(r);o.append(l),K$1(l,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(t);}}}function H(){const t=Nr();if(!cr(t)||!t.isCollapsed())return false;const e=t.anchor.getNode();if(!Z$2(e)||0!==e.getChildrenSize())return false;const n=D$2(e),r=e.getParent();ot$2(r)||w$1(40);const i=r.getParent();let s;if(to(i))s=Pi(),n.insertAfter(s);else {if(!Z$2(i))return false;s=Y$2(),i.insertAfter(s);}s.setTextStyle(t.style).setTextFormat(t.format).select();const o=e.getNextSiblings();if(o.length>0){const t=st$2(r.getListType());if(Z$2(s)){const e=Y$2();e.append(t),s.insertAfter(e);}else s.insertAfter(t);t.append(...o);}return function(t){let e=t;for(;null==e.getNextSibling()&&null==e.getPreviousSibling();){const t=e.getParent();if(null==t||!Z$2(t)&&!ot$2(t))break;e=t;}e.remove();}(e),true}function X$1(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}let j$1 = class j extends fi{static getType(){return "listitem"}static clone(t){return new j(t.__value,t.__checked,t.__key)}constructor(t,e,n){super(n),this.__value=void 0===t?1:t,this.__checked=e;}createDOM(t){const e=document.createElement("li");return this.updateListItemDOM(null,e,t),e}updateListItemDOM(t,r,i){const s=this.getParent();ot$2(s)&&"check"===s.getListType()&&function(t,e,n,r){ot$2(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"));}(r,this,t),r.value=this.__value,function(t,r,i){const s=[],o=[],l=r.list,c=l?l.listitem:void 0;let a;l&&l.nested&&(a=l.nested.listitem);void 0!==c&&s.push(...X$1(c));if(l){const t=i.getParent(),e=ot$2(t)&&"check"===t.getListType(),n=i.getChecked();e&&!n||o.push(l.listitemUnchecked),e&&n||o.push(l.listitemChecked),e&&s.push(n?l.listitemChecked:l.listitemUnchecked);}if(void 0!==a){const t=X$1(a);i.getChildren().some((t=>ot$2(t)))?s.push(...t):o.push(...t);}o.length>0&&it$3(t,...o);s.length>0&&rt$2(t,...s);}(r,i.theme,this);const o=t?t.__style:"",l=this.__style;o!==l&&(""===l?r.removeAttribute("style"):r.style.cssText=l),function(t,e,n){const r=B$1(e.__textStyle);for(const e in r)t.style.setProperty(`--listitem-marker-${e}`,r[e]);if(n)for(const e in B$1(n.__textStyle))e in r||t.style.removeProperty(`--listitem-marker-${e}`);}(r,this,t);}updateDOM(t,e,n){const r=e;return this.updateListItemDOM(t,r,n),false}static transform(){return t=>{if(Z$2(t)||w$1(144),null==t.__checked)return;const e=t.getParent();ot$2(e)&&"check"!==e.getListType()&&null!=t.getChecked()&&t.setChecked(void 0);}}static importDOM(){return {li:()=>({conversion:G$1,priority:0})}}static importJSON(t){return Y$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const e=this.createDOM(t._config),n=this.getFormatType();n&&(e.style.textAlign=n);const r=this.getDirection();return r&&(e.dir=r),{element:e}}exportJSON(){return {...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let e=0;e{t.append(e);}))),this.remove(),0===n.getChildrenSize()&&n.remove(),t}insertAfter(t,e=true){const n=this.getParentOrThrow();if(ot$2(n)||w$1(39),Z$2(t))return super.insertAfter(t,e);const r=this.getNextSiblings();if(n.insertAfter(t,e),0!==r.length){const i=st$2(n.getListType());r.forEach((t=>i.append(t))),t.insertAfter(i,e);}return t}remove(t){const e=this.getPreviousSibling(),n=this.getNextSibling();super.remove(t),e&&n&&R$2(e)&&R$2(n)&&(V$1(e.getFirstChild(),n.getFirstChild()),n.remove());}insertNewAfter(t,e=true){const n=Y$2().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,e),n}collapseAtStart(t){const e=Pi();this.getChildren().forEach((t=>e.append(t)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=Z$2(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else {n.insertBefore(e),n.remove();const r=t.anchor,i=t.focus,s=e.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,i.offset,"element");}else n.insertBefore(e),this.remove();return true}getValue(){return this.getLatest().__value}setValue(t){const e=this.getWritable();return e.__value=t,e}getChecked(){const t=this.getLatest();let e;const n=this.getParent();return ot$2(n)&&(e=n.getListType()),"check"===e?Boolean(t.__checked):void 0}setChecked(t){const e=this.getWritable();return e.__checked=t,e}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(null===t||!this.isAttached())return this.getLatest().__indent;let e=t.getParentOrThrow(),n=0;for(;Z$2(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){"number"!=typeof t&&w$1(117),(t=Math.floor(t))>=0||w$1(199);let e=this.getIndent();for(;e!==t;)e{ot$2(t)||w$1(163),function(t){const e=t.getNextSibling();ot$2(e)&&t.getListType()===e.getListType()&&V$1(t,e);}(t),function(t){const e="check"!==t.getListType();let n=t.getStart();for(const r of t.getChildren())Z$2(r)&&(r.getValue()!==n&&r.setValue(n),e&&null!=r.getLatest().__checked&&r.setChecked(void 0),ot$2(r.getFirstChild())||n++);}(t);}}static importDOM(){return {ol:()=>({conversion:rt$1,priority:0}),ul:()=>({conversion:rt$1,priority:0})}}static importJSON(t){return st$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const e=this.createDOM(t._config,t);return fo(e)&&(1!==this.__start&&e.setAttribute("start",String(this.__start)),"check"===this.__listType&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return {...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return false}canIndent(){return false}splice(t,e,n){let r=n;for(let t=0;t1?s.push(...t):o.push(...t);}}o.length>0&&it$3(t,...o),s.length>0&&rt$2(t,...s);}function nt$1(t){const e=[];for(let n=0;n1&&t.forEach((t=>{ot$2(t)&&e.push(J$2(t));}));}else e.push(J$2(r));}return e}function rt$1(t){const e=t.nodeName.toLowerCase();let n=null;if("ol"===e){n=st$2("number",t.start);}else "ul"===e&&(n=function(t){if("check"===t.getAttribute("__lexicallisttype")||t.classList.contains("contains-task-list"))return true;for(const e of t.childNodes)if(fo(e)&&e.hasAttribute("aria-checked"))return true;return false}(t)?st$2("check"):st$2("bullet"));return {after:nt$1,node:n}}const it$2={ol:"number",ul:"bullet"};function st$2(t="number",e=1){return no(new tt$1(t,e))}function ot$2(t){return t instanceof tt$1}const ft$2=oe("INSERT_UNORDERED_LIST_COMMAND"),pt$3=oe("INSERT_ORDERED_LIST_COMMAND"),mt$3=oe("REMOVE_LIST_COMMAND");function _t$3(t){return j$2(t.registerCommand(pt$3,(()=>(W$1("number"),true)),Ii),t.registerCommand(ft$2,(()=>(W$1("bullet"),true)),Ii),t.registerCommand(mt$3,(()=>(z$2(),true)),Ii),t.registerCommand(de,(()=>H()),Ii),t.registerNodeTransform(j$1,(t=>{const e=t.getFirstChild();if(e){if(Qn(e)){const n=e.getStyle(),r=e.getFormat();t.getTextStyle()!==n&&t.setTextStyle(n),t.getTextFormat()!==r&&t.setTextFormat(r);}}else {const e=Nr();cr(e)&&(e.style!==t.getTextStyle()||e.format!==t.getTextFormat())&&e.isCollapsed()&&t.is(e.anchor.getNode())&&t.setTextStyle(e.style).setTextFormat(e.format);}})),t.registerNodeTransform(Jn,(t=>{const e=t.getParent();if(Z$2(e)&&t.is(e.getFirstChild())){const n=t.getStyle(),r=t.getFormat();n===e.getTextStyle()&&r===e.getTextFormat()||e.setTextStyle(n).setTextFormat(r);}})))} /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -1474,7 +1431,7 @@ function K$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URL * */ -function m$1(e,n){const t=ao(n)?n.body.childNodes:n.childNodes;let l=[];const r=[];for(const n of t)if(!w$3.has(n.nodeName)){const t=y$2(n,e,r,false);null!==t&&(l=l.concat(t));}return function(e){for(const n of e)n.getNextSibling()instanceof Pi&&n.insertAfter(Jn());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove();}}(r),l}function g(e,n){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),o=No().getChildren();for(let l=0;l{const e=new Pi;return o.push(e),e}:Li)),null==m?v.length>0?c=c.concat(v):Ts(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return ks(e.nextSibling)&&ks(e.previousSibling)}(e)&&(c=c.concat(Jn())):Si(m)&&m.append(...v),c}function C$2(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e{const e=new Ai;return o.push(e),e}:Pi)),null==m?v.length>0?h=h.concat(v):po(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return _o(e.nextSibling)&&_o(e.previousSibling)}(e)&&(h=h.concat(Pn())):di(m)&&m.append(...v),h}function w(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;et}).createHTML(t)}return t}(c),"text/html");return A$1(o,m$1(o,t),n)}catch(t){console.error(t);}const u=a||t.getData("text/uri-list");if(null!=u)if(yr(n)){const t=u.split(/(\r?\n|\t)/);""===t[t.length-1]&&t.pop();for(let e=0;e{t.update(()=>{o(M$3(t,e,n));});});const o=t.getRootElement(),i=t._window||window,l=i.document,s=ps(i);if(null===o||null===s)return false;const c=l.createElement("span");c.style.cssText="position: fixed; top: -1000px;",c.append(l.createTextNode("#")),o.append(c);const a=new Range;return a.setStart(c,0),a.setEnd(c,1),s.removeAllRanges(),s.addRange(a),new Promise((e,o)=>{const s=t.registerCommand(Re$1,o=>(Lt$3(o,ClipboardEvent)&&(s(),null!==b$2&&(i.clearTimeout(b$2),b$2=null),e(M$3(t,o,n))),true),Wi);b$2=i.setTimeout(()=>{s(),b$2=null,e(false);},50),l.execCommand("copy"),c.remove();})}function M$3(t,e,n){if(void 0===n){const e=ps(t._window),o=Lr();if(!o||o.isCollapsed())return false;if(!e)return false;const r=e.anchorNode,l=e.focusNode;if(null!==r&&null!==l&&!eo(t,r,l))return false;n=_$1(o);}e.preventDefault();const o=e.clipboardData;return null!==o&&(J$2(o,n),true)}const O=[["text/html",D$2],["application/x-lexical-editor",S$1]];function _$1(t=Lr()){const e={"text/plain":t?t.getTextContent():""};if(t){const n=bs();for(const[o,r]of O){const i=r(n,t);null!==i&&(e[o]=i);}}return e}function J$2(t,e){for(const[n]of O) void 0===e[n]&&t.setData(n,"");for(const n in e){const o=e[n];void 0!==o&&t.setData(n,o);}} +function y$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function T(e,n=Nr()){return null==n&&y$1(166),cr(n)&&n.isCollapsed()||0===n.getNodes().length?"":m$2(e,n)}function v$2(t,e=Nr()){return null==e&&y$1(166),cr(e)&&e.isCollapsed()||0===e.getNodes().length?null:JSON.stringify(R$1(t,e))}function D$1(t,n,o){const r=t.getData("application/x-lexical-editor");if(r)try{const t=JSON.parse(r);if(t.namespace===o._config.namespace&&Array.isArray(t.nodes)){return N$1(o,A$1(t.nodes),n)}}catch(t){}const c=t.getData("text/html"),a=t.getData("text/plain");if(c&&a!==c)try{const t=(new DOMParser).parseFromString(function(t){if(window.trustedTypes&&window.trustedTypes.createPolicy){return window.trustedTypes.createPolicy("lexical",{createHTML:t=>t}).createHTML(t)}return t}(c),"text/html");return N$1(o,h$2(o,t),n)}catch(t){}const u=a||t.getData("text/uri-list");if(null!=u)if(cr(n)){const t=u.split(/(\r?\n|\t)/);""===t[t.length-1]&&t.pop();for(let e=0;e0?a.text=t:i=false;}for(let o=0;o{t.update((()=>{o(E$2(t,e,n));}));}));const o=t.getRootElement(),i=t._window||window,l=window.document,s=lo(i);if(null===o||null===s)return false;const c=l.createElement("span");c.style.cssText="position: fixed; top: -1000px;",c.append(l.createTextNode("#")),o.append(c);const a=new Range;return a.setStart(c,0),a.setEnd(c,1),s.removeAllRanges(),s.addRange(a),new Promise(((e,o)=>{const i=t.registerCommand(Je,(o=>(Lt$1(o,ClipboardEvent)&&(i(),null!==P&&(window.clearTimeout(P),P=null),e(E$2(t,o,n))),true)),Bi);P=window.setTimeout((()=>{i(),P=null,e(false);}),50),l.execCommand("copy"),c.remove();}))}function E$2(t,e,n){if(void 0===n){const e=lo(t._window);if(!e)return false;const o=e.anchorNode,r=e.focusNode;if(null!==o&&null!==r&&!Hi(t,o,r))return false;const i=Nr();if(null===i)return false;n=M$3(i);}e.preventDefault();const o=e.clipboardData;return null!==o&&(O$1(o,n),true)}const L$1=[["text/html",T],["application/x-lexical-editor",v$2]];function M$3(t=Nr()){const e={"text/plain":t?t.getTextContent():""};if(t){const n=xo();for(const[o,r]of L$1){const i=r(n,t);null!==i&&(e[o]=i);}}return e}function O$1(t,e){for(const n in e){const o=e[n];void 0!==o&&t.setData(n,o);}} /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -1494,7 +1451,7 @@ function v$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URL * */ -function gt$1(t,e){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(t,e);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(t,e);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const pt$1="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ht$2=pt$1&&"documentMode"in document?document.documentMode:null,vt$1=pt$1&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ct$2=!(!pt$1||!("InputEvent"in window)||ht$2)&&"getTargetRanges"in new window.InputEvent("input"),yt$1=pt$1&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xt$1=pt$1&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Dt$1=pt$1&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nt$2=pt$1&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&vt$1&&!Dt$1,wt$2=re$1("DRAG_DROP_PASTE_FILE");let Et$2 = class Et extends Ci{static getType(){return "quote"}static clone(t){return new Et(t.__key)}createDOM(t){const e=document.createElement("blockquote");return lt$3(e,t.theme.quote),e}updateDOM(t,e){return false}static importDOM(){return {blockquote:t=>({conversion:Ft$1,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return _t$1().updateFromJSON(t)}insertNewAfter(t,e){const n=Li(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,e),n}collapseAtStart(){const t=Li();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}canMergeWhenEmpty(){return true}};function _t$1(){return fs(new Et$2)}function Ot$1(t){return t instanceof Et$2}let Pt$2 = class Pt extends Ci{__tag;static getType(){return "heading"}static clone(t){return new Pt(t.__tag,t.__key)}constructor(t,e){super(e),this.__tag=t;}getTag(){return this.__tag}setTag(t){const e=this.getWritable();return this.__tag=t,e}createDOM(t){const e=this.__tag,n=document.createElement(e),r=t.theme.heading;if(void 0!==r){const t=r[e];lt$3(n,t);}return n}updateDOM(t,e,n){return t.__tag!==this.__tag}static importDOM(){return {h1:t=>({conversion:At$2,priority:0}),h2:t=>({conversion:At$2,priority:0}),h3:t=>({conversion:At$2,priority:0}),h4:t=>({conversion:At$2,priority:0}),h5:t=>({conversion:At$2,priority:0}),h6:t=>({conversion:At$2,priority:0}),p:t=>{const e=t.firstChild;return null!==e&&Tt$2(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Tt$2(t)?{conversion:t=>({node:St$2("h1")}),priority:3}:null}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return St$2(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return {...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=true){const n=t?t.anchor.offset:0,r=this.getLastDescendant(),o=!r||t&&t.anchor.key===r.getKey()&&n===r.getTextContentSize()||!t?Li():St$2(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,e),0===n&&!this.isEmpty()&&t){const t=Li();t.select(),this.replace(t,true);}return o}collapseAtStart(){const t=this.isEmpty()?Li():St$2(this.getTag());return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}extractWithChild(){return true}};function Tt$2(t){return "span"===t.nodeName.toLowerCase()&&"26pt"===t.style.fontSize}function At$2(t){const e=t.nodeName.toLowerCase();let n=null;return "h1"!==e&&"h2"!==e&&"h3"!==e&&"h4"!==e&&"h5"!==e&&"h6"!==e||(n=St$2(e),null!==t.style&&(Ps(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Ft$1(t){const e=_t$1();return null!==t.style&&(e.setFormat(t.style.textAlign),Ps(t,e)),{node:e}}function St$2(t="h1"){return fs(new Pt$2(t))}function It$1(t){return t instanceof Pt$2}function Mt$1(t){let e=null;if(Lt$3(t,DragEvent)?e=t.dataTransfer:Lt$3(t,ClipboardEvent)&&(e=t.clipboardData),null===e)return [false,[],false];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return [r,Array.from(e.files),o]}function bt$2(t){const e=Lr();if(!yr(e))return false;const n=new Set,r=e.getNodes();for(let e=0;eSi(t)&&!t.isInline());if(null===s)continue;const c=s.getKey();s.canIndent()&&!n.has(c)&&(n.add(c),t(s));}return n.size>0}function Kt(t){const e=vo(t);return Ti(e)}function kt$2(t){for(const e of ["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e);}function Jt(n){return U$4(n.registerCommand(se$1,t=>{const e=Lr();return !!xr(e)&&(e.clear(),true)},Ki),n.registerCommand(le$2,t=>{const e=Lr();return yr(e)?(e.deleteCharacter(t),true):!!xr(e)&&(e.deleteNodes(),true)},Ki),n.registerCommand(he$1,t=>{const e=Lr();return !!yr(e)&&(e.deleteWord(t),true)},Ki),n.registerCommand(ge$1,t=>{const e=Lr();return !!yr(e)&&(e.deleteLine(t),true)},Ki),n.registerCommand(ue$1,e=>{const r=Lr();if("string"==typeof e)null!==r&&r.insertText(e);else {if(null===r)return false;const o=e.dataTransfer;if(null!=o)R$2(o,r,n);else if(yr(r)){const t=e.data;return t&&r.insertText(t),true}}return true},Ki),n.registerCommand(de$1,()=>{const t=Lr();return !!yr(t)&&(t.removeText(),true)},Ki),n.registerCommand(_e$1,t=>{const e=Lr();return !!yr(e)&&(e.formatText(t),true)},Ki),n.registerCommand(Le$1,t=>{const e=Lr();if(!yr(e)&&!xr(e))return false;const n=e.getNodes();for(const e of n){const n=zs(e,t=>Si(t)&&!t.isInline());null!==n&&n.setFormat(t);}return true},Ki),n.registerCommand(ce$1,t=>{const e=Lr();return !!yr(e)&&(e.insertLineBreak(t),true)},Ki),n.registerCommand(ae$1,()=>{const t=Lr();return !!yr(t)&&(t.insertParagraph(),true)},Ki),n.registerCommand(Ae$1,()=>(jr([ur()]),true),Ki),n.registerCommand(Pe$1,()=>bt$2(t=>{const e=t.getIndent();t.setIndent(e+1);}),Ki),n.registerCommand(De$1,()=>bt$2(t=>{const e=t.getIndent();e>0&&t.setIndent(Math.max(0,e-1));}),Ki),n.registerCommand(ke$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectPrevious(),true}else if(yr(e)){const n=qo(e.focus,true);if(!t.shiftKey&&Ti(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),t.preventDefault(),true}return false},Ki),n.registerCommand(Te$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectNext(0,0),true}else if(yr(e)){if(function(t){const e=t.focus;return "root"===e.key&&e.offset===No().getChildrenSize()}(e))return t.preventDefault(),true;const n=qo(e.focus,false);if(!t.shiftKey&&Ti(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),true}return false},Ki),n.registerCommand(Se$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$2(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),true}if(!yr(e))return false;if(Z$3(e,true)){const n=t.shiftKey;return t.preventDefault(),ne(e,n,true),true}return false},Ki),n.registerCommand(xe,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$2(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),true}if(!yr(e))return false;const n=t.shiftKey;return !!Z$3(e,false)&&(t.preventDefault(),ne(e,n,false),true)},Ki),n.registerCommand(we$1,t=>{if(Kt(t.target))return false;const e=Lr();if(yr(e)){if(function(t){if(!t.isCollapsed())return false;const{anchor:e}=t;if(0!==e.offset)return false;const n=e.getNode();if(bi(n))return false;const r=xt$4(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(e))return t.preventDefault(),n.dispatchCommand(De$1,void 0);if(xt$1&&"ko-KR"===navigator.language)return false}else if(!xr(e))return false;return t.preventDefault(),n.dispatchCommand(le$2,true)},Ki),n.registerCommand(Oe$1,t=>{if(Kt(t.target))return false;const e=Lr();return !(!yr(e)&&!xr(e))&&(t.preventDefault(),n.dispatchCommand(le$2,false))},Ki),n.registerCommand(Ne$1,t=>{const e=Lr();if(!yr(e))return false;if(kt$2(e),null!==t){if((xt$1||yt$1||Nt$2)&&Ct$2)return false;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(ce$1,false)}return n.dispatchCommand(ae$1,void 0)},Ki),n.registerCommand(Ee$1,()=>{const t=Lr();return !!yr(t)&&(n.blur(),true)},Ki),n.registerCommand(Fe$1,t=>{const[,e]=Mt$1(t);if(e.length>0){const r=gt$1(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=vo(o);if(null!==i){const e=Ar();if(lr(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else {const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element");}const n=St$5(e);wo(n);}n.dispatchCommand(wt$2,e);}return t.preventDefault(),true}const r=Lr();return !!yr(r)},Ki),n.registerCommand(Ie$1,t=>{const[e]=Mt$1(t),n=Lr();return !(e&&!yr(n))},Ki),n.registerCommand(Ke$1,t=>{const[e]=Mt$1(t),n=Lr();if(e&&!yr(n))return false;const r=gt$1(t.clientX,t.clientY);if(null!==r){const e=vo(r.node);Ti(e)&&t.preventDefault();}return true},Ki),n.registerCommand(We$1,()=>(jo(),true),Ki),n.registerCommand(Re$1,t=>(F$1(n,Lt$3(t,ClipboardEvent)?t:null),true),Ki),n.registerCommand(Be$1,t=>(async function(t,n){await F$1(n,Lt$3(t,ClipboardEvent)?t:null),n.update(()=>{const t=Lr();yr(t)?t.removeText():xr(t)&&t.getNodes().forEach(t=>t.remove());});}(t,n),true),Ki),n.registerCommand(fe$1,e=>{const[,r,o]=Mt$1(e);if(r.length>0&&!o)return n.dispatchCommand(wt$2,r),true;if(Ss(e.target)&&to(e.target))return false;return null!==Lr()&&(function(e,n){e.preventDefault(),n.update(()=>{const r=Lr(),o=Lt$3(e,InputEvent)||Lt$3(e,KeyboardEvent)?null:e.clipboardData;null!=o&&null!==r&&R$2(o,r,n);},{tag:Fn});}(e,n),true)},Ki),n.registerCommand(be$1,t=>{const e=Lr();return yr(e)&&kt$2(e),false},Ki),n.registerCommand(Me$1,t=>{const e=Lr();return yr(e)&&kt$2(e),false},Ki))} +function dt$2(t,e){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(t,e);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(t,e);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const mt$2="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ft$1=mt$2&&"documentMode"in document?document.documentMode:null,gt$2=!(!mt$2||!("InputEvent"in window)||ft$1)&&"getTargetRanges"in new window.InputEvent("input"),pt$2=mt$2&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ht$2=mt$2&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ct$1=mt$2&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vt$2=mt$2&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ct$1,yt$2=oe("DRAG_DROP_PASTE_FILE");class Dt extends fi{static getType(){return "quote"}static clone(t){return new Dt(t.__key)}createDOM(t){const e=document.createElement("blockquote");return rt$2(e,t.theme.quote),e}updateDOM(t,e){return false}static importDOM(){return {blockquote:t=>({conversion:Tt$2,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return xt$2().updateFromJSON(t)}insertNewAfter(t,e){const n=Pi(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,e),n}collapseAtStart(){const t=Pi();return this.getChildren().forEach((e=>t.append(e))),this.replace(t),true}canMergeWhenEmpty(){return true}}function xt$2(){return no(new Dt)}function wt$1(t){return t instanceof Dt}let Nt$2 = class Nt extends fi{static getType(){return "heading"}static clone(t){return new Nt(t.__tag,t.__key)}constructor(t,e){super(e),this.__tag=t;}getTag(){return this.__tag}setTag(t){const e=this.getWritable();return this.__tag=t,e}createDOM(t){const e=this.__tag,n=document.createElement(e),r=t.theme.heading;if(void 0!==r){const t=r[e];rt$2(n,t);}return n}updateDOM(t,e,n){return t.__tag!==this.__tag}static importDOM(){return {h1:t=>({conversion:Ot,priority:0}),h2:t=>({conversion:Ot,priority:0}),h3:t=>({conversion:Ot,priority:0}),h4:t=>({conversion:Ot,priority:0}),h5:t=>({conversion:Ot,priority:0}),h6:t=>({conversion:Ot,priority:0}),p:t=>{const e=t.firstChild;return null!==e&&Et$1(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Et$1(t)?{conversion:t=>({node:_t$2("h1")}),priority:3}:null}}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return _t$2(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return {...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=true){const n=t?t.anchor.offset:0,r=this.getLastDescendant(),o=!r||t&&t.anchor.key===r.getKey()&&n===r.getTextContentSize()||!t?Pi():_t$2(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,e),0===n&&!this.isEmpty()&&t){const t=Pi();t.select(),this.replace(t,true);}return o}collapseAtStart(){const t=this.isEmpty()?Pi():_t$2(this.getTag());return this.getChildren().forEach((e=>t.append(e))),this.replace(t),true}extractWithChild(){return true}};function Et$1(t){return "span"===t.nodeName.toLowerCase()&&"26pt"===t.style.fontSize}function Ot(t){const e=t.nodeName.toLowerCase();let n=null;return "h1"!==e&&"h2"!==e&&"h3"!==e&&"h4"!==e&&"h5"!==e&&"h6"!==e||(n=_t$2(e),null!==t.style&&(To(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Tt$2(t){const e=xt$2();return null!==t.style&&(e.setFormat(t.style.textAlign),To(t,e)),{node:e}}function _t$2(t="h1"){return no(new Nt$2(t))}function At(t){return t instanceof Nt$2}function Ft$1(t){let e=null;if(Lt$1(t,DragEvent)?e=t.dataTransfer:Lt$1(t,ClipboardEvent)&&(e=t.clipboardData),null===e)return [false,[],false];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return [r,Array.from(e.files),o]}function St$2(t){const e=Nr();if(!cr(e))return false;const n=new Set,r=e.getNodes();for(let e=0;edi(t)&&!t.isInline()));if(null===s)continue;const a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),t(s));}return n.size>0}function It$1(t){const e=hs(t);return _i(e)}function Pt$1(t){for(const e of ["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e);}function Mt(o){return j$2(o.registerCommand(ae,(t=>{const e=Nr();return !!ur(e)&&(e.clear(),true)}),Li),o.registerCommand(ue,(t=>{const e=Nr();return cr(e)?(e.deleteCharacter(t),true):!!ur(e)&&(e.deleteNodes(),true)}),Li),o.registerCommand(pe,(t=>{const e=Nr();return !!cr(e)&&(e.deleteWord(t),true)}),Li),o.registerCommand(ye,(t=>{const e=Nr();return !!cr(e)&&(e.deleteLine(t),true)}),Li),o.registerCommand(he,(e=>{const n=Nr();if("string"==typeof e)null!==n&&n.insertText(e);else {if(null===n)return false;const r=e.dataTransfer;if(null!=r)D$1(r,n,o);else if(cr(n)){const t=e.data;return t&&n.insertText(t),true}}return true}),Li),o.registerCommand(_e,(()=>{const t=Nr();return !!cr(t)&&(t.removeText(),true)}),Li),o.registerCommand(me,(t=>{const e=Nr();return !!cr(e)&&(e.formatText(t),true)}),Li),o.registerCommand(Ke,(t=>{const e=Nr();if(!cr(e)&&!ur(e))return false;const n=e.getNodes();for(const e of n){const n=wt$2(e,(t=>di(t)&&!t.isInline()));null!==n&&n.setFormat(t);}return true}),Li),o.registerCommand(fe,(t=>{const e=Nr();return !!cr(e)&&(e.insertLineBreak(t),true)}),Li),o.registerCommand(de,(()=>{const t=Nr();return !!cr(t)&&(t.insertParagraph(),true)}),Li),o.registerCommand(Fe,(()=>(Fr([er()]),true)),Li),o.registerCommand(Le,(()=>St$2((t=>{const e=t.getIndent();t.setIndent(e+1);}))),Li),o.registerCommand(Ie,(()=>St$2((t=>{const e=t.getIndent();e>0&&t.setIndent(Math.max(0,e-1));}))),Li),o.registerCommand(Ne,(t=>{const e=Nr();if(ur(e)){const t=e.getNodes();if(t.length>0)return t[0].selectPrevious(),true}else if(cr(e)){const n=Bs(e.focus,true);if(!t.shiftKey&&_i(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),t.preventDefault(),true}return false}),Li),o.registerCommand(we,(t=>{const e=Nr();if(ur(e)){const t=e.getNodes();if(t.length>0)return t[0].selectNext(0,0),true}else if(cr(e)){if(function(t){const e=t.focus;return "root"===e.key&&e.offset===ps().getChildrenSize()}(e))return t.preventDefault(),true;const n=Bs(e.focus,false);if(!t.shiftKey&&_i(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),true}return false}),Li),o.registerCommand(Te,(t=>{const e=Nr();if(ur(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectPrevious(),true}if(!cr(e))return false;if(X$2(e,true)){const n=t.shiftKey;return t.preventDefault(),J$3(e,n,true),true}return false}),Li),o.registerCommand(ve,(t=>{const e=Nr();if(ur(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectNext(0,0),true}if(!cr(e))return false;const o=t.shiftKey;return !!X$2(e,false)&&(t.preventDefault(),J$3(e,o,false),true)}),Li),o.registerCommand(Ae,(t=>{if(It$1(t.target))return false;const e=Nr();if(cr(e)){if(function(t){if(!t.isCollapsed())return false;const{anchor:e}=t;if(0!==e.offset)return false;const n=e.getNode();if(yi(n))return false;const r=yt$3(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(e))return t.preventDefault(),o.dispatchCommand(Ie,void 0);if(ht$2&&"ko-KR"===navigator.language)return false}else if(!ur(e))return false;return t.preventDefault(),o.dispatchCommand(ue,true)}),Li),o.registerCommand(De,(t=>{if(It$1(t.target))return false;const e=Nr();return !(!cr(e)&&!ur(e))&&(t.preventDefault(),o.dispatchCommand(ue,false))}),Li),o.registerCommand(Ee,(t=>{const e=Nr();if(!cr(e))return false;if(Pt$1(e),null!==t){if((ht$2||pt$2||vt$2)&>$2)return false;if(t.preventDefault(),t.shiftKey)return o.dispatchCommand(fe,false)}return o.dispatchCommand(de,void 0)}),Li),o.registerCommand(Oe,(()=>{const t=Nr();return !!cr(t)&&(o.blur(),true)}),Li),o.registerCommand(ze,(t=>{const[,e]=Ft$1(t);if(e.length>0){const n=dt$2(t.clientX,t.clientY);if(null!==n){const{offset:t,node:r}=n,i=hs(r);if(null!==i){const e=vr();if(Qn(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else {const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element");}const n=vt$4(e);ms(n);}o.dispatchCommand(yt$2,e);}return t.preventDefault(),true}const n=Nr();return !!cr(n)}),Li),o.registerCommand(Be,(t=>{const[e]=Ft$1(t),n=Nr();return !(e&&!cr(n))}),Li),o.registerCommand(Re,(t=>{const[e]=Ft$1(t),n=Nr();if(e&&!cr(n))return false;const r=dt$2(t.clientX,t.clientY);if(null!==r){const e=hs(r.node);_i(e)&&t.preventDefault();}return true}),Li),o.registerCommand($e,(()=>(Fs(),true)),Li),o.registerCommand(Je,(t=>(_$1(o,Lt$1(t,ClipboardEvent)?t:null),true)),Li),o.registerCommand(Ue,(t=>(async function(t,n){await _$1(n,Lt$1(t,ClipboardEvent)?t:null),n.update((()=>{const t=Nr();cr(t)?t.removeText():ur(t)&&t.getNodes().forEach((t=>t.remove()));}));}(t,o),true)),Li),o.registerCommand(ge,(e=>{const[,n,r]=Ft$1(e);if(n.length>0&&!r)return o.dispatchCommand(yt$2,n),true;if(ho(e.target)&&Yi(e.target))return false;return null!==Nr()&&(function(e,n){e.preventDefault(),n.update((()=>{const r=Nr(),o=Lt$1(e,InputEvent)||Lt$1(e,KeyboardEvent)?null:e.clipboardData;null!=o&&null!==r&&D$1(o,r,n);}),{tag:bi});}(e,o),true)}),Li),o.registerCommand(Me,(t=>{const e=Nr();return cr(e)&&Pt$1(e),false}),Li),o.registerCommand(Pe,(t=>{const e=Nr();return cr(e)&&Pt$1(e),false}),Li))} /* ********************************************** Begin prism-core.js @@ -5139,7 +5096,7 @@ Prism.languages.swift['string-literal'].forEach(function (rule) { * */ -function I$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M$2="javascript";function R$1(e,n){for(const r of e.childNodes){if(Cs(r)&&r.tagName===n)return true;R$1(r,n);}return false}const K$2="data-language",$$1="data-highlight-language",W$3="data-theme";let q$1 = class q extends Ci{__language;__theme;__isSyntaxHighlightSupported;static getType(){return "code"}static clone(t){return new q(t.__language,t.__key)}constructor(t,e){super(e),this.__language=t||void 0,this.__isSyntaxHighlightSupported=false,this.__theme=void 0;}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported;}createDOM(t){const n=document.createElement("code");lt$3(n,t.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(K$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute($$1,r));const i=this.getTheme();i&&n.setAttribute(W$3,i);const o=this.getStyle();return o&&n.setAttribute("style",o),n}updateDOM(t,e,n){const r=this.__language,i=t.__language;r?r!==i&&e.setAttribute(K$2,r):i&&e.removeAttribute(K$2);const o=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&e.setAttribute($$1,r):e.removeAttribute($$1):o&&r&&e.setAttribute($$1,r);const s=this.__theme,l=t.__theme;s?s!==l&&e.setAttribute(W$3,s):l&&e.removeAttribute(W$3);const u=this.__style,c=t.__style;return u?u!==c&&e.setAttribute("style",u):c&&e.removeAttribute("style"),false}exportDOM(t){const n=document.createElement("pre");lt$3(n,t._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(K$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute($$1,r));const i=this.getTheme();i&&n.setAttribute(W$3,i);const o=this.getStyle();return o&&n.setAttribute("style",o),{element:n}}static importDOM(){return {code:t=>null!=t.textContent&&(/\r?\n/.test(t.textContent)||R$1(t,"BR"))?{conversion:Q$1,priority:1}:null,div:()=>({conversion:G$1,priority:1}),pre:()=>({conversion:Q$1,priority:0}),table:t=>tt(t)?{conversion:V$2,priority:3}:null,td:t=>{const e=t,n=e.closest("table");return e.classList.contains("js-file-line")||n&&tt(n)?{conversion:Y,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&tt(e)?{conversion:Y,priority:3}:null}}}static importJSON(t){return U$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return {...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,e=true){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const t=Li();return this.insertAfter(t,e),t}const{anchor:i,focus:o}=t,a=(i.isBefore(o)?i:o).getNode();if(lr(a)){let t=st$1(a);const e=[];for(;;)if(fr(t))e.push(ur()),t=t.getNextSibling();else {if(!it$1(t))break;{let n=0;const r=t.getTextContent(),i=t.getTextContentSize();for(;nt.append(e)),this.replace(t),true}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const e=this.getWritable();return e.__isSyntaxHighlightSupported=t,e}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const e=this.getWritable();return e.__theme=t||void 0,e}getTheme(){return this.getLatest().__theme}};function U$2(t,e){return Ks(q$1).setLanguage(t).setTheme(e)}function X$1(t){return t instanceof q$1}function Q$1(t){return {node:U$2(t.getAttribute(K$2))}}function G$1(t){const e=t,n=Z(e);return n||function(t){let e=t.parentElement;for(;null!==e;){if(Z(e))return true;e=e.parentElement;}return false}(e)?{node:n?U$2():null}:{node:null}}function V$2(){return {node:U$2()}}function Y(){return {node:null}}function Z(t){return null!==t.style.fontFamily.match("monospace")}function tt(t){return t.classList.contains("js-file-line-container")}let et$1 = class et extends Xn{__highlightType;constructor(t="",e,n){super(t,n),this.__highlightType=e;}static getType(){return "code-highlight"}static clone(t){return new et(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return false}createDOM(t){const n=super.createDOM(t),r=nt$1(t.theme,this.__highlightType);return lt$3(n,r),n}updateDOM(t,r,i){const o=super.updateDOM(t,r,i),s=nt$1(i.theme,t.__highlightType),l=nt$1(i.theme,this.__highlightType);return s!==l&&(s&&ut$2(r,s),l&<$3(r,l)),o}static importJSON(t){return rt().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return {...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return true}createParentElementNode(){return U$2()}};function nt$1(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function rt(t="",e){return fs(new et$1(t,e))}function it$1(t){return t instanceof et$1}function ot$1(t,e){let n=t;for(let i=tl(t,e);i&&(it$1(i.origin)||fr(i.origin));i=ft$1(i))n=i.origin;return n}function st$1(t){return ot$1(t,"previous")}function lt$1(t){return ot$1(t,"next")}function ut(t){const e=st$1(t),n=lt$1(t);let r=e;for(;null!==r;){if(it$1(r)){const t=oo(r.getTextContent());if(null!==t)return t}if(r===n)break;r=r.getNextSibling();}const i=e.getParent();if(Si(i)){const t=i.getDirection();if("ltr"===t||"rtl"===t)return t}return null}function ct$1(t,e){let n=null,r=null,i=t,o=e,s=t.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(it$1(i)||fr(i)||jn(i)||I$2(167),jn(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent();}else o--;const t=s[o];it$1(i)&&" "!==t&&(r={node:i,offset:o});}if(null!==r)return r;let l=null;if(e",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var r=e[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:true},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}};}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e});}(Prism);const ft=globalThis.Prism||window.Prism,pt={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"},ht$1={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function dt(t){return ht$1[t]||t}function St$1(t){return "string"==typeof t?t:Array.isArray(t)?t.map(St$1).join(""):St$1(t.content)}function vt(t,e){const n=/^diff-([\w-]+)/i.exec(e),r=t.getTextContent();let i=ft.tokenize(r,ft.languages[n?"diff":e]);return n&&(i=function(t,e){const n=e,r=ft.languages[n],i={tokens:t},o=ft.languages.diff.PREFIXES;for(const t of i.tokens){if("string"==typeof t||!(t.type in o)||!Array.isArray(t.content))continue;const e=t.type;let n=0;const i=()=>(n++,new ft.Token("prefix",o[e],e.replace(/^(\w+).*/,"$1"))),s=t.content.filter(t=>"string"==typeof t||"prefix"!==t.type),l=t.content.length-s.length,u=ft.tokenize(St$1(s),r);u.unshift(i());const c=/\r\n|\n/g,g=t=>{const e=[];c.lastIndex=0;let r,o=0;for(;n{for(let e=0;e0&&n.push(rt(i,e));}}else {const{content:t,alias:e}=r;"string"==typeof t?n.push(...Tt$1([t],"prefix"===r.type&&"string"==typeof e?e:r.type)):Array.isArray(t)&&n.push(...Tt$1(t,"unchanged"===r.type?void 0:r.type));}return n}const bt$1={$tokenize(t,e){return vt(t,e||this.defaultLanguage)},defaultLanguage:M$2,tokenize(t,e){return ft.tokenize(t,ft.languages[e||""]||ft.languages[this.defaultLanguage])}};function Ct$1(t,e,n){const r=t.getParent();X$1(r)?wt$1(r,e,n):it$1(t)&&t.replace(sr(t.__text));}function Nt$1(t,e){const n=e.getElementByKey(t.getKey());if(null===n)return;const r=t.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let t=0;t{!function(t,e){const n=xo(t);if(!X$1(n)||!n.isAttached())return;const r=Lr();if(!yr(r))return void e();const i=r.anchor,o=i.offset,s="element"===i.type&&jn(n.getChildAtIndex(i.offset-1));let u=0;if(!s){const t=i.getNode();u=o+t.getPreviousSiblings().reduce((t,e)=>t+e.getTextContentSize(),0);}if(!e())return;if(s)return void i.getNode().select(o,o);n.getChildren().some(t=>{const e=lr(t);if(e||jn(t)){const n=t.getTextContentSize();if(e&&n>=u)return t.select(u,u),true;u-=n;}return false});}(r,()=>{const e=xo(r);if(!X$1(e)||!e.isAttached())return false;const i=e.getLanguage()||n.defaultLanguage,o=n.$tokenize(e,i),s=function(t,e){let n=0;for(;n{jt$1.delete(r);},skipTransforms:true}));}function kt$1(t,e){return it$1(t)&&it$1(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||fr(t)&&fr(e)||jn(t)&&jn(e)}function At$1(t){if(!yr(t))return false;const e=t.anchor.getNode(),n=X$1(e)?e:e.getParent(),r=t.focus.getNode(),i=X$1(r)?r:r.getParent();return X$1(n)&&n.is(i)}function Pt$1(t){const e=t.getNodes(),n=[];if(1===e.length&&X$1(e[0]))return n;let r=[];for(let t=0;t0&&(n.push(r),r=[]):r.push(i);}if(r.length>0){const e=t.isBackward()?t.anchor:t.focus,i=hr(r[0].getKey(),0,"text");e.is(i)||n.push(r);}return n}function Lt$1(t){const e=Lr();if(!yr(e)||!At$1(e))return false;const n=Pt$1(e),r=n.length;if(0===r&&e.isCollapsed())return t===Pe$1&&e.insertNodes([ur()]),true;if(0===r&&t===Pe$1&&"\n"===e.getTextContent()){const t=ur(),n=Jn(),r=e.isBackward()?"previous":"next";return e.insertNodes([t,n]),Sl(Al(dl(el(t,"next",0),El(tl(n,"next"))),r)),true}for(let i=0;i0){let n=r[0];if(0===i&&(n=st$1(n)),t===Pe$1){const t=ur();if(n.insertBefore(t),0===i){const r=e.isBackward()?"focus":"anchor",i=hr(n.getKey(),0,"text");e[r].is(i)&&e[r].set(t.getKey(),0,"text");}}else fr(n)&&n.remove();}}return true}function Ot(t,e){const n=Lr();if(!yr(n))return false;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),c=i.getNode(),g=t===ke$1;if(!At$1(n)||!it$1(l)&&!fr(l)||!it$1(c)&&!fr(c))return false;if(!e.altKey){if(n.isCollapsed()){const t=l.getParentOrThrow();if(g&&0===o&&null===l.getPreviousSibling()){if(null===t.getPreviousSibling())return t.selectPrevious(),e.preventDefault(),true}else if(!g&&o===l.getTextContentSize()&&null===l.getNextSibling()){if(null===t.getNextSibling())return t.selectNext(),e.preventDefault(),true}}return false}let a,f;if(l.isBefore(c)?(a=st$1(l),f=lt$1(c)):(a=st$1(c),f=lt$1(l)),null==a||null==f)return false;const p=a.getNodesBetween(f);for(let t=0;tt.remove()),t===ke$1?(p.forEach(t=>x.insertBefore(t)),x.insertBefore(h)):(x.insertAfter(h),x=h,p.forEach(t=>{x.insertAfter(t),x=t;})),n.setTextNodeRange(l,o,c,s),true}function Ht(t,e){const n=Lr();if(!yr(n))return false;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=t===ve$1;if(!At$1(n)||!it$1(o)&&!fr(o)||!it$1(s)&&!fr(s))return false;const c=s;if("rtl"===ut(c)?!l:l){const t=ct$1(c,i.offset);if(null!==t){const{node:e,offset:r}=t;jn(e)?e.selectNext(0,0):n.setTextNodeRange(e,r,e,r);}else c.getParentOrThrow().selectStart();}else {gt(c).select();}return e.preventDefault(),e.stopPropagation(),true}function Et$1(t,e){if(!t.hasNodes([q$1,et$1]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==e&&(e=bt$1);const n=[];return true!==t._headless&&n.push(t.registerMutationListener(q$1,e=>{t.getEditorState().read(()=>{for(const[n,r]of e)if("destroyed"!==r){const e=xo(n);null!==e&&Nt$1(e,t);}});},{skipInitialization:false})),n.push(t.registerNodeTransform(q$1,n=>wt$1(n,t,e)),t.registerNodeTransform(Xn,n=>Ct$1(n,t,e)),t.registerNodeTransform(et$1,n=>Ct$1(n,t,e)),t.registerCommand(Me$1,e=>{const n=function(t){const e=Lr();if(!yr(e)||!At$1(e))return null;const n=t?De$1:Pe$1,r=t?De$1:Ae$1,i=e.anchor,o=e.focus;if(i.is(o))return r;const s=Pt$1(e);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&I$2(285),e.isBackward()?(u=o,c=i):(u=i,c=o);const g=st$1(l[0]),a=lt$1(l[0]),f=hr(g.getKey(),0,"text"),p=hr(a.getKey(),a.getTextContentSize(),"text");return u.isBefore(f)||p.isBefore(c)?n:f.isBefore(u)||c.isBefore(p)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),true)},zi),t.registerCommand(Ae$1,()=>!!At$1(Lr())&&(jr([ur()]),true),zi),t.registerCommand(Pe$1,t=>Lt$1(Pe$1),zi),t.registerCommand(De$1,t=>Lt$1(De$1),zi),t.registerCommand(ke$1,t=>{const e=Lr();if(!yr(e))return false;const{anchor:n}=e,r=n.getNode();return !!At$1(e)&&(e.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&X$1(r.getParentOrThrow())?(t.preventDefault(),true):Ot(ke$1,t))},zi),t.registerCommand(Te$1,t=>{const e=Lr();if(!yr(e))return false;const{anchor:n}=e,r=n.getNode();return !!At$1(e)&&(e.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&X$1(r.getParentOrThrow())?(t.preventDefault(),true):Ot(Te$1,t))},zi),t.registerCommand(ve$1,t=>Ht(ve$1,t),zi),t.registerCommand(Ce$1,t=>Ht(Ce$1,t),zi)),U$4(...n)} +function D(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M$2=globalThis.Prism||window.Prism,z$1=t=>{try{return !!t&&M$2.languages.hasOwnProperty(t)}catch(t){return false}};function J$1(e,n){for(const r of e.childNodes){if(fo(r)&&r.tagName===n)return true;J$1(r,n);}return false}const E$1="data-language",F="data-highlight-language";class K extends fi{static getType(){return "code"}static clone(t){return new K(t.__language,t.__key)}constructor(t,e){super(e),this.__language=t||void 0,this.__isSyntaxHighlightSupported=z$1(t);}createDOM(t){const n=document.createElement("code");rt$2(n,t.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();return r&&(n.setAttribute(E$1,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(F,r)),n}updateDOM(t,e,n){const r=this.__language,o=t.__language;return r?r!==o&&(e.setAttribute(E$1,r),this.__isSyntaxHighlightSupported&&e.setAttribute(F,r)):o&&(e.removeAttribute(E$1),t.__isSyntaxHighlightSupported&&e.removeAttribute(F)),false}exportDOM(t){const n=document.createElement("pre");rt$2(n,t._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();return r&&(n.setAttribute(E$1,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(F,r)),{element:n}}static importDOM(){return {code:t=>null!=t.textContent&&(/\r?\n/.test(t.textContent)||J$1(t,"BR"))?{conversion:q,priority:1}:null,div:()=>({conversion:U$1,priority:1}),pre:()=>({conversion:q,priority:0}),table:t=>X(t)?{conversion:W,priority:3}:null,td:t=>{const e=t,n=e.closest("table");return e.classList.contains("js-file-line")||n&&X(n)?{conversion:$,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&X(e)?{conversion:$,priority:3}:null}}}static importJSON(t){return R().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language)}exportJSON(){return {...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(t,e=true){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const t=Pi();return this.insertAfter(t,e),t}const{anchor:o,focus:i}=t,g=(o.isBefore(i)?o:i).getNode();if(Qn(g)){let t=ut(g);const e=[];for(;;)if(nr(t))e.push(er()),t=t.getNextSibling();else {if(!st$1(t))break;{let n=0;const r=t.getTextContent(),o=t.getTextContentSize();for(;nt.append(e))),this.replace(t),true}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e.__isSyntaxHighlightSupported=z$1(t),e}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}}function R(t){return no(new K(t))}function I(t){return t instanceof K}function q(t){return {node:R(t.getAttribute(E$1))}}function U$1(t){const e=t,n=Q(e);return n||function(t){let e=t.parentElement;for(;null!==e;){if(Q(e))return true;e=e.parentElement;}return false}(e)?{node:n?R():null}:{node:null}}function W(){return {node:R()}}function $(){return {node:null}}function Q(t){return null!==t.style.fontFamily.match("monospace")}function X(t){return t.classList.contains("js-file-line-container")}const G="javascript",V={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"},Y$1={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Z$1(t){return Y$1[t]||t}class rt extends Jn{constructor(t="",e,n){super(t,n),this.__highlightType=e;}static getType(){return "code-highlight"}static clone(t){return new rt(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return false}createDOM(t){const n=super.createDOM(t),r=ot$1(t.theme,this.__highlightType);return rt$2(n,r),n}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=ot$1(o.theme,t.__highlightType),l=ot$1(o.theme,this.__highlightType);return s!==l&&(s&&it$3(r,s),l&&rt$2(r,l)),i}static importJSON(t){return it$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return {...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return true}createParentElementNode(){return R()}}function ot$1(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function it$1(t="",e){return no(new rt(t,e))}function st$1(t){return t instanceof rt}function lt$1(t,e){let n=t;for(let o=Jo(t,e);o&&(st$1(o.origin)||nr(o.origin));o=ct$2(o))n=o.origin;return n}function ut(t){return lt$1(t,"previous")}function ct$1(t){return lt$1(t,"next")}const at={defaultLanguage:G,tokenize(t,e){return M$2.tokenize(t,M$2.languages[e||""]||M$2.languages[this.defaultLanguage])}};function gt$1(t,e){let n=null,r=null,o=t,i=e,s=t.getTextContent();for(;;){if(0===i){if(o=o.getPreviousSibling(),null===o)break;if(st$1(o)||nr(o)||Fn(o)||D(167),Fn(o)){n={node:o,offset:1};break}i=Math.max(0,o.getTextContentSize()-1),s=o.getTextContent();}else i--;const t=s[i];st$1(o)&&" "!==t&&(r={node:o,offset:i});}if(null!==r)return r;let l=null;if(e{!function(t,e){const n=us(t);if(!I(n)||!n.isAttached())return;const r=Nr();if(!cr(r))return void e();const o=r.anchor,i=o.offset,s="element"===o.type&&Fn(n.getChildAtIndex(o.offset-1));let u=0;if(!s){const t=o.getNode();u=i+t.getPreviousSiblings().reduce(((t,e)=>t+e.getTextContentSize()),0);}if(!e())return;if(s)return void o.getNode().select(i,i);n.getChildren().some((t=>{const e=Qn(t);if(e||Fn(t)){const n=t.getTextContentSize();if(e&&n>=u)return t.select(u,u),true;u-=n;}return false}));}(r,(()=>{const e=us(r);if(!I(e)||!e.isAttached())return false;const o=e.getTextContent(),i=xt$1(n.tokenize(o,e.getLanguage()||n.defaultLanguage)),s=function(t,e){let n=0;for(;n{dt$1.delete(r);},skipTransforms:true}));}function xt$1(t,e){const n=[];for(const r of t)if("string"==typeof r){const t=r.split(/(\n|\t)/),o=t.length;for(let r=0;r0&&n.push(it$1(o,e));}}else {const{content:t}=r;"string"==typeof t?n.push(...xt$1([t],r.type)):Array.isArray(t)&&n.push(...xt$1(t,r.type));}return n}function yt$1(t,e){return st$1(t)&&st$1(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||nr(t)&&nr(e)||Fn(t)&&Fn(e)}function St$1(t){if(!cr(t))return false;const e=t.anchor.getNode(),n=I(e)?e:e.getParent(),r=t.focus.getNode(),o=I(r)?r:r.getParent();return I(n)&&n.is(o)}function _t$1(t){const e=t.getNodes(),n=[];if(1===e.length&&I(e[0]))return n;let r=[];for(let t=0;t0&&(n.push(r),r=[]):r.push(o);}if(r.length>0){const e=t.isBackward()?t.anchor:t.focus,o=ir(r[0].getKey(),0,"text");e.is(o)||n.push(r);}return n}function vt$1(t){const e=Nr();if(!cr(e)||!St$1(e))return false;const n=_t$1(e),r=n.length;if(0===r&&e.isCollapsed())return t===Le&&e.insertNodes([er()]),true;if(0===r&&t===Le&&"\n"===e.getTextContent()){const t=er(),n=Pn(),r=e.isBackward()?"previous":"next";return e.insertNodes([t,n]),al(xl(tl(Uo(t,"next",0),pl(Jo(n,"next"))),r)),true}for(let o=0;o0){let n=r[0];if(0===o&&(n=ut(n)),t===Le){const t=er();if(n.insertBefore(t),0===o){const r=e.isBackward()?"focus":"anchor",o=ir(n.getKey(),0,"text");e[r].is(o)&&e[r].set(t.getKey(),0,"text");}}else nr(n)&&n.remove();}}return true}function Tt$1(t,e){const n=Nr();if(!cr(n))return false;const{anchor:r,focus:o}=n,i=r.offset,s=o.offset,l=r.getNode(),c=o.getNode(),a=t===Ne;if(!St$1(n)||!st$1(l)&&!nr(l)||!st$1(c)&&!nr(c))return false;if(!e.altKey){if(n.isCollapsed()){const t=l.getParentOrThrow();if(a&&0===i&&null===l.getPreviousSibling()){if(null===t.getPreviousSibling())return t.selectPrevious(),e.preventDefault(),true}else if(!a&&i===l.getTextContentSize()&&null===l.getNextSibling()){if(null===t.getNextSibling())return t.selectNext(),e.preventDefault(),true}}return false}let g,p;if(l.isBefore(c)?(g=ut(l),p=ct$1(c)):(g=ut(c),p=ct$1(l)),null==g||null==p)return false;const f=g.getNodesBetween(p);for(let t=0;tt.remove())),t===Ne?(f.forEach((t=>_.insertBefore(t))),_.insertBefore(d)):(_.insertAfter(d),_=d,f.forEach((t=>{_.insertAfter(t),_=t;}))),n.setTextNodeRange(l,i,c,s),true}function Ct(t,e){const n=Nr();if(!cr(n))return false;const{anchor:r,focus:o}=n,i=r.getNode(),s=o.getNode(),l=t===be;if(!St$1(n)||!st$1(i)&&!nr(i)||!st$1(s)&&!nr(s))return false;if(l){const t=gt$1(s,o.offset);if(null!==t){const{node:e,offset:r}=t;Fn(e)?e.selectNext(0,0):n.setTextNodeRange(e,r,e,r);}else s.getParentOrThrow().selectStart();}else {pt$1(s).select();}return e.preventDefault(),e.stopPropagation(),true}function Nt$1(t,e){if(!t.hasNodes([K,rt]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==e&&(e=at);const n=[];return true!==t._headless&&n.push(t.registerMutationListener(K,(e=>{t.update((()=>{for(const[n,r]of e)if("destroyed"!==r){const e=us(n);null!==e&&ht$1(e,t);}}));}),{skipInitialization:false})),n.push(t.registerNodeTransform(K,(n=>mt$1(n,t,e))),t.registerNodeTransform(Jn,(n=>ft(n,t,e))),t.registerNodeTransform(rt,(n=>ft(n,t,e))),t.registerCommand(Pe,(e=>{const n=function(t){const e=Nr();if(!cr(e)||!St$1(e))return null;const n=t?Ie:Le,r=t?Ie:Fe,o=e.anchor,i=e.focus;if(o.is(i))return r;const s=_t$1(e);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&D(285),e.isBackward()?(u=i,c=o):(u=o,c=i);const a=ut(l[0]),g=ct$1(l[0]),p=ir(a.getKey(),0,"text"),f=ir(g.getKey(),g.getTextContentSize(),"text");return u.isBefore(p)||f.isBefore(c)?n:p.isBefore(u)||c.isBefore(f)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),true)}),Ii),t.registerCommand(Fe,(()=>!!St$1(Nr())&&(Fr([er()]),true)),Ii),t.registerCommand(Le,(t=>vt$1(Le)),Ii),t.registerCommand(Ie,(t=>vt$1(Ie)),Ii),t.registerCommand(Ne,(t=>{const e=Nr();if(!cr(e))return false;const{anchor:n}=e,r=n.getNode();return !!St$1(e)&&(e.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&I(r.getParentOrThrow())?(t.preventDefault(),true):Tt$1(Ne,t))}),Ii),t.registerCommand(we,(t=>{const e=Nr();if(!cr(e))return false;const{anchor:n}=e,r=n.getNode();return !!St$1(e)&&(e.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&I(r.getParentOrThrow())?(t.preventDefault(),true):Tt$1(we,t))}),Ii),t.registerCommand(be,(t=>Ct(be,t)),Ii),t.registerCommand(ke,(t=>Ct(ke,t)),Ii)),j$2(...n)} /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -5149,12 +5106,12 @@ function I$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URL * */ -const R=new Set(["http:","https:","mailto:","sms:","tel:"]);let y$1 = class y extends Ci{__url;__target;__rel;__title;static getType(){return "link"}static clone(t){return new y(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(t="",e={},n){super(n);const{target:r=null,rel:i=null,title:l=null}=e;this.__url=t,this.__target=r,this.__rel=i,this.__title=l;}createDOM(e){const n=document.createElement("a");return this.updateLinkDOM(null,n,e),lt$3(n,e.theme.link),n}updateLinkDOM(t,n,r){if(xs(n)){t&&t.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(const e of ["target","rel","title"]){const r=`__${e}`,i=this[r];t&&t[r]===i||(i?n[e]=i:n.removeAttribute(e));}}}updateDOM(t,e,n){return this.updateLinkDOM(t,e,n),false}static importDOM(){return {a:t=>({conversion:N$1,priority:1})}}static importJSON(t){return D$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setURL(t.url).setRel(t.rel||null).setTarget(t.target||null).setTitle(t.title||null)}sanitizeUrl(t){t=W$2(t);try{const e=new URL(W$2(t));if(!R.has(e.protocol))return "about:blank"}catch(e){return t}return t}exportJSON(){return {...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=true){const n=D$1(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,e),n}canInsertTextBefore(){return false}canInsertTextAfter(){return false}canBeEmpty(){return false}isInline(){return true}extractWithChild(t,e,n){if(!yr(e))return false;const r=e.anchor.getNode(),i=e.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&e.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function N$1(t){let n=null;if(xs(t)){const e=t.textContent;(null!==e&&""!==e||t.children.length>0)&&(n=D$1(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}));}return {node:n}}function D$1(t="",e){return fs(new y$1(t,e))}function w$2(t){return t instanceof y$1}class A extends y$1{__isUnlinked;constructor(t="",e={},n){super(t,e,n),this.__isUnlinked=void 0!==e.isUnlinked&&null!==e.isUnlinked&&e.isUnlinked;}static getType(){return "autolink"}static clone(t){return new A(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?document.createElement("span"):super.createDOM(t)}updateDOM(t,e,n){return super.updateDOM(t,e,n)||t.__isUnlinked!==this.__isUnlinked}static importJSON(t){return I$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked||false)}static importDOM(){return null}exportJSON(){return {...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(t,e=true){const n=this.getParentOrThrow().insertNewAfter(t,e);if(Si(n)){const t=I$1(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(t),t}return null}}function I$1(t="",e){return fs(new A(t,e))}function E$2(t){return t instanceof A}function M$1(t,e){if("element"===t.type){const n=t.getNode();Si(n)||function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252);return n.getChildren()[t.offset+e]||null}return null}function J$1(t,e={}){let r;if(t&&"object"==typeof t){const{url:n,...i}=t;r=n,e={...i,...e};}else r=t;const{target:i,title:l}=e,s=void 0===e.rel?"noreferrer":e.rel,u=Lr();if(null===u||!yr(u)&&!xr(u))return;if(xr(u)){const t=u.getNodes();if(0===t.length)return;return void t.forEach(t=>{if(null===r){const e=zs(t,t=>!E$2(t)&&w$2(t));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove());}else {const e=zs(t,t=>!E$2(t)&&w$2(t));if(e)e.setURL(r),void 0!==i&&e.setTarget(i),void 0!==s&&e.setRel(s);else {const e=D$1(r,{rel:s,target:i});t.insertBefore(e),e.append(t);}}})}const h=u.extract();if(null===r){const t=new Set;return void h.forEach(e=>{const n=e.getParent();if(w$2(n)&&!E$2(n)){const e=n.getKey();if(t.has(e))return;!function(t,e){const n=new Set(e.filter(e=>t.isParentOf(e)).map(t=>t.getKey())),r=t.getChildren(),i=r.filter(t=>n.has(t.getKey()));if(i.length===r.length)return r.forEach(e=>t.insertBefore(e)),void t.remove();const l=r.findIndex(t=>n.has(t.getKey())),s=r.findLastIndex(t=>n.has(t.getKey())),o=0===l,u=s===r.length-1;if(o)i.forEach(e=>t.insertBefore(e));else if(u)for(let e=i.length-1;e>=0;e--)t.insertAfter(i[e]);else {for(let e=i.length-1;e>=0;e--)t.insertAfter(i[e]);const e=r.slice(s+1);if(e.length>0){const n=D$1(t.getURL(),{rel:t.getRel(),target:t.getTarget(),title:t.getTitle()});i[i.length-1].insertAfter(n),e.forEach(t=>n.append(t));}}}(n,h),t.add(e);}})}const p=new Set,_=t=>{p.has(t.getKey())||(p.add(t.getKey()),t.setURL(r),void 0!==i&&t.setTarget(i),void 0!==s&&t.setRel(s),void 0!==l&&t.setTitle(l));};if(1===h.length){const t=h[0],e=zs(t,w$2);if(null!==e)return _(e)}!function(t){const e=Lr();if(!yr(e))return t();const n=St$5(e),r=n.isBackward(),i=M$1(n.anchor,r?-1:0),l=M$1(n.focus,r?0:-1);t();if(i||l){const t=Lr();if(yr(t)){const e=t.clone();if(i){const t=i.getParent();t&&e.anchor.set(t.getKey(),i.getIndexWithinParent()+(r?1:0),"element");}if(l){const t=l.getParent();t&&e.focus.set(t.getKey(),l.getIndexWithinParent()+(r?0:1),"element");}wo(St$5(e));}}}(()=>{let t=null;for(const e of h){if(!e.isAttached())continue;const o=zs(e,w$2);if(o){_(o);continue}if(Si(e)){if(!e.isInline())continue;if(w$2(e)){if(!(E$2(e)||null!==t&&t.getParentOrThrow().isParentOf(e))){_(e),t=e;continue}for(const t of e.getChildren())e.insertBefore(t);e.remove();continue}}const u=e.getPreviousSibling();w$2(u)&&u.is(t)?u.append(e):(t=D$1(r,{rel:s,target:i,title:l}),e.insertAfter(t),t.append(e));}});}const K$1=/^\+?[0-9\s()-]{5,}$/;function W$2(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:K$1.test(t)?`tel:${t}`:`https://${t}`} +const h$1=new Set(["http:","https:","mailto:","sms:","tel:"]);let g$1 = class g extends fi{static getType(){return "link"}static clone(t){return new g(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(t="",e={},r){super(r);const{target:n=null,rel:i=null,title:s=null}=e;this.__url=t,this.__target=n,this.__rel=i,this.__title=s;}createDOM(e){const r=document.createElement("a");return this.updateLinkDOM(null,r,e),rt$2(r,e.theme.link),r}updateLinkDOM(t,r,n){if(uo(r)){t&&t.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const e of ["target","rel","title"]){const n=`__${e}`,i=this[n];t&&t[n]===i||(i?r[e]=i:r.removeAttribute(e));}}}updateDOM(t,e,r){return this.updateLinkDOM(t,e,r),false}static importDOM(){return {a:t=>({conversion:f,priority:1})}}static importJSON(t){return d().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setURL(t.url).setRel(t.rel||null).setTarget(t.target||null).setTitle(t.title||null)}sanitizeUrl(t){t=S$1(t);try{const e=new URL(S$1(t));if(!h$1.has(e.protocol))return "about:blank"}catch(e){return t}return t}exportJSON(){return {...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=true){const r=d(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,e),r}canInsertTextBefore(){return false}canInsertTextAfter(){return false}canBeEmpty(){return false}isInline(){return true}extractWithChild(t,e,r){if(!cr(e))return false;const n=e.anchor.getNode(),i=e.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&e.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function f(t){let r=null;if(uo(t)){const e=t.textContent;(null!==e&&""!==e||t.children.length>0)&&(r=d(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}));}return {node:r}}function d(t="",e){return no(new g$1(t,e))}function p(t){return t instanceof g$1}let m$1 = class m extends g$1{constructor(t="",e={},r){super(t,e,r),this.__isUnlinked=void 0!==e.isUnlinked&&null!==e.isUnlinked&&e.isUnlinked;}static getType(){return "autolink"}static clone(t){return new m(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?document.createElement("span"):super.createDOM(t)}updateDOM(t,e,r){return super.updateDOM(t,e,r)||t.__isUnlinked!==this.__isUnlinked}static importJSON(t){return U().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked||false)}static importDOM(){return null}exportJSON(){return {...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(t,e=true){const r=this.getParentOrThrow().insertNewAfter(t,e);if(di(r)){const t=U(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(t),t}return null}};function U(t="",e){return no(new m$1(t,e))}function O(t){return t instanceof m$1}function N(t,e){if("element"===t.type){const r=t.getNode();di(r)||function(t,...e){const r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(const t of e)n.append("v",t);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252);return r.getChildren()[t.offset+e]||null}return null}function v$1(t,e={}){const{target:n,title:i}=e,l=void 0===e.rel?"noreferrer":e.rel,h=Nr();if(null===h||!cr(h)&&!ur(h))return;if(ur(h)){const e=h.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===t){const t=wt$2(e,(t=>!O(t)&&p(t)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove());}else {const i=wt$2(e,(t=>!O(t)&&p(t)));if(i)i.setURL(t),void 0!==n&&i.setTarget(n),void 0!==l&&i.setRel(l);else {const r=d(t,{rel:l,target:n});e.insertBefore(r),r.append(e);}}}))}const g=h.extract();if(null===t)return void g.forEach((t=>{const e=wt$2(t,(t=>!O(t)&&p(t)));if(e){const t=e.getChildren();for(let r=0;r{f.has(e.getKey())||(f.add(e.getKey()),e.setURL(t),void 0!==n&&e.setTarget(n),void 0!==l&&e.setRel(l),void 0!==i&&e.setTitle(i));};if(1===g.length){const t=x$1(g[0],p);if(null!==t)return m(t)}!function(t){const e=Nr();if(!cr(e))return t();const r=vt$4(e),n=r.isBackward(),i=N(r.anchor,n?-1:0),l=N(r.focus,n?0:-1);t();if(i||l){const t=Nr();if(cr(t)){const e=t.clone();if(i){const t=i.getParent();t&&e.anchor.set(t.getKey(),i.getIndexWithinParent()+(n?1:0),"element");}if(l){const t=l.getParent();t&&e.focus.set(t.getKey(),l.getIndexWithinParent()+(n?0:1),"element");}ms(vt$4(e));}}}((()=>{let e=null;for(const r of g){if(!r.isAttached())continue;const s=x$1(r,p);if(s){m(s);continue}if(di(r)){if(!r.isInline())continue;if(p(r)){if(!(O(r)||null!==e&&e.getParentOrThrow().isParentOf(r))){m(r),e=r;continue}for(const t of r.getChildren())r.insertBefore(t);r.remove();continue}}const u=r.getPreviousSibling();p(u)&&u.is(e)?u.append(r):(e=d(t,{rel:l,target:n,title:i}),r.insertAfter(e),e.append(r));}}));}function x$1(t,e){let r=t;for(;null!==r&&null!==r.getParent()&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}const L=/^\+?[0-9\s()-]{5,}$/;function S$1(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:L.test(t)?`tel:${t}`:`https://${t}`} function getNearestListItemNode(node) { let current = node; while (current !== null) { - if (ot$2(current)) return current + if (Z$2(current)) return current current = current.getParent(); } return null @@ -5163,7 +5120,7 @@ function getNearestListItemNode(node) { function getListType(node) { let current = node; while (current) { - if (dt$1(current)) { + if (ot$2(current)) { return current.getListType() } current = current.getParent(); @@ -5183,13 +5140,13 @@ function isPrintableCharacter(event) { } function extendTextNodeConversion(conversionName, callback = (textNode => textNode)) { - return extendConversion(Xn, conversionName, (conversionOutput, element) => ({ + return extendConversion(Jn, conversionName, (conversionOutput, element) => ({ ...conversionOutput, forChild: (lexicalNode, parentNode) => { const originalForChild = conversionOutput?.forChild ?? (x => x); let childNode = originalForChild(lexicalNode, parentNode); - if (lr(childNode)) childNode = callback(childNode, element) ?? childNode; + if (Qn(childNode)) childNode = callback(childNode, element) ?? childNode; return childNode } })) @@ -5347,8 +5304,8 @@ class LexicalToolbarElement extends HTMLElement { } #updateButtonStates() { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const anchorNode = selection.anchor.getNode(); if (!anchorNode.getParent()) { return } @@ -5360,9 +5317,9 @@ class LexicalToolbarElement extends HTMLElement { const isStrikethrough = selection.hasFormat("strikethrough"); const isHighlight = selection.hasFormat("highlight"); const isInLink = this.#isInLink(anchorNode); - const isInQuote = Ot$1(topLevelElement); - const isInHeading = It$1(topLevelElement); - const isInCode = X$1(topLevelElement) || selection.hasFormat("code"); + const isInQuote = wt$1(topLevelElement); + const isInHeading = At(topLevelElement); + const isInCode = I(topLevelElement) || selection.hasFormat("code"); const isInList = this.#isInList(anchorNode); const listType = getListType(anchorNode); @@ -5385,7 +5342,7 @@ class LexicalToolbarElement extends HTMLElement { #isInList(node) { let current = node; while (current) { - if (dt$1(current) || ot$2(current)) return true + if (ot$2(current) || Z$2(current)) return true current = current.getParent(); } return false @@ -5394,7 +5351,7 @@ class LexicalToolbarElement extends HTMLElement { #isInLink(node) { let current = node; while (current) { - if (w$2(current)) return true + if (p(current)) return true current = current.getParent(); } return false @@ -5566,7 +5523,7 @@ customElements.define("lexxy-toolbar", LexicalToolbarElement); * */ -function z$1(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o):n[t]=[o]);}return n}function U$1(t){const e=z$1(t,t=>t.type);return {element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const W$1=/[!-/:-@[-`{-~\s]/;function V$1(t){return lr(t)&&!t.hasFormat("code")}function et(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const nt=/^(\s*)(\d{1,})\.\s/,ot=/^(\s*)[-*+]\s/,it=/^(#{1,6})\s/,st=/^>\s/,lt=/^[ \t]*```([\w-]+)?/,ct=/[ \t]*```$/,mt=ot$4("mdListMarker",{parse:t=>"string"==typeof t&&/^[-*+]$/.test(t)?t:"-"}),ht=t=>(e,n,o,r)=>{const i=t(o);i.append(...n),e.replace(i),r||i.select(0,0);};const xt=t=>(e,n,o,r)=>{const i=e.getPreviousSibling(),s=e.getNextSibling(),l=st$2("check"===t?"x"===o[3]:void 0),c=o[0].trim()[0],f="bullet"!==t&&"check"!==t||c!==mt.parse(c)?void 0:c;if(dt$1(s)&&s.getListType()===t){f&&ct$4(s,mt,f);const t=s.getFirstChild();null!==t?t.insertBefore(l):s.append(l),e.remove();}else if(dt$1(i)&&i.getListType()===t)f&&ct$4(i,mt,f),i.append(l),e.remove();else {const n=ht$3(t,"number"===t?Number(o[2]):void 0);f&&ct$4(n,mt,f),n.append(l),e.replace(n);}l.append(...n),r||l.select(0,0);const a=function(t){const e=t.match(/\t/g),n=t.match(/ /g);let o=0;return e&&(o+=e.length),n&&(o+=Math.floor(n.length/4)),o}(o[1]);a&&l.setIndent(a);},Tt=(t,e,n)=>{const o=[],r=t.getChildren();let i=0;for(const s of r)if(ot$2(s)){if(1===s.getChildrenSize()){const t=s.getFirstChild();if(dt$1(t)){o.push(Tt(t,e,n+1));continue}}const r=" ".repeat(4*n),l=t.getListType(),c=st$4(t,mt),f="number"===l?`${t.getStart()+i}. `:"check"===l?`${c} [${s.getChecked()?"x":" "}] `:c+" ";o.push(r+f+e(s)),i++;}return o.join("\n")},Et={dependencies:[Pt$2],export:(t,e)=>{if(!It$1(t))return null;const n=Number(t.getTag().slice(1));return "#".repeat(n)+" "+e(t)},regExp:it,replace:ht(t=>{const e="h"+t[1].length;return St$2(e)}),type:"element"},Ct={dependencies:[Et$2],export:(t,e)=>{if(!Ot$1(t))return null;const n=e(t).split("\n"),o=[];for(const t of n)o.push("> "+t);return o.join("\n")},regExp:st,replace:(t,e,n,o)=>{if(o){const n=t.getPreviousSibling();if(Ot$1(n))return n.splice(n.getChildrenSize(),0,[Jn(),...e]),void t.remove()}const r=_t$1();r.append(...e),t.replace(r),o||r.select(0,0);},type:"element"},yt={dependencies:[q$1],export:t=>{if(!X$1(t))return null;const e=t.getTextContent();return "```"+(t.getLanguage()||"")+(e?"\n"+e:"")+"\n```"},regExpEnd:{optional:true,regExp:ct},regExpStart:lt,replace:(t,e,n,o,r,i)=>{let s,c;if(!e&&r){if(1===r.length)o?(s=U$2(),c=n[1]+r[0]):(s=U$2(n[1]),c=r[0].startsWith(" ")?r[0].slice(1):r[0]);else {if(s=U$2(n[1]),0===r[0].trim().length)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();c=r.join("\n");}const e=sr(c);s.append(e),t.append(s);}else e&&ht(t=>U$2(t?t[1]:void 0))(t,e,n,i);},type:"multiline-element"},$t={dependencies:[lt$2,nt$2],export:(t,e)=>dt$1(t)?Tt(t,e,0):null,regExp:ot,replace:xt("bullet"),type:"element"},St={dependencies:[lt$2,nt$2],export:(t,e)=>dt$1(t)?Tt(t,e,0):null,regExp:nt,replace:xt("number"),type:"element"},bt={format:["code"],tag:"`",type:"text-format"},Ft={format:["highlight"],tag:"==",type:"text-format"},It={format:["bold","italic"],tag:"***",type:"text-format"},wt={format:["bold","italic"],intraword:false,tag:"___",type:"text-format"},Nt={format:["bold"],tag:"**",type:"text-format"},kt={format:["bold"],intraword:false,tag:"__",type:"text-format"},Rt={format:["strikethrough"],tag:"~~",type:"text-format"},Lt={format:["italic"],tag:"*",type:"text-format"},_t={format:["italic"],intraword:false,tag:"_",type:"text-format"},Pt={dependencies:[y$1],export:(t,e,n)=>{if(!w$2(t)||E$2(t))return null;const o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{const[,n,o,r]=e,i=D$1(o,{title:r}),s=n.split("[").length-1,c=n.split("]").length-1;let f=n,a="";if(sc){const t=n.split("[");a="["+t[0],f=t.slice(1).join("[");}const u=sr(f);return u.setFormat(t.getFormat()),i.append(u),t.replace(i),a&&i.insertBefore(sr(a)),u},trigger:")",type:"text-match"},Bt=[Et,Ct,$t,St],Mt=[yt],jt=[bt,It,wt,Nt,kt,Ft,Lt,_t,Rt],At=[Pt],zt=[...Bt,...Mt,...jt,...At];function Ut(t,e,n){const o=n.length;for(let r=e;r>=o;r--){const e=r-o;if(Wt(t,e,n,0,o)&&" "!==t[e+o])return e}return -1}function Wt(t,e,n,o,r){for(let i=0;it[t.length-1]),l=z$1(o.textMatch,({trigger:t})=>t);for(const e of n){const n=e.type;if("element"===n||"text-match"===n||"multiline-element"===n){const n=e.dependencies;for(const e of n)t.hasNode(e)||et(173,e.getType());}}const c=(t,n,c)=>{(function(t,e,n,o){const r=t.getParent();if(!as(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExp:r,replace:s}of o){const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,false))return i.remove(),true}}return false})(t,n,c,o.element)||function(t,e,n,o){const r=t.getParent();if(!as(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExpStart:r,replace:s,regExpEnd:l}of o){if(l&&!("optional"in l)||l&&"optional"in l&&!l.optional)continue;const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,null,null,false))return i.remove(),true}}return false}(t,n,c,o.multilineElement)||function(t,e,n){let o=t.getTextContent();const r=n[o[e-1]];if(null==r)return false;e1&&!Wt(r,a,o,0,f))continue;if(" "===r[a-1])continue;const u=r[l+1];if(false===n.intraword&&u&&!W$1.test(u))continue;const g=t;let p=g,d=Ut(r,a,o),h=p;for(;d<0&&(h=h.getPreviousSibling())&&!jn(h);)if(lr(h)){if(h.hasFormat("code"))continue;const t=h.getTextContent();p=h,d=Ut(t,t.length,o);}if(d<0)continue;if(p===g&&d+f===a)continue;const E=p.getTextContent();if(d>0&&E[d-1]===c)continue;const C=E[d-1];if(false===n.intraword&&C&&!W$1.test(C))continue;const y=g.getTextContent(),$=y.slice(0,a)+y.slice(l+1);g.setTextContent($);const v=p===g?$:E;p.setTextContent(v.slice(0,d)+v.slice(d+f));const S=Lr(),b=Ar();wo(b);const F=l-f*(p===g?2:1)+1;b.anchor.set(p.__key,d,"text"),b.focus.set(g.__key,F,"text");for(const t of n.format)b.hasFormat(t)||b.formatText(t);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const t of n.format)b.hasFormat(t)&&b.toggleFormat(t);return yr(S)&&(b.format=S.format),true}}(n,c,r);};return t.registerUpdateListener(({tags:n,dirtyLeaves:o,editorState:r,prevEditorState:i})=>{if(n.has(Ln)||n.has(An))return;if(t.isComposing())return;const l=r.read(Lr),f=i.read(Lr);if(!yr(f)||!yr(l)||!l.isCollapsed()||l.is(f))return;const a=l.anchor.key,u=l.anchor.offset,g=r._nodeMap.get(a);!lr(g)||!o.has(a)||1!==u&&u>f.anchor.offset+1||t.update(()=>{if(!V$1(g))return;const t=g.getParent();null===t||X$1(t)||c(t,g,l.anchor.offset);});})} +function M$1(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o):n[t]=[o]);}return n}function j(t){const e=M$1(t,(t=>t.type));return {element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const A=/[!-/:-@[-`{-~\s]/;function J(t){return Qn(t)&&!t.hasFormat("code")}function Y(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Z(t,e,n){const o=n.length;for(let r=e;r>=o;r--){const e=r-o;if(tt(t,e,n,0,o)&&" "!==t[e+o])return e}return -1}function tt(t,e,n,o,r){for(let i=0;it[t.length-1])),l=M$1(o.textMatch,(({trigger:t})=>t));for(const e of n){const n=e.type;if("element"===n||"text-match"===n||"multiline-element"===n){const n=e.dependencies;for(const e of n)t.hasNode(e)||Y(173,e.getType());}}const c=(t,n,c)=>{(function(t,e,n,o){const r=t.getParent();if(!to(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExp:r,replace:s}of o){const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,false))return i.remove(),true}}return false})(t,n,c,o.element)||function(t,e,n,o){const r=t.getParent();if(!to(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExpStart:r,replace:s,regExpEnd:l}of o){if(l&&!("optional"in l)||l&&"optional"in l&&!l.optional)continue;const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,null,null,false))return i.remove(),true}}return false}(t,n,c,o.multilineElement)||function(t,e,n){let o=t.getTextContent();const r=n[o[e-1]];if(null==r)return false;e1&&!tt(r,a,o,0,f))continue;if(" "===r[a-1])continue;const u=r[l+1];if(false===n.intraword&&u&&!A.test(u))continue;const p=t;let h=p,x=Z(r,a,o),T=h;for(;x<0&&(T=T.getPreviousSibling())&&!Fn(T);)if(Qn(T)){if(T.hasFormat("code"))continue;const t=T.getTextContent();h=T,x=Z(t,t.length,o);}if(x<0)continue;if(h===p&&x+f===a)continue;const C=h.getTextContent();if(x>0&&C[x-1]===c)continue;const E=C[x-1];if(false===n.intraword&&E&&!A.test(E))continue;const y=p.getTextContent(),v=y.slice(0,a)+y.slice(l+1);p.setTextContent(v);const S=h===p?v:C;h.setTextContent(S.slice(0,x)+S.slice(x+f));const $=Nr(),b=vr();ms(b);const F=l-f*(h===p?2:1)+1;b.anchor.set(h.__key,x,"text"),b.focus.set(p.__key,F,"text");for(const t of n.format)b.hasFormat(t)||b.formatText(t);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const t of n.format)b.hasFormat(t)&&b.toggleFormat(t);return cr($)&&(b.format=$.format),true}}(n,c,r);};return t.registerUpdateListener((({tags:n,dirtyLeaves:o,editorState:r,prevEditorState:i})=>{if(n.has(Ni)||n.has(vi))return;if(t.isComposing())return;const l=r.read(Nr),f=i.read(Nr);if(!cr(f)||!cr(l)||!l.isCollapsed()||l.is(f))return;const p=l.anchor.key,d=l.anchor.offset,m=r._nodeMap.get(p);!Qn(m)||!o.has(p)||1!==d&&d>f.anchor.offset+1||t.update((()=>{if(!J(m))return;const t=m.getParent();null===t||I(t)||c(t,m,l.anchor.offset);}));}))}const nt=/^(\s*)(\d{1,})\.\s/,ot=/^(\s*)[-*+]\s/,it=/^(#{1,6})\s/,st=/^>\s/,lt=/^[ \t]*```(\w+)?/,ct=/[ \t]*```$/,gt=t=>(e,n,o,r)=>{const i=t(o);i.append(...n),e.replace(i),r||i.select(0,0);};const pt=t=>(e,n,o,r)=>{const i=e.getPreviousSibling(),s=e.getNextSibling(),l=Y$2("check"===t?"x"===o[3]:void 0);if(ot$2(s)&&s.getListType()===t){const t=s.getFirstChild();null!==t?t.insertBefore(l):s.append(l),e.remove();}else if(ot$2(i)&&i.getListType()===t)i.append(l),e.remove();else {const n=st$2(t,"number"===t?Number(o[2]):void 0);n.append(l),e.replace(n);}l.append(...n),r||l.select(0,0);const c=function(t){const e=t.match(/\t/g),n=t.match(/ /g);let o=0;return e&&(o+=e.length),n&&(o+=Math.floor(n.length/4)),o}(o[1]);c&&l.setIndent(c);},dt=(t,e,n)=>{const o=[],r=t.getChildren();let i=0;for(const s of r)if(Z$2(s)){if(1===s.getChildrenSize()){const t=s.getFirstChild();if(ot$2(t)){o.push(dt(t,e,n+1));continue}}const r=" ".repeat(4*n),l=t.getListType(),c="number"===l?`${t.getStart()+i}. `:"check"===l?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(r+c+e(s)),i++;}return o.join("\n")},mt={dependencies:[Nt$2],export:(t,e)=>{if(!At(t))return null;const n=Number(t.getTag().slice(1));return "#".repeat(n)+" "+e(t)},regExp:it,replace:gt((t=>{const e="h"+t[1].length;return _t$2(e)})),type:"element"},ht={dependencies:[Dt],export:(t,e)=>{if(!wt$1(t))return null;const n=e(t).split("\n"),o=[];for(const t of n)o.push("> "+t);return o.join("\n")},regExp:st,replace:(t,e,n,o)=>{if(o){const n=t.getPreviousSibling();if(wt$1(n))return n.splice(n.getChildrenSize(),0,[Pn(),...e]),void t.remove()}const r=xt$2();r.append(...e),t.replace(r),o||r.select(0,0);},type:"element"},xt={dependencies:[K],export:t=>{if(!I(t))return null;const e=t.getTextContent();return "```"+(t.getLanguage()||"")+(e?"\n"+e:"")+"\n```"},regExpEnd:{optional:true,regExp:ct},regExpStart:lt,replace:(t,e,n,o,r,i)=>{let s,c;if(!e&&r){if(1===r.length)o?(s=R(),c=n[1]+r[0]):(s=R(n[1]),c=r[0].startsWith(" ")?r[0].slice(1):r[0]);else {if(s=R(n[1]),0===r[0].trim().length)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();c=r.join("\n");}const e=Xn(c);s.append(e),t.append(s);}else e&>((t=>R(t?t[1]:void 0)))(t,e,n,i);},type:"multiline-element"},Tt={dependencies:[tt$1,j$1],export:(t,e)=>ot$2(t)?dt(t,e,0):null,regExp:ot,replace:pt("bullet"),type:"element"},Et={dependencies:[tt$1,j$1],export:(t,e)=>ot$2(t)?dt(t,e,0):null,regExp:nt,replace:pt("number"),type:"element"},yt={format:["code"],tag:"`",type:"text-format"},vt={format:["highlight"],tag:"==",type:"text-format"},St={format:["bold","italic"],tag:"***",type:"text-format"},$t={format:["bold","italic"],intraword:false,tag:"___",type:"text-format"},bt={format:["bold"],tag:"**",type:"text-format"},Ft={format:["bold"],intraword:false,tag:"__",type:"text-format"},It={format:["strikethrough"],tag:"~~",type:"text-format"},Nt={format:["italic"],tag:"*",type:"text-format"},wt={format:["italic"],intraword:false,tag:"_",type:"text-format"},kt={dependencies:[g$1],export:(t,e,n)=>{if(!p(t)||O(t))return null;const o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{const[,n,o,r]=e,i=d(o,{title:r}),s=Xn(n);return s.setFormat(t.getFormat()),i.append(s),t.replace(i),s},trigger:")",type:"text-match"};const Lt=[mt,ht,Tt,Et],Pt=[xt],Rt=[yt,St,$t,bt,Ft,vt,Nt,wt,It],_t=[kt],Bt=[...Lt,...Pt,...Rt,..._t]; /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -5576,7 +5533,7 @@ function z$1(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o * */ -function x$1(t,e,n,r,o){if(null===t||0===n.size&&0===r.size&&!o)return 0;const i=e._selection,a=t._selection;if(o)return 1;if(!(yr(i)&&yr(a)&&a.isCollapsed()&&i.isCollapsed()))return 0;const s=function(t,e,n){const r=t._nodeMap,o=[];for(const t of e){const e=r.get(t);void 0!==e&&o.push(e);}for(const[t,e]of n){if(!e)continue;const n=r.get(t);void 0===n||bi(n)||o.push(n);}return o}(e,n,r);if(0===s.length)return 0;if(s.length>1){const n=e._nodeMap,r=n.get(i.anchor.key),o=n.get(a.anchor.key);return r&&o&&!t._nodeMap.has(r.__key)&&lr(r)&&1===r.__text.length&&1===i.anchor.offset?2:0}const c=s[0],d=t._nodeMap.get(c.__key);if(!lr(d)||!lr(c)||d.__mode!==c.__mode)return 0;const u=d.__text,l=c.__text;if(u===l)return 0;const f=i.anchor,p=a.anchor;if(f.key!==p.key||"text"!==f.type)return 0;const h=f.offset,m=p.offset,y=l.length-u.length;return 1===y&&m===h-1?2:-1===y&&m===h+1?3:-1===y&&m===h?4:0}function C$1(t,e){let n=Date.now(),r=0;return (o,i,a,s,c,d)=>{const u=Date.now();if(d.has(An))return r=0,n=u,2;const l=x$1(o,i,s,c,t.isComposing()),f=(()=>{const f=null===a||a.editor===t,p=d.has(Pn);if(!p&&f&&d.has(Dn))return 0;if(null===o)return 1;const h=i._selection;if(!(s.size>0||c.size>0))return null!==h?0:2;const m="number"==typeof e?e:e.peek();if(false===p&&0!==l&&l===r&&ur.exportJSON()))===JSON.stringify(n.read(()=>o.exportJSON()))}(Array.from(s)[0],o,i))return 0}return 1})();return n=u,r=l,f}}function v$1(t){t.undoStack=[],t.redoStack=[],t.current=null;}function b$1(t,e,n){const r=C$1(t,n),i=U$4(t.registerCommand(pe$1,()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==r.length){const o=e.current,i=r.pop();null!==o&&(n.push(o),t.dispatchCommand($e$1,true)),0===r.length&&t.dispatchCommand(Ue$1,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:An});}}(t,e),true),Ki),t.registerCommand(ye$1,()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==n.length){const o=e.current;null!==o&&(r.push(o),t.dispatchCommand(Ue$1,true));const i=n.pop();0===n.length&&t.dispatchCommand($e$1,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:An});}}(t,e),true),Ki),t.registerCommand(Je$1,()=>(v$1(e),false),Ki),t.registerCommand(je$1,()=>(v$1(e),t.dispatchCommand($e$1,false),t.dispatchCommand(Ue$1,false),true),Ki),t.registerUpdateListener(({editorState:n,prevEditorState:o,dirtyLeaves:i,dirtyElements:a,tags:s})=>{const c=e.current,d=e.redoStack,u=e.undoStack,l=null===c?null:c.editorState;if(null!==c&&n===l)return;const f=r(o,n,c,i,a,s);if(1===f)0!==d.length&&(e.redoStack=[],t.dispatchCommand($e$1,false)),null!==c&&(u.push({...c}),t.dispatchCommand(Ue$1,true));else if(2===f)return;e.current={editor:t,editorState:n};}));return i}function w$1(){return {current:null,redoStack:[],undoStack:[]}}const E$1=Kl({build:(e,{delay:n,createInitialHistoryState:r,disabled:o})=>at$1({delay:n,disabled:o,historyState:r(e)}),config:Bl({createInitialHistoryState:w$1,delay:300,disabled:"undefined"==typeof window}),name:"@lexical/history/History",register:(t,n,r)=>{const o=r.getOutput();return dt$2(()=>o.disabled.value?void 0:b$1(t,o.historyState.value,o.delay))}});Kl({dependencies:[zl(E$1,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:true})],name:"@lexical/history/SharedHistory",register(t,o,i){const{output:a}=i.getDependency(E$1),s=function(t){return t?Gt(t,E$1.name):null}(t._parentEditor);if(!s)return ()=>{};const c=s.output;return dt$2(()=>F$2(()=>{a.delay.value=c.delay.value,a.historyState.value=c.historyState.value,a.disabled.value=c.disabled.value;}))}}); +const m=0,h=1,_=2,g=0,S=1,k=2,y=3,C=4;function x(t,e,n,r,o){if(null===t||0===n.size&&0===r.size&&!o)return g;const i=e._selection,c=t._selection;if(o)return S;if(!(cr(i)&&cr(c)&&c.isCollapsed()&&i.isCollapsed()))return g;const s=function(t,e,n){const r=t._nodeMap,o=[];for(const t of e){const e=r.get(t);void 0!==e&&o.push(e);}for(const[t,e]of n){if(!e)continue;const n=r.get(t);void 0===n||yi(n)||o.push(n);}return o}(e,n,r);if(0===s.length)return g;if(s.length>1){const n=e._nodeMap,r=n.get(i.anchor.key),o=n.get(c.anchor.key);return r&&o&&!t._nodeMap.has(r.__key)&&Qn(r)&&1===r.__text.length&&1===i.anchor.offset?k:g}const a=s[0],u=t._nodeMap.get(a.__key);if(!Qn(u)||!Qn(a)||u.__mode!==a.__mode)return g;const d=u.__text,m=a.__text;if(d===m)return g;const h=i.anchor,_=c.anchor;if(h.key!==_.key||"text"!==h.type)return g;const x=h.offset,M=_.offset,z=m.length-d.length;return 1===z&&M===x-1?k:-1===z&&M===x+1?y:-1===z&&M===x?C:g}function M(t,e){let n=Date.now(),r=g;return (o,i,c,s,p,S)=>{const k=Date.now();if(S.has(vi))return r=g,n=k,_;const y=x(o,i,s,p,t.isComposing()),C=(()=>{const a=null===c||c.editor===t,C=S.has(ki);if(!C&&a&&S.has(Ti))return m;if(null===o)return h;const x=i._selection;if(!(s.size>0||p.size>0))return null!==x?m:_;if(false===C&&y!==g&&y===r&&kr.exportJSON())))===JSON.stringify(n.read((()=>o.exportJSON())))}(Array.from(s)[0],o,i))return m}return h})();return n=k,r=y,C}}function z(t){t.undoStack=[],t.redoStack=[],t.current=null;}function v(u,d,l){const f=M(u,l),p=j$2(u.registerCommand(xe,(()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==r.length){const o=e.current,i=r.pop();null!==o&&(n.push(o),t.dispatchCommand(Ye,true)),0===r.length&&t.dispatchCommand(He,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:vi});}}(u,d),true)),Li),u.registerCommand(Ce,(()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==n.length){const o=e.current;null!==o&&(r.push(o),t.dispatchCommand(He,true));const i=n.pop();0===n.length&&t.dispatchCommand(Ye,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:vi});}}(u,d),true)),Li),u.registerCommand(je,(()=>(z(d),false)),Li),u.registerCommand(Ve,(()=>(z(d),u.dispatchCommand(Ye,false),u.dispatchCommand(He,false),true)),Li),u.registerUpdateListener((({editorState:t,prevEditorState:e,dirtyLeaves:n,dirtyElements:r,tags:o})=>{const i=d.current,a=d.redoStack,l=d.undoStack,p=null===i?null:i.editorState;if(null!==i&&t===p)return;const m=f(e,t,i,n,r,o);if(m===h)0!==a.length&&(d.redoStack=[],u.dispatchCommand(Ye,false)),null!==i&&(l.push({...i}),u.dispatchCommand(He,true));else if(m===_)return;d.current={editor:u,editorState:t};})));return p}function E(){return {current:null,redoStack:[],undoStack:[]}} var theme = { text: { @@ -5690,7 +5647,7 @@ function bytesToHumanSize(bytes) { return `${ value.toFixed(2) } ${ sizes[i] }` } -class ActionTextAttachmentNode extends ki { +class ActionTextAttachmentNode extends gi { static getType() { return "action_text_attachment" } @@ -6073,7 +6030,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { const src = this.blobUrlTemplate .replace(":signed_id", blob.signed_id) .replace(":filename", encodeURIComponent(blob.filename)); - const latest = xo(this.getKey()); + const latest = us(this.getKey()); if (latest) { latest.replace(new ActionTextAttachmentNode({ sgid: blob.attachable_sgid, @@ -6087,7 +6044,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { height: image?.naturalHeight })); } - }, { tag: Dn }); + }, { tag: Ti }); } async #loadFigurePreviewFromBlob(blob, figure) { @@ -6108,7 +6065,79 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { } } -class HorizontalDividerNode extends ki { +class AttachmentGalleryNode extends fi { + static getType() { + return "attachment_gallery" + } + + static clone(node) { + return new AttachmentGalleryNode(node.__key) + } + + static importJSON(serializedNode) { + return new AttachmentGalleryNode() + } + + static importDOM() { + return { + div: (domNode) => { + if (domNode.classList.contains('attachment-gallery')) { + return { + conversion: () => ({ node: new AttachmentGalleryNode() }), + priority: 1 + } + } + return null + } + } + } + + constructor(key) { + super(key); + } + + createDOM() { + const element = document.createElement("div"); + element.className = this.getGalleryClassName(); + return element + } + + updateDOM(prevNode, dom) { + const className = this.getGalleryClassName(); + if (dom.className !== className) { + dom.className = className; + } + return false + } + + getGalleryClassName() { + const count = this.getChildrenSize(); + return `attachment-gallery attachment-gallery--${count}` + } + + isInline() { + return false + } + + exportDOM(editor) { + const element = document.createElement("div"); + element.className = this.getGalleryClassName(); + return { element } + } + + exportJSON() { + return { + type: "attachment_gallery", + version: 1 + } + } +} + +function $createAttachmentGalleryNode() { + return new AttachmentGalleryNode() +} + +class HorizontalDividerNode extends gi { static getType() { return "horizontal_divider" } @@ -6217,15 +6246,15 @@ class CommandDispatcher { } dispatchBold() { - this.editor.dispatchCommand(_e$1, "bold"); + this.editor.dispatchCommand(me, "bold"); } dispatchItalic() { - this.editor.dispatchCommand(_e$1, "italic"); + this.editor.dispatchCommand(me, "italic"); } dispatchStrikethrough() { - this.editor.dispatchCommand(_e$1, "strikethrough"); + this.editor.dispatchCommand(me, "strikethrough"); } dispatchToggleHighlight(styles) { @@ -6238,16 +6267,16 @@ class CommandDispatcher { dispatchLink(url) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return if (selection.isCollapsed()) { - const autoLinkNode = I$1(url); - const textNode = sr(url); + const autoLinkNode = U(url); + const textNode = Xn(url); autoLinkNode.append(textNode); selection.insertNodes([ autoLinkNode ]); } else { - J$1(url); + v$1(url); } }); } @@ -6257,7 +6286,7 @@ class CommandDispatcher { } dispatchInsertUnorderedList() { - const selection = Lr(); + const selection = Nr(); if (!selection) return const anchorNode = selection.anchor.getNode(); @@ -6265,12 +6294,12 @@ class CommandDispatcher { if (this.selection.isInsideList && anchorNode && getListType(anchorNode) === "bullet") { this.contents.unwrapSelectedListItems(); } else { - this.editor.dispatchCommand(St$3, undefined); + this.editor.dispatchCommand(ft$2, undefined); } } dispatchInsertOrderedList() { - const selection = Lr(); + const selection = Nr(); if (!selection) return const anchorNode = selection.anchor.getNode(); @@ -6278,20 +6307,20 @@ class CommandDispatcher { if (this.selection.isInsideList && anchorNode && getListType(anchorNode) === "number") { this.contents.unwrapSelectedListItems(); } else { - this.editor.dispatchCommand(xt$2, undefined); + this.editor.dispatchCommand(pt$3, undefined); } } dispatchInsertQuoteBlock() { - this.contents.toggleNodeWrappingAllSelectedNodes((node) => Ot$1(node), () => _t$1()); + this.contents.toggleNodeWrappingAllSelectedNodes((node) => wt$1(node), () => xt$2()); } dispatchInsertCodeBlock() { this.editor.update(() => { if (this.selection.hasSelectedWordsInSingleLine) { - this.editor.dispatchCommand(_e$1, "code"); + this.editor.dispatchCommand(me, "code"); } else { - this.contents.toggleNodeWrappingAllSelectedLines((node) => X$1(node), () => new q$1("plain")); + this.contents.toggleNodeWrappingAllSelectedLines((node) => I(node), () => new K("plain")); } }); } @@ -6306,12 +6335,12 @@ class CommandDispatcher { dispatchRotateHeadingFormat() { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow(); let nextTag = "h2"; - if (It$1(topLevelElement)) { + if (At(topLevelElement)) { const currentTag = topLevelElement.getTag(); if (currentTag === "h2") { nextTag = "h3"; @@ -6325,7 +6354,7 @@ class CommandDispatcher { } if (nextTag) { - this.contents.insertNodeWrappingEachSelectedLine(() => St$2(nextTag)); + this.contents.insertNodeWrappingEachSelectedLine(() => _t$2(nextTag)); } else { this.contents.removeFormattingFromSelectedLines(); } @@ -6340,9 +6369,7 @@ class CommandDispatcher { const files = Array.from(target.files); if (!files.length) return - for (const file of files) { - this.contents.uploadFile(file); - } + this.contents.uploadFiles(files); } }); @@ -6352,11 +6379,11 @@ class CommandDispatcher { } dispatchUndo() { - this.editor.dispatchCommand(pe$1, undefined); + this.editor.dispatchCommand(xe, undefined); } dispatchRedo() { - this.editor.dispatchCommand(ye$1, undefined); + this.editor.dispatchCommand(Ce, undefined); } #registerCommands() { @@ -6365,7 +6392,7 @@ class CommandDispatcher { this.#registerCommandHandler(command, 0, this[methodName].bind(this)); } - this.#registerCommandHandler(fe$1, zi, this.dispatchPaste.bind(this)); + this.#registerCommandHandler(ge, Ii, this.dispatchPaste.bind(this)); } #registerCommandHandler(command, priority, handler) { @@ -6376,9 +6403,9 @@ class CommandDispatcher { #toggleLink(url) { this.editor.update(() => { if (url === null) { - J$1(null); + v$1(null); } else { - J$1(url); + v$1(url); } }); } @@ -6423,10 +6450,7 @@ class CommandDispatcher { const files = Array.from(dataTransfer.files); if (!files.length) return - for (const file of files) { - this.contents.uploadFile(file); - } - + this.contents.uploadFiles(files); this.editor.focus(); } } @@ -6476,9 +6500,9 @@ class Selection { } set current(selection) { - if (xr(selection)) { + if (ur(selection)) { this.editor.getEditorState().read(() => { - this._current = Lr(); + this._current = Nr(); this.#syncSelectedClasses(); }); } else { @@ -6511,20 +6535,20 @@ class Selection { placeCursorAtTheEnd() { this.editor.update(() => { - No().selectEnd(); + ps().selectEnd(); }); } selectedNodeWithOffset() { - const selection = Lr(); + const selection = Nr(); if (!selection) return { node: null, offset: 0 } - if (yr(selection)) { + if (cr(selection)) { return { node: selection.anchor.getNode(), offset: selection.anchor.offset } - } else if (xr(selection)) { + } else if (ur(selection)) { const [ node ] = selection.getNodes(); return { node, @@ -6539,8 +6563,8 @@ class Selection { let selectionState = null; this.editor.getEditorState().read(() => { - const selection = Lr(); - if (selection && yr(selection)) { + const selection = Nr(); + if (selection && cr(selection)) { selectionState = { anchor: { key: selection.anchor.key, offset: selection.anchor.offset }, focus: { key: selection.focus.key, offset: selection.focus.offset } @@ -6552,8 +6576,8 @@ class Selection { if (selectionState) { this.editor.update(() => { - const selection = Lr(); - if (selection && yr(selection)) { + const selection = Nr(); + if (selection && cr(selection)) { selection.anchor.set(selectionState.anchor.key, selectionState.anchor.offset, "text"); selection.focus.set(selectionState.focus.key, selectionState.focus.offset, "text"); } @@ -6562,8 +6586,8 @@ class Selection { } get hasSelectedWordsInSingleLine() { - const selection = Lr(); - if (!yr(selection)) return false + const selection = Nr(); + if (!cr(selection)) return false if (selection.isCollapsed()) return false @@ -6579,7 +6603,7 @@ class Selection { const nodes = selection.getNodes(); for (const node of nodes) { - if (jn(node)) { + if (Fn(node)) { return false } } @@ -6588,8 +6612,8 @@ class Selection { } get isInsideList() { - const selection = Lr(); - if (!yr(selection)) return false + const selection = Nr(); + if (!cr(selection)) return false const anchorNode = selection.anchor.getNode(); return getNearestListItemNode(anchorNode) !== null @@ -6599,11 +6623,11 @@ class Selection { const { anchorNode, offset } = this.#getCollapsedSelectionData(); if (!anchorNode) return null - if (lr(anchorNode)) { + if (Qn(anchorNode)) { return this.#getNodeAfterTextNode(anchorNode, offset) } - if (Si(anchorNode)) { + if (di(anchorNode)) { return this.#getNodeAfterElementNode(anchorNode, offset) } @@ -6614,11 +6638,11 @@ class Selection { const { anchorNode, offset } = this.#getCollapsedSelectionData(); if (!anchorNode) return null - if (lr(anchorNode)) { + if (Qn(anchorNode)) { return this.#getNextNodeFromTextEnd(anchorNode) } - if (Si(anchorNode)) { + if (di(anchorNode)) { return this.#getNodeAfterElementNode(anchorNode, offset) } @@ -6629,11 +6653,11 @@ class Selection { const { anchorNode, offset } = this.#getCollapsedSelectionData(); if (!anchorNode) return null - if (lr(anchorNode)) { + if (Qn(anchorNode)) { return this.#getNodeBeforeTextNode(anchorNode, offset) } - if (Si(anchorNode)) { + if (di(anchorNode)) { return this.#getNodeBeforeElementNode(anchorNode, offset) } @@ -6644,11 +6668,11 @@ class Selection { const { anchorNode, offset } = this.#getCollapsedSelectionData(); if (!anchorNode) return null - if (lr(anchorNode)) { + if (Qn(anchorNode)) { return this.#getPreviousNodeFromTextStart(anchorNode) } - if (Si(anchorNode)) { + if (di(anchorNode)) { return this.#getNodeBeforeElementNode(anchorNode, offset) } @@ -6664,8 +6688,8 @@ class Selection { this._currentlySelectedKeys = new Set(); - const selection = Lr(); - if (selection && xr(selection)) { + const selection = Nr(); + if (selection && ur(selection)) { for (const node of selection.getNodes()) { this._currentlySelectedKeys.add(node.getKey()); } @@ -6675,17 +6699,17 @@ class Selection { } #processSelectionChangeCommands() { - this.editor.registerCommand(Se$1, this.#selectPreviousNode.bind(this), zi); - this.editor.registerCommand(xe, this.#selectNextNode.bind(this), zi); - this.editor.registerCommand(ke$1, this.#selectPreviousTopLevelNode.bind(this), zi); - this.editor.registerCommand(Te$1, this.#selectNextTopLevelNode.bind(this), zi); + this.editor.registerCommand(Te, this.#selectPreviousNode.bind(this), Ii); + this.editor.registerCommand(ve, this.#selectNextNode.bind(this), Ii); + this.editor.registerCommand(Ne, this.#selectPreviousTopLevelNode.bind(this), Ii); + this.editor.registerCommand(we, this.#selectNextTopLevelNode.bind(this), Ii); - this.editor.registerCommand(Oe$1, this.#deleteSelectedOrNext.bind(this), zi); - this.editor.registerCommand(we$1, this.#deletePreviousOrNext.bind(this), zi); + this.editor.registerCommand(De, this.#deleteSelectedOrNext.bind(this), Ii); + this.editor.registerCommand(Ae, this.#deletePreviousOrNext.bind(this), Ii); - this.editor.registerCommand(ie$1, () => { - this.current = Lr(); - }, zi); + this.editor.registerCommand(le, () => { + this.current = Nr(); + }, Ii); } #listenForNodeSelections() { @@ -6694,11 +6718,11 @@ class Selection { const { key } = event.detail; this.editor.update(() => { - const node = xo(key); + const node = us(key); if (node) { - const selection = Pr(); + const selection = kr(); selection.add(node.getKey()); - wo(selection); + ms(selection); } this.editor.focus(); }); @@ -6716,20 +6740,20 @@ class Selection { this.editor.getRootElement().addEventListener("keydown", (event) => { if (isPrintableCharacter(event)) { this.editor.update(() => { - const selection = Lr(); + const selection = Nr(); - if (yr(selection) && selection.isCollapsed()) { + if (cr(selection) && selection.isCollapsed()) { const anchorNode = selection.anchor.getNode(); const offset = selection.anchor.offset; const nodeBefore = this.#getNodeBeforePosition(anchorNode, offset); const nodeAfter = this.#getNodeAfterPosition(anchorNode, offset); - if (nodeBefore instanceof ki && !nodeBefore.isInline()) { + if (nodeBefore instanceof gi && !nodeBefore.isInline()) { event.preventDefault(); this.#contents.createParagraphAfterNode(nodeBefore, event.key); return - } else if (nodeAfter instanceof ki && !nodeAfter.isInline()) { + } else if (nodeAfter instanceof gi && !nodeAfter.isInline()) { event.preventDefault(); this.#contents.createParagraphBeforeNode(nodeAfter, event.key); return @@ -6741,20 +6765,20 @@ class Selection { } #getNodeBeforePosition(node, offset) { - if (lr(node) && offset === 0) { + if (Qn(node) && offset === 0) { return node.getPreviousSibling() } - if (Si(node) && offset > 0) { + if (di(node) && offset > 0) { return node.getChildAtIndex(offset - 1) } return null } #getNodeAfterPosition(node, offset) { - if (lr(node) && offset === node.getTextContentSize()) { + if (Qn(node) && offset === node.getTextContentSize()) { return node.getNextSibling() } - if (Si(node)) { + if (di(node)) { return node.getChildAtIndex(offset) } return null @@ -6875,14 +6899,14 @@ class Selection { } #getTopLevelElementFromSelection() { - const selection = Lr(); + const selection = Nr(); if (!selection) return null - if (xr(selection)) { + if (ur(selection)) { return this.#getTopLevelFromNodeSelection(selection) } - if (yr(selection)) { + if (cr(selection)) { return this.#getTopLevelFromRangeSelection(selection) } @@ -6910,25 +6934,25 @@ class Selection { } #createAndSelectNewParagraph() { - const root = No(); - const newParagraph = Li(); + const root = ps(); + const newParagraph = Pi(); root.append(newParagraph); newParagraph.selectStart(); } #selectInLexical(node) { - if (!node || !(node instanceof ki)) return + if (!node || !(node instanceof gi)) return this.editor.update(() => { - const selection = Pr(); + const selection = kr(); selection.add(node.getKey()); - wo(selection); + ms(selection); }); } #deleteSelectedOrNext() { const node = this.nodeAfterCursor; - if (node instanceof ki) { + if (node instanceof gi) { this.#selectInLexical(node); return true } else { @@ -6940,7 +6964,7 @@ class Selection { #deletePreviousOrNext() { const node = this.nodeBeforeCursor; - if (node instanceof ki) { + if (node instanceof gi) { this.#selectInLexical(node); return true } else { @@ -6951,7 +6975,7 @@ class Selection { } #getValidSelectionRange() { - const lexicalSelection = Lr(); + const lexicalSelection = Nr(); if (!lexicalSelection || !lexicalSelection.isCollapsed()) return null const nativeSelection = window.getSelection(); @@ -7034,8 +7058,8 @@ class Selection { } #getCollapsedSelectionData() { - const selection = Lr(); - if (!yr(selection) || !selection.isCollapsed()) { + const selection = Nr(); + if (!cr(selection) || !selection.isCollapsed()) { return { anchorNode: null, offset: 0 } } @@ -7051,7 +7075,7 @@ class Selection { } #getNextNodeFromTextEnd(anchorNode) { - if (anchorNode.getNextSibling() instanceof ki) { + if (anchorNode.getNextSibling() instanceof gi) { return anchorNode.getNextSibling() } const parent = anchorNode.getParent(); @@ -7073,7 +7097,7 @@ class Selection { } #getPreviousNodeFromTextStart(anchorNode) { - if (anchorNode.getPreviousSibling() instanceof ki) { + if (anchorNode.getPreviousSibling() instanceof gi) { return anchorNode.getPreviousSibling() } const parent = anchorNode.getParent(); @@ -7104,7 +7128,7 @@ class Selection { } } -class CustomActionTextAttachmentNode extends ki { +class CustomActionTextAttachmentNode extends gi { static getType() { return "custom_action_text_attachment" } @@ -7131,7 +7155,7 @@ class CustomActionTextAttachmentNode extends ki { const nodes = []; const previousSibling = attachment.previousSibling; if (previousSibling && previousSibling.nodeType === Node.TEXT_NODE && /\s$/.test(previousSibling.textContent)) { - nodes.push(sr(" ")); + nodes.push(Xn(" ")); } nodes.push(new CustomActionTextAttachmentNode({ @@ -7140,7 +7164,7 @@ class CustomActionTextAttachmentNode extends ki { contentType: attachment.getAttribute("content-type") })); - nodes.push(sr(" ")); + nodes.push(Xn(" ")); return { node: nodes } }, @@ -7211,15 +7235,15 @@ class FormatEscaper { monitor() { this.editor.registerCommand( - Ne$1, + Ee, (event) => this.#handleEnterKey(event), - Bi + Ki ); } #handleEnterKey(event) { - const selection = Lr(); - if (!yr(selection)) return false + const selection = Nr(); + if (!cr(selection)) return false const anchorNode = selection.anchor.getNode(); @@ -7253,7 +7277,7 @@ class FormatEscaper { let currentNode = node; while (currentNode) { - if (Ot$1(currentNode)) { + if (wt$1(currentNode)) { return true } currentNode = currentNode.getParent(); @@ -7276,7 +7300,7 @@ class FormatEscaper { if (!this.#isNodeEmpty(paragraph)) return false const parent = paragraph.getParent(); - return parent && ot$2(parent) + return parent && Z$2(parent) } #isNodeEmpty(node) { @@ -7286,7 +7310,7 @@ class FormatEscaper { if (children.length === 0) return true return children.every(child => { - if (jn(child)) return true + if (Fn(child)) return true return this.#isNodeEmpty(child) }) } @@ -7295,7 +7319,7 @@ class FormatEscaper { let currentNode = node; while (currentNode) { - if (ot$2(currentNode)) { + if (Z$2(currentNode)) { return currentNode } currentNode = currentNode.getParent(); @@ -7309,10 +7333,10 @@ class FormatEscaper { if (!listItem) return const parentList = listItem.getParent(); - if (!parentList || !dt$1(parentList)) return + if (!parentList || !ot$2(parentList)) return const blockquote = parentList.getParent(); - const isInBlockquote = blockquote && Ot$1(blockquote); + const isInBlockquote = blockquote && wt$1(blockquote); if (isInBlockquote) { const listItemsAfter = this.#getListItemSiblingsAfter(listItem); @@ -7324,7 +7348,7 @@ class FormatEscaper { } } - const paragraph = Li(); + const paragraph = Pi(); parentList.insertAfter(paragraph); listItem.remove(); @@ -7338,14 +7362,14 @@ class FormatEscaper { if (!this.#isNodeEmpty(paragraph)) return false const parent = paragraph.getParent(); - return parent && Ot$1(parent) + return parent && wt$1(parent) } #getParagraphNode(node) { let currentNode = node; while (currentNode) { - if (Ii(currentNode)) { + if (Fi(currentNode)) { return currentNode } currentNode = currentNode.getParent(); @@ -7359,7 +7383,7 @@ class FormatEscaper { if (!paragraph) return const blockquote = paragraph.getParent(); - if (!blockquote || !Ot$1(blockquote)) return + if (!blockquote || !wt$1(blockquote)) return const siblingsAfter = this.#getSiblingsAfter(paragraph); const nonEmptySiblings = siblingsAfter.filter(sibling => !this.#isNodeEmpty(sibling)); @@ -7367,7 +7391,7 @@ class FormatEscaper { if (nonEmptySiblings.length > 0) { this.#splitBlockquote(blockquote, paragraph, nonEmptySiblings); } else { - const newParagraph = Li(); + const newParagraph = Pi(); blockquote.insertAfter(newParagraph); paragraph.remove(); newParagraph.selectStart(); @@ -7391,7 +7415,7 @@ class FormatEscaper { let sibling = listItem.getNextSibling(); while (sibling) { - if (ot$2(sibling)) { + if (Z$2(sibling)) { siblings.push(sibling); } sibling = sibling.getNextSibling(); @@ -7404,12 +7428,12 @@ class FormatEscaper { const blockquoteSiblingsAfterList = this.#getSiblingsAfter(parentList); const nonEmptyBlockquoteSiblings = blockquoteSiblingsAfterList.filter(sibling => !this.#isNodeEmpty(sibling)); - const middleParagraph = Li(); + const middleParagraph = Pi(); blockquote.insertAfter(middleParagraph); - const newList = ht$3(parentList.getListType()); + const newList = st$2(parentList.getListType()); - const newBlockquote = _t$1(); + const newBlockquote = xt$2(); middleParagraph.insertAfter(newBlockquote); newBlockquote.append(newList); @@ -7443,7 +7467,7 @@ class FormatEscaper { const items = list.getChildren(); for (let i = items.length - 1; i >= 0; i--) { const item = items[i]; - if (ot$2(item) && this.#isNodeEmpty(item)) { + if (Z$2(item) && this.#isNodeEmpty(item)) { item.remove(); } else { break @@ -7464,10 +7488,10 @@ class FormatEscaper { } #splitBlockquote(blockquote, emptyParagraph, siblingsAfter) { - const newParagraph = Li(); + const newParagraph = Pi(); blockquote.insertAfter(newParagraph); - const newBlockquote = _t$1(); + const newBlockquote = xt$2(); newParagraph.insertAfter(newBlockquote); siblingsAfter.forEach(sibling => { @@ -7493,27 +7517,27 @@ class Contents { insertHtml(html) { this.editor.update(() => { - const selection = Lr(); + const selection = Nr(); - if (!yr(selection)) return + if (!cr(selection)) return - const nodes = m$1(this.editor, parseHtml(html)); + const nodes = h$2(this.editor, parseHtml(html)); selection.insertNodes(nodes); }); } insertAtCursor(node) { this.editor.update(() => { - const selection = Lr(); + const selection = Nr(); const selectedNodes = selection?.getNodes(); - if (yr(selection)) { - jr([ node ]); - } else if (xr(selection) && selectedNodes && selectedNodes.length > 0) { + if (cr(selection)) { + Fr([ node ]); + } else if (ur(selection) && selectedNodes && selectedNodes.length > 0) { const lastNode = selectedNodes[selectedNodes.length - 1]; lastNode.insertAfter(node); } else { - const root = No(); + const root = ps(); root.append(node); } }); @@ -7526,8 +7550,8 @@ class Contents { insertNodeWrappingEachSelectedLine(newNodeFn) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const selectedNodes = selection.extract(); @@ -7545,8 +7569,8 @@ class Contents { toggleNodeWrappingAllSelectedLines(isFormatAppliedFn, newNodeFn) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow(); @@ -7561,8 +7585,8 @@ class Contents { toggleNodeWrappingAllSelectedNodes(isFormatAppliedFn, newNodeFn) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const topLevelElement = selection.anchor.getNode().getTopLevelElement(); @@ -7577,11 +7601,11 @@ class Contents { removeFormattingFromSelectedLines() { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow(); - const paragraph = Li(); + const paragraph = Pi(); paragraph.append(...topLevelElement.getChildren()); topLevelElement.replace(paragraph); }); @@ -7591,8 +7615,8 @@ class Contents { let result = false; this.editor.read(() => { - const selection = Lr(); - result = yr(selection) && !selection.isCollapsed(); + const selection = Nr(); + result = cr(selection) && !selection.isCollapsed(); }); return result @@ -7600,8 +7624,8 @@ class Contents { unwrapSelectedListItems() { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const { listItems, parentLists } = this.#collectSelectedListItems(selection); if (listItems.size > 0) { @@ -7616,12 +7640,12 @@ class Contents { let linkNodeKey = null; this.editor.update(() => { - const textNode = sr(url); - const linkNode = D$1(url); + const textNode = Xn(url); + const linkNode = d(url); linkNode.append(textNode); - const selection = Lr(); - if (yr(selection)) { + const selection = Nr(); + if (cr(selection)) { selection.insertNodes([ linkNode ]); linkNodeKey = linkNode.getKey(); } @@ -7634,7 +7658,7 @@ class Contents { if (!this.hasSelectedText()) return this.editor.update(() => { - J$1(url); + v$1(url); }); } @@ -7642,13 +7666,13 @@ class Contents { let result = ""; this.editor.getEditorState().read(() => { - const selection = Lr(); + const selection = Nr(); if (!selection || !selection.isCollapsed()) return const anchor = selection.anchor; const anchorNode = anchor.getNode(); - if (!lr(anchorNode)) return + if (!Qn(anchorNode)) return const fullText = anchorNode.getTextContent(); const offset = anchor.offset; @@ -7668,13 +7692,13 @@ class Contents { let result = false; this.editor.getEditorState().read(() => { - const selection = Lr(); + const selection = Nr(); if (!selection || !selection.isCollapsed()) return const anchor = selection.anchor; const anchorNode = anchor.getNode(); - if (!lr(anchorNode)) return + if (!Qn(anchorNode)) return const fullText = anchorNode.getTextContent(); const offset = anchor.offset; @@ -7702,56 +7726,85 @@ class Contents { } createParagraphAfterNode(node, text) { - const newParagraph = Li(); + const newParagraph = Pi(); node.insertAfter(newParagraph); newParagraph.selectStart(); // Insert the typed text if (text) { - newParagraph.append(sr(text)); + newParagraph.append(Xn(text)); newParagraph.select(1, 1); // Place cursor after the text } } createParagraphBeforeNode(node, text) { - const newParagraph = Li(); + const newParagraph = Pi(); node.insertBefore(newParagraph); newParagraph.selectStart(); // Insert the typed text if (text) { - newParagraph.append(sr(text)); + newParagraph.append(Xn(text)); newParagraph.select(1, 1); // Place cursor after the text } } uploadFile(file) { + this.uploadFiles([file]); + } + + uploadFiles(files) { if (!this.editorElement.supportsAttachments) { console.warn("This editor does not supports attachments (it's configured with [attachments=false])"); return } - if (!this.#shouldUploadFile(file)) { - return - } + const validFiles = files.filter(file => this.#shouldUploadFile(file)); + if (validFiles.length === 0) return const uploadUrl = this.editorElement.directUploadUrl; const blobUrlTemplate = this.editorElement.blobUrlTemplate; this.editor.update(() => { - const uploadedImageNode = new ActionTextAttachmentUploadNode({ file: file, uploadUrl: uploadUrl, blobUrlTemplate: blobUrlTemplate, editor: this.editor }); - this.insertAtCursor(uploadedImageNode); - }, { tag: Dn }); + const selection = Nr(); + const anchorNode = selection?.anchor.getNode(); + const currentParagraph = anchorNode?.getTopLevelElement(); + + const uploadNodes = validFiles.map(file => + new ActionTextAttachmentUploadNode({ + file: file, + uploadUrl: uploadUrl, + blobUrlTemplate: blobUrlTemplate, + editor: this.editor + }) + ); + + // Wrap multiple files in a gallery, insert single files directly + const nodeToInsert = uploadNodes.length >= 2 + ? this.#createGalleryWithNodes(uploadNodes) + : uploadNodes[0]; + + this.#insertNode(nodeToInsert, currentParagraph); + + // If we inserted a gallery, move cursor outside of it + if (uploadNodes.length >= 2) { + this.#selectOutsideNode(nodeToInsert); + } + }, { tag: Ti }); } async deleteSelectedNodes() { let focusNode = null; + let parentWasGallery = false; this.editor.update(() => { - if (xr(this.#selection.current)) { + if (ur(this.#selection.current)) { const nodesToRemove = this.#selection.current.getNodes(); if (nodesToRemove.length === 0) return + const parent = nodesToRemove[0]?.getParent(); + parentWasGallery = parent?.getType() === 'attachment_gallery'; + focusNode = this.#findAdjacentNodeTo(nodesToRemove); this.#deleteNodes(nodesToRemove); } @@ -7760,7 +7813,20 @@ class Contents { await nextFrame(); this.editor.update(() => { - this.#selectAfterDeletion(focusNode); + if (parentWasGallery) { + // Get the gallery node from the focus node + const galleryNode = focusNode?.getParent?.()?.getType?.() === 'attachment_gallery' + ? focusNode.getParent() + : focusNode; + + if (galleryNode?.getType?.() === 'attachment_gallery') { + this.#selectOutsideNode(galleryNode); + } else { + this.#selectAfterDeletion(focusNode); + } + } else { + this.#selectAfterDeletion(focusNode); + } this.#selection.clear(); this.editor.focus(); }); @@ -7768,18 +7834,18 @@ class Contents { replaceNodeWithHTML(nodeKey, html, options = {}) { this.editor.update(() => { - const node = xo(nodeKey); + const node = us(nodeKey); if (!node) return - const selection = Lr(); + const selection = Nr(); let wasSelected = false; - if (yr(selection)) { + if (cr(selection)) { const selectedNodes = selection.getNodes(); wasSelected = selectedNodes.includes(node) || selectedNodes.some(n => n.getParent() === node); if (wasSelected) { - wo(null); + ms(null); } } @@ -7794,7 +7860,7 @@ class Contents { insertHTMLBelowNode(nodeKey, html, options = {}) { this.editor.update(() => { - const node = xo(nodeKey); + const node = us(nodeKey); if (!node) return const previousNode = node.getTopLevelElement() || node; @@ -7812,7 +7878,7 @@ class Contents { this.editor.update(() => { const nextSibling = node.getNextSibling(); if (!nextSibling) { - const newParagraph = Li(); + const newParagraph = Pi(); node.insertAfter(newParagraph); newParagraph.selectStart(); } @@ -7831,8 +7897,8 @@ class Contents { #insertNodeWrappingAllSelectedNodes(newNodeFn) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return const selectedNodes = selection.extract(); if (selectedNodes.length === 0) { @@ -7857,7 +7923,7 @@ class Contents { wrappingNode.append(element); }); - wo(null); + ms(null); }); } @@ -7867,7 +7933,7 @@ class Contents { // Find the last non-empty paragraph while (lastNonEmptyIndex >= 0) { const element = elements[lastNonEmptyIndex]; - if (!Ii(element) || !this.#isElementEmpty(element)) { + if (!Fi(element) || !this.#isElementEmpty(element)) { break } lastNonEmptyIndex--; @@ -7882,14 +7948,14 @@ class Contents { // Check if it only contains line breaks const children = element.getChildren(); - return children.length === 0 || children.every(child => jn(child)) + return children.length === 0 || children.every(child => Fn(child)) } #removeStandaloneEmptyParagraph() { - const root = No(); + const root = ps(); if (root.getChildrenSize() === 1) { const firstChild = root.getFirstChild(); - if (firstChild && Ii(firstChild) && this.#isElementEmpty(firstChild)) { + if (firstChild && Fi(firstChild) && this.#isElementEmpty(firstChild)) { firstChild.remove(); } } @@ -7897,8 +7963,8 @@ class Contents { #insertNodeWrappingAllSelectedLines(newNodeFn) { this.editor.update(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return if (selection.isCollapsed()) { this.#wrapCurrentLine(selection, newNodeFn); @@ -7917,7 +7983,7 @@ class Contents { wrappingNode.append(...topLevelElement.getChildren()); topLevelElement.replace(wrappingNode); } else { - jr([ newNodeFn() ]); + Fr([ newNodeFn() ]); } } @@ -7939,13 +8005,13 @@ class Contents { .map((node) => this.#getParagraphFromNode(node)) .filter(Boolean); - wo(null); + ms(null); return selectedParagraphs } #getParagraphFromNode(node) { - if (Ii(node)) return node - if (lr(node) && node.getParent() && Ii(node.getParent())) { + if (Fi(node)) return node + if (Qn(node) && node.getParent() && Fi(node.getParent())) { return node.getParent() } return null @@ -7973,9 +8039,9 @@ class Contents { const lines = Array.from(lineSet); lines.forEach((lineText, index) => { - wrappingNode.append(sr(lineText)); + wrappingNode.append(Xn(lineText)); if (index < lines.length - 1) { - wrappingNode.append(Jn()); + wrappingNode.append(Pn()); } }); @@ -7998,9 +8064,16 @@ class Contents { // Use splice() instead of node.remove() for proper removal and // reconciliation. Would have issues with removing unintended decorator nodes // with node.remove() + const galleriesToUpdate = new Map(); + nodes.forEach((node) => { const parent = node.getParent(); - if (!Si(parent)) return + if (!di(parent)) return + + // Track gallery parents that need DOM updates + if (parent.getType() === 'attachment_gallery') { + galleriesToUpdate.set(parent.getKey(), parent); + } const children = parent.getChildren(); const index = children.indexOf(node); @@ -8009,6 +8082,11 @@ class Contents { parent.splice(index, 1, []); } }); + + // Update gallery DOM and remove if empty/single child + galleriesToUpdate.forEach((gallery, galleryKey) => { + this.#updateOrRemoveGallery(gallery, galleryKey); + }); } #findAdjacentNodeTo(nodes) { @@ -8019,13 +8097,13 @@ class Contents { } #selectAfterDeletion(focusNode) { - const root = No(); + const root = ps(); if (root.getChildrenSize() === 0) { - const newParagraph = Li(); + const newParagraph = Pi(); root.append(newParagraph); newParagraph.selectStart(); } else if (focusNode) { - if (lr(focusNode) || Ii(focusNode)) { + if (Qn(focusNode) || Fi(focusNode)) { focusNode.selectEnd(); } else { focusNode.selectNext(0, 0); @@ -8043,7 +8121,7 @@ class Contents { if (listItem) { listItems.add(listItem); const parentList = listItem.getParent(); - if (parentList && dt$1(parentList)) { + if (parentList && ot$2(parentList)) { parentLists.add(parentList); } } @@ -8067,9 +8145,9 @@ class Contents { #convertListItemToParagraph(listItem) { const parentList = listItem.getParent(); - if (!parentList || !dt$1(parentList)) return null + if (!parentList || !ot$2(parentList)) return null - const paragraph = Li(); + const paragraph = Pi(); const sublists = this.#extractSublistsAndContent(listItem, paragraph); listItem.insertAfter(paragraph); @@ -8083,7 +8161,7 @@ class Contents { const sublists = []; listItem.getChildren().forEach((child) => { - if (dt$1(child)) { + if (ot$2(child)) { sublists.push(child); } else { paragraph.append(child); @@ -8101,7 +8179,7 @@ class Contents { #removeEmptyParentLists(parentLists) { for (const parentList of parentLists) { - if (dt$1(parentList) && parentList.getChildrenSize() === 0) { + if (ot$2(parentList) && parentList.getChildrenSize() === 0) { parentList.remove(); } } @@ -8122,21 +8200,21 @@ class Contents { #selectParagraphRange(firstParagraph, lastParagraph) { firstParagraph.selectStart(); - const currentSelection = Lr(); - if (currentSelection && yr(currentSelection)) { + const currentSelection = Nr(); + if (currentSelection && cr(currentSelection)) { currentSelection.anchor.set(firstParagraph.getKey(), 0, "element"); currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), "element"); } } #getTextAnchorData() { - const selection = Lr(); + const selection = Nr(); if (!selection || !selection.isCollapsed()) return { anchorNode: null, offset: 0 } const anchor = selection.anchor; const anchorNode = anchor.getNode(); - if (!lr(anchorNode)) return { anchorNode: null, offset: 0 } + if (!Qn(anchorNode)) return { anchorNode: null, offset: 0 } return { anchorNode, offset: anchor.offset } } @@ -8152,8 +8230,8 @@ class Contents { const textBeforeString = fullText.slice(0, lastIndex); const textAfterCursor = fullText.slice(offset); - const textNodeBefore = sr(textBeforeString); - const textNodeAfter = sr(textAfterCursor || " "); + const textNodeBefore = Xn(textBeforeString); + const textNodeAfter = Xn(textAfterCursor || " "); anchorNode.replace(textNodeBefore); @@ -8175,13 +8253,13 @@ class Contents { } #appendLineBreakIfNeeded(paragraph) { - if (Ii(paragraph) && !this.editorElement.isSingleLineMode) { + if (Fi(paragraph) && !this.editorElement.isSingleLineMode) { const children = paragraph.getChildren(); const last = children[children.length - 1]; const beforeLast = children[children.length - 2]; - if (lr(last) && last.getTextContent() === "" && (beforeLast && !lr(beforeLast))) { - paragraph.append(Jn()); + if (Qn(last) && last.getTextContent() === "" && (beforeLast && !Qn(beforeLast))) { + paragraph.append(Pn()); } } } @@ -8197,86 +8275,63 @@ class Contents { } #createHtmlNodeWith(html) { - const htmlNodes = m$1(this.editor, parseHtml(html)); - return htmlNodes[0] || Li() + const htmlNodes = h$2(this.editor, parseHtml(html)); + return htmlNodes[0] || Pi() } #shouldUploadFile(file) { return dispatch(this.editorElement, "lexxy:file-accept", { file }, true) } -} -/** - * marked v16.4.1 - a markdown parser - * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - */ + #createGalleryWithNodes(uploadNodes) { + const gallery = $createAttachmentGalleryNode(); + uploadNodes.forEach(node => gallery.append(node)); + return gallery + } -/** - * DO NOT EDIT THIS FILE - * The code in this file is generated from files in ./src/ - */ + #insertNode(node, currentParagraph) { + if (currentParagraph && Fi(currentParagraph) && currentParagraph.getChildrenSize() === 0) { + currentParagraph.replace(node); + // If we're replacing an empty paragraph with a gallery, ensure there's a paragraph after for cursor placement + if (node.getType() === 'attachment_gallery') { + const newParagraph = Pi(); + node.insertAfter(newParagraph); + } + } else if (currentParagraph && di(currentParagraph)) { + currentParagraph.insertAfter(node); + } else { + Fr([node]); + } + } + + #selectOutsideNode(node) { + const nextNode = node.getNextSibling(); + if (nextNode && (Qn(nextNode) || Fi(nextNode))) { + nextNode.selectStart(); + } else { + // If there's no suitable next node, create a new paragraph after the gallery + const newParagraph = Pi(); + node.insertAfter(newParagraph); + newParagraph.selectStart(); + } + } + + #updateOrRemoveGallery(gallery, galleryKey) { + const childCount = gallery.getChildrenSize(); -function L(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var T=L();function G(u){T=u;}var I={exec:()=>null};function h(u,e=""){let t=typeof u=="string"?u:u.source,n={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(m.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var m={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:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,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+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:u=>new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}#`),htmlBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}<(?:[a-z].*>|!--)`,"i")},be=/^(?:[ \t]*(?:\n|$))+/,Re=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Oe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F=/(?:[*+-]|\d{1,9}[.)])/,ie=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oe=h(ie).replace(/bull/g,F).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(),we=h(ie).replace(/bull/g,F).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(),j=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ye=/^[^\n]+/,Q=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Pe=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Se=h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F).getRegex(),v="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",U=/|$))/,$e=h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae=h(j).replace("hr",E).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),_e=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ae).getRegex(),K={blockquote:_e,code:Re,def:Pe,fences:Te,heading:Oe,hr:E,html:$e,lheading:oe,list:Se,newline:be,paragraph:ae,table:I,text:ye},re=h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",E).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Le={...K,lheading:we,table:re,paragraph:h(j).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},Me={...K,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(j).replace("hr",E).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",oe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ze=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ae=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,le=/^( {2,}|\\)\n(?!\s*$)/,Ie=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ce=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ve=h(ce,"u").replace(/punct/g,D).getRegex(),De=h(ce,"u").replace(/punct/g,pe).getRegex(),he="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",He=h(he,"gu").replace(/notPunctSpace/g,ue).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ze=h(he,"gu").replace(/notPunctSpace/g,Be).replace(/punctSpace/g,Ce).replace(/punct/g,pe).getRegex(),Ge=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ue).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ne=h(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),Fe=h(/^<(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(),je=h(U).replace("(?:-->|$)","-->").getRegex(),Qe=h("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ue=h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),de=h(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",Q).getRegex(),ke=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),Ke=h("reflink|nolink(?!\\()","g").replace("reflink",de).replace("nolink",ke).getRegex(),se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:I,anyPunctuation:Ne,autolink:Fe,blockSkip:qe,br:le,code:Ae,del:I,emStrongLDelim:ve,emStrongRDelimAst:He,emStrongRDelimUnd:Ge,escape:ze,link:Ue,nolink:ke,punctuation:Ee,reflink:de,reflinkSearch:Ke,tag:Qe,text:Ie,url:I},We={...X,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...X,emStrongRDelimAst:Ze,emStrongLDelim:De,url:h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",se).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:h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},ge=u=>Je[u];function w(u,e){if(e){if(m.escapeTest.test(u))return u.replace(m.escapeReplace,ge)}else if(m.escapeTestNoEncode.test(u))return u.replace(m.escapeReplaceNoEncode,ge);return u}function J(u){try{u=encodeURI(u).replace(m.percentDecode,"%");}catch{return null}return u}function V(u,e){let t=u.replace(m.findPipe,(i,s,o)=>{let a=false,l=s;for(;--l>=0&&o[l]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length0?-2:-1}function me(u,e,t,n,r){let i=e.href,s=e.title||null,o=u[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:u[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Ve(u,e,t){let n=u.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(` -`).map(i=>{let s=i.match(t.other.beginningSpace);if(s===null)return i;let[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(` -`)}var y=class{options;rules;lexer;constructor(e){this.options=e||T;}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 n=t[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:z(n,` -`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Ve(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=z(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim());}return {type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:z(t[0],` -`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=z(t[0],` -`).split(` -`),r="",i="",s=[];for(;n.length>0;){let o=false,a=[],l;for(l=0;l1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:false,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=false;for(;e;){let l=false,c="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let g=t[2].split(` -`,1)[0].replace(this.rules.other.listReplaceTabs,H=>" ".repeat(3*H.length)),d=e.split(` -`,1)[0],R=!g.trim(),f=0;if(this.options.pedantic?(f=2,p=g.trimStart()):R?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,p=g.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(d)&&(c+=d+` -`,e=e.substring(d.length+1),l=true),!l){let H=this.rules.other.nextBulletRegex(f),ee=this.rules.other.hrRegex(f),te=this.rules.other.fencesBeginRegex(f),ne=this.rules.other.headingBeginRegex(f),xe=this.rules.other.htmlBeginRegex(f);for(;e;){let Z=e.split(` -`,1)[0],A;if(d=Z,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),A=d):A=d.replace(this.rules.other.tabCharGlobal," "),te.test(d)||ne.test(d)||xe.test(d)||H.test(d)||ee.test(d))break;if(A.search(this.rules.other.nonSpaceChar)>=f||!d.trim())p+=` -`+A.slice(f);else {if(R||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(g)||ne.test(g)||ee.test(g))break;p+=` -`+d;}!R&&!d.trim()&&(R=true),c+=Z+` -`,e=e.substring(Z.length+1),g=A.slice(f);}}i.loose||(o?i.loose=true:this.rules.other.doubleBlankLine.test(c)&&(o=true));let O=null,Y;this.options.gfm&&(O=this.rules.other.listIsTask.exec(p),O&&(Y=O[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:c,task:!!O,checked:Y,loose:false,text:p,tokens:[]}),i.raw+=c;}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;lg.type==="space"),p=c.length>0&&c.some(g=>this.rules.other.anyLine.test(g.raw));i.loose=p;}if(i.loose)for(let l=0;l({text:a,tokens:this.lexer.inline(a),header:false,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return {type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` -`?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}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=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=z(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=fe(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]="";}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3]);}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),me(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.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 r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return {type:"text",raw:s,text:s}}return me(n,i,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))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,o,a,l=s,c=0,p=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(r=p.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let g=[...r[0]][0].length,d=e.slice(0,s+r.index+g+a);if(Math.min(s,a)%2){let f=d.slice(1,-1);return {type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let R=d.slice(2,-2);return {type:"strong",raw:d,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}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 n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0];}return {type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class u{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||T,this.options.tokenizer=this.options.tokenizer||new y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:C.normal,inline:M.normal};this.options.pedantic?(t.block=C.pedantic,t.inline=M.pedantic):this.options.gfm&&(t.block=C.gfm,this.options.breaks?t.inline=M.breaks:t.inline=M.gfm),this.tokenizer.rules=t;}static get rules(){return {block:C,inline:M}}static lex(e,t){return new u(t).lex(e)}static lexInline(e,t){return new u(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,` -`),this.blockTokens(e,this.tokens);for(let t=0;t(r=s.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);r.raw.length===1&&s!==void 0?s.raw+=` -`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` -`)?"":` -`)+r.raw,s.text+=` -`+r.text,this.inlineQueue.at(-1).src=s.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 s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` -`)?"":` -`)+r.raw,s.text+=` -`+r.raw,this.inlineQueue.at(-1).src=s.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 s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(l=>{a=l.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` -`)?"":` -`)+r.raw,s.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(` -`)?"":` -`)+r.raw,s.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,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 o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.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);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=false,s="";for(;e;){i||(s=""),i=false;let o;if(this.options.extensions?.inline?.some(l=>(o=l.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let l=t.at(-1);o.type==="text"&&l?.type==="text"?(l.raw+=o.raw,l.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,s)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let a=e;if(this.options.extensions?.startInline){let l=1/0,c=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},c),typeof p=="number"&&p>=0&&(l=Math.min(l,p));}),l<1/0&&l>=0&&(a=e.substring(0,l+1));}if(o=this.tokenizer.inlineText(a)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=true;let l=t.at(-1);l?.type==="text"?(l.raw+=o.raw,l.text+=o.text):t.push(o);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return t}};var P=class{options;parser;constructor(e){this.options=e||T;}space(e){return ""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+` -`;return r?'
'+(n?i:w(i,true))+`
-`:"
"+(n?i:w(i,true))+`
-`}blockquote({tokens:e}){return `
-${this.parser.parse(e)}
-`}html({text:e}){return e}def(e){return ""}heading({tokens:e,depth:t}){return `${this.parser.parseInline(e)} -`}hr(e){return `
-`}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o -`+r+" -`}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+" "+w(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=true)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:true}):t+=n+" ";}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • -`}checkbox({checked:e}){return "'}paragraph({tokens:e}){return `

    ${this.parser.parseInline(e)}

    -`}table(e){let t="",n="";for(let i=0;i${r}`),` - -`+t+` -`+r+`
    -`}tablerow({text:e}){return ` -${e} -`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` -`}strong({tokens:e}){return `${this.parser.parseInline(e)}`}em({tokens:e}){return `${this.parser.parseInline(e)}`}codespan({text:e}){return `${w(e,true)}`}br(e){return "
    "}del({tokens:e}){return `${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=J(e);if(i===null)return r;e=i;let s='
    ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=J(e);if(i===null)return w(n);e=i;let s=`${n}{let o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===false&&(a=s.apply(this,o)),a}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new P(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=n.renderer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p||""};}r.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new y(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=n.tokenizer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p};}r.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new S;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=n.hooks[o],l=i[o];S.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&S.passThroughHooksRespectAsync.has(s))return (async()=>{let g=await a.call(i,c);return l.call(i,g)})();let p=a.call(i,c);return l.call(i,p)}:i[o]=(...c)=>{if(this.defaults.async)return (async()=>{let g=await a.apply(i,c);return g===false&&(g=await l.apply(i,c)),g})();let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p};}r.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a};}this.defaults={...this.defaults,...r};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,r)=>{let i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===true&&i.async===false)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return (async()=>{let a=s.hooks?await s.hooks.preprocess(n):n,c=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(a,s),p=s.hooks?await s.hooks.processAllTokens(c):c;s.walkTokens&&await Promise.all(this.walkTokens(p,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(p,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let p=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(a){return o(a)}}}onError(e,t){return n=>{if(n.message+=` -Please report this to https://github.com/markedjs/marked.`,e){let r="

    An error occurred:

    "+w(n.message+"",true)+"
    ";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var _=new B;function k(u,e){return _.parse(u,e)}k.options=k.setOptions=function(u){return _.setOptions(u),k.defaults=_.defaults,G(k.defaults),k};k.getDefaults=L;k.defaults=T;k.use=function(...u){return _.use(...u),k.defaults=_.defaults,G(k.defaults),k};k.walkTokens=function(u,e){return _.walkTokens(u,e)};k.parseInline=_.parseInline;k.Parser=b;k.parser=b.parse;k.Renderer=P;k.TextRenderer=$;k.Lexer=x;k.lexer=x.lex;k.Tokenizer=y;k.Hooks=S;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;b.parse;x.lex; + // If gallery is empty or has only one child, unwrap it + if (childCount <= 1) { + gallery.getChildren().forEach(child => gallery.insertBefore(child)); + gallery.remove(); + } else { + // Update the gallery's className to reflect new child count + const dom = this.editor.getElementByKey(galleryKey); + if (dom) { + dom.className = `attachment-gallery attachment-gallery--${childCount}`; + } + } + } +} function isUrl(string) { try { @@ -8327,13 +8382,13 @@ class Clipboard { let result = false; this.editor.getEditorState().read(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return let currentNode = selection.anchor.getNode(); while (currentNode) { - if (X$1(currentNode)) { + if (I(currentNode)) { result = true; return } @@ -8371,7 +8426,7 @@ class Clipboard { } #pasteMarkdown(text) { - const html = k(text); + const html = marked(text); this.contents.insertHtml(html); } @@ -8413,7 +8468,7 @@ class Highlighter { toggle(styles) { this.editor.update(() => { this.#toggleSelectionStyles(styles); - j$2(node => this.#syncHighlightWithStyle(node)); + L$2(node => this.#syncHighlightWithStyle(node)); }); } @@ -8422,12 +8477,12 @@ class Highlighter { } #toggleSelectionStyles(styles) { - const selection = Lr(); + const selection = Nr(); for (const property in styles) { - const oldValue = le$1(selection, property); + const oldValue = Y$3(selection, property); const patch = { [property]: this.#toggleOrReplace(oldValue, styles[property]) }; - U$5(selection, patch); + M$6(selection, patch); } } @@ -8442,14 +8497,14 @@ class Highlighter { } #hasHighlightStyles(node) { - const styles = b$3(node.getStyle()); + const styles = B$1(node.getStyle()); return !!(styles.color || styles["background-color"]) } } -class HighlightNode extends Xn { +class HighlightNode extends Jn { $config() { - return this.config("highlight", { extends: Xn }) + return this.config("highlight", { extends: Jn }) } static importDOM() { @@ -8478,9 +8533,9 @@ function applyHighlightStyle(textNode, element) { const TRIX_LANGUAGE_ATTR = "language"; -class TrixTextNode extends Xn { +class TrixTextNode extends Jn { $config() { - return this.config("trix-text", { extends: Xn }) + return this.config("trix-text", { extends: Jn }) } static importDOM() { @@ -8505,7 +8560,7 @@ class TrixTextNode extends Xn { }), // read "language" attribute and normalize pre: (element) => onlyPreLanguageElements(element, { - conversion: extendConversion(q$1, "pre", applyLanguage), + conversion: extendConversion(K, "pre", applyLanguage), priority: 1 }) } @@ -8527,7 +8582,7 @@ function onlyPreLanguageElements(element, conversion) { } function applyLanguage(conversionOutput, element) { - const language = dt(element.getAttribute(TRIX_LANGUAGE_ATTR)); + const language = Z$1(element.getAttribute(TRIX_LANGUAGE_ATTR)); conversionOutput.node.setLanguage(language); } @@ -8582,7 +8637,7 @@ class LexicalEditorElement extends HTMLElement { formResetCallback() { this.value = this.#initialValue; - this.editor.dispatchCommand(je$1, undefined); + this.editor.dispatchCommand(Ve, undefined); } get form() { @@ -8623,7 +8678,7 @@ class LexicalEditorElement extends HTMLElement { get value() { if (!this.cachedValue) { this.editor?.getEditorState().read(() => { - this.cachedValue = sanitize(g(this.editor, null)); + this.cachedValue = sanitize(m$2(this.editor, null)); }); } @@ -8632,8 +8687,8 @@ class LexicalEditorElement extends HTMLElement { set value(html) { this.editor.update(() => { - ns(zn); - const root = No(); + Ys(Mi); + const root = ps(); root.clear(); if (html !== "") root.append(...this.#parseHtmlIntoLexicalNodes(html)); root.select(); @@ -8649,13 +8704,13 @@ class LexicalEditorElement extends HTMLElement { #parseHtmlIntoLexicalNodes(html) { if (!html) html = "

    "; - const nodes = m$1(this.editor, parseHtml(`
    ${html}
    `)); + const nodes = h$2(this.editor, parseHtml(`
    ${html}
    `)); // Custom decorator block elements such action-text-attachments get wrapped into

    automatically by Lexical. // We flatten those. return nodes.map(node => { if (node.getType() === "paragraph" && node.getChildrenSize() === 1) { const child = node.getFirstChild(); - if (child instanceof ki && !child.isInline()) { + if (child instanceof gi && !child.isInline()) { return child } } @@ -8678,7 +8733,7 @@ class LexicalEditorElement extends HTMLElement { #createEditor() { this.editorContentElement = this.editorContentElement || this.#createEditorContentElement(); - const editor = $i({ + const editor = Wi({ namespace: "LexicalEditor", onError(error) { throw error @@ -8696,21 +8751,21 @@ class LexicalEditorElement extends HTMLElement { const nodes = [ TrixTextNode, HighlightNode, - Et$2, - Pt$2, - lt$2, - nt$2, - q$1, - et$1, - y$1, - A, + Dt, + Nt$2, + tt$1, + j$1, + K, + rt, + g$1, + m$1, HorizontalDividerNode, CustomActionTextAttachmentNode, ]; if (this.supportsAttachments) { - nodes.push(ActionTextAttachmentNode, ActionTextAttachmentUploadNode); + nodes.push(ActionTextAttachmentNode, ActionTextAttachmentUploadNode, AttachmentGalleryNode); } return nodes @@ -8798,16 +8853,16 @@ class LexicalEditorElement extends HTMLElement { } #registerComponents() { - Jt(this.editor); - this.historyState = w$1(); - b$1(this.editor, this.historyState, 20); - bt$3(this.editor); + Mt(this.editor); + this.historyState = E(); + v(this.editor, this.historyState, 20); + _t$3(this.editor); this.#registerCodeHiglightingComponents(); - Dt(this.editor, zt); + et(this.editor, Bt); } #registerCodeHiglightingComponents() { - Et$1(this.editor); + Nt$1(this.editor); this.append(createElement("lexxy-code-language-picker")); } @@ -8816,7 +8871,7 @@ class LexicalEditorElement extends HTMLElement { const { key, values } = event.detail; this.editor.update(() => { - const node = xo(key); + const node = us(key); if (node instanceof ActionTextAttachmentNode) { const updatedNode = node.getWritable(); @@ -8829,7 +8884,7 @@ class LexicalEditorElement extends HTMLElement { #handleEnter() { // We can't prevent these externally using regular keydown because Lexical handles it first. this.editor.registerCommand( - Ne$1, + Ee, (event) => { // Prevent CTRL+ENTER if (event.ctrlKey || event.metaKey) { @@ -8845,7 +8900,7 @@ class LexicalEditorElement extends HTMLElement { return false }, - Ri + zi ); } @@ -8853,8 +8908,8 @@ class LexicalEditorElement extends HTMLElement { // Lexxy handles focus and blur as commands // see https://github.com/facebook/lexical/blob/d1a8e84fe9063a4f817655b346b6ff373aa107f0/packages/lexical/src/LexicalEvents.ts#L35 // and https://stackoverflow.com/a/72212077 - this.editor.registerCommand(Ye, () => { dispatch(this, "lexxy:blur"); }, Ri); - this.editor.registerCommand(Ve$1, () => { dispatch(this, "lexxy:focus"); }, Ri); + this.editor.registerCommand(Ge, () => { dispatch(this, "lexxy:blur"); }, zi); + this.editor.registerCommand(qe, () => { dispatch(this, "lexxy:focus"); }, zi); } #attachDebugHooks() { @@ -8975,12 +9030,12 @@ class LinkDialog extends HTMLElement { let url = ""; this.#editor.getEditorState().read(() => { - const selection = Lr(); - if (!yr(selection)) return + const selection = Nr(); + if (!cr(selection)) return let node = selection.getNodes()[0]; while (node && node.getParent()) { - if (w$2(node)) { + if (p(node)) { url = node.getURL(); break } @@ -9095,8 +9150,8 @@ class ColorDialog extends HTMLElement { } #updateColorButtonStates(selection) { - const textColor = le$1(selection, "color", ""); - const backgroundColor = le$1(selection, "background-color", ""); + const textColor = Y$3(selection, "color", ""); + const backgroundColor = Y$3(selection, "background-color", ""); this.#colorButtons.forEach(button => { const matchesSelection = button.dataset.value === textColor || button.dataset.value === backgroundColor; @@ -9306,7 +9361,7 @@ class LexicalPromptElement extends HTMLElement { const { node, offset } = this.#selection.selectedNodeWithOffset(); if (!node) return - if (lr(node) && offset > 0) { + if (Qn(node) && offset > 0) { const fullText = node.getTextContent(); const charBeforeCursor = fullText[offset - 1]; @@ -9335,7 +9390,7 @@ class LexicalPromptElement extends HTMLElement { const { node, offset } = this.#selection.selectedNodeWithOffset(); if (!node) return - if (lr(node) && offset > 0) { + if (Qn(node) && offset > 0) { const fullText = node.getTextContent(); const textBeforeCursor = fullText.slice(0, offset); const lastTriggerIndex = textBeforeCursor.lastIndexOf(this.trigger); @@ -9387,16 +9442,16 @@ class LexicalPromptElement extends HTMLElement { #registerKeyListeners() { // We can't use a regular keydown for Enter as Lexical handles it first - this.keyListeners.push(this.#editor.registerCommand(Ne$1, this.#handleSelectedOption.bind(this), Bi)); - this.keyListeners.push(this.#editor.registerCommand(Me$1, this.#handleSelectedOption.bind(this), Bi)); + this.keyListeners.push(this.#editor.registerCommand(Ee, this.#handleSelectedOption.bind(this), Ki)); + this.keyListeners.push(this.#editor.registerCommand(Pe, this.#handleSelectedOption.bind(this), Ki)); if (this.#doesSpaceSelect) { - this.keyListeners.push(this.#editor.registerCommand(be$1, this.#handleSelectedOption.bind(this), Bi)); + this.keyListeners.push(this.#editor.registerCommand(Me, this.#handleSelectedOption.bind(this), Ki)); } // Register arrow keys with HIGH priority to prevent Lexical's selection handlers from running - this.keyListeners.push(this.#editor.registerCommand(ke$1, this.#handleArrowUp.bind(this), Bi)); - this.keyListeners.push(this.#editor.registerCommand(Te$1, this.#handleArrowDown.bind(this), Bi)); + this.keyListeners.push(this.#editor.registerCommand(Ne, this.#handleArrowUp.bind(this), Ki)); + this.keyListeners.push(this.#editor.registerCommand(we, this.#handleArrowDown.bind(this), Ki)); } #handleArrowUp(event) { @@ -9594,7 +9649,7 @@ class LexicalPromptElement extends HTMLElement { #insertTemplateAsEditableText(template, stringToReplace) { this.#editor.update(() => { - const nodes = m$1(this.#editor, parseHtml(`${template.innerHTML}`)); + const nodes = h$2(this.#editor, parseHtml(`${template.innerHTML}`)); this.#editorContents.replaceTextBackUntil(stringToReplace, nodes); }); } @@ -9671,7 +9726,7 @@ class CodeLanguagePicker extends HTMLElement { } get #languages() { - const languages = { ...pt }; + const languages = { ...V }; if (!languages.ruby) languages.ruby = "Ruby"; @@ -9709,18 +9764,18 @@ class CodeLanguagePicker extends HTMLElement { } #getCurrentCodeNode() { - const selection = Lr(); + const selection = Nr(); - if (!yr(selection)) { + if (!cr(selection)) { return null } const anchorNode = selection.anchor.getNode(); const parentNode = anchorNode.getParent(); - if (X$1(anchorNode)) { + if (I(anchorNode)) { return anchorNode - } else if (X$1(parentNode)) { + } else if (I(parentNode)) { return parentNode } @@ -9737,7 +9792,7 @@ class CodeLanguagePicker extends HTMLElement { #updateLanguagePickerWith(language) { if (this.languagePickerElement && language) { - const normalizedLanguage = dt(language); + const normalizedLanguage = Z$1(language); this.languagePickerElement.value = normalizedLanguage; } } diff --git a/app/assets/javascript/lexxy.js.br b/app/assets/javascript/lexxy.js.br index 0da2e514f..b2d9a9387 100644 Binary files a/app/assets/javascript/lexxy.js.br and b/app/assets/javascript/lexxy.js.br differ diff --git a/app/assets/javascript/lexxy.js.gz b/app/assets/javascript/lexxy.js.gz index 33fc70349..6fe9c1a58 100644 Binary files a/app/assets/javascript/lexxy.js.gz and b/app/assets/javascript/lexxy.js.gz differ diff --git a/app/assets/javascript/lexxy.min.js b/app/assets/javascript/lexxy.min.js index 133140dec..af2d73cd9 100644 --- a/app/assets/javascript/lexxy.min.js +++ b/app/assets/javascript/lexxy.min.js @@ -1,5 +1,5 @@ -import{DirectUpload as e}from"@rails/activestorage"; -/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:t,setPrototypeOf:n,isFrozen:r,getPrototypeOf:i,getOwnPropertyDescriptor:s}=Object;let{freeze:o,seal:a,create:l}=Object,{apply:c,construct:u}="undefined"!=typeof Reflect&&Reflect;o||(o=function(e){return e}),a||(a=function(e){return e}),c||(c=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i1?t-1:0),r=1;r1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:m;n&&n(e,null);let s=t.length;for(;s--;){let n=t[s];if("string"==typeof n){const e=i(n);e!==n&&(r(t)||(t[s]=e),n=e)}e[n]=!0}return e}function N(e){for(let t=0;t/gm),K=a(/\$\{[\w\W]*/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]+$/),q=a(/^aria-[\-\w]+$/),J=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),G=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=a(/^html$/i),Y=a(/^[a-z][.\w]*(-[.\w]+)+$/i);var X=Object.freeze({__proto__:null,ARIA_ATTR:q,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:Y,DATA_ATTR:j,DOCTYPE_NAME:Z,ERB_EXPR:H,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:V,MUSTACHE_EXPR:W,TMPLIT_EXPR:K});const Q=1,ee=3,te=7,ne=8,re=9,ie=function(){return"undefined"==typeof window?null:window};var se=function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const r=t=>e(t);if(r.version="3.3.0",r.removed=[],!n||!n.document||n.document.nodeType!==re||!n.Element)return r.isSupported=!1,r;let{document:i}=n;const s=i,a=s.currentScript,{DocumentFragment:c,HTMLTemplateElement:u,Node:C,Element:T,NodeFilter:N,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:H,DOMParser:K,trustedTypes:j}=n,q=T.prototype,V=L(q,"cloneNode"),G=L(q,"remove"),Y=L(q,"nextSibling"),se=L(q,"childNodes"),oe=L(q,"parentNode");if("function"==typeof u){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let ae,le="";const{implementation:ce,createNodeIterator:ue,createDocumentFragment:de,getElementsByTagName:he}=i,{importNode:ge}=s;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof t&&"function"==typeof oe&&ce&&void 0!==ce.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:_e,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:ke}=X;let{IS_ALLOWED_URI:Se}=X,we=null;const Ce=E({},[...P,...O,...F,...R,...D]);let Te=null;const Ee=E({},[...z,...B,...$,...U]);let Ne=Object.seal(l(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null;const Pe=Object.seal(l(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Oe=!0,Fe=!0,Ie=!1,Re=!0,Me=!1,De=!0,ze=!1,Be=!1,$e=!1,Ue=!1,We=!1,He=!1,Ke=!0,je=!1,qe=!0,Je=!1,Ve={},Ge=null;const Ze=E({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Xe=E({},["audio","video","img","source","image","track"]);let Qe=null;const et=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let it=rt,st=!1,ot=null;const at=E({},[tt,nt,rt],y);let lt=E({},["mi","mo","mn","ms","mtext"]),ct=E({},["annotation-xml"]);const ut=E({},["title","style","font","a","script"]);let dt=null;const ht=["application/xhtml+xml","text/html"];let gt=null,pt=null;const ft=i.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=A(e),dt=-1===ht.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===dt?y:m,we=k(e,"ALLOWED_TAGS")?E({},e.ALLOWED_TAGS,gt):Ce,Te=k(e,"ALLOWED_ATTR")?E({},e.ALLOWED_ATTR,gt):Ee,ot=k(e,"ALLOWED_NAMESPACES")?E({},e.ALLOWED_NAMESPACES,y):at,Qe=k(e,"ADD_URI_SAFE_ATTR")?E(A(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=k(e,"ADD_DATA_URI_TAGS")?E(A(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Ge=k(e,"FORBID_CONTENTS")?E({},e.FORBID_CONTENTS,gt):Ze,Ae=k(e,"FORBID_TAGS")?E({},e.FORBID_TAGS,gt):A({}),Le=k(e,"FORBID_ATTR")?E({},e.FORBID_ATTR,gt):A({}),Ve=!!k(e,"USE_PROFILES")&&e.USE_PROFILES,Oe=!1!==e.ALLOW_ARIA_ATTR,Fe=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Me=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,ze=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,We=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,Ke=!1!==e.SANITIZE_DOM,je=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Je=e.IN_PLACE||!1,Se=e.ALLOWED_URI_REGEXP||J,it=e.NAMESPACE||rt,lt=e.MATHML_TEXT_INTEGRATION_POINTS||lt,ct=e.HTML_INTEGRATION_POINTS||ct,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Fe=!1),We&&(Ue=!0),Ve&&(we=E({},D),Te=[],!0===Ve.html&&(E(we,P),E(Te,z)),!0===Ve.svg&&(E(we,O),E(Te,B),E(Te,U)),!0===Ve.svgFilters&&(E(we,F),E(Te,B),E(Te,U)),!0===Ve.mathMl&&(E(we,R),E(Te,$),E(Te,U))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Pe.tagCheck=e.ADD_TAGS:(we===Ce&&(we=A(we)),E(we,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Pe.attributeCheck=e.ADD_ATTR:(Te===Ee&&(Te=A(Te)),E(Te,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&E(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ge===Ze&&(Ge=A(Ge)),E(Ge,e.FORBID_CONTENTS,gt)),qe&&(we["#text"]=!0),ze&&E(we,["html","head","body"]),we.table&&(E(we,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ae=e.TRUSTED_TYPES_POLICY,le=ae.createHTML("")}else void 0===ae&&(ae=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(j,a)),null!==ae&&"string"==typeof le&&(le=ae.createHTML(""));o&&o(e),pt=e}},_t=E({},[...O,...F,...I]),bt=E({},[...R,...M]),xt=function(e){p(r.removed,{element:e});try{oe(e).removeChild(e)}catch(t){G(e)}},vt=function(e,t){try{p(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ue||We)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},kt=function(e){let t=null,n=null;if($e)e=""+e;else{const t=_(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===dt&&it===rt&&(e=''+e+"");const r=ae?ae.createHTML(e):e;if(it===rt)try{t=(new K).parseFromString(r,dt)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(it,"template",null);try{t.documentElement.innerHTML=st?le:r}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(i.createTextNode(n),s.childNodes[0]||null),it===rt?he.call(t,ze?"html":"body")[0]:ze?t.documentElement:s},St=function(e){return ue.call(e.ownerDocument||e,e,N.SHOW_ELEMENT|N.SHOW_COMMENT|N.SHOW_TEXT|N.SHOW_PROCESSING_INSTRUCTION|N.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof H&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof W)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof C&&e instanceof C};function Tt(e,t,n){d(e,(e=>{e.call(r,t,n,pt)}))}const Et=function(e){let t=null;if(Tt(pe.beforeSanitizeElements,e,null),wt(e))return xt(e),!0;const n=gt(e.nodeName);if(Tt(pe.uponSanitizeElement,e,{tagName:n,allowedTags:we}),De&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent))return xt(e),!0;if(e.nodeType===te)return xt(e),!0;if(De&&e.nodeType===ne&&S(/<[/\w]/g,e.data))return xt(e),!0;if(!(Pe.tagCheck instanceof Function&&Pe.tagCheck(n))&&(!we[n]||Ae[n])){if(!Ae[n]&&At(n)){if(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))return!1}if(qe&&!Ge[n]){const t=oe(e)||e.parentNode,n=se(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=V(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,Y(e))}}}return xt(e),!0}return e instanceof T&&!function(e){let t=oe(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=m(e.tagName),r=m(t.tagName);return!!ot[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||lt[r]):Boolean(_t[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(bt[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!lt[r])&&!bt[n]&&(ut[n]||!_t[n]):!("application/xhtml+xml"!==dt||!ot[e.namespaceURI]))}(e)?(xt(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!S(/<\/no(script|embed|frames)/i,e.innerHTML)?(Me&&e.nodeType===ee&&(t=e.textContent,d([fe,me,ye],(e=>{t=b(t,e," ")})),e.textContent!==t&&(p(r.removed,{element:e.cloneNode()}),e.textContent=t)),Tt(pe.afterSanitizeElements,e,null),!1):(xt(e),!0)},Nt=function(e,t,n){if(Ke&&("id"===t||"name"===t)&&(n in i||n in ft))return!1;if(Fe&&!Le[t]&&S(_e,t));else if(Oe&&S(be,t));else if(Pe.attributeCheck instanceof Function&&Pe.attributeCheck(t,e));else if(!Te[t]||Le[t]){if(!(At(e)&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&S(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t,e))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Qe[t]);else if(S(Se,b(n,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Ye[e]){if(Ie&&!S(xe,b(n,ve,"")));else if(n)return!1}else;return!0},At=function(e){return"annotation-xml"!==e&&_(e,ke)},Lt=function(e){Tt(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||wt(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let i=t.length;for(;i--;){const s=t[i],{name:o,namespaceURI:a,value:l}=s,c=gt(o),u=l;let h="value"===o?u:v(u);if(n.attrName=c,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,Tt(pe.uponSanitizeAttribute,e,n),h=n.attrValue,!je||"id"!==c&&"name"!==c||(vt(o,e),h="user-content-"+h),De&&S(/((--!?|])>)|<\/(style|title|textarea)/i,h)){vt(o,e);continue}if("attributename"===c&&_(h,"href")){vt(o,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){vt(o,e);continue}if(!Re&&S(/\/>/i,h)){vt(o,e);continue}Me&&d([fe,me,ye],(e=>{h=b(h,e," ")}));const p=gt(e.nodeName);if(Nt(p,c,h)){if(ae&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(a);else switch(j.getAttributeType(p,c)){case"TrustedHTML":h=ae.createHTML(h);break;case"TrustedScriptURL":h=ae.createScriptURL(h)}if(h!==u)try{a?e.setAttributeNS(a,o,h):e.setAttribute(o,h),wt(e)?xt(e):g(r.removed)}catch(t){vt(o,e)}}else vt(o,e)}Tt(pe.afterSanitizeAttributes,e,null)},Pt=function e(t){let n=null;const r=St(t);for(Tt(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Tt(pe.uponSanitizeShadowNode,n,null),Et(n),Lt(n),n.content instanceof c&&e(n.content);Tt(pe.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,o=null,a=null;if(st=!e,st&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ct(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!r.isSupported)return e;if(Be||yt(t),r.removed=[],"string"==typeof e&&(Je=!1),Je){if(e.nodeName){const t=gt(e.nodeName);if(!we[t]||Ae[t])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof C)n=kt("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),i.nodeType===Q&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!Ue&&!Me&&!ze&&-1===e.indexOf("<"))return ae&&He?ae.createHTML(e):e;if(n=kt(e),!n)return Ue?null:He?le:""}n&&$e&&xt(n.firstChild);const l=St(Je?e:n);for(;o=l.nextNode();)Et(o),Lt(o),o.content instanceof c&&Pt(o.content);if(Je)return e;if(Ue){if(We)for(a=de.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(Te.shadowroot||Te.shadowrootmode)&&(a=ge.call(s,a,!0)),a}let u=ze?n.outerHTML:n.innerHTML;return ze&&we["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&S(Z,n.ownerDocument.doctype.name)&&(u="\n"+u),Me&&d([fe,me,ye],(e=>{u=b(u,e," ")})),ae&&He?ae.createHTML(u):u},r.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Be=!0},r.clearConfig=function(){pt=null,Be=!1},r.isValidAttribute=function(e,t,n){pt||yt({});const r=gt(e),i=gt(t);return Nt(r,i,n)},r.addHook=function(e,t){"function"==typeof t&&p(pe[e],t)},r.removeHook=function(e,t){if(void 0!==t){const n=h(pe[e],t);return-1===n?void 0:f(pe[e],n,1)[0]}return g(pe[e])},r.removeHooks=function(e){pe[e]=[]},r.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r}();function oe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ae(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ce=le&&"documentMode"in document?document.documentMode:null,ue=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),de=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),he=!(!le||!("InputEvent"in window)||ce)&&"getTargetRanges"in new window.InputEvent("input"),ge=le&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pe=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,fe=le&&/Android/.test(navigator.userAgent),me=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ye=le&&fe&&me,_e=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ue&&!me;function be(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const xe=0,ve=1,ke=2,Se=1,we=2,Ce=3,Te=4,Ee=5,Ne=6,Ae=ge||pe||_e?" ":"​",Le="\n\n",Pe=de?" ":Ae,Oe="֑-߿יִ-﷽ﹰ-ﻼ",Fe="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ie=new RegExp("^[^"+Fe+"]*["+Oe+"]"),Re=new RegExp("^[^"+Oe+"]*["+Fe+"]"),Me={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},De={directionless:1,unmergeable:2},ze={center:2,end:6,justify:4,left:1,right:3,start:5},Be={[we]:"center",[Ne]:"end",[Te]:"justify",[Se]:"left",[Ce]:"right",[Ee]:"start"},$e={normal:0,segmented:2,token:1},Ue={[xe]:"normal",[ke]:"segmented",[ve]:"token"},We="$config";function He(e,t,n,r,i,s){let o=e.getFirstChild();for(;null!==o;){const e=o.__key;o.__parent===t&&(ss(o)&&He(o,e,n,r,i,s),n.has(e)||s.delete(e),i.push(e)),o=o.getNextSibling()}}let Ke=!1,je=0;function qe(e){je=e.timeStamp}function Je(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==Zs(e,n)}function Ve(e,t,n){const r=Do(Po(n));let i=null,s=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,s=r.focusOffset);const o=e.nodeValue;null!==o&&co(t,o,i,s,!1)}function Ge(e,t,n){if(si(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Bs(t)&&n.isAttached()}function Ze(e,t,n,r){for(let i=e;i&&!Yo(i);i=To(i)){const e=Zs(i,t);if(void 0!==e){const t=Vs(e,n);if(t)return ls(t)||!Bo(i)?void 0:[i,t]}else if(i===r)return[r,to(n)]}}function Ye(e,t,n){Ke=!0;const r=performance.now()-je>100;try{ts(e,(()=>{const i=ki()||function(e){return e.getEditorState().read((()=>{const e=ki();return null!==e?e.clone():null}))}(e),s=new Map,o=e.getRootElement(),a=e._editorState,l=e._blockCursorElement;let c=!1,u="";for(let n=0;n0){let t=0;for(let i=0;i0)for(const[t,n]of s)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t{Ye(e,t,n)}))}let et=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||lt).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function tt(e,t,n="latest"){const r=("latest"===n?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function nt(e,t,n){let r;if($i(),"function"==typeof n){const i=e.getLatest(),s=tt(i,t);if(r=n(s),t.isEqual(s,r))return i}else r=n;const i=e.getWritable();return st(i).updateFromKnown(t,r),i}function rt(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=Qo(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let it=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:s}=this.sharedNodeState,o=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(s,n,r);this.size=o}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return at(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[i,s]of Object.entries(n)){const n=e.get(i);n?t.has(n)||t.set(n,n.parse(s)):(r=r||{},r[i]=s)}return r}(n.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=at(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function st(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new it(t,ot(t));return t.__state=n,n}function ot(e){return e.__state?e.__state.sharedNodeState:Es(jo(),e.getType()).sharedNodeState}function at(e){if(e)for(const t in e)return e}function lt(e){return e}function ct(e,t,n){for(const[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function ut(e,t,n){const{unknownState:r}=t,i=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0;return!1}function dt(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function ht(e,t){const n=e.__mode,r=e.__format,i=e.__style,s=t.__mode,o=t.__format,a=t.__style,l=e.__state,c=t.__state;return(null===n||n===s)&&(null===r||r===o)&&(null===i||i===a)&&(null===e.__state||l===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set;return!(e&&ct(n,e,t)||t&&ct(n,t,e)||e&&ut(n,e,t)||t&&ut(n,t,e))}(l,c))}function gt(e,t){const n=e.mergeWithSibling(t),r=Hi()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function pt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Gr(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(ht(t,r)){r=gt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Gr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(ht(r,n)){r=gt(r,n);break}break}n.remove()}}else r.remove()}function ft(e){return mt(e.anchor),mt(e.focus),e}function mt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),Gr(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!ss(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let yt,_t,bt,xt,vt,kt,St,wt,Ct,Tt,Et="",Nt=null,At="",Lt="",Pt=!1,Ot=!1;function Ft(e,t){const n=St.get(e);if(null!==t){const n=Gt(e);n.parentNode===t&&t.removeChild(n)}if(wt.has(e)||_t._keyToDOMMap.delete(e),ss(n)){const e=jt(n,St);It(e,0,e.length-1,null)}void 0!==n&&bo(Tt,bt,xt,n,"destroyed")}function It(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&Ft(t,r)}}function Rt(e,t){e.setProperty("text-align",t)}const Mt="40px";function Dt(e,t){const n=yt.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Mt;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function zt(e,t){const n=e.style;0===t?Rt(n,""):1===t?Rt(n,"left"):2===t?Rt(n,"center"):3===t?Rt(n,"right"):4===t?Rt(n,"justify"):5===t?Rt(n,"start"):6===t&&Rt(n,"end")}function Bt(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if(us(e))return null;const n=e.getParentOrThrow();return us(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function $t(e,t){const n=wt.get(e);void 0===n&&oe(60);const r=n.createDOM(yt,_t);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,_t),Gr(n)?r.setAttribute("data-lexical-text","true"):ls(n)&&r.setAttribute("data-lexical-decorator","true"),ss(n)){const e=n.__indent,t=n.__size;if(Bt(r,n),0!==e&&Dt(r,e),0!==t){const e=t-1;Ut(jt(n,wt),n,0,e,n.getDOMSlot(r))}const i=n.__format;0!==i&&zt(r,i),n.isInline()||Ht(null,n,r),wo(n)&&(Et+=Le,Lt+=Le)}else{const t=n.getTextContent();if(ls(n)){const t=n.decorate(_t,yt);null!==t&&Jt(e,t),r.contentEditable="false"}Et+=t,Lt+=t}return null!==t&&t.insertChild(r),bo(Tt,bt,xt,n,"created"),r}function Ut(e,t,n,r,i){const s=Et;Et="";let o=n;for(;o<=r;++o){$t(e[o],i);const t=wt.get(e[o]);null!==t&&Gr(t)&&(null===Nt&&(Nt=t.getFormat()),""===At&&(At=t.getStyle()))}wo(t)&&(Et+=Le),i.element.__lexicalTextContent=Et,Et=s+Et}function Wt(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return Pr(e)?"line-break":ls(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Ht(e,t,n){const r=Wt(e,St),i=Wt(t,wt);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Kt(e,t,n){var r;Nt=null,At="",function(e,t,n){const r=Et,i=e.__size,s=t.__size;Et="";const o=n.element;if(1===i&&1===s){const n=e.__first,i=t.__first;if(n===i)qt(n,o);else{const e=Gt(n),t=$t(i,null);try{o.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const s=`${r.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(s)}throw r}Ft(n,null)}const s=wt.get(i);Gr(s)&&(null===Nt&&(Nt=s.getFormat()),""===At&&(At=s.getStyle()))}else{const r=jt(e,St),a=jt(t,wt);if(r.length!==i&&oe(227),a.length!==s&&oe(228),0===i)0!==s&&Ut(a,t,0,s-1,n);else if(0===s){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;It(r,0,i-1,e?null:o),e&&(o.textContent="")}}else!function(e,t,n,r,i,s){const o=r-1,a=i-1;let l,c,u=s.getFirstChild(),d=0,h=0;for(;d<=o&&h<=a;){const e=t[d],r=n[h];if(e===r)u=Vt(qt(r,s.element)),d++,h++;else{void 0===l&&(l=new Set(t)),void 0===c&&(c=new Set(n));const i=c.has(e),o=l.has(r);if(i)if(o){const e=Co(_t,r);e===u?u=Vt(qt(r,s.element)):(s.withBefore(u).insertChild(e),qt(r,s.element)),d++,h++}else $t(r,s.withBefore(u)),h++;else u=Vt(Gt(e)),Ft(e,s.element),d++}const i=wt.get(r);null!==i&&Gr(i)&&(null===Nt&&(Nt=i.getFormat()),""===At&&(At=i.getStyle()))}const g=d>o,p=h>a;if(g&&!p){const t=n[a+1],r=void 0===t?null:_t.getElementByKey(t);Ut(n,e,h,a,s.withBefore(r))}else p&&!g&&It(t,d,o,s.element)}(t,r,a,i,s,n)}wo(t)&&(Et+=Le),o.__lexicalTextContent=Et,Et=r+Et}(e,t,t.getDOMSlot(n)),r=t,null==Nt||Nt===r.__textFormat||Ot||r.setTextFormat(Nt),function(e){""===At||At===e.__textStyle||Ot||e.setTextStyle(At)}(t)}function jt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&oe(101),n.push(r),r=e.__next}return n}function qt(e,t){const n=St.get(e);let r=wt.get(e);void 0!==n&&void 0!==r||oe(61);const i=Pt||kt.has(e)||vt.has(e),s=Co(_t,e);if(n===r&&!i){if(ss(n)){const e=s.__lexicalTextContent;void 0!==e&&(Et+=e,Lt+=e)}else{const e=n.getTextContent();Lt+=e,Et+=e}return s}if(n!==r&&i&&bo(Tt,bt,xt,r,"updated"),r.updateDOM(n,s,yt)){const n=$t(e,null);return null===t&&oe(62),t.replaceChild(n,s),Ft(e,null),n}if(ss(n)&&ss(r)){const e=r.__indent;(Pt||e!==n.__indent)&&Dt(s,e);const t=r.__format;if((Pt||t!==n.__format)&&zt(s,t),i&&(Kt(n,r,s),us(r)||r.isInline()||Ht(n,r,s)),wo(r)&&(Et+=Le,Lt+=Le),(Pt||r.__dir!==n.__dir)&&(Bt(s,r),us(r)&&!Pt))for(const e of r.getChildren())ss(e)&&Bt(Co(_t,e.getKey()),e)}else{const t=r.getTextContent();if(ls(r)){const t=r.decorate(_t,yt);null!==t&&Jt(e,t)}Et+=t,Lt+=t}if(!Ot&&us(r)&&r.__cachedText!==Lt){const e=r.getWritable();e.__cachedText=Lt,r=e}return s}function Jt(e,t){let n=_t._pendingDecorators;const r=_t._decorators;if(null===n){if(r[e]===t)return;n=Xs(_t)}n[e]=t}function Vt(e){let t=e.nextSibling;return null!==t&&t===_t._blockCursorElement&&(t=t.nextSibling),t}function Gt(e){const t=Ct.get(e);return void 0===t&&oe(75,e),t}function Zt(e){return{type:e}}const Yt=Zt("SELECTION_CHANGE_COMMAND"),Xt=Zt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Qt=Zt("CLICK_COMMAND"),en=Zt("DELETE_CHARACTER_COMMAND"),tn=Zt("INSERT_LINE_BREAK_COMMAND"),nn=Zt("INSERT_PARAGRAPH_COMMAND"),rn=Zt("CONTROLLED_TEXT_INSERTION_COMMAND"),sn=Zt("PASTE_COMMAND"),on=Zt("REMOVE_TEXT_COMMAND"),an=Zt("DELETE_WORD_COMMAND"),ln=Zt("DELETE_LINE_COMMAND"),cn=Zt("FORMAT_TEXT_COMMAND"),un=Zt("UNDO_COMMAND"),dn=Zt("REDO_COMMAND"),hn=Zt("KEYDOWN_COMMAND"),gn=Zt("KEY_ARROW_RIGHT_COMMAND"),pn=Zt("MOVE_TO_END"),fn=Zt("KEY_ARROW_LEFT_COMMAND"),mn=Zt("MOVE_TO_START"),yn=Zt("KEY_ARROW_UP_COMMAND"),_n=Zt("KEY_ARROW_DOWN_COMMAND"),bn=Zt("KEY_ENTER_COMMAND"),xn=Zt("KEY_SPACE_COMMAND"),vn=Zt("KEY_BACKSPACE_COMMAND"),kn=Zt("KEY_ESCAPE_COMMAND"),Sn=Zt("KEY_DELETE_COMMAND"),wn=Zt("KEY_TAB_COMMAND"),Cn=Zt("INSERT_TAB_COMMAND"),Tn=Zt("INDENT_CONTENT_COMMAND"),En=Zt("OUTDENT_CONTENT_COMMAND"),Nn=Zt("DROP_COMMAND"),An=Zt("FORMAT_ELEMENT_COMMAND"),Ln=Zt("DRAGSTART_COMMAND"),Pn=Zt("DRAGOVER_COMMAND"),On=Zt("DRAGEND_COMMAND"),Fn=Zt("COPY_COMMAND"),In=Zt("CUT_COMMAND"),Rn=Zt("SELECT_ALL_COMMAND"),Mn=Zt("CLEAR_EDITOR_COMMAND"),Dn=Zt("CLEAR_HISTORY_COMMAND"),zn=Zt("CAN_REDO_COMMAND"),Bn=Zt("CAN_UNDO_COMMAND"),$n=Zt("FOCUS_COMMAND"),Un=Zt("BLUR_COMMAND"),Wn=Zt("KEY_MODIFIER_COMMAND"),Hn=Object.freeze({}),Kn=[["keydown",function(e,t){if(!(jn=e.timeStamp,qn=e.key,t.isComposing()||So(t,hn,e)||null==e.key)){if(tr&&mo(e))return ts(t,(()=>{dr(t,nr)})),tr=!1,void(nr="");if(function(e){return go(e,"ArrowRight",{shiftKey:"any"})}(e))So(t,gn,e);else if(function(e){return go(e,"ArrowRight",po)}(e))So(t,pn,e);else if(function(e){return go(e,"ArrowLeft",{shiftKey:"any"})}(e))So(t,fn,e);else if(function(e){return go(e,"ArrowLeft",po)}(e))So(t,mn,e);else if(function(e){return go(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))So(t,yn,e);else if(function(e){return go(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))So(t,_n,e);else if(function(e){return go(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))Qn=!0,So(t,bn,e);else if(function(e){return" "===e.key}(e))So(t,xn,e);else if(function(e){return ue&&go(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),Qn=!0,So(t,tn,!0);else if(function(e){return go(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))Qn=!1,So(t,bn,e);else if(function(e){return go(e,"Backspace",{shiftKey:"any"})||ue&&go(e,"h",{ctrlKey:!0})}(e))mo(e)?So(t,vn,e):(e.preventDefault(),So(t,en,!0));else if(function(e){return"Escape"===e.key}(e))So(t,kn,e);else if(function(e){return go(e,"Delete",{})||ue&&go(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),So(t,en,!1)):So(t,Sn,e);else if(function(e){return go(e,"Backspace",fo)}(e))e.preventDefault(),So(t,an,!0);else if(function(e){return go(e,"Delete",fo)}(e))e.preventDefault(),So(t,an,!1);else if(function(e){return ue&&go(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),So(t,ln,!0);else if(function(e){return ue&&(go(e,"Delete",{metaKey:!0})||go(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),So(t,ln,!1);else if(function(e){return go(e,"b",po)}(e))e.preventDefault(),So(t,cn,"bold");else if(function(e){return go(e,"u",po)}(e))e.preventDefault(),So(t,cn,"underline");else if(function(e){return go(e,"i",po)}(e))e.preventDefault(),So(t,cn,"italic");else if(function(e){return go(e,"Tab",{shiftKey:"any"})}(e))So(t,wn,e);else if(function(e){return go(e,"z",po)}(e))e.preventDefault(),So(t,un,void 0);else if(function(e){return ue?go(e,"z",{metaKey:!0,shiftKey:!0}):go(e,"y",{ctrlKey:!0})||go(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),So(t,dn,void 0);else{const n=t._editorState._selection;null===n||si(n)?yo(e)&&(e.preventDefault(),So(t,Rn,e)):function(e){return go(e,"c",po)}(e)?(e.preventDefault(),So(t,Fn,e)):function(e){return go(e,"x",po)}(e)?(e.preventDefault(),So(t,In,e)):yo(e)&&(e.preventDefault(),So(t,Rn,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&So(t,Wn,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;$o(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&ts(t,(()=>{Ls(n)||(Xn=!0)}))}],["compositionstart",function(e,t){ts(t,(()=>{const n=ki();if(si(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();qs(r.key),(e.timeStamp{dr(t,e.data)})):(tr=!0,nr=e.data)}],["input",function(e,t){e.stopPropagation(),ts(t,(()=>{if(Bo(e.target)&&Ls(e.target))return;const n=ki(),r=e.data,i=ur(e);if(null!=r&&si(n)&&sr(n,i,r,e.timeStamp,!1)){er&&(dr(t,r),er=!1);const i=n.anchor.getNode(),s=Do(Po(t));if(null===s)return;const o=n.isBackward(),a=o?n.anchor.offset:n.focus.offset,l=o?n.focus.offset:n.anchor.offset;he&&!n.isCollapsed()&&Gr(i)&&null!==s.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===ao(s.anchorNode)||So(t,rn,r);const c=r.length;de&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),ge||pe||_e||!t.isComposing()||(jn=0,qs(null))}else lo(!1,t,null!==r?r:void 0),er&&(dr(t,r||void 0),er=!1);!function(){$i();Xe(Hi())}()}),{event:e}),Vn=null}],["click",function(e,t){ts(t,(()=>{const n=ki(),r=Do(Po(t)),i=Si();if(r)if(si(n)){const t=n.anchor,s=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!us(s)&&1===eo().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&s!==n.focus.getNode()){const e=ea(s,(e=>ss(e)&&!e.isInline()));ss(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(Bo(n)||Bs(n))&&no(vi(i,r,t,e))}So(t,Qt,e)}))}],["cut",Hn],["copy",Hn],["dragstart",Hn],["dragover",Hn],["dragend",Hn],["paste",Hn],["focus",Hn],["blur",Hn],["drop",Hn]];he&&Kn.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=ur(e);"deleteCompositionText"===n||de&&ko(t)||"insertCompositionText"!==n&&ts(t,(()=>{const i=ki();if("deleteContentBackward"===n){if(null===i){const e=Si();if(!si(e))return;no(e.clone())}if(si(i)){const n=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===qn&&s{ts(t,(()=>{qs(null)}))}),30),si(i)){const e=i.anchor.getNode();e.markDirty(),Gr(e)||oe(142),cr(i,e)}}else{qs(null),e.preventDefault();const r=i.anchor.getNode(),s=r.getTextContent(),o=r.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===s.length;let l=ye&&n&&!a&&o;if(l&&i.isCollapsed()&&(l=!ls(vo(i.anchor,!0))),!l){So(t,en,!0);const e=ki();ye&&si(e)&&e.isCollapsed()&&(rr=e,setTimeout((()=>rr=null)))}}return}}var s;if(!si(i))return;const o=e.data;null!==Vn&&lo(!1,t,Vn),i.dirty&&null===Vn||!i.isCollapsed()||us(i.anchor.getNode())||null===r||i.applyDOMRange(r),Vn=null;const a=i.anchor,l=i.focus,c=a.getNode(),u=l.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":So(t,rn,e);break;case"insertFromComposition":qs(null),So(t,rn,e);break;case"insertLineBreak":qs(null),So(t,tn,!1);break;case"insertParagraph":qs(null),Qn&&!pe?(Qn=!1,So(t,tn,!1)):So(t,nn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":So(t,sn,e);break;case"deleteByComposition":(function(e,t){return e!==t||ss(e)||ss(t)||!Ds(e)||!Ds(t)})(c,u)&&So(t,on,e);break;case"deleteByDrag":case"deleteByCut":So(t,on,e);break;case"deleteContent":So(t,en,!1);break;case"deleteWordBackward":So(t,an,!0);break;case"deleteWordForward":So(t,an,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":So(t,ln,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":So(t,ln,!1);break;case"formatStrikeThrough":So(t,cn,"strikethrough");break;case"formatBold":So(t,cn,"bold");break;case"formatItalic":So(t,cn,"italic");break;case"formatUnderline":So(t,cn,"underline");break;case"historyUndo":So(t,un,void 0);break;case"historyRedo":So(t,dn,void 0)}else{if("\n"===o)e.preventDefault(),So(t,tn,!1);else if(o===Le)e.preventDefault(),So(t,nn,void 0);else if(null==o&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=o&&sr(i,r,o,e.timeStamp,!0)?(e.preventDefault(),So(t,rn,o)):Vn=o;Jn=e.timeStamp}}))}(e,t)]);let jn=0,qn=null,Jn=0,Vn=null;const Gn=new WeakMap,Zn=new WeakMap;let Yn=!1,Xn=!1,Qn=!1,er=!1,tr=!1,nr="",rr=null,ir=[0,"",0,"root",0];function sr(e,t,n,r,i){const s=e.anchor,o=e.focus,a=s.getNode(),l=Hi(),c=Do(Po(l)),u=null!==c?c.anchorNode:null,d=s.key,h=l.getElementByKey(d),g=n.length;return d!==o.key||!Gr(a)||(!i&&(!he||Jn1||(i||!he)&&null!==h&&!a.isComposing()&&u!==Us(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||a.getFormat()!==e.format||a.getStyle()!==e.style||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=Ds(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Gr(t)||ss(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,a)}function or(e,t){return Bs(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function ar(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=e;Yn&&(Yn=!1,or(r,i)&&or(s,o)&&!rr)||ts(t,(()=>{if(!n)return void no(null);if(!Os(t,r,s))return;let a=ki();if(rr&&si(a)&&a.isCollapsed()){const e=a.anchor,t=rr.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(a=rr.clone(),no(a))}if(rr=null,si(a)){const n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);const i=Po(t).event,s=i?i.timeStamp:performance.now(),[o,l,c,u,d]=ir,h=eo(),g=!1===t.isComposing()&&""===h.getTextContent();if(s{const r=Si(),i=t.anchorNode;(Bo(i)||Bs(i))&&no(vi(r,t,n,e))})));const r=so(n),i=r[r.length-1],s=i._key,o=gr.get(s),a=o||i;a!==n&&ar(t,a,!1),ar(t,n,!0),n!==i?gr.set(s,n):o&&gr.delete(s)}function fr(e){e._lexicalHandled=!0}function mr(e){return!0===e._lexicalHandled}function yr(e){const t=Gn.get(e);if(void 0===t)return;const n=Zn.get(t);if(void 0===n)return;const r=n-1;r>=0||oe(164),Gn.delete(e),Zn.set(t,r),0===r&&t.removeEventListener("selectionchange",pr);const i=Rs(e);Fs(i)?(function(e){if(null!==e._parentEditor){const t=so(e),n=t[t.length-1]._key;gr.get(n)===e&&gr.delete(n)}else gr.delete(e._key)}(i),e.__lexicalEditor=null):i&&oe(198);const s=hr(e);for(let e=0;ee.__key===this.__key));if(Gr(this))return n;if(si(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(ls(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Vs(e)}getParentOrThrow(){const e=this.getParent();return null===e&&oe(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(Oo(t))return ss(e)||e===this&&ls(e)||oe(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&oe(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Vs(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Vs(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=ss(this)?this:this.getParent(),n=ss(e)?e:e.getParent(),r=t&&n?La(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=La(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Ea(t):("same"!==t.type&&"ancestor"!==t.type&&oe(279),!1)))}isParentOf(e){const t=La(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;const o=ss(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==o){i=o;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}const l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let c=null,u=l;do{if(null===u&&oe(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=Hi()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(xr(this))return this;const e=Vs(this.__key);return null===e&&oe(113),e}getWritable(){if(xr(this))return this;$i();const e=Wi(),t=Hi(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,o=ki();if(null!==o&&o.setCachedNodes(null),s.has(r))return js(i),i;const a=Go(i);return s.add(r),js(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){oe(70)}updateDOM(e,t,n){oe(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){oe(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let i=r;for(const e of ot(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&st(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){_r(this,!0,e)}replace(e,t){$i();let n=ki();null!==n&&(n=n.clone()),Io(this,e);const r=this.getLatest(),i=this.__key,s=e.__key,o=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;Ks(o);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(_r(r,!1,!0),null===c?a.__first=s:c.getWritable().__next=s,o.__prev=d,null===u?a.__last=s:u.getWritable().__prev=s,o.__next=h,o.__parent=g,a.__size=l,t&&(ss(this)&&ss(o)||oe(139),this.getChildren().forEach((e=>{o.append(e)}))),si(n)){no(n);const e=n.anchor,t=n.focus;e.key===i&&ri(e,o),t.key===i&&ri(t,o)}return Js()===i&&qs(s),o}insertAfter(e,t=!0){$i(),Io(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=ki();let o=!1,a=!1;if(null!==i){const t=e.getIndexWithinParent();if(Ks(r),si(s)){const e=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}const l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===l?c.__last=u:l.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&si(s)){const e=this.getIndexWithinParent();wi(s,c,e+1);const t=c.__key;o&&s.anchor.set(t,e+2,"element"),a&&s.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){$i(),Io(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;Ks(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===s?o.__first=i:s.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;const c=ki();return t&&si(c)&&wi(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return _s()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){$i();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(ss(n))return n.select();if(!Gr(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){$i();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(ss(n))return n.select(0,0);if(!Gr(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}const kr="historic",Sr="history-merge",wr="collaboration",Cr="skip-scroll-into-view",Tr="skip-dom-selection",Er="skip-selection-focus";class Nr extends vr{static getType(){return"linebreak"}static clone(e){return new Nr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&Ho(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Or(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&Or(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&Ho(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Or(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&Or(r))return!0}return!1}(e)?null:{conversion:Ar,priority:0}}}static importJSON(e){return Lr().updateFromJSON(e)}}function Ar(e){return{node:Lr()}}function Lr(){return Fo(new Nr)}function Pr(e){return e instanceof Nr}function Or(e){return Bs(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Fr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function Ir(e,t){return 1&t?"strong":2&t?"em":"span"}function Rr(e,t,n,r,i){const s=r.classList;let o=_o(i,"base");void 0!==o&&s.add(...o),o=_o(i,"underlineStrikethrough");let a=!1;const l=8&t&&4&t;void 0!==o&&(8&n&&4&n?(a=!0,l||s.add(...o)):l&&s.remove(...o));for(const e in Me){const r=Me[e];if(o=_o(i,e),void 0!==o)if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&s.remove(...o);continue}(0===(t&r)||l&&"underline"===e||"strikethrough"===e)&&s.add(...o)}else t&r&&s.remove(...o)}}function Mr(e,t,n){const r=t.firstChild,i=n.isComposing(),s=e+(i?Ae:"");if(null==r)t.textContent=s;else{const e=r.nodeValue;if(e!==s)if(i||de){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,s=0;for(;i({conversion:Kr,priority:0}),b:()=>({conversion:Ur,priority:0}),code:()=>({conversion:Jr,priority:0}),em:()=>({conversion:Jr,priority:0}),i:()=>({conversion:Jr,priority:0}),mark:()=>({conversion:Jr,priority:0}),s:()=>({conversion:Jr,priority:0}),span:()=>({conversion:$r,priority:0}),strong:()=>({conversion:Jr,priority:0}),sub:()=>({conversion:Jr,priority:0}),sup:()=>({conversion:Jr,priority:0}),u:()=>({conversion:Jr,priority:0})}}static importJSON(e){return Vr().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Bo(t)||oe(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=zr(t,"b")),this.hasFormat("italic")&&(t=zr(t,"i")),this.hasFormat("strikethrough")&&(t=zr(t,"s")),this.hasFormat("underline")&&(t=zr(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Me[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?De[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ws(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=$e[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){$i();let n=e,r=t;const i=ki(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const e=s.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!si(i))return _i(o,n,o,r,"text","text");{const e=Js();e!==i.anchor.key&&e!==i.focus.key||qs(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let a=e;a<0&&(a=o+a,a<0&&(a=0));const l=ki();if(r&&si(l)){const t=e+o;l.setTextNodeRange(i,t,i,t)}const c=s.slice(0,a)+n+s.slice(a+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){$i();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Js(),s=n.length;e.sort(((e,t)=>e-t)),e.push(s);const o=[],a=e.length;for(let t=0,r=0;tt&&(o.push(n.slice(t,i)),t=i)}const l=o.length;if(1===l)return[t];const c=o[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const _=ki();if(si(_)){const[e,t]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=Vr(c),d.__format=h,d.__style=g,d.__detail=p,d.__state=dt(t,d),f=!0):d=t.setTextContent(c);const b=[d];for(let e=1;e=k&&(m.set(e.getKey(),x-k,"text"),x=k){y.set(e.getKey(),v-k,"text");break}k=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&js(t),null!==n&&js(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,b),this.remove()):e.splice(t,1,b),si(_)&&wi(_,u,t,l-1)}return b}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||oe(50);const n=this.__key,r=e.__key,i=this.__text,s=i.length;Js()===r&&qs(n);const o=ki();if(si(o)){const i=o.anchor,a=o.focus;null!==i&&i.key===r&&Ei(i,t,n,e,s),null!==a&&a.key===r&&Ei(a,t,n,e,s)}const a=e.__text,l=t?a+i:i+a;this.setTextContent(l);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function $r(e){return{forChild:Zr(e.style),node:null}}function Ur(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Zr(t.style,n?void 0:"bold"),node:null}}const Wr=new WeakMap;function Hr(e){if(!Bo(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Kr(e){const t=e;null===e.parentElement&&oe(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=Wr.get(n))&&!Hr(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=jr(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:Vr(n)}}function jr(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,Bo(n)){const e=n.style.display;if(""===e&&!Wo(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(Bs(n))return n;if("BR"===n.nodeName)return null}}const qr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Jr(e){const t=qr[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Zr(e.style,t),node:null}}function Vr(e=""){return Fo(new Br(e))}function Gr(e){return e instanceof Br}function Zr(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>Gr(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),o&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Yr extends Br{static getType(){return"tab"}static clone(e){return new Yr(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=_o(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Xr().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&ae(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||oe(286),this}setDetail(e){return 2!==e&&oe(127),this}setMode(e){return"normal"!==e&&oe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Xr(){return Fo(new Yr)}function Qr(e){return e instanceof Yr}class ei{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offsete&&(r=e)}else if(!ss(t)){const e=t.getNextSibling();if(Gr(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function ri(e,t){if(ss(t)){const n=t.getLastDescendant();ss(n)||Gr(n)?ni(e,n):ni(e,t)}else ni(e,t)}class ii{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!ai(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new ii(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(Gr(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e1;){const e=t[t.length-1];if(!ss(e)||s.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=$a(e.anchor),r=$a(e.anchor.getFlipped()),i=e=>ca(e)?e.origin:e.getNodeAtCaret(),s=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(s)}return t}(Ha(Ra(this),"next"));return Bi()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,a]=ci(this);let l="",c=!0;for(let u=0;u=0;e--){const t=s[e];if(t.is(d)||ss(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Ds(d))if(a===h)d.select();else{const t=Vr(e);t.select(),d.replace(t)}else d=d.spliceText(a,h-a,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(ss(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},s=r.length;if(0===s)return this.toggleFormat(e),qs(null),void i(t);const o=this.anchor,a=this.focus,l=this.isBackward(),c=l?a:o,u=l?o:a;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=s-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(zs(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||zs(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const _=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||zs(m)||([m]=m.splitText(y)),m.setFormat(_));for(let t=d+1;t(ss(e)||ls(e))&&!e.isInline()))){ss(n)||oe(211,t.constructor.name,t.getType());const i=Li(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=_s();let n=null;for(let r=0;r0){const e=s.getRangeAt(0),n=this.anchor.getNode(),i=us(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(Oo(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let o=!1;for(let e=0;e0)if(t){const e=r[0];ss(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];ss(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}s.anchorNode===e.startContainer&&s.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,s=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,s,!0)}(this)}}"lineboundary"===n&&Oi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&ss(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(ss(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=Sa(Pa(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(da(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(ss(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=$a(t);Ia(this,wa(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(ua(t)){if(ss(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(ls(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&ss(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=xi();e.add(t.origin.getKey()),no(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return Ia(this,wa(!t.origin.isEmpty()&&n.isEmpty()?Ma(fa(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&ui(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,s=r.getTextContentSize();if(r.is(n)||e&&t!==s||!e&&0!==t)return void hi(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,s=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==s)return void hi(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,s=r.offset,o=e{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function hi(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,a=0;for(let e=0;en||r){i.splice(e,1),r&&(a=void 0);break}}const l=i.join("").trim();""===l?r.remove():(r.setTextContent(l),r.select(a,a))}function gi(e,t,n,r){let i,s=t;if(Bo(e)){let o=!1;const a=e.childNodes,l=a.length,c=r._blockCursorElement;s===l&&(o=!0,s=l-1);let u=a[s],d=!1;if(u===c)u=a[s+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&s--}if(i=ro(u),Gr(i))s=ya(i,o?"next":"previous");else{let a=ro(e);if(null===a)return null;if(ss(a)){const l=r.getElementByKey(a.getKey());null===l&&oe(214);const c=a.getDOMSlot(l);[a,s]=c.resolveChildIndex(a,l,e,t),ss(a)||oe(215),o&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let u=a.getChildAtIndex(s);if(ss(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=o?u.getLastDescendant():u.getFirstDescendant();null===e?a=u:(u=e,a=ss(u)?u:u.getParentOrThrow()),s=0}Gr(u)?(i=u,a=null,s=ya(u,o?"next":"previous")):u!==a&&o&&!d&&(ss(a)||oe(216),s=Math.min(a.getChildrenSize(),s+1))}else{const n=a.getIndexWithinParent();s=0===t&&ls(a)&&ro(e)===a?n:n+1,a=a.getParentOrThrow()}if(ss(a))return ti(a.__key,s,"element")}}else i=ro(e);return Gr(i)?ti(i.__key,ya(i,s,"clamp"),"text"):null}function pi(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(t){if((n||!t)&&null===r&&ss(s)&&s.isInline()){const t=s.getPreviousSibling();Gr(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else ss(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Gr(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(t&&ss(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&ss(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();Gr(t)&&e.set(t.__key,0,"text")}}}function fi(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);pi(e,r,i),pi(t,!r,i),i&&t.set(e.key,e.offset,e.type);const s=Hi();if(s.isComposing()&&s._compositionKey!==e.key&&si(n)){const r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function mi(e,t,n,r,i,s){if(null===e||null===n||!Os(i,e,n))return null;const o=gi(e,t,si(s)?s.anchor:null,i);if(null===o)return null;const a=gi(n,r,si(s)?s.focus:null,i);if(null===a)return null;if("element"===o.type&&"element"===a.type){const t=ro(e),r=ro(n);if(ls(t)&&ls(r))return null}return fi(o,a,s),[o,a]}function yi(e){return ss(e)&&!e.isInline()}function _i(e,t,n,r,i,s){const o=Wi(),a=new oi(ti(e,t,i),ti(n,r,s),0,"");return a.dirty=!0,o._selection=a,a}function bi(){const e=ti("root",0,"element"),t=ti("root",0,"element");return new oi(e,t,0,"")}function xi(){return new ii(new Set)}function vi(e,t,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,a="selectionchange"===o,l=!Ke&&(a||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let c,u,d,h;if(si(e)&&!l)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,(a||void 0===o)&&si(e)&&!Os(n,c,u))return e.clone();const g=mi(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;return new oi(p,f,si(e)?e.format:0,si(e)?e.style:"")}function ki(){return Wi()._selection}function Si(){return Hi()._editorState._selection}function wi(e,t,n,r=1){const i=e.anchor,s=e.focus,o=i.getNode(),a=s.getNode();if(!t.is(o)&&!t.is(a))return;const l=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n0||n0||n=e,o=i?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Gr(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,"text"),r.set(o.__key,e,"text")}}else{if(ss(s)){const e=s.getChildrenSize(),r=n>=e,i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Gr(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(ss(o)){const e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(Gr(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function Ti(e,t,n,r,i){let s=null,o=0,a=null;null!==r?(s=r.__key,Gr(r)?(o=r.getTextContentSize(),a="text"):ss(r)&&(o=r.getChildrenSize(),a="element")):null!==i&&(s=i.__key,Gr(i)?a="text":ss(i)&&(a="element")),null!==s&&null!==a?e.set(s,o,a):(o=t.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),e.set(n.__key,o,"element"))}function Ei(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function Ni(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function Ai(e){let t=ki()||Si();null===t&&(t=eo().selectEnd()),t.insertNodes(e)}function Li(e){let t=e;e.isCollapsed()||t.removeText();const n=ki();si(n)&&(t=n),si(t)||oe(161);const r=t.anchor;let i=r.getNode(),s=r.offset;for(;!Ko(i);){const e=i;if([i,s]=Pi(i,s),e.is(i))break}return s}function Pi(e,t){const n=e.getParent();if(!n){const e=_s();return eo().append(e),e.select(),[eo(),0]}if(Gr(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!ss(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new oi(ti(e.__key,t,"element"),ti(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Oi(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const s=Pa(e.focus,n?"previous":"next"),o="lineboundary"===r,a="move"===t;let l=s,c="decorators-and-blocks"===i;if(!Ua(l)){for(const e of l){c=!1;const{origin:t}=e;if(!ls(t)||t.isIsolated()||(l=e,!o||!t.isInline()))break}if(c)for(const e of Sa(s).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(da(e))e.origin.isInline()||(l=e);else{if(ss(e.origin))continue;ls(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===s)return!1;if(a&&!o&&ls(l.origin)&&l.origin.isKeyboardSelectable()){const e=xi();return e.add(l.origin.getKey()),no(e),!0}return l=$a(l),a&&Oa(e.anchor,l),Oa(e.focus,l),c||!o}let Fi=null,Ii=null,Ri=!1,Mi=!1,Di=0;const zi={characterData:!0,childList:!0,subtree:!0};function Bi(){return Ri||null!==Fi&&Fi._readOnly}function $i(){Ri&&oe(13)}function Ui(){Di>99&&oe(14)}function Wi(){return null===Fi&&oe(195,Ki()),Fi}function Hi(){return null===Ii&&oe(196,Ki()),Ii}function Ki(){let e=0;const t=new Set,n=Ss.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=Rs(r);if(Fs(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function ji(e,t,n){const r=t.__type,i=Es(e,r);let s=n.get(r);void 0===s&&(s=Array.from(i.transforms),n.set(r,s));const o=s.length;for(let e=0;e0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=Eo(n),i=Lo(r);if(null===r||null===i)return;let{top:s,bottom:o}=t,a=0,l=0,c=n;for(;null!==c;){const t=c===r.body;if(t)a=0,l=Po(e).innerHeight;else{const e=c.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(sl&&(n=o-l),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;s-=t,o-=t}if(t)break;c=To(c)}}(n,t,s)}}Yn=!0}}(o,a,e,x,_,r)}!function(e,t,n){let r=e._blockCursorElement;if(si(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let a=!1,l=null;if(o===s.getChildrenSize())Ro(s.getChildAtIndex(o-1))&&(a=!0);else{const t=s.getChildAtIndex(o);if(null!==t&&Ro(t)){const n=t.getPreviousSibling();(null===n||Ro(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){const n=e.getElementByKey(s.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=be(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===l?n.appendChild(r):n.insertBefore(r,l))}}null!==r&&Mo(r,e,t)}(e,r,a)}finally{null!==g&&g.observe(r,zi),Ii=d,Fi=c}}null!==p&&function(e,t,n,r,i){const s=Array.from(e._listeners.mutation),o=s.length;for(let e=0;e0||u>0;){if(l>0){t._dirtyLeaves=new Set;for(const e of a){const r=i.get(e);Gr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&pt(r),void 0!==r&&qi(r,s)&&ji(t,r,o),n.add(e)}if(a=t._dirtyLeaves,l=a.size,l>0){Di++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],a=e[1];if(r.set(n,a),!a)continue;const l=i.get(n);void 0!==l&&qi(l,s)&&ji(t,l,o)}a=t._dirtyLeaves,l=a.size,c=t._dirtyElements,u=c.size,Di++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Qi(e),function(e,t,n,r){const i=e._nodeMap,s=t._nodeMap,o=[];for(const[e]of r){const t=s.get(e);void 0!==t&&(t.isAttached()||(ss(t)&&He(t,e,i,s,o,r),i.has(e)||r.delete(e),o.push(e)))}for(const e of o)s.delete(e);for(const e of n){const t=s.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),s.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);const i=l._selection;if(si(i)){const e=l._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||oe(19)}else ai(i)&&0===i._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Yi(e)}finally{Fi=u,Ri=d,Ii=h,e._updating=g,Di=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(l,e);f?l._flushSync?(l._flushSync=!1,Yi(e)):c&&As((()=>{Yi(e)})):(l._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function ts(e,t,n){Ii===e&&void 0===n?t():es(e,t,n)}class ns{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new ns(this.element,e,this.after)}withAfter(e){return new ns(this.element,this.before,e)}withElement(e){return this.element===e?this:new ns(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&oe(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&oe(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&oe(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(_e||pe||ge);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=rs(t,n);i.push(r);const s=rs(t,this.element);let o=e.getIndexWithinParent();for(let e=0;en){o+=1;break}}return[e.getParentOrThrow(),o]}}function rs(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&oe(225),n.reverse()}class is extends vr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Be[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=Hi()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(Gr(t)&&e.push(t),ss(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;ss(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;ss(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return ss(e)&&e.getLastDescendant()||e||null}const r=t[e];return ss(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Vs(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&oe(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Vs(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&oe(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;re.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?ze[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){xr(this)&&oe(324,this.__key,this.__type);const r=this.getChildrenSize(),i=this.getWritable();e+t<=r||oe(226,String(e),String(t),String(r));const s=i.__key,o=[],a=[],l=this.getChildAtIndex(e+t);let c=null,u=r-t+n.length;if(0!==e)if(e===r)c=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(c=t.getPreviousSibling())}if(t>0){let e=null===c?this.getFirstChild():c.getNextSibling();for(let n=0;n0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function ss(e){return e instanceof is}function os(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class as extends vr{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function ls(e){return e instanceof as}class cs extends is{__cachedText;static getType(){return"root"}static clone(){return new cs}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){oe(51)}getTextContent(){const e=this.__cachedText;return!Bi()&&0!==Hi()._dirtyType||null===e?super.getTextContent():e}remove(){oe(52)}replace(e){oe(53)}insertBefore(e){oe(54)}insertAfter(e){oe(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)ss(e)||ls(e)||oe(282);return super.splice(e,t,n)}static importJSON(e){return eo().updateFromJSON(e)}collapseAtStart(){return!0}}function us(e){return e instanceof cs}function ds(e){return new ps(new Map(e._nodeMap))}function hs(){return new ps(new Map([["root",new cs]]))}function gs(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&oe(130,n.name),ss(e)){const r=t.children;Array.isArray(r)||oe(59,n.name);const i=e.getChildren();for(let e=0;e({root:gs(eo())})))}}class fs extends is{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class ms extends is{static getType(){return"paragraph"}static clone(e){return new ms(e.__key)}createDOM(e){const t=document.createElement("p"),n=_o(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:ys,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Bo(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return _s().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=_s();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||Gr(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function ys(e){const t=_s();return e.style&&(t.setFormat(e.style.textAlign),Zo(e,t)),{node:t}}function _s(){return Fo(new ms)}function bs(e){return e instanceof ms}function xs(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=hs(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const s=e._observer;null!==s&&(s.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function vs(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=Qo(r),i=r.transform;if(!n.has(i)){n.add(i);const e=r.transform();e&&t.add(e)}if(e){const n=e.$transform;n&&t.add(n),r=e.extends}else{const e=Object.getPrototypeOf(r);r=e.prototype instanceof vr&&e!==vr?e:void 0}}return t}function ks(e){const t=e||{},n=Ii,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,s=t.disableEvents||!1,o=hs(),a=t.namespace||(null!==i?i._config.namespace:oo()),l=t.editorState,c=[cs,Br,Nr,Yr,ms,fs,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==l&&(p._pendingEditorState=l,p._dirtyType=2),p}class Ss{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,s,o,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=oo(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&oe(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&oe(36,String(e));const s=i[n];return s.add(t),()=>{s.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let s=i.get(t);void 0===s&&(s=new Set,i.set(t,s)),s.add(r);const o=n&&n.skipInitialization;return void 0!==o&&o||this.initializeMutationListener(t,r),()=>{s.delete(r),0===s.size&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&oe(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Vo(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=Vo(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=Vs(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Sr}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return So(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=_o(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,xs(this,t,e,r),null!==t&&(this._config.disableEvents||yr(t),null!=n&&t.classList.remove(...n)),null!==e){const t=Lo(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,Qe(this),this._updateTags.add(Sr),Yi(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument;Gn.set(e,n);const r=Zn.get(n)??0;r<1&&n.addEventListener("selectionchange",pr),Zn.set(n,r+1),e.__lexicalEditor=t;const i=hr(e);for(let n=0;n{mr(e)||(fr(e),(t.isEditable()||"click"===r)&&s(e,t))}:e=>{if(mr(e))return;fr(e);const n=t.isEditable();switch(r){case"cut":return n&&So(t,In,e);case"copy":return So(t,Fn,e);case"paste":return n&&So(t,sn,e);case"dragstart":return n&&So(t,Ln,e);case"dragover":return n&&So(t,Pn,e);case"dragend":return n&&So(t,On,e);case"focus":return n&&So(t,$n,e);case"blur":return n&&So(t,Un,e);case"drop":return n&&So(t,Nn,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Sr),Yi(this);Xi("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&oe(38);let n=e;n._readOnly&&(n=ds(e),n._selection=e._selection?e._selection.clone():null),Xe(this);const r=this._pendingEditorState,i=this._updateTags,s=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=s&&i.add(s),Yi(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Yi(this)}parseEditorState(e,t){return function(e,t,n){const r=hs(),i=Fi,s=Ri,o=Ii,a=t._dirtyElements,l=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Fi=r,Ri=!1,Ii=t,Cs(null);try{const i=t._nodes;Gi(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=c,t._dirtyType=u,Fi=i,Ri=s,Ii=o}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Yi(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):es(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),ts(this,(()=>{const r=ki(),i=eo();null!==r?r.dirty||no(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),No("focus"),function(e){$i(),Hi()._deferred.push(e)}((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=Do(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Xi("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ss.version="0.38.2+prod.esm";let ws=null;function Cs(e){ws=e}let Ts=1;function Es(e,t){const n=Ns(e,t);return void 0===n&&oe(30,t),n}function Ns(e,t){return e._nodes.get(t)}const As="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function Ls(e){return ls(Ys(e))}function Ps(e){const t=document.activeElement;if(!Bo(t))return!1;const n=t.nodeName;return ls(Ys(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==Rs(t))}function Os(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!Ps(t)&&Is(t)===e}catch(e){return!1}}function Fs(e){return e instanceof Ss}function Is(e){let t=e;for(;null!=t;){const e=Rs(t);if(Fs(e))return e;t=To(t)}return null}function Rs(e){return e?e.__lexicalEditor:null}function Ms(e){return Ie.test(e)?"rtl":Re.test(e)?"ltr":null}function Ds(e){return Qr(e)||e.isToken()}function zs(e){return Ds(e)||e.isSegmented()}function Bs(e){return $o(e)&&3===e.nodeType}function $s(e){return $o(e)&&9===e.nodeType}function Us(e){let t=e;for(;null!=t;){if(Bs(t))return t;t=t.firstChild}return null}function Ws(e,t,n){const r=Me[t];if(null!==n&&(e&r)===(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function Hs(e){return Gr(e)||Pr(e)||ls(e)}function Ks(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),s=e.getNextSibling(),o=null!==s?s.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,c=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=a),null!==l&&(l.__next=o),null!==c&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function js(e){Ui(),xr(e)&&oe(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=Wi(),i=Hi(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,s,o);const a=t.__key;i._dirtyType=1,ss(e)?o.set(a,!0):i._dirtyLeaves.add(a)}function qs(e){$i();const t=Hi(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Vs(n);null!==e&&e.getWritable()}if(null!==e){const t=Vs(e);null!==t&&t.getWritable()}}}function Js(){return Bi()?null:Hi()._compositionKey}function Vs(e,t){const n=(t||Wi())._nodeMap.get(e);return void 0===n?null:n}function Gs(e,t){const n=Zs(e,Hi());return void 0!==n?Vs(n,t):null}function Zs(e,t){return e[`__lexicalKey_${t._key}`]}function Ys(e,t){let n=e;for(;null!=n;){const e=Gs(n,t);if(null!==e)return e;n=To(n)}return null}function Xs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Qs(e){return e.read((()=>eo().getTextContent()))}function eo(){return to(Wi())}function to(e){return e._nodeMap.get("root")}function no(e){$i();const t=Wi();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function ro(e){const t=Hi(),n=function(e,t){let n=e;for(;null!=n;){const e=Zs(n,t);if(void 0!==e)return e;n=To(n)}return null}(e,t);return null===n?e===t.getRootElement()?Vs("root"):null:Vs(n)}function io(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function so(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function oo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function ao(e){return Bs(e)?e.nodeValue:null}function lo(e,t,n){const r=Do(Po(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let t=ao(i);const r=Ys(i);if(null!==t&&Gr(r)){if(t===Ae&&n){const e=n.length;t=n,s=e,o=e}null!==t&&co(r,t,s,o,e)}}}function co(e,t,n,r,i){let s=e;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let a=t;(o||i)&&t[t.length-1]===Ae&&(a=t.slice(0,-1));const l=s.getTextContent();if(i||a!==l){if(""===a){if(qs(null),ge||pe||_e)s.remove();else{const e=Hi();setTimeout((()=>{e.update((()=>{s.isAttached()&&s.remove()}))}),20)}return}const t=s.getParent(),i=Si(),l=s.getTextContentSize(),c=Js(),u=s.getKey();if(s.isToken()||null!==c&&u===c&&!o||si(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===l&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const d=ki();if(!si(d)||null===n||null===r)return void uo(s,a,d);if(d.setTextNodeRange(s,n,s,r),s.isSegmented()){const e=Vr(s.getTextContent());s.replace(e),s=e}uo(s,a,d)}}}function uo(e,t,n){if(e.setTextContent(t),si(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=ya(e,i.offset,"clamp"))}}}function ho(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function go(e,t,n){return function(e,t){return ho(e,t,"altKey")&&ho(e,t,"ctrlKey")&&ho(e,t,"shiftKey")&&ho(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const po={ctrlKey:!ue,metaKey:ue},fo={altKey:ue,ctrlKey:!ue};function mo(e){return"Backspace"===e.key}function yo(e){return go(e,"a",po)}function _o(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=be(i);return n[t]=e,e}return i}function bo(e,t,n,r,i){if(0===n.size)return;const s=r.__type,o=r.__key,a=t.get(s);void 0===a&&oe(33,s);const l=a.klass;let c=e.get(l);void 0===c&&(c=new Map,e.set(l,c));const u=c.get(o),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(o,d?"updated":i)}function xo(e,t,n){const r=e.getParent();let i=n,s=e;return null!==r&&(t&&0===n?(i=s.getIndexWithinParent(),s=r):t||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?i-1:i)}function vo(e,t){const n=e.offset;if("element"===e.type)return xo(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?xo(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function ko(e){const t=Po(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function So(e,t,n){return function(e,t,n){const r=so(e);for(let i=4;i>=0;i--)for(let s=0;s{for(let t=0;ts),Xo(e,"clone")||(e.clone=t=>(Cs(t),new e)),Xo(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Xo(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const ea=(e,t)=>{let n=e;for(;null!=n&&!us(n);){if(t(n))return n;n=n.getParent()}return null},ta={next:"previous",previous:"next"};class na{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Ca({hasNext:ua,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return fa(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return fa(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const s=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();null!==t&&o.size0){const t=i.getNodeAtCaret();if(t)if(o.delete(t.getKey()),o.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(s)&&e.remove(),t.replace(e)}else null===t&&oe(263,Array.from(o).join(" "))}else i.insert(e);i=fa(e,this.direction)}for(const e of o.values())e.remove();return this}}class ra extends na{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ba(e,this.direction)}getParentCaret(e="root"){return fa(oa(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=sa(this.direction);return fa(this.getNodeAtCaret(),e)||ba(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof ra&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const ia={root:us,shadowRoot:Oo};function sa(e){return ta[e]}function oa(e,t="root"){return ia[t](e)?null:e}class aa extends na{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:fa(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return ss(this.origin)?ba(this.origin,this.direction):null}getParentCaret(e="root"){return fa(oa(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=sa(this.direction);return fa(this.getNodeAtCaret(),e)||ba(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof aa&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof aa||e instanceof la)&&this.direction===e.direction&&this.origin.is(e.origin)}}class la extends na{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ma(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return fa(oa(this.getParentAtCaret(),e),this.direction)}getFlipped(){return ma(this.origin,sa(this.direction),this.offset)}isSamePointCaret(e){return e instanceof la&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof aa||e instanceof la)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return fa(this.origin,this.direction)}}function ca(e){return e instanceof la}function ua(e){return e instanceof aa}function da(e){return e instanceof ra}const ha={next:class extends la{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends la{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},ga={next:class extends aa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends aa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},pa={next:class extends ra{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends ra{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function fa(e,t){return e?new ga[t](e):null}function ma(e,t,n){return e?new ha[t](e,ya(e,n)):null}function ya(e,t,n="error"){const r=e.getTextContentSize();let i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&ae(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function _a(e,t){return new ka(e,t)}function ba(e,t){return ss(e)?new pa[t](e):null}function xa(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class va{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new va(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return ca(t)?function(e,t){const{direction:n,origin:r}=e;return _a(e,ya(r,"focus"===t?sa(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[_a(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=ca(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=ca(n),i=t=>t.isSameNodeCaret(n)?null:xa(t)||t.getParentCaret(e);return Ca({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class ka{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n{let n;for(let r=l;rn.has(e.getKey())&&Ko(e)));return u&&d?[u,d]:null}(u,d,l);if(h){const[e,t]=h;ba(e,"previous").splice(0,t.getChildren()),t.remove()}const g=[u,d,...o,...a].find(za);if(g)return function(e){return wa(e,e)}(Wa($a(g),e.direction));oe(269,JSON.stringify(o.map((e=>e.origin.__key))))}function $a(e){const t=function(e){let t=e;for(;da(t);){const e=xa(t);if(!da(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Gr(t.origin))return ca(t)?t:ma(t.origin,n,n);const r=t.getAdjacentCaret();return ua(r)&&Gr(r.origin)?ma(r.origin,n,sa(n)):t}function Ua(e){return ca(e)&&e.offset!==ya(e.origin,e.direction)}function Wa(e,t){return e.direction===t?e:e.getFlipped()}function Ha(e,t){return e.direction===t?e:wa(Wa(e.focus,t),Wa(e.anchor,t))}const Ka=new Map;function ja(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function qa(e){let t=Ka.get(e);return void 0===t&&(t=ja(e),Ka.set(e,t)),t}function Ja(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Va(e){const t=jo().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Ga(e){return Va(us(e)?e:e.getParentOrThrow())}function Za(e){const t=Ga(e);return null!==t&&"rtl"===t.direction}function Ya(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!zs(t)&&null!==r){const[i,s]=r,o=e.isBackward(),a=i.getNode(),l=s.getNode(),c=t.is(a),u=t.is(l);if(c||u){const[r,i]=ci(e),s=a.is(l),c=t.is(o?l:a),u=t.is(o?a:l);let d,h=0;s?(h=r>i?i:r,d=r>i?r:i):c?(h=o?i:r,d=void 0):u&&(h=0,d=o?r:i);const g=t.__text.slice(h,d);g!==t.__text&&("clone"===n&&(t=function(e){return(t=Go(e))[br]=!0,t;var t}(t)),t.__text=g)}}return t}function Xa(e){const t=e.getStyle(),n=ja(t);Ka.set(t,n)}function Qa(e,t){(si(e)?e.isCollapsed():Gr(e)||ss(e))||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(280);const n=qa(si(e)?e.style:Gr(e)?e.getStyle():e.getTextStyle()),r=Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}),i=Ja(r);si(e)||Gr(e)?e.setStyle(i):e.setTextStyle(i),Ka.set(i,r)}function el(e,t){if(si(e)&&e.isCollapsed()){Qa(e,t);const n=e.anchor.getNode();ss(n)&&n.isEmpty()&&Qa(n,t)}tl((e=>{Qa(e,t)}))}function tl(e){const t=ki();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(si(t))for(const e of Ra(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!Gr(t)||!t.canHaveFormat())continue;const[n,i]=r(t);i!==n&&(zs(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}si(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:s}=t;t.set(n.key,n.offset,n.type),n.set(r,i,s)}}(t)}function nl(e){const t=rl(e);return null!==t&&"vertical-rl"===t.writingMode}function rl(e){const t=e.anchor.getNode();return ss(t)?Va(t):Ga(t)}function il(e,t){let n=nl(e)?!t:t;sl(e)&&(n=!n);const r=Pa(e.focus,n?"previous":"next");if(Ua(r))return!1;for(const e of Sa(r)){if(da(e))return!e.origin.isInline();if(!ss(e.origin)){if(ls(e.origin))return!0;break}}return!1}function sl(e){const t=rl(e);return null!==t&&"rtl"===t.direction}function ol(e,t,n){const r=sl(e);let i;i=nl(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function al(e,t,n){const r=qa(e.getStyle());return null!==r&&r[t]||n}function ll(e,t,n=""){let r=null;const i=e.getNodes(),s=e.anchor,o=e.focus,a=e.isBackward(),l=a?o.offset:s.offset,c=a?o.getNode():s.getNode();if(si(e)&&e.isCollapsed()&&""!==e.style){const n=qa(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")})),se.setConfig({ALLOWED_TAGS:["a","action-text-attachment","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","q","s","strong","ul"],ALLOWED_ATTR:["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","style","title","url","width"],SAFE_FOR_XML:!1});const dl="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,hl=dl&&"documentMode"in document?document.documentMode:null;function gl(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function pl(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function fl(e,...t){const n=gl(...t);n.length>0&&e.classList.add(...n)}function ml(e,...t){const n=gl(...t);n.length>0&&e.classList.remove(...n)}function yl(e){return e?e.getAdjacentCaret():null}function _l(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function bl(e){const t=ea(e,(e=>ss(e)&&!e.isInline()));return ss(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(4,e.__key),t}function xl(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}dl&&"InputEvent"in window&&!hl&&new window.InputEvent("input");const vl=Symbol.for("preact-signals");function kl(){if(Tl>1)return void Tl--;let e,t=!1;for(;void 0!==wl;){let n=wl;for(wl=void 0,El++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Ol(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(El=0,Tl--,t)throw e}let Sl,wl;function Cl(e){const t=Sl;Sl=void 0;try{return e()}finally{Sl=t}}let Tl=0,El=0,Nl=0;function Al(e){if(void 0===Sl)return;let t=e.n;return void 0===t||t.t!==Sl?(t={i:0,S:e,p:Sl.s,n:void 0,t:Sl,e:void 0,x:void 0,r:t},void 0!==Sl.s&&(Sl.s.n=t),Sl.s=t,e.n=t,32&Sl.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Sl.s,t.n=void 0,Sl.s.n=t,Sl.s=t),t):void 0}function Ll(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Pl(e,t){return new Ll(e,t)}function Ol(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Fl(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Il(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Rl(e,t){Ll.call(this,void 0),this.x=e,this.s=void 0,this.g=Nl-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Ml(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Tl++;const n=Sl;Sl=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Dl(e),t}finally{Sl=n,kl()}}}function Dl(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ml(e)}function zl(e){if(Sl!==this)throw new Error("Out-of-order effect");Il(this),Sl=e,this.f&=-2,8&this.f&&Dl(this),kl()}function Bl(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function $l(e,t){const n=new Bl(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}Ll.prototype.brand=vl,Ll.prototype.h=function(){return!0},Ll.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Cl((()=>{var e;null==(e=this.W)||e.call(this)})))},Ll.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Cl((()=>{var e;null==(e=this.Z)||e.call(this)})))}},Ll.prototype.subscribe=function(e){return $l((()=>{const t=this.value,n=Sl;Sl=void 0;try{e(t)}finally{Sl=n}}),{name:"sub"})},Ll.prototype.valueOf=function(){return this.value},Ll.prototype.toString=function(){return this.value+""},Ll.prototype.toJSON=function(){return this.value},Ll.prototype.peek=function(){const e=Sl;Sl=void 0;try{return this.value}finally{Sl=e}},Object.defineProperty(Ll.prototype,"value",{get(){const e=Al(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(El>100)throw new Error("Cycle detected");this.v=e,this.i++,Nl++,Tl++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{kl()}}}}),Rl.prototype=new Ll,Rl.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Nl)return!0;if(this.g=Nl,this.f|=1,this.i>0&&!Ol(this))return this.f&=-2,!0;const e=Sl;try{Fl(this),Sl=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Sl=e,Il(this),this.f&=-2,!0},Rl.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Ll.prototype.S.call(this,e)},Rl.prototype.U=function(e){if(void 0!==this.t&&(Ll.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Rl.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Rl.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Al(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Bl.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},Bl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Ml(this),Fl(this),Tl++;const e=Sl;return Sl=this,zl.bind(this,e)},Bl.prototype.N=function(){2&this.f||(this.f|=2,this.o=wl,wl=this)},Bl.prototype.d=function(){this.f|=8,1&this.f||Dl(this)},Bl.prototype.dispose=function(){this.d()};new Set;Symbol.for("@lexical/extension/LexicalBuilder");function Ul(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Wl(e){let t=e.getParent();hc(t)||Ul(40);let n=t;for(;null!==n;)n=n.getParent(),hc(n)&&(t=n);return t}function Hl(e){let t=[];const n=e.getChildren().filter(sc);for(let e=0;e0&&e.append(...i),t.remove()}function Yl(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())sc(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),hc(r.getFirstChild())||n++)}function Xl(e){const t=new Set;if(Kl(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Kl(r)&&Kl(i)){const n=i.getFirstChild();if(hc(n)){n.append(e);const i=r.getFirstChild();hc(i)&&(Vl(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Kl(r)){const t=r.getFirstChild();if(hc(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Kl(i)){const t=i.getFirstChild();hc(t)&&t.append(e)}else if(hc(n)){const t=ic().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),s=dc(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(s),s.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Ql(e){if(Kl(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(hc(n?n.getParent():void 0)&&sc(n)&&hc(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=t.getListType(),i=ic(),s=dc(r);i.append(s),e.getPreviousSiblings().forEach((e=>s.append(e)));const o=ic(),a=dc(r);o.append(a),Vl(a,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(e)}}}function ec(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}let tc=class extends is{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();hc(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:is,importDOM:{li:()=>({conversion:nc,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!hc(r)||"check"!==r.getListType()||hc(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],s=t.list,o=s?s.listitem:void 0;let a;if(s&&s.nested&&(a=s.nested.listitem),void 0!==o&&r.push(...ec(o)),s){const e=n.getParent(),t=hc(e)&&"check"===e.getListType(),o=n.getChecked();t&&!o||i.push(s.listitemUnchecked),t&&o||i.push(s.listitemChecked),t&&r.push(o?s.listitemChecked:s.listitemUnchecked)}if(void 0!==a){const e=ec(a);n.getChildren().some((e=>hc(e)))?r.push(...e):i.push(...e)}i.length>0&&ml(e,...i),r.length>0&&fl(e,...r)}(t,n.theme,this);const r=e?e.__style:"",i=this.__style;r!==i&&(""===i?t.removeAttribute("style"):t.style.cssText=i),function(e,t,n){const r=qa(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in qa(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(hc(n)||Ul(39),sc(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=dc(n.getListType());r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Kl(t)&&Kl(n)&&(Zl(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=ic().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=_s();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=sc(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,s=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return hc(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;sc(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Ul(117),(e=Math.floor(e))>=0||Ul(199);let t=this.getIndent();for(;t!==e;)t0&&"INPUT"===t.children[0].tagName)return rc(t.children[0]);const t=e.getAttribute("aria-checked");return{node:ic("true"===t||"false"!==t&&void 0)}}function rc(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:ic(e.hasAttribute("checked"))}}function ic(e){return Fo(new tc(void 0,e))}function sc(e){return e instanceof tc}let oc=class extends is{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();hc(t)&&e.getListType()===t.getListType()&&Zl(e,t)}(e),Yl(e)},extends:is,importDOM:{ol:()=>({conversion:cc,priority:0}),ul:()=>({conversion:cc,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=uc[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,ac(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(ac(t,n.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return Bo(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e1?r.push(...e):i.push(...e)}}i.length>0&&ml(e,...i),r.length>0&&fl(e,...r)}function lc(e){const t=[];for(let n=0;n1&&e.forEach((e=>{hc(e)&&t.push(jl(e))}))}else t.push(jl(r))}return t}function cc(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=dc("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list")||"1"===e.getAttribute("data-is-checklist"))return!0;for(const t of e.childNodes)if(Bo(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?dc("check"):dc("bullet")),{after:lc,node:n}}const uc={ol:"number",ul:"bullet"};function dc(e="number",t=1){return Fo(new oc(e,t))}function hc(e){return e instanceof oc}const gc=Zt("UPDATE_LIST_START_COMMAND"),pc=Zt("INSERT_UNORDERED_LIST_COMMAND"),fc=Zt("INSERT_ORDERED_LIST_COMMAND"),mc=Zt("REMOVE_LIST_COMMAND");function yc(e){return pl(e.registerCommand(fc,(()=>(Jl("number"),!0)),1),e.registerCommand(gc,(e=>{const{listNodeKey:t,newStart:n}=e,r=Vs(t);return!!hc(r)&&("number"===r.getListType()&&(r.setStart(n),Yl(r)),!0)}),1),e.registerCommand(pc,(()=>(Jl("bullet"),!0)),1),e.registerCommand(mc,(()=>(function(){const e=ki();if(si(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(ql(r,n))t.add(Wl(r));else for(let e=0;efunction(){const e=ki();if(!si(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!sc(t)||0!==t.getChildrenSize())return!1;const n=Wl(t),r=t.getParent();hc(r)||Ul(40);const i=r.getParent();let s;if(Oo(i))s=_s(),n.insertAfter(s);else{if(!sc(i))return!1;s=ic(),i.insertAfter(s)}s.setTextStyle(e.style).setTextFormat(e.format).select();const o=t.getNextSiblings();if(o.length>0){const e=dc(r.getListType());if(sc(s)){const t=ic();t.append(e),s.insertAfter(t)}else s.insertAfter(e);e.append(...o)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!sc(e)&&!hc(e))break;t=e}t.remove()}(t),!0}()),1),e.registerNodeTransform(tc,(e=>{const t=e.getFirstChild();if(t){if(Gr(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=ki();si(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(Br,(e=>{const t=e.getParent();if(sc(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function _c(e,t){const n=$s(t)?t.body.childNodes:t.childNodes;let r=[];const i=[];for(const t of n)if(!vc.has(t.nodeName)){const n=kc(t,e,i,!1);null!==n&&(r=r.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof fs&&t.insertAfter(Lr());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(i),r}function bc(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=eo().getChildren();for(let i=0;i{const e=new fs;return n.push(e),e}:_s)),null==a?h.length>0?o=o.concat(h):Ho(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(Wo(e.nextSibling)&&Wo(e.previousSibling))}(e)&&(o=o.concat(Lr())):ss(a)&&a.append(...h),o}function Sc(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function wc(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return Cc(n,function(e){const t=[];for(let n=0;ne}).createHTML(e):e}(i),"text/html")),t)}catch(e){console.error(e)}const o=s||e.getData("text/uri-list");if(null!=o)if(si(t)){const e=o.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t{e.update((()=>{r(Ac(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,s=i.document,o=Do(i);if(null===r||null===o)return!1;const a=s.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(s.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),o.removeAllRanges(),o.addRange(l),new Promise(((t,r)=>{const o=e.registerCommand(Fn,(r=>(xl(r,ClipboardEvent)&&(o(),null!==Ec&&(i.clearTimeout(Ec),Ec=null),t(Ac(e,r,n))),!0)),4);Ec=i.setTimeout((()=>{o(),Ec=null,t(!1)}),50),s.execCommand("copy"),a.remove()}))}function Ac(e,t,n){if(void 0===n){const t=Do(e._window),r=ki();if(!r||r.isCollapsed())return!1;if(!t)return!1;const i=t.anchorNode,s=t.focusNode;if(null!==i&&null!==s&&!Os(e,i,s))return!1;n=function(e=ki()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=jo();for(const[r,i]of Lc){const s=i(n,e);null!==s&&(t[r]=s)}}return t}(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Lc)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Lc=[["text/html",function(e,t=ki()){return null==t&&Sc(166),si(t)&&t.isCollapsed()||0===t.getNodes().length?"":bc(e,t)}],["application/x-lexical-editor",function(e,t=ki()){return null==t&&Sc(166),si(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=eo().getChildren();for(let i=0;i({conversion:Jc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Bo(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Wc().updateFromJSON(e)}insertNewAfter(e,t){const n=_s(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=_s();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Wc(){return Fo(new Uc)}function Hc(e){return e instanceof Uc}let Kc=class e extends is{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){fl(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:qc,priority:0}),h2:e=>({conversion:qc,priority:0}),h3:e=>({conversion:qc,priority:0}),h4:e=>({conversion:qc,priority:0}),h5:e=>({conversion:qc,priority:0}),h6:e=>({conversion:qc,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&jc(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>jc(e)?{conversion:e=>({node:Vc("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Bo(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Vc(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?_s():Vc(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=_s();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?_s():Vc(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function jc(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function qc(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Vc(t),null!==e.style&&(Zo(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Jc(e){const t=Wc();return null!==e.style&&(t.setFormat(e.style.textAlign),Zo(e,t)),{node:t}}function Vc(e="h1"){return Fo(new Kc(e))}function Gc(e){return e instanceof Kc}function Zc(e){let t=null;if(xl(e,DragEvent)?t=e.dataTransfer:xl(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function Yc(e){const t=ki();if(!si(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;tss(e)&&!e.isInline()));if(null===o)continue;const a=o.getKey();o.canIndent()&&!n.has(a)&&(n.add(a),e(o))}return n.size>0}function Xc(e){return ls(Ys(e))}function Qc(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function eu(e){return pl(e.registerCommand(Qt,(e=>{const t=ki();return!!ai(t)&&(t.clear(),!0)}),0),e.registerCommand(en,(e=>{const t=ki();return si(t)?(t.deleteCharacter(e),!0):!!ai(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(an,(e=>{const t=ki();return!!si(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(ln,(e=>{const t=ki();return!!si(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(rn,(t=>{const n=ki();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)wc(r,n,e);else if(si(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(on,(()=>{const e=ki();return!!si(e)&&(e.removeText(),!0)}),0),e.registerCommand(cn,(e=>{const t=ki();return!!si(t)&&(t.formatText(e),!0)}),0),e.registerCommand(An,(e=>{const t=ki();if(!si(t)&&!ai(t))return!1;const n=t.getNodes();for(const t of n){const n=ea(t,(e=>ss(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(tn,(e=>{const t=ki();return!!si(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(nn,(()=>{const e=ki();return!!si(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Cn,(()=>(Ai([Xr()]),!0)),0),e.registerCommand(Tn,(()=>Yc((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(En,(()=>Yc((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(yn,(e=>{const t=ki();if(ai(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(si(t)){const n=vo(t.focus,!0);if(!e.shiftKey&&ls(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(_n,(e=>{const t=ki();if(ai(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(si(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===eo().getChildrenSize()}(t))return e.preventDefault(),!0;const n=vo(t.focus,!1);if(!e.shiftKey&&ls(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(fn,(e=>{const t=ki();if(ai(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Za(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!si(t))return!1;if(il(t,!0)){const n=e.shiftKey;return e.preventDefault(),ol(t,n,!0),!0}return!1}),0),e.registerCommand(gn,(e=>{const t=ki();if(ai(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Za(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!si(t))return!1;const n=e.shiftKey;return!!il(t,!1)&&(e.preventDefault(),ol(t,n,!1),!0)}),0),e.registerCommand(vn,(t=>{if(Xc(t.target))return!1;const n=ki();if(si(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(us(n))return!1;const r=bl(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(En,void 0);if(Dc&&"ko-KR"===navigator.language)return!1}else if(!ai(n))return!1;return t.preventDefault(),e.dispatchCommand(en,!0)}),0),e.registerCommand(Sn,(t=>{if(Xc(t.target))return!1;const n=ki();return!(!si(n)&&!ai(n))&&(t.preventDefault(),e.dispatchCommand(en,!1))}),0),e.registerCommand(bn,(t=>{const n=ki();if(!si(n))return!1;if(Qc(n),null!==t){if((Dc||Mc||Bc)&&Rc)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(tn,!1)}return e.dispatchCommand(nn,void 0)}),0),e.registerCommand(kn,(()=>!!si(ki())&&(e.blur(),!0)),0),e.registerCommand(Nn,(t=>{const[,n]=Zc(t);if(n.length>0){const r=Pc(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,s=Ys(i);if(null!==s){const e=bi();if(Gr(s))e.anchor.set(s.getKey(),t,"text"),e.focus.set(s.getKey(),t,"text");else{const t=s.getParentOrThrow().getKey(),n=s.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}no(ft(e))}e.dispatchCommand($c,n)}return t.preventDefault(),!0}return!!si(ki())}),0),e.registerCommand(Ln,(e=>{const[t]=Zc(e),n=ki();return!(t&&!si(n))}),0),e.registerCommand(Pn,(e=>{const[t]=Zc(e),n=ki();if(t&&!si(n))return!1;const r=Pc(e.clientX,e.clientY);if(null!==r){ls(Ys(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Rn,(()=>(function(e){const t=eo();if(si(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),ft(e),e}{const e=t.select(0,t.getChildrenSize());no(ft(e))}}(),!0)),0),e.registerCommand(Fn,(t=>(Nc(e,xl(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(In,(t=>(async function(e,t){await Nc(t,xl(e,ClipboardEvent)?e:null),t.update((()=>{const e=ki();si(e)?e.removeText():ai(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(sn,(t=>{const[,n,r]=Zc(t);return n.length>0&&!r?(e.dispatchCommand($c,n),!0):(!$o(t.target)||!Ps(t.target))&&(null!==ki()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=ki(),r=xl(e,InputEvent)||xl(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&wc(r,n,t)}),{tag:"paste"})}(t,e),!0))}),0),e.registerCommand(xn,(e=>{const t=ki();return si(t)&&Qc(t),!1}),0),e.registerCommand(wn,(e=>{const t=ki();return si(t)&&Qc(t),!1}),0))}var tu=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 s?new s(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);S+=k.value.length,k=k.next){var w=k.value;if(t.length>e.length)return;if(!(w instanceof s)){var C,T=1;if(_){if(!(C=o(v,S,e,y))||C.index>=e.length)break;var E=C.index,N=C.index+C[0].length,A=S;for(A+=k.value.length;E>=A;)A+=(k=k.next).value.length;if(S=A-=k.value.length,k.value instanceof s)continue;for(var L=k;L!==t.tail&&(Ad.reach&&(d.reach=I);var R=k.prev;if(O&&(R=c(t,R,O),S+=O.length),u(t,R,T),k=c(t,R,new s(h,m?i.tokenize(P,m):P,b,P)),F&&c(t,k,F),T>1){var M={cause:h+","+p,reach:I};a(e,t,n,k.prev,S,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function l(){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 c(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"+s.content+""},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,s=n.code,o=n.immediateClose;e.postMessage(i.highlight(s,i.languages[r],r)),o&&e.close()}),!1),i):i;var d=i.util.currentScript();function h(){i.manual||i.highlightAll()}if(d&&(i.filename=d.src,d.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}); +import{DirectUpload as e}from"@rails/activestorage";import{marked as t}from"marked"; +/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:n,setPrototypeOf:r,isFrozen:i,getPrototypeOf:o,getOwnPropertyDescriptor:s}=Object;let{freeze:a,seal:l,create:c}=Object,{apply:u,construct:d}="undefined"!=typeof Reflect&&Reflect;a||(a=function(e){return e}),l||(l=function(e){return e}),u||(u=function(e,t,n){return e.apply(t,n)}),d||(d=function(e,t){return new e(...t)});const h=w(Array.prototype.forEach),g=w(Array.prototype.lastIndexOf),p=w(Array.prototype.pop),f=w(Array.prototype.push),m=w(Array.prototype.splice),y=w(String.prototype.toLowerCase),_=w(String.prototype.toString),b=w(String.prototype.match),x=w(String.prototype.replace),v=w(String.prototype.indexOf),S=w(String.prototype.trim),C=w(Object.prototype.hasOwnProperty),E=w(RegExp.prototype.test),T=(k=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:y;r&&r(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(i(t)||(t[o]=e),r=e)}e[r]=!0}return e}function A(e){for(let t=0;t/gm),j=l(/\$\{[\w\W]*/gm),q=l(/^data-[\-\w.\u00B7-\uFFFF]+$/),J=l(/^aria-[\-\w]+$/),V=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),G=l(/^(?:\w+script|data):/i),Y=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=l(/^html$/i),X=l(/^[a-z][.\w]*(-[.\w]+)+$/i);var Q=Object.freeze({__proto__:null,ARIA_ATTR:J,ATTR_WHITESPACE:Y,CUSTOM_ELEMENT:X,DATA_ATTR:q,DOCTYPE_NAME:Z,ERB_EXPR:K,IS_ALLOWED_URI:V,IS_SCRIPT_OR_DATA:G,MUSTACHE_EXPR:$,TMPLIT_EXPR:j});const ee=1,te=3,ne=7,re=8,ie=9,oe=function(){return"undefined"==typeof window?null:window};var se=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oe();const r=t=>e(t);if(r.version="3.2.6",r.removed=[],!t||!t.document||t.document.nodeType!==ie||!t.Element)return r.isSupported=!1,r;let{document:i}=t;const o=i,s=o.currentScript,{DocumentFragment:l,HTMLTemplateElement:u,Node:d,Element:k,NodeFilter:w,NamedNodeMap:A=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:$,DOMParser:K,trustedTypes:j}=t,q=k.prototype,J=F(q,"cloneNode"),G=F(q,"remove"),Y=F(q,"nextSibling"),X=F(q,"childNodes"),se=F(q,"parentNode");if("function"==typeof u){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let ae,le="";const{implementation:ce,createNodeIterator:ue,createDocumentFragment:de,getElementsByTagName:he}=i,{importNode:ge}=o;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof n&&"function"==typeof se&&ce&&void 0!==ce.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:_e,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:Se}=Q;let{IS_ALLOWED_URI:Ce}=Q,Ee=null;const Te=N({},[...P,...O,...I,...M,...B]);let ke=null;const we=N({},[...z,...U,...W,...H]);let Ne=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null,Fe=!0,Pe=!0,Oe=!1,Ie=!0,De=!1,Me=!0,Re=!1,Be=!1,ze=!1,Ue=!1,We=!1,He=!1,$e=!0,Ke=!1,je=!0,qe=!1,Je={},Ve=null;const Ge=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Ze=N({},["audio","video","img","source","image","track"]);let Xe=null;const Qe=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let rt=nt,it=!1,ot=null;const st=N({},[et,tt,nt],_);let at=N({},["mi","mo","mn","ms","mtext"]),lt=N({},["annotation-xml"]);const ct=N({},["title","style","font","a","script"]);let ut=null;const dt=["application/xhtml+xml","text/html"];let ht=null,gt=null;const pt=i.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!gt||gt!==e){if(e&&"object"==typeof e||(e={}),e=L(e),ut=-1===dt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ht="application/xhtml+xml"===ut?_:y,Ee=C(e,"ALLOWED_TAGS")?N({},e.ALLOWED_TAGS,ht):Te,ke=C(e,"ALLOWED_ATTR")?N({},e.ALLOWED_ATTR,ht):we,ot=C(e,"ALLOWED_NAMESPACES")?N({},e.ALLOWED_NAMESPACES,_):st,Xe=C(e,"ADD_URI_SAFE_ATTR")?N(L(Qe),e.ADD_URI_SAFE_ATTR,ht):Qe,Ye=C(e,"ADD_DATA_URI_TAGS")?N(L(Ze),e.ADD_DATA_URI_TAGS,ht):Ze,Ve=C(e,"FORBID_CONTENTS")?N({},e.FORBID_CONTENTS,ht):Ge,Ae=C(e,"FORBID_TAGS")?N({},e.FORBID_TAGS,ht):L({}),Le=C(e,"FORBID_ATTR")?N({},e.FORBID_ATTR,ht):L({}),Je=!!C(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Pe=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,De=e.SAFE_FOR_TEMPLATES||!1,Me=!1!==e.SAFE_FOR_XML,Re=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,We=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,$e=!1!==e.SANITIZE_DOM,Ke=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,qe=e.IN_PLACE||!1,Ce=e.ALLOWED_URI_REGEXP||V,rt=e.NAMESPACE||nt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,lt=e.HTML_INTEGRATION_POINTS||lt,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(Pe=!1),We&&(Ue=!0),Je&&(Ee=N({},B),ke=[],!0===Je.html&&(N(Ee,P),N(ke,z)),!0===Je.svg&&(N(Ee,O),N(ke,U),N(ke,H)),!0===Je.svgFilters&&(N(Ee,I),N(ke,U),N(ke,H)),!0===Je.mathMl&&(N(Ee,M),N(ke,W),N(ke,H))),e.ADD_TAGS&&(Ee===Te&&(Ee=L(Ee)),N(Ee,e.ADD_TAGS,ht)),e.ADD_ATTR&&(ke===we&&(ke=L(ke)),N(ke,e.ADD_ATTR,ht)),e.ADD_URI_SAFE_ATTR&&N(Xe,e.ADD_URI_SAFE_ATTR,ht),e.FORBID_CONTENTS&&(Ve===Ge&&(Ve=L(Ve)),N(Ve,e.FORBID_CONTENTS,ht)),je&&(Ee["#text"]=!0),Re&&N(Ee,["html","head","body"]),Ee.table&&(N(Ee,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw T('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw T('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ae=e.TRUSTED_TYPES_POLICY,le=ae.createHTML("")}else void 0===ae&&(ae=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(j,s)),null!==ae&&"string"==typeof le&&(le=ae.createHTML(""));a&&a(e),gt=e}},yt=N({},[...O,...I,...D]),_t=N({},[...M,...R]),bt=function(e){f(r.removed,{element:e});try{se(e).removeChild(e)}catch(t){G(e)}},xt=function(e,t){try{f(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){f(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ue||We)try{bt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},vt=function(e){let t=null,n=null;if(ze)e=""+e;else{const t=b(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&rt===nt&&(e=''+e+"");const r=ae?ae.createHTML(e):e;if(rt===nt)try{t=(new K).parseFromString(r,ut)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(rt,"template",null);try{t.documentElement.innerHTML=it?le:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),rt===nt?he.call(t,Re?"html":"body")[0]:Re?t.documentElement:o},St=function(e){return ue.call(e.ownerDocument||e,e,w.SHOW_ELEMENT|w.SHOW_COMMENT|w.SHOW_TEXT|w.SHOW_PROCESSING_INSTRUCTION|w.SHOW_CDATA_SECTION,null)},Ct=function(e){return e instanceof $&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof A)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Et=function(e){return"function"==typeof d&&e instanceof d};function Tt(e,t,n){h(e,(e=>{e.call(r,t,n,gt)}))}const kt=function(e){let t=null;if(Tt(pe.beforeSanitizeElements,e,null),Ct(e))return bt(e),!0;const n=ht(e.nodeName);if(Tt(pe.uponSanitizeElement,e,{tagName:n,allowedTags:Ee}),Me&&e.hasChildNodes()&&!Et(e.firstElementChild)&&E(/<[/\w!]/g,e.innerHTML)&&E(/<[/\w!]/g,e.textContent))return bt(e),!0;if(e.nodeType===ne)return bt(e),!0;if(Me&&e.nodeType===re&&E(/<[/\w]/g,e.data))return bt(e),!0;if(!Ee[n]||Ae[n]){if(!Ae[n]&&Nt(n)){if(Ne.tagNameCheck instanceof RegExp&&E(Ne.tagNameCheck,n))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))return!1}if(je&&!Ve[n]){const t=se(e)||e.parentNode,n=X(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=J(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,Y(e))}}}return bt(e),!0}return e instanceof k&&!function(e){let t=se(e);t&&t.tagName||(t={namespaceURI:rt,tagName:"template"});const n=y(e.tagName),r=y(t.tagName);return!!ot[e.namespaceURI]&&(e.namespaceURI===tt?t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(yt[n]):e.namespaceURI===et?t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&<[r]:Boolean(_t[n]):e.namespaceURI===nt?!(t.namespaceURI===tt&&!lt[r])&&!(t.namespaceURI===et&&!at[r])&&!_t[n]&&(ct[n]||!yt[n]):!("application/xhtml+xml"!==ut||!ot[e.namespaceURI]))}(e)?(bt(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!E(/<\/no(script|embed|frames)/i,e.innerHTML)?(De&&e.nodeType===te&&(t=e.textContent,h([fe,me,ye],(e=>{t=x(t,e," ")})),e.textContent!==t&&(f(r.removed,{element:e.cloneNode()}),e.textContent=t)),Tt(pe.afterSanitizeElements,e,null),!1):(bt(e),!0)},wt=function(e,t,n){if($e&&("id"===t||"name"===t)&&(n in i||n in pt))return!1;if(Pe&&!Le[t]&&E(_e,t));else if(Fe&&E(be,t));else if(!ke[t]||Le[t]){if(!(Nt(e)&&(Ne.tagNameCheck instanceof RegExp&&E(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&E(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&E(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Xe[t]);else if(E(Ce,x(n,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!Ye[e]){if(Oe&&!E(xe,x(n,ve,"")));else if(n)return!1}else;return!0},Nt=function(e){return"annotation-xml"!==e&&b(e,Se)},At=function(e){Tt(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ct(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:a,value:l}=o,c=ht(s),u=l;let d="value"===s?u:S(u);if(n.attrName=c,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Tt(pe.uponSanitizeAttribute,e,n),d=n.attrValue,!Ke||"id"!==c&&"name"!==c||(xt(s,e),d="user-content-"+d),Me&&E(/((--!?|])>)|<\/(style|title)/i,d)){xt(s,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){xt(s,e);continue}if(!Ie&&E(/\/>/i,d)){xt(s,e);continue}De&&h([fe,me,ye],(e=>{d=x(d,e," ")}));const g=ht(e.nodeName);if(wt(g,c,d)){if(ae&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(a);else switch(j.getAttributeType(g,c)){case"TrustedHTML":d=ae.createHTML(d);break;case"TrustedScriptURL":d=ae.createScriptURL(d)}if(d!==u)try{a?e.setAttributeNS(a,s,d):e.setAttribute(s,d),Ct(e)?bt(e):p(r.removed)}catch(t){xt(s,e)}}else xt(s,e)}Tt(pe.afterSanitizeAttributes,e,null)},Lt=function e(t){let n=null;const r=St(t);for(Tt(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Tt(pe.uponSanitizeShadowNode,n,null),kt(n),At(n),n.content instanceof l&&e(n.content);Tt(pe.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,s=null,a=null;if(it=!e,it&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Et(e)){if("function"!=typeof e.toString)throw T("toString is not a function");if("string"!=typeof(e=e.toString()))throw T("dirty is not a string, aborting")}if(!r.isSupported)return e;if(Be||mt(t),r.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){const t=ht(e.nodeName);if(!Ee[t]||Ae[t])throw T("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof d)n=vt("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),i.nodeType===ee&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!Ue&&!De&&!Re&&-1===e.indexOf("<"))return ae&&He?ae.createHTML(e):e;if(n=vt(e),!n)return Ue?null:He?le:""}n&&ze&&bt(n.firstChild);const c=St(qe?e:n);for(;s=c.nextNode();)kt(s),At(s),s.content instanceof l&&Lt(s.content);if(qe)return e;if(Ue){if(We)for(a=de.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(ke.shadowroot||ke.shadowrootmode)&&(a=ge.call(o,a,!0)),a}let u=Re?n.outerHTML:n.innerHTML;return Re&&Ee["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&E(Z,n.ownerDocument.doctype.name)&&(u="\n"+u),De&&h([fe,me,ye],(e=>{u=x(u,e," ")})),ae&&He?ae.createHTML(u):u},r.setConfig=function(){mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Be=!0},r.clearConfig=function(){gt=null,Be=!1},r.isValidAttribute=function(e,t,n){gt||mt({});const r=ht(e),i=ht(t);return wt(r,i,n)},r.addHook=function(e,t){"function"==typeof t&&f(pe[e],t)},r.removeHook=function(e,t){if(void 0!==t){const n=g(pe[e],t);return-1===n?void 0:m(pe[e],n,1)[0]}return p(pe[e])},r.removeHooks=function(e){pe[e]=[]},r.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r}();function ae(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ce=le&&"documentMode"in document?document.documentMode:null,ue=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),de=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),he=!(!le||!("InputEvent"in window)||ce)&&"getTargetRanges"in new window.InputEvent("input"),ge=le&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pe=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,fe=le&&/Android/.test(navigator.userAgent),me=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ye=le&&fe&&me,_e=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!me;function be(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const xe=0,ve=1,Se=2,Ce=1,Ee=2,Te=3,ke=4,we=5,Ne=6,Ae=ge||pe||_e?" ":"​",Le="\n\n",Fe=de?" ":Ae,Pe="֑-߿יִ-﷽ﹰ-ﻼ",Oe="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ie=new RegExp("^[^"+Oe+"]*["+Pe+"]"),De=new RegExp("^[^"+Pe+"]*["+Oe+"]"),Me={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Re={directionless:1,unmergeable:2},Be={center:2,end:6,justify:4,left:1,right:3,start:5},ze={[Ee]:"center",[Ne]:"end",[ke]:"justify",[Ce]:"left",[Te]:"right",[we]:"start"},Ue={normal:0,segmented:2,token:1},We={[xe]:"normal",[Se]:"segmented",[ve]:"token"},He="$";function $e(e,t,n,r,i,o){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(Hi(s)&&$e(s,e,n,r,i,o),n.has(e)||o.delete(e),i.push(e)),s=s.getNextSibling()}}let Ke=!1,je=0;function qe(e){je=e.timeStamp}function Je(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==Po(e,n)}function Ve(e,t,n){const r=_s(hs(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&qo(t,s,i,o,!1)}function Ge(e,t,n){if(Hr(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return So(t)&&n.isAttached()}function Ye(e,t,n,r){for(let i=e;i&&!Os(i);i=as(i)){const e=Po(i,t);if(void 0!==e){const t=Lo(e,n);if(t)return ji(t)||!xs(i)?void 0:[i,t]}else if(i===r)return[r,Ro(n)]}}function Ze(e,t,n){Ke=!0;const r=performance.now()-je>100;try{Bi(e,(()=>{const i=oi()||function(e){return e.getEditorState().read((()=>{const e=oi();return null!==e?e.clone():null}))}(e),o=new Map,s=e.getRootElement(),a=e._editorState,l=e._blockCursorElement;let c=!1,u="";for(let n=0;n0){let t=0;for(let i=0;i0)for(const[t,n]of o)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t{Ze(e,t,n)}))}let et=class e{constructor(e,t=new Map,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedConfigMap=t,this.unknownState=n,this.knownState=r;const o=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(t,n,r);this.size=o}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);return tt(e)?{[He]:e}:{}}getWritable(t){if(this.node===t)return this;const n=new Map(this.knownState),r=tt(i=this.unknownState)&&{...i};var i;if(r)for(const e of n.keys())delete r[e.key];return new e(t,this.sharedConfigMap,tt(r),n,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||this.size++,r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState={},e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n);this.unknownState=tt(this.unknownState)}};function tt(e){if(e)for(const t in e)return e}function nt(e,t){const n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,a=t.__style,l=e.__state,c=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===a)&&(null===e.__state||l===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set,r=(e,t)=>{for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const e=t?t.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return!0}return!1},i=(e,t)=>{const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r)for(const[e,t]of Object.entries(r))if(!n.has(e)&&(n.add(e),t!==(i?i[e]:void 0)))return!0;return!1};return!(e&&r(e,t)||t&&r(t,e)||e&&i(e,t)||t&&i(t,e))}(l,c))}function rt(e,t){const n=e.mergeWithSibling(t),r=ki()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function it(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Pr(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(nt(t,r)){r=rt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Pr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(nt(r,n)){r=rt(r,n);break}break}n.remove()}}else r.remove()}function ot(e){return st(e.anchor),st(e.focus),e}function st(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),Pr(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Hi(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let at,lt,ct,ut,dt,ht,gt,pt,ft,mt,yt="",_t="",bt=null,xt="",vt="",St=!1,Ct=!1,Et=null;function Tt(e,t){const n=gt.get(e);if(null!==t){const n=Wt(e);n.parentNode===t&&t.removeChild(n)}if(pt.has(e)||lt._keyToDOMMap.delete(e),Hi(n)){const e=Rt(n,gt);kt(e,0,e.length-1,null)}void 0!==n&&es(mt,ct,ut,n,"destroyed")}function kt(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&Tt(t,r)}}function wt(e,t){e.setProperty("text-align",t)}const Nt="40px";function At(e,t){const n=at.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Nt;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function Lt(e,t){const n=e.style;0===t?wt(n,""):1===t?wt(n,"left"):2===t?wt(n,"center"):3===t?wt(n,"right"):4===t?wt(n,"justify"):5===t?wt(n,"start"):6===t&&wt(n,"end")}function Ft(e,t){const n=pt.get(e);void 0===n&&ae(60);const r=n.createDOM(at,lt);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,lt),Pr(n)?r.setAttribute("data-lexical-text","true"):ji(n)&&r.setAttribute("data-lexical-decorator","true"),Hi(n)){const e=n.__indent,t=n.__size;if(0!==e&&At(r,e),0!==t){const e=t-1;!function(e,t,n,r){const i=_t;_t="",Pt(e,n,0,t,n.getDOMSlot(r)),Dt(n,r),_t=i}(Rt(n,pt),e,n,r)}const i=n.__format;0!==i&&Lt(r,i),n.isInline()||It(null,n,r),os(n)&&(yt+=Le,vt+=Le)}else{const t=n.getTextContent();if(ji(n)){const t=n.decorate(lt,at);null!==t&&zt(e,t),r.contentEditable="false"}else Pr(n)&&(n.isDirectionless()||(_t+=t));yt+=t,vt+=t}return null!==t&&t.insertChild(r),es(mt,ct,ut,n,"created"),r}function Pt(e,t,n,r,i){const o=yt;yt="";let s=n;for(;s<=r;++s){Ft(e[s],i);const t=pt.get(e[s]);null!==t&&Pr(t)&&(null===bt&&(bt=t.getFormat()),""===xt&&(xt=t.getStyle()))}os(t)&&(yt+=Le),i.element.__lexicalTextContent=yt,yt=o+yt}function Ot(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return pr(e)?"line-break":ji(e)&&e.isInline()?"decorator":null}return"empty"}return null}function It(e,t,n){const r=Ot(e,gt),i=Ot(t,pt);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Dt(e,t){const n=t.__lexicalDirTextContent||"",r=t.__lexicalDir||"";if(n!==_t||r!==Et){const n=""===_t,i=n?Et:function(e){return Ie.test(e)?"rtl":De.test(e)?"ltr":null}(_t);if(i!==r){const o=t.classList,s=at.theme;let a=null!==r?s[r]:void 0,l=null!==i?s[i]:void 0;if(void 0!==a){if("string"==typeof a){const e=be(a);a=s[r]=e}o.remove(...a)}if(null===i||n&&"ltr"===i)t.removeAttribute("dir");else{if(void 0!==l){if("string"==typeof l){const e=be(l);l=s[i]=e}void 0!==l&&o.add(...l)}t.dir=i}Ct||(e.getWritable().__dir=i)}Et=i,t.__lexicalDirTextContent=_t,t.__lexicalDir=i}}function Mt(e,t,n){const r=_t;var i;_t="",bt=null,xt="",function(e,t,n){const r=yt,i=e.__size,o=t.__size;yt="";const s=n.element;if(1===i&&1===o){const n=e.__first,i=t.__first;if(n===i)Bt(n,s);else{const e=Wt(n),t=Ft(i,null);try{s.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${s.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(o)}throw r}Tt(n,null)}const o=pt.get(i);Pr(o)&&(null===bt&&(bt=o.getFormat()),""===xt&&(xt=o.getStyle()))}else{const r=Rt(e,gt),a=Rt(t,pt);if(r.length!==i&&ae(227),a.length!==o&&ae(228),0===i)0!==o&&Pt(a,t,0,o-1,n);else if(0===o){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;kt(r,0,i-1,e?null:s),e&&(s.textContent="")}}else!function(e,t,n,r,i,o){const s=r-1,a=i-1;let l,c,u=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=a;){const e=t[d],r=n[h];if(e===r)u=Ut(Bt(r,o.element)),d++,h++;else{void 0===l&&(l=new Set(t)),void 0===c&&(c=new Set(n));const i=c.has(e),s=l.has(r);if(i)if(s){const e=ss(lt,r);e===u?u=Ut(Bt(r,o.element)):(o.withBefore(u).insertChild(e),Bt(r,o.element)),d++,h++}else Ft(r,o.withBefore(u)),h++;else u=Ut(Wt(e)),Tt(e,o.element),d++}const i=pt.get(r);null!==i&&Pr(i)&&(null===bt&&(bt=i.getFormat()),""===xt&&(xt=i.getStyle()))}const g=d>s,p=h>a;if(g&&!p){const t=n[a+1],r=void 0===t?null:lt.getElementByKey(t);Pt(n,e,h,a,o.withBefore(r))}else p&&!g&&kt(t,d,s,o.element)}(t,r,a,i,o,n)}os(t)&&(yt+=Le),s.__lexicalTextContent=yt,yt=r+yt}(e,t,t.getDOMSlot(n)),Dt(t,n),i=t,null==bt||bt===i.__textFormat||Ct||i.setTextFormat(bt),function(e){""===xt||xt===e.__textStyle||Ct||e.setTextStyle(xt)}(t),_t=r}function Rt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&ae(101),n.push(r),r=e.__next}return n}function Bt(e,t){const n=gt.get(e);let r=pt.get(e);void 0!==n&&void 0!==r||ae(61);const i=St||ht.has(e)||dt.has(e),o=ss(lt,e);if(n===r&&!i){if(Hi(n)){const e=o.__lexicalTextContent;void 0!==e&&(yt+=e,vt+=e);const t=o.__lexicalDirTextContent;void 0!==t&&(_t+=t)}else{const e=n.getTextContent();Pr(n)&&!n.isDirectionless()&&(_t+=e),vt+=e,yt+=e}return o}if(n!==r&&i&&es(mt,ct,ut,r,"updated"),r.updateDOM(n,o,at)){const n=Ft(e,null);return null===t&&ae(62),t.replaceChild(n,o),Tt(e,null),n}if(Hi(n)&&Hi(r)){const e=r.__indent;e!==n.__indent&&At(o,e);const t=r.__format;t!==n.__format&&Lt(o,t),i&&(Mt(n,r,o),Ji(r)||r.isInline()||It(n,r,o)),os(r)&&(yt+=Le,vt+=Le)}else{const t=r.getTextContent();if(ji(r)){const t=r.decorate(lt,at);null!==t&&zt(e,t)}else Pr(r)&&!r.isDirectionless()&&(_t+=t);yt+=t,vt+=t}if(!Ct&&Ji(r)&&r.__cachedText!==vt){const e=r.getWritable();e.__cachedText=vt,r=e}return o}function zt(e,t){let n=lt._pendingDecorators;const r=lt._decorators;if(null===n){if(r[e]===t)return;n=Io(lt)}n[e]=t}function Ut(e){let t=e.nextSibling;return null!==t&&t===lt._blockCursorElement&&(t=t.nextSibling),t}function Wt(e){const t=ft.get(e);return void 0===t&&ae(75,e),t}function Ht(e){return{type:e}}const $t=Ht("SELECTION_CHANGE_COMMAND"),Kt=Ht("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),jt=Ht("CLICK_COMMAND"),qt=Ht("DELETE_CHARACTER_COMMAND"),Jt=Ht("INSERT_LINE_BREAK_COMMAND"),Vt=Ht("INSERT_PARAGRAPH_COMMAND"),Gt=Ht("CONTROLLED_TEXT_INSERTION_COMMAND"),Yt=Ht("PASTE_COMMAND"),Zt=Ht("REMOVE_TEXT_COMMAND"),Xt=Ht("DELETE_WORD_COMMAND"),Qt=Ht("DELETE_LINE_COMMAND"),en=Ht("FORMAT_TEXT_COMMAND"),tn=Ht("UNDO_COMMAND"),nn=Ht("REDO_COMMAND"),rn=Ht("KEYDOWN_COMMAND"),on=Ht("KEY_ARROW_RIGHT_COMMAND"),sn=Ht("MOVE_TO_END"),an=Ht("KEY_ARROW_LEFT_COMMAND"),ln=Ht("MOVE_TO_START"),cn=Ht("KEY_ARROW_UP_COMMAND"),un=Ht("KEY_ARROW_DOWN_COMMAND"),dn=Ht("KEY_ENTER_COMMAND"),hn=Ht("KEY_SPACE_COMMAND"),gn=Ht("KEY_BACKSPACE_COMMAND"),pn=Ht("KEY_ESCAPE_COMMAND"),fn=Ht("KEY_DELETE_COMMAND"),mn=Ht("KEY_TAB_COMMAND"),yn=Ht("INSERT_TAB_COMMAND"),_n=Ht("INDENT_CONTENT_COMMAND"),bn=Ht("OUTDENT_CONTENT_COMMAND"),xn=Ht("DROP_COMMAND"),vn=Ht("FORMAT_ELEMENT_COMMAND"),Sn=Ht("DRAGSTART_COMMAND"),Cn=Ht("DRAGOVER_COMMAND"),En=Ht("DRAGEND_COMMAND"),Tn=Ht("COPY_COMMAND"),kn=Ht("CUT_COMMAND"),wn=Ht("SELECT_ALL_COMMAND"),Nn=Ht("CLEAR_EDITOR_COMMAND"),An=Ht("CLEAR_HISTORY_COMMAND"),Ln=Ht("CAN_REDO_COMMAND"),Fn=Ht("CAN_UNDO_COMMAND"),Pn=Ht("FOCUS_COMMAND"),On=Ht("BLUR_COMMAND"),In=Ht("KEY_MODIFIER_COMMAND"),Dn=Object.freeze({}),Mn=[["keydown",function(e,t){if(!(Rn=e.timeStamp,Bn=e.key,t.isComposing()||is(t,rn,e)||null==e.key)){if(qn&&Zo(e))return Bi(t,(()=>{nr(t,Jn)})),qn=!1,void(Jn="");if(function(e){return Vo(e,"ArrowRight",{shiftKey:"any"})}(e))is(t,on,e);else if(function(e){return Vo(e,"ArrowRight",Go)}(e))is(t,sn,e);else if(function(e){return Vo(e,"ArrowLeft",{shiftKey:"any"})}(e))is(t,an,e);else if(function(e){return Vo(e,"ArrowLeft",Go)}(e))is(t,ln,e);else if(function(e){return Vo(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))is(t,cn,e);else if(function(e){return Vo(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))is(t,un,e);else if(function(e){return Vo(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))Kn=!0,is(t,dn,e);else if(function(e){return" "===e.key}(e))is(t,hn,e);else if(function(e){return ue&&Vo(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),Kn=!0,is(t,Jt,!0);else if(function(e){return Vo(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))Kn=!1,is(t,dn,e);else if(function(e){return Vo(e,"Backspace",{shiftKey:"any"})||ue&&Vo(e,"h",{ctrlKey:!0})}(e))Zo(e)?is(t,gn,e):(e.preventDefault(),is(t,qt,!0));else if(function(e){return"Escape"===e.key}(e))is(t,pn,e);else if(function(e){return Vo(e,"Delete",{})||ue&&Vo(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),is(t,qt,!1)):is(t,fn,e);else if(function(e){return Vo(e,"Backspace",Yo)}(e))e.preventDefault(),is(t,Xt,!0);else if(function(e){return Vo(e,"Delete",Yo)}(e))e.preventDefault(),is(t,Xt,!1);else if(function(e){return ue&&Vo(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),is(t,Qt,!0);else if(function(e){return ue&&(Vo(e,"Delete",{metaKey:!0})||Vo(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),is(t,Qt,!1);else if(function(e){return Vo(e,"b",Go)}(e))e.preventDefault(),is(t,en,"bold");else if(function(e){return Vo(e,"u",Go)}(e))e.preventDefault(),is(t,en,"underline");else if(function(e){return Vo(e,"i",Go)}(e))e.preventDefault(),is(t,en,"italic");else if(function(e){return Vo(e,"Tab",{shiftKey:"any"})}(e))is(t,mn,e);else if(function(e){return Vo(e,"z",Go)}(e))e.preventDefault(),is(t,tn,void 0);else if(function(e){return ue?Vo(e,"z",{metaKey:!0,shiftKey:!0}):Vo(e,"y",{ctrlKey:!0})||Vo(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),is(t,nn,void 0);else{const n=t._editorState._selection;null===n||Hr(n)?Xo(e)&&(e.preventDefault(),is(t,wn,e)):function(e){return Vo(e,"c",Go)}(e)?(e.preventDefault(),is(t,Tn,e)):function(e){return Vo(e,"x",Go)}(e)?(e.preventDefault(),is(t,kn,e)):Xo(e)&&(e.preventDefault(),is(t,wn,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&is(t,In,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;vs(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Bi(t,(()=>{po(n)||($n=!0)}))}],["compositionstart",function(e,t){Bi(t,(()=>{const n=oi();if(Hr(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();No(r.key),(e.timeStamp{nr(t,e.data)})):(qn=!0,Jn=e.data)}],["input",function(e,t){e.stopPropagation(),Bi(t,(()=>{if(xs(e.target)&&po(e.target))return;const n=oi(),r=e.data,i=tr(e);if(null!=r&&Hr(n)&&Yn(n,i,r,e.timeStamp,!1)){jn&&(nr(t,r),jn=!1);const i=n.anchor.getNode(),o=_s(hs(t));if(null===o)return;const s=n.isBackward(),a=s?n.anchor.offset:n.focus.offset,l=s?n.focus.offset:n.anchor.offset;he&&!n.isCollapsed()&&Pr(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Ko(o.anchorNode)||is(t,Gt,r);const c=r.length;de&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),ge||pe||_e||!t.isComposing()||(Rn=0,No(null))}else jo(!1,t,null!==r?r:void 0),jn&&(nr(t,r||void 0),jn=!1);!function(){Ci();Xe(ki())}()}),{event:e}),Un=null}],["click",function(e,t){Bi(t,(()=>{const n=oi(),r=_s(hs(t)),i=si();if(r)if(Hr(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!Ji(o)&&1===Mo().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){const e=function(e,t){let n=e;for(;n!==Mo()&&null!=n;){if(t(n))return n;n=n.getParent()}return null}(o,(e=>Hi(e)&&!e.isInline()));Hi(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(xs(n)||So(n))&&Bo(ii(i,r,t,e))}is(t,jt,e)}))}],["cut",Dn],["copy",Dn],["dragstart",Dn],["dragover",Dn],["dragend",Dn],["paste",Dn],["focus",Dn],["blur",Dn],["drop",Dn]];he&&Mn.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=tr(e);"deleteCompositionText"===n||de&&rs(t)||"insertCompositionText"!==n&&Bi(t,(()=>{const i=oi();if("deleteContentBackward"===n){if(null===i){const e=si();if(!Hr(e))return;Bo(e.clone())}if(Hr(i)){const n=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===Bn&&o{Bi(t,(()=>{No(null)}))}),30),Hr(i)){const e=i.anchor.getNode();e.markDirty(),Pr(e)||ae(142),er(i,e)}}else{No(null),e.preventDefault();const r=i.anchor.getNode(),o=r.getTextContent(),s=r.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===o.length;let l=ye&&n&&!a&&s;if(l&&i.isCollapsed()&&(l=!ji(ns(i.anchor,!0))),!l){is(t,qt,!0);const e=oi();ye&&Hr(e)&&e.isCollapsed()&&(Vn=e,setTimeout((()=>Vn=null)))}}return}}var o;if(!Hr(i))return;const s=e.data;null!==Un&&jo(!1,t,Un),i.dirty&&null===Un||!i.isCollapsed()||Ji(i.anchor.getNode())||null===r||i.applyDOMRange(r),Un=null;const a=i.anchor,l=i.focus,c=a.getNode(),u=l.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":is(t,Gt,e);break;case"insertFromComposition":No(null),is(t,Gt,e);break;case"insertLineBreak":No(null),is(t,Jt,!1);break;case"insertParagraph":No(null),Kn&&!pe?(Kn=!1,is(t,Jt,!1)):is(t,Vt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":is(t,Yt,e);break;case"deleteByComposition":(function(e,t){return e!==t||Hi(e)||Hi(t)||!xo(e)||!xo(t)})(c,u)&&is(t,Zt,e);break;case"deleteByDrag":case"deleteByCut":is(t,Zt,e);break;case"deleteContent":is(t,qt,!1);break;case"deleteWordBackward":is(t,Xt,!0);break;case"deleteWordForward":is(t,Xt,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":is(t,Qt,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":is(t,Qt,!1);break;case"formatStrikeThrough":is(t,en,"strikethrough");break;case"formatBold":is(t,en,"bold");break;case"formatItalic":is(t,en,"italic");break;case"formatUnderline":is(t,en,"underline");break;case"historyUndo":is(t,tn,void 0);break;case"historyRedo":is(t,nn,void 0)}else{if("\n"===s)e.preventDefault(),is(t,Jt,!1);else if(s===Le)e.preventDefault(),is(t,Vt,void 0);else if(null==s&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=s&&Yn(i,r,s,e.timeStamp,!0)?(e.preventDefault(),is(t,Gt,s)):Un=s;zn=e.timeStamp}}))}(e,t)]);let Rn=0,Bn=null,zn=0,Un=null;const Wn=new WeakMap;let Hn=!1,$n=!1,Kn=!1,jn=!1,qn=!1,Jn="",Vn=null,Gn=[0,"",0,"root",0];function Yn(e,t,n,r,i){const o=e.anchor,s=e.focus,a=o.getNode(),l=ki(),c=_s(hs(l)),u=null!==c?c.anchorNode:null,d=o.key,h=l.getElementByKey(d),g=n.length;return d!==s.key||!Pr(a)||(!i&&(!he||zn1||(i||!he)&&null!==h&&!a.isComposing()&&u!==Co(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||a.getFormat()!==e.format||a.getStyle()!==e.style||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=xo(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Pr(t)||Hi(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,a)}function Zn(e,t){return So(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function Xn(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;Hn&&(Hn=!1,Zn(r,i)&&Zn(o,s)&&!Vn)||Bi(t,(()=>{if(!n)return void Bo(null);if(!mo(t,r,o))return;let a=oi();if(Vn&&Hr(a)&&a.isCollapsed()){const e=a.anchor,t=Vn.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(a=Vn.clone(),Bo(a))}if(Vn=null,Hr(a)){const n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);const i=hs(t).event,o=i?i.timeStamp:performance.now(),[s,l,c,u,d]=Gn,h=Mo(),g=!1===t.isComposing()&&""===h.getTextContent();if(o{const r=si(),i=t.anchorNode;(xs(i)||So(i))&&Bo(ii(r,t,n,e))})));const r=Ho(n),i=r[r.length-1],o=i._key,s=ir.get(o),a=s||i;a!==n&&Xn(t,a,!1),Xn(t,n,!0),n!==i?ir.set(o,n):s&&ir.delete(o)}function sr(e){e._lexicalHandled=!0}function ar(e){return!0===e._lexicalHandled}function lr(e){const t=e.ownerDocument,n=Wn.get(t);if(void 0===n)return;const r=n-1;r>=0||ae(164),Wn.set(t,r),0===r&&t.removeEventListener("selectionchange",or);const i=bo(e);yo(i)?(function(e){if(null!==e._parentEditor){const t=Ho(e),n=t[t.length-1]._key;ir.get(n)===e&&ir.delete(n)}else ir.delete(e._key)}(i),e.__lexicalEditor=null):i&&ae(198);const o=rr(e);for(let e=0;ee.__key===this.__key));if(Pr(this))return n;if(Hr(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(ji(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Lo(e)}getParentOrThrow(){const e=this.getParent();return null===e&&ae(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(gs(t))return Hi(e)||e===this&&ji(e)||ae(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&ae(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Lo(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Lo(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Hi(this)?this:this.getParent(),n=Hi(e)?e:e.getParent(),r=t&&n?ca(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=ca(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===sa(t):("same"!==t.type&&"ancestor"!==t.type&&ae(279),!1)))}isParentOf(e){const t=ca(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;const s=Hi(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}const l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let c=null,u=l;do{if(null===u&&ae(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=ki()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=Lo(this.__key);return null===e&&ae(113),e}getWritable(){Ci();const e=Ti(),t=ki(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=oi();if(null!==s&&s.setCachedNodes(null),o.has(r))return wo(i),i;const a=Fs(i);return o.add(r),wo(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){ae(70)}updateDOM(e,t,n){ae(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){ae(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable();return(t||n.__state)&&function(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new et(t);return t.__state=n,n}(e).updateFromJSON(t),n}(this,e.$)}static transform(){return null}remove(e){cr(this,!0,e)}replace(e,t){Ci();let n=oi();null!==n&&(n=n.clone()),fs(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;ko(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(cr(r,!1,!0),null===c?a.__first=o:c.getWritable().__next=o,s.__prev=d,null===u?a.__last=o:u.getWritable().__prev=o,s.__next=h,s.__parent=g,a.__size=l,t&&(Hi(this)&&Hi(s)||ae(139),this.getChildren().forEach((e=>{s.append(e)}))),Hr(n)){Bo(n);const e=n.anchor,t=n.focus;e.key===i&&Ur(e,s),t.key===i&&Ur(t,s)}return Ao()===i&&No(o),s}insertAfter(e,t=!0){Ci(),fs(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=oi();let s=!1,a=!1;if(null!==i){const t=e.getIndexWithinParent();if(ko(r),Hr(o)){const e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}const l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===l?c.__last=u:l.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Hr(o)){const e=this.getIndexWithinParent();ai(o,c,e+1);const t=c.__key;s&&o.anchor.set(t,e+2,"element"),a&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){Ci(),fs(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;ko(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;const c=oi();return t&&Hr(c)&&ai(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return so()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Ci();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Hi(n))return n.select();if(!Pr(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Ci();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Hi(n))return n.select(0,0);if(!Pr(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class dr extends ur{static getType(){return"linebreak"}static clone(e){return new dr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&Es(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&fr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&fr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&Es(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&fr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&fr(r))return!0}return!1}(e)?null:{conversion:hr,priority:0}}}static importJSON(e){return gr().updateFromJSON(e)}}function hr(e){return{node:gr()}}function gr(){return ps(new dr)}function pr(e){return e instanceof dr}function fr(e){return So(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function mr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function yr(e,t){return 1&t?"strong":2&t?"em":"span"}function _r(e,t,n,r,i){const o=r.classList;let s=Qo(i,"base");void 0!==s&&o.add(...s),s=Qo(i,"underlineStrikethrough");let a=!1;const l=8&t&&4&t;void 0!==s&&(8&n&&4&n?(a=!0,l||o.add(...s)):l&&o.remove(...s));for(const e in Me){const r=Me[e];if(s=Qo(i,e),void 0!==s)if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}t&r&&(!l||"underline"!==e)&&"strikethrough"!==e||o.add(...s)}else t&r&&o.remove(...s)}}function br(e,t,n){const r=t.firstChild,i=n.isComposing(),o=e+(i?Ae:"");if(null==r)t.textContent=o;else{const e=r.nodeValue;if(e!==o)if(i||de){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,o=0;for(;i({conversion:wr,priority:0}),b:()=>({conversion:Er,priority:0}),code:()=>({conversion:Lr,priority:0}),em:()=>({conversion:Lr,priority:0}),i:()=>({conversion:Lr,priority:0}),mark:()=>({conversion:Lr,priority:0}),s:()=>({conversion:Lr,priority:0}),span:()=>({conversion:Cr,priority:0}),strong:()=>({conversion:Lr,priority:0}),sub:()=>({conversion:Lr,priority:0}),sup:()=>({conversion:Lr,priority:0}),u:()=>({conversion:Lr,priority:0})}}static importJSON(e){return Fr().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return xs(t)||ae(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=vr(t,"b")),this.hasFormat("italic")&&(t=vr(t,"i")),this.hasFormat("strikethrough")&&(t=vr(t,"s")),this.hasFormat("underline")&&(t=vr(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Me[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Re[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Eo(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Ue[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){Ci();let n=e,r=t;const i=oi(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Hr(i))return ti(s,n,s,r,"text","text");{const e=Ao();e!==i.anchor.key&&e!==i.focus.key||No(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let a=e;a<0&&(a=s+a,a<0&&(a=0));const l=oi();if(r&&Hr(l)){const t=e+s;l.setTextNodeRange(i,t,i,t)}const c=o.slice(0,a)+n+o.slice(a+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Ci();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Ao(),o=n.length;e.sort(((e,t)=>e-t)),e.push(o);const s=[],a=e.length;for(let t=0,r=0;tt&&(s.push(n.slice(t,i)),t=i)}const l=s.length;if(1===l)return[t];const c=s[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const _=oi();if(Hr(_)){const[e,t]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=Fr(c),d.__format=h,d.__style=g,d.__detail=p,f=!0):d=t.setTextContent(c);const b=[d];for(let e=1;e=S&&(m.set(e.getKey(),x-S,"text"),x=S){y.set(e.getKey(),v-S,"text");break}S=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&wo(t),null!==n&&wo(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,b),this.remove()):e.splice(t,1,b),Hr(_)&&ai(_,u,t,l-1)}return b}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||ae(50);const n=this.__key,r=e.__key,i=this.__text,o=i.length;Ao()===r&&No(n);const s=oi();if(Hr(s)){const i=s.anchor,a=s.focus;null!==i&&i.key===r&&ui(i,t,n,e,o),null!==a&&a.key===r&&ui(a,t,n,e,o)}const a=e.__text,l=t?a+i:i+a;this.setTextContent(l);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Cr(e){return{forChild:Or(e.style),node:null}}function Er(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Or(t.style,n?void 0:"bold"),node:null}}const Tr=new WeakMap;function kr(e){if(!xs(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function wr(e){const t=e;null===e.parentElement&&ae(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=Tr.get(n))&&!kr(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=Nr(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:Fr(n)}}function Nr(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,xs(n)){const e=n.style.display;if(""===e&&!Cs(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(So(n))return n;if("BR"===n.nodeName)return null}}const Ar={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Lr(e){const t=Ar[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Or(e.style,t),node:null}}function Fr(e=""){return ps(new Sr(e))}function Pr(e){return e instanceof Sr}function Or(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>Pr(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Ir extends Sr{static getType(){return"tab"}static clone(e){return new Ir(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=Qo(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Dr().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&ae(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||ae(286),this}setDetail(e){return 2!==e&&ae(127),this}setMode(e){return"normal"!==e&&ae(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Dr(){return ps(new Ir)}function Mr(e){return e instanceof Ir}class Rr{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offsete&&(r=e)}else if(!Hi(t)){const e=t.getNextSibling();if(Pr(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Ur(e,t){if(Hi(t)){const n=t.getLastDescendant();Hi(n)||Pr(n)?zr(e,n):zr(e,t)}else zr(e,t)}class Wr{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Kr(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Wr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(Pr(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e1;){const e=t[t.length-1];if(!Hi(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=ba(e.anchor),r=ba(e.anchor.getFlipped()),i=e=>Hs(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(Sa(pa(this),"next"));return Si()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,a]=qr(this);let l="",c=!0;for(let u=0;u=0;e--){const t=o[e];if(t.is(d)||Hi(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(xo(d))if(a===h)d.select();else{const t=Fr(e);t.select(),d.replace(t)}else d=d.spliceText(a,h-a,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(Hi(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),No(null),void i(t);const s=this.anchor,a=this.focus,l=this.isBackward(),c=l?a:s,u=l?s:a;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=o-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(vo(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||vo(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const _=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||vo(m)||([m]=m.splitText(y)),m.setFormat(_));for(let t=d+1;t(Hi(e)||ji(e))&&!e.isInline()))){Hi(n)||ae(211,t.constructor.name,t.getType());const i=gi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=so();let n=null;for(let r=0;rl?l:a,t=a>l?a:l,n=o.splitText(e,t),r=0===e?n[0]:n[1];return null!=r?[r]:[]}return[o]}const c=r.isBefore(i);if(Pr(o)){const t=c?a:l;t===o.getTextContentSize()?e.shift():0!==t&&([,o]=o.splitText(t),e[0]=o)}if(Pr(s)){const t=s.getTextContent().length,r=c?l:a;0===r?e.pop():r!==t&&([s]=s.splitText(r),e[n]=s)}return e}modify(e,t,n){if(fi(this,e,t,n))return;const r="move"===e,i=ki(),o=_s(hs(i));if(!o)return;const s=i._blockCursorElement,a=i._rootElement,l=this.focus.getNode();if(null===a||null===s||!Hi(l)||l.isInline()||l.canBeEmpty()||ys(s,i,a),this.dirty){let e=ss(i,this.anchor.key),t=ss(i,this.focus.key);"text"===this.anchor.type&&(e=Co(e)),"text"===this.focus.type&&(t=Co(t)),e&&t&&di(o,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(o,e,t?"backward":"forward",n),o.rangeCount>0){const e=o.getRangeAt(0),n=this.anchor.getNode(),i=Ji(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(gs(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e0)if(t){const e=r[0];Hi(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Hi(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}o.anchorNode===e.startContainer&&o.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,o=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,o,!0)}(this)}}"lineboundary"===n&&fi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Hi(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Hi(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=na(ua(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(Ks(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Hi(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=ba(t);ga(this,ra(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if($s(t)){if(Hi(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(ji(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Hi(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=ri();e.add(t.origin.getKey()),Bo(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return ga(this,ra(!t.origin.isEmpty()&&n.isEmpty()?fa(Vs(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&Jr(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Gr(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Gr(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,o=r.offset,s=e{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Gr(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,a=0;for(let e=0;en||r){i.splice(e,1),r&&(a=void 0);break}}const l=i.join("").trim();""===l?r.remove():(r.setTextContent(l),r.select(a,a))}function Yr(e,t,n,r){let i,o=t;if(xs(e)){let s=!1;const a=e.childNodes,l=a.length,c=r._blockCursorElement;o===l&&(s=!0,o=l-1);let u=a[o],d=!1;if(u===c)u=a[o+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&o--}if(i=zo(u),Pr(i))o=Uo(i,s);else{let a=zo(e);if(null===a)return null;if(Hi(a)){const l=r.getElementByKey(a.getKey());null===l&&ae(214);const c=a.getDOMSlot(l);[a,o]=c.resolveChildIndex(a,l,e,t),Hi(a)||ae(215),s&&o>=a.getChildrenSize()&&(o=Math.max(0,a.getChildrenSize()-1));let u=a.getChildAtIndex(o);if(Hi(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=s?u.getLastDescendant():u.getFirstDescendant();null===e?a=u:(u=e,a=Hi(u)?u:u.getParentOrThrow()),o=0}Pr(u)?(i=u,a=null,o=Uo(u,s)):u!==a&&s&&!d&&(Hi(a)||ae(216),o=Math.min(a.getChildrenSize(),o+1))}else{const n=a.getIndexWithinParent();o=0===t&&ji(a)&&zo(e)===a?n:n+1,a=a.getParentOrThrow()}if(Hi(a))return Br(a.__key,o,"element")}}else i=zo(e);return Pr(i)?Br(i.__key,o,"text"):null}function Zr(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&Hi(o)&&o.isInline()){const t=o.getPreviousSibling();Pr(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Hi(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Pr(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(t&&Hi(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Hi(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();Pr(t)&&e.set(t.__key,0,"text")}}}function Xr(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);Zr(e,r,i),Zr(t,!r,i),i&&t.set(e.key,e.offset,e.type);const o=ki();if(o.isComposing()&&o._compositionKey!==e.key&&Hr(n)){const r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function Qr(e,t,n,r,i,o){if(null===e||null===n||!mo(i,e,n))return null;const s=Yr(e,t,Hr(o)?o.anchor:null,i);if(null===s)return null;const a=Yr(n,r,Hr(o)?o.focus:null,i);if(null===a)return null;if("element"===s.type&&"element"===a.type){const t=zo(e),r=zo(n);if(ji(t)&&ji(r))return null}return Xr(s,a,o),[s,a]}function ei(e){return Hi(e)&&!e.isInline()}function ti(e,t,n,r,i,o){const s=Ti(),a=new $r(Br(e,t,i),Br(n,r,o),0,"");return a.dirty=!0,s._selection=a,a}function ni(){const e=Br("root",0,"element"),t=Br("root",0,"element");return new $r(e,t,0,"")}function ri(){return new Wr(new Set)}function ii(e,t,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,a="selectionchange"===s,l=!Ke&&(a||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let c,u,d,h;if(Hr(e)&&!l)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,a&&Hr(e)&&!mo(n,c,u))return e.clone();const g=Qr(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;return new $r(p,f,Hr(e)?e.format:0,Hr(e)?e.style:"")}function oi(){return Ti()._selection}function si(){return ki()._editorState._selection}function ai(e,t,n,r=1){const i=e.anchor,o=e.focus,s=i.getNode(),a=o.getNode();if(!t.is(s)&&!t.is(a))return;const l=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n0||n0||n=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Pr(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(Hi(o)){const e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Pr(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Hi(s)){const e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(Pr(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function ci(e,t,n,r,i){let o=null,s=0,a=null;null!==r?(o=r.__key,Pr(r)?(s=r.getTextContentSize(),a="text"):Hi(r)&&(s=r.getChildrenSize(),a="element")):null!==i&&(o=i.__key,Pr(i)?a="text":Hi(i)&&(a="element")),null!==o&&null!==a?e.set(o,s,a):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function ui(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function di(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function hi(e){let t=oi()||si();null===t&&(t=Mo().selectEnd()),t.insertNodes(e)}function gi(e){let t=e;e.isCollapsed()||t.removeText();const n=oi();Hr(n)&&(t=n),Hr(t)||ae(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!Ts(i);){const e=i;if([i,o]=pi(i,o),e.is(i))break}return o}function pi(e,t){const n=e.getParent();if(!n){const e=so();return Mo().append(e),e.select(),[Mo(),0]}if(Pr(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Hi(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new $r(Br(e.__key,t,"element"),Br(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function fi(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const o=ua(e.focus,n?"previous":"next"),s="lineboundary"===r,a="move"===t;let l=o,c="decorators-and-blocks"===i;if(!xa(l)){for(const e of l){c=!1;const{origin:t}=e;if(!ji(t)||t.isIsolated()||(l=e,!s||!t.isInline()))break}if(c)for(const e of na(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Ks(e))e.origin.isInline()||(l=e);else{if(Hi(e.origin))continue;ji(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===o)return!1;if(a&&!s&&ji(l.origin)&&l.origin.isKeyboardSelectable()){const e=ri();return e.add(l.origin.getKey()),Bo(e),!0}return l=ba(l),a&&da(e.anchor,l),da(e.focus,l),c||!s}let mi=null,yi=null,_i=!1,bi=!1,xi=0;const vi={characterData:!0,childList:!0,subtree:!0};function Si(){return _i||null!==mi&&mi._readOnly}function Ci(){_i&&ae(13)}function Ei(){xi>99&&ae(14)}function Ti(){return null===mi&&ae(195,wi()),mi}function ki(){return null===yi&&ae(196,wi()),yi}function wi(){let e=0;const t=new Set,n=uo.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=bo(r);if(yo(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function Ni(e,t,n){const r=t.__type,i=function(e,t){const n=e._nodes.get(t);return void 0===n&&ae(30,t),n}(e,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let e=0;e0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=ls(n),i=ds(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,a=0,l=0,c=n;for(;null!==c;){const t=c===r.body;if(t)a=0,l=hs(e).innerHeight;else{const e=c.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(ol&&(n=s-l),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;o-=t,s-=t}if(t)break;c=as(c)}}(n,t,o)}}Hn=!0}}(s,a,e,x,_,r)}!function(e,t,n){let r=e._blockCursorElement;if(Hr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let a=!1,l=null;if(s===o.getChildrenSize())ms(o.getChildAtIndex(s-1))&&(a=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&ms(t)){const n=t.getPreviousSibling();(null===n||ms(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){const n=e.getElementByKey(o.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=be(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===l?n.appendChild(r):n.insertBefore(r,l))}}null!==r&&ys(r,e,t)}(e,r,a)}finally{null!==g&&g.observe(r,vi),yi=d,mi=c}}null!==p&&function(e,t,n,r,i){const o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e0||u>0;){if(l>0){t._dirtyLeaves=new Set;for(const e of a){const r=i.get(e);Pr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&it(r),void 0!==r&&Ai(r,o)&&Ni(t,r,s),n.add(e)}if(a=t._dirtyLeaves,l=a.size,l>0){xi++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],a=e[1];if(r.set(n,a),!a)continue;const l=i.get(n);void 0!==l&&Ai(l,o)&&Ni(t,l,s)}a=t._dirtyLeaves,l=a.size,c=t._dirtyElements,u=c.size,xi++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Mi(e),function(e,t,n,r){const i=e._nodeMap,o=t._nodeMap,s=[];for(const[e]of r){const t=o.get(e);void 0!==t&&(t.isAttached()||(Hi(t)&&$e(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(const e of s)o.delete(e);for(const e of n){const t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);const i=l._selection;if(Hr(i)){const e=l._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||ae(19)}else Kr(i)&&0===i._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ii(e)}finally{mi=u,_i=d,yi=h,e._updating=g,xi=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(l,e);f?l._flushSync?(l._flushSync=!1,Ii(e)):c&&go((()=>{Ii(e)})):(l._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Bi(e,t,n){yi===e&&void 0===n?t():Ri(e,t,n)}class zi{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new zi(this.element,e,this.after)}withAfter(e){return new zi(this.element,this.before,e)}withElement(e){return this.element===e?this:new zi(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&ae(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&ae(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&ae(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(pe||ge);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=Ui(t,n);i.push(r);const o=Ui(t,this.element);let s=e.getIndexWithinParent();for(let e=0;en){s+=1;break}}return[e.getParentOrThrow(),s]}}function Ui(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&ae(225),n.reverse()}class Wi extends ur{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return ze[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=ki()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(Pr(t)&&e.push(t),Hi(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Hi(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Hi(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return Hi(e)&&e.getLastDescendant()||e||null}const r=t[e];return Hi(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Lo(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&ae(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Lo(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&ae(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;re.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?Be[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const r=n.length,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||ae(226,String(e),String(t),String(i));const s=o.__key,a=[],l=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Hi(e){return e instanceof Wi}function $i(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Ki extends ur{decorate(e,t){ae(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function ji(e){return e instanceof Ki}class qi extends Wi{static getType(){return"root"}static clone(){return new qi}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ae(51)}getTextContent(){const e=this.__cachedText;return!Si()&&0!==ki()._dirtyType||null===e?super.getTextContent():e}remove(){ae(52)}replace(e){ae(53)}insertBefore(e){ae(54)}insertAfter(e){ae(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Hi(e)||ji(e)||ae(282);return super.splice(e,t,n)}static importJSON(e){return Mo().updateFromJSON(e)}collapseAtStart(){return!0}}function Ji(e){return e instanceof qi}function Vi(e){return new Zi(new Map(e._nodeMap))}function Gi(){return new Zi(new Map([["root",new qi]]))}function Yi(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ae(130,n.name),Hi(e)){const r=t.children;Array.isArray(r)||ae(59,n.name);const i=e.getChildren();for(let e=0;e({root:Yi(Mo())})))}}const Xi="historic",Qi="history-merge",eo="collaboration",to="skip-scroll-into-view",no="skip-dom-selection";class ro extends Wi{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class io extends Wi{static getType(){return"paragraph"}static clone(e){return new io(e.__key)}createDOM(e){const t=document.createElement("p"),n=Qo(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:oo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return so().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=so();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||Pr(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function oo(e){const t=so();return e.style&&(t.setFormat(e.style.textAlign),Ps(e,t)),{node:t}}function so(){return ps(new io)}function ao(e){return e instanceof io}function lo(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Gi(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function co(e){const t=e||{},n=yi,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Gi(),a=t.namespace||(null!==i?i._config.namespace:$o()),l=t.editorState,c=[qi,Sr,dr,Ir,io,ro,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==l&&(p._pendingEditorState=l,p._dirtyType=2),p}class uo{constructor(e,t,n,r,i,o,s,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=$o(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&ae(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&ae(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,r);const o=n&&n.skipInitialization;return void 0!==o&&o||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&ae(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Ls(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=Ls(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=Lo(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Qi}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return is(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=Qo(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,lo(this,t,e,r),null!==t&&(this._config.disableEvents||lr(t),null!=n&&t.classList.remove(...n)),null!==e){const t=ds(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,Qe(this),this._updateTags.add(Qi),Ii(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=Wn.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",or),Wn.set(n,(r||0)+1),e.__lexicalEditor=t;const i=rr(e);for(let n=0;n{ar(e)||(sr(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(ar(e))return;sr(e);const n=t.isEditable();switch(r){case"cut":return n&&is(t,kn,e);case"copy":return is(t,Tn,e);case"paste":return n&&is(t,Yt,e);case"dragstart":return n&&is(t,Sn,e);case"dragover":return n&&is(t,Cn,e);case"dragend":return n&&is(t,En,e);case"focus":return n&&is(t,Pn,e);case"blur":return n&&is(t,On,e);case"drop":return n&&is(t,xn,e)}};e.addEventListener(r,s),i.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Qi),Ii(this);Di("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&ae(38);let n=e;n._readOnly&&(n=Vi(e),n._selection=e._selection?e._selection.clone():null),Xe(this);const r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),Ii(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||Ii(this)}parseEditorState(e,t){return function(e,t,n){const r=Gi(),i=mi,o=_i,s=yi,a=t._dirtyElements,l=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,mi=r,_i=!1,yi=t;try{const i=t._nodes;Pi(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=c,t._dirtyType=u,mi=i,_i=o,yi=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Ii(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Ri(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Bi(this,(()=>{const r=oi(),i=Mo();null!==r?r.dirty||Bo(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),cs("focus"),function(e){Ci(),ki()._deferred.push(e)}((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=_s(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Di("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}uo.version="0.32.1+prod.esm";let ho=1;const go="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function po(e){return ji(Oo(e))}function fo(e){const t=document.activeElement;if(!xs(t))return!1;const n=t.nodeName;return ji(Oo(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==bo(t))}function mo(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!fo(t)&&_o(t)===e}catch(e){return!1}}function yo(e){return e instanceof uo}function _o(e){let t=e;for(;null!=t;){const e=bo(t);if(yo(e))return e;t=as(t)}return null}function bo(e){return e?e.__lexicalEditor:null}function xo(e){return Mr(e)||e.isToken()}function vo(e){return xo(e)||e.isSegmented()}function So(e){return vs(e)&&3===e.nodeType}function Co(e){let t=e;for(;null!=t;){if(So(t))return t;t=t.firstChild}return null}function Eo(e,t,n){const r=Me[t];if(null!==n&&(e&r)==(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function To(e){return Pr(e)||pr(e)||ji(e)}function ko(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,c=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=a),null!==l&&(l.__next=s),null!==c&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function wo(e){Ei();const t=e.getLatest(),n=t.__parent,r=Ti(),i=ki(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);const a=t.__key;i._dirtyType=1,Hi(e)?s.set(a,!0):i._dirtyLeaves.add(a)}function No(e){Ci();const t=ki(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Lo(n);null!==e&&e.getWritable()}if(null!==e){const t=Lo(e);null!==t&&t.getWritable()}}}function Ao(){return Si()?null:ki()._compositionKey}function Lo(e,t){const n=(t||Ti())._nodeMap.get(e);return void 0===n?null:n}function Fo(e,t){const n=Po(e,ki());return void 0!==n?Lo(n,t):null}function Po(e,t){return e[`__lexicalKey_${t._key}`]}function Oo(e,t){let n=e;for(;null!=n;){const e=Fo(n,t);if(null!==e)return e;n=as(n)}return null}function Io(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Do(e){return e.read((()=>Mo().getTextContent()))}function Mo(){return Ro(Ti())}function Ro(e){return e._nodeMap.get("root")}function Bo(e){Ci();const t=Ti();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function zo(e){const t=ki(),n=function(e,t){let n=e;for(;null!=n;){const e=Po(n,t);if(void 0!==e)return e;n=as(n)}return null}(e,t);return null===n?e===t.getRootElement()?Lo("root"):null:Lo(n)}function Uo(e,t){return t?e.getTextContentSize():0}function Wo(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ho(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function $o(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ko(e){return So(e)?e.nodeValue:null}function jo(e,t,n){const r=_s(hs(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=Ko(i);const r=Oo(i);if(null!==t&&Pr(r)){if(t===Ae&&n){const e=n.length;t=n,o=e,s=e}null!==t&&qo(r,t,o,s,e)}}}function qo(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let a=t;(s||i)&&t[t.length-1]===Ae&&(a=t.slice(0,-1));const l=o.getTextContent();if(i||a!==l){if(""===a){if(No(null),ge||pe||_e)o.remove();else{const e=ki();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=si(),l=o.getTextContentSize(),c=Ao(),u=o.getKey();if(o.isToken()||null!==c&&u===c&&!s||Hr(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===l&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const d=oi();if(!Hr(d)||null===n||null===r)return void o.setTextContent(a);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=Fr(o.getTextContent());o.replace(e),o=e}o.setTextContent(a)}}}function Jo(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Vo(e,t,n){return function(e,t){return Jo(e,t,"altKey")&&Jo(e,t,"ctrlKey")&&Jo(e,t,"shiftKey")&&Jo(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const Go={ctrlKey:!ue,metaKey:ue},Yo={altKey:ue,ctrlKey:!ue};function Zo(e){return"Backspace"===e.key}function Xo(e){return Vo(e,"a",Go)}function Qo(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=be(i);return n[t]=e,e}return i}function es(e,t,n,r,i){if(0===n.size)return;const o=r.__type,s=r.__key,a=t.get(o);void 0===a&&ae(33,o);const l=a.klass;let c=e.get(l);void 0===c&&(c=new Map,e.set(l,c));const u=c.get(s),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(s,d?"updated":i)}function ts(e,t,n){const r=e.getParent();let i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function ns(e,t){const n=e.offset;if("element"===e.type)return ts(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?ts(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function rs(e){const t=hs(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function is(e,t,n){return function(e,t,n){const r=Ho(e);for(let i=4;i>=0;i--)for(let o=0;o{for(let t=0;te,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Vs(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Vs(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size0){const t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&ae(263,Array.from(s).join(" "))}else i.insert(e);i=Vs(e,this.direction)}for(const e of s.values())e.remove();return this}}class Ms extends Ds{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Xs(e,this.direction)}getParentCaret(e="root"){return Vs(zs(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Bs(this.direction);return Vs(this.getNodeAtCaret(),e)||Xs(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Ms&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Rs={root:Ji,shadowRoot:gs};function Bs(e){return Is[e]}function zs(e,t="root"){return Rs[t](e)?null:e}class Us extends Ds{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Vs(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Hi(this.origin)?Xs(this.origin,this.direction):null}getParentCaret(e="root"){return Vs(zs(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Bs(this.direction);return Vs(this.getNodeAtCaret(),e)||Xs(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Us&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Us||e instanceof Ws)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Ws extends Ds{type="text";constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Gs(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Vs(zs(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Gs(this.origin,Bs(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Ws&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Us||e instanceof Ws)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Vs(this.origin,this.direction)}}function Hs(e){return e instanceof Ws}function $s(e){return e instanceof Us}function Ks(e){return e instanceof Ms}const js={next:class extends Ws{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ws{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},qs={next:class extends Us{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Us{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Js={next:class extends Ms{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ms{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Vs(e,t){return e?new qs[t](e):null}function Gs(e,t,n){return e?new js[t](e,Ys(e,n)):null}function Ys(e,t){const n=e.getTextContentSize();let r="next"===t?n:"previous"===t?0:t;return(r<0||r>n)&&(function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function Zs(e,t){return new ta(e,t)}function Xs(e,t){return Hi(e)?new Js[t](e):null}function Qs(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class ea{type="node-caret-range";constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new ea(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Hs(t)?function(e,t){const{direction:n,origin:r}=e;return Zs(e,Ys(r,"focus"===t?Bs(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Zs(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Hs(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Hs(n),i=t=>t.isSameNodeCaret(n)?null:Qs(t)||t.getParentCaret(e);return ia({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class ta{type="slice";constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n{let n;for(let r=l;rn.has(e.getKey())&&Ts(e)));return u&&d?[u,d]:null}(u,d,l);if(h){const[e,t]=h;Xs(e,"previous").splice(0,t.getChildren()),t.remove()}const g=[u,d,...s,...a].find(ya);if(g)return function(e){return ra(e,e)}(va(ba(g),e.direction));ae(269,JSON.stringify(s.map((e=>e.origin.__key))))}function ba(e){const t=function(e){let t=e;for(;Ks(t);){const e=Qs(t);if(!Ks(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Pr(t.origin))return Hs(t)?t:Gs(t.origin,n,n);const r=t.getAdjacentCaret();return $s(r)&&Pr(r.origin)?Gs(r.origin,n,Bs(n)):t}function xa(e){return Hs(e)&&e.offset!==Ys(e.origin,e.direction)}function va(e,t){return e.direction===t?e:e.getFlipped()}function Sa(e,t){return e.direction===t?e:ra(va(e.focus,t),va(e.anchor,t))}const Ca=new Map;function Ea(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function Ta(e){let t=Ca.get(e);return void 0===t&&(t=Ea(e),Ca.set(e,t)),t}function ka(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function wa(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!vo(t)&&null!==n){const[r,i]=n,o=e.isBackward(),s=r.getNode(),a=i.getNode(),l=t.is(s),c=t.is(a);if(l||c){const[n,r]=qr(e),i=s.is(a),l=t.is(o?a:s),c=t.is(o?s:a);let u,d=0;i?(d=n>r?r:n,u=n>r?n:r):l?(d=o?r:n,u=void 0):c&&(d=0,u=o?n:r),t.__text=t.__text.slice(d,u)}}return t}function Na(e){const t=e.getStyle(),n=Ea(t);Ca.set(t,n)}function Aa(e,t){(Hr(e)?e.isCollapsed():Pr(e)||Hi(e))||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(280);const n=Ta(Hr(e)?e.style:Pr(e)?e.getStyle():e.getTextStyle()),r=Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}),i=ka(r);Hr(e)||Pr(e)?e.setStyle(i):e.setTextStyle(i),Ca.set(i,r)}function La(e,t){if(Hr(e)&&e.isCollapsed()){Aa(e,t);const n=e.anchor.getNode();Hi(n)&&n.isEmpty()&&Aa(n,t)}Fa((e=>{Aa(e,t)}))}function Fa(e){const t=oi();if(!t)return;const n=new Map;if(Hr(t))for(const e of pa(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const r=t.getNodes();for(const t of r){if(!Pr(t)||!t.canHaveFormat())continue;const[r,o]=(i=t,n.get(i.getKey())||[0,i.getTextContentSize()]);o!==r&&(vo(t)||0===r&&o===t.getTextContentSize()?e(t):e(t.splitText(r,o)[0===r?0:1]))}var i;Hr(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:o}=t;t.set(n.key,n.offset,n.type),n.set(r,i,o)}}(t)}function Pa(e){const t=e.anchor.getNode(),n=Ji(t)?t:t.getParentOrThrow(),r=ws().getElementByKey(n.getKey());if(null===r)return!1;const i=r.ownerDocument.defaultView;return null!==i&&"vertical-rl"===i.getComputedStyle(r).writingMode}function Oa(e,t){const n=Pa(e)?!t:t,r=ua(e.focus,n?"previous":"next");if(xa(r))return!1;for(const e of na(r)){if(Ks(e))return!e.origin.isInline();if(!Hi(e.origin)){if(ji(e.origin))return!0;break}}return!1}function Ia(e,t,n){const r=function(e){const t=e.anchor.getNode();return"rtl"===(Ji(t)?t:t.getParentOrThrow()).getDirection()}(e);let i;i=Pa(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function Da(e,t,n){const r=Ta(e.getStyle());return null!==r&&r[t]||n}function Ma(e,t,n=""){let r=null;const i=e.getNodes(),o=e.anchor,s=e.focus,a=e.isBackward(),l=a?s.offset:o.offset,c=a?s.getNode():o.getNode();if(Hr(e)&&e.isCollapsed()&&""!==e.style){const n=Ta(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")})),se.setConfig({ALLOWED_TAGS:["a","action-text-attachment","b","blockquote","br","code","div","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","q","s","strong","ul"],ALLOWED_ATTR:["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","style","title","url","width"],SAFE_FOR_XML:!1});const za="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ua=za&&"documentMode"in document?document.documentMode:null;function Wa(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function Ha(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function $a(e,...t){const n=Wa(...t);n.length>0&&e.classList.add(...n)}function Ka(e,...t){const n=Wa(...t);n.length>0&&e.classList.remove(...n)}function ja(e){return e?e.getAdjacentCaret():null}function qa(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Ja(e){const t=Va(e,(e=>Hi(e)&&!e.isInline()));return Hi(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(4,e.__key),t}za&&"InputEvent"in window&&!Ua&&new window.InputEvent("input");const Va=(e,t)=>{let n=e;for(;n!==Mo()&&null!=n;){if(t(n))return n;n=n.getParent()}return null};function Ga(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Ya(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Za(e){let t=e.getParent();xl(t)||Ya(40);let n=t;for(;null!==n;)n=n.getParent(),xl(n)&&(t=n);return t}function Xa(e){let t=[];const n=e.getChildren().filter(gl);for(let e=0;e0&&e.append(...i),t.remove()}function sl(e){const t=new Set;if(Qa(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Qa(r)&&Qa(i)){const n=i.getFirstChild();if(xl(n)){n.append(e);const i=r.getFirstChild();xl(i)&&(rl(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Qa(r)){const t=r.getFirstChild();if(xl(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Qa(i)){const t=i.getFirstChild();xl(t)&&t.append(e)}else if(xl(n)){const t=hl().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),o=bl(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function al(e){if(Qa(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(xl(n?n.getParent():void 0)&&gl(n)&&xl(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=t.getListType(),i=hl(),o=bl(r);i.append(o),e.getPreviousSiblings().forEach((e=>o.append(e)));const s=hl(),a=bl(r);s.append(a),rl(a,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(s),n.replace(e)}}}function ll(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}let cl=class e extends Wi{static getType(){return"listitem"}static clone(t){return new e(t.__value,t.__checked,t.__key)}constructor(e,t,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){const r=this.getParent();xl(r)&&"check"===r.getListType()&&function(e,t,n){xl(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],o=t.list,s=o?o.listitem:void 0;let a;if(o&&o.nested&&(a=o.nested.listitem),void 0!==s&&r.push(...ll(s)),o){const e=n.getParent(),t=xl(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||i.push(o.listitemUnchecked),t&&s||i.push(o.listitemChecked),t&&r.push(s?o.listitemChecked:o.listitemUnchecked)}if(void 0!==a){const e=ll(a);n.getChildren().some((e=>xl(e)))?r.push(...e):i.push(...e)}i.length>0&&Ka(e,...i),r.length>0&&$a(e,...r)}(t,n.theme,this);const i=e?e.__style:"",o=this.__style;i!==o&&(""===o?t.removeAttribute("style"):t.style.cssText=o),function(e,t,n){const r=Ta(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Ta(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}static transform(){return e=>{if(gl(e)||Ya(144),null==e.__checked)return;const t=e.getParent();xl(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:ul,priority:0})}}static importJSON(e){return hl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(xl(n)||Ya(39),gl(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=bl(n.getListType());r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Qa(t)&&Qa(n)&&(ol(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=hl().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=so();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=gl(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,o=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(o,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(o,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return xl(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;gl(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Ya(117),(e=Math.floor(e))>=0||Ya(199);let t=this.getIndent();for(;t!==e;)t{xl(e)||Ya(163),function(e){const t=e.getNextSibling();xl(t)&&e.getListType()===t.getListType()&&ol(e,t)}(e),function(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())gl(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),xl(r.getFirstChild())||n++)}(e)}}static importDOM(){return{ol:()=>({conversion:yl,priority:0}),ul:()=>({conversion:yl,priority:0})}}static importJSON(e){return bl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return xs(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e1?r.push(...e):i.push(...e)}}i.length>0&&Ka(e,...i),r.length>0&&$a(e,...r)}function ml(e){const t=[];for(let n=0;n1&&e.forEach((e=>{xl(e)&&t.push(el(e))}))}else t.push(el(r))}return t}function yl(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=bl("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list"))return!0;for(const t of e.childNodes)if(xs(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?bl("check"):bl("bullet")),{after:ml,node:n}}const _l={ol:"number",ul:"bullet"};function bl(e="number",t=1){return ps(new pl(e,t))}function xl(e){return e instanceof pl}const vl=Ht("INSERT_UNORDERED_LIST_COMMAND"),Sl=Ht("INSERT_ORDERED_LIST_COMMAND"),Cl=Ht("REMOVE_LIST_COMMAND");function El(e){return Ha(e.registerCommand(Sl,(()=>(nl("number"),!0)),1),e.registerCommand(vl,(()=>(nl("bullet"),!0)),1),e.registerCommand(Cl,(()=>(function(){const e=oi();if(Hr(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(tl(r,n))t.add(Za(r));else for(let e=0;efunction(){const e=oi();if(!Hr(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!gl(t)||0!==t.getChildrenSize())return!1;const n=Za(t),r=t.getParent();xl(r)||Ya(40);const i=r.getParent();let o;if(gs(i))o=so(),n.insertAfter(o);else{if(!gl(i))return!1;o=hl(),i.insertAfter(o)}o.setTextStyle(e.style).setTextFormat(e.format).select();const s=t.getNextSiblings();if(s.length>0){const e=bl(r.getListType());if(gl(o)){const t=hl();t.append(e),o.insertAfter(t)}else o.insertAfter(e);e.append(...s)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!gl(e)&&!xl(e))break;t=e}t.remove()}(t),!0}()),1),e.registerNodeTransform(cl,(e=>{const t=e.getFirstChild();if(t){if(Pr(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=oi();Hr(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(Sr,(e=>{const t=e.getParent();if(gl(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function Tl(e,t){const n=t.body?t.body.childNodes:[];let r=[];const i=[];for(let t=0;t{const e=new ro;return n.push(e),e}:so)),null==a?h.length>0?s=s.concat(h):Es(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(Cs(e.nextSibling)&&Cs(e.previousSibling))}(e)&&(s=s.concat(gr())):Hi(a)&&a.append(...h),s}function Ll(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Fl(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return Pl(n,function(e){const t=[];for(let n=0;ne}).createHTML(e):e}(i),"text/html")),t)}catch(e){}const s=o||e.getData("text/uri-list");if(null!=s)if(Hr(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t0?l.text=e:i=!1}for(let r=0;r{e.update((()=>{r(Ml(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=window.document,s=_s(i);if(null===r||null===s)return!1;const a=o.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(o.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise(((t,r)=>{const i=e.registerCommand(Tn,(r=>(Ga(r,ClipboardEvent)&&(i(),null!==Il&&(window.clearTimeout(Il),Il=null),t(Ml(e,r,n))),!0)),4);Il=window.setTimeout((()=>{i(),Il=null,t(!1)}),50),o.execCommand("copy"),a.remove()}))}function Ml(e,t,n){if(void 0===n){const t=_s(e._window);if(!t)return!1;const r=t.anchorNode,i=t.focusNode;if(null!==r&&null!==i&&!mo(e,r,i))return!1;const o=oi();if(null===o)return!1;n=function(e=oi()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=ws();for(const[r,i]of Rl){const o=i(n,e);null!==o&&(t[r]=o)}}return t}(o)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Rl=[["text/html",function(e,t=oi()){return null==t&&Ll(166),Hr(t)&&t.isCollapsed()||0===t.getNodes().length?"":kl(e,t)}],["application/x-lexical-editor",function(e,t=oi()){return null==t&&Ll(166),Hr(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=Mo().getChildren();for(let i=0;i({conversion:Ql,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Vl().updateFromJSON(e)}insertNewAfter(e,t){const n=so(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=so();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Vl(){return ps(new Jl)}function Gl(e){return e instanceof Jl}let Yl=class e extends Wi{static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){$a(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Xl,priority:0}),h2:e=>({conversion:Xl,priority:0}),h3:e=>({conversion:Xl,priority:0}),h4:e=>({conversion:Xl,priority:0}),h5:e=>({conversion:Xl,priority:0}),h6:e=>({conversion:Xl,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Zl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Zl(e)?{conversion:e=>({node:ec("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return ec(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?so():ec(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=so();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?so():ec(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Zl(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Xl(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=ec(t),null!==e.style&&(Ps(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Ql(e){const t=Vl();return null!==e.style&&(t.setFormat(e.style.textAlign),Ps(e,t)),{node:t}}function ec(e="h1"){return ps(new Yl(e))}function tc(e){return e instanceof Yl}function nc(e){let t=null;if(Ga(e,DragEvent)?t=e.dataTransfer:Ga(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function rc(e){const t=oi();if(!Hr(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;tHi(e)&&!e.isInline()));if(null===s)continue;const a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}function ic(e){return ji(Oo(e))}function oc(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function sc(e){return Ha(e.registerCommand(jt,(e=>{const t=oi();return!!Kr(t)&&(t.clear(),!0)}),0),e.registerCommand(qt,(e=>{const t=oi();return Hr(t)?(t.deleteCharacter(e),!0):!!Kr(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(Xt,(e=>{const t=oi();return!!Hr(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(Qt,(e=>{const t=oi();return!!Hr(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Gt,(t=>{const n=oi();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Fl(r,n,e);else if(Hr(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(Zt,(()=>{const e=oi();return!!Hr(e)&&(e.removeText(),!0)}),0),e.registerCommand(en,(e=>{const t=oi();return!!Hr(t)&&(t.formatText(e),!0)}),0),e.registerCommand(vn,(e=>{const t=oi();if(!Hr(t)&&!Kr(t))return!1;const n=t.getNodes();for(const t of n){const n=Va(t,(e=>Hi(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(Jt,(e=>{const t=oi();return!!Hr(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(Vt,(()=>{const e=oi();return!!Hr(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(yn,(()=>(hi([Dr()]),!0)),0),e.registerCommand(_n,(()=>rc((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(bn,(()=>rc((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(cn,(e=>{const t=oi();if(Kr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Hr(t)){const n=ns(t.focus,!0);if(!e.shiftKey&&ji(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(un,(e=>{const t=oi();if(Kr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Hr(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===Mo().getChildrenSize()}(t))return e.preventDefault(),!0;const n=ns(t.focus,!1);if(!e.shiftKey&&ji(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(an,(e=>{const t=oi();if(Kr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!Hr(t))return!1;if(Oa(t,!0)){const n=e.shiftKey;return e.preventDefault(),Ia(t,n,!0),!0}return!1}),0),e.registerCommand(on,(e=>{const t=oi();if(Kr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}if(!Hr(t))return!1;const n=e.shiftKey;return!!Oa(t,!1)&&(e.preventDefault(),Ia(t,n,!1),!0)}),0),e.registerCommand(gn,(t=>{if(ic(t.target))return!1;const n=oi();if(Hr(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(Ji(n))return!1;const r=Ja(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(bn,void 0);if($l&&"ko-KR"===navigator.language)return!1}else if(!Kr(n))return!1;return t.preventDefault(),e.dispatchCommand(qt,!0)}),0),e.registerCommand(fn,(t=>{if(ic(t.target))return!1;const n=oi();return!(!Hr(n)&&!Kr(n))&&(t.preventDefault(),e.dispatchCommand(qt,!1))}),0),e.registerCommand(dn,(t=>{const n=oi();if(!Hr(n))return!1;if(oc(n),null!==t){if(($l||Hl||jl)&&Wl)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Jt,!1)}return e.dispatchCommand(Vt,void 0)}),0),e.registerCommand(pn,(()=>!!Hr(oi())&&(e.blur(),!0)),0),e.registerCommand(xn,(t=>{const[,n]=nc(t);if(n.length>0){const r=Bl(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=Oo(i);if(null!==o){const e=ni();if(Pr(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{const t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Bo(ot(e))}e.dispatchCommand(ql,n)}return t.preventDefault(),!0}return!!Hr(oi())}),0),e.registerCommand(Sn,(e=>{const[t]=nc(e),n=oi();return!(t&&!Hr(n))}),0),e.registerCommand(Cn,(e=>{const[t]=nc(e),n=oi();if(t&&!Hr(n))return!1;const r=Bl(e.clientX,e.clientY);if(null!==r){ji(Oo(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(wn,(()=>(function(e){const t=Mo();if(Hr(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),ot(e),e}{const e=t.select(0,t.getChildrenSize());Bo(ot(e))}}(),!0)),0),e.registerCommand(Tn,(t=>(Dl(e,Ga(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(kn,(t=>(async function(e,t){await Dl(t,Ga(e,ClipboardEvent)?e:null),t.update((()=>{const e=oi();Hr(e)?e.removeText():Kr(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Yt,(t=>{const[,n,r]=nc(t);return n.length>0&&!r?(e.dispatchCommand(ql,n),!0):(!vs(t.target)||!fo(t.target))&&(null!==oi()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=oi(),r=Ga(e,InputEvent)||Ga(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Fl(r,n,t)}),{tag:"paste"})}(t,e),!0))}),0),e.registerCommand(hn,(e=>{const t=oi();return Hr(t)&&oc(t),!1}),0),e.registerCommand(mn,(e=>{const t=oi();return Hr(t)&&oc(t),!1}),0))}var ac=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 o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);C+=S.value.length,S=S.next){var E=S.value;if(t.length>e.length)return;if(!(E instanceof o)){var T,k=1;if(_){if(!(T=s(v,C,e,y))||T.index>=e.length)break;var w=T.index,N=T.index+T[0].length,A=C;for(A+=S.value.length;w>=A;)A+=(S=S.next).value.length;if(C=A-=S.value.length,S.value instanceof o)continue;for(var L=S;L!==t.tail&&(Ad.reach&&(d.reach=I);var D=S.prev;if(P&&(D=c(t,D,P),C+=P.length),u(t,D,k),S=c(t,D,new o(h,m?i.tokenize(F,m):F,b,F)),O&&c(t,S,O),k>1){var M={cause:h+","+p,reach:I};a(e,t,n,S.prev,C,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function l(){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 c(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"+o.content+""},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,o=n.code,s=n.immediateClose;e.postMessage(i.highlight(o,i.languages[r],r)),s&&e.close()}),!1),i):i;var d=i.util.currentScript();function h(){i.manual||i.highlightAll()}if(d&&(i.filename=d.src,d.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}); /** * Prism: Lightweight, robust, elegant syntax highlighting * @@ -7,4 +7,4 @@ import{DirectUpload as e}from"@rails/activestorage"; * @author Lea Verou * @namespace * @public - */function nu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}"undefined"!=typeof module&&module.exports&&(module.exports=tu),"undefined"!=typeof global&&(global.Prism=tu),tu.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},tu.languages.markup.tag.inside["attr-value"].inside.entity=tu.languages.markup.entity,tu.languages.markup.doctype.inside["internal-subset"].inside=tu.languages.markup,tu.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(tu.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:tu.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:tu.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},tu.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(tu.languages.markup.tag,"addAttribute",{value:function(e,t){tu.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:tu.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),tu.languages.html=tu.languages.markup,tu.languages.mathml=tu.languages.markup,tu.languages.svg=tu.languages.markup,tu.languages.xml=tu.languages.extend("markup",{}),tu.languages.ssml=tu.languages.xml,tu.languages.atom=tu.languages.xml,tu.languages.rss=tu.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(tu),tu.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:/[{}[\];(),.:]/},tu.languages.javascript=tu.languages.extend("clike",{"class-name":[tu.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),tu.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,tu.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:tu.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:tu.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:tu.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:tu.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:tu.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),tu.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:tu.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"}}),tu.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),tu.languages.markup&&(tu.languages.markup.tag.addInlined("script","javascript"),tu.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),tu.languages.js=tu.languages.javascript,function(){if(void 0!==tu&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",n="loading",r="loaded",i="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+n+'"])';tu.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),tu.hooks.add("before-sanity-check",(function(s){var o=s.element;if(o.matches(i)){s.code="",o.setAttribute(t,n);var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=o.getAttribute("data-src"),c=s.language;if("none"===c){var u=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[u]||u}tu.util.setLanguage(a,c),tu.util.setLanguage(o,c);var d=tu.plugins.autoloader;d&&d.loadLanguages(c),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?n("✖ Error "+r.status+" while fetching file: "+r.statusText):n("✖ Error: File does not exist or is empty"))},r.send(null)}(l,(function(e){o.setAttribute(t,r);var n=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}(o.getAttribute("data-range"));if(n){var i=e.split(/\r\n?|\n/g),s=n[0],l=null==n[1]?i.length:n[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(s,l).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(s+1))}a.textContent=e,tu.highlightElement(a)}),(function(e){o.setAttribute(t,"failed"),a.textContent=e}))}})),tu.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(i),r=0;t=n[r++];)tu.highlightElement(t)}};var s=!1;tu.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),tu.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(Prism),Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,n=0;n<2;n++)t=t.replace(//g,(function(){return t}));t=t.replace(//g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism),function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//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(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//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 ru(e,t){for(const n of e.childNodes){if(Bo(n)&&n.tagName===t)return!0;ru(n,t)}return!1}const iu="data-language",su="data-highlight-language",ou="data-theme";let au=class e extends is{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");fl(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(iu,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(su,n));const r=this.getTheme();r&&t.setAttribute(ou,r);const i=this.getStyle();return i&&t.setAttribute("style",i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(iu,r):i&&t.removeAttribute(iu);const s=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?s&&r?r!==i&&t.setAttribute(su,r):t.removeAttribute(su):s&&r&&t.setAttribute(su,r);const o=this.__theme,a=e.__theme;o?o!==a&&t.setAttribute(ou,o):a&&t.removeAttribute(ou);const l=this.__style,c=e.__style;return l?l!==c&&t.setAttribute("style",l):c&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");fl(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(iu,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(su,n));const r=this.getTheme();r&&t.setAttribute(ou,r);const i=this.getStyle();return i&&t.setAttribute("style",i),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||ru(e,"BR"))?{conversion:uu,priority:1}:null,div:()=>({conversion:du,priority:1}),pre:()=>({conversion:uu,priority:0}),table:e=>fu(e)?{conversion:hu,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&fu(n)?{conversion:gu,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&fu(t)?{conversion:gu,priority:3}:null}}}static importJSON(e){return lu().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){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=_s();return this.insertAfter(e,t),e}const{anchor:i,focus:s}=e,o=(i.isBefore(s)?i:s).getNode();if(Gr(o)){let e=vu(o);const t=[];for(;;)if(Qr(e))t.push(Xr()),e=e.getNextSibling();else{if(!bu(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;ne.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function lu(e,t){return function(e){const t=jo();return $i(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(au).setLanguage(e).setTheme(t)}function cu(e){return e instanceof au}function uu(e){return{node:lu(e.getAttribute(iu))}}function du(e){const t=e,n=pu(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(pu(t))return!0;t=t.parentElement}return!1}(t)?{node:n?lu():null}:{node:null}}function hu(){return{node:lu()}}function gu(){return{node:null}}function pu(e){return null!==e.style.fontFamily.match("monospace")}function fu(e){return e.classList.contains("js-file-line-container")}let mu=class e extends Br{__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)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return fl(t,yu(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=yu(n.theme,e.__highlightType),s=yu(n.theme,this.__highlightType);return i!==s&&(i&&ml(t,i),s&&fl(t,s)),r}static importJSON(e){return _u().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 lu()}};function yu(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function _u(e="",t){return Fo(new mu(e,t))}function bu(e){return e instanceof mu}function xu(e,t){let n=e;for(let r=fa(e,t);r&&(bu(r.origin)||Qr(r.origin));r=yl(r))n=r.origin;return n}function vu(e){return xu(e,"previous")}function ku(e){return xu(e,"next")}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const Su=globalThis.Prism||window.Prism,wu={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"},Cu={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Tu(e){return Cu[e]||e}function Eu(e){return"string"==typeof e?e:Array.isArray(e)?e.map(Eu).join(""):Eu(e.content)}function Nu(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=Su.tokenize(r,Su.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=Su.languages[n],i={tokens:e},s=Su.languages.diff.PREFIXES;for(const e of i.tokens){if("string"==typeof e||!(e.type in s)||!Array.isArray(e.content))continue;const t=e.type;let n=0;const i=()=>(n++,new Su.Token("prefix",s[t],t.replace(/^(\w+).*/,"$1"))),o=e.content.filter((e=>"string"==typeof e||"prefix"!==e.type)),a=e.content.length-o.length,l=Su.tokenize(Eu(o),r);l.unshift(i());const c=/\r\n|\n/g,u=e=>{const t=[];c.lastIndex=0;let r,s=0;for(;n{for(let t=0;t0&&n.push(_u(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...Au([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...Au(e,"unchanged"===r.type?void 0:r.type))}return n}const Lu={$tokenize(e,t){return Nu(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return Su.tokenize(e,Su.languages[t||""]||Su.languages[this.defaultLanguage])}};function Pu(e,t,n){const r=e.getParent();cu(r)?Iu(r,t,n):bu(e)&&e.replace(Vr(e.__text))}function Ou(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let s="1",o=1;for(let e=0;e{!function(e,t){const n=Vs(e);if(!cu(n)||!n.isAttached())return;const r=ki();if(!si(r))return void t();const i=r.anchor,s=i.offset,o="element"===i.type&&Pr(n.getChildAtIndex(i.offset-1));let a=0;if(!o){const e=i.getNode();a=s+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(o?i.getNode().select(s,s):n.getChildren().some((e=>{const t=Gr(e);if(t||Pr(e)){const n=e.getTextContentSize();if(t&&n>=a)return e.select(a,a),!0;a-=n}return!1})))}(r,(()=>{const t=Vs(r);if(!cu(t)||!t.isAttached())return!1;const i=t.getLanguage()||n.defaultLanguage,s=n.$tokenize(t,i),o=function(e,t){let n=0;for(;n{Fu.delete(r)},skipTransforms:!0}))}function Ru(e,t){return bu(e)&&bu(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Qr(e)&&Qr(t)||Pr(e)&&Pr(t)}function Mu(e){if(!si(e))return!1;const t=e.anchor.getNode(),n=cu(t)?t:t.getParent(),r=e.focus.getNode(),i=cu(r)?r:r.getParent();return cu(n)&&n.is(i)}function Du(e){const t=e.getNodes(),n=[];if(1===t.length&&cu(t[0]))return n;let r=[];for(let e=0;e0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=ti(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function zu(e){const t=ki();if(!si(t)||!Mu(t))return!1;const n=Du(t),r=n.length;if(0===r&&t.isCollapsed())return e===Tn&&t.insertNodes([Xr()]),!0;if(0===r&&e===Tn&&"\n"===t.getTextContent()){const e=Xr(),n=Lr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),Fa(Ha(wa(ma(e,"next",0),$a(fa(n,"next"))),r)),!0}for(let i=0;i0){let n=r[0];if(0===i&&(n=vu(n)),e===Tn){const e=Xr();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=ti(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Qr(n)&&n.remove()}}return!0}function Bu(e,t){const n=ki();if(!si(n))return!1;const{anchor:r,focus:i}=n,s=r.offset,o=i.offset,a=r.getNode(),l=i.getNode(),c=e===yn;if(!Mu(n)||!bu(a)&&!Qr(a)||!bu(l)&&!Qr(l))return!1;if(!t.altKey){if(n.isCollapsed()){const e=a.getParentOrThrow();if(c&&0===s&&null===a.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&s===a.getTextContentSize()&&null===a.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(a.isBefore(l)?(u=vu(a),d=ku(l)):(u=vu(l),d=ku(a)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;ee.remove())),e===yn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(a,s,l,o),!0}function $u(e,t){const n=ki();if(!si(n))return!1;const{anchor:r,focus:i}=n,s=r.getNode(),o=i.getNode(),a=e===mn;if(!Mu(n)||!bu(s)&&!Qr(s)||!bu(o)&&!Qr(o))return!1;const l=o;if("rtl"===function(e){const t=vu(e),n=ku(e);let r=t;for(;null!==r;){if(bu(r)){const e=Ms(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(ss(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}(l)?!a:a){const e=function(e,t){let n=null,r=null,i=e,s=t,o=e.getTextContent();for(;;){if(0===s){if(i=i.getPreviousSibling(),null===i)break;if(bu(i)||Qr(i)||Pr(i)||nu(167),Pr(i)){n={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const e=o[s];bu(i)&&" "!==e&&(r={node:i,offset:s})}if(null!==r)return r;let a=null;if(t({conversion:Hu,priority:1})}}static importJSON(e){return Ku().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=Xu(e);try{const t=new URL(Xu(e));if(!Uu.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=Ku(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!si(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Hu(e){let t=null;if(zo(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Ku(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Ku(e="",t){return Fo(new Wu(e,t))}function ju(e){return e instanceof Wu}class qu extends Wu{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new qu(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Ju().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(ss(n)){const e=Ju(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}}function Ju(e="",t){return Fo(new qu(e,t))}function Vu(e){return e instanceof qu}function Gu(e,t){if("element"===e.type){const n=e.getNode();return ss(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function Zu(e,t={}){let n;if(e&&"object"==typeof e){const{url:r,...i}=e;n=r,t={...i,...t}}else n=e;const{target:r,title:i}=t,s=void 0===t.rel?"noreferrer":t.rel,o=ki();if(null===o||!si(o)&&!ai(o))return;if(ai(o)){const e=o.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===n){const t=ea(e,(e=>!Vu(e)&&ju(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=ea(e,(e=>!Vu(e)&&ju(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==s&&t.setRel(s);else{const t=Ku(n,{rel:s,target:r});e.insertBefore(t),t.append(e)}}}))}const a=o.extract();if(null===n){const e=new Set;return void a.forEach((t=>{const n=t.getParent();if(ju(n)&&!Vu(n)){const t=n.getKey();if(e.has(t))return;!function(e,t){const n=new Set(t.filter((t=>e.isParentOf(t))).map((e=>e.getKey()))),r=e.getChildren(),i=r.filter((e=>n.has(e.getKey())));if(i.length===r.length)return r.forEach((t=>e.insertBefore(t))),void e.remove();const s=r.findIndex((e=>n.has(e.getKey()))),o=r.findLastIndex((e=>n.has(e.getKey()))),a=0===s,l=o===r.length-1;if(a)i.forEach((t=>e.insertBefore(t)));else if(l)for(let t=i.length-1;t>=0;t--)e.insertAfter(i[t]);else{for(let t=i.length-1;t>=0;t--)e.insertAfter(i[t]);const t=r.slice(o+1);if(t.length>0){const n=Ku(e.getURL(),{rel:e.getRel(),target:e.getTarget(),title:e.getTitle()});i[i.length-1].insertAfter(n),t.forEach((e=>n.append(e)))}}}(n,a),e.add(t)}}))}const l=new Set,c=e=>{l.has(e.getKey())||(l.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==s&&e.setRel(s),void 0!==i&&e.setTitle(i))};if(1===a.length){const e=a[0],t=ea(e,ju);if(null!==t)return c(t)}!function(e){const t=ki();if(!si(t))return e();const n=ft(t),r=n.isBackward(),i=Gu(n.anchor,r?-1:0),s=Gu(n.focus,r?0:-1);if(e(),i||s){const e=ki();if(si(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(s){const e=s.getParent();e&&t.focus.set(e.getKey(),s.getIndexWithinParent()+(r?0:1),"element")}no(ft(t))}}}((()=>{let e=null;for(const t of a){if(!t.isAttached())continue;const o=ea(t,ju);if(o){c(o);continue}if(ss(t)){if(!t.isInline())continue;if(ju(t)){if(!(Vu(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const a=t.getPreviousSibling();ju(a)&&a.is(e)?a.append(t):(e=Ku(n,{rel:s,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const Yu=/^\+?[0-9\s()-]{5,}$/;function Xu(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Yu.test(e)?`tel:${e}`:`https://${e}`}function Qu(e){let t=e;for(;null!==t;){if(sc(t))return t;t=t.getParent()}return null}function ed(e){let t=e;for(;t;){if(hc(t))return t.getListType();t=t.getParent()}return null}function td(e,t=e=>e){return nd(Br,e,((e,n)=>({...e,forChild:(r,i)=>{const s=e?.forChild??(e=>e);let o=s(r,i);return Gr(o)&&(o=t(o,n)??o),o}})))}function nd(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const s=i.conversion(r);return s?n(s,r)??s:s}}class rd extends HTMLElement{constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.updateButtonStatesCallbacks=[]}connectedCallback(){requestAnimationFrame((()=>this.#e())),this._resizeObserver=new ResizeObserver((()=>this.#e())),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.#t(),this.#n(),this.#r(),this.#i(),this.#s(),this.#e(),this.toggleAttribute("connected",!0)}registerUpdateButtonStatesCallback(e){this.updateButtonStatesCallbacks.push(e)}#t(){this.addEventListener("click",this.#o.bind(this))}#o({target:e}){this.#a(e,"[data-command]",this.#l.bind(this)),this.#a(e,"[data-dialog-target]",this.#c.bind(this))}#a(e,t,n){const r=e.closest(t);r&&n(r)}#l(e){const{command:t,payload:n}=e.dataset;this.editor.dispatchCommand(t,n)}#c(e){const t=e.dataset.dialogTarget,n=this.querySelector("lexxy-"+t);n&&(n.dialog&&n.dialog.open?n.close():(this.#u(),n.show()))}#u(){this.querySelectorAll("dialog[open]").forEach((e=>{e.closest(".lexxy-dialog").close()}))}#n(){this.editorElement.addEventListener("keydown",(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){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#r(){const e=parseInt(this.editorElement.editorContentElement.getAttribute("tabindex")??"0");this.#h.forEach(((t,n)=>{t.setAttribute("tabindex",`${e+n+1}`)}))}#i(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#g()}))}))}#s(){this.editor.registerUpdateListener((()=>{this.#p()}))}#p(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#f("undo",0===e.undoStack.length),this.#f("redo",0===e.redoStack.length))}))}#g(){const e=ki();if(!si(e))return;const t=e.anchor.getNode();if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e.hasFormat("bold"),i=e.hasFormat("italic"),s=e.hasFormat("strikethrough"),o=e.hasFormat("highlight"),a=this.#m(t),l=Hc(n),c=Gc(n),u=cu(n)||e.hasFormat("code"),d=this.#y(t),h=ed(t);this.#_("bold",r),this.#_("italic",i),this.#_("strikethrough",s),this.#_("highlight",o),this.#_("link",a),this.#_("quote",l),this.#_("heading",c),this.#_("code",u),this.#_("unordered-list",d&&"bullet"===h),this.#_("ordered-list",d&&"number"===h),this.#p(),this.updateButtonStatesCallbacks.forEach((t=>t(e)))}#y(e){let t=e;for(;t;){if(hc(t)||sc(t))return!0;t=t.getParent()}return!1}#m(e){let t=e;for(;t;){if(ju(t))return!0;t=t.getParent()}return!1}#_(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#f(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#b(){return this.scrollWidth>this.clientWidth}#e=()=>{this.#x(),this.#v(),this.#k.style.display=this.#S.children.length?"block":"none",this.#k.setAttribute("nonce",ul())};get#k(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#S(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}#x(){for(;this.#S.children.length>0;)this.insertBefore(this.#S.children[0],this.#k)}#v(){const e=this.#w.reverse();let t=!1;for(const n of e){if(!this.#b()){t&&this.#S.prepend(n);break}this.#S.prepend(n),t=!0}}get#h(){return Array.from(this.querySelectorAll(":scope > button"))}get#w(){return Array.from(this.querySelectorAll(":scope > button, :scope > [role=separator]"))}static get defaultTemplate(){return'\n \n\n \n\n \n\n \n\n \n

    \n
    \n
    \n
    \n \n
    \n
    \n \n\n \n\n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n
    \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n\n \n\n
    \n •••\n
    \n
    \n '}}function id(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}customElements.define("lexxy-toolbar",rd);const sd=/[!-/:-@[-`{-~\s]/;function od(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ad=function(e,t){return new et(e,t)}("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-"}),ld=e=>(t,n,r,i)=>{const s=e(r);s.append(...n),t.replace(s),i||s.select(0,0)},cd=e=>(t,n,r,i)=>{const s=t.getPreviousSibling(),o=t.getNextSibling(),a=ic("check"===e?"x"===r[3]:void 0),l=r[0].trim()[0],c="bullet"!==e&&"check"!==e||l!==ad.parse(l)?void 0:l;if(hc(o)&&o.getListType()===e){c&&nt(o,ad,c);const e=o.getFirstChild();null!==e?e.insertBefore(a):o.append(a),t.remove()}else if(hc(s)&&s.getListType()===e)c&&nt(s,ad,c),s.append(a),t.remove();else{const n=dc(e,"number"===e?Number(r[2]):void 0);c&&nt(n,ad,c),n.append(a),t.replace(n)}a.append(...n),i||a.select(0,0);const u=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&a.setIndent(u)},ud=(e,t,n)=>{const r=[],i=e.getChildren();let s=0;for(const o of i)if(sc(o)){if(1===o.getChildrenSize()){const e=o.getFirstChild();if(hc(e)){r.push(ud(e,t,n+1));continue}}const i=" ".repeat(4*n),a=e.getListType(),l=tt(e,ad),c="number"===a?`${e.getStart()+s}. `:"check"===a?`${l} [${o.getChecked()?"x":" "}] `:l+" ";r.push(i+c+t(o)),s++}return r.join("\n")},dd={dependencies:[Kc],export:(e,t)=>{if(!Gc(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:ld((e=>Vc("h"+e[1].length))),type:"element"},hd={dependencies:[Uc],export:(e,t)=>{if(!Hc(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(Hc(n))return n.splice(n.getChildrenSize(),0,[Lr(),...t]),void e.remove()}const i=Wc();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},gd={dependencies:[au],export:e=>{if(!cu(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```([\w-]+)?/,replace:(e,t,n,r,i,s)=>{let o,a;if(!t&&i){if(1===i.length)r?(o=lu(),a=n[1]+i[0]):(o=lu(n[1]),a=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(o=lu(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();a=i.join("\n")}const t=Vr(a);o.append(t),e.append(o)}else t&&ld((e=>lu(e?e[1]:void 0)))(e,t,n,s)},type:"multiline-element"},pd={dependencies:[oc,tc],export:(e,t)=>hc(e)?ud(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:cd("bullet"),type:"element"},fd={dependencies:[oc,tc],export:(e,t)=>hc(e)?ud(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:cd("number"),type:"element"},md={dependencies:[Wu],export:(e,t,n)=>{if(!ju(e)||Vu(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,s=Ku(r,{title:i}),o=n.split("[").length-1,a=n.split("]").length-1;let l=n,c="";if(oa){const e=n.split("[");c="["+e[0],l=e.slice(1).join("[")}const u=Vr(l);return u.setFormat(e.getFormat()),s.append(u),e.replace(s),c&&s.insertBefore(Vr(c)),u},trigger:")",type:"text-match"},yd=[...[dd,hd,pd,fd],...[gd],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[md]];function _d(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(bd(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function bd(e,t,n,r,i){for(let s=0;se.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=id(n.textFormat,(({tag:e})=>e[e.length-1])),i=id(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||od(173,n.getType())}}const s=(e,t,s)=>{(function(e,t,n,r){if(!Oo(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:s,replace:o}of r){const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,!1))return s.remove(),!0}}return!1})(e,t,s,n.element)||function(e,t,n,r){if(!Oo(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:s,replace:o,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,null,null,!1))return s.remove(),!0}}return!1}(e,t,s,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t1&&!bd(r,a,n,0,o))continue;if(" "===r[a-1])continue;const l=r[i+1];if(!1===t.intraword&&l&&!sd.test(l))continue;const c=e;let u=c,d=_d(r,a,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!Pr(h);)if(Gr(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=_d(e,e.length,n)}if(d<0)continue;if(u===c&&d+o===a)continue;const g=u.getTextContent();if(d>0&&g[d-1]===s)continue;const p=g[d-1];if(!1===t.intraword&&p&&!sd.test(p))continue;const f=c.getTextContent(),m=f.slice(0,a)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+o));const _=ki(),b=bi();no(b);const x=i-o*(u===c?2:1)+1;b.anchor.set(u.__key,d,"text"),b.focus.set(c.__key,x,"text");for(const e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return si(_)&&(b.format=_.format),!0}}(t,s,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(wr)||t.has(kr))return;if(e.isComposing())return;const o=r.read(ki),a=i.read(ki);if(!si(a)||!si(o)||!o.isCollapsed()||o.is(a))return;const l=o.anchor.key,c=o.anchor.offset,u=r._nodeMap.get(l);!Gr(u)||!n.has(l)||1!==c&&c>a.anchor.offset+1||e.update((()=>{if(!function(e){return Gr(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||cu(e)||s(e,u,o.anchor.offset)}))}))}function vd(e,t){let n=Date.now(),r=0;return(i,s,o,a,l,c)=>{const u=Date.now();if(c.has(kr))return r=0,n=u,2;const d=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const s=t._selection,o=e._selection;if(i)return 1;if(!(si(s)&&si(o)&&o.isCollapsed()&&s.isCollapsed()))return 0;const a=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||us(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){const n=t._nodeMap,r=n.get(s.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Gr(r)&&1===r.__text.length&&1===s.anchor.offset?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!Gr(c)||!Gr(l)||c.__mode!==l.__mode)return 0;const u=c.__text,d=l.__text;if(u===d)return 0;const h=s.anchor,g=o.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}(i,s,a,l,e.isComposing()),h=(()=>{const h=null===o||o.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Sr))return 0;if(null===i)return 1;const p=s._selection;if(!(a.size>0||l.size>0))return null!==p?0:2;const f="number"==typeof t?t:t.peek();return!1===g&&0!==d&&d===r&&ur.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(a)[0],i,s)?0:1})();return n=u,r=d,h}}function kd(e){e.undoStack=[],e.redoStack=[],e.current=null}function Sd(e,t,n){const r=vd(e,n),i=pl(e.registerCommand(un,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,s=r.pop();null!==i&&(n.push(i),e.dispatchCommand(zn,!0)),0===r.length&&e.dispatchCommand(Bn,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:kr})}}(e,t),!0)),0),e.registerCommand(dn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(Bn,!0));const s=n.pop();0===n.length&&e.dispatchCommand(zn,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:kr})}}(e,t),!0)),0),e.registerCommand(Mn,(()=>(kd(t),!1)),0),e.registerCommand(Dn,(()=>(kd(t),e.dispatchCommand(zn,!1),e.dispatchCommand(Bn,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:s,dirtyElements:o,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,s,o,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(zn,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(Bn,!0));else if(2===h)return;t.current={editor:e,editorState:n}})));return i}function wd(){return{current:null,redoStack:[],undoStack:[]}}var Cd={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},codeHighlight:{atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__property",decorator:"code-token__function",deleted:"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__variable",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",namespace:"code-token__variable",number:"code-token__property",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};function Td(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function Ed(e){return(new DOMParser).parseFromString(e,"text/html")}function Nd(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function Ad(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Ld(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Pd(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}class Od extends as{static getType(){return"action_text_attachment"}static clone(e){return new Od({...e},e.__key)}static importJSON(e){return new Od({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Od({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:e=>({conversion:()=>({node:new Od({src:e.getAttribute("src"),caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),video:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{conversion:()=>({node:new Od({src:t,fileName:n,contentType:r})}),priority:1}}}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:s,fileName:o,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=s||"",this.fileName=o||"",this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#C(e)})),this.isPreviewableAttachment?(e.appendChild(this.#T()),e.appendChild(this.#E())):(e.appendChild(this.#N()),e.appendChild(this.#A())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:Td("action-text-attachment",{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,Td("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#L(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#L||this.previewable}#T(){return Td("img",{src:this.src,alt:this.altText,...this.#P})}get#P(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#N(){return Td("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#A(){const e=Td("figcaption",{className:"attachment__caption"}),t=Td("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=Td("span",{className:"attachment__size",textContent:Pd(this.fileSize)});e.appendChild(t)}return e}#C(e){Nd(e,"lexxy:internal:select-node",{key:this.getKey()})}#E(){const e=Td("figcaption",{className:"attachment__caption"}),t=Td("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#O.bind(this)),t.addEventListener("keydown",this.#F.bind(this)),e.appendChild(t),e}#O(e){const t=e.target;t.placeholder=this.fileName,this.#I(t)}#I(e){Nd(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#F(e){"Enter"===e.key&&(this.#I(e.target),Nd(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Fd extends Od{static getType(){return"action_text_attachment_upload"}static clone(e){return new Fd({...e},e.__key)}static importJSON(e){return new Fd({...e})}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},s){super({contentType:e.type},s),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#T()):e.appendChild(this.#N()),e.appendChild(this.#R());const t=Td("progress",{value:this.progress,max:100});return e.appendChild(t),this.#M(e).then((()=>this.#D(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}exportJSON(){return{type:"action_text_attachment_upload",version:1,progress:this.progress,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,...super.exportJSON()}}#T(){return Td("img")}#N(){return Td("span",{className:"attachment__icon",textContent:this.#z()})}#z(){return this.file.name.split(".").pop().toLowerCase()}#R(){const e=Td("figcaption",{className:"attachment__caption"}),t=Td("span",{className:"attachment__name",textContent:this.file.name||""}),n=Td("span",{className:"attachment__size",textContent:Pd(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#M(e){const t=e.querySelector("img");return t?async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))}(this.file,t):Promise.resolve()}#D(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#B(n):this.#$(t,n).then((()=>{this.#U(n,t)}))}))}#B(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(Td("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#U(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),i=Vs(this.getKey());i&&i.replace(new Od({sgid:t.attachable_sgid,src:t.previewable?t.url:r,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Sr})}async#$(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#T();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}class Id extends as{static getType(){return"horizontal_divider"}static clone(e){return new Id(e.__key)}static importJSON(e){return new Id}static importDOM(){return{hr:e=>({conversion:()=>({node:new Id}),priority:1})}}constructor(e){super(e)}createDOM(){const e=Td("figure",{className:"horizontal-divider"}),t=Td("hr");return e.addEventListener("click",(t=>{Nd(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.appendChild(t),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:Td("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Rd=["bold","italic","strikethrough","link","unlink","toggleHighlight","removeHighlight","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","undo","redo"];class Md{static configureFor(e){new Md(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.highlighter=e.highlighter,this.#W(),this.#H()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(cn,"bold")}dispatchItalic(){this.editor.dispatchCommand(cn,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(cn,"strikethrough")}dispatchToggleHighlight(e){this.highlighter.toggle(e)}dispatchRemoveHighlight(){this.highlighter.remove()}dispatchLink(e){this.editor.update((()=>{const t=ki();if(si(t))if(t.isCollapsed()){const n=Ju(e),r=Vr(e);n.append(r),t.insertNodes([n])}else Zu(e)}))}dispatchUnlink(){this.#K(null)}dispatchInsertUnorderedList(){const e=ki();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===ed(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(pc,void 0)}dispatchInsertOrderedList(){const e=ki();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===ed(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(fc,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedNodes((e=>Hc(e)),(()=>Wc()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(cn,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>cu(e)),(()=>new au("plain")))}))}dispatchInsertHorizontalDivider(){this.editor.update((()=>{this.contents.insertAtCursorEnsuringLineBelow(new Id)})),this.editor.focus()}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=ki();if(!si(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Gc(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>Vc(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=Td("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchUndo(){this.editor.dispatchCommand(un,void 0)}dispatchRedo(){this.editor.dispatchCommand(dn,void 0)}#W(){for(const t of Rd){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#j(t,0,this[n].bind(this))}var e;this.#j(sn,1,this.dispatchPaste.bind(this))}#j(e,t,n){this.editor.registerCommand(e,n,t)}#K(e){this.editor.update((()=>{Zu(null===e?null:e)}))}#H(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#q.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#J.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#V.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#G.bind(this)))}#V(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#G(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#q(e){e.preventDefault()}#J(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}}function Dd(){return new Promise(requestAnimationFrame)}class zd{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Z(),this.#Y(),this.#X(),this.#Q()}clear(){this.current=null}set current(e){ai(e)?this.editor.getEditorState().read((()=>{this._current=ki(),this.#ee()})):this.editor.update((()=>{this.#ee(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#te();if(!t)return;const n=this.#ne(t);n&&(e=this.#re(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{eo().selectEnd()}))}selectedNodeWithOffset(){const e=ki();if(!e)return{node:null,offset:0};if(si(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(ai(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}preservingSelection(e){let t=null;this.editor.getEditorState().read((()=>{const e=ki();e&&si(e)&&(t={anchor:{key:e.anchor.key,offset:e.anchor.offset},focus:{key:e.focus.key,offset:e.focus.offset}})})),e(),t&&this.editor.update((()=>{const e=ki();e&&si(e)&&(e.anchor.set(t.anchor.key,t.anchor.offset,"text"),e.focus.set(t.focus.key,t.focus.offset,"text"))}))}get hasSelectedWordsInSingleLine(){const e=ki();if(!si(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if(Pr(e))return!1;return!0}get isInsideList(){const e=ki();if(!si(e))return!1;return null!==Qu(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Gr(e)?this.#se(e,t):ss(e)?this.#oe(e,t):this.#ae(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Gr(e)?this.#le(e):ss(e)?this.#oe(e,t):this.#ae(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Gr(e)?this.#ce(e,t):ss(e)?this.#ue(e,t):this.#de(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Gr(e)?this.#he(e):ss(e)?this.#ue(e,t):this.#de(e):null}get#ge(){return this.editorElement.contents}get#pe(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;this._currentlySelectedKeys=new Set;const e=ki();if(e&&ai(e))for(const t of e.getNodes())this._currentlySelectedKeys.add(t.getKey());return this._currentlySelectedKeys}#Y(){this.editor.registerCommand(fn,this.#fe.bind(this),1),this.editor.registerCommand(gn,this.#me.bind(this),1),this.editor.registerCommand(yn,this.#ye.bind(this),1),this.editor.registerCommand(_n,this.#_e.bind(this),1),this.editor.registerCommand(Sn,this.#be.bind(this),1),this.editor.registerCommand(vn,this.#xe.bind(this),1),this.editor.registerCommand(Yt,(()=>{this.current=ki()}),1)}#Z(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Dd();const{key:t}=e.detail;this.editor.update((()=>{const e=Vs(t);if(e){const t=xi();t.add(e.getKey()),no(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#ve()}))}#X(){this.editor.getRootElement().addEventListener("keydown",(e=>{(function(e){return!(e.ctrlKey||e.metaKey||e.altKey||e.key.length>1&&"Enter"!==e.key&&"Space"!==e.key||1!==e.key.length)})(e)&&this.editor.update((()=>{const t=ki();if(si(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=t.anchor.offset,i=this.#ke(n,r),s=this.#Se(n,r);if(i instanceof as&&!i.isInline())return e.preventDefault(),void this.#ge.createParagraphAfterNode(i,e.key);if(s instanceof as&&!s.isInline())return e.preventDefault(),void this.#ge.createParagraphBeforeNode(s,e.key)}}))}),!0)}#ke(e,t){return Gr(e)&&0===t?e.getPreviousSibling():ss(e)&&t>0?e.getChildAtIndex(t-1):null}#Se(e,t){return Gr(e)&&t===e.getTextContentSize()?e.getNextSibling():ss(e)?e.getChildAtIndex(t):null}#Q(){this.editorContentElement.addEventListener("keydown",(e=>{if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}),!0)}#ee(){this.#we(),this.#Ce(),this.previouslySelectedKeys=this.#pe,this._currentlySelectedKeys=null}#we(){for(const e of this.previouslySelectedKeys)if(!this.#pe.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Ce(){for(const e of this.#pe)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#fe(){this.current?await this.#Te((e=>e.selectPrevious())):this.#Ee(this.nodeBeforeCursor)}async#me(){this.current?await this.#Te((e=>e.selectNext(0,0))):this.#Ee(this.nodeAfterCursor)}async#ye(){this.current?await this.#Te((e=>e.selectPrevious())):this.#Ee(this.topLevelNodeBeforeCursor)}async#_e(){this.current?await this.#Te((e=>e.selectNext(0,0))):this.#Ee(this.topLevelNodeAfterCursor)}async#Te(e){await Dd(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#ve(){this.editor.update((()=>{const e=this.#Ne();e&&this.#Ae(e)}))}#Ne(){const e=ki();return e?ai(e)?this.#Le(e):si(e)?this.#Pe(e):null:null}#Le(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Pe(e){return e.anchor.getNode().getTopLevelElement()}#Ae(e){const t=e.getNextSibling();t?t.selectStart():this.#Oe()}#Oe(){const e=eo(),t=_s();e.append(t),t.selectStart()}#Ee(e){e&&e instanceof as&&this.editor.update((()=>{const t=xi();t.add(e.getKey()),no(t)}))}#be(){const e=this.nodeAfterCursor;return e instanceof as?(this.#Ee(e),!0):(this.#ge.deleteSelectedNodes(),!1)}#xe(){const e=this.nodeBeforeCursor;return e instanceof as?(this.#Ee(e),!0):(this.#ge.deleteSelectedNodes(),!1)}#te(){const e=ki();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#ne(e){let t=e.getBoundingClientRect();if(this.#Fe(t)){const n=this.#Ie(e);t=n.getBoundingClientRect(),this.#Re(n),n.remove()}return t}#Fe(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#Ie(e){const t=this.#Me();return e.insertNode(t),t}#Me(){const e=document.createElement("span");return e.textContent="​",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",ul()),e}#Re(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#re(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const s=this.#De(t);return isNaN(s)||(i+=s),{x:r,y:i,fontSize:s}}#De(e){const t=window.getSelection().anchorNode,n=this.#ze(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#ze(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#ie(){const e=ki();if(!si(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#se(e,t){return t===e.getTextContentSize()?this.#le(e):null}#le(e){if(e.getNextSibling()instanceof as)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#oe(e,t){return t0?e.getChildAtIndex(t-1):this.#de(e)}#ae(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#de(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class Bd extends as{static getType(){return"custom_action_text_attachment"}static clone(e){return new Bd({...e},e.__key)}static importJSON(e){return new Bd({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Vr(" ")),n.push(new Bd({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Vr(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=Td("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{Nd(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:Td("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class $d{constructor(e){this.editorElement=e,this.editor=e.editor}monitor(){this.editor.registerCommand(bn,(e=>this.#Be(e)),3)}#Be(e){const t=ki();if(!si(t))return!1;const n=t.anchor.getNode();return!!this.#$e(n)&&(this.#Ue(e,n)||this.#We(e,n))}#Ue(e,t){return!(!this.#He(t)&&!this.#Ke(t))&&(e.preventDefault(),this.#je(t),!0)}#We(e,t){return!!this.#qe(t)&&(e.preventDefault(),this.#Je(t),!0)}#$e(e){let t=e;for(;t;){if(Hc(t))return!0;t=t.getParent()}return!1}#He(e){const t=this.#Ve(e);return!!t&&this.#Ge(t)}#Ke(e){const t=this.#Ze(e);if(!t)return!1;if(!this.#Ge(t))return!1;const n=t.getParent();return n&&sc(n)}#Ge(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>!!Pr(e)||this.#Ge(e)))}#Ve(e){let t=e;for(;t;){if(sc(t))return t;t=t.getParent()}return null}#je(e){const t=this.#Ve(e);if(!t)return;const n=t.getParent();if(!n||!hc(n))return;const r=n.getParent();if(r&&Hc(r)){const e=this.#Ye(t).filter((e=>!this.#Ge(e)));if(e.length>0)return void this.#Xe(r,n,t,e)}const i=_s();n.insertAfter(i),t.remove(),i.selectStart()}#qe(e){const t=this.#Ze(e);if(!t)return!1;if(!this.#Ge(t))return!1;const n=t.getParent();return n&&Hc(n)}#Ze(e){let t=e;for(;t;){if(bs(t))return t;t=t.getParent()}return null}#Je(e){const t=this.#Ze(e);if(!t)return;const n=t.getParent();if(!n||!Hc(n))return;const r=this.#Qe(t).filter((e=>!this.#Ge(e)));if(r.length>0)this.#et(n,t,r);else{const e=_s();n.insertAfter(e),t.remove(),e.selectStart()}}#Qe(e){const t=[];let n=e.getNextSibling();for(;n;)t.push(n),n=n.getNextSibling();return t}#Ye(e){const t=[];let n=e.getNextSibling();for(;n;)sc(n)&&t.push(n),n=n.getNextSibling();return t}#Xe(e,t,n,r){const i=this.#Qe(t).filter((e=>!this.#Ge(e))),s=_s();e.insertAfter(s);const o=dc(t.getListType()),a=Wc();s.insertAfter(a),a.append(o),r.forEach((e=>{o.append(e)})),i.forEach((e=>{a.append(e)})),n.remove(),this.#tt(t),this.#nt(a),0===t.getChildrenSize()?(t.remove(),0===e.getChildrenSize()&&e.remove()):this.#nt(e),s.selectStart()}#tt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!sc(n)||!this.#Ge(n))break;n.remove()}}#nt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!this.#Ge(n))break;n.remove()}}#et(e,t,n){const r=_s();e.insertAfter(r);const i=Wc();r.insertAfter(i),n.forEach((e=>{i.append(e)})),t.remove(),this.#nt(e),this.#nt(i),r.selectStart()}}class Ud{constructor(e){this.editorElement=e,this.editor=e.editor,new $d(e).monitor()}insertHtml(e){this.editor.update((()=>{const t=ki();if(!si(t))return;const n=_c(this.editor,Ed(e));t.insertNodes(n)}))}insertAtCursor(e){this.editor.update((()=>{const t=ki(),n=t?.getNodes();if(si(t))Ai([e]);else if(ai(t)&&n&&n.length>0){n[n.length-1].insertAfter(e)}else{eo().append(e)}}))}insertAtCursorEnsuringLineBelow(e){this.insertAtCursor(e),this.#rt(e)}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=ki();if(!si(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=ki();if(!si(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.#it(t)}))}toggleNodeWrappingAllSelectedNodes(e,t){this.editor.update((()=>{const n=ki();if(!si(n))return;const r=n.anchor.getNode().getTopLevelElement();r&&e(r)?this.#st(r):this.#ot(t)}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=ki();if(!si(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=_s();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=ki();e=si(t)&&!t.isCollapsed()})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=ki();if(!si(e))return;const{listItems:t,parentLists:n}=this.#at(e);if(t.size>0){const e=this.#lt(t);this.#ct(n),this.#ut(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=Vr(e),r=Ku(e);r.append(n);const i=ki();si(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{Zu(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=ki();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Gr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=ki();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Gr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#dt();if(!n)return;const i=this.#ht(n,r,e);-1!==i&&this.#gt(n,r,i,t)}))}createParagraphAfterNode(e,t){const n=_s();e.insertAfter(n),n.selectStart(),t&&(n.append(Vr(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=_s();e.insertBefore(n),n.selectStart(),t&&(n.append(Vr(t)),n.select(1,1))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#pt(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=new Fd({file:e,uploadUrl:t,blobUrlTemplate:n,editor:this.editor});this.insertAtCursor(r)}),{tag:Sr})}async deleteSelectedNodes(){let e=null;this.editor.update((()=>{if(ai(this.#ft.current)){const t=this.#ft.current.getNodes();if(0===t.length)return;e=this.#mt(t),this.#yt(t)}})),await Dd(),this.editor.update((()=>{this.#_t(e),this.#ft.clear(),this.editor.focus()}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Vs(e);if(!r)return;const i=ki();let s=!1;if(si(i)){const e=i.getNodes();s=e.includes(r)||e.some((e=>e.getParent()===r)),s&&no(null)}const o=n.attachment?this.#bt(t,n.attachment):this.#xt(t);r.replace(o),s&&o.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Vs(e);if(!r)return;const i=r.getTopLevelElement()||r,s=n.attachment?this.#bt(t,n.attachment):this.#xt(t);i.insertAfter(s)}))}get#ft(){return this.editorElement.selection}#rt(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=_s();e.insertAfter(t),t.selectStart()}}))}#st(e){e.getChildren().forEach((t=>{e.insertBefore(t)})),e.remove()}#ot(e){this.editor.update((()=>{const t=ki();if(!si(t))return;const n=t.extract();if(0===n.length)return;const r=new Set;n.forEach((e=>{const t=e.getTopLevelElementOrThrow();r.add(t)}));const i=this.#vt(Array.from(r));if(0===i.length)return this.#kt(),void this.insertAtCursor(e());const s=e();i[0].insertBefore(s),i.forEach((e=>{s.append(e)})),no(null)}))}#vt(e){let t=e.length-1;for(;t>=0;){const n=e[t];if(!bs(n)||!this.#St(n))break;t--}return e.slice(0,t+1)}#St(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>Pr(e)))}#kt(){const e=eo();if(1===e.getChildrenSize()){const t=e.getFirstChild();t&&bs(t)&&this.#St(t)&&t.remove()}}#it(e){this.editor.update((()=>{const t=ki();si(t)&&(t.isCollapsed()?this.#wt(t,e):this.#Ct(t,e))}))}#wt(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else Ai([t()])}#Ct(e,t){const n=this.#Tt(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#Et(n);if(0===r.size)return;const s=this.#Nt(t,r);this.#At(e,s),this.#Lt(i)}#Tt(e){const t=e.extract().map((e=>this.#Pt(e))).filter(Boolean);return no(null),t}#Pt(e){return bs(e)?e:Gr(e)&&e.getParent()&&bs(e.getParent())?e.getParent():null}#Et(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#Nt(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Vr(e)),te.remove()))}#yt(e){e.forEach((e=>{const t=e.getParent();if(!ss(t))return;const n=t.getChildren().indexOf(e);n>=0&&t.splice(n,1,[])}))}#mt(e){const t=e[0],n=e[e.length-1];return t?.getPreviousSibling()||n?.getNextSibling()}#_t(e){const t=eo();if(0===t.getChildrenSize()){const e=_s();t.append(e),e.selectStart()}else e&&(Gr(e)||bs(e)?e.selectEnd():e.selectNext(0,0))}#at(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Qu(e);if(t){n.add(t);const e=t.getParent();e&&hc(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#lt(e){const t=[];for(const n of e){const e=this.#Ot(n);e&&t.push(e)}return t}#Ot(e){const t=e.getParent();if(!t||!hc(t))return null;const n=_s(),r=this.#Ft(e,n);return e.insertAfter(n),this.#It(n,r),e.remove(),n}#Ft(e,t){const n=[];return e.getChildren().forEach((e=>{hc(e)?n.push(e):t.append(e)})),n}#It(e,t){t.forEach((t=>{e.insertAfter(t)}))}#ct(e){for(const t of e)hc(t)&&0===t.getChildrenSize()&&t.remove()}#ut(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#Rt(t,n)}#Rt(e,t){e.selectStart();const n=ki();n&&si(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#dt(){const e=ki();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Gr(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#ht(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#gt(e,t,n,r){const i=e.getTextContent(),s=i.slice(0,n),o=i.slice(t),a=Vr(s),l=Vr(o||" ");e.replace(a);this.#Mt(a,r).insertAfter(l),this.#Dt(l.getParentOrThrow());const c=o?0:1;l.select(c,c)}#Mt(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Dt(e){if(bs(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Gr(n)&&""===n.getTextContent()&&r&&!Gr(r)&&e.append(Lr())}}#bt(e,t={}){return new Bd({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#xt(e){return _c(this.editor,Ed(e))[0]||_s()}#pt(e){return Ad(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function Wd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hd={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Kd(e){Hd=e}var jd={exec:()=>null};function qd(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(Jd.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Jd={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:/^
    /i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Vd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gd=/(?:[*+-]|\d{1,9}[.)])/,Zd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yd=qd(Zd).replace(/bull/g,Gd).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(),Xd=qd(Zd).replace(/bull/g,Gd).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(),Qd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,th=qd(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",eh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nh=qd(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gd).getRegex(),rh="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",ih=/|$))/,sh=qd("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",ih).replace("tag",rh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oh=qd(Qd).replace("hr",Vd).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",rh).getRegex(),ah={blockquote:qd(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oh).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:th,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Vd,html:sh,lheading:Yd,list:nh,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:oh,table:jd,text:/^[^\n]+/},lh=qd("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",rh).getRegex(),ch={...ah,lheading:Xd,table:lh,paragraph:qd(Qd).replace("hr",Vd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",lh).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",rh).getRegex()},uh={...ah,html:qd("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",ih).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:qd(Qd).replace("hr",Vd).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Yd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},dh=/^( {2,}|\\)\n(?!\s*$)/,hh=/[\p{P}\p{S}]/u,gh=/[\s\p{P}\p{S}]/u,ph=/[^\s\p{P}\p{S}]/u,fh=qd(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,gh).getRegex(),mh=/(?!~)[\p{P}\p{S}]/u,yh=qd(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_h=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,bh=qd(_h,"u").replace(/punct/g,hh).getRegex(),xh=qd(_h,"u").replace(/punct/g,mh).getRegex(),vh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kh=qd(vh,"gu").replace(/notPunctSpace/g,ph).replace(/punctSpace/g,gh).replace(/punct/g,hh).getRegex(),Sh=qd(vh,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,mh).getRegex(),wh=qd("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ph).replace(/punctSpace/g,gh).replace(/punct/g,hh).getRegex(),Ch=qd(/\\(punct)/,"gu").replace(/punct/g,hh).getRegex(),Th=qd(/^<(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(),Eh=qd(ih).replace("(?:--\x3e|$)","--\x3e").getRegex(),Nh=qd("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Eh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ah=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Lh=qd(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ah).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ph=qd(/^!?\[(label)\]\[(ref)\]/).replace("label",Ah).replace("ref",eh).getRegex(),Oh=qd(/^!?\[(ref)\](?:\[\])?/).replace("ref",eh).getRegex(),Fh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ih={_backpedal:jd,anyPunctuation:Ch,autolink:Th,blockSkip:yh,br:dh,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:jd,emStrongLDelim:bh,emStrongRDelimAst:kh,emStrongRDelimUnd:wh,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Lh,nolink:Oh,punctuation:fh,reflink:Ph,reflinkSearch:qd("reflink|nolink(?!\\()","g").replace("reflink",Ph).replace("nolink",Oh).getRegex(),tag:Nh,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Uh=e=>$h[e];function Wh(e,t){if(t){if(Jd.escapeTest.test(e))return e.replace(Jd.escapeReplace,Uh)}else if(Jd.escapeTestNoEncode.test(e))return e.replace(Jd.escapeReplaceNoEncode,Uh);return e}function Hh(e){try{e=encodeURI(e).replace(Jd.percentDecode,"%")}catch{return null}return e}function Kh(e,t){let n=e.replace(Jd.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Jd.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length0)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:jh(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map((e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=jh(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:jh(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=jh(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),s=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let h,g=e.split("\n",1)[0];if(c=g,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),h=c):h=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||s.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+h.slice(d);else{if(u||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),l=h.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(a),g&&(h="[ ] "!==g[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]}))));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=jh(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),qh(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 qh(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,s=[...r[0]].length-1,o=s,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=l.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,l=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Vh=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Hd,this.options.tokenizer=this.options.tokenizer||new Jh,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:Jd,block:zh.normal,inline:Bh.normal};this.options.pedantic?(t.block=zh.pedantic,t.inline=Bh.pedantic):this.options.gfm&&(t.block=zh.gfm,this.options.breaks?t.inline=Bh.breaks:t.inline=Bh.gfm),this.tokenizer.rules=t}static get rules(){return{block:zh,inline:Bh}}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(Jd.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,s="";for(;e;){let r;if(i||(s=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,s)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(o=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},Gh=class{options;parser;constructor(e){this.options=e||Hd}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Jd.notSpaceStart)?.[0],i=e.replace(Jd.endingNewline,"")+"\n";return r?'
    '+(n?i:Wh(i,!0))+"
    \n":"
    "+(n?i:Wh(i,!0))+"
    \n"}blockquote({tokens:e}){return`
    \n${this.parser.parse(e)}
    \n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
    \n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t\n"+r+"\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+Wh(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),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",n="";for(let t=0;t${r}`),"\n\n"+t+"\n"+r+"
    \n"}tablerow({text:e}){return`\n${e}\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`\n`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Wh(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Hh(e);if(null===i)return r;let s='
    ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Hh(e);if(null===i)return Wh(n);let s=`${n}{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Gh(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Jh(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Xh;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],s=t[r];Xh.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Xh.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return s.call(t,n)})();let r=i.call(t,e);return s.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await s.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Vh.lex(e,t??this.defaults)}parser(e,t){return Yh.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));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?Vh.lex:Vh.lexInline)(n,i),s=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(s,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?Yh.parse:Yh.parseInline)(s,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?Vh.lex:Vh.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?Yh.parse:Yh.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="

    An error occurred:

    "+Wh(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function eg(e,t){return Qh.parse(e,t)}function tg(e){try{return new URL(e),!0}catch{return!1}}function ng(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}eg.options=eg.setOptions=function(e){return Qh.setOptions(e),eg.defaults=Qh.defaults,Kd(eg.defaults),eg},eg.getDefaults=Wd,eg.defaults=Hd,eg.use=function(...e){return Qh.use(...e),eg.defaults=Qh.defaults,Kd(eg.defaults),eg},eg.walkTokens=function(e,t){return Qh.walkTokens(e,t)},eg.parseInline=Qh.parseInline,eg.Parser=Yh,eg.parser=Yh.parse,eg.Renderer=Gh,eg.TextRenderer=Zh,eg.Lexer=Vh,eg.lexer=Vh.lex,eg.Tokenizer=Jh,eg.Hooks=Xh,eg.parse=eg,eg.options,eg.setOptions,eg.use,eg.walkTokens,eg.parseInline,Yh.parse,Vh.lex;class rg{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#zt(t)&&!this.#Bt()?(this.#$t(t),e.preventDefault(),!0):void this.#Ut(t))}#zt(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#Bt(){let e=!1;return this.editor.getEditorState().read((()=>{const t=ki();if(!si(t))return;let n=t.anchor.getNode();for(;n;){if(cu(n))return void(e=!0);n=n.getParent()}})),e}#$t(e){e.items[0].getAsString((e=>{if(tg(e)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else if(tg(e)){const t=this.contents.createLink(e);this.#Wt(t,{url:e})}else this.#Ht(e)}))}#Wt(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Ad(this.editorElement,"lexxy:insert-link",{...t,...n})}#Ht(e){const t=eg(e);this.contents.insertHtml(t)}#Ut(e){if(!this.editorElement.supportsAttachments)return;e.getData("text/html")||this.#Kt((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#Kt(e){const t=window.scrollY,n=window.scrollX;e(),await Dd(),window.scrollTo(n,t),this.editor.focus()}}class ig{constructor(e){this.editor=e.editor}toggle(e){this.editor.update((()=>{this.#jt(e),tl((e=>this.#qt(e)))}))}remove(){this.toggle({color:void 0,"background-color":void 0})}#jt(e){const t=ki();for(const n in e){const r=ll(t,n);el(t,{[n]:this.#Jt(r,e[n])})}}#Jt(e,t){return e===t?null:t}#qt(e){this.#Vt(e)!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}#Vt(e){const t=qa(e.getStyle());return!(!t.color&&!t["background-color"])}}class sg extends Br{$config(){return this.config("highlight",{extends:Br})}static importDOM(){return{mark:()=>({conversion:td("mark",og),priority:1})}}}function og(e,t){const n=t.style?.color,r=t.style?.backgroundColor;let i="";if(n&&""!==n&&(i+=`color: ${n};`),r&&""!==r&&(i+=`background-color: ${r};`),i.length)return e.hasFormat("highlight")||e.toggleFormat("highlight"),e.setStyle(e.getStyle()+i)}const ag="language";class lg extends Br{$config(){return this.config("trix-text",{extends:Br})}static importDOM(){return{em:e=>cg(e,{conversion:td("i",og),priority:1}),span:e=>cg(e,{conversion:td("mark",og),priority:1}),strong:e=>cg(e,{conversion:td("b",og),priority:1}),del:()=>({conversion:td("s",ug),priority:1}),pre:e=>function(e,t){return e.hasAttribute(ag)?t:null}(e,{conversion:nd(au,"pre",dg),priority:1})}}}function cg(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function ug(e,t){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),og(e,t)}function dg(e,t){const n=Tu(t.getAttribute(ag));e.node.setLanguage(n)}class hg extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#Gt="";#Zt=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Ld("lexxy-editor"),this.editor=this.#Yt(),this.contents=new Ud(this),this.selection=new zd(this),this.clipboard=new rg(this),this.highlighter=new ig(this),Md.configureFor(this),this.#Xt(),requestAnimationFrame((()=>Ad(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#Qt()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#en())),"required"===e&&this.isConnected&&(this.#Zt.required=this.hasAttribute("required"),this.#tn())}formResetCallback(){this.value=this.#Gt,this.editor.dispatchCommand(Dn,void 0)}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#nn?(this.toolbar=this.toolbar||this.#rn(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return se.sanitize(e)}(bc(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{No(Tr);const t=eo();t.clear(),""!==e&&t.append(...this.#in(e)),t.select(),this.#sn(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#in(e){e||(e="

    ");return _c(this.editor,Ed(`
    ${e}
    `)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof as&&!t.isInline())return t}return e}))}#Xt(){this.#on(),this.#an(),this.#ln(),this.#cn(),this.#un(),this.#dn(),this.#hn(),this.#gn(),this.#pn()}#Yt(){this.editorContentElement=this.editorContentElement||this.#fn();const e=ks({namespace:"LexicalEditor",onError(e){throw e},theme:Cd,nodes:this.#mn});return e.setRootElement(this.editorContentElement),e}get#mn(){const e=[lg,sg,Uc,Kc,oc,tc,au,mu,Wu,qu,Id,Bd];return this.supportsAttachments&&e.push(Od,Fd),e}#fn(){const e=Td("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#yn,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#_n.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#yn(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#_n(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#bn(e){const t=void 0!==this.#bn&&this.#bn!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#Zt.value=this.#xn?"":e,t&&Ad(this,"lexxy:change")}get#bn(){return this._internalFormValue}#gn(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"

    ";this.value=this.#Gt=e}#pn(){document.addEventListener("turbo:before-cache",this.#vn)}#vn=e=>{this.#Qt()};#on(){this.#kn(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#bn=this.value,this.#sn(),this.#tn()})))}#kn(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#Sn(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#an(){eu(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},Sd(this.editor,this.historyState,20),yc(this.editor),this.#wn(),xd(this.editor,yd)}#wn(){!function(e,t){if(!e.hasNodes([au,mu]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=Lu);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(au,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Vs(n);null!==t&&Ou(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(au,(n=>Iu(n,e,t))),e.registerNodeTransform(Br,(n=>Pu(n,e,t))),e.registerNodeTransform(mu,(n=>Pu(n,e,t))),e.registerCommand(wn,(t=>{const n=function(e){const t=ki();if(!si(t)||!Mu(t))return null;const n=e?En:Tn,r=e?En:Cn,i=t.anchor,s=t.focus;if(i.is(s))return r;const o=Du(t);if(1!==o.length)return n;const a=o[0];let l,c;0===a.length&&nu(285),t.isBackward()?(l=s,c=i):(l=i,c=s);const u=vu(a[0]),d=ku(a[0]),h=ti(u.getKey(),0,"text"),g=ti(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(Cn,(()=>!!Mu(ki())&&(Ai([Xr()]),!0)),1),e.registerCommand(Tn,(e=>zu(Tn)),1),e.registerCommand(En,(e=>zu(En)),1),e.registerCommand(yn,(e=>{const t=ki();if(!si(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Mu(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&cu(r.getParentOrThrow())?(e.preventDefault(),!0):Bu(yn,e))}),1),e.registerCommand(_n,(e=>{const t=ki();if(!si(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Mu(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&cu(r.getParentOrThrow())?(e.preventDefault(),!0):Bu(_n,e))}),1),e.registerCommand(mn,(e=>$u(mn,e)),1),e.registerCommand(pn,(e=>$u(pn,e)),1)),pl(...n)}(this.editor),this.append(Td("lexxy-code-language-picker"))}#ln(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=Vs(t);if(e instanceof Od){const t=e.getWritable();Object.assign(t,n)}}))}))}#cn(){this.editor.registerCommand(bn,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#un(){this.editor.registerCommand(Un,(()=>{Ad(this,"lexxy:blur")}),2),this.editor.registerCommand($n,(()=>{Ad(this,"lexxy:focus")}),2)}#dn(){hg.debug&&this.#kn(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#hn(){this.#nn&&this.toolbarElement.setEditor(this)}#rn(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#Cn()}get#nn(){return"false"!==this.getAttribute("toolbar")}#Cn(){const e=Td("lexxy-toolbar");return e.innerHTML=rd.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),this.prepend(e),e}#sn(){this.classList.toggle("lexxy-editor--empty",this.#xn)}get#xn(){return["


    ","

    ",""].includes(this.value.trim())}#tn(){this.#Zt.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#Zt.validity,this.#Zt.validationMessage,this.editorContentElement)}#Qt(){this.#Sn(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#vn)}#en(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",hg);class gg extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Tn.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#En.bind(this)),this.addEventListener("keydown",this.#Nn.bind(this))}show(e){this.input.value=this.#An,this.dialog.show()}close(){this.dialog.close()}#Tn(e){const t=e.submitter?.value;this.#Ln.dispatchCommand(t,this.input.value)}#En(e){this.#Ln.dispatchCommand("unlink"),this.close()}#Nn(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#An(){let e="";return this.#Ln.getEditorState().read((()=>{const t=ki();if(!si(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(ju(n)){e=n.getURL();break}n=n.getParent()}})),e}get#Ln(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",gg);const pg="button.lexxy-color-button";class fg extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.#Pn(),this.#On()}show(){this.dialog.show()}close(){this.dialog.close()}#On(){this.addEventListener("keydown",this.#Nn.bind(this)),this.querySelector("[data-command='removeHighlight']").addEventListener("click",this.#Fn.bind(this)),this.#In.forEach((e=>e.addEventListener("click",this.#Rn.bind(this)))),this.#Mn.registerUpdateButtonStatesCallback(this.#Dn.bind(this))}#Nn(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}#Pn(){this.#zn.forEach((e=>{this.#Bn(e)}))}#Bn(e){const t=e.dataset.values?.split("; ")||[],n=e.dataset.buttonGroup;t.forEach(((t,r)=>{e.appendChild(this.#$n(n,t,r))}))}#$n(e,t,n){const r=document.createElement("button");return r.dataset.style=e,r.style.setProperty(e,t),r.dataset.value=t,r.classList.add("lexxy-color-button"),r.name=e+"-"+n,r}#Rn(e){e.preventDefault();const t=e.target.closest(pg);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.#Ln.dispatchCommand("toggleHighlight",{[n]:r}),this.close()}#Fn(e){e.preventDefault(),this.#Ln.dispatchCommand("removeHighlight"),this.close()}get#zn(){return this.querySelectorAll("[data-button-group]")}get#Mn(){return this.closest("lexxy-toolbar")}get#Ln(){return this.#Mn.editor}get#In(){return Array.from(this.querySelectorAll(pg))}#Dn(e){const t=ll(e,"color",""),n=ll(e,"background-color","");this.#In.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}))}}customElements.define("lexxy-color-dialog",fg);class mg{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=Td("li",{role:"option",id:Ld("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=Ed(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class yg extends mg{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Un(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Un(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return ng(e).includes(ng(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class _g extends yg{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class bg extends yg{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class xg extends mg{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,s)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){s(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#Wn(e));return this.#Un(t)}#Wn(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Un(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class vg extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#Hn(),this.#Kn()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#jn(){return!this.supportsSpaceInSearches}#Hn(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new xg(e):new bg(e):new _g(this.querySelectorAll("lexxy-prompt-item"))}#Kn(){const e=this.#Ln.registerUpdateListener((()=>{this.#Ln.read((()=>{const{node:t,offset:n}=this.#ft.selectedNodeWithOffset();if(t&&Gr(t)&&n>0){const r=t.getTextContent();if(r[n-1]===this.trigger){const t=1===n,i=n>1?r[n-2]:null;(t||(" "===i||"\n"===i))&&(e(),this.#qn())}}}))}))}#Jn(){this.cursorPositionListener=this.#Ln.registerUpdateListener((()=>{this.closed||this.#Ln.read((()=>{const{node:e,offset:t}=this.#ft.selectedNodeWithOffset();if(e)if(Gr(e)&&t>0){const n=e.getTextContent().slice(0,t).lastIndexOf(this.trigger);(-1===n||t<=n)&&this.#Vn()}else this.#Vn()}))}))}#Gn(){this.cursorPositionListener&&(this.cursorPositionListener(),this.cursorPositionListener=null)}get#Ln(){return this.#Zn.editor}get#Zn(){return this.closest("lexxy-editor")}get#ft(){return this.#Zn.selection}async#qn(){this.popoverElement??=await this.#Yn(),this.#Xn(),await this.#Qn(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#er(),this.#Zn.addEventListener("keydown",this.#tr),this.#Zn.addEventListener("lexxy:change",this.#Qn),this.#nr(),this.#Jn()}#nr(){this.keyListeners.push(this.#Ln.registerCommand(bn,this.#rr.bind(this),3)),this.keyListeners.push(this.#Ln.registerCommand(wn,this.#rr.bind(this),3)),this.#jn&&this.keyListeners.push(this.#Ln.registerCommand(xn,this.#rr.bind(this),3)),this.keyListeners.push(this.#Ln.registerCommand(yn,this.#ir.bind(this),3)),this.keyListeners.push(this.#Ln.registerCommand(_n,this.#sr.bind(this),3))}#ir(e){return this.#or(),e.preventDefault(),!0}#sr(e){return this.#ar(),e.preventDefault(),!0}#er(){const e=this.#lr[0];e&&this.#cr(e)}get#lr(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#cr(e){this.#ur(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#ft.preservingSelection((()=>{this.#Zn.focus()})),this.#dr.setAttribute("aria-controls",this.popoverElement.id),this.#dr.setAttribute("aria-activedescendant",e.id),this.#dr.setAttribute("aria-haspopup","listbox")}#ur(){this.#lr.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#dr.removeAttribute("aria-controls"),this.#dr.removeAttribute("aria-activedescendant"),this.#dr.removeAttribute("aria-haspopup")}#hr(){const{x:e,y:t,fontSize:n}=this.#ft.cursorPosition,r=this.#Zn.getBoundingClientRect(),i=this.#dr.getBoundingClientRect().top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.popoverElement.style.left=`${e}px`,this.popoverElement.toggleAttribute("data-anchored",!0)),this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";const s=this.popoverElement.getBoundingClientRect();(s.bottom>window.innerHeight||this.popoverElement.hasAttribute("data-clipped-at-bottom"))&&(this.popoverElement.style.top=t+i-s.height-n+"px",this.popoverElement.style.bottom="auto",this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#Xn(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-anchored")}async#Vn(){this.#ur(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#Zn.removeEventListener("lexxy:change",this.#Qn),this.#Zn.removeEventListener("keydown",this.#tr),this.#gr(),this.#Gn(),await Dd(),this.#Kn()}#gr(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#Qn=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#pr.containsTextBackUntil(this.trigger)?(await this.#fr(),await Dd(),this.#hr()):this.#Vn()};async#fr(){const e=this.#pr.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#mr(t):this.#yr(),this.#er()}#mr(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#yr(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=Td("li",{innerHTML:this.#_r});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#_r(){return this.getAttribute("empty-results")||"Nothing found"}#tr=e=>{"Escape"===e.key&&(this.#Vn(),this.#Zn.focus(),e.stopPropagation())};#ar(){const e=this.#br+1;e=0&&this.#cr(this.#lr[e])}get#br(){return this.#lr.findIndex((e=>e.hasAttribute("aria-selected")))}get#xr(){return this.#lr[this.#br]}#rr(e){return e.preventDefault(),e.stopPropagation(),this.#vr(),!0}#vr(){this.#kr(),this.#Vn(),this.#Zn.focus()}#kr(){const e=this.source.promptItemFor(this.#xr);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#pr.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#Sr(t,n):this.#wr(e,t,n)}#Sr(e,t){this.#Ln.update((()=>{const n=_c(this.#Ln,Ed(`${e.innerHTML}`));this.#pr.replaceTextBackUntil(t,n)}))}#wr(e,t,n){this.#Ln.update((()=>{const r=new Bd({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#pr.replaceTextBackUntil(n,r)}))}get#pr(){return this.#Zn.contents}get#dr(){return this.#Zn.editorContentElement}async#Yn(){const e=Td("ul",{role:"listbox",id:Ld("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",ul()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#Cr),this.#Zn.appendChild(e),e}#Cr=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#cr(t),this.#vr())}}customElements.define("lexxy-prompt",vg);class kg extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#Tr(),this.#Er()}#Tr(){this.languagePickerElement=this.#Nr(),this.languagePickerElement.addEventListener("change",(()=>{this.#Ar(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.languagePickerElement.setAttribute("nonce",ul()),this.editorElement.appendChild(this.languagePickerElement)}#Nr(){const e=Td("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Lr)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Lr(){const e={...wu};e.ruby||(e.ruby="Ruby");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#Ar(e){this.editor.update((()=>{const t=this.#Pr();t&&t.setLanguage(e)}))}#Er(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#Pr();e?this.#Or(e):this.#Fr()}))}))}#Pr(){const e=ki();if(!si(e))return null;const t=e.anchor.getNode(),n=t.getParent();return cu(t)?t:cu(n)?n:null}#Or(e){const t=e.getLanguage();this.#Ir(t),this.#Rr(),this.#Mr(e)}#Ir(e){if(this.languagePickerElement&&e){const t=Tu(e);this.languagePickerElement.value=t}}#Mr(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#Rr(){this.languagePickerElement.hidden=!1}#Fr(){this.languagePickerElement.hidden=!0}}function Sg(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(//gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),s=Td("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}customElements.define("lexxy-code-language-picker",kg),function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(Prism),window.Prism=window.Prism||{},Prism.manual=!0;export{Sg as highlightAll}; + */function lc(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}"undefined"!=typeof module&&module.exports&&(module.exports=ac),"undefined"!=typeof global&&(global.Prism=ac),ac.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},ac.languages.markup.tag.inside["attr-value"].inside.entity=ac.languages.markup.entity,ac.languages.markup.doctype.inside["internal-subset"].inside=ac.languages.markup,ac.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(ac.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:ac.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:ac.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},ac.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(ac.languages.markup.tag,"addAttribute",{value:function(e,t){ac.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:ac.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),ac.languages.html=ac.languages.markup,ac.languages.mathml=ac.languages.markup,ac.languages.svg=ac.languages.markup,ac.languages.xml=ac.languages.extend("markup",{}),ac.languages.ssml=ac.languages.xml,ac.languages.atom=ac.languages.xml,ac.languages.rss=ac.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(ac),ac.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:/[{}[\];(),.:]/},ac.languages.javascript=ac.languages.extend("clike",{"class-name":[ac.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),ac.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,ac.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:ac.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:ac.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:ac.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:ac.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:ac.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),ac.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:ac.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"}}),ac.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),ac.languages.markup&&(ac.languages.markup.tag.addInlined("script","javascript"),ac.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),ac.languages.js=ac.languages.javascript,function(){if(void 0!==ac&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",n="loading",r="loaded",i="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+n+'"])';ac.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),ac.hooks.add("before-sanity-check",(function(o){var s=o.element;if(s.matches(i)){o.code="",s.setAttribute(t,n);var a=s.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=s.getAttribute("data-src"),c=o.language;if("none"===c){var u=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[u]||u}ac.util.setLanguage(a,c),ac.util.setLanguage(s,c);var d=ac.plugins.autoloader;d&&d.loadLanguages(c),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?n("✖ Error "+r.status+" while fetching file: "+r.statusText):n("✖ Error: File does not exist or is empty"))},r.send(null)}(l,(function(e){s.setAttribute(t,r);var n=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}(s.getAttribute("data-range"));if(n){var i=e.split(/\r\n?|\n/g),o=n[0],l=null==n[1]?i.length:n[1];o<0&&(o+=i.length),o=Math.max(0,Math.min(o-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(o,l).join("\n"),s.hasAttribute("data-start")||s.setAttribute("data-start",String(o+1))}a.textContent=e,ac.highlightElement(a)}),(function(e){s.setAttribute(t,"failed"),a.textContent=e}))}})),ac.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(i),r=0;t=n[r++];)ac.highlightElement(t)}};var o=!1;ac.fileHighlight=function(){o||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),o=!0),ac.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+o+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+o+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(Prism),Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,n=0;n<2;n++)t=t.replace(//g,(function(){return t}));t=t.replace(//g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism),function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//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(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism);const cc=globalThis.Prism||window.Prism,uc=e=>{try{return!!e&&cc.languages.hasOwnProperty(e)}catch(e){return!1}};function dc(e,t){for(const n of e.childNodes){if(xs(n)&&n.tagName===t)return!0;dc(n,t)}return!1}const hc="data-language",gc="data-highlight-language";class pc extends Wi{static getType(){return"code"}static clone(e){return new pc(e.__language,e.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=uc(e)}createDOM(e){const t=document.createElement("code");$a(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(hc,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(gc,n)),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;return r?r!==i&&(t.setAttribute(hc,r),this.__isSyntaxHighlightSupported&&t.setAttribute(gc,r)):i&&(t.removeAttribute(hc),e.__isSyntaxHighlightSupported&&t.removeAttribute(gc)),!1}exportDOM(e){const t=document.createElement("pre");$a(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(hc,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(gc,n)),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||dc(e,"BR"))?{conversion:yc,priority:1}:null,div:()=>({conversion:_c,priority:1}),pre:()=>({conversion:yc,priority:0}),table:e=>Sc(e)?{conversion:bc,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Sc(n)?{conversion:xc,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Sc(t)?{conversion:xc,priority:3}:null}}}static importJSON(e){return fc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,t=!0){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=so();return this.insertAfter(e,t),e}const{anchor:i,focus:o}=e,s=(i.isBefore(o)?i:o).getNode();if(Pr(s)){let e=Fc(s);const t=[];for(;;)if(Mr(e))t.push(Dr()),e=e.getNextSibling();else{if(!Ac(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;ne.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t.__isSyntaxHighlightSupported=uc(e),t}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}}function fc(e){return ps(new pc(e))}function mc(e){return e instanceof pc}function yc(e){return{node:fc(e.getAttribute(hc))}}function _c(e){const t=e,n=vc(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(vc(t))return!0;t=t.parentElement}return!1}(t)?{node:n?fc():null}:{node:null}}function bc(){return{node:fc()}}function xc(){return{node:null}}function vc(e){return null!==e.style.fontFamily.match("monospace")}function Sc(e){return e.classList.contains("js-file-line-container")}const Cc={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"},Ec={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Tc(e){return Ec[e]||e}class kc extends Sr{constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new kc(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return $a(t,wc(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=wc(n.theme,e.__highlightType),o=wc(n.theme,this.__highlightType);return i!==o&&(i&&Ka(t,i),o&&$a(t,o)),r}static importJSON(e){return Nc().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 fc()}}function wc(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Nc(e="",t){return ps(new kc(e,t))}function Ac(e){return e instanceof kc}function Lc(e,t){let n=e;for(let r=Vs(e,t);r&&(Ac(r.origin)||Mr(r.origin));r=ja(r))n=r.origin;return n}function Fc(e){return Lc(e,"previous")}function Pc(e){return Lc(e,"next")}const Oc={defaultLanguage:"javascript",tokenize(e,t){return cc.tokenize(e,cc.languages[t||""]||cc.languages[this.defaultLanguage])}};function Ic(e,t,n){const r=e.getParent();mc(r)?Rc(r,t,n):Ac(e)&&e.replace(Fr(e.__text))}function Dc(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let e=0;e{!function(e,t){const n=Lo(e);if(!mc(n)||!n.isAttached())return;const r=oi();if(!Hr(r))return void t();const i=r.anchor,o=i.offset,s="element"===i.type&&pr(n.getChildAtIndex(i.offset-1));let a=0;if(!s){const e=i.getNode();a=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(s?i.getNode().select(o,o):n.getChildren().some((e=>{const t=Pr(e);if(t||pr(e)){const n=e.getTextContentSize();if(t&&n>=a)return e.select(a,a),!0;a-=n}return!1})))}(r,(()=>{const t=Lo(r);if(!mc(t)||!t.isAttached())return!1;const i=t.getTextContent(),o=Bc(n.tokenize(i,t.getLanguage()||n.defaultLanguage)),s=function(e,t){let n=0;for(;n{Mc.delete(r)},skipTransforms:!0}))}function Bc(e,t){const n=[];for(const r of e)if("string"==typeof r){const e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r0&&n.push(Nc(i,t))}}else{const{content:e}=r;"string"==typeof e?n.push(...Bc([e],r.type)):Array.isArray(e)&&n.push(...Bc(e,r.type))}return n}function zc(e,t){return Ac(e)&&Ac(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Mr(e)&&Mr(t)||pr(e)&&pr(t)}function Uc(e){if(!Hr(e))return!1;const t=e.anchor.getNode(),n=mc(t)?t:t.getParent(),r=e.focus.getNode(),i=mc(r)?r:r.getParent();return mc(n)&&n.is(i)}function Wc(e){const t=e.getNodes(),n=[];if(1===t.length&&mc(t[0]))return n;let r=[];for(let e=0;e0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Br(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function Hc(e){const t=oi();if(!Hr(t)||!Uc(t))return!1;const n=Wc(t),r=n.length;if(0===r&&t.isCollapsed())return e===_n&&t.insertNodes([Dr()]),!0;if(0===r&&e===_n&&"\n"===t.getTextContent()){const e=Dr(),n=gr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),ha(Sa(ra(Gs(e,"next",0),ba(Vs(n,"next"))),r)),!0}for(let i=0;i0){let n=r[0];if(0===i&&(n=Fc(n)),e===_n){const e=Dr();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Br(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Mr(n)&&n.remove()}}return!0}function $c(e,t){const n=oi();if(!Hr(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,a=r.getNode(),l=i.getNode(),c=e===cn;if(!Uc(n)||!Ac(a)&&!Mr(a)||!Ac(l)&&!Mr(l))return!1;if(!t.altKey){if(n.isCollapsed()){const e=a.getParentOrThrow();if(c&&0===o&&null===a.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&o===a.getTextContentSize()&&null===a.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(a.isBefore(l)?(u=Fc(a),d=Pc(l)):(u=Fc(l),d=Pc(a)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;ee.remove())),e===cn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(a,o,l,s),!0}function Kc(e,t){const n=oi();if(!Hr(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),a=e===ln;if(!Uc(n)||!Ac(o)&&!Mr(o)||!Ac(s)&&!Mr(s))return!1;if(a){const e=function(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(Ac(i)||Mr(i)||pr(i)||lc(167),pr(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Ac(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let a=null;if(t({conversion:Jc,priority:1})}}static importJSON(e){return Vc().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=ru(e);try{const t=new URL(ru(e));if(!jc.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=Vc(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Hr(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Jc(e){let t=null;if(bs(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Vc(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Vc(e="",t){return ps(new qc(e,t))}function Gc(e){return e instanceof qc}let Yc=class e extends qc{constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}static getType(){return"autolink"}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Zc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(Hi(n)){const e=Zc(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function Zc(e="",t){return ps(new Yc(e,t))}function Xc(e){return e instanceof Yc}function Qc(e,t){if("element"===e.type){const n=e.getNode();return Hi(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function eu(e,t={}){const{target:n,title:r}=t,i=void 0===t.rel?"noreferrer":t.rel,o=oi();if(null===o||!Hr(o)&&!Kr(o))return;if(Kr(o)){const t=o.getNodes();if(0===t.length)return;return void t.forEach((t=>{if(null===e){const e=Va(t,(e=>!Xc(e)&&Gc(e)));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const r=Va(t,(e=>!Xc(e)&&Gc(e)));if(r)r.setURL(e),void 0!==n&&r.setTarget(n),void 0!==i&&r.setRel(i);else{const r=Vc(e,{rel:i,target:n});t.insertBefore(r),r.append(t)}}}))}const s=o.extract();if(null===e)return void s.forEach((e=>{const t=Va(e,(e=>!Xc(e)&&Gc(e)));if(t){const e=t.getChildren();for(let n=0;n{a.has(t.getKey())||(a.add(t.getKey()),t.setURL(e),void 0!==n&&t.setTarget(n),void 0!==i&&t.setRel(i),void 0!==r&&t.setTitle(r))};if(1===s.length){const e=tu(s[0],Gc);if(null!==e)return l(e)}!function(e){const t=oi();if(!Hr(t))return e();const n=ot(t),r=n.isBackward(),i=Qc(n.anchor,r?-1:0),o=Qc(n.focus,r?0:-1);if(e(),i||o){const e=oi();if(Hr(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(o){const e=o.getParent();e&&t.focus.set(e.getKey(),o.getIndexWithinParent()+(r?0:1),"element")}Bo(ot(t))}}}((()=>{let t=null;for(const o of s){if(!o.isAttached())continue;const s=tu(o,Gc);if(s){l(s);continue}if(Hi(o)){if(!o.isInline())continue;if(Gc(o)){if(!(Xc(o)||null!==t&&t.getParentOrThrow().isParentOf(o))){l(o),t=o;continue}for(const e of o.getChildren())o.insertBefore(e);o.remove();continue}}const a=o.getPreviousSibling();Gc(a)&&a.is(t)?a.append(o):(t=Vc(e,{rel:i,target:n,title:r}),o.insertAfter(t),t.append(o))}}))}function tu(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}const nu=/^\+?[0-9\s()-]{5,}$/;function ru(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:nu.test(e)?`tel:${e}`:`https://${e}`}function iu(e){let t=e;for(;null!==t;){if(gl(t))return t;t=t.getParent()}return null}function ou(e){let t=e;for(;t;){if(xl(t))return t.getListType();t=t.getParent()}return null}function su(e,t=e=>e){return au(Sr,e,((e,n)=>({...e,forChild:(r,i)=>{const o=e?.forChild??(e=>e);let s=o(r,i);return Pr(s)&&(s=t(s,n)??s),s}})))}function au(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const o=i.conversion(r);return o?n(o,r)??o:o}}class lu extends HTMLElement{constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.updateButtonStatesCallbacks=[]}connectedCallback(){requestAnimationFrame((()=>this.#e())),this._resizeObserver=new ResizeObserver((()=>this.#e())),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.#t(),this.#n(),this.#r(),this.#i(),this.#o(),this.#e(),this.toggleAttribute("connected",!0)}registerUpdateButtonStatesCallback(e){this.updateButtonStatesCallbacks.push(e)}#t(){this.addEventListener("click",this.#s.bind(this))}#s({target:e}){this.#a(e,"[data-command]",this.#l.bind(this)),this.#a(e,"[data-dialog-target]",this.#c.bind(this))}#a(e,t,n){const r=e.closest(t);r&&n(r)}#l(e){const{command:t,payload:n}=e.dataset;this.editor.dispatchCommand(t,n)}#c(e){const t=e.dataset.dialogTarget,n=this.querySelector("lexxy-"+t);n&&(n.dialog&&n.dialog.open?n.close():(this.#u(),n.show()))}#u(){this.querySelectorAll("dialog[open]").forEach((e=>{e.closest(".lexxy-dialog").close()}))}#n(){this.editorElement.addEventListener("keydown",(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){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#r(){const e=parseInt(this.editorElement.editorContentElement.getAttribute("tabindex")??"0");this.#h.forEach(((t,n)=>{t.setAttribute("tabindex",`${e+n+1}`)}))}#i(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#g()}))}))}#o(){this.editor.registerUpdateListener((()=>{this.#p()}))}#p(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#f("undo",0===e.undoStack.length),this.#f("redo",0===e.redoStack.length))}))}#g(){const e=oi();if(!Hr(e))return;const t=e.anchor.getNode();if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e.hasFormat("bold"),i=e.hasFormat("italic"),o=e.hasFormat("strikethrough"),s=e.hasFormat("highlight"),a=this.#m(t),l=Gl(n),c=tc(n),u=mc(n)||e.hasFormat("code"),d=this.#y(t),h=ou(t);this.#_("bold",r),this.#_("italic",i),this.#_("strikethrough",o),this.#_("highlight",s),this.#_("link",a),this.#_("quote",l),this.#_("heading",c),this.#_("code",u),this.#_("unordered-list",d&&"bullet"===h),this.#_("ordered-list",d&&"number"===h),this.#p(),this.updateButtonStatesCallbacks.forEach((t=>t(e)))}#y(e){let t=e;for(;t;){if(xl(t)||gl(t))return!0;t=t.getParent()}return!1}#m(e){let t=e;for(;t;){if(Gc(t))return!0;t=t.getParent()}return!1}#_(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#f(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#b(){return this.scrollWidth>this.clientWidth}#e=()=>{this.#x(),this.#v(),this.#S.style.display=this.#C.children.length?"block":"none",this.#S.setAttribute("nonce",Ba())};get#S(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#C(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}#x(){for(;this.#C.children.length>0;)this.insertBefore(this.#C.children[0],this.#S)}#v(){const e=this.#E.reverse();let t=!1;for(const n of e){if(!this.#b()){t&&this.#C.prepend(n);break}this.#C.prepend(n),t=!0}}get#h(){return Array.from(this.querySelectorAll(":scope > button"))}get#E(){return Array.from(this.querySelectorAll(":scope > button, :scope > [role=separator]"))}static get defaultTemplate(){return'\n \n\n \n\n \n\n \n\n \n \n
    \n
    \n
    \n \n
    \n
    \n
    \n\n \n\n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n
    \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n\n \n\n
    \n •••\n
    \n
    \n '}}function cu(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}customElements.define("lexxy-toolbar",lu);const uu=/[!-/:-@[-`{-~\s]/;function du(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function hu(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(gu(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function gu(e,t,n,r,i){for(let o=0;oe.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=cu(n.textFormat,(({tag:e})=>e[e.length-1])),i=cu(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||du(173,n.getType())}}const o=(e,t,o)=>{(function(e,t,n,r){if(!gs(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:o,replace:s}of r){const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,a]=t.splitText(n);if(!1!==s(e,a?[a,...i]:i,r,!1))return o.remove(),!0}}return!1})(e,t,o,n.element)||function(e,t,n,r){if(!gs(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:o,replace:s,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,a]=t.splitText(n);if(!1!==s(e,a?[a,...i]:i,r,null,null,!1))return o.remove(),!0}}return!1}(e,t,o,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t1&&!gu(r,a,n,0,s))continue;if(" "===r[a-1])continue;const l=r[i+1];if(!1===t.intraword&&l&&!uu.test(l))continue;const c=e;let u=c,d=hu(r,a,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!pr(h);)if(Pr(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=hu(e,e.length,n)}if(d<0)continue;if(u===c&&d+s===a)continue;const g=u.getTextContent();if(d>0&&g[d-1]===o)continue;const p=g[d-1];if(!1===t.intraword&&p&&!uu.test(p))continue;const f=c.getTextContent(),m=f.slice(0,a)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+s));const _=oi(),b=ni();Bo(b);const x=i-s*(u===c?2:1)+1;b.anchor.set(u.__key,d,"text"),b.focus.set(c.__key,x,"text");for(const e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return Hr(_)&&(b.format=_.format),!0}}(t,o,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(eo)||t.has(Xi))return;if(e.isComposing())return;const s=r.read(oi),a=i.read(oi);if(!Hr(a)||!Hr(s)||!s.isCollapsed()||s.is(a))return;const l=s.anchor.key,c=s.anchor.offset,u=r._nodeMap.get(l);!Pr(u)||!n.has(l)||1!==c&&c>a.anchor.offset+1||e.update((()=>{if(!function(e){return Pr(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||mc(e)||o(e,u,s.anchor.offset)}))}))}const fu=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},mu=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),a=hl("check"===e?"x"===r[3]:void 0);if(xl(s)&&s.getListType()===e){const e=s.getFirstChild();null!==e?e.insertBefore(a):s.append(a),t.remove()}else if(xl(o)&&o.getListType()===e)o.append(a),t.remove();else{const n=bl(e,"number"===e?Number(r[2]):void 0);n.append(a),t.replace(n)}a.append(...n),i||a.select(0,0);const l=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);l&&a.setIndent(l)},yu=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(gl(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(xl(e)){r.push(yu(e,t,n+1));continue}}const i=" ".repeat(4*n),a=e.getListType(),l="number"===a?`${e.getStart()+o}. `:"check"===a?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+l+t(s)),o++}return r.join("\n")},_u={dependencies:[Yl],export:(e,t)=>{if(!tc(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:fu((e=>ec("h"+e[1].length))),type:"element"},bu={dependencies:[Jl],export:(e,t)=>{if(!Gl(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(Gl(n))return n.splice(n.getChildrenSize(),0,[gr(),...t]),void e.remove()}const i=Vl();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},xu={dependencies:[pc],export:e=>{if(!mc(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```(\w+)?/,replace:(e,t,n,r,i,o)=>{let s,a;if(!t&&i){if(1===i.length)r?(s=fc(),a=n[1]+i[0]):(s=fc(n[1]),a=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(s=fc(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();a=i.join("\n")}const t=Fr(a);s.append(t),e.append(s)}else t&&fu((e=>fc(e?e[1]:void 0)))(e,t,n,o)},type:"multiline-element"},vu={dependencies:[pl,cl],export:(e,t)=>xl(e)?yu(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:mu("bullet"),type:"element"},Su={dependencies:[pl,cl],export:(e,t)=>xl(e)?yu(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:mu("number"),type:"element"},Cu={dependencies:[qc],export:(e,t,n)=>{if(!Gc(e)||Xc(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,o=Vc(r,{title:i}),s=Fr(n);return s.setFormat(e.getFormat()),o.append(s),e.replace(o),s},trigger:")",type:"text-match"},Eu=[...[_u,bu,vu,Su],...[xu],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[Cu]];function Tu(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const o=t._selection,s=e._selection;if(i)return 1;if(!(Hr(o)&&Hr(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;const a=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||Ji(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){const n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Pr(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!Pr(c)||!Pr(l)||c.__mode!==l.__mode)return 0;const u=c.__text,d=l.__text;if(u===d)return 0;const h=o.anchor,g=s.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}function ku(e,t){let n=Date.now(),r=0;return(i,o,s,a,l,c)=>{const u=Date.now();if(c.has(Xi))return r=0,n=u,2;const d=Tu(i,o,a,l,e.isComposing()),h=(()=>{const h=null===s||s.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Qi))return 0;if(null===i)return 1;const p=o._selection;return a.size>0||l.size>0?!1===g&&0!==d&&d===r&&ur.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(a)[0],i,o)?0:1:null!==p?0:2})();return n=u,r=d,h}}function wu(e){e.undoStack=[],e.redoStack=[],e.current=null}var Nu={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},codeHighlight:{atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__property",decorator:"code-token__function",deleted:"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__variable",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",namespace:"code-token__variable",number:"code-token__property",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};function Au(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function Lu(e){return(new DOMParser).parseFromString(e,"text/html")}function Fu(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function Pu(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Ou(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Iu(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}class Du extends Ki{static getType(){return"action_text_attachment"}static clone(e){return new Du({...e},e.__key)}static importJSON(e){return new Du({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Du({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:e=>({conversion:()=>({node:new Du({src:e.getAttribute("src"),caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),video:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{conversion:()=>({node:new Du({src:t,fileName:n,contentType:r})}),priority:1}}}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:o,fileName:s,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=o||"",this.fileName=s||"",this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#T(e)})),this.isPreviewableAttachment?(e.appendChild(this.#k()),e.appendChild(this.#w())):(e.appendChild(this.#N()),e.appendChild(this.#A())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:Au("action-text-attachment",{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,Au("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#L(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#L||this.previewable}#k(){return Au("img",{src:this.src,alt:this.altText,...this.#F})}get#F(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#N(){return Au("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#A(){const e=Au("figcaption",{className:"attachment__caption"}),t=Au("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=Au("span",{className:"attachment__size",textContent:Iu(this.fileSize)});e.appendChild(t)}return e}#T(e){Fu(e,"lexxy:internal:select-node",{key:this.getKey()})}#w(){const e=Au("figcaption",{className:"attachment__caption"}),t=Au("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#P.bind(this)),t.addEventListener("keydown",this.#O.bind(this)),e.appendChild(t),e}#P(e){const t=e.target;t.placeholder=this.fileName,this.#I(t)}#I(e){Fu(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#O(e){"Enter"===e.key&&(this.#I(e.target),Fu(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Mu extends Du{static getType(){return"action_text_attachment_upload"}static clone(e){return new Mu({...e},e.__key)}static importJSON(e){return new Mu({...e})}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},o){super({contentType:e.type},o),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#k()):e.appendChild(this.#N()),e.appendChild(this.#D());const t=Au("progress",{value:this.progress,max:100});return e.appendChild(t),this.#M(e).then((()=>this.#R(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}exportJSON(){return{type:"action_text_attachment_upload",version:1,progress:this.progress,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,...super.exportJSON()}}#k(){return Au("img")}#N(){return Au("span",{className:"attachment__icon",textContent:this.#B()})}#B(){return this.file.name.split(".").pop().toLowerCase()}#D(){const e=Au("figcaption",{className:"attachment__caption"}),t=Au("span",{className:"attachment__name",textContent:this.file.name||""}),n=Au("span",{className:"attachment__size",textContent:Iu(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#M(e){const t=e.querySelector("img");return t?async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))}(this.file,t):Promise.resolve()}#R(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#z(n):this.#U(t,n).then((()=>{this.#W(n,t)}))}))}#z(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(Au("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#W(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),i=Lo(this.getKey());i&&i.replace(new Du({sgid:t.attachable_sgid,src:t.previewable?t.url:r,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Qi})}async#U(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#k();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}class Ru extends Wi{static getType(){return"attachment_gallery"}static clone(e){return new Ru(e.__key)}static importJSON(e){return new Ru}static importDOM(){return{div:e=>e.classList.contains("attachment-gallery")?{conversion:()=>({node:new Ru}),priority:1}:null}}constructor(e){super(e)}createDOM(){const e=document.createElement("div");return e.className=this.getGalleryClassName(),e}updateDOM(e,t){const n=this.getGalleryClassName();return t.className!==n&&(t.className=n),!1}getGalleryClassName(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}isInline(){return!1}exportDOM(e){const t=document.createElement("div");return t.className=this.getGalleryClassName(),{element:t}}exportJSON(){return{type:"attachment_gallery",version:1}}}class Bu extends Ki{static getType(){return"horizontal_divider"}static clone(e){return new Bu(e.__key)}static importJSON(e){return new Bu}static importDOM(){return{hr:e=>({conversion:()=>({node:new Bu}),priority:1})}}constructor(e){super(e)}createDOM(){const e=Au("figure",{className:"horizontal-divider"}),t=Au("hr");return e.addEventListener("click",(t=>{Fu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.appendChild(t),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:Au("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const zu=["bold","italic","strikethrough","link","unlink","toggleHighlight","removeHighlight","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","undo","redo"];class Uu{static configureFor(e){new Uu(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.highlighter=e.highlighter,this.#H(),this.#$()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(en,"bold")}dispatchItalic(){this.editor.dispatchCommand(en,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(en,"strikethrough")}dispatchToggleHighlight(e){this.highlighter.toggle(e)}dispatchRemoveHighlight(){this.highlighter.remove()}dispatchLink(e){this.editor.update((()=>{const t=oi();if(Hr(t))if(t.isCollapsed()){const n=Zc(e),r=Fr(e);n.append(r),t.insertNodes([n])}else eu(e)}))}dispatchUnlink(){this.#K(null)}dispatchInsertUnorderedList(){const e=oi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===ou(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(vl,void 0)}dispatchInsertOrderedList(){const e=oi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===ou(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(Sl,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedNodes((e=>Gl(e)),(()=>Vl()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(en,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>mc(e)),(()=>new pc("plain")))}))}dispatchInsertHorizontalDivider(){this.editor.update((()=>{this.contents.insertAtCursorEnsuringLineBelow(new Bu)})),this.editor.focus()}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=oi();if(!Hr(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(tc(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>ec(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=Au("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);t.length&&this.contents.uploadFiles(t)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchUndo(){this.editor.dispatchCommand(tn,void 0)}dispatchRedo(){this.editor.dispatchCommand(nn,void 0)}#H(){for(const t of zu){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#j(t,0,this[n].bind(this))}var e;this.#j(Yt,1,this.dispatchPaste.bind(this))}#j(e,t,n){this.editor.registerCommand(e,n,t)}#K(e){this.editor.update((()=>{eu(null===e?null:e)}))}#$(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#q.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#J.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#V.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#G.bind(this)))}#V(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#G(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#q(e){e.preventDefault()}#J(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);n.length&&(this.contents.uploadFiles(n),this.editor.focus())}}function Wu(){return new Promise(requestAnimationFrame)}class Hu{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Y(),this.#Z(),this.#X(),this.#Q()}clear(){this.current=null}set current(e){Kr(e)?this.editor.getEditorState().read((()=>{this._current=oi(),this.#ee()})):this.editor.update((()=>{this.#ee(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#te();if(!t)return;const n=this.#ne(t);n&&(e=this.#re(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{Mo().selectEnd()}))}selectedNodeWithOffset(){const e=oi();if(!e)return{node:null,offset:0};if(Hr(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(Kr(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}preservingSelection(e){let t=null;this.editor.getEditorState().read((()=>{const e=oi();e&&Hr(e)&&(t={anchor:{key:e.anchor.key,offset:e.anchor.offset},focus:{key:e.focus.key,offset:e.focus.offset}})})),e(),t&&this.editor.update((()=>{const e=oi();e&&Hr(e)&&(e.anchor.set(t.anchor.key,t.anchor.offset,"text"),e.focus.set(t.focus.key,t.focus.offset,"text"))}))}get hasSelectedWordsInSingleLine(){const e=oi();if(!Hr(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if(pr(e))return!1;return!0}get isInsideList(){const e=oi();if(!Hr(e))return!1;return null!==iu(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#oe(e,t):Hi(e)?this.#se(e,t):this.#ae(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#le(e):Hi(e)?this.#se(e,t):this.#ae(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#ce(e,t):Hi(e)?this.#ue(e,t):this.#de(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#he(e):Hi(e)?this.#ue(e,t):this.#de(e):null}get#ge(){return this.editorElement.contents}get#pe(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;this._currentlySelectedKeys=new Set;const e=oi();if(e&&Kr(e))for(const t of e.getNodes())this._currentlySelectedKeys.add(t.getKey());return this._currentlySelectedKeys}#Z(){this.editor.registerCommand(an,this.#fe.bind(this),1),this.editor.registerCommand(on,this.#me.bind(this),1),this.editor.registerCommand(cn,this.#ye.bind(this),1),this.editor.registerCommand(un,this.#_e.bind(this),1),this.editor.registerCommand(fn,this.#be.bind(this),1),this.editor.registerCommand(gn,this.#xe.bind(this),1),this.editor.registerCommand($t,(()=>{this.current=oi()}),1)}#Y(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Wu();const{key:t}=e.detail;this.editor.update((()=>{const e=Lo(t);if(e){const t=ri();t.add(e.getKey()),Bo(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#ve()}))}#X(){this.editor.getRootElement().addEventListener("keydown",(e=>{(function(e){return!(e.ctrlKey||e.metaKey||e.altKey||e.key.length>1&&"Enter"!==e.key&&"Space"!==e.key||1!==e.key.length)})(e)&&this.editor.update((()=>{const t=oi();if(Hr(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=t.anchor.offset,i=this.#Se(n,r),o=this.#Ce(n,r);if(i instanceof Ki&&!i.isInline())return e.preventDefault(),void this.#ge.createParagraphAfterNode(i,e.key);if(o instanceof Ki&&!o.isInline())return e.preventDefault(),void this.#ge.createParagraphBeforeNode(o,e.key)}}))}),!0)}#Se(e,t){return Pr(e)&&0===t?e.getPreviousSibling():Hi(e)&&t>0?e.getChildAtIndex(t-1):null}#Ce(e,t){return Pr(e)&&t===e.getTextContentSize()?e.getNextSibling():Hi(e)?e.getChildAtIndex(t):null}#Q(){this.editorContentElement.addEventListener("keydown",(e=>{if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}),!0)}#ee(){this.#Ee(),this.#Te(),this.previouslySelectedKeys=this.#pe,this._currentlySelectedKeys=null}#Ee(){for(const e of this.previouslySelectedKeys)if(!this.#pe.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Te(){for(const e of this.#pe)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#fe(){this.current?await this.#ke((e=>e.selectPrevious())):this.#we(this.nodeBeforeCursor)}async#me(){this.current?await this.#ke((e=>e.selectNext(0,0))):this.#we(this.nodeAfterCursor)}async#ye(){this.current?await this.#ke((e=>e.selectPrevious())):this.#we(this.topLevelNodeBeforeCursor)}async#_e(){this.current?await this.#ke((e=>e.selectNext(0,0))):this.#we(this.topLevelNodeAfterCursor)}async#ke(e){await Wu(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#ve(){this.editor.update((()=>{const e=this.#Ne();e&&this.#Ae(e)}))}#Ne(){const e=oi();return e?Kr(e)?this.#Le(e):Hr(e)?this.#Fe(e):null:null}#Le(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Fe(e){return e.anchor.getNode().getTopLevelElement()}#Ae(e){const t=e.getNextSibling();t?t.selectStart():this.#Pe()}#Pe(){const e=Mo(),t=so();e.append(t),t.selectStart()}#we(e){e&&e instanceof Ki&&this.editor.update((()=>{const t=ri();t.add(e.getKey()),Bo(t)}))}#be(){const e=this.nodeAfterCursor;return e instanceof Ki?(this.#we(e),!0):(this.#ge.deleteSelectedNodes(),!1)}#xe(){const e=this.nodeBeforeCursor;return e instanceof Ki?(this.#we(e),!0):(this.#ge.deleteSelectedNodes(),!1)}#te(){const e=oi();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#ne(e){let t=e.getBoundingClientRect();if(this.#Oe(t)){const n=this.#Ie(e);t=n.getBoundingClientRect(),this.#De(n),n.remove()}return t}#Oe(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#Ie(e){const t=this.#Me();return e.insertNode(t),t}#Me(){const e=document.createElement("span");return e.textContent="​",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",Ba()),e}#De(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#re(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#Re(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#Re(e){const t=window.getSelection().anchorNode,n=this.#Be(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#Be(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#ie(){const e=oi();if(!Hr(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#oe(e,t){return t===e.getTextContentSize()?this.#le(e):null}#le(e){if(e.getNextSibling()instanceof Ki)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#se(e,t){return t0?e.getChildAtIndex(t-1):this.#de(e)}#ae(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#de(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class $u extends Ki{static getType(){return"custom_action_text_attachment"}static clone(e){return new $u({...e},e.__key)}static importJSON(e){return new $u({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Fr(" ")),n.push(new $u({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Fr(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=Au("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{Fu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:Au("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class Ku{constructor(e){this.editorElement=e,this.editor=e.editor}monitor(){this.editor.registerCommand(dn,(e=>this.#ze(e)),3)}#ze(e){const t=oi();if(!Hr(t))return!1;const n=t.anchor.getNode();return!!this.#Ue(n)&&(this.#We(e,n)||this.#He(e,n))}#We(e,t){return!(!this.#$e(t)&&!this.#Ke(t))&&(e.preventDefault(),this.#je(t),!0)}#He(e,t){return!!this.#qe(t)&&(e.preventDefault(),this.#Je(t),!0)}#Ue(e){let t=e;for(;t;){if(Gl(t))return!0;t=t.getParent()}return!1}#$e(e){const t=this.#Ve(e);return!!t&&this.#Ge(t)}#Ke(e){const t=this.#Ye(e);if(!t)return!1;if(!this.#Ge(t))return!1;const n=t.getParent();return n&&gl(n)}#Ge(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>!!pr(e)||this.#Ge(e)))}#Ve(e){let t=e;for(;t;){if(gl(t))return t;t=t.getParent()}return null}#je(e){const t=this.#Ve(e);if(!t)return;const n=t.getParent();if(!n||!xl(n))return;const r=n.getParent();if(r&&Gl(r)){const e=this.#Ze(t).filter((e=>!this.#Ge(e)));if(e.length>0)return void this.#Xe(r,n,t,e)}const i=so();n.insertAfter(i),t.remove(),i.selectStart()}#qe(e){const t=this.#Ye(e);if(!t)return!1;if(!this.#Ge(t))return!1;const n=t.getParent();return n&&Gl(n)}#Ye(e){let t=e;for(;t;){if(ao(t))return t;t=t.getParent()}return null}#Je(e){const t=this.#Ye(e);if(!t)return;const n=t.getParent();if(!n||!Gl(n))return;const r=this.#Qe(t).filter((e=>!this.#Ge(e)));if(r.length>0)this.#et(n,t,r);else{const e=so();n.insertAfter(e),t.remove(),e.selectStart()}}#Qe(e){const t=[];let n=e.getNextSibling();for(;n;)t.push(n),n=n.getNextSibling();return t}#Ze(e){const t=[];let n=e.getNextSibling();for(;n;)gl(n)&&t.push(n),n=n.getNextSibling();return t}#Xe(e,t,n,r){const i=this.#Qe(t).filter((e=>!this.#Ge(e))),o=so();e.insertAfter(o);const s=bl(t.getListType()),a=Vl();o.insertAfter(a),a.append(s),r.forEach((e=>{s.append(e)})),i.forEach((e=>{a.append(e)})),n.remove(),this.#tt(t),this.#nt(a),0===t.getChildrenSize()?(t.remove(),0===e.getChildrenSize()&&e.remove()):this.#nt(e),o.selectStart()}#tt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!gl(n)||!this.#Ge(n))break;n.remove()}}#nt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!this.#Ge(n))break;n.remove()}}#et(e,t,n){const r=so();e.insertAfter(r);const i=Vl();r.insertAfter(i),n.forEach((e=>{i.append(e)})),t.remove(),this.#nt(e),this.#nt(i),r.selectStart()}}class ju{constructor(e){this.editorElement=e,this.editor=e.editor,new Ku(e).monitor()}insertHtml(e){this.editor.update((()=>{const t=oi();if(!Hr(t))return;const n=Tl(this.editor,Lu(e));t.insertNodes(n)}))}insertAtCursor(e){this.editor.update((()=>{const t=oi(),n=t?.getNodes();if(Hr(t))hi([e]);else if(Kr(t)&&n&&n.length>0){n[n.length-1].insertAfter(e)}else{Mo().append(e)}}))}insertAtCursorEnsuringLineBelow(e){this.insertAtCursor(e),this.#rt(e)}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=oi();if(!Hr(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=oi();if(!Hr(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.#it(t)}))}toggleNodeWrappingAllSelectedNodes(e,t){this.editor.update((()=>{const n=oi();if(!Hr(n))return;const r=n.anchor.getNode().getTopLevelElement();r&&e(r)?this.#ot(r):this.#st(t)}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=oi();if(!Hr(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=so();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=oi();e=Hr(t)&&!t.isCollapsed()})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=oi();if(!Hr(e))return;const{listItems:t,parentLists:n}=this.#at(e);if(t.size>0){const e=this.#lt(t);this.#ct(n),this.#ut(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=Fr(e),r=Vc(e);r.append(n);const i=oi();Hr(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{eu(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=oi();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const o=i.getTextContent(),s=r.offset,a=o.slice(0,s),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=oi();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const o=i.getTextContent(),s=r.offset,a=o.slice(0,s);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#dt();if(!n)return;const i=this.#ht(n,r,e);-1!==i&&this.#gt(n,r,i,t)}))}createParagraphAfterNode(e,t){const n=so();e.insertAfter(n),n.selectStart(),t&&(n.append(Fr(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=so();e.insertBefore(n),n.selectStart(),t&&(n.append(Fr(t)),n.select(1,1))}uploadFile(e){this.uploadFiles([e])}uploadFiles(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");const t=e.filter((e=>this.#pt(e)));if(0===t.length)return;const n=this.editorElement.directUploadUrl,r=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const e=oi(),i=e?.anchor.getNode(),o=i?.getTopLevelElement(),s=t.map((e=>new Mu({file:e,uploadUrl:n,blobUrlTemplate:r,editor:this.editor}))),a=s.length>=2?this.#ft(s):s[0];this.#mt(a,o),s.length>=2&&this.#yt(a)}),{tag:Qi})}async deleteSelectedNodes(){let e=null,t=!1;this.editor.update((()=>{if(Kr(this.#_t.current)){const n=this.#_t.current.getNodes();if(0===n.length)return;const r=n[0]?.getParent();t="attachment_gallery"===r?.getType(),e=this.#bt(n),this.#xt(n)}})),await Wu(),this.editor.update((()=>{if(t){const t="attachment_gallery"===e?.getParent?.()?.getType?.()?e.getParent():e;"attachment_gallery"===t?.getType?.()?this.#yt(t):this.#vt(e)}else this.#vt(e);this.#_t.clear(),this.editor.focus()}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Lo(e);if(!r)return;const i=oi();let o=!1;if(Hr(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&Bo(null)}const s=n.attachment?this.#St(t,n.attachment):this.#Ct(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Lo(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#St(t,n.attachment):this.#Ct(t);i.insertAfter(o)}))}get#_t(){return this.editorElement.selection}#rt(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=so();e.insertAfter(t),t.selectStart()}}))}#ot(e){e.getChildren().forEach((t=>{e.insertBefore(t)})),e.remove()}#st(e){this.editor.update((()=>{const t=oi();if(!Hr(t))return;const n=t.extract();if(0===n.length)return;const r=new Set;n.forEach((e=>{const t=e.getTopLevelElementOrThrow();r.add(t)}));const i=this.#Et(Array.from(r));if(0===i.length)return this.#Tt(),void this.insertAtCursor(e());const o=e();i[0].insertBefore(o),i.forEach((e=>{o.append(e)})),Bo(null)}))}#Et(e){let t=e.length-1;for(;t>=0;){const n=e[t];if(!ao(n)||!this.#kt(n))break;t--}return e.slice(0,t+1)}#kt(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>pr(e)))}#Tt(){const e=Mo();if(1===e.getChildrenSize()){const t=e.getFirstChild();t&&ao(t)&&this.#kt(t)&&t.remove()}}#it(e){this.editor.update((()=>{const t=oi();Hr(t)&&(t.isCollapsed()?this.#wt(t,e):this.#Nt(t,e))}))}#wt(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else hi([t()])}#Nt(e,t){const n=this.#At(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#Lt(n);if(0===r.size)return;const o=this.#Ft(t,r);this.#Pt(e,o),this.#Ot(i)}#At(e){const t=e.extract().map((e=>this.#It(e))).filter(Boolean);return Bo(null),t}#It(e){return ao(e)?e:Pr(e)&&e.getParent()&&ao(e.getParent())?e.getParent():null}#Lt(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#Ft(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Fr(e)),te.remove()))}#xt(e){const t=new Map;e.forEach((e=>{const n=e.getParent();if(!Hi(n))return;"attachment_gallery"===n.getType()&&t.set(n.getKey(),n);const r=n.getChildren().indexOf(e);r>=0&&n.splice(r,1,[])})),t.forEach(((e,t)=>{this.#Dt(e,t)}))}#bt(e){const t=e[0],n=e[e.length-1];return t?.getPreviousSibling()||n?.getNextSibling()}#vt(e){const t=Mo();if(0===t.getChildrenSize()){const e=so();t.append(e),e.selectStart()}else e&&(Pr(e)||ao(e)?e.selectEnd():e.selectNext(0,0))}#at(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=iu(e);if(t){n.add(t);const e=t.getParent();e&&xl(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#lt(e){const t=[];for(const n of e){const e=this.#Mt(n);e&&t.push(e)}return t}#Mt(e){const t=e.getParent();if(!t||!xl(t))return null;const n=so(),r=this.#Rt(e,n);return e.insertAfter(n),this.#Bt(n,r),e.remove(),n}#Rt(e,t){const n=[];return e.getChildren().forEach((e=>{xl(e)?n.push(e):t.append(e)})),n}#Bt(e,t){t.forEach((t=>{e.insertAfter(t)}))}#ct(e){for(const t of e)xl(t)&&0===t.getChildrenSize()&&t.remove()}#ut(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#zt(t,n)}#zt(e,t){e.selectStart();const n=oi();n&&Hr(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#dt(){const e=oi();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Pr(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#ht(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#gt(e,t,n,r){const i=e.getTextContent(),o=i.slice(0,n),s=i.slice(t),a=Fr(o),l=Fr(s||" ");e.replace(a);this.#Ut(a,r).insertAfter(l),this.#Wt(l.getParentOrThrow());const c=s?0:1;l.select(c,c)}#Ut(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Wt(e){if(ao(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Pr(n)&&""===n.getTextContent()&&r&&!Pr(r)&&e.append(gr())}}#St(e,t={}){return new $u({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#Ct(e){return Tl(this.editor,Lu(e))[0]||so()}#pt(e){return Pu(this.editorElement,"lexxy:file-accept",{file:e},!0)}#ft(e){const t=new Ru;return e.forEach((e=>t.append(e))),t}#mt(e,t){if(t&&ao(t)&&0===t.getChildrenSize()){if(t.replace(e),"attachment_gallery"===e.getType()){const t=so();e.insertAfter(t)}}else t&&Hi(t)?t.insertAfter(e):hi([e])}#yt(e){const t=e.getNextSibling();if(t&&(Pr(t)||ao(t)))t.selectStart();else{const t=so();e.insertAfter(t),t.selectStart()}}#Dt(e,t){const n=e.getChildrenSize();if(n<=1)e.getChildren().forEach((t=>e.insertBefore(t))),e.remove();else{const e=this.editor.getElementByKey(t);e&&(e.className=`attachment-gallery attachment-gallery--${n}`)}}}function qu(e){try{return new URL(e),!0}catch{return!1}}function Ju(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}class Vu{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#Ht(t)&&!this.#$t()?(this.#Kt(t),e.preventDefault(),!0):void this.#jt(t))}#Ht(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#$t(){let e=!1;return this.editor.getEditorState().read((()=>{const t=oi();if(!Hr(t))return;let n=t.anchor.getNode();for(;n;){if(mc(n))return void(e=!0);n=n.getParent()}})),e}#Kt(e){e.items[0].getAsString((e=>{if(qu(e)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else if(qu(e)){const t=this.contents.createLink(e);this.#qt(t,{url:e})}else this.#Jt(e)}))}#qt(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Pu(this.editorElement,"lexxy:insert-link",{...t,...n})}#Jt(e){const n=t(e);this.contents.insertHtml(n)}#jt(e){if(!this.editorElement.supportsAttachments)return;e.getData("text/html")||this.#Vt((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#Vt(e){const t=window.scrollY,n=window.scrollX;e(),await Wu(),window.scrollTo(n,t),this.editor.focus()}}class Gu{constructor(e){this.editor=e.editor}toggle(e){this.editor.update((()=>{this.#Gt(e),Fa((e=>this.#Yt(e)))}))}remove(){this.toggle({color:void 0,"background-color":void 0})}#Gt(e){const t=oi();for(const n in e){const r=Ma(t,n);La(t,{[n]:this.#Zt(r,e[n])})}}#Zt(e,t){return e===t?null:t}#Yt(e){this.#Xt(e)!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}#Xt(e){const t=Ta(e.getStyle());return!(!t.color&&!t["background-color"])}}class Yu extends Sr{$config(){return this.config("highlight",{extends:Sr})}static importDOM(){return{mark:()=>({conversion:su("mark",Zu),priority:1})}}}function Zu(e,t){const n=t.style?.color,r=t.style?.backgroundColor;let i="";if(n&&""!==n&&(i+=`color: ${n};`),r&&""!==r&&(i+=`background-color: ${r};`),i.length)return e.hasFormat("highlight")||e.toggleFormat("highlight"),e.setStyle(e.getStyle()+i)}const Xu="language";class Qu extends Sr{$config(){return this.config("trix-text",{extends:Sr})}static importDOM(){return{em:e=>ed(e,{conversion:su("i",Zu),priority:1}),span:e=>ed(e,{conversion:su("mark",Zu),priority:1}),strong:e=>ed(e,{conversion:su("b",Zu),priority:1}),del:()=>({conversion:su("s",td),priority:1}),pre:e=>function(e,t){return e.hasAttribute(Xu)?t:null}(e,{conversion:au(pc,"pre",nd),priority:1})}}}function ed(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function td(e,t){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),Zu(e,t)}function nd(e,t){const n=Tc(t.getAttribute(Xu));e.node.setLanguage(n)}class rd extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#Qt="";#en=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Ou("lexxy-editor"),this.editor=this.#tn(),this.contents=new ju(this),this.selection=new Hu(this),this.clipboard=new Vu(this),this.highlighter=new Gu(this),Uu.configureFor(this),this.#nn(),requestAnimationFrame((()=>Pu(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#rn()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#in())),"required"===e&&this.isConnected&&(this.#en.required=this.hasAttribute("required"),this.#on())}formResetCallback(){this.value=this.#Qt,this.editor.dispatchCommand(An,void 0)}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#sn?(this.toolbar=this.toolbar||this.#an(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return se.sanitize(e)}(kl(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{cs(no);const t=Mo();t.clear(),""!==e&&t.append(...this.#ln(e)),t.select(),this.#cn(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#ln(e){e||(e="

    ");return Tl(this.editor,Lu(`
    ${e}
    `)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof Ki&&!t.isInline())return t}return e}))}#nn(){this.#un(),this.#dn(),this.#hn(),this.#gn(),this.#pn(),this.#fn(),this.#mn(),this.#yn(),this.#_n()}#tn(){this.editorContentElement=this.editorContentElement||this.#bn();const e=co({namespace:"LexicalEditor",onError(e){throw e},theme:Nu,nodes:this.#xn});return e.setRootElement(this.editorContentElement),e}get#xn(){const e=[Qu,Yu,Jl,Yl,pl,cl,pc,kc,qc,Yc,Bu,$u];return this.supportsAttachments&&e.push(Du,Mu,Ru),e}#bn(){const e=Au("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#vn,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#Sn.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#vn(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#Sn(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#Cn(e){const t=void 0!==this.#Cn&&this.#Cn!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#en.value=this.#En?"":e,t&&Pu(this,"lexxy:change")}get#Cn(){return this._internalFormValue}#yn(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"

    ";this.value=this.#Qt=e}#_n(){document.addEventListener("turbo:before-cache",this.#Tn)}#Tn=e=>{this.#rn()};#un(){this.#kn(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#Cn=this.value,this.#cn(),this.#on()})))}#kn(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#wn(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#dn(){sc(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},function(e,t,n){const r=ku(e,n),i=Ha(e.registerCommand(tn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(Ln,!0)),0===r.length&&e.dispatchCommand(Fn,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Xi})}}(e,t),!0)),0),e.registerCommand(nn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(Fn,!0));const o=n.pop();0===n.length&&e.dispatchCommand(Ln,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Xi})}}(e,t),!0)),0),e.registerCommand(Nn,(()=>(wu(t),!1)),0),e.registerCommand(An,(()=>(wu(t),e.dispatchCommand(Ln,!1),e.dispatchCommand(Fn,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:o,dirtyElements:s,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,o,s,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(Ln,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(Fn,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(this.editor,this.historyState,20),El(this.editor),this.#Nn(),pu(this.editor,Eu)}#Nn(){!function(e,t){if(!e.hasNodes([pc,kc]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=Oc);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(pc,(t=>{e.update((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Lo(n);null!==t&&Dc(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(pc,(n=>Rc(n,e,t))),e.registerNodeTransform(Sr,(n=>Ic(n,e,t))),e.registerNodeTransform(kc,(n=>Ic(n,e,t))),e.registerCommand(mn,(t=>{const n=function(e){const t=oi();if(!Hr(t)||!Uc(t))return null;const n=e?bn:_n,r=e?bn:yn,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=Wc(t);if(1!==s.length)return n;const a=s[0];let l,c;0===a.length&&lc(285),t.isBackward()?(l=o,c=i):(l=i,c=o);const u=Fc(a[0]),d=Pc(a[0]),h=Br(u.getKey(),0,"text"),g=Br(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(yn,(()=>!!Uc(oi())&&(hi([Dr()]),!0)),1),e.registerCommand(_n,(e=>Hc(_n)),1),e.registerCommand(bn,(e=>Hc(bn)),1),e.registerCommand(cn,(e=>{const t=oi();if(!Hr(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Uc(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&mc(r.getParentOrThrow())?(e.preventDefault(),!0):$c(cn,e))}),1),e.registerCommand(un,(e=>{const t=oi();if(!Hr(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Uc(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&mc(r.getParentOrThrow())?(e.preventDefault(),!0):$c(un,e))}),1),e.registerCommand(ln,(e=>Kc(ln,e)),1),e.registerCommand(sn,(e=>Kc(sn,e)),1)),Ha(...n)}(this.editor),this.append(Au("lexxy-code-language-picker"))}#hn(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=Lo(t);if(e instanceof Du){const t=e.getWritable();Object.assign(t,n)}}))}))}#gn(){this.editor.registerCommand(dn,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#pn(){this.editor.registerCommand(On,(()=>{Pu(this,"lexxy:blur")}),2),this.editor.registerCommand(Pn,(()=>{Pu(this,"lexxy:focus")}),2)}#fn(){rd.debug&&this.#kn(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#mn(){this.#sn&&this.toolbarElement.setEditor(this)}#an(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#An()}get#sn(){return"false"!==this.getAttribute("toolbar")}#An(){const e=Au("lexxy-toolbar");return e.innerHTML=lu.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),this.prepend(e),e}#cn(){this.classList.toggle("lexxy-editor--empty",this.#En)}get#En(){return["


    ","

    ",""].includes(this.value.trim())}#on(){this.#en.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#en.validity,this.#en.validationMessage,this.editorContentElement)}#rn(){this.#wn(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Tn)}#in(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",rd);class id extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Ln.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Fn.bind(this)),this.addEventListener("keydown",this.#Pn.bind(this))}show(e){this.input.value=this.#On,this.dialog.show()}close(){this.dialog.close()}#Ln(e){const t=e.submitter?.value;this.#In.dispatchCommand(t,this.input.value)}#Fn(e){this.#In.dispatchCommand("unlink"),this.close()}#Pn(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#On(){let e="";return this.#In.getEditorState().read((()=>{const t=oi();if(!Hr(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(Gc(n)){e=n.getURL();break}n=n.getParent()}})),e}get#In(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",id);const od="button.lexxy-color-button";class sd extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.#Dn(),this.#Mn()}show(){this.dialog.show()}close(){this.dialog.close()}#Mn(){this.addEventListener("keydown",this.#Pn.bind(this)),this.querySelector("[data-command='removeHighlight']").addEventListener("click",this.#Rn.bind(this)),this.#Bn.forEach((e=>e.addEventListener("click",this.#zn.bind(this)))),this.#Un.registerUpdateButtonStatesCallback(this.#Wn.bind(this))}#Pn(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}#Dn(){this.#Hn.forEach((e=>{this.#$n(e)}))}#$n(e){const t=e.dataset.values?.split("; ")||[],n=e.dataset.buttonGroup;t.forEach(((t,r)=>{e.appendChild(this.#Kn(n,t,r))}))}#Kn(e,t,n){const r=document.createElement("button");return r.dataset.style=e,r.style.setProperty(e,t),r.dataset.value=t,r.classList.add("lexxy-color-button"),r.name=e+"-"+n,r}#zn(e){e.preventDefault();const t=e.target.closest(od);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.#In.dispatchCommand("toggleHighlight",{[n]:r}),this.close()}#Rn(e){e.preventDefault(),this.#In.dispatchCommand("removeHighlight"),this.close()}get#Hn(){return this.querySelectorAll("[data-button-group]")}get#Un(){return this.closest("lexxy-toolbar")}get#In(){return this.#Un.editor}get#Bn(){return Array.from(this.querySelectorAll(od))}#Wn(e){const t=Ma(e,"color",""),n=Ma(e,"background-color","");this.#Bn.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}))}}customElements.define("lexxy-color-dialog",sd);class ad{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=Au("li",{role:"option",id:Ou("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=Lu(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class ld extends ad{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#jn(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#jn(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Ju(e).includes(Ju(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class cd extends ld{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class ud extends ld{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class dd extends ad{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,o)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){o(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#qn(e));return this.#jn(t)}#qn(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#jn(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class hd extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#Jn(),this.#Vn()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#Gn(){return!this.supportsSpaceInSearches}#Jn(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new dd(e):new ud(e):new cd(this.querySelectorAll("lexxy-prompt-item"))}#Vn(){const e=this.#In.registerUpdateListener((()=>{this.#In.read((()=>{const{node:t,offset:n}=this.#_t.selectedNodeWithOffset();if(t&&Pr(t)&&n>0){const r=t.getTextContent();if(r[n-1]===this.trigger){const t=1===n,i=n>1?r[n-2]:null;(t||(" "===i||"\n"===i))&&(e(),this.#Yn())}}}))}))}#Zn(){this.cursorPositionListener=this.#In.registerUpdateListener((()=>{this.closed||this.#In.read((()=>{const{node:e,offset:t}=this.#_t.selectedNodeWithOffset();if(e)if(Pr(e)&&t>0){const n=e.getTextContent().slice(0,t).lastIndexOf(this.trigger);(-1===n||t<=n)&&this.#Xn()}else this.#Xn()}))}))}#Qn(){this.cursorPositionListener&&(this.cursorPositionListener(),this.cursorPositionListener=null)}get#In(){return this.#er.editor}get#er(){return this.closest("lexxy-editor")}get#_t(){return this.#er.selection}async#Yn(){this.popoverElement??=await this.#tr(),this.#nr(),await this.#rr(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#ir(),this.#er.addEventListener("keydown",this.#or),this.#er.addEventListener("lexxy:change",this.#rr),this.#sr(),this.#Zn()}#sr(){this.keyListeners.push(this.#In.registerCommand(dn,this.#ar.bind(this),3)),this.keyListeners.push(this.#In.registerCommand(mn,this.#ar.bind(this),3)),this.#Gn&&this.keyListeners.push(this.#In.registerCommand(hn,this.#ar.bind(this),3)),this.keyListeners.push(this.#In.registerCommand(cn,this.#lr.bind(this),3)),this.keyListeners.push(this.#In.registerCommand(un,this.#cr.bind(this),3))}#lr(e){return this.#ur(),e.preventDefault(),!0}#cr(e){return this.#dr(),e.preventDefault(),!0}#ir(){const e=this.#hr[0];e&&this.#gr(e)}get#hr(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#gr(e){this.#pr(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#_t.preservingSelection((()=>{this.#er.focus()})),this.#fr.setAttribute("aria-controls",this.popoverElement.id),this.#fr.setAttribute("aria-activedescendant",e.id),this.#fr.setAttribute("aria-haspopup","listbox")}#pr(){this.#hr.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#fr.removeAttribute("aria-controls"),this.#fr.removeAttribute("aria-activedescendant"),this.#fr.removeAttribute("aria-haspopup")}#mr(){const{x:e,y:t,fontSize:n}=this.#_t.cursorPosition,r=this.#er.getBoundingClientRect(),i=this.#fr.getBoundingClientRect().top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.popoverElement.style.left=`${e}px`,this.popoverElement.toggleAttribute("data-anchored",!0)),this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";const o=this.popoverElement.getBoundingClientRect();(o.bottom>window.innerHeight||this.popoverElement.hasAttribute("data-clipped-at-bottom"))&&(this.popoverElement.style.top=t+i-o.height-n+"px",this.popoverElement.style.bottom="auto",this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#nr(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-anchored")}async#Xn(){this.#pr(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#er.removeEventListener("lexxy:change",this.#rr),this.#er.removeEventListener("keydown",this.#or),this.#yr(),this.#Qn(),await Wu(),this.#Vn()}#yr(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#rr=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#_r.containsTextBackUntil(this.trigger)?(await this.#br(),await Wu(),this.#mr()):this.#Xn()};async#br(){const e=this.#_r.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#xr(t):this.#vr(),this.#ir()}#xr(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#vr(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=Au("li",{innerHTML:this.#Sr});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#Sr(){return this.getAttribute("empty-results")||"Nothing found"}#or=e=>{"Escape"===e.key&&(this.#Xn(),this.#er.focus(),e.stopPropagation())};#dr(){const e=this.#Cr+1;e=0&&this.#gr(this.#hr[e])}get#Cr(){return this.#hr.findIndex((e=>e.hasAttribute("aria-selected")))}get#Er(){return this.#hr[this.#Cr]}#ar(e){return e.preventDefault(),e.stopPropagation(),this.#Tr(),!0}#Tr(){this.#kr(),this.#Xn(),this.#er.focus()}#kr(){const e=this.source.promptItemFor(this.#Er);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#_r.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#wr(t,n):this.#Nr(e,t,n)}#wr(e,t){this.#In.update((()=>{const n=Tl(this.#In,Lu(`${e.innerHTML}`));this.#_r.replaceTextBackUntil(t,n)}))}#Nr(e,t,n){this.#In.update((()=>{const r=new $u({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#_r.replaceTextBackUntil(n,r)}))}get#_r(){return this.#er.contents}get#fr(){return this.#er.editorContentElement}async#tr(){const e=Au("ul",{role:"listbox",id:Ou("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",Ba()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#Ar),this.#er.appendChild(e),e}#Ar=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#gr(t),this.#Tr())}}customElements.define("lexxy-prompt",hd);class gd extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#Lr(),this.#Fr()}#Lr(){this.languagePickerElement=this.#Pr(),this.languagePickerElement.addEventListener("change",(()=>{this.#Or(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.languagePickerElement.setAttribute("nonce",Ba()),this.editorElement.appendChild(this.languagePickerElement)}#Pr(){const e=Au("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Ir)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Ir(){const e={...Cc};e.ruby||(e.ruby="Ruby");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#Or(e){this.editor.update((()=>{const t=this.#Dr();t&&t.setLanguage(e)}))}#Fr(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#Dr();e?this.#Mr(e):this.#Rr()}))}))}#Dr(){const e=oi();if(!Hr(e))return null;const t=e.anchor.getNode(),n=t.getParent();return mc(t)?t:mc(n)?n:null}#Mr(e){const t=e.getLanguage();this.#Br(t),this.#zr(),this.#Ur(e)}#Br(e){if(this.languagePickerElement&&e){const t=Tc(e);this.languagePickerElement.value=t}}#Ur(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#zr(){this.languagePickerElement.hidden=!1}#Rr(){this.languagePickerElement.hidden=!0}}function pd(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(//gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),o=Au("code",{"data-language":t,innerHTML:i});e.replaceWith(o)}(e)}))}customElements.define("lexxy-code-language-picker",gd),function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(Prism),window.Prism=window.Prism||{},Prism.manual=!0;export{pd as highlightAll}; diff --git a/app/assets/javascript/lexxy.min.js.br b/app/assets/javascript/lexxy.min.js.br index 915287480..18a972727 100644 Binary files a/app/assets/javascript/lexxy.min.js.br and b/app/assets/javascript/lexxy.min.js.br differ diff --git a/app/assets/javascript/lexxy.min.js.gz b/app/assets/javascript/lexxy.min.js.gz index 9727c366f..cecb70f70 100644 Binary files a/app/assets/javascript/lexxy.min.js.gz and b/app/assets/javascript/lexxy.min.js.gz differ diff --git a/app/assets/stylesheets/lexxy-content.css b/app/assets/stylesheets/lexxy-content.css index 6f399d35b..caf206645 100644 --- a/app/assets/stylesheets/lexxy-content.css +++ b/app/assets/stylesheets/lexxy-content.css @@ -392,3 +392,62 @@ --lexxy-attachment-text-color: var(--lexxy-color-ink-inverted); } } + +/* Attachment galleries +/* ------------------------------------------------------------------------ */ + +:where(.attachment-gallery) { + display: grid; + column-gap: 1rem; + row-gap: 3rem; + margin-block: var(--lexxy-content-margin); + margin-inline: auto; + max-inline-size: 100%; + + /* Make action-text-attachment elements proper grid items */ + action-text-attachment { + display: block; + } + + /* Two images: side by side */ + &.attachment-gallery--2 { + grid-template-columns: repeat(2, 1fr); + } + + /* Three images: all in a row */ + &.attachment-gallery--3 { + grid-template-columns: repeat(3, 1fr); + } + + /* Four images: 2x2 grid */ + &.attachment-gallery--4 { + grid-template-columns: repeat(2, 1fr); + } + + /* Five or more images: 3 column grid */ + &.attachment-gallery--5, + &.attachment-gallery--6, + &.attachment-gallery--7, + &.attachment-gallery--8, + &.attachment-gallery--9 { + grid-template-columns: repeat(3, 1fr); + } + + /* Attachments in galleries have no individual margin */ + .attachment { + margin-block: 0; + } + + /* Images in galleries should fill their grid cell */ + .attachment--preview img { + block-size: auto; + inline-size: 100%; + max-block-size: 32rem; + object-fit: contain; + } + + /* Captions in galleries need proper spacing */ + .attachment__caption { + margin-block-start: 1ch; + } +} diff --git a/package.json b/package.json index 31a3e44b6..966dca3e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@37signals/lexxy", - "version": "0.1.19-beta", + "version": "0.1.20.beta", "description": "Lexxy - A modern rich text editor for Rails.", "module": "dist/lexxy.esm.js", "type": "module", diff --git a/src/config/dom_purify.js b/src/config/dom_purify.js index 98f8ed2a4..70403b798 100644 --- a/src/config/dom_purify.js +++ b/src/config/dom_purify.js @@ -1,7 +1,7 @@ import DOMPurify from "dompurify" import { getCSSFromStyleObject, getStyleObjectFromCSS } from "@lexical/selection" -const ALLOWED_HTML_TAGS = [ "a", "action-text-attachment", "b", "blockquote", "br", "code", "em", +const ALLOWED_HTML_TAGS = [ "a", "action-text-attachment", "b", "blockquote", "br", "code", "div", "em", "figcaption", "figure", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i", "img", "li", "mark", "ol", "p", "pre", "q", "s", "strong", "ul" ] const ALLOWED_HTML_ATTRIBUTES = [ "alt", "caption", "class", "content", "content-type", "contenteditable", diff --git a/src/editor/command_dispatcher.js b/src/editor/command_dispatcher.js index ee88acb40..5498bc792 100644 --- a/src/editor/command_dispatcher.js +++ b/src/editor/command_dispatcher.js @@ -181,9 +181,7 @@ export class CommandDispatcher { const files = Array.from(target.files) if (!files.length) return - for (const file of files) { - this.contents.uploadFile(file) - } + this.contents.uploadFiles(files) } }) @@ -264,10 +262,7 @@ export class CommandDispatcher { const files = Array.from(dataTransfer.files) if (!files.length) return - for (const file of files) { - this.contents.uploadFile(file) - } - + this.contents.uploadFiles(files) this.editor.focus() } } diff --git a/src/editor/contents.js b/src/editor/contents.js index 1ddd9d519..59df70eec 100644 --- a/src/editor/contents.js +++ b/src/editor/contents.js @@ -11,6 +11,7 @@ import { dispatch, parseHtml } from "../helpers/html_helper" import { $isListNode } from "@lexical/list" import { getNearestListItemNode } from "../helpers/lexical_helper" import { nextFrame } from "../helpers/timing_helpers.js" +import { $createAttachmentGalleryNode } from "../nodes/attachment_gallery_node" import { FormatEscaper } from "./format_escaper" export default class Contents { @@ -256,32 +257,61 @@ export default class Contents { } uploadFile(file) { + this.uploadFiles([file]) + } + + uploadFiles(files) { if (!this.editorElement.supportsAttachments) { console.warn("This editor does not supports attachments (it's configured with [attachments=false])") return } - if (!this.#shouldUploadFile(file)) { - return - } + const validFiles = files.filter(file => this.#shouldUploadFile(file)) + if (validFiles.length === 0) return const uploadUrl = this.editorElement.directUploadUrl const blobUrlTemplate = this.editorElement.blobUrlTemplate this.editor.update(() => { - const uploadedImageNode = new ActionTextAttachmentUploadNode({ file: file, uploadUrl: uploadUrl, blobUrlTemplate: blobUrlTemplate, editor: this.editor }) - this.insertAtCursor(uploadedImageNode) + const selection = $getSelection() + const anchorNode = selection?.anchor.getNode() + const currentParagraph = anchorNode?.getTopLevelElement() + + const uploadNodes = validFiles.map(file => + new ActionTextAttachmentUploadNode({ + file: file, + uploadUrl: uploadUrl, + blobUrlTemplate: blobUrlTemplate, + editor: this.editor + }) + ) + + // Wrap multiple files in a gallery, insert single files directly + const nodeToInsert = uploadNodes.length >= 2 + ? this.#createGalleryWithNodes(uploadNodes) + : uploadNodes[0] + + this.#insertNode(nodeToInsert, currentParagraph) + + // If we inserted a gallery, move cursor outside of it + if (uploadNodes.length >= 2) { + this.#selectOutsideNode(nodeToInsert) + } }, { tag: HISTORY_MERGE_TAG }) } async deleteSelectedNodes() { let focusNode = null + let parentWasGallery = false this.editor.update(() => { if ($isNodeSelection(this.#selection.current)) { const nodesToRemove = this.#selection.current.getNodes() if (nodesToRemove.length === 0) return + const parent = nodesToRemove[0]?.getParent() + parentWasGallery = parent?.getType() === 'attachment_gallery' + focusNode = this.#findAdjacentNodeTo(nodesToRemove) this.#deleteNodes(nodesToRemove) } @@ -290,7 +320,20 @@ export default class Contents { await nextFrame() this.editor.update(() => { - this.#selectAfterDeletion(focusNode) + if (parentWasGallery) { + // Get the gallery node from the focus node + const galleryNode = focusNode?.getParent?.()?.getType?.() === 'attachment_gallery' + ? focusNode.getParent() + : focusNode + + if (galleryNode?.getType?.() === 'attachment_gallery') { + this.#selectOutsideNode(galleryNode) + } else { + this.#selectAfterDeletion(focusNode) + } + } else { + this.#selectAfterDeletion(focusNode) + } this.#selection.clear() this.editor.focus() }) @@ -528,10 +571,17 @@ export default class Contents { // Use splice() instead of node.remove() for proper removal and // reconciliation. Would have issues with removing unintended decorator nodes // with node.remove() + const galleriesToUpdate = new Map() + nodes.forEach((node) => { const parent = node.getParent() if (!$isElementNode(parent)) return + // Track gallery parents that need DOM updates + if (parent.getType() === 'attachment_gallery') { + galleriesToUpdate.set(parent.getKey(), parent) + } + const children = parent.getChildren() const index = children.indexOf(node) @@ -539,6 +589,11 @@ export default class Contents { parent.splice(index, 1, []) } }) + + // Update gallery DOM and remove if empty/single child + galleriesToUpdate.forEach((gallery, galleryKey) => { + this.#updateOrRemoveGallery(gallery, galleryKey) + }) } #findAdjacentNodeTo(nodes) { @@ -734,4 +789,53 @@ export default class Contents { #shouldUploadFile(file) { return dispatch(this.editorElement, "lexxy:file-accept", { file }, true) } + + #createGalleryWithNodes(uploadNodes) { + const gallery = $createAttachmentGalleryNode() + uploadNodes.forEach(node => gallery.append(node)) + return gallery + } + + #insertNode(node, currentParagraph) { + if (currentParagraph && $isParagraphNode(currentParagraph) && currentParagraph.getChildrenSize() === 0) { + currentParagraph.replace(node) + // If we're replacing an empty paragraph with a gallery, ensure there's a paragraph after for cursor placement + if (node.getType() === 'attachment_gallery') { + const newParagraph = $createParagraphNode() + node.insertAfter(newParagraph) + } + } else if (currentParagraph && $isElementNode(currentParagraph)) { + currentParagraph.insertAfter(node) + } else { + $insertNodes([node]) + } + } + + #selectOutsideNode(node) { + const nextNode = node.getNextSibling() + if (nextNode && ($isTextNode(nextNode) || $isParagraphNode(nextNode))) { + nextNode.selectStart() + } else { + // If there's no suitable next node, create a new paragraph after the gallery + const newParagraph = $createParagraphNode() + node.insertAfter(newParagraph) + newParagraph.selectStart() + } + } + + #updateOrRemoveGallery(gallery, galleryKey) { + const childCount = gallery.getChildrenSize() + + // If gallery is empty or has only one child, unwrap it + if (childCount <= 1) { + gallery.getChildren().forEach(child => gallery.insertBefore(child)) + gallery.remove() + } else { + // Update the gallery's className to reflect new child count + const dom = this.editor.getElementByKey(galleryKey) + if (dom) { + dom.className = `attachment-gallery attachment-gallery--${childCount}` + } + } + } } diff --git a/src/elements/editor.js b/src/elements/editor.js index 7ce03d401..767b9f43a 100644 --- a/src/elements/editor.js +++ b/src/elements/editor.js @@ -10,6 +10,7 @@ import { createEmptyHistoryState, registerHistory } from "@lexical/history" import theme from "../config/theme" import { ActionTextAttachmentNode } from "../nodes/action_text_attachment_node" import { ActionTextAttachmentUploadNode } from "../nodes/action_text_attachment_upload_node" +import { AttachmentGalleryNode } from "../nodes/attachment_gallery_node" import { HorizontalDividerNode } from "../nodes/horizontal_divider_node" import { CommandDispatcher } from "../editor/command_dispatcher" import Selection from "../editor/selection" @@ -201,7 +202,7 @@ export default class LexicalEditorElement extends HTMLElement { ] if (this.supportsAttachments) { - nodes.push(ActionTextAttachmentNode, ActionTextAttachmentUploadNode) + nodes.push(ActionTextAttachmentNode, ActionTextAttachmentUploadNode, AttachmentGalleryNode) } return nodes diff --git a/src/nodes/attachment_gallery_node.js b/src/nodes/attachment_gallery_node.js new file mode 100644 index 000000000..23b8c0861 --- /dev/null +++ b/src/nodes/attachment_gallery_node.js @@ -0,0 +1,73 @@ +import { ElementNode } from "lexical" + +export class AttachmentGalleryNode extends ElementNode { + static getType() { + return "attachment_gallery" + } + + static clone(node) { + return new AttachmentGalleryNode(node.__key) + } + + static importJSON(serializedNode) { + return new AttachmentGalleryNode() + } + + static importDOM() { + return { + div: (domNode) => { + if (domNode.classList.contains('attachment-gallery')) { + return { + conversion: () => ({ node: new AttachmentGalleryNode() }), + priority: 1 + } + } + return null + } + } + } + + constructor(key) { + super(key) + } + + createDOM() { + const element = document.createElement("div") + element.className = this.getGalleryClassName() + return element + } + + updateDOM(prevNode, dom) { + const className = this.getGalleryClassName() + if (dom.className !== className) { + dom.className = className + } + return false + } + + getGalleryClassName() { + const count = this.getChildrenSize() + return `attachment-gallery attachment-gallery--${count}` + } + + isInline() { + return false + } + + exportDOM(editor) { + const element = document.createElement("div") + element.className = this.getGalleryClassName() + return { element } + } + + exportJSON() { + return { + type: "attachment_gallery", + version: 1 + } + } +} + +export function $createAttachmentGalleryNode() { + return new AttachmentGalleryNode() +} diff --git a/test/dummy/config/importmap.rb b/test/dummy/config/importmap.rb index 2cd168a3d..b7fd25756 100644 --- a/test/dummy/config/importmap.rb +++ b/test/dummy/config/importmap.rb @@ -16,3 +16,4 @@ pin "prismjs" pin "prettier" pin "prettier/parser-html", to: "prettier--parser-html.js" +pin "marked", to: "https://ga.jspm.io/npm:marked@16.4.0/lib/marked.esm.js" diff --git a/test/fixtures/files/example2.png b/test/fixtures/files/example2.png new file mode 100644 index 000000000..a627181f6 Binary files /dev/null and b/test/fixtures/files/example2.png differ diff --git a/test/system/attachment_galleries_test.rb b/test/system/attachment_galleries_test.rb new file mode 100644 index 000000000..9c61ba2b0 --- /dev/null +++ b/test/system/attachment_galleries_test.rb @@ -0,0 +1,40 @@ +require "application_system_test_case" + +class AttachmentGalleriesTest < ApplicationSystemTestCase + setup do + visit edit_post_path(posts(:empty)) + end + + test "creates gallery when uploading two images at once" do + attach_file [ file_fixture("example.png"), file_fixture("example2.png") ] do + click_on "Upload file" + end + + assert_gallery count: 2 + end + + test "single attachment is not wrapped in gallery" do + attach_file file_fixture("example.png") do + click_on "Upload file" + end + + assert_image_figure_attachment content_type: "image/png", caption: "example.png" + assert_no_gallery + end + + test "removes gallery wrapper when deleting down to one image" do + attach_file [ file_fixture("example.png"), file_fixture("example2.png") ] do + click_on "Upload file" + end + + assert_gallery count: 2 + + # Delete one image, leaving one + find("figure.attachment", match: :first).click + page.send_keys :backspace + + # Gallery wrapper should be removed, leaving single attachment + assert_no_gallery + assert_selector "figure.attachment", count: 1 + end +end diff --git a/test/test_helpers/editor_helper.rb b/test/test_helpers/editor_helper.rb index 6da690176..b16d222c4 100644 --- a/test/test_helpers/editor_helper.rb +++ b/test/test_helpers/editor_helper.rb @@ -39,6 +39,15 @@ def assert_no_mention_attachments assert_no_css "action-text-attachment[content-type='application/vnd.actiontext.mention']" end + def assert_gallery(count:) + assert_selector ".attachment-gallery.attachment-gallery--#{count}", count: 1 + assert_selector "figure.attachment", count: count + end + + def assert_no_gallery + assert_no_selector ".attachment-gallery" + end + def wait_for_editor assert_css "lexxy-editor[connected]" assert_css "lexxy-toolbar[connected]" if has_css?("lexxy-toolbar")