/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
'use strict';var ba=require("lexical");let ca={},ea={},fa={},ha={},ia={},ja={},ka={},ma={},na={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={};function q(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
let Oa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Pa=Oa&&"documentMode"in document?document.documentMode:null,t=Oa&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qa=Oa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ra=Oa&&"InputEvent"in window&&!Pa?"getTargetRanges"in new window.InputEvent("input"):!1,Sa=Oa&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ta=Oa&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
!window.MSStream,Wa=Oa&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xa=Sa||Ta?"\u00a0":"\u200b",Ya=Qa?"\u00a0":Xa,Za=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,$a=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,ab={bold:1,code:16,italic:2,strikethrough:4,subscript:32,
superscript:64,underline:8},bb={directionless:1,unmergeable:2},cb={center:2,end:6,justify:4,left:1,right:3,start:5},db={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},eb={normal:0,segmented:2,token:1},fb={0:"normal",2:"segmented",1:"token"},gb=!1,hb=0;function ib(a){hb=a.timeStamp}function jb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function kb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
function lb(a,b,c){gb=!0;let d=100<performance.now()-hb;try{v(a,()=>{let e=u()||kb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let l=!1,m="";for(var p=0;p<b.length;p++){var n=b[p],r=n.type,w=n.target,y=mb(w,h);if(!(null===y&&w!==g||z(y)))if("characterData"===r){if(n=d&&B(y))a:{n=e;r=w;var x=y;if(C(n)){var A=n.anchor.getNode();if(A.is(x)&&n.format!==A.getFormat()){n=!1;break a}}n=3===r.nodeType&&x.isAttached()}n&&(x=E(a._window),r=n=null,null!==x&&x.anchorNode===
w&&(n=x.anchorOffset,r=x.focusOffset),w=w.nodeValue,null!==w&&nb(y,w,n,r,!1))}else if("childList"===r){l=!0;r=n.addedNodes;for(x=0;x<r.length;x++){A=r[x];var U=ob(A),J=A.parentNode;null==J||A===k||null!==U||"BR"===A.nodeName&&jb(A,J,a)||(Qa&&(U=A.innerText||A.nodeValue)&&(m+=U),J.removeChild(A))}n=n.removedNodes;r=n.length;if(0<r){x=0;for(A=0;A<r;A++)if(J=n[A],"BR"===J.nodeName&&jb(J,w,a)||k===J)w.appendChild(J),x++;r!==x&&(w===g&&(y=h._nodeMap.get("root")),f.set(w,y))}}}if(0<f.size)for(let [da,N]of f)if(F(N))for(f=
N.getChildrenKeys(),g=da.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(da.appendChild(k),g=k):g!==k&&da.replaceChild(k,g),g=g.nextSibling);else B(N)&&N.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)y=h[p],w=y.parentNode,null==w||"BR"!==y.nodeName||jb(y,k,a)||w.removeChild(y);c.takeRecords()}null!==e&&(l&&(e.dirty=!0,pb(e)),Qa&&qb(a)&&e.insertRawText(m))})}finally{gb=!1}}
function rb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();lb(a,c,b)}}function sb(a){0===hb&&ub(a).addEventListener("textInput",ib,!0);a._observer=new MutationObserver((b,c)=>{lb(a,b,c)})}let vb=1,wb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function xb(a){var b=document.activeElement;b=null!==b?b.nodeName:null;return z(mb(a))&&("INPUT"===b||"TEXTAREA"===b)}
function yb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!xb(b)&&zb(b)===a}catch(e){return!1}}function zb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Ab(a)}return null}function Bb(a){return a.isToken()||a.isSegmented()}function Cb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Db(a,b,c){b=ab[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Eb(a){return B(a)||Fb(a)||z(a)}
function Gb(a,b){if(null!=b)a.__key=b;else{G();99<Hb&&q(14);b=H();var c=I(),d=""+vb++;c._nodeMap.set(d,a);F(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
function Ib(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Jb(a){99<Hb&&q(14);var b=a.getLatest(),c=b.__parent,d=I();let e=H(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;F(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
function K(a){G();var b=H();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function Kb(){return Lb()?null:H()._compositionKey}function L(a,b){a=(b||I())._nodeMap.get(a);return void 0===a?null:a}function ob(a,b){let c=H();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function mb(a,b){for(;null!=a;){let c=ob(a,b);if(null!==c)return c;a=Ab(a)}return null}
function Mb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Nb(a){return a.read(()=>Ob().getTextContent())}function Pb(a,b){v(a,()=>{var c=I();if(!c.isEmpty())if("root"===b)Ob().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ob(){return I()._nodeMap.get("root")}function pb(a){G();let b=I();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
function Qb(a){var b=H(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Ab(c)}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Rb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Sb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Tb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
function Ub(a,b,c){b=E(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=mb(d),null!==b&&B(d))){if(b===Xa&&c){let g=c.length;b=c;f=e=g}null!==b&&nb(d,b,e,f,a)}}}
function nb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Xa&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Sa||Ta)f.remove();else{let h=H();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Vb(),f.isToken()||null!==Kb()&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
(c=f.getTextContent(),c=M(c),f.replace(c),f=c)),f.setTextContent(a))}}function Wb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(B(b)||F(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
function Xb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Yb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&q(33),d=b.klass,b=a.get(d),void 0===b&&(b=new Map,a.set(d,b)),a=b.get(c),d="destroyed"===a&&"created"===e,(void 0===a||d)&&b.set(c,d?"updated":e))}function Zb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
function $b(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Zb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Zb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function qb(a){a=(a=ub(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function ac(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
function bc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function Ab(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}
function cc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=ub(a).innerHeight}else{var l=b.getBoundingClientRect();h=l.top;k=l.bottom}l=0;f<h?l=-(h-f):g>k&&(l=g-k);0!==l&&(c?e.scrollBy(0,l):(h=b.scrollTop,b.scrollTop+=l,h=b.scrollTop-h,f-=h,g-=h));if(c)break;b=Ab(b)}}}
function dc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!F(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();ec(e,a)&&c.set(a.__key,0,"element");ec(f,a)&&d.set(a.__key,0,"element");return b}function ec(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function ub(a){a=a._window;null===a&&q(78);return a}function fc(a){for(a=a.getParentOrThrow();null!==a&&!gc(a);)a=a.getParentOrThrow();return a}function gc(a){return O(a)||F(a)&&a.isShadowRoot()}
function hc(a){var b=H();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function ic(a,b){a=a.getParent();if(O(a)&&!F(b)&&!z(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}function kc(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}function lc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}
function E(a){return Oa?(a||window).getSelection():null}function mc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&mc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}
function nc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(F(c)&&mc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}function oc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}
function pc(a,b){let c=a.mergeWithSibling(b),d=H()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function qc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{oc(b,a)&&(a=pc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{oc(a,c)&&pc(a,c);break}}}
function rc(a){sc(a.anchor);sc(a.focus);return a}function sc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",tc,S,uc,vc=!1,wc=!1,xc,yc=null,zc,Ac,Bc,Cc,Dc,Ec;
function Fc(a,b){let c=Bc.get(a);if(null!==b){let d=Gc(a);d.parentNode===b&&b.removeChild(d)}Cc.has(a)||S._keyToDOMMap.delete(a);F(c)&&(a=Hc(c,Bc),Ic(a,0,a.length-1,null));void 0!==c&&Yb(Ec,uc,xc,c,"destroyed")}function Ic(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Fc(e,d)}}function Jc(a,b){a.setProperty("text-align",b)}function Kc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
function Lc(a,b){a=a.style;0===b?Jc(a,""):1===b?Jc(a,"left"):2===b?Jc(a,"center"):3===b?Jc(a,"right"):4===b?Jc(a,"justify"):5===b?Jc(a,"start"):6===b&&Jc(a,"end")}
function Mc(a,b,c){let d=Cc.get(a);void 0===d&&q(60);let e=d.createDOM(tc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(F(d)){a=d.__indent;f=d.__size;0!==a&&Kc(e,a);if(0!==f){--f;a=Hc(d,Cc);var g=Q;Q="";Nc(a,0,f,e,null);Oc(d,e);Q=g}a=d.__format;0!==a&&Lc(e,a);d.isInline()||Pc(null,d,e);ac(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(S,tc),null!==g&&Qc(a,
g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Yb(Ec,uc,xc,d,"created");return e}function Nc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Mc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Rc(a,b){a=b.get(a);return Fb(a)||z(a)&&a.isInline()}
function Pc(a,b,c){a=null!==a&&(0===a.__size||Rc(a.__last,Bc));b=0===b.__size||Rc(b.__last,Cc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
function Oc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==yc){let f=""===Q;if(f)var d=yc;else d=Q,d=Za.test(d)?"rtl":$a.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=tc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);wc||(a.getWritable().__dir=d)}yc=
d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}function Hc(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);if(void 0===d)throw Error("createChildrenArray: node does not exist in nodeMap");c.push(a);a=d.__next}return c}
function Sc(a,b){var c=Bc.get(a),d=Cc.get(a);void 0!==c&&void 0!==d||q(61);var e=vc||Ac.has(a)||zc.has(a);let f=bc(S,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Yb(Ec,uc,xc,d,"updated");if(d.updateDOM(c,f,tc))return d=Mc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Fc(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&Kc(f,a);a=d.__format;
a!==c.__format&&Lc(f,a);if(e){a=d;e=Q;Q="";b=P;var g=c.__size,h=a.__size;P="";if(1===g&&1===h){var k=c.__first,l=a.__first;if(k===l)Sc(k,f);else{var m=Gc(k);l=Mc(l,null,null);f.replaceChild(l,m);Fc(k,null)}}else{l=Hc(c,Bc);var p=Hc(a,Cc);if(0===g)0!==h&&Nc(p,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Ic(l,0,g-1,k?null:f),k&&(f.textContent=""));else{var n=l;l=p;p=g-1;g=h-1;let w=f.firstChild,y=0;for(h=0;y<=p&&h<=g;){var r=n[y];let x=l[h];if(r===x)w=Tc(Sc(x,f)),y++,h++;else{void 0===
k&&(k=new Set(n));void 0===m&&(m=new Set(l));let A=m.has(r),U=k.has(x);A?(U?(r=bc(S,x),r===w?w=Tc(Sc(x,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Sc(x,f)),y++):Mc(x,f,w),h++):(w=Tc(Gc(r)),Fc(r,f),y++)}}k=y>p;m=h>g;k&&!m?(k=l[g+1],k=void 0===k?null:S.getElementByKey(k),Nc(l,h,g,f,k)):m&&!k&&Ic(n,y,p,f)}}ac(a)&&(P+="\n\n");f.__lexicalTextContent=P;P=b+P;Oc(a,f);Q=e;O(d)||d.isInline()||Pc(c,d,f)}ac(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(S,tc),null!==e&&Qc(a,e)):
B(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!wc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Qc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Mb(S)}c[a]=b}function Tc(a){a=a.nextSibling;null!==a&&a===S._blockCursorElement&&(a=a.nextSibling);return a}function Gc(a){a=Dc.get(a);void 0===a&&q(75);return a}
let T=Object.freeze({}),$c=[["keydown",Uc],["pointerdown",Vc],["compositionstart",Wc],["compositionend",Xc],["input",Yc],["click",Zc],["cut",T],["copy",T],["dragstart",T],["dragover",T],["dragend",T],["paste",T],["focus",T],["blur",T],["drop",T]];Ra&&$c.push(["beforeinput",(a,b)=>ad(a,b)]);let bd=0,cd=0,dd=0,ed=0,fd=!1,gd=!1,hd=!1,id=!1,jd=[0,0,"root",0];
function kd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=H(),k=E(h._window);k=null!==k?k.anchorNode:null;let l=e.key;h=h.getElementByKey(l);let m=b.length;return l!==f.key||!B(g)||(!d&&(!Ra||dd<c+50)||2>m||Rb(b))&&e.offset!==f.offset&&!g.isComposing()||Bb(g)||g.isDirty()&&1<m||(d||!Ra)&&null!==h&&!g.isComposing()&&k!==Cb(h)||g.getFormat()!==a.format||Wb(a,g)}function ld(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
function md(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(fd&&(fd=!1,ld(d,e)&&ld(f,g)))return;v(b,()=>{if(!c)pb(null);else if(yb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,l=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var m=ub(b).event;m=m?m.timeStamp:performance.now();let [p,n,r,w]=jd;m<w+200&&k.offset===n&&k.key===r?h.format=p:"text"===k.type?h.format=l.getFormat():"element"===k.type&&(h.format=0)}else{k=127;l=!1;m=h.getNodes();
let p=m.length;for(let n=0;n<p;n++){let r=m[n];if(B(r)&&(l=!0,k&=r.getFormat(),0===k))break}h.format=l?k:0}}V(b,ca,void 0)}})}function Zc(a,b){v(b,()=>{let c=u(),d=E(b._window),e=Vb();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Ob().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ea,a)})}
function Vc(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{z(mb(c))||(gd=!0)})}function nd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function od(a,b){return a!==b||F(a)||F(b)||!a.isToken()||!b.isToken()}
function ad(a,b){let c=a.inputType;"deleteCompositionText"===c||Qa&&qb(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Vb();if(!C(e))return;pb(e.clone())}if(C(d)){229===cd&&a.timeStamp<bd+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),bd=0,setTimeout(()=>{v(b,()=>{K(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,fa,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
nd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,ha,!1)):"\n\n"===e?(a.preventDefault(),V(b,ia,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&kd(d,e,a.timeStamp,!0)&&(a.preventDefault(),V(b,ja,e)),dd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ja,a);break;case "insertFromComposition":K(null);
V(b,ja,a);break;case "insertLineBreak":K(null);V(b,ha,!1);break;case "insertParagraph":K(null);hd?(hd=!1,V(b,ha,!1)):V(b,ia,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ka,a);break;case "deleteByComposition":od(g,f)&&V(b,ma,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ma,void 0);break;case "deleteContent":V(b,fa,!1);break;case "deleteWordBackward":V(b,na,!0);break;case "deleteWordForward":V(b,na,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
oa,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,oa,!1);break;case "formatStrikeThrough":V(b,pa,"strikethrough");break;case "formatBold":V(b,pa,"bold");break;case "formatItalic":V(b,pa,"italic");break;case "formatUnderline":V(b,pa,"underline");break;case "historyUndo":V(b,qa,void 0);break;case "historyRedo":V(b,ra,void 0)}}})}
function Yc(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&kd(c,d,a.timeStamp,!1)){id&&(pd(b,d),id=!1);var e=c.anchor,f=e.getNode(),g=E(b._window);if(null===g)return;let h=e.offset;if(e=Ra&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||V(b,ja,d);d=d.length;Qa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);
Sa||Ta||!b.isComposing()||(bd=0,K(null))}else Ub(!1,b),id&&(pd(b,d||void 0),id=!1);G();c=H();rb(c)})}function Wc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<bd+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ja,Ya)}})}
function pd(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=Cb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&nb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,ya,null);return}}Ub(!0,a,b)}function Xc(a,b){Qa?id=!0:v(b,()=>{pd(b,a.data)})}
function Uc(a,b){bd=a.timeStamp;cd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)hd=!0,V(b,ya,a);else if(32===c)V(b,za,a);else if(t&&e&&79===c)a.preventDefault(),hd=!0,V(b,ha,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,Aa,a):(a.preventDefault(),V(b,fa,!0)):27===c?V(b,Ca,a):(h=t?d||g||f?
!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Da,a):(a.preventDefault(),V(b,fa,!1)):8===c&&(t?g:e)?(a.preventDefault(),V(b,na,!0)):46===c&&(t?g:e)?(a.preventDefault(),V(b,na,!1)):t&&f&&8===c?(a.preventDefault(),V(b,oa,!0)):t&&f&&46===c?(a.preventDefault(),V(b,oa,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),V(b,pa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
V(b,qa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,ra,void 0)):qd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),V(b,Ja,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),V(b,Ka,a))))):V(b,Ea,a))}else hd=!1,V(b,ya,a);else V(b,xa,a);else V(b,wa,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);(e||d||g||f)&&V(b,Na,a)}}function rd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let sd=new Map;
function td(a){a=a.target;let b=E(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=zb(b.anchorNode);if(null!==c){gd&&(gd=!1,v(c,()=>{var g=Vb(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=ud(g,b,c),pb(g))}));a=Sb(c);a=a[a.length-1];var d=a._key,e=sd.get(d),f=e||a;f!==c&&md(b,f,!1);md(b,c,!0);c!==a?sd.set(d,c):e&&sd.delete(d)}}}
function vd(a,b){0===ed&&a.ownerDocument.addEventListener("selectionchange",td);ed++;a.__lexicalEditor=b;let c=rd(a);for(let d=0;d<$c.length;d++){let [e,f]=$c[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return V(b,Ka,h);case "copy":return V(b,Ja,h);case "paste":return V(b,ka,h);case "dragstart":return V(b,Ga,h);case "dragover":return V(b,Ha,h);case "dragend":return V(b,
Ia,h);case "focus":return V(b,La,h);case "blur":return V(b,Ma,h);case "drop":return V(b,Fa,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function wd(a,b,c,d){jd=[a,b,c,d]}
class W{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
Lb()||(Kb()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function xd(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!F(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function yd(a,b){if(F(b)){let c=b.getLastDescendant();F(c)||B(c)?xd(a,c):xd(a,b)}else xd(a,b)}
function zd(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=M(),g=O(d)?Ad().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function Bd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
class Cd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!qd(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new Cd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(B(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);Lb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}
function C(a){return a instanceof Dd}
class Ed{constructor(a,b,c){this.gridKey=a;this.anchor=b;this.focus=c;this.dirty=!1;this._cachedNodes=null;b._selection=this;c._selection=this}is(a){return Fd(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new Ed(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Gd(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,b){let c=
this.focus.getNode();return rc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&q(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&q(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=this._cachedNodes;
if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);Hd(f)||q(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Id(g)||q(24);g=g.getChildren();for(let l=b;l<=d;l++){var h=g[l];Jd(h)||q(25);a.add(h);for(h=h.getChildren();0<h.length;){let m=h.shift();a.add(m);F(m)&&h.unshift(...m.getChildren())}}}a=Array.from(a);Lb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();
return b}}function Fd(a){return a instanceof Ed}
class Dd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();F(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
b?b:a);F(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?F(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);Lb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Bd(this.anchor,a.__key,b,"text");Bd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=Gd(this),g="",h=!0;for(let k=0;k<a.length;k++){let l=a[k];if(F(l)&&!l.isInline())h||
(g+="\n"),h=l.isEmpty()?!1:!0;else if(h=!1,B(l)){let m=l.getTextContent();l===b?m=l===c?e<f?m.slice(e,f):m.slice(f,e):d?m.slice(e):m.slice(f):l===c&&(m=d?m.slice(0,f):m.slice(0,e));g+=m}else!z(l)&&!Fb(l)||l===c&&this.isCollapsed()||(g+=l.getTextContent())}return g}applyDOMRange(a){let b=H(),c=b.getEditorState()._selection;a=Kd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Bd(this.anchor,d.key,d.offset,d.type);Bd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
null}}clone(){let a=this.anchor,b=this.focus;return new Dd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Db(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&ab[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Ld())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
b.isBefore(c),e=this.format;d&&"element"===b.type?zd(b,c,e):d||"element"!==c.type||zd(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];B(b)||q(26);d=b.getTextContent().length;var l=b.getParentOrThrow(),m=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!l.canInsertTextAfter()&&null===b.getNextSibling())){var p=b.getNextSibling();if(!B(p)||Bb(p))p=M(),p.setFormat(e),l.canInsertTextAfter()?b.insertAfter(p):l.insertAfter(p);
p.select(0,0);b=p;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!l.canInsertTextBefore()&&null===b.getPreviousSibling())){p=b.getPreviousSibling();if(!B(p)||Bb(p))p=M(),p.setFormat(e),l.canInsertTextBefore()?b.insertBefore(p):l.insertBefore(p);p.select();b=p;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)l=M(b.getTextContent()),l.setFormat(e),b.replace(l),b=l;else if(!(this.isCollapsed()||""===
a||(p=m.getParent(),l.canInsertTextBefore()&&l.canInsertTextAfter()&&(!F(p)||p.canInsertTextBefore()&&p.canInsertTextAfter())))){this.insertText("");Md(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=M(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=M(a);f.setFormat(e);f.select();0===c?b.insertBefore(f,!1):([g]=b.splitText(c),g.insertAfter(f,!1));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=f)}else{e=new Set([...b.getParentKeys(),...m.getParentKeys()]);var n=F(b)?b:b.getParentOrThrow();l=F(m)?m:m.getParentOrThrow();p=m;if(!n.is(l)&&l.isInline()){do p=l,l=l.getParentOrThrow();while(l.isInline())}"text"===h.type&&(0!==k||""===m.getTextContent())||"element"===h.type&&m.getIndexWithinParent()<k?B(m)&&!m.isToken()&&k!==m.getTextContentSize()?
(m.isSegmented()&&(h=M(m.getTextContent()),m.replace(h),m=h),m=m.spliceText(0,k,""),e.add(m.__key)):(h=m.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?m.remove():h.remove()):e.add(m.__key);h=l.getChildren();k=new Set(f);m=n.is(l);n=n.isInline()&&null===b.getNextSibling()?n:b;for(let r=h.length-1;0<=r;r--){let w=h[r];if(w.is(b)||F(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(p)?m||n.insertAfter(w,!1):w.remove())}if(!m)for(h=l,k=null;null!==h;){m=h.getChildren();l=m.length;
if(0===l||m[l-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),K(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
K(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var l=e-1,m=c[l];e="text"===d.type?d.offset:m.getTextContentSize();if(k.is(m))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var p=m.getFormatFlags(a,g);0<e&&(e!==m.getTextContentSize()&&([m]=m.splitText(e)),m.setFormat(p));for(h+=1;h<l;h++){let n=c[h];if(!n.isToken()){let r=n.getFormatFlags(a,p);n.setFormat(r)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(m.__key,e,"text");this.format=g|p}}}}}insertNodes(a,b){if(!this.isCollapsed()){var c=this.isBackward()?this.anchor:this.focus,d=c.getNode().getNextSibling();d=d?d.getKey():null;c=(c=
c.getNode().getPreviousSibling())?c.getKey():null;this.removeText();if(this.isCollapsed()&&"element"===this.focus.type){if(this.focus.key===d&&0===this.focus.offset){var e=M();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=M(),this.focus.getNode().insertAfter(e));e&&(this.focus.set(e.__key,0,"text"),this.anchor.set(e.__key,0,"text"))}}d=this.anchor;c=d.offset;var f=d.getNode();e=f;"element"===d.type&&(e=d.getNode(),d=e.getChildAtIndex(c-
1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=gc(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,l=null;for(let r=0;r<a.length;r++){var m=a[r];if(z(e)||!F(m)||m.isInline())k&&!z(m)&&gc(e.getParent())&&q(28);else{if(m.is(g)){if(F(e)&&e.isEmpty()&&e.canReplaceWith(m)){e.replace(m);
e=m;k=!0;continue}var p=m.getFirstDescendant();if(Eb(p)){for(p=p.getParentOrThrow();p.isInline();)p=p.getParentOrThrow();l=p.getChildren();k=l.length;if(F(e)){var n=e.getFirstChild();for(let w=0;w<k;w++){let y=l[w];null===n?e.append(y):n.insertAfter(y);n=y}}else{for(n=k-1;0<=n;n--)e.insertAfter(l[n]);e=e.getParentOrThrow()}l=l[k-1];p.remove();k=!0;if(p.is(m))continue}}B(e)&&(null===h&&q(27),e=h)}k=!1;if(F(e)&&!e.isInline())if(l=m,z(m)&&!m.isInline())e=e.insertAfter(m,!1);else if(F(m)){if(m.canBeEmpty()||
!m.isEmpty())O(e)?(p=e.getChildAtIndex(c),null!==p?p.insertBefore(m):e.append(m),e=m):e=e.insertAfter(m,!1)}else p=e.getFirstChild(),null!==p?p.insertBefore(m):e.append(m),e=m;else!F(m)||F(m)&&m.isInline()||z(e)&&!e.isInline()?(l=m,e=e.insertAfter(m,!1)):(m=e.getParentOrThrow(),Fb(e)&&e.remove(),e=m,r--)}b&&(B(f)?f.select():(a=e.getPreviousSibling(),B(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(F(e)){if(a=B(l)?l:F(l)&&l.isInline()?l.getLastDescendant():e.getLastDescendant(),
b||(null===a?e.select():B(a)?""===a.getTextContent()?a.selectPrevious():a.select():a.selectNext()),0!==d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!F(e)||Nd(c)||z(c)&&(!c.isInline()||c.isIsolated())?F(e)||Nd(c)?F(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),F(f)||q(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(B(e)?e.select():(b=e.getParentOrThrow(),
a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(gc(f)){e=Ad();c=f.getChildAtIndex(b);e.select();null!==
c?c.insertBefore(e,!1):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this,!1),F(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(F(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==
d)for(c=0;c<d;c++)b=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=Ld();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Gd(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Gd(this);if(0===b)return[];
if(1===b)return B(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=$b(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Od(),b.add(g.__key),pb(b)):(a=b?g.getPreviousSibling():
g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),F(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=H(),d=E(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||lc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),
e=O(e)?e:fc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],ec(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],F(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],F(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Bd(f,b.key,b.offset,b.type),Bd(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&F(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(F(e)&&!e.canExtractContents())return}e=$b(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&F(d)&&0===d.getChildrenSize()?(d.remove(),a=Od(),a.add(e.__key),pb(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?
c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Pd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Pd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Rb(b)||(a?e.offset=
f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function qd(a){return a instanceof Cd}
function Qd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function Gd(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[Qd(b),Qd(a)]}
function Pd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],l=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||l){d.splice(h,1);l&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
function Rd(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=Qb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Qb(a);if(null===f)return null;if(F(f)){a=f.getChildAtIndex(e);if(b=F(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=F(a)?a:a.getParentOrThrow()));
B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&Qb(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new W(f.__key,e,"element")}}else d=Qb(a);return B(d)?new W(d.__key,e,"text"):null}
function Sd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&F(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):F(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&F(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
b)&&null===d&&F(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Md(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Sd(a,d,e);Sd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=H();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,Bd(a,d.key,d.offset,d.type),Bd(b,c.key,c.offset,c.type))}}
function Kd(a,b,c,d,e,f){if(null===a||null===c||!yb(e,a,c))return null;b=Rd(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Rd(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Qb(a),c=Qb(c),z(a)&&z(c)))return null;Md(b,d,f);return[b,d]}function Nd(a){return F(a)&&!a.isInline()}function Td(a,b,c,d,e,f){let g=I();a=new Dd(new W(a,b,e),new W(c,d,f),0);a.dirty=!0;return g._selection=a}function Od(){return new Cd(new Set)}
function Ud(a){let b=a.getEditorState()._selection,c=E(a._window);return qd(b)||Fd(b)?b.clone():ud(b,c,a)}
function ud(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!gb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!yb(c,e,f))return a.clone()}else return a.clone();c=Kd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Dd(h,k,C(a)?a.format:0)}
function u(){return I()._selection}function Vb(){return H()._editorState._selection}
function Vd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Wd(a));else{var k=a.isBackward();h=k?f:e;var l=h.getNode();e=k?e:f;f=e.getNode();b.is(l)&&(l=h.offset,c<=l&&h.set(g,Math.max(0,l+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Wd(a)}}
function Wd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())F(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(F(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}F(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Xd(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
function Yd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):F(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":F(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Zd(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
function $d(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,l=d.anchorOffset,m=d.focusOffset,p=document.activeElement;if(!(e.has("collaboration")&&p!==f||null!==p&&xb(p)))if(C(b)){var n=b.anchor,r=b.focus,w=n.key,y=r.key,x=bc(c,w);y=bc(c,y);var A=n.offset,U=r.offset,J=b.format,da=b.isCollapsed(),N=x,D=y,aa=!1;"text"===n.type&&(N=Cb(x),aa=n.getNode().getFormat()!==J);"text"===r.type&&(D=Cb(y));if(null!==N&&null!==D){da&&(null===a||aa||C(a)&&a.format!==J)&&wd(J,A,w,performance.now());if(l===A&&m===
U&&h===N&&k===D&&("Range"!==d.type||!da)&&(null!==p&&f.contains(p)||f.focus({preventScroll:!0}),"element"!==n.type))return;if(!e.has("skip-scroll-into-view"))try{Wa&&1E3<g?window.requestAnimationFrame(()=>d.setBaseAndExtent(N,A,D,U)):d.setBaseAndExtent(N,A,D,U)}catch(Ua){}!e.has("skip-scroll-into-view")&&b.isCollapsed()&&null!==f&&f===document.activeElement&&(a=b instanceof Dd&&"element"===b.anchor.type?N.childNodes[A]||null:0<d.rangeCount?d.getRangeAt(0):null,null!==a&&(a=a.getBoundingClientRect(),
cc(c,a,f)));fd=!0}}else null!==a&&yb(c,h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,ae=!1,Hb=0,be={characterData:!0,childList:!0,subtree:!0};function Lb(){return Z||null!==X&&X._readOnly}function G(){Z&&q(13)}function I(){null===X&&q(15);return X}function H(){null===Y&&q(16);return Y}function ce(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}
function de(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&qc(b)}
function ee(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Kb(),f=new Map;var g=c;let h=g.size;for(var k=d,l=k.size;0<h||0<l;){if(0<h){b._dirtyLeaves=new Set;for(let m of g)g=a.get(m),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&qc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Hb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let m of k)if(k=m[0],l=m[1],"root"===k||l)g=a.get(k),void 0!==
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),d.set(k,l);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;l=k.size;Hb++}b._dirtyLeaves=c;b._dirtyElements=d}function fe(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(F(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=fe(a[d],b);c.append(e)}return c}function ge(a,b){let c=X,d=Z,e=Y;X=a;Z=!0;Y=null;try{return b()}finally{X=c,Z=d,Y=e}}
function he(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=X,l=Z,m=Y,p=a._updating,n=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==n){Y=a;X=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();Q=R=P="";vc=2===w;yc=null;S=a;tc=a._config;uc=a._nodes;xc=S._listeners.mutation;zc=y;Ac=x;Bc=e._nodeMap;Cc=b._nodeMap;wc=
b._readOnly;Dc=new Map(a._keyToDOMMap);var A=new Map;Ec=A;Sc("root",null);Ec=Dc=tc=Cc=Bc=Ac=zc=uc=S=void 0;r=A}catch(D){D instanceof Error&&a._onError(D);if(ae)throw D;ie(a,null,c,b);sb(a);a._dirtyType=2;ae=!0;he(a);ae=!1;return}finally{n.observe(c,be),a._updating=p,X=k,Z=l,Y=m}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;x=a._updateTags;l=a._deferred;y=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,J=a._pendingDecorators||U,da=b._nodeMap,N;for(N in J)da.has(N)||(J===U&&(J=Mb(a)),delete J[N]);d=d?null:E(a._window);if(a._editable&&null!==d&&(h||null===g||g.dirty)){Y=a;X=b;try{null!==n&&n.disconnect();if(h||null===g||g.dirty){let D=a._blockCursorElement;null!==D&&lc(D,a,c);$d(f,g,a,d,x,c,y)}a:{let D=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let aa=g.anchor,
Ua=aa.getNode(),jc=aa.offset,He=Ua.getChildrenSize();f=!1;g=null;if(jc===He){let la=Ua.getChildAtIndex(jc-1);kc(la)&&(f=!0)}else{let la=Ua.getChildAtIndex(jc);if(kc(la)){let Va=la.getPreviousSibling();if(null===Va||kc(Va))f=!0,g=a.getElementByKey(la.__key)}}if(f){let la=a.getElementByKey(Ua.__key);if(null===D){let Va=a._config.theme,tb=document.createElement("div");tb.contentEditable="false";tb.setAttribute("data-lexical-cursor","true");let Ba=Va.blockCursor;if(void 0!==Ba){if("string"===typeof Ba){let Ie=
Ba.split(" ");Ba=Va.blockCursor=Ie}void 0!==Ba&&tb.classList.add(...Ba)}a._blockCursorElement=D=tb}c.style.caretColor="transparent";null===g?la.appendChild(D):la.insertBefore(D,g);break a}}null!==D&&lc(D,a,c)}null!==n&&n.observe(c,be)}finally{Y=m,X=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),m=k.length,n=0;n<m;n++){let [D,aa]=k[n];r=c.get(aa);void 0!==r&&D(r,{dirtyLeaves:p,updateTags:x})}c=a._pendingDecorators;null!==c&&(a._decorators=c,a._pendingDecorators=null,je("decorator",a,!0,
c));c=Nb(e);k=Nb(b);c!==k&&je("textcontent",a,!0,k);je("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:x});a._deferred=[];if(0!==l.length){b=a._updating;a._updating=!0;try{for(e=0;e<l.length;e++)l[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [D,aa]=b;ke(a,D,aa)}}}
function je(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}function V(a,b,c){if(!1===a._updating||Y!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=Sb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
function le(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
function ke(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new me(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=X;let k=Z,l=Y,m=a._updating;X=c;Z=!1;a._updating=!0;Y=a;try{g&&(a._headless?null!=h._selection&&(c._selection=h._selection.clone()):c._selection=Ud(a));let p=a._compositionKey;
b();e=le(a,e);Xd(c,a);0!==a._dirtyType&&(e?de(c,a):ee(c,a),le(a),nc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let n=c._selection;if(C(n)){let r=c._nodeMap,w=n.focus.key;void 0!==r.get(n.anchor.key)&&void 0!==r.get(w)||q(19)}else qd(n)&&0===n._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();he(a);return}finally{X=f,Z=k,Y=l,
a._updating=m,Hb=0}b=null!==a._window?window.event:null;b=null!=b?b.type:null;0!==a._dirtyType||ne(c,a)||null!==a._blockCursorElement&&"blur"===b?c._flushSync?(c._flushSync=!1,he(a)):g&&wb(()=>{he(a)}):(c._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):ke(a,b,c)}
function oe(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=dc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&(Yd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Yd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Ib(a),Vd(f,e,d,-1)):Ib(a);c||gc(e)||e.canBeEmpty()||!e.isEmpty()||oe(e,b);b&&O(e)&&e.isEmpty()&&e.selectEnd()}}
class pe{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Gb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=u();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:L(a)}getParentOrThrow(){let a=this.getParent();null===a&&q(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(gc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
this.getTopLevelElement();null===a&&q(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){let a=this.getLatest().__prev;return null===a?null:L(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=
this.getLatest().__next;return null===a?null:L(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();F(this)&&b.unshift(this);F(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){let e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;
var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();break}c=a}return d<b}isParentOf(a){let b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){let b=this.isBefore(a),c=[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=F(e)?b?e.getFirstChild():e.getLastChild():
null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&q(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=H()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&q(69);return a}getWritable(){G();var a=I(),b=H();a=a._nodeMap;
let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&(f._cachedNodes=null);if(b.has(c))return Jb(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;F(d)&&F(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Jb(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){q(70)}updateDOM(){q(71)}exportDOM(a){return{element:this.createDOM(a._config,
a)}}exportJSON(){q(72)}static importJSON(){q(18)}remove(a){oe(this,!0,a)}replace(a,b){G();var c=u();null!==c&&(c=c.clone());ic(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;Ib(g);let k=d.getPreviousSibling(),l=d.getNextSibling(),m=d.__prev,p=d.__next,n=d.__parent;oe(d,!1);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=m;null===l?a.__last=f:l.getWritable().__prev=f;g.__next=p;g.__parent=n;a.__size=h;b&&this.getChildren().forEach(r=>
{g.append(r)});C(c)&&(pb(c),b=c.anchor,c=c.focus,b.key===e&&yd(b,g),c.key===e&&yd(c,g));Kb()===e&&K(f);return g}insertAfter(a,b=!0){G();ic(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();Ib(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let l=d.__key,
m=c.__next;null===e?k.__last=l:e.getWritable().__prev=l;k.__size++;c.__next=l;d.__next=m;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),Vd(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=!0){G();ic(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Ib(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=
e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=u();b&&C(c)&&(b=this.getParentOrThrow(),Vd(c,b,k));return a}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):F(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():F(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,
a))}markDirty(){this.getWritable()}}class qe extends pe{constructor(a){super(a)}decorate(){q(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof qe}
class re extends pe{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return db[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
this.getChildrenSize()}isDirty(){let a=H()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(F(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(F(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
this.getLastChild();for(;null!==a;){if(F(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],F(a)&&a.getLastDescendant()||a||null;a=b[a];return F(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:L(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&q(45);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:L(a)}getLastChildOrThrow(){let a=
this.getLastChild();null===a&&q(96);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();F(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==
a?(a=cb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||F(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&(a=this.getLastChild(),B(a)||F(a)))return a.select();void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return Td(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();
return F(a)||B(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return F(a)||B(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?cb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;
return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let l=this.getChildAtIndex(a+b),m=null,p=e-b+d;if(0!==a)if(a===e)m=this.getLastChild();else{var n=this.getChildAtIndex(a);null!==n&&(m=n.getPreviousSibling())}if(0<b){var r=null===m?this.getFirstChild():m.getNextSibling();for(n=0;n<b;n++){if(null===r)throw Error("splice: sibling not found");var w=r.getNextSibling(),y=r.__key;r=r.getWritable();Ib(r);k.push(y);r=w}}n=m;for(w=0;w<d;w++){y=c[w];
null!==n&&y.is(n)&&(m=n=n.getPreviousSibling());r=y.getWritable();r.__parent===g&&p--;Ib(r);let x=y.__key;null===n?(f.__first=x,r.__prev=null):(n=n.getWritable(),n.__next=x,r.__prev=n.__key);y.__key===g&&q(76);r.__parent=g;h.push(x);n=y}a+b===e?null!==n&&(n.getWritable().__next=null,f.__last=n.__key):null!==l&&(a=l.getWritable(),null!==n?(b=n.getWritable(),a.__prev=n.__key,b.__next=l.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:x,focus:A}=a;se(x,
k,h)&&Yd(x,x.getNode(),this,m,l);se(A,k,h)&&Yd(A,A.getNode(),this,m,l);0!==p||this.canBeEmpty()||gc(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}
function F(a){return a instanceof re}function se(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
class te extends re{static getType(){return"root"}static clone(){return new te}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Lb()&&0!==H()._dirtyType||null===a?super.getTextContent():a}remove(){q(52)}replace(){q(53)}insertBefore(){q(54)}insertAfter(){q(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];F(c)||z(c)||q(56)}return super.append(...a)}static importJSON(a){let b=Ob();b.setFormat(a.format);
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function O(a){return a instanceof te}function ne(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function ue(){return new me(new Map([["root",new te]]))}
function ve(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&q(58);let c=b.children;if(F(a)){Array.isArray(c)||q(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=ve(a[d]);c.push(e)}}return b}
class me{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return ge(this,a)}clone(a){a=new me(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ge(this,()=>({root:ve(Ob())}))}}
class we extends pe{static getType(){return"linebreak"}static clone(a){return new we(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:xe,priority:0}}}}static importJSON(){return Ld()}exportJSON(){return{type:"linebreak",version:1}}}function xe(){return{node:Ld()}}function Ld(){return hc(new we)}
function Fb(a){return a instanceof we}function ye(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ze(a,b){return b&1?"strong":b&2?"em":"span"}
function Ae(a,b,c,d,e){a=d.classList;d=Xb(e,"base");void 0!==d&&a.add(...d);d=Xb(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in ab)h=ab[k],d=Xb(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
function Be(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Xa:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Qa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,l]=a;0!==k&&d.deleteData(h,k);d.insertData(h,l)}else d.nodeValue=a}function Ce(a,b){b=document.createElement(b);b.appendChild(a);return b}
class De extends pe{static getType(){return"text"}static clone(a){return new De(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return fb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Kb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=ab[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Db(c,a,b)}createDOM(a){var b=this.__format,c=ye(this,b);let d=ze(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Be(this.__text,c,this);
a=a.theme.text;void 0!==a&&Ae(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ye(this,e);let h=ye(this,f);var k=ze(this,e);let l=ze(this,f);if((null===g?k:g)!==(null===h?l:h))return!0;if(g===h&&k!==l)return e=b.firstChild,null==e&&q(48),a=g=document.createElement(l),Be(d,a,this),c=c.theme.text,void 0!==c&&Ae(l,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&q(49));Be(d,k,this);c=c.theme.text;
void 0!==c&&e!==f&&Ae(l,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Ee,priority:0}),b:()=>({conversion:Fe,priority:0}),br:()=>({conversion:Ge,priority:0}),code:()=>({conversion:Je,priority:0}),em:()=>({conversion:Je,priority:0}),i:()=>({conversion:Je,priority:0}),span:()=>({conversion:Ke,priority:0}),strong:()=>({conversion:Je,priority:0}),sub:()=>({conversion:Je,priority:0}),sup:()=>({conversion:Je,priority:0}),u:()=>({conversion:Je,
priority:0})}}static importJSON(a){let b=M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&(this.hasFormat("bold")&&(a=Ce(a,"b")),this.hasFormat("italic")&&(a=Ce(a,"i")),this.hasFormat("strikethrough")&&(a=Ce(a,"s")),this.hasFormat("underline")&&(a=Ce(a,"u")));return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),
type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?ab[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?bb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=ab[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=eb[a];if(this.__mode===
a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=Kb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Td(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,
h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&C(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Kb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var l=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),
p=b.__detail;g=!1;b.isSegmented()?(h=M(l),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=l);b=u();h=[h];l=l.length;for(let w=1;w<f;w++){var n=a[w],r=n.length;n=M(n).getWritable();n.__format=k;n.__style=m;n.__detail=p;let y=n.__key;r=l+r;if(C(b)){let x=b.anchor,A=b.focus;x.key===d&&"text"===x.type&&x.offset>l&&x.offset<=r&&(x.key=y,x.offset-=l,b.dirty=!0);A.key===d&&"text"===A.type&&A.offset>l&&A.offset<=r&&(A.key=y,A.offset-=l,b.dirty=!0)}e===d&&K(y);l=r;h.push(n)}d=this.getPreviousSibling();
e=this.getNextSibling();null!==d&&Jb(d);null!==e&&Jb(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Vd(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Kb()===d&&K(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Zd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Zd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?
c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
function Ke(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!B(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}function Ge(){return{node:ba.$createLineBreakNode()}}
function Fe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ee(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:M(a)}}let Le={code:"code",em:"italic",i:"italic",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
function Je(a){let b=Le[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return hc(new De(a))}function B(a){return a instanceof De}
class Me extends re{static getType(){return"paragraph"}static clone(a){return new Me(a.__key)}createDOM(a){let b=document.createElement("p");a=Xb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ne,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=Ad();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=Ad();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ne(){return{node:Ad()}}function Ad(){return hc(new Me)}
function ie(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=ue();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
function Oe(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
class Pe{constructor(a,b,c,d,e,f){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Tb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=null!==b&&b._headless;this._blockCursorElement=this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=
this._listeners.decorator;b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&q(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&q(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>
0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&q(37);let d=c.transforms;d.add(b);Pb(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
this._rootElement;if(a!==b){let e=Xb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ie(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==ed&&(ed--,0===ed&&b.ownerDocument.removeEventListener("selectionchange",td));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Sb(c);d=d[d.length-1]._key;sd.get(d)===c&&sd.delete(d)}else sd.delete(c._key);b.__lexicalEditor=null}c=rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
[]}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,sb(this),this._updateTags.add("history-merge"),he(this),this._config.disableEvents||vd(a,this),null!=e&&a.classList.add(...e)):this._window=null;je("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
b){a.isEmpty()&&q(38);rb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),he(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);he(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ue(),d=X,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,l=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{fe(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=l,X=d,Z=e,Y=f}return c}update(a,b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Ob();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=E(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,je("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Qe extends re{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
function Jd(a){return a instanceof Qe}class Re extends re{}function Hd(a){return a instanceof Re}class Se extends re{}function Id(a){return a instanceof Se}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=hc;exports.$copyNode=function(a){a=a.constructor.clone(a);Gb(a,null);return a};exports.$createLineBreakNode=Ld;exports.$createNodeSelection=Od;exports.$createParagraphNode=Ad;
exports.$createRangeSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Dd(a,b,0)};exports.$createTextNode=M;exports.$getAdjacentNode=$b;exports.$getNearestNodeFromDOMNode=mb;exports.$getNearestRootOrShadowRoot=fc;exports.$getNodeByKey=L;exports.$getPreviousSelection=Vb;exports.$getRoot=Ob;exports.$getSelection=u;exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=ec;
exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Ob().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Eb;exports.$isLineBreakNode=Fb;exports.$isNodeSelection=qd;exports.$isParagraphNode=function(a){return a instanceof Me};exports.$isRangeSelection=C;exports.$isRootNode=O;exports.$isRootOrShadowRoot=gc;exports.$isTextNode=B;
exports.$nodesOfType=function(a){var b=I();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=rc;exports.$parseSerializedNode=function(a){return fe(a,H()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=pb;exports.BLUR_COMMAND=Ma;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
exports.CLICK_COMMAND=ea;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ja;exports.COPY_COMMAND=Ja;exports.CUT_COMMAND=Ka;exports.DELETE_CHARACTER_COMMAND=fa;exports.DELETE_LINE_COMMAND=oa;exports.DELETE_WORD_COMMAND=na;
exports.DEPRECATED_$createGridSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Ed("root",a,b)};exports.DEPRECATED_$isGridCellNode=Jd;exports.DEPRECATED_$isGridNode=Hd;exports.DEPRECATED_$isGridRowNode=Id;exports.DEPRECATED_$isGridSelection=Fd;exports.DEPRECATED_GridCellNode=Qe;exports.DEPRECATED_GridNode=Re;exports.DEPRECATED_GridRowNode=Se;exports.DRAGEND_COMMAND=Ia;exports.DRAGOVER_COMMAND=Ha;exports.DRAGSTART_COMMAND=Ga;exports.DROP_COMMAND=Fa;
exports.DecoratorNode=qe;exports.ElementNode=re;exports.FOCUS_COMMAND=La;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=pa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ha;exports.INSERT_PARAGRAPH_COMMAND=ia;exports.KEY_ARROW_DOWN_COMMAND=xa;exports.KEY_ARROW_LEFT_COMMAND=ua;exports.KEY_ARROW_RIGHT_COMMAND=sa;exports.KEY_ARROW_UP_COMMAND=wa;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Da;exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ca;
exports.KEY_MODIFIER_COMMAND=Na;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Ea;exports.LineBreakNode=we;exports.MOVE_TO_END=ta;exports.MOVE_TO_START=va;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ka;exports.ParagraphNode=Me;exports.REDO_COMMAND=ra;exports.REMOVE_TEXT_COMMAND=ma;exports.RootNode=te;exports.SELECTION_CHANGE_COMMAND=ca;exports.TextNode=De;exports.UNDO_COMMAND=qa;exports.createCommand=function(){return{}};
exports.createEditor=function(a){var b=a||{},c=Y,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=ue(),h=b.namespace||(null!==e?e._config.namespace:Tb()),k=b.editorState,l=[te,De,we,Me,...(b.nodes||[])],m=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<l.length;c++){let n=l[c];var p=null;"function"!==typeof n&&(p=n,n=p.replace,p=p.with);let r=n.getType();a.set(r,{klass:n,replace:p,transforms:new Set})}d=new Pe(g,
e,a,{disableEvents:f,namespace:h,theme:d},m?m:console.error,Oe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
