lexical 0.7.3 → 0.7.5

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.dev.js CHANGED
@@ -6,8 +6,6 @@
6
6
  */
7
7
  'use strict';
8
8
 
9
- var lexical = require('lexical');
10
-
11
9
  /**
12
10
  * Copyright (c) Meta Platforms, Inc. and affiliates.
13
11
  *
@@ -455,8 +453,14 @@ function $isSelectionCapturedInDecorator(node) {
455
453
  }
456
454
  function isSelectionCapturedInDecoratorInput(anchorDOM) {
457
455
  const activeElement = document.activeElement;
458
- const nodeName = activeElement !== null ? activeElement.nodeName : null;
459
- return $isDecoratorNode($getNearestNodeFromDOMNode(anchorDOM)) && (nodeName === 'INPUT' || nodeName === 'TEXTAREA');
456
+
457
+ if (activeElement === null) {
458
+ return false;
459
+ }
460
+
461
+ const nodeName = activeElement.nodeName;
462
+ return $isDecoratorNode($getNearestNodeFromDOMNode(anchorDOM)) && (nodeName === 'INPUT' || nodeName === 'TEXTAREA' || activeElement.contentEditable === 'true' && // @ts-ignore iternal field
463
+ activeElement.__lexicalEditor == null);
460
464
  }
461
465
  function isSelectionWithinEditor(editor, anchorDOM, focusDOM) {
462
466
  const rootElement = editor.getRootElement();
@@ -5790,27 +5794,27 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
5790
5794
  if (anchor.type !== 'element') {
5791
5795
  return;
5792
5796
  }
5793
- }
5797
+ } // Apply the updated selection to the DOM. Note: this will trigger
5798
+ // a "selectionchange" event, although it will be asynchronous.
5794
5799
 
5795
- if (!tags.has('skip-scroll-into-view')) // Apply the updated selection to the DOM. Note: this will trigger
5796
- // a "selectionchange" event, although it will be asynchronous.
5797
- try {
5798
- // When updating more than 1000 nodes on Chrome, it's actually better to defer
5799
- // updating the selection till the next frame. This is because Chrome's
5800
- // Blink engine has hard limit on how many DOM nodes it can redraw in
5801
- // a single cycle, so keeping it to the next frame improves performance.
5802
- // The downside is that is makes the computation within Lexical more
5803
- // complex, as now, we've sync update the DOM, but selection no longer
5804
- // matches.
5805
- if (IS_CHROME && nodeCount > 1000) {
5806
- window.requestAnimationFrame(() => domSelection.setBaseAndExtent(nextAnchorNode, nextAnchorOffset, nextFocusNode, nextFocusOffset));
5807
- } else {
5808
- domSelection.setBaseAndExtent(nextAnchorNode, nextAnchorOffset, nextFocusNode, nextFocusOffset);
5809
- }
5810
- } catch (error) {// If we encounter an error, continue. This can sometimes
5811
- // occur with FF and there's no good reason as to why it
5812
- // should happen.
5800
+
5801
+ try {
5802
+ // When updating more than 1000 nodes on Chrome, it's actually better to defer
5803
+ // updating the selection till the next frame. This is because Chrome's
5804
+ // Blink engine has hard limit on how many DOM nodes it can redraw in
5805
+ // a single cycle, so keeping it to the next frame improves performance.
5806
+ // The downside is that is makes the computation within Lexical more
5807
+ // complex, as now, we've sync update the DOM, but selection no longer
5808
+ // matches.
5809
+ if (IS_CHROME && nodeCount > 1000) {
5810
+ window.requestAnimationFrame(() => domSelection.setBaseAndExtent(nextAnchorNode, nextAnchorOffset, nextFocusNode, nextFocusOffset));
5811
+ } else {
5812
+ domSelection.setBaseAndExtent(nextAnchorNode, nextAnchorOffset, nextFocusNode, nextFocusOffset);
5813
5813
  }
5814
+ } catch (error) {// If we encounter an error, continue. This can sometimes
5815
+ // occur with FF and there's no good reason as to why it
5816
+ // should happen.
5817
+ }
5814
5818
 
5815
5819
  if (!tags.has('skip-scroll-into-view') && nextSelection.isCollapsed() && rootElement !== null && rootElement === document.activeElement) {
5816
5820
  const selectionTarget = nextSelection instanceof RangeSelection && nextSelection.anchor.type === 'element' ? nextAnchorNode.childNodes[nextAnchorOffset] || null : domSelection.rangeCount > 0 ? domSelection.getRangeAt(0) : null;
@@ -6281,6 +6285,10 @@ function commitPendingUpdates(editor) {
6281
6285
  if (mutatedNodes !== null) {
6282
6286
  triggerMutationListeners(editor, currentEditorState, pendingEditorState, mutatedNodes, tags, dirtyLeaves);
6283
6287
  }
6288
+
6289
+ if (!$isRangeSelection(pendingSelection) && pendingSelection !== null && (currentSelection === null || !currentSelection.is(pendingSelection))) {
6290
+ editor.dispatchCommand(SELECTION_CHANGE_COMMAND, undefined);
6291
+ }
6284
6292
  /**
6285
6293
  * Capture pendingDecorators after garbage collecting detached decorators
6286
6294
  */
@@ -7202,7 +7210,7 @@ class LexicalNode {
7202
7210
  const prevKey = self.__prev;
7203
7211
  const nextKey = self.__next;
7204
7212
  const parentKey = self.__parent;
7205
- removeNode(self, false);
7213
+ removeNode(self, false, true);
7206
7214
 
7207
7215
  if (prevSibling === null) {
7208
7216
  writableParent.__first = key;
@@ -9131,7 +9139,7 @@ function convertSpanElement(domNode) {
9131
9139
 
9132
9140
  function convertLineBreakToElement() {
9133
9141
  return {
9134
- node: lexical.$createLineBreakNode()
9142
+ node: $createLineBreakNode()
9135
9143
  };
9136
9144
  }
9137
9145
 
@@ -9191,7 +9199,7 @@ function convertTextFormatElement(domNode) {
9191
9199
 
9192
9200
  return {
9193
9201
  forChild: lexicalNode => {
9194
- if ($isTextNode(lexicalNode)) {
9202
+ if ($isTextNode(lexicalNode) && !lexicalNode.hasFormat(format)) {
9195
9203
  lexicalNode.toggleFormat(format);
9196
9204
  }
9197
9205
 
package/Lexical.prod.js CHANGED
@@ -4,196 +4,196 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var ba=require("lexical");let ca={},ea={},fa={},ha={},ia={},ja={},ka={},ma={},na={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={};function q(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
- let Oa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Pa=Oa&&"documentMode"in document?document.documentMode:null,t=Oa&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qa=Oa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ra=Oa&&"InputEvent"in window&&!Pa?"getTargetRanges"in new window.InputEvent("input"):!1,Sa=Oa&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ta=Oa&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
- !window.MSStream,Wa=Oa&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xa=Sa||Ta?"\u00a0":"\u200b",Ya=Qa?"\u00a0":Xa,Za=/^[^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]/,$a=/^[^\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]/,ab={bold:1,code:16,italic:2,strikethrough:4,subscript:32,
10
- superscript:64,underline:8},bb={directionless:1,unmergeable:2},cb={center:2,end:6,justify:4,left:1,right:3,start:5},db={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},eb={normal:0,segmented:2,token:1},fb={0:"normal",2:"segmented",1:"token"},gb=!1,hb=0;function ib(a){hb=a.timeStamp}function jb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function kb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
11
- function lb(a,b,c){gb=!0;let d=100<performance.now()-hb;try{v(a,()=>{let e=u()||kb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let l=!1,m="";for(var p=0;p<b.length;p++){var n=b[p],r=n.type,w=n.target,y=mb(w,h);if(!(null===y&&w!==g||z(y)))if("characterData"===r){if(n=d&&B(y))a:{n=e;r=w;var x=y;if(C(n)){var A=n.anchor.getNode();if(A.is(x)&&n.format!==A.getFormat()){n=!1;break a}}n=3===r.nodeType&&x.isAttached()}n&&(x=E(a._window),r=n=null,null!==x&&x.anchorNode===
12
- w&&(n=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&nb(y,w,n,r,!1))}else if("childList"===r){l=!0;r=n.addedNodes;for(x=0;x<r.length;x++){A=r[x];var U=ob(A),J=A.parentNode;null==J||A===k||null!==U||"BR"===A.nodeName&&jb(A,J,a)||(Qa&&(U=A.innerText||A.nodeValue)&&(m+=U),J.removeChild(A))}n=n.removedNodes;r=n.length;if(0<r){x=0;for(A=0;A<r;A++)if(J=n[A],"BR"===J.nodeName&&jb(J,w,a)||k===J)w.appendChild(J),x++;r!==x&&(w===g&&(y=h._nodeMap.get("root")),f.set(w,y))}}}if(0<f.size)for(let [da,N]of f)if(F(N))for(f=
13
- N.getChildrenKeys(),g=da.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(da.appendChild(k),g=k):g!==k&&da.replaceChild(k,g),g=g.nextSibling);else B(N)&&N.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)y=h[p],w=y.parentNode,null==w||"BR"!==y.nodeName||jb(y,k,a)||w.removeChild(y);c.takeRecords()}null!==e&&(l&&(e.dirty=!0,pb(e)),Qa&&qb(a)&&e.insertRawText(m))})}finally{gb=!1}}
14
- function rb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();lb(a,c,b)}}function sb(a){0===hb&&ub(a).addEventListener("textInput",ib,!0);a._observer=new MutationObserver((b,c)=>{lb(a,b,c)})}let vb=1,wb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function xb(a){var b=document.activeElement;b=null!==b?b.nodeName:null;return z(mb(a))&&("INPUT"===b||"TEXTAREA"===b)}
15
- function yb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!xb(b)&&zb(b)===a}catch(e){return!1}}function zb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Ab(a)}return null}function Bb(a){return a.isToken()||a.isSegmented()}function Cb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Db(a,b,c){b=ab[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Eb(a){return B(a)||Fb(a)||z(a)}
16
- function Gb(a,b){if(null!=b)a.__key=b;else{G();99<Hb&&q(14);b=H();var c=I(),d=""+vb++;c._nodeMap.set(d,a);F(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
17
- function Ib(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
18
- a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Jb(a){99<Hb&&q(14);var b=a.getLatest(),c=b.__parent,d=I();let e=H(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;F(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
19
- function K(a){G();var b=H();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function Kb(){return Lb()?null:H()._compositionKey}function L(a,b){a=(b||I())._nodeMap.get(a);return void 0===a?null:a}function ob(a,b){let c=H();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function mb(a,b){for(;null!=a;){let c=ob(a,b);if(null!==c)return c;a=Ab(a)}return null}
20
- function Mb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Nb(a){return a.read(()=>Ob().getTextContent())}function Pb(a,b){v(a,()=>{var c=I();if(!c.isEmpty())if("root"===b)Ob().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ob(){return I()._nodeMap.get("root")}function pb(a){G();let b=I();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
21
- function Qb(a){var b=H(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Ab(c)}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Rb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Sb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Tb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
22
- function Ub(a,b,c){b=E(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=mb(d),null!==b&&B(d))){if(b===Xa&&c){let g=c.length;b=c;f=e=g}null!==b&&nb(d,b,e,f,a)}}}
23
- function nb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Xa&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Sa||Ta)f.remove();else{let h=H();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Vb(),f.isToken()||null!==Kb()&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
24
- (c=f.getTextContent(),c=M(c),f.replace(c),f=c)),f.setTextContent(a))}}function Wb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||F(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
25
- function Xb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Yb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&q(33),d=b.klass,b=a.get(d),void 0===b&&(b=new Map,a.set(d,b)),a=b.get(c),d="destroyed"===a&&"created"===e,(void 0===a||d)&&b.set(c,d?"updated":e))}function Zb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
26
- function $b(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Zb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Zb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function qb(a){a=(a=ub(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function ac(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
27
- function bc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function Ab(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}
28
- function cc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=ub(a).innerHeight}else{var l=b.getBoundingClientRect();h=l.top;k=l.bottom}l=0;f<h?l=-(h-f):g>k&&(l=g-k);0!==l&&(c?e.scrollBy(0,l):(h=b.scrollTop,b.scrollTop+=l,h=b.scrollTop-h,f-=h,g-=h));if(c)break;b=Ab(b)}}}
29
- function dc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!F(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();ec(e,a)&&c.set(a.__key,0,"element");ec(f,a)&&d.set(a.__key,0,"element");return b}function ec(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function ub(a){a=a._window;null===a&&q(78);return a}function fc(a){for(a=a.getParentOrThrow();null!==a&&!gc(a);)a=a.getParentOrThrow();return a}function gc(a){return O(a)||F(a)&&a.isShadowRoot()}
30
- function hc(a){var b=H();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function ic(a,b){a=a.getParent();if(O(a)&&!F(b)&&!z(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}function kc(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}function lc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}
31
- function E(a){return Oa?(a||window).getSelection():null}function mc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&mc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}
32
- function nc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(F(c)&&mc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}function oc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}
33
- function pc(a,b){let c=a.mergeWithSibling(b),d=H()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function qc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{oc(b,a)&&(a=pc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{oc(a,c)&&pc(a,c);break}}}
34
- function rc(a){sc(a.anchor);sc(a.focus);return a}function sc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",tc,S,uc,vc=!1,wc=!1,xc,yc=null,zc,Ac,Bc,Cc,Dc,Ec;
35
- function Fc(a,b){let c=Bc.get(a);if(null!==b){let d=Gc(a);d.parentNode===b&&b.removeChild(d)}Cc.has(a)||S._keyToDOMMap.delete(a);F(c)&&(a=Hc(c,Bc),Ic(a,0,a.length-1,null));void 0!==c&&Yb(Ec,uc,xc,c,"destroyed")}function Ic(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Fc(e,d)}}function Jc(a,b){a.setProperty("text-align",b)}function Kc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
36
- function Lc(a,b){a=a.style;0===b?Jc(a,""):1===b?Jc(a,"left"):2===b?Jc(a,"center"):3===b?Jc(a,"right"):4===b?Jc(a,"justify"):5===b?Jc(a,"start"):6===b&&Jc(a,"end")}
37
- function Mc(a,b,c){let d=Cc.get(a);void 0===d&&q(60);let e=d.createDOM(tc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(F(d)){a=d.__indent;f=d.__size;0!==a&&Kc(e,a);if(0!==f){--f;a=Hc(d,Cc);var g=Q;Q="";Nc(a,0,f,e,null);Oc(d,e);Q=g}a=d.__format;0!==a&&Lc(e,a);d.isInline()||Pc(null,d,e);ac(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(S,tc),null!==g&&Qc(a,
38
- g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Yb(Ec,uc,xc,d,"created");return e}function Nc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Mc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Rc(a,b){a=b.get(a);return Fb(a)||z(a)&&a.isInline()}
39
- function Pc(a,b,c){a=null!==a&&(0===a.__size||Rc(a.__last,Bc));b=0===b.__size||Rc(b.__last,Cc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
40
- function Oc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==yc){let f=""===Q;if(f)var d=yc;else d=Q,d=Za.test(d)?"rtl":$a.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=tc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);wc||(a.getWritable().__dir=d)}yc=
41
- d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}function Hc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);if(void 0===d)throw Error("createChildrenArray: node does not exist in nodeMap");c.push(a);a=d.__next}return c}
42
- function Sc(a,b){var c=Bc.get(a),d=Cc.get(a);void 0!==c&&void 0!==d||q(61);var e=vc||Ac.has(a)||zc.has(a);let f=bc(S,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Yb(Ec,uc,xc,d,"updated");if(d.updateDOM(c,f,tc))return d=Mc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Fc(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&Kc(f,a);a=d.__format;
43
- a!==c.__format&&Lc(f,a);if(e){a=d;e=Q;Q="";b=P;var g=c.__size,h=a.__size;P="";if(1===g&&1===h){var k=c.__first,l=a.__first;if(k===l)Sc(k,f);else{var m=Gc(k);l=Mc(l,null,null);f.replaceChild(l,m);Fc(k,null)}}else{l=Hc(c,Bc);var p=Hc(a,Cc);if(0===g)0!==h&&Nc(p,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Ic(l,0,g-1,k?null:f),k&&(f.textContent=""));else{var n=l;l=p;p=g-1;g=h-1;let w=f.firstChild,y=0;for(h=0;y<=p&&h<=g;){var r=n[y];let x=l[h];if(r===x)w=Tc(Sc(x,f)),y++,h++;else{void 0===
44
- k&&(k=new Set(n));void 0===m&&(m=new Set(l));let A=m.has(r),U=k.has(x);A?(U?(r=bc(S,x),r===w?w=Tc(Sc(x,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Sc(x,f)),y++):Mc(x,f,w),h++):(w=Tc(Gc(r)),Fc(r,f),y++)}}k=y>p;m=h>g;k&&!m?(k=l[g+1],k=void 0===k?null:S.getElementByKey(k),Nc(l,h,g,f,k)):m&&!k&&Ic(n,y,p,f)}}ac(a)&&(P+="\n\n");f.__lexicalTextContent=P;P=b+P;Oc(a,f);Q=e;O(d)||d.isInline()||Pc(c,d,f)}ac(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(S,tc),null!==e&&Qc(a,e)):
45
- B(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!wc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Qc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Mb(S)}c[a]=b}function Tc(a){a=a.nextSibling;null!==a&&a===S._blockCursorElement&&(a=a.nextSibling);return a}function Gc(a){a=Dc.get(a);void 0===a&&q(75);return a}
46
- let T=Object.freeze({}),$c=[["keydown",Uc],["pointerdown",Vc],["compositionstart",Wc],["compositionend",Xc],["input",Yc],["click",Zc],["cut",T],["copy",T],["dragstart",T],["dragover",T],["dragend",T],["paste",T],["focus",T],["blur",T],["drop",T]];Ra&&$c.push(["beforeinput",(a,b)=>ad(a,b)]);let bd=0,cd=0,dd=0,ed=0,fd=!1,gd=!1,hd=!1,id=!1,jd=[0,0,"root",0];
47
- function kd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=H(),k=E(h._window);k=null!==k?k.anchorNode:null;let l=e.key;h=h.getElementByKey(l);let m=b.length;return l!==f.key||!B(g)||(!d&&(!Ra||dd<c+50)||2>m||Rb(b))&&e.offset!==f.offset&&!g.isComposing()||Bb(g)||g.isDirty()&&1<m||(d||!Ra)&&null!==h&&!g.isComposing()&&k!==Cb(h)||g.getFormat()!==a.format||Wb(a,g)}function ld(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
48
- function md(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(fd&&(fd=!1,ld(d,e)&&ld(f,g)))return;v(b,()=>{if(!c)pb(null);else if(yb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,l=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var m=ub(b).event;m=m?m.timeStamp:performance.now();let [p,n,r,w]=jd;m<w+200&&k.offset===n&&k.key===r?h.format=p:"text"===k.type?h.format=l.getFormat():"element"===k.type&&(h.format=0)}else{k=127;l=!1;m=h.getNodes();
49
- let p=m.length;for(let n=0;n<p;n++){let r=m[n];if(B(r)&&(l=!0,k&=r.getFormat(),0===k))break}h.format=l?k:0}}V(b,ca,void 0)}})}function Zc(a,b){v(b,()=>{let c=u(),d=E(b._window),e=Vb();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Ob().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ea,a)})}
50
- function Vc(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{z(mb(c))||(gd=!0)})}function nd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function od(a,b){return a!==b||F(a)||F(b)||!a.isToken()||!b.isToken()}
51
- function ad(a,b){let c=a.inputType;"deleteCompositionText"===c||Qa&&qb(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Vb();if(!C(e))return;pb(e.clone())}if(C(d)){229===cd&&a.timeStamp<bd+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),bd=0,setTimeout(()=>{v(b,()=>{K(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,fa,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
52
- nd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,ha,!1)):"\n\n"===e?(a.preventDefault(),V(b,ia,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&kd(d,e,a.timeStamp,!0)&&(a.preventDefault(),V(b,ja,e)),dd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ja,a);break;case "insertFromComposition":K(null);
53
- V(b,ja,a);break;case "insertLineBreak":K(null);V(b,ha,!1);break;case "insertParagraph":K(null);hd?(hd=!1,V(b,ha,!1)):V(b,ia,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ka,a);break;case "deleteByComposition":od(g,f)&&V(b,ma,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ma,void 0);break;case "deleteContent":V(b,fa,!1);break;case "deleteWordBackward":V(b,na,!0);break;case "deleteWordForward":V(b,na,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
54
- oa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,oa,!1);break;case "formatStrikeThrough":V(b,pa,"strikethrough");break;case "formatBold":V(b,pa,"bold");break;case "formatItalic":V(b,pa,"italic");break;case "formatUnderline":V(b,pa,"underline");break;case "historyUndo":V(b,qa,void 0);break;case "historyRedo":V(b,ra,void 0)}}})}
55
- function Yc(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&kd(c,d,a.timeStamp,!1)){id&&(pd(b,d),id=!1);var e=c.anchor,f=e.getNode(),g=E(b._window);if(null===g)return;let h=e.offset;if(e=Ra&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||V(b,ja,d);d=d.length;Qa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);
56
- Sa||Ta||!b.isComposing()||(bd=0,K(null))}else Ub(!1,b),id&&(pd(b,d||void 0),id=!1);G();c=H();rb(c)})}function Wc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<bd+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ja,Ya)}})}
57
- function pd(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=Cb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&nb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,ya,null);return}}Ub(!0,a,b)}function Xc(a,b){Qa?id=!0:v(b,()=>{pd(b,a.data)})}
58
- function Uc(a,b){bd=a.timeStamp;cd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)hd=!0,V(b,ya,a);else if(32===c)V(b,za,a);else if(t&&e&&79===c)a.preventDefault(),hd=!0,V(b,ha,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,Aa,a):(a.preventDefault(),V(b,fa,!0)):27===c?V(b,Ca,a):(h=t?d||g||f?
59
- !1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Da,a):(a.preventDefault(),V(b,fa,!1)):8===c&&(t?g:e)?(a.preventDefault(),V(b,na,!0)):46===c&&(t?g:e)?(a.preventDefault(),V(b,na,!1)):t&&f&&8===c?(a.preventDefault(),V(b,oa,!0)):t&&f&&46===c?(a.preventDefault(),V(b,oa,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
60
- V(b,qa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,ra,void 0)):qd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),V(b,Ja,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),V(b,Ka,a))))):V(b,Ea,a))}else hd=!1,V(b,ya,a);else V(b,xa,a);else V(b,wa,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);(e||d||g||f)&&V(b,Na,a)}}function rd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let sd=new Map;
61
- function td(a){a=a.target;let b=E(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=zb(b.anchorNode);if(null!==c){gd&&(gd=!1,v(c,()=>{var g=Vb(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=ud(g,b,c),pb(g))}));a=Sb(c);a=a[a.length-1];var d=a._key,e=sd.get(d),f=e||a;f!==c&&md(b,f,!1);md(b,c,!0);c!==a?sd.set(d,c):e&&sd.delete(d)}}}
62
- function vd(a,b){0===ed&&a.ownerDocument.addEventListener("selectionchange",td);ed++;a.__lexicalEditor=b;let c=rd(a);for(let d=0;d<$c.length;d++){let [e,f]=$c[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return V(b,Ka,h);case "copy":return V(b,Ja,h);case "paste":return V(b,ka,h);case "dragstart":return V(b,Ga,h);case "dragover":return V(b,Ha,h);case "dragend":return V(b,
63
- Ia,h);case "focus":return V(b,La,h);case "blur":return V(b,Ma,h);case "drop":return V(b,Fa,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function wd(a,b,c,d){jd=[a,b,c,d]}
64
- class W{constructor(a,b,c){this._selection=null;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(),d=this.offset;a=a.offset;if(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
65
- Lb()||(Kb()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function xd(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!F(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function yd(a,b){if(F(b)){let c=b.getLastDescendant();F(c)||B(c)?xd(a,c):xd(a,b)}else xd(a,b)}
7
+ 'use strict';let aa={},ba={},ca={},ea={},fa={},ha={},ia={},ja={},ka={},ma={},na={},oa={},pa={},qa={},ra={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ba={},Ca={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function q(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
+ let Na="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Oa=Na&&"documentMode"in document?document.documentMode:null,t=Na&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pa=Na&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qa=Na&&"InputEvent"in window&&!Oa?"getTargetRanges"in new window.InputEvent("input"):!1,Ra=Na&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Sa=Na&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
+ !window.MSStream,Ta=Na&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ua=Ra||Sa?"\u00a0":"\u200b",Wa=Pa?"\u00a0":Ua,Xa=/^[^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]/,Ya=/^[^\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]/,Za={bold:1,code:16,italic:2,strikethrough:4,subscript:32,
10
+ superscript:64,underline:8},$a={directionless:1,unmergeable:2},ab={center:2,end:6,justify:4,left:1,right:3,start:5},bb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},cb={normal:0,segmented:2,token:1},db={0:"normal",2:"segmented",1:"token"},eb=!1,fb=0;function gb(a){fb=a.timeStamp}function hb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function ib(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
11
+ function jb(a,b,c){eb=!0;let d=100<performance.now()-fb;try{v(a,()=>{let e=u()||ib(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let l=!1,m="";for(var p=0;p<b.length;p++){var n=b[p],r=n.type,w=n.target,y=kb(w,h);if(!(null===y&&w!==g||z(y)))if("characterData"===r){if(n=d&&B(y))a:{n=e;r=w;var x=y;if(C(n)){var A=n.anchor.getNode();if(A.is(x)&&n.format!==A.getFormat()){n=!1;break a}}n=3===r.nodeType&&x.isAttached()}n&&(x=D(a._window),r=n=null,null!==x&&x.anchorNode===
12
+ w&&(n=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&lb(y,w,n,r,!1))}else if("childList"===r){l=!0;r=n.addedNodes;for(x=0;x<r.length;x++){A=r[x];var U=mb(A),I=A.parentNode;null==I||A===k||null!==U||"BR"===A.nodeName&&hb(A,I,a)||(Pa&&(U=A.innerText||A.nodeValue)&&(m+=U),I.removeChild(A))}n=n.removedNodes;r=n.length;if(0<r){x=0;for(A=0;A<r;A++)if(I=n[A],"BR"===I.nodeName&&hb(I,w,a)||k===I)w.appendChild(I),x++;r!==x&&(w===g&&(y=h._nodeMap.get("root")),f.set(w,y))}}}if(0<f.size)for(let [da,N]of f)if(E(N))for(f=
13
+ N.getChildrenKeys(),g=da.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(da.appendChild(k),g=k):g!==k&&da.replaceChild(k,g),g=g.nextSibling);else B(N)&&N.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)y=h[p],w=y.parentNode,null==w||"BR"!==y.nodeName||hb(y,k,a)||w.removeChild(y);c.takeRecords()}null!==e&&(l&&(e.dirty=!0,nb(e)),Pa&&ob(a)&&e.insertRawText(m))})}finally{eb=!1}}
14
+ function pb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();jb(a,c,b)}}function qb(a){0===fb&&rb(a).addEventListener("textInput",gb,!0);a._observer=new MutationObserver((b,c)=>{jb(a,b,c)})}let sb=1,vb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function wb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return z(kb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}
15
+ function xb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!wb(b)&&yb(b)===a}catch(e){return!1}}function yb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=zb(a)}return null}function Ab(a){return a.isToken()||a.isSegmented()}function Bb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Cb(a,b,c){b=Za[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Db(a){return B(a)||Eb(a)||z(a)}
16
+ function Fb(a,b){if(null!=b)a.__key=b;else{F();99<Gb&&q(14);b=G();var c=H(),d=""+sb++;c._nodeMap.set(d,a);E(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
17
+ function Hb(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
18
+ a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Ib(a){99<Gb&&q(14);var b=a.getLatest(),c=b.__parent,d=H();let e=G(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;E(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
19
+ function J(a){F();var b=G();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=K(c),null!==b&&b.getWritable()),null!==a&&(a=K(a),null!==a&&a.getWritable()))}function Jb(){return Kb()?null:G()._compositionKey}function K(a,b){a=(b||H())._nodeMap.get(a);return void 0===a?null:a}function mb(a,b){let c=G();a=a[`__lexicalKey_${c._key}`];return void 0!==a?K(a,b):null}function kb(a,b){for(;null!=a;){let c=mb(a,b);if(null!==c)return c;a=zb(a)}return null}
20
+ function Lb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Mb(a){return a.read(()=>Nb().getTextContent())}function Ob(a,b){v(a,()=>{var c=H();if(!c.isEmpty())if("root"===b)Nb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Nb(){return H()._nodeMap.get("root")}function nb(a){F();let b=H();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
21
+ function Pb(a){var b=G(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=zb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?K("root"):null):K(c)}function Qb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Rb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Sb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
22
+ function Tb(a,b,c){b=D(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=kb(d),null!==b&&B(d))){if(b===Ua&&c){let g=c.length;b=c;f=e=g}null!==b&&lb(d,b,e,f,a)}}}
23
+ function lb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Ua&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(J(null),Ra||Sa)f.remove();else{let h=G();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Ub(),f.isToken()||null!==Jb()&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
24
+ (c=f.getTextContent(),c=M(c),f.replace(c),f=c)),f.setTextContent(a))}}function Vb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
25
+ function Wb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Xb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&q(33),d=b.klass,b=a.get(d),void 0===b&&(b=new Map,a.set(d,b)),a=b.get(c),d="destroyed"===a&&"created"===e,(void 0===a||d)&&b.set(c,d?"updated":e))}function Yb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
26
+ function Zb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Yb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Yb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function ob(a){a=(a=rb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function $b(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
27
+ function ac(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function zb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}
28
+ function bc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=rb(a).innerHeight}else{var l=b.getBoundingClientRect();h=l.top;k=l.bottom}l=0;f<h?l=-(h-f):g>k&&(l=g-k);0!==l&&(c?e.scrollBy(0,l):(h=b.scrollTop,b.scrollTop+=l,h=b.scrollTop-h,f-=h,g-=h));if(c)break;b=zb(b)}}}
29
+ function cc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!E(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();dc(e,a)&&c.set(a.__key,0,"element");dc(f,a)&&d.set(a.__key,0,"element");return b}function dc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function rb(a){a=a._window;null===a&&q(78);return a}function ec(a){for(a=a.getParentOrThrow();null!==a&&!fc(a);)a=a.getParentOrThrow();return a}function fc(a){return O(a)||E(a)&&a.isShadowRoot()}
30
+ function gc(a){var b=G();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function hc(a,b){a=a.getParent();!O(a)||E(b)||z(b)||q(99)}function ic(a){return(z(a)||E(a)&&!a.canBeEmpty())&&!a.isInline()}function jc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function D(a){return Na?(a||window).getSelection():null}
31
+ function kc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(E(a)&&kc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}function mc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(E(c)&&kc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
32
+ function nc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function oc(a,b){let c=a.mergeWithSibling(b),d=G()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
33
+ function pc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{nc(b,a)&&(a=oc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{nc(a,c)&&oc(a,c);break}}}function qc(a){rc(a.anchor);rc(a.focus);return a}
34
+ function rc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!E(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",sc,S,tc,uc=!1,vc=!1,wc,xc=null,yc,zc,Ac,Bc,Cc,Dc;
35
+ function Ec(a,b){let c=Ac.get(a);if(null!==b){let d=Fc(a);d.parentNode===b&&b.removeChild(d)}Bc.has(a)||S._keyToDOMMap.delete(a);E(c)&&(a=Gc(c,Ac),Hc(a,0,a.length-1,null));void 0!==c&&Xb(Dc,tc,wc,c,"destroyed")}function Hc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Ec(e,d)}}function Ic(a,b){a.setProperty("text-align",b)}function Jc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
36
+ function Kc(a,b){a=a.style;0===b?Ic(a,""):1===b?Ic(a,"left"):2===b?Ic(a,"center"):3===b?Ic(a,"right"):4===b?Ic(a,"justify"):5===b?Ic(a,"start"):6===b&&Ic(a,"end")}
37
+ function Lc(a,b,c){let d=Bc.get(a);void 0===d&&q(60);let e=d.createDOM(sc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;f=d.__size;0!==a&&Jc(e,a);if(0!==f){--f;a=Gc(d,Bc);var g=Q;Q="";Mc(a,0,f,e,null);Nc(d,e);Q=g}a=d.__format;0!==a&&Kc(e,a);d.isInline()||Oc(null,d,e);$b(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(S,sc),null!==g&&Pc(a,
38
+ g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Xb(Dc,tc,wc,d,"created");return e}function Mc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Lc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Qc(a,b){a=b.get(a);return Eb(a)||z(a)&&a.isInline()}
39
+ function Oc(a,b,c){a=null!==a&&(0===a.__size||Qc(a.__last,Ac));b=0===b.__size||Qc(b.__last,Bc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
40
+ function Nc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==xc){let f=""===Q;if(f)var d=xc;else d=Q,d=Xa.test(d)?"rtl":Ya.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=sc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);vc||(a.getWritable().__dir=d)}xc=
41
+ d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}function Gc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&q(101);c.push(a);a=d.__next}return c}
42
+ function Rc(a,b){var c=Ac.get(a),d=Bc.get(a);void 0!==c&&void 0!==d||q(61);var e=uc||zc.has(a)||yc.has(a);let f=ac(S,a);if(c===d&&!e)return E(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Xb(Dc,tc,wc,d,"updated");if(d.updateDOM(c,f,sc))return d=Lc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Ec(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&Jc(f,a);a=d.__format;
43
+ a!==c.__format&&Kc(f,a);if(e){a=d;e=Q;Q="";b=P;var g=c.__size,h=a.__size;P="";if(1===g&&1===h){var k=c.__first,l=a.__first;if(k===l)Rc(k,f);else{var m=Fc(k);l=Lc(l,null,null);f.replaceChild(l,m);Ec(k,null)}}else{l=Gc(c,Ac);var p=Gc(a,Bc);if(0===g)0!==h&&Mc(p,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Hc(l,0,g-1,k?null:f),k&&(f.textContent=""));else{var n=l;l=p;p=g-1;g=h-1;let w=f.firstChild,y=0;for(h=0;y<=p&&h<=g;){var r=n[y];let x=l[h];if(r===x)w=Sc(Rc(x,f)),y++,h++;else{void 0===
44
+ k&&(k=new Set(n));void 0===m&&(m=new Set(l));let A=m.has(r),U=k.has(x);A?(U?(r=ac(S,x),r===w?w=Sc(Rc(x,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Rc(x,f)),y++):Lc(x,f,w),h++):(w=Sc(Fc(r)),Ec(r,f),y++)}}k=y>p;m=h>g;k&&!m?(k=l[g+1],k=void 0===k?null:S.getElementByKey(k),Mc(l,h,g,f,k)):m&&!k&&Hc(n,y,p,f)}}$b(a)&&(P+="\n\n");f.__lexicalTextContent=P;P=b+P;Nc(a,f);Q=e;O(d)||d.isInline()||Oc(c,d,f)}$b(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(S,sc),null!==e&&Pc(a,e)):
45
+ B(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!vc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Pc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Lb(S)}c[a]=b}function Sc(a){a=a.nextSibling;null!==a&&a===S._blockCursorElement&&(a=a.nextSibling);return a}function Fc(a){a=Cc.get(a);void 0===a&&q(75);return a}
46
+ let Tc=Object.freeze({}),$c=[["keydown",Uc],["pointerdown",Vc],["compositionstart",Wc],["compositionend",Xc],["input",Yc],["click",Zc],["cut",Tc],["copy",Tc],["dragstart",Tc],["dragover",Tc],["dragend",Tc],["paste",Tc],["focus",Tc],["blur",Tc],["drop",Tc]];Qa&&$c.push(["beforeinput",(a,b)=>ad(a,b)]);let bd=0,cd=0,dd=0,ed=0,fd=!1,gd=!1,hd=!1,id=!1,jd=[0,0,"root",0];
47
+ function kd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=G(),k=D(h._window);k=null!==k?k.anchorNode:null;let l=e.key;h=h.getElementByKey(l);let m=b.length;return l!==f.key||!B(g)||(!d&&(!Qa||dd<c+50)||2>m||Qb(b))&&e.offset!==f.offset&&!g.isComposing()||Ab(g)||g.isDirty()&&1<m||(d||!Qa)&&null!==h&&!g.isComposing()&&k!==Bb(h)||g.getFormat()!==a.format||Vb(a,g)}function ld(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
48
+ function md(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(fd&&(fd=!1,ld(d,e)&&ld(f,g)))return;v(b,()=>{if(!c)nb(null);else if(xb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,l=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var m=rb(b).event;m=m?m.timeStamp:performance.now();let [p,n,r,w]=jd;m<w+200&&k.offset===n&&k.key===r?h.format=p:"text"===k.type?h.format=l.getFormat():"element"===k.type&&(h.format=0)}else{k=127;l=!1;m=h.getNodes();
49
+ let p=m.length;for(let n=0;n<p;n++){let r=m[n];if(B(r)&&(l=!0,k&=r.getFormat(),0===k))break}h.format=l?k:0}}T(b,aa,void 0)}})}function Zc(a,b){v(b,()=>{let c=u(),d=D(b._window),e=Ub();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Nb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}T(b,ba,a)})}
50
+ function Vc(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{z(kb(c))||(gd=!0)})}function nd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function od(a,b){return a!==b||E(a)||E(b)||!a.isToken()||!b.isToken()}
51
+ function ad(a,b){let c=a.inputType;"deleteCompositionText"===c||Pa&&ob(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Ub();if(!C(e))return;nb(e.clone())}if(C(d)){229===cd&&a.timeStamp<bd+30&&b.isComposing()&&d.anchor.key===d.focus.key?(J(null),bd=0,setTimeout(()=>{v(b,()=>{J(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),T(b,ca,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
52
+ nd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),T(b,ea,!1)):"\n\n"===e?(a.preventDefault(),T(b,fa,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&kd(d,e,a.timeStamp,!0)&&(a.preventDefault(),T(b,ha,e)),dd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":T(b,ha,a);break;case "insertFromComposition":J(null);
53
+ T(b,ha,a);break;case "insertLineBreak":J(null);T(b,ea,!1);break;case "insertParagraph":J(null);hd?(hd=!1,T(b,ea,!1)):T(b,fa,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":T(b,ia,a);break;case "deleteByComposition":od(g,f)&&T(b,ja,void 0);break;case "deleteByDrag":case "deleteByCut":T(b,ja,void 0);break;case "deleteContent":T(b,ca,!1);break;case "deleteWordBackward":T(b,ka,!0);break;case "deleteWordForward":T(b,ka,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":T(b,
54
+ ma,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":T(b,ma,!1);break;case "formatStrikeThrough":T(b,na,"strikethrough");break;case "formatBold":T(b,na,"bold");break;case "formatItalic":T(b,na,"italic");break;case "formatUnderline":T(b,na,"underline");break;case "historyUndo":T(b,oa,void 0);break;case "historyRedo":T(b,pa,void 0)}}})}
55
+ function Yc(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&kd(c,d,a.timeStamp,!1)){id&&(pd(b,d),id=!1);var e=c.anchor,f=e.getNode(),g=D(b._window);if(null===g)return;let h=e.offset;if(e=Qa&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||T(b,ha,d);d=d.length;Pa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);
56
+ Ra||Sa||!b.isComposing()||(bd=0,J(null))}else Tb(!1,b),id&&(pd(b,d||void 0),id=!1);F();c=G();pb(c)})}function Wc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor;J(d.key);(a.timeStamp<bd+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&T(b,ha,Wa)}})}
57
+ function pd(a,b){var c=a._compositionKey;J(null);if(null!==c&&null!=b){if(""===b){b=K(c);a=Bb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&lb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);T(a,xa,null);return}}Tb(!0,a,b)}function Xc(a,b){Pa?id=!0:v(b,()=>{pd(b,a.data)})}
58
+ function Uc(a,b){bd=a.timeStamp;cd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)hd=!0,T(b,xa,a);else if(32===c)T(b,ya,a);else if(t&&e&&79===c)a.preventDefault(),hd=!0,T(b,ea,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?T(b,za,a):(a.preventDefault(),T(b,ca,!0)):27===c?T(b,Aa,a):(h=t?d||g||f?
59
+ !1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?T(b,Ba,a):(a.preventDefault(),T(b,ca,!1)):8===c&&(t?g:e)?(a.preventDefault(),T(b,ka,!0)):46===c&&(t?g:e)?(a.preventDefault(),T(b,ka,!1)):t&&f&&8===c?(a.preventDefault(),T(b,ma,!0)):t&&f&&46===c?(a.preventDefault(),T(b,ma,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,na,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,na,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,na,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
60
+ T(b,oa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),T(b,pa,void 0)):qd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),T(b,Ia,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),T(b,Ja,a))))):T(b,Ca,a))}else hd=!1,T(b,xa,a);else T(b,wa,a);else T(b,va,a);else T(b,ua,a);else T(b,ta,a);else T(b,ra,a);else T(b,qa,a);(e||d||g||f)&&T(b,Ma,a)}}function rd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let sd=new Map;
61
+ function td(a){a=a.target;let b=D(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=yb(b.anchorNode);if(null!==c){gd&&(gd=!1,v(c,()=>{var g=Ub(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=ud(g,b,c),nb(g))}));a=Rb(c);a=a[a.length-1];var d=a._key,e=sd.get(d),f=e||a;f!==c&&md(b,f,!1);md(b,c,!0);c!==a?sd.set(d,c):e&&sd.delete(d)}}}
62
+ function vd(a,b){0===ed&&a.ownerDocument.addEventListener("selectionchange",td);ed++;a.__lexicalEditor=b;let c=rd(a);for(let d=0;d<$c.length;d++){let [e,f]=$c[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return T(b,Ja,h);case "copy":return T(b,Ia,h);case "paste":return T(b,ia,h);case "dragstart":return T(b,Fa,h);case "dragover":return T(b,Ga,h);case "dragend":return T(b,
63
+ Ha,h);case "focus":return T(b,Ka,h);case "blur":return T(b,La,h);case "drop":return T(b,Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function wd(a,b,c,d){jd=[a,b,c,d]}
64
+ class W{constructor(a,b,c){this._selection=null;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(),d=this.offset;a=a.offset;if(E(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}E(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=K(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
65
+ Kb()||(Jb()===e&&J(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function xd(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function yd(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?xd(a,c):xd(a,b)}else xd(a,b)}
66
66
  function zd(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=M(),g=O(d)?Ad().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function Bd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
67
67
  class Cd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!qd(a))return!1;let 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);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Cd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
68
- b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(B(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);Lb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}
68
+ b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(B(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=K(c),null!==b&&a.push(b);Kb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}
69
69
  function C(a){return a instanceof Dd}
70
70
  class Ed{constructor(a,b,c){this.gridKey=a;this.anchor=b;this.focus=c;this.dirty=!1;this._cachedNodes=null;b._selection=this;c._selection=this}is(a){return Fd(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new Ed(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Gd(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,b){let c=
71
- this.focus.getNode();return rc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&q(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&q(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=this._cachedNodes;
72
- if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);Hd(f)||q(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Id(g)||q(24);g=g.getChildren();for(let l=b;l<=d;l++){var h=g[l];Jd(h)||q(25);a.add(h);for(h=h.getChildren();0<h.length;){let m=h.shift();a.add(m);F(m)&&h.unshift(...m.getChildren())}}}a=Array.from(a);Lb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();
71
+ this.focus.getNode();return qc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=K(this.anchor.key);null===a&&q(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=K(this.focus.key);null===c&&q(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=this._cachedNodes;
72
+ if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=K(this.gridKey);Hd(f)||q(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Id(g)||q(24);g=g.getChildren();for(let l=b;l<=d;l++){var h=g[l];Jd(h)||q(25);a.add(h);for(h=h.getChildren();0<h.length;){let m=h.shift();a.add(m);E(m)&&h.unshift(...m.getChildren())}}}a=Array.from(a);Kb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();
73
73
  return b}}function Fd(a){return a instanceof Ed}
74
- class Dd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(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(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();F(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
75
- b?b:a);F(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?F(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);Lb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Bd(this.anchor,a.__key,b,"text");Bd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=Gd(this),g="",h=!0;for(let k=0;k<a.length;k++){let l=a[k];if(F(l)&&!l.isInline())h||
76
- (g+="\n"),h=l.isEmpty()?!1:!0;else if(h=!1,B(l)){let m=l.getTextContent();l===b?m=l===c?e<f?m.slice(e,f):m.slice(f,e):d?m.slice(e):m.slice(f):l===c&&(m=d?m.slice(0,f):m.slice(0,e));g+=m}else!z(l)&&!Fb(l)||l===c&&this.isCollapsed()||(g+=l.getTextContent())}return g}applyDOMRange(a){let b=H(),c=b.getEditorState()._selection;a=Kd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Bd(this.anchor,d.key,d.offset,d.type);Bd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
77
- null}}clone(){let a=this.anchor,b=this.focus;return new Dd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Db(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ab[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Ld())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
78
- b.isBefore(c),e=this.format;d&&"element"===b.type?zd(b,c,e):d||"element"!==c.type||zd(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];B(b)||q(26);d=b.getTextContent().length;var l=b.getParentOrThrow(),m=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!l.canInsertTextAfter()&&null===b.getNextSibling())){var p=b.getNextSibling();if(!B(p)||Bb(p))p=M(),p.setFormat(e),l.canInsertTextAfter()?b.insertAfter(p):l.insertAfter(p);
79
- p.select(0,0);b=p;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!l.canInsertTextBefore()&&null===b.getPreviousSibling())){p=b.getPreviousSibling();if(!B(p)||Bb(p))p=M(),p.setFormat(e),l.canInsertTextBefore()?b.insertBefore(p):l.insertBefore(p);p.select();b=p;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)l=M(b.getTextContent()),l.setFormat(e),b.replace(l),b=l;else if(!(this.isCollapsed()||""===
80
- a||(p=m.getParent(),l.canInsertTextBefore()&&l.canInsertTextAfter()&&(!F(p)||p.canInsertTextBefore()&&p.canInsertTextAfter())))){this.insertText("");Md(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=M(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=M(a);f.setFormat(e);f.select();0===c?b.insertBefore(f,!1):([g]=b.splitText(c),g.insertAfter(f,!1));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
81
- a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=f)}else{e=new Set([...b.getParentKeys(),...m.getParentKeys()]);var n=F(b)?b:b.getParentOrThrow();l=F(m)?m:m.getParentOrThrow();p=m;if(!n.is(l)&&l.isInline()){do p=l,l=l.getParentOrThrow();while(l.isInline())}"text"===h.type&&(0!==k||""===m.getTextContent())||"element"===h.type&&m.getIndexWithinParent()<k?B(m)&&!m.isToken()&&k!==m.getTextContentSize()?
82
- (m.isSegmented()&&(h=M(m.getTextContent()),m.replace(h),m=h),m=m.spliceText(0,k,""),e.add(m.__key)):(h=m.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?m.remove():h.remove()):e.add(m.__key);h=l.getChildren();k=new Set(f);m=n.is(l);n=n.isInline()&&null===b.getNextSibling()?n:b;for(let r=h.length-1;0<=r;r--){let w=h[r];if(w.is(b)||F(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(p)?m||n.insertAfter(w,!1):w.remove())}if(!m)for(h=l,k=null;null!==h;){m=h.getChildren();l=m.length;
83
- if(0===l||m[l-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),K(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
84
- K(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var l=e-1,m=c[l];e="text"===d.type?d.offset:m.getTextContentSize();if(k.is(m))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
74
+ class Dd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(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(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();E(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
75
+ b?b:a);E(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?E(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);Kb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Bd(this.anchor,a.__key,b,"text");Bd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=Gd(this),g="",h=!0;for(let k=0;k<a.length;k++){let l=a[k];if(E(l)&&!l.isInline())h||
76
+ (g+="\n"),h=l.isEmpty()?!1:!0;else if(h=!1,B(l)){let m=l.getTextContent();l===b?m=l===c?e<f?m.slice(e,f):m.slice(f,e):d?m.slice(e):m.slice(f):l===c&&(m=d?m.slice(0,f):m.slice(0,e));g+=m}else!z(l)&&!Eb(l)||l===c&&this.isCollapsed()||(g+=l.getTextContent())}return g}applyDOMRange(a){let b=G(),c=b.getEditorState()._selection;a=Kd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Bd(this.anchor,d.key,d.offset,d.type);Bd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
77
+ null}}clone(){let a=this.anchor,b=this.focus;return new Dd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Cb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Za[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Ld())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
78
+ b.isBefore(c),e=this.format;d&&"element"===b.type?zd(b,c,e):d||"element"!==c.type||zd(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];B(b)||q(26);d=b.getTextContent().length;var l=b.getParentOrThrow(),m=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!l.canInsertTextAfter()&&null===b.getNextSibling())){var p=b.getNextSibling();if(!B(p)||Ab(p))p=M(),p.setFormat(e),l.canInsertTextAfter()?b.insertAfter(p):l.insertAfter(p);
79
+ p.select(0,0);b=p;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!l.canInsertTextBefore()&&null===b.getPreviousSibling())){p=b.getPreviousSibling();if(!B(p)||Ab(p))p=M(),p.setFormat(e),l.canInsertTextBefore()?b.insertBefore(p):l.insertBefore(p);p.select();b=p;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)l=M(b.getTextContent()),l.setFormat(e),b.replace(l),b=l;else if(!(this.isCollapsed()||""===
80
+ a||(p=m.getParent(),l.canInsertTextBefore()&&l.canInsertTextAfter()&&(!E(p)||p.canInsertTextBefore()&&p.canInsertTextAfter())))){this.insertText("");Md(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=M(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=M(a);f.setFormat(e);f.select();0===c?b.insertBefore(f,!1):([g]=b.splitText(c),g.insertAfter(f,!1));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
81
+ a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=f)}else{e=new Set([...b.getParentKeys(),...m.getParentKeys()]);var n=E(b)?b:b.getParentOrThrow();l=E(m)?m:m.getParentOrThrow();p=m;if(!n.is(l)&&l.isInline()){do p=l,l=l.getParentOrThrow();while(l.isInline())}"text"===h.type&&(0!==k||""===m.getTextContent())||"element"===h.type&&m.getIndexWithinParent()<k?B(m)&&!m.isToken()&&k!==m.getTextContentSize()?
82
+ (m.isSegmented()&&(h=M(m.getTextContent()),m.replace(h),m=h),m=m.spliceText(0,k,""),e.add(m.__key)):(h=m.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?m.remove():h.remove()):e.add(m.__key);h=l.getChildren();k=new Set(f);m=n.is(l);n=n.isInline()&&null===b.getNextSibling()?n:b;for(let r=h.length-1;0<=r;r--){let w=h[r];if(w.is(b)||E(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(p)?m||n.insertAfter(w,!1):w.remove())}if(!m)for(h=l,k=null;null!==h;){m=h.getChildren();l=m.length;
83
+ if(0===l||m[l-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),J(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
84
+ J(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var l=e-1,m=c[l];e="text"===d.type?d.offset:m.getTextContentSize();if(k.is(m))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
85
85
  this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var p=m.getFormatFlags(a,g);0<e&&(e!==m.getTextContentSize()&&([m]=m.splitText(e)),m.setFormat(p));for(h+=1;h<l;h++){let n=c[h];if(!n.isToken()){let r=n.getFormatFlags(a,p);n.setFormat(r)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(m.__key,e,"text");this.format=g|p}}}}}insertNodes(a,b){if(!this.isCollapsed()){var c=this.isBackward()?this.anchor:this.focus,d=c.getNode().getNextSibling();d=d?d.getKey():null;c=(c=
86
86
  c.getNode().getPreviousSibling())?c.getKey():null;this.removeText();if(this.isCollapsed()&&"element"===this.focus.type){if(this.focus.key===d&&0===this.focus.offset){var e=M();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=M(),this.focus.getNode().insertAfter(e));e&&(this.focus.set(e.__key,0,"text"),this.anchor.set(e.__key,0,"text"))}}d=this.anchor;c=d.offset;var f=d.getNode();e=f;"element"===d.type&&(e=d.getNode(),d=e.getChildAtIndex(c-
87
- 1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=gc(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,l=null;for(let r=0;r<a.length;r++){var m=a[r];if(z(e)||!F(m)||m.isInline())k&&!z(m)&&gc(e.getParent())&&q(28);else{if(m.is(g)){if(F(e)&&e.isEmpty()&&e.canReplaceWith(m)){e.replace(m);
88
- e=m;k=!0;continue}var p=m.getFirstDescendant();if(Eb(p)){for(p=p.getParentOrThrow();p.isInline();)p=p.getParentOrThrow();l=p.getChildren();k=l.length;if(F(e)){var n=e.getFirstChild();for(let w=0;w<k;w++){let y=l[w];null===n?e.append(y):n.insertAfter(y);n=y}}else{for(n=k-1;0<=n;n--)e.insertAfter(l[n]);e=e.getParentOrThrow()}l=l[k-1];p.remove();k=!0;if(p.is(m))continue}}B(e)&&(null===h&&q(27),e=h)}k=!1;if(F(e)&&!e.isInline())if(l=m,z(m)&&!m.isInline())e=e.insertAfter(m,!1);else if(F(m)){if(m.canBeEmpty()||
89
- !m.isEmpty())O(e)?(p=e.getChildAtIndex(c),null!==p?p.insertBefore(m):e.append(m),e=m):e=e.insertAfter(m,!1)}else p=e.getFirstChild(),null!==p?p.insertBefore(m):e.append(m),e=m;else!F(m)||F(m)&&m.isInline()||z(e)&&!e.isInline()?(l=m,e=e.insertAfter(m,!1)):(m=e.getParentOrThrow(),Fb(e)&&e.remove(),e=m,r--)}b&&(B(f)?f.select():(a=e.getPreviousSibling(),B(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(F(e)){if(a=B(l)?l:F(l)&&l.isInline()?l.getLastDescendant():e.getLastDescendant(),
90
- b||(null===a?e.select():B(a)?""===a.getTextContent()?a.selectPrevious():a.select():a.selectNext()),0!==d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!F(e)||Nd(c)||z(c)&&(!c.isInline()||c.isIsolated())?F(e)||Nd(c)?F(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),F(f)||q(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(B(e)?e.select():(b=e.getParentOrThrow(),
91
- a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(gc(f)){e=Ad();c=f.getChildAtIndex(b);e.select();null!==
92
- c?c.insertBefore(e,!1):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this,!1),F(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(F(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==
87
+ 1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=fc(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,l=null;for(let r=0;r<a.length;r++){var m=a[r];if(z(e)||!E(m)||m.isInline())k&&!z(m)&&fc(e.getParent())&&q(28);else{if(m.is(g)){if(E(e)&&e.isEmpty()&&e.canReplaceWith(m)){e.replace(m);
88
+ e=m;k=!0;continue}var p=m.getFirstDescendant();if(Db(p)){for(p=p.getParentOrThrow();p.isInline();)p=p.getParentOrThrow();l=p.getChildren();k=l.length;if(E(e)){var n=e.getFirstChild();for(let w=0;w<k;w++){let y=l[w];null===n?e.append(y):n.insertAfter(y);n=y}}else{for(n=k-1;0<=n;n--)e.insertAfter(l[n]);e=e.getParentOrThrow()}l=l[k-1];p.remove();k=!0;if(p.is(m))continue}}B(e)&&(null===h&&q(27),e=h)}k=!1;if(E(e)&&!e.isInline())if(l=m,z(m)&&!m.isInline())e=e.insertAfter(m,!1);else if(E(m)){if(m.canBeEmpty()||
89
+ !m.isEmpty())O(e)?(p=e.getChildAtIndex(c),null!==p?p.insertBefore(m):e.append(m),e=m):e=e.insertAfter(m,!1)}else p=e.getFirstChild(),null!==p?p.insertBefore(m):e.append(m),e=m;else!E(m)||E(m)&&m.isInline()||z(e)&&!e.isInline()?(l=m,e=e.insertAfter(m,!1)):(m=e.getParentOrThrow(),Eb(e)&&e.remove(),e=m,r--)}b&&(B(f)?f.select():(a=e.getPreviousSibling(),B(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(E(e)){if(a=B(l)?l:E(l)&&l.isInline()?l.getLastDescendant():e.getLastDescendant(),
90
+ b||(null===a?e.select():B(a)?""===a.getTextContent()?a.selectPrevious():a.select():a.selectNext()),0!==d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!E(e)||Nd(c)||z(c)&&(!c.isInline()||c.isIsolated())?E(e)||Nd(c)?E(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),E(f)||q(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(B(e)?e.select():(b=e.getParentOrThrow(),
91
+ a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(fc(f)){e=Ad();c=f.getChildAtIndex(b);e.select();null!==
92
+ c?c.insertBefore(e,!1):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this,!1),E(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(E(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==
93
93
  d)for(c=0;c<d;c++)b=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=Ld();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Gd(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Gd(this);if(0===b)return[];
94
- if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=$b(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Od(),b.add(g.__key),pb(b)):(a=b?g.getPreviousSibling():
95
- g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),F(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=H(),d=E(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||lc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),
96
- e=O(e)?e:fc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],ec(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],F(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],F(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Bd(f,b.key,b.offset,b.type),Bd(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
97
- this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&F(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(F(e)&&!e.canExtractContents())return}e=$b(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&F(d)&&0===d.getChildrenSize()?(d.remove(),a=Od(),a.add(e.__key),pb(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?
98
- c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Pd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Pd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Rb(b)||(a?e.offset=
94
+ if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=Zb(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Od(),b.add(g.__key),nb(b)):(a=b?g.getPreviousSibling():
95
+ g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=G(),d=D(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!E(g)||g.isInline()||g.canBeEmpty()||jc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),
96
+ e=O(e)?e:ec(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],dc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],E(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],E(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Bd(f,b.key,b.offset,b.type),Bd(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
97
+ this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&E(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(E(e)&&!e.canExtractContents())return}e=Zb(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&E(d)&&0===d.getChildrenSize()?(d.remove(),a=Od(),a.add(e.__key),nb(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?
98
+ c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Pd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Pd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Qb(b)||(a?e.offset=
99
99
  f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function qd(a){return a instanceof Cd}
100
100
  function Qd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Gd(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[Qd(b),Qd(a)]}
101
101
  function Pd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],l=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||l){d.splice(h,1);l&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
102
- function Rd(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=Qb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Qb(a);if(null===f)return null;if(F(f)){a=f.getChildAtIndex(e);if(b=F(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=F(a)?a:a.getParentOrThrow()));
103
- B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&Qb(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new W(f.__key,e,"element")}}else d=Qb(a);return B(d)?new W(d.__key,e,"text"):null}
104
- function Sd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&F(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):F(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&F(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
105
- b)&&null===d&&F(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Md(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Sd(a,d,e);Sd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=H();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Bd(a,d.key,d.offset,d.type),Bd(b,c.key,c.offset,c.type))}}
106
- function Kd(a,b,c,d,e,f){if(null===a||null===c||!yb(e,a,c))return null;b=Rd(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Rd(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Qb(a),c=Qb(c),z(a)&&z(c)))return null;Md(b,d,f);return[b,d]}function Nd(a){return F(a)&&!a.isInline()}function Td(a,b,c,d,e,f){let g=I();a=new Dd(new W(a,b,e),new W(c,d,f),0);a.dirty=!0;return g._selection=a}function Od(){return new Cd(new Set)}
107
- function Ud(a){let b=a.getEditorState()._selection,c=E(a._window);return qd(b)||Fd(b)?b.clone():ud(b,c,a)}
108
- function ud(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!gb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!yb(c,e,f))return a.clone()}else return a.clone();c=Kd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Dd(h,k,C(a)?a.format:0)}
109
- function u(){return I()._selection}function Vb(){return H()._editorState._selection}
102
+ function Rd(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=Pb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Pb(a);if(null===f)return null;if(E(f)){a=f.getChildAtIndex(e);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=E(a)?a:a.getParentOrThrow()));
103
+ B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&Pb(a)===f?e:e+1,f=f.getParentOrThrow();if(E(f))return new W(f.__key,e,"element")}}else d=Pb(a);return B(d)?new W(d.__key,e,"text"):null}
104
+ function Sd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&E(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
105
+ b)&&null===d&&E(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Md(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Sd(a,d,e);Sd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=G();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Bd(a,d.key,d.offset,d.type),Bd(b,c.key,c.offset,c.type))}}
106
+ function Kd(a,b,c,d,e,f){if(null===a||null===c||!xb(e,a,c))return null;b=Rd(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Rd(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Pb(a),c=Pb(c),z(a)&&z(c)))return null;Md(b,d,f);return[b,d]}function Nd(a){return E(a)&&!a.isInline()}function Td(a,b,c,d,e,f){let g=H();a=new Dd(new W(a,b,e),new W(c,d,f),0);a.dirty=!0;return g._selection=a}function Od(){return new Cd(new Set)}
107
+ function Ud(a){let b=a.getEditorState()._selection,c=D(a._window);return qd(b)||Fd(b)?b.clone():ud(b,c,a)}
108
+ function ud(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!eb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!xb(c,e,f))return a.clone()}else return a.clone();c=Kd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Dd(h,k,C(a)?a.format:0)}
109
+ function u(){return H()._selection}function Ub(){return G()._editorState._selection}
110
110
  function Vd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Wd(a));else{var k=a.isBackward();h=k?f:e;var l=h.getNode();e=k?e:f;f=e.getNode();b.is(l)&&(l=h.offset,c<=l&&h.set(g,Math.max(0,l+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Wd(a)}}
111
- function Wd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())F(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(F(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}F(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
111
+ function Wd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())E(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}E(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
112
112
  1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Xd(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
113
- function Yd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):F(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":F(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Zd(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
114
- function $d(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,l=d.anchorOffset,m=d.focusOffset,p=document.activeElement;if(!(e.has("collaboration")&&p!==f||null!==p&&xb(p)))if(C(b)){var n=b.anchor,r=b.focus,w=n.key,y=r.key,x=bc(c,w);y=bc(c,y);var A=n.offset,U=r.offset,J=b.format,da=b.isCollapsed(),N=x,D=y,aa=!1;"text"===n.type&&(N=Cb(x),aa=n.getNode().getFormat()!==J);"text"===r.type&&(D=Cb(y));if(null!==N&&null!==D){da&&(null===a||aa||C(a)&&a.format!==J)&&wd(J,A,w,performance.now());if(l===A&&m===
115
- U&&h===N&&k===D&&("Range"!==d.type||!da)&&(null!==p&&f.contains(p)||f.focus({preventScroll:!0}),"element"!==n.type))return;if(!e.has("skip-scroll-into-view"))try{Wa&&1E3<g?window.requestAnimationFrame(()=>d.setBaseAndExtent(N,A,D,U)):d.setBaseAndExtent(N,A,D,U)}catch(Ua){}!e.has("skip-scroll-into-view")&&b.isCollapsed()&&null!==f&&f===document.activeElement&&(a=b instanceof Dd&&"element"===b.anchor.type?N.childNodes[A]||null:0<d.rangeCount?d.getRangeAt(0):null,null!==a&&(a=a.getBoundingClientRect(),
116
- cc(c,a,f)));fd=!0}}else null!==a&&yb(c,h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,ae=!1,Hb=0,be={characterData:!0,childList:!0,subtree:!0};function Lb(){return Z||null!==X&&X._readOnly}function G(){Z&&q(13)}function I(){null===X&&q(15);return X}function H(){null===Y&&q(16);return Y}function ce(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}
117
- function de(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&qc(b)}
118
- function ee(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Kb(),f=new Map;var g=c;let h=g.size;for(var k=d,l=k.size;0<h||0<l;){if(0<h){b._dirtyLeaves=new Set;for(let m of g)g=a.get(m),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&qc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Hb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let m of k)if(k=m[0],l=m[1],"root"===k||l)g=a.get(k),void 0!==
119
- g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;Hb++}b._dirtyLeaves=c;b._dirtyElements=d}function fe(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(F(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=fe(a[d],b);c.append(e)}return c}function ge(a,b){let c=X,d=Z,e=Y;X=a;Z=!0;Y=null;try{return b()}finally{X=c,Z=d,Y=e}}
120
- function he(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=X,l=Z,m=Y,p=a._updating,n=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==n){Y=a;X=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();Q=R=P="";vc=2===w;yc=null;S=a;tc=a._config;uc=a._nodes;xc=S._listeners.mutation;zc=y;Ac=x;Bc=e._nodeMap;Cc=b._nodeMap;wc=
121
- b._readOnly;Dc=new Map(a._keyToDOMMap);var A=new Map;Ec=A;Sc("root",null);Ec=Dc=tc=Cc=Bc=Ac=zc=uc=S=void 0;r=A}catch(D){D instanceof Error&&a._onError(D);if(ae)throw D;ie(a,null,c,b);sb(a);a._dirtyType=2;ae=!0;he(a);ae=!1;return}finally{n.observe(c,be),a._updating=p,X=k,Z=l,Y=m}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;x=a._updateTags;l=a._deferred;y=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
122
- a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,J=a._pendingDecorators||U,da=b._nodeMap,N;for(N in J)da.has(N)||(J===U&&(J=Mb(a)),delete J[N]);d=d?null:E(a._window);if(a._editable&&null!==d&&(h||null===g||g.dirty)){Y=a;X=b;try{null!==n&&n.disconnect();if(h||null===g||g.dirty){let D=a._blockCursorElement;null!==D&&lc(D,a,c);$d(f,g,a,d,x,c,y)}a:{let D=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let aa=g.anchor,
123
- Ua=aa.getNode(),jc=aa.offset,He=Ua.getChildrenSize();f=!1;g=null;if(jc===He){let la=Ua.getChildAtIndex(jc-1);kc(la)&&(f=!0)}else{let la=Ua.getChildAtIndex(jc);if(kc(la)){let Va=la.getPreviousSibling();if(null===Va||kc(Va))f=!0,g=a.getElementByKey(la.__key)}}if(f){let la=a.getElementByKey(Ua.__key);if(null===D){let Va=a._config.theme,tb=document.createElement("div");tb.contentEditable="false";tb.setAttribute("data-lexical-cursor","true");let Ba=Va.blockCursor;if(void 0!==Ba){if("string"===typeof Ba){let Ie=
124
- Ba.split(" ");Ba=Va.blockCursor=Ie}void 0!==Ba&&tb.classList.add(...Ba)}a._blockCursorElement=D=tb}c.style.caretColor="transparent";null===g?la.appendChild(D):la.insertBefore(D,g);break a}}null!==D&&lc(D,a,c)}null!==n&&n.observe(c,be)}finally{Y=m,X=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),m=k.length,n=0;n<m;n++){let [D,aa]=k[n];r=c.get(aa);void 0!==r&&D(r,{dirtyLeaves:p,updateTags:x})}c=a._pendingDecorators;null!==c&&(a._decorators=c,a._pendingDecorators=null,je("decorator",a,!0,
125
- c));c=Nb(e);k=Nb(b);c!==k&&je("textcontent",a,!0,k);je("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:x});a._deferred=[];if(0!==l.length){b=a._updating;a._updating=!0;try{for(e=0;e<l.length;e++)l[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [D,aa]=b;ke(a,D,aa)}}}
126
- function je(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}function V(a,b,c){if(!1===a._updating||Y!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=Sb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
113
+ function Yd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":E(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Zd(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
114
+ function $d(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,l=d.anchorOffset,m=d.focusOffset,p=document.activeElement;if(!(e.has("collaboration")&&p!==f||null!==p&&wb(p)))if(C(b)){var n=b.anchor,r=b.focus,w=n.key,y=r.key,x=ac(c,w);y=ac(c,y);var A=n.offset,U=r.offset,I=b.format,da=b.isCollapsed(),N=x,V=y,L=!1;"text"===n.type&&(N=Bb(x),L=n.getNode().getFormat()!==I);"text"===r.type&&(V=Bb(y));if(null!==N&&null!==V){da&&(null===a||L||C(a)&&a.format!==I)&&wd(I,A,w,performance.now());if(l===A&&m===U&&
115
+ h===N&&k===V&&("Range"!==d.type||!da)&&(null!==p&&f.contains(p)||f.focus({preventScroll:!0}),"element"!==n.type))return;try{Ta&&1E3<g?window.requestAnimationFrame(()=>d.setBaseAndExtent(N,A,V,U)):d.setBaseAndExtent(N,A,V,U)}catch(sa){}!e.has("skip-scroll-into-view")&&b.isCollapsed()&&null!==f&&f===document.activeElement&&(a=b instanceof Dd&&"element"===b.anchor.type?N.childNodes[A]||null:0<d.rangeCount?d.getRangeAt(0):null,null!==a&&(a=a.getBoundingClientRect(),bc(c,a,f)));fd=!0}}else null!==a&&xb(c,
116
+ h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,ae=!1,Gb=0,be={characterData:!0,childList:!0,subtree:!0};function Kb(){return Z||null!==X&&X._readOnly}function F(){Z&&q(13)}function H(){null===X&&q(15);return X}function G(){null===Y&&q(16);return Y}function ce(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}
117
+ function de(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&pc(b)}
118
+ function ee(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Jb(),f=new Map;var g=c;let h=g.size;for(var k=d,l=k.size;0<h||0<l;){if(0<h){b._dirtyLeaves=new Set;for(let m of g)g=a.get(m),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&pc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Gb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let m of k)if(k=m[0],l=m[1],"root"===k||l)g=a.get(k),void 0!==
119
+ g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;Gb++}b._dirtyLeaves=c;b._dirtyElements=d}function fe(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=fe(a[d],b);c.append(e)}return c}function ge(a,b){let c=X,d=Z,e=Y;X=a;Z=!0;Y=null;try{return b()}finally{X=c,Z=d,Y=e}}
120
+ function he(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=X,l=Z,m=Y,p=a._updating,n=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==n){Y=a;X=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();Q=R=P="";uc=2===w;xc=null;S=a;sc=a._config;tc=a._nodes;wc=S._listeners.mutation;yc=y;zc=x;Ac=e._nodeMap;Bc=b._nodeMap;vc=
121
+ b._readOnly;Cc=new Map(a._keyToDOMMap);var A=new Map;Dc=A;Rc("root",null);Dc=Cc=sc=Bc=Ac=zc=yc=tc=S=void 0;r=A}catch(L){L instanceof Error&&a._onError(L);if(ae)throw L;ie(a,null,c,b);qb(a);a._dirtyType=2;ae=!0;he(a);ae=!1;return}finally{n.observe(c,be),a._updating=p,X=k,Z=l,Y=m}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;x=a._updateTags;l=a._deferred;y=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
122
+ a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,I=a._pendingDecorators||U,da=b._nodeMap,N;for(N in I)da.has(N)||(I===U&&(I=Lb(a)),delete I[N]);d=d?null:D(a._window);if(a._editable&&null!==d&&(h||null===g||g.dirty)){Y=a;X=b;try{null!==n&&n.disconnect();if(h||null===g||g.dirty){var V=a._blockCursorElement;null!==V&&jc(V,a,c);$d(f,g,a,d,x,c,y)}a:{let L=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let sa=g.anchor,
123
+ tb=sa.getNode(),lc=sa.offset,He=tb.getChildrenSize();h=!1;V=null;if(lc===He){let la=tb.getChildAtIndex(lc-1);ic(la)&&(h=!0)}else{let la=tb.getChildAtIndex(lc);if(ic(la)){let Va=la.getPreviousSibling();if(null===Va||ic(Va))h=!0,V=a.getElementByKey(la.__key)}}if(h){let la=a.getElementByKey(tb.__key);if(null===L){let Va=a._config.theme,ub=document.createElement("div");ub.contentEditable="false";ub.setAttribute("data-lexical-cursor","true");let Da=Va.blockCursor;if(void 0!==Da){if("string"===typeof Da){let Ie=
124
+ Da.split(" ");Da=Va.blockCursor=Ie}void 0!==Da&&ub.classList.add(...Da)}a._blockCursorElement=L=ub}c.style.caretColor="transparent";null===V?la.appendChild(L):la.insertBefore(L,V);break a}}null!==L&&jc(L,a,c)}null!==n&&n.observe(c,be)}finally{Y=m,X=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),m=k.length,n=0;n<m;n++){let [L,sa]=k[n];r=c.get(sa);void 0!==r&&L(r,{dirtyLeaves:p,updateTags:x})}C(g)||null===g||null!==f&&f.is(g)||a.dispatchCommand(aa,void 0);f=a._pendingDecorators;null!==f&&
125
+ (a._decorators=f,a._pendingDecorators=null,je("decorator",a,!0,f));f=Mb(e);g=Mb(b);f!==g&&je("textcontent",a,!0,g);je("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:x});a._deferred=[];if(0!==l.length){b=a._updating;a._updating=!0;try{for(e=0;e<l.length;e++)l[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [L,sa]=b;ke(a,L,sa)}}}
126
+ function je(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}function T(a,b,c){if(!1===a._updating||Y!==a){let f=!1;a.update(()=>{f=T(a,b,c)});return f}let d=Rb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
127
127
  function le(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
128
128
  function ke(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new me(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=X;let k=Z,l=Y,m=a._updating;X=c;Z=!1;a._updating=!0;Y=a;try{g&&(a._headless?null!=h._selection&&(c._selection=h._selection.clone()):c._selection=Ud(a));let p=a._compositionKey;
129
- b();e=le(a,e);Xd(c,a);0!==a._dirtyType&&(e?de(c,a):ee(c,a),le(a),nc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let n=c._selection;if(C(n)){let r=c._nodeMap,w=n.focus.key;void 0!==r.get(n.anchor.key)&&void 0!==r.get(w)||q(19)}else qd(n)&&0===n._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();he(a);return}finally{X=f,Z=k,Y=l,
130
- a._updating=m,Hb=0}b=null!==a._window?window.event:null;b=null!=b?b.type:null;0!==a._dirtyType||ne(c,a)||null!==a._blockCursorElement&&"blur"===b?c._flushSync?(c._flushSync=!1,he(a)):g&&wb(()=>{he(a)}):(c._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):ke(a,b,c)}
131
- function oe(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=dc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&(Yd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Yd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Ib(a),Vd(f,e,d,-1)):Ib(a);c||gc(e)||e.canBeEmpty()||!e.isEmpty()||oe(e,b);b&&O(e)&&e.isEmpty()&&e.selectEnd()}}
132
- class pe{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Gb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
133
- a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:L(a)}getParentOrThrow(){let a=this.getParent();null===a&&q(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(gc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
134
- this.getTopLevelElement();null===a&&q(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:L(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=
135
- this.getLatest().__next;return null===a?null:L(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();F(this)&&b.unshift(this);F(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++){let e=b[d];if(c.has(e))return e}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;
136
- var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let 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){let b=this.isBefore(a),c=[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=F(e)?b?e.getFirstChild():e.getLastChild():
137
- null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&q(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=H()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&q(69);return a}getWritable(){G();var a=I(),b=H();a=a._nodeMap;
138
- let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&(f._cachedNodes=null);if(b.has(c))return Jb(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;F(d)&&F(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Jb(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){q(70)}updateDOM(){q(71)}exportDOM(a){return{element:this.createDOM(a._config,
139
- a)}}exportJSON(){q(72)}static importJSON(){q(18)}remove(a){oe(this,!0,a)}replace(a,b){G();var c=u();null!==c&&(c=c.clone());ic(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;Ib(g);let k=d.getPreviousSibling(),l=d.getNextSibling(),m=d.__prev,p=d.__next,n=d.__parent;oe(d,!1);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=m;null===l?a.__last=f:l.getWritable().__prev=f;g.__next=p;g.__parent=n;a.__size=h;b&&this.getChildren().forEach(r=>
140
- {g.append(r)});C(c)&&(pb(c),b=c.anchor,c=c.focus,b.key===e&&yd(b,g),c.key===e&&yd(c,g));Kb()===e&&K(f);return g}insertAfter(a,b=!0){G();ic(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();Ib(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let l=d.__key,
141
- m=c.__next;null===e?k.__last=l:e.getWritable().__prev=l;k.__size++;c.__next=l;d.__next=m;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),Vd(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){G();ic(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Ib(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=
142
- e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),Vd(c,b,k));return a}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):F(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():F(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,
129
+ b();e=le(a,e);Xd(c,a);0!==a._dirtyType&&(e?de(c,a):ee(c,a),le(a),mc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let n=c._selection;if(C(n)){let r=c._nodeMap,w=n.focus.key;void 0!==r.get(n.anchor.key)&&void 0!==r.get(w)||q(19)}else qd(n)&&0===n._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();he(a);return}finally{X=f,Z=k,Y=l,
130
+ a._updating=m,Gb=0}b=null!==a._window?window.event:null;b=null!=b?b.type:null;0!==a._dirtyType||ne(c,a)||null!==a._blockCursorElement&&"blur"===b?c._flushSync?(c._flushSync=!1,he(a)):g&&vb(()=>{he(a)}):(c._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):ke(a,b,c)}
131
+ function oe(a,b,c){F();var d=a.__key;let e=a.getParent();if(null!==e){var f=cc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&(Yd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Yd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Hb(a),Vd(f,e,d,-1)):Hb(a);c||fc(e)||e.canBeEmpty()||!e.isEmpty()||oe(e,b);b&&O(e)&&e.isEmpty()&&e.selectEnd()}}
132
+ class pe{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Fb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=K(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
133
+ a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:K(a)}getParentOrThrow(){let a=this.getParent();null===a&&q(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(fc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
134
+ this.getTopLevelElement();null===a&&q(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:K(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=
135
+ this.getLatest().__next;return null===a?null:K(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(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++){let e=b[d];if(c.has(e))return e}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;
136
+ var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let 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){let b=this.isBefore(a),c=[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=E(e)?b?e.getFirstChild():e.getLastChild():
137
+ null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&q(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=G()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=K(this.__key);null===a&&q(69);return a}getWritable(){F();var a=H(),b=G();a=a._nodeMap;
138
+ let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&(f._cachedNodes=null);if(b.has(c))return Ib(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;E(d)&&E(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Ib(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){q(70)}updateDOM(){q(71)}exportDOM(a){return{element:this.createDOM(a._config,
139
+ a)}}exportJSON(){q(72)}static importJSON(){q(18)}remove(a){oe(this,!0,a)}replace(a,b){F();var c=u();null!==c&&(c=c.clone());hc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;Hb(g);let k=d.getPreviousSibling(),l=d.getNextSibling(),m=d.__prev,p=d.__next,n=d.__parent;oe(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=m;null===l?a.__last=f:l.getWritable().__prev=f;g.__next=p;g.__parent=n;a.__size=h;b&&this.getChildren().forEach(r=>
140
+ {g.append(r)});C(c)&&(nb(c),b=c.anchor,c=c.focus,b.key===e&&yd(b,g),c.key===e&&yd(c,g));Jb()===e&&J(f);return g}insertAfter(a,b=!0){F();hc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();Hb(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let l=d.__key,
141
+ m=c.__next;null===e?k.__last=l:e.getWritable().__prev=l;k.__size++;c.__next=l;d.__next=m;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),Vd(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){F();hc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Hb(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=
142
+ e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),Vd(c,b,k));return a}selectPrevious(a,b){F();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){F();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,
143
143
  a))}markDirty(){this.getWritable()}}class qe extends pe{constructor(a){super(a)}decorate(){q(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof qe}
144
- class re extends pe{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return db[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
145
- this.getChildrenSize()}isDirty(){let a=H()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(F(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(F(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
146
- this.getLastChild();for(;null!==a;){if(F(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],F(a)&&a.getLastDescendant()||a||null;a=b[a];return F(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:L(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&q(45);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:L(a)}getLastChildOrThrow(){let a=
147
- this.getLastChild();null===a&&q(96);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();F(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==
148
- a?(a=cb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||F(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&(a=this.getLastChild(),B(a)||F(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return Td(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();
149
- return F(a)||B(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return F(a)||B(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?cb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;
150
- return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let l=this.getChildAtIndex(a+b),m=null,p=e-b+d;if(0!==a)if(a===e)m=this.getLastChild();else{var n=this.getChildAtIndex(a);null!==n&&(m=n.getPreviousSibling())}if(0<b){var r=null===m?this.getFirstChild():m.getNextSibling();for(n=0;n<b;n++){if(null===r)throw Error("splice: sibling not found");var w=r.getNextSibling(),y=r.__key;r=r.getWritable();Ib(r);k.push(y);r=w}}n=m;for(w=0;w<d;w++){y=c[w];
151
- null!==n&&y.is(n)&&(m=n=n.getPreviousSibling());r=y.getWritable();r.__parent===g&&p--;Ib(r);let x=y.__key;null===n?(f.__first=x,r.__prev=null):(n=n.getWritable(),n.__next=x,r.__prev=n.__key);y.__key===g&&q(76);r.__parent=g;h.push(x);n=y}a+b===e?null!==n&&(n.getWritable().__next=null,f.__last=n.__key):null!==l&&(a=l.getWritable(),null!==n?(b=n.getWritable(),a.__prev=n.__key,b.__next=l.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:A}=a;se(x,
152
- k,h)&&Yd(x,x.getNode(),this,m,l);se(A,k,h)&&Yd(A,A.getNode(),this,m,l);0!==p||this.canBeEmpty()||gc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}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}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
153
- function F(a){return a instanceof re}function se(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
154
- class te extends re{static getType(){return"root"}static clone(){return new te}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Lb()&&0!==H()._dirtyType||null===a?super.getTextContent():a}remove(){q(52)}replace(){q(53)}insertBefore(){q(54)}insertAfter(){q(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];F(c)||z(c)||q(56)}return super.append(...a)}static importJSON(a){let b=Ob();b.setFormat(a.format);
144
+ class re extends pe{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return bb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
145
+ this.getChildrenSize()}isDirty(){let a=G()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(E(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(E(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
146
+ this.getLastChild();for(;null!==a;){if(E(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:K(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&q(45);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:K(a)}getLastChildOrThrow(){let a=
147
+ this.getLastChild();null===a&&q(96);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();E(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==
148
+ a?(a=ab[a],0!==(this.getFormat()&a)):!1}select(a,b){F();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||E(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&(a=this.getLastChild(),B(a)||E(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return Td(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();
149
+ return E(a)||B(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return E(a)||B(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?ab[a]:0;return this}setIndent(a){this.getWritable().__indent=a;
150
+ return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let l=this.getChildAtIndex(a+b),m=null,p=e-b+d;if(0!==a)if(a===e)m=this.getLastChild();else{var n=this.getChildAtIndex(a);null!==n&&(m=n.getPreviousSibling())}if(0<b){var r=null===m?this.getFirstChild():m.getNextSibling();for(n=0;n<b;n++){null===r&&q(100);var w=r.getNextSibling(),y=r.__key;r=r.getWritable();Hb(r);k.push(y);r=w}}n=m;for(w=0;w<d;w++){y=c[w];null!==n&&y.is(n)&&(m=n=n.getPreviousSibling());
151
+ r=y.getWritable();r.__parent===g&&p--;Hb(r);let x=y.__key;null===n?(f.__first=x,r.__prev=null):(n=n.getWritable(),n.__next=x,r.__prev=n.__key);y.__key===g&&q(76);r.__parent=g;h.push(x);n=y}a+b===e?null!==n&&(n.getWritable().__next=null,f.__last=n.__key):null!==l&&(a=l.getWritable(),null!==n?(b=n.getWritable(),a.__prev=n.__key,b.__next=l.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:A}=a;se(x,k,h)&&Yd(x,x.getNode(),this,m,l);se(A,k,h)&&Yd(A,
152
+ A.getNode(),this,m,l);0!==p||this.canBeEmpty()||fc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}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}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
153
+ function E(a){return a instanceof re}function se(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
154
+ class te extends re{static getType(){return"root"}static clone(){return new te}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Kb()&&0!==G()._dirtyType||null===a?super.getTextContent():a}remove(){q(52)}replace(){q(53)}insertBefore(){q(54)}insertAfter(){q(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||z(c)||q(56)}return super.append(...a)}static importJSON(a){let b=Nb();b.setFormat(a.format);
155
155
  b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function O(a){return a instanceof te}function ne(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 ue(){return new me(new Map([["root",new te]]))}
156
- function ve(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&q(58);let c=b.children;if(F(a)){Array.isArray(c)||q(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=ve(a[d]);c.push(e)}}return b}
157
- class me{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){return ge(this,a)}clone(a){a=new me(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ge(this,()=>({root:ve(Ob())}))}}
158
- class we extends pe{static getType(){return"linebreak"}static clone(a){return new we(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:xe,priority:0}}}}static importJSON(){return Ld()}exportJSON(){return{type:"linebreak",version:1}}}function xe(){return{node:Ld()}}function Ld(){return hc(new we)}
159
- function Fb(a){return a instanceof we}function ye(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ze(a,b){return b&1?"strong":b&2?"em":"span"}
160
- function Ae(a,b,c,d,e){a=d.classList;d=Xb(e,"base");void 0!==d&&a.add(...d);d=Xb(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in ab)h=ab[k],d=Xb(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
161
- function Be(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Xa:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Qa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,l]=a;0!==k&&d.deleteData(h,k);d.insertData(h,l)}else d.nodeValue=a}function Ce(a,b){b=document.createElement(b);b.appendChild(a);return b}
162
- class De extends pe{static getType(){return"text"}static clone(a){return new De(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}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return fb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Kb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
163
- (this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=ab[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Db(c,a,b)}createDOM(a){var b=this.__format,c=ye(this,b);let d=ze(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Be(this.__text,c,this);
156
+ function ve(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&q(58);let c=b.children;if(E(a)){Array.isArray(c)||q(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=ve(a[d]);c.push(e)}}return b}
157
+ class me{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){return ge(this,a)}clone(a){a=new me(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ge(this,()=>({root:ve(Nb())}))}}
158
+ class we extends pe{static getType(){return"linebreak"}static clone(a){return new we(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:xe,priority:0}}}}static importJSON(){return Ld()}exportJSON(){return{type:"linebreak",version:1}}}function xe(){return{node:Ld()}}function Ld(){return gc(new we)}
159
+ function Eb(a){return a instanceof we}function ye(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ze(a,b){return b&1?"strong":b&2?"em":"span"}
160
+ function Ae(a,b,c,d,e){a=d.classList;d=Wb(e,"base");void 0!==d&&a.add(...d);d=Wb(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Za)h=Za[k],d=Wb(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
161
+ function Be(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ua:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Pa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,l]=a;0!==k&&d.deleteData(h,k);d.insertData(h,l)}else d.nodeValue=a}function Ce(a,b){b=document.createElement(b);b.appendChild(a);return b}
162
+ class De extends pe{static getType(){return"text"}static clone(a){return new De(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}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return db[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Jb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
163
+ (this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Za[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Cb(c,a,b)}createDOM(a){var b=this.__format,c=ye(this,b);let d=ze(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Be(this.__text,c,this);
164
164
  a=a.theme.text;void 0!==a&&Ae(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ye(this,e);let h=ye(this,f);var k=ze(this,e);let l=ze(this,f);if((null===g?k:g)!==(null===h?l:h))return!0;if(g===h&&k!==l)return e=b.firstChild,null==e&&q(48),a=g=document.createElement(l),Be(d,a,this),c=c.theme.text,void 0!==c&&Ae(l,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&q(49));Be(d,k,this);c=c.theme.text;
165
165
  void 0!==c&&e!==f&&Ae(l,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Ee,priority:0}),b:()=>({conversion:Fe,priority:0}),br:()=>({conversion:Ge,priority:0}),code:()=>({conversion:Je,priority:0}),em:()=>({conversion:Je,priority:0}),i:()=>({conversion:Je,priority:0}),span:()=>({conversion:Ke,priority:0}),strong:()=>({conversion:Je,priority:0}),sub:()=>({conversion:Je,priority:0}),sup:()=>({conversion:Je,priority:0}),u:()=>({conversion:Je,
166
166
  priority:0})}}static importJSON(a){let b=M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&(this.hasFormat("bold")&&(a=Ce(a,"b")),this.hasFormat("italic")&&(a=Ce(a,"i")),this.hasFormat("strikethrough")&&(a=Ce(a,"s")),this.hasFormat("underline")&&(a=Ce(a,"u")));return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),
167
- type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?ab[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?bb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=ab[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=eb[a];if(this.__mode===
168
- a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=Kb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Td(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,
169
- h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Kb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var l=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),
170
- p=b.__detail;g=!1;b.isSegmented()?(h=M(l),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=l);b=u();h=[h];l=l.length;for(let w=1;w<f;w++){var n=a[w],r=n.length;n=M(n).getWritable();n.__format=k;n.__style=m;n.__detail=p;let y=n.__key;r=l+r;if(C(b)){let x=b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>l&&x.offset<=r&&(x.key=y,x.offset-=l,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>l&&A.offset<=r&&(A.key=y,A.offset-=l,b.dirty=!0)}e===d&&K(y);l=r;h.push(n)}d=this.getPreviousSibling();
171
- e=this.getNextSibling();null!==d&&Jb(d);null!==e&&Jb(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Vd(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Kb()===d&&K(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Zd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Zd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?
167
+ type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?Za[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?$a[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=Za[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=cb[a];if(this.__mode===
168
+ a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){F();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=Jb(),d!==c.anchor.key&&d!==c.focus.key||J(e),c.setTextNodeRange(this,a,this,b);else return Td(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,
169
+ h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){F();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Jb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var l=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),
170
+ p=b.__detail;g=!1;b.isSegmented()?(h=M(l),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=l);b=u();h=[h];l=l.length;for(let w=1;w<f;w++){var n=a[w],r=n.length;n=M(n).getWritable();n.__format=k;n.__style=m;n.__detail=p;let y=n.__key;r=l+r;if(C(b)){let x=b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>l&&x.offset<=r&&(x.key=y,x.offset-=l,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>l&&A.offset<=r&&(A.key=y,A.offset-=l,b.dirty=!0)}e===d&&J(y);l=r;h.push(n)}d=this.getPreviousSibling();
171
+ e=this.getNextSibling();null!==d&&Ib(d);null!==e&&Ib(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Vd(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Jb()===d&&J(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Zd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Zd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?
172
172
  c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
173
- function Ke(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}function Ge(){return{node:ba.$createLineBreakNode()}}
173
+ function Ke(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}function Ge(){return{node:Ld()}}
174
174
  function Fe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ee(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:M(a)}}let Le={code:"code",em:"italic",i:"italic",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
175
- function Je(a){let b=Le[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return hc(new De(a))}function B(a){return a instanceof De}
176
- class Me extends re{static getType(){return"paragraph"}static clone(a){return new Me(a.__key)}createDOM(a){let b=document.createElement("p");a=Xb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ne,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
175
+ function Je(a){let b=Le[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return gc(new De(a))}function B(a){return a instanceof De}
176
+ class Me extends re{static getType(){return"paragraph"}static clone(a){return new Me(a.__key)}createDOM(a){let b=document.createElement("p");a=Wb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ne,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
177
177
  0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=Ad();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=Ad();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
178
- this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ne(){return{node:Ad()}}function Ad(){return hc(new Me)}
178
+ this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ne(){return{node:Ad()}}function Ad(){return gc(new Me)}
179
179
  function ie(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=ue();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=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
180
180
  function Oe(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
181
181
  class Pe{constructor(a,b,c,d,e,f){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,editable:new Set,mutation:new Map,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=
182
- new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Tb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
182
+ new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Sb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
183
183
  this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let 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(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&q(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>
184
- 0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&q(37);let d=c.transforms;d.add(b);Pb(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let 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){let b=
185
- this._rootElement;if(a!==b){let e=Xb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ie(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==ed&&(ed--,0===ed&&b.ownerDocument.removeEventListener("selectionchange",td));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Sb(c);d=d[d.length-1]._key;sd.get(d)===c&&sd.delete(d)}else sd.delete(c._key);b.__lexicalEditor=null}c=rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
186
- []}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,sb(this),this._updateTags.add("history-merge"),he(this),this._config.disableEvents||vd(a,this),null!=e&&a.classList.add(...e)):this._window=null;je("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
187
- b){a.isEmpty()&&q(38);rb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),he(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);he(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ue(),d=X,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
188
- new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{fe(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,X=d,Z=e,Y=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Ob();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
189
- a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=E(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,je("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Qe extends re{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
190
- function Jd(a){return a instanceof Qe}class Re extends re{}function Hd(a){return a instanceof Re}class Se extends re{}function Id(a){return a instanceof Se}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=hc;exports.$copyNode=function(a){a=a.constructor.clone(a);Gb(a,null);return a};exports.$createLineBreakNode=Ld;exports.$createNodeSelection=Od;exports.$createParagraphNode=Ad;
191
- exports.$createRangeSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Dd(a,b,0)};exports.$createTextNode=M;exports.$getAdjacentNode=$b;exports.$getNearestNodeFromDOMNode=mb;exports.$getNearestRootOrShadowRoot=fc;exports.$getNodeByKey=L;exports.$getPreviousSelection=Vb;exports.$getRoot=Ob;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=ec;
192
- exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Ob().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Eb;exports.$isLineBreakNode=Fb;exports.$isNodeSelection=qd;exports.$isParagraphNode=function(a){return a instanceof Me};exports.$isRangeSelection=C;exports.$isRootNode=O;exports.$isRootOrShadowRoot=gc;exports.$isTextNode=B;
193
- exports.$nodesOfType=function(a){var b=I();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=rc;exports.$parseSerializedNode=function(a){return fe(a,H()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=pb;exports.BLUR_COMMAND=Ma;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
194
- exports.CLICK_COMMAND=ea;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ja;exports.COPY_COMMAND=Ja;exports.CUT_COMMAND=Ka;exports.DELETE_CHARACTER_COMMAND=fa;exports.DELETE_LINE_COMMAND=oa;exports.DELETE_WORD_COMMAND=na;
195
- exports.DEPRECATED_$createGridSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Ed("root",a,b)};exports.DEPRECATED_$isGridCellNode=Jd;exports.DEPRECATED_$isGridNode=Hd;exports.DEPRECATED_$isGridRowNode=Id;exports.DEPRECATED_$isGridSelection=Fd;exports.DEPRECATED_GridCellNode=Qe;exports.DEPRECATED_GridNode=Re;exports.DEPRECATED_GridRowNode=Se;exports.DRAGEND_COMMAND=Ia;exports.DRAGOVER_COMMAND=Ha;exports.DRAGSTART_COMMAND=Ga;exports.DROP_COMMAND=Fa;
196
- exports.DecoratorNode=qe;exports.ElementNode=re;exports.FOCUS_COMMAND=La;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=pa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ha;exports.INSERT_PARAGRAPH_COMMAND=ia;exports.KEY_ARROW_DOWN_COMMAND=xa;exports.KEY_ARROW_LEFT_COMMAND=ua;exports.KEY_ARROW_RIGHT_COMMAND=sa;exports.KEY_ARROW_UP_COMMAND=wa;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Da;exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ca;
197
- exports.KEY_MODIFIER_COMMAND=Na;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Ea;exports.LineBreakNode=we;exports.MOVE_TO_END=ta;exports.MOVE_TO_START=va;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ka;exports.ParagraphNode=Me;exports.REDO_COMMAND=ra;exports.REMOVE_TEXT_COMMAND=ma;exports.RootNode=te;exports.SELECTION_CHANGE_COMMAND=ca;exports.TextNode=De;exports.UNDO_COMMAND=qa;exports.createCommand=function(){return{}};
198
- exports.createEditor=function(a){var b=a||{},c=Y,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=ue(),h=b.namespace||(null!==e?e._config.namespace:Tb()),k=b.editorState,l=[te,De,we,Me,...(b.nodes||[])],m=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<l.length;c++){let n=l[c];var p=null;"function"!==typeof n&&(p=n,n=p.replace,p=p.with);let r=n.getType();a.set(r,{klass:n,replace:p,transforms:new Set})}d=new Pe(g,
184
+ 0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&q(37);let d=c.transforms;d.add(b);Ob(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return T(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
185
+ this._rootElement;if(a!==b){let e=Wb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ie(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==ed&&(ed--,0===ed&&b.ownerDocument.removeEventListener("selectionchange",td));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Rb(c);d=d[d.length-1]._key;sd.get(d)===c&&sd.delete(d)}else sd.delete(c._key);b.__lexicalEditor=null}c=rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
186
+ []}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,qb(this),this._updateTags.add("history-merge"),he(this),this._config.disableEvents||vd(a,this),null!=e&&a.classList.add(...e)):this._window=null;je("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
187
+ b){a.isEmpty()&&q(38);pb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),he(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);he(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ue(),d=X,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
188
+ new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{fe(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,X=d,Z=e,Y=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Nb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
189
+ a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=D(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,je("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Qe extends re{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
190
+ function Jd(a){return a instanceof Qe}class Re extends re{}function Hd(a){return a instanceof Re}class Se extends re{}function Id(a){return a instanceof Se}exports.$addUpdateTag=function(a){F();G()._updateTags.add(a)};exports.$applyNodeReplacement=gc;exports.$copyNode=function(a){a=a.constructor.clone(a);Fb(a,null);return a};exports.$createLineBreakNode=Ld;exports.$createNodeSelection=Od;exports.$createParagraphNode=Ad;
191
+ exports.$createRangeSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Dd(a,b,0)};exports.$createTextNode=M;exports.$getAdjacentNode=Zb;exports.$getNearestNodeFromDOMNode=kb;exports.$getNearestRootOrShadowRoot=ec;exports.$getNodeByKey=K;exports.$getPreviousSelection=Ub;exports.$getRoot=Nb;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=dc;
192
+ exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Nb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=E;exports.$isInlineElementOrDecoratorNode=function(a){return E(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Db;exports.$isLineBreakNode=Eb;exports.$isNodeSelection=qd;exports.$isParagraphNode=function(a){return a instanceof Me};exports.$isRangeSelection=C;exports.$isRootNode=O;exports.$isRootOrShadowRoot=fc;exports.$isTextNode=B;
193
+ exports.$nodesOfType=function(a){var b=H();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=qc;exports.$parseSerializedNode=function(a){return fe(a,G()._nodes)};exports.$setCompositionKey=J;exports.$setSelection=nb;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
194
+ exports.CLICK_COMMAND=ba;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ha;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=ca;exports.DELETE_LINE_COMMAND=ma;exports.DELETE_WORD_COMMAND=ka;
195
+ exports.DEPRECATED_$createGridSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Ed("root",a,b)};exports.DEPRECATED_$isGridCellNode=Jd;exports.DEPRECATED_$isGridNode=Hd;exports.DEPRECATED_$isGridRowNode=Id;exports.DEPRECATED_$isGridSelection=Fd;exports.DEPRECATED_GridCellNode=Qe;exports.DEPRECATED_GridNode=Re;exports.DEPRECATED_GridRowNode=Se;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
196
+ exports.DecoratorNode=qe;exports.ElementNode=re;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=na;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=fa;exports.KEY_ARROW_DOWN_COMMAND=wa;exports.KEY_ARROW_LEFT_COMMAND=ta;exports.KEY_ARROW_RIGHT_COMMAND=qa;exports.KEY_ARROW_UP_COMMAND=va;exports.KEY_BACKSPACE_COMMAND=za;exports.KEY_DELETE_COMMAND=Ba;exports.KEY_ENTER_COMMAND=xa;exports.KEY_ESCAPE_COMMAND=Aa;
197
+ exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=ya;exports.KEY_TAB_COMMAND=Ca;exports.LineBreakNode=we;exports.MOVE_TO_END=ra;exports.MOVE_TO_START=ua;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ia;exports.ParagraphNode=Me;exports.REDO_COMMAND=pa;exports.REMOVE_TEXT_COMMAND=ja;exports.RootNode=te;exports.SELECTION_CHANGE_COMMAND=aa;exports.TextNode=De;exports.UNDO_COMMAND=oa;exports.createCommand=function(){return{}};
198
+ exports.createEditor=function(a){var b=a||{},c=Y,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=ue(),h=b.namespace||(null!==e?e._config.namespace:Sb()),k=b.editorState,l=[te,De,we,Me,...(b.nodes||[])],m=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<l.length;c++){let n=l[c];var p=null;"function"!==typeof n&&(p=n,n=p.replace,p=p.with);let r=n.getType();a.set(r,{klass:n,replace:p,transforms:new Set})}d=new Pe(g,
199
199
  e,a,{disableEvents:f,namespace:h,theme:d},m?m:console.error,Oe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
@@ -5,10 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { EditorConfig, LexicalEditor } from '../LexicalEditor';
8
+ import type { EditorConfig, LexicalEditor, Spread } from '../LexicalEditor';
9
9
  import type { DOMConversionMap, DOMExportOutput, NodeKey, SerializedLexicalNode } from '../LexicalNode';
10
10
  import type { GridSelection, NodeSelection, RangeSelection } from '../LexicalSelection';
11
- import { Spread } from 'lexical';
12
11
  import { LexicalNode } from '../LexicalNode';
13
12
  export declare type SerializedTextNode = Spread<{
14
13
  detail: number;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.7.3",
12
+ "version": "0.7.5",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",