lexical 0.1.21 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.prod.js CHANGED
@@ -6,163 +6,161 @@
6
6
  */
7
7
  function q(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
8
  const aa=RegExp("^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]"),da=RegExp("^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]"),ea={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},fa={center:2,justify:4,left:1,right:3},ha={inert:3,normal:0,
9
- segmented:2,token:1},ia="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ja=ia&&"documentMode"in document?document.documentMode:null,r=ia&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),la=ia&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ma=ia&&"InputEvent"in window&&!ja?"getTargetRanges"in new window.InputEvent("input"):!1;let na=0;const oa="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
10
- function pa(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!t(qa(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&ra(b)===a}catch(e){return!1}}function ra(a){for(;null!=a;){const b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function u(a){return a.isToken()||a.isInert()}function sa(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}
11
- function ta(a,b,c){b=ea[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function ua(a){return w(a)||va(a)||t(a)}function xa(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;const c=b.indexOf(a.__key);-1===c&&q(16);ya(a);b.splice(c,1)}}
12
- function za(a){99<Aa&&q(26);var b=a.getLatest(),c=b.__parent,d=z();const f=A(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;B(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function ya(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&za(b);null!==a&&za(a)}
13
- function D(a){E();var b=A();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=H(c),null!==b&&b.getWritable());null!==a&&(a=H(a),null!==a&&a.getWritable())}function H(a,b){a=(b||z())._nodeMap.get(a);return void 0===a?null:a}function Ba(a,b){const c=A();a=a["__lexicalKey_"+c._key];return void 0!==a?H(a,b):null}function qa(a,b){for(;null!=a;){const c=Ba(a,b);if(null!==c)return c;a=a.parentNode}return null}function Ca(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}
14
- function Da(a){return a.read(()=>Ea().getTextContent())}function Fa(a,b){I(a,()=>{var c=z();if(!c.isEmpty())if("root"===b)Ea().markDirty();else{c=c._nodeMap;for(const [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ea(){return z()._nodeMap.get("root")}function Ga(a){z()._selection=a}
15
- function Ha(a){var b=A(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?H("root"):null):H(c)}function Ia(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Ja(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
16
- function Ka(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=qa(c),w(a))){c=c.nodeValue;const e=null!==b&&b.data;if("\u200b"===c&&e){const g=e.length;c=e;f=d=g}La(a,c,d,f,null!==b)}}}
17
- function La(a,b,c,d,f){if(a.isAttached()&&(f||!a.isDirty())){var e=a.isComposing();let g=b;(e||f)&&"\u200b"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(f||g!==b)""===g?(e&&D(null),a.remove()):(f=a.getParent(),b=Ma(),u(a)||null!==A()._compositionKey&&!e||null!==f&&J(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?a.markDirty():(e=K(),J(e)&&null!==c&&null!==d&&(e.setTextNodeRange(a,c,a,d),a.isSegmented()&&(c=a.getTextContent(),c=L(c),a.replace(c),a=c)),a.setTextContent(g)))}}
18
- function Na(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=A().getElementByKey(h);(b=h!==f.key||!w(e)||d.offset!==f.offset&&!e.isComposing()||(c||e.isDirty())&&1<b.length||null!==l&&!e.isComposing()&&g!==sa(l)||e.getFormat()!==a.format)||(e.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=e.getParentOrThrow(),d=e.isToken(),a=0===b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),e=e.getTextContentSize()===
9
+ segmented:2,token:1},ia="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ja=ia&&"documentMode"in document?document.documentMode:null,r=ia&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ka=ia&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ma=ia&&"InputEvent"in window&&!ja?"getTargetRanges"in new window.InputEvent("input"):!1,na=ia&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);let oa=0;
10
+ const pa="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function qa(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!t(ra(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&sa(b)===a}catch(e){return!1}}function sa(a){for(;null!=a;){const b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}
11
+ function u(a){return a.isToken()||a.isInert()}function ta(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function ua(a,b,c){b=ea[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function va(a){return w(a)||wa(a)||t(a)}function ya(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;const c=b.indexOf(a.__key);-1===c&&q(16);za(a);b.splice(c,1)}}
12
+ function Aa(a){99<Ba&&q(26);var b=a.getLatest(),c=b.__parent,d=z();const f=A(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;B(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function za(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Aa(b);null!==a&&Aa(a)}
13
+ function C(a){F();var b=A();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=H(c),null!==b&&b.getWritable());null!==a&&(a=H(a),null!==a&&a.getWritable())}function H(a,b){a=(b||z())._nodeMap.get(a);return void 0===a?null:a}function Ca(a,b){const c=A();a=a["__lexicalKey_"+c._key];return void 0!==a?H(a,b):null}function ra(a,b){for(;null!=a;){const c=Ca(a,b);if(null!==c)return c;a=a.parentNode}return null}function Da(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}
14
+ function Ea(a){return a.read(()=>Fa().getTextContent())}function Ga(a,b){I(a,()=>{var c=z();if(!c.isEmpty())if("root"===b)Fa().markDirty();else{c=c._nodeMap;for(const [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Fa(){return z()._nodeMap.get("root")}function Ha(a){z()._selection=a}
15
+ function Ia(a){var b=A(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?H("root"):null):H(c)}function Ja(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}
16
+ function Ka(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=ra(c),w(a))){c=c.nodeValue;const e=null!==b&&b.data;if("\u200b"===c&&e){const g=e.length;c=e;f=d=g}La(a,c,d,f,null!==b)}}}
17
+ function La(a,b,c,d,f){let e=a;if(e.isAttached()&&(f||!e.isDirty())){var g=e.isComposing();a=b;(g||f)&&"\u200b"===b[b.length-1]&&(a=b.slice(0,-1));b=e.getTextContent();if(f||a!==b)if(""===a)if(C(null),na)e.remove();else{const h=A();setTimeout(()=>{h.update(()=>{e.remove()})},20)}else f=e.getParent(),b=Ma(),u(e)||null!==A()._compositionKey&&!g||null!==f&&J(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?e.markDirty():(g=K(),J(g)&&null!==c&&null!==d&&(g.setTextNodeRange(e,c,e,d),e.isSegmented()&&
18
+ (c=e.getTextContent(),c=L(c),e.replace(c),e=c)),e.setTextContent(a))}}
19
+ function Na(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=A().getElementByKey(h);(b=h!==f.key||!w(e)||d.offset!==f.offset&&!e.isComposing()||(c||e.isDirty())&&1<b.length||null!==l&&!e.isComposing()&&g!==ta(l)||e.getFormat()!==a.format)||(e.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=e.getParentOrThrow(),d=e.isToken(),a=0===b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),e=e.getTextContentSize()===
19
20
  b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||e):b=!1);return b}function Oa(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Pa(a,b,c,d,f){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&q(66,c),b=b.klass,c=a.get(b),void 0===c&&(c=new Map,a.set(b,c)),c.has(d)||c.set(d,f))}
20
21
  function Qa(a,b,c){const d=a.getParent();let f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Ra(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Qa(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Qa(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
21
- function Sa(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Ta(a,b,c,d,f){a=a.__children;const e=a.length;for(let g=0;g<e;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(B(l)&&Ta(l,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
22
- function Ua(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(const f of c){const e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(const [f]of d)c=b.get(f),void 0===c||c.isAttached()||(B(c)&&Ta(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function Ya(a,b){const c=a.__mode,d=a.__format;a=a.__style;const f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
22
+ function Sa(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Wa(a,b,c,d,f){a=a.__children;const e=a.length;for(let g=0;g<e;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(B(l)&&Wa(l,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
23
+ function Xa(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(const f of c){const e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(const [f]of d)c=b.get(f),void 0===c||c.isAttached()||(B(c)&&Wa(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function Ya(a,b){const c=a.__mode,d=a.__format;a=a.__style;const f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
23
24
  function Za(a,b){const c=a.mergeWithSibling(b),d=A()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function $a(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&w(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Ya(b,a)&&(a=Za(b,a));break}for(var c;null!==(c=a.getNextSibling())&&w(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Ya(a,c)&&Za(a,c);break}}}
24
- function ab(a,b){E();var c=a.__key;const d=a.getParent();if(null!==d){var f=K(),e=!1;if(J(f)&&b){var g=f.anchor;const h=f.focus;g.key===c&&(bb(g,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0);h.key===c&&(bb(h,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);ya(a);g.splice(c,1);a.getWritable().__parent=null;J(f)&&b&&!e&&cb(f,d,c,-1);null===d||M(d)||d.canBeEmpty()||!d.isEmpty()||ab(d,b);null!==d&&M(d)&&d.isEmpty()&&d.selectEnd()}}
25
- function db(a){const b=H(a);null===b&&q(39,a);return b}
26
- class eb{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{E();99<Aa&&q(26);a=A();var b=z(),c=""+na++;b._nodeMap.set(c,this);B(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=H(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
25
+ function ab(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&q(24,e);for(var h in a)if(e=a[h],null!=e&&"object"===typeof e&&(e=e.editorState,null!=e)){var l=bb();l._nodes=c._nodes;l._parentEditor=c._parentEditor;l._pendingEditorState=cb(e,l);a[h]=l}h=g.klass;g=a.__key;a.__key=void 0;h=h.clone(a);a.__key=g;e=h.__key;M(h)&&z()._nodeMap.set("root",h);h.__parent=d;if(B(h)){d=a.__children;for(l=0;l<d.length;l++){var k=b.get(d[l]);void 0!==k&&(k=ab(k,b,c,e,f).__key,h.__children.push(k))}h.__indent=
26
+ a.__indent;h.__format=a.__format;h.__dir=a.__dir}else w(h)&&(h.__format=a.__format,h.__style=a.__style,h.__mode=a.__mode,h.__detail=a.__detail);b=null!=f?f.originalSelection:void 0;null!=b&&(a=f.remappedSelection,"range"===b.type?(c=b.anchor,b=b.focus,null!=a||g!==c.key&&g!==b.key||(f.remappedSelection=a={anchor:{...c},focus:{...b},type:"range"}),null!=a&&"range"===a.type&&(g===c.key&&(a.anchor.key=e),g===b.key&&(a.focus.key=e))):"node"===b.type?(b=b.nodes,g=b.indexOf(g),-1!==g&&(null==a&&(f.remappedSelection=
27
+ a={nodes:[...b],type:"node"}),"node"===a.type&&a.nodes.splice(g,1,e))):"grid"===b.type&&(c=b.gridKey,d=b.anchorCellKey,l=b.focusCellKey,null!=a||c!==g&&c!==d&&c!==l||(f.remappedSelection=a={...b,type:"grid"}),null!=a&&"grid"===a.type&&(c===g&&(a.gridKey=e),d===g&&(a.anchorCellKey=e),l===g&&(a.focusCellKey=e))));return h}let N="",O="",P="",db,Q,eb,fb=!1,gb=!1,hb,ib=null,jb,kb,lb,mb,nb,ob;
28
+ function pb(a,b){const c=lb.get(a);if(null!==b){const d=qb(a);b.removeChild(d)}mb.has(a)||Q._keyToDOMMap.delete(a);B(c)&&(a=c.__children,rb(a,0,a.length-1,null));void 0!==c&&Pa(ob,eb,hb,c,"destroyed")}function rb(a,b,c,d){for(;b<=c;++b){const f=a[b];void 0!==f&&pb(f,d)}}function sb(a,b){a.setProperty("text-align",b)}function tb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}
29
+ function ub(a,b){a=a.style;0===b?sb(a,""):1===b?sb(a,"left"):2===b?sb(a,"center"):3===b?sb(a,"right"):4===b&&sb(a,"justify")}
30
+ function vb(a,b,c){const d=mb.get(a);void 0===d&&q(42);const f=d.createDOM(db,Q);var e=Q._keyToDOMMap;f["__lexicalKey_"+Q._key]=a;e.set(a,f);w(d)?f.setAttribute("data-lexical-text","true"):t(d)&&f.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&tb(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;const h=O;O="";wb(e,0,g,f,null);xb(d,f);O=h}e=d.__format;0!==e&&ub(f,e);yb(null,a,f)}else e=d.getTextContent(),t(d)?(g=d.decorate(Q),null!==g&&zb(a,g),f.contentEditable="false"):
31
+ w(d)&&(d.isDirectionless()||(O+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),N+=e,P+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Pa(ob,eb,hb,d,"created");return f}function wb(a,b,c,d,f){const e=N;for(N="";b<=c;++b)vb(a[b],d,f);d.__lexicalTextContent=N;N=e+N}function Ab(a,b){a=b.get(a[a.length-1]);return wa(a)||t(a)}
32
+ function yb(a,b,c){a=null!==a&&(0===a.length||Ab(a,lb));b=null!==b&&(0===b.length||Ab(b,mb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
33
+ function xb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==ib){const e=""===O;if(e)var d=ib;else d=O,d=aa.test(d)?"rtl":da.test(d)?"ltr":null;if(d!==c){const g=b.classList,h=db.theme;var f=null!==c?h[c]:void 0;let l=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==l&&("string"===typeof l&&(c=l.split(" "),l=h[d]=c),g.add(...l)),b.dir=d);gb||(a.getWritable().__dir=d)}ib=d;b.__lexicalDirTextContent=
34
+ O;b.__lexicalDir=d}}
35
+ function Bb(a,b){var c=lb.get(a),d=mb.get(a);void 0!==c&&void 0!==d||q(43);var f=fb||kb.has(a)||jb.has(a);const e=Cb(Q,a);if(c===d&&!f)return B(c)?(d=e.__lexicalTextContent,void 0!==d&&(N+=d,P+=d),d=e.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),w(c)&&!c.isDirectionless()&&(O+=d),P+=d,N+=d),e;c!==d&&f&&Pa(ob,eb,hb,d,"updated");if(d.updateDOM(c,e,db))return d=vb(a,null,null),null===b&&q(44),b.replaceChild(d,e),pb(a,null),d;if(B(c)&&B(d)){if(a=d.__indent,a!==c.__indent&&tb(e,a),
36
+ a=d.__format,a!==c.__format&&ub(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=O;O="";const v=N;N="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Bb(m,e);else{var p=qb(m);h=vb(h,null,null);e.replaceChild(h,p);pb(m,null)}}else if(0===l)0!==k&&wb(h,0,k-1,e,null);else if(0===k)0!==l&&(m=null==e.__lexicalLineBreak,rb(g,0,l-1,m?null:e),m&&(e.textContent=""));else{const D=l-1;l=k-1;let y=e.firstChild,E=0;for(k=0;E<=D&&k<=l;){var n=g[E];const x=h[k];if(n===x)y=Bb(x,
37
+ e).nextSibling,E++,k++;else{void 0===m&&(m=new Set(g));void 0===p&&(p=new Set(h));const G=p.has(n),W=m.has(x);G?(W?(n=Cb(Q,x),n===y?y=Bb(x,e).nextSibling:(null!=y?e.insertBefore(n,y):e.appendChild(n),Bb(x,e)),E++):vb(x,e,y),k++):(y=qb(n).nextSibling,pb(n,e),E++)}}m=E>D;p=k>l;m&&!p?(m=h[l+1],m=void 0===m?null:Q.getElementByKey(m),wb(h,k,l,e,m)):p&&!m&&rb(g,E,D,e)}e.__lexicalTextContent=N;N=v+N;xb(f,e);O=b;M(d)||yb(a,c,e)}}else c=d.getTextContent(),t(d)?(f=d.decorate(Q),null!==f&&zb(a,f)):w(d)&&!d.isDirectionless()&&
38
+ (O+=c),N+=c,P+=c;!gb&&M(d)&&d.__cachedText!==P&&(d=d.getWritable(),d.__cachedText=P);return e}function zb(a,b){let c=Q._pendingDecorators;const d=Q._decorators;if(null===c){if(d[a]===b)return;c=Da(Q)}c[a]=b}function qb(a){a=nb.get(a);void 0===a&&q(45);return a}function Cb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let R=null,T=null,U=!1,Db=!1,Ba=0;function F(){U&&q(25)}function z(){null===R&&q(27);return R}function A(){null===T&&q(28);return T}
39
+ function Eb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Fb(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(const c of b)b=a.get(c),w(b)&&b.isSimpleText()&&!b.isUnmergeable()&&$a(b)}
40
+ function Gb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=A()._compositionKey,e=new Map;var g=c;let h=g.size;for(var l=d,k=l.size;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;for(const m of g)g=a.get(m),w(g)&&g.isSimpleText()&&!g.isUnmergeable()&&$a(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Eb(b,g,e),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Ba++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(const m of l)l=m[0],k=m[1],"root"!==l&&k&&(g=a.get(l),void 0!==
41
+ g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Eb(b,g,e),d.set(l,k));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;Ba++}b._dirtyLeaves=c;b._dirtyElements=d}function cb(a,b){var c=new Map;c=new Hb(c);const d={originalSelection:a._selection},f=R,e=U,g=T;R=c;U=!1;T=b;try{const h=new Map(a._nodeMap),l=h.get("root");ab(l,h,b,null,d)}finally{R=f,U=e,T=g}c._selection=Ib(d.remappedSelection||d.originalSelection);return c}
42
+ function Jb(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=R,l=U,k=T,m=a._updating;T=a;R=b;U=!1;a._updating=!0;try{var p=a._observer;let la=null;if(g&&null!==p){var n=a._dirtyType,v=a._dirtyElements,D=a._dirtyLeaves;p.disconnect();try{O=P=N="";fb=2===n;ib=null;Q=a;db=a._config;eb=a._nodes;hb=Q._listeners.mutation;jb=v;kb=D;lb=d._nodeMap;mb=b._nodeMap;gb=b._readOnly;
43
+ nb=new Map(a._keyToDOMMap);const xa=new Map;ob=xa;Bb("root",null);ob=nb=db=mb=lb=kb=jb=eb=Q=void 0;la=xa}finally{p.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Ta=window.getSelection();if(null!==Ta&&(g||null===e||e.dirty)){p=Ta;const xa=p.anchorNode,lc=p.focusNode,sd=p.anchorOffset,td=p.focusOffset,Ua=document.activeElement,ba=a._rootElement;if(!a._updateTags.has("collaboration")||Ua===ba)if(J(e)){var y=e.anchor,E=e.focus,x=E.key,G=Cb(a,y.key),W=Cb(a,x),mc=y.offset,nc=E.offset;f=G;
44
+ x=W;"text"===y.type&&(f=ta(G));"text"===E.type&&(x=ta(W));if(null!==f&&null!==x)if(sd!==mc||td!==nc||xa!==f||lc!==x||"Range"===p.type&&e.isCollapsed())try{if(p.setBaseAndExtent(f,mc,x,nc),e.isCollapsed()&&ba===Ua){const ca=3===f.nodeType?f.parentNode:f;if(null!==ca){const Va=ca.getBoundingClientRect();if(Va.bottom>window.innerHeight)ca.scrollIntoView(!1);else if(0>Va.top)ca.scrollIntoView();else if(ba){const oc=ba.getBoundingClientRect();Va.bottom>oc.bottom?ca.scrollIntoView(!1):Va.top<oc.top&&ca.scrollIntoView()}a._updateTags.add("scroll-into-view")}}}catch(ca){}else null===
45
+ ba||null!==Ua&&ba.contains(Ua)||ba.focus({preventScroll:!0})}else null!==f&&qa(a,xa,lc)&&p.removeAllRanges()}var pc=la;null!==pc&&Kb(a,d,b,pc)}catch(la){a._onError(la);Db||(Lb(a,null,c,b),Mb(a),a._dirtyType=2,Db=!0,Jb(a),Db=!1);return}finally{a._updating=m,R=h,U=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;e=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=
46
+ a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var S in k)m.has(S)||(k===g&&(k=Da(a)),delete k[S]);S=a._pendingDecorators;null!==S&&(a._decorators=S,a._pendingDecorators=null,Nb("decorator",a,!0,S));S=Ea(d);g=Ea(b);S!==g&&Nb("textcontent",a,!0,g);Nb("update",a,!0,{dirtyElements:e,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(S=0;S<b.length;S++)b[S]()}finally{a._updating=d}}b=a._updates;
47
+ if(0!==b.length){const [la,Ta]=b.shift();Ob(a,la,Ta)}}}function Kb(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Nb(a,b,c,...d){const f=b._updating;b._updating=c;try{const e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a](...d)}finally{b._updating=f}}
48
+ function V(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=V(a,b,c)});return e}const d=Ja(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(const h of f)if(!0===h(c,a))return!0}return!1}function Pb(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,f]=b.shift();let e,g;void 0!==f&&(e=f.onUpdate,g=f.tag,f.skipTransforms&&(c=!0),e&&a._deferred.push(e),g&&a._updateTags.add(g));d()}return c}
49
+ function Ob(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new Hb(new Map(c._nodeMap)),g=!0);const h=R,l=U,k=T,m=a._updating;R=e;U=!1;a._updating=!0;T=a;try{g&&(e._selection=Qb(a));const p=a._compositionKey;b();f=Pb(a);Rb(e,a);0!==a._dirtyType&&(f?Fb(e,a):Gb(e,a),Pb(a),Xa(c,e,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&
50
+ (e._flushSync=!0);const n=e._selection;if(J(n)){const v=e._nodeMap,D=n.focus.key;void 0!==v.get(n.anchor.key)&&void 0!==v.get(D)||q(30)}else Sb(n)&&0===n._nodes.size&&(e._selection=null)}catch(p){a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Jb(a);return}finally{R=h,U=l,T=k,a._updating=m,Ba=0}0!==a._dirtyType||Tb(e,a)?e._flushSync?(e._flushSync=!1,Jb(a)):g&&pa(()=>{Jb(a)}):(e._flushSync=!1,g&&(d.clear(),a._deferred=[],
51
+ a._pendingEditorState=null))}function I(a,b,c){a._updating?a._updates.push([b,c]):Ob(a,b,c)}let Ub=!1,Vb=0;function Wb(a){Vb=a.timeStamp}function Xb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function Yb(a){return a.getEditorState().read(()=>{const b=K();return null!==b?b.clone():null})}
52
+ function Zb(a,b,c){Ub=!0;const d=100<performance.now()-Vb;try{I(a,()=>{var f=new Map,e=a.getRootElement(),g=a._editorState;let h=!1,l="";for(var k=0;k<b.length;k++){var m=b[k],p=m.type,n=m.target,v=ra(n,g);if(!t(v))if("characterData"===p){if(d&&3===n.nodeType&&w(v)&&v.isAttached()){m=window.getSelection();var D=p=null;null!==m&&m.anchorNode===n&&(p=m.anchorOffset,D=m.focusOffset);La(v,n.nodeValue,p,D,!1)}}else if("childList"===p){h=!0;p=m.addedNodes;for(D=0;D<p.length;D++){var y=p[D],E=Ca(y),x=y.parentNode;
53
+ null==x||null!==E||"BR"===y.nodeName&&Xb(y,x,a)||(ka&&(E=y.innerText||y.nodeValue)&&(l+=E),x.removeChild(y))}m=m.removedNodes;p=m.length;if(0<p){D=0;for(y=0;y<p;y++)x=m[y],"BR"===x.nodeName&&Xb(x,n,a)&&(n.appendChild(x),D++);p!==D&&(n===e&&(v=g._nodeMap.get("root")),f.set(n,v))}}}if(0<f.size)for(const [G,W]of f)if(B(W))for(f=W.__children,e=G.firstChild,g=0;g<f.length;g++)k=a.getElementByKey(f[g]),null!==k&&(null==e?(G.appendChild(k),e=k):e!==k&&G.replaceChild(k,e),e=e.nextSibling);else w(W)&&W.markDirty();
54
+ f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,v=0;v<g.length;v++)n=g[v],m=n.parentNode,null==m||"BR"!==n.nodeName||Xb(n,k,a)||m.removeChild(n);c.takeRecords()}f=K()||Yb(a);null!==f&&(h&&(f.dirty=!0,Ha(f)),ka&&Sa()&&f.insertRawText(l))})}finally{Ub=!1}}function $b(a){const b=a._observer;if(null!==b){const c=b.takeRecords();Zb(a,c,b)}}
55
+ function Mb(a){0===Vb&&window.addEventListener("textInput",Wb,!0);a._observer=new MutationObserver((b,c)=>{Zb(a,b,c)})}
56
+ class ac{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;B(b)&&(b=b.getDescendantByIndex(d));B(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=H(this.key);null===a&&q(5);return a}set(a,b,c){const d=K(),f=this.key;this.key=a;this.offset=b;this.type=
57
+ c;U||(A()._compositionKey===f&&C(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function X(a,b,c){return new ac(a,b,c)}function bc(a,b){const c=b.__key;let d=a.offset,f="element";w(b)&&(f="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,f)}function cc(a,b){if(B(b)){const c=b.getLastDescendant();B(c)||w(c)?bc(a,c):bc(a,b)}else w(b)&&bc(a,b)}
58
+ function dc(a,b,c){const d=a.getNode(),f=d.getChildAtIndex(a.offset),e=L(),g=M(d)?ec().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function Y(a,b,c,d){a.key=b;a.offset=c;a.type=d}
59
+ class fc{constructor(a){this.dirty=!1;this._nodes=a}is(a){if(!Sb(a))return!1;const b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a)}delete(a){this.dirty=!0;this._nodes.delete(a)}clear(){this.dirty=!0;this._nodes.clear()}has(a){return this._nodes.has(a)}clone(){return new fc(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=this._nodes;const b=[];for(const c of a)a=H(c),null!==
60
+ a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function J(a){return a instanceof gc}
61
+ class hc{constructor(a,b,c){this.gridKey=a;this.anchorCellKey=b;this.anchor=X(b,0,"element");this.focusCellKey=c;this.focus=X(c,0,"element");this.dirty=!1}is(a){return ic(a)?this.gridKey===a.gridKey&&this.anchorCellKey===a.anchorCellKey&&this.focusCellKey===a.focusCellKey:!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchorCellKey=b;this.focusCellKey=c}clone(){return new hc(this.gridKey,this.anchorCellKey,this.focusCellKey)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
62
+ H(this.anchorCellKey);a||q(74);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=H(this.focusCellKey);c||q(75);var d=c.getIndexWithinParent();const f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){const a=new Set,{fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=H(this.gridKey);jc(e)||q(76);a.add(e);e=e.getChildren();
63
+ for(let l=c;l<=f;l++){var g=e[l];a.add(g);kc(g)||q(77);g=g.getChildren();for(let k=b;k<=d;k++){var h=g[k];qc(h)||q(78);a.add(h);for(h=h.getChildren();0<h.length;){const m=h.shift();a.add(m);B(m)&&h.unshift(...m.getChildren())}}}return Array.from(a)}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function ic(a){return a instanceof hc}
64
+ class gc{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return J(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();B(c)&&(c=c.getDescendantByIndex(a.offset));B(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?B(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,
65
+ b,c,d){Y(this.anchor,a.__key,b,"text");Y(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,f=this.focus;const e=d.isBefore(f);d=d.getCharacterOffset();f=f.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(B(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,w(k)){let m=k.getTextContent();k===b?m=k===c?d<f?m.slice(d,f):m.slice(f,d):e?m.slice(d):m.slice(f):
66
+ k===c&&(m=e?m.slice(0,f):m.slice(0,d));g+=m}else!t(k)&&!wa(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=A(),c=b.getEditorState()._selection;a=rc(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;Y(this.anchor,d.key,d.offset,d.type);Y(this.focus,f.key,f.offset,f.type)}}clone(){const a=this.anchor,b=this.focus;return new gc(X(a.key,a.offset,a.type),X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=ua(this.format,
67
+ a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(L(f));d!==c-1&&a.push(sc())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?dc(b,c,f):d||"element"!==c.type||dc(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var l=h.offset;
68
+ b=e[0];w(b)||q(6);d=b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=L(b.getTextContent()),b.replace(k),b=k);else{m=b.getPreviousSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?b.insertBefore(m):k.insertBefore(m);m.select();
69
+ b=m;if(""!==a){this.insertText(a);return}}else{var m=b.getNextSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?b.insertAfter(m):k.insertAfter(m);m.select(0,0);b=m;if(""!==a){this.insertText(a);return}}if(1===g)if(u(b))a=L(a),a.select(),b.replace(a);else{e=b.getFormat();if(c===l&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=L(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));e.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
70
+ a.length);return}b=b.spliceText(c,l-c,a,!0);""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var p=B(b)?b:b.getParentOrThrow();m=B(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?w(k)&&!u(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,
71
+ l,""),f.add(k.__key)):k.remove():f.add(k.__key);h=m.getChildren();l=new Set(e);const n=p.is(m);if(m.canBeEmpty()||p===m){for(p=h.length-1;0<=p;p--){const v=h[p];if(v.is(b)||B(v)&&v.isParentOf(b))break;v.isAttached()&&(!l.has(v)||v.is(k)?n||b.insertAfter(v):v.remove())}if(!n)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))f.delete(h.__key),l=h;h=h.getParent()}}else p.append(m);u(b)?c===d?b.select():(a=L(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?
72
+ b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a),C(null);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var p=b[m];if(w(p)){k=p.getFormatFlags(a,null);break}}var n=e.offset;p=(m=e.isBefore(g))?n:l;m=m?l:n;if(p===
73
+ d.getTextContentSize()){const v=d.getNextSibling();w(v)&&(p=n=0,d=v,k=d.getFormatFlags(a,null))}if(d.is(f))w(d)&&("element"===e.type&&"element"===g.type?(d.setFormat(k),d.select(p,m),this.format=k):(p=n>l?l:n,m=n>l?n:l,p!==m&&(0===p&&m===h?(d.setFormat(k),d.select(p,m)):(a=d.splitText(p,m),a=0===p?a[0]:a[1],a.setFormat(k),a.select(0,m-p)),this.format=k)));else for(w(d)&&(0!==p&&([,d]=d.splitText(p)),d.setFormat(k)),e=k,w(f)&&(e=f.getFormatFlags(a,k),k=f.getTextContent().length,0!==m&&(m!==k&&([f]=
74
+ f.splitText(m)),f.setFormat(e))),k=1;k<c;k++)m=b[k],g=m.__key,w(m)&&g!==d.__key&&g!==f.__key&&!m.isToken()&&(g=m.getFormatFlags(a,e),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),h=M(f)?null:f.getTopLevelElementOrThrow();if(w(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),
75
+ c.push(f);else if(d===e)e=f;else{if(u(f))return!1;[e,f]=f.splitText(d);c.push(f)}f=e;c.push(...g);g=a[0];var l=!1;for(let p=0;p<a.length;p++){const n=a[p];if(B(n)){if(n.is(g)){if(B(e)&&e.isEmpty()&&e.canReplaceWith(n)){e.replace(n);e=n;l=!0;continue}var k=n.getFirstDescendant();if(va(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(B(e))for(let v=0;v<m;v++)e.append(l[v]);else{for(--m;0<=m;m--)e.insertAfter(l[m]);e=e.getParentOrThrow()}k.remove();
76
+ l=!0;if(k.is(n))continue}}w(e)&&(null===h&&q(69),e=h)}else l&&!t(n)&&M(e.getParent())&&q(7);l=!1;if(B(e))if(t(n)&&n.isTopLevel())e=e.insertAfter(n);else if(B(n)){if(n.canBeEmpty()||!n.isEmpty())M(e)?(k=e.getChildAtIndex(d),null!==k?k.insertBefore(n):e.append(n),e=n):e=e.insertAfter(n)}else k=e.getFirstChild(),null!==k?k.insertBefore(n):e.append(n),e=n;else!B(n)||t(e)&&e.isTopLevel()?e=e.insertAfter(n):(e=n.getParentOrThrow(),p--)}b&&(w(f)?f.select():(a=e.getPreviousSibling(),w(a)?a.select():(a=e.getIndexWithinParent(),
77
+ e.getParentOrThrow().select(a,a))));if(B(e)){if(a=e.getLastDescendant(),b||(null===a?e.select():w(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),B(e)&&!B(a)?(e.append(a),e=a):B(e)||B(a)?B(a)&&!a.canInsertAfter(e)?(h=d.constructor.clone(d),B(h)||q(8),h.append(a),e.insertAfter(h)):e.insertAfter(a):(e.insertBefore(a),e=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(w(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+1,c.select(e,
78
+ e)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(M(f)){a=ec();b=f.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):f.append(a);return}a=f.getChildren().slice(b).reverse()}c=f.insertNewAfter(this);if(null===c)this.insertLineBreak();else if(B(c))if(d=
79
+ a.length,0===b&&0<d)f.insertBefore(c);else{b=null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=sc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const f=this.focus;var e=a[0];let g=
80
+ a[c];var h=d.getCharacterOffset();const l=f.getCharacterOffset();if(0===b)return[];if(1===b)return w(e)?(a=h>l?l:h,c=e.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);w(e)&&(d=b?h:l,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));w(g)&&(e=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==e&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a;const g=Ra(d,b);if(t(g)&&!g.isIsolated()){var h=b?g.getPreviousSibling():
81
+ g.getNextSibling();if(!w(h)){a=g.getParentOrThrow();B(h)?(a=h.__key,h=b?h.getChildrenSize():0):(h=g.getIndexWithinParent(),a=a.__key,b||h++);d.set(a,h,"element");e&&f.set(a,h,"element");return}}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,h=b.type,Y(b,e.key,e.offset,e.type),Y(e,d,f,h)))}deleteCharacter(a){if(this.isCollapsed()){var b=
82
+ this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){tc(f,a,b);return}}else if(null!==
83
+ d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){tc(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=d.offset,g=f.offset;const h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
84
+ this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function Sb(a){return a instanceof fc}function tc(a,b,c){const d=a.getTextContent().split(/\s/g),f=d.length;let e=0,g=0;for(let h=0;h<f;h++){const l=d[h],k=h===f-1;g=e;e+=l.length;if(b&&e===c||e>c||k){d.splice(h,1);k&&(g=void 0);break}}b=d.join(" ");""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
85
+ function uc(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Ia(f[d]);if(w(f))d=g?f.getTextContentSize():0;else{e=Ia(a);if(null===e)return null;if(B(e)){a=e.getChildAtIndex(d);if(b=B(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));w(a)?(f=a,e=null,d=g?f.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
86
+ d=0===b&&t(e)&&Ia(a)===e?d:d+1,e=e.getParentOrThrow();if(B(e))return X(e.__key,d,"element")}}else f=Ia(a);return w(f)?X(f.__key,d,"text"):null}
87
+ function rc(a,b,c,d,f,e){if(null===a||null===c||!qa(f,a,c))return null;a=uc(a,b,J(e)?e.anchor:null);if(null===a)return null;c=uc(c,d,J(e)?e.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),w(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),w(b)&&!b.isInert()&&(a.key=b.__key,a.offset=
88
+ 0));f.isComposing()&&f._compositionKey!==a.key&&J(e)&&(f=e.anchor,e=e.focus,Y(a,f.key,f.offset,f.type),Y(c,e.key,e.offset,e.type))}return[a,c]}function vc(a,b,c,d,f,e){const g=z();a=new gc(X(a,b,f),X(c,d,e),0);a.dirty=!0;return g._selection=a}
89
+ function Qb(a){var b=a.getEditorState()._selection,c=window.getSelection();if(Sb(b)||ic(b))return b.clone();{var d=(d=window.event)&&d.type;d=!Ub&&("selectionchange"===d||"beforeinput"===d||"compositionstart"===d||"compositionend"===d||"click"===d&&3===window.event.detail||void 0===d);let g,h;if(!J(b)||d)if(null===c)b=null;else if(d=c.anchorNode,g=c.focusNode,h=c.anchorOffset,c=c.focusOffset,a=rc(d,h,g,c,a,b),null===a)b=null;else{var [f,e]=a;b=new gc(f,e,J(b)?b.format:0)}else b=b.clone()}return b}
90
+ function K(){return z()._selection}function Ma(){return A()._editorState._selection}function Ib(a){if(null!==a){if("range"===a.type)return new gc(X(a.anchor.key,a.anchor.offset,a.anchor.type),X(a.focus.key,a.focus.offset,a.focus.type),0);if("node"===a.type)return new fc(new Set(a.nodes));if("grid"===a.type)return new hc(a.gridKey,a.anchorCellKey,a.focusCellKey)}return null}
91
+ function wc(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),xc(a));else{var l=a.isBackward();h=l?e:f;var k=h.getNode();f=l?f:e;e=f.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));xc(a)}}
92
+ function xc(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())B(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),w(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(B(e)){const h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);w(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.__key,e,"text"))}B(g)&&(c=g.getChildrenSize(),f=(b=f>=c)?g.getChildAtIndex(c-
93
+ 1):g.getChildAtIndex(f),w(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.__key,g,"text")))}}function Rb(a,b){b=b.getEditorState()._selection;a=a._selection;if(J(a)){var c=a.anchor;const d=a.focus;let f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
94
+ function yc(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,w(d)?(g=d.getTextContentSize(),h="text"):B(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,w(f)?h="text":B(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function zc(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}
95
+ function Ac(a,b){F();var c=a.__key;const d=a.getParent();if(null!==d){var f=K(),e=!1;if(J(f)&&b){var g=f.anchor;const h=f.focus;g.key===c&&(yc(g,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0);h.key===c&&(yc(h,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);za(a);g.splice(c,1);a.getWritable().__parent=null;J(f)&&b&&!e&&wc(f,d,c,-1);null===d||M(d)||d.canBeEmpty()||!d.isEmpty()||Ac(d,b);null!==d&&M(d)&&d.isEmpty()&&d.selectEnd()}}
96
+ function Bc(a){const b=H(a);null===b&&q(39,a);return b}
97
+ class Cc{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{F();99<Ba&&q(26);a=A();var b=z(),c=""+oa++;b._nodeMap.set(c,this);B(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=H(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
27
98
  K();if(null==a)return!1;const b=(new Set(a.getNodes().map(c=>c.__key))).has(this.__key);return w(this)?b:J(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){const a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){const a=this.getLatest().__parent;return null===a?null:H(a)}getParentOrThrow(){const a=this.getParent();null===a&&q(33,this.__key);return a}getTopLevelElement(){let a=
28
99
  this;for(;null!==a;){const b=a.getParent();if(M(b)&&B(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&q(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
29
- b?null:H(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>db(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:H(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>db(c))}getCommonAncestor(a){const b=this.getParents();var c=
100
+ b?null:H(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>Bc(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:H(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>Bc(c))}getCommonAncestor(a){const b=this.getParents();var c=
30
101
  a.getParents();B(this)&&b.unshift(this);B(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){const f=b[d];if(c.has(f))return f}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=
31
102
  a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){const b=this.isBefore(a),c=[],d=new Set;var f=this;let e=null;for(;;){var g=f.__key;d.has(g)||(d.add(g),c.push(f));if(f===a)break;g=B(f)?b?f.getFirstChild():f.getLastChild():null;if(null!==g)null===e&&(e=f),f=g;else if(g=b?f.getNextSibling():f.getPreviousSibling(),null!==g)f=g;else{g=f.getParentOrThrow();d.has(g.__key)||
32
- c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&q(35),g=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(f.is(e)&&(e=null),null!==g||d.has(f.__key)||c.push(f));while(null===g);f=g}}b||c.reverse();return c}isDirty(){const a=A()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===A()._compositionKey}getLatest(){const a=H(this.__key);null===a&&q(36);return a}getWritable(){E();var a=z(),b=A();a=a._nodeMap;const c=this.__key,d=this.getLatest(),
33
- f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return za(d),d;const e=d.constructor.clone(d);e.__parent=f;B(d)&&B(e)?(e.__children=Array.from(d.__children),e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):w(d)&&w(e)?(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail):t(d)&&t(e)&&(e.__state=d.__state);b.add(c);e.__key=c;za(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}exportDOM(a){return t(this)?
34
- (a=a.getElementByKey(this.getKey()),{element:a?a.cloneNode():null}):{element:this.createDOM(a._config,a)}}static importDOM(){return null}remove(){E();ab(this,!0)}replace(a){E();const b=this.__key;a=a.getWritable();xa(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;const f=d.indexOf(this.__key),e=a.__key;-1===f&&q(16);d.splice(f,0,e);a.__parent=c.__key;ab(this,!1);ya(a);d=K();J(d)&&(c=d.anchor,d=d.focus,c.key===b&&fb(c,a),d.key===b&&fb(d,a));A()._compositionKey===b&&D(e);return a}insertAfter(a){E();
35
- var b=this.getWritable(),c=a.getWritable(),d=c.getParent();const f=K();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(xa(c),J(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;const l=e.__children;b=l.indexOf(b.__key);-1===b&&q(16);l.splice(b+1,0,d);ya(c);J(f)&&(cb(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));
36
- return a}insertBefore(a){E();var b=this.getWritable(),c=a.getWritable();xa(c);const d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;const e=d.__children;b=e.indexOf(b.__key);-1===b&&q(16);e.splice(b,0,f);ya(c);c=K();J(c)&&cb(c,d,b);return a}selectPrevious(a,b){E();const c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):B(c)?c.select():w(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){E();const c=this.getNextSibling(),
37
- d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):w(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
38
- class gb{constructor(a,b){this.id=a||Ja();this.editorState=b||null;this.editor=null}init(a){let b=this.editorState;"string"===typeof b&&(this.editorState=b=a.parseEditorState(b),null!==b&&a.setEditorState(b,{tag:"history-merge"}))}set(a){this.editor=a;this.editorState=a.getEditorState()}toJSON(){const a=this.editorState;return{editorState:null===a||"string"===typeof a?a:JSON.stringify(a.toJSON()),id:this.id,type:"editor"}}isEmpty(){return null===this.editorState}}
39
- function hb(a,b){return new gb(a,b)}class ib{constructor(a,b){this._editor=a;this._observers=new Set;this._map=b||new Map}get(a){return this._map.get(a)}has(a){return this._map.has(a)}set(a,b){this._map.set(a,b);const c=this._observers;for(const d of c)d(a,b)}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}destroy(){this._observers.clear()}toJSON(){return{map:Array.from(this._map.entries()),type:"map"}}}function jb(a,b){return new ib(a,b)}
40
- class kb{constructor(a,b){this._editor=a;this._observers=new Set;this._array=b||[]}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}getLength(){return this._array.length}map(a){const b=[],c=this._array;for(let d=0;d<c.length;d++)b.push(a(c[d],d,c));return b}reduce(a,b){const c=this._array;for(let d=0;d<c.length;d++){const f=c[d];b=void 0!==b?a(b,f):f}return b}push(a){this.splice(this._array.length,0,a)}splice(a,b,c){void 0===c?this._array.splice(a,b):this._array.splice(a,b,c);const d=
41
- Array.from(this._observers);for(let f=0;f<d.length;f++)d[f](a,b,c)}indexOf(a){return this._array.indexOf(a)}destroy(){this._observers.clear()}toJSON(){return{array:this._array,type:"array"}}}function lb(a,b){return new kb(a,b)}class mb extends eb{constructor(a,b){super(b);b=A();this.__state=a||jb(b)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function t(a){return a instanceof mb}
42
- function nb(a,b){if("string"===typeof b||"number"===typeof b||"boolean"===typeof b||null===b)var c=b;else if("object"===typeof b)if(c=b.type,"editor"===c)c=hb(b.id,b.editorState);else if("array"===c){b=b.array;c=[];for(let d=0;d<b.length;d++)c.push(nb(a,b[d]));c=lb(a,c)}else c=ob(a,b);else q(48);return c}function ob(a,b){b=b.map;const c=new Map;for(let d=0;d<b.length;d++){const [f,e]=b[d];c.set(f,nb(a,e))}return jb(a,c)}
43
- function pb(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&q(24,e);g=g.klass;e=a.__key;a.__key=void 0;g=g.clone(a);a.__key=e;const h=g.__key;M(g)&&z()._nodeMap.set("root",g);g.__parent=d;if(B(g)){d=a.__children;for(var l=0;l<d.length;l++){var k=b.get(d[l]);void 0!==k&&(k=pb(k,b,c,h,f).__key,g.__children.push(k))}g.__indent=a.__indent;g.__format=a.__format;g.__dir=a.__dir}else w(g)?(g.__format=a.__format,g.__style=a.__style,g.__mode=a.__mode,g.__detail=a.__detail):
44
- t(g)&&(a=a.__state,g.__state=a&&ob(c,a));a=null!=f?f.originalSelection:void 0;null!=a&&(c=f.remappedSelection,"range"===a.type?(b=a.anchor,a=a.focus,null!=c||e!==b.key&&e!==a.key||(f.remappedSelection=c={anchor:{...b},focus:{...a},type:"range"}),null!=c&&"range"===c.type&&(e===b.key&&(c.anchor.key=h),e===a.key&&(c.focus.key=h))):"node"===a.type?(a=a.nodes,e=a.indexOf(e),-1!==e&&(null==c&&(f.remappedSelection=c={nodes:[...a],type:"node"}),"node"===c.type&&c.nodes.splice(e,1,h))):"grid"===a.type&&(b=
45
- a.gridKey,d=a.anchorCellKey,l=a.focusCellKey,null!=c||b!==e&&b!==d&&b!==l||(f.remappedSelection=c={...a,type:"grid"}),null!=c&&"grid"===c.type&&(b===e&&(c.gridKey=h),d===e&&(c.anchorCellKey=h),l===e&&(c.focusCellKey=h))));return g}let N="",O="",P="",qb,Q,rb,sb=!1,tb=!1,ub,vb=null,wb,xb,yb,zb,Ab,Bb;function Cb(a,b){const c=yb.get(a);if(null!==b){const d=Db(a);b.removeChild(d)}zb.has(a)||Q._keyToDOMMap.delete(a);B(c)&&(a=c.__children,Eb(a,0,a.length-1,null));void 0!==c&&Pa(Bb,rb,ub,c,"destroyed")}
46
- function Eb(a,b,c,d){for(;b<=c;++b){const f=a[b];void 0!==f&&Cb(f,d)}}function Fb(a,b){a.setProperty("text-align",b)}function Gb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}function Hb(a,b){a=a.style;0===b?Fb(a,""):1===b?Fb(a,"left"):2===b?Fb(a,"center"):3===b?Fb(a,"right"):4===b&&Fb(a,"justify")}
47
- function Ib(a,b,c){const d=zb.get(a);void 0===d&&q(42);const f=d.createDOM(qb,Q);var e=Q._keyToDOMMap;f["__lexicalKey_"+Q._key]=a;e.set(a,f);w(d)?f.setAttribute("data-lexical-text","true"):t(d)&&f.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&Gb(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;const h=O;O="";Jb(e,0,g,f,null);Kb(d,f);O=h}e=d.__format;0!==e&&Hb(f,e);Lb(null,a,f)}else e=d.getTextContent(),t(d)?(g=d.decorate(Q),null!==g&&Mb(a,g),f.contentEditable="false"):
48
- w(d)&&(d.isDirectionless()||(O+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),N+=e,P+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Pa(Bb,rb,ub,d,"created");return f}function Jb(a,b,c,d,f){const e=N;for(N="";b<=c;++b)Ib(a[b],d,f);d.__lexicalTextContent=N;N=e+N}function Nb(a,b){a=b.get(a[a.length-1]);return va(a)||t(a)}
49
- function Lb(a,b,c){a=null!==a&&(0===a.length||Nb(a,yb));b=null!==b&&(0===b.length||Nb(b,zb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
50
- function Kb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==vb){const e=""===O;if(e)var d=vb;else d=O,d=aa.test(d)?"rtl":da.test(d)?"ltr":null;if(d!==c){const g=b.classList,h=qb.theme;var f=null!==c?h[c]:void 0;let l=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==l&&("string"===typeof l&&(c=l.split(" "),l=h[d]=c),g.add(...l)),b.dir=d);tb||(a.getWritable().__dir=d)}vb=d;b.__lexicalDirTextContent=
51
- O;b.__lexicalDir=d}}
52
- function Ob(a,b){var c=yb.get(a),d=zb.get(a);void 0!==c&&void 0!==d||q(43);var f=sb||xb.has(a)||wb.has(a);const e=Pb(Q,a);if(c===d&&!f)return B(c)?(d=e.__lexicalTextContent,void 0!==d&&(N+=d,P+=d),d=e.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),w(c)&&!c.isDirectionless()&&(O+=d),P+=d,N+=d),e;c!==d&&f&&Pa(Bb,rb,ub,d,"updated");if(d.updateDOM(c,e,qb))return d=Ib(a,null,null),null===b&&q(44),b.replaceChild(d,e),Cb(a,null),d;if(B(c)&&B(d)){if(a=d.__indent,a!==c.__indent&&Gb(e,a),
53
- a=d.__format,a!==c.__format&&Hb(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=O;O="";const v=N;N="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Ob(m,e);else{var p=Db(m);h=Ib(h,null,null);e.replaceChild(h,p);Cb(m,null)}}else if(0===l)0!==k&&Jb(h,0,k-1,e,null);else if(0===k)0!==l&&(m=null==e.__lexicalLineBreak,Eb(g,0,l-1,m?null:e),m&&(e.textContent=""));else{const C=l-1;l=k-1;let y=e.firstChild,F=0;for(k=0;F<=C&&k<=l;){var n=g[F];const x=h[k];if(n===x)y=Ob(x,
54
- e).nextSibling,F++,k++;else{void 0===m&&(m=new Set(g));void 0===p&&(p=new Set(h));const G=p.has(n),W=m.has(x);G?(W?(n=Pb(Q,x),n===y?y=Ob(x,e).nextSibling:(null!=y?e.insertBefore(n,y):e.appendChild(n),Ob(x,e)),F++):Ib(x,e,y),k++):(y=Db(n).nextSibling,Cb(n,e),F++)}}m=F>C;p=k>l;m&&!p?(m=h[l+1],m=void 0===m?null:Q.getElementByKey(m),Jb(h,k,l,e,m)):p&&!m&&Eb(g,F,C,e)}e.__lexicalTextContent=N;N=v+N;Kb(f,e);O=b;M(d)||Lb(a,c,e)}}else c=d.getTextContent(),t(d)?(f=d.decorate(Q),null!==f&&Mb(a,f)):w(d)&&!d.isDirectionless()&&
55
- (O+=c),N+=c,P+=c;!tb&&M(d)&&d.__cachedText!==P&&(d=d.getWritable(),d.__cachedText=P);return e}function Mb(a,b){let c=Q._pendingDecorators;const d=Q._decorators;if(null===c){if(d[a]===b)return;c=Ca(Q)}c[a]=b}function Db(a){a=Ab.get(a);void 0===a&&q(45);return a}function Pb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let S=null,T=null,U=!1,Qb=!1,Aa=0;function E(){U&&q(25)}function z(){null===S&&q(27);return S}function A(){null===T&&q(28);return T}
56
- function Rb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Sb(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(const c of b)b=a.get(c),w(b)&&b.isSimpleText()&&!b.isUnmergeable()&&$a(b)}
57
- function Tb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=A()._compositionKey,e=new Map;var g=c;let h=g.size;for(var l=d,k=l.size;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;for(const m of g)g=a.get(m),w(g)&&g.isSimpleText()&&!g.isUnmergeable()&&$a(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Rb(b,g,e),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Aa++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(const m of l)l=m[0],k=m[1],"root"!==l&&k&&(g=a.get(l),void 0!==
58
- g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Rb(b,g,e),d.set(l,k));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;Aa++}b._dirtyLeaves=c;b._dirtyElements=d}
59
- function Ub(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=S,l=U,k=T,m=a._updating;T=a;S=b;U=!1;a._updating=!0;try{var p=a._observer;let ka=null;if(g&&null!==p){var n=a._dirtyType,v=a._dirtyElements,C=a._dirtyLeaves;p.disconnect();try{O=P=N="";sb=2===n;vb=null;Q=a;qb=a._config;rb=a._nodes;ub=Q._listeners.mutation;wb=v;xb=C;yb=d._nodeMap;zb=b._nodeMap;tb=b._readOnly;
60
- Ab=new Map(a._keyToDOMMap);const wa=new Map;Bb=wa;Ob("root",null);Bb=Ab=qb=zb=yb=xb=wb=rb=Q=void 0;ka=wa}finally{p.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Va=window.getSelection();if(null!==Va&&(g||null===e||e.dirty)){p=Va;const wa=p.anchorNode,vc=p.focusNode,xd=p.anchorOffset,yd=p.focusOffset,Wa=document.activeElement,ba=a._rootElement;if(!a._updateTags.has("collaboration")||Wa===ba)if(J(e)){var y=e.anchor,F=e.focus,x=F.key,G=Pb(a,y.key),W=Pb(a,x),wc=y.offset,xc=F.offset;f=G;
61
- x=W;"text"===y.type&&(f=sa(G));"text"===F.type&&(x=sa(W));if(null!==f&&null!==x)if(xd!==wc||yd!==xc||wa!==f||vc!==x||"Range"===p.type&&e.isCollapsed())try{if(p.setBaseAndExtent(f,wc,x,xc),e.isCollapsed()&&ba===Wa){const ca=3===f.nodeType?f.parentNode:f;if(null!==ca){const Xa=ca.getBoundingClientRect();if(Xa.bottom>window.innerHeight)ca.scrollIntoView(!1);else if(0>Xa.top)ca.scrollIntoView();else if(ba){const yc=ba.getBoundingClientRect();Xa.bottom>yc.bottom?ca.scrollIntoView(!1):Xa.top<yc.top&&ca.scrollIntoView()}a._updateTags.add("scroll-into-view")}}}catch(ca){}else null===
62
- ba||null!==Wa&&ba.contains(Wa)||ba.focus({preventScroll:!0})}else null!==f&&pa(a,wa,vc)&&p.removeAllRanges()}var zc=ka;null!==zc&&Vb(a,d,b,zc)}catch(ka){a._onError(ka);Qb||(Wb(a,null,c,b),Xb(a),a._dirtyType=2,Qb=!0,Ub(a),Qb=!1);return}finally{a._updating=m,S=h,U=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;e=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=
63
- a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var R in k)m.has(R)||(k===g&&(k=Ca(a)),delete k[R]);R=a._pendingDecorators;null!==R&&(a._decorators=R,a._pendingDecorators=null,Yb("decorator",a,!0,R));R=Da(d);g=Da(b);R!==g&&Yb("textcontent",a,!0,g);Yb("update",a,!0,{dirtyElements:e,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(R=0;R<b.length;R++)b[R]()}finally{a._updating=d}}b=a._updates;
64
- if(0!==b.length){const [ka,Va]=b.shift();Zb(a,ka,Va)}}}function Vb(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Yb(a,b,c,...d){const f=b._updating;b._updating=c;try{const e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a](...d)}finally{b._updating=f}}
65
- function V(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=V(a,b,c)});return e}const d=Ia(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(const h of f)if(!0===h(c,a))return!0}return!1}function $b(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,f]=b.shift();let e,g;void 0!==f&&(e=f.onUpdate,g=f.tag,f.skipTransforms&&(c=!0),e&&a._deferred.push(e),g&&a._updateTags.add(g));d()}return c}
66
- function Zb(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new ac(new Map(c._nodeMap)),g=!0);const h=S,l=U,k=T,m=a._updating;S=e;U=!1;a._updating=!0;T=a;try{g&&(e._selection=bc(a));const p=a._compositionKey;b();f=$b(a);cc(e,a);0!==a._dirtyType&&(f?Sb(e,a):Tb(e,a),$b(a),Ua(c,e,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&
67
- (e._flushSync=!0);const n=e._selection;if(J(n)){const v=e._nodeMap,C=n.focus.key;void 0!==v.get(n.anchor.key)&&void 0!==v.get(C)||q(30)}else dc(n)&&0===n._nodes.size&&(e._selection=null)}catch(p){a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Ub(a);return}finally{S=h,U=l,T=k,a._updating=m,Aa=0}0!==a._dirtyType||ec(e,a)?e._flushSync?(e._flushSync=!1,Ub(a)):g&&oa(()=>{Ub(a)}):(e._flushSync=!1,g&&(d.clear(),a._deferred=[],
68
- a._pendingEditorState=null))}function I(a,b,c){a._updating?a._updates.push([b,c]):Zb(a,b,c)}let fc=!1,gc=0;function hc(a){gc=a.timeStamp}function ic(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function jc(a){return a.getEditorState().read(()=>{const b=K();return null!==b?b.clone():null})}
69
- function kc(a,b,c){fc=!0;const d=100<performance.now()-gc;try{I(a,()=>{var f=new Map,e=a.getRootElement(),g=a._editorState;let h=!1,l="";for(var k=0;k<b.length;k++){var m=b[k],p=m.type,n=m.target,v=qa(n,g);if(!t(v))if("characterData"===p){if(d&&3===n.nodeType&&w(v)&&v.isAttached()){m=window.getSelection();var C=p=null;null!==m&&m.anchorNode===n&&(p=m.anchorOffset,C=m.focusOffset);La(v,n.nodeValue,p,C,!1)}}else if("childList"===p){h=!0;p=m.addedNodes;for(C=0;C<p.length;C++){var y=p[C],F=Ba(y),x=y.parentNode;
70
- null==x||null!==F||"BR"===y.nodeName&&ic(y,x,a)||(la&&(F=y.innerText||y.nodeValue)&&(l+=F),x.removeChild(y))}m=m.removedNodes;p=m.length;if(0<p){C=0;for(y=0;y<p;y++)x=m[y],"BR"===x.nodeName&&ic(x,n,a)&&(n.appendChild(x),C++);p!==C&&(n===e&&(v=g._nodeMap.get("root")),f.set(n,v))}}}if(0<f.size)for(const [G,W]of f)if(B(W))for(f=W.__children,e=G.firstChild,g=0;g<f.length;g++)k=a.getElementByKey(f[g]),null!==k&&(null==e?(G.appendChild(k),e=k):e!==k&&G.replaceChild(k,e),e=e.nextSibling);else w(W)&&W.markDirty();
71
- f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,v=0;v<g.length;v++)n=g[v],m=n.parentNode,null==m||"BR"!==n.nodeName||ic(n,k,a)||m.removeChild(n);c.takeRecords()}f=K()||jc(a);null!==f&&(h&&(f.dirty=!0,Ga(f)),la&&Sa()&&f.insertRawText(l))})}finally{fc=!1}}function lc(a){const b=a._observer;if(null!==b){const c=b.takeRecords();kc(a,c,b)}}
72
- function Xb(a){0===gc&&window.addEventListener("textInput",hc,!0);a._observer=new MutationObserver((b,c)=>{kc(a,b,c)})}
73
- class mc{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;B(b)&&(b=b.getDescendantByIndex(d));B(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=H(this.key);null===a&&q(5);return a}set(a,b,c){const d=K(),f=this.key;this.key=a;this.offset=b;this.type=
74
- c;U||(A()._compositionKey===f&&D(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function X(a,b,c){return new mc(a,b,c)}function nc(a,b){const c=b.__key;let d=a.offset,f="element";w(b)&&(f="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,f)}function fb(a,b){if(B(b)){const c=b.getLastDescendant();B(c)||w(c)?nc(a,c):nc(a,b)}else w(b)&&nc(a,b)}
75
- function oc(a,b,c){const d=a.getNode(),f=d.getChildAtIndex(a.offset),e=L(),g=M(d)?pc().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function Y(a,b,c,d){a.key=b;a.offset=c;a.type=d}
76
- class qc{constructor(a){this.dirty=!1;this._nodes=a}is(a){if(!dc(a))return!1;const b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a)}delete(a){this.dirty=!0;this._nodes.delete(a)}clear(){this.dirty=!0;this._nodes.clear()}has(a){return this._nodes.has(a)}clone(){return new qc(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=this._nodes;const b=[];for(const c of a)a=H(c),null!==
77
- a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function J(a){return a instanceof rc}
78
- class sc{constructor(a,b,c){this.gridKey=a;this.anchorCellKey=b;this.anchor=X(b,0,"element");this.focusCellKey=c;this.focus=X(c,0,"element");this.dirty=!1}is(a){return tc(a)?this.gridKey===a.gridKey&&this.anchorCellKey===a.anchorCellKey&&this.focusCellKey===a.focusCellKey:!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchorCellKey=b;this.focusCellKey=c}clone(){return new sc(this.gridKey,this.anchorCellKey,this.focusCellKey)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
79
- H(this.anchorCellKey);a||q(74);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=H(this.focusCellKey);c||q(75);var d=c.getIndexWithinParent();const f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){const a=new Set,{fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=H(this.gridKey);uc(e)||q(76);a.add(e);e=e.getChildren();
80
- for(let l=c;l<=f;l++){var g=e[l];a.add(g);Ac(g)||q(77);g=g.getChildren();for(let k=b;k<=d;k++){var h=g[k];Bc(h)||q(78);a.add(h);for(h=h.getChildren();0<h.length;){const m=h.shift();a.add(m);B(m)&&h.unshift(...m.getChildren())}}}return Array.from(a)}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function tc(a){return a instanceof sc}
81
- class rc{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return J(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();B(c)&&(c=c.getDescendantByIndex(a.offset));B(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?B(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,
82
- b,c,d){Y(this.anchor,a.__key,b,"text");Y(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,f=this.focus;const e=d.isBefore(f);d=d.getCharacterOffset();f=f.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(B(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,w(k)){let m=k.getTextContent();k===b?m=k===c?d<f?m.slice(d,f):m.slice(f,d):e?m.slice(d):m.slice(f):
83
- k===c&&(m=e?m.slice(0,f):m.slice(0,d));g+=m}else!t(k)&&!va(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=A(),c=b.getEditorState()._selection;a=Cc(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;Y(this.anchor,d.key,d.offset,d.type);Y(this.focus,f.key,f.offset,f.type)}}clone(){const a=this.anchor,b=this.focus;return new rc(X(a.key,a.offset,a.type),X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=ta(this.format,
84
- a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(L(f));d!==c-1&&a.push(Dc())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?oc(b,c,f):d||"element"!==c.type||oc(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var l=h.offset;
85
- b=e[0];w(b)||q(6);d=b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=L(b.getTextContent()),b.replace(k),b=k);else{m=b.getPreviousSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?b.insertBefore(m):k.insertBefore(m);m.select();
86
- b=m;if(""!==a){this.insertText(a);return}}else{var m=b.getNextSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?b.insertAfter(m):k.insertAfter(m);m.select(0,0);b=m;if(""!==a){this.insertText(a);return}}if(1===g)if(u(b))e=L(a),e.select(),b.replace(e);else{e=b.getFormat();if(c===l&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=L(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));return}b=b.spliceText(c,l-c,a,!0);""===b.getTextContent()?
87
- b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var p=B(b)?b:b.getParentOrThrow();m=B(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?w(k)&&!u(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,l,""),f.add(k.__key)):k.remove():f.add(k.__key);h=m.getChildren();
88
- l=new Set(e);const n=p.is(m);if(m.canBeEmpty()||p===m){for(p=h.length-1;0<=p;p--){const v=h[p];if(v.is(b)||B(v)&&v.isParentOf(b))break;v.isAttached()&&(!l.has(v)||v.is(k)?n||b.insertAfter(v):v.remove())}if(!n)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))f.delete(h.__key),l=h;h=h.getParent()}}else p.append(m);u(b)?c===d?b.select():(a=L(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&
89
- (this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var p=b[m];if(w(p)){k=p.getFormatFlags(a,null);break}}var n=e.offset;p=(m=e.isBefore(g))?n:l;m=m?l:n;if(p===d.getTextContentSize()){const v=d.getNextSibling();w(v)&&(p=
90
- n=0,d=v,k=d.getFormatFlags(a,null))}if(d.is(f))w(d)&&("element"===e.type&&"element"===g.type?(d.setFormat(k),d.select(p,m),this.format=k):(p=n>l?l:n,m=n>l?n:l,p!==m&&(0===p&&m===h?(d.setFormat(k),d.select(p,m)):(a=d.splitText(p,m),a=0===p?a[0]:a[1],a.setFormat(k),a.select(0,m-p)),this.format=k)));else for(w(d)&&(0!==p&&([,d]=d.splitText(p)),d.setFormat(k)),e=k,w(f)&&(e=f.getFormatFlags(a,k),k=f.getTextContent().length,0!==m&&(m!==k&&([f]=f.splitText(m)),f.setFormat(e))),k=1;k<c;k++)m=b[k],g=m.__key,
91
- w(m)&&g!==d.__key&&g!==f.__key&&!m.isToken()&&(g=m.getFormatFlags(a,e),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),h=M(f)?null:f.getTopLevelElementOrThrow();if(w(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),c.push(f);else if(d===e)e=f;else{if(u(f))return!1;[e,
92
- f]=f.splitText(d);c.push(f)}f=e;c.push(...g);g=a[0];var l=!1;for(let p=0;p<a.length;p++){const n=a[p];if(B(n)){if(n.is(g)){if(B(e)&&e.isEmpty()&&e.canReplaceWith(n)){e.replace(n);e=n;l=!0;continue}var k=n.getFirstDescendant();if(ua(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(B(e))for(let v=0;v<m;v++)e.append(l[v]);else{for(--m;0<=m;m--)e.insertAfter(l[m]);e=e.getParentOrThrow()}k.remove();l=!0;if(k.is(n))continue}}w(e)&&(null===h&&q(69),
93
- e=h)}else l&&!t(n)&&M(e.getParent())&&q(7);l=!1;if(B(e))if(t(n)&&n.isTopLevel())e=e.insertAfter(n);else if(B(n)){if(n.canBeEmpty()||!n.isEmpty())M(e)?(k=e.getChildAtIndex(d),null!==k?k.insertBefore(n):e.append(n),e=n):e=e.insertAfter(n)}else k=e.getFirstChild(),null!==k?k.insertBefore(n):e.append(n),e=n;else!B(n)||t(e)&&e.isTopLevel()?e=e.insertAfter(n):(e=n.getParentOrThrow(),p--)}b&&(w(f)?f.select():(a=e.getPreviousSibling(),w(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,
94
- a))));if(B(e)){if(a=e.getLastDescendant(),b||(null===a?e.select():w(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),B(e)&&!B(a)?(e.append(a),e=a):B(e)||B(a)?B(a)&&!a.canInsertAfter(e)?(h=d.constructor.clone(d),B(h)||q(8),h.append(a),e.insertAfter(h)):e.insertAfter(a):(e.insertBefore(a),e=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(w(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+1,c.select(e,e)));return!0}insertParagraph(){this.isCollapsed()||
95
- this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(M(f)){a=pc();b=f.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):f.append(a);return}a=f.getChildren().slice(b).reverse()}c=f.insertNewAfter(this);if(null===c)this.insertLineBreak();else if(B(c))if(d=a.length,0===b&&0<d)f.insertBefore(c);else{b=
96
- null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=Dc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const f=this.focus;var e=a[0];let g=a[c];var h=d.getCharacterOffset();const l=f.getCharacterOffset();
97
- if(0===b)return[];if(1===b)return w(e)?(a=h>l?l:h,c=e.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);w(e)&&(d=b?h:l,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));w(g)&&(e=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==e&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a;const g=Ra(d,b);if(t(g)&&!g.isIsolated()){var h=b?g.getPreviousSibling():g.getNextSibling();if(!w(h)){a=g.getParentOrThrow();
98
- B(h)?(a=h.__key,h=b?h.getChildrenSize():0):(h=g.getIndexWithinParent(),a=a.__key,b||h++);d.set(a,h,"element");e&&f.set(a,h,"element");return}}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,h=b.type,Y(b,e.key,e.offset,e.type),Y(e,d,f,h)))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();
99
- if(!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){Ec(f,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=
100
- b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){Ec(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=d.offset,g=f.offset;const h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
101
- this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function dc(a){return a instanceof qc}function Ec(a,b,c){const d=a.getTextContent().split(/\s/g),f=d.length;let e=0,g=0;for(let h=0;h<f;h++){const l=d[h],k=h===f-1;g=e;e+=l.length;if(b&&e===c||e>c||k){d.splice(h,1);k&&(g=void 0);break}}b=d.join(" ");""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
102
- function Fc(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Ha(f[d]);if(w(f))d=g?f.getTextContentSize():0;else{e=Ha(a);if(null===e)return null;if(B(e)){a=e.getChildAtIndex(d);if(b=B(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));w(a)?(f=a,e=null,d=g?f.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
103
- d=0===b&&t(e)&&Ha(a)===e?d:d+1,e=e.getParentOrThrow();if(B(e))return X(e.__key,d,"element")}}else f=Ha(a);return w(f)?X(f.__key,d,"text"):null}
104
- function Cc(a,b,c,d,f,e){if(null===a||null===c||!pa(f,a,c))return null;a=Fc(a,b,J(e)?e.anchor:null);if(null===a)return null;c=Fc(c,d,J(e)?e.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),w(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),w(b)&&!b.isInert()&&(a.key=b.__key,a.offset=
105
- 0));f.isComposing()&&f._compositionKey!==a.key&&J(e)&&(f=e.anchor,e=e.focus,Y(a,f.key,f.offset,f.type),Y(c,e.key,e.offset,e.type))}return[a,c]}function Gc(a,b,c,d,f,e){const g=z();a=new rc(X(a,b,f),X(c,d,e),0);a.dirty=!0;return g._selection=a}
106
- function bc(a){var b=a.getEditorState()._selection,c=window.getSelection();if(dc(b)||tc(b))return b.clone();{var d=(d=window.event)&&d.type;d=!fc&&("selectionchange"===d||"beforeinput"===d||"compositionstart"===d||"compositionend"===d||"click"===d&&3===window.event.detail||void 0===d);let g,h;if(!J(b)||d)if(null===c)b=null;else if(d=c.anchorNode,g=c.focusNode,h=c.anchorOffset,c=c.focusOffset,a=Cc(d,h,g,c,a,b),null===a)b=null;else{var [f,e]=a;b=new rc(f,e,J(b)?b.format:0)}else b=b.clone()}return b}
107
- function K(){return z()._selection}function Ma(){return A()._editorState._selection}function Hc(a){if(null!==a){if("range"===a.type)return new rc(X(a.anchor.key,a.anchor.offset,a.anchor.type),X(a.focus.key,a.focus.offset,a.focus.type),0);if("node"===a.type)return new qc(new Set(a.nodes));if("grid"===a.type)return new sc(a.gridKey,a.anchorCellKey,a.focusCellKey)}return null}
108
- function cb(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),Ic(a));else{var l=a.isBackward();h=l?e:f;var k=h.getNode();f=l?f:e;e=f.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));Ic(a)}}
109
- function Ic(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())B(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),w(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(B(e)){const h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);w(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.__key,e,"text"))}B(g)&&(c=g.getChildrenSize(),f=(b=f>=c)?g.getChildAtIndex(c-
110
- 1):g.getChildAtIndex(f),w(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.__key,g,"text")))}}function cc(a,b){b=b.getEditorState()._selection;a=a._selection;if(J(a)){var c=a.anchor;const d=a.focus;let f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
111
- function bb(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,w(d)?(g=d.getTextContentSize(),h="text"):B(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,w(f)?h="text":B(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Jc(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}
112
- class Kc extends eb{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=H(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
103
+ c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&q(35),g=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(f.is(e)&&(e=null),null!==g||d.has(f.__key)||c.push(f));while(null===g);f=g}}b||c.reverse();return c}isDirty(){const a=A()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===A()._compositionKey}getLatest(){const a=H(this.__key);null===a&&q(36);return a}getWritable(){F();var a=z(),b=A();a=a._nodeMap;const c=this.__key,d=this.getLatest(),
104
+ f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return Aa(d),d;const e=d.constructor.clone(d);e.__parent=f;B(d)&&B(e)?(e.__children=Array.from(d.__children),e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):w(d)&&w(e)&&(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail);b.add(c);e.__key=c;Aa(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}exportDOM(a){return t(this)?
105
+ (a=a.getElementByKey(this.getKey()),{element:a?a.cloneNode():null}):{element:this.createDOM(a._config,a)}}static importDOM(){return null}remove(){F();Ac(this,!0)}replace(a){F();const b=this.__key;a=a.getWritable();ya(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;const f=d.indexOf(this.__key),e=a.__key;-1===f&&q(16);d.splice(f,0,e);a.__parent=c.__key;Ac(this,!1);za(a);d=K();J(d)&&(c=d.anchor,d=d.focus,c.key===b&&cc(c,a),d.key===b&&cc(d,a));A()._compositionKey===b&&C(e);return a}insertAfter(a){F();
106
+ var b=this.getWritable(),c=a.getWritable(),d=c.getParent();const f=K();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(ya(c),J(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;const l=e.__children;b=l.indexOf(b.__key);-1===b&&q(16);l.splice(b+1,0,d);za(c);J(f)&&(wc(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));
107
+ return a}insertBefore(a){F();var b=this.getWritable(),c=a.getWritable();ya(c);const d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;const e=d.__children;b=e.indexOf(b.__key);-1===b&&q(16);e.splice(b,0,f);za(c);c=K();J(c)&&wc(c,d,b);return a}selectPrevious(a,b){F();const c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):B(c)?c.select():w(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){F();const c=this.getNextSibling(),
108
+ d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):w(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class Dc extends Cc{constructor(a){super(a)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function t(a){return a instanceof Dc}
109
+ class Ec extends Cc{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=H(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
113
110
  A()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let f=0;f<c.length;f++){var d=H(c[f]);!w(d)||!a&&d.isInert()?B(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(B(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(B(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
114
111
  this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],B(a)&&a.getLastDescendant()||a;a=b[a];return B(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:H(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&q(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,b=a.length;return 0===b?null:H(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:H(a)}getTextContent(a,
115
- b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);B(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){E();const c=K();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(J(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return Gc(d,a,d,b,"element","element");return c}selectStart(){const a=
116
- this.getFirstDescendant();return B(a)||w(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return B(a)||w(a)?a.select():null!==a?a.selectNext():this.select()}clear(){E();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){E();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){E();const b=this.getWritable();b.__dir=a;return b}setFormat(a){E();this.getWritable().__format=fa[a];return this}setIndent(a){E();
117
- this.getWritable().__indent=a;return this}splice(a,b,c){E();const d=this.getWritable();var f=d.__key;const e=d.__children,g=c.length;var h=[];for(let l=0;l<g;l++){const k=c[l],m=k.getWritable();k.__key===f&&q(49);xa(m);m.__parent=f;h.push(m.__key)}(c=this.getChildAtIndex(a-1))&&za(c);(f=this.getChildAtIndex(a+b))&&za(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);if(a.length&&(b=K(),J(b))){const l=new Set(a),k=new Set(h);h=n=>{for(n=n.getNode();n;){const v=n.__key;if(l.has(v)&&!k.has(v))return!0;
118
- n=n.getParent()}return!1};const {anchor:m,focus:p}=b;h(m)&&bb(m,m.getNode(),this,c,f);h(p)&&bb(p,p.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=H(a[b]),null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||M(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}}
119
- function B(a){return a instanceof Kc}
120
- class Lc extends Kc{static getType(){return"root"}static clone(){return new Lc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(70)}getTextContent(a,b){const c=this.__cachedText;return!U&&0!==A()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];B(c)||t(c)||q(46)}return super.append(...a)}toJSON(){return{__children:this.__children,__dir:this.__dir,
121
- __format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function M(a){return a instanceof Lc}function ec(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function Mc(){return new ac(new Map([["root",new Lc]]))}
122
- class ac{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=S,d=U,f=T;S=this;U=!0;T=null;try{var b=a();break a}finally{S=c,U=d,T=f}b=void 0}return b}clone(a){a=new ac(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:J(a)?{anchor:{key:a.anchor.key,offset:a.anchor.offset,
123
- type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:dc(a)?{nodes:Array.from(a._nodes),type:"node"}:tc(a)?{anchorCellKey:a.anchorCellKey,focusCellKey:a.focusCellKey,gridKey:a.gridKey,type:"grid"}:null}}}const Nc=Object.freeze({}),Tc=[["keydown",Oc],["compositionstart",Pc],["compositionend",Qc],["input",Rc],["click",Sc],["cut",Nc],["copy",Nc],["dragstart",Nc],["paste",Nc],["focus",Nc],["blur",Nc]];ma?Tc.push(["beforeinput",Uc]):Tc.push(["drop",Nc]);
124
- let Vc=!1,Wc=0;function Xc(a,b,c){I(b,()=>{if(c){var d=K();if(J(d)&&d.isCollapsed()){"Range"===a.type&&(d.dirty=!0);var f=d.anchor;"text"===f.type?(f=f.getNode(),d.format=f.getFormat()):"element"===f.type&&(d.format=0)}V(b,Yc,void 0)}else Ga(null)})}
125
- function Sc(a,b){I(b,()=>{const c=K();if(J(c)){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Ea().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}V(b,Zc,a)})}
126
- function Uc(a,b){const c=a.inputType;"deleteCompositionText"===c||"insertCompositionText"===c||la&&Sa()||I(b,()=>{const d=K();if(J(d))if("deleteContentBackward"===c)D(null),a.preventDefault(),V(b,$c,!0);else{var f=a.data;if(!d.dirty&&d.isCollapsed()&&!M(d.anchor.getNode())&&a.getTargetRanges){var e=a.getTargetRanges()[0];e&&d.applyDOMRange(e)}var g=d.focus;e=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),V(b,ad,void 0)):"\n\n"===f?(a.preventDefault(),V(b,bd,void 0)):
127
- null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Na(d,f,!0)&&(a.preventDefault(),V(b,cd,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,cd,a);break;case "insertFromComposition":D(null);V(b,cd,a);break;case "insertLineBreak":D(null);V(b,ad,void 0);break;case "insertParagraph":D(null);V(b,bd,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,dd,a);
128
- break;case "deleteByComposition":e===g&&!B(e)&&!B(g)&&u(e)&&u(g)||V(b,ed,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ed,void 0);break;case "deleteContent":V(b,$c,!1);break;case "deleteWordBackward":V(b,fd,!0);break;case "deleteWordForward":V(b,fd,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,gd,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,gd,!1);break;case "formatStrikeThrough":V(b,Z,"strikethrough");break;
129
- case "formatBold":V(b,Z,"bold");break;case "formatItalic":V(b,Z,"italic");break;case "formatUnderline":V(b,Z,"underline");break;case "historyUndo":V(b,hd,void 0);break;case "historyRedo":V(b,id,void 0)}}})}function Rc(a,b){a.stopPropagation();I(b,()=>{var c=K();const d=a.data;null!=d&&J(c)&&Na(c,d,!1)?V(b,cd,d):Ka(b,null);E();c=A();lc(c)})}function Pc(a,b){I(b,()=>{const c=K();if(J(c)&&!b.isComposing()){const d=c.anchor;D(d.key);Vc&&"element"!==d.type&&c.isCollapsed()||V(b,cd," ")}})}
130
- function Qc(a,b){I(b,()=>{var c=b._compositionKey;D(null);if(null!==c&&""===a.data){const d=H(c);c=sa(b.getElementByKey(c));null!==c&&w(d)&&La(d,c.nodeValue,null,null,!0)}else Ka(b,a)})}
131
- function Oc(a,b){Vc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)V(b,jd,a);else if(r&&f&&79===c)a.preventDefault(),V(b,ad,!0);else if(13!==c||d){var h=r?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?V(b,kd,a):V(b,$c,!0):27===c?V(b,ld,a):(h=r?d||g||e?!1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?V(b,md,a):(a.preventDefault(),V(b,$c,!1)):
132
- 8===c&&(r?g:f)?(a.preventDefault(),V(b,fd,!0)):46===c&&(r?g:f)?(a.preventDefault(),V(b,fd,!1)):r&&e&&8===c?(a.preventDefault(),V(b,gd,!0)):r&&e&&46===c?(a.preventDefault(),V(b,gd,!1)):66===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"bold")):85===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"underline")):73===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"italic")):9!==c||g||f||e?90===c&&!d&&(r?e:f)?(a.preventDefault(),V(b,hd,void 0)):(h=r?90===c&&e&&d:89===c&&f||90===c&&f&&d,h&&(a.preventDefault(),V(b,id,void 0))):V(b,
133
- nd,a))}else V(b,jd,a);else V(b,od,a);else V(b,pd,a);else V(b,qd,a);else V(b,rd,a)}}function sd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const td=new Map;function ud(){const a=window.getSelection(),b=ra(a.anchorNode);if(null!==b){var c=Ia(b);c=c[c.length-1];var d=c._key,f=td.get(d),e=f||c;e!==b&&Xc(a,e,!1);Xc(a,b,!0);b!==c?td.set(d,b):f&&td.delete(d)}}
134
- function vd(a,b){0===Wc&&a.ownerDocument.addEventListener("selectionchange",ud);Wc++;a.__lexicalEditor=b;const c=sd(a);for(let d=0;d<Tc.length;d++){const [f,e]=Tc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return V(b,wd,h);case "copy":return V(b,zd,h);case "paste":return V(b,dd,h);case "dragstart":return V(b,Ad,h);case "focus":return V(b,Bd,h);case "blur":return V(b,Cd,h);case "drop":return V(b,Dd,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,
135
- g)})}}class Ed extends eb{static getType(){return"linebreak"}static clone(a){return new Ed(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:()=>({conversion:Fd,priority:0})}}}function Fd(){return{node:Dc()}}function Dc(){return new Ed}function va(a){return a instanceof Ed}function Gd(a,b){return b&1?"strong":b&2?"em":"span"}
136
- function Hd(a,b,c,d,f){a=d.classList;d=Oa(f,"base");void 0!==d&&a.add(...d);d=Oa(f,"underlineStrikethrough");let e=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ea)h=ea[l],d=Oa(f,l),void 0!==d&&(c&h?!e||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
137
- function Id(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u200b":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const f=a.length;let e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
138
- class Jd extends eb{static getType(){return"text"}static clone(a){return new Jd(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
139
- (this.getLatest().__detail&2)}hasFormat(a){a=ea[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return ta(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Gd(this,b),f=document.createElement(null===c?d:c);let e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;Id(this.__text,
140
- c,this);a=a.theme.text;void 0!==a&&Hd(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){const d=this.__text;var f=a.__format,e=this.__format,g=f&16?"code":null;const h=e&16?"code":null;var l=Gd(this,f);const k=Gd(this,e);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return f=b.firstChild,null==f&&q(20),a=g=document.createElement(k),Id(d,a,this),c=c.theme.text,void 0!==c&&Hd(k,0,e,a,c),b.replaceChild(g,f),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
141
- l&&q(21));Id(d,l,this);c=c.theme.text;void 0!==c&&f!==e&&Hd(k,f,e,l,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:Kd,priority:0}),b:()=>({conversion:Ld,priority:0}),em:()=>({conversion:Md,priority:0}),i:()=>({conversion:Md,priority:0}),span:()=>({conversion:Nd,priority:0}),strong:()=>({conversion:Md,priority:0}),u:()=>({conversion:Md,priority:0})}}selectionTransform(){}setFormat(a){E();const b=this.getWritable();b.__format=a;return b}setStyle(a){E();
142
- const b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=ea[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){E();const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){E();const a=this.getWritable();a.__detail^=2;return a}setMode(a){E();a=ha[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){E();const b=this.getWritable();b.__text=a;return b}select(a,b){E();const c=K();var d=this.getTextContent();const f=this.__key;"string"===typeof d?(d=
143
- d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(J(c))d=A()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||D(f),c.setTextNodeRange(this,a,this,b);else return Gc(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){E();const f=this.getWritable(),e=f.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=K();d&&J(l)&&(a+=g,l.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);return f.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){E();
112
+ b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);B(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){F();const c=K();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(J(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return vc(d,a,d,b,"element","element");return c}selectStart(){const a=
113
+ this.getFirstDescendant();return B(a)||w(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return B(a)||w(a)?a.select():null!==a?a.selectNext():this.select()}clear(){F();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){F();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){F();const b=this.getWritable();b.__dir=a;return b}setFormat(a){F();this.getWritable().__format=fa[a];return this}setIndent(a){F();
114
+ this.getWritable().__indent=a;return this}splice(a,b,c){F();const d=this.getWritable();var f=d.__key;const e=d.__children,g=c.length;var h=[];for(let l=0;l<g;l++){const k=c[l],m=k.getWritable();k.__key===f&&q(49);ya(m);m.__parent=f;h.push(m.__key)}(c=this.getChildAtIndex(a-1))&&Aa(c);(f=this.getChildAtIndex(a+b))&&Aa(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);if(a.length&&(b=K(),J(b))){const l=new Set(a),k=new Set(h);h=n=>{for(n=n.getNode();n;){const v=n.__key;if(l.has(v)&&!k.has(v))return!0;
115
+ n=n.getParent()}return!1};const {anchor:m,focus:p}=b;h(m)&&yc(m,m.getNode(),this,c,f);h(p)&&yc(p,p.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=H(a[b]),null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||M(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}}
116
+ function B(a){return a instanceof Ec}
117
+ class Fc extends Ec{static getType(){return"root"}static clone(){return new Fc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(70)}getTextContent(a,b){const c=this.__cachedText;return!U&&0!==A()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];B(c)||t(c)||q(46)}return super.append(...a)}toJSON(){return{__children:this.__children,__dir:this.__dir,
118
+ __format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function M(a){return a instanceof Fc}function Tb(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function Gc(){return new Hb(new Map([["root",new Fc]]))}
119
+ class Hb{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=R,d=U,f=T;R=this;U=!0;T=null;try{var b=a();break a}finally{R=c,U=d,T=f}b=void 0}return b}clone(a){a=new Hb(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:J(a)?{anchor:{key:a.anchor.key,offset:a.anchor.offset,
120
+ type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:Sb(a)?{nodes:Array.from(a._nodes),type:"node"}:ic(a)?{anchorCellKey:a.anchorCellKey,focusCellKey:a.focusCellKey,gridKey:a.gridKey,type:"grid"}:null}}}const Hc=Object.freeze({}),Nc=[["keydown",Ic],["compositionstart",Jc],["compositionend",Kc],["input",Lc],["click",Mc],["cut",Hc],["copy",Hc],["dragstart",Hc],["paste",Hc],["focus",Hc],["blur",Hc]];ma?Nc.push(["beforeinput",Oc]):Nc.push(["drop",Hc]);
121
+ let Pc=!1,Qc=0;function Rc(a,b,c){I(b,()=>{if(c){var d=K();if(J(d)&&d.isCollapsed()){"Range"===a.type&&(d.dirty=!0);var f=d.anchor;"text"===f.type?(f=f.getNode(),d.format=f.getFormat()):"element"===f.type&&(d.format=0)}V(b,Sc,void 0)}else Ha(null)})}
122
+ function Mc(a,b){I(b,()=>{const c=K();if(J(c)){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Fa().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}V(b,Tc,a)})}
123
+ function Oc(a,b){const c=a.inputType;if(!("deleteCompositionText"===c||ka&&Sa()))if("insertCompositionText"===c){const d=a.data;d&&I(b,()=>{var f=K();if(J(f)){const e=f.anchor,g=e.getNode(),h=g.getPreviousSibling();0===e.offset&&w(g)&&w(h)&&" "===g.getTextContent()&&h.getFormat()!==f.format&&(f=h.getTextContent(),0===d.indexOf(f)&&(f=d.slice(f.length),V(b,Uc,f),setTimeout(()=>{I(b,()=>{g.select()})},20)))}})}else I(b,()=>{const d=K();if(J(d))if("deleteContentBackward"===c)C(null),a.preventDefault(),
124
+ V(b,Vc,!0);else{var f=a.data;if(!d.dirty&&d.isCollapsed()&&!M(d.anchor.getNode())&&a.getTargetRanges){var e=a.getTargetRanges()[0];e&&d.applyDOMRange(e)}var g=d.focus;e=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),V(b,Wc,void 0)):"\n\n"===f?(a.preventDefault(),V(b,Xc,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Na(d,f,!0)&&(a.preventDefault(),V(b,Uc,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,
125
+ Uc,a);break;case "insertFromComposition":C(null);V(b,Uc,a);break;case "insertLineBreak":C(null);V(b,Wc,void 0);break;case "insertParagraph":C(null);V(b,Xc,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,Yc,a);break;case "deleteByComposition":e===g&&!B(e)&&!B(g)&&u(e)&&u(g)||V(b,Zc,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,Zc,void 0);break;case "deleteContent":V(b,Vc,!1);break;case "deleteWordBackward":V(b,$c,!0);break;case "deleteWordForward":V(b,$c,!1);break;
126
+ case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,ad,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,ad,!1);break;case "formatStrikeThrough":V(b,Z,"strikethrough");break;case "formatBold":V(b,Z,"bold");break;case "formatItalic":V(b,Z,"italic");break;case "formatUnderline":V(b,Z,"underline");break;case "historyUndo":V(b,bd,void 0);break;case "historyRedo":V(b,cd,void 0)}}})}
127
+ function Lc(a,b){a.stopPropagation();I(b,()=>{var c=K();const d=a.data;null!=d&&J(c)&&Na(c,d,!1)?V(b,Uc,d):Ka(b,null);F();c=A();$b(c)})}function Jc(a,b){I(b,()=>{const c=K();if(J(c)&&!b.isComposing()){const d=c.anchor;C(d.key);Pc&&"element"!==d.type&&c.isCollapsed()&&c.anchor.getNode().getFormat()===c.format||V(b,Uc," ")}})}
128
+ function Kc(a,b){I(b,()=>{var c=b._compositionKey;C(null);if(null!==c&&""===a.data){const d=H(c);c=ta(b.getElementByKey(c));null!==c&&w(d)&&La(d,c.nodeValue,null,null,!0)}else Ka(b,a)})}
129
+ function Ic(a,b){Pc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)V(b,dd,a);else if(r&&f&&79===c)a.preventDefault(),V(b,Wc,!0);else if(13!==c||d){var h=r?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?V(b,ed,a):V(b,Vc,!0):27===c?V(b,fd,a):(h=r?d||g||e?!1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?V(b,gd,a):(a.preventDefault(),V(b,Vc,!1)):
130
+ 8===c&&(r?g:f)?(a.preventDefault(),V(b,$c,!0)):46===c&&(r?g:f)?(a.preventDefault(),V(b,$c,!1)):r&&e&&8===c?(a.preventDefault(),V(b,ad,!0)):r&&e&&46===c?(a.preventDefault(),V(b,ad,!1)):66===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"bold")):85===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"underline")):73===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"italic")):9!==c||g||f||e?90===c&&!d&&(r?e:f)?(a.preventDefault(),V(b,bd,void 0)):(h=r?90===c&&e&&d:89===c&&f||90===c&&f&&d,h&&(a.preventDefault(),V(b,cd,void 0))):V(b,
131
+ hd,a))}else V(b,dd,a);else V(b,id,a);else V(b,jd,a);else V(b,kd,a);else V(b,ld,a)}}function md(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const nd=new Map;function od(){const a=window.getSelection(),b=sa(a.anchorNode);if(null!==b){var c=Ja(b);c=c[c.length-1];var d=c._key,f=nd.get(d),e=f||c;e!==b&&Rc(a,e,!1);Rc(a,b,!0);b!==c?nd.set(d,b):f&&nd.delete(d)}}
132
+ function pd(a,b){0===Qc&&a.ownerDocument.addEventListener("selectionchange",od);Qc++;a.__lexicalEditor=b;const c=md(a);for(let d=0;d<Nc.length;d++){const [f,e]=Nc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return V(b,qd,h);case "copy":return V(b,rd,h);case "paste":return V(b,Yc,h);case "dragstart":return V(b,ud,h);case "focus":return V(b,vd,h);case "blur":return V(b,wd,h);case "drop":return V(b,xd,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,
133
+ g)})}}class yd extends Cc{static getType(){return"linebreak"}static clone(a){return new yd(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:()=>({conversion:zd,priority:0})}}}function zd(){return{node:sc()}}function sc(){return new yd}function wa(a){return a instanceof yd}function Ad(a,b){return b&1?"strong":b&2?"em":"span"}
134
+ function Bd(a,b,c,d,f){a=d.classList;d=Oa(f,"base");void 0!==d&&a.add(...d);d=Oa(f,"underlineStrikethrough");let e=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ea)h=ea[l],d=Oa(f,l),void 0!==d&&(c&h?!e||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
135
+ function Cd(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u200b":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const f=a.length;let e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
136
+ class Dd extends Cc{static getType(){return"text"}static clone(a){return new Dd(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
137
+ (this.getLatest().__detail&2)}hasFormat(a){a=ea[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return ua(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Ad(this,b),f=document.createElement(null===c?d:c);let e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;Cd(this.__text,
138
+ c,this);a=a.theme.text;void 0!==a&&Bd(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){const d=this.__text;var f=a.__format,e=this.__format,g=f&16?"code":null;const h=e&16?"code":null;var l=Ad(this,f);const k=Ad(this,e);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return f=b.firstChild,null==f&&q(20),a=g=document.createElement(k),Cd(d,a,this),c=c.theme.text,void 0!==c&&Bd(k,0,e,a,c),b.replaceChild(g,f),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
139
+ l&&q(21));Cd(d,l,this);c=c.theme.text;void 0!==c&&f!==e&&Bd(k,f,e,l,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:Ed,priority:0}),b:()=>({conversion:Fd,priority:0}),em:()=>({conversion:Gd,priority:0}),i:()=>({conversion:Gd,priority:0}),span:()=>({conversion:Hd,priority:0}),strong:()=>({conversion:Gd,priority:0}),u:()=>({conversion:Gd,priority:0})}}selectionTransform(){}setFormat(a){F();const b=this.getWritable();b.__format=a;return b}setStyle(a){F();
140
+ const b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=ea[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){F();const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){F();const a=this.getWritable();a.__detail^=2;return a}setMode(a){F();a=ha[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){F();const b=this.getWritable();b.__text=a;return b}select(a,b){F();const c=K();var d=this.getTextContent();const f=this.__key;"string"===typeof d?(d=
141
+ d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(J(c))d=A()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||C(f),c.setTextNodeRange(this,a,this,b);else return vc(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){F();const f=this.getWritable(),e=f.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=K();d&&J(l)&&(a+=g,l.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);return f.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){F();
144
142
  var b=this.getLatest(),c=b.getTextContent(),d=b.__key,f=A()._compositionKey,e=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&e.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);e=a.length;if(0===e)return[];if(a[0]===c)return[b];var k=a[0];c=b.getParentOrThrow();l=c.__key;const m=b.getFormat(),p=b.getStyle(),n=b.__detail;g=!1;b.isSegmented()?(h=L(k),h.__parent=l,h.__format=m,h.__style=p,h.__detail=n,g=!0):(h=b.getWritable(),h.__text=k);b=K();h=[h];k=k.length;for(let y=1;y<e;y++){var v=
145
- a[y],C=v.length;v=L(v).getWritable();v.__format=m;v.__style=p;v.__detail=n;const F=v.__key;C=k+C;if(J(b)){const x=b.anchor,G=b.focus;x.key===d&&"text"===x.type&&x.offset>k&&x.offset<=C&&(x.key=F,x.offset-=k,b.dirty=!0);G.key===d&&"text"===G.type&&G.offset>k&&G.offset<=C&&(G.key=F,G.offset-=k,b.dirty=!0)}f===d&&D(F);k=C;v.__parent=l;h.push(v)}ya(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);J(b)&&cb(b,c,d,e-1);return h}mergeWithSibling(a){const b=
146
- a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,f=this.__text,e=f.length;A()._compositionKey===d&&D(c);const g=K();if(J(g)){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(Jc(h,b,c,a,e),g.dirty=!0);null!==l&&l.key===d&&(Jc(l,b,c,a,e),g.dirty=!0)}this.setTextContent(b?a.__text+f:f+a.__text);a.remove();return this.getLatest()}isTextEntity(){return!1}}
147
- function Nd(a){const b="700"===a.style.fontWeight;return{forChild:c=>{w(c)&&b&&c.toggleFormat("bold");return c},node:null}}function Ld(a){const b="normal"===a.style.fontWeight;return{forChild:c=>{w(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Kd(a){return{node:L(a.textContent)}}const Od={em:"italic",i:"italic",strong:"bold",u:"underline"};function Md(a){const b=Od[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{w(c)&&c.toggleFormat(b);return c},node:null}}
148
- function L(a=""){return new Jd(a)}function w(a){return a instanceof Jd}
149
- class Pd extends Kc{static getType(){return"paragraph"}static clone(a){return new Pd(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Oa(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Qd,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}insertNewAfter(){const a=pc(),b=this.getDirection();
150
- a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||w(a[0])&&""===a[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 Qd(){return{node:pc()}}function pc(){return new Pd}
151
- function Wb(a,b,c,d){const f=a._keyToDOMMap;f.clear();a._editorState=Mc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
152
- function Rd(a){const b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM;if(!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
153
- class Sd{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
154
- new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+na++;this._onError=f;this._htmlConversions=e;this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){const b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){const b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){const b=this._listeners.decorator;b.add(a);return()=>
143
+ a[y],D=v.length;v=L(v).getWritable();v.__format=m;v.__style=p;v.__detail=n;const E=v.__key;D=k+D;if(J(b)){const x=b.anchor,G=b.focus;x.key===d&&"text"===x.type&&x.offset>k&&x.offset<=D&&(x.key=E,x.offset-=k,b.dirty=!0);G.key===d&&"text"===G.type&&G.offset>k&&G.offset<=D&&(G.key=E,G.offset-=k,b.dirty=!0)}f===d&&C(E);k=D;v.__parent=l;h.push(v)}za(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);J(b)&&wc(b,c,d,e-1);return h}mergeWithSibling(a){const b=
144
+ a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,f=this.__text,e=f.length;A()._compositionKey===d&&C(c);const g=K();if(J(g)){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(zc(h,b,c,a,e),g.dirty=!0);null!==l&&l.key===d&&(zc(l,b,c,a,e),g.dirty=!0)}this.setTextContent(b?a.__text+f:f+a.__text);a.remove();return this.getLatest()}isTextEntity(){return!1}}
145
+ function Hd(a){const b="700"===a.style.fontWeight;return{forChild:c=>{w(c)&&b&&c.toggleFormat("bold");return c},node:null}}function Fd(a){const b="normal"===a.style.fontWeight;return{forChild:c=>{w(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ed(a){return{node:L(a.textContent)}}const Id={em:"italic",i:"italic",strong:"bold",u:"underline"};function Gd(a){const b=Id[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{w(c)&&c.toggleFormat(b);return c},node:null}}
146
+ function L(a=""){return new Dd(a)}function w(a){return a instanceof Dd}
147
+ class Jd extends Ec{static getType(){return"paragraph"}static clone(a){return new Jd(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Oa(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Kd,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}insertNewAfter(){const a=ec(),b=this.getDirection();
148
+ a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||w(a[0])&&""===a[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 Kd(){return{node:ec()}}function ec(){return new Jd}
149
+ function Lb(a,b,c,d){const f=a._keyToDOMMap;f.clear();a._editorState=Gc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
150
+ function Ld(a){const b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM;if(!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
151
+ function bb(a){var b=a||{},c=b.namespace||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Gc();a=b.editorState;const l=[Fc,Dd,yd,Jd,...(b.nodes||[])],k=b.onError;b=b.readOnly||!1;const m=new Map;for(let p=0;p<l.length;p++){const n=l[p],v=n.getType();m.set(v,{klass:n,transforms:new Set})}c=new Md(h,e,m,{context:f,disableEvents:g,namespace:c,theme:d},k,Ld(m),b);void 0!==a&&(c._pendingEditorState=a,c._dirtyType=
152
+ 2);return c}
153
+ class Md{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
154
+ new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+oa++;this._onError=f;this._htmlConversions=e;this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){const b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){const b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){const b=this._listeners.decorator;b.add(a);return()=>
155
155
  {b.delete(a)}}registerTextContentListener(a){const b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){const b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&q(56);const d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);const f=d.get(a);void 0===f&&q(81,a);const e=f[c];e.add(b);return()=>{e.delete(b);f.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
156
- b){void 0===this._nodes.get(a.getType())&&q(57,a.name);const c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const f=d.transforms;f.add(b);Fa(this,c);return()=>{f.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}setRootElement(a){const b=
157
- this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Wb(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Wc&&(Wc--,0===Wc&&b.ownerDocument.removeEventListener("selectionchange",ud));c=b.__lexicalEditor;if(null!=c){if(null!==c._parentEditor){var d=Ia(c);d=d[d.length-1]._key;td.get(d)===c&&td.delete(d)}else td.delete(c._key);b.__lexicalEditor=null}c=sd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect=
158
- "text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Xb(this),this._updateTags.add("history-merge"),Ub(this),this._config.disableEvents||vd(a,this));Yb("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);lc(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
159
- Ub(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Ub(this)}parseEditorState(a){a=JSON.parse(a);var b=new Map;b=new ac(b);const c={originalSelection:a._selection},d=U,f=T;S=b;U=!1;T=this;try{const e=new Map(a._nodeMap),g=e.get("root");pb(g,e,this,null,c)}finally{S=b,U=d,T=f}b._selection=Hc(c.remappedSelection||c.originalSelection);return b}update(a,b){I(this,a,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),I(this,
160
- ()=>{const c=K(),d=Ea();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly=a;Yb("readonly",this,!0,a)}}class Td extends Kc{constructor(a,b){super(b)}}function Bc(a){return a instanceof Td}class Ud extends Kc{}function uc(a){return a instanceof Ud}
161
- class Vd extends Kc{}function Ac(a){return a instanceof Vd}const Yc={},Zc={},$c={},ad={},bd={},cd={},dd={},ed={},fd={},gd={},Z={},hd={},id={},rd={},qd={},pd={},od={},jd={},kd={},ld={},md={},nd={},Dd={},Ad={},zd={},wd={},Bd={},Cd={};exports.$createGridSelection=function(){return new sc("root","root","root")};exports.$createLineBreakNode=Dc;exports.$createNodeFromParse=function(a,b){E();const c=A();return pb(a,b,c,null)};exports.$createNodeSelection=function(){return new qc(new Set)};
162
- exports.$createParagraphNode=pc;exports.$createRangeSelection=function(){const a=X("root",0,"element"),b=X("root",0,"element");return new rc(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=Ra;exports.$getNearestNodeFromDOMNode=qa;exports.$getNodeByKey=H;exports.$getPreviousSelection=Ma;exports.$getRoot=Ea;exports.$getSelection=K;exports.$isDecoratorNode=t;exports.$isElementNode=B;exports.$isGridCellNode=Bc;exports.$isGridNode=uc;exports.$isGridRowNode=Ac;exports.$isGridSelection=tc;
163
- exports.$isLeafNode=ua;exports.$isLineBreakNode=va;exports.$isNodeSelection=dc;exports.$isParagraphNode=function(a){return a instanceof Pd};exports.$isRangeSelection=J;exports.$isRootNode=M;exports.$isTextNode=w;exports.$nodesOfType=function(a){var b=z();const c=b._readOnly,d=a.getType();b=b._nodeMap;const f=[];for(const [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$setCompositionKey=D;exports.$setSelection=Ga;exports.BLUR_COMMAND=Cd;
164
- exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Zc;exports.COPY_COMMAND=zd;exports.CUT_COMMAND=wd;exports.DELETE_CHARACTER_COMMAND=$c;exports.DELETE_LINE_COMMAND=gd;exports.DELETE_WORD_COMMAND=fd;exports.DRAGSTART_COMMAND=Ad;exports.DROP_COMMAND=Dd;exports.DecoratorNode=mb;exports.ElementNode=Kc;exports.FOCUS_COMMAND=Bd;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=Z;
165
- exports.GridCellNode=Td;exports.GridNode=Ud;exports.GridRowNode=Vd;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ad;exports.INSERT_PARAGRAPH_COMMAND=bd;exports.INSERT_TEXT_COMMAND=cd;exports.KEY_ARROW_DOWN_COMMAND=od;exports.KEY_ARROW_LEFT_COMMAND=qd;exports.KEY_ARROW_RIGHT_COMMAND=rd;exports.KEY_ARROW_UP_COMMAND=pd;exports.KEY_BACKSPACE_COMMAND=kd;exports.KEY_DELETE_COMMAND=md;exports.KEY_ENTER_COMMAND=jd;exports.KEY_ESCAPE_COMMAND=ld;exports.KEY_TAB_COMMAND=nd;
166
- exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=dd;exports.ParagraphNode=Pd;exports.READ_ONLY_COMMAND={};exports.REDO_COMMAND=id;exports.REMOVE_TEXT_COMMAND=ed;exports.SELECTION_CHANGE_COMMAND=Yc;exports.TextNode=Jd;exports.UNDO_COMMAND=hd;exports.VERSION="0.1.21";exports.createCommand=function(){return{}};exports.createDecoratorArray=lb;exports.createDecoratorEditor=hb;exports.createDecoratorMap=jb;
167
- exports.createEditor=function(a){var b=a||{},c=b.namespace||Ja();const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Mc();a=b.editorState;const l=[Lc,Jd,Ed,Pd,...(b.nodes||[])],k=b.onError;b=b.readOnly||!1;const m=new Map;for(let p=0;p<l.length;p++){const n=l[p],v=n.getType();m.set(v,{klass:n,transforms:new Set})}c=new Sd(h,e,m,{context:f,disableEvents:g,namespace:c,theme:d},k,Rd(m),b);void 0!==a&&(c._pendingEditorState=a,c._dirtyType=2);return c};
168
- exports.isDecoratorArray=function(a){return a instanceof kb};exports.isDecoratorEditor=function(a){return a instanceof gb};exports.isDecoratorMap=function(a){return a instanceof ib};
156
+ b){void 0===this._nodes.get(a.getType())&&q(57,a.name);const c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const f=d.transforms;f.add(b);Ga(this,c);return()=>{f.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){const b=
157
+ this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Lb(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Qc&&(Qc--,0===Qc&&b.ownerDocument.removeEventListener("selectionchange",od));c=b.__lexicalEditor;if(null!=c){if(null!==c._parentEditor){var d=Ja(c);d=d[d.length-1]._key;nd.get(d)===c&&nd.delete(d)}else nd.delete(c._key);b.__lexicalEditor=null}c=md(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect=
158
+ "text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Mb(this),this._updateTags.add("history-merge"),Jb(this),this._config.disableEvents||pd(a,this));Nb("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);$b(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
159
+ Jb(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Jb(this)}parseEditorState(a){a=JSON.parse(a);return cb(a,this)}update(a,b){I(this,a,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),I(this,()=>{const c=K(),d=Fa();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==
160
+ a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly=a;Nb("readonly",this,!0,a)}toJSON(){return{editorState:this._editorState}}}class Nd extends Ec{constructor(a,b){super(b)}}function qc(a){return a instanceof Nd}class Od extends Ec{}function jc(a){return a instanceof Od}class Pd extends Ec{}function kc(a){return a instanceof Pd}
161
+ const Sc={},Tc={},Vc={},Wc={},Xc={},Uc={},Yc={},Zc={},$c={},ad={},Z={},bd={},cd={},ld={},kd={},jd={},id={},dd={},ed={},fd={},gd={},hd={},xd={},ud={},rd={},qd={},vd={},wd={};exports.$createGridSelection=function(){return new hc("root","root","root")};exports.$createLineBreakNode=sc;exports.$createNodeFromParse=function(a,b){F();const c=A();return ab(a,b,c,null)};exports.$createNodeSelection=function(){return new fc(new Set)};exports.$createParagraphNode=ec;
162
+ exports.$createRangeSelection=function(){const a=X("root",0,"element"),b=X("root",0,"element");return new gc(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=Ra;exports.$getNearestNodeFromDOMNode=ra;exports.$getNodeByKey=H;exports.$getPreviousSelection=Ma;exports.$getRoot=Fa;exports.$getSelection=K;exports.$isDecoratorNode=t;exports.$isElementNode=B;exports.$isGridCellNode=qc;exports.$isGridNode=jc;exports.$isGridRowNode=kc;exports.$isGridSelection=ic;exports.$isLeafNode=va;
163
+ exports.$isLineBreakNode=wa;exports.$isNodeSelection=Sb;exports.$isParagraphNode=function(a){return a instanceof Jd};exports.$isRangeSelection=J;exports.$isRootNode=M;exports.$isTextNode=w;exports.$nodesOfType=function(a){var b=z();const c=b._readOnly,d=a.getType();b=b._nodeMap;const f=[];for(const [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$setCompositionKey=C;exports.$setSelection=Ha;exports.BLUR_COMMAND=wd;exports.CAN_REDO_COMMAND={};
164
+ exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Tc;exports.COPY_COMMAND=rd;exports.CUT_COMMAND=qd;exports.DELETE_CHARACTER_COMMAND=Vc;exports.DELETE_LINE_COMMAND=ad;exports.DELETE_WORD_COMMAND=$c;exports.DRAGSTART_COMMAND=ud;exports.DROP_COMMAND=xd;exports.DecoratorNode=Dc;exports.ElementNode=Ec;exports.FOCUS_COMMAND=vd;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=Z;exports.GridCellNode=Nd;exports.GridNode=Od;
165
+ exports.GridRowNode=Pd;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=Wc;exports.INSERT_PARAGRAPH_COMMAND=Xc;exports.INSERT_TEXT_COMMAND=Uc;exports.KEY_ARROW_DOWN_COMMAND=id;exports.KEY_ARROW_LEFT_COMMAND=kd;exports.KEY_ARROW_RIGHT_COMMAND=ld;exports.KEY_ARROW_UP_COMMAND=jd;exports.KEY_BACKSPACE_COMMAND=ed;exports.KEY_DELETE_COMMAND=gd;exports.KEY_ENTER_COMMAND=dd;exports.KEY_ESCAPE_COMMAND=fd;exports.KEY_TAB_COMMAND=hd;exports.OUTDENT_CONTENT_COMMAND={};
166
+ exports.PASTE_COMMAND=Yc;exports.ParagraphNode=Jd;exports.READ_ONLY_COMMAND={};exports.REDO_COMMAND=cd;exports.REMOVE_TEXT_COMMAND=Zc;exports.SELECTION_CHANGE_COMMAND=Sc;exports.TextNode=Dd;exports.UNDO_COMMAND=bd;exports.VERSION="0.2.0";exports.createCommand=function(){return{}};exports.createEditor=bb;