lexical 0.20.1 → 0.20.2
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 +17 -3
- package/Lexical.dev.mjs +17 -3
- package/Lexical.prod.js +17 -17
- package/Lexical.prod.mjs +1 -1
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -10479,6 +10479,14 @@ class LexicalEditor {
|
|
|
10479
10479
|
throw Error(`setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty.`);
|
|
10480
10480
|
}
|
|
10481
10481
|
}
|
|
10482
|
+
|
|
10483
|
+
// Ensure that we have a writable EditorState so that transforms can run
|
|
10484
|
+
// during a historic operation
|
|
10485
|
+
let writableEditorState = editorState;
|
|
10486
|
+
if (writableEditorState._readOnly) {
|
|
10487
|
+
writableEditorState = cloneEditorState(editorState);
|
|
10488
|
+
writableEditorState._selection = editorState._selection ? editorState._selection.clone() : null;
|
|
10489
|
+
}
|
|
10482
10490
|
$flushRootMutations(this);
|
|
10483
10491
|
const pendingEditorState = this._pendingEditorState;
|
|
10484
10492
|
const tags = this._updateTags;
|
|
@@ -10489,14 +10497,20 @@ class LexicalEditor {
|
|
|
10489
10497
|
}
|
|
10490
10498
|
$commitPendingUpdates(this);
|
|
10491
10499
|
}
|
|
10492
|
-
this._pendingEditorState =
|
|
10500
|
+
this._pendingEditorState = writableEditorState;
|
|
10493
10501
|
this._dirtyType = FULL_RECONCILE;
|
|
10494
10502
|
this._dirtyElements.set('root', false);
|
|
10495
10503
|
this._compositionKey = null;
|
|
10496
10504
|
if (tag != null) {
|
|
10497
10505
|
tags.add(tag);
|
|
10498
10506
|
}
|
|
10499
|
-
|
|
10507
|
+
|
|
10508
|
+
// Only commit pending updates if not already in an editor.update
|
|
10509
|
+
// (e.g. dispatchCommand) otherwise this will cause a second commit
|
|
10510
|
+
// with an already read-only state and selection
|
|
10511
|
+
if (!this._updating) {
|
|
10512
|
+
$commitPendingUpdates(this);
|
|
10513
|
+
}
|
|
10500
10514
|
}
|
|
10501
10515
|
|
|
10502
10516
|
/**
|
|
@@ -10633,7 +10647,7 @@ class LexicalEditor {
|
|
|
10633
10647
|
};
|
|
10634
10648
|
}
|
|
10635
10649
|
}
|
|
10636
|
-
LexicalEditor.version = "0.20.
|
|
10650
|
+
LexicalEditor.version = "0.20.2+dev.cjs";
|
|
10637
10651
|
|
|
10638
10652
|
exports.$addUpdateTag = $addUpdateTag;
|
|
10639
10653
|
exports.$applyNodeReplacement = $applyNodeReplacement;
|
package/Lexical.dev.mjs
CHANGED
|
@@ -10477,6 +10477,14 @@ class LexicalEditor {
|
|
|
10477
10477
|
throw Error(`setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty.`);
|
|
10478
10478
|
}
|
|
10479
10479
|
}
|
|
10480
|
+
|
|
10481
|
+
// Ensure that we have a writable EditorState so that transforms can run
|
|
10482
|
+
// during a historic operation
|
|
10483
|
+
let writableEditorState = editorState;
|
|
10484
|
+
if (writableEditorState._readOnly) {
|
|
10485
|
+
writableEditorState = cloneEditorState(editorState);
|
|
10486
|
+
writableEditorState._selection = editorState._selection ? editorState._selection.clone() : null;
|
|
10487
|
+
}
|
|
10480
10488
|
$flushRootMutations(this);
|
|
10481
10489
|
const pendingEditorState = this._pendingEditorState;
|
|
10482
10490
|
const tags = this._updateTags;
|
|
@@ -10487,14 +10495,20 @@ class LexicalEditor {
|
|
|
10487
10495
|
}
|
|
10488
10496
|
$commitPendingUpdates(this);
|
|
10489
10497
|
}
|
|
10490
|
-
this._pendingEditorState =
|
|
10498
|
+
this._pendingEditorState = writableEditorState;
|
|
10491
10499
|
this._dirtyType = FULL_RECONCILE;
|
|
10492
10500
|
this._dirtyElements.set('root', false);
|
|
10493
10501
|
this._compositionKey = null;
|
|
10494
10502
|
if (tag != null) {
|
|
10495
10503
|
tags.add(tag);
|
|
10496
10504
|
}
|
|
10497
|
-
|
|
10505
|
+
|
|
10506
|
+
// Only commit pending updates if not already in an editor.update
|
|
10507
|
+
// (e.g. dispatchCommand) otherwise this will cause a second commit
|
|
10508
|
+
// with an already read-only state and selection
|
|
10509
|
+
if (!this._updating) {
|
|
10510
|
+
$commitPendingUpdates(this);
|
|
10511
|
+
}
|
|
10498
10512
|
}
|
|
10499
10513
|
|
|
10500
10514
|
/**
|
|
@@ -10631,6 +10645,6 @@ class LexicalEditor {
|
|
|
10631
10645
|
};
|
|
10632
10646
|
}
|
|
10633
10647
|
}
|
|
10634
|
-
LexicalEditor.version = "0.20.
|
|
10648
|
+
LexicalEditor.version = "0.20.2+dev.esm";
|
|
10635
10649
|
|
|
10636
10650
|
export { $addUpdateTag, $applyNodeReplacement, $cloneWithProperties, $copyNode, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $getAdjacentNode, $getCharacterOffsets, $getEditor, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getPreviousSelection, $getRoot, $getSelection, $getTextContent, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isDecoratorNode, $isElementNode, $isInlineElementOrDecoratorNode, $isLeafNode, $isLineBreakNode, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isTabNode, $isTextNode, $isTokenOrSegmented, $nodesOfType, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $selectAll, $setCompositionKey, $setSelection, $splitNode, ArtificialNode__DO_NOT_USE, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, DecoratorNode, ElementNode, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, IS_ALL_FORMATTING, IS_BOLD, IS_CODE, IS_HIGHLIGHT, IS_ITALIC, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, LineBreakNode, MOVE_TO_END, MOVE_TO_START, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, createCommand, createEditor, getDOMSelection, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, resetRandomKey, setDOMUnmanaged, setNodeIndentFromDOM };
|
package/Lexical.prod.js
CHANGED
|
@@ -39,14 +39,14 @@ function Nc(a){return null!==a.nodeName.match(new RegExp(/^(a|abbr|acronym|b|cit
|
|
|
39
39
|
function Pc(a){if(B(a)&&!a.isInline())return!0;if(!H(a)||Gc(a))return!1;var b=a.getFirstChild();b=null===b||Qc(b)||C(b)||b.isInline();return!a.isInline()&&!1!==a.canBeEmpty()&&b}function Rc(a,b){for(;null!==a&&null!==a.getParent()&&!b(a);)a=a.getParentOrThrow();return b(a)?a:null}let Sc=new WeakMap,Tc=new Map;
|
|
40
40
|
function Uc(a){if(!a._readOnly&&a.isEmpty())return Tc;a._readOnly||r(192);let b=Sc.get(a);if(!b){b=new Map;Sc.set(a,b);for(let [c,d]of a._nodeMap){a=d.__type;let e=b.get(a);e||(e=new Map,b.set(a,e));e.set(c,d)}}return b}function Vc(a){let b=a.constructor.clone(a);b.afterCloneFrom(a);return b}function Wc(a,b){a=parseInt(a.style.paddingInlineStart,10)||0;b.setIndent(a/40)}function zb(a){return!0===a.__lexicalUnmanaged}
|
|
41
41
|
function Xc(a,b,c,d,e,f){for(a=a.getFirstChild();null!==a;){let g=a.__key;a.__parent===b&&(H(a)&&Xc(a,g,c,d,e,f),c.has(g)||f.delete(g),e.push(g));a=a.getNextSibling()}}function Yc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;let e=[];for(let [f]of d){let g=b.get(f);void 0===g||g.isAttached()||(H(g)&&Xc(g,f,a,b,e,d),a.has(f)||d.delete(f),e.push(f))}for(let f of e)b.delete(f);for(let f of c)d=b.get(f),void 0===d||d.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}
|
|
42
|
-
let N="",O="",Zc=null,$c="",ad="",bd,P,cd,
|
|
42
|
+
let N="",O="",Zc=null,$c="",ad="",bd,P,cd,dd=!1,nd=!1,od,pd=null,qd,rd,sd,td,ud,vd;function wd(a,b){let c=sd.get(a);if(null!==b){let d=xd(a);d.parentNode===b&&b.removeChild(d)}td.has(a)||P._keyToDOMMap.delete(a);H(c)&&(a=yd(c,sd),zd(a,0,a.length-1,null));void 0!==c&&zc(vd,cd,od,c,"destroyed")}function zd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&wd(e,d)}}function Ad(a,b){a.setProperty("text-align",b)}
|
|
43
43
|
function Bd(a,b){var c=bd.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function Cd(a,b){a=a.style;0===b?Ad(a,""):1===b?Ad(a,"left"):2===b?Ad(a,"center"):3===b?Ad(a,"right"):4===b?Ad(a,"justify"):5===b?Ad(a,"start"):6===b&&Ad(a,"end")}
|
|
44
44
|
function Dd(a,b){let c=td.get(a);void 0===c&&r(60);let d=c.createDOM(bd,P);var e=P._keyToDOMMap;d[`__lexicalKey_${P._key}`]=a;e.set(a,d);C(c)?d.setAttribute("data-lexical-text","true"):B(c)&&d.setAttribute("data-lexical-decorator","true");if(H(c)){a=c.__indent;e=c.__size;0!==a&&Bd(d,a);if(0!==e){--e;a=yd(c,td);var f=O;O="";Ed(a,c,0,e,c.getDOMSlot(d));Fd(c,d);O=f}a=c.__format;0!==a&&Cd(d,a);c.isInline()||Gd(null,c,d);Cc(c)&&(N+="\n\n",ad+="\n\n")}else e=c.getTextContent(),B(c)?(f=c.decorate(P,bd),
|
|
45
45
|
null!==f&&Hd(a,f),d.contentEditable="false"):C(c)&&(c.isDirectionless()||(O+=e)),N+=e,ad+=e;null!==b&&b.insertChild(d);zc(vd,cd,od,c,"created");return d}function Ed(a,b,c,d,e){let f=N;for(N="";c<=d;++c){Dd(a[c],e);let g=td.get(a[c]);null!==g&&C(g)&&(null===Zc&&(Zc=g.getFormat()),""===$c&&($c=g.getStyle()))}Cc(b)&&(N+="\n\n");e.element.__lexicalTextContent=N;N=f+N}
|
|
46
46
|
function Id(a,b){if(a){if(a=a.__last)if(b=b.get(a))return Qc(b)?"line-break":B(b)&&b.isInline()?"decorator":null;return"empty"}return null}function Gd(a,b,c){a=Id(a,sd);let d=Id(b,td);a!==d&&b.getDOMSlot(c).setManagedLineBreak(d)}
|
|
47
47
|
function Fd(a,b){var c=b.__lexicalDir||"";if((b.__lexicalDirTextContent||"")!==O||c!==pd){let f=""===O;if(f)var d=pd;else d=O,d=fb.test(d)?"rtl":gb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=bd.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=ob(e),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=ob(k),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);nd||(a.getWritable().__dir=d)}pd=d;b.__lexicalDirTextContent=
|
|
48
48
|
O;b.__lexicalDir=d}}function yd(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&r(101);c.push(a);a=d.__next}return c}
|
|
49
|
-
function Jd(a,b){var c=sd.get(a),d=td.get(a);void 0!==c&&void 0!==d||r(61);var e=
|
|
49
|
+
function Jd(a,b){var c=sd.get(a),d=td.get(a);void 0!==c&&void 0!==d||r(61);var e=dd||rd.has(a)||qd.has(a);let f=Dc(P,a);if(c===d&&!e)return H(c)?(d=f.__lexicalTextContent,void 0!==d&&(N+=d,ad+=d),d=f.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),C(c)&&!c.isDirectionless()&&(O+=d),ad+=d,N+=d),f;c!==d&&e&&zc(vd,cd,od,d,"updated");if(d.updateDOM(c,f,bd))return d=Dd(a,null),null===b&&r(62),b.replaceChild(d,f),wd(a,null),d;if(H(c)&&H(d)){a=d.__indent;a!==c.__indent&&Bd(f,a);a=d.__format;
|
|
50
50
|
a!==c.__format&&Cd(f,a);if(e){a=O;O="";Zc=null;$c="";var g=d.getDOMSlot(f);e=N;var h=c.__size,k=d.__size;N="";b=g.element;if(1===h&&1===k){var l=c.__first,n=d.__first;if(l===n)Jd(l,b);else{g=xd(l);var q=Dd(n,null);try{b.replaceChild(q,g)}catch(w){if("object"===typeof w&&null!=w)throw Error(`${w.toString()} Parent: ${b.tagName}, new child: {tag: ${q.tagName} key: ${n}}, old child: {tag: ${g.tagName}, key: ${l}}.`);throw w;}wd(l,null)}l=td.get(n);C(l)&&(null===Zc&&(Zc=l.getFormat()),""===$c&&($c=l.getStyle()))}else{q=
|
|
51
51
|
yd(c,sd);var m=yd(d,td);q.length!==h&&r(227);m.length!==k&&r(228);if(0===h)0!==k&&Ed(m,d,0,k-1,g);else if(0===k)0!==h&&(l=null==g.after&&null==g.before&&null==g.element.__lexicalLineBreak,zd(q,0,h-1,l?null:b),l&&(b.textContent=""));else{var t=q;q=m;m=h-1;h=k-1;let w=g.getFirstChild(),y=0;for(k=0;y<=m&&k<=h;){var x=t[y],A=q[k];if(x===A)w=Kd(Jd(A,g.element)),y++,k++;else{void 0===l&&(l=new Set(t));void 0===n&&(n=new Set(q));let F=n.has(x),ba=l.has(A);F?(ba?(x=Dc(P,A),x===w?w=Kd(Jd(A,g.element)):(g.withBefore(w).insertChild(x),
|
|
52
52
|
Jd(A,g.element)),y++):Dd(A,g.withBefore(w)),k++):(w=Kd(xd(x)),wd(x,g.element),y++)}A=td.get(A);null!==A&&C(A)&&(null===Zc&&(Zc=A.getFormat()),""===$c&&($c=A.getStyle()))}l=y>m;n=k>h;l&&!n?(l=q[h+1],l=void 0===l?null:P.getElementByKey(l),Ed(q,d,k,h,g.withBefore(l))):n&&!l&&zd(t,y,m,g.element)}}Cc(d)&&(N+="\n\n");b.__lexicalTextContent=N;N=e+N;Fd(d,f);Ld(d)&&null!=Zc&&Zc!==d.__textFormat&&!nd&&(d.setTextFormat(Zc),d.setTextStyle($c));Ld(d)&&""!==$c&&$c!==d.__textStyle&&!nd&&d.setTextStyle($c);O=a;M(d)||
|
|
@@ -166,15 +166,15 @@ function G(){null===U&&r(196,Af());return U}function Af(){var a=0;let b=new Set,
|
|
|
166
166
|
function Bf(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30,d);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++);}function Cf(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),C(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Lb(b)}function Df(a,b){if(b){a=a._updateTags;var c=b;Array.isArray(b)||(c=[b]);for(let d of c)a.add(d)}}
|
|
167
167
|
function Ef(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=lc(),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 n of g)g=a.get(n),C(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Lb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Bf(b,g,f),c.add(n);g=b._dirtyLeaves;h=g.size;if(0<h){bc++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let n of k)if(k=n[0],l=n[1],"root"===k||l)g=a.get(k),void 0!==
|
|
168
168
|
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Bf(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;bc++}b._dirtyLeaves=c;b._dirtyElements=d}function Ff(a,b){var c=a.type,d=b.get(c);void 0===d&&r(17,c);c=d.klass;a.type!==c.getType()&&r(18,c.name);c=c.importJSON(a);a=a.children;if(H(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=Ff(a[d],b);c.append(e)}return c}function Gf(a,b,c){let d=T,e=V,f=U;T=b;V=!0;U=a;try{return c()}finally{T=d,V=e,U=f}}
|
|
169
|
-
function Hf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,l=T,n=V,q=U,m=a._updating,t=a._observer,x=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==t){U=a;T=c;V=!1;a._updating=!0;try{let E=a._dirtyType,Q=a._dirtyElements,R=a._dirtyLeaves;t.disconnect();var A=E,w=Q,y=R;O=ad=N="";
|
|
170
|
-
td=c._nodeMap;nd=c._readOnly;ud=new Map(a._keyToDOMMap);let ma=new Map;vd=ma;Jd("root",null);vd=ud=bd=td=sd=rd=qd=cd=P=void 0;x=ma}catch(E){E instanceof Error&&a._onError(E);if(yf)throw E;If(a,null,d,c);Hb(a);a._dirtyType=2;yf=!0;Hf(a,f);yf=!1;return}finally{t.observe(d,zf),a._updating=m,T=l,V=n,U=q}}c._readOnly||(c._readOnly=!0);var F=a._dirtyLeaves,ba=a._dirtyElements,ab=a._normalizedNodes,ca=a._updateTags,
|
|
171
|
-
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var Te=a._decorators,cc=a._pendingDecorators||Te,Wf=c._nodeMap,
|
|
172
|
-
Y!==d||null!==Y&&Qb(Y)))if(D(h)){var ub=h.anchor,
|
|
169
|
+
function Hf(a,b){let c=a._pendingEditorState,d=a._rootElement,e=a._headless||null===d;if(null!==c){var f=a._editorState,g=f._selection,h=c._selection,k=0!==a._dirtyType,l=T,n=V,q=U,m=a._updating,t=a._observer,x=null;a._pendingEditorState=null;a._editorState=c;if(!e&&k&&null!==t){U=a;T=c;V=!1;a._updating=!0;try{let E=a._dirtyType,Q=a._dirtyElements,R=a._dirtyLeaves;t.disconnect();var A=E,w=Q,y=R;O=ad=N="";dd=2===A;pd=null;P=a;bd=a._config;cd=a._nodes;od=P._listeners.mutation;qd=w;rd=y;sd=f._nodeMap;
|
|
170
|
+
td=c._nodeMap;nd=c._readOnly;ud=new Map(a._keyToDOMMap);let ma=new Map;vd=ma;Jd("root",null);vd=ud=bd=td=sd=rd=qd=cd=P=void 0;x=ma}catch(E){E instanceof Error&&a._onError(E);if(yf)throw E;If(a,null,d,c);Hb(a);a._dirtyType=2;yf=!0;Hf(a,f);yf=!1;return}finally{t.observe(d,zf),a._updating=m,T=l,V=n,U=q}}c._readOnly||(c._readOnly=!0);var F=a._dirtyLeaves,ba=a._dirtyElements,ab=a._normalizedNodes,ca=a._updateTags,ed=a._deferred;k&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
|
171
|
+
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var Te=a._decorators,cc=a._pendingDecorators||Te,Wf=c._nodeMap,fd;for(fd in cc)Wf.has(fd)||(cc===Te&&(cc=nc(a)),delete cc[fd]);var na=e?null:Bb(a._window);if(a._editable&&null!==na&&(k||null===h||h.dirty)){U=a;T=c;try{null!==t&&t.disconnect();if(k||null===h||h.dirty){let E=a._blockCursorElement;null!==E&&Lc(E,a,d);a:{let Q=na.anchorNode,R=na.focusNode,ma=na.anchorOffset,tb=na.focusOffset,Y=document.activeElement;if(!(ca.has("collaboration")&&
|
|
172
|
+
Y!==d||null!==Y&&Qb(Y)))if(D(h)){var ub=h.anchor,gd=h.focus,Ue=ub.key,Xf=gd.key,Ve=Dc(a,Ue),We=Dc(a,Xf),dc=ub.offset,Xe=gd.offset,hd=h.format,id=h.style,Ye=h.isCollapsed(),vb=Ve,ec=We,jd=!1;if("text"===ub.type){vb=Zb(Ve);let Z=ub.getNode();jd=Z.getFormat()!==hd||Z.getStyle()!==id}else D(g)&&"text"===g.anchor.type&&(jd=!0);"text"===gd.type&&(ec=Zb(We));if(null!==vb&&null!==ec){if(Ye&&(null===g||jd||D(g)&&(g.format!==hd||g.style!==id))){var Yf=performance.now();de=[hd,id,dc,Ue,Yf]}if(ma===dc&&tb===
|
|
173
173
|
Xe&&Q===vb&&R===ec&&("Range"!==na.type||!Ye)&&(null!==Y&&d.contains(Y)||d.focus({preventScroll:!0}),"element"!==ub.type))break a;try{na.setBaseAndExtent(vb,dc,ec,Xe)}catch(Z){}if(!ca.has("skip-scroll-into-view")&&h.isCollapsed()&&null!==d&&d===document.activeElement){let Z=h instanceof jf&&"element"===h.anchor.type?vb.childNodes[dc]||null:0<na.rangeCount?na.getRangeAt(0):null;if(null!==Z){let W;if(Z instanceof Text){let X=document.createRange();X.selectNode(Z);W=X.getBoundingClientRect()}else W=Z.getBoundingClientRect();
|
|
174
|
-
let Ca=d.ownerDocument,Ia=Ca.defaultView;if(null!==Ia)for(var {top:
|
|
174
|
+
let Ca=d.ownerDocument,Ia=Ca.defaultView;if(null!==Ia)for(var {top:kd,bottom:ld}=W,fc,gc,ra=d;null!==ra;){let X=ra===Ca.body;if(X)fc=0,gc=Ib(a).innerHeight;else{let hc=ra.getBoundingClientRect();fc=hc.top;gc=hc.bottom}let Ja=0;kd<fc?Ja=-(fc-kd):ld>gc&&(Ja=ld-gc);if(0!==Ja)if(X)Ia.scrollBy(0,Ja);else{let hc=ra.scrollTop;ra.scrollTop+=Ja;let Ze=ra.scrollTop-hc;kd-=Ze;ld-=Ze}if(X)break;ra=Ab(ra)}}}$d=!0}}else null!==g&&Tb(a,Q,R)&&na.removeAllRanges()}}a:{let E=a._blockCursorElement;if(D(h)&&h.isCollapsed()&&
|
|
175
175
|
"element"===h.anchor.type&&d.contains(document.activeElement)){let Q=h.anchor,R=Q.getNode(),ma=Q.offset,tb=R.getChildrenSize(),Y=!1,Z=null;if(ma===tb){let W=R.getChildAtIndex(ma-1);Kc(W)&&(Y=!0)}else{let W=R.getChildAtIndex(ma);if(null!==W&&Kc(W)){let Ca=W.getPreviousSibling();if(null===Ca||Kc(Ca))Y=!0,Z=a.getElementByKey(W.__key)}}if(Y){let W=a.getElementByKey(R.__key);if(null===E){let Ca=a._config.theme,Ia=document.createElement("div");Ia.contentEditable="false";Ia.setAttribute("data-lexical-cursor",
|
|
176
176
|
"true");let X=Ca.blockCursor;if(void 0!==X){if("string"===typeof X){let Ja=ob(X);X=Ca.blockCursor=Ja}void 0!==X&&Ia.classList.add(...X)}a._blockCursorElement=E=Ia}d.style.caretColor="transparent";null===Z?W.appendChild(E):W.insertBefore(E,Z);break a}}null!==E&&Lc(E,a,d)}null!==t&&t.observe(d,zf)}finally{U=q,T=l}}if(null!==x){var Zf=x;let E=Array.from(a._listeners.mutation),Q=E.length;for(let R=0;R<Q;R++){let [ma,tb]=E[R],Y=Zf.get(tb);void 0!==Y&&ma(Y,{dirtyLeaves:F,prevEditorState:f,updateTags:ca})}}D(h)||
|
|
177
|
-
null===h||null!==g&&g.is(h)||a.dispatchCommand(aa,void 0);var
|
|
177
|
+
null===h||null!==g&&g.is(h)||a.dispatchCommand(aa,void 0);var md=a._pendingDecorators;null!==md&&(a._decorators=md,a._pendingDecorators=null,Jf("decorator",a,!0,md));var $f=oc(b||f),$e=oc(c);$f!==$e&&Jf("textcontent",a,!0,$e);Jf("update",a,!0,{dirtyElements:ba,dirtyLeaves:F,editorState:c,normalizedNodes:ab,prevEditorState:b||f,tags:ca});a._deferred=[];if(0!==ed.length){let E=a._updating;a._updating=!0;try{for(let Q=0;Q<ed.length;Q++)ed[Q]()}finally{a._updating=E}}var af=a._updates;if(0!==af.length){let E=
|
|
178
178
|
af.shift();if(E){let [Q,R]=E;Kf(a,Q,R)}}}}function Jf(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}}
|
|
179
179
|
function S(a,b,c){if(!1===a._updating||U!==a){let f=!1;a.update(()=>{f=S(a,b,c)});return f}let d=sc(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}
|
|
180
180
|
function Lf(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d;if(void 0!==f){d=f.onUpdate;f.skipTransforms&&(b=!0);if(f.discrete){let g=a._pendingEditorState;null===g&&r(191);g._flushSync=!0}d&&a._deferred.push(d);Df(a,f.tag)}e()}}return b}
|
|
@@ -215,15 +215,15 @@ e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,b,c){a=this.reso
|
|
|
215
215
|
b){let c=this._editorState;if(b=Uc(c).get(b.getType())){var d=new Map;for(let e of b.keys())d.set(e,"created");0<d.size&&a(d,{dirtyLeaves:new Set,prevEditorState:c,updateTags:new Set(["registerMutationListener"])})}}registerNodeTransformToKlass(a,b){a=this.getRegisteredNode(a);a.transforms.add(b);return a}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));pc(this,a.getType());return()=>
|
|
216
216
|
{d.forEach(e=>e.transforms.delete(b))}}hasNode(a){return this._nodes.has(a.getType())}hasNodes(a){return a.every(this.hasNode.bind(this))}dispatchCommand(a,b){return S(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let f=yc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;If(this,b,a,c);if(null!==b){if(!this._config.disableEvents){var d=
|
|
217
217
|
b.ownerDocument,e=Zd.get(d);void 0===e&&r(162);--e;0<=e||r(164);Zd.set(d,e);0===e&&d.removeEventListener("selectionchange",oe);d=Sb(b);Vb(d)?(null!==d._parentEditor?(e=sc(d),e=e[e.length-1]._key,ne.get(e)===d&&ne.delete(e)):ne.delete(d._key),b.__lexicalEditor=null):d&&r(198);d=me(b);for(e=0;e<d.length;e++)d[e]();b.__lexicalEventHandles=[]}null!=f&&b.classList.remove(...f)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",
|
|
218
|
-
a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,Hb(this),this._updateTags.add("history-merge"),Hf(this),this._config.disableEvents||pe(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);Jf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&r(38);
|
|
219
|
-
b?b.tag:null;null===
|
|
220
|
-
b&&b(),c._readOnly=!0}catch(n){n instanceof Error&&this._onError(n)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,T=d,V=e,U=f}return c}read(a){Hf(this);return this.getEditorState().read(a,{editor:this})}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=K();
|
|
221
|
-
{c.removeAttribute("autocapitalize");a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=Bb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,Jf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
|
222
|
-
exports.$applyNodeReplacement=Ic;exports.$cloneWithProperties=Vc;exports.$copyNode=Hc;exports.$createLineBreakNode=Be;exports.$createNodeSelection=pf;exports.$createParagraphNode=we;exports.$createPoint=ef;exports.$createRangeSelection=function(){let a=ef("root",0,"element"),b=ef("root",0,"element");return new jf(a,b,0,"")};exports.$createRangeSelectionFromDom=function(a,b){return ie(null,a,b,null)};
|
|
223
|
-
exports.$getCharacterOffsets=kf;exports.$getEditor=function(){return G()};exports.$getNearestNodeFromDOMNode=Rb;exports.$getNearestRootOrShadowRoot=Fc;exports.$getNodeByKey=z;exports.$getNodeByKeyOrThrow=function(a){let b=z(a);null===b&&r(63,a);return b};exports.$getPreviousSelection=vc;exports.$getRoot=K;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};
|
|
224
|
-
exports.$insertNodes=function(a){let b=u()||vc();null===b&&(b=K().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return H(a)&&!a.isInline()};exports.$isDecoratorNode=B;exports.$isElementNode=H;exports.$isInlineElementOrDecoratorNode=function(a){return H(a)&&a.isInline()||B(a)&&a.isInline()};exports.$isLeafNode=function(a){return C(a)||Qc(a)||B(a)};exports.$isLineBreakNode=Qc;
|
|
225
|
-
exports.$isRootNode=M;exports.$isRootOrShadowRoot=Gc;exports.$isTabNode=cf;exports.$isTextNode=C;exports.$isTokenOrSegmented=Xb;exports.$nodesOfType=function(a){let b=a.getType();var c=ic();if(c._readOnly)return(a=Uc(c).get(b))?Array.from(a.values()):[];c=c._nodeMap;let d=[];for(let [,e]of c)e instanceof a&&e.__type===b&&e.isAttached()&&d.push(e);return d};exports.$normalizeSelection__EXPERIMENTAL=Mb;
|
|
226
|
-
exports.$parseSerializedNode=function(a){return Ff(a,G()._nodes)};exports.$selectAll=function(){var a=K();a=a.select(0,a.getChildrenSize());Eb(Mb(a))};exports.$setCompositionKey=J;exports.$setSelection=Eb;
|
|
218
|
+
a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,Hb(this),this._updateTags.add("history-merge"),Hf(this),this._config.disableEvents||pe(a,this),null!=f&&a.classList.add(...f)):(this._editorState=c,this._window=this._pendingEditorState=null);Jf("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&r(38);let c=a;c._readOnly&&(c=new Mf(new Map(a._nodeMap)),c._selection=a._selection?
|
|
219
|
+
a._selection.clone():null);Gb(this);a=this._pendingEditorState;let d=this._updateTags;b=void 0!==b?b.tag:null;null===a||a.isEmpty()||(null!=b&&d.add(b),Hf(this));this._pendingEditorState=c;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);this._updating||Hf(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=Uf(),d=T,e=V,f=U,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;
|
|
220
|
+
this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;T=c;V=!1;U=this;try{Ff(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(n){n instanceof Error&&this._onError(n)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,T=d,V=e,U=f}return c}read(a){Hf(this);return this.getEditorState().read(a,{editor:this})}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=K();
|
|
221
|
+
null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=Bb(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,Jf("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
|
222
|
+
Wb.version="0.20.2+prod.cjs";exports.$addUpdateTag=function(a){I();G()._updateTags.add(a)};exports.$applyNodeReplacement=Ic;exports.$cloneWithProperties=Vc;exports.$copyNode=Hc;exports.$createLineBreakNode=Be;exports.$createNodeSelection=pf;exports.$createParagraphNode=we;exports.$createPoint=ef;exports.$createRangeSelection=function(){let a=ef("root",0,"element"),b=ef("root",0,"element");return new jf(a,b,0,"")};exports.$createRangeSelectionFromDom=function(a,b){return ie(null,a,b,null)};
|
|
223
|
+
exports.$createTabNode=Qe;exports.$createTextNode=L;exports.$getAdjacentNode=Bc;exports.$getCharacterOffsets=kf;exports.$getEditor=function(){return G()};exports.$getNearestNodeFromDOMNode=Rb;exports.$getNearestRootOrShadowRoot=Fc;exports.$getNodeByKey=z;exports.$getNodeByKeyOrThrow=function(a){let b=z(a);null===b&&r(63,a);return b};exports.$getPreviousSelection=vc;exports.$getRoot=K;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};
|
|
224
|
+
exports.$hasAncestor=Ec;exports.$hasUpdateTag=function(a){return G()._updateTags.has(a)};exports.$insertNodes=function(a){let b=u()||vc();null===b&&(b=K().selectEnd());b.insertNodes(a)};exports.$isBlockElementNode=function(a){return H(a)&&!a.isInline()};exports.$isDecoratorNode=B;exports.$isElementNode=H;exports.$isInlineElementOrDecoratorNode=function(a){return H(a)&&a.isInline()||B(a)&&a.isInline()};exports.$isLeafNode=function(a){return C(a)||Qc(a)||B(a)};exports.$isLineBreakNode=Qc;
|
|
225
|
+
exports.$isNodeSelection=se;exports.$isParagraphNode=Ld;exports.$isRangeSelection=D;exports.$isRootNode=M;exports.$isRootOrShadowRoot=Gc;exports.$isTabNode=cf;exports.$isTextNode=C;exports.$isTokenOrSegmented=Xb;exports.$nodesOfType=function(a){let b=a.getType();var c=ic();if(c._readOnly)return(a=Uc(c).get(b))?Array.from(a.values()):[];c=c._nodeMap;let d=[];for(let [,e]of c)e instanceof a&&e.__type===b&&e.isAttached()&&d.push(e);return d};exports.$normalizeSelection__EXPERIMENTAL=Mb;
|
|
226
|
+
exports.$onUpdate=function(a){I();G()._deferred.push(a)};exports.$parseSerializedNode=function(a){return Ff(a,G()._nodes)};exports.$selectAll=function(){var a=K();a=a.select(0,a.getChildrenSize());Eb(Mb(a))};exports.$setCompositionKey=J;exports.$setSelection=Eb;
|
|
227
227
|
exports.$splitNode=function(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);Gc(a)&&r(102);let d=g=>{const h=g.getParentOrThrow(),k=Gc(h),l=g!==c||k?Hc(g):g;if(k)return H(g)&&H(l)||r(133),g.insertAfter(l),[g,l,l];const [n,q,m]=d(h);g=g.getNextSiblings();m.append(l,...g);return[n,q,l]},[e,f]=d(c);return[e,f]};exports.ArtificialNode__DO_NOT_USE=ag;exports.BLUR_COMMAND=Ra;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
|
|
228
228
|
exports.CLICK_COMMAND=da;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=Na;exports.CUT_COMMAND=Oa;exports.DELETE_CHARACTER_COMMAND=ea;exports.DELETE_LINE_COMMAND=oa;exports.DELETE_WORD_COMMAND=la;exports.DRAGEND_COMMAND=Ma;exports.DRAGOVER_COMMAND=La;exports.DRAGSTART_COMMAND=Ka;exports.DROP_COMMAND=Ha;
|
|
229
229
|
exports.DecoratorNode=Sf;exports.ElementNode=Qf;exports.FOCUS_COMMAND=Qa;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=pa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.INSERT_TAB_COMMAND={};exports.IS_ALL_FORMATTING=255;exports.IS_BOLD=1;exports.IS_CODE=16;exports.IS_HIGHLIGHT=128;exports.IS_ITALIC=2;exports.IS_STRIKETHROUGH=4;exports.IS_SUBSCRIPT=32;exports.IS_SUPERSCRIPT=64;exports.IS_UNDERLINE=8;
|
package/Lexical.prod.mjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
function e(e){return{}}const t={},n={},r={},i={},s={},o={},l={},c={},a={},u={},f={},d={},h={},g={},_={},p={},y={},m={},x={},v={},S={},C={},T={},k={},b={},w={},N={},E={},P={},F={},L={},D={},O={},M={},I={},A={},B={},z={},W={},R={},K={},J={},$={},U={},V={},j="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,H=j&&"documentMode"in document?document.documentMode:null,q=j&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),G=j&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Q=!(!j||!("InputEvent"in window)||H)&&"getTargetRanges"in new window.InputEvent("input"),X=j&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Y=j&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Z=j&&/Android/.test(navigator.userAgent),ee=j&&/^(?=.*Chrome).*/i.test(navigator.userAgent),te=j&&Z&&ee,ne=j&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ee,re=1,ie=3,se=0,oe=1,le=2,ce=0,ae=1,ue=2,fe=1,de=2,he=4,ge=8,_e=16,pe=32,ye=64,me=128,xe=112|(3|he|ge)|me,ve=1,Se=2,Ce=3,Te=4,ke=5,be=6,we=X||Y||ne?" ":"",Ne="\n\n",Ee=G?" ":we,Pe="֑-߿יִ-﷽ﹰ-ﻼ",Fe="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Le=new RegExp("^[^"+Fe+"]*["+Pe+"]"),De=new RegExp("^[^"+Pe+"]*["+Fe+"]"),Oe={bold:1,code:16,highlight:me,italic:2,strikethrough:he,subscript:32,superscript:64,underline:ge},Me={directionless:1,unmergeable:2},Ie={center:Se,end:be,justify:Te,left:ve,right:Ce,start:ke},Ae={[Se]:"center",[be]:"end",[Te]:"justify",[ve]:"left",[Ce]:"right",[ke]:"start"},Be={normal:0,segmented:2,token:1},ze={[ce]:"normal",[ue]:"segmented",[ae]:"token"};function We(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re=We((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function Ke(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const Je=100;let $e=!1,Ue=0;function Ve(e){Ue=e.timeStamp}function je(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==kt(e,n)}function He(e,t,n){const r=vn(n._window);let i=null,s=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,s=r.focusOffset);const o=e.nodeValue;null!==o&&zt(t,o,i,s,!1)}function qe(e,t,n){if(ki(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return t.nodeType===ie&&n.isAttached()}function Ge(e,t,n,r){for(let i=e;i&&!An(i);i=rn(i)){const e=kt(i,t);if(void 0!==e){const t=Ct(e,n);if(t)return Es(t)?void 0:[i,t]}else if(i===r)return[r,Pt(n)]}}function Qe(e,t,n){$e=!0;const r=performance.now()-Ue>Je;try{Ss(e,(()=>{const i=Ri()||function(e){return e.getEditorState().read((()=>{const e=Ri();return null!==e?e.clone():null}))}(e),s=new Map,o=e.getRootElement(),l=e._editorState,c=e._blockCursorElement;let a=!1,u="";for(let n=0;n<t.length;n++){const f=t[n],d=f.type,h=f.target,g=Ge(h,e,l,o);if(!g)continue;const[_,p]=g;if("characterData"===d)r&&hi(p)&&qe(i,h,p)&&He(h,p,e);else if("childList"===d){a=!0;const t=f.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=Tt(r),s=r.parentNode;if(null!=s&&r!==c&&null===i&&!je(r,s,e)){if(G){const e=r.innerText||r.nodeValue;e&&(u+=e)}s.removeChild(r)}}const n=f.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(je(r,h,e)||c===r)&&(h.appendChild(r),t++)}r!==t&&s.set(_,p)}}}if(s.size>0)for(const[t,n]of s)n.reconcileObservedMutation(t,e);const f=n.takeRecords();if(f.length>0){for(let t=0;t<f.length;t++){const n=f[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],s=n.parentNode;null==s||"BR"!==n.nodeName||je(n,i,e)||s.removeChild(n)}}n.takeRecords()}null!==i&&(a&&(i.dirty=!0,Ft(i)),G&&Zt(e)&&i.insertRawText(u))}))}finally{$e=!1}}function Xe(e){const t=e._observer;if(null!==t){Qe(e,t.takeRecords(),t)}}function Ye(e){!function(e){0===Ue&&an(e).addEventListener("textInput",Ve,!0)}(e),e._observer=new MutationObserver(((t,n)=>{Qe(e,t,n)}))}function Ze(e,t){const n=e.__mode,r=e.__format,i=e.__style,s=t.__mode,o=t.__format,l=t.__style;return!(null!==n&&n!==s||null!==r&&r!==o||null!==i&&i!==l)}function et(e,t){const n=e.mergeWithSibling(t),r=ls()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function tt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&hi(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(Ze(t,r)){r=et(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&hi(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Ze(r,n)){r=et(r,n);break}break}n.remove()}}else r.remove()}function nt(e){return rt(e.anchor),rt(e.focus),e}function rt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),hi(r)){e.set(r.__key,i?r.getTextContentSize():0,"text");break}if(!bs(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element")}}let it=1;function st(){it=1}const ot="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function lt(e){const t=document.activeElement;if(null===t)return!1;const n=t.nodeName;return Es(bt(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==ft(t))}function ct(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!lt(t)&&ut(t)===e}catch(e){return!1}}function at(e){return e instanceof js}function ut(e){let t=e;for(;null!=t;){const e=ft(t);if(at(e))return e;t=rn(t)}return null}function ft(e){return e?e.__lexicalEditor:null}function dt(e){return e.isToken()||e.isSegmented()}function ht(e){return e.nodeType===ie}function gt(e){let t=e;for(;null!=t;){if(ht(t))return t;t=t.firstChild}return null}function _t(e,t,n){const r=Oe[t];if(null!==n&&(e&r)==(n&r))return e;let i=e^r;return"subscript"===t?i&=~Oe.superscript:"superscript"===t&&(i&=~Oe.subscript),i}function pt(e){return hi(e)||Gr(e)||Es(e)}function yt(e,t){if(null!=t)return void(e.__key=t);is(),ss();const n=ls(),r=os(),i=""+it++;r._nodeMap.set(i,e),bs(e)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=oe,e.__key=i}function mt(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),s=e.getNextSibling();if(null===i)if(null!==s){const e=s.getWritable();r.__first=s.__key,e.__prev=null}else r.__first=null;else{const e=i.getWritable();if(null!==s){const t=s.getWritable();t.__prev=e.__key,e.__next=t.__key}else e.__next=null;n.__prev=null}if(null===s)if(null!==i){const e=i.getWritable();r.__last=i.__key,e.__next=null}else r.__last=null;else{const e=s.getWritable();if(null!==i){const t=i.getWritable();t.__next=e.__key,e.__prev=t.__key}else e.__prev=null;n.__next=null}r.__size--,n.__parent=null}}function xt(e){ss();const t=e.getLatest(),n=t.__parent,r=os(),i=ls(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,s,o);const l=t.__key;i._dirtyType=oe,bs(e)?o.set(l,!0):i._dirtyLeaves.add(l)}function vt(e){is();const t=ls(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Ct(n);null!==e&&e.getWritable()}if(null!==e){const t=Ct(e);null!==t&&t.getWritable()}}}function St(){if(rs())return null;return ls()._compositionKey}function Ct(e,t){const n=(t||os())._nodeMap.get(e);return void 0===n?null:n}function Tt(e,t){const n=kt(e,ls());return void 0!==n?Ct(n,t):null}function kt(e,t){return e[`__lexicalKey_${t._key}`]}function bt(e,t){let n=e;for(;null!=n;){const e=Tt(n,t);if(null!==e)return e;n=rn(n)}return null}function wt(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Nt(e){return e.read((()=>Et().getTextContent()))}function Et(){return Pt(os())}function Pt(e){return e._nodeMap.get("root")}function Ft(e){is();const t=os();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Lt(e){const t=ls(),n=function(e,t){let n=e;for(;null!=n;){const e=kt(n,t);if(void 0!==e)return e;n=rn(n)}return null}(e,t);if(null===n){return e===t.getRootElement()?Ct("root"):null}return Ct(n)}function Dt(e,t){return t?e.getTextContentSize():0}function Ot(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Mt(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function It(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function At(e){return e.nodeType===ie?e.nodeValue:null}function Bt(e,t,n){const r=vn(t._window);if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let t=At(i);const r=bt(i);if(null!==t&&hi(r)){if(t===we&&n){const e=n.length;t=n,s=e,o=e}null!==t&&zt(r,t,s,o,e)}}}function zt(e,t,n,r,i){let s=e;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let l=t;(o||i)&&t[t.length-1]===we&&(l=t.slice(0,-1));const c=s.getTextContent();if(i||l!==c){if(""===l){if(vt(null),X||Y||ne)s.remove();else{const e=ls();setTimeout((()=>{e.update((()=>{s.isAttached()&&s.remove()}))}),20)}return}const t=s.getParent(),i=Ki(),c=s.getTextContentSize(),a=St(),u=s.getKey();if(s.isToken()||null!==a&&u===a&&!o||ki(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const f=Ri();if(!ki(f)||null===n||null===r)return void s.setTextContent(l);if(f.setTextNodeRange(s,n,s,r),s.isSegmented()){const e=di(s.getTextContent());s.replace(e),s=e}s.setTextContent(l)}}}function Wt(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=t.isToken();return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(hi(t)||bs(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}function Rt(e){return"ArrowLeft"===e}function Kt(e){return"ArrowRight"===e}function Jt(e,t){return q?e:t}function $t(e){return"Enter"===e}function Ut(e){return"Backspace"===e}function Vt(e){return"Delete"===e}function jt(e,t,n){return"a"===e.toLowerCase()&&Jt(t,n)}function Ht(){const e=Et();Ft(nt(e.select(0,e.getChildrenSize())))}function qt(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=Ke(i);return n[t]=e,e}return i}function Gt(e,t,n,r,i){if(0===n.size)return;const s=r.__type,o=r.__key,l=t.get(s);void 0===l&&Re(33,s);const c=l.klass;let a=e.get(c);void 0===a&&(a=new Map,e.set(c,a));const u=a.get(o),f="destroyed"===u&&"created"===i;(void 0===u||f)&&a.set(o,f?"updated":i)}function Qt(e){const t=e.getType(),n=os();if(n._readOnly){const e=Dn(n).get(t);return e?Array.from(e.values()):[]}const r=n._nodeMap,i=[];for(const[,n]of r)n instanceof e&&n.__type===t&&n.isAttached()&&i.push(n);return i}function Xt(e,t,n){const r=e.getParent();let i=n,s=e;return null!==r&&(t&&0===n?(i=s.getIndexWithinParent(),s=r):t||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?i-1:i)}function Yt(e,t){const n=e.offset;if("element"===e.type){return Xt(e.getNode(),t,n)}{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?Xt(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function Zt(e){const t=an(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function en(e,t,n){return ms(e,t,n)}function tn(e){return!Fs(e)&&!e.isLastChild()&&!e.isInline()}function nn(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&Re(75,t),n}function rn(e){const t=e.assignedSlot||e.parentElement;return null!==t&&11===t.nodeType?t.host:t}function sn(e){return ls()._updateTags.has(e)}function on(e){is();ls()._updateTags.add(e)}function ln(e){is();ls()._deferred.push(e)}function cn(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function an(e){const t=e._window;return null===t&&Re(78),t}function un(e){return bs(e)&&e.isInline()||Es(e)&&e.isInline()}function fn(e){let t=e.getParentOrThrow();for(;null!==t;){if(dn(t))return t;t=t.getParentOrThrow()}return t}function dn(e){return Fs(e)||bs(e)&&e.isShadowRoot()}function hn(e){const t=e.constructor.clone(e);return yt(t,null),t}function gn(e){const t=ls(),n=e.constructor.getType(),r=t._nodes.get(n);void 0===r&&Re(200,e.constructor.name,n);const{replace:i,replaceWithKlass:s}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==s?t instanceof s||Re(201,s.name,s.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||Re(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&Re(203,e.constructor.name,n,r.name,r.getType()),t}return e}function _n(e,t){!Fs(e.getParent())||bs(t)||Es(t)||Re(99)}function pn(e){const t=Ct(e);return null===t&&Re(63,e),t}function yn(e){return(Es(e)||bs(e)&&!e.canBeEmpty())&&!e.isInline()}function mn(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function xn(e,t,n){let r=e._blockCursorElement;if(ki(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let l=!1,c=null;if(o===s.getChildrenSize()){yn(s.getChildAtIndex(o-1))&&(l=!0)}else{const t=s.getChildAtIndex(o);if(null!==t&&yn(t)){const n=t.getPreviousSibling();(null===n||yn(n))&&(l=!0,c=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(s.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=Ke(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&mn(r,e,t)}function vn(e){return j?(e||window).getSelection():null}function Sn(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),dn(e)&&Re(102);const r=e=>{const t=e.getParentOrThrow(),i=dn(t),s=e!==n||i?hn(e):e;if(i)return bs(e)&&bs(s)||Re(133),e.insertAfter(s),[e,s,s];{const[n,i,o]=r(t),l=e.getNextSiblings();return o.append(s,...l),[n,i,s]}},[i,s]=r(n);return[i,s]}function Cn(e){return Tn(e)&&"A"===e.tagName}function Tn(e){return 1===e.nodeType}function kn(e){return 11===e.nodeType}function bn(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function wn(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function Nn(e){if(Es(e)&&!e.isInline())return!0;if(!bs(e)||dn(e))return!1;const t=e.getFirstChild(),n=null===t||Gr(t)||hi(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function En(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}function Pn(){return ls()}const Fn=new WeakMap,Ln=new Map;function Dn(e){if(!e._readOnly&&e.isEmpty())return Ln;e._readOnly||Re(192);let t=Fn.get(e);if(!t){t=new Map,Fn.set(e,t);for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}}return t}function On(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Mn(e,t){const n=(parseInt(e.style.paddingInlineStart,10)||0)/40;t.setIndent(n)}function In(e){e.__lexicalUnmanaged=!0}function An(e){return!0===e.__lexicalUnmanaged}function Bn(e,t,n,r,i,s){let o=e.getFirstChild();for(;null!==o;){const e=o.__key;o.__parent===t&&(bs(o)&&Bn(o,e,n,r,i,s),n.has(e)||s.delete(e),i.push(e)),o=o.getNextSibling()}}let zn,Wn,Rn,Kn,Jn,$n,Un,Vn,jn,Hn,qn="",Gn="",Qn=null,Xn="",Yn="",Zn=!1,er=!1,tr=null;function nr(e,t){const n=Un.get(e);if(null!==t){const n=xr(e);n.parentNode===t&&t.removeChild(n)}if(Vn.has(e)||Wn._keyToDOMMap.delete(e),bs(n)){const e=gr(n,Un);rr(e,0,e.length-1,null)}void 0!==n&&Gt(Hn,Rn,Kn,n,"destroyed")}function rr(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&nr(t,r)}}function ir(e,t){e.setProperty("text-align",t)}const sr="40px";function or(e,t){const n=zn.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||sr;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function lr(e,t){const n=e.style;0===t?ir(n,""):t===ve?ir(n,"left"):t===Se?ir(n,"center"):t===Ce?ir(n,"right"):t===Te?ir(n,"justify"):t===ke?ir(n,"start"):t===be&&ir(n,"end")}function cr(e,t){const n=Vn.get(e);void 0===n&&Re(60);const r=n.createDOM(zn,Wn);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,Wn),hi(n)?r.setAttribute("data-lexical-text","true"):Es(n)&&r.setAttribute("data-lexical-decorator","true"),bs(n)){const e=n.__indent,t=n.__size;if(0!==e&&or(r,e),0!==t){const e=t-1;!function(e,t,n,r){const i=Gn;Gn="",ar(e,n,0,t,n.getDOMSlot(r)),dr(n,r),Gn=i}(gr(n,Vn),e,n,r)}const i=n.__format;0!==i&&lr(r,i),n.isInline()||fr(null,n,r),tn(n)&&(qn+=Ne,Yn+=Ne)}else{const t=n.getTextContent();if(Es(n)){const t=n.decorate(Wn,zn);null!==t&&pr(e,t),r.contentEditable="false"}else hi(n)&&(n.isDirectionless()||(Gn+=t));qn+=t,Yn+=t}return null!==t&&t.insertChild(r),Gt(Hn,Rn,Kn,n,"created"),r}function ar(e,t,n,r,i){const s=qn;qn="";let o=n;for(;o<=r;++o){cr(e[o],i);const t=Vn.get(e[o]);null!==t&&hi(t)&&(null===Qn&&(Qn=t.getFormat()),""===Xn&&(Xn=t.getStyle()))}tn(t)&&(qn+=Ne);i.element.__lexicalTextContent=qn,qn=s+qn}function ur(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return Gr(e)?"line-break":Es(e)&&e.isInline()?"decorator":null}return"empty"}return null}function fr(e,t,n){const r=ur(e,Un),i=ur(t,Vn);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function dr(e,t){const n=t.__lexicalDirTextContent||"",r=t.__lexicalDir||"";if(n!==Gn||r!==tr){const n=""===Gn,s=n?tr:(i=Gn,Le.test(i)?"rtl":De.test(i)?"ltr":null);if(s!==r){const i=t.classList,o=zn.theme;let l=null!==r?o[r]:void 0,c=null!==s?o[s]:void 0;if(void 0!==l){if("string"==typeof l){const e=Ke(l);l=o[r]=e}i.remove(...l)}if(null===s||n&&"ltr"===s)t.removeAttribute("dir");else{if(void 0!==c){if("string"==typeof c){const e=Ke(c);c=o[s]=e}void 0!==c&&i.add(...c)}t.dir=s}if(!er){e.getWritable().__dir=s}}tr=s,t.__lexicalDirTextContent=Gn,t.__lexicalDir=s}var i}function hr(e,t,n){const r=Gn;var i;Gn="",Qn=null,Xn="",function(e,t,n){const r=qn,i=e.__size,s=t.__size;qn="";const o=n.element;if(1===i&&1===s){const n=e.__first,r=t.__first;if(n===r)_r(n,o);else{const e=xr(n),t=cr(r,null);try{o.replaceChild(t,e)}catch(i){if("object"==typeof i&&null!=i){const s=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(s)}throw i}nr(n,null)}const i=Vn.get(r);hi(i)&&(null===Qn&&(Qn=i.getFormat()),""===Xn&&(Xn=i.getStyle()))}else{const r=gr(e,Un),l=gr(t,Vn);if(r.length!==i&&Re(227),l.length!==s&&Re(228),0===i)0!==s&&ar(l,t,0,s-1,n);else if(0===s){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;rr(r,0,i-1,e?null:o),e&&(o.textContent="")}}else!function(e,t,n,r,i,s){const o=r-1,l=i-1;let c,a,u=s.getFirstChild(),f=0,d=0;for(;f<=o&&d<=l;){const e=t[f],r=n[d];if(e===r)u=yr(_r(r,s.element)),f++,d++;else{void 0===c&&(c=new Set(t)),void 0===a&&(a=new Set(n));const i=a.has(e),o=c.has(r);if(i)if(o){const e=nn(Wn,r);e===u?u=yr(_r(r,s.element)):(s.withBefore(u).insertChild(e),_r(r,s.element)),f++,d++}else cr(r,s.withBefore(u)),d++;else u=yr(xr(e)),nr(e,s.element),f++}const i=Vn.get(r);null!==i&&hi(i)&&(null===Qn&&(Qn=i.getFormat()),""===Xn&&(Xn=i.getStyle()))}const h=f>o,g=d>l;if(h&&!g){const t=n[l+1],r=void 0===t?null:Wn.getElementByKey(t);ar(n,e,d,l,s.withBefore(r))}else g&&!h&&rr(t,f,o,s.element)}(t,r,l,i,s,n)}tn(t)&&(qn+=Ne);o.__lexicalTextContent=qn,qn=r+qn}(e,t,t.getDOMSlot(n)),dr(t,n),zs(i=t)&&null!=Qn&&Qn!==i.__textFormat&&!er&&(i.setTextFormat(Qn),i.setTextStyle(Xn)),function(e){zs(e)&&""!==Xn&&Xn!==e.__textStyle&&!er&&e.setTextStyle(Xn)}(t),Gn=r}function gr(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&Re(101),n.push(r),r=e.__next}return n}function _r(e,t){const n=Un.get(e);let r=Vn.get(e);void 0!==n&&void 0!==r||Re(61);const i=Zn||$n.has(e)||Jn.has(e),s=nn(Wn,e);if(n===r&&!i){if(bs(n)){const e=s.__lexicalTextContent;void 0!==e&&(qn+=e,Yn+=e);const t=s.__lexicalDirTextContent;void 0!==t&&(Gn+=t)}else{const e=n.getTextContent();hi(n)&&!n.isDirectionless()&&(Gn+=e),Yn+=e,qn+=e}return s}if(n!==r&&i&&Gt(Hn,Rn,Kn,r,"updated"),r.updateDOM(n,s,zn)){const n=cr(e,null);return null===t&&Re(62),t.replaceChild(n,s),nr(e,null),n}if(bs(n)&&bs(r)){const e=r.__indent;e!==n.__indent&&or(s,e);const t=r.__format;t!==n.__format&&lr(s,t),i&&(hr(n,r,s),Fs(r)||r.isInline()||fr(n,r,s)),tn(r)&&(qn+=Ne,Yn+=Ne)}else{const t=r.getTextContent();if(Es(r)){const t=r.decorate(Wn,zn);null!==t&&pr(e,t)}else hi(r)&&!r.isDirectionless()&&(Gn+=t);qn+=t,Yn+=t}if(!er&&Fs(r)&&r.__cachedText!==Yn){const e=r.getWritable();e.__cachedText=Yn,r=e}return s}function pr(e,t){let n=Wn._pendingDecorators;const r=Wn._decorators;if(null===n){if(r[e]===t)return;n=wt(Wn)}n[e]=t}function yr(e){let t=e.nextSibling;return null!==t&&t===Wn._blockCursorElement&&(t=t.nextSibling),t}function mr(e,t,n,r,i,s){qn="",Yn="",Gn="",Zn=r===le,tr=null,Wn=n,zn=n._config,Rn=n._nodes,Kn=Wn._listeners.mutation,Jn=i,$n=s,Un=e._nodeMap,Vn=t._nodeMap,er=t._readOnly,jn=new Map(n._keyToDOMMap);const o=new Map;return Hn=o,_r("root",null),Wn=void 0,Rn=void 0,Jn=void 0,$n=void 0,Un=void 0,Vn=void 0,zn=void 0,jn=void 0,Hn=void 0,o}function xr(e){const t=jn.get(e);return void 0===t&&Re(75,e),t}const vr=Object.freeze({}),Sr=30,Cr=[["keydown",function(e,t){if(Tr=e.timeStamp,kr=e.key,t.isComposing())return;const{key:n,shiftKey:r,ctrlKey:o,metaKey:l,altKey:c}=e;if(en(t,_,e))return;if(null==n)return;if(function(e,t,n,r){return Kt(e)&&!t&&!r&&!n}(n,o,c,l))en(t,p,e);else if(function(e,t,n,r,i){return Kt(e)&&!r&&!n&&(t||i)}(n,o,r,c,l))en(t,y,e);else if(function(e,t,n,r){return Rt(e)&&!t&&!r&&!n}(n,o,c,l))en(t,m,e);else if(function(e,t,n,r,i){return Rt(e)&&!r&&!n&&(t||i)}(n,o,r,c,l))en(t,x,e);else if(function(e,t,n){return function(e){return"ArrowUp"===e}(e)&&!t&&!n}(n,o,l))en(t,v,e);else if(function(e,t,n){return function(e){return"ArrowDown"===e}(e)&&!t&&!n}(n,o,l))en(t,S,e);else if(function(e,t){return $t(e)&&t}(n,r))Fr=!0,en(t,C,e);else if(function(e){return" "===e}(n))en(t,T,e);else if(function(e,t){return q&&t&&"o"===e.toLowerCase()}(n,o))e.preventDefault(),Fr=!0,en(t,s,!0);else if(function(e,t){return $t(e)&&!t}(n,r))Fr=!1,en(t,C,e);else if(function(e,t,n,r){return q?!t&&!n&&(Ut(e)||"h"===e.toLowerCase()&&r):!(r||t||n)&&Ut(e)}(n,c,l,o))Ut(n)?en(t,k,e):(e.preventDefault(),en(t,i,!0));else if(function(e){return"Escape"===e}(n))en(t,b,e);else if(function(e,t,n,r,i){return q?!(n||r||i)&&(Vt(e)||"d"===e.toLowerCase()&&t):!(t||r||i)&&Vt(e)}(n,o,r,c,l))Vt(n)?en(t,w,e):(e.preventDefault(),en(t,i,!1));else if(function(e,t,n){return Ut(e)&&(q?t:n)}(n,c,o))e.preventDefault(),en(t,u,!0);else if(function(e,t,n){return Vt(e)&&(q?t:n)}(n,c,o))e.preventDefault(),en(t,u,!1);else if(function(e,t){return q&&t&&Ut(e)}(n,l))e.preventDefault(),en(t,f,!0);else if(function(e,t){return q&&t&&Vt(e)}(n,l))e.preventDefault(),en(t,f,!1);else if(function(e,t,n,r){return"b"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"bold");else if(function(e,t,n,r){return"u"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"underline");else if(function(e,t,n,r){return"i"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"italic");else if(function(e,t,n,r){return"Tab"===e&&!t&&!n&&!r}(n,c,o,l))en(t,N,e);else if(function(e,t,n,r){return"z"===e.toLowerCase()&&!t&&Jt(n,r)}(n,r,l,o))e.preventDefault(),en(t,h,void 0);else if(function(e,t,n,r){return q?"z"===e.toLowerCase()&&n&&t:"y"===e.toLowerCase()&&r||"z"===e.toLowerCase()&&r&&t}(n,r,l,o))e.preventDefault(),en(t,g,void 0);else{const i=t._editorState._selection;null===i||ki(i)?!G&&jt(n,l,o)&&(e.preventDefault(),en(t,z,e)):!function(e,t,n,r){return!t&&"c"===e.toLowerCase()&&(q?n:r)}(n,r,l,o)?!function(e,t,n,r){return!t&&"x"===e.toLowerCase()&&(q?n:r)}(n,r,l,o)?jt(n,l,o)&&(e.preventDefault(),en(t,z,e)):(e.preventDefault(),en(t,B,e)):(e.preventDefault(),en(t,A,e))}(function(e,t,n,r){return e||t||n||r})(o,r,c,l)&&en(t,V,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;n instanceof Node&&"touch"!==r&&Ss(t,(()=>{Es(bt(n))||(Pr=!0)}))}],["compositionstart",function(e,t){Ss(t,(()=>{const n=Ri();if(ki(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();vt(r.key),(e.timeStamp<Tr+Sr||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||hi(i)&&i.getStyle()!==n.style)&&en(t,l,Ee)}}))}],["compositionend",function(e,t){G?Lr=!0:Ss(t,(()=>{Br(t,e.data)}))}],["input",function(e,t){e.stopPropagation(),Ss(t,(()=>{const n=Ri(),r=e.data,i=Ar(e);if(null!=r&&ki(n)&&Or(n,i,r,e.timeStamp,!1)){Lr&&(Br(t,r),Lr=!1);const i=n.anchor.getNode(),s=vn(t._window);if(null===s)return;const o=n.isBackward(),c=o?n.anchor.offset:n.focus.offset,a=o?n.focus.offset:n.anchor.offset;Q&&!n.isCollapsed()&&hi(i)&&null!==s.anchorNode&&i.getTextContent().slice(0,c)+r+i.getTextContent().slice(c+a)===At(s.anchorNode)||en(t,l,r);const u=r.length;G&&u>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=u),X||Y||ne||!t.isComposing()||(Tr=0,vt(null))}else{Bt(!1,t,null!==r?r:void 0),Lr&&(Br(t,r||void 0),Lr=!1)}is(),Xe(ls())})),wr=null}],["click",function(e,t){Ss(t,(()=>{const n=Ri(),i=vn(t._window),s=Ki();if(i)if(ki(n)){const t=n.anchor,r=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!Fs(r)&&1===Et().getChildrenSize()&&r.getTopLevelElementOrThrow().isEmpty()&&null!==s&&n.is(s))i.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()){r!==n.focus.getNode()&&(bs(r)?r.select(0):r.getParentOrThrow().select(0))}}else if("touch"===e.pointerType){const n=i.anchorNode;if(null!==n){const r=n.nodeType;if(r===re||r===ie){Ft(Wi(s,i,t,e))}}}en(t,r,e)}))}],["cut",vr],["copy",vr],["dragstart",vr],["dragover",vr],["dragend",vr],["paste",vr],["focus",vr],["blur",vr],["drop",vr]];Q&&Cr.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=Ar(e);if("deleteCompositionText"===n||G&&Zt(t))return;if("insertCompositionText"===n)return;Ss(t,(()=>{const _=Ri();if("deleteContentBackward"===n){if(null===_){const e=Ki();if(!ki(e))return;Ft(e.clone())}if(ki(_)){const n=_.anchor.key===_.focus.key;if(p=e.timeStamp,"MediaLast"===kr&&p<Tr+Sr&&t.isComposing()&&n){if(vt(null),Tr=0,setTimeout((()=>{Ss(t,(()=>{vt(null)}))}),Sr),ki(_)){const e=_.anchor.getNode();e.markDirty(),_.format=e.getFormat(),hi(e)||Re(142),_.style=e.getStyle()}}else{vt(null),e.preventDefault();const r=_.anchor.getNode(),s=r.getTextContent(),o=r.canInsertTextAfter(),l=0===_.anchor.offset&&_.focus.offset===s.length;te&&n&&!l&&o||en(t,i,!0)}return}}var p;if(!ki(_))return;const y=e.data;null!==wr&&Bt(!1,t,wr),_.dirty&&null===wr||!_.isCollapsed()||Fs(_.anchor.getNode())||null===r||_.applyDOMRange(r),wr=null;const m=_.anchor,x=_.focus,v=m.getNode(),S=x.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":en(t,l,e);break;case"insertFromComposition":vt(null),en(t,l,e);break;case"insertLineBreak":vt(null),en(t,s,!1);break;case"insertParagraph":vt(null),Fr&&!Y?(Fr=!1,en(t,s,!1)):en(t,o,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":en(t,c,e);break;case"deleteByComposition":(function(e,t){return e!==t||bs(e)||bs(t)||!e.isToken()||!t.isToken()})(v,S)&&en(t,a,e);break;case"deleteByDrag":case"deleteByCut":en(t,a,e);break;case"deleteContent":en(t,i,!1);break;case"deleteWordBackward":en(t,u,!0);break;case"deleteWordForward":en(t,u,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":en(t,f,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":en(t,f,!1);break;case"formatStrikeThrough":en(t,d,"strikethrough");break;case"formatBold":en(t,d,"bold");break;case"formatItalic":en(t,d,"italic");break;case"formatUnderline":en(t,d,"underline");break;case"historyUndo":en(t,h,void 0);break;case"historyRedo":en(t,g,void 0)}else{if("\n"===y)e.preventDefault(),en(t,s,!1);else if(y===Ne)e.preventDefault(),en(t,o,void 0);else if(null==y&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),_.insertRawText(t)}else null!=y&&Or(_,r,y,e.timeStamp,!0)?(e.preventDefault(),en(t,l,y)):wr=y;br=e.timeStamp}}))}(e,t)]);let Tr=0,kr=null,br=0,wr=null;const Nr=new WeakMap;let Er=!1,Pr=!1,Fr=!1,Lr=!1,Dr=[0,"",0,"root",0];function Or(e,t,n,r,i){const s=e.anchor,o=e.focus,l=s.getNode(),c=ls(),a=vn(c._window),u=null!==a?a.anchorNode:null,f=s.key,d=c.getElementByKey(f),h=n.length;return f!==o.key||!hi(l)||(!i&&(!Q||br<r+50)||l.isDirty()&&h<2||Ot(n))&&s.offset!==o.offset&&!l.isComposing()||dt(l)||l.isDirty()&&h>1||(i||!Q)&&null!==d&&!l.isComposing()&&u!==gt(d)||null!==a&&null!==t&&(!t.collapsed||t.startContainer!==a.anchorNode||t.startOffset!==a.anchorOffset)||l.getFormat()!==e.format||l.getStyle()!==e.style||Wt(e,l)}function Mr(e,t){return null!==e&&null!==e.nodeValue&&e.nodeType===ie&&0!==t&&t!==e.nodeValue.length}function Ir(e,n,r){const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=e;Er&&(Er=!1,Mr(i,s)&&Mr(o,l))||Ss(n,(()=>{if(!r)return void Ft(null);if(!ct(n,i,o))return;const c=Ri();if(ki(c)){const t=c.anchor,r=t.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=an(n).event,s=i?i.timeStamp:performance.now(),[o,l,a,u,f]=Dr,d=Et(),h=!1===n.isComposing()&&""===d.getTextContent();if(s<f+200&&t.offset===a&&t.key===u)c.format=o,c.style=l;else if("text"===t.type)hi(r)||Re(141),c.format=r.getFormat(),c.style=r.getStyle();else if("element"===t.type&&!h){const e=t.getNode();c.style="",e instanceof Is&&0===e.getChildrenSize()?(c.format=e.getTextFormat(),c.style=e.getTextStyle()):c.format=0}}else{const e=t.key,n=c.focus.key,r=c.getNodes(),i=r.length,o=c.isBackward(),a=o?l:s,u=o?s:l,f=o?n:e,d=o?e:n;let h=xe,g=!1;for(let e=0;e<i;e++){const t=r[e],n=t.getTextContentSize();if(hi(t)&&0!==n&&!(0===e&&t.__key===f&&a===n||e===i-1&&t.__key===d&&0===u)&&(g=!0,h&=t.getFormat(),0===h))break}c.format=g?h:0}}en(n,t,void 0)}))}function Ar(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function Br(e,t){const n=e._compositionKey;if(vt(null),null!==n&&null!=t){if(""===t){const t=Ct(n),r=gt(e.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&hi(t)&&zt(t,r.nodeValue,null,null,!0))}if("\n"===t[t.length-1]){const t=Ri();if(ki(t)){const n=t.focus;return t.anchor.set(n.key,n.offset,n.type),void en(e,C,null)}}}Bt(!0,e,t)}function zr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Wr=new Map;function Rr(e){const t=e.target,n=vn(null==t?null:9===t.nodeType?t.defaultView:t.ownerDocument.defaultView);if(null===n)return;const r=ut(n.anchorNode);if(null===r)return;Pr&&(Pr=!1,Ss(r,(()=>{const t=Ki(),i=n.anchorNode;if(null===i)return;const s=i.nodeType;if(s!==re&&s!==ie)return;Ft(Wi(t,n,r,e))})));const i=Mt(r),s=i[i.length-1],o=s._key,l=Wr.get(o),c=l||s;c!==r&&Ir(n,c,!1),Ir(n,r,!0),r!==s?Wr.set(o,r):l&&Wr.delete(o)}function Kr(e){e._lexicalHandled=!0}function Jr(e){return!0===e._lexicalHandled}function $r(e){const t=e.ownerDocument,n=Nr.get(t);void 0===n&&Re(162);const r=n-1;r>=0||Re(164),Nr.set(t,r),0===r&&t.removeEventListener("selectionchange",Rr);const i=ft(e);at(i)?(!function(e){if(null!==e._parentEditor){const t=Mt(e),n=t[t.length-1]._key;Wr.get(n)===e&&Wr.delete(n)}else Wr.delete(e._key)}(i),e.__lexicalEditor=null):i&&Re(198);const s=zr(e);for(let e=0;e<s.length;e++)s[e]();e.__lexicalEventHandles=[]}function Ur(e,t,n){is();const r=e.__key,i=e.getParent();if(null===i)return;const s=function(e){const t=Ri();if(!ki(t)||!bs(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),s=r.getNode();return cn(i,e)&&n.set(e.__key,0,"element"),cn(s,e)&&r.set(e.__key,0,"element"),t}(e);let o=!1;if(ki(s)&&t){const t=s.anchor,n=s.focus;t.key===r&&(Ui(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Ui(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else wi(s)&&t&&e.isSelected()&&e.selectPrevious();if(ki(s)&&t&&!o){const t=e.getIndexWithinParent();mt(e),Ji(s,i,t,-1)}else mt(e);n||dn(i)||i.canBeEmpty()||!i.isEmpty()||Ur(i,t),t&&Fs(i)&&i.isEmpty()&&i.selectEnd()}class Vr{static getType(){Re(64,this.name)}static clone(e){Re(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,yt(this,e)}getType(){return this.__type}isInline(){Re(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=Ct(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||Ri();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(hi(this))return n;if(ki(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Es(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor,r=n.getNode();if(n.offset===r.getChildrenSize()&&r.is(e)&&r.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Ct(e)}getParentOrThrow(){const e=this.getParent();return null===e&&Re(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(dn(t))return bs(e)||e===this&&Es(e)||Re(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&Re(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Ct(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Ct(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();bs(this)&&t.unshift(this),bs(e)&&n.unshift(e);const r=t.length,i=n.length;if(0===r||0===i||t[r-1]!==n[i-1])return null;const s=new Set(n);for(let e=0;e<r;e++){const n=t[e];if(s.has(n))return n}return null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,r=0,i=this;for(;;){const e=i.getParentOrThrow();if(e===t){n=i.getIndexWithinParent();break}i=e}for(i=e;;){const e=i.getParentOrThrow();if(e===t){r=i.getIndexWithinParent();break}i=e}return n<r}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;null!==n;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;const o=bs(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==o){i=o;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let a=null,u=c;do{if(null===u&&Re(68),a=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==a||r.has(u.__key)||n.push(u)}while(null===a);i=a}return t||n.reverse(),n}isDirty(){const e=ls()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=Ct(this.__key);return null===e&&Re(113),e}getWritable(){is();const e=os(),t=ls(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,o=Ri();if(null!==o&&o.setCachedNodes(null),s.has(r))return xt(i),i;const l=On(i);return s.add(r),xt(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){Re(70)}updateDOM(e,t,n){Re(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){Re(72)}static importJSON(e){Re(18,this.name)}static transform(){return null}remove(e){Ur(this,!0,e)}replace(e,t){is();let n=Ri();null!==n&&(n=n.clone()),_n(this,e);const r=this.getLatest(),i=this.__key,s=e.__key,o=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;mt(o);const a=r.getPreviousSibling(),u=r.getNextSibling(),f=r.__prev,d=r.__next,h=r.__parent;if(Ur(r,!1,!0),null===a)l.__first=s;else{a.getWritable().__next=s}if(o.__prev=f,null===u)l.__last=s;else{u.getWritable().__prev=s}if(o.__next=d,o.__parent=h,l.__size=c,t&&(bs(this)&&bs(o)||Re(139),this.getChildren().forEach((e=>{o.append(e)}))),ki(n)){Ft(n);const e=n.anchor,t=n.focus;e.key===i&&Si(e,o),t.key===i&&Si(t,o)}return St()===i&&vt(s),o}insertAfter(e,t=!0){is(),_n(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=Ri();let o=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(mt(r),ki(s)){const e=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else{c.getWritable().__prev=u}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,t&&ki(s)){const e=this.getIndexWithinParent();Ji(s,a,e+1);const t=a.__key;o&&s.anchor.set(t,e+2,"element"),l&&s.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){is(),_n(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;mt(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===s)o.__first=i;else{s.getWritable().__next=i}o.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Ri();if(t&&ki(a)){Ji(a,this.getParentOrThrow(),c)}return e}isParentRequired(){return!1}createParentElementNode(){return Bs()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){is();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(bs(n))return n.select();if(!hi(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){is();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(bs(n))return n.select(0,0);if(!hi(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class jr extends Vr{static getType(){return"linebreak"}static clone(e){return new jr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&wn(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Qr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&Qr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&wn(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Qr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&Qr(r))return!0}return!1}(e)?null:{conversion:Hr,priority:0}}}static importJSON(e){return qr()}exportJSON(){return{type:"linebreak",version:1}}}function Hr(e){return{node:qr()}}function qr(){return gn(new jr)}function Gr(e){return e instanceof jr}function Qr(e){return e.nodeType===ie&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Xr(e,t){return 16&t?"code":t&me?"mark":32&t?"sub":64&t?"sup":null}function Yr(e,t){return 1&t?"strong":2&t?"em":"span"}function Zr(e,t,n,r,i){const s=r.classList;let o=qt(i,"base");void 0!==o&&s.add(...o),o=qt(i,"underlineStrikethrough");let l=!1;const c=t&ge&&t&he;void 0!==o&&(n&ge&&n&he?(l=!0,c||s.add(...o)):c&&s.remove(...o));for(const e in Oe){const r=Oe[e];if(o=qt(i,e),void 0!==o)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&s.remove(...o);continue}t&r&&(!c||"underline"!==e)&&"strikethrough"!==e||s.add(...o)}else t&r&&s.remove(...o)}}function ei(e,t,n){const r=t.firstChild,i=n.isComposing(),s=e+(i?we:"");if(null==r)t.textContent=s;else{const e=r.nodeValue;if(e!==s)if(i||G){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,s=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;s+i<n&&s+i<r&&e[n-s-1]===t[r-s-1];)s++;return[i,n-i-s,t.slice(i,r-s)]}(e,s);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=s}}function ti(e,t,n,r,i,s){ei(i,e,t);const o=s.theme.text;void 0!==o&&Zr(0,0,r,e,o)}function ni(e,t){const n=document.createElement(t);return n.appendChild(e),n}class ri extends Vr{static getType(){return"text"}static clone(e){return new ri(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return ze[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===St()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Oe[e];return!!(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return _t(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,r=Xr(0,n),i=Yr(0,n),s=null===r?i:r,o=document.createElement(s);let l=o;this.hasFormat("code")&&o.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),o.appendChild(l));ti(l,this,0,n,this.__text,e);const c=this.__style;return""!==c&&(o.style.cssText=c),o}updateDOM(e,t,n){const r=this.__text,i=e.__format,s=this.__format,o=Xr(0,i),l=Xr(0,s),c=Yr(0,i),a=Yr(0,s);if((null===o?c:o)!==(null===l?a:l))return!0;if(o===l&&c!==a){const e=t.firstChild;null==e&&Re(48);const i=document.createElement(a);return ti(i,this,0,s,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==o&&(u=t.firstChild,null==u&&Re(49)),ei(r,u,this);const f=n.theme.text;void 0!==f&&i!==s&&Zr(0,i,s,u,f);const d=e.__style,h=this.__style;return d!==h&&(t.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:ci,priority:0}),b:()=>({conversion:si,priority:0}),code:()=>({conversion:fi,priority:0}),em:()=>({conversion:fi,priority:0}),i:()=>({conversion:fi,priority:0}),s:()=>({conversion:fi,priority:0}),span:()=>({conversion:ii,priority:0}),strong:()=>({conversion:fi,priority:0}),sub:()=>({conversion:fi,priority:0}),sup:()=>({conversion:fi,priority:0}),u:()=>({conversion:fi,priority:0})}}static importJSON(e){const t=di(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return null!==t&&Tn(t)||Re(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=ni(t,"b")),this.hasFormat("italic")&&(t=ni(t,"i")),this.hasFormat("strikethrough")&&(t=ni(t,"s")),this.hasFormat("underline")&&(t=ni(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Oe[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Me[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=_t(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Be[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){is();let n=e,r=t;const i=Ri(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const e=s.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!ki(i))return Ii(o,n,o,r,"text","text");{const e=St();e!==i.anchor.key&&e!==i.focus.key||vt(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let l=e;l<0&&(l=o+l,l<0&&(l=0));const c=Ri();if(r&&ki(c)){const t=e+o;c.setTextNodeRange(i,t,i,t)}const a=s.slice(0,l)+n+s.slice(l+t);return i.__text=a,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){is();const t=this.getLatest(),n=t.getTextContent(),r=t.__key,i=St(),s=new Set(e),o=[],l=n.length;let c="";for(let e=0;e<l;e++)""!==c&&s.has(e)&&(o.push(c),c=""),c+=n[e];""!==c&&o.push(c);const a=o.length;if(0===a)return[];if(o[0]===n)return[t];const u=o[0],f=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),_=t.__detail;let p=!1;t.isSegmented()?(d=di(u),d.__format=h,d.__style=g,d.__detail=_,p=!0):(d=t.getWritable(),d.__text=u);const y=Ri(),m=[d];let x=u.length;for(let e=1;e<a;e++){const t=o[e],n=t.length,s=di(t).getWritable();s.__format=h,s.__style=g,s.__detail=_;const l=s.__key,c=x+n;if(ki(y)){const e=y.anchor,t=y.focus;e.key===r&&"text"===e.type&&e.offset>x&&e.offset<=c&&(e.key=l,e.offset-=x,y.dirty=!0),t.key===r&&"text"===t.type&&t.offset>x&&t.offset<=c&&(t.key=l,t.offset-=x,y.dirty=!0)}i===r&&vt(l),x=c,m.push(s)}if(null!==f){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&xt(t),null!==n&&xt(n)}(this);const e=f.getWritable(),t=this.getIndexWithinParent();p?(e.splice(t,0,m),this.remove()):e.splice(t,1,m),ki(y)&&Ji(y,f,t,a-1)}return m}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||Re(50);const n=this.__key,r=e.__key,i=this.__text,s=i.length;St()===r&&vt(n);const o=Ri();if(ki(o)){const i=o.anchor,l=o.focus;null!==i&&i.key===r&&(Vi(i,t,n,e,s),o.dirty=!0),null!==l&&l.key===r&&(Vi(l,t,n,e,s),o.dirty=!0)}const l=e.__text,c=t?l+i:i+l;this.setTextContent(c);const a=this.getWritable();return e.remove(),a}isTextEntity(){return!1}}function ii(e){return{forChild:gi(e.style),node:null}}function si(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:gi(t.style,n?void 0:"bold"),node:null}}const oi=new WeakMap;function li(e){return"PRE"===e.nodeName||e.nodeType===re&&void 0!==e.style&&void 0!==e.style.whiteSpace&&e.style.whiteSpace.startsWith("pre")}function ci(e){const t=e;null===e.parentElement&&Re(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=oi.get(n))&&!li(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)oi.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(qr()):"\t"===r?t.push(pi()):""!==r&&t.push(di(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=ai(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=ai(e,!0));){if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:di(n)}}function ai(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,n.nodeType===re){const e=n.style.display;if(""===e&&!bn(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(n.nodeType===ie)return n;if("BR"===n.nodeName)return null}}const ui={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function fi(e){const t=ui[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:gi(e.style,t),node:null}}function di(e=""){return gn(new ri(e))}function hi(e){return e instanceof ri}function gi(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===e.fontStyle,l=r.includes("underline"),c=e.verticalAlign;return e=>hi(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),o&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==c||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==c||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class _i extends ri{static getType(){return"tab"}static clone(e){return new _i(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=pi();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){Re(126)}setDetail(e){Re(127)}setMode(e){Re(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function pi(){return gn(new _i)}function yi(e){return e instanceof _i}class mi{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const r=this.offset,i=e.offset;if(bs(t)){const e=t.getDescendantByIndex(r);t=null!=e?e:t}if(bs(n)){const e=n.getDescendantByIndex(i);n=null!=e?e:n}return t===n?r<i:t.isBefore(n)}getNode(){const e=Ct(this.key);return null===e&&Re(20),e}set(e,t,n){const r=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,rs()||(St()===i&&vt(e),null!==r&&(r.setCachedNodes(null),r.dirty=!0))}}function xi(e,t,n){return new mi(e,t,n)}function vi(e,t){let n=t.__key,r=e.offset,i="element";if(hi(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!bs(t)){const e=t.getNextSibling();if(hi(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Si(e,t){if(bs(t)){const n=t.getLastDescendant();bs(n)||hi(n)?vi(e,n):vi(e,t)}else vi(e,t)}function Ci(e,t,n,r){e.key=t,e.offset=n,e.type=r}class Ti{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!wi(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Ti(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(hi(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=Ct(e);null!==t&&n.push(t)}return rs()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function ki(e){return e instanceof bi}class bi{constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!ki(e)&&(this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this.anchor,n=this.focus,r=t.isBefore(n),i=r?t:n,s=r?n:t;let o=i.getNode(),l=s.getNode();const c=i.offset,a=s.offset;if(bs(o)){const e=o.getDescendantByIndex(c);o=null!=e?e:o}if(bs(l)){let e=l.getDescendantByIndex(a);null!==e&&e!==o&&l.getChildAtIndex(a)===e&&(e=e.getPreviousSibling()),l=null!=e?e:l}let u;return u=o.is(l)?bs(o)&&o.getChildrenSize()>0?[]:[o]:o.getNodesBetween(l),rs()||(this._cachedNodes=u),u}setTextNodeRange(e,t,n,r){Ci(this.anchor,e.__key,t,"text"),Ci(this.focus,n.__key,r,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,l]=Ei(this);let c="",a=!0;for(let u=0;u<e.length;u++){const f=e[u];if(bs(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,hi(f)){let e=f.getTextContent();f===t?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=o<l?e.slice(o,l):e.slice(l,o)):e=s?e.slice(o):e.slice(l):f===n&&(e=s?e.slice(0,l):e.slice(0,o)),c+=e}else!Es(f)&&!Gr(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(e){const t=ls(),n=t.getEditorState()._selection,r=Oi(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,s]=r;Ci(this.anchor,i.key,i.offset,i.type),Ci(this.focus,s.key,s.offset,s.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new bi(xi(e.key,e.offset,e.type),xi(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=_t(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Oe[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(qr()):"\t"===r?n.push(pi()):n.push(di(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let s=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(s=n,o=t),"element"===s.type&&function(e,t,n,r){const i=e.getNode(),s=i.getChildAtIndex(e.offset),o=di(),l=Fs(i)?Bs().append(o):o;o.setFormat(n),o.setStyle(r),null===s?i.append(l):s.insertBefore(l),e.is(t)&&t.set(o.__key,0,"text"),e.set(o.__key,0,"text")}(s,o,r,i);const l=s.offset;let c=o.offset;const a=this.getNodes(),u=a.length;let f=a[0];hi(f)||Re(26);const d=f.getTextContent().length,h=f.getParentOrThrow();let g=a[u-1];if(1===u&&"element"===o.type&&(c=d,o.set(s.key,c,"text")),this.isCollapsed()&&l===d&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!h.canInsertTextAfter()&&null===f.getNextSibling())){let t=f.getNextSibling();if(hi(t)&&t.canInsertTextBefore()&&!dt(t)||(t=di(),t.setFormat(r),t.setStyle(i),h.canInsertTextAfter()?f.insertAfter(t):h.insertAfter(t)),t.select(0,0),f=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!h.canInsertTextBefore()&&null===f.getPreviousSibling())){let t=f.getPreviousSibling();if(hi(t)&&!dt(t)||(t=di(),t.setFormat(r),h.canInsertTextBefore()?f.insertBefore(t):h.insertBefore(t)),t.select(),f=t,""!==e)return void this.insertText(e)}else if(f.isSegmented()&&l!==d){const e=di(f.getTextContent());e.setFormat(r),f.replace(e),f=e}else if(!this.isCollapsed()&&""!==e){const t=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||bs(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Di(this.anchor,this.focus,null),void this.insertText(e)}if(1===u){if(f.isToken()){const t=di(e);return t.select(),void f.replace(t)}const t=f.getFormat(),n=f.getStyle();if(l!==c||t===r&&n===i){if(yi(f)){const t=di(e);return t.setFormat(r),t.setStyle(i),t.select(),void f.replace(t)}}else{if(""!==f.getTextContent()){const t=di(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)f.insertBefore(t,!1);else{const[e]=f.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}f.setFormat(r),f.setStyle(i)}const s=c-l;f=f.spliceText(l,s,e,!0),""===f.getTextContent()?f.remove():"text"===this.anchor.type&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{const t=new Set([...f.getParentKeys(),...g.getParentKeys()]),n=bs(f)?f:f.getParentOrThrow();let r=bs(g)?g:g.getParentOrThrow(),i=g;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===o.type&&(0!==c||""===g.getTextContent())||"element"===o.type&&g.getIndexWithinParent()<c)if(hi(g)&&!g.isToken()&&c!==g.getTextContentSize()){if(g.isSegmented()){const e=di(g.getTextContent());g.replace(e),g=e}Fs(o.getNode())||"text"!==o.type||(g=g.spliceText(0,c,"")),t.add(g.__key)}else{const e=g.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?g.remove():e.remove()}else t.add(g.__key);const s=r.getChildren(),h=new Set(a),_=n.is(r),p=n.isInline()&&null===f.getNextSibling()?n:f;for(let e=s.length-1;e>=0;e--){const t=s[e];if(t.is(f)||bs(t)&&t.isParentOf(f))break;t.isAttached()&&(!h.has(t)||t.is(i)?_||p.insertAfter(t,!1):t.remove())}if(!_){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(f.isToken())if(l===d)f.select();else{const t=di(e);t.select(),f.replace(t)}else f=f.spliceText(l,d-l,e,!0),""===f.getTextContent()?f.remove():f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<u;e++){const n=a[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),r=this.isBackward()?t:e,i=this.isBackward()?e:t;let s=r.getNode(),o=i.getNode();const l=En(s,Nn),c=En(o,Nn);hi(s)&&s.isToken()&&r.offset<s.getTextContentSize()&&(r.offset=0),i.offset>0&&hi(o)&&o.isToken()&&(i.offset=o.getTextContentSize()),n.forEach((e=>{cn(s,e)||cn(o,e)||e.getKey()===s.getKey()||e.getKey()===o.getKey()||e.remove()}));const a=(e,t)=>{if(""===e.getTextContent())e.remove();else if(0!==t&&dt(e)){const t=di(e.getTextContent());return t.setFormat(e.getFormat()),t.setStyle(e.getStyle()),e.replace(t)}};if(s===o&&hi(s)){const n=Math.abs(t.offset-e.offset);return s.spliceText(r.offset,n,"",!0),void a(s,n)}if(hi(s)){const e=s.getTextContentSize()-r.offset;s.spliceText(r.offset,e,""),s=a(s,e)||s}hi(o)&&(o.spliceText(0,i.offset,""),o=a(o,i.offset)||o),s.isAttached()&&hi(s)?s.selectEnd():o.isAttached()&&hi(o)&&o.selectStart();bs(l)&&bs(c)&&l!==c&&(l.append(...c.getChildren()),c.remove(),i.set(r.key,r.offset,r.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void vt(null);const n=this.getNodes(),r=[];for(const e of n)hi(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(zs(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},s=r.length;if(0===s)return this.toggleFormat(e),vt(null),void i(t);const o=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:o,u=c?o:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(e,t);i(g);const _=s-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(dt(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const e=d.splitText(h,y),t=0===h?e[0]:e[1];t.setFormat(g),"text"===a.type&&a.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-h,"text")}return void(this.format=g)}0===h||dt(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(e,g);y>0&&(y===p.getTextContentSize()||dt(p)||([p]=p.splitText(y)),p.setFormat(m));for(let t=f+1;t<_;t++){const n=r[t],i=n.getFormatFlags(e,m);n.setFormat(i)}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m}insertNodes(e){if(0===e.length)return;if("root"===this.anchor.key){this.insertParagraph();const t=Ri();return ki(t)||Re(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=En(t,Nn),r=e[e.length-1];if(bs(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=Gi(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(bs(e)||Es(e))&&!e.isInline()))){bs(n)||Re(211,t.constructor.name,t.getType());const i=Gi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=Bs();let n=null;for(let r=0;r<e.length;r++){const i=e[r],s=Gr(i);if(s||Es(i)&&i.isInline()||bs(i)&&i.isInline()||hi(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),s))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),s=i.getLastDescendant(),o=i.getChildren(),l=!bs(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1];let a=o[0];var u;bs(u=a)&&Nn(u)&&!u.isEmpty()&&bs(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(bs(n)||Re(211,t.constructor.name,t.getType()),n.append(...a.getChildren()),a=o[1]),a&&(null===n&&Re(212,t.constructor.name,t.getType()),function(e,t,n){const r=t.getParentOrThrow().getLastChild();let i=t;const s=[t];for(;i!==r;)i.getNextSibling()||Re(140),i=i.getNextSibling(),s.push(i);let o=e;for(const e of s)o=o.insertAfter(e)}(n,a));const f=En(s,Nn);l&&bs(f)&&(l.canMergeWhenEmpty()||Nn(c))&&(f.append(...l.getChildren()),l.remove()),bs(n)&&n.isEmpty()&&n.remove(),s.selectEnd();const d=bs(n)?n.getLastChild():null;Gr(d)&&f!==n&&d.remove()}insertParagraph(){if("root"===this.anchor.key){const e=Bs();return Et().splice(this.anchor.offset,0,[e]),e.select(),e}const e=Gi(this),t=En(this.anchor.getNode(),Nn);bs(t)||Re(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=qr();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,r=this.anchor,i=this.focus;let s=e[0],o=e[n];const[l,c]=Ei(this);if(0===t)return[];if(1===t){if(hi(s)&&!this.isCollapsed()){const e=l>c?c:l,t=l>c?l:c,n=s.splitText(e,t),r=0===e?n[0]:n[1];return null!=r?[r]:[]}return[s]}const a=r.isBefore(i);if(hi(s)){const t=a?l:c;t===s.getTextContentSize()?e.shift():0!==t&&([,s]=s.splitText(t),e[0]=s)}if(hi(o)){const t=o.getTextContent().length,r=a?c:l;0===r?e.pop():r!==t&&([o]=o.splitText(r),e[n]=o)}return e}modify(e,t,n){const r=this.focus,i=this.anchor,s="move"===e,o=Yt(r,t);if(Es(o)&&!o.isIsolated()){if(s&&o.isKeyboardSelectable()){const e=Bi();return e.add(o.__key),void Ft(e)}const e=t?o.getPreviousSibling():o.getNextSibling();if(hi(e)){const n=e.__key,o=t?e.getTextContent().length:0;return r.set(n,o,"text"),void(s&&i.set(n,o,"text"))}{const n=o.getParentOrThrow();let l,c;return bs(e)?(c=e.__key,l=t?e.getChildrenSize():0):(l=o.getIndexWithinParent(),c=n.__key,t||l++),r.set(c,l,"element"),void(s&&i.set(c,l,"element"))}}const l=ls(),c=vn(l._window);if(!c)return;const a=l._blockCursorElement,u=l._rootElement;if(null===u||null===a||!bs(o)||o.isInline()||o.canBeEmpty()||mn(a,l,u),function(e,t,n,r){e.modify(t,n,r)}(c,e,t?"backward":"forward",n),c.rangeCount>0){const e=c.getRangeAt(0),n=this.anchor.getNode(),r=Fs(n)?n:fn(n);if(this.applyDOMRange(e),this.dirty=!0,!s){const n=this.getNodes(),i=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];cn(t,r)?i.push(t):s=!0}if(s&&i.length>0)if(t){const e=i[0];bs(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=i[i.length-1];bs(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}c.anchorNode===e.startContainer&&c.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,s=n.type;Ci(n,t.key,t.offset,t.type),Ci(t,r,i,s),e._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&bs(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(bs(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const n=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let r=n.getNode();if(this.forwardDeletion(n,r,e))return;const i=this.focus,s=Yt(i,e);if(Es(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&bs(r)&&0===r.getChildrenSize()){r.remove();const e=Bi();e.add(s.__key),Ft(e)}else{s.remove();ls().dispatchCommand(t,void 0)}return}if(!e&&bs(s)&&bs(r)&&r.isEmpty())return r.remove(),void s.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===n.offset){if(("element"===n.type?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}}else{const t="text"===i.type?i.getNode():null;if(r="text"===n.type?n.getNode():null,null!==t&&t.isSegmented()){const n=i.offset,s=t.getTextContentSize();if(t.is(r)||e&&n!==s||!e&&0!==n)return void Pi(t,e,n)}else if(null!==r&&r.isSegmented()){const i=n.offset,s=r.getTextContentSize();if(r.is(t)||e&&0!==i||!e&&i!==s)return void Pi(r,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode(),s=r.getNode();if(i===s&&"text"===n.type&&"text"===r.type){const e=n.offset,s=r.offset,o=e<s,l=o?e:s,c=o?s:e,a=c-1;if(l!==a){Ot(i.getTextContent().slice(l,c))||(t?r.offset=a:n.offset=a)}}}(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&Fs(e.getParent())&&0===e.getIndexWithinParent()&&e.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t="element"===this.anchor.type;if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&0===this.anchor.offset&&this.modify("extend",e,"character"),t){const t=e?this.anchor:this.focus;t.set(t.key,t.offset+1,t.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function wi(e){return e instanceof Ti}function Ni(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Ei(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Ni(n),Ni(r)]}function Pi(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let e=0;e<s;e++){const r=e===s-1;if(l=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function Fi(e,t,n,r){let i,s=t;if(e.nodeType===re){let o=!1;const l=e.childNodes,c=l.length,a=r._blockCursorElement;s===c&&(o=!0,s=c-1);let u=l[s],f=!1;if(u===a)u=l[s+1],f=!0;else if(null!==a){const n=a.parentNode;if(e===n){t>Array.prototype.indexOf.call(n.children,a)&&s--}}if(i=Lt(u),hi(i))s=Dt(i,o);else{let l=Lt(e);if(null===l)return null;if(bs(l)){const c=r.getElementByKey(l.getKey());null===c&&Re(214);const a=l.getDOMSlot(c);[l,s]=a.resolveChildIndex(l,c,e,t),bs(l)||Re(215),o&&s>=l.getChildrenSize()&&(s=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(s);if(bs(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=o?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=bs(u)?u:u.getParentOrThrow()),s=0}hi(u)?(i=u,l=null,s=Dt(u,o)):u!==l&&o&&!f&&(bs(l)||Re(216),s=Math.min(l.getChildrenSize(),s+1))}else{const n=l.getIndexWithinParent();s=0===t&&Es(l)&&Lt(e)===l?n:n+1,l=l.getParentOrThrow()}if(bs(l))return xi(l.__key,s,"element")}}else i=Lt(e);return hi(i)?xi(i.__key,s,"text"):null}function Li(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(t){if((n||!t)&&null===r&&bs(s)&&s.isInline()){const t=s.getPreviousSibling();hi(t)&&(e.key=t.__key,e.offset=t.getTextContent().length)}}else bs(r)&&!n&&r.isInline()?(e.key=r.__key,e.offset=r.getChildrenSize(),e.type="element"):hi(r)&&(e.key=r.__key,e.offset=r.getTextContent().length)}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(t&&bs(r)&&r.isInline())e.key=r.__key,e.offset=0,e.type="element";else if((n||t)&&null===r&&bs(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();hi(t)&&(e.key=t.__key,e.offset=0)}}}function Di(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);Li(e,r,i),Li(t,!r,i),i&&(t.key=e.key,t.offset=e.offset,t.type=e.type);const s=ls();if(s.isComposing()&&s._compositionKey!==e.key&&ki(n)){const r=n.anchor,i=n.focus;Ci(e,r.key,r.offset,r.type),Ci(t,i.key,i.offset,i.type)}}}function Oi(e,t,n,r,i,s){if(null===e||null===n||!ct(i,e,n))return null;const o=Fi(e,t,ki(s)?s.anchor:null,i);if(null===o)return null;const l=Fi(n,r,ki(s)?s.focus:null,i);if(null===l)return null;if("element"===o.type&&"element"===l.type){const t=Lt(e),r=Lt(n);if(Es(t)&&Es(r))return null}return Di(o,l,s),[o,l]}function Mi(e){return bs(e)&&!e.isInline()}function Ii(e,t,n,r,i,s){const o=os(),l=new bi(xi(e,t,i),xi(n,r,s),0,"");return l.dirty=!0,o._selection=l,l}function Ai(){const e=xi("root",0,"element"),t=xi("root",0,"element");return new bi(e,t,0,"")}function Bi(){return new Ti(new Set)}function zi(e,t){return Wi(null,e,t,null)}function Wi(e,t,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,l="selectionchange"===o,c=!$e&&(l||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let a,u,f,d;if(ki(e)&&!c)return e.clone();if(null===t)return null;if(a=t.anchorNode,u=t.focusNode,f=t.anchorOffset,d=t.focusOffset,l&&ki(e)&&!ct(n,a,u))return e.clone();const h=Oi(a,f,u,d,n,e);if(null===h)return null;const[g,_]=h;return new bi(g,_,ki(e)?e.format:0,ki(e)?e.style:"")}function Ri(){return os()._selection}function Ki(){return ls()._editorState._selection}function Ji(e,t,n,r=1){const i=e.anchor,s=e.focus,o=i.getNode(),l=s.getNode();if(!t.is(o)&&!t.is(l))return;const c=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(c,n,"element"),s.set(c,n,"element"),$i(e)}}else{const o=e.isBackward(),l=o?s:i,a=l.getNode(),u=o?i:s,f=u.getNode();if(t.is(a)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(c,Math.max(0,e+r),"element")}if(t.is(f)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),"element")}}$i(e)}function $i(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,s=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!bs(s))return;const e=s.getChildrenSize(),i=n>=e,o=i?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(hi(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,"text"),r.set(o.__key,e,"text")}}else{if(bs(s)){const e=s.getChildrenSize(),r=n>=e,i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(hi(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(bs(o)){const e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(hi(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function Ui(e,t,n,r,i){let s=null,o=0,l=null;null!==r?(s=r.__key,hi(r)?(o=r.getTextContentSize(),l="text"):bs(r)&&(o=r.getChildrenSize(),l="element")):null!==i&&(s=i.__key,hi(i)?l="text":bs(i)&&(l="element")),null!==s&&null!==l?e.set(s,o,l):(o=t.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),e.set(n.__key,o,"element"))}function Vi(e,t,n,r,i){"text"===e.type?(e.key=n,t||(e.offset+=i)):e.offset>r.getIndexWithinParent()&&(e.offset-=1)}function ji(e,t,n,r,i,s,o){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has("collaboration")&&f!==s||null!==f&<(f))return;if(!ki(t))return void(null!==e&&ct(n,l,c)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.key,_=h.key,p=nn(n,g),y=nn(n,_),m=d.offset,x=h.offset,v=t.format,S=t.style,C=t.isCollapsed();let T=p,k=y,b=!1;if("text"===d.type){T=gt(p);const e=d.getNode();b=e.getFormat()!==v||e.getStyle()!==S}else ki(e)&&"text"===e.anchor.type&&(b=!0);var w,N,E,P,F;if(("text"===h.type&&(k=gt(y)),null!==T&&null!==k)&&(C&&(null===e||b||ki(e)&&(e.format!==v||e.style!==S))&&(w=v,N=S,E=m,P=g,F=performance.now(),Dr=[w,N,E,P,F]),a!==m||u!==x||l!==T||c!==k||"Range"===r.type&&C||(null!==f&&s.contains(f)||s.focus({preventScroll:!0}),"element"===d.type))){try{r.setBaseAndExtent(T,m,k,x)}catch(e){}if(!i.has("skip-scroll-into-view")&&t.isCollapsed()&&null!==s&&s===document.activeElement){const e=t instanceof bi&&"element"===t.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=n.ownerDocument,i=r.defaultView;if(null===i)return;let{top:s,bottom:o}=t,l=0,c=0,a=n;for(;null!==a;){const t=a===r.body;if(t)l=0,c=an(e).innerHeight;else{const e=a.getBoundingClientRect();l=e.top,c=e.bottom}let n=0;if(s<l?n=-(l-s):o>c&&(n=o-c),0!==n)if(t)i.scrollBy(0,n);else{const e=a.scrollTop;a.scrollTop+=n;const t=a.scrollTop-e;s-=t,o-=t}if(t)break;a=rn(a)}}(n,t,s)}}Er=!0}}function Hi(e){let t=Ri()||Ki();null===t&&(t=Et().selectEnd()),t.insertNodes(e)}function qi(){const e=Ri();return null===e?"":e.getTextContent()}function Gi(e){let t=e;e.isCollapsed()||t.removeText();const n=Ri();ki(n)&&(t=n),ki(t)||Re(161);const r=t.anchor;let i=r.getNode(),s=r.offset;for(;!Nn(i);)[i,s]=Qi(i,s);return s}function Qi(e,t){const n=e.getParent();if(!n){const e=Bs();return Et().append(e),e.select(),[Et(),0]}if(hi(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!bs(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new bi(xi(e.__key,t,"element"),xi(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}let Xi=null,Yi=null,Zi=!1,es=!1,ts=0;const ns={characterData:!0,childList:!0,subtree:!0};function rs(){return Zi||null!==Xi&&Xi._readOnly}function is(){Zi&&Re(13)}function ss(){ts>99&&Re(14)}function os(){return null===Xi&&Re(195,cs()),Xi}function ls(){return null===Yi&&Re(196,cs()),Yi}function cs(){let e=0;const t=new Set,n=js.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ft(r);if(at(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function as(){return Yi}function us(e,t,n){const r=t.__type,i=function(e,t){const n=e._nodes.get(t);return void 0===n&&Re(30,t),n}(e,r);let s=n.get(r);void 0===s&&(s=Array.from(i.transforms),n.set(r,s));const o=s.length;for(let e=0;e<o&&(s[e](t),t.isAttached());e++);}function fs(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function ds(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function hs(e){return gs(e,ls()._nodes)}function gs(e,t){const n=e.type,r=t.get(n);void 0===r&&Re(17,n);const i=r.klass;e.type!==i.getType()&&Re(18,i.name);const s=i.importJSON(e),o=e.children;if(bs(s)&&Array.isArray(o))for(let e=0;e<o.length;e++){const n=gs(o[e],t);s.append(n)}return s}function _s(e,t,n){const r=Xi,i=Zi,s=Yi;Xi=t,Zi=!0,Yi=e;try{return n()}finally{Xi=r,Zi=i,Yi=s}}function ps(e,n){const r=e._pendingEditorState,i=e._rootElement,s=e._headless||null===i;if(null===r)return;const o=e._editorState,l=o._selection,c=r._selection,a=e._dirtyType!==se,u=Xi,f=Zi,d=Yi,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!s&&a&&null!==g){Yi=e,Xi=r,Zi=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),_=mr(o,r,e,t,n,i)}catch(t){if(t instanceof Error&&e._onError(t),es)throw t;return Us(e,null,i,r),Ye(e),e._dirtyType=le,es=!0,ps(e,o),void(es=!1)}finally{g.observe(i,ns),e._updating=h,Xi=u,Zi=f,Yi=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,v=e._deferred;a&&(e._dirtyType=se,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let s;for(s in r)i.has(s)||(r===n&&(r=wt(e)),delete r[s])}(e,r);const S=s?null:vn(e._window);if(e._editable&&null!==S&&(a||null===c||c.dirty)){Yi=e,Xi=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&mn(t,e,i),ji(l,c,e,S,x,i)}xn(e,i,c),null!==g&&g.observe(i,ns)}finally{Yi=d,Xi=u}}null!==_&&function(e,t,n,r,i){const s=Array.from(e._listeners.mutation),o=s.length;for(let e=0;e<o;e++){const[o,l]=s[e],c=t.get(l);void 0!==c&&o(c,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}(e,_,x,p,o),ki(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(t,void 0);const C=e._pendingDecorators;null!==C&&(e._decorators=C,e._pendingDecorators=null,ys("decorator",e,!0,C)),function(e,t,n){const r=Nt(t),i=Nt(n);r!==i&&ys("textcontent",e,!0,i)}(e,n||o,r),ys("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,normalizedNodes:m,prevEditorState:n||o,tags:x}),function(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,v),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;vs(e,t,r)}}}(e)}function ys(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++)n[e].apply(null,r)}finally{t._updating=i}}function ms(e,t,n){if(!1===e._updating||Yi!==e){let r=!1;return e.update((()=>{r=ms(e,t,n)})),r}const r=Mt(e);for(let i=4;i>=0;i--)for(let s=0;s<r.length;s++){const o=r[s]._commands.get(t);if(void 0!==o){const t=o[i];if(void 0!==t){const r=Array.from(t),i=r.length;for(let t=0;t<i;t++)if(!0===r[t](n,e))return!0}}}return!1}function xs(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t;let s;if(void 0!==i){if(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete){const t=e._pendingEditorState;null===t&&Re(191),t._flushSync=!0}s&&e._deferred.push(s),ds(e,i.tag)}n()}}return r}function vs(e,t,n){const r=e._updateTags;let i,s=!1,o=!1;void 0!==n&&(i=n.onUpdate,ds(e,n.tag),s=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let c=e._pendingEditorState,a=!1;(null===c||c._readOnly)&&(c=e._pendingEditorState=new Os(new Map((c||l)._nodeMap)),a=!0),c._flushSync=o;const u=Xi,f=Zi,d=Yi,h=e._updating;Xi=c,Zi=!1,e._updating=!0,Yi=e;try{a&&(e._headless?null!==l._selection&&(c._selection=l._selection.clone()):c._selection=function(e){const t=e.getEditorState()._selection,n=vn(e._window);return ki(t)||null==t?Wi(t,n,e,null):t.clone()}(e));const n=e._compositionKey;t(),s=xs(e,s),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(ki(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==se&&(s?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);hi(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&tt(t)}}(c,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,s=St(),o=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);hi(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&tt(r),void 0!==r&&fs(r,s)&&us(t,r,o),n.add(e)}if(l=t._dirtyLeaves,c=l.size,c>0){ts++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map;for(const e of a){const n=e[0],l=e[1];if("root"!==n&&!l)continue;const c=i.get(n);void 0!==c&&fs(c,s)&&us(t,c,o),r.set(n,l)}l=t._dirtyLeaves,c=l.size,a=t._dirtyElements,u=a.size,ts++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),xs(e),function(e,t,n,r){const i=e._nodeMap,s=t._nodeMap,o=[];for(const[e]of r){const t=s.get(e);void 0!==t&&(t.isAttached()||(bs(t)&&Bn(t,e,i,s,o,r),i.has(e)||r.delete(e),o.push(e)))}for(const e of o)s.delete(e);for(const e of n){const t=s.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),s.delete(e))}}(l,c,e._dirtyLeaves,e._dirtyElements));n!==e._compositionKey&&(c._flushSync=!0);const r=c._selection;if(ki(r)){const e=c._nodeMap,t=r.anchor.key,n=r.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||Re(19)}else wi(r)&&0===r._nodes.size&&(c._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=le,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void ps(e)}finally{Xi=u,Zi=f,Yi=d,e._updating=h,ts=0}const g=e._dirtyType!==se||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(c,e);g?c._flushSync?(c._flushSync=!1,ps(e)):a&&ot((()=>{ps(e)})):(c._flushSync=!1,a&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Ss(e,t,n){e._updating?e._updates.push([t,n]):vs(e,t,n)}class Cs{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Cs(this.element,e,this.after)}withAfter(e){return new Cs(this.element,this.before,e)}withElement(e){return new Cs(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&Re(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&Re(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&Re(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(Y||X);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=Ts(t,n);i.push(r);const s=Ts(t,this.element);let o=e.getIndexWithinParent();for(let e=0;e<s.length;e++){const t=i[e],n=s[e];if(void 0===t||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}}function Ts(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=t.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=r.previousSibling)e++;n.push(e)}return r!==e&&Re(225),n.reverse()}class ks extends Vr{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ae[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=ls()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(hi(t)&&e.push(t),bs(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;bs(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;bs(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return bs(e)&&e.getLastDescendant()||e||null}const r=t[e];return bs(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Ct(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&Re(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Ct(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&Re(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),bs(i)&&r!==n-1&&!i.isInline()&&(e+=Ne)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),bs(i)&&r!==n-1&&!i.isInline()&&(e+=Ne.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(""!==e){const t=Ie[e];return!!(this.getFormat()&t)}return!1}select(e,t){is();const n=Ri();let r=e,i=t;const s=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(hi(e)||bs(e))return e.select(0,0)}else if(!(void 0!==e&&e!==s||void 0!==t&&t!==s)){const e=this.getLastChild();if(hi(e)||bs(e))return e.select()}void 0===r&&(r=s),void 0===i&&(i=s);const o=this.__key;return ki(n)?(n.anchor.set(o,r,"element"),n.focus.set(o,i,"element"),n.dirty=!0,n):Ii(o,r,o,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?Ie[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const r=n.length,i=this.getChildrenSize(),s=this.getWritable();e+t<=i||Re(226,String(e),String(t),String(i));const o=s.__key,l=[],c=[],a=this.getChildAtIndex(e+t);let u=null,f=i-t+r;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){null===e&&Re(100);const t=e.getNextSibling(),n=e.__key;mt(e.getWritable()),c.push(n),e=t}}let d=u;for(let e=0;e<r;e++){const t=n[e];null!==d&&t.is(d)&&(u=d=d.getPreviousSibling());const r=t.getWritable();r.__parent===o&&f--,mt(r);const i=t.__key;if(null===d)s.__first=i,r.__prev=null;else{const e=d.getWritable();e.__next=i,r.__prev=e.__key}t.__key===o&&Re(76),r.__parent=o,l.push(i),d=t}if(e+t===i){if(null!==d){d.getWritable().__next=null,s.__last=d.__key}}else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(s.__size=f,c.length){const e=Ri();if(ki(e)){const t=new Set(c),n=new Set(l),{anchor:r,focus:i}=e;ws(r,t,n)&&Ui(r,r.getNode(),this,u,a),ws(i,t,n)&&Ui(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||dn(this)||this.remove()}}return s}getDOMSlot(e){return new Cs(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Tn(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function bs(e){return e instanceof ks}function ws(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Ns extends Vr{constructor(e){super(e)}decorate(e,t){Re(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Es(e){return e instanceof Ns}class Ps extends ks{static getType(){return"root"}static clone(){return new Ps}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Re(51)}getTextContent(){const e=this.__cachedText;return!rs()&&ls()._dirtyType!==se||null===e?super.getTextContent():e}remove(){Re(52)}replace(e){Re(53)}insertBefore(e){Re(54)}insertAfter(e){Re(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];bs(n)||Es(n)||Re(56)}return super.append(...e)}static importJSON(e){const t=Et();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Fs(e){return e instanceof Ps}function Ls(){return new Os(new Map([["root",new Ps]]))}function Ds(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Re(130,n.name),bs(e)){const r=t.children;Array.isArray(r)||Re(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=Ds(i[e]);r.push(t)}}return t}class Os{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return _s(t&&t.editor||null,this,e)}clone(e){const t=new Os(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return _s(null,this,(()=>({root:Ds(Et())})))}}class Ms extends ks{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Is extends ks{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Oe[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return _t(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new Is(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=qt(e.theme,"paragraph");if(void 0!==n){t.classList.add(...n)}return t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:As,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Tn(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();t.style.textAlign=e;const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){const t=Bs();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=Bs();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||hi(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function As(e){const t=Bs();return e.style&&(t.setFormat(e.style.textAlign),Mn(e,t)),{node:t}}function Bs(){return gn(new Is)}function zs(e){return e instanceof Is}const Ws=0,Rs=1,Ks=2,Js=3,$s=4;function Us(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Ls(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=se,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const s=e._observer;null!==s&&(s.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function Vs(e){const t=e||{},n=as(),r=t.theme||{},i=void 0===e?n:t.parentEditor||null,s=t.disableEvents||!1,o=Ls(),l=t.namespace||(null!==i?i._config.namespace:It()),c=t.editorState,a=[Ps,ri,jr,_i,Is,Ms,...t.nodes||[]],{onError:u,html:f}=t,d=void 0===t.editable||t.editable;let h;if(void 0===e&&null!==n)h=n._nodes;else{h=new Map;for(let e=0;e<a.length;e++){let t=a[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}const i=t.getType(),s=t.transform(),o=new Set;null!==s&&o.add(s),h.set(i,{exportDOM:f&&f.export?f.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,transforms:o})}}const g=new js(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(h,f?f.import:void 0),d);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=le),g}class js{constructor(e,t,n,r,i,s,o){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=se,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=It(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&Re(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&Re(36,String(e));const s=i[n];return s.add(t),()=>{s.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&Re(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Dn(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}var s,o;return s=this,o=e.getType(),Ss(s,(()=>{const e=os();if(e.isEmpty())return;if("root"===o)return void Et().markDirty();const t=e._nodeMap;for(const[,e]of t)e.markDirty()}),null===s._pendingEditorState?{tag:"history-merge"}:void 0),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return en(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=qt(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Us(this,t,e,r),null!==t&&(this._config.disableEvents||$r(t),null!=n&&t.classList.remove(...n)),null!==e){const t=function(e){const t=e.ownerDocument;return t&&t.defaultView||null}(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=le,Ye(this),this._updateTags.add("history-merge"),ps(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=Nr.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Rr),Nr.set(n,(r||0)+1),e.__lexicalEditor=t;const i=zr(e);for(let n=0;n<Cr.length;n++){const[r,s]=Cr[n],o="function"==typeof s?e=>{Jr(e)||(Kr(e),(t.isEditable()||"click"===r)&&s(e,t))}:e=>{if(Jr(e))return;Kr(e);const n=t.isEditable();switch(r){case"cut":return n&&en(t,B,e);case"copy":return en(t,A,e);case"paste":return n&&en(t,c,e);case"dragstart":return n&&en(t,O,e);case"dragover":return n&&en(t,M,e);case"dragend":return n&&en(t,I,e);case"focus":return n&&en(t,$,e);case"blur":return n&&en(t,U,e);case"drop":return n&&en(t,L,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._editorState=r,this._pendingEditorState=null,this._window=null;ys("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&Re(38),Xe(this);const n=this._pendingEditorState,r=this._updateTags,i=void 0!==t?t.tag:null;null===n||n.isEmpty()||(null!=i&&r.add(i),ps(this)),this._pendingEditorState=e,this._dirtyType=le,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=i&&r.add(i),ps(this)}parseEditorState(e,t){return function(e,t,n){const r=Ls(),i=Xi,s=Zi,o=Yi,l=t._dirtyElements,c=t._dirtyLeaves,a=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Xi=r,Zi=!1,Yi=t;try{const i=t._nodes;gs(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=c,t._cloneNotNeeded=a,t._dirtyType=u,Xi=i,Zi=s,Yi=o}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return ps(this),this.getEditorState().read(e,{editor:this})}update(e,t){Ss(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ss(this,(()=>{const e=Ri(),n=Et();null!==e?e.dirty=!0:0!==n.getChildrenSize()&&("rootStart"===t.defaultSelection?n.selectStart():n.selectEnd())}),{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=vn(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ys("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}js.version="0.20.1+prod.esm";export{on as $addUpdateTag,gn as $applyNodeReplacement,On as $cloneWithProperties,hn as $copyNode,qr as $createLineBreakNode,Bi as $createNodeSelection,Bs as $createParagraphNode,xi as $createPoint,Ai as $createRangeSelection,zi as $createRangeSelectionFromDom,pi as $createTabNode,di as $createTextNode,Yt as $getAdjacentNode,Ei as $getCharacterOffsets,Pn as $getEditor,bt as $getNearestNodeFromDOMNode,fn as $getNearestRootOrShadowRoot,Ct as $getNodeByKey,pn as $getNodeByKeyOrThrow,Ki as $getPreviousSelection,Et as $getRoot,Ri as $getSelection,qi as $getTextContent,cn as $hasAncestor,sn as $hasUpdateTag,Hi as $insertNodes,Mi as $isBlockElementNode,Es as $isDecoratorNode,bs as $isElementNode,un as $isInlineElementOrDecoratorNode,pt as $isLeafNode,Gr as $isLineBreakNode,wi as $isNodeSelection,zs as $isParagraphNode,ki as $isRangeSelection,Fs as $isRootNode,dn as $isRootOrShadowRoot,yi as $isTabNode,hi as $isTextNode,dt as $isTokenOrSegmented,Qt as $nodesOfType,nt as $normalizeSelection__EXPERIMENTAL,ln as $onUpdate,hs as $parseSerializedNode,Ht as $selectAll,vt as $setCompositionKey,Ft as $setSelection,Sn as $splitNode,Ms as ArtificialNode__DO_NOT_USE,U as BLUR_COMMAND,K as CAN_REDO_COMMAND,J as CAN_UNDO_COMMAND,W as CLEAR_EDITOR_COMMAND,R as CLEAR_HISTORY_COMMAND,r as CLICK_COMMAND,$s as COMMAND_PRIORITY_CRITICAL,Ws as COMMAND_PRIORITY_EDITOR,Js as COMMAND_PRIORITY_HIGH,Rs as COMMAND_PRIORITY_LOW,Ks as COMMAND_PRIORITY_NORMAL,l as CONTROLLED_TEXT_INSERTION_COMMAND,A as COPY_COMMAND,B as CUT_COMMAND,i as DELETE_CHARACTER_COMMAND,f as DELETE_LINE_COMMAND,u as DELETE_WORD_COMMAND,I as DRAGEND_COMMAND,M as DRAGOVER_COMMAND,O as DRAGSTART_COMMAND,L as DROP_COMMAND,Ns as DecoratorNode,ks as ElementNode,$ as FOCUS_COMMAND,D as FORMAT_ELEMENT_COMMAND,d as FORMAT_TEXT_COMMAND,P as INDENT_CONTENT_COMMAND,s as INSERT_LINE_BREAK_COMMAND,o as INSERT_PARAGRAPH_COMMAND,E as INSERT_TAB_COMMAND,xe as IS_ALL_FORMATTING,fe as IS_BOLD,_e as IS_CODE,me as IS_HIGHLIGHT,de as IS_ITALIC,he as IS_STRIKETHROUGH,pe as IS_SUBSCRIPT,ye as IS_SUPERSCRIPT,ge as IS_UNDERLINE,S as KEY_ARROW_DOWN_COMMAND,m as KEY_ARROW_LEFT_COMMAND,p as KEY_ARROW_RIGHT_COMMAND,v as KEY_ARROW_UP_COMMAND,k as KEY_BACKSPACE_COMMAND,w as KEY_DELETE_COMMAND,_ as KEY_DOWN_COMMAND,C as KEY_ENTER_COMMAND,b as KEY_ESCAPE_COMMAND,V as KEY_MODIFIER_COMMAND,T as KEY_SPACE_COMMAND,N as KEY_TAB_COMMAND,jr as LineBreakNode,y as MOVE_TO_END,x as MOVE_TO_START,F as OUTDENT_CONTENT_COMMAND,c as PASTE_COMMAND,Is as ParagraphNode,g as REDO_COMMAND,a as REMOVE_TEXT_COMMAND,Ps as RootNode,t as SELECTION_CHANGE_COMMAND,n as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,z as SELECT_ALL_COMMAND,Oe as TEXT_TYPE_TO_FORMAT,_i as TabNode,ri as TextNode,h as UNDO_COMMAND,e as createCommand,Vs as createEditor,vn as getDOMSelection,gt as getDOMTextNode,ft as getEditorPropertyFromDOMNode,ut as getNearestEditorFromDOMNode,wn as isBlockDomNode,rs as isCurrentlyReadOnlyMode,ht as isDOMTextNode,An as isDOMUnmanaged,kn as isDocumentFragment,Cn as isHTMLAnchorElement,Tn as isHTMLElement,bn as isInlineDomNode,at as isLexicalEditor,lt as isSelectionCapturedInDecoratorInput,ct as isSelectionWithinEditor,st as resetRandomKey,In as setDOMUnmanaged,Mn as setNodeIndentFromDOM};
|
|
9
|
+
function e(e){return{}}const t={},n={},r={},i={},s={},o={},l={},c={},a={},u={},f={},d={},h={},g={},_={},p={},y={},m={},x={},v={},S={},C={},T={},k={},b={},w={},N={},E={},P={},F={},L={},O={},D={},M={},I={},A={},B={},z={},W={},R={},K={},J={},$={},U={},V={},j="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,H=j&&"documentMode"in document?document.documentMode:null,q=j&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),G=j&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Q=!(!j||!("InputEvent"in window)||H)&&"getTargetRanges"in new window.InputEvent("input"),X=j&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Y=j&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Z=j&&/Android/.test(navigator.userAgent),ee=j&&/^(?=.*Chrome).*/i.test(navigator.userAgent),te=j&&Z&&ee,ne=j&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ee,re=1,ie=3,se=0,oe=1,le=2,ce=0,ae=1,ue=2,fe=1,de=2,he=4,ge=8,_e=16,pe=32,ye=64,me=128,xe=112|(3|he|ge)|me,ve=1,Se=2,Ce=3,Te=4,ke=5,be=6,we=X||Y||ne?" ":"",Ne="\n\n",Ee=G?" ":we,Pe="֑-߿יִ-﷽ﹰ-ﻼ",Fe="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Le=new RegExp("^[^"+Fe+"]*["+Pe+"]"),Oe=new RegExp("^[^"+Pe+"]*["+Fe+"]"),De={bold:1,code:16,highlight:me,italic:2,strikethrough:he,subscript:32,superscript:64,underline:ge},Me={directionless:1,unmergeable:2},Ie={center:Se,end:be,justify:Te,left:ve,right:Ce,start:ke},Ae={[Se]:"center",[be]:"end",[Te]:"justify",[ve]:"left",[Ce]:"right",[ke]:"start"},Be={normal:0,segmented:2,token:1},ze={[ce]:"normal",[ue]:"segmented",[ae]:"token"};function We(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re=We((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function Ke(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const Je=100;let $e=!1,Ue=0;function Ve(e){Ue=e.timeStamp}function je(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==kt(e,n)}function He(e,t,n){const r=vn(n._window);let i=null,s=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,s=r.focusOffset);const o=e.nodeValue;null!==o&&zt(t,o,i,s,!1)}function qe(e,t,n){if(ki(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return t.nodeType===ie&&n.isAttached()}function Ge(e,t,n,r){for(let i=e;i&&!An(i);i=rn(i)){const e=kt(i,t);if(void 0!==e){const t=Ct(e,n);if(t)return Es(t)?void 0:[i,t]}else if(i===r)return[r,Pt(n)]}}function Qe(e,t,n){$e=!0;const r=performance.now()-Ue>Je;try{Ss(e,(()=>{const i=Ri()||function(e){return e.getEditorState().read((()=>{const e=Ri();return null!==e?e.clone():null}))}(e),s=new Map,o=e.getRootElement(),l=e._editorState,c=e._blockCursorElement;let a=!1,u="";for(let n=0;n<t.length;n++){const f=t[n],d=f.type,h=f.target,g=Ge(h,e,l,o);if(!g)continue;const[_,p]=g;if("characterData"===d)r&&hi(p)&&qe(i,h,p)&&He(h,p,e);else if("childList"===d){a=!0;const t=f.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=Tt(r),s=r.parentNode;if(null!=s&&r!==c&&null===i&&!je(r,s,e)){if(G){const e=r.innerText||r.nodeValue;e&&(u+=e)}s.removeChild(r)}}const n=f.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(je(r,h,e)||c===r)&&(h.appendChild(r),t++)}r!==t&&s.set(_,p)}}}if(s.size>0)for(const[t,n]of s)n.reconcileObservedMutation(t,e);const f=n.takeRecords();if(f.length>0){for(let t=0;t<f.length;t++){const n=f[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],s=n.parentNode;null==s||"BR"!==n.nodeName||je(n,i,e)||s.removeChild(n)}}n.takeRecords()}null!==i&&(a&&(i.dirty=!0,Ft(i)),G&&Zt(e)&&i.insertRawText(u))}))}finally{$e=!1}}function Xe(e){const t=e._observer;if(null!==t){Qe(e,t.takeRecords(),t)}}function Ye(e){!function(e){0===Ue&&an(e).addEventListener("textInput",Ve,!0)}(e),e._observer=new MutationObserver(((t,n)=>{Qe(e,t,n)}))}function Ze(e,t){const n=e.__mode,r=e.__format,i=e.__style,s=t.__mode,o=t.__format,l=t.__style;return!(null!==n&&n!==s||null!==r&&r!==o||null!==i&&i!==l)}function et(e,t){const n=e.mergeWithSibling(t),r=ls()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function tt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&hi(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(Ze(t,r)){r=et(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&hi(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Ze(r,n)){r=et(r,n);break}break}n.remove()}}else r.remove()}function nt(e){return rt(e.anchor),rt(e.focus),e}function rt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),hi(r)){e.set(r.__key,i?r.getTextContentSize():0,"text");break}if(!bs(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element")}}let it=1;function st(){it=1}const ot="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function lt(e){const t=document.activeElement;if(null===t)return!1;const n=t.nodeName;return Es(bt(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==ft(t))}function ct(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!lt(t)&&ut(t)===e}catch(e){return!1}}function at(e){return e instanceof Hs}function ut(e){let t=e;for(;null!=t;){const e=ft(t);if(at(e))return e;t=rn(t)}return null}function ft(e){return e?e.__lexicalEditor:null}function dt(e){return e.isToken()||e.isSegmented()}function ht(e){return e.nodeType===ie}function gt(e){let t=e;for(;null!=t;){if(ht(t))return t;t=t.firstChild}return null}function _t(e,t,n){const r=De[t];if(null!==n&&(e&r)==(n&r))return e;let i=e^r;return"subscript"===t?i&=~De.superscript:"superscript"===t&&(i&=~De.subscript),i}function pt(e){return hi(e)||Gr(e)||Es(e)}function yt(e,t){if(null!=t)return void(e.__key=t);is(),ss();const n=ls(),r=os(),i=""+it++;r._nodeMap.set(i,e),bs(e)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=oe,e.__key=i}function mt(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),s=e.getNextSibling();if(null===i)if(null!==s){const e=s.getWritable();r.__first=s.__key,e.__prev=null}else r.__first=null;else{const e=i.getWritable();if(null!==s){const t=s.getWritable();t.__prev=e.__key,e.__next=t.__key}else e.__next=null;n.__prev=null}if(null===s)if(null!==i){const e=i.getWritable();r.__last=i.__key,e.__next=null}else r.__last=null;else{const e=s.getWritable();if(null!==i){const t=i.getWritable();t.__next=e.__key,e.__prev=t.__key}else e.__prev=null;n.__next=null}r.__size--,n.__parent=null}}function xt(e){ss();const t=e.getLatest(),n=t.__parent,r=os(),i=ls(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,s,o);const l=t.__key;i._dirtyType=oe,bs(e)?o.set(l,!0):i._dirtyLeaves.add(l)}function vt(e){is();const t=ls(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Ct(n);null!==e&&e.getWritable()}if(null!==e){const t=Ct(e);null!==t&&t.getWritable()}}}function St(){if(rs())return null;return ls()._compositionKey}function Ct(e,t){const n=(t||os())._nodeMap.get(e);return void 0===n?null:n}function Tt(e,t){const n=kt(e,ls());return void 0!==n?Ct(n,t):null}function kt(e,t){return e[`__lexicalKey_${t._key}`]}function bt(e,t){let n=e;for(;null!=n;){const e=Tt(n,t);if(null!==e)return e;n=rn(n)}return null}function wt(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Nt(e){return e.read((()=>Et().getTextContent()))}function Et(){return Pt(os())}function Pt(e){return e._nodeMap.get("root")}function Ft(e){is();const t=os();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Lt(e){const t=ls(),n=function(e,t){let n=e;for(;null!=n;){const e=kt(n,t);if(void 0!==e)return e;n=rn(n)}return null}(e,t);if(null===n){return e===t.getRootElement()?Ct("root"):null}return Ct(n)}function Ot(e,t){return t?e.getTextContentSize():0}function Dt(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Mt(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function It(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function At(e){return e.nodeType===ie?e.nodeValue:null}function Bt(e,t,n){const r=vn(t._window);if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let t=At(i);const r=bt(i);if(null!==t&&hi(r)){if(t===we&&n){const e=n.length;t=n,s=e,o=e}null!==t&&zt(r,t,s,o,e)}}}function zt(e,t,n,r,i){let s=e;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let l=t;(o||i)&&t[t.length-1]===we&&(l=t.slice(0,-1));const c=s.getTextContent();if(i||l!==c){if(""===l){if(vt(null),X||Y||ne)s.remove();else{const e=ls();setTimeout((()=>{e.update((()=>{s.isAttached()&&s.remove()}))}),20)}return}const t=s.getParent(),i=Ki(),c=s.getTextContentSize(),a=St(),u=s.getKey();if(s.isToken()||null!==a&&u===a&&!o||ki(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const f=Ri();if(!ki(f)||null===n||null===r)return void s.setTextContent(l);if(f.setTextNodeRange(s,n,s,r),s.isSegmented()){const e=di(s.getTextContent());s.replace(e),s=e}s.setTextContent(l)}}}function Wt(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=t.isToken();return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(hi(t)||bs(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}function Rt(e){return"ArrowLeft"===e}function Kt(e){return"ArrowRight"===e}function Jt(e,t){return q?e:t}function $t(e){return"Enter"===e}function Ut(e){return"Backspace"===e}function Vt(e){return"Delete"===e}function jt(e,t,n){return"a"===e.toLowerCase()&&Jt(t,n)}function Ht(){const e=Et();Ft(nt(e.select(0,e.getChildrenSize())))}function qt(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=Ke(i);return n[t]=e,e}return i}function Gt(e,t,n,r,i){if(0===n.size)return;const s=r.__type,o=r.__key,l=t.get(s);void 0===l&&Re(33,s);const c=l.klass;let a=e.get(c);void 0===a&&(a=new Map,e.set(c,a));const u=a.get(o),f="destroyed"===u&&"created"===i;(void 0===u||f)&&a.set(o,f?"updated":i)}function Qt(e){const t=e.getType(),n=os();if(n._readOnly){const e=On(n).get(t);return e?Array.from(e.values()):[]}const r=n._nodeMap,i=[];for(const[,n]of r)n instanceof e&&n.__type===t&&n.isAttached()&&i.push(n);return i}function Xt(e,t,n){const r=e.getParent();let i=n,s=e;return null!==r&&(t&&0===n?(i=s.getIndexWithinParent(),s=r):t||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?i-1:i)}function Yt(e,t){const n=e.offset;if("element"===e.type){return Xt(e.getNode(),t,n)}{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?Xt(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function Zt(e){const t=an(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function en(e,t,n){return ms(e,t,n)}function tn(e){return!Fs(e)&&!e.isLastChild()&&!e.isInline()}function nn(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&Re(75,t),n}function rn(e){const t=e.assignedSlot||e.parentElement;return null!==t&&11===t.nodeType?t.host:t}function sn(e){return ls()._updateTags.has(e)}function on(e){is();ls()._updateTags.add(e)}function ln(e){is();ls()._deferred.push(e)}function cn(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function an(e){const t=e._window;return null===t&&Re(78),t}function un(e){return bs(e)&&e.isInline()||Es(e)&&e.isInline()}function fn(e){let t=e.getParentOrThrow();for(;null!==t;){if(dn(t))return t;t=t.getParentOrThrow()}return t}function dn(e){return Fs(e)||bs(e)&&e.isShadowRoot()}function hn(e){const t=e.constructor.clone(e);return yt(t,null),t}function gn(e){const t=ls(),n=e.constructor.getType(),r=t._nodes.get(n);void 0===r&&Re(200,e.constructor.name,n);const{replace:i,replaceWithKlass:s}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==s?t instanceof s||Re(201,s.name,s.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||Re(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&Re(203,e.constructor.name,n,r.name,r.getType()),t}return e}function _n(e,t){!Fs(e.getParent())||bs(t)||Es(t)||Re(99)}function pn(e){const t=Ct(e);return null===t&&Re(63,e),t}function yn(e){return(Es(e)||bs(e)&&!e.canBeEmpty())&&!e.isInline()}function mn(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function xn(e,t,n){let r=e._blockCursorElement;if(ki(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let l=!1,c=null;if(o===s.getChildrenSize()){yn(s.getChildAtIndex(o-1))&&(l=!0)}else{const t=s.getChildAtIndex(o);if(null!==t&&yn(t)){const n=t.getPreviousSibling();(null===n||yn(n))&&(l=!0,c=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(s.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=Ke(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&mn(r,e,t)}function vn(e){return j?(e||window).getSelection():null}function Sn(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),dn(e)&&Re(102);const r=e=>{const t=e.getParentOrThrow(),i=dn(t),s=e!==n||i?hn(e):e;if(i)return bs(e)&&bs(s)||Re(133),e.insertAfter(s),[e,s,s];{const[n,i,o]=r(t),l=e.getNextSiblings();return o.append(s,...l),[n,i,s]}},[i,s]=r(n);return[i,s]}function Cn(e){return Tn(e)&&"A"===e.tagName}function Tn(e){return 1===e.nodeType}function kn(e){return 11===e.nodeType}function bn(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function wn(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function Nn(e){if(Es(e)&&!e.isInline())return!0;if(!bs(e)||dn(e))return!1;const t=e.getFirstChild(),n=null===t||Gr(t)||hi(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function En(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}function Pn(){return ls()}const Fn=new WeakMap,Ln=new Map;function On(e){if(!e._readOnly&&e.isEmpty())return Ln;e._readOnly||Re(192);let t=Fn.get(e);if(!t){t=new Map,Fn.set(e,t);for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}}return t}function Dn(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Mn(e,t){const n=(parseInt(e.style.paddingInlineStart,10)||0)/40;t.setIndent(n)}function In(e){e.__lexicalUnmanaged=!0}function An(e){return!0===e.__lexicalUnmanaged}function Bn(e,t,n,r,i,s){let o=e.getFirstChild();for(;null!==o;){const e=o.__key;o.__parent===t&&(bs(o)&&Bn(o,e,n,r,i,s),n.has(e)||s.delete(e),i.push(e)),o=o.getNextSibling()}}let zn,Wn,Rn,Kn,Jn,$n,Un,Vn,jn,Hn,qn="",Gn="",Qn=null,Xn="",Yn="",Zn=!1,er=!1,tr=null;function nr(e,t){const n=Un.get(e);if(null!==t){const n=xr(e);n.parentNode===t&&t.removeChild(n)}if(Vn.has(e)||Wn._keyToDOMMap.delete(e),bs(n)){const e=gr(n,Un);rr(e,0,e.length-1,null)}void 0!==n&&Gt(Hn,Rn,Kn,n,"destroyed")}function rr(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&nr(t,r)}}function ir(e,t){e.setProperty("text-align",t)}const sr="40px";function or(e,t){const n=zn.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||sr;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function lr(e,t){const n=e.style;0===t?ir(n,""):t===ve?ir(n,"left"):t===Se?ir(n,"center"):t===Ce?ir(n,"right"):t===Te?ir(n,"justify"):t===ke?ir(n,"start"):t===be&&ir(n,"end")}function cr(e,t){const n=Vn.get(e);void 0===n&&Re(60);const r=n.createDOM(zn,Wn);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,Wn),hi(n)?r.setAttribute("data-lexical-text","true"):Es(n)&&r.setAttribute("data-lexical-decorator","true"),bs(n)){const e=n.__indent,t=n.__size;if(0!==e&&or(r,e),0!==t){const e=t-1;!function(e,t,n,r){const i=Gn;Gn="",ar(e,n,0,t,n.getDOMSlot(r)),dr(n,r),Gn=i}(gr(n,Vn),e,n,r)}const i=n.__format;0!==i&&lr(r,i),n.isInline()||fr(null,n,r),tn(n)&&(qn+=Ne,Yn+=Ne)}else{const t=n.getTextContent();if(Es(n)){const t=n.decorate(Wn,zn);null!==t&&pr(e,t),r.contentEditable="false"}else hi(n)&&(n.isDirectionless()||(Gn+=t));qn+=t,Yn+=t}return null!==t&&t.insertChild(r),Gt(Hn,Rn,Kn,n,"created"),r}function ar(e,t,n,r,i){const s=qn;qn="";let o=n;for(;o<=r;++o){cr(e[o],i);const t=Vn.get(e[o]);null!==t&&hi(t)&&(null===Qn&&(Qn=t.getFormat()),""===Xn&&(Xn=t.getStyle()))}tn(t)&&(qn+=Ne);i.element.__lexicalTextContent=qn,qn=s+qn}function ur(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return Gr(e)?"line-break":Es(e)&&e.isInline()?"decorator":null}return"empty"}return null}function fr(e,t,n){const r=ur(e,Un),i=ur(t,Vn);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function dr(e,t){const n=t.__lexicalDirTextContent||"",r=t.__lexicalDir||"";if(n!==Gn||r!==tr){const n=""===Gn,s=n?tr:(i=Gn,Le.test(i)?"rtl":Oe.test(i)?"ltr":null);if(s!==r){const i=t.classList,o=zn.theme;let l=null!==r?o[r]:void 0,c=null!==s?o[s]:void 0;if(void 0!==l){if("string"==typeof l){const e=Ke(l);l=o[r]=e}i.remove(...l)}if(null===s||n&&"ltr"===s)t.removeAttribute("dir");else{if(void 0!==c){if("string"==typeof c){const e=Ke(c);c=o[s]=e}void 0!==c&&i.add(...c)}t.dir=s}if(!er){e.getWritable().__dir=s}}tr=s,t.__lexicalDirTextContent=Gn,t.__lexicalDir=s}var i}function hr(e,t,n){const r=Gn;var i;Gn="",Qn=null,Xn="",function(e,t,n){const r=qn,i=e.__size,s=t.__size;qn="";const o=n.element;if(1===i&&1===s){const n=e.__first,r=t.__first;if(n===r)_r(n,o);else{const e=xr(n),t=cr(r,null);try{o.replaceChild(t,e)}catch(i){if("object"==typeof i&&null!=i){const s=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(s)}throw i}nr(n,null)}const i=Vn.get(r);hi(i)&&(null===Qn&&(Qn=i.getFormat()),""===Xn&&(Xn=i.getStyle()))}else{const r=gr(e,Un),l=gr(t,Vn);if(r.length!==i&&Re(227),l.length!==s&&Re(228),0===i)0!==s&&ar(l,t,0,s-1,n);else if(0===s){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;rr(r,0,i-1,e?null:o),e&&(o.textContent="")}}else!function(e,t,n,r,i,s){const o=r-1,l=i-1;let c,a,u=s.getFirstChild(),f=0,d=0;for(;f<=o&&d<=l;){const e=t[f],r=n[d];if(e===r)u=yr(_r(r,s.element)),f++,d++;else{void 0===c&&(c=new Set(t)),void 0===a&&(a=new Set(n));const i=a.has(e),o=c.has(r);if(i)if(o){const e=nn(Wn,r);e===u?u=yr(_r(r,s.element)):(s.withBefore(u).insertChild(e),_r(r,s.element)),f++,d++}else cr(r,s.withBefore(u)),d++;else u=yr(xr(e)),nr(e,s.element),f++}const i=Vn.get(r);null!==i&&hi(i)&&(null===Qn&&(Qn=i.getFormat()),""===Xn&&(Xn=i.getStyle()))}const h=f>o,g=d>l;if(h&&!g){const t=n[l+1],r=void 0===t?null:Wn.getElementByKey(t);ar(n,e,d,l,s.withBefore(r))}else g&&!h&&rr(t,f,o,s.element)}(t,r,l,i,s,n)}tn(t)&&(qn+=Ne);o.__lexicalTextContent=qn,qn=r+qn}(e,t,t.getDOMSlot(n)),dr(t,n),Ws(i=t)&&null!=Qn&&Qn!==i.__textFormat&&!er&&(i.setTextFormat(Qn),i.setTextStyle(Xn)),function(e){Ws(e)&&""!==Xn&&Xn!==e.__textStyle&&!er&&e.setTextStyle(Xn)}(t),Gn=r}function gr(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&Re(101),n.push(r),r=e.__next}return n}function _r(e,t){const n=Un.get(e);let r=Vn.get(e);void 0!==n&&void 0!==r||Re(61);const i=Zn||$n.has(e)||Jn.has(e),s=nn(Wn,e);if(n===r&&!i){if(bs(n)){const e=s.__lexicalTextContent;void 0!==e&&(qn+=e,Yn+=e);const t=s.__lexicalDirTextContent;void 0!==t&&(Gn+=t)}else{const e=n.getTextContent();hi(n)&&!n.isDirectionless()&&(Gn+=e),Yn+=e,qn+=e}return s}if(n!==r&&i&&Gt(Hn,Rn,Kn,r,"updated"),r.updateDOM(n,s,zn)){const n=cr(e,null);return null===t&&Re(62),t.replaceChild(n,s),nr(e,null),n}if(bs(n)&&bs(r)){const e=r.__indent;e!==n.__indent&&or(s,e);const t=r.__format;t!==n.__format&&lr(s,t),i&&(hr(n,r,s),Fs(r)||r.isInline()||fr(n,r,s)),tn(r)&&(qn+=Ne,Yn+=Ne)}else{const t=r.getTextContent();if(Es(r)){const t=r.decorate(Wn,zn);null!==t&&pr(e,t)}else hi(r)&&!r.isDirectionless()&&(Gn+=t);qn+=t,Yn+=t}if(!er&&Fs(r)&&r.__cachedText!==Yn){const e=r.getWritable();e.__cachedText=Yn,r=e}return s}function pr(e,t){let n=Wn._pendingDecorators;const r=Wn._decorators;if(null===n){if(r[e]===t)return;n=wt(Wn)}n[e]=t}function yr(e){let t=e.nextSibling;return null!==t&&t===Wn._blockCursorElement&&(t=t.nextSibling),t}function mr(e,t,n,r,i,s){qn="",Yn="",Gn="",Zn=r===le,tr=null,Wn=n,zn=n._config,Rn=n._nodes,Kn=Wn._listeners.mutation,Jn=i,$n=s,Un=e._nodeMap,Vn=t._nodeMap,er=t._readOnly,jn=new Map(n._keyToDOMMap);const o=new Map;return Hn=o,_r("root",null),Wn=void 0,Rn=void 0,Jn=void 0,$n=void 0,Un=void 0,Vn=void 0,zn=void 0,jn=void 0,Hn=void 0,o}function xr(e){const t=jn.get(e);return void 0===t&&Re(75,e),t}const vr=Object.freeze({}),Sr=30,Cr=[["keydown",function(e,t){if(Tr=e.timeStamp,kr=e.key,t.isComposing())return;const{key:n,shiftKey:r,ctrlKey:o,metaKey:l,altKey:c}=e;if(en(t,_,e))return;if(null==n)return;if(function(e,t,n,r){return Kt(e)&&!t&&!r&&!n}(n,o,c,l))en(t,p,e);else if(function(e,t,n,r,i){return Kt(e)&&!r&&!n&&(t||i)}(n,o,r,c,l))en(t,y,e);else if(function(e,t,n,r){return Rt(e)&&!t&&!r&&!n}(n,o,c,l))en(t,m,e);else if(function(e,t,n,r,i){return Rt(e)&&!r&&!n&&(t||i)}(n,o,r,c,l))en(t,x,e);else if(function(e,t,n){return function(e){return"ArrowUp"===e}(e)&&!t&&!n}(n,o,l))en(t,v,e);else if(function(e,t,n){return function(e){return"ArrowDown"===e}(e)&&!t&&!n}(n,o,l))en(t,S,e);else if(function(e,t){return $t(e)&&t}(n,r))Fr=!0,en(t,C,e);else if(function(e){return" "===e}(n))en(t,T,e);else if(function(e,t){return q&&t&&"o"===e.toLowerCase()}(n,o))e.preventDefault(),Fr=!0,en(t,s,!0);else if(function(e,t){return $t(e)&&!t}(n,r))Fr=!1,en(t,C,e);else if(function(e,t,n,r){return q?!t&&!n&&(Ut(e)||"h"===e.toLowerCase()&&r):!(r||t||n)&&Ut(e)}(n,c,l,o))Ut(n)?en(t,k,e):(e.preventDefault(),en(t,i,!0));else if(function(e){return"Escape"===e}(n))en(t,b,e);else if(function(e,t,n,r,i){return q?!(n||r||i)&&(Vt(e)||"d"===e.toLowerCase()&&t):!(t||r||i)&&Vt(e)}(n,o,r,c,l))Vt(n)?en(t,w,e):(e.preventDefault(),en(t,i,!1));else if(function(e,t,n){return Ut(e)&&(q?t:n)}(n,c,o))e.preventDefault(),en(t,u,!0);else if(function(e,t,n){return Vt(e)&&(q?t:n)}(n,c,o))e.preventDefault(),en(t,u,!1);else if(function(e,t){return q&&t&&Ut(e)}(n,l))e.preventDefault(),en(t,f,!0);else if(function(e,t){return q&&t&&Vt(e)}(n,l))e.preventDefault(),en(t,f,!1);else if(function(e,t,n,r){return"b"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"bold");else if(function(e,t,n,r){return"u"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"underline");else if(function(e,t,n,r){return"i"===e.toLowerCase()&&!t&&Jt(n,r)}(n,c,l,o))e.preventDefault(),en(t,d,"italic");else if(function(e,t,n,r){return"Tab"===e&&!t&&!n&&!r}(n,c,o,l))en(t,N,e);else if(function(e,t,n,r){return"z"===e.toLowerCase()&&!t&&Jt(n,r)}(n,r,l,o))e.preventDefault(),en(t,h,void 0);else if(function(e,t,n,r){return q?"z"===e.toLowerCase()&&n&&t:"y"===e.toLowerCase()&&r||"z"===e.toLowerCase()&&r&&t}(n,r,l,o))e.preventDefault(),en(t,g,void 0);else{const i=t._editorState._selection;null===i||ki(i)?!G&&jt(n,l,o)&&(e.preventDefault(),en(t,z,e)):!function(e,t,n,r){return!t&&"c"===e.toLowerCase()&&(q?n:r)}(n,r,l,o)?!function(e,t,n,r){return!t&&"x"===e.toLowerCase()&&(q?n:r)}(n,r,l,o)?jt(n,l,o)&&(e.preventDefault(),en(t,z,e)):(e.preventDefault(),en(t,B,e)):(e.preventDefault(),en(t,A,e))}(function(e,t,n,r){return e||t||n||r})(o,r,c,l)&&en(t,V,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;n instanceof Node&&"touch"!==r&&Ss(t,(()=>{Es(bt(n))||(Pr=!0)}))}],["compositionstart",function(e,t){Ss(t,(()=>{const n=Ri();if(ki(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();vt(r.key),(e.timeStamp<Tr+Sr||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||hi(i)&&i.getStyle()!==n.style)&&en(t,l,Ee)}}))}],["compositionend",function(e,t){G?Lr=!0:Ss(t,(()=>{Br(t,e.data)}))}],["input",function(e,t){e.stopPropagation(),Ss(t,(()=>{const n=Ri(),r=e.data,i=Ar(e);if(null!=r&&ki(n)&&Dr(n,i,r,e.timeStamp,!1)){Lr&&(Br(t,r),Lr=!1);const i=n.anchor.getNode(),s=vn(t._window);if(null===s)return;const o=n.isBackward(),c=o?n.anchor.offset:n.focus.offset,a=o?n.focus.offset:n.anchor.offset;Q&&!n.isCollapsed()&&hi(i)&&null!==s.anchorNode&&i.getTextContent().slice(0,c)+r+i.getTextContent().slice(c+a)===At(s.anchorNode)||en(t,l,r);const u=r.length;G&&u>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=u),X||Y||ne||!t.isComposing()||(Tr=0,vt(null))}else{Bt(!1,t,null!==r?r:void 0),Lr&&(Br(t,r||void 0),Lr=!1)}is(),Xe(ls())})),wr=null}],["click",function(e,t){Ss(t,(()=>{const n=Ri(),i=vn(t._window),s=Ki();if(i)if(ki(n)){const t=n.anchor,r=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!Fs(r)&&1===Et().getChildrenSize()&&r.getTopLevelElementOrThrow().isEmpty()&&null!==s&&n.is(s))i.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()){r!==n.focus.getNode()&&(bs(r)?r.select(0):r.getParentOrThrow().select(0))}}else if("touch"===e.pointerType){const n=i.anchorNode;if(null!==n){const r=n.nodeType;if(r===re||r===ie){Ft(Wi(s,i,t,e))}}}en(t,r,e)}))}],["cut",vr],["copy",vr],["dragstart",vr],["dragover",vr],["dragend",vr],["paste",vr],["focus",vr],["blur",vr],["drop",vr]];Q&&Cr.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=Ar(e);if("deleteCompositionText"===n||G&&Zt(t))return;if("insertCompositionText"===n)return;Ss(t,(()=>{const _=Ri();if("deleteContentBackward"===n){if(null===_){const e=Ki();if(!ki(e))return;Ft(e.clone())}if(ki(_)){const n=_.anchor.key===_.focus.key;if(p=e.timeStamp,"MediaLast"===kr&&p<Tr+Sr&&t.isComposing()&&n){if(vt(null),Tr=0,setTimeout((()=>{Ss(t,(()=>{vt(null)}))}),Sr),ki(_)){const e=_.anchor.getNode();e.markDirty(),_.format=e.getFormat(),hi(e)||Re(142),_.style=e.getStyle()}}else{vt(null),e.preventDefault();const r=_.anchor.getNode(),s=r.getTextContent(),o=r.canInsertTextAfter(),l=0===_.anchor.offset&&_.focus.offset===s.length;te&&n&&!l&&o||en(t,i,!0)}return}}var p;if(!ki(_))return;const y=e.data;null!==wr&&Bt(!1,t,wr),_.dirty&&null===wr||!_.isCollapsed()||Fs(_.anchor.getNode())||null===r||_.applyDOMRange(r),wr=null;const m=_.anchor,x=_.focus,v=m.getNode(),S=x.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":en(t,l,e);break;case"insertFromComposition":vt(null),en(t,l,e);break;case"insertLineBreak":vt(null),en(t,s,!1);break;case"insertParagraph":vt(null),Fr&&!Y?(Fr=!1,en(t,s,!1)):en(t,o,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":en(t,c,e);break;case"deleteByComposition":(function(e,t){return e!==t||bs(e)||bs(t)||!e.isToken()||!t.isToken()})(v,S)&&en(t,a,e);break;case"deleteByDrag":case"deleteByCut":en(t,a,e);break;case"deleteContent":en(t,i,!1);break;case"deleteWordBackward":en(t,u,!0);break;case"deleteWordForward":en(t,u,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":en(t,f,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":en(t,f,!1);break;case"formatStrikeThrough":en(t,d,"strikethrough");break;case"formatBold":en(t,d,"bold");break;case"formatItalic":en(t,d,"italic");break;case"formatUnderline":en(t,d,"underline");break;case"historyUndo":en(t,h,void 0);break;case"historyRedo":en(t,g,void 0)}else{if("\n"===y)e.preventDefault(),en(t,s,!1);else if(y===Ne)e.preventDefault(),en(t,o,void 0);else if(null==y&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),_.insertRawText(t)}else null!=y&&Dr(_,r,y,e.timeStamp,!0)?(e.preventDefault(),en(t,l,y)):wr=y;br=e.timeStamp}}))}(e,t)]);let Tr=0,kr=null,br=0,wr=null;const Nr=new WeakMap;let Er=!1,Pr=!1,Fr=!1,Lr=!1,Or=[0,"",0,"root",0];function Dr(e,t,n,r,i){const s=e.anchor,o=e.focus,l=s.getNode(),c=ls(),a=vn(c._window),u=null!==a?a.anchorNode:null,f=s.key,d=c.getElementByKey(f),h=n.length;return f!==o.key||!hi(l)||(!i&&(!Q||br<r+50)||l.isDirty()&&h<2||Dt(n))&&s.offset!==o.offset&&!l.isComposing()||dt(l)||l.isDirty()&&h>1||(i||!Q)&&null!==d&&!l.isComposing()&&u!==gt(d)||null!==a&&null!==t&&(!t.collapsed||t.startContainer!==a.anchorNode||t.startOffset!==a.anchorOffset)||l.getFormat()!==e.format||l.getStyle()!==e.style||Wt(e,l)}function Mr(e,t){return null!==e&&null!==e.nodeValue&&e.nodeType===ie&&0!==t&&t!==e.nodeValue.length}function Ir(e,n,r){const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=e;Er&&(Er=!1,Mr(i,s)&&Mr(o,l))||Ss(n,(()=>{if(!r)return void Ft(null);if(!ct(n,i,o))return;const c=Ri();if(ki(c)){const t=c.anchor,r=t.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const i=an(n).event,s=i?i.timeStamp:performance.now(),[o,l,a,u,f]=Or,d=Et(),h=!1===n.isComposing()&&""===d.getTextContent();if(s<f+200&&t.offset===a&&t.key===u)c.format=o,c.style=l;else if("text"===t.type)hi(r)||Re(141),c.format=r.getFormat(),c.style=r.getStyle();else if("element"===t.type&&!h){const e=t.getNode();c.style="",e instanceof As&&0===e.getChildrenSize()?(c.format=e.getTextFormat(),c.style=e.getTextStyle()):c.format=0}}else{const e=t.key,n=c.focus.key,r=c.getNodes(),i=r.length,o=c.isBackward(),a=o?l:s,u=o?s:l,f=o?n:e,d=o?e:n;let h=xe,g=!1;for(let e=0;e<i;e++){const t=r[e],n=t.getTextContentSize();if(hi(t)&&0!==n&&!(0===e&&t.__key===f&&a===n||e===i-1&&t.__key===d&&0===u)&&(g=!0,h&=t.getFormat(),0===h))break}c.format=g?h:0}}en(n,t,void 0)}))}function Ar(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function Br(e,t){const n=e._compositionKey;if(vt(null),null!==n&&null!=t){if(""===t){const t=Ct(n),r=gt(e.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&hi(t)&&zt(t,r.nodeValue,null,null,!0))}if("\n"===t[t.length-1]){const t=Ri();if(ki(t)){const n=t.focus;return t.anchor.set(n.key,n.offset,n.type),void en(e,C,null)}}}Bt(!0,e,t)}function zr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Wr=new Map;function Rr(e){const t=e.target,n=vn(null==t?null:9===t.nodeType?t.defaultView:t.ownerDocument.defaultView);if(null===n)return;const r=ut(n.anchorNode);if(null===r)return;Pr&&(Pr=!1,Ss(r,(()=>{const t=Ki(),i=n.anchorNode;if(null===i)return;const s=i.nodeType;if(s!==re&&s!==ie)return;Ft(Wi(t,n,r,e))})));const i=Mt(r),s=i[i.length-1],o=s._key,l=Wr.get(o),c=l||s;c!==r&&Ir(n,c,!1),Ir(n,r,!0),r!==s?Wr.set(o,r):l&&Wr.delete(o)}function Kr(e){e._lexicalHandled=!0}function Jr(e){return!0===e._lexicalHandled}function $r(e){const t=e.ownerDocument,n=Nr.get(t);void 0===n&&Re(162);const r=n-1;r>=0||Re(164),Nr.set(t,r),0===r&&t.removeEventListener("selectionchange",Rr);const i=ft(e);at(i)?(!function(e){if(null!==e._parentEditor){const t=Mt(e),n=t[t.length-1]._key;Wr.get(n)===e&&Wr.delete(n)}else Wr.delete(e._key)}(i),e.__lexicalEditor=null):i&&Re(198);const s=zr(e);for(let e=0;e<s.length;e++)s[e]();e.__lexicalEventHandles=[]}function Ur(e,t,n){is();const r=e.__key,i=e.getParent();if(null===i)return;const s=function(e){const t=Ri();if(!ki(t)||!bs(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),s=r.getNode();return cn(i,e)&&n.set(e.__key,0,"element"),cn(s,e)&&r.set(e.__key,0,"element"),t}(e);let o=!1;if(ki(s)&&t){const t=s.anchor,n=s.focus;t.key===r&&(Ui(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Ui(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else wi(s)&&t&&e.isSelected()&&e.selectPrevious();if(ki(s)&&t&&!o){const t=e.getIndexWithinParent();mt(e),Ji(s,i,t,-1)}else mt(e);n||dn(i)||i.canBeEmpty()||!i.isEmpty()||Ur(i,t),t&&Fs(i)&&i.isEmpty()&&i.selectEnd()}class Vr{static getType(){Re(64,this.name)}static clone(e){Re(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,yt(this,e)}getType(){return this.__type}isInline(){Re(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=Ct(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||Ri();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(hi(this))return n;if(ki(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Es(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor,r=n.getNode();if(n.offset===r.getChildrenSize()&&r.is(e)&&r.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:Ct(e)}getParentOrThrow(){const e=this.getParent();return null===e&&Re(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(dn(t))return bs(e)||e===this&&Es(e)||Re(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&Re(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:Ct(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:Ct(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();bs(this)&&t.unshift(this),bs(e)&&n.unshift(e);const r=t.length,i=n.length;if(0===r||0===i||t[r-1]!==n[i-1])return null;const s=new Set(n);for(let e=0;e<r;e++){const n=t[e];if(s.has(n))return n}return null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,r=0,i=this;for(;;){const e=i.getParentOrThrow();if(e===t){n=i.getIndexWithinParent();break}i=e}for(i=e;;){const e=i.getParentOrThrow();if(e===t){r=i.getIndexWithinParent();break}i=e}return n<r}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;null!==n;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;const o=bs(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==o){i=o;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let a=null,u=c;do{if(null===u&&Re(68),a=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==a||r.has(u.__key)||n.push(u)}while(null===a);i=a}return t||n.reverse(),n}isDirty(){const e=ls()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=Ct(this.__key);return null===e&&Re(113),e}getWritable(){is();const e=os(),t=ls(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,o=Ri();if(null!==o&&o.setCachedNodes(null),s.has(r))return xt(i),i;const l=Dn(i);return s.add(r),xt(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){Re(70)}updateDOM(e,t,n){Re(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){Re(72)}static importJSON(e){Re(18,this.name)}static transform(){return null}remove(e){Ur(this,!0,e)}replace(e,t){is();let n=Ri();null!==n&&(n=n.clone()),_n(this,e);const r=this.getLatest(),i=this.__key,s=e.__key,o=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;mt(o);const a=r.getPreviousSibling(),u=r.getNextSibling(),f=r.__prev,d=r.__next,h=r.__parent;if(Ur(r,!1,!0),null===a)l.__first=s;else{a.getWritable().__next=s}if(o.__prev=f,null===u)l.__last=s;else{u.getWritable().__prev=s}if(o.__next=d,o.__parent=h,l.__size=c,t&&(bs(this)&&bs(o)||Re(139),this.getChildren().forEach((e=>{o.append(e)}))),ki(n)){Ft(n);const e=n.anchor,t=n.focus;e.key===i&&Si(e,o),t.key===i&&Si(t,o)}return St()===i&&vt(s),o}insertAfter(e,t=!0){is(),_n(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=Ri();let o=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(mt(r),ki(s)){const e=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else{c.getWritable().__prev=u}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,t&&ki(s)){const e=this.getIndexWithinParent();Ji(s,a,e+1);const t=a.__key;o&&s.anchor.set(t,e+2,"element"),l&&s.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){is(),_n(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;mt(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===s)o.__first=i;else{s.getWritable().__next=i}o.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Ri();if(t&&ki(a)){Ji(a,this.getParentOrThrow(),c)}return e}isParentRequired(){return!1}createParentElementNode(){return zs()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){is();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(bs(n))return n.select();if(!hi(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){is();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(bs(n))return n.select(0,0);if(!hi(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class jr extends Vr{static getType(){return"linebreak"}static clone(e){return new jr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&wn(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Qr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&Qr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&wn(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Qr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&Qr(r))return!0}return!1}(e)?null:{conversion:Hr,priority:0}}}static importJSON(e){return qr()}exportJSON(){return{type:"linebreak",version:1}}}function Hr(e){return{node:qr()}}function qr(){return gn(new jr)}function Gr(e){return e instanceof jr}function Qr(e){return e.nodeType===ie&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Xr(e,t){return 16&t?"code":t&me?"mark":32&t?"sub":64&t?"sup":null}function Yr(e,t){return 1&t?"strong":2&t?"em":"span"}function Zr(e,t,n,r,i){const s=r.classList;let o=qt(i,"base");void 0!==o&&s.add(...o),o=qt(i,"underlineStrikethrough");let l=!1;const c=t&ge&&t&he;void 0!==o&&(n&ge&&n&he?(l=!0,c||s.add(...o)):c&&s.remove(...o));for(const e in De){const r=De[e];if(o=qt(i,e),void 0!==o)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&s.remove(...o);continue}t&r&&(!c||"underline"!==e)&&"strikethrough"!==e||s.add(...o)}else t&r&&s.remove(...o)}}function ei(e,t,n){const r=t.firstChild,i=n.isComposing(),s=e+(i?we:"");if(null==r)t.textContent=s;else{const e=r.nodeValue;if(e!==s)if(i||G){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,s=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;s+i<n&&s+i<r&&e[n-s-1]===t[r-s-1];)s++;return[i,n-i-s,t.slice(i,r-s)]}(e,s);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=s}}function ti(e,t,n,r,i,s){ei(i,e,t);const o=s.theme.text;void 0!==o&&Zr(0,0,r,e,o)}function ni(e,t){const n=document.createElement(t);return n.appendChild(e),n}class ri extends Vr{static getType(){return"text"}static clone(e){return new ri(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return ze[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===St()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=De[e];return!!(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return _t(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,r=Xr(0,n),i=Yr(0,n),s=null===r?i:r,o=document.createElement(s);let l=o;this.hasFormat("code")&&o.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),o.appendChild(l));ti(l,this,0,n,this.__text,e);const c=this.__style;return""!==c&&(o.style.cssText=c),o}updateDOM(e,t,n){const r=this.__text,i=e.__format,s=this.__format,o=Xr(0,i),l=Xr(0,s),c=Yr(0,i),a=Yr(0,s);if((null===o?c:o)!==(null===l?a:l))return!0;if(o===l&&c!==a){const e=t.firstChild;null==e&&Re(48);const i=document.createElement(a);return ti(i,this,0,s,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==o&&(u=t.firstChild,null==u&&Re(49)),ei(r,u,this);const f=n.theme.text;void 0!==f&&i!==s&&Zr(0,i,s,u,f);const d=e.__style,h=this.__style;return d!==h&&(t.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:ci,priority:0}),b:()=>({conversion:si,priority:0}),code:()=>({conversion:fi,priority:0}),em:()=>({conversion:fi,priority:0}),i:()=>({conversion:fi,priority:0}),s:()=>({conversion:fi,priority:0}),span:()=>({conversion:ii,priority:0}),strong:()=>({conversion:fi,priority:0}),sub:()=>({conversion:fi,priority:0}),sup:()=>({conversion:fi,priority:0}),u:()=>({conversion:fi,priority:0})}}static importJSON(e){const t=di(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return null!==t&&Tn(t)||Re(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=ni(t,"b")),this.hasFormat("italic")&&(t=ni(t,"i")),this.hasFormat("strikethrough")&&(t=ni(t,"s")),this.hasFormat("underline")&&(t=ni(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?De[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Me[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=_t(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Be[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){is();let n=e,r=t;const i=Ri(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const e=s.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!ki(i))return Ii(o,n,o,r,"text","text");{const e=St();e!==i.anchor.key&&e!==i.focus.key||vt(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let l=e;l<0&&(l=o+l,l<0&&(l=0));const c=Ri();if(r&&ki(c)){const t=e+o;c.setTextNodeRange(i,t,i,t)}const a=s.slice(0,l)+n+s.slice(l+t);return i.__text=a,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){is();const t=this.getLatest(),n=t.getTextContent(),r=t.__key,i=St(),s=new Set(e),o=[],l=n.length;let c="";for(let e=0;e<l;e++)""!==c&&s.has(e)&&(o.push(c),c=""),c+=n[e];""!==c&&o.push(c);const a=o.length;if(0===a)return[];if(o[0]===n)return[t];const u=o[0],f=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),_=t.__detail;let p=!1;t.isSegmented()?(d=di(u),d.__format=h,d.__style=g,d.__detail=_,p=!0):(d=t.getWritable(),d.__text=u);const y=Ri(),m=[d];let x=u.length;for(let e=1;e<a;e++){const t=o[e],n=t.length,s=di(t).getWritable();s.__format=h,s.__style=g,s.__detail=_;const l=s.__key,c=x+n;if(ki(y)){const e=y.anchor,t=y.focus;e.key===r&&"text"===e.type&&e.offset>x&&e.offset<=c&&(e.key=l,e.offset-=x,y.dirty=!0),t.key===r&&"text"===t.type&&t.offset>x&&t.offset<=c&&(t.key=l,t.offset-=x,y.dirty=!0)}i===r&&vt(l),x=c,m.push(s)}if(null!==f){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&xt(t),null!==n&&xt(n)}(this);const e=f.getWritable(),t=this.getIndexWithinParent();p?(e.splice(t,0,m),this.remove()):e.splice(t,1,m),ki(y)&&Ji(y,f,t,a-1)}return m}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||Re(50);const n=this.__key,r=e.__key,i=this.__text,s=i.length;St()===r&&vt(n);const o=Ri();if(ki(o)){const i=o.anchor,l=o.focus;null!==i&&i.key===r&&(Vi(i,t,n,e,s),o.dirty=!0),null!==l&&l.key===r&&(Vi(l,t,n,e,s),o.dirty=!0)}const l=e.__text,c=t?l+i:i+l;this.setTextContent(c);const a=this.getWritable();return e.remove(),a}isTextEntity(){return!1}}function ii(e){return{forChild:gi(e.style),node:null}}function si(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:gi(t.style,n?void 0:"bold"),node:null}}const oi=new WeakMap;function li(e){return"PRE"===e.nodeName||e.nodeType===re&&void 0!==e.style&&void 0!==e.style.whiteSpace&&e.style.whiteSpace.startsWith("pre")}function ci(e){const t=e;null===e.parentElement&&Re(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=oi.get(n))&&!li(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)oi.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(qr()):"\t"===r?t.push(pi()):""!==r&&t.push(di(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=ai(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=ai(e,!0));){if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:di(n)}}function ai(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,n.nodeType===re){const e=n.style.display;if(""===e&&!bn(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(n.nodeType===ie)return n;if("BR"===n.nodeName)return null}}const ui={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function fi(e){const t=ui[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:gi(e.style,t),node:null}}function di(e=""){return gn(new ri(e))}function hi(e){return e instanceof ri}function gi(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===e.fontStyle,l=r.includes("underline"),c=e.verticalAlign;return e=>hi(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),o&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==c||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==c||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class _i extends ri{static getType(){return"tab"}static clone(e){return new _i(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=pi();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){Re(126)}setDetail(e){Re(127)}setMode(e){Re(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function pi(){return gn(new _i)}function yi(e){return e instanceof _i}class mi{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const r=this.offset,i=e.offset;if(bs(t)){const e=t.getDescendantByIndex(r);t=null!=e?e:t}if(bs(n)){const e=n.getDescendantByIndex(i);n=null!=e?e:n}return t===n?r<i:t.isBefore(n)}getNode(){const e=Ct(this.key);return null===e&&Re(20),e}set(e,t,n){const r=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,rs()||(St()===i&&vt(e),null!==r&&(r.setCachedNodes(null),r.dirty=!0))}}function xi(e,t,n){return new mi(e,t,n)}function vi(e,t){let n=t.__key,r=e.offset,i="element";if(hi(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!bs(t)){const e=t.getNextSibling();if(hi(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Si(e,t){if(bs(t)){const n=t.getLastDescendant();bs(n)||hi(n)?vi(e,n):vi(e,t)}else vi(e,t)}function Ci(e,t,n,r){e.key=t,e.offset=n,e.type=r}class Ti{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!wi(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Ti(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(hi(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=Ct(e);null!==t&&n.push(t)}return rs()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function ki(e){return e instanceof bi}class bi{constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!ki(e)&&(this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this.anchor,n=this.focus,r=t.isBefore(n),i=r?t:n,s=r?n:t;let o=i.getNode(),l=s.getNode();const c=i.offset,a=s.offset;if(bs(o)){const e=o.getDescendantByIndex(c);o=null!=e?e:o}if(bs(l)){let e=l.getDescendantByIndex(a);null!==e&&e!==o&&l.getChildAtIndex(a)===e&&(e=e.getPreviousSibling()),l=null!=e?e:l}let u;return u=o.is(l)?bs(o)&&o.getChildrenSize()>0?[]:[o]:o.getNodesBetween(l),rs()||(this._cachedNodes=u),u}setTextNodeRange(e,t,n,r){Ci(this.anchor,e.__key,t,"text"),Ci(this.focus,n.__key,r,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,l]=Ei(this);let c="",a=!0;for(let u=0;u<e.length;u++){const f=e[u];if(bs(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,hi(f)){let e=f.getTextContent();f===t?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=o<l?e.slice(o,l):e.slice(l,o)):e=s?e.slice(o):e.slice(l):f===n&&(e=s?e.slice(0,l):e.slice(0,o)),c+=e}else!Es(f)&&!Gr(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(e){const t=ls(),n=t.getEditorState()._selection,r=Di(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,s]=r;Ci(this.anchor,i.key,i.offset,i.type),Ci(this.focus,s.key,s.offset,s.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new bi(xi(e.key,e.offset,e.type),xi(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=_t(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=De[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(qr()):"\t"===r?n.push(pi()):n.push(di(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let s=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(s=n,o=t),"element"===s.type&&function(e,t,n,r){const i=e.getNode(),s=i.getChildAtIndex(e.offset),o=di(),l=Fs(i)?zs().append(o):o;o.setFormat(n),o.setStyle(r),null===s?i.append(l):s.insertBefore(l),e.is(t)&&t.set(o.__key,0,"text"),e.set(o.__key,0,"text")}(s,o,r,i);const l=s.offset;let c=o.offset;const a=this.getNodes(),u=a.length;let f=a[0];hi(f)||Re(26);const d=f.getTextContent().length,h=f.getParentOrThrow();let g=a[u-1];if(1===u&&"element"===o.type&&(c=d,o.set(s.key,c,"text")),this.isCollapsed()&&l===d&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!h.canInsertTextAfter()&&null===f.getNextSibling())){let t=f.getNextSibling();if(hi(t)&&t.canInsertTextBefore()&&!dt(t)||(t=di(),t.setFormat(r),t.setStyle(i),h.canInsertTextAfter()?f.insertAfter(t):h.insertAfter(t)),t.select(0,0),f=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!h.canInsertTextBefore()&&null===f.getPreviousSibling())){let t=f.getPreviousSibling();if(hi(t)&&!dt(t)||(t=di(),t.setFormat(r),h.canInsertTextBefore()?f.insertBefore(t):h.insertBefore(t)),t.select(),f=t,""!==e)return void this.insertText(e)}else if(f.isSegmented()&&l!==d){const e=di(f.getTextContent());e.setFormat(r),f.replace(e),f=e}else if(!this.isCollapsed()&&""!==e){const t=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||bs(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Oi(this.anchor,this.focus,null),void this.insertText(e)}if(1===u){if(f.isToken()){const t=di(e);return t.select(),void f.replace(t)}const t=f.getFormat(),n=f.getStyle();if(l!==c||t===r&&n===i){if(yi(f)){const t=di(e);return t.setFormat(r),t.setStyle(i),t.select(),void f.replace(t)}}else{if(""!==f.getTextContent()){const t=di(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)f.insertBefore(t,!1);else{const[e]=f.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}f.setFormat(r),f.setStyle(i)}const s=c-l;f=f.spliceText(l,s,e,!0),""===f.getTextContent()?f.remove():"text"===this.anchor.type&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{const t=new Set([...f.getParentKeys(),...g.getParentKeys()]),n=bs(f)?f:f.getParentOrThrow();let r=bs(g)?g:g.getParentOrThrow(),i=g;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===o.type&&(0!==c||""===g.getTextContent())||"element"===o.type&&g.getIndexWithinParent()<c)if(hi(g)&&!g.isToken()&&c!==g.getTextContentSize()){if(g.isSegmented()){const e=di(g.getTextContent());g.replace(e),g=e}Fs(o.getNode())||"text"!==o.type||(g=g.spliceText(0,c,"")),t.add(g.__key)}else{const e=g.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?g.remove():e.remove()}else t.add(g.__key);const s=r.getChildren(),h=new Set(a),_=n.is(r),p=n.isInline()&&null===f.getNextSibling()?n:f;for(let e=s.length-1;e>=0;e--){const t=s[e];if(t.is(f)||bs(t)&&t.isParentOf(f))break;t.isAttached()&&(!h.has(t)||t.is(i)?_||p.insertAfter(t,!1):t.remove())}if(!_){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(f.isToken())if(l===d)f.select();else{const t=di(e);t.select(),f.replace(t)}else f=f.spliceText(l,d-l,e,!0),""===f.getTextContent()?f.remove():f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<u;e++){const n=a[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),r=this.isBackward()?t:e,i=this.isBackward()?e:t;let s=r.getNode(),o=i.getNode();const l=En(s,Nn),c=En(o,Nn);hi(s)&&s.isToken()&&r.offset<s.getTextContentSize()&&(r.offset=0),i.offset>0&&hi(o)&&o.isToken()&&(i.offset=o.getTextContentSize()),n.forEach((e=>{cn(s,e)||cn(o,e)||e.getKey()===s.getKey()||e.getKey()===o.getKey()||e.remove()}));const a=(e,t)=>{if(""===e.getTextContent())e.remove();else if(0!==t&&dt(e)){const t=di(e.getTextContent());return t.setFormat(e.getFormat()),t.setStyle(e.getStyle()),e.replace(t)}};if(s===o&&hi(s)){const n=Math.abs(t.offset-e.offset);return s.spliceText(r.offset,n,"",!0),void a(s,n)}if(hi(s)){const e=s.getTextContentSize()-r.offset;s.spliceText(r.offset,e,""),s=a(s,e)||s}hi(o)&&(o.spliceText(0,i.offset,""),o=a(o,i.offset)||o),s.isAttached()&&hi(s)?s.selectEnd():o.isAttached()&&hi(o)&&o.selectStart();bs(l)&&bs(c)&&l!==c&&(l.append(...c.getChildren()),c.remove(),i.set(r.key,r.offset,r.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void vt(null);const n=this.getNodes(),r=[];for(const e of n)hi(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(Ws(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},s=r.length;if(0===s)return this.toggleFormat(e),vt(null),void i(t);const o=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:o,u=c?o:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(e,t);i(g);const _=s-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(dt(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const e=d.splitText(h,y),t=0===h?e[0]:e[1];t.setFormat(g),"text"===a.type&&a.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-h,"text")}return void(this.format=g)}0===h||dt(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(e,g);y>0&&(y===p.getTextContentSize()||dt(p)||([p]=p.splitText(y)),p.setFormat(m));for(let t=f+1;t<_;t++){const n=r[t],i=n.getFormatFlags(e,m);n.setFormat(i)}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m}insertNodes(e){if(0===e.length)return;if("root"===this.anchor.key){this.insertParagraph();const t=Ri();return ki(t)||Re(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=En(t,Nn),r=e[e.length-1];if(bs(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=Gi(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(bs(e)||Es(e))&&!e.isInline()))){bs(n)||Re(211,t.constructor.name,t.getType());const i=Gi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=zs();let n=null;for(let r=0;r<e.length;r++){const i=e[r],s=Gr(i);if(s||Es(i)&&i.isInline()||bs(i)&&i.isInline()||hi(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),s))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),s=i.getLastDescendant(),o=i.getChildren(),l=!bs(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1];let a=o[0];var u;bs(u=a)&&Nn(u)&&!u.isEmpty()&&bs(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(bs(n)||Re(211,t.constructor.name,t.getType()),n.append(...a.getChildren()),a=o[1]),a&&(null===n&&Re(212,t.constructor.name,t.getType()),function(e,t,n){const r=t.getParentOrThrow().getLastChild();let i=t;const s=[t];for(;i!==r;)i.getNextSibling()||Re(140),i=i.getNextSibling(),s.push(i);let o=e;for(const e of s)o=o.insertAfter(e)}(n,a));const f=En(s,Nn);l&&bs(f)&&(l.canMergeWhenEmpty()||Nn(c))&&(f.append(...l.getChildren()),l.remove()),bs(n)&&n.isEmpty()&&n.remove(),s.selectEnd();const d=bs(n)?n.getLastChild():null;Gr(d)&&f!==n&&d.remove()}insertParagraph(){if("root"===this.anchor.key){const e=zs();return Et().splice(this.anchor.offset,0,[e]),e.select(),e}const e=Gi(this),t=En(this.anchor.getNode(),Nn);bs(t)||Re(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=qr();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,r=this.anchor,i=this.focus;let s=e[0],o=e[n];const[l,c]=Ei(this);if(0===t)return[];if(1===t){if(hi(s)&&!this.isCollapsed()){const e=l>c?c:l,t=l>c?l:c,n=s.splitText(e,t),r=0===e?n[0]:n[1];return null!=r?[r]:[]}return[s]}const a=r.isBefore(i);if(hi(s)){const t=a?l:c;t===s.getTextContentSize()?e.shift():0!==t&&([,s]=s.splitText(t),e[0]=s)}if(hi(o)){const t=o.getTextContent().length,r=a?c:l;0===r?e.pop():r!==t&&([o]=o.splitText(r),e[n]=o)}return e}modify(e,t,n){const r=this.focus,i=this.anchor,s="move"===e,o=Yt(r,t);if(Es(o)&&!o.isIsolated()){if(s&&o.isKeyboardSelectable()){const e=Bi();return e.add(o.__key),void Ft(e)}const e=t?o.getPreviousSibling():o.getNextSibling();if(hi(e)){const n=e.__key,o=t?e.getTextContent().length:0;return r.set(n,o,"text"),void(s&&i.set(n,o,"text"))}{const n=o.getParentOrThrow();let l,c;return bs(e)?(c=e.__key,l=t?e.getChildrenSize():0):(l=o.getIndexWithinParent(),c=n.__key,t||l++),r.set(c,l,"element"),void(s&&i.set(c,l,"element"))}}const l=ls(),c=vn(l._window);if(!c)return;const a=l._blockCursorElement,u=l._rootElement;if(null===u||null===a||!bs(o)||o.isInline()||o.canBeEmpty()||mn(a,l,u),function(e,t,n,r){e.modify(t,n,r)}(c,e,t?"backward":"forward",n),c.rangeCount>0){const e=c.getRangeAt(0),n=this.anchor.getNode(),r=Fs(n)?n:fn(n);if(this.applyDOMRange(e),this.dirty=!0,!s){const n=this.getNodes(),i=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];cn(t,r)?i.push(t):s=!0}if(s&&i.length>0)if(t){const e=i[0];bs(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=i[i.length-1];bs(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}c.anchorNode===e.startContainer&&c.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,s=n.type;Ci(n,t.key,t.offset,t.type),Ci(t,r,i,s),e._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&bs(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(bs(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const n=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let r=n.getNode();if(this.forwardDeletion(n,r,e))return;const i=this.focus,s=Yt(i,e);if(Es(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&bs(r)&&0===r.getChildrenSize()){r.remove();const e=Bi();e.add(s.__key),Ft(e)}else{s.remove();ls().dispatchCommand(t,void 0)}return}if(!e&&bs(s)&&bs(r)&&r.isEmpty())return r.remove(),void s.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===n.offset){if(("element"===n.type?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}}else{const t="text"===i.type?i.getNode():null;if(r="text"===n.type?n.getNode():null,null!==t&&t.isSegmented()){const n=i.offset,s=t.getTextContentSize();if(t.is(r)||e&&n!==s||!e&&0!==n)return void Pi(t,e,n)}else if(null!==r&&r.isSegmented()){const i=n.offset,s=r.getTextContentSize();if(r.is(t)||e&&0!==i||!e&&i!==s)return void Pi(r,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode(),s=r.getNode();if(i===s&&"text"===n.type&&"text"===r.type){const e=n.offset,s=r.offset,o=e<s,l=o?e:s,c=o?s:e,a=c-1;if(l!==a){Dt(i.getTextContent().slice(l,c))||(t?r.offset=a:n.offset=a)}}}(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&Fs(e.getParent())&&0===e.getIndexWithinParent()&&e.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t="element"===this.anchor.type;if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&0===this.anchor.offset&&this.modify("extend",e,"character"),t){const t=e?this.anchor:this.focus;t.set(t.key,t.offset+1,t.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function wi(e){return e instanceof Ti}function Ni(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Ei(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Ni(n),Ni(r)]}function Pi(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let e=0;e<s;e++){const r=e===s-1;if(l=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function Fi(e,t,n,r){let i,s=t;if(e.nodeType===re){let o=!1;const l=e.childNodes,c=l.length,a=r._blockCursorElement;s===c&&(o=!0,s=c-1);let u=l[s],f=!1;if(u===a)u=l[s+1],f=!0;else if(null!==a){const n=a.parentNode;if(e===n){t>Array.prototype.indexOf.call(n.children,a)&&s--}}if(i=Lt(u),hi(i))s=Ot(i,o);else{let l=Lt(e);if(null===l)return null;if(bs(l)){const c=r.getElementByKey(l.getKey());null===c&&Re(214);const a=l.getDOMSlot(c);[l,s]=a.resolveChildIndex(l,c,e,t),bs(l)||Re(215),o&&s>=l.getChildrenSize()&&(s=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(s);if(bs(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=o?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=bs(u)?u:u.getParentOrThrow()),s=0}hi(u)?(i=u,l=null,s=Ot(u,o)):u!==l&&o&&!f&&(bs(l)||Re(216),s=Math.min(l.getChildrenSize(),s+1))}else{const n=l.getIndexWithinParent();s=0===t&&Es(l)&&Lt(e)===l?n:n+1,l=l.getParentOrThrow()}if(bs(l))return xi(l.__key,s,"element")}}else i=Lt(e);return hi(i)?xi(i.__key,s,"text"):null}function Li(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(t){if((n||!t)&&null===r&&bs(s)&&s.isInline()){const t=s.getPreviousSibling();hi(t)&&(e.key=t.__key,e.offset=t.getTextContent().length)}}else bs(r)&&!n&&r.isInline()?(e.key=r.__key,e.offset=r.getChildrenSize(),e.type="element"):hi(r)&&(e.key=r.__key,e.offset=r.getTextContent().length)}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(t&&bs(r)&&r.isInline())e.key=r.__key,e.offset=0,e.type="element";else if((n||t)&&null===r&&bs(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();hi(t)&&(e.key=t.__key,e.offset=0)}}}function Oi(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);Li(e,r,i),Li(t,!r,i),i&&(t.key=e.key,t.offset=e.offset,t.type=e.type);const s=ls();if(s.isComposing()&&s._compositionKey!==e.key&&ki(n)){const r=n.anchor,i=n.focus;Ci(e,r.key,r.offset,r.type),Ci(t,i.key,i.offset,i.type)}}}function Di(e,t,n,r,i,s){if(null===e||null===n||!ct(i,e,n))return null;const o=Fi(e,t,ki(s)?s.anchor:null,i);if(null===o)return null;const l=Fi(n,r,ki(s)?s.focus:null,i);if(null===l)return null;if("element"===o.type&&"element"===l.type){const t=Lt(e),r=Lt(n);if(Es(t)&&Es(r))return null}return Oi(o,l,s),[o,l]}function Mi(e){return bs(e)&&!e.isInline()}function Ii(e,t,n,r,i,s){const o=os(),l=new bi(xi(e,t,i),xi(n,r,s),0,"");return l.dirty=!0,o._selection=l,l}function Ai(){const e=xi("root",0,"element"),t=xi("root",0,"element");return new bi(e,t,0,"")}function Bi(){return new Ti(new Set)}function zi(e,t){return Wi(null,e,t,null)}function Wi(e,t,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,l="selectionchange"===o,c=!$e&&(l||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let a,u,f,d;if(ki(e)&&!c)return e.clone();if(null===t)return null;if(a=t.anchorNode,u=t.focusNode,f=t.anchorOffset,d=t.focusOffset,l&&ki(e)&&!ct(n,a,u))return e.clone();const h=Di(a,f,u,d,n,e);if(null===h)return null;const[g,_]=h;return new bi(g,_,ki(e)?e.format:0,ki(e)?e.style:"")}function Ri(){return os()._selection}function Ki(){return ls()._editorState._selection}function Ji(e,t,n,r=1){const i=e.anchor,s=e.focus,o=i.getNode(),l=s.getNode();if(!t.is(o)&&!t.is(l))return;const c=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(c,n,"element"),s.set(c,n,"element"),$i(e)}}else{const o=e.isBackward(),l=o?s:i,a=l.getNode(),u=o?i:s,f=u.getNode();if(t.is(a)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(c,Math.max(0,e+r),"element")}if(t.is(f)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),"element")}}$i(e)}function $i(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,s=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!bs(s))return;const e=s.getChildrenSize(),i=n>=e,o=i?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(hi(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,"text"),r.set(o.__key,e,"text")}}else{if(bs(s)){const e=s.getChildrenSize(),r=n>=e,i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(hi(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(bs(o)){const e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(hi(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function Ui(e,t,n,r,i){let s=null,o=0,l=null;null!==r?(s=r.__key,hi(r)?(o=r.getTextContentSize(),l="text"):bs(r)&&(o=r.getChildrenSize(),l="element")):null!==i&&(s=i.__key,hi(i)?l="text":bs(i)&&(l="element")),null!==s&&null!==l?e.set(s,o,l):(o=t.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),e.set(n.__key,o,"element"))}function Vi(e,t,n,r,i){"text"===e.type?(e.key=n,t||(e.offset+=i)):e.offset>r.getIndexWithinParent()&&(e.offset-=1)}function ji(e,t,n,r,i,s,o){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has("collaboration")&&f!==s||null!==f&<(f))return;if(!ki(t))return void(null!==e&&ct(n,l,c)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.key,_=h.key,p=nn(n,g),y=nn(n,_),m=d.offset,x=h.offset,v=t.format,S=t.style,C=t.isCollapsed();let T=p,k=y,b=!1;if("text"===d.type){T=gt(p);const e=d.getNode();b=e.getFormat()!==v||e.getStyle()!==S}else ki(e)&&"text"===e.anchor.type&&(b=!0);var w,N,E,P,F;if(("text"===h.type&&(k=gt(y)),null!==T&&null!==k)&&(C&&(null===e||b||ki(e)&&(e.format!==v||e.style!==S))&&(w=v,N=S,E=m,P=g,F=performance.now(),Or=[w,N,E,P,F]),a!==m||u!==x||l!==T||c!==k||"Range"===r.type&&C||(null!==f&&s.contains(f)||s.focus({preventScroll:!0}),"element"===d.type))){try{r.setBaseAndExtent(T,m,k,x)}catch(e){}if(!i.has("skip-scroll-into-view")&&t.isCollapsed()&&null!==s&&s===document.activeElement){const e=t instanceof bi&&"element"===t.anchor.type?T.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=n.ownerDocument,i=r.defaultView;if(null===i)return;let{top:s,bottom:o}=t,l=0,c=0,a=n;for(;null!==a;){const t=a===r.body;if(t)l=0,c=an(e).innerHeight;else{const e=a.getBoundingClientRect();l=e.top,c=e.bottom}let n=0;if(s<l?n=-(l-s):o>c&&(n=o-c),0!==n)if(t)i.scrollBy(0,n);else{const e=a.scrollTop;a.scrollTop+=n;const t=a.scrollTop-e;s-=t,o-=t}if(t)break;a=rn(a)}}(n,t,s)}}Er=!0}}function Hi(e){let t=Ri()||Ki();null===t&&(t=Et().selectEnd()),t.insertNodes(e)}function qi(){const e=Ri();return null===e?"":e.getTextContent()}function Gi(e){let t=e;e.isCollapsed()||t.removeText();const n=Ri();ki(n)&&(t=n),ki(t)||Re(161);const r=t.anchor;let i=r.getNode(),s=r.offset;for(;!Nn(i);)[i,s]=Qi(i,s);return s}function Qi(e,t){const n=e.getParent();if(!n){const e=zs();return Et().append(e),e.select(),[Et(),0]}if(hi(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!bs(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new bi(xi(e.__key,t,"element"),xi(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}let Xi=null,Yi=null,Zi=!1,es=!1,ts=0;const ns={characterData:!0,childList:!0,subtree:!0};function rs(){return Zi||null!==Xi&&Xi._readOnly}function is(){Zi&&Re(13)}function ss(){ts>99&&Re(14)}function os(){return null===Xi&&Re(195,cs()),Xi}function ls(){return null===Yi&&Re(196,cs()),Yi}function cs(){let e=0;const t=new Set,n=Hs.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ft(r);if(at(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function as(){return Yi}function us(e,t,n){const r=t.__type,i=function(e,t){const n=e._nodes.get(t);return void 0===n&&Re(30,t),n}(e,r);let s=n.get(r);void 0===s&&(s=Array.from(i.transforms),n.set(r,s));const o=s.length;for(let e=0;e<o&&(s[e](t),t.isAttached());e++);}function fs(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function ds(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function hs(e){return gs(e,ls()._nodes)}function gs(e,t){const n=e.type,r=t.get(n);void 0===r&&Re(17,n);const i=r.klass;e.type!==i.getType()&&Re(18,i.name);const s=i.importJSON(e),o=e.children;if(bs(s)&&Array.isArray(o))for(let e=0;e<o.length;e++){const n=gs(o[e],t);s.append(n)}return s}function _s(e,t,n){const r=Xi,i=Zi,s=Yi;Xi=t,Zi=!0,Yi=e;try{return n()}finally{Xi=r,Zi=i,Yi=s}}function ps(e,n){const r=e._pendingEditorState,i=e._rootElement,s=e._headless||null===i;if(null===r)return;const o=e._editorState,l=o._selection,c=r._selection,a=e._dirtyType!==se,u=Xi,f=Zi,d=Yi,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!s&&a&&null!==g){Yi=e,Xi=r,Zi=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),_=mr(o,r,e,t,n,i)}catch(t){if(t instanceof Error&&e._onError(t),es)throw t;return Vs(e,null,i,r),Ye(e),e._dirtyType=le,es=!0,ps(e,o),void(es=!1)}finally{g.observe(i,ns),e._updating=h,Xi=u,Zi=f,Yi=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,v=e._deferred;a&&(e._dirtyType=se,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let s;for(s in r)i.has(s)||(r===n&&(r=wt(e)),delete r[s])}(e,r);const S=s?null:vn(e._window);if(e._editable&&null!==S&&(a||null===c||c.dirty)){Yi=e,Xi=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&mn(t,e,i),ji(l,c,e,S,x,i)}xn(e,i,c),null!==g&&g.observe(i,ns)}finally{Yi=d,Xi=u}}null!==_&&function(e,t,n,r,i){const s=Array.from(e._listeners.mutation),o=s.length;for(let e=0;e<o;e++){const[o,l]=s[e],c=t.get(l);void 0!==c&&o(c,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}(e,_,x,p,o),ki(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(t,void 0);const C=e._pendingDecorators;null!==C&&(e._decorators=C,e._pendingDecorators=null,ys("decorator",e,!0,C)),function(e,t,n){const r=Nt(t),i=Nt(n);r!==i&&ys("textcontent",e,!0,i)}(e,n||o,r),ys("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,normalizedNodes:m,prevEditorState:n||o,tags:x}),function(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,v),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;vs(e,t,r)}}}(e)}function ys(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++)n[e].apply(null,r)}finally{t._updating=i}}function ms(e,t,n){if(!1===e._updating||Yi!==e){let r=!1;return e.update((()=>{r=ms(e,t,n)})),r}const r=Mt(e);for(let i=4;i>=0;i--)for(let s=0;s<r.length;s++){const o=r[s]._commands.get(t);if(void 0!==o){const t=o[i];if(void 0!==t){const r=Array.from(t),i=r.length;for(let t=0;t<i;t++)if(!0===r[t](n,e))return!0}}}return!1}function xs(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t;let s;if(void 0!==i){if(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete){const t=e._pendingEditorState;null===t&&Re(191),t._flushSync=!0}s&&e._deferred.push(s),ds(e,i.tag)}n()}}return r}function vs(e,t,n){const r=e._updateTags;let i,s=!1,o=!1;void 0!==n&&(i=n.onUpdate,ds(e,n.tag),s=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let c=e._pendingEditorState,a=!1;(null===c||c._readOnly)&&(c=e._pendingEditorState=Ls(c||l),a=!0),c._flushSync=o;const u=Xi,f=Zi,d=Yi,h=e._updating;Xi=c,Zi=!1,e._updating=!0,Yi=e;try{a&&(e._headless?null!==l._selection&&(c._selection=l._selection.clone()):c._selection=function(e){const t=e.getEditorState()._selection,n=vn(e._window);return ki(t)||null==t?Wi(t,n,e,null):t.clone()}(e));const n=e._compositionKey;t(),s=xs(e,s),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(ki(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==se&&(s?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);hi(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&tt(t)}}(c,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,s=St(),o=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);hi(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&tt(r),void 0!==r&&fs(r,s)&&us(t,r,o),n.add(e)}if(l=t._dirtyLeaves,c=l.size,c>0){ts++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map;for(const e of a){const n=e[0],l=e[1];if("root"!==n&&!l)continue;const c=i.get(n);void 0!==c&&fs(c,s)&&us(t,c,o),r.set(n,l)}l=t._dirtyLeaves,c=l.size,a=t._dirtyElements,u=a.size,ts++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),xs(e),function(e,t,n,r){const i=e._nodeMap,s=t._nodeMap,o=[];for(const[e]of r){const t=s.get(e);void 0!==t&&(t.isAttached()||(bs(t)&&Bn(t,e,i,s,o,r),i.has(e)||r.delete(e),o.push(e)))}for(const e of o)s.delete(e);for(const e of n){const t=s.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),s.delete(e))}}(l,c,e._dirtyLeaves,e._dirtyElements));n!==e._compositionKey&&(c._flushSync=!0);const r=c._selection;if(ki(r)){const e=c._nodeMap,t=r.anchor.key,n=r.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||Re(19)}else wi(r)&&0===r._nodes.size&&(c._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=le,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void ps(e)}finally{Xi=u,Zi=f,Yi=d,e._updating=h,ts=0}const g=e._dirtyType!==se||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(c,e);g?c._flushSync?(c._flushSync=!1,ps(e)):a&&ot((()=>{ps(e)})):(c._flushSync=!1,a&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Ss(e,t,n){e._updating?e._updates.push([t,n]):vs(e,t,n)}class Cs{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Cs(this.element,e,this.after)}withAfter(e){return new Cs(this.element,this.before,e)}withElement(e){return new Cs(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&Re(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&Re(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&Re(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(Y||X);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=Ts(t,n);i.push(r);const s=Ts(t,this.element);let o=e.getIndexWithinParent();for(let e=0;e<s.length;e++){const t=i[e],n=s[e];if(void 0===t||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}}function Ts(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=t.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=r.previousSibling)e++;n.push(e)}return r!==e&&Re(225),n.reverse()}class ks extends Vr{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ae[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=ls()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(hi(t)&&e.push(t),bs(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;bs(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;bs(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return bs(e)&&e.getLastDescendant()||e||null}const r=t[e];return bs(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Ct(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&Re(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Ct(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&Re(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),bs(i)&&r!==n-1&&!i.isInline()&&(e+=Ne)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),bs(i)&&r!==n-1&&!i.isInline()&&(e+=Ne.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(""!==e){const t=Ie[e];return!!(this.getFormat()&t)}return!1}select(e,t){is();const n=Ri();let r=e,i=t;const s=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(hi(e)||bs(e))return e.select(0,0)}else if(!(void 0!==e&&e!==s||void 0!==t&&t!==s)){const e=this.getLastChild();if(hi(e)||bs(e))return e.select()}void 0===r&&(r=s),void 0===i&&(i=s);const o=this.__key;return ki(n)?(n.anchor.set(o,r,"element"),n.focus.set(o,i,"element"),n.dirty=!0,n):Ii(o,r,o,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?Ie[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const r=n.length,i=this.getChildrenSize(),s=this.getWritable();e+t<=i||Re(226,String(e),String(t),String(i));const o=s.__key,l=[],c=[],a=this.getChildAtIndex(e+t);let u=null,f=i-t+r;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){null===e&&Re(100);const t=e.getNextSibling(),n=e.__key;mt(e.getWritable()),c.push(n),e=t}}let d=u;for(let e=0;e<r;e++){const t=n[e];null!==d&&t.is(d)&&(u=d=d.getPreviousSibling());const r=t.getWritable();r.__parent===o&&f--,mt(r);const i=t.__key;if(null===d)s.__first=i,r.__prev=null;else{const e=d.getWritable();e.__next=i,r.__prev=e.__key}t.__key===o&&Re(76),r.__parent=o,l.push(i),d=t}if(e+t===i){if(null!==d){d.getWritable().__next=null,s.__last=d.__key}}else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(s.__size=f,c.length){const e=Ri();if(ki(e)){const t=new Set(c),n=new Set(l),{anchor:r,focus:i}=e;ws(r,t,n)&&Ui(r,r.getNode(),this,u,a),ws(i,t,n)&&Ui(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||dn(this)||this.remove()}}return s}getDOMSlot(e){return new Cs(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Tn(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function bs(e){return e instanceof ks}function ws(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Ns extends Vr{constructor(e){super(e)}decorate(e,t){Re(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Es(e){return e instanceof Ns}class Ps extends ks{static getType(){return"root"}static clone(){return new Ps}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Re(51)}getTextContent(){const e=this.__cachedText;return!rs()&&ls()._dirtyType!==se||null===e?super.getTextContent():e}remove(){Re(52)}replace(e){Re(53)}insertBefore(e){Re(54)}insertAfter(e){Re(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];bs(n)||Es(n)||Re(56)}return super.append(...e)}static importJSON(e){const t=Et();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function Fs(e){return e instanceof Ps}function Ls(e){return new Ms(new Map(e._nodeMap))}function Os(){return new Ms(new Map([["root",new Ps]]))}function Ds(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Re(130,n.name),bs(e)){const r=t.children;Array.isArray(r)||Re(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=Ds(i[e]);r.push(t)}}return t}class Ms{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return _s(t&&t.editor||null,this,e)}clone(e){const t=new Ms(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return _s(null,this,(()=>({root:Ds(Et())})))}}class Is extends ks{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class As extends ks{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=De[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return _t(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new As(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=qt(e.theme,"paragraph");if(void 0!==n){t.classList.add(...n)}return t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Bs,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Tn(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();t.style.textAlign=e;const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){const t=zs();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=zs();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||hi(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Bs(e){const t=zs();return e.style&&(t.setFormat(e.style.textAlign),Mn(e,t)),{node:t}}function zs(){return gn(new As)}function Ws(e){return e instanceof As}const Rs=0,Ks=1,Js=2,$s=3,Us=4;function Vs(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Os(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=se,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const s=e._observer;null!==s&&(s.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function js(e){const t=e||{},n=as(),r=t.theme||{},i=void 0===e?n:t.parentEditor||null,s=t.disableEvents||!1,o=Os(),l=t.namespace||(null!==i?i._config.namespace:It()),c=t.editorState,a=[Ps,ri,jr,_i,As,Is,...t.nodes||[]],{onError:u,html:f}=t,d=void 0===t.editable||t.editable;let h;if(void 0===e&&null!==n)h=n._nodes;else{h=new Map;for(let e=0;e<a.length;e++){let t=a[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}const i=t.getType(),s=t.transform(),o=new Set;null!==s&&o.add(s),h.set(i,{exportDOM:f&&f.export?f.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,transforms:o})}}const g=new Hs(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(h,f?f.import:void 0),d);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=le),g}class Hs{constructor(e,t,n,r,i,s,o){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=se,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=It(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&Re(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&Re(36,String(e));const s=i[n];return s.add(t),()=>{s.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&Re(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=On(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}var s,o;return s=this,o=e.getType(),Ss(s,(()=>{const e=os();if(e.isEmpty())return;if("root"===o)return void Et().markDirty();const t=e._nodeMap;for(const[,e]of t)e.markDirty()}),null===s._pendingEditorState?{tag:"history-merge"}:void 0),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return en(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=qt(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Vs(this,t,e,r),null!==t&&(this._config.disableEvents||$r(t),null!=n&&t.classList.remove(...n)),null!==e){const t=function(e){const t=e.ownerDocument;return t&&t.defaultView||null}(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=le,Ye(this),this._updateTags.add("history-merge"),ps(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=Nr.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Rr),Nr.set(n,(r||0)+1),e.__lexicalEditor=t;const i=zr(e);for(let n=0;n<Cr.length;n++){const[r,s]=Cr[n],o="function"==typeof s?e=>{Jr(e)||(Kr(e),(t.isEditable()||"click"===r)&&s(e,t))}:e=>{if(Jr(e))return;Kr(e);const n=t.isEditable();switch(r){case"cut":return n&&en(t,B,e);case"copy":return en(t,A,e);case"paste":return n&&en(t,c,e);case"dragstart":return n&&en(t,D,e);case"dragover":return n&&en(t,M,e);case"dragend":return n&&en(t,I,e);case"focus":return n&&en(t,$,e);case"blur":return n&&en(t,U,e);case"drop":return n&&en(t,L,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._editorState=r,this._pendingEditorState=null,this._window=null;ys("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&Re(38);let n=e;n._readOnly&&(n=Ls(e),n._selection=e._selection?e._selection.clone():null),Xe(this);const r=this._pendingEditorState,i=this._updateTags,s=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=s&&i.add(s),ps(this)),this._pendingEditorState=n,this._dirtyType=le,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||ps(this)}parseEditorState(e,t){return function(e,t,n){const r=Os(),i=Xi,s=Zi,o=Yi,l=t._dirtyElements,c=t._dirtyLeaves,a=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Xi=r,Zi=!1,Yi=t;try{const i=t._nodes;gs(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=c,t._cloneNotNeeded=a,t._dirtyType=u,Xi=i,Zi=s,Yi=o}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return ps(this),this.getEditorState().read(e,{editor:this})}update(e,t){Ss(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ss(this,(()=>{const e=Ri(),n=Et();null!==e?e.dirty=!0:0!==n.getChildrenSize()&&("rootStart"===t.defaultSelection?n.selectStart():n.selectEnd())}),{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=vn(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ys("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Hs.version="0.20.2+prod.esm";export{on as $addUpdateTag,gn as $applyNodeReplacement,Dn as $cloneWithProperties,hn as $copyNode,qr as $createLineBreakNode,Bi as $createNodeSelection,zs as $createParagraphNode,xi as $createPoint,Ai as $createRangeSelection,zi as $createRangeSelectionFromDom,pi as $createTabNode,di as $createTextNode,Yt as $getAdjacentNode,Ei as $getCharacterOffsets,Pn as $getEditor,bt as $getNearestNodeFromDOMNode,fn as $getNearestRootOrShadowRoot,Ct as $getNodeByKey,pn as $getNodeByKeyOrThrow,Ki as $getPreviousSelection,Et as $getRoot,Ri as $getSelection,qi as $getTextContent,cn as $hasAncestor,sn as $hasUpdateTag,Hi as $insertNodes,Mi as $isBlockElementNode,Es as $isDecoratorNode,bs as $isElementNode,un as $isInlineElementOrDecoratorNode,pt as $isLeafNode,Gr as $isLineBreakNode,wi as $isNodeSelection,Ws as $isParagraphNode,ki as $isRangeSelection,Fs as $isRootNode,dn as $isRootOrShadowRoot,yi as $isTabNode,hi as $isTextNode,dt as $isTokenOrSegmented,Qt as $nodesOfType,nt as $normalizeSelection__EXPERIMENTAL,ln as $onUpdate,hs as $parseSerializedNode,Ht as $selectAll,vt as $setCompositionKey,Ft as $setSelection,Sn as $splitNode,Is as ArtificialNode__DO_NOT_USE,U as BLUR_COMMAND,K as CAN_REDO_COMMAND,J as CAN_UNDO_COMMAND,W as CLEAR_EDITOR_COMMAND,R as CLEAR_HISTORY_COMMAND,r as CLICK_COMMAND,Us as COMMAND_PRIORITY_CRITICAL,Rs as COMMAND_PRIORITY_EDITOR,$s as COMMAND_PRIORITY_HIGH,Ks as COMMAND_PRIORITY_LOW,Js as COMMAND_PRIORITY_NORMAL,l as CONTROLLED_TEXT_INSERTION_COMMAND,A as COPY_COMMAND,B as CUT_COMMAND,i as DELETE_CHARACTER_COMMAND,f as DELETE_LINE_COMMAND,u as DELETE_WORD_COMMAND,I as DRAGEND_COMMAND,M as DRAGOVER_COMMAND,D as DRAGSTART_COMMAND,L as DROP_COMMAND,Ns as DecoratorNode,ks as ElementNode,$ as FOCUS_COMMAND,O as FORMAT_ELEMENT_COMMAND,d as FORMAT_TEXT_COMMAND,P as INDENT_CONTENT_COMMAND,s as INSERT_LINE_BREAK_COMMAND,o as INSERT_PARAGRAPH_COMMAND,E as INSERT_TAB_COMMAND,xe as IS_ALL_FORMATTING,fe as IS_BOLD,_e as IS_CODE,me as IS_HIGHLIGHT,de as IS_ITALIC,he as IS_STRIKETHROUGH,pe as IS_SUBSCRIPT,ye as IS_SUPERSCRIPT,ge as IS_UNDERLINE,S as KEY_ARROW_DOWN_COMMAND,m as KEY_ARROW_LEFT_COMMAND,p as KEY_ARROW_RIGHT_COMMAND,v as KEY_ARROW_UP_COMMAND,k as KEY_BACKSPACE_COMMAND,w as KEY_DELETE_COMMAND,_ as KEY_DOWN_COMMAND,C as KEY_ENTER_COMMAND,b as KEY_ESCAPE_COMMAND,V as KEY_MODIFIER_COMMAND,T as KEY_SPACE_COMMAND,N as KEY_TAB_COMMAND,jr as LineBreakNode,y as MOVE_TO_END,x as MOVE_TO_START,F as OUTDENT_CONTENT_COMMAND,c as PASTE_COMMAND,As as ParagraphNode,g as REDO_COMMAND,a as REMOVE_TEXT_COMMAND,Ps as RootNode,t as SELECTION_CHANGE_COMMAND,n as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,z as SELECT_ALL_COMMAND,De as TEXT_TYPE_TO_FORMAT,_i as TabNode,ri as TextNode,h as UNDO_COMMAND,e as createCommand,js as createEditor,vn as getDOMSelection,gt as getDOMTextNode,ft as getEditorPropertyFromDOMNode,ut as getNearestEditorFromDOMNode,wn as isBlockDomNode,rs as isCurrentlyReadOnlyMode,ht as isDOMTextNode,An as isDOMUnmanaged,kn as isDocumentFragment,Cn as isHTMLAnchorElement,Tn as isHTMLElement,bn as isInlineDomNode,at as isLexicalEditor,lt as isSelectionCapturedInDecoratorInput,ct as isSelectionWithinEditor,st as resetRandomKey,In as setDOMUnmanaged,Mn as setNodeIndentFromDOM};
|