lexical 0.2.0 → 0.2.1

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.d.ts CHANGED
@@ -31,7 +31,7 @@ export var KEY_ARROW_RIGHT_COMMAND: LexicalCommand<KeyboardEvent>;
31
31
  export var KEY_ARROW_LEFT_COMMAND: LexicalCommand<KeyboardEvent>;
32
32
  export var KEY_ARROW_UP_COMMAND: LexicalCommand<KeyboardEvent>;
33
33
  export var KEY_ARROW_DOWN_COMMAND: LexicalCommand<KeyboardEvent>;
34
- export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent>;
34
+ export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent | null>;
35
35
  export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
36
36
  export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
37
37
  export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
package/Lexical.dev.js CHANGED
@@ -104,9 +104,9 @@ const documentMode = CAN_USE_DOM && 'documentMode' in document ? document.docume
104
104
  const IS_APPLE = CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
105
105
  const IS_FIREFOX = CAN_USE_DOM && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
106
106
  const CAN_USE_BEFORE_INPUT = CAN_USE_DOM && 'InputEvent' in window && !documentMode ? 'getTargetRanges' in new window.InputEvent('input') : false;
107
- const IS_SAFARI = CAN_USE_DOM && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); // Keep these in case we need to use them in the future.
107
+ const IS_SAFARI = CAN_USE_DOM && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent);
108
+ const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; // Keep these in case we need to use them in the future.
108
109
  // export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
109
- // export const IS_IOS: boolean = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
110
110
  // export const IS_CHROME: boolean = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
111
111
  // export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
112
112
 
@@ -422,6 +422,11 @@ function internalGetRoot(editorState) {
422
422
  }
423
423
  function $setSelection(selection) {
424
424
  const editorState = getActiveEditorState();
425
+
426
+ if (selection !== null && Object.isFrozen(selection)) {
427
+ console.warn('$setSelection called on frozen selection object. Ensure selection is cloned before passing in.');
428
+ }
429
+
425
430
  editorState._selection = selection;
426
431
  }
427
432
  function $flushMutations$1() {
@@ -533,7 +538,7 @@ function $updateTextNodeFromDOMContent(textNode, textContent, anchorOffset, focu
533
538
  if (normalizedTextContent === '') {
534
539
  $setCompositionKey(null);
535
540
 
536
- if (!IS_SAFARI) {
541
+ if (!IS_SAFARI && !IS_IOS) {
537
542
  // For composition (mainly Android), we have to remove the node on a later update
538
543
  const editor = getActiveEditor();
539
544
  setTimeout(() => {
@@ -2634,7 +2639,7 @@ function $flushMutations(editor, mutations, observer) {
2634
2639
  targetDOM, targetNode);
2635
2640
  }
2636
2641
  } else if (type === 'childList') {
2637
- shouldRevertSelection = true; // We attempt to "undo" any changes that have occured outside
2642
+ shouldRevertSelection = true; // We attempt to "undo" any changes that have occurred outside
2638
2643
  // of Lexical. We want Lexical's editor state to be source of truth.
2639
2644
  // To the user, these will look like no-ops.
2640
2645
 
@@ -3733,7 +3738,8 @@ class RangeSelection {
3733
3738
  const startingNode = target;
3734
3739
  siblings.push(...nextSiblings);
3735
3740
  const firstNode = nodes[0];
3736
- let didReplaceOrMerge = false; // Time to insert the nodes!
3741
+ let didReplaceOrMerge = false;
3742
+ let lastNodeInserted = null; // Time to insert the nodes!
3737
3743
 
3738
3744
  for (let i = 0; i < nodes.length; i++) {
3739
3745
  const node = nodes[i];
@@ -3796,11 +3802,13 @@ class RangeSelection {
3796
3802
 
3797
3803
  if ($isElementNode(target)) {
3798
3804
  for (let s = 0; s < childrenLength; s++) {
3799
- target.append(children[s]);
3805
+ lastNodeInserted = children[s];
3806
+ target.append(lastNodeInserted);
3800
3807
  }
3801
3808
  } else {
3802
3809
  for (let s = childrenLength - 1; s >= 0; s--) {
3803
- target.insertAfter(children[s]);
3810
+ lastNodeInserted = children[s];
3811
+ target.insertAfter(lastNodeInserted);
3804
3812
  }
3805
3813
 
3806
3814
  target = target.getParentOrThrow();
@@ -3833,6 +3841,8 @@ class RangeSelection {
3833
3841
  didReplaceOrMerge = false;
3834
3842
 
3835
3843
  if ($isElementNode(target)) {
3844
+ lastNodeInserted = node;
3845
+
3836
3846
  if ($isDecoratorNode(node) && node.isTopLevel()) {
3837
3847
  target = target.insertAfter(node);
3838
3848
  } else if (!$isElementNode(node)) {
@@ -3865,6 +3875,7 @@ class RangeSelection {
3865
3875
  }
3866
3876
  }
3867
3877
  } else if (!$isElementNode(node) || $isDecoratorNode(target) && target.isTopLevel()) {
3878
+ lastNodeInserted = node;
3868
3879
  target = target.insertAfter(node);
3869
3880
  } else {
3870
3881
  target = node.getParentOrThrow(); // Re-try again with the target being the parent
@@ -3891,7 +3902,9 @@ class RangeSelection {
3891
3902
  }
3892
3903
 
3893
3904
  if ($isElementNode(target)) {
3894
- const lastChild = target.getLastDescendant();
3905
+ // If the last node to be inserted was a text node,
3906
+ // then we should attempt to move selection to that.
3907
+ const lastChild = $isTextNode(lastNodeInserted) ? lastNodeInserted : target.getLastDescendant();
3895
3908
 
3896
3909
  if (!selectStart) {
3897
3910
  // Handle moving selection to end for elements
@@ -6273,6 +6286,7 @@ class EditorState {
6273
6286
  *
6274
6287
  */
6275
6288
  const PASS_THROUGH_COMMAND = Object.freeze({});
6289
+ const ANDROID_COMPOSITION_LATENCY = 30;
6276
6290
  const rootElementEvents = [// $FlowIgnore bad event inheritance
6277
6291
  ['keydown', onKeyDown], // $FlowIgnore bad event inheritance
6278
6292
  ['compositionstart', onCompositionStart], // $FlowIgnore bad event inheritance
@@ -6287,7 +6301,7 @@ if (CAN_USE_BEFORE_INPUT) {
6287
6301
  rootElementEvents.push(['drop', PASS_THROUGH_COMMAND]);
6288
6302
  }
6289
6303
 
6290
- let lastKeyWasMaybeAndroidSoftKey = false;
6304
+ let lastKeyDownTimeStamp = 0;
6291
6305
  let rootElementsRegistered = 0;
6292
6306
 
6293
6307
  function onSelectionChange(domSelection, editor, isActive) {
@@ -6398,7 +6412,7 @@ function onBeforeInput(event, editor) {
6398
6412
  updateEditor(editor, () => {
6399
6413
  node.select();
6400
6414
  });
6401
- }, 20);
6415
+ }, ANDROID_COMPOSITION_LATENCY);
6402
6416
  }
6403
6417
  }
6404
6418
  }
@@ -6419,7 +6433,14 @@ function onBeforeInput(event, editor) {
6419
6433
  // Used for Android
6420
6434
  $setCompositionKey(null);
6421
6435
  event.preventDefault();
6422
- dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
6436
+ lastKeyDownTimeStamp = 0;
6437
+ dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true); // Fixes an Android bug where selection flickers when backspacing
6438
+
6439
+ setTimeout(() => {
6440
+ editor.update(() => {
6441
+ $setCompositionKey(null);
6442
+ });
6443
+ }, ANDROID_COMPOSITION_LATENCY);
6423
6444
  return;
6424
6445
  }
6425
6446
 
@@ -6599,7 +6620,7 @@ function onInput(event, editor) {
6599
6620
  dispatchCommand(editor, INSERT_TEXT_COMMAND, data);
6600
6621
  } else {
6601
6622
  $updateSelectedTextFromDOM(editor, null);
6602
- } // Also flush any other mutations that might have occured
6623
+ } // Also flush any other mutations that might have occurred
6603
6624
  // since the change.
6604
6625
 
6605
6626
 
@@ -6615,7 +6636,9 @@ function onCompositionStart(event, editor) {
6615
6636
  const anchor = selection.anchor;
6616
6637
  $setCompositionKey(anchor.key);
6617
6638
 
6618
- if (!lastKeyWasMaybeAndroidSoftKey || anchor.type === 'element' || !selection.isCollapsed() || selection.anchor.getNode().getFormat() !== selection.format) {
6639
+ if ( // If it has been 30ms since the last keydown, then we should
6640
+ // apply the empty space heuristic.
6641
+ event.timeStamp < lastKeyDownTimeStamp + ANDROID_COMPOSITION_LATENCY || anchor.type === 'element' || !selection.isCollapsed() || selection.anchor.getNode().getFormat() !== selection.format) {
6619
6642
  // We insert an empty space, ready for the composition
6620
6643
  // to get inserted into the new node we create. If
6621
6644
  // we don't do this, Safari will fail on us because
@@ -6629,30 +6652,41 @@ function onCompositionStart(event, editor) {
6629
6652
  function onCompositionEnd(event, editor) {
6630
6653
  updateEditor(editor, () => {
6631
6654
  const compositionKey = editor._compositionKey;
6632
- $setCompositionKey(null); // Handle termination of composition, as it can sometimes
6633
- // move to an adjacent DOM node when backspacing.
6655
+ $setCompositionKey(null);
6656
+ const data = event.data; // Handle termination of composition.
6657
+
6658
+ if (compositionKey !== null && data != null) {
6659
+ // It can sometimes move to an adjacent DOM node when backspacing.
6660
+ // So check for the empty case.
6661
+ if (data === '') {
6662
+ const node = $getNodeByKey(compositionKey);
6663
+ const textNode = getDOMTextNode(editor.getElementByKey(compositionKey));
6664
+
6665
+ if (textNode !== null && $isTextNode(node)) {
6666
+ $updateTextNodeFromDOMContent(node, textNode.nodeValue, null, null, true);
6667
+ }
6634
6668
 
6635
- if (compositionKey !== null && event.data === '') {
6636
- const node = $getNodeByKey(compositionKey);
6637
- const textNode = getDOMTextNode(editor.getElementByKey(compositionKey));
6669
+ return;
6670
+ } else if (data[data.length - 1] === '\n') {
6671
+ const selection = $getSelection();
6638
6672
 
6639
- if (textNode !== null && $isTextNode(node)) {
6640
- $updateTextNodeFromDOMContent(node, textNode.nodeValue, null, null, true);
6673
+ if ($isRangeSelection(selection)) {
6674
+ // If the last character is a line break, we also need to insert
6675
+ // a line break.
6676
+ const focus = selection.focus;
6677
+ selection.anchor.set(focus.key, focus.offset, focus.type);
6678
+ dispatchCommand(editor, KEY_ENTER_COMMAND, null);
6679
+ return;
6680
+ }
6641
6681
  }
6642
-
6643
- return;
6644
6682
  }
6645
6683
 
6646
6684
  $updateSelectedTextFromDOM(editor, event);
6647
6685
  });
6648
6686
  }
6649
6687
 
6650
- function updateAndroidSoftKeyFlagIfAny(event) {
6651
- lastKeyWasMaybeAndroidSoftKey = event.key === 'Unidentified' && event.keyCode === 229;
6652
- }
6653
-
6654
6688
  function onKeyDown(event, editor) {
6655
- updateAndroidSoftKeyFlagIfAny(event);
6689
+ lastKeyDownTimeStamp = event.timeStamp;
6656
6690
 
6657
6691
  if (editor.isComposing()) {
6658
6692
  return;
@@ -6685,6 +6719,7 @@ function onKeyDown(event, editor) {
6685
6719
  if (isBackspace(keyCode)) {
6686
6720
  dispatchCommand(editor, KEY_BACKSPACE_COMMAND, event);
6687
6721
  } else {
6722
+ event.preventDefault();
6688
6723
  dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
6689
6724
  }
6690
6725
  } else if (isEscape(keyCode)) {
@@ -8205,7 +8240,7 @@ class LexicalEditor {
8205
8240
  *
8206
8241
  *
8207
8242
  */
8208
- const VERSION = '0.2.0';
8243
+ const VERSION = '0.2.1';
8209
8244
 
8210
8245
  /**
8211
8246
  * Copyright (c) Meta Platforms, Inc. and affiliates.
package/Lexical.js.flow CHANGED
@@ -30,7 +30,7 @@ declare export var KEY_ARROW_RIGHT_COMMAND: LexicalCommand<KeyboardEvent>;
30
30
  declare export var KEY_ARROW_LEFT_COMMAND: LexicalCommand<KeyboardEvent>;
31
31
  declare export var KEY_ARROW_UP_COMMAND: LexicalCommand<KeyboardEvent>;
32
32
  declare export var KEY_ARROW_DOWN_COMMAND: LexicalCommand<KeyboardEvent>;
33
- declare export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent>;
33
+ declare export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent | null>;
34
34
  declare export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
35
35
  declare export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
36
36
  declare export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
package/Lexical.prod.js CHANGED
@@ -6,161 +6,161 @@
6
6
  */
7
7
  function q(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
8
  const aa=RegExp("^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]"),da=RegExp("^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]"),ea={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},fa={center:2,justify:4,left:1,right:3},ha={inert:3,normal:0,
9
- segmented:2,token:1},ia="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ja=ia&&"documentMode"in document?document.documentMode:null,r=ia&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ka=ia&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ma=ia&&"InputEvent"in window&&!ja?"getTargetRanges"in new window.InputEvent("input"):!1,na=ia&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);let oa=0;
10
- const pa="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function qa(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!t(ra(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&sa(b)===a}catch(e){return!1}}function sa(a){for(;null!=a;){const b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}
11
- function u(a){return a.isToken()||a.isInert()}function ta(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function ua(a,b,c){b=ea[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function va(a){return w(a)||wa(a)||t(a)}function ya(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;const c=b.indexOf(a.__key);-1===c&&q(16);za(a);b.splice(c,1)}}
12
- function Aa(a){99<Ba&&q(26);var b=a.getLatest(),c=b.__parent,d=z();const f=A(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;B(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function za(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Aa(b);null!==a&&Aa(a)}
13
- function C(a){F();var b=A();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=H(c),null!==b&&b.getWritable());null!==a&&(a=H(a),null!==a&&a.getWritable())}function H(a,b){a=(b||z())._nodeMap.get(a);return void 0===a?null:a}function Ca(a,b){const c=A();a=a["__lexicalKey_"+c._key];return void 0!==a?H(a,b):null}function ra(a,b){for(;null!=a;){const c=Ca(a,b);if(null!==c)return c;a=a.parentNode}return null}function Da(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}
14
- function Ea(a){return a.read(()=>Fa().getTextContent())}function Ga(a,b){I(a,()=>{var c=z();if(!c.isEmpty())if("root"===b)Fa().markDirty();else{c=c._nodeMap;for(const [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Fa(){return z()._nodeMap.get("root")}function Ha(a){z()._selection=a}
15
- function Ia(a){var b=A(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?H("root"):null):H(c)}function Ja(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}
16
- function Ka(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=ra(c),w(a))){c=c.nodeValue;const e=null!==b&&b.data;if("\u200b"===c&&e){const g=e.length;c=e;f=d=g}La(a,c,d,f,null!==b)}}}
17
- function La(a,b,c,d,f){let e=a;if(e.isAttached()&&(f||!e.isDirty())){var g=e.isComposing();a=b;(g||f)&&"\u200b"===b[b.length-1]&&(a=b.slice(0,-1));b=e.getTextContent();if(f||a!==b)if(""===a)if(C(null),na)e.remove();else{const h=A();setTimeout(()=>{h.update(()=>{e.remove()})},20)}else f=e.getParent(),b=Ma(),u(e)||null!==A()._compositionKey&&!g||null!==f&&J(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?e.markDirty():(g=K(),J(g)&&null!==c&&null!==d&&(g.setTextNodeRange(e,c,e,d),e.isSegmented()&&
9
+ segmented:2,token:1},ia="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ja=ia&&"documentMode"in document?document.documentMode:null,r=ia&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ka=ia&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),la=ia&&"InputEvent"in window&&!ja?"getTargetRanges"in new window.InputEvent("input"):!1,na=ia&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),oa=ia&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
10
+ !window.MSStream;let pa=0;const qa="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function ra(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!u(sa(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&ta(b)===a}catch(e){return!1}}function ta(a){for(;null!=a;){const b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}
11
+ function v(a){return a.isToken()||a.isInert()}function ua(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function va(a,b,c){b=ea[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function wa(a){return w(a)||ya(a)||u(a)}function za(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;const c=b.indexOf(a.__key);-1===c&&q(16);Aa(a);b.splice(c,1)}}
12
+ function Ba(a){99<Ca&&q(26);var b=a.getLatest(),c=b.__parent,d=z();const f=B(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;C(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function Aa(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Ba(b);null!==a&&Ba(a)}
13
+ function D(a){F();var b=B();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=H(c),null!==b&&b.getWritable());null!==a&&(a=H(a),null!==a&&a.getWritable())}function H(a,b){a=(b||z())._nodeMap.get(a);return void 0===a?null:a}function Da(a,b){const c=B();a=a["__lexicalKey_"+c._key];return void 0!==a?H(a,b):null}function sa(a,b){for(;null!=a;){const c=Da(a,b);if(null!==c)return c;a=a.parentNode}return null}function Ea(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}
14
+ function Fa(a){return a.read(()=>Ga().getTextContent())}function Ha(a,b){I(a,()=>{var c=z();if(!c.isEmpty())if("root"===b)Ga().markDirty();else{c=c._nodeMap;for(const [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ga(){return z()._nodeMap.get("root")}function Ia(a){z()._selection=a}
15
+ function Ja(a){var b=B(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?H("root"):null):H(c)}function Ka(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}
16
+ function La(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=sa(c),w(a))){c=c.nodeValue;const e=null!==b&&b.data;if("\u200b"===c&&e){const g=e.length;c=e;f=d=g}Ma(a,c,d,f,null!==b)}}}
17
+ function Ma(a,b,c,d,f){let e=a;if(e.isAttached()&&(f||!e.isDirty())){var g=e.isComposing();a=b;(g||f)&&"\u200b"===b[b.length-1]&&(a=b.slice(0,-1));b=e.getTextContent();if(f||a!==b)if(""===a)if(D(null),na||oa)e.remove();else{const h=B();setTimeout(()=>{h.update(()=>{e.remove()})},20)}else f=e.getParent(),b=Na(),v(e)||null!==B()._compositionKey&&!g||null!==f&&J(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?e.markDirty():(g=K(),J(g)&&null!==c&&null!==d&&(g.setTextNodeRange(e,c,e,d),e.isSegmented()&&
18
18
  (c=e.getTextContent(),c=L(c),e.replace(c),e=c)),e.setTextContent(a))}}
19
- function Na(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=A().getElementByKey(h);(b=h!==f.key||!w(e)||d.offset!==f.offset&&!e.isComposing()||(c||e.isDirty())&&1<b.length||null!==l&&!e.isComposing()&&g!==ta(l)||e.getFormat()!==a.format)||(e.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=e.getParentOrThrow(),d=e.isToken(),a=0===b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),e=e.getTextContentSize()===
20
- b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||e):b=!1);return b}function Oa(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Pa(a,b,c,d,f){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&q(66,c),b=b.klass,c=a.get(b),void 0===c&&(c=new Map,a.set(b,c)),c.has(d)||c.set(d,f))}
21
- function Qa(a,b,c){const d=a.getParent();let f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Ra(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Qa(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Qa(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
22
- function Sa(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Wa(a,b,c,d,f){a=a.__children;const e=a.length;for(let g=0;g<e;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(B(l)&&Wa(l,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
23
- function Xa(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(const f of c){const e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(const [f]of d)c=b.get(f),void 0===c||c.isAttached()||(B(c)&&Wa(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function Ya(a,b){const c=a.__mode,d=a.__format;a=a.__style;const f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
24
- function Za(a,b){const c=a.mergeWithSibling(b),d=A()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function $a(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&w(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Ya(b,a)&&(a=Za(b,a));break}for(var c;null!==(c=a.getNextSibling())&&w(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Ya(a,c)&&Za(a,c);break}}}
25
- function ab(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&q(24,e);for(var h in a)if(e=a[h],null!=e&&"object"===typeof e&&(e=e.editorState,null!=e)){var l=bb();l._nodes=c._nodes;l._parentEditor=c._parentEditor;l._pendingEditorState=cb(e,l);a[h]=l}h=g.klass;g=a.__key;a.__key=void 0;h=h.clone(a);a.__key=g;e=h.__key;M(h)&&z()._nodeMap.set("root",h);h.__parent=d;if(B(h)){d=a.__children;for(l=0;l<d.length;l++){var k=b.get(d[l]);void 0!==k&&(k=ab(k,b,c,e,f).__key,h.__children.push(k))}h.__indent=
19
+ function Oa(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=B().getElementByKey(h);(b=h!==f.key||!w(e)||d.offset!==f.offset&&!e.isComposing()||(c||e.isDirty())&&1<b.length||null!==l&&!e.isComposing()&&g!==ua(l)||e.getFormat()!==a.format)||(e.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=e.getParentOrThrow(),d=e.isToken(),a=0===b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),e=e.getTextContentSize()===
20
+ b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||e):b=!1);return b}function Pa(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Qa(a,b,c,d,f){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&q(66,c),b=b.klass,c=a.get(b),void 0===c&&(c=new Map,a.set(b,c)),c.has(d)||c.set(d,f))}
21
+ function Ra(a,b,c){const d=a.getParent();let f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Sa(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Ra(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Ra(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
22
+ function Wa(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Xa(a,b,c,d,f){a=a.__children;const e=a.length;for(let g=0;g<e;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(C(l)&&Xa(l,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
23
+ function Ya(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(const f of c){const e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(const [f]of d)c=b.get(f),void 0===c||c.isAttached()||(C(c)&&Xa(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function Za(a,b){const c=a.__mode,d=a.__format;a=a.__style;const f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
24
+ function $a(a,b){const c=a.mergeWithSibling(b),d=B()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function ab(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&w(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Za(b,a)&&(a=$a(b,a));break}for(var c;null!==(c=a.getNextSibling())&&w(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Za(a,c)&&$a(a,c);break}}}
25
+ function bb(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&q(24,e);for(var h in a)if(e=a[h],null!=e&&"object"===typeof e&&(e=e.editorState,null!=e)){var l=cb();l._nodes=c._nodes;l._parentEditor=c._parentEditor;l._pendingEditorState=db(e,l);a[h]=l}h=g.klass;g=a.__key;a.__key=void 0;h=h.clone(a);a.__key=g;e=h.__key;M(h)&&z()._nodeMap.set("root",h);h.__parent=d;if(C(h)){d=a.__children;for(l=0;l<d.length;l++){var k=b.get(d[l]);void 0!==k&&(k=bb(k,b,c,e,f).__key,h.__children.push(k))}h.__indent=
26
26
  a.__indent;h.__format=a.__format;h.__dir=a.__dir}else w(h)&&(h.__format=a.__format,h.__style=a.__style,h.__mode=a.__mode,h.__detail=a.__detail);b=null!=f?f.originalSelection:void 0;null!=b&&(a=f.remappedSelection,"range"===b.type?(c=b.anchor,b=b.focus,null!=a||g!==c.key&&g!==b.key||(f.remappedSelection=a={anchor:{...c},focus:{...b},type:"range"}),null!=a&&"range"===a.type&&(g===c.key&&(a.anchor.key=e),g===b.key&&(a.focus.key=e))):"node"===b.type?(b=b.nodes,g=b.indexOf(g),-1!==g&&(null==a&&(f.remappedSelection=
27
- a={nodes:[...b],type:"node"}),"node"===a.type&&a.nodes.splice(g,1,e))):"grid"===b.type&&(c=b.gridKey,d=b.anchorCellKey,l=b.focusCellKey,null!=a||c!==g&&c!==d&&c!==l||(f.remappedSelection=a={...b,type:"grid"}),null!=a&&"grid"===a.type&&(c===g&&(a.gridKey=e),d===g&&(a.anchorCellKey=e),l===g&&(a.focusCellKey=e))));return h}let N="",O="",P="",db,Q,eb,fb=!1,gb=!1,hb,ib=null,jb,kb,lb,mb,nb,ob;
28
- function pb(a,b){const c=lb.get(a);if(null!==b){const d=qb(a);b.removeChild(d)}mb.has(a)||Q._keyToDOMMap.delete(a);B(c)&&(a=c.__children,rb(a,0,a.length-1,null));void 0!==c&&Pa(ob,eb,hb,c,"destroyed")}function rb(a,b,c,d){for(;b<=c;++b){const f=a[b];void 0!==f&&pb(f,d)}}function sb(a,b){a.setProperty("text-align",b)}function tb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}
29
- function ub(a,b){a=a.style;0===b?sb(a,""):1===b?sb(a,"left"):2===b?sb(a,"center"):3===b?sb(a,"right"):4===b&&sb(a,"justify")}
30
- function vb(a,b,c){const d=mb.get(a);void 0===d&&q(42);const f=d.createDOM(db,Q);var e=Q._keyToDOMMap;f["__lexicalKey_"+Q._key]=a;e.set(a,f);w(d)?f.setAttribute("data-lexical-text","true"):t(d)&&f.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&tb(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;const h=O;O="";wb(e,0,g,f,null);xb(d,f);O=h}e=d.__format;0!==e&&ub(f,e);yb(null,a,f)}else e=d.getTextContent(),t(d)?(g=d.decorate(Q),null!==g&&zb(a,g),f.contentEditable="false"):
31
- w(d)&&(d.isDirectionless()||(O+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),N+=e,P+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Pa(ob,eb,hb,d,"created");return f}function wb(a,b,c,d,f){const e=N;for(N="";b<=c;++b)vb(a[b],d,f);d.__lexicalTextContent=N;N=e+N}function Ab(a,b){a=b.get(a[a.length-1]);return wa(a)||t(a)}
32
- function yb(a,b,c){a=null!==a&&(0===a.length||Ab(a,lb));b=null!==b&&(0===b.length||Ab(b,mb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
33
- function xb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==ib){const e=""===O;if(e)var d=ib;else d=O,d=aa.test(d)?"rtl":da.test(d)?"ltr":null;if(d!==c){const g=b.classList,h=db.theme;var f=null!==c?h[c]:void 0;let l=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==l&&("string"===typeof l&&(c=l.split(" "),l=h[d]=c),g.add(...l)),b.dir=d);gb||(a.getWritable().__dir=d)}ib=d;b.__lexicalDirTextContent=
27
+ a={nodes:[...b],type:"node"}),"node"===a.type&&a.nodes.splice(g,1,e))):"grid"===b.type&&(c=b.gridKey,d=b.anchorCellKey,l=b.focusCellKey,null!=a||c!==g&&c!==d&&c!==l||(f.remappedSelection=a={...b,type:"grid"}),null!=a&&"grid"===a.type&&(c===g&&(a.gridKey=e),d===g&&(a.anchorCellKey=e),l===g&&(a.focusCellKey=e))));return h}let N="",O="",P="",eb,Q,fb,gb=!1,hb=!1,ib,jb=null,kb,lb,mb,nb,ob,pb;
28
+ function qb(a,b){const c=mb.get(a);if(null!==b){const d=rb(a);b.removeChild(d)}nb.has(a)||Q._keyToDOMMap.delete(a);C(c)&&(a=c.__children,sb(a,0,a.length-1,null));void 0!==c&&Qa(pb,fb,ib,c,"destroyed")}function sb(a,b,c,d){for(;b<=c;++b){const f=a[b];void 0!==f&&qb(f,d)}}function tb(a,b){a.setProperty("text-align",b)}function ub(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}
29
+ function vb(a,b){a=a.style;0===b?tb(a,""):1===b?tb(a,"left"):2===b?tb(a,"center"):3===b?tb(a,"right"):4===b&&tb(a,"justify")}
30
+ function wb(a,b,c){const d=nb.get(a);void 0===d&&q(42);const f=d.createDOM(eb,Q);var e=Q._keyToDOMMap;f["__lexicalKey_"+Q._key]=a;e.set(a,f);w(d)?f.setAttribute("data-lexical-text","true"):u(d)&&f.setAttribute("data-lexical-decorator","true");if(C(d)){a=d.__indent;0!==a&&ub(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;const h=O;O="";xb(e,0,g,f,null);yb(d,f);O=h}e=d.__format;0!==e&&vb(f,e);zb(null,a,f)}else e=d.getTextContent(),u(d)?(g=d.decorate(Q),null!==g&&Ab(a,g),f.contentEditable="false"):
31
+ w(d)&&(d.isDirectionless()||(O+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),N+=e,P+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Qa(pb,fb,ib,d,"created");return f}function xb(a,b,c,d,f){const e=N;for(N="";b<=c;++b)wb(a[b],d,f);d.__lexicalTextContent=N;N=e+N}function Bb(a,b){a=b.get(a[a.length-1]);return ya(a)||u(a)}
32
+ function zb(a,b,c){a=null!==a&&(0===a.length||Bb(a,mb));b=null!==b&&(0===b.length||Bb(b,nb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
33
+ function yb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==jb){const e=""===O;if(e)var d=jb;else d=O,d=aa.test(d)?"rtl":da.test(d)?"ltr":null;if(d!==c){const g=b.classList,h=eb.theme;var f=null!==c?h[c]:void 0;let l=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==l&&("string"===typeof l&&(c=l.split(" "),l=h[d]=c),g.add(...l)),b.dir=d);hb||(a.getWritable().__dir=d)}jb=d;b.__lexicalDirTextContent=
34
34
  O;b.__lexicalDir=d}}
35
- function Bb(a,b){var c=lb.get(a),d=mb.get(a);void 0!==c&&void 0!==d||q(43);var f=fb||kb.has(a)||jb.has(a);const e=Cb(Q,a);if(c===d&&!f)return B(c)?(d=e.__lexicalTextContent,void 0!==d&&(N+=d,P+=d),d=e.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),w(c)&&!c.isDirectionless()&&(O+=d),P+=d,N+=d),e;c!==d&&f&&Pa(ob,eb,hb,d,"updated");if(d.updateDOM(c,e,db))return d=vb(a,null,null),null===b&&q(44),b.replaceChild(d,e),pb(a,null),d;if(B(c)&&B(d)){if(a=d.__indent,a!==c.__indent&&tb(e,a),
36
- a=d.__format,a!==c.__format&&ub(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=O;O="";const v=N;N="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Bb(m,e);else{var p=qb(m);h=vb(h,null,null);e.replaceChild(h,p);pb(m,null)}}else if(0===l)0!==k&&wb(h,0,k-1,e,null);else if(0===k)0!==l&&(m=null==e.__lexicalLineBreak,rb(g,0,l-1,m?null:e),m&&(e.textContent=""));else{const D=l-1;l=k-1;let y=e.firstChild,E=0;for(k=0;E<=D&&k<=l;){var n=g[E];const x=h[k];if(n===x)y=Bb(x,
37
- e).nextSibling,E++,k++;else{void 0===m&&(m=new Set(g));void 0===p&&(p=new Set(h));const G=p.has(n),W=m.has(x);G?(W?(n=Cb(Q,x),n===y?y=Bb(x,e).nextSibling:(null!=y?e.insertBefore(n,y):e.appendChild(n),Bb(x,e)),E++):vb(x,e,y),k++):(y=qb(n).nextSibling,pb(n,e),E++)}}m=E>D;p=k>l;m&&!p?(m=h[l+1],m=void 0===m?null:Q.getElementByKey(m),wb(h,k,l,e,m)):p&&!m&&rb(g,E,D,e)}e.__lexicalTextContent=N;N=v+N;xb(f,e);O=b;M(d)||yb(a,c,e)}}else c=d.getTextContent(),t(d)?(f=d.decorate(Q),null!==f&&zb(a,f)):w(d)&&!d.isDirectionless()&&
38
- (O+=c),N+=c,P+=c;!gb&&M(d)&&d.__cachedText!==P&&(d=d.getWritable(),d.__cachedText=P);return e}function zb(a,b){let c=Q._pendingDecorators;const d=Q._decorators;if(null===c){if(d[a]===b)return;c=Da(Q)}c[a]=b}function qb(a){a=nb.get(a);void 0===a&&q(45);return a}function Cb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let R=null,T=null,U=!1,Db=!1,Ba=0;function F(){U&&q(25)}function z(){null===R&&q(27);return R}function A(){null===T&&q(28);return T}
39
- function Eb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Fb(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(const c of b)b=a.get(c),w(b)&&b.isSimpleText()&&!b.isUnmergeable()&&$a(b)}
40
- function Gb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=A()._compositionKey,e=new Map;var g=c;let h=g.size;for(var l=d,k=l.size;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;for(const m of g)g=a.get(m),w(g)&&g.isSimpleText()&&!g.isUnmergeable()&&$a(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Eb(b,g,e),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Ba++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(const m of l)l=m[0],k=m[1],"root"!==l&&k&&(g=a.get(l),void 0!==
41
- g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Eb(b,g,e),d.set(l,k));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;Ba++}b._dirtyLeaves=c;b._dirtyElements=d}function cb(a,b){var c=new Map;c=new Hb(c);const d={originalSelection:a._selection},f=R,e=U,g=T;R=c;U=!1;T=b;try{const h=new Map(a._nodeMap),l=h.get("root");ab(l,h,b,null,d)}finally{R=f,U=e,T=g}c._selection=Ib(d.remappedSelection||d.originalSelection);return c}
42
- function Jb(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=R,l=U,k=T,m=a._updating;T=a;R=b;U=!1;a._updating=!0;try{var p=a._observer;let la=null;if(g&&null!==p){var n=a._dirtyType,v=a._dirtyElements,D=a._dirtyLeaves;p.disconnect();try{O=P=N="";fb=2===n;ib=null;Q=a;db=a._config;eb=a._nodes;hb=Q._listeners.mutation;jb=v;kb=D;lb=d._nodeMap;mb=b._nodeMap;gb=b._readOnly;
43
- nb=new Map(a._keyToDOMMap);const xa=new Map;ob=xa;Bb("root",null);ob=nb=db=mb=lb=kb=jb=eb=Q=void 0;la=xa}finally{p.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Ta=window.getSelection();if(null!==Ta&&(g||null===e||e.dirty)){p=Ta;const xa=p.anchorNode,lc=p.focusNode,sd=p.anchorOffset,td=p.focusOffset,Ua=document.activeElement,ba=a._rootElement;if(!a._updateTags.has("collaboration")||Ua===ba)if(J(e)){var y=e.anchor,E=e.focus,x=E.key,G=Cb(a,y.key),W=Cb(a,x),mc=y.offset,nc=E.offset;f=G;
44
- x=W;"text"===y.type&&(f=ta(G));"text"===E.type&&(x=ta(W));if(null!==f&&null!==x)if(sd!==mc||td!==nc||xa!==f||lc!==x||"Range"===p.type&&e.isCollapsed())try{if(p.setBaseAndExtent(f,mc,x,nc),e.isCollapsed()&&ba===Ua){const ca=3===f.nodeType?f.parentNode:f;if(null!==ca){const Va=ca.getBoundingClientRect();if(Va.bottom>window.innerHeight)ca.scrollIntoView(!1);else if(0>Va.top)ca.scrollIntoView();else if(ba){const oc=ba.getBoundingClientRect();Va.bottom>oc.bottom?ca.scrollIntoView(!1):Va.top<oc.top&&ca.scrollIntoView()}a._updateTags.add("scroll-into-view")}}}catch(ca){}else null===
45
- ba||null!==Ua&&ba.contains(Ua)||ba.focus({preventScroll:!0})}else null!==f&&qa(a,xa,lc)&&p.removeAllRanges()}var pc=la;null!==pc&&Kb(a,d,b,pc)}catch(la){a._onError(la);Db||(Lb(a,null,c,b),Mb(a),a._dirtyType=2,Db=!0,Jb(a),Db=!1);return}finally{a._updating=m,R=h,U=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;e=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=
46
- a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var S in k)m.has(S)||(k===g&&(k=Da(a)),delete k[S]);S=a._pendingDecorators;null!==S&&(a._decorators=S,a._pendingDecorators=null,Nb("decorator",a,!0,S));S=Ea(d);g=Ea(b);S!==g&&Nb("textcontent",a,!0,g);Nb("update",a,!0,{dirtyElements:e,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(S=0;S<b.length;S++)b[S]()}finally{a._updating=d}}b=a._updates;
47
- if(0!==b.length){const [la,Ta]=b.shift();Ob(a,la,Ta)}}}function Kb(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Nb(a,b,c,...d){const f=b._updating;b._updating=c;try{const e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a](...d)}finally{b._updating=f}}
48
- function V(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=V(a,b,c)});return e}const d=Ja(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(const h of f)if(!0===h(c,a))return!0}return!1}function Pb(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,f]=b.shift();let e,g;void 0!==f&&(e=f.onUpdate,g=f.tag,f.skipTransforms&&(c=!0),e&&a._deferred.push(e),g&&a._updateTags.add(g));d()}return c}
49
- function Ob(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new Hb(new Map(c._nodeMap)),g=!0);const h=R,l=U,k=T,m=a._updating;R=e;U=!1;a._updating=!0;T=a;try{g&&(e._selection=Qb(a));const p=a._compositionKey;b();f=Pb(a);Rb(e,a);0!==a._dirtyType&&(f?Fb(e,a):Gb(e,a),Pb(a),Xa(c,e,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&
50
- (e._flushSync=!0);const n=e._selection;if(J(n)){const v=e._nodeMap,D=n.focus.key;void 0!==v.get(n.anchor.key)&&void 0!==v.get(D)||q(30)}else Sb(n)&&0===n._nodes.size&&(e._selection=null)}catch(p){a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Jb(a);return}finally{R=h,U=l,T=k,a._updating=m,Ba=0}0!==a._dirtyType||Tb(e,a)?e._flushSync?(e._flushSync=!1,Jb(a)):g&&pa(()=>{Jb(a)}):(e._flushSync=!1,g&&(d.clear(),a._deferred=[],
51
- a._pendingEditorState=null))}function I(a,b,c){a._updating?a._updates.push([b,c]):Ob(a,b,c)}let Ub=!1,Vb=0;function Wb(a){Vb=a.timeStamp}function Xb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function Yb(a){return a.getEditorState().read(()=>{const b=K();return null!==b?b.clone():null})}
52
- function Zb(a,b,c){Ub=!0;const d=100<performance.now()-Vb;try{I(a,()=>{var f=new Map,e=a.getRootElement(),g=a._editorState;let h=!1,l="";for(var k=0;k<b.length;k++){var m=b[k],p=m.type,n=m.target,v=ra(n,g);if(!t(v))if("characterData"===p){if(d&&3===n.nodeType&&w(v)&&v.isAttached()){m=window.getSelection();var D=p=null;null!==m&&m.anchorNode===n&&(p=m.anchorOffset,D=m.focusOffset);La(v,n.nodeValue,p,D,!1)}}else if("childList"===p){h=!0;p=m.addedNodes;for(D=0;D<p.length;D++){var y=p[D],E=Ca(y),x=y.parentNode;
53
- null==x||null!==E||"BR"===y.nodeName&&Xb(y,x,a)||(ka&&(E=y.innerText||y.nodeValue)&&(l+=E),x.removeChild(y))}m=m.removedNodes;p=m.length;if(0<p){D=0;for(y=0;y<p;y++)x=m[y],"BR"===x.nodeName&&Xb(x,n,a)&&(n.appendChild(x),D++);p!==D&&(n===e&&(v=g._nodeMap.get("root")),f.set(n,v))}}}if(0<f.size)for(const [G,W]of f)if(B(W))for(f=W.__children,e=G.firstChild,g=0;g<f.length;g++)k=a.getElementByKey(f[g]),null!==k&&(null==e?(G.appendChild(k),e=k):e!==k&&G.replaceChild(k,e),e=e.nextSibling);else w(W)&&W.markDirty();
54
- f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,v=0;v<g.length;v++)n=g[v],m=n.parentNode,null==m||"BR"!==n.nodeName||Xb(n,k,a)||m.removeChild(n);c.takeRecords()}f=K()||Yb(a);null!==f&&(h&&(f.dirty=!0,Ha(f)),ka&&Sa()&&f.insertRawText(l))})}finally{Ub=!1}}function $b(a){const b=a._observer;if(null!==b){const c=b.takeRecords();Zb(a,c,b)}}
55
- function Mb(a){0===Vb&&window.addEventListener("textInput",Wb,!0);a._observer=new MutationObserver((b,c)=>{Zb(a,b,c)})}
56
- class ac{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;B(b)&&(b=b.getDescendantByIndex(d));B(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=H(this.key);null===a&&q(5);return a}set(a,b,c){const d=K(),f=this.key;this.key=a;this.offset=b;this.type=
57
- c;U||(A()._compositionKey===f&&C(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function X(a,b,c){return new ac(a,b,c)}function bc(a,b){const c=b.__key;let d=a.offset,f="element";w(b)&&(f="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,f)}function cc(a,b){if(B(b)){const c=b.getLastDescendant();B(c)||w(c)?bc(a,c):bc(a,b)}else w(b)&&bc(a,b)}
58
- function dc(a,b,c){const d=a.getNode(),f=d.getChildAtIndex(a.offset),e=L(),g=M(d)?ec().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function Y(a,b,c,d){a.key=b;a.offset=c;a.type=d}
59
- class fc{constructor(a){this.dirty=!1;this._nodes=a}is(a){if(!Sb(a))return!1;const b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a)}delete(a){this.dirty=!0;this._nodes.delete(a)}clear(){this.dirty=!0;this._nodes.clear()}has(a){return this._nodes.has(a)}clone(){return new fc(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=this._nodes;const b=[];for(const c of a)a=H(c),null!==
60
- a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function J(a){return a instanceof gc}
61
- class hc{constructor(a,b,c){this.gridKey=a;this.anchorCellKey=b;this.anchor=X(b,0,"element");this.focusCellKey=c;this.focus=X(c,0,"element");this.dirty=!1}is(a){return ic(a)?this.gridKey===a.gridKey&&this.anchorCellKey===a.anchorCellKey&&this.focusCellKey===a.focusCellKey:!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchorCellKey=b;this.focusCellKey=c}clone(){return new hc(this.gridKey,this.anchorCellKey,this.focusCellKey)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
62
- H(this.anchorCellKey);a||q(74);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=H(this.focusCellKey);c||q(75);var d=c.getIndexWithinParent();const f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){const a=new Set,{fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=H(this.gridKey);jc(e)||q(76);a.add(e);e=e.getChildren();
63
- for(let l=c;l<=f;l++){var g=e[l];a.add(g);kc(g)||q(77);g=g.getChildren();for(let k=b;k<=d;k++){var h=g[k];qc(h)||q(78);a.add(h);for(h=h.getChildren();0<h.length;){const m=h.shift();a.add(m);B(m)&&h.unshift(...m.getChildren())}}}return Array.from(a)}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function ic(a){return a instanceof hc}
64
- class gc{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return J(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();B(c)&&(c=c.getDescendantByIndex(a.offset));B(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?B(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,
65
- b,c,d){Y(this.anchor,a.__key,b,"text");Y(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,f=this.focus;const e=d.isBefore(f);d=d.getCharacterOffset();f=f.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(B(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,w(k)){let m=k.getTextContent();k===b?m=k===c?d<f?m.slice(d,f):m.slice(f,d):e?m.slice(d):m.slice(f):
66
- k===c&&(m=e?m.slice(0,f):m.slice(0,d));g+=m}else!t(k)&&!wa(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=A(),c=b.getEditorState()._selection;a=rc(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;Y(this.anchor,d.key,d.offset,d.type);Y(this.focus,f.key,f.offset,f.type)}}clone(){const a=this.anchor,b=this.focus;return new gc(X(a.key,a.offset,a.type),X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=ua(this.format,
67
- a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(L(f));d!==c-1&&a.push(sc())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?dc(b,c,f):d||"element"!==c.type||dc(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var l=h.offset;
68
- b=e[0];w(b)||q(6);d=b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=L(b.getTextContent()),b.replace(k),b=k);else{m=b.getPreviousSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?b.insertBefore(m):k.insertBefore(m);m.select();
69
- b=m;if(""!==a){this.insertText(a);return}}else{var m=b.getNextSibling();if(!w(m)||u(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?b.insertAfter(m):k.insertAfter(m);m.select(0,0);b=m;if(""!==a){this.insertText(a);return}}if(1===g)if(u(b))a=L(a),a.select(),b.replace(a);else{e=b.getFormat();if(c===l&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=L(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));e.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
70
- a.length);return}b=b.spliceText(c,l-c,a,!0);""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var p=B(b)?b:b.getParentOrThrow();m=B(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?w(k)&&!u(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,
71
- l,""),f.add(k.__key)):k.remove():f.add(k.__key);h=m.getChildren();l=new Set(e);const n=p.is(m);if(m.canBeEmpty()||p===m){for(p=h.length-1;0<=p;p--){const v=h[p];if(v.is(b)||B(v)&&v.isParentOf(b))break;v.isAttached()&&(!l.has(v)||v.is(k)?n||b.insertAfter(v):v.remove())}if(!n)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))f.delete(h.__key),l=h;h=h.getParent()}}else p.append(m);u(b)?c===d?b.select():(a=L(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?
72
- b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a),C(null);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var p=b[m];if(w(p)){k=p.getFormatFlags(a,null);break}}var n=e.offset;p=(m=e.isBefore(g))?n:l;m=m?l:n;if(p===
73
- d.getTextContentSize()){const v=d.getNextSibling();w(v)&&(p=n=0,d=v,k=d.getFormatFlags(a,null))}if(d.is(f))w(d)&&("element"===e.type&&"element"===g.type?(d.setFormat(k),d.select(p,m),this.format=k):(p=n>l?l:n,m=n>l?n:l,p!==m&&(0===p&&m===h?(d.setFormat(k),d.select(p,m)):(a=d.splitText(p,m),a=0===p?a[0]:a[1],a.setFormat(k),a.select(0,m-p)),this.format=k)));else for(w(d)&&(0!==p&&([,d]=d.splitText(p)),d.setFormat(k)),e=k,w(f)&&(e=f.getFormatFlags(a,k),k=f.getTextContent().length,0!==m&&(m!==k&&([f]=
35
+ function Cb(a,b){var c=mb.get(a),d=nb.get(a);void 0!==c&&void 0!==d||q(43);var f=gb||lb.has(a)||kb.has(a);const e=Db(Q,a);if(c===d&&!f)return C(c)?(d=e.__lexicalTextContent,void 0!==d&&(N+=d,P+=d),d=e.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),w(c)&&!c.isDirectionless()&&(O+=d),P+=d,N+=d),e;c!==d&&f&&Qa(pb,fb,ib,d,"updated");if(d.updateDOM(c,e,eb))return d=wb(a,null,null),null===b&&q(44),b.replaceChild(d,e),qb(a,null),d;if(C(c)&&C(d)){if(a=d.__indent,a!==c.__indent&&ub(e,a),
36
+ a=d.__format,a!==c.__format&&vb(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=O;O="";const p=N;N="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Cb(m,e);else{var n=rb(m);h=wb(h,null,null);e.replaceChild(h,n);qb(m,null)}}else if(0===l)0!==k&&xb(h,0,k-1,e,null);else if(0===k)0!==l&&(m=null==e.__lexicalLineBreak,sb(g,0,l-1,m?null:e),m&&(e.textContent=""));else{const A=l-1;l=k-1;let y=e.firstChild,E=0;for(k=0;E<=A&&k<=l;){var t=g[E];const x=h[k];if(t===x)y=Cb(x,
37
+ e).nextSibling,E++,k++;else{void 0===m&&(m=new Set(g));void 0===n&&(n=new Set(h));const G=n.has(t),W=m.has(x);G?(W?(t=Db(Q,x),t===y?y=Cb(x,e).nextSibling:(null!=y?e.insertBefore(t,y):e.appendChild(t),Cb(x,e)),E++):wb(x,e,y),k++):(y=rb(t).nextSibling,qb(t,e),E++)}}m=E>A;n=k>l;m&&!n?(m=h[l+1],m=void 0===m?null:Q.getElementByKey(m),xb(h,k,l,e,m)):n&&!m&&sb(g,E,A,e)}e.__lexicalTextContent=N;N=p+N;yb(f,e);O=b;M(d)||zb(a,c,e)}}else c=d.getTextContent(),u(d)?(f=d.decorate(Q),null!==f&&Ab(a,f)):w(d)&&!d.isDirectionless()&&
38
+ (O+=c),N+=c,P+=c;!hb&&M(d)&&d.__cachedText!==P&&(d=d.getWritable(),d.__cachedText=P);return e}function Ab(a,b){let c=Q._pendingDecorators;const d=Q._decorators;if(null===c){if(d[a]===b)return;c=Ea(Q)}c[a]=b}function rb(a){a=ob.get(a);void 0===a&&q(45);return a}function Db(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let R=null,T=null,U=!1,Eb=!1,Ca=0;function F(){U&&q(25)}function z(){null===R&&q(27);return R}function B(){null===T&&q(28);return T}
39
+ function Fb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Gb(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(const c of b)b=a.get(c),w(b)&&b.isSimpleText()&&!b.isUnmergeable()&&ab(b)}
40
+ function Hb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=B()._compositionKey,e=new Map;var g=c;let h=g.size;for(var l=d,k=l.size;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;for(const m of g)g=a.get(m),w(g)&&g.isSimpleText()&&!g.isUnmergeable()&&ab(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Fb(b,g,e),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Ca++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(const m of l)l=m[0],k=m[1],"root"!==l&&k&&(g=a.get(l),void 0!==
41
+ g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Fb(b,g,e),d.set(l,k));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;Ca++}b._dirtyLeaves=c;b._dirtyElements=d}function db(a,b){var c=new Map;c=new Ib(c);const d={originalSelection:a._selection},f=R,e=U,g=T;R=c;U=!1;T=b;try{const h=new Map(a._nodeMap),l=h.get("root");bb(l,h,b,null,d)}finally{R=f,U=e,T=g}c._selection=Jb(d.remappedSelection||d.originalSelection);return c}
42
+ function Kb(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=R,l=U,k=T,m=a._updating;T=a;R=b;U=!1;a._updating=!0;try{var n=a._observer;let ma=null;if(g&&null!==n){var t=a._dirtyType,p=a._dirtyElements,A=a._dirtyLeaves;n.disconnect();try{O=P=N="";gb=2===t;jb=null;Q=a;eb=a._config;fb=a._nodes;ib=Q._listeners.mutation;kb=p;lb=A;mb=d._nodeMap;nb=b._nodeMap;hb=b._readOnly;
43
+ ob=new Map(a._keyToDOMMap);const xa=new Map;pb=xa;Cb("root",null);pb=ob=eb=nb=mb=lb=kb=fb=Q=void 0;ma=xa}finally{n.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Ta=window.getSelection();if(null!==Ta&&(g||null===e||e.dirty)){n=Ta;const xa=n.anchorNode,mc=n.focusNode,td=n.anchorOffset,ud=n.focusOffset,Ua=document.activeElement,ba=a._rootElement;if(!a._updateTags.has("collaboration")||Ua===ba)if(J(e)){var y=e.anchor,E=e.focus,x=E.key,G=Db(a,y.key),W=Db(a,x),nc=y.offset,oc=E.offset;f=G;
44
+ x=W;"text"===y.type&&(f=ua(G));"text"===E.type&&(x=ua(W));if(null!==f&&null!==x)if(td!==nc||ud!==oc||xa!==f||mc!==x||"Range"===n.type&&e.isCollapsed())try{if(n.setBaseAndExtent(f,nc,x,oc),e.isCollapsed()&&ba===Ua){const ca=3===f.nodeType?f.parentNode:f;if(null!==ca){const Va=ca.getBoundingClientRect();if(Va.bottom>window.innerHeight)ca.scrollIntoView(!1);else if(0>Va.top)ca.scrollIntoView();else if(ba){const pc=ba.getBoundingClientRect();Va.bottom>pc.bottom?ca.scrollIntoView(!1):Va.top<pc.top&&ca.scrollIntoView()}a._updateTags.add("scroll-into-view")}}}catch(ca){}else null===
45
+ ba||null!==Ua&&ba.contains(Ua)||ba.focus({preventScroll:!0})}else null!==f&&ra(a,xa,mc)&&n.removeAllRanges()}var qc=ma;null!==qc&&Lb(a,d,b,qc)}catch(ma){a._onError(ma);Eb||(Mb(a,null,c,b),Nb(a),a._dirtyType=2,Eb=!0,Kb(a),Eb=!1);return}finally{a._updating=m,R=h,U=l,T=k}b._readOnly=!0;c=a._dirtyLeaves;e=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=
46
+ a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var S in k)m.has(S)||(k===g&&(k=Ea(a)),delete k[S]);S=a._pendingDecorators;null!==S&&(a._decorators=S,a._pendingDecorators=null,Ob("decorator",a,!0,S));S=Fa(d);g=Fa(b);S!==g&&Ob("textcontent",a,!0,g);Ob("update",a,!0,{dirtyElements:e,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(S=0;S<b.length;S++)b[S]()}finally{a._updating=d}}b=a._updates;
47
+ if(0!==b.length){const [ma,Ta]=b.shift();Pb(a,ma,Ta)}}}function Lb(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Ob(a,b,c,...d){const f=b._updating;b._updating=c;try{const e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a](...d)}finally{b._updating=f}}
48
+ function V(a,b,c){if(!1===a._updating||T!==a){let e=!1;a.update(()=>{e=V(a,b,c)});return e}const d=Ka(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(const h of f)if(!0===h(c,a))return!0}return!1}function Qb(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,f]=b.shift();let e,g;void 0!==f&&(e=f.onUpdate,g=f.tag,f.skipTransforms&&(c=!0),e&&a._deferred.push(e),g&&a._updateTags.add(g));d()}return c}
49
+ function Pb(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new Ib(new Map(c._nodeMap)),g=!0);const h=R,l=U,k=T,m=a._updating;R=e;U=!1;a._updating=!0;T=a;try{g&&(e._selection=Rb(a));const n=a._compositionKey;b();f=Qb(a);Sb(e,a);0!==a._dirtyType&&(f?Gb(e,a):Hb(e,a),Qb(a),Ya(c,e,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&
50
+ (e._flushSync=!0);const t=e._selection;if(J(t)){const p=e._nodeMap,A=t.focus.key;void 0!==p.get(t.anchor.key)&&void 0!==p.get(A)||q(30)}else Tb(t)&&0===t._nodes.size&&(e._selection=null)}catch(n){a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Kb(a);return}finally{R=h,U=l,T=k,a._updating=m,Ca=0}0!==a._dirtyType||Ub(e,a)?e._flushSync?(e._flushSync=!1,Kb(a)):g&&qa(()=>{Kb(a)}):(e._flushSync=!1,g&&(d.clear(),a._deferred=[],
51
+ a._pendingEditorState=null))}function I(a,b,c){a._updating?a._updates.push([b,c]):Pb(a,b,c)}let Vb=!1,Wb=0;function Xb(a){Wb=a.timeStamp}function Yb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function Zb(a){return a.getEditorState().read(()=>{const b=K();return null!==b?b.clone():null})}
52
+ function $b(a,b,c){Vb=!0;const d=100<performance.now()-Wb;try{I(a,()=>{var f=new Map,e=a.getRootElement(),g=a._editorState;let h=!1,l="";for(var k=0;k<b.length;k++){var m=b[k],n=m.type,t=m.target,p=sa(t,g);if(!u(p))if("characterData"===n){if(d&&3===t.nodeType&&w(p)&&p.isAttached()){m=window.getSelection();var A=n=null;null!==m&&m.anchorNode===t&&(n=m.anchorOffset,A=m.focusOffset);Ma(p,t.nodeValue,n,A,!1)}}else if("childList"===n){h=!0;n=m.addedNodes;for(A=0;A<n.length;A++){var y=n[A],E=Da(y),x=y.parentNode;
53
+ null==x||null!==E||"BR"===y.nodeName&&Yb(y,x,a)||(ka&&(E=y.innerText||y.nodeValue)&&(l+=E),x.removeChild(y))}m=m.removedNodes;n=m.length;if(0<n){A=0;for(y=0;y<n;y++)x=m[y],"BR"===x.nodeName&&Yb(x,t,a)&&(t.appendChild(x),A++);n!==A&&(t===e&&(p=g._nodeMap.get("root")),f.set(t,p))}}}if(0<f.size)for(const [G,W]of f)if(C(W))for(f=W.__children,e=G.firstChild,g=0;g<f.length;g++)k=a.getElementByKey(f[g]),null!==k&&(null==e?(G.appendChild(k),e=k):e!==k&&G.replaceChild(k,e),e=e.nextSibling);else w(W)&&W.markDirty();
54
+ f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,p=0;p<g.length;p++)t=g[p],m=t.parentNode,null==m||"BR"!==t.nodeName||Yb(t,k,a)||m.removeChild(t);c.takeRecords()}f=K()||Zb(a);null!==f&&(h&&(f.dirty=!0,Ia(f)),ka&&Wa()&&f.insertRawText(l))})}finally{Vb=!1}}function ac(a){const b=a._observer;if(null!==b){const c=b.takeRecords();$b(a,c,b)}}
55
+ function Nb(a){0===Wb&&window.addEventListener("textInput",Xb,!0);a._observer=new MutationObserver((b,c)=>{$b(a,b,c)})}
56
+ class bc{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;C(b)&&(b=b.getDescendantByIndex(d));C(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=H(this.key);null===a&&q(5);return a}set(a,b,c){const d=K(),f=this.key;this.key=a;this.offset=b;this.type=
57
+ c;U||(B()._compositionKey===f&&D(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function X(a,b,c){return new bc(a,b,c)}function cc(a,b){const c=b.__key;let d=a.offset,f="element";w(b)&&(f="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,f)}function dc(a,b){if(C(b)){const c=b.getLastDescendant();C(c)||w(c)?cc(a,c):cc(a,b)}else w(b)&&cc(a,b)}
58
+ function ec(a,b,c){const d=a.getNode(),f=d.getChildAtIndex(a.offset),e=L(),g=M(d)?fc().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function Y(a,b,c,d){a.key=b;a.offset=c;a.type=d}
59
+ class gc{constructor(a){this.dirty=!1;this._nodes=a}is(a){if(!Tb(a))return!1;const b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a)}delete(a){this.dirty=!0;this._nodes.delete(a)}clear(){this.dirty=!0;this._nodes.clear()}has(a){return this._nodes.has(a)}clone(){return new gc(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=this._nodes;const b=[];for(const c of a)a=H(c),null!==
60
+ a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function J(a){return a instanceof hc}
61
+ class ic{constructor(a,b,c){this.gridKey=a;this.anchorCellKey=b;this.anchor=X(b,0,"element");this.focusCellKey=c;this.focus=X(c,0,"element");this.dirty=!1}is(a){return jc(a)?this.gridKey===a.gridKey&&this.anchorCellKey===a.anchorCellKey&&this.focusCellKey===a.focusCellKey:!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchorCellKey=b;this.focusCellKey=c}clone(){return new ic(this.gridKey,this.anchorCellKey,this.focusCellKey)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
62
+ H(this.anchorCellKey);a||q(74);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=H(this.focusCellKey);c||q(75);var d=c.getIndexWithinParent();const f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){const a=new Set,{fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=H(this.gridKey);kc(e)||q(76);a.add(e);e=e.getChildren();
63
+ for(let l=c;l<=f;l++){var g=e[l];a.add(g);lc(g)||q(77);g=g.getChildren();for(let k=b;k<=d;k++){var h=g[k];rc(h)||q(78);a.add(h);for(h=h.getChildren();0<h.length;){const m=h.shift();a.add(m);C(m)&&h.unshift(...m.getChildren())}}}return Array.from(a)}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function jc(a){return a instanceof ic}
64
+ class hc{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return J(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();C(c)&&(c=c.getDescendantByIndex(a.offset));C(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?C(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,
65
+ b,c,d){Y(this.anchor,a.__key,b,"text");Y(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,f=this.focus;const e=d.isBefore(f);d=d.getCharacterOffset();f=f.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(C(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,w(k)){let m=k.getTextContent();k===b?m=k===c?d<f?m.slice(d,f):m.slice(f,d):e?m.slice(d):m.slice(f):
66
+ k===c&&(m=e?m.slice(0,f):m.slice(0,d));g+=m}else!u(k)&&!ya(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=B(),c=b.getEditorState()._selection;a=sc(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;Y(this.anchor,d.key,d.offset,d.type);Y(this.focus,f.key,f.offset,f.type)}}clone(){const a=this.anchor,b=this.focus;return new hc(X(a.key,a.offset,a.type),X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=va(this.format,
67
+ a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(L(f));d!==c-1&&a.push(tc())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?ec(b,c,f):d||"element"!==c.type||ec(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var l=h.offset;
68
+ b=e[0];w(b)||q(6);d=b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=L(b.getTextContent()),b.replace(k),b=k);else{m=b.getPreviousSibling();if(!w(m)||v(m)||m.isSegmented())m=L(),k.canInsertTextBefore()?b.insertBefore(m):k.insertBefore(m);m.select();
69
+ b=m;if(""!==a){this.insertText(a);return}}else{var m=b.getNextSibling();if(!w(m)||v(m)||m.isSegmented())m=L(),k.canInsertTextAfter()?b.insertAfter(m):k.insertAfter(m);m.select(0,0);b=m;if(""!==a){this.insertText(a);return}}if(1===g)if(v(b))a=L(a),a.select(),b.replace(a);else{e=b.getFormat();if(c===l&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=L(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));e.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
70
+ a.length);return}b=b.spliceText(c,l-c,a,!0);""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var n=C(b)?b:b.getParentOrThrow();m=C(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?w(k)&&!v(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=L(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,
71
+ l,""),f.add(k.__key)):k.remove():f.add(k.__key);h=m.getChildren();l=new Set(e);const t=n.is(m);if(m.canBeEmpty()||n===m){for(n=h.length-1;0<=n;n--){const p=h[n];if(p.is(b)||C(p)&&p.isParentOf(b))break;p.isAttached()&&(!l.has(p)||p.is(k)?t||b.insertAfter(p):p.remove())}if(!t)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))f.delete(h.__key),l=h;h=h.getParent()}}else n.append(m);v(b)?c===d?b.select():(a=L(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?
72
+ b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a),D(null);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(w(n)){k=n.getFormatFlags(a,null);break}}var t=e.offset;n=(m=e.isBefore(g))?t:l;m=m?l:t;if(n===
73
+ d.getTextContentSize()){const p=d.getNextSibling();w(p)&&(n=t=0,d=p,k=d.getFormatFlags(a,null))}if(d.is(f))w(d)&&("element"===e.type&&"element"===g.type?(d.setFormat(k),d.select(n,m),this.format=k):(n=t>l?l:t,m=t>l?t:l,n!==m&&(0===n&&m===h?(d.setFormat(k),d.select(n,m)):(a=d.splitText(n,m),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,m-n)),this.format=k)));else for(w(d)&&(0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),e=k,w(f)&&(e=f.getFormatFlags(a,k),k=f.getTextContent().length,0!==m&&(m!==k&&([f]=
74
74
  f.splitText(m)),f.setFormat(e))),k=1;k<c;k++)m=b[k],g=m.__key,w(m)&&g!==d.__key&&g!==f.__key&&!m.isToken()&&(g=m.getFormatFlags(a,e),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),h=M(f)?null:f.getTopLevelElementOrThrow();if(w(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),
75
- c.push(f);else if(d===e)e=f;else{if(u(f))return!1;[e,f]=f.splitText(d);c.push(f)}f=e;c.push(...g);g=a[0];var l=!1;for(let p=0;p<a.length;p++){const n=a[p];if(B(n)){if(n.is(g)){if(B(e)&&e.isEmpty()&&e.canReplaceWith(n)){e.replace(n);e=n;l=!0;continue}var k=n.getFirstDescendant();if(va(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(B(e))for(let v=0;v<m;v++)e.append(l[v]);else{for(--m;0<=m;m--)e.insertAfter(l[m]);e=e.getParentOrThrow()}k.remove();
76
- l=!0;if(k.is(n))continue}}w(e)&&(null===h&&q(69),e=h)}else l&&!t(n)&&M(e.getParent())&&q(7);l=!1;if(B(e))if(t(n)&&n.isTopLevel())e=e.insertAfter(n);else if(B(n)){if(n.canBeEmpty()||!n.isEmpty())M(e)?(k=e.getChildAtIndex(d),null!==k?k.insertBefore(n):e.append(n),e=n):e=e.insertAfter(n)}else k=e.getFirstChild(),null!==k?k.insertBefore(n):e.append(n),e=n;else!B(n)||t(e)&&e.isTopLevel()?e=e.insertAfter(n):(e=n.getParentOrThrow(),p--)}b&&(w(f)?f.select():(a=e.getPreviousSibling(),w(a)?a.select():(a=e.getIndexWithinParent(),
77
- e.getParentOrThrow().select(a,a))));if(B(e)){if(a=e.getLastDescendant(),b||(null===a?e.select():w(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),B(e)&&!B(a)?(e.append(a),e=a):B(e)||B(a)?B(a)&&!a.canInsertAfter(e)?(h=d.constructor.clone(d),B(h)||q(8),h.append(a),e.insertAfter(h)):e.insertAfter(a):(e.insertBefore(a),e=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(w(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+1,c.select(e,
78
- e)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(M(f)){a=ec();b=f.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):f.append(a);return}a=f.getChildren().slice(b).reverse()}c=f.insertNewAfter(this);if(null===c)this.insertLineBreak();else if(B(c))if(d=
79
- a.length,0===b&&0<d)f.insertBefore(c);else{b=null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=sc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const f=this.focus;var e=a[0];let g=
80
- a[c];var h=d.getCharacterOffset();const l=f.getCharacterOffset();if(0===b)return[];if(1===b)return w(e)?(a=h>l?l:h,c=e.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);w(e)&&(d=b?h:l,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));w(g)&&(e=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==e&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a;const g=Ra(d,b);if(t(g)&&!g.isIsolated()){var h=b?g.getPreviousSibling():
81
- g.getNextSibling();if(!w(h)){a=g.getParentOrThrow();B(h)?(a=h.__key,h=b?h.getChildrenSize():0):(h=g.getIndexWithinParent(),a=a.__key,b||h++);d.set(a,h,"element");e&&f.set(a,h,"element");return}}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,h=b.type,Y(b,e.key,e.offset,e.type),Y(e,d,f,h)))}deleteCharacter(a){if(this.isCollapsed()){var b=
82
- this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){tc(f,a,b);return}}else if(null!==
83
- d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){tc(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=d.offset,g=f.offset;const h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
84
- this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function Sb(a){return a instanceof fc}function tc(a,b,c){const d=a.getTextContent().split(/\s/g),f=d.length;let e=0,g=0;for(let h=0;h<f;h++){const l=d[h],k=h===f-1;g=e;e+=l.length;if(b&&e===c||e>c||k){d.splice(h,1);k&&(g=void 0);break}}b=d.join(" ");""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
85
- function uc(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Ia(f[d]);if(w(f))d=g?f.getTextContentSize():0;else{e=Ia(a);if(null===e)return null;if(B(e)){a=e.getChildAtIndex(d);if(b=B(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));w(a)?(f=a,e=null,d=g?f.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
86
- d=0===b&&t(e)&&Ia(a)===e?d:d+1,e=e.getParentOrThrow();if(B(e))return X(e.__key,d,"element")}}else f=Ia(a);return w(f)?X(f.__key,d,"text"):null}
87
- function rc(a,b,c,d,f,e){if(null===a||null===c||!qa(f,a,c))return null;a=uc(a,b,J(e)?e.anchor:null);if(null===a)return null;c=uc(c,d,J(e)?e.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),w(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),w(b)&&!b.isInert()&&(a.key=b.__key,a.offset=
88
- 0));f.isComposing()&&f._compositionKey!==a.key&&J(e)&&(f=e.anchor,e=e.focus,Y(a,f.key,f.offset,f.type),Y(c,e.key,e.offset,e.type))}return[a,c]}function vc(a,b,c,d,f,e){const g=z();a=new gc(X(a,b,f),X(c,d,e),0);a.dirty=!0;return g._selection=a}
89
- function Qb(a){var b=a.getEditorState()._selection,c=window.getSelection();if(Sb(b)||ic(b))return b.clone();{var d=(d=window.event)&&d.type;d=!Ub&&("selectionchange"===d||"beforeinput"===d||"compositionstart"===d||"compositionend"===d||"click"===d&&3===window.event.detail||void 0===d);let g,h;if(!J(b)||d)if(null===c)b=null;else if(d=c.anchorNode,g=c.focusNode,h=c.anchorOffset,c=c.focusOffset,a=rc(d,h,g,c,a,b),null===a)b=null;else{var [f,e]=a;b=new gc(f,e,J(b)?b.format:0)}else b=b.clone()}return b}
90
- function K(){return z()._selection}function Ma(){return A()._editorState._selection}function Ib(a){if(null!==a){if("range"===a.type)return new gc(X(a.anchor.key,a.anchor.offset,a.anchor.type),X(a.focus.key,a.focus.offset,a.focus.type),0);if("node"===a.type)return new fc(new Set(a.nodes));if("grid"===a.type)return new hc(a.gridKey,a.anchorCellKey,a.focusCellKey)}return null}
91
- function wc(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),xc(a));else{var l=a.isBackward();h=l?e:f;var k=h.getNode();f=l?f:e;e=f.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));xc(a)}}
92
- function xc(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())B(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),w(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(B(e)){const h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);w(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.__key,e,"text"))}B(g)&&(c=g.getChildrenSize(),f=(b=f>=c)?g.getChildAtIndex(c-
93
- 1):g.getChildAtIndex(f),w(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.__key,g,"text")))}}function Rb(a,b){b=b.getEditorState()._selection;a=a._selection;if(J(a)){var c=a.anchor;const d=a.focus;let f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
94
- function yc(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,w(d)?(g=d.getTextContentSize(),h="text"):B(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,w(f)?h="text":B(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function zc(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}
95
- function Ac(a,b){F();var c=a.__key;const d=a.getParent();if(null!==d){var f=K(),e=!1;if(J(f)&&b){var g=f.anchor;const h=f.focus;g.key===c&&(yc(g,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0);h.key===c&&(yc(h,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);za(a);g.splice(c,1);a.getWritable().__parent=null;J(f)&&b&&!e&&wc(f,d,c,-1);null===d||M(d)||d.canBeEmpty()||!d.isEmpty()||Ac(d,b);null!==d&&M(d)&&d.isEmpty()&&d.selectEnd()}}
96
- function Bc(a){const b=H(a);null===b&&q(39,a);return b}
97
- class Cc{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{F();99<Ba&&q(26);a=A();var b=z(),c=""+oa++;b._nodeMap.set(c,this);B(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=H(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
75
+ c.push(f);else if(d===e)e=f;else{if(v(f))return!1;[e,f]=f.splitText(d);c.push(f)}const l=e;c.push(...g);g=a[0];var k=!1;f=null;for(let t=0;t<a.length;t++){const p=a[t];if(C(p)){if(p.is(g)){if(C(e)&&e.isEmpty()&&e.canReplaceWith(p)){e.replace(p);e=p;k=!0;continue}var m=p.getFirstDescendant();if(wa(m)){for(m=m.getParentOrThrow();m.isInline();)m=m.getParentOrThrow();k=m.getChildren();var n=k.length;if(C(e))for(let A=0;A<n;A++)f=k[A],e.append(f);else{for(--n;0<=n;n--)f=k[n],e.insertAfter(f);e=e.getParentOrThrow()}m.remove();
76
+ k=!0;if(m.is(p))continue}}w(e)&&(null===h&&q(69),e=h)}else k&&!u(p)&&M(e.getParent())&&q(7);k=!1;if(C(e))if(f=p,u(p)&&p.isTopLevel())e=e.insertAfter(p);else if(C(p)){if(p.canBeEmpty()||!p.isEmpty())M(e)?(m=e.getChildAtIndex(d),null!==m?m.insertBefore(p):e.append(p),e=p):e=e.insertAfter(p)}else m=e.getFirstChild(),null!==m?m.insertBefore(p):e.append(p),e=p;else!C(p)||u(e)&&e.isTopLevel()?(f=p,e=e.insertAfter(p)):(e=p.getParentOrThrow(),t--)}b&&(w(l)?l.select():(a=e.getPreviousSibling(),w(a)?a.select():
77
+ (a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(C(e)){if(a=w(f)?f:e.getLastDescendant(),b||(null===a?e.select():w(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),C(e)&&!C(a)?(e.append(a),e=a):C(e)||C(a)?C(a)&&!a.canInsertAfter(e)?(h=d.constructor.clone(d),C(h)||q(8),h.append(a),e.insertAfter(h)):e.insertAfter(a):(e.insertBefore(a),e=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(w(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+
78
+ 1,c.select(e,e)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(M(f)){a=fc();b=f.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):f.append(a);return}a=f.getChildren().slice(b).reverse()}c=f.insertNewAfter(this);if(null===c)this.insertLineBreak();
79
+ else if(C(c))if(d=a.length,0===b&&0<d)f.insertBefore(c);else{b=null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=tc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const f=this.focus;
80
+ var e=a[0];let g=a[c];var h=d.getCharacterOffset();const l=f.getCharacterOffset();if(0===b)return[];if(1===b)return w(e)?(a=h>l?l:h,c=e.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);w(e)&&(d=b?h:l,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));w(g)&&(e=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==e&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a;const g=Sa(d,b);if(u(g)&&!g.isIsolated()){var h=
81
+ b?g.getPreviousSibling():g.getNextSibling();if(!w(h)){a=g.getParentOrThrow();C(h)?(a=h.__key,h=b?h.getChildrenSize():0):(h=g.getIndexWithinParent(),a=a.__key,b||h++);d.set(a,h,"element");e&&f.set(a,h,"element");return}}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,h=b.type,Y(b,e.key,e.offset,e.type),Y(e,d,f,h)))}deleteCharacter(a){if(this.isCollapsed()){var b=
82
+ this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),C(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){uc(f,a,b);return}}else if(null!==
83
+ d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){uc(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=d.offset,g=f.offset;const h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
84
+ this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function Tb(a){return a instanceof gc}function uc(a,b,c){const d=a.getTextContent().split(/\s/g),f=d.length;let e=0,g=0;for(let h=0;h<f;h++){const l=d[h],k=h===f-1;g=e;e+=l.length;if(b&&e===c||e>c||k){d.splice(h,1);k&&(g=void 0);break}}b=d.join(" ");""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
85
+ function vc(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Ja(f[d]);if(w(f))d=g?f.getTextContentSize():0;else{e=Ja(a);if(null===e)return null;if(C(e)){a=e.getChildAtIndex(d);if(b=C(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));w(a)?(f=a,e=null,d=g?f.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
86
+ d=0===b&&u(e)&&Ja(a)===e?d:d+1,e=e.getParentOrThrow();if(C(e))return X(e.__key,d,"element")}}else f=Ja(a);return w(f)?X(f.__key,d,"text"):null}
87
+ function sc(a,b,c,d,f,e){if(null===a||null===c||!ra(f,a,c))return null;a=vc(a,b,J(e)?e.anchor:null);if(null===a)return null;c=vc(c,d,J(e)?e.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),w(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),w(b)&&!b.isInert()&&(a.key=b.__key,a.offset=
88
+ 0));f.isComposing()&&f._compositionKey!==a.key&&J(e)&&(f=e.anchor,e=e.focus,Y(a,f.key,f.offset,f.type),Y(c,e.key,e.offset,e.type))}return[a,c]}function wc(a,b,c,d,f,e){const g=z();a=new hc(X(a,b,f),X(c,d,e),0);a.dirty=!0;return g._selection=a}
89
+ function Rb(a){var b=a.getEditorState()._selection,c=window.getSelection();if(Tb(b)||jc(b))return b.clone();{var d=(d=window.event)&&d.type;d=!Vb&&("selectionchange"===d||"beforeinput"===d||"compositionstart"===d||"compositionend"===d||"click"===d&&3===window.event.detail||void 0===d);let g,h;if(!J(b)||d)if(null===c)b=null;else if(d=c.anchorNode,g=c.focusNode,h=c.anchorOffset,c=c.focusOffset,a=sc(d,h,g,c,a,b),null===a)b=null;else{var [f,e]=a;b=new hc(f,e,J(b)?b.format:0)}else b=b.clone()}return b}
90
+ function K(){return z()._selection}function Na(){return B()._editorState._selection}function Jb(a){if(null!==a){if("range"===a.type)return new hc(X(a.anchor.key,a.anchor.offset,a.anchor.type),X(a.focus.key,a.focus.offset,a.focus.type),0);if("node"===a.type)return new gc(new Set(a.nodes));if("grid"===a.type)return new ic(a.gridKey,a.anchorCellKey,a.focusCellKey)}return null}
91
+ function xc(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),yc(a));else{var l=a.isBackward();h=l?e:f;var k=h.getNode();f=l?f:e;e=f.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));yc(a)}}
92
+ function yc(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())C(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),w(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(C(e)){const h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);w(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.__key,e,"text"))}C(g)&&(c=g.getChildrenSize(),f=(b=f>=c)?g.getChildAtIndex(c-
93
+ 1):g.getChildAtIndex(f),w(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.__key,g,"text")))}}function Sb(a,b){b=b.getEditorState()._selection;a=a._selection;if(J(a)){var c=a.anchor;const d=a.focus;let f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
94
+ function zc(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,w(d)?(g=d.getTextContentSize(),h="text"):C(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,w(f)?h="text":C(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Ac(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}
95
+ function Bc(a,b){F();var c=a.__key;const d=a.getParent();if(null!==d){var f=K(),e=!1;if(J(f)&&b){var g=f.anchor;const h=f.focus;g.key===c&&(zc(g,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0);h.key===c&&(zc(h,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);Aa(a);g.splice(c,1);a.getWritable().__parent=null;J(f)&&b&&!e&&xc(f,d,c,-1);null===d||M(d)||d.canBeEmpty()||!d.isEmpty()||Bc(d,b);null!==d&&M(d)&&d.isEmpty()&&d.selectEnd()}}
96
+ function Cc(a){const b=H(a);null===b&&q(39,a);return b}
97
+ class Dc{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{F();99<Ca&&q(26);a=B();var b=z(),c=""+pa++;b._nodeMap.set(c,this);C(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=H(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
98
98
  K();if(null==a)return!1;const b=(new Set(a.getNodes().map(c=>c.__key))).has(this.__key);return w(this)?b:J(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){const a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){const a=this.getLatest().__parent;return null===a?null:H(a)}getParentOrThrow(){const a=this.getParent();null===a&&q(33,this.__key);return a}getTopLevelElement(){let a=
99
- this;for(;null!==a;){const b=a.getParent();if(M(b)&&B(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&q(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
100
- b?null:H(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>Bc(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:H(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>Bc(c))}getCommonAncestor(a){const b=this.getParents();var c=
101
- a.getParents();B(this)&&b.unshift(this);B(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){const f=b[d];if(c.has(f))return f}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=
102
- a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){const b=this.isBefore(a),c=[],d=new Set;var f=this;let e=null;for(;;){var g=f.__key;d.has(g)||(d.add(g),c.push(f));if(f===a)break;g=B(f)?b?f.getFirstChild():f.getLastChild():null;if(null!==g)null===e&&(e=f),f=g;else if(g=b?f.getNextSibling():f.getPreviousSibling(),null!==g)f=g;else{g=f.getParentOrThrow();d.has(g.__key)||
103
- c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&q(35),g=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(f.is(e)&&(e=null),null!==g||d.has(f.__key)||c.push(f));while(null===g);f=g}}b||c.reverse();return c}isDirty(){const a=A()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===A()._compositionKey}getLatest(){const a=H(this.__key);null===a&&q(36);return a}getWritable(){F();var a=z(),b=A();a=a._nodeMap;const c=this.__key,d=this.getLatest(),
104
- f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return Aa(d),d;const e=d.constructor.clone(d);e.__parent=f;B(d)&&B(e)?(e.__children=Array.from(d.__children),e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):w(d)&&w(e)&&(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail);b.add(c);e.__key=c;Aa(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}exportDOM(a){return t(this)?
105
- (a=a.getElementByKey(this.getKey()),{element:a?a.cloneNode():null}):{element:this.createDOM(a._config,a)}}static importDOM(){return null}remove(){F();Ac(this,!0)}replace(a){F();const b=this.__key;a=a.getWritable();ya(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;const f=d.indexOf(this.__key),e=a.__key;-1===f&&q(16);d.splice(f,0,e);a.__parent=c.__key;Ac(this,!1);za(a);d=K();J(d)&&(c=d.anchor,d=d.focus,c.key===b&&cc(c,a),d.key===b&&cc(d,a));A()._compositionKey===b&&C(e);return a}insertAfter(a){F();
106
- var b=this.getWritable(),c=a.getWritable(),d=c.getParent();const f=K();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(ya(c),J(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;const l=e.__children;b=l.indexOf(b.__key);-1===b&&q(16);l.splice(b+1,0,d);za(c);J(f)&&(wc(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));
107
- return a}insertBefore(a){F();var b=this.getWritable(),c=a.getWritable();ya(c);const d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;const e=d.__children;b=e.indexOf(b.__key);-1===b&&q(16);e.splice(b,0,f);za(c);c=K();J(c)&&wc(c,d,b);return a}selectPrevious(a,b){F();const c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):B(c)?c.select():w(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){F();const c=this.getNextSibling(),
108
- d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):w(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class Dc extends Cc{constructor(a){super(a)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function t(a){return a instanceof Dc}
109
- class Ec extends Cc{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=H(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
110
- A()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let f=0;f<c.length;f++){var d=H(c[f]);!w(d)||!a&&d.isInert()?B(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(B(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(B(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
111
- this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],B(a)&&a.getLastDescendant()||a;a=b[a];return B(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:H(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&q(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,b=a.length;return 0===b?null:H(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:H(a)}getTextContent(a,
112
- b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);B(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){F();const c=K();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(J(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return vc(d,a,d,b,"element","element");return c}selectStart(){const a=
113
- this.getFirstDescendant();return B(a)||w(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return B(a)||w(a)?a.select():null!==a?a.selectNext():this.select()}clear(){F();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){F();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){F();const b=this.getWritable();b.__dir=a;return b}setFormat(a){F();this.getWritable().__format=fa[a];return this}setIndent(a){F();
114
- this.getWritable().__indent=a;return this}splice(a,b,c){F();const d=this.getWritable();var f=d.__key;const e=d.__children,g=c.length;var h=[];for(let l=0;l<g;l++){const k=c[l],m=k.getWritable();k.__key===f&&q(49);ya(m);m.__parent=f;h.push(m.__key)}(c=this.getChildAtIndex(a-1))&&Aa(c);(f=this.getChildAtIndex(a+b))&&Aa(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);if(a.length&&(b=K(),J(b))){const l=new Set(a),k=new Set(h);h=n=>{for(n=n.getNode();n;){const v=n.__key;if(l.has(v)&&!k.has(v))return!0;
115
- n=n.getParent()}return!1};const {anchor:m,focus:p}=b;h(m)&&yc(m,m.getNode(),this,c,f);h(p)&&yc(p,p.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=H(a[b]),null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||M(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}}
116
- function B(a){return a instanceof Ec}
117
- class Fc extends Ec{static getType(){return"root"}static clone(){return new Fc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(70)}getTextContent(a,b){const c=this.__cachedText;return!U&&0!==A()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];B(c)||t(c)||q(46)}return super.append(...a)}toJSON(){return{__children:this.__children,__dir:this.__dir,
118
- __format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function M(a){return a instanceof Fc}function Tb(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function Gc(){return new Hb(new Map([["root",new Fc]]))}
119
- class Hb{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=R,d=U,f=T;R=this;U=!0;T=null;try{var b=a();break a}finally{R=c,U=d,T=f}b=void 0}return b}clone(a){a=new Hb(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:J(a)?{anchor:{key:a.anchor.key,offset:a.anchor.offset,
120
- type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:Sb(a)?{nodes:Array.from(a._nodes),type:"node"}:ic(a)?{anchorCellKey:a.anchorCellKey,focusCellKey:a.focusCellKey,gridKey:a.gridKey,type:"grid"}:null}}}const Hc=Object.freeze({}),Nc=[["keydown",Ic],["compositionstart",Jc],["compositionend",Kc],["input",Lc],["click",Mc],["cut",Hc],["copy",Hc],["dragstart",Hc],["paste",Hc],["focus",Hc],["blur",Hc]];ma?Nc.push(["beforeinput",Oc]):Nc.push(["drop",Hc]);
121
- let Pc=!1,Qc=0;function Rc(a,b,c){I(b,()=>{if(c){var d=K();if(J(d)&&d.isCollapsed()){"Range"===a.type&&(d.dirty=!0);var f=d.anchor;"text"===f.type?(f=f.getNode(),d.format=f.getFormat()):"element"===f.type&&(d.format=0)}V(b,Sc,void 0)}else Ha(null)})}
122
- function Mc(a,b){I(b,()=>{const c=K();if(J(c)){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Fa().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}V(b,Tc,a)})}
123
- function Oc(a,b){const c=a.inputType;if(!("deleteCompositionText"===c||ka&&Sa()))if("insertCompositionText"===c){const d=a.data;d&&I(b,()=>{var f=K();if(J(f)){const e=f.anchor,g=e.getNode(),h=g.getPreviousSibling();0===e.offset&&w(g)&&w(h)&&" "===g.getTextContent()&&h.getFormat()!==f.format&&(f=h.getTextContent(),0===d.indexOf(f)&&(f=d.slice(f.length),V(b,Uc,f),setTimeout(()=>{I(b,()=>{g.select()})},20)))}})}else I(b,()=>{const d=K();if(J(d))if("deleteContentBackward"===c)C(null),a.preventDefault(),
124
- V(b,Vc,!0);else{var f=a.data;if(!d.dirty&&d.isCollapsed()&&!M(d.anchor.getNode())&&a.getTargetRanges){var e=a.getTargetRanges()[0];e&&d.applyDOMRange(e)}var g=d.focus;e=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),V(b,Wc,void 0)):"\n\n"===f?(a.preventDefault(),V(b,Xc,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Na(d,f,!0)&&(a.preventDefault(),V(b,Uc,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,
125
- Uc,a);break;case "insertFromComposition":C(null);V(b,Uc,a);break;case "insertLineBreak":C(null);V(b,Wc,void 0);break;case "insertParagraph":C(null);V(b,Xc,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,Yc,a);break;case "deleteByComposition":e===g&&!B(e)&&!B(g)&&u(e)&&u(g)||V(b,Zc,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,Zc,void 0);break;case "deleteContent":V(b,Vc,!1);break;case "deleteWordBackward":V(b,$c,!0);break;case "deleteWordForward":V(b,$c,!1);break;
126
- case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,ad,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,ad,!1);break;case "formatStrikeThrough":V(b,Z,"strikethrough");break;case "formatBold":V(b,Z,"bold");break;case "formatItalic":V(b,Z,"italic");break;case "formatUnderline":V(b,Z,"underline");break;case "historyUndo":V(b,bd,void 0);break;case "historyRedo":V(b,cd,void 0)}}})}
127
- function Lc(a,b){a.stopPropagation();I(b,()=>{var c=K();const d=a.data;null!=d&&J(c)&&Na(c,d,!1)?V(b,Uc,d):Ka(b,null);F();c=A();$b(c)})}function Jc(a,b){I(b,()=>{const c=K();if(J(c)&&!b.isComposing()){const d=c.anchor;C(d.key);Pc&&"element"!==d.type&&c.isCollapsed()&&c.anchor.getNode().getFormat()===c.format||V(b,Uc," ")}})}
128
- function Kc(a,b){I(b,()=>{var c=b._compositionKey;C(null);if(null!==c&&""===a.data){const d=H(c);c=ta(b.getElementByKey(c));null!==c&&w(d)&&La(d,c.nodeValue,null,null,!0)}else Ka(b,a)})}
129
- function Ic(a,b){Pc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)V(b,dd,a);else if(r&&f&&79===c)a.preventDefault(),V(b,Wc,!0);else if(13!==c||d){var h=r?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?V(b,ed,a):V(b,Vc,!0):27===c?V(b,fd,a):(h=r?d||g||e?!1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?V(b,gd,a):(a.preventDefault(),V(b,Vc,!1)):
130
- 8===c&&(r?g:f)?(a.preventDefault(),V(b,$c,!0)):46===c&&(r?g:f)?(a.preventDefault(),V(b,$c,!1)):r&&e&&8===c?(a.preventDefault(),V(b,ad,!0)):r&&e&&46===c?(a.preventDefault(),V(b,ad,!1)):66===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"bold")):85===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"underline")):73===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"italic")):9!==c||g||f||e?90===c&&!d&&(r?e:f)?(a.preventDefault(),V(b,bd,void 0)):(h=r?90===c&&e&&d:89===c&&f||90===c&&f&&d,h&&(a.preventDefault(),V(b,cd,void 0))):V(b,
131
- hd,a))}else V(b,dd,a);else V(b,id,a);else V(b,jd,a);else V(b,kd,a);else V(b,ld,a)}}function md(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const nd=new Map;function od(){const a=window.getSelection(),b=sa(a.anchorNode);if(null!==b){var c=Ja(b);c=c[c.length-1];var d=c._key,f=nd.get(d),e=f||c;e!==b&&Rc(a,e,!1);Rc(a,b,!0);b!==c?nd.set(d,b):f&&nd.delete(d)}}
132
- function pd(a,b){0===Qc&&a.ownerDocument.addEventListener("selectionchange",od);Qc++;a.__lexicalEditor=b;const c=md(a);for(let d=0;d<Nc.length;d++){const [f,e]=Nc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return V(b,qd,h);case "copy":return V(b,rd,h);case "paste":return V(b,Yc,h);case "dragstart":return V(b,ud,h);case "focus":return V(b,vd,h);case "blur":return V(b,wd,h);case "drop":return V(b,xd,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,
133
- g)})}}class yd extends Cc{static getType(){return"linebreak"}static clone(a){return new yd(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:()=>({conversion:zd,priority:0})}}}function zd(){return{node:sc()}}function sc(){return new yd}function wa(a){return a instanceof yd}function Ad(a,b){return b&1?"strong":b&2?"em":"span"}
134
- function Bd(a,b,c,d,f){a=d.classList;d=Oa(f,"base");void 0!==d&&a.add(...d);d=Oa(f,"underlineStrikethrough");let e=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ea)h=ea[l],d=Oa(f,l),void 0!==d&&(c&h?!e||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
135
- function Cd(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u200b":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const f=a.length;let e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
136
- class Dd extends Cc{static getType(){return"text"}static clone(a){return new Dd(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
137
- (this.getLatest().__detail&2)}hasFormat(a){a=ea[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return ua(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Ad(this,b),f=document.createElement(null===c?d:c);let e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;Cd(this.__text,
138
- c,this);a=a.theme.text;void 0!==a&&Bd(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){const d=this.__text;var f=a.__format,e=this.__format,g=f&16?"code":null;const h=e&16?"code":null;var l=Ad(this,f);const k=Ad(this,e);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return f=b.firstChild,null==f&&q(20),a=g=document.createElement(k),Cd(d,a,this),c=c.theme.text,void 0!==c&&Bd(k,0,e,a,c),b.replaceChild(g,f),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
139
- l&&q(21));Cd(d,l,this);c=c.theme.text;void 0!==c&&f!==e&&Bd(k,f,e,l,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:Ed,priority:0}),b:()=>({conversion:Fd,priority:0}),em:()=>({conversion:Gd,priority:0}),i:()=>({conversion:Gd,priority:0}),span:()=>({conversion:Hd,priority:0}),strong:()=>({conversion:Gd,priority:0}),u:()=>({conversion:Gd,priority:0})}}selectionTransform(){}setFormat(a){F();const b=this.getWritable();b.__format=a;return b}setStyle(a){F();
99
+ this;for(;null!==a;){const b=a.getParent();if(M(b)&&C(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&q(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
100
+ b?null:H(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>Cc(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:H(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>Cc(c))}getCommonAncestor(a){const b=this.getParents();var c=
101
+ a.getParents();C(this)&&b.unshift(this);C(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){const f=b[d];if(c.has(f))return f}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=
102
+ a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){const b=this.isBefore(a),c=[],d=new Set;var f=this;let e=null;for(;;){var g=f.__key;d.has(g)||(d.add(g),c.push(f));if(f===a)break;g=C(f)?b?f.getFirstChild():f.getLastChild():null;if(null!==g)null===e&&(e=f),f=g;else if(g=b?f.getNextSibling():f.getPreviousSibling(),null!==g)f=g;else{g=f.getParentOrThrow();d.has(g.__key)||
103
+ c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&q(35),g=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(f.is(e)&&(e=null),null!==g||d.has(f.__key)||c.push(f));while(null===g);f=g}}b||c.reverse();return c}isDirty(){const a=B()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===B()._compositionKey}getLatest(){const a=H(this.__key);null===a&&q(36);return a}getWritable(){F();var a=z(),b=B();a=a._nodeMap;const c=this.__key,d=this.getLatest(),
104
+ f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return Ba(d),d;const e=d.constructor.clone(d);e.__parent=f;C(d)&&C(e)?(e.__children=Array.from(d.__children),e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):w(d)&&w(e)&&(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail);b.add(c);e.__key=c;Ba(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}exportDOM(a){return u(this)?
105
+ (a=a.getElementByKey(this.getKey()),{element:a?a.cloneNode():null}):{element:this.createDOM(a._config,a)}}static importDOM(){return null}remove(){F();Bc(this,!0)}replace(a){F();const b=this.__key;a=a.getWritable();za(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;const f=d.indexOf(this.__key),e=a.__key;-1===f&&q(16);d.splice(f,0,e);a.__parent=c.__key;Bc(this,!1);Aa(a);d=K();J(d)&&(c=d.anchor,d=d.focus,c.key===b&&dc(c,a),d.key===b&&dc(d,a));B()._compositionKey===b&&D(e);return a}insertAfter(a){F();
106
+ var b=this.getWritable(),c=a.getWritable(),d=c.getParent();const f=K();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(za(c),J(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;const l=e.__children;b=l.indexOf(b.__key);-1===b&&q(16);l.splice(b+1,0,d);Aa(c);J(f)&&(xc(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));
107
+ return a}insertBefore(a){F();var b=this.getWritable(),c=a.getWritable();za(c);const d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;const e=d.__children;b=e.indexOf(b.__key);-1===b&&q(16);e.splice(b,0,f);Aa(c);c=K();J(c)&&xc(c,d,b);return a}selectPrevious(a,b){F();const c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):C(c)?c.select():w(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){F();const c=this.getNextSibling(),
108
+ d=this.getParentOrThrow();return null===c?d.select():C(c)?c.select(0,0):w(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class Ec extends Dc{constructor(a){super(a)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function u(a){return a instanceof Ec}
109
+ class Fc extends Dc{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=H(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
110
+ B()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let f=0;f<c.length;f++){var d=H(c[f]);!w(d)||!a&&d.isInert()?C(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(C(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(C(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
111
+ this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],C(a)&&a.getLastDescendant()||a;a=b[a];return C(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:H(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&q(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,b=a.length;return 0===b?null:H(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:H(a)}getTextContent(a,
112
+ b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);C(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){F();const c=K();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(J(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return wc(d,a,d,b,"element","element");return c}selectStart(){const a=
113
+ this.getFirstDescendant();return C(a)||w(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return C(a)||w(a)?a.select():null!==a?a.selectNext():this.select()}clear(){F();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){F();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){F();const b=this.getWritable();b.__dir=a;return b}setFormat(a){F();this.getWritable().__format=fa[a];return this}setIndent(a){F();
114
+ this.getWritable().__indent=a;return this}splice(a,b,c){F();const d=this.getWritable();var f=d.__key;const e=d.__children,g=c.length;var h=[];for(let l=0;l<g;l++){const k=c[l],m=k.getWritable();k.__key===f&&q(49);za(m);m.__parent=f;h.push(m.__key)}(c=this.getChildAtIndex(a-1))&&Ba(c);(f=this.getChildAtIndex(a+b))&&Ba(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);if(a.length&&(b=K(),J(b))){const l=new Set(a),k=new Set(h);h=t=>{for(t=t.getNode();t;){const p=t.__key;if(l.has(p)&&!k.has(p))return!0;
115
+ t=t.getParent()}return!1};const {anchor:m,focus:n}=b;h(m)&&zc(m,m.getNode(),this,c,f);h(n)&&zc(n,n.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=H(a[b]),null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||M(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}}
116
+ function C(a){return a instanceof Fc}
117
+ class Gc extends Fc{static getType(){return"root"}static clone(){return new Gc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(70)}getTextContent(a,b){const c=this.__cachedText;return!U&&0!==B()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];C(c)||u(c)||q(46)}return super.append(...a)}toJSON(){return{__children:this.__children,__dir:this.__dir,
118
+ __format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function M(a){return a instanceof Gc}function Ub(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 Hc(){return new Ib(new Map([["root",new Gc]]))}
119
+ class Ib{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=R,d=U,f=T;R=this;U=!0;T=null;try{var b=a();break a}finally{R=c,U=d,T=f}b=void 0}return b}clone(a){a=new Ib(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:J(a)?{anchor:{key:a.anchor.key,offset:a.anchor.offset,
120
+ type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:Tb(a)?{nodes:Array.from(a._nodes),type:"node"}:jc(a)?{anchorCellKey:a.anchorCellKey,focusCellKey:a.focusCellKey,gridKey:a.gridKey,type:"grid"}:null}}}const Ic=Object.freeze({}),Oc=[["keydown",Jc],["compositionstart",Kc],["compositionend",Lc],["input",Mc],["click",Nc],["cut",Ic],["copy",Ic],["dragstart",Ic],["paste",Ic],["focus",Ic],["blur",Ic]];la?Oc.push(["beforeinput",Pc]):Oc.push(["drop",Ic]);
121
+ let Qc=0,Rc=0;function Sc(a,b,c){I(b,()=>{if(c){var d=K();if(J(d)&&d.isCollapsed()){"Range"===a.type&&(d.dirty=!0);var f=d.anchor;"text"===f.type?(f=f.getNode(),d.format=f.getFormat()):"element"===f.type&&(d.format=0)}V(b,Tc,void 0)}else Ia(null)})}
122
+ function Nc(a,b){I(b,()=>{const c=K();if(J(c)){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Ga().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}V(b,Uc,a)})}function Vc(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function Wc(a,b){return a!==b||C(a)||C(b)||!v(a)||!v(b)}
123
+ function Pc(a,b){const c=a.inputType;if(!("deleteCompositionText"===c||ka&&Wa()))if("insertCompositionText"===c){const d=a.data;d&&I(b,()=>{var f=K();if(J(f)){const e=f.anchor,g=e.getNode(),h=g.getPreviousSibling();0===e.offset&&w(g)&&w(h)&&" "===g.getTextContent()&&h.getFormat()!==f.format&&(f=h.getTextContent(),0===d.indexOf(f)&&(f=d.slice(f.length),V(b,Xc,f),setTimeout(()=>{I(b,()=>{g.select()})},30)))}})}else I(b,()=>{const d=K();if(J(d))if("deleteContentBackward"===c)D(null),a.preventDefault(),
124
+ Qc=0,V(b,Yc,!0),setTimeout(()=>{b.update(()=>{D(null)})},30);else{var f=a.data;d.dirty||!d.isCollapsed()||M(d.anchor.getNode())||Vc(d,a);var e=d.focus,g=d.anchor.getNode();e=e.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),V(b,Zc,void 0)):"\n\n"===f?(a.preventDefault(),V(b,$c,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Oa(d,f,!0)&&(a.preventDefault(),V(b,Xc,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,
125
+ Xc,a);break;case "insertFromComposition":D(null);V(b,Xc,a);break;case "insertLineBreak":D(null);V(b,Zc,void 0);break;case "insertParagraph":D(null);V(b,$c,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ad,a);break;case "deleteByComposition":Wc(g,e)&&V(b,bd,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,bd,void 0);break;case "deleteContent":V(b,Yc,!1);break;case "deleteWordBackward":V(b,cd,!0);break;case "deleteWordForward":V(b,cd,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
126
+ dd,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,dd,!1);break;case "formatStrikeThrough":V(b,Z,"strikethrough");break;case "formatBold":V(b,Z,"bold");break;case "formatItalic":V(b,Z,"italic");break;case "formatUnderline":V(b,Z,"underline");break;case "historyUndo":V(b,ed,void 0);break;case "historyRedo":V(b,fd,void 0)}}})}
127
+ function Mc(a,b){a.stopPropagation();I(b,()=>{var c=K();const d=a.data;null!=d&&J(c)&&Oa(c,d,!1)?V(b,Xc,d):La(b,null);F();c=B();ac(c)})}function Kc(a,b){I(b,()=>{const c=K();if(J(c)&&!b.isComposing()){const d=c.anchor;D(d.key);(a.timeStamp<Qc+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,Xc," ")}})}
128
+ function Lc(a,b){I(b,()=>{var c=b._compositionKey;D(null);var d=a.data;if(null!==c&&null!=d){if(""===d){d=H(c);c=ua(b.getElementByKey(c));null!==c&&w(d)&&Ma(d,c.nodeValue,null,null,!0);return}if("\n"===d[d.length-1]&&(c=K(),J(c))){d=c.focus;c.anchor.set(d.key,d.offset,d.type);V(b,gd,null);return}}La(b,a)})}
129
+ function Jc(a,b){Qc=a.timeStamp;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)V(b,gd,a);else if(r&&f&&79===c)a.preventDefault(),V(b,Zc,!0);else if(13!==c||d){var h=r?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?V(b,hd,a):(a.preventDefault(),V(b,Yc,!0)):27===c?V(b,id,a):(h=r?d||g||e?!1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?V(b,jd,a):(a.preventDefault(),V(b,Yc,!1)):8===c&&
130
+ (r?g:f)?(a.preventDefault(),V(b,cd,!0)):46===c&&(r?g:f)?(a.preventDefault(),V(b,cd,!1)):r&&e&&8===c?(a.preventDefault(),V(b,dd,!0)):r&&e&&46===c?(a.preventDefault(),V(b,dd,!1)):66===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"bold")):85===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"underline")):73===c&&(r?e:f)?(a.preventDefault(),V(b,Z,"italic")):9!==c||g||f||e?90===c&&!d&&(r?e:f)?(a.preventDefault(),V(b,ed,void 0)):(h=r?90===c&&e&&d:89===c&&f||90===c&&f&&d,h&&(a.preventDefault(),V(b,fd,void 0))):V(b,kd,a))}else V(b,
131
+ gd,a);else V(b,ld,a);else V(b,md,a);else V(b,nd,a);else V(b,od,a)}}function pd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const qd=new Map;function rd(){const a=window.getSelection(),b=ta(a.anchorNode);if(null!==b){var c=Ka(b);c=c[c.length-1];var d=c._key,f=qd.get(d),e=f||c;e!==b&&Sc(a,e,!1);Sc(a,b,!0);b!==c?qd.set(d,b):f&&qd.delete(d)}}
132
+ function sd(a,b){0===Rc&&a.ownerDocument.addEventListener("selectionchange",rd);Rc++;a.__lexicalEditor=b;const c=pd(a);for(let d=0;d<Oc.length;d++){const [f,e]=Oc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return V(b,vd,h);case "copy":return V(b,wd,h);case "paste":return V(b,ad,h);case "dragstart":return V(b,xd,h);case "focus":return V(b,yd,h);case "blur":return V(b,zd,h);case "drop":return V(b,Ad,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,
133
+ g)})}}class Bd extends Dc{static getType(){return"linebreak"}static clone(a){return new Bd(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:()=>({conversion:Cd,priority:0})}}}function Cd(){return{node:tc()}}function tc(){return new Bd}function ya(a){return a instanceof Bd}function Dd(a,b){return b&1?"strong":b&2?"em":"span"}
134
+ function Ed(a,b,c,d,f){a=d.classList;d=Pa(f,"base");void 0!==d&&a.add(...d);d=Pa(f,"underlineStrikethrough");let e=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ea)h=ea[l],d=Pa(f,l),void 0!==d&&(c&h?!e||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
135
+ function Fd(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u200b":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const f=a.length;let e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
136
+ class Gd extends Dc{static getType(){return"text"}static clone(a){return new Gd(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
137
+ (this.getLatest().__detail&2)}hasFormat(a){a=ea[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return va(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Dd(this,b),f=document.createElement(null===c?d:c);let e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;Fd(this.__text,
138
+ c,this);a=a.theme.text;void 0!==a&&Ed(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){const d=this.__text;var f=a.__format,e=this.__format,g=f&16?"code":null;const h=e&16?"code":null;var l=Dd(this,f);const k=Dd(this,e);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return f=b.firstChild,null==f&&q(20),a=g=document.createElement(k),Fd(d,a,this),c=c.theme.text,void 0!==c&&Ed(k,0,e,a,c),b.replaceChild(g,f),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
139
+ l&&q(21));Fd(d,l,this);c=c.theme.text;void 0!==c&&f!==e&&Ed(k,f,e,l,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:Hd,priority:0}),b:()=>({conversion:Id,priority:0}),em:()=>({conversion:Jd,priority:0}),i:()=>({conversion:Jd,priority:0}),span:()=>({conversion:Kd,priority:0}),strong:()=>({conversion:Jd,priority:0}),u:()=>({conversion:Jd,priority:0})}}selectionTransform(){}setFormat(a){F();const b=this.getWritable();b.__format=a;return b}setStyle(a){F();
140
140
  const b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=ea[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){F();const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){F();const a=this.getWritable();a.__detail^=2;return a}setMode(a){F();a=ha[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){F();const b=this.getWritable();b.__text=a;return b}select(a,b){F();const c=K();var d=this.getTextContent();const f=this.__key;"string"===typeof d?(d=
141
- d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(J(c))d=A()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||C(f),c.setTextNodeRange(this,a,this,b);else return vc(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){F();const f=this.getWritable(),e=f.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=K();d&&J(l)&&(a+=g,l.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);return f.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){F();
142
- var b=this.getLatest(),c=b.getTextContent(),d=b.__key,f=A()._compositionKey,e=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&e.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);e=a.length;if(0===e)return[];if(a[0]===c)return[b];var k=a[0];c=b.getParentOrThrow();l=c.__key;const m=b.getFormat(),p=b.getStyle(),n=b.__detail;g=!1;b.isSegmented()?(h=L(k),h.__parent=l,h.__format=m,h.__style=p,h.__detail=n,g=!0):(h=b.getWritable(),h.__text=k);b=K();h=[h];k=k.length;for(let y=1;y<e;y++){var v=
143
- a[y],D=v.length;v=L(v).getWritable();v.__format=m;v.__style=p;v.__detail=n;const E=v.__key;D=k+D;if(J(b)){const x=b.anchor,G=b.focus;x.key===d&&"text"===x.type&&x.offset>k&&x.offset<=D&&(x.key=E,x.offset-=k,b.dirty=!0);G.key===d&&"text"===G.type&&G.offset>k&&G.offset<=D&&(G.key=E,G.offset-=k,b.dirty=!0)}f===d&&C(E);k=D;v.__parent=l;h.push(v)}za(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);J(b)&&wc(b,c,d,e-1);return h}mergeWithSibling(a){const b=
144
- a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,f=this.__text,e=f.length;A()._compositionKey===d&&C(c);const g=K();if(J(g)){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(zc(h,b,c,a,e),g.dirty=!0);null!==l&&l.key===d&&(zc(l,b,c,a,e),g.dirty=!0)}this.setTextContent(b?a.__text+f:f+a.__text);a.remove();return this.getLatest()}isTextEntity(){return!1}}
145
- function Hd(a){const b="700"===a.style.fontWeight;return{forChild:c=>{w(c)&&b&&c.toggleFormat("bold");return c},node:null}}function Fd(a){const b="normal"===a.style.fontWeight;return{forChild:c=>{w(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ed(a){return{node:L(a.textContent)}}const Id={em:"italic",i:"italic",strong:"bold",u:"underline"};function Gd(a){const b=Id[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{w(c)&&c.toggleFormat(b);return c},node:null}}
146
- function L(a=""){return new Dd(a)}function w(a){return a instanceof Dd}
147
- class Jd extends Ec{static getType(){return"paragraph"}static clone(a){return new Jd(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Oa(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Kd,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}insertNewAfter(){const a=ec(),b=this.getDirection();
148
- a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||w(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Kd(){return{node:ec()}}function ec(){return new Jd}
149
- function Lb(a,b,c,d){const f=a._keyToDOMMap;f.clear();a._editorState=Gc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
150
- function Ld(a){const b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM;if(!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
151
- function bb(a){var b=a||{},c=b.namespace||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Gc();a=b.editorState;const l=[Fc,Dd,yd,Jd,...(b.nodes||[])],k=b.onError;b=b.readOnly||!1;const m=new Map;for(let p=0;p<l.length;p++){const n=l[p],v=n.getType();m.set(v,{klass:n,transforms:new Set})}c=new Md(h,e,m,{context:f,disableEvents:g,namespace:c,theme:d},k,Ld(m),b);void 0!==a&&(c._pendingEditorState=a,c._dirtyType=
141
+ d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(J(c))d=B()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||D(f),c.setTextNodeRange(this,a,this,b);else return wc(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){F();const f=this.getWritable(),e=f.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=K();d&&J(l)&&(a+=g,l.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);return f.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){F();
142
+ var b=this.getLatest(),c=b.getTextContent(),d=b.__key,f=B()._compositionKey,e=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&e.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);e=a.length;if(0===e)return[];if(a[0]===c)return[b];var k=a[0];c=b.getParentOrThrow();l=c.__key;const m=b.getFormat(),n=b.getStyle(),t=b.__detail;g=!1;b.isSegmented()?(h=L(k),h.__parent=l,h.__format=m,h.__style=n,h.__detail=t,g=!0):(h=b.getWritable(),h.__text=k);b=K();h=[h];k=k.length;for(let y=1;y<e;y++){var p=
143
+ a[y],A=p.length;p=L(p).getWritable();p.__format=m;p.__style=n;p.__detail=t;const E=p.__key;A=k+A;if(J(b)){const x=b.anchor,G=b.focus;x.key===d&&"text"===x.type&&x.offset>k&&x.offset<=A&&(x.key=E,x.offset-=k,b.dirty=!0);G.key===d&&"text"===G.type&&G.offset>k&&G.offset<=A&&(G.key=E,G.offset-=k,b.dirty=!0)}f===d&&D(E);k=A;p.__parent=l;h.push(p)}Aa(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);J(b)&&xc(b,c,d,e-1);return h}mergeWithSibling(a){const b=
144
+ a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,f=this.__text,e=f.length;B()._compositionKey===d&&D(c);const g=K();if(J(g)){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(Ac(h,b,c,a,e),g.dirty=!0);null!==l&&l.key===d&&(Ac(l,b,c,a,e),g.dirty=!0)}this.setTextContent(b?a.__text+f:f+a.__text);a.remove();return this.getLatest()}isTextEntity(){return!1}}
145
+ function Kd(a){const b="700"===a.style.fontWeight;return{forChild:c=>{w(c)&&b&&c.toggleFormat("bold");return c},node:null}}function Id(a){const b="normal"===a.style.fontWeight;return{forChild:c=>{w(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Hd(a){return{node:L(a.textContent)}}const Ld={em:"italic",i:"italic",strong:"bold",u:"underline"};function Jd(a){const b=Ld[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{w(c)&&c.toggleFormat(b);return c},node:null}}
146
+ function L(a=""){return new Gd(a)}function w(a){return a instanceof Gd}
147
+ class Md extends Fc{static getType(){return"paragraph"}static clone(a){return new Md(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Pa(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Nd,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}insertNewAfter(){const a=fc(),b=this.getDirection();
148
+ a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||w(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Nd(){return{node:fc()}}function fc(){return new Md}
149
+ function Mb(a,b,c,d){const f=a._keyToDOMMap;f.clear();a._editorState=Hc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
150
+ function Od(a){const b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM;if(!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
151
+ function cb(a){var b=a||{},c=b.namespace||Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5);const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Hc();a=b.editorState;const l=[Gc,Gd,Bd,Md,...(b.nodes||[])],k=b.onError;b=b.readOnly||!1;const m=new Map;for(let n=0;n<l.length;n++){const t=l[n],p=t.getType();m.set(p,{klass:t,transforms:new Set})}c=new Pd(h,e,m,{context:f,disableEvents:g,namespace:c,theme:d},k,Od(m),b);void 0!==a&&(c._pendingEditorState=a,c._dirtyType=
152
152
  2);return c}
153
- class Md{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
154
- new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+oa++;this._onError=f;this._htmlConversions=e;this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){const b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){const b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){const b=this._listeners.decorator;b.add(a);return()=>
153
+ class Pd{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
154
+ new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+pa++;this._onError=f;this._htmlConversions=e;this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){const b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){const b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){const b=this._listeners.decorator;b.add(a);return()=>
155
155
  {b.delete(a)}}registerTextContentListener(a){const b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){const b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&q(56);const d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);const f=d.get(a);void 0===f&&q(81,a);const e=f[c];e.add(b);return()=>{e.delete(b);f.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
156
- b){void 0===this._nodes.get(a.getType())&&q(57,a.name);const c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const f=d.transforms;f.add(b);Ga(this,c);return()=>{f.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){const b=
157
- this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Lb(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Qc&&(Qc--,0===Qc&&b.ownerDocument.removeEventListener("selectionchange",od));c=b.__lexicalEditor;if(null!=c){if(null!==c._parentEditor){var d=Ja(c);d=d[d.length-1]._key;nd.get(d)===c&&nd.delete(d)}else nd.delete(c._key);b.__lexicalEditor=null}c=md(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect=
158
- "text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Mb(this),this._updateTags.add("history-merge"),Jb(this),this._config.disableEvents||pd(a,this));Nb("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);$b(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
159
- Jb(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Jb(this)}parseEditorState(a){a=JSON.parse(a);return cb(a,this)}update(a,b){I(this,a,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),I(this,()=>{const c=K(),d=Fa();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==
160
- a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly=a;Nb("readonly",this,!0,a)}toJSON(){return{editorState:this._editorState}}}class Nd extends Ec{constructor(a,b){super(b)}}function qc(a){return a instanceof Nd}class Od extends Ec{}function jc(a){return a instanceof Od}class Pd extends Ec{}function kc(a){return a instanceof Pd}
161
- const Sc={},Tc={},Vc={},Wc={},Xc={},Uc={},Yc={},Zc={},$c={},ad={},Z={},bd={},cd={},ld={},kd={},jd={},id={},dd={},ed={},fd={},gd={},hd={},xd={},ud={},rd={},qd={},vd={},wd={};exports.$createGridSelection=function(){return new hc("root","root","root")};exports.$createLineBreakNode=sc;exports.$createNodeFromParse=function(a,b){F();const c=A();return ab(a,b,c,null)};exports.$createNodeSelection=function(){return new fc(new Set)};exports.$createParagraphNode=ec;
162
- exports.$createRangeSelection=function(){const a=X("root",0,"element"),b=X("root",0,"element");return new gc(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=Ra;exports.$getNearestNodeFromDOMNode=ra;exports.$getNodeByKey=H;exports.$getPreviousSelection=Ma;exports.$getRoot=Fa;exports.$getSelection=K;exports.$isDecoratorNode=t;exports.$isElementNode=B;exports.$isGridCellNode=qc;exports.$isGridNode=jc;exports.$isGridRowNode=kc;exports.$isGridSelection=ic;exports.$isLeafNode=va;
163
- exports.$isLineBreakNode=wa;exports.$isNodeSelection=Sb;exports.$isParagraphNode=function(a){return a instanceof Jd};exports.$isRangeSelection=J;exports.$isRootNode=M;exports.$isTextNode=w;exports.$nodesOfType=function(a){var b=z();const c=b._readOnly,d=a.getType();b=b._nodeMap;const f=[];for(const [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$setCompositionKey=C;exports.$setSelection=Ha;exports.BLUR_COMMAND=wd;exports.CAN_REDO_COMMAND={};
164
- exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Tc;exports.COPY_COMMAND=rd;exports.CUT_COMMAND=qd;exports.DELETE_CHARACTER_COMMAND=Vc;exports.DELETE_LINE_COMMAND=ad;exports.DELETE_WORD_COMMAND=$c;exports.DRAGSTART_COMMAND=ud;exports.DROP_COMMAND=xd;exports.DecoratorNode=Dc;exports.ElementNode=Ec;exports.FOCUS_COMMAND=vd;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=Z;exports.GridCellNode=Nd;exports.GridNode=Od;
165
- exports.GridRowNode=Pd;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=Wc;exports.INSERT_PARAGRAPH_COMMAND=Xc;exports.INSERT_TEXT_COMMAND=Uc;exports.KEY_ARROW_DOWN_COMMAND=id;exports.KEY_ARROW_LEFT_COMMAND=kd;exports.KEY_ARROW_RIGHT_COMMAND=ld;exports.KEY_ARROW_UP_COMMAND=jd;exports.KEY_BACKSPACE_COMMAND=ed;exports.KEY_DELETE_COMMAND=gd;exports.KEY_ENTER_COMMAND=dd;exports.KEY_ESCAPE_COMMAND=fd;exports.KEY_TAB_COMMAND=hd;exports.OUTDENT_CONTENT_COMMAND={};
166
- exports.PASTE_COMMAND=Yc;exports.ParagraphNode=Jd;exports.READ_ONLY_COMMAND={};exports.REDO_COMMAND=cd;exports.REMOVE_TEXT_COMMAND=Zc;exports.SELECTION_CHANGE_COMMAND=Sc;exports.TextNode=Dd;exports.UNDO_COMMAND=bd;exports.VERSION="0.2.0";exports.createCommand=function(){return{}};exports.createEditor=bb;
156
+ b){void 0===this._nodes.get(a.getType())&&q(57,a.name);const c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const f=d.transforms;f.add(b);Ha(this,c);return()=>{f.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){const b=
157
+ this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Mb(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Rc&&(Rc--,0===Rc&&b.ownerDocument.removeEventListener("selectionchange",rd));c=b.__lexicalEditor;if(null!=c){if(null!==c._parentEditor){var d=Ka(c);d=d[d.length-1]._key;qd.get(d)===c&&qd.delete(d)}else qd.delete(c._key);b.__lexicalEditor=null}c=pd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect=
158
+ "text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Nb(this),this._updateTags.add("history-merge"),Kb(this),this._config.disableEvents||sd(a,this));Ob("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);ac(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
159
+ Kb(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Kb(this)}parseEditorState(a){a=JSON.parse(a);return db(a,this)}update(a,b){I(this,a,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),I(this,()=>{const c=K(),d=Ga();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==
160
+ a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly=a;Ob("readonly",this,!0,a)}toJSON(){return{editorState:this._editorState}}}class Qd extends Fc{constructor(a,b){super(b)}}function rc(a){return a instanceof Qd}class Rd extends Fc{}function kc(a){return a instanceof Rd}class Sd extends Fc{}function lc(a){return a instanceof Sd}
161
+ const Tc={},Uc={},Yc={},Zc={},$c={},Xc={},ad={},bd={},cd={},dd={},Z={},ed={},fd={},od={},nd={},md={},ld={},gd={},hd={},id={},jd={},kd={},Ad={},xd={},wd={},vd={},yd={},zd={};exports.$createGridSelection=function(){return new ic("root","root","root")};exports.$createLineBreakNode=tc;exports.$createNodeFromParse=function(a,b){F();const c=B();return bb(a,b,c,null)};exports.$createNodeSelection=function(){return new gc(new Set)};exports.$createParagraphNode=fc;
162
+ exports.$createRangeSelection=function(){const a=X("root",0,"element"),b=X("root",0,"element");return new hc(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=Sa;exports.$getNearestNodeFromDOMNode=sa;exports.$getNodeByKey=H;exports.$getPreviousSelection=Na;exports.$getRoot=Ga;exports.$getSelection=K;exports.$isDecoratorNode=u;exports.$isElementNode=C;exports.$isGridCellNode=rc;exports.$isGridNode=kc;exports.$isGridRowNode=lc;exports.$isGridSelection=jc;exports.$isLeafNode=wa;
163
+ exports.$isLineBreakNode=ya;exports.$isNodeSelection=Tb;exports.$isParagraphNode=function(a){return a instanceof Md};exports.$isRangeSelection=J;exports.$isRootNode=M;exports.$isTextNode=w;exports.$nodesOfType=function(a){var b=z();const c=b._readOnly,d=a.getType();b=b._nodeMap;const f=[];for(const [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$setCompositionKey=D;exports.$setSelection=Ia;exports.BLUR_COMMAND=zd;exports.CAN_REDO_COMMAND={};
164
+ exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Uc;exports.COPY_COMMAND=wd;exports.CUT_COMMAND=vd;exports.DELETE_CHARACTER_COMMAND=Yc;exports.DELETE_LINE_COMMAND=dd;exports.DELETE_WORD_COMMAND=cd;exports.DRAGSTART_COMMAND=xd;exports.DROP_COMMAND=Ad;exports.DecoratorNode=Ec;exports.ElementNode=Fc;exports.FOCUS_COMMAND=yd;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=Z;exports.GridCellNode=Qd;exports.GridNode=Rd;
165
+ exports.GridRowNode=Sd;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=Zc;exports.INSERT_PARAGRAPH_COMMAND=$c;exports.INSERT_TEXT_COMMAND=Xc;exports.KEY_ARROW_DOWN_COMMAND=ld;exports.KEY_ARROW_LEFT_COMMAND=nd;exports.KEY_ARROW_RIGHT_COMMAND=od;exports.KEY_ARROW_UP_COMMAND=md;exports.KEY_BACKSPACE_COMMAND=hd;exports.KEY_DELETE_COMMAND=jd;exports.KEY_ENTER_COMMAND=gd;exports.KEY_ESCAPE_COMMAND=id;exports.KEY_TAB_COMMAND=kd;exports.OUTDENT_CONTENT_COMMAND={};
166
+ exports.PASTE_COMMAND=ad;exports.ParagraphNode=Md;exports.READ_ONLY_COMMAND={};exports.REDO_COMMAND=fd;exports.REMOVE_TEXT_COMMAND=bd;exports.SELECTION_CHANGE_COMMAND=Tc;exports.TextNode=Gd;exports.UNDO_COMMAND=ed;exports.VERSION="0.2.1";exports.createCommand=function(){return{}};exports.createEditor=cb;
package/README.md CHANGED
@@ -11,10 +11,10 @@ editor implementations to be built on top. Lexical's engine provides three main
11
11
 
12
12
  By design, the core of Lexical tries to be as minimal as possible.
13
13
  Lexical doesn't directly concern itself with things that monolithic editors tend to do – such as UI components, toolbars or rich-text features and markdown. Instead
14
- the logic for those features can be included via a plugin interface and used as and when they're needed. This ensures great extensibilty and keeps code-sizes
14
+ the logic for those features can be included via a plugin interface and used as and when they're needed. This ensures great extensibility and keeps code-sizes
15
15
  to a minimal – ensuring apps only pay the cost for what they actually import.
16
16
 
17
- For React apps, Lexical has tight intergration with React 18+ via the optional `@lexical/react` package. This package provides
17
+ For React apps, Lexical has tight integration with React 18+ via the optional `@lexical/react` package. This package provides
18
18
  production-ready utility functions, helpers and React hooks that make it seemless to create text editors within React.
19
19
 
20
20
  ## Usage
@@ -90,7 +90,7 @@ There are a few ways to update an editor instance:
90
90
  - Trigger an update with `editor.update()`
91
91
  - Setting the editor state via `editor.setEditorState()`
92
92
  - Applying a change as part of an existing update via `editor.registerNodeTransform()`
93
- - Using a command listener with `editor.registerCommand( () => {...}, priority)`
93
+ - Using a command listener with `editor.registerCommand(EXAMPLE_COMMAND, () => {...}, priority)`
94
94
 
95
95
  The most common way to update the editor is to use `editor.update()`. Calling this function
96
96
  requires a function to be passed in that will provide access to mutate the underlying
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lexical",
3
- "description": "Lexical is an extensible text editor library that provides excellent reliability, accessible and performance.",
3
+ "description": "Lexical is an extensible text editor framework that provides excellent reliability, accessible and performance.",
4
4
  "keywords": [
5
5
  "react",
6
6
  "lexical",
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.2.0",
12
+ "version": "0.2.1",
13
13
  "main": "Lexical.js",
14
14
  "typings": "Lexical.d.ts",
15
15
  "repository": {