lexical 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.dev.js CHANGED
@@ -220,7 +220,7 @@ function getLastSelection(editor) {
220
220
  }
221
221
 
222
222
  function handleTextMutation(target, node, editor) {
223
- const domSelection = getDOMSelection();
223
+ const domSelection = getDOMSelection(editor._window);
224
224
  let anchorOffset = null;
225
225
  let focusOffset = null;
226
226
 
@@ -279,7 +279,7 @@ function $flushMutations$1(editor, mutations, observer) {
279
279
  // processed outside of the Lexical engine.
280
280
  if (shouldFlushTextMutations && $isTextNode(targetNode) && shouldUpdateTextNodeFromMutation(selection, targetDOM, targetNode)) {
281
281
  handleTextMutation( // nodeType === DOM_TEXT_TYPE is a Text DOM node
282
- targetDOM, targetNode);
282
+ targetDOM, targetNode, editor);
283
283
  }
284
284
  } else if (type === 'childList') {
285
285
  shouldRevertSelection = true; // We attempt to "undo" any changes that have occurred outside
@@ -867,9 +867,9 @@ function getAnchorTextFromDOM(anchorNode) {
867
867
 
868
868
  return null;
869
869
  }
870
- function $updateSelectedTextFromDOM(isCompositionEnd, data) {
870
+ function $updateSelectedTextFromDOM(isCompositionEnd, editor, data) {
871
871
  // Update the text content with the latest composition text
872
- const domSelection = getDOMSelection();
872
+ const domSelection = getDOMSelection(editor._window);
873
873
 
874
874
  if (domSelection === null) {
875
875
  return;
@@ -1555,15 +1555,8 @@ function updateDOMBlockCursorElement(editor, rootElement, nextSelection) {
1555
1555
  removeDOMBlockCursorElement(blockCursorElement, editor, rootElement);
1556
1556
  }
1557
1557
  }
1558
- function getDOMSelection() {
1559
- const editor = internalGetActiveEditor();
1560
-
1561
- if (!CAN_USE_DOM) {
1562
- return null;
1563
- }
1564
-
1565
- const win = editor && editor._window || window;
1566
- return win.getSelection();
1558
+ function getDOMSelection(targetWindow) {
1559
+ return !CAN_USE_DOM ? null : (targetWindow || window).getSelection();
1567
1560
  }
1568
1561
 
1569
1562
  /**
@@ -2454,10 +2447,11 @@ function $shouldPreventDefaultAndInsertText(selection, text, timeStamp, isBefore
2454
2447
  const anchor = selection.anchor;
2455
2448
  const focus = selection.focus;
2456
2449
  const anchorNode = anchor.getNode();
2457
- const domSelection = getDOMSelection();
2450
+ const editor = getActiveEditor();
2451
+ const domSelection = getDOMSelection(editor._window);
2458
2452
  const domAnchorNode = domSelection !== null ? domSelection.anchorNode : null;
2459
2453
  const anchorKey = anchor.key;
2460
- const backingAnchorElement = getActiveEditor().getElementByKey(anchorKey);
2454
+ const backingAnchorElement = editor.getElementByKey(anchorKey);
2461
2455
  const textLength = text.length;
2462
2456
  return anchorKey !== focus.key || // If we're working with a non-text node.
2463
2457
  !$isTextNode(anchorNode) || // If we are replacing a range with a single character or grapheme, and not composing.
@@ -2577,7 +2571,7 @@ function onSelectionChange(domSelection, editor, isActive) {
2577
2571
  function onClick(event, editor) {
2578
2572
  updateEditor(editor, () => {
2579
2573
  const selection = $getSelection();
2580
- const domSelection = getDOMSelection();
2574
+ const domSelection = getDOMSelection(editor._window);
2581
2575
  const lastSelection = $getPreviousSelection();
2582
2576
 
2583
2577
  if ($isRangeSelection(selection)) {
@@ -2879,7 +2873,7 @@ function onInput(event, editor) {
2879
2873
 
2880
2874
  const anchor = selection.anchor;
2881
2875
  const anchorNode = anchor.getNode();
2882
- const domSelection = getDOMSelection();
2876
+ const domSelection = getDOMSelection(editor._window);
2883
2877
 
2884
2878
  if (domSelection === null) {
2885
2879
  return;
@@ -2906,7 +2900,7 @@ function onInput(event, editor) {
2906
2900
  $setCompositionKey(null);
2907
2901
  }
2908
2902
  } else {
2909
- $updateSelectedTextFromDOM(false); // onInput always fires after onCompositionEnd for FF.
2903
+ $updateSelectedTextFromDOM(false, editor); // onInput always fires after onCompositionEnd for FF.
2910
2904
 
2911
2905
  if (isFirefoxEndingComposition) {
2912
2906
  onCompositionEndImpl(editor, data || undefined);
@@ -2978,7 +2972,7 @@ function onCompositionEndImpl(editor, data) {
2978
2972
  }
2979
2973
  }
2980
2974
 
2981
- $updateSelectedTextFromDOM(true, data);
2975
+ $updateSelectedTextFromDOM(true, editor, data);
2982
2976
  }
2983
2977
 
2984
2978
  function onCompositionEnd(event, editor) {
@@ -3118,7 +3112,9 @@ function getRootElementRemoveHandles(rootElement) {
3118
3112
  const activeNestedEditorsMap = new Map();
3119
3113
 
3120
3114
  function onDocumentSelectionChange(event) {
3121
- const domSelection = getDOMSelection();
3115
+ const target = event.target;
3116
+ const targetWindow = target == null ? null : target.nodeType === 9 ? target.defaultView : target.ownerDocument.defaultView;
3117
+ const domSelection = getDOMSelection(targetWindow);
3122
3118
 
3123
3119
  if (domSelection === null) {
3124
3120
  return;
@@ -4937,13 +4933,13 @@ class RangeSelection {
4937
4933
  }
4938
4934
  }
4939
4935
 
4940
- const domSelection = getDOMSelection();
4936
+ const editor = getActiveEditor();
4937
+ const domSelection = getDOMSelection(editor._window);
4941
4938
 
4942
4939
  if (!domSelection) {
4943
4940
  return;
4944
4941
  }
4945
4942
 
4946
- const editor = getActiveEditor();
4947
4943
  const blockCursorElement = editor._blockCursorElement;
4948
4944
  const rootElement = editor._rootElement; // Remove the block cursor element if it exists. This will ensure selection
4949
4945
  // works as intended. If we leave it in the DOM all sorts of strange bugs
@@ -5457,7 +5453,7 @@ function DEPRECATED_$createGridSelection() {
5457
5453
  function internalCreateSelection(editor) {
5458
5454
  const currentEditorState = editor.getEditorState();
5459
5455
  const lastSelection = currentEditorState._selection;
5460
- const domSelection = getDOMSelection();
5456
+ const domSelection = getDOMSelection(editor._window);
5461
5457
 
5462
5458
  if ($isNodeSelection(lastSelection) || DEPRECATED_$isGridSelection(lastSelection)) {
5463
5459
  return lastSelection.clone();
@@ -6246,7 +6242,7 @@ function commitPendingUpdates(editor) {
6246
6242
  // Reconciliation has finished. Now update selection and trigger listeners.
6247
6243
  // ======
6248
6244
 
6249
- const domSelection = shouldSkipDOM ? null : getDOMSelection(); // Attempt to update the DOM selection, including focusing of the root element,
6245
+ const domSelection = shouldSkipDOM ? null : getDOMSelection(editor._window); // Attempt to update the DOM selection, including focusing of the root element,
6250
6246
  // and scroll into view if needed.
6251
6247
 
6252
6248
  if (editor._editable && // domSelection will be null in headless
@@ -8493,6 +8489,12 @@ function createTextInnerDOM(innerDOM, node, innerTag, format, text, config) {
8493
8489
  setTextThemeClassNames(innerTag, 0, format, innerDOM, textClassNames);
8494
8490
  }
8495
8491
  }
8492
+
8493
+ function wrapElementWith(element, tag) {
8494
+ const el = document.createElement(tag);
8495
+ el.appendChild(element);
8496
+ return el;
8497
+ }
8496
8498
  /** @noInheritDoc */
8497
8499
 
8498
8500
 
@@ -8676,43 +8678,47 @@ class TextNode extends LexicalNode {
8676
8678
 
8677
8679
  static importDOM() {
8678
8680
  return {
8679
- '#text': node => ({
8681
+ '#text': () => ({
8680
8682
  conversion: convertTextDOMNode,
8681
8683
  priority: 0
8682
8684
  }),
8683
- b: node => ({
8685
+ b: () => ({
8684
8686
  conversion: convertBringAttentionToElement,
8685
8687
  priority: 0
8686
8688
  }),
8687
- code: node => ({
8689
+ br: () => ({
8690
+ conversion: convertLineBreakToElement,
8691
+ priority: 0
8692
+ }),
8693
+ code: () => ({
8688
8694
  conversion: convertTextFormatElement,
8689
8695
  priority: 0
8690
8696
  }),
8691
- em: node => ({
8697
+ em: () => ({
8692
8698
  conversion: convertTextFormatElement,
8693
8699
  priority: 0
8694
8700
  }),
8695
- i: node => ({
8701
+ i: () => ({
8696
8702
  conversion: convertTextFormatElement,
8697
8703
  priority: 0
8698
8704
  }),
8699
- span: node => ({
8705
+ span: () => ({
8700
8706
  conversion: convertSpanElement,
8701
8707
  priority: 0
8702
8708
  }),
8703
- strong: node => ({
8709
+ strong: () => ({
8704
8710
  conversion: convertTextFormatElement,
8705
8711
  priority: 0
8706
8712
  }),
8707
- sub: node => ({
8713
+ sub: () => ({
8708
8714
  conversion: convertTextFormatElement,
8709
8715
  priority: 0
8710
8716
  }),
8711
- sup: node => ({
8717
+ sup: () => ({
8712
8718
  conversion: convertTextFormatElement,
8713
8719
  priority: 0
8714
8720
  }),
8715
- u: node => ({
8721
+ u: () => ({
8716
8722
  conversion: convertTextFormatElement,
8717
8723
  priority: 0
8718
8724
  })
@@ -8726,6 +8732,39 @@ class TextNode extends LexicalNode {
8726
8732
  node.setMode(serializedNode.mode);
8727
8733
  node.setStyle(serializedNode.style);
8728
8734
  return node;
8735
+ } // This improves Lexical's basic text output in copy+paste plus
8736
+ // for headless mode where people might use Lexical to generate
8737
+ // HTML content and not have the ability to use CSS classes.
8738
+
8739
+
8740
+ exportDOM(editor) {
8741
+ let {
8742
+ element
8743
+ } = super.exportDOM(editor); // This is the only way to properly add support for most clients,
8744
+ // even if it's semantically incorrect to have to resort to using
8745
+ // <b>, <u>, <s>, <i> elements.
8746
+
8747
+ if (element !== null) {
8748
+ if (this.hasFormat('bold')) {
8749
+ element = wrapElementWith(element, 'b');
8750
+ }
8751
+
8752
+ if (this.hasFormat('italic')) {
8753
+ element = wrapElementWith(element, 'i');
8754
+ }
8755
+
8756
+ if (this.hasFormat('strikethrough')) {
8757
+ element = wrapElementWith(element, 's');
8758
+ }
8759
+
8760
+ if (this.hasFormat('underline')) {
8761
+ element = wrapElementWith(element, 'u');
8762
+ }
8763
+ }
8764
+
8765
+ return {
8766
+ element
8767
+ };
8729
8768
  }
8730
8769
 
8731
8770
  exportJSON() {
@@ -9088,6 +9127,12 @@ function convertSpanElement(domNode) {
9088
9127
  };
9089
9128
  }
9090
9129
 
9130
+ function convertLineBreakToElement() {
9131
+ return {
9132
+ node: $createLineBreakNode()
9133
+ };
9134
+ }
9135
+
9091
9136
  function convertBringAttentionToElement(domNode) {
9092
9137
  // domNode is a <b> since we matched it by nodeName
9093
9138
  const b = domNode; // Google Docs wraps all copied HTML in a <b> with font-weight normal
@@ -9810,7 +9855,7 @@ class LexicalEditor {
9810
9855
  rootElement.blur();
9811
9856
  }
9812
9857
 
9813
- const domSelection = getDOMSelection();
9858
+ const domSelection = getDOMSelection(this._window);
9814
9859
 
9815
9860
  if (domSelection !== null) {
9816
9861
  domSelection.removeAllRanges();
package/Lexical.prod.js CHANGED
@@ -4,13 +4,13 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';let ba={},ca={},ea={},fa={},ha={},ia={},ja={},ka={},ma={},na={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function q(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
7
+ 'use strict';let ba={},ca={},ea={},fa={},ha={},ia={},ja={},ka={},ma={},na={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ba={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function q(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
8
  let Na="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Oa=Na&&"documentMode"in document?document.documentMode:null,t=Na&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pa=Na&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qa=Na&&"InputEvent"in window&&!Oa?"getTargetRanges"in new window.InputEvent("input"):!1,Ra=Na&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Sa=Na&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
9
  !window.MSStream,Ta=Na&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Wa=Ra||Sa?"\u00a0":"\u200b",Xa=Pa?"\u00a0":Wa,Ya=/^[^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]/,Za=/^[^\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]/,$a={bold:1,code:16,italic:2,strikethrough:4,subscript:32,
10
10
  superscript:64,underline:8},ab={directionless:1,unmergeable:2},bb={center:2,end:6,justify:4,left:1,right:3,start:5},cb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},db={normal:0,segmented:2,token:1},eb={0:"normal",2:"segmented",1:"token"},fb=!1,gb=0;function hb(a){gb=a.timeStamp}function ib(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function jb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
11
- function kb(a,b,c){fb=!0;let d=100<performance.now()-gb;try{v(a,()=>{let e=u()||jb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let l=!1,m="";for(var p=0;p<b.length;p++){var n=b[p],r=n.type,w=n.target,y=lb(w,h);if(!(null===y&&w!==g||z(y)))if("characterData"===r){if(n=d&&B(y))a:{n=e;r=w;var x=y;if(C(n)){var A=n.anchor.getNode();if(A.is(x)&&n.format!==A.getFormat()){n=!1;break a}}n=3===r.nodeType&&x.isAttached()}n&&(x=E(),r=n=null,null!==x&&x.anchorNode===w&&(n=x.anchorOffset,
12
- r=x.focusOffset),w=w.nodeValue,null!==w&&mb(y,w,n,r,!1))}else if("childList"===r){l=!0;r=n.addedNodes;for(x=0;x<r.length;x++){A=r[x];var U=nb(A),J=A.parentNode;null==J||A===k||null!==U||"BR"===A.nodeName&&ib(A,J,a)||(Pa&&(U=A.innerText||A.nodeValue)&&(m+=U),J.removeChild(A))}n=n.removedNodes;r=n.length;if(0<r){x=0;for(A=0;A<r;A++)if(J=n[A],"BR"===J.nodeName&&ib(J,w,a)||k===J)w.appendChild(J),x++;r!==x&&(w===g&&(y=h._nodeMap.get("root")),f.set(w,y))}}}if(0<f.size)for(let [da,N]of f)if(F(N))for(f=N.getChildrenKeys(),
13
- g=da.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(da.appendChild(k),g=k):g!==k&&da.replaceChild(k,g),g=g.nextSibling);else B(N)&&N.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)y=h[p],w=y.parentNode,null==w||"BR"!==y.nodeName||ib(y,k,a)||w.removeChild(y);c.takeRecords()}null!==e&&(l&&(e.dirty=!0,ob(e)),Pa&&pb(a)&&e.insertRawText(m))})}finally{fb=!1}}
11
+ function kb(a,b,c){fb=!0;let d=100<performance.now()-gb;try{v(a,()=>{let e=u()||jb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let l=!1,m="";for(var p=0;p<b.length;p++){var n=b[p],r=n.type,w=n.target,y=lb(w,h);if(!(null===y&&w!==g||z(y)))if("characterData"===r){if(n=d&&B(y))a:{n=e;r=w;var x=y;if(C(n)){var A=n.anchor.getNode();if(A.is(x)&&n.format!==A.getFormat()){n=!1;break a}}n=3===r.nodeType&&x.isAttached()}n&&(x=E(a._window),r=n=null,null!==x&&x.anchorNode===
12
+ w&&(n=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&mb(y,w,n,r,!1))}else if("childList"===r){l=!0;r=n.addedNodes;for(x=0;x<r.length;x++){A=r[x];var U=nb(A),J=A.parentNode;null==J||A===k||null!==U||"BR"===A.nodeName&&ib(A,J,a)||(Pa&&(U=A.innerText||A.nodeValue)&&(m+=U),J.removeChild(A))}n=n.removedNodes;r=n.length;if(0<r){x=0;for(A=0;A<r;A++)if(J=n[A],"BR"===J.nodeName&&ib(J,w,a)||k===J)w.appendChild(J),x++;r!==x&&(w===g&&(y=h._nodeMap.get("root")),f.set(w,y))}}}if(0<f.size)for(let [da,N]of f)if(F(N))for(f=
13
+ N.getChildrenKeys(),g=da.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(da.appendChild(k),g=k):g!==k&&da.replaceChild(k,g),g=g.nextSibling);else B(N)&&N.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)y=h[p],w=y.parentNode,null==w||"BR"!==y.nodeName||ib(y,k,a)||w.removeChild(y);c.takeRecords()}null!==e&&(l&&(e.dirty=!0,ob(e)),Pa&&pb(a)&&e.insertRawText(m))})}finally{fb=!1}}
14
14
  function qb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();kb(a,c,b)}}function rb(a){0===gb&&sb(a).addEventListener("textInput",hb,!0);a._observer=new MutationObserver((b,c)=>{kb(a,b,c)})}let ub=1,vb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function wb(a){var b=document.activeElement;b=null!==b?b.nodeName:null;return z(lb(a))&&("INPUT"===b||"TEXTAREA"===b)}
15
15
  function xb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!wb(b)&&yb(b)===a}catch(e){return!1}}function yb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=zb(a)}return null}function Ab(a){return a.isToken()||a.isSegmented()}function Bb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Cb(a,b,c){b=$a[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Db(a){return B(a)||Eb(a)||z(a)}
16
16
  function Fb(a,b){if(null!=b)a.__key=b;else{G();99<Gb&&q(14);b=H();var c=I(),d=""+ub++;c._nodeMap.set(d,a);F(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
@@ -19,7 +19,7 @@ a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=nul
19
19
  function K(a){G();var b=H();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function Jb(){return Kb()?null:H()._compositionKey}function L(a,b){a=(b||I())._nodeMap.get(a);return void 0===a?null:a}function nb(a,b){let c=H();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function lb(a,b){for(;null!=a;){let c=nb(a,b);if(null!==c)return c;a=zb(a)}return null}
20
20
  function Lb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Mb(a){return a.read(()=>Nb().getTextContent())}function Ob(a,b){v(a,()=>{var c=I();if(!c.isEmpty())if("root"===b)Nb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Nb(){return I()._nodeMap.get("root")}function ob(a){G();let b=I();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
21
21
  function Pb(a){var b=H(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=zb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Qb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Rb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Sb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
22
- function Tb(a,b){var c=E();if(null!==c){var d=c.anchorNode,{anchorOffset:e,focusOffset:f}=c;if(null!==d&&(c=3===d.nodeType?d.nodeValue:null,d=lb(d),null!==c&&B(d))){if(c===Wa&&b){let g=b.length;c=b;f=e=g}null!==c&&mb(d,c,e,f,a)}}}
22
+ function Tb(a,b,c){b=E(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=lb(d),null!==b&&B(d))){if(b===Wa&&c){let g=c.length;b=c;f=e=g}null!==b&&mb(d,b,e,f,a)}}}
23
23
  function mb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Wa&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Ra||Sa)f.remove();else{let h=H();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Ub(),f.isToken()||null!==Jb()&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
24
24
  (c=f.getTextContent(),c=M(c),f.replace(c),f=c)),f.setTextContent(a))}}function Vb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||F(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
25
25
  function Wb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Xb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&q(33),d=b.klass,b=a.get(d),void 0===b&&(b=new Map,a.set(d,b)),a=b.get(c),d="destroyed"===a&&"created"===e,(void 0===a||d)&&b.set(c,d?"updated":e))}function Yb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
@@ -27,41 +27,41 @@ function Zb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Yb(a,
27
27
  function ac(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function zb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}
28
28
  function bc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=sb(a).innerHeight}else{var l=b.getBoundingClientRect();h=l.top;k=l.bottom}l=0;f<h?l=-(h-f):g>k&&(l=g-k);0!==l&&(c?e.scrollBy(0,l):(h=b.scrollTop,b.scrollTop+=l,h=b.scrollTop-h,f-=h,g-=h));if(c)break;b=zb(b)}}}
29
29
  function cc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!F(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();dc(e,a)&&c.set(a.__key,0,"element");dc(f,a)&&d.set(a.__key,0,"element");return b}function dc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function sb(a){a=a._window;null===a&&q(78);return a}function ec(a){for(a=a.getParentOrThrow();null!==a&&!fc(a);)a=a.getParentOrThrow();return a}function fc(a){return O(a)||F(a)&&a.isShadowRoot()}
30
- function gc(a){var b=H();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function hc(a,b){a=a.getParent();if(O(a)&&!F(b)&&!z(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}function jc(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}function kc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}
31
- function E(){let a=P;return Na?(a&&a._window||window).getSelection():null}function lc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&lc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}
30
+ function gc(a){var b=H();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function hc(a,b){a=a.getParent();if(O(a)&&!F(b)&&!z(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}function ic(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}function kc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}
31
+ function E(a){return Na?(a||window).getSelection():null}function lc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&lc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}
32
32
  function mc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(F(c)&&lc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}function nc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}
33
33
  function oc(a,b){let c=a.mergeWithSibling(b),d=H()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function pc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{nc(b,a)&&(a=oc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{nc(a,c)&&oc(a,c);break}}}
34
- function qc(a){rc(a.anchor);rc(a.focus);return a}function rc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let Q="",R="",S="",sc,T,tc,uc=!1,vc=!1,wc,xc=null,yc,zc,Ac,Bc,Cc,Dc;
35
- function Ec(a,b){let c=Ac.get(a);if(null!==b){let d=Fc(a);d.parentNode===b&&b.removeChild(d)}Bc.has(a)||T._keyToDOMMap.delete(a);F(c)&&(a=Gc(c,Ac),Hc(a,0,a.length-1,null));void 0!==c&&Xb(Dc,tc,wc,c,"destroyed")}function Hc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Ec(e,d)}}function Ic(a,b){a.setProperty("text-align",b)}function Jc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
34
+ function qc(a){rc(a.anchor);rc(a.focus);return a}function rc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",sc,S,tc,uc=!1,vc=!1,wc,xc=null,yc,zc,Ac,Bc,Cc,Dc;
35
+ function Ec(a,b){let c=Ac.get(a);if(null!==b){let d=Fc(a);d.parentNode===b&&b.removeChild(d)}Bc.has(a)||S._keyToDOMMap.delete(a);F(c)&&(a=Gc(c,Ac),Hc(a,0,a.length-1,null));void 0!==c&&Xb(Dc,tc,wc,c,"destroyed")}function Hc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Ec(e,d)}}function Ic(a,b){a.setProperty("text-align",b)}function Jc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
36
36
  function Kc(a,b){a=a.style;0===b?Ic(a,""):1===b?Ic(a,"left"):2===b?Ic(a,"center"):3===b?Ic(a,"right"):4===b?Ic(a,"justify"):5===b?Ic(a,"start"):6===b&&Ic(a,"end")}
37
- function Lc(a,b,c){let d=Bc.get(a);void 0===d&&q(60);let e=d.createDOM(sc,T);var f=T._keyToDOMMap;e["__lexicalKey_"+T._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(F(d)){a=d.__indent;f=d.__size;0!==a&&Jc(e,a);if(0!==f){--f;a=Gc(d,Bc);var g=R;R="";Mc(a,0,f,e,null);Nc(d,e);R=g}a=d.__format;0!==a&&Kc(e,a);d.isInline()||Oc(null,d,e);$b(d)&&(Q+="\n\n",S+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(T,sc),null!==g&&Pc(a,
38
- g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(R+=f)),Q+=f,S+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Xb(Dc,tc,wc,d,"created");return e}function Mc(a,b,c,d,e){let f=Q;for(Q="";b<=c;++b)Lc(a[b],d,e);d.__lexicalTextContent=Q;Q=f+Q}function Qc(a,b){a=b.get(a);return Eb(a)||z(a)&&a.isInline()}
37
+ function Lc(a,b,c){let d=Bc.get(a);void 0===d&&q(60);let e=d.createDOM(sc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(F(d)){a=d.__indent;f=d.__size;0!==a&&Jc(e,a);if(0!==f){--f;a=Gc(d,Bc);var g=Q;Q="";Mc(a,0,f,e,null);Nc(d,e);Q=g}a=d.__format;0!==a&&Kc(e,a);d.isInline()||Oc(null,d,e);$b(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(S,sc),null!==g&&Pc(a,
38
+ g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Xb(Dc,tc,wc,d,"created");return e}function Mc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Lc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Qc(a,b){a=b.get(a);return Eb(a)||z(a)&&a.isInline()}
39
39
  function Oc(a,b,c){a=null!==a&&(0===a.__size||Qc(a.__last,Ac));b=0===b.__size||Qc(b.__last,Bc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
40
- function Nc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==R||c!==xc){let f=""===R;if(f)var d=xc;else d=R,d=Ya.test(d)?"rtl":Za.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=sc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);vc||(a.getWritable().__dir=d)}xc=
41
- d;b.__lexicalDirTextContent=R;b.__lexicalDir=d}}function Gc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);if(void 0===d)throw Error("createChildrenArray: node does not exist in nodeMap");c.push(a);a=d.__next}return c}
42
- function Rc(a,b){var c=Ac.get(a),d=Bc.get(a);void 0!==c&&void 0!==d||q(61);var e=uc||zc.has(a)||yc.has(a);let f=ac(T,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(Q+=d,S+=d),d=f.__lexicalDirTextContent,void 0!==d&&(R+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(R+=d),S+=d,Q+=d),f;c!==d&&e&&Xb(Dc,tc,wc,d,"updated");if(d.updateDOM(c,f,sc))return d=Lc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Ec(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&Jc(f,a);a=d.__format;
43
- a!==c.__format&&Kc(f,a);if(e){a=d;e=R;R="";b=Q;var g=c.__size,h=a.__size;Q="";if(1===g&&1===h){var k=c.__first,l=a.__first;if(k===l)Rc(k,f);else{var m=Fc(k);l=Lc(l,null,null);f.replaceChild(l,m);Ec(k,null)}}else{l=Gc(c,Ac);var p=Gc(a,Bc);if(0===g)0!==h&&Mc(p,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Hc(l,0,g-1,k?null:f),k&&(f.textContent=""));else{var n=l;l=p;p=g-1;g=h-1;let w=f.firstChild,y=0;for(h=0;y<=p&&h<=g;){var r=n[y];let x=l[h];if(r===x)w=Sc(Rc(x,f)),y++,h++;else{void 0===
44
- k&&(k=new Set(n));void 0===m&&(m=new Set(l));let A=m.has(r),U=k.has(x);A?(U?(r=ac(T,x),r===w?w=Sc(Rc(x,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Rc(x,f)),y++):Lc(x,f,w),h++):(w=Sc(Fc(r)),Ec(r,f),y++)}}k=y>p;m=h>g;k&&!m?(k=l[g+1],k=void 0===k?null:T.getElementByKey(k),Mc(l,h,g,f,k)):m&&!k&&Hc(n,y,p,f)}}$b(a)&&(Q+="\n\n");f.__lexicalTextContent=Q;Q=b+Q;Nc(a,f);R=e;O(d)||d.isInline()||Oc(c,d,f)}$b(d)&&(Q+="\n\n",S+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(T,sc),null!==e&&Pc(a,e)):
45
- B(d)&&!d.isDirectionless()&&(R+=c),Q+=c,S+=c;!vc&&O(d)&&d.__cachedText!==S&&(d=d.getWritable(),d.__cachedText=S);return f}function Pc(a,b){let c=T._pendingDecorators,d=T._decorators;if(null===c){if(d[a]===b)return;c=Lb(T)}c[a]=b}function Sc(a){a=a.nextSibling;null!==a&&a===T._blockCursorElement&&(a=a.nextSibling);return a}function Fc(a){a=Cc.get(a);void 0===a&&q(75);return a}
46
- let V=Object.freeze({}),Zc=[["keydown",Tc],["pointerdown",Uc],["compositionstart",Vc],["compositionend",Wc],["input",Xc],["click",Yc],["cut",V],["copy",V],["dragstart",V],["dragover",V],["dragend",V],["paste",V],["focus",V],["blur",V],["drop",V]];Qa&&Zc.push(["beforeinput",(a,b)=>$c(a,b)]);let ad=0,bd=0,cd=0,dd=0,ed=!1,fd=!1,gd=!1,hd=!1,id=[0,0,"root",0];
47
- function jd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=E();h=null!==h?h.anchorNode:null;let k=e.key,l=H().getElementByKey(k),m=b.length;return k!==f.key||!B(g)||(!d&&(!Qa||cd<c+50)||2>m||Qb(b))&&e.offset!==f.offset&&!g.isComposing()||Ab(g)||g.isDirty()&&1<m||(d||!Qa)&&null!==l&&!g.isComposing()&&h!==Bb(l)||g.getFormat()!==a.format||Vb(a,g)}function kd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
40
+ function Nc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==xc){let f=""===Q;if(f)var d=xc;else d=Q,d=Ya.test(d)?"rtl":Za.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=sc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);vc||(a.getWritable().__dir=d)}xc=
41
+ d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}function Gc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);if(void 0===d)throw Error("createChildrenArray: node does not exist in nodeMap");c.push(a);a=d.__next}return c}
42
+ function Rc(a,b){var c=Ac.get(a),d=Bc.get(a);void 0!==c&&void 0!==d||q(61);var e=uc||zc.has(a)||yc.has(a);let f=ac(S,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Xb(Dc,tc,wc,d,"updated");if(d.updateDOM(c,f,sc))return d=Lc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Ec(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&Jc(f,a);a=d.__format;
43
+ a!==c.__format&&Kc(f,a);if(e){a=d;e=Q;Q="";b=P;var g=c.__size,h=a.__size;P="";if(1===g&&1===h){var k=c.__first,l=a.__first;if(k===l)Rc(k,f);else{var m=Fc(k);l=Lc(l,null,null);f.replaceChild(l,m);Ec(k,null)}}else{l=Gc(c,Ac);var p=Gc(a,Bc);if(0===g)0!==h&&Mc(p,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Hc(l,0,g-1,k?null:f),k&&(f.textContent=""));else{var n=l;l=p;p=g-1;g=h-1;let w=f.firstChild,y=0;for(h=0;y<=p&&h<=g;){var r=n[y];let x=l[h];if(r===x)w=Sc(Rc(x,f)),y++,h++;else{void 0===
44
+ k&&(k=new Set(n));void 0===m&&(m=new Set(l));let A=m.has(r),U=k.has(x);A?(U?(r=ac(S,x),r===w?w=Sc(Rc(x,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Rc(x,f)),y++):Lc(x,f,w),h++):(w=Sc(Fc(r)),Ec(r,f),y++)}}k=y>p;m=h>g;k&&!m?(k=l[g+1],k=void 0===k?null:S.getElementByKey(k),Mc(l,h,g,f,k)):m&&!k&&Hc(n,y,p,f)}}$b(a)&&(P+="\n\n");f.__lexicalTextContent=P;P=b+P;Nc(a,f);Q=e;O(d)||d.isInline()||Oc(c,d,f)}$b(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(S,sc),null!==e&&Pc(a,e)):
45
+ B(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!vc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Pc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Lb(S)}c[a]=b}function Sc(a){a=a.nextSibling;null!==a&&a===S._blockCursorElement&&(a=a.nextSibling);return a}function Fc(a){a=Cc.get(a);void 0===a&&q(75);return a}
46
+ let T=Object.freeze({}),Zc=[["keydown",Tc],["pointerdown",Uc],["compositionstart",Vc],["compositionend",Wc],["input",Xc],["click",Yc],["cut",T],["copy",T],["dragstart",T],["dragover",T],["dragend",T],["paste",T],["focus",T],["blur",T],["drop",T]];Qa&&Zc.push(["beforeinput",(a,b)=>$c(a,b)]);let ad=0,bd=0,cd=0,dd=0,ed=!1,fd=!1,gd=!1,hd=!1,id=[0,0,"root",0];
47
+ function jd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=H(),k=E(h._window);k=null!==k?k.anchorNode:null;let l=e.key;h=h.getElementByKey(l);let m=b.length;return l!==f.key||!B(g)||(!d&&(!Qa||cd<c+50)||2>m||Qb(b))&&e.offset!==f.offset&&!g.isComposing()||Ab(g)||g.isDirty()&&1<m||(d||!Qa)&&null!==h&&!g.isComposing()&&k!==Bb(h)||g.getFormat()!==a.format||Vb(a,g)}function kd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
48
48
  function ld(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(ed&&(ed=!1,kd(d,e)&&kd(f,g)))return;v(b,()=>{if(!c)ob(null);else if(xb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,l=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var m=sb(b).event;m=m?m.timeStamp:performance.now();let [p,n,r,w]=id;m<w+200&&k.offset===n&&k.key===r?h.format=p:"text"===k.type?h.format=l.getFormat():"element"===k.type&&(h.format=0)}else{k=127;l=!1;m=h.getNodes();
49
- let p=m.length;for(let n=0;n<p;n++){let r=m[n];if(B(r)&&(l=!0,k&=r.getFormat(),0===k))break}h.format=l?k:0}}W(b,ba,void 0)}})}function Yc(a,b){v(b,()=>{let c=u(),d=E(),e=Ub();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Nb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}W(b,ca,a)})}
49
+ let p=m.length;for(let n=0;n<p;n++){let r=m[n];if(B(r)&&(l=!0,k&=r.getFormat(),0===k))break}h.format=l?k:0}}V(b,ba,void 0)}})}function Yc(a,b){v(b,()=>{let c=u(),d=E(b._window),e=Ub();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Nb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ca,a)})}
50
50
  function Uc(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{z(lb(c))||(fd=!0)})}function md(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function nd(a,b){return a!==b||F(a)||F(b)||!a.isToken()||!b.isToken()}
51
- function $c(a,b){let c=a.inputType;"deleteCompositionText"===c||Pa&&pb(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Ub();if(!C(e))return;ob(e.clone())}if(C(d)){229===bd&&a.timeStamp<ad+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),ad=0,setTimeout(()=>{v(b,()=>{K(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),W(b,ea,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
52
- md(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),W(b,fa,!1)):"\n\n"===e?(a.preventDefault(),W(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&jd(d,e,a.timeStamp,!0)&&(a.preventDefault(),W(b,ia,e)),cd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":W(b,ia,a);break;case "insertFromComposition":K(null);
53
- W(b,ia,a);break;case "insertLineBreak":K(null);W(b,fa,!1);break;case "insertParagraph":K(null);gd?(gd=!1,W(b,fa,!1)):W(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":W(b,ja,a);break;case "deleteByComposition":nd(g,f)&&W(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":W(b,ka,void 0);break;case "deleteContent":W(b,ea,!1);break;case "deleteWordBackward":W(b,ma,!0);break;case "deleteWordForward":W(b,ma,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":W(b,
54
- na,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":W(b,na,!1);break;case "formatStrikeThrough":W(b,oa,"strikethrough");break;case "formatBold":W(b,oa,"bold");break;case "formatItalic":W(b,oa,"italic");break;case "formatUnderline":W(b,oa,"underline");break;case "historyUndo":W(b,pa,void 0);break;case "historyRedo":W(b,qa,void 0)}}})}
55
- function Xc(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&jd(c,d,a.timeStamp,!1)){hd&&(od(b,d),hd=!1);var e=c.anchor,f=e.getNode(),g=E();if(null===g)return;let h=e.offset;if(e=Qa&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||W(b,ia,d);d=d.length;Pa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);Ra||Sa||!b.isComposing()||
56
- (ad=0,K(null))}else Tb(!1),hd&&(od(b,d||void 0),hd=!1);G();c=H();qb(c)})}function Vc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<ad+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&W(b,ia,Xa)}})}
57
- function od(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=Bb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&mb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);W(a,xa,null);return}}Tb(!0,b)}function Wc(a,b){Pa?hd=!0:v(b,()=>{od(b,a.data)})}
58
- function Tc(a,b){ad=a.timeStamp;bd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)gd=!0,W(b,xa,a);else if(32===c)W(b,ya,a);else if(t&&e&&79===c)a.preventDefault(),gd=!0,W(b,fa,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?W(b,za,a):(a.preventDefault(),W(b,ea,!0)):27===c?W(b,Aa,a):(h=t?d||g||f?
59
- !1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?W(b,Ca,a):(a.preventDefault(),W(b,ea,!1)):8===c&&(t?g:e)?(a.preventDefault(),W(b,ma,!0)):46===c&&(t?g:e)?(a.preventDefault(),W(b,ma,!1)):t&&f&&8===c?(a.preventDefault(),W(b,na,!0)):t&&f&&46===c?(a.preventDefault(),W(b,na,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),W(b,oa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),W(b,oa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),W(b,oa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
60
- W(b,pa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),W(b,qa,void 0)):pd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),W(b,Ia,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),W(b,Ja,a))))):W(b,Da,a))}else gd=!1,W(b,xa,a);else W(b,wa,a);else W(b,va,a);else W(b,ua,a);else W(b,ta,a);else W(b,sa,a);else W(b,ra,a);(e||d||g||f)&&W(b,Ma,a)}}function qd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let rd=new Map;
61
- function sd(){let a=E();if(null!==a){var b=yb(a.anchorNode);if(null!==b){fd&&(fd=!1,v(b,()=>{var g=Ub(),h=a.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=td(g,a,b),ob(g))}));var c=Rb(b);c=c[c.length-1];var d=c._key,e=rd.get(d),f=e||c;f!==b&&ld(a,f,!1);ld(a,b,!0);b!==c?rd.set(d,b):e&&rd.delete(d)}}}
62
- function ud(a,b){0===dd&&a.ownerDocument.addEventListener("selectionchange",sd);dd++;a.__lexicalEditor=b;let c=qd(a);for(let d=0;d<Zc.length;d++){let [e,f]=Zc[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return W(b,Ja,h);case "copy":return W(b,Ia,h);case "paste":return W(b,ja,h);case "dragstart":return W(b,Fa,h);case "dragover":return W(b,Ga,h);case "dragend":return W(b,
63
- Ha,h);case "focus":return W(b,Ka,h);case "blur":return W(b,La,h);case "drop":return W(b,Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function vd(a,b,c,d){id=[a,b,c,d]}
64
- class X{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
51
+ function $c(a,b){let c=a.inputType;"deleteCompositionText"===c||Pa&&pb(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Ub();if(!C(e))return;ob(e.clone())}if(C(d)){229===bd&&a.timeStamp<ad+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),ad=0,setTimeout(()=>{v(b,()=>{K(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,ea,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
52
+ md(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,fa,!1)):"\n\n"===e?(a.preventDefault(),V(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&jd(d,e,a.timeStamp,!0)&&(a.preventDefault(),V(b,ia,e)),cd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ia,a);break;case "insertFromComposition":K(null);
53
+ V(b,ia,a);break;case "insertLineBreak":K(null);V(b,fa,!1);break;case "insertParagraph":K(null);gd?(gd=!1,V(b,fa,!1)):V(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ja,a);break;case "deleteByComposition":nd(g,f)&&V(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ka,void 0);break;case "deleteContent":V(b,ea,!1);break;case "deleteWordBackward":V(b,ma,!0);break;case "deleteWordForward":V(b,ma,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
54
+ na,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,na,!1);break;case "formatStrikeThrough":V(b,oa,"strikethrough");break;case "formatBold":V(b,oa,"bold");break;case "formatItalic":V(b,oa,"italic");break;case "formatUnderline":V(b,oa,"underline");break;case "historyUndo":V(b,pa,void 0);break;case "historyRedo":V(b,qa,void 0)}}})}
55
+ function Xc(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&jd(c,d,a.timeStamp,!1)){hd&&(od(b,d),hd=!1);var e=c.anchor,f=e.getNode(),g=E(b._window);if(null===g)return;let h=e.offset;if(e=Qa&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||V(b,ia,d);d=d.length;Pa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);
56
+ Ra||Sa||!b.isComposing()||(ad=0,K(null))}else Tb(!1,b),hd&&(od(b,d||void 0),hd=!1);G();c=H();qb(c)})}function Vc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<ad+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ia,Xa)}})}
57
+ function od(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=Bb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&mb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,xa,null);return}}Tb(!0,a,b)}function Wc(a,b){Pa?hd=!0:v(b,()=>{od(b,a.data)})}
58
+ function Tc(a,b){ad=a.timeStamp;bd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)gd=!0,V(b,xa,a);else if(32===c)V(b,ya,a);else if(t&&e&&79===c)a.preventDefault(),gd=!0,V(b,fa,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,za,a):(a.preventDefault(),V(b,ea,!0)):27===c?V(b,Aa,a):(h=t?d||g||f?
59
+ !1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Ba,a):(a.preventDefault(),V(b,ea,!1)):8===c&&(t?g:e)?(a.preventDefault(),V(b,ma,!0)):46===c&&(t?g:e)?(a.preventDefault(),V(b,ma,!1)):t&&f&&8===c?(a.preventDefault(),V(b,na,!0)):t&&f&&46===c?(a.preventDefault(),V(b,na,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,oa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,oa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,oa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
60
+ V(b,pa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,qa,void 0)):pd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),V(b,Ia,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),V(b,Ja,a))))):V(b,Da,a))}else gd=!1,V(b,xa,a);else V(b,wa,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);else V(b,ra,a);(e||d||g||f)&&V(b,Ma,a)}}function qd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let rd=new Map;
61
+ function sd(a){a=a.target;let b=E(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=yb(b.anchorNode);if(null!==c){fd&&(fd=!1,v(c,()=>{var g=Ub(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=td(g,b,c),ob(g))}));a=Rb(c);a=a[a.length-1];var d=a._key,e=rd.get(d),f=e||a;f!==c&&ld(b,f,!1);ld(b,c,!0);c!==a?rd.set(d,c):e&&rd.delete(d)}}}
62
+ function ud(a,b){0===dd&&a.ownerDocument.addEventListener("selectionchange",sd);dd++;a.__lexicalEditor=b;let c=qd(a);for(let d=0;d<Zc.length;d++){let [e,f]=Zc[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return V(b,Ja,h);case "copy":return V(b,Ia,h);case "paste":return V(b,ja,h);case "dragstart":return V(b,Fa,h);case "dragover":return V(b,Ga,h);case "dragend":return V(b,
63
+ Ha,h);case "focus":return V(b,Ka,h);case "blur":return V(b,La,h);case "drop":return V(b,Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function vd(a,b,c,d){id=[a,b,c,d]}
64
+ class W{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
65
65
  Kb()||(Jb()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function wd(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!F(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function xd(a,b){if(F(b)){let c=b.getLastDescendant();F(c)||B(c)?wd(a,c):wd(a,b)}else wd(a,b)}
66
66
  function yd(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=M(),g=O(d)?zd().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function Ad(a,b,c,d){a.key=b;a.offset=c;a.type=d}
67
67
  class Bd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!pd(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Bd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
@@ -74,7 +74,7 @@ return b}}function Ed(a){return a instanceof Dd}
74
74
  class Cd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();F(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
75
75
  b?b:a);F(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?F(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);Kb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Ad(this.anchor,a.__key,b,"text");Ad(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=Fd(this),g="",h=!0;for(let k=0;k<a.length;k++){let l=a[k];if(F(l)&&!l.isInline())h||
76
76
  (g+="\n"),h=l.isEmpty()?!1:!0;else if(h=!1,B(l)){let m=l.getTextContent();l===b?m=l===c?e<f?m.slice(e,f):m.slice(f,e):d?m.slice(e):m.slice(f):l===c&&(m=d?m.slice(0,f):m.slice(0,e));g+=m}else!z(l)&&!Eb(l)||l===c&&this.isCollapsed()||(g+=l.getTextContent())}return g}applyDOMRange(a){let b=H(),c=b.getEditorState()._selection;a=Jd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Ad(this.anchor,d.key,d.offset,d.type);Ad(this.focus,e.key,e.offset,e.type);this._cachedNodes=
77
- null}}clone(){let a=this.anchor,b=this.focus;return new Cd(new X(a.key,a.offset,a.type),new X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Cb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&$a[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Kd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
77
+ null}}clone(){let a=this.anchor,b=this.focus;return new Cd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Cb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&$a[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Kd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
78
78
  b.isBefore(c),e=this.format;d&&"element"===b.type?yd(b,c,e):d||"element"!==c.type||yd(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];B(b)||q(26);d=b.getTextContent().length;var l=b.getParentOrThrow(),m=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!l.canInsertTextAfter()&&null===b.getNextSibling())){var p=b.getNextSibling();if(!B(p)||Ab(p))p=M(),p.setFormat(e),l.canInsertTextAfter()?b.insertAfter(p):l.insertAfter(p);
79
79
  p.select(0,0);b=p;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!l.canInsertTextBefore()&&null===b.getPreviousSibling())){p=b.getPreviousSibling();if(!B(p)||Ab(p))p=M(),p.setFormat(e),l.canInsertTextBefore()?b.insertBefore(p):l.insertBefore(p);p.select();b=p;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)l=M(b.getTextContent()),l.setFormat(e),b.replace(l),b=l;else if(!(this.isCollapsed()||""===
80
80
  a||(p=m.getParent(),l.canInsertTextBefore()&&l.canInsertTextAfter()&&(!F(p)||p.canInsertTextBefore()&&p.canInsertTextAfter())))){this.insertText("");Ld(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=M(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=M(a);f.setFormat(e);f.select();0===c?b.insertBefore(f,!1):([g]=b.splitText(c),g.insertAfter(f,!1));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
@@ -92,19 +92,19 @@ a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isC
92
92
  c?c.insertBefore(e,!1):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this,!1),F(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(F(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==
93
93
  d)for(c=0;c<d;c++)b=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=Kd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Fd(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Fd(this);if(0===b)return[];
94
94
  if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=Zb(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Nd(),b.add(g.__key),ob(b)):(a=b?g.getPreviousSibling():
95
- g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),F(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(d=E()){e=H();var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||kc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=
96
- O(e)?e:ec(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],dc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],F(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],F(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Ad(f,b.key,b.offset,b.type),Ad(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
95
+ g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),F(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=H(),d=E(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||kc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),
96
+ e=O(e)?e:ec(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],dc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],F(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],F(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Ad(f,b.key,b.offset,b.type),Ad(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
97
97
  this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&F(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(F(e)&&!e.canExtractContents())return}e=Zb(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&F(d)&&0===d.getChildrenSize()?(d.remove(),a=Nd(),a.add(e.__key),ob(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?
98
98
  c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Od(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Od(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Qb(b)||(a?e.offset=
99
99
  f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function pd(a){return a instanceof Bd}
100
100
  function Pd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Fd(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[Pd(b),Pd(a)]}
101
101
  function Od(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],l=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||l){d.splice(h,1);l&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
102
102
  function Qd(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=Pb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Pb(a);if(null===f)return null;if(F(f)){a=f.getChildAtIndex(e);if(b=F(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=F(a)?a:a.getParentOrThrow()));
103
- B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&Pb(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new X(f.__key,e,"element")}}else d=Pb(a);return B(d)?new X(d.__key,e,"text"):null}
103
+ B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&Pb(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new W(f.__key,e,"element")}}else d=Pb(a);return B(d)?new W(d.__key,e,"text"):null}
104
104
  function Rd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&F(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):F(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&F(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
105
105
  b)&&null===d&&F(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Ld(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Rd(a,d,e);Rd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=H();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Ad(a,d.key,d.offset,d.type),Ad(b,c.key,c.offset,c.type))}}
106
- function Jd(a,b,c,d,e,f){if(null===a||null===c||!xb(e,a,c))return null;b=Qd(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Qd(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Pb(a),c=Pb(c),z(a)&&z(c)))return null;Ld(b,d,f);return[b,d]}function Md(a){return F(a)&&!a.isInline()}function Sd(a,b,c,d,e,f){let g=I();a=new Cd(new X(a,b,e),new X(c,d,f),0);a.dirty=!0;return g._selection=a}function Nd(){return new Bd(new Set)}
107
- function Td(a){let b=a.getEditorState()._selection,c=E();return pd(b)||Ed(b)?b.clone():td(b,c,a)}
106
+ function Jd(a,b,c,d,e,f){if(null===a||null===c||!xb(e,a,c))return null;b=Qd(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Qd(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Pb(a),c=Pb(c),z(a)&&z(c)))return null;Ld(b,d,f);return[b,d]}function Md(a){return F(a)&&!a.isInline()}function Sd(a,b,c,d,e,f){let g=I();a=new Cd(new W(a,b,e),new W(c,d,f),0);a.dirty=!0;return g._selection=a}function Nd(){return new Bd(new Set)}
107
+ function Td(a){let b=a.getEditorState()._selection,c=E(a._window);return pd(b)||Ed(b)?b.clone():td(b,c,a)}
108
108
  function td(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!fb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!xb(c,e,f))return a.clone()}else return a.clone();c=Jd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Cd(h,k,C(a)?a.format:0)}
109
109
  function u(){return I()._selection}function Ub(){return H()._editorState._selection}
110
110
  function Ud(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Vd(a));else{var k=a.isBackward();h=k?f:e;var l=h.getNode();e=k?e:f;f=e.getNode();b.is(l)&&(l=h.offset,c<=l&&h.set(g,Math.max(0,l+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Vd(a)}}
@@ -113,20 +113,20 @@ function Vd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNod
113
113
  function Xd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):F(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":F(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Yd(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
114
114
  function Zd(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,l=d.anchorOffset,m=d.focusOffset,p=document.activeElement;if(!(e.has("collaboration")&&p!==f||null!==p&&wb(p)))if(C(b)){var n=b.anchor,r=b.focus,w=n.key,y=r.key,x=ac(c,w);y=ac(c,y);var A=n.offset,U=r.offset,J=b.format,da=b.isCollapsed(),N=x,D=y,aa=!1;"text"===n.type&&(N=Bb(x),aa=n.getNode().getFormat()!==J);"text"===r.type&&(D=Bb(y));if(null!==N&&null!==D){da&&(null===a||aa||C(a)&&a.format!==J)&&vd(J,A,w,performance.now());if(l===A&&m===
115
115
  U&&h===N&&k===D&&("Range"!==d.type||!da)&&(null!==p&&f.contains(p)||f.focus({preventScroll:!0}),"element"!==n.type))return;if(!e.has("skip-scroll-into-view"))try{Ta&&1E3<g?window.requestAnimationFrame(()=>d.setBaseAndExtent(N,A,D,U)):d.setBaseAndExtent(N,A,D,U)}catch(Ua){}!e.has("skip-scroll-into-view")&&b.isCollapsed()&&null!==f&&f===document.activeElement&&(a=b instanceof Cd&&"element"===b.anchor.type?N.childNodes[A]||null:0<d.rangeCount?d.getRangeAt(0):null,null!==a&&(a=a.getBoundingClientRect(),
116
- bc(c,a,f)));ed=!0}}else null!==a&&xb(c,h,k)&&d.removeAllRanges()}let Y=null,P=null,Z=!1,$d=!1,Gb=0,ae={characterData:!0,childList:!0,subtree:!0};function Kb(){return Z||null!==Y&&Y._readOnly}function G(){Z&&q(13)}function I(){null===Y&&q(15);return Y}function H(){null===P&&q(16);return P}function be(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}
116
+ bc(c,a,f)));ed=!0}}else null!==a&&xb(c,h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,$d=!1,Gb=0,ae={characterData:!0,childList:!0,subtree:!0};function Kb(){return Z||null!==X&&X._readOnly}function G(){Z&&q(13)}function I(){null===X&&q(15);return X}function H(){null===Y&&q(16);return Y}function be(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}
117
117
  function ce(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&pc(b)}
118
118
  function de(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Jb(),f=new Map;var g=c;let h=g.size;for(var k=d,l=k.size;0<h||0<l;){if(0<h){b._dirtyLeaves=new Set;for(let m of g)g=a.get(m),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&pc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&be(b,g,f),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Gb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let m of k)if(k=m[0],l=m[1],"root"===k||l)g=a.get(k),void 0!==
119
- g&&void 0!==g&&g.__key!==e&&g.isAttached()&&be(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;Gb++}b._dirtyLeaves=c;b._dirtyElements=d}function ee(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(F(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=ee(a[d],b);c.append(e)}return c}function fe(a,b){let c=Y,d=Z,e=P;Y=a;Z=!0;P=null;try{return b()}finally{Y=c,Z=d,P=e}}
120
- function ge(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=Y,l=Z,m=P,p=a._updating,n=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==n){P=a;Y=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();R=S=Q="";uc=2===w;xc=null;T=a;sc=a._config;tc=a._nodes;wc=T._listeners.mutation;yc=y;zc=x;Ac=e._nodeMap;Bc=b._nodeMap;vc=
121
- b._readOnly;Cc=new Map(a._keyToDOMMap);var A=new Map;Dc=A;Rc("root",null);Dc=Cc=sc=Bc=Ac=zc=yc=tc=T=void 0;r=A}catch(D){D instanceof Error&&a._onError(D);if($d)throw D;he(a,null,c,b);rb(a);a._dirtyType=2;$d=!0;ge(a);$d=!1;return}finally{n.observe(c,ae),a._updating=p,Y=k,Z=l,P=m}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;x=a._updateTags;l=a._deferred;y=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
122
- a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,J=a._pendingDecorators||U,da=b._nodeMap,N;for(N in J)da.has(N)||(J===U&&(J=Lb(a)),delete J[N]);d=d?null:E();if(a._editable&&null!==d&&(h||null===g||g.dirty)){P=a;Y=b;try{null!==n&&n.disconnect();if(h||null===g||g.dirty){let D=a._blockCursorElement;null!==D&&kc(D,a,c);Zd(f,g,a,d,x,c,y)}a:{let D=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let aa=g.anchor,Ua=aa.getNode(),
123
- ic=aa.offset,Fe=Ua.getChildrenSize();f=!1;g=null;if(ic===Fe){let la=Ua.getChildAtIndex(ic-1);jc(la)&&(f=!0)}else{let la=Ua.getChildAtIndex(ic);if(jc(la)){let Va=la.getPreviousSibling();if(null===Va||jc(Va))f=!0,g=a.getElementByKey(la.__key)}}if(f){let la=a.getElementByKey(Ua.__key);if(null===D){let Va=a._config.theme,tb=document.createElement("div");tb.contentEditable="false";tb.setAttribute("data-lexical-cursor","true");let Ba=Va.blockCursor;if(void 0!==Ba){if("string"===typeof Ba){let Ge=Ba.split(" ");
124
- Ba=Va.blockCursor=Ge}void 0!==Ba&&tb.classList.add(...Ba)}a._blockCursorElement=D=tb}c.style.caretColor="transparent";null===g?la.appendChild(D):la.insertBefore(D,g);break a}}null!==D&&kc(D,a,c)}null!==n&&n.observe(c,ae)}finally{P=m,Y=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),m=k.length,n=0;n<m;n++){let [D,aa]=k[n];r=c.get(aa);void 0!==r&&D(r,{dirtyLeaves:p,updateTags:x})}c=a._pendingDecorators;null!==c&&(a._decorators=c,a._pendingDecorators=null,ie("decorator",a,!0,c));c=Mb(e);k=
125
- Mb(b);c!==k&&ie("textcontent",a,!0,k);ie("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:x});a._deferred=[];if(0!==l.length){b=a._updating;a._updating=!0;try{for(e=0;e<l.length;e++)l[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [D,aa]=b;je(a,D,aa)}}}function ie(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
126
- function W(a,b,c){if(!1===a._updating||P!==a){let f=!1;a.update(()=>{f=W(a,b,c)});return f}let d=Rb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
119
+ g&&void 0!==g&&g.__key!==e&&g.isAttached()&&be(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;Gb++}b._dirtyLeaves=c;b._dirtyElements=d}function ee(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(F(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=ee(a[d],b);c.append(e)}return c}function fe(a,b){let c=X,d=Z,e=Y;X=a;Z=!0;Y=null;try{return b()}finally{X=c,Z=d,Y=e}}
120
+ function ge(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=X,l=Z,m=Y,p=a._updating,n=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==n){Y=a;X=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();Q=R=P="";uc=2===w;xc=null;S=a;sc=a._config;tc=a._nodes;wc=S._listeners.mutation;yc=y;zc=x;Ac=e._nodeMap;Bc=b._nodeMap;vc=
121
+ b._readOnly;Cc=new Map(a._keyToDOMMap);var A=new Map;Dc=A;Rc("root",null);Dc=Cc=sc=Bc=Ac=zc=yc=tc=S=void 0;r=A}catch(D){D instanceof Error&&a._onError(D);if($d)throw D;he(a,null,c,b);rb(a);a._dirtyType=2;$d=!0;ge(a);$d=!1;return}finally{n.observe(c,ae),a._updating=p,X=k,Z=l,Y=m}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;x=a._updateTags;l=a._deferred;y=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
122
+ a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,J=a._pendingDecorators||U,da=b._nodeMap,N;for(N in J)da.has(N)||(J===U&&(J=Lb(a)),delete J[N]);d=d?null:E(a._window);if(a._editable&&null!==d&&(h||null===g||g.dirty)){Y=a;X=b;try{null!==n&&n.disconnect();if(h||null===g||g.dirty){let D=a._blockCursorElement;null!==D&&kc(D,a,c);Zd(f,g,a,d,x,c,y)}a:{let D=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let aa=g.anchor,
123
+ Ua=aa.getNode(),jc=aa.offset,Ge=Ua.getChildrenSize();f=!1;g=null;if(jc===Ge){let la=Ua.getChildAtIndex(jc-1);ic(la)&&(f=!0)}else{let la=Ua.getChildAtIndex(jc);if(ic(la)){let Va=la.getPreviousSibling();if(null===Va||ic(Va))f=!0,g=a.getElementByKey(la.__key)}}if(f){let la=a.getElementByKey(Ua.__key);if(null===D){let Va=a._config.theme,tb=document.createElement("div");tb.contentEditable="false";tb.setAttribute("data-lexical-cursor","true");let Ca=Va.blockCursor;if(void 0!==Ca){if("string"===typeof Ca){let He=
124
+ Ca.split(" ");Ca=Va.blockCursor=He}void 0!==Ca&&tb.classList.add(...Ca)}a._blockCursorElement=D=tb}c.style.caretColor="transparent";null===g?la.appendChild(D):la.insertBefore(D,g);break a}}null!==D&&kc(D,a,c)}null!==n&&n.observe(c,ae)}finally{Y=m,X=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),m=k.length,n=0;n<m;n++){let [D,aa]=k[n];r=c.get(aa);void 0!==r&&D(r,{dirtyLeaves:p,updateTags:x})}c=a._pendingDecorators;null!==c&&(a._decorators=c,a._pendingDecorators=null,ie("decorator",a,!0,
125
+ c));c=Mb(e);k=Mb(b);c!==k&&ie("textcontent",a,!0,k);ie("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:x});a._deferred=[];if(0!==l.length){b=a._updating;a._updating=!0;try{for(e=0;e<l.length;e++)l[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [D,aa]=b;je(a,D,aa)}}}
126
+ function ie(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}function V(a,b,c){if(!1===a._updating||Y!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=Rb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
127
127
  function ke(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
128
- function je(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new le(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=Y;let k=Z,l=P,m=a._updating;Y=c;Z=!1;a._updating=!0;P=a;try{g&&(a._headless?null!=h._selection&&(c._selection=h._selection.clone()):c._selection=Td(a));let p=a._compositionKey;
129
- b();e=ke(a,e);Wd(c,a);0!==a._dirtyType&&(e?ce(c,a):de(c,a),ke(a),mc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let n=c._selection;if(C(n)){let r=c._nodeMap,w=n.focus.key;void 0!==r.get(n.anchor.key)&&void 0!==r.get(w)||q(19)}else pd(n)&&0===n._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();ge(a);return}finally{Y=f,Z=k,P=l,
128
+ function je(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new le(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=X;let k=Z,l=Y,m=a._updating;X=c;Z=!1;a._updating=!0;Y=a;try{g&&(a._headless?null!=h._selection&&(c._selection=h._selection.clone()):c._selection=Td(a));let p=a._compositionKey;
129
+ b();e=ke(a,e);Wd(c,a);0!==a._dirtyType&&(e?ce(c,a):de(c,a),ke(a),mc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let n=c._selection;if(C(n)){let r=c._nodeMap,w=n.focus.key;void 0!==r.get(n.anchor.key)&&void 0!==r.get(w)||q(19)}else pd(n)&&0===n._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();ge(a);return}finally{X=f,Z=k,Y=l,
130
130
  a._updating=m,Gb=0}b=null!==a._window?window.event:null;b=null!=b?b.type:null;0!==a._dirtyType||me(c,a)||null!==a._blockCursorElement&&"blur"===b?c._flushSync?(c._flushSync=!1,ge(a)):g&&vb(()=>{ge(a)}):(c._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):je(a,b,c)}
131
131
  function ne(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=cc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&(Xd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Xd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Hb(a),Ud(f,e,d,-1)):Hb(a);c||fc(e)||e.canBeEmpty()||!e.isEmpty()||ne(e,b);b&&O(e)&&e.isEmpty()&&e.selectEnd()}}
132
132
  class oe{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Fb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
@@ -158,41 +158,42 @@ class le{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly
158
158
  class ve extends oe{static getType(){return"linebreak"}static clone(a){return new ve(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:we,priority:0}}}}static importJSON(){return Kd()}exportJSON(){return{type:"linebreak",version:1}}}function we(){return{node:Kd()}}function Kd(){return gc(new ve)}
159
159
  function Eb(a){return a instanceof ve}function xe(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ye(a,b){return b&1?"strong":b&2?"em":"span"}
160
160
  function ze(a,b,c,d,e){a=d.classList;d=Wb(e,"base");void 0!==d&&a.add(...d);d=Wb(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in $a)h=$a[k],d=Wb(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
161
- function Ae(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Wa:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Pa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,l]=a;0!==k&&d.deleteData(h,k);d.insertData(h,l)}else d.nodeValue=a}
162
- class Be extends oe{static getType(){return"text"}static clone(a){return new Be(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return eb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Jb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
161
+ function Ae(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Wa:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Pa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,l]=a;0!==k&&d.deleteData(h,k);d.insertData(h,l)}else d.nodeValue=a}function Be(a,b){b=document.createElement(b);b.appendChild(a);return b}
162
+ class Ce extends oe{static getType(){return"text"}static clone(a){return new Ce(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return eb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Jb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
163
163
  (this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=$a[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Cb(c,a,b)}createDOM(a){var b=this.__format,c=xe(this,b);let d=ye(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Ae(this.__text,c,this);
164
164
  a=a.theme.text;void 0!==a&&ze(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=xe(this,e);let h=xe(this,f);var k=ye(this,e);let l=ye(this,f);if((null===g?k:g)!==(null===h?l:h))return!0;if(g===h&&k!==l)return e=b.firstChild,null==e&&q(48),a=g=document.createElement(l),Ae(d,a,this),c=c.theme.text,void 0!==c&&ze(l,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&q(49));Ae(d,k,this);c=c.theme.text;
165
- void 0!==c&&e!==f&&ze(l,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Ce,priority:0}),b:()=>({conversion:De,priority:0}),code:()=>({conversion:Ee,priority:0}),em:()=>({conversion:Ee,priority:0}),i:()=>({conversion:Ee,priority:0}),span:()=>({conversion:He,priority:0}),strong:()=>({conversion:Ee,priority:0}),sub:()=>({conversion:Ee,priority:0}),sup:()=>({conversion:Ee,priority:0}),u:()=>({conversion:Ee,priority:0})}}static importJSON(a){let b=
166
- M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?$a[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?ab[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=
167
- a;return b}toggleFormat(a){a=$a[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=db[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,
168
- void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=Jb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Sd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),
169
- d=b.__key,e=Jb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var l=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=M(l),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=l);b=u();h=[h];l=l.length;for(let w=1;w<f;w++){var n=a[w],r=n.length;n=M(n).getWritable();n.__format=k;n.__style=m;n.__detail=p;let y=
170
- n.__key;r=l+r;if(C(b)){let x=b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>l&&x.offset<=r&&(x.key=y,x.offset-=l,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>l&&A.offset<=r&&(A.key=y,A.offset-=l,b.dirty=!0)}e===d&&K(y);l=r;h.push(n)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&Ib(d);null!==e&&Ib(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Ud(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();
171
- b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Jb()===d&&K(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Yd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Yd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
172
- function He(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
173
- function De(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ce(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:M(a)}}let Ie={code:"code",em:"italic",i:"italic",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
174
- function Ee(a){let b=Ie[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return gc(new Be(a))}function B(a){return a instanceof Be}
175
- class Je extends qe{static getType(){return"paragraph"}static clone(a){return new Je(a.__key)}createDOM(a){let b=document.createElement("p");a=Wb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ke,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
165
+ void 0!==c&&e!==f&&ze(l,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:De,priority:0}),b:()=>({conversion:Ee,priority:0}),br:()=>({conversion:Fe,priority:0}),code:()=>({conversion:Ie,priority:0}),em:()=>({conversion:Ie,priority:0}),i:()=>({conversion:Ie,priority:0}),span:()=>({conversion:Je,priority:0}),strong:()=>({conversion:Ie,priority:0}),sub:()=>({conversion:Ie,priority:0}),sup:()=>({conversion:Ie,priority:0}),u:()=>({conversion:Ie,
166
+ priority:0})}}static importJSON(a){let b=M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&(this.hasFormat("bold")&&(a=Be(a,"b")),this.hasFormat("italic")&&(a=Be(a,"i")),this.hasFormat("strikethrough")&&(a=Be(a,"s")),this.hasFormat("underline")&&(a=Be(a,"u")));return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),
167
+ type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?$a[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?ab[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=$a[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=db[a];if(this.__mode===
168
+ a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=Jb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Sd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,
169
+ h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Jb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var l=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),
170
+ p=b.__detail;g=!1;b.isSegmented()?(h=M(l),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=l);b=u();h=[h];l=l.length;for(let w=1;w<f;w++){var n=a[w],r=n.length;n=M(n).getWritable();n.__format=k;n.__style=m;n.__detail=p;let y=n.__key;r=l+r;if(C(b)){let x=b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>l&&x.offset<=r&&(x.key=y,x.offset-=l,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>l&&A.offset<=r&&(A.key=y,A.offset-=l,b.dirty=!0)}e===d&&K(y);l=r;h.push(n)}d=this.getPreviousSibling();
171
+ e=this.getNextSibling();null!==d&&Ib(d);null!==e&&Ib(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Ud(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Jb()===d&&K(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Yd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Yd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?
172
+ c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
173
+ function Je(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}function Fe(){return{node:Kd()}}
174
+ function Ee(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function De(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:M(a)}}let Ke={code:"code",em:"italic",i:"italic",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
175
+ function Ie(a){let b=Ke[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return gc(new Ce(a))}function B(a){return a instanceof Ce}
176
+ class Le extends qe{static getType(){return"paragraph"}static clone(a){return new Le(a.__key)}createDOM(a){let b=document.createElement("p");a=Wb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Me,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
176
177
  0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=zd();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=zd();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
177
- this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ke(){return{node:zd()}}function zd(){return gc(new Je)}
178
+ this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Me(){return{node:zd()}}function zd(){return gc(new Le)}
178
179
  function he(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=te();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
179
- function Le(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
180
- class Me{constructor(a,b,c,d,e,f){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
180
+ function Ne(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
181
+ class Oe{constructor(a,b,c,d,e,f){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
181
182
  new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Sb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
182
183
  this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&q(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&q(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>
183
- 0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&q(37);let d=c.transforms;d.add(b);Ob(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return W(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
184
+ 0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&q(37);let d=c.transforms;d.add(b);Ob(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
184
185
  this._rootElement;if(a!==b){let e=Wb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;he(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==dd&&(dd--,0===dd&&b.ownerDocument.removeEventListener("selectionchange",sd));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Rb(c);d=d[d.length-1]._key;rd.get(d)===c&&rd.delete(d)}else rd.delete(c._key);b.__lexicalEditor=null}c=qd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
185
186
  []}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,rb(this),this._updateTags.add("history-merge"),ge(this),this._config.disableEvents||ud(a,this),null!=e&&a.classList.add(...e)):this._window=null;ie("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
186
- b){a.isEmpty()&&q(38);qb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),ge(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);ge(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=te(),d=Y,e=Z,f=P,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
187
- new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;Z=!1;P=this;try{ee(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,Y=d,Z=e,P=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Nb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
188
- a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=E();null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,ie("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Ne extends qe{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
189
- function Id(a){return a instanceof Ne}class Oe extends qe{}function Gd(a){return a instanceof Oe}class Pe extends qe{}function Hd(a){return a instanceof Pe}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=gc;exports.$copyNode=function(a){a=a.constructor.clone(a);Fb(a,null);return a};exports.$createLineBreakNode=Kd;exports.$createNodeSelection=Nd;exports.$createParagraphNode=zd;
190
- exports.$createRangeSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new Cd(a,b,0)};exports.$createTextNode=M;exports.$getAdjacentNode=Zb;exports.$getNearestNodeFromDOMNode=lb;exports.$getNearestRootOrShadowRoot=ec;exports.$getNodeByKey=L;exports.$getPreviousSelection=Ub;exports.$getRoot=Nb;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=dc;
191
- exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Nb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Db;exports.$isLineBreakNode=Eb;exports.$isNodeSelection=pd;exports.$isParagraphNode=function(a){return a instanceof Je};exports.$isRangeSelection=C;exports.$isRootNode=O;exports.$isRootOrShadowRoot=fc;exports.$isTextNode=B;
187
+ b){a.isEmpty()&&q(38);qb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),ge(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);ge(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=te(),d=X,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
188
+ new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{ee(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,X=d,Z=e,Y=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Nb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
189
+ a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=E(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,ie("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Pe extends qe{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
190
+ function Id(a){return a instanceof Pe}class Qe extends qe{}function Gd(a){return a instanceof Qe}class Re extends qe{}function Hd(a){return a instanceof Re}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=gc;exports.$copyNode=function(a){a=a.constructor.clone(a);Fb(a,null);return a};exports.$createLineBreakNode=Kd;exports.$createNodeSelection=Nd;exports.$createParagraphNode=zd;
191
+ exports.$createRangeSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Cd(a,b,0)};exports.$createTextNode=M;exports.$getAdjacentNode=Zb;exports.$getNearestNodeFromDOMNode=lb;exports.$getNearestRootOrShadowRoot=ec;exports.$getNodeByKey=L;exports.$getPreviousSelection=Ub;exports.$getRoot=Nb;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=dc;
192
+ exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Nb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Db;exports.$isLineBreakNode=Eb;exports.$isNodeSelection=pd;exports.$isParagraphNode=function(a){return a instanceof Le};exports.$isRangeSelection=C;exports.$isRootNode=O;exports.$isRootOrShadowRoot=fc;exports.$isTextNode=B;
192
193
  exports.$nodesOfType=function(a){var b=I();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=qc;exports.$parseSerializedNode=function(a){return ee(a,H()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=ob;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
193
194
  exports.CLICK_COMMAND=ca;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ia;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=ea;exports.DELETE_LINE_COMMAND=na;exports.DELETE_WORD_COMMAND=ma;
194
- exports.DEPRECATED_$createGridSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new Dd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Id;exports.DEPRECATED_$isGridNode=Gd;exports.DEPRECATED_$isGridRowNode=Hd;exports.DEPRECATED_$isGridSelection=Ed;exports.DEPRECATED_GridCellNode=Ne;exports.DEPRECATED_GridNode=Oe;exports.DEPRECATED_GridRowNode=Pe;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
195
- exports.DecoratorNode=pe;exports.ElementNode=qe;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=oa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=wa;exports.KEY_ARROW_LEFT_COMMAND=ta;exports.KEY_ARROW_RIGHT_COMMAND=ra;exports.KEY_ARROW_UP_COMMAND=va;exports.KEY_BACKSPACE_COMMAND=za;exports.KEY_DELETE_COMMAND=Ca;exports.KEY_ENTER_COMMAND=xa;exports.KEY_ESCAPE_COMMAND=Aa;
196
- exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=ya;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=ve;exports.MOVE_TO_END=sa;exports.MOVE_TO_START=ua;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Je;exports.REDO_COMMAND=qa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=se;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=Be;exports.UNDO_COMMAND=pa;exports.createCommand=function(){return{}};
197
- exports.createEditor=function(a){var b=a||{},c=P,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=te(),h=b.namespace||(null!==e?e._config.namespace:Sb()),k=b.editorState,l=[se,Be,ve,Je,...(b.nodes||[])],m=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<l.length;c++){let n=l[c];var p=null;"function"!==typeof n&&(p=n,n=p.replace,p=p.with);let r=n.getType();a.set(r,{klass:n,replace:p,transforms:new Set})}d=new Me(g,
198
- e,a,{disableEvents:f,namespace:h,theme:d},m?m:console.error,Le(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
195
+ exports.DEPRECATED_$createGridSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Dd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Id;exports.DEPRECATED_$isGridNode=Gd;exports.DEPRECATED_$isGridRowNode=Hd;exports.DEPRECATED_$isGridSelection=Ed;exports.DEPRECATED_GridCellNode=Pe;exports.DEPRECATED_GridNode=Qe;exports.DEPRECATED_GridRowNode=Re;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
196
+ exports.DecoratorNode=pe;exports.ElementNode=qe;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=oa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=wa;exports.KEY_ARROW_LEFT_COMMAND=ta;exports.KEY_ARROW_RIGHT_COMMAND=ra;exports.KEY_ARROW_UP_COMMAND=va;exports.KEY_BACKSPACE_COMMAND=za;exports.KEY_DELETE_COMMAND=Ba;exports.KEY_ENTER_COMMAND=xa;exports.KEY_ESCAPE_COMMAND=Aa;
197
+ exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=ya;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=ve;exports.MOVE_TO_END=sa;exports.MOVE_TO_START=ua;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Le;exports.REDO_COMMAND=qa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=se;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=Ce;exports.UNDO_COMMAND=pa;exports.createCommand=function(){return{}};
198
+ exports.createEditor=function(a){var b=a||{},c=Y,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=te(),h=b.namespace||(null!==e?e._config.namespace:Sb()),k=b.editorState,l=[se,Ce,ve,Le,...(b.nodes||[])],m=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<l.length;c++){let n=l[c];var p=null;"function"!==typeof n&&(p=n,n=p.replace,p=p.with);let r=n.getType();a.set(r,{klass:n,replace:p,transforms:new Set})}d=new Oe(g,
199
+ e,a,{disableEvents:f,namespace:h,theme:d},m?m:console.error,Ne(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
package/LexicalUtils.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare function doesContainGrapheme(str: string): boolean;
50
50
  export declare function getEditorsToPropagate(editor: LexicalEditor): Array<LexicalEditor>;
51
51
  export declare function createUID(): string;
52
52
  export declare function getAnchorTextFromDOM(anchorNode: Node): null | string;
53
- export declare function $updateSelectedTextFromDOM(isCompositionEnd: boolean, data?: string): void;
53
+ export declare function $updateSelectedTextFromDOM(isCompositionEnd: boolean, editor: LexicalEditor, data?: string): void;
54
54
  export declare function $updateTextNodeFromDOMContent(textNode: TextNode, textContent: string, anchorOffset: null | number, focusOffset: null | number, compositionEnd: boolean): void;
55
55
  export declare function $shouldInsertTextAfterOrBeforeTextNode(selection: RangeSelection, node: TextNode): boolean;
56
56
  export declare function isTab(keyCode: number, altKey: boolean, ctrlKey: boolean, metaKey: boolean): boolean;
@@ -108,4 +108,4 @@ export declare function errorOnInsertTextNodeOnRoot(node: LexicalNode, insertNod
108
108
  export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N;
109
109
  export declare function removeDOMBlockCursorElement(blockCursorElement: HTMLElement, editor: LexicalEditor, rootElement: HTMLElement): void;
110
110
  export declare function updateDOMBlockCursorElement(editor: LexicalEditor, rootElement: HTMLElement, nextSelection: null | RangeSelection | NodeSelection | GridSelection): void;
111
- export declare function getDOMSelection(): null | Selection;
111
+ export declare function getDOMSelection(targetWindow: null | Window): null | Selection;
@@ -5,10 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { EditorConfig } from '../LexicalEditor';
9
- import type { DOMConversionMap, NodeKey, SerializedLexicalNode } from '../LexicalNode';
8
+ import type { EditorConfig, LexicalEditor, Spread } from '../LexicalEditor';
9
+ import type { DOMConversionMap, DOMExportOutput, NodeKey, SerializedLexicalNode } from '../LexicalNode';
10
10
  import type { GridSelection, NodeSelection, RangeSelection } from '../LexicalSelection';
11
- import type { Spread } from 'lexical';
12
11
  import { LexicalNode } from '../LexicalNode';
13
12
  export declare type SerializedTextNode = Spread<{
14
13
  detail: number;
@@ -57,6 +56,7 @@ export declare class TextNode extends LexicalNode {
57
56
  updateDOM(prevNode: TextNode, dom: HTMLElement, config: EditorConfig): boolean;
58
57
  static importDOM(): DOMConversionMap | null;
59
58
  static importJSON(serializedNode: SerializedTextNode): TextNode;
59
+ exportDOM(editor: LexicalEditor): DOMExportOutput;
60
60
  exportJSON(): SerializedTextNode;
61
61
  selectionTransform(prevSelection: null | RangeSelection | NodeSelection | GridSelection, nextSelection: RangeSelection): void;
62
62
  setFormat(format: TextFormatType | number): this;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.7.2",
12
+ "version": "0.7.4",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",