lexical 0.45.0 → 0.45.1-dev.0

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.
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u,h=0,g=1,_=2,p=1,y=2,m=4,x=8,C=16,v=32,S=64,k=128,T=2047,b=1,N=2,w=3,E=4,O=5,M=6,A=a||l||d?"\xa0":"\u200b",D="\n\n",P=o?"\xa0":A,F="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",I="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",L=new RegExp("^[^"+I+"]*["+F+"]"),z=new RegExp("^[^"+F+"]*["+I+"]"),K={bold:1,capitalize:1024,code:16,highlight:k,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},B={directionless:1,unmergeable:2},R={center:2,end:6,justify:4,left:1,right:3,start:5},W={[N]:"center",[M]:"end",[E]:"justify",[b]:"left",[w]:"right",[O]:"start"},$={normal:0,segmented:2,token:1},J={[h]:"normal",[_]:"segmented",[g]:"token"},j="$",U="$config";function V(){return Ol()._blockCursorElement}class H{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new H(this.element,t,this.after)}withAfter(t){return new H(this.element,this.before,t)}withElement(t){return this.element===t?this:new H(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const r=Y(t,this.element);if(null===r)return"after";const i=Array.prototype.indexOf.call(t.childNodes,r);if(i<0)return"after";if(e===t)return n<=i?"before":"after";const o=Y(t,e);if(null===o)return"after";const s=Array.prototype.indexOf.call(t.childNodes,o);return s>=0&&s<=i?"before":"after"}getInsertionAnchor(){return this.before}}function Y(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class q extends H{withBefore(t){return new q(this.element,t,this.after)}withAfter(t){return new q(this.element,this.before,t)}withElement(t){return this.element===t?this:new q(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){const t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return null!==e&&e===V()?e:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=i}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let n=0;for(let r=this.element.firstChild;null!==r&&r!==t&&r!==e;r=r.nextSibling)n++;return n}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset(),n=V(),i=this.element.childNodes,o=Math.min(r,i.length);let s=0;for(let t=e;t<o;t++)i[t]!==n&&s++;return[t,Math.min(s,t.getChildrenSize())]}const i=G(e,n);i.push(r);const o=G(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<o.length;t++){const e=i[t],n=o[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return[t.getParentOrThrow(),s]}}function G(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t)}return i!==e&&t(225),r.reverse()}let X;try{X="0.45.0+prod.esm"}catch(t){}const Q=X??"0.45.0+source";class Z{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}const tt=null;function et(t,e=1e3){return t instanceof nt?t.clone():t.size<e?new Map(t):(new nt).init(new Map(t),void 0,t.size)}class nt{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,(new nt).init(this._old,this._nursery,this._size)}init(t,e,n){return this._old=t,this._nursery=e,this._size=n,this}get size(){return this._size}has(t){return void 0!==this.get(t)}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return void 0!==e?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===tt?void 0:e}shouldCompact(){return void 0!==this._nursery&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const t=new Map(this._old);for(const[e,n]of this._nursery)n!==tt?t.set(e,n):t.delete(e);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const n=this.getWithTombstone(t);if(n===e)return this;const r=this.getNursery();return n!==tt&&void 0!==n||(this._size++,n===tt&&r.delete(t)),r.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,tt),this._size--),e}getOrInsert(t,e){const n=this.get(t);return void 0!==n?n:(this.set(t,e),e)}getOrInsertComputed(t,e){const n=this.get(t);if(void 0!==n)return n;const r=e(t);return this.set(t,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(e)for(const n of e){const e=n[0],r=t?t.get(e):void 0;r!==tt&&(void 0!==r&&(n[1]=r),yield n)}if(t)for(const n of t)n[1]===tt||e&&e.has(n[0])||(yield n)}forEach(t,e){void 0!==e&&(t=t.bind(e));for(const[e,n]of this.entries())t(n,e,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}}function rt(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(_o(s)&&rt(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling()}}let it=!1,ot=0;function st(t){ot=t.timeStamp}function lt(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==Ss(t,n)}function ct(t,e,n){const r=_l(ol(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&Is(e,s,i,o,!1)}function at(t,e,n){if(si(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return us(e)&&n.isAttached()}function ut(t,e,n,r){for(let i=t;i&&!Jl(i);i=Qs(i)){const t=Ss(i,e);if(void 0!==t){const e=Cs(t,n);if(e)return mo(e)||!vl(i)?void 0:[i,e]}else if(i===r)return[r,ws(n)]}}function ft(t,e,n){it=!0;const r=performance.now()-ot>100;try{ho(t,()=>{const i=Ti()||function(t){return t.getEditorState().read(()=>{const t=Ti();return null!==t?t.clone():null})}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=ut(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Gr(y)&&us(g)&&at(i,g,y)&&ct(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],i=vs(r),s=r.parentNode;if(null!=s&&r!==a&&null===i&&!lt(r,s,t)&&!Jl(r)){if(o){const t=(vl(r)?r.innerText:null)||r.nodeValue;t&&(f+=t)}s.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(lt(r,g,t)||a===r)&&(g.appendChild(r),e++)}r!==e&&s.set(p,y)}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],o=n.parentNode;null==o||"BR"!==n.nodeName||lt(n,i,t)||o.removeChild(n)}}n.takeRecords()}null!==i&&(u&&Es(i),o&&qs(t)&&i.insertRawText(f))})}finally{it=!1}}function dt(t){const e=t._observer;if(null!==e){ft(t,e.takeRecords(),e)}}function ht(t){!function(t){0===ot&&ol(t).addEventListener("textInput",st,!0)}(t),t._observer=new MutationObserver((e,n)=>{ft(t,e,n)})}class gt{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||Tt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function _t(t,e){return new gt(t,e)}function pt(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function yt(t,e,n){const r=pt(t,n,"direct"),i=pt(e,n,"direct");return n.isEqual(r,i)?null:[r,i]}function mt(t,e,n){let r;if(Hi(),"function"==typeof n){const i=t.getLatest(),o=pt(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return vt(i).updateFromKnown(e,r),i}function xt(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Ul(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t)}}return{flatKeys:n,sharedConfigMap:e}}class Ct{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++}return r}(o,n,r);this.size=s}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return kt(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new Ct(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(e.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=kt(i)),this.size++),r.set(t,e)}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n)}}function vt(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Ct(e,St(e));return e.__state=n,n}function St(t){return t.__state?t.__state.sharedNodeState:Qo(Ol(),t.getType()).sharedNodeState}function kt(t){if(t)for(const e in t)return t}function Tt(t){return t}function bt(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return!0}return!1}function Nt(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return!0}return!1}function wt(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function Et(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return!0;const n=new Set;return!(t&&bt(n,t,e)||e&&bt(n,e,t)||t&&Nt(n,t,e)||e&&Nt(n,e,t))}(c,a))}function Ot(t,e){const n=t.mergeWithSibling(e),r=Gi()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function Mt(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Gr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(Et(e,r)){r=Ot(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Gr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Et(r,n)){r=Ot(r,n);break}break}n.remove()}}else r.remove()}function At(t){return Dt(t.anchor),Dt(t.focus),t}function Dt(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=!0):(r=e.getChildAtIndex(n),i=!1),Gr(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!_o(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}const Pt=Symbol.for("@lexical/CachedTextSize");function Ft(e,n){return Xt.read(()=>{let r=0,i=e;for(let e=0;e<n&&null!==i;e++){const o=Gt.get(i);if(void 0===o&&t(345,i),_o(o)){const s=Qt.get(i);if(void 0!==s&&_o(s)&&s.__parent!==o.__parent)r+=o.getTextContentSize();else{const e=Zt.get(i),n=e&&e.__lexicalTextContent;"string"!=typeof n&&t(346,o.getType()),r+=n.length}e<n-1&&!o.isInline()&&(r+=2)}else{const e=o[Pt];void 0===e&&t(347,o.getType(),i),r+=e}i=o.__next}return r},{editor:Kt})}function It(t){_o(t)||void 0===t[Pt]&&(t[Pt]=Gr(t)?t.__text.length:t.getTextContentSize())}const Lt=4;let zt,Kt,Bt,Rt="",Wt=null,$t=null,Jt=null;function jt(){return{firstTextKey:Jt,format:Wt,style:$t}}function Ut(t){null!==t.firstTextKey&&(Wt=t.format,$t=t.style,Jt=t.firstTextKey)}function Vt(e){if(null!==Jt)return;const n=e.__lexicalFirstTextKey;if(void 0===n&&t(348),null===n)return;const r=Qt.get(n);Gr(r)&&(Wt=r.getFormat(),$t=r.getStyle(),Jt=n)}let Ht,Yt,qt,Gt,Xt,Qt,Zt,te,ee,ne,re=!1,ie=!1;function oe(t,e){const n=Gt.get(t),r=Qt.has(t);if(null!==e){const n=Se(t);n.parentNode===e&&e.removeChild(n)}if(!r){if(Kt._keyToDOMMap.delete(t),_o(n)){const t=Yl(n,Gt);se(t,0,t.length-1,null)}void 0!==n&&Us(ee,Bt,Ht,n,"destroyed")}}function se(t,e,n,r){for(let i=e;i<=n;++i){const e=t[i];void 0!==e&&oe(e,r)}}function le(t,e){t.setProperty("text-align",e)}const ce="40px";function ae(t,e){const n=zt.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * var(--lexical-indent-base-value, ${ce}))`)}function ue(t,e){const n=t.style;0===e?le(n,""):1===e?le(n,"left"):2===e?le(n,"center"):3===e?le(n,"right"):4===e?le(n,"justify"):5===e?le(n,"start"):6===e&&le(n,"end")}function fe(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(Co(t))return null;const n=t.getParentOrThrow();return cl(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function de(e,n){const r=Qt.get(e);if(void 0===r&&t(60),null!==n){const t=Gt.get(e);if(void 0!==t&&t.__parent!==r.__parent){const t=Zt.get(e);if(void 0!==t)return n.insertChild(t),ye(e,n.element)}}const i=ne.$createDOM(r,Kt);if(function(t,e,n){const r=n._keyToDOMMap;(function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n})(e,n,t),r.set(t,e)}(e,i,Kt),Gr(r)?i.setAttribute("data-lexical-text","true"):mo(r)&&i.setAttribute("data-lexical-decorator","true"),_o(r)){const t=r.__indent,e=r.__size;if(fe(i,r),0!==t&&ae(i,t),0===e)i.__lexicalTextContent="",i.__lexicalFirstTextKey=null;else{const t=e-1;he(Yl(r,Qt),r,0,t,Al(r,i,Kt))}const n=r.__format;0!==n&&ue(i,n),r.isInline()||ge(null,r,i)}else{const t=r.getTextContent();if(mo(r)){const t=r.decorate(Kt,zt);null!==t&&me(e,t),i.contentEditable="false"}Rt+=t}return null!==n&&n.insertChild(i),ne.$decorateDOM(r,null,i,Kt),It(r),Us(ee,Bt,Ht,r,"created"),i}function he(e,n,r,i,o){const s=Rt,l=jt();Rt="",Wt=null,$t=null,Jt=null;let c=r;for(;c<=i;++c){const t=jt();de(e[c],o);const n=Qt.get(e[c]);null!==n&&Gr(n)?null===Wt&&(Wt=n.getFormat(),$t=n.getStyle(),Jt=n.__key):_o(n)&&c<i&&!n.isInline()&&(Rt+=D),Ut(t)}const a=Kt._keyToDOMMap.get(n.__key);void 0===a&&t(349,n.__key),a.__lexicalTextContent=Rt,a.__lexicalFirstTextKey=Jt,Rt=s+Rt,Ut(l)}function ge(t,e,n){const r=Al(e,n,Kt),i=r.element.__lexicalLastChildKind??null,o=function(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Dr(t)?"line-break":mo(t)&&t.isInline()?"decorator":null}return"empty"}return null}(e,Qt);i!==o&&r.setManagedLineBreak(o)}function _e(e,n,r){var i;Wt=null,$t=null,Jt=null,function(e,n,r){const i=Rt,o=e.__size,s=n.__size;Rt="";const l=r.element,c=Kt._keyToDOMMap.get(n.__key);void 0===c&&t(351,n.__key);const a=s-o;if(!re&&Math.abs(a)<=1&&o>=Lt&&e.__first===n.__first&&(0!==a||!Kt._cloneNotNeeded.has(e.__key))){const o=c.__lexicalTextContent,u=te.get(e.__key);if(!re&&"string"==typeof o&&void 0!==u){const s=function(t,e){const n=e.size;if(0===n||n>=t.__size)return null;let r=t.__last,i=null,o=0;for(;null!==r&&o<n;){if(!e.has(r))return null;i=r;const t=Qt.get(r);if(void 0===t)return null;r=t.__prev,o++}if(o!==n)return null;if(null!==r&&e.has(r))return null;return i}(n,u);if(null!==s){const f=u.size;if(0===a){const e=Ft(s,f);let r=s,a=0;for(;null!==r&&a<f;){const t=Qt.get(r);if(void 0===t)break;const e=jt();ye(r,l),Gr(t)&&null===Wt&&(Wt=t.getFormat(),$t=t.getStyle(),Jt=t.__key),Ut(e),r=t.__next,a++}let d="";for(r=s,a=0;null!==r&&a<f;){const e=Qt.get(r);if(void 0===e)break;let n;if(_o(e)){const i=Kt._keyToDOMMap.get(r),o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(352,e.getType()),n=o}else n=e.getTextContent();d+=n,a<f-1&&_o(e)&&!e.isInline()&&(d+=D),r=e.__next,a++}const h=o.slice(0,o.length-e)+d;return c.__lexicalTextContent=h,Rt=i+h,void pe(n,c,u)}if(function(e,n,r,i,o,s,l,c){if(1!==c&&-1!==c)return!1;const a=1===c?2:1;if(l!==a)return!1;const u=l-c;let f=e.__last;for(let t=0;t<u-1;t++){if(null===f)return!1;const t=Gt.get(f);if(void 0===t)return!1;f=t.__prev}if(null===f)return!1;const d=Qt.get(s),h=Gt.get(f);if(void 0===d||void 0===h)return!1;if(d.__prev!==h.__prev)return!1;const g=[];let _=s;for(let t=0;t<l;t++){if(null===_)return!1;g.push(_);const t=Qt.get(_);_=t?t.__next:null}const p=[];_=f;for(let t=0;t<u;t++){if(null===_)return!1;p.push(_);const t=Gt.get(_);_=t?t.__next:null}const y=new Set(p),m=new Set(g),x=[];let C=0,v=0;for(;C<u&&v<l;)if(g[v]===p[C])x.push({key:g[v],kind:"reconcile"}),C++,v++;else if(m.has(p[C])){if(y.has(g[v]))return!1;x.push({key:g[v],kind:"create",nextIndex:v}),v++}else x.push({key:p[C],kind:"destroy"}),C++;for(;C<u;)x.push({key:p[C++],kind:"destroy"});for(;v<l;)x.push({key:g[v],kind:"create",nextIndex:v}),v++;const S=Ft(f,u);for(const t of x){const e=jt();if("reconcile"===t.kind)ye(t.key,r.element);else if("destroy"===t.kind)oe(t.key,r.element);else{let e=null;for(let n=t.nextIndex+1;n<l;n++){const t=Kt._keyToDOMMap.get(g[n]);if(void 0!==t){e=t;break}}de(t.key,r.withBefore(e??r.before))}if("destroy"!==t.kind){const e=Qt.get(t.key);e&&Gr(e)&&null===Wt&&(Wt=e.getFormat(),$t=e.getStyle(),Jt=e.__key)}Ut(e)}let k="";for(let e=0;e<l;e++){const n=Qt.get(g[e]);if(void 0===n)return!1;let r;if(_o(n)){const i=Kt._keyToDOMMap.get(g[e]),o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(350,n.getType()),r=o}else r=n.getTextContent();k+=r,e<l-1&&_o(n)&&!n.isInline()&&(k+=D)}const T=o.slice(0,o.length-S)+k;return i.__lexicalTextContent=T,!0}(e,0,r,c,o,s,f,a)){const e=c.__lexicalTextContent;return"string"!=typeof e&&t(353),Rt=i+e,void pe(n,c,u)}}}if(0===a){let n=e.__first,r=0;for(;null!==n;){const e=Qt.get(n);if(void 0===e)break;const i=re||qt.has(n)||Yt.has(n),o=jt();if(i)ye(n,l);else{let r,i;if(_o(e)){i=Zt.get(n);const o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(354,e.getType()),r=o}else r=e.getTextContent();Rt+=r,void 0!==i&&Vt(i)}Gr(e)?null===Wt&&(Wt=e.getFormat(),$t=e.getStyle(),Jt=e.__key):_o(e)&&r<s-1&&!e.isInline()&&(Rt+=D),Ut(o),n=e.__next,r++}return c.__lexicalTextContent=Rt,c.__lexicalFirstTextKey=Jt,void(Rt=i+Rt)}}if(1===o&&1===s){const t=e.__first,i=n.__first;if(t===i)ye(t,l);else{const e=Se(t),n=de(i,null);try{e.parentNode===l?l.replaceChild(n,e):r.insertChild(n)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw r}oe(t,null)}const o=Qt.get(i);Gr(o)&&null===Wt&&(Wt=o.getFormat(),$t=o.getStyle(),Jt=o.__key)}else{const i=Yl(e,Gt),c=Yl(n,Qt);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&he(c,n,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;se(i,0,o-1,t?null:l),t&&(l.textContent="")}}else!function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d],i=jt();if(t===r)u=xe(ye(r,o.element)),f++,d++;else{if(void 0===a&&(a=Ce(n,d)),void 0===c)c=Ce(e,f);else if(!c.has(t)){f++,Ut(i);continue}if(!a.has(t)){u=xe(Se(t)),oe(t,o.element),f++,c.delete(t),Ut(i);continue}if(c.has(r)){const t=Xs(Kt,r);t!==u&&o.withBefore(u??o.before).insertChild(t),u=xe(ye(r,o.element)),f++,d++}else de(r,o.withBefore(u??o.before)),d++}const s=Qt.get(r);null!==s&&Gr(s)?null===Wt&&(Wt=s.getFormat(),$t=s.getStyle(),Jt=s.__key):_o(s)&&d<=l&&!s.isInline()&&(Rt+=D),Ut(i)}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Kt.getElementByKey(e);he(n,t,d,l,o.withBefore(r??o.before))}else g&&!h&&se(e,f,s,o.element)}(n,i,c,o,s,r)}c.__lexicalTextContent=Rt,c.__lexicalFirstTextKey=Jt,Rt=i+Rt}(e,n,Al(n,r,Kt)),cl(n)||(i=n,null==Wt||Wt===i.__textFormat||ie||i.setTextFormat(Wt),function(t){null==$t||$t===t.__textStyle||ie||t.setTextStyle($t)}(n))}function pe(t,e,n){const r=e.__lexicalFirstTextKey;if(null!=r){const e=t.__key;let i=r;for(;null!==i;){const t=Qt.get(i);if(void 0===t){i=null;break}if(t.__parent===e)break;i=t.__parent}if(null!==i&&!n.has(i)){const t=Qt.get(r);if(Gr(t))return Wt=t.getFormat(),void($t=t.getStyle())}}e.__lexicalFirstTextKey=Jt}function ye(e,n){const r=Gt.get(e);let i=Qt.get(e);void 0!==r&&void 0!==i||t(61);const o=re||qt.has(e)||Yt.has(e),s=Xs(Kt,e);if(r===i&&!o){let e;if(_o(r)){const n=s.__lexicalTextContent;"string"!=typeof n&&t(355,r.getType()),e=n,Vt(s)}else e=r.getTextContent();return Rt+=e,s}if(r!==i&&o&&Us(ee,Bt,Ht,i,"updated"),ne.$updateDOM(i,r,s,Kt)){const r=de(e,null);return null===n&&t(62),n.replaceChild(r,s),oe(e,null),r}if(_o(r)){_o(i)||t(334,e);const n=i.__indent;(re||n!==r.__indent)&&ae(s,n);const l=i.__format;if((re||l!==r.__format)&&ue(s,l),o)_e(r,i,s),Co(i)||i.isInline()||ge(0,i,s);else{const e=s.__lexicalTextContent;"string"!=typeof e&&t(356,r.getType()),Rt+=e,Vt(s)}if((re||i.__dir!==r.__dir||i.__parent!==r.__parent)&&(fe(s,i),Co(i)&&!re))for(const t of i.getChildren())if(_o(t)){fe(Xs(Kt,t.getKey()),t)}}else{const t=i.getTextContent();if(mo(i)){const t=i.decorate(Kt,zt);null!==t&&me(e,t)}Rt+=t}if(!ie&&Co(i)){const t=i.getLatest();if(t.__cachedText!==Rt){const e=t.getWritable();e.__cachedText=Rt,i=e}}return ne.$decorateDOM(i,r,s,Kt),It(i),s}function me(t,e){let n=Kt._pendingDecorators;const r=Kt._decorators;if(null===n){if(r[t]===e)return;n=Ts(Kt)}n[t]=e}function xe(t){let e=t.nextSibling;return null!==e&&e===Kt._blockCursorElement&&(e=e.nextSibling),e}function Ce(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function ve(t,e,n,r,i,o){Rt="",Wt=null,$t=null,Jt=null,re=2===r,Kt=n,zt=n._config,ne=n._config.dom||Jo,Bt=n._nodes,Ht=Kt._listeners.mutation,Yt=i,qt=o,Gt=t._nodeMap,Xt=t,Qt=e._nodeMap,ie=e._readOnly,Zt=et(n._keyToDOMMap),te=function(){const t=new Map,e=e=>{for(const n of e){const e=Qt.get(n);if(void 0===e)continue;const r=e.__parent;if(null===r)continue;let i=t.get(r);void 0===i&&(i=new Set,t.set(r,i)),i.add(n)}};return e(Yt.keys()),e(qt),t}();const s=new Map;return ee=s,ye("root",null),Kt=void 0,Bt=void 0,Yt=void 0,qt=void 0,Gt=void 0,Xt=void 0,Qt=void 0,zt=void 0,Zt=void 0,te=void 0,ee=void 0,ne=Jo,s}function Se(e){const n=Zt.get(e);return void 0===n&&t(75,e),n}function ke(t){return{type:t}}const Te=ke("SELECTION_CHANGE_COMMAND"),be=ke("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ne=ke("CLICK_COMMAND"),we=ke("BEFORE_INPUT_COMMAND"),Ee=ke("INPUT_COMMAND"),Oe=ke("COMPOSITION_START_COMMAND"),Me=ke("COMPOSITION_END_COMMAND"),Ae=ke("DELETE_CHARACTER_COMMAND"),De=ke("INSERT_LINE_BREAK_COMMAND"),Pe=ke("INSERT_PARAGRAPH_COMMAND"),Fe=ke("CONTROLLED_TEXT_INSERTION_COMMAND"),Ie=ke("PASTE_COMMAND"),Le=ke("REMOVE_TEXT_COMMAND"),ze=ke("DELETE_WORD_COMMAND"),Ke=ke("DELETE_LINE_COMMAND"),Be=ke("FORMAT_TEXT_COMMAND"),Re=ke("UNDO_COMMAND"),We=ke("REDO_COMMAND"),$e=ke("KEYDOWN_COMMAND"),Je=ke("KEY_ARROW_RIGHT_COMMAND"),je=ke("MOVE_TO_END"),Ue=ke("KEY_ARROW_LEFT_COMMAND"),Ve=ke("MOVE_TO_START"),He=ke("KEY_ARROW_UP_COMMAND"),Ye=ke("KEY_ARROW_DOWN_COMMAND"),qe=ke("KEY_ENTER_COMMAND"),Ge=ke("KEY_SPACE_COMMAND"),Xe=ke("KEY_BACKSPACE_COMMAND"),Qe=ke("KEY_ESCAPE_COMMAND"),Ze=ke("KEY_DELETE_COMMAND"),tn=ke("KEY_TAB_COMMAND"),en=ke("INSERT_TAB_COMMAND"),nn=ke("INDENT_CONTENT_COMMAND"),rn=ke("OUTDENT_CONTENT_COMMAND"),on=ke("DROP_COMMAND"),sn=ke("FORMAT_ELEMENT_COMMAND"),ln=ke("DRAGSTART_COMMAND"),cn=ke("DRAGOVER_COMMAND"),an=ke("DRAGEND_COMMAND"),un=ke("COPY_COMMAND"),fn=ke("CUT_COMMAND"),dn=ke("SELECT_ALL_COMMAND"),hn=ke("CLEAR_EDITOR_COMMAND"),gn=ke("CLEAR_HISTORY_COMMAND"),_n=ke("CAN_REDO_COMMAND"),pn=ke("CAN_UNDO_COMMAND"),yn=ke("FOCUS_COMMAND"),mn=ke("BLUR_COMMAND"),xn=ke("KEY_MODIFIER_COMMAND"),Cn=Object.freeze({}),vn=[["keydown",function(t,e){Sn=t.timeStamp,kn=t.key,"Backspace"!==t.key&&Un();if(e.isComposing())return;Gs(e,$e,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Sl(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&ho(e,()=>{es(n)||(An=!0)})}],["compositionstart",function(t,e){Gs(e,Oe,t)}],["compositionend",function(t,e){o?Pn=!0:l||!a&&!d?Gs(e,Me,t):(Fn=!0,In=t.data)}],["input",function(t,e){t.stopPropagation(),Un(),ho(e,()=>{e.dispatchCommand(Ee,t)},{event:t}),bn=null}],["click",function(t,e){ho(e,()=>{const n=Ti(),r=_l(ol(e)),i=bi();if(r)if(si(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!Co(e)&&1===Ns().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(vl(n)||us(n)){Es(ki(i,r,e,t))}}Gs(e,Ne,t)})}],["cut",Cn],["copy",Cn],["dragstart",Cn],["dragover",Cn],["dragend",Cn],["paste",Cn],["focus",Cn],["blur",Cn],["drop",Cn]];s&&vn.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||o&&qs(e))return;if("insertCompositionText"===n)return;Gs(e,we,t)}(t,e)]);let Sn=0,kn=null,Tn=0,bn=null,Nn=!1,wn=null;const En=new WeakMap,On=new WeakMap;let Mn=!1,An=!1,Dn=!1,Pn=!1,Fn=!1,In="",Ln=null,zn=[0,"",0,"root",0];function Kn(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=Gi(),u=_l(ol(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Gr(c)||(!i&&(!s||Tn<r+50)||c.isDirty()&&g<2||Ms(n))&&o.offset!==l.offset&&!c.isComposing()||as(c)||c.isDirty()&&g>1||(i||!s)&&null!==h&&!c.isComposing()&&f!==Pl(c,h,a)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==t.format||c.getStyle()!==t.style)||function(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;const n=t.anchor.offset,r=e.getParentOrThrow(),i=cs(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return(Gr(e)||_o(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function Bn(t,e){return us(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function Rn(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;Mn&&(Mn=!1,Bn(i,o)&&Bn(s,l)&&!Ln)||ho(n,()=>{if(!r)return void Es(null);if(!rs(n,i,s))return;let c=Ti();if(Ln&&si(c)&&c.isCollapsed()){const t=c.anchor,e=Ln.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=Ln.clone(),Es(c))}if(Ln=null,si(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const o=ol(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=zn,h=Ns(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)Wn(c,l,a);else if("text"===r.type)Gr(i)||t(141),$n(c,i);else if("element"===r.type&&!g){_o(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();Wn(t,n,r)}(c,e):Wn(c,c.format,"")}}else{const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,s=c.isBackward(),a=s?l:o,u=s?o:l,f=s?e:t,d=s?t:e;let h=2047,g=!1;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(Gr(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=!0,h&=e.getFormat(),0===h))break}c.format=g?h:0}}Gs(n,Te,void 0)})}function Wn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function $n(t,e){Wn(t,e.getFormat(),e.getStyle())}function Jn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function jn(t){if(null==t||t.length<=1||null==kn)return;const e=1===kn.length?kn:"Enter"===kn?"\n":"Tab"===kn?"\t":null;if(!e)return;const n=Ti();if(!si(n)||!n.isCollapsed())return;const r=n.anchor.getNode();if(!Gr(r))return;const{offset:i}=n.anchor;if(r.getTextContentSize()===i){const t=r.getNextSibling();if("\n"===e){if(Dr(t))t.selectEnd();else if(!t){const t=Hl(r,mi),e=t&&t.getNextSibling();_o(e)&&e.selectStart()}}else"\t"===e?ti(t)&&t.selectEnd():Gr(t)&&t.getTextContent()[0]===e&&t.select(1,1)}else r.getTextContent()[i]===e&&r.select(i+1,i+1)}function Un(){Nn=!1,null!==wn&&(clearTimeout(wn),wn=null)}function Vn(){Un(),Nn=!0,wn=setTimeout(Un,0)}function Hn(e){const n=e.inputType,r=Jn(e),i=Gi(),o=Ti();if("insertText"===n&&e.data&&Nn){if(Un(),e.preventDefault(),si(o)&&!o.isCollapsed()){const t=o.isBackward()?o.anchor:o.focus;o.anchor.set(t.key,t.offset,t.type),o.focus.set(t.key,t.offset,t.type)}return!0}if("deleteContentBackward"===n){if(null===o){const t=bi();if(!si(t))return!0;Es(t.clone())}if(si(o)){const n=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===kn&&s<Sn+30&&i.isComposing()&&n){if(ms(null),Sn=0,setTimeout(()=>{ho(i,()=>{ms(null)})},30),si(o)){const e=o.anchor.getNode();e.markDirty(),Gr(e)||t(142),$n(o,e)}}else{if(ms(null),l&&null!==r&&!r.collapsed&&(o.applyDOMRange(r),!o.isCollapsed()))return e.preventDefault(),o.removeText(),!0;e.preventDefault();const t=o.anchor.getNode(),s=t.getTextContent(),c=t.canInsertTextAfter(),a=0===o.anchor.offset&&o.focus.offset===s.length;let u=f&&n&&!a&&c;if(u&&o.isCollapsed()&&(u=!mo(Ys(o.anchor,!0))),!u){Gs(i,Ae,!0);const t=Ti();f&&si(t)&&t.isCollapsed()&&(Ln=t,setTimeout(()=>Ln=null))}}return!0}}var s;if(!si(o))return!0;const c=e.data;null!==bn&&Fs(!1,i,bn),o.dirty&&null===bn||!o.isCollapsed()||Co(o.anchor.getNode())||null===r||o.applyDOMRange(r),bn=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===c)e.preventDefault(),Gs(i,De,!1);else if(c===D)e.preventDefault(),Gs(i,Pe,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t)}else null!=c&&Kn(o,r,c,e.timeStamp,!0)?(e.preventDefault(),Gs(i,Fe,c),jn(c)):bn=c;return Tn=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Gs(i,Fe,e);jn((e.dataTransfer?e.dataTransfer.getData("text/plain"):null)??e.data);break;case"insertFromComposition":ms(null),Gs(i,Fe,e);break;case"insertLineBreak":ms(null),Gs(i,De,!1);break;case"insertParagraph":ms(null),Dn&&!l?(Dn=!1,Gs(i,De,!1)):Gs(i,Pe,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Gs(i,Ie,e);break;case"deleteByComposition":(function(t,e){return t!==e||_o(t)||_o(e)||!cs(t)||!cs(e)})(d,h)&&Gs(i,Le,e);break;case"deleteByDrag":el(vr),Gs(i,Le,e);break;case"deleteByCut":Gs(i,Le,e);break;case"deleteContent":Gs(i,Ae,!1);break;case"deleteWordBackward":Gs(i,ze,!0);break;case"deleteWordForward":Gs(i,ze,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Gs(i,Ke,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Gs(i,Ke,!1);break;case"formatStrikeThrough":Gs(i,Be,"strikethrough");break;case"formatBold":Gs(i,Be,"bold");break;case"formatItalic":Gs(i,Be,"italic");break;case"formatUnderline":Gs(i,Be,"underline");break;case"historyUndo":Gs(i,Re,void 0);break;case"historyRedo":Gs(i,We,void 0)}return!0}function Yn(t){if(vl(t.target)&&es(t.target))return!0;const e=Gi(),n=Ti(),r=t.data,i=Jn(t);if(null!=r&&si(n)&&Kn(n,i,r,t.timeStamp,!1)){Pn&&(Xn(e,r),Pn=!1);const i=n.anchor.getNode(),l=_l(ol(e));if(null===l)return!0;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Gr(i)&&null!==l.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+u)===Ps(l.anchorNode)||Gs(e,Fe,r);const d=r.length;o&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d,n._cachedNodes=null,n._cachedIsBackward=null),f&&e.isComposing()&&(Sn=0,ms(null))}else{Fs(!1,e,null!==r?r:void 0),Pn&&(Xn(e,r||void 0),Pn=!1)}return function(){Hi();const t=Gi();dt(t)}(),!0}function qn(t){const e=Gi(),n=Ti();if(si(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();ms(r.key),el(Sr),(t.timeStamp<Sn+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Gr(i)&&i.getStyle()!==n.style)&&Gs(e,Fe,P)}return!0}function Gn(t){return Xn(Gi(),t.data),el(kr),!0}function Xn(t,e){const n=t._compositionKey;if(ms(null),null!==n&&null!=e){if(""===e){const e=Cs(n),r=t.getElementByKey(n),i=null!==r&&Gr(e)?Pl(e,r,t):null;if(null!==i&&null!==i.nodeValue&&Gr(e)){const n=_l(ol(t));let r=null,o=null;null!==n&&n.anchorNode===i&&(r=n.anchorOffset,o=n.focusOffset),Is(e,i.nodeValue,r,o,!0)}return}if("\n"===e[e.length-1]){const e=Ti();if(si(e)||ci(e)){if(si(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type)}return void Gs(t,qe,null)}}}Fs(!0,t,e)}function Qn(t){const e=Gi();if(null==t.key)return!0;if(Fn){if($s(t))return ho(e,()=>{Xn(e,In)}),Fn=!1,In="",!0;Fn=!1,In=""}if(function(t){return Bs(t,"ArrowRight",{shiftKey:"any"})}(t))Gs(e,Je,t);else if(function(t){return Bs(t,"ArrowRight",{...Rs,shiftKey:"any"})}(t))Gs(e,je,t);else if(function(t){return Bs(t,"ArrowLeft",{shiftKey:"any"})}(t))Gs(e,Ue,t);else if(function(t){return Bs(t,"ArrowLeft",{...Rs,shiftKey:"any"})}(t))Gs(e,Ve,t);else if(function(t){return Bs(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Gs(e,He,t);else if(function(t){return Bs(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Gs(e,Ye,t);else if(function(t){return Bs(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Dn=!0,Gs(e,qe,t);else if(function(t){return" "===t.key}(t))Gs(e,Ge,t);else if(function(t){return i&&Bs(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),Dn=!0,Gs(e,De,!0);else if(function(t){return Bs(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Dn=!1,Gs(e,qe,t);else if(function(t){return Bs(t,"Backspace",{shiftKey:"any"})||i&&Bs(t,"h",{ctrlKey:!0})}(t))$s(t)?Gs(e,Xe,t)&&Vn():(t.preventDefault(),Gs(e,Ae,!0));else if(function(t){return"Escape"===t.key}(t))Gs(e,Qe,t);else if(function(t){return Bs(t,"Delete",{})||i&&Bs(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),Gs(e,Ae,!1)):Gs(e,Ze,t);else if(function(t){return Bs(t,"Backspace",Ws)}(t))t.preventDefault(),Gs(e,ze,!0);else if(function(t){return Bs(t,"Delete",Ws)}(t))t.preventDefault(),Gs(e,ze,!1);else if(function(t){return i&&Bs(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),Gs(e,Ke,!0);else if(function(t){return i&&(Bs(t,"Delete",{metaKey:!0})||Bs(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),Gs(e,Ke,!1);else if(function(t){return Bs(t,"b",Rs)}(t))t.preventDefault(),Gs(e,Be,"bold");else if(function(t){return Bs(t,"u",Rs)}(t))t.preventDefault(),Gs(e,Be,"underline");else if(function(t){return Bs(t,"i",Rs)}(t))t.preventDefault(),Gs(e,Be,"italic");else if(function(t){return Bs(t,"Tab",{shiftKey:"any"})}(t))Gs(e,tn,t);else if(function(t){return Bs(t,"z",Rs)}(t))t.preventDefault(),Gs(e,Re,void 0);else if(function(t){if(i)return Bs(t,"z",{metaKey:!0,shiftKey:!0});return Bs(t,"y",{ctrlKey:!0})||Bs(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),Gs(e,We,void 0);else{const n=e._editorState._selection;!function(t){return Bs(t,"a",Rs)}(t)?null===n||si(n)||(!function(t){return Bs(t,"c",Rs)}(t)?function(t){return Bs(t,"x",Rs)}(t)&&(t.preventDefault(),Gs(e,fn,t)):(t.preventDefault(),Gs(e,un,t))):(t.preventDefault(),Gs(e,dn,t)&&Vn())}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(xn,t),!0}function Zn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const tr=new Map;function er(t){const e=pl(t.target);if(null===e)return;const n=os(e.anchorNode);if(null===n)return;An&&(An=!1,ho(n,()=>{const r=bi(),i=e.anchorNode;if(vl(i)||us(i)){Es(ki(r,e,n,t))}}));const r=As(n),i=r[r.length-1],o=i._key,s=tr.get(o),l=s||i;l!==n&&Rn(e,l,!1),Rn(e,n,!0),n!==i?tr.set(o,n):s&&tr.delete(o)}function nr(t){t._lexicalHandled=!0}function rr(t){return!0===t._lexicalHandled}const ir=()=>{};function or(e){const n=En.get(e);if(void 0===n)return void ir();const r=On.get(n);if(void 0===r)return void ir();const i=r-1;i>=0||t(164),En.delete(e),On.set(n,i),0===i&&n.removeEventListener("selectionchange",er);const o=ss(e);is(o)?(!function(t){if(null!==t._parentEditor){const e=As(t),n=e[e.length-1]._key;tr.get(n)===t&&tr.delete(n)}else tr.delete(t._key)}(o),e.__lexicalEditor=null):o&&t(198);const s=Zn(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function sr(t,e,n){Hi();const r=t.__key,i=t.getParent();if(null===i)return;const o=function(t){const e=Ti();if(!si(e)||!_o(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();rl(i,t)&&n.set(t.__key,0,"element");rl(o,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if(si(o)&&e){const e=o.anchor,n=o.focus;e.key===r&&(Ei(e,t,i,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(Ei(n,t,i,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else ci(o)&&e&&t.isSelected()&&t.selectPrevious();if(si(o)&&e&&!s){const e=t.getIndexWithinParent();ps(t),Ni(o,i,e,-1)}else ps(t);n||cl(i)||i.canBeEmpty()||!i.isEmpty()||sr(i,e),e&&o&&Co(i)&&i.isEmpty()&&i.selectEnd()}function lr(t){return t}const cr=Symbol.for("ephemeral");function ar(t){return t[cr]||!1}const ur={configurable:!0,enumerable:!1,value:void 0,writable:!0};class fr{__type;__key;__parent;__prev;__next;__state;[Pt];static getType(){const{ownNodeType:e}=Ul(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name)}$config(){return{}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",ur),Object.defineProperty(this,Pt,ur),_s(this,t)}getType(){return this.__type}isInline(){t(137,this.constructor.name)}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return!0;const e=Cs(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||Ti();if(null==e)return!1;const n=e.getNodes().some(t=>t.__key===this.__key);if(Gr(this))return n;if(si(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(mo(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return-1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return null===t?null:Cs(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(cl(n))return _o(e)||e===this&&mo(e)||t(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Cs(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Cs(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=_o(this)?this:this.getParent(),n=_o(t)?t:t.getParent(),r=e&&n?Ec(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ec(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===bc(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ec(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=_o(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f)}while(null===u);o=u}return n||r.reverse(),r}isDirty(){const t=Gi()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(ar(this))return this;const e=Cs(this.__key);return null===e&&t(113),e}getWritable(){if(ar(this))return this;Hi();const t=qi(),e=Gi(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=Ti();if(null!==s&&s.setCachedNodes(null),o.has(r))return ys(i),i;const l=zl(i);return o.add(r),ys(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}getDOMSlot(t){return new H(t)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name)}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of St(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return(n.__state||i)&&vt(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){sr(this,!0,t)}replace(e,n){Hi();let r=Ti();null!==r&&(r=r.clone()),fl(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=null!==u?l.getIndexWithinParent():-1;ps(l),null!==u&&si(r)&&Ni(r,u,f,-1);const d=i.getPreviousSibling(),h=i.getNextSibling(),g=i.__prev,_=i.__next,p=i.__parent;if(sr(i,!1,!0),null===d)c.__first=s;else{d.getWritable().__next=s}if(l.__prev=g,null===h)c.__last=s;else{h.getWritable().__prev=s}l.__next=_,l.__parent=p,c.__size=a;let y=0;if(n&&(_o(this)&&_o(l)||t(139),y=l.getChildrenSize(),l.splice(y,0,this.getChildren())),si(r)){Es(r);const t=r.anchor,e=r.focus;t.key===o&&(n&&"element"===t.type?t.set(l.__key,y+t.offset,"element"):ii(t,l)),e.key===o&&(n&&"element"===e.type?e.set(l.__key,y+e.offset,"element"):ii(e,l))}return xs()===o&&ms(s),l}insertAfter(t,e=!0){Hi(),fl(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=Ti();let s=!1,l=!1;if(null!==i){const n=t.getIndexWithinParent();if(si(o)){const t=i.__key,e=o.anchor,r=o.focus;s="element"===e.type&&e.key===t&&e.offset===n+1,l="element"===r.type&&r.key===t&&r.offset===n+1}ps(r),e&&si(o)&&Ni(o,i,n,-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,e&&si(o)){const t=this.getIndexWithinParent();Ni(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element")}return t}insertBefore(t,e=!0){Hi(),fl(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key,o=Ti(),s=r.getParent(),l=null!==s?r.getIndexWithinParent():-1;ps(r),null!==s&&e&&si(o)&&Ni(o,s,l,-1);const c=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),u=n.__prev,f=this.getIndexWithinParent();if(null===c)a.__first=i;else{c.getWritable().__next=i}if(a.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,e&&si(o)){Ni(o,this.getParentOrThrow(),f)}return t}isParentRequired(){return!1}createParentElementNode(){return Oo()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Hi();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(_o(n))return n.select();if(!Gr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Hi();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(_o(n))return n.select(0,0);if(!Gr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}function dr(t){return t instanceof fr}const hr="historic",gr="history-push",_r="history-merge",pr="paste",yr="collaboration",mr="skip-collab",xr="skip-scroll-into-view",Cr="skip-dom-selection",vr="skip-selection-focus",Sr="composition-start",kr="composition-end",Tr=/\s*!important\s*$/i;function br(t){const e={};if(!t)return e;let n="",r="",i=null,o=!1,s=!1,l=!1,c=0;for(let a=0;a<t.length;a++){const u=t[a];if(o)"*"===u&&"/"===t[a+1]&&(o=!1,a++);else if(s)l?r+=u:n+=u,s=!1;else if(null===i)if("/"!==u||"*"!==t[a+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==c){if(";"===u&&0===c){const t=n.trim(),i=r.trim();""!==t&&""!==i&&(e[t]=i),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else c=Math.max(0,c-1),l?r+=u:n+=u;else c++,l?r+=u:n+=u;else i=u,l?r+=u:n+=u;else o=!0,a++;else l?r+=u:n+=u,"\\"===u?s=!0:u===i&&(i=null)}const a=n.trim(),u=r.trim();return""!==a&&""!==u&&(e[a]=u),e}function Nr(t,e,n){const r=Tr.test(n)?"important":"",i=""===r?n:n.replace(Tr,"").trim();t.setProperty(e,i,r)}function wr(t,e){for(const n in e){const r=e[n];null==r?t.removeProperty(n):Nr(t,n,r)}}function Er(t,e,n=""){if(e===n)return;const r=br(n),i=br(e);for(const e in i)delete r[e],Nr(t,e,i[e]);for(const e in r)t.removeProperty(e)}class Or extends fr{static getType(){return"linebreak"}static clone(t){return new Or(t.__key)}constructor(t){super(t)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>function(t){const e=t.parentElement;if(null!==e&&wl(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Pr(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&Pr(n))return!0}}return!1}(t)||function(t){const e=t.parentElement;if(null!==e&&wl(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Pr(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&Pr(r))return!0}return!1}(t)?null:{conversion:Mr,priority:0}}}static importJSON(t){return Ar().updateFromJSON(t)}}function Mr(t){return{node:Ar()}}function Ar(){return ul(new Or)}function Dr(t){return t instanceof Or}function Pr(t){return us(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Fr(t,e){return 16&e?"code":e&k?"mark":32&e?"sub":64&e?"sup":null}function Ir(t,e){return 1&e?"strong":2&e?"em":"span"}function Lr(t,e,n,r,i){const o=r.classList;let s=js(i,"base");void 0!==s&&o.add(...s),s=js(i,"underlineStrikethrough");let l=!1;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=!0,c||o.add(...s)):c&&o.remove(...s));for(const t in K){const r=K[t];if(s=js(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s)}else e&r&&o.remove(...s)}}function zr(t,e,n){const r=n.isComposing(),i=t+(r?A:""),s=Ol(),l=Ml(s).$getDOMSlot(n,e,s),c=l.getFirstChild();if(null===c||c.nodeType!==Node.TEXT_NODE)return void l.insertChild(document.createTextNode(i));const a=c,u=a.nodeValue;if(u!==i)if(r||o){const[t,e,n]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;o+i<n&&o+i<r&&t[n-o-1]===e[r-o-1];)o++;return[i,n-i-o,e.slice(i,r-o)]}(u,i);0!==e&&a.deleteData(t,e),a.insertData(t,n)}else a.nodeValue=i}function Kr(t,e,n,r,i,o){zr(i,t,e);const s=o.theme.text;void 0!==s&&Lr(0,0,r,t,s)}function Br(t,e){const n=document.createElement(e);return n.appendChild(t),n}class Rr extends fr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new Rr(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return J[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===xs()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=K[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return hs(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=Fr(0,n),i=Ir(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l));Kr(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&Er(s.style,c),s}updateDOM(e,n,r){const i=this.__text,o=e.__format,s=this.__format,l=Fr(0,o),c=Fr(0,s),a=Ir(0,o),u=Ir(0,s);if((null===l?a:l)!==(null===c?u:c))return!0;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const o=document.createElement(u);return Kr(o,this,0,s,i,r),n.replaceChild(o,e),!1}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),zr(i,f,this);const d=r.theme.text;void 0!==d&&o!==s&&Lr(0,o,s,f,d);const h=e.__style,g=this.__style;return h!==g&&Er(n.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Ur,priority:0}),b:()=>({conversion:$r,priority:0}),code:()=>({conversion:Yr,priority:0}),em:()=>({conversion:Yr,priority:0}),i:()=>({conversion:Yr,priority:0}),mark:()=>({conversion:Yr,priority:0}),s:()=>({conversion:Yr,priority:0}),span:()=>({conversion:Wr,priority:0}),strong:()=>({conversion:Yr,priority:0}),sub:()=>({conversion:Yr,priority:0}),sup:()=>({conversion:Yr,priority:0}),u:()=>({conversion:Yr,priority:0})}}static importJSON(t){return qr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return vl(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Br(n,"b")),this.hasFormat("italic")&&(n=Br(n,"i")),this.hasFormat("strikethrough")&&(n=Br(n,"s")),this.hasFormat("underline")&&(n=Br(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?K[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?B[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=hs(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=$[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Hi();let n=t,r=e;const i=Ti(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t)}else n=0,r=0;if(!si(i))return xi(s,n,s,r,"text","text");{const t=xs();t!==i.anchor.key&&t!==i.focus.key||ms(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=Ti();if(r&&si(c)){const e=t+s;c.setTextNodeRange(i,e,i,e)}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Hi();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,i=xs(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;e<o&&r<=l;r++){const i=t[r];i>e&&(s.push(n.slice(e,i)),e=i)}const c=s.length;if(1===c)return[e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=!1,p=null,y=null;const m=Ti();if(si(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e)}e.isSegmented()?(f=qr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=wt(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=qr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=wt(e,n);const o=n.__key;i===r&&ms(o),x.push(n)}const C=p?p.offset:null,v=y?y.offset:null;let S=0;for(const t of x){if(!p&&!y)break;const e=S+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=S&&(p.set(t.getKey(),C-S,"text"),C<e&&(p=null)),null!==y&&null!==v&&v<=e&&v>=S){y.set(t.getKey(),v-S,"text");break}S=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&ys(e);null!==n&&ys(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),si(m)&&Ni(m,u,e,c-1)}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;xs()===i&&ms(r);const l=Ti();if(si(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Oi(t,n,r,e,s),null!==o&&o.key===i&&Oi(o,n,r,e,s)}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Wr(t){return{forChild:Xr(t.style),node:null}}function $r(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Xr(e.style,n?void 0:"bold"),node:null}}const Jr=new WeakMap;function jr(t){if(!vl(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Ur(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=Jr.get(n))&&!jr(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)Jr.set(r[t],i);return i}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(Ar()):"\t"===n?e.push(Zr()):""!==n&&e.push(qr(n))}return{node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return{node:null};if(" "===r[0]){let t=n,e=!0;for(;null!==t&&null!==(t=Vr(t,!1));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=!1;break}}e&&(r=r.slice(1))}if(" "===r[r.length-1]){let t=n,e=!0;for(;null!==t&&null!==(t=Vr(t,!0));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=!1;break}}e&&(r=r.slice(0,r.length-1))}return""===r?{node:null}:{node:qr(r)}}function Vr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t}if(n=t,vl(n)){const t=n.style.display;if(""===t&&!bl(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(us(n))return n;if("BR"===n.nodeName)return null}}const Hr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Yr(t){const e=Hr[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Xr(t.style,e),node:null}}function qr(t=""){return ul(new Rr(t))}function Gr(t){return t instanceof Rr}function Xr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Gr(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class Qr extends Rr{static getType(){return"tab"}static clone(t){return new Qr(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=js(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Zr().updateFromJSON(t)}setTextContent(t){return"\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return"normal"!==e&&t(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Zr(){return ul(new Qr)}function ti(t){return t instanceof Qr}class ei{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return Tc(Kc(Oc(this,"next")),Kc(Oc(t,"next")))<0}getNode(){const e=Cs(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,o=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,Vi()||(xs()===o&&ms(t),null!==i&&(i.setCachedNodes(null),si(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function ni(t,e,n){return new ei(t,e,n)}function ri(t,e){let n=e.__key,r=t.offset,i="element";if(Gr(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!_o(e)){const t=e.getNextSibling();if(Gr(t))n=t.__key,r=0,i="text";else{const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,i)}function ii(t,e){if(_o(e)){const n=e.getLastDescendant();_o(n)||Gr(n)?ri(t,n):ri(t,e)}else ri(t,e)}class oi{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!ci(t))return!1;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new oi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(Gr(r))i=r.select();else{const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t)}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove()}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Cs(t);null!==e&&n.push(e)}return Vi()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((Ti()||bi())===this&&t[0]){const e=uc(t[0],"next");Ac(Sc(e,e))}for(const e of t)e.remove()}}function si(t){return t instanceof li}class li{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!si(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,o=new Set;for(const n of t)if(sc(n)){const{origin:t}=n;0===e.length?i.add(t):(o.add(t),e.push(t))}else{const{origin:t}=n;_o(t)&&o.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(oc(t.focus)&&_o(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=gc(t.focus.origin,"previous");sc(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=pc(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!_o(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=Kc(t.anchor),r=Kc(t.anchor.getFlipped()),i=t=>rc(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o)}return e}(Wc(Pc(this),"next"));return Vi()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){return this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text"),this}getTextContent(){const t=this.getNodes();if(0===t.length)return"";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=ui(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(_o(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,Gr(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=o?t.slice(s):t.slice(l):f===n&&(t=o?t.slice(0,l):t.slice(0,s)),c+=t}else!mo(f)&&!Dr(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=Gi(),n=e.getEditorState()._selection,r=yi(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,o,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),s&&(this.dirty=!0),At(this)}clone(){const t=this.anchor,e=this.focus;return new li(ni(t.key,t.offset,t.type),ni(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=hs(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=K[t];return 0!==(this.format&e)}insertRawText(t){this.insertNodes(Ii(t))}insertText(e){const n=this.anchor,r=this.focus,i=this.format,o=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const i=t.getNode(),o=i.getChildAtIndex(t.offset),s=qr();if(s.setFormat(n),s.setStyle(r),Mo(o))o.splice(0,0,[s]);else{const t=Co(i)?Oo().append(s):s;null===o?i.append(t):o.insertBefore(t)}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text")}(s,l,i,o),"element"===l.type&&Mc(l,Kc(Oc(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Gr(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(as(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Gr(t)&&t.canInsertTextBefore()&&!as(t)||(t=qr(),t.setFormat(i),t.setStyle(o),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(as(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Gr(t)&&!as(t)||(t=qr(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=qr(d.getTextContent());t.setFormat(i),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||_o(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),pi(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(cs(d)){const t=qr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===o){if(ti(d)){const t=qr(e);return t.setFormat(i),t.setStyle(o),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=qr(e);if(t.setFormat(i),t.setStyle(o),t.select(),0===c)d.insertBefore(t,!1);else{const[e]=d.splitText(c);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}d.setFormat(i),d.setStyle(o)}const r=a-c;d=d.spliceText(c,r,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=_o(d)?d:d.getParentOrThrow();let r=_o(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(Gr(_)&&!cs(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=qr(_.getTextContent());_.replace(t),_=t}Co(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key)}else{const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove()}else t.add(_.__key);const o=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=o.length-1;t>=0;t--){const e=o[t];if(e.is(d)||_o(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,!1):e.remove())}if(!g){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(cs(d))if(c===h)d.select();else{const t=qr(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=Ti()===this;Dc(this,zc(Pc(this))),t&&Ti()!==this&&Es(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void ms(null);const n=this.getNodes(),r=[];for(const t of n)Gr(t)&&r.push(t);const i=e=>{n.forEach(n=>{if(_o(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}})},o=r.length;if(0===o)return this.toggleFormat(t),ms(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s: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(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(as(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text")}return void(this.format=g)}0===h||as(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||as(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,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(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Ti();return si(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Hl(n,El),i=e[e.length-1];if(_o(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=zi(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(t=>(_o(t)||mo(t))&&!t.isInline())){_o(r)||t(211,n.constructor.name,n.getType());const o=zi(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Oo();let n=null;for(let r=0;r<t.length;r++){const i=t[r],o=Dr(i);if(o||mo(i)&&i.isInline()||_o(i)&&i.isInline()||Gr(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),o))continue;null!==n&&n.append(i)}else e.append(i),n=null}return e}(e),s=o.getLastDescendant(),l=o.getChildren(),c=!_o(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;_o(f=u)&&El(f)&&!f.isEmpty()&&_o(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(_o(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n){const r=n.getParentOrThrow().getLastChild();let i=n;const o=[n];for(;i!==r;)i.getNextSibling()||t(140),i=i.getNextSibling(),o.push(i);let s=e;for(const t of o)s=s.insertAfter(t)}(r,u));const d=Hl(s,El);c&&_o(d)&&(c.canMergeWhenEmpty()||El(a))&&(d.append(...c.getChildren()),c.remove()),_o(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=_o(r)?r.getLastChild():null;Dr(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=Oo();return Ns().splice(this.anchor.offset,0,[t]),t.select(),t}const e=zi(this),n=Hl(this.anchor.getNode(),El);_o(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=n.insertNewAfter(this,!1);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(t){const e=Ar();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n)}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[i,o]=ui(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[o,i]:[i,o];if(0===e)return[];if(1===e){if(Gr(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return[n]}if(Gr(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),Gr(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,e,n){if(Bi(this,t,e,n))return;const r="move"===t,i=Gi(),o=_l(ol(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===s||!_o(c)||c.isInline()||c.canBeEmpty()||gl(s,i,l),this.dirty){const t=Xs(i,this.anchor.key),e=Xs(i,this.focus.key);let n=t,r=e;if("text"===this.anchor.type){const e=this.anchor.getNode();n=Gr(e)?Pl(e,t,i):null}if("text"===this.focus.type){const t=this.focus.getNode();r=Gr(t)?Pl(t,e,i):null}n&&r&&Mi(o,n,this.anchor.offset,r,this.focus.offset)}if(function(t,e,n,r){t.modify(e,n,r)}(o,t,e?"backward":"forward",n),o.rangeCount>0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=Co(n)?n:ll(n);if(this.applyDOMRange(t),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let t=0;t<n.length;t++){const e=n[t];rl(e,i)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];_o(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];_o(t)?t.selectEnd():t.getParentOrThrow().selectEnd()}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,i,o,!0)}(this)}}"lineboundary"===n&&Bi(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&_o(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(_o(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=Cc(Oc(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(sc(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(_o(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Kc(e);Dc(this,Sc(t,t)),r.anchor.origin.remove()}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"})}else{if("merge-block"===t.type)break;if(oc(e)){if(_o(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(mo(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&_o(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=vi();t.add(e.origin.getKey()),Es(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return e.origin.isEmpty()&&!n.isEmpty()&&e.origin.getParent()===n.getParent()?void e.origin.remove(!0):(Dc(this,Sc(!e.origin.isEmpty()&&n.isEmpty()?Fc(uc(n,e.direction)):r.anchor,e)),this.removeText())}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&fi(this,e.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void hi(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void hi(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t<o,l=s?t:o,c=s?o:t,a=c-1;if(l!==a){(function(t){return!(Ms(t)||di(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type))}}}(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&Co(t.getParent())&&null===t.getPreviousSibling()&&fi(this,t)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word")}this.isCollapsed()?this.deleteCharacter(t):this.removeText()}isBackward(){const t=this._cachedIsBackward;if(null!==t)return t;const e=this.focus.isBefore(this.anchor);return Vi()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function ci(t){return t instanceof oi}function ai(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function ui(t){const e=t.getStartEndPoints();if(null===e)return[0,0];const[n,r]=e;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[ai(n),ai(r)]}function fi(t,e){for(let n=e;n;n=n.getParent()){if(_o(n)){if(n.collapseAtStart(t))return!0;if(cl(n))break}if(n.getPreviousSibling())break}return!1}const di=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return()=>!1})();function hi(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;t<o;t++){const r=t===o-1;if(l=s,s+=i[t].length,e&&s===n||s>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function gi(e,n,r,i){let o,s=n,l=!1;if(vl(e)){let c=!1;const a=e.childNodes,u=a.length,f=i._blockCursorElement;s===u&&u>0&&(c=!0,s=u-1),void 0!==Ss(e,i)||e===i.getRootElement()||es(e)||(l=!0);let d=a[s],h=!1;if(d===f)d=a[s+1],h=!0;else if(null!==f){const t=f.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,f)&&s--}}if(o=Os(d),Gr(o))s=dc(o,c?"next":"previous");else{let a=Os(e);if(null===a)return null;if(_o(a)){const l=i.getElementByKey(a.getKey());null===l&&t(214);const u=Al(a,l,i);[a,s]=u.resolveChildIndex(a,l,e,n),_o(a)||t(215),c&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let f=a.getChildAtIndex(s);if(_o(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=c?f.getLastDescendant():f.getFirstDescendant();null===t?a=f:(f=t,a=_o(f)?f:f.getParentOrThrow()),s=0}Gr(f)?(o=f,a=null,s=dc(f,c?"next":"previous")):f!==a&&c&&!h&&(_o(a)||t(216),s=Math.min(a.getChildrenSize(),s+1))}else{const t=a.getIndexWithinParent(),r=i.getElementByKey(a.getKey());let o="after";if(null!==r&&Os(e)===a){const t=Al(a,r,i);t.element!==r?o=t.resolveLeafPosition(r,e,n):0===n&&mo(a)&&(o="before")}s="before"===o?t:t+1,a=a.getParentOrThrow()}if(_o(a))return[ni(a.__key,s,"element"),l]}}else o=Os(e);return Gr(o)?[ni(o.__key,dc(o,s,"clamp"),"text"),l]:null}function _i(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&_o(o)&&o.isInline()){const e=o.getPreviousSibling();Gr(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else _o(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Gr(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&_o(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&_o(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();Gr(e)&&t.set(e.__key,0,"text")}}}function pi(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);_i(t,n,r),_i(e,!n,r),r&&e.set(t.key,t.offset,t.type)}}function yi(t,e,n,r,i,o){if(null===t||null===n||!rs(i,t,n))return null;const s=gi(t,e,si(o)?o.anchor:null,i);if(null===s)return null;const l=gi(n,r,si(o)?o.focus:null,i);if(null===l)return null;const[c,a]=s,[u,f]=l;if("element"===c.type&&"element"===u.type){const e=Os(t),r=Os(n);if(mo(e)&&mo(r))return null}return pi(c,u),[c,u,a||f]}function mi(t){return _o(t)&&!t.isInline()}function xi(t,e,n,r,i,o){const s=qi(),l=new li(ni(t,e,i),ni(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Ci(){const t=ni("root",0,"element"),e=ni("root",0,"element");return new li(t,e,0,"")}function vi(){return new oi(new Set)}function Si(t,e){return ki(null,t,e,null)}function ki(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!it&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(si(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&si(t)&&!rs(n,a,u))return t.clone();const h=yi(a,f,u,d,n,t);if(null===h)return null;const[g,_,p]=h;let y=0,m="";if(si(t)){const e=t.anchor;if(g.key===e.key)y=t.format,m=t.style;else{const t=g.getNode();Gr(t)?(y=t.getFormat(),m=t.getStyle()):_o(t)&&(y=t.getTextFormat(),m=t.getTextStyle())}}const x=new li(g,_,y,m);return p&&(x.dirty=!0),x}function Ti(){return qi()._selection}function bi(){return Gi()._editorState._selection}function Ni(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),o.set(c,n,"element"),wi(t)}}else{const s=t.isBackward(),l=s?o:i,a=l.getNode(),u=s?i:o,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element")}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element")}}wi(t)}function wi(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!_o(o))return;const t=o.getChildrenSize(),i=n>=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(Gr(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}return}if(_o(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(Gr(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text")}}if(_o(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(Gr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}function Ei(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,Gr(r)?(s=r.getTextContentSize(),l="text"):_o(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,Gr(i)?l="text":_o(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Oi(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function Mi(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i)}catch(t){}}function Ai(t,e,n){const r=Xs(t,e.getKey());if(_o(e)){const i=Al(e,r,t);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function Di(t,e,n,r,i,s){const l=document.activeElement;if(i.has(yr)&&l!==s||null!==l&&ns(l))return;if(!si(e))return void(null!==t&&rs(n,r.anchorNode,r.focusNode)&&r.removeAllRanges());const c=e.anchor,a=e.focus,u=c.getNode(),f=a.getNode(),[d,h]=Ai(n,u,c.offset),[g,_]=Ai(n,f,a.offset),p=e.format,y=e.style,m=e.isCollapsed();let x=d,C=g,v=!1;var S,k,T,b,N;if(("text"===c.type?(x=Gr(u)?Pl(u,d,n):null,v=u.getFormat()!==p||u.getStyle()!==y):si(t)&&"text"===t.anchor.type&&(v=!0),"text"===a.type&&(C=Gr(f)?Pl(f,g,n):null),null!==x&&null!==C)&&(m&&(null===t||v||si(t)&&(t.format!==p||t.style!==y))&&(S=p,k=y,T=h,b=c.key,N=performance.now(),zn=[S,k,T,b,N]),"Range"===r.type&&m||r.anchorOffset!==h||r.focusOffset!==_||r.anchorNode!==x||r.focusNode!==C||(null!==l&&s.contains(l)||i.has(vr)||s.focus({preventScroll:!0}),"element"===c.type))){if(Mi(r,x,h,C,_),!o||!e.isCollapsed()||null===s||i.has(vr)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!i.has(xr)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=si(e)&&"element"===e.anchor.type?x.childNodes[h]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();!function(t,e,n){const r=Zs(n),i=il(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e){const e=i.visualViewport;if(e){const t=e.offsetTop;l=t,c=t+e.height}else l=0,c=ol(t).innerHeight;const n=i.getComputedStyle(r.documentElement),o=parseFloat(n.scrollPaddingTop),s=parseFloat(n.scrollPaddingBottom);isFinite(o)&&(l+=o),isFinite(s)&&(c-=s)}else{const t=a.getBoundingClientRect();l=t.top,c=t.bottom}let n=0;if(o<l?n=-(l-o):s>c&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else{const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e}if(e)break;a=Qs(a)}}(n,e,s)}}Mn=!0}}function Pi(t){let e=Ti()||bi();null===e&&(e=Ns().selectEnd()),e.insertNodes(t)}function Fi(t,e){for(const n of t.split(/(\r?\n|\t)/))"\n"===n||"\r\n"===n?e.linebreak():"\t"===n?e.tab():""!==n&&e.text(n)}function Ii(t){const e=[];return Fi(t,{linebreak:()=>e.push(Ar()),tab:()=>e.push(Zr()),text:t=>e.push(qr(t))}),e}function Li(){const t=Ti();return null===t?"":t.getTextContent()}function zi(e){let n=e;e.isCollapsed()||n.removeText();const r=Ti();si(r)&&(n=r),si(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!El(o);){const t=o;if([o,s]=Ki(o,s),t.is(o))break}return s}function Ki(t,e){const n=t.getParent();if(!n){const t=Oo();return Ns().append(t),t.select(),[Ns(),0]}if(Gr(t)){const r=t.splitText(e);if(0===r.length)return[n,t.getIndexWithinParent()];const i=0===e?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!_o(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new li(ni(t.__key,e,"element"),ni(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Bi(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),!0}const o=Oc(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!Bc(c)){for(const t of c){a=!1;const{origin:e}=t;if(!mo(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of Cc(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(sc(t))t.origin.isInline()||(c=t);else{if(_o(t.origin))continue;mo(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===o)return!1;if(l&&!s&&mo(c.origin)&&c.origin.isKeyboardSelectable()){const t=vi();return t.add(c.origin.getKey()),Es(t),!0}return c=Kc(c),l&&Mc(t.anchor,c),Mc(t.focus,c),a||!s}let Ri=null,Wi=null,$i=!1,Ji=!1,ji=0;const Ui={characterData:!0,childList:!0,subtree:!0};function Vi(){return $i||null!==Ri&&Ri._readOnly}function Hi(){$i&&t(13)}function Yi(){ji>99&&t(14)}function qi(){return null===Ri&&t(195,Qi()),Ri}function Gi(){return null===Wi&&t(337,Qi()),Wi}function Xi(){Gi()._dirtyType=2}function Qi(){let t=0;const e=new Set,n=Ho.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ss(r);if(is(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Zi(){return Wi}function to(t,e,n){const r=e.__type,i=Qo(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t<s&&(o[t](e),e.isAttached());t++);}function eo(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function no(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t)}function ro(t){return io(t,Gi()._nodes)}function io(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const o=i.klass;e.type!==o.getType()&&t(18,o.name);const s=o.importJSON(e),l=e.children;if(_o(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=io(l[t],n);s.append(e)}return s}function oo(t,e,n){const r=Ri,i=$i,o=Wi;Ri=e,$i=!0,Wi=t;try{return n()}finally{Ri=r,$i=i,Wi=o}}function so(e,n){const r=e._pendingEditorState,i=e._rootElement,o=e._headless||null===i;if(null===r)return void(e._deferred.length>0&&ao(e,e._deferred));const s=e._editorState,l=s._selection,c=r._selection,a=0!==e._dirtyType,u=Ri,f=$i,d=Wi,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!o&&a&&null!==g){Wi=e,Ri=r,$i=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),_=ve(s,r,e,t,n,i)}catch(t){if(t instanceof Error&&e._onError(t),Ji)throw t;return Wo(e,null,i,r),ht(e),e._dirtyType=2,Ji=!0,so(e,s),void(Ji=!1)}finally{g.observe(i,Ui),e._updating=h,Ri=u,$i=f,Wi=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,C=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=Ts(t)),delete r[o])}(e,r);const v=o?null:_l(ol(e));if(e._editable&&null!==v&&(a||null===c||c.dirty||!c.is(l))&&null!==i&&!x.has(Cr)){Wi=e,Ri=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&gl(t,e,i),Di(l,c,e,v,x,i)}!function(t,e,n){let r=t._blockCursorElement;if(si(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,c=null;if(s===o.getChildrenSize()){hl(o.getChildAtIndex(s-1))&&(l=!0)}else{const e=o.getChildAtIndex(s);if(null!==e&&hl(e)){const n=e.getPreviousSibling();(null===n||hl(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=Al(o,t.getElementByKey(o.__key),t).element;return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=Qc(r);r=e.blockCursor=t}void 0!==r&&n.classList.add(...r)}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&gl(r,t,e)}(e,i,c)}finally{null!==g&&g.observe(i,Ui),Wi=d,Ri=u}}null!==_&&function(t,e,n,r,i){const o=Array.from(t._listeners.mutation),s=o.length;for(let t=0;t<s;t++){const[s,l]=o[t];for(const t of l){const o=e.get(t);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,_,x,p,s),si(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(Te,void 0);const S=e._pendingDecorators;null!==S&&(e._decorators=S,e._pendingDecorators=null,lo("decorator",e,!0,S)),function(t,e,n){const r=bs(e),i=bs(n);r!==i&&lo("textcontent",t,!0,i)}(e,n||s,r),lo("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,mutatedNodes:_,normalizedNodes:m,prevEditorState:n||s,tags:x}),ao(e,C),function(e){const n=e._updates;if(0===n.length)return void(e._cascadeCount=0);if(e._cascadeCount++>99){e._updates=[],e._cascadeCount=0;try{t(343)}catch(t){t instanceof Error&&e._onError(t)}return}const r=n.shift();if(r){const[t,n]=r;fo(e,t,n)}}(e)}function lo(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=e._listeners[t],i=Array.from(n);for(const[t,e]of i){e&&e();const i=t(...r);n.has(t)?n.set(t,i):i&&i()}}finally{e._updating=i}}function co(t,e,n,r){const i=As(t);let o;for(let t=4;t>=0;t--)for(let s=0;s<i.length;s++){const l=i[s];if(s>0&&l._updating){o=l;break}const c=l._commands.get(e);if(void 0!==c){const e=c[t];if(e.size>0){let t=!1;if(ho(l,()=>{for(const i of e)if(i(n,r))return void(t=!0)}),t)return t}}}return o&&o.update(()=>{co(o,e,n,r)}),!1}function ao(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=!0;try{for(let t=0;t<e.length;t++)e[t]()}finally{t._updating=n}}}function uo(e,n){const r=e._updates;let i=n||!1;for(;0!==r.length;){const n=r.shift();if(n){const[r,o]=n,s=e._pendingEditorState;let l;void 0!==o&&(l=o.onUpdate,o.skipTransforms&&(i=!0),o.discrete&&(null===s&&t(191),s._flushSync=!0),l&&e._deferred.push(l),no(e,o.tag)),null==s?fo(e,r,o):r()}}return i}function fo(e,n,r){const i=e._updateTags;let o,s=!1,l=!1;void 0!==r&&(o=r.onUpdate,no(e,r.tag),s=r.skipTransforms||!1,l=r.discrete||!1),o&&e._deferred.push(o);const c=e._editorState;let a=e._pendingEditorState,u=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=vo(a||c),u=!0),a._flushSync=l;const f=Ri,d=$i,h=Wi,g=e._updating;Ri=a,$i=!1,e._updating=!0,Wi=e;const _=e._headless||null===e.getRootElement();qo(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=_l(ol(t));return si(n)||null==n?ki(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),s=uo(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(si(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);Gr(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&Mt(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,o=xs(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);Gr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Mt(r),void 0!==r&&eo(r,o)&&to(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){ji++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&eo(c,o)&&to(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,ji++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),uo(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(_o(e)&&rt(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)))}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t))}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(si(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19)}else ci(o)&&0===o._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void so(e)}finally{Ri=f,$i=d,Wi=h,e._updating=g,ji=0}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);p?a._flushSync?(a._flushSync=!1,so(e)):u&&ts(()=>{so(e)}):(a._flushSync=!1,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null))}function ho(t,e,n){Wi===t&&void 0===n?e():fo(t,e,n)}class go extends fr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return W[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=Gi()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Gr(e)&&t.push(e),_o(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;_o(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;_o(t);){const e=t.getLastChild();if(null===e)break;t=e}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return _o(t)&&t.getLastDescendant()||t||null}const r=e[t];return _o(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Cs(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Cs(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),_o(i)&&r!==n-1&&!i.isInline()&&(t+=D)}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),_o(i)&&r!==n-1&&!i.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=R[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=K[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return hs(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Hi();const n=Ti();let r=t,i=e;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Gr(t)||_o(t))return t.select(0,0)}else if(!(void 0!==t&&t!==o||void 0!==e&&e!==o)){const t=this.getLastChild();if(Gr(t)||_o(t))return t.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return si(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):xi(s,r,s,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(t=>t.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t&&R[t]||0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){ar(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;ps(e.getWritable()),c.push(r),e=n}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,ps(n);const r=e.__key;if(null===d)o.__first=r,n.__prev=null;else{const t=d.getWritable();t.__next=r,n.__prev=t.__key}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e}if(e+n===i){if(null!==d){d.getWritable().__next=null,o.__last=d.__key}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key}else t.__prev=null}if(o.__size=f,c.length){const t=Ti();if(si(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:i}=t;po(r,e,n)&&Ei(r,r.getNode(),this,u,a),po(i,e,n)&&Ei(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||cl(this)||this.remove()}}return o}getDOMSlot(t){return new q(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(vl(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px",e.setAttribute("data-lexical-indent",String(t)));const n=this.getDirection();n&&(e.dir=n)}return{element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0===e&&""===n||cl(this)||this.getChildren().some(Gr)||(0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,e,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,e){const n=Al(this,t,e);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function _o(t){return t instanceof go}function po(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return!0;r=r.getParent()}return!1}class yo extends fr{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function mo(t){return t instanceof yo}class xo extends go{__cachedText;static getType(){return"root"}static clone(){return new xo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return null===t||!Vi()&&0!==Gi()._dirtyType?super.getTextContent():t}remove(){t(52)}replace(e){t(53)}insertBefore(e){t(54)}insertAfter(e){t(55)}updateDOM(t,e){return!1}splice(e,n,r){for(const e of r)_o(e)||mo(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return Ns().updateFromJSON(t)}collapseAtStart(){return!0}}function Co(t){return t instanceof xo}function vo(t){return new bo(et(t._nodeMap))}function So(){return new bo(new Map([["root",new xo]]))}function ko(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),_o(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t<o.length;t++){const e=ko(o[t]);i.push(e)}}return n}function To(t){return t instanceof bo}class bo{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return oo(e&&e.editor||null,this,t)}clone(t){const e=new bo(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return oo(null,this,()=>({root:ko(Ns())}))}}class No extends go{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class wo extends go{static getType(){return"paragraph"}static clone(t){return new wo(t.__key)}createDOM(t){const e=document.createElement("p"),n=js(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n)}return e}updateDOM(t,e,n){return!1}static importDOM(){return{p:t=>({conversion:Eo,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(vl(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return Oo().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(Gr);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=Oo();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Gr(t[0])&&""===t[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 Eo(t){const e=Oo();if(Wl(e,t),Bl(t,e),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in R&&e.setFormat(n)}return Rl(e,t),{node:e}}function Oo(){return ul(new wo)}function Mo(t){return t instanceof wo}const Ao=0,Do=1,Po=2,Fo=3,Io=4,Lo=-8,zo=-7,Ko=-6,Bo=-5,Ro=-4;function Wo(t,e,n,r,i){const o=t._keyToDOMMap;o.clear(),t._editorState=So(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",o.set("root",n))}function $o(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=Ul(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t)}if(t){const n=t.$transform;n&&e.add(n),r=t.extends}else{const t=Object.getPrototypeOf(r);r=t.prototype instanceof fr&&t!==fr?t:void 0}}return e}const Jo={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=Zo(e,t.getType());return n&&void 0!==n.exportDOM?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,i)=>_o(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$shouldExclude:(t,e,n)=>_o(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function jo(t){const e=t||{},n=Zi(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||!1,s=So(),l=e.namespace||(null!==i?i._config.namespace:Ds()),c=e.editorState,a=[xo,Rr,Or,Qr,wo,No,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else{h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null}Ul(e);const i=e.getType(),o=$o(e);h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:xt(a[t]),transforms:o})}}const g=new Ho(s,i,h,{disableEvents:o,dom:{...Jo,...t&&t.dom},namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e])})};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n)}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),function(t){t.registerCommand(we,Hn,Ao),t.registerCommand(Ee,Yn,Ao),t.registerCommand(Oe,qn,Ao),t.registerCommand(Me,Gn,Ao),t.registerCommand($e,Qn,Ao)}(g),g}function Uo(t,e){const n=t.get(e);t.delete(e),n&&n()}function Vo(t,e,n){return t.set(e,n),Uo.bind(null,t,e)}class Ho{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new nt,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,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=Ds(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){return Vo(this._listeners.update,t)}registerEditableListener(t){return Vo(this._listeners.editable,t)}registerDecoratorListener(t){return Vo(this._listeners.decorator,t)}registerTextContentListener(t){return Vo(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return ea(Vo(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0)}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Z,new Z,new Z,new Z,new Z]);const o=i.get(e);void 0===o&&t(36,String(e));const s=function(t){return 7&t}(r),l=o[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.delete(n),o.every(t=>0===t.size)&&i.delete(e)}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Ll(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t)}return function(t,e){const n=Ll(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e)}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=Cs(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:_r}:void 0)}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Gs(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=js(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Wo(this,e,t,r,{preserveUpdateQueue:!0}),null!==e&&(this._config.disableEvents||or(e),null!=n&&e.classList.remove(...n)),null!==t){const e=il(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,ht(this),this._updateTags.add(_r),so(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;En.set(t,n);const r=On.get(n)??0;r<1&&n.addEventListener("selectionchange",er),On.set(n,r+1),t.__lexicalEditor=e;const i=Zn(t);for(let n=0;n<vn.length;n++){const[r,o]=vn[n],s="function"==typeof o?t=>{rr(t)||(nr(t),(e.isEditable()||"click"===r)&&o(t,e))}:t=>{if(rr(t))return;nr(t);const n=e.isEditable();switch(r){case"cut":return n&&Gs(e,fn,t);case"copy":return Gs(e,un,t);case"paste":return n&&Gs(e,Ie,t);case"dragstart":return n&&Gs(e,ln,t);case"dragover":return n&&Gs(e,cn,t);case"dragend":return n&&Gs(e,an,t);case"focus":return n&&Gs(e,yn,t);case"blur":return n&&Gs(e,mn,t);case"drop":return n&&Gs(e,on,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s)})}}(t,this),null!=n&&t.classList.add(...n)}else this._window=null,this._updateTags.add(_r),so(this);lo("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=vo(e),r._selection=e._selection?e._selection.clone():null),dt(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),so(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&o.add(s),this._updating||so(this)}parseEditorState(t,e){return function(t,e,n){const r=So(),i=Ri,o=$i,s=Wi,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Ri=r,$i=!1,Wi=e,qo(null);try{const i=e._nodes;io(t.root,i),n&&n(),r._readOnly=!0}catch(t){t instanceof Error&&e._onError(t)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,Ri=i,$i=o,Wi=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return so(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):fo(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),ho(this,()=>{const r=Ti(),i=Ns();null!==r?r.dirty||Es(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),el("focus"),nl(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=_l(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,lo("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ho.version=Q;let Yo=null;function qo(t){Yo=t}let Go=1;function Xo(){Go=1}function Qo(e,n){const r=Zo(e,n);return void 0===r&&t(30,n),r}function Zo(t,e){return t._nodes.get(e)}const ts="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function es(t){return mo(ks(t))}function ns(t){const e=document.activeElement;if(!vl(e))return!1;const n=e.nodeName;return mo(ks(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==ss(e))}function rs(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!ns(e)&&os(e)===t}catch(t){return!1}}function is(t){return t instanceof Ho}function os(t){let e=t;for(;null!=e;){const t=ss(e);if(is(t))return t;e=Qs(e)}return null}function ss(t){return t?t.__lexicalEditor:null}function ls(t){return L.test(t)?"rtl":z.test(t)?"ltr":null}function cs(t){return ti(t)||t.isToken()}function as(t){return cs(t)||t.isSegmented()}function us(t){return Sl(t)&&3===t.nodeType}function fs(t){return Sl(t)&&9===t.nodeType}function ds(t){let e=t;for(;null!=e;){if(us(e))return e;e=e.firstChild}return null}function hs(t,e,n){const r=K[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return"subscript"===e?i&=~K.superscript:"superscript"===e?i&=~K.subscript:"lowercase"===e?(i&=~K.uppercase,i&=~K.capitalize):"uppercase"===e?(i&=~K.lowercase,i&=~K.capitalize):"capitalize"===e&&(i&=~K.lowercase,i&=~K.uppercase),i}function gs(t){return Gr(t)||Dr(t)||mo(t)}function _s(t,e){const n=function(){const t=Yo;return Yo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);Hi(),Yi();const r=Gi(),i=qi(),o=""+Go++;i._nodeMap.set(o,t),_o(t)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),0===r._dirtyType&&(r._dirtyType=1),t.__key=o}function ps(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function ys(e){Yi(),ar(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=qi(),o=Gi(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,!1),r=t.__parent}}(r,s,l);const c=n.__key;0===o._dirtyType&&(o._dirtyType=1),_o(e)?l.set(c,!0):o._dirtyLeaves.add(c)}function ms(t){Hi();const e=Gi(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Cs(n);null!==t&&t.getWritable()}if(null!==t){const e=Cs(t);null!==e&&e.getWritable()}}}function xs(){if(Vi())return null;return Gi()._compositionKey}function Cs(t,e){const n=(e||qi())._nodeMap.get(t);return void 0===n?null:n}function vs(t,e){const n=Ss(t,Gi());return void 0!==n?Cs(n,e):null}function Ss(t,e){return t[`__lexicalKey_${e._key}`]}function ks(t,e){let n=t;for(;null!=n;){const t=vs(n,e);if(null!==t)return t;n=Qs(n)}return null}function Ts(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function bs(t){return t.read(()=>Ns().getTextContent())}function Ns(){return ws(qi())}function ws(t){return t._nodeMap.get("root")}function Es(t){Hi();const e=qi();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Os(t){const e=Gi(),n=function(t,e){let n=t;for(;null!=n;){const t=Ss(n,e);if(void 0!==t)return t;n=Qs(n)}return null}(t,e);if(null===n){return t===e.getRootElement()?Cs("root"):null}return Cs(n)}function Ms(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function As(t){const e=[];for(let n=t;null!==n;n=n._parentEditor)e.push(n);return e}function Ds(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ps(t){return us(t)?t.nodeValue:null}function Fs(t,e,n){const r=_l(ol(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=Ps(i);const r=ks(i);if(null!==e&&Gr(r)){if((e===A||e===P)&&n){const t=n.length;e=n,o=t,s=t}null!==e&&Is(r,e,o,s,t)}}}function Is(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let c=e;if((s||i)&&(e.endsWith(A)&&(c=e.slice(0,-A.length)),i)){const t=P;let e;for(;-1!==(e=c.indexOf(t));)c=c.slice(0,e)+c.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length))}const u=o.getTextContent();if(i||c!==u){if(""===c){if(ms(null),a||l||d)o.remove();else{const t=Gi();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove()})},20)}return}const e=o.getParent(),i=bi(),u=o.getTextContentSize(),f=xs(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||si(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=Ti();if(!si(g)||null===n||null===r)return void Ls(o,c,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=qr(o.getTextContent());o.replace(t),o=t}Ls(o,c,g)}}}function Ls(t,e,n){if(t.setTextContent(e),si(n)){const e=t.getKey();let r=!1;for(const i of["anchor","focus"]){const o=n[i];"text"===o.type&&o.key===e&&(o.offset=dc(t,o.offset,"clamp"),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function zs(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function Ks(t,e){return zs(t,e,"altKey")&&zs(t,e,"ctrlKey")&&zs(t,e,"shiftKey")&&zs(t,e,"metaKey")}function Bs(t,e,n){if(!Ks(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1)return!1;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const Rs={ctrlKey:!i,metaKey:i},Ws={altKey:i,ctrlKey:!i};function $s(t){return"Backspace"===t.key}function Js(t){const e=Ns();if(si(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),At(t),t}{const t=e.select(0,e.getChildrenSize());return Es(At(t)),t}}function js(t,e){void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=Qc(i);return n[e]=t,t}return i}function Us(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o)}function Vs(t){const e=t.getType(),n=qi();if(n._readOnly){const t=Ll(n).get(e);return t?Array.from(t.values()):[]}const r=n._nodeMap,i=[];for(const[,n]of r)n instanceof t&&n.__type===e&&n.isAttached()&&i.push(n);return i}function Hs(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function Ys(t,e){const n=t.offset;if("element"===t.type){return Hs(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Hs(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function qs(t){const e=ol(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Gs(t,e,n){return co(t,e,n,t)}function Xs(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function Qs(t){const e=t.assignedSlot||t.parentElement;return kl(e)?e.host:e}function Zs(t){return fs(t)?t:vl(t)?t.ownerDocument:null}function tl(t){return Gi()._updateTags.has(t)}function el(t){Hi();Gi()._updateTags.add(t)}function nl(t){Hi();Gi()._deferred.push(t)}function rl(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function il(t){const e=Zs(t);return e?e.defaultView:null}function ol(e){const n=e._window;return null===n&&t(78),n}function sl(t){return _o(t)&&t.isInline()||mo(t)&&t.isInline()}function ll(t){let e=t.getParentOrThrow();for(;null!==e;){if(cl(e))return e;e=e.getParentOrThrow()}return e}function cl(t){return Co(t)||_o(t)&&t.isShadowRoot()}function al(t,e=!1){const n=t.constructor.clone(t);return _s(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function ul(e){const n=Gi(),r=e.getType(),i=Zo(n,r);void 0===i&&t(200,e.constructor.name,r);const{replace:o,replaceWithKlass:s}=i;if(null!==o){const n=o(e),i=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function fl(e,n){!Co(e.getParent())||_o(n)||mo(n)||t(99)}function dl(e){const n=Cs(e);return null===n&&t(63,e),n}function hl(t){return(mo(t)||_o(t)&&!t.canBeEmpty())&&!t.isInline()}function gl(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function _l(t){return n?(t||window).getSelection():null}function pl(t){const e=il(t);return e?e.getSelection():null}function yl(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),cl(e)&&t(102);const i=e=>{const n=e.getParentOrThrow(),o=cl(n),s=e!==r||o?al(e):e;if(o)return _o(e)&&_o(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,o]=i(n),l=e.getNextSiblings();return o.append(s,...l),[t,r,s]}},[o,s]=i(r);return[o,s]}function ml(t){return vl(t)&&"A"===t.tagName}function xl(t){return vl(t)&&"TR"===t.tagName}function Cl(t){return vl(t)&&("TD"===t.tagName||"TH"===t.tagName)}function vl(t){return Sl(t)&&1===t.nodeType}function Sl(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function kl(t){return Sl(t)&&11===t.nodeType}const Tl=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function bl(t){return!(!vl(t)||!t.style.display.startsWith("inline"))||Tl.test(t.nodeName)}const Nl=/^(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;function wl(t){return(!vl(t)||!t.style.display.startsWith("inline"))&&Nl.test(t.nodeName)}function El(t){if(mo(t)&&!t.isInline())return!0;if(!_o(t)||cl(t))return!1;const e=t.getFirstChild(),n=null===e||Dr(e)||Gr(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Ol(){return Gi()}function Ml(t=Ol()){return t._config.dom||Jo}function Al(e,n,r=Ol()){const i=Ml(r).$getDOMSlot(e,n,r);return _o(e)&&(Dl(i)||t(344,e.getKey(),e.getType())),i}function Dl(t){return t instanceof q}function Pl(t,e,n=Ol()){return ds(Al(t,e,n).element)}const Fl=new WeakMap,Il=new Map;function Ll(e){if(!e._readOnly&&e.isEmpty())return Il;e._readOnly||t(192);let n=Fl.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r)}return e}(e),Fl.set(e,n)),n}function zl(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Kl(t){return(e=zl(t))[cr]=!0,e;var e}function Bl(t,e){const n=t.getAttribute("data-lexical-indent");if(null!==n){const t=parseInt(n,10);if(Number.isFinite(t)&&t>=0)return void e.setIndent(t)}const r=parseInt(t.style.paddingInlineStart,10)||0,i=Math.round(r/40);e.setIndent(i)}function Rl(t,e){const n=e.getAttribute("dir");return"ltr"===n||"rtl"===n?t.setDirection(n):t}function Wl(t,e){const n=e.style.textAlign;return n&&n in R?t.setFormat(n):t}function $l(t){t.__lexicalUnmanaged=!0}function Jl(t){return!0===t.__lexicalUnmanaged}function jl(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==fr[e]}function Ul(e){const n=U in e.prototype?e.prototype[U]():void 0,r=function(e){if(!(e===fr||e.prototype instanceof fr)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{Ho.version&&(r=JSON.parse(Ho.version))}catch(t){}t(290,e.name,n,r)}return e===yo||e===go||e===fr}(e),i=!r&&jl(e,"getType")?e.getType():void 0;let o,s=i;if(n)if(i)o=n[i];else for(const[t,e]of Object.entries(n))s=t,o=e;if(!r&&s&&(jl(e,"getType")||(e.getType=()=>s),jl(e,"clone")||(e.clone=t=>(qo(t),new e)),jl(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!jl(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t)}return{ownNodeConfig:o,ownNodeType:s}}function Vl(t){const e=Ol();Hi();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const Hl=(t,e)=>{let n=t;for(;null!=n&&!Co(n);){if(e(n))return n;n=n.getParent()}return null};function Yl(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=null===n?Cs(i):n.get(i);null==e&&t(174),r.push(i),i=e.__next}return r}const ql={next:"previous",previous:"next"};class Gl{origin;constructor(t){this.origin=t}[Symbol.iterator](){return kc({hasNext:oc,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return uc(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return uc(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e)}for(const e of i){if(l.size>0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else{const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e)}else null===n&&t(263,Array.from(l).join(" "))}else o.insert(e);o=uc(e,this.direction)}for(const t of l.values())t.remove();return this}}class Xl extends Gl{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:gc(t,this.direction)}getParentCaret(t="root"){return uc(tc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Zl(this.direction);return uc(this.getNodeAtCaret(),t)||gc(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Xl&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Ql={root:Co,shadowRoot:cl};function Zl(t){return ql[t]}function tc(t,e="root"){return Ql[e](t)?null:t}class ec extends Gl{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:uc(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return _o(this.origin)?gc(this.origin,this.direction):null}getParentCaret(t="root"){return uc(tc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Zl(this.direction);return uc(this.getNodeAtCaret(),t)||gc(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof ec&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof ec||t instanceof nc)&&this.direction===t.direction&&this.origin.is(t.origin)}}class nc extends Gl{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:fc(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return uc(tc(this.getParentAtCaret(),t),this.direction)}getFlipped(){return fc(this.origin,Zl(this.direction),this.offset)}isSamePointCaret(t){return t instanceof nc&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ec||t instanceof nc)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return uc(this.origin,this.direction)}}function rc(t){return t instanceof nc}function ic(t){return t instanceof Gl}function oc(t){return t instanceof ec}function sc(t){return t instanceof Xl}const lc={next:class extends nc{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends nc{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},cc={next:class extends ec{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ec{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},ac={next:class extends Xl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Xl{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function uc(t,e){return t?new cc[e](t):null}function fc(t,e,n){return t?new lc[e](t,dc(t,n)):null}function dc(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return(o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function hc(t,e){return new mc(t,e)}function gc(t,e){return _o(t)?new ac[e](t):null}function _c(t){return t&&t.getChildCaret()||t}function pc(t){return t&&_c(t.getAdjacentCaret())}class yc{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new yc(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return rc(e)?function(t,e){const{direction:n,origin:r}=t,i=dc(r,"focus"===e?Zl(n):n);return hc(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return[hc(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=rc(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=rc(n),i=e=>e.isSameNodeCaret(n)?null:pc(e)||e.getParentCaret(t);return kc({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class mc{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return fc(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function xc(t){return t instanceof mc}function Cc(t){return Sc(t,uc(Ns(),t.direction))}function vc(t){return Sc(t,t)}function Sc(e,n){return e.direction!==n.direction&&t(265),new yc(e,n,e.direction)}function kc(t){const{initial:e,hasNext:n,step:r,map:i}=t;let o=e;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const t={done:!1,value:i(o)};return o=r(o),t}}}function Tc(e,n){const r=Ec(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case"same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===n.type?1:-1;case"branch":return bc(r)}}function bc(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let o=e,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function Nc(t,e){return e.is(t)}function wc(t){return _o(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ec(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=wc(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,o]=wc(n);i;o=i,i=i.getParent()){const s=r.get(i);if(void 0!==s)return null===s?(Nc(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===o?(Nc(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((_o(s)||Nc(e,s))&&(_o(o)||Nc(n,o))&&i.is(s.getParent())&&i.is(o.getParent())||t(278),{a:s,b:o,commonAncestor:i,type:"branch"})}return null}function Oc(e,n){const{type:r,key:i,offset:o}=e,s=dl(e.key);return"text"===r?(Gr(s)||t(266,s.getType(),i),fc(s,n,o)):(_o(s)||t(267,s.getType(),i),$c(s,e.offset,n))}function Mc(e,n){const{origin:r,direction:i}=n,o="next"===i;rc(n)?e.set(r.getKey(),n.offset,"text"):oc(n)?Gr(r)?e.set(r.getKey(),dc(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(sc(n)&&_o(r)||t(268),e.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function Ac(t){const e=Ti(),n=si(e)?e:Ci();return Dc(n,t),Es(n),n}function Dc(t,e){Mc(t.anchor,e.anchor),Mc(t.focus,e.focus)}function Pc(t){const{anchor:e,focus:n}=t,r=Oc(e,"next"),i=Oc(n,"next"),o=Tc(r,i)<=0?"next":"previous";return Sc(Rc(r,o),Rc(i,o))}function Fc(t){const{direction:e,origin:n}=t,r=uc(n,Zl(e)).getNodeAtCaret();return r?uc(r,e):gc(n.getParentOrThrow(),e)}function Ic(t,e="root"){const n=[t];for(let r=sc(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Fc(r));return n}function Lc(t){return!!t&&t.origin.isAttached()}function zc(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let o=n;const s=Wc(e,i),l=Ic(s.anchor,r),c=Ic(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(sc(t))a.add(t.origin.getKey());else if(oc(t)){const{origin:e}=t;_o(e)&&!a.has(e.getKey())||u.push(e)}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Fc(uc(e,i)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===o||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){o="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=qr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=fc(n,i,e.offset)}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped())}}let f,d;for(const t of l)if(Lc(t)){f=Kc(t);break}for(const t of c)if(Lc(t)){d=Kc(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let c;for(c=0;c<l&&o[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(cl(i))return;!n&&e(i)&&(n=i)}return n},u=a(o,El),f=u&&a(s,t=>n.has(t.getKey())&&El(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;gc(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(!0);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(!0)}}const g=[f,d,...l,...c].find(Lc);if(g){return vc(Rc(Kc(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function Kc(t){const e=function(t){let e=t;for(;sc(e);){const t=pc(e);if(!sc(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Gr(e.origin))return rc(e)?e:fc(e.origin,n,n);const r=e.getAdjacentCaret();return oc(r)&&Gr(r.origin)?fc(r.origin,n,Zl(n)):e}function Bc(t){return rc(t)&&t.offset!==dc(t.origin,t.direction)}function Rc(t,e){return t.direction===e?t:t.getFlipped()}function Wc(t,e){return t.direction===e?t:Sc(Rc(t.focus,e),Rc(t.anchor,e))}function $c(t,e,n){let r=gc(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Rc(r,n)}function Jc(t,e="root"){let n=0,r=t,i=pc(r);for(;null===i;){if(n--,i=r.getParentCaret(e),!i)return null;r=i,i=pc(r)}return i&&[i,n]}function jc(e){const{origin:n,offset:r,direction:i}=e;if(r===dc(n,i))return e.getSiblingCaret();if(r===dc(n,Zl(i)))return Fc(e.getSiblingCaret());const[o]=n.splitText(r);return Gr(o)||t(281),Rc(uc(o,"next"),i)}function Uc(t,e){return!0}function Vc(t,{$copyElementNode:e=al,$splitTextPointCaretNext:n=jc,rootMode:r="shadowRoot",$shouldSplit:i=Uc,removeEmptyDestination:o=!1}={}){if(rc(t))return n(t);const s=t.getParentCaret(r);if(s){const{origin:n}=s;if(sc(t)){const t=Fc(s);if(o&&n.isEmpty())return n.remove(),t;if(!n.canBeEmpty()||!i(n,"first"))return t}const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(e(n).splice(0,0,r))}return s}function Hc(t){return t}function Yc(...t){return t}function qc(t,e){return[t,e]}function Gc(t){return t}function Xc(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t}function Qc(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function Zc(t,...e){const n=Qc(...e);n.length>0&&t.classList.add(...n)}function ta(t,...e){const n=Qc(...e);n.length>0&&t.classList.remove(...n)}function ea(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}export{el as $addUpdateTag,ul as $applyNodeReplacement,Oc as $caretFromPoint,Pc as $caretRangeFromSelection,zl as $cloneWithProperties,Kl as $cloneWithPropertiesEphemeral,Tc as $comparePointCaretNext,al as $copyNode,Vl as $create,Yl as $createChildrenArray,Ar as $createLineBreakNode,vi as $createNodeSelection,Oo as $createParagraphNode,ni as $createPoint,Ci as $createRangeSelection,Si as $createRangeSelectionFromDom,Zr as $createTabNode,qr as $createTextNode,Cc as $extendCaretToRange,Hl as $findMatchingParent,Xi as $fullReconcile,Ii as $generateNodesFromRawText,pc as $getAdjacentChildCaret,Ys as $getAdjacentNode,Jc as $getAdjacentSiblingOrParentSiblingCaret,Rc as $getCaretInDirection,Sc as $getCaretRange,Wc as $getCaretRangeInDirection,ui as $getCharacterOffsets,gc as $getChildCaret,$c as $getChildCaretAtIndex,_c as $getChildCaretOrSelf,vc as $getCollapsedCaretRange,Ec as $getCommonAncestor,bc as $getCommonAncestorResultBranchOrder,Al as $getDOMSlot,Pl as $getDOMTextNode,Ol as $getEditor,Ml as $getEditorDOMRenderConfig,ks as $getNearestNodeFromDOMNode,ll as $getNearestRootOrShadowRoot,Cs as $getNodeByKey,dl as $getNodeByKeyOrThrow,vs as $getNodeFromDOMNode,bi as $getPreviousSelection,Ns as $getRoot,Ti as $getSelection,uc as $getSiblingCaret,pt as $getState,yt as $getStateChange,Li as $getTextContent,dc as $getTextNodeOffset,fc as $getTextPointCaret,hc as $getTextPointCaretSlice,vt as $getWritableNodeState,rl as $hasAncestor,tl as $hasUpdateTag,Pi as $insertNodes,mi as $isBlockElementNode,sc as $isChildCaret,mo as $isDecoratorNode,To as $isEditorState,Dl as $isElementDOMSlot,_o as $isElementNode,Bc as $isExtendableTextPointCaret,sl as $isInlineElementOrDecoratorNode,gs as $isLeafNode,dr as $isLexicalNode,Dr as $isLineBreakNode,ic as $isNodeCaret,ci as $isNodeSelection,Mo as $isParagraphNode,si as $isRangeSelection,Co as $isRootNode,cl as $isRootOrShadowRoot,oc as $isSiblingCaret,ti as $isTabNode,Gr as $isTextNode,rc as $isTextPointCaret,xc as $isTextPointCaretSlice,as as $isTokenOrSegmented,cs as $isTokenOrTab,Vs as $nodesOfType,Kc as $normalizeCaret,At as $normalizeSelection__EXPERIMENTAL,nl as $onUpdate,ro as $parseSerializedNode,zc as $removeTextFromCaretRange,Fc as $rewindSiblingCaret,Js as $selectAll,ms as $setCompositionKey,Rl as $setDirectionFromDOM,Wl as $setFormatFromDOM,Mc as $setPointFromCaret,Es as $setSelection,Ac as $setSelectionFromCaretRange,mt as $setState,Vc as $splitAtPointCaretNext,yl as $splitNode,Di as $updateDOMSelection,Dc as $updateRangeSelectionFromCaretRange,No as ArtificialNode__DO_NOT_USE,we as BEFORE_INPUT_COMMAND,mn as BLUR_COMMAND,_n as CAN_REDO_COMMAND,pn as CAN_UNDO_COMMAND,s as CAN_USE_BEFORE_INPUT,n as CAN_USE_DOM,hn as CLEAR_EDITOR_COMMAND,gn as CLEAR_HISTORY_COMMAND,Ne as CLICK_COMMAND,yr as COLLABORATION_TAG,Ro as COMMAND_PRIORITY_BEFORE_CRITICAL,Lo as COMMAND_PRIORITY_BEFORE_EDITOR,Bo as COMMAND_PRIORITY_BEFORE_HIGH,zo as COMMAND_PRIORITY_BEFORE_LOW,Ko as COMMAND_PRIORITY_BEFORE_NORMAL,Io as COMMAND_PRIORITY_CRITICAL,Ao as COMMAND_PRIORITY_EDITOR,Fo as COMMAND_PRIORITY_HIGH,Do as COMMAND_PRIORITY_LOW,Po as COMMAND_PRIORITY_NORMAL,Me as COMPOSITION_END_COMMAND,kr as COMPOSITION_END_TAG,Oe as COMPOSITION_START_COMMAND,Sr as COMPOSITION_START_TAG,Fe as CONTROLLED_TEXT_INSERTION_COMMAND,un as COPY_COMMAND,fn as CUT_COMMAND,Jo as DEFAULT_EDITOR_DOM_CONFIG,Ae as DELETE_CHARACTER_COMMAND,Ke as DELETE_LINE_COMMAND,ze as DELETE_WORD_COMMAND,an as DRAGEND_COMMAND,cn as DRAGOVER_COMMAND,ln as DRAGSTART_COMMAND,on as DROP_COMMAND,yo as DecoratorNode,go as ElementNode,yn as FOCUS_COMMAND,sn as FORMAT_ELEMENT_COMMAND,Be as FORMAT_TEXT_COMMAND,hr as HISTORIC_TAG,_r as HISTORY_MERGE_TAG,gr as HISTORY_PUSH_TAG,nn as INDENT_CONTENT_COMMAND,Ee as INPUT_COMMAND,De as INSERT_LINE_BREAK_COMMAND,Pe as INSERT_PARAGRAPH_COMMAND,en as INSERT_TAB_COMMAND,El as INTERNAL_$isBlock,T as IS_ALL_FORMATTING,c as IS_ANDROID,f as IS_ANDROID_CHROME,i as IS_APPLE,d as IS_APPLE_WEBKIT,p as IS_BOLD,u as IS_CHROME,C as IS_CODE,o as IS_FIREFOX,k as IS_HIGHLIGHT,l as IS_IOS,y as IS_ITALIC,a as IS_SAFARI,m as IS_STRIKETHROUGH,v as IS_SUBSCRIPT,S as IS_SUPERSCRIPT,x as IS_UNDERLINE,Ye as KEY_ARROW_DOWN_COMMAND,Ue as KEY_ARROW_LEFT_COMMAND,Je as KEY_ARROW_RIGHT_COMMAND,He as KEY_ARROW_UP_COMMAND,Xe as KEY_BACKSPACE_COMMAND,Ze as KEY_DELETE_COMMAND,$e as KEY_DOWN_COMMAND,qe as KEY_ENTER_COMMAND,Qe as KEY_ESCAPE_COMMAND,xn as KEY_MODIFIER_COMMAND,Ge as KEY_SPACE_COMMAND,tn as KEY_TAB_COMMAND,Or as LineBreakNode,je as MOVE_TO_END,Ve as MOVE_TO_START,j as NODE_STATE_KEY,rn as OUTDENT_CONTENT_COMMAND,Ie as PASTE_COMMAND,pr as PASTE_TAG,wo as ParagraphNode,We as REDO_COMMAND,Le as REMOVE_TEXT_COMMAND,xo as RootNode,Te as SELECTION_CHANGE_COMMAND,be as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,dn as SELECT_ALL_COMMAND,mr as SKIP_COLLAB_TAG,Cr as SKIP_DOM_SELECTION_TAG,xr as SKIP_SCROLL_INTO_VIEW_TAG,vr as SKIP_SELECTION_FOCUS_TAG,K as TEXT_TYPE_TO_FORMAT,Qr as TabNode,Rr as TextNode,Re as UNDO_COMMAND,Zc as addClassNamesToElement,lr as buildImportMap,Yc as configExtension,ke as createCommand,jo as createEditor,xt as createSharedNodeState,_t as createState,qc as declarePeerDependency,Hc as defineExtension,Zl as flipDirection,Zs as getDOMOwnerDocument,_l as getDOMSelection,pl as getDOMSelectionFromTarget,ds as getDOMTextNode,ss as getEditorPropertyFromDOMNode,os as getNearestEditorFromDOMNode,Zo as getRegisteredNode,Qo as getRegisteredNodeOrThrow,Ul as getStaticNodeConfig,br as getStyleObjectFromCSS,ls as getTextDirection,$o as getTransformSetFromKlass,wl as isBlockDomNode,Vi as isCurrentlyReadOnlyMode,fs as isDOMDocumentNode,Sl as isDOMNode,us as isDOMTextNode,Jl as isDOMUnmanaged,kl as isDocumentFragment,Bs as isExactShortcutMatch,ml as isHTMLAnchorElement,vl as isHTMLElement,Cl as isHTMLTableCellElement,xl as isHTMLTableRowElement,bl as isInlineDomNode,is as isLexicalEditor,Ks as isModifierMatch,ns as isSelectionCapturedInDecoratorInput,rs as isSelectionWithinEditor,kc as makeStepwiseIterator,ea as mergeRegister,Qc as normalizeClassNames,ta as removeClassNamesFromElement,ps as removeFromParent,Xo as resetRandomKey,Gc as safeCast,Er as setDOMStyleFromCSS,wr as setDOMStyleObject,$l as setDOMUnmanaged,Bl as setNodeIndentFromDOM,Xc as shallowMergeConfig,nr as stopLexicalPropagation,hs as toggleTextFormatType,Fi as tokenizeRawText};
9
+ function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u,h=0,g=1,_=2,p=1,y=2,m=4,x=8,C=16,v=32,S=64,k=128,T=2047,b=1,N=2,w=3,E=4,O=5,M=6,A=a||l||d?"\xa0":"\u200b",D="\n\n",P=o?"\xa0":A,F="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",I="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",L=new RegExp("^[^"+I+"]*["+F+"]"),z=new RegExp("^[^"+F+"]*["+I+"]"),K={bold:1,capitalize:1024,code:16,highlight:k,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},B={directionless:1,unmergeable:2},W={center:2,end:6,justify:4,left:1,right:3,start:5},R={[N]:"center",[M]:"end",[E]:"justify",[b]:"left",[w]:"right",[O]:"start"},$={normal:0,segmented:2,token:1},J={[h]:"normal",[_]:"segmented",[g]:"token"},j="$",U="$config";function V(){return Al()._blockCursorElement}class H{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new H(this.element,t,this.after)}withAfter(t){return new H(this.element,this.before,t)}withElement(t){return this.element===t?this:new H(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const r=Y(t,this.element);if(null===r)return"after";const i=Array.prototype.indexOf.call(t.childNodes,r);if(i<0)return"after";if(e===t)return n<=i?"before":"after";const o=Y(t,e);if(null===o)return"after";const s=Array.prototype.indexOf.call(t.childNodes,o);return s>=0&&s<=i?"before":"after"}getInsertionAnchor(){return this.before}}function Y(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class q extends H{withBefore(t){return new q(this.element,t,this.after)}withAfter(t){return new q(this.element,this.before,t)}withElement(t){return this.element===t?this:new q(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){const t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return null!==e&&e===V()?e:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t}else n.__lexicalLineBreak=i}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let n=0;for(let r=this.element.firstChild;null!==r&&r!==t&&r!==e;r=r.nextSibling)n++;return n}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset(),n=V(),i=this.element.childNodes,o=Math.min(r,i.length);let s=0;for(let t=e;t<o;t++)i[t]!==n&&s++;return[t,Math.min(s,t.getChildrenSize())]}const i=G(e,n);i.push(r);const o=G(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<o.length;t++){const e=i[t],n=o[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return[t.getParentOrThrow(),s]}}function G(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t)}return i!==e&&t(225),r.reverse()}let X;try{X="0.45.1-dev.0+prod.esm"}catch(t){}const Q=X??"0.45.1-dev.0+source";class Z{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}const tt=null;function et(t,e=1e3){return t instanceof nt?t.clone():t.size<e?new Map(t):(new nt).init(new Map(t),void 0,t.size)}class nt{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,(new nt).init(this._old,this._nursery,this._size)}init(t,e,n){return this._old=t,this._nursery=e,this._size=n,this}get size(){return this._size}has(t){return void 0!==this.get(t)}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return void 0!==e?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===tt?void 0:e}shouldCompact(){return void 0!==this._nursery&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const t=new Map(this._old);for(const[e,n]of this._nursery)n!==tt?t.set(e,n):t.delete(e);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const n=this.getWithTombstone(t);if(n===e)return this;const r=this.getNursery();return n!==tt&&void 0!==n||(this._size++,n===tt&&r.delete(t)),r.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,tt),this._size--),e}getOrInsert(t,e){const n=this.get(t);return void 0!==n?n:(this.set(t,e),e)}getOrInsertComputed(t,e){const n=this.get(t);if(void 0!==n)return n;const r=e(t);return this.set(t,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(e)for(const n of e){const e=n[0],r=t?t.get(e):void 0;r!==tt&&(void 0!==r&&(n[1]=r),yield n)}if(t)for(const n of t)n[1]===tt||e&&e.has(n[0])||(yield n)}forEach(t,e){void 0!==e&&(t=t.bind(e));for(const[e,n]of this.entries())t(n,e,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}}function rt(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(uo(s)&&rt(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling()}}let it=!1,ot=0;function st(t){ot=t.timeStamp}function lt(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==bs(t,n)}function ct(t,e,n){const r=yl(ll(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&zs(e,s,i,o,!1)}function at(t,e,n){if(ei(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return!1}return ds(e)&&n.isAttached()}function ut(t,e,n){for(let r=t;r&&!Ul(r);r=tl(r)){const t=bs(r,e);if(void 0!==t){const e=Ss(t,n);if(e)return go(e)||!kl(r)?void 0:[r,e]}}}function ft(t,e,n){it=!0;const r=performance.now()-ot>100;try{co(t,()=>{const i=xi()||function(t){return t.getEditorState().read(()=>{const t=xi();return null!==t?t.clone():null})}(t),s=new Map,l=t._editorState,c=t._blockCursorElement;let a=!1,u="";for(let n=0;n<e.length;n++){const f=e[n],d=f.type,h=f.target,g=ut(h,t,l);if(!g)continue;const[_,p]=g;if("characterData"===d)r&&Ur(p)&&ds(h)&&at(i,h,p)&&ct(h,p,t);else if("childList"===d){a=!0;const e=f.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],i=ks(r),s=r.parentNode;if(null!=s&&r!==c&&null===i&&!lt(r,s,t)&&!Ul(r)){if(o){const t=(kl(r)?r.innerText:null)||r.nodeValue;t&&(u+=t)}s.removeChild(r)}}const n=f.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(lt(r,h,t)||c===r)&&(h.appendChild(r),e++)}r!==e&&s.set(_,p)}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const f=n.takeRecords();if(f.length>0){for(let e=0;e<f.length;e++){const n=f[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],o=n.parentNode;null==o||"BR"!==n.nodeName||lt(n,i,t)||o.removeChild(n)}}n.takeRecords()}null!==i&&(a&&Ms(i),o&&Xs(t)&&i.insertRawText(u))})}finally{it=!1}}function dt(t){const e=t._observer;if(null!==e){ft(t,e.takeRecords(),e)}}function ht(t){!function(t){0===ot&&ll(t).addEventListener("textInput",st,!0)}(t),t._observer=new MutationObserver((e,n)=>{ft(t,e,n)})}class gt{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||Tt).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function _t(t,e){return new gt(t,e)}function pt(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function yt(t,e,n){const r=pt(t,n,"direct"),i=pt(e,n,"direct");return n.isEqual(r,i)?null:[r,i]}function mt(t,e,n){let r;if($i(),"function"==typeof n){const i=t.getLatest(),o=pt(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return vt(i).updateFromKnown(e,r),i}function xt(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Yl(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t)}}return{flatKeys:n,sharedConfigMap:e}}class Ct{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++}return r}(o,n,r);this.size=s}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return kt(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new Ct(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(e.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=kt(i)),this.size++),r.set(t,e)}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n)}}function vt(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Ct(e,St(e));return e.__state=n,n}function St(t){return t.__state?t.__state.sharedNodeState:es(Al(),t.getType()).sharedNodeState}function kt(t){if(t)for(const e in t)return t}function Tt(t){return t}function bt(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return!0}return!1}function Nt(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return!0}return!1}function wt(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function Et(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return!0;const n=new Set;return!(t&&bt(n,t,e)||e&&bt(n,e,t)||t&&Nt(n,t,e)||e&&Nt(n,e,t))}(c,a))}function Ot(t,e){const n=t.mergeWithSibling(e),r=Vi()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function Mt(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Ur(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(Et(e,r)){r=Ot(e,r);break}break}e.remove()}for(;null!==(n=r.getNextSibling())&&Ur(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(Et(r,n)){r=Ot(r,n);break}break}n.remove()}}else r.remove()}function At(t){return Dt(t.anchor),Dt(t.focus),t}function Dt(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=!0):(r=e.getChildAtIndex(n),i=!1),Ur(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!uo(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}const Pt=Symbol.for("@lexical/CachedTextSize");function Ft(e,n){return Xt.read(()=>{let r=0,i=e;for(let e=0;e<n&&null!==i;e++){const o=Gt.get(i);if(void 0===o&&t(345,i),uo(o)){const s=Qt.get(i);if(void 0!==s&&uo(s)&&s.__parent!==o.__parent)r+=o.getTextContentSize();else{const e=Zt.get(i),n=e&&e.__lexicalTextContent;"string"!=typeof n&&t(346,o.getType()),r+=n.length}e<n-1&&!o.isInline()&&(r+=2)}else{const e=o[Pt];void 0===e&&t(347,o.getType(),i),r+=e}i=o.__next}return r},{editor:Kt})}function It(t){uo(t)||void 0===t[Pt]&&(t[Pt]=Ur(t)?t.__text.length:t.getTextContentSize())}const Lt=4;let zt,Kt,Bt,Wt="",Rt=null,$t=null,Jt=null;function jt(){return{firstTextKey:Jt,format:Rt,style:$t}}function Ut(t){null!==t.firstTextKey&&(Rt=t.format,$t=t.style,Jt=t.firstTextKey)}function Vt(e){if(null!==Jt)return;const n=e.__lexicalFirstTextKey;if(void 0===n&&t(348),null===n)return;const r=Qt.get(n);Ur(r)&&(Rt=r.getFormat(),$t=r.getStyle(),Jt=n)}let Ht,Yt,qt,Gt,Xt,Qt,Zt,te,ee,ne,re=!1,ie=!1;function oe(t,e){const n=Gt.get(t),r=Qt.has(t);if(null!==e){const n=Se(t);n.parentNode===e&&e.removeChild(n)}if(!r){if(Kt._keyToDOMMap.delete(t),uo(n)){const t=Xl(n,Gt);se(t,0,t.length-1,null)}void 0!==n&&Hs(ee,Bt,Ht,n,"destroyed")}}function se(t,e,n,r){for(let i=e;i<=n;++i){const e=t[i];void 0!==e&&oe(e,r)}}function le(t,e){t.setProperty("text-align",e)}const ce="40px";function ae(t,e){const n=zt.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * var(--lexical-indent-base-value, ${ce}))`)}function ue(t,e){const n=t.style;0===e?le(n,""):1===e?le(n,"left"):2===e?le(n,"center"):3===e?le(n,"right"):4===e?le(n,"justify"):5===e?le(n,"start"):6===e&&le(n,"end")}function fe(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(po(t))return null;const n=t.getParentOrThrow();return ul(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir")}function de(e,n){const r=Qt.get(e);if(void 0===r&&t(60),null!==n){const t=Gt.get(e);if(void 0!==t&&t.__parent!==r.__parent){const t=Zt.get(e);if(void 0!==t)return n.insertChild(t),ye(e,n.element)}}const i=ne.$createDOM(r,Kt);if(function(t,e,n){const r=n._keyToDOMMap;Ts(e,n,t),r.set(t,e)}(e,i,Kt),Ur(r)?i.setAttribute("data-lexical-text","true"):go(r)&&(i.setAttribute("data-lexical-decorator","true"),jl(i,{captureSelection:!0})),uo(r)){const t=r.__indent,e=r.__size;if(fe(i,r),0!==t&&ae(i,t),0===e)i.__lexicalTextContent="",i.__lexicalFirstTextKey=null;else{const t=e-1;he(Xl(r,Qt),r,0,t,Pl(r,i,Kt))}const n=r.__format;0!==n&&ue(i,n),r.isInline()||ge(null,r,i)}else{const t=r.getTextContent();if(go(r)){const t=r.decorate(Kt,zt);null!==t&&me(e,t),i.contentEditable="false"}Wt+=t}return null!==n&&n.insertChild(i),ne.$decorateDOM(r,null,i,Kt),It(r),Hs(ee,Bt,Ht,r,"created"),i}function he(e,n,r,i,o){const s=Wt,l=jt();Wt="",Rt=null,$t=null,Jt=null;let c=r;for(;c<=i;++c){const t=jt();de(e[c],o);const n=Qt.get(e[c]);null!==n&&Ur(n)?null===Rt&&(Rt=n.getFormat(),$t=n.getStyle(),Jt=n.__key):uo(n)&&c<i&&!n.isInline()&&(Wt+=D),Ut(t)}const a=Kt._keyToDOMMap.get(n.__key);void 0===a&&t(349,n.__key),a.__lexicalTextContent=Wt,a.__lexicalFirstTextKey=Jt,Wt=s+Wt,Ut(l)}function ge(t,e,n){const r=Pl(e,n,Kt),i=r.element.__lexicalLastChildKind??null,o=function(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return No(t)?"line-break":go(t)&&t.isInline()?"decorator":null}return"empty"}return null}(e,Qt);i!==o&&r.setManagedLineBreak(o)}function _e(e,n,r){var i;Rt=null,$t=null,Jt=null,function(e,n,r){const i=Wt,o=e.__size,s=n.__size;Wt="";const l=r.element,c=Kt._keyToDOMMap.get(n.__key);void 0===c&&t(351,n.__key);const a=s-o;if(!re&&Math.abs(a)<=1&&o>=Lt&&e.__first===n.__first&&(0!==a||!Kt._cloneNotNeeded.has(e.__key))){const o=c.__lexicalTextContent,u=te.get(e.__key);if(!re&&"string"==typeof o&&void 0!==u){const s=function(t,e){const n=e.size;if(0===n||n>=t.__size)return null;let r=t.__last,i=null,o=0;for(;null!==r&&o<n;){if(!e.has(r))return null;i=r;const t=Qt.get(r);if(void 0===t)return null;r=t.__prev,o++}if(o!==n)return null;if(null!==r&&e.has(r))return null;return i}(n,u);if(null!==s){const f=u.size;if(0===a){const e=Ft(s,f);let r=s,a=0;for(;null!==r&&a<f;){const t=Qt.get(r);if(void 0===t)break;const e=jt();ye(r,l),Ur(t)&&null===Rt&&(Rt=t.getFormat(),$t=t.getStyle(),Jt=t.__key),Ut(e),r=t.__next,a++}let d="";for(r=s,a=0;null!==r&&a<f;){const e=Qt.get(r);if(void 0===e)break;let n;if(uo(e)){const i=Kt._keyToDOMMap.get(r),o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(352,e.getType()),n=o}else n=e.getTextContent();d+=n,a<f-1&&uo(e)&&!e.isInline()&&(d+=D),r=e.__next,a++}const h=o.slice(0,o.length-e)+d;return c.__lexicalTextContent=h,Wt=i+h,void pe(n,c,u)}if(function(e,n,r,i,o,s,l,c){if(1!==c&&-1!==c)return!1;const a=1===c?2:1;if(l!==a)return!1;const u=l-c;let f=e.__last;for(let t=0;t<u-1;t++){if(null===f)return!1;const t=Gt.get(f);if(void 0===t)return!1;f=t.__prev}if(null===f)return!1;const d=Qt.get(s),h=Gt.get(f);if(void 0===d||void 0===h)return!1;if(d.__prev!==h.__prev)return!1;const g=[];let _=s;for(let t=0;t<l;t++){if(null===_)return!1;g.push(_);const t=Qt.get(_);_=t?t.__next:null}const p=[];_=f;for(let t=0;t<u;t++){if(null===_)return!1;p.push(_);const t=Gt.get(_);_=t?t.__next:null}const y=new Set(p),m=new Set(g),x=[];let C=0,v=0;for(;C<u&&v<l;)if(g[v]===p[C])x.push({key:g[v],kind:"reconcile"}),C++,v++;else if(m.has(p[C])){if(y.has(g[v]))return!1;x.push({key:g[v],kind:"create",nextIndex:v}),v++}else x.push({key:p[C],kind:"destroy"}),C++;for(;C<u;)x.push({key:p[C++],kind:"destroy"});for(;v<l;)x.push({key:g[v],kind:"create",nextIndex:v}),v++;const S=Ft(f,u);for(const t of x){const e=jt();if("reconcile"===t.kind)ye(t.key,r.element);else if("destroy"===t.kind)oe(t.key,r.element);else{let e=null;for(let n=t.nextIndex+1;n<l;n++){const t=Kt._keyToDOMMap.get(g[n]);if(void 0!==t){e=t;break}}de(t.key,r.withBefore(e??r.before))}if("destroy"!==t.kind){const e=Qt.get(t.key);e&&Ur(e)&&null===Rt&&(Rt=e.getFormat(),$t=e.getStyle(),Jt=e.__key)}Ut(e)}let k="";for(let e=0;e<l;e++){const n=Qt.get(g[e]);if(void 0===n)return!1;let r;if(uo(n)){const i=Kt._keyToDOMMap.get(g[e]),o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(350,n.getType()),r=o}else r=n.getTextContent();k+=r,e<l-1&&uo(n)&&!n.isInline()&&(k+=D)}const T=o.slice(0,o.length-S)+k;return i.__lexicalTextContent=T,!0}(e,0,r,c,o,s,f,a)){const e=c.__lexicalTextContent;return"string"!=typeof e&&t(353),Wt=i+e,void pe(n,c,u)}}}if(0===a){let n=e.__first,r=0;for(;null!==n;){const e=Qt.get(n);if(void 0===e)break;const i=re||qt.has(n)||Yt.has(n),o=jt();if(i)ye(n,l);else{let r,i;if(uo(e)){i=Zt.get(n);const o=i&&i.__lexicalTextContent;"string"!=typeof o&&t(354,e.getType()),r=o}else r=e.getTextContent();Wt+=r,void 0!==i&&Vt(i)}Ur(e)?null===Rt&&(Rt=e.getFormat(),$t=e.getStyle(),Jt=e.__key):uo(e)&&r<s-1&&!e.isInline()&&(Wt+=D),Ut(o),n=e.__next,r++}return c.__lexicalTextContent=Wt,c.__lexicalFirstTextKey=Jt,void(Wt=i+Wt)}}if(1===o&&1===s){const t=e.__first,i=n.__first;if(t===i)ye(t,l);else{const e=Se(t),n=de(i,null);try{e.parentNode===l?l.replaceChild(n,e):r.insertChild(n)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw r}oe(t,null)}const o=Qt.get(i);Ur(o)&&null===Rt&&(Rt=o.getFormat(),$t=o.getStyle(),Jt=o.__key)}else{const i=Xl(e,Gt),c=Xl(n,Qt);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&he(c,n,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;se(i,0,o-1,t?null:l),t&&(l.textContent="")}}else!function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d],i=jt();if(t===r)u=xe(ye(r,o.element)),f++,d++;else{if(void 0===a&&(a=Ce(n,d)),void 0===c)c=Ce(e,f);else if(!c.has(t)){f++,Ut(i);continue}if(!a.has(t)){u=xe(Se(t)),oe(t,o.element),f++,c.delete(t),Ut(i);continue}if(c.has(r)){const t=Zs(Kt,r);t!==u&&o.withBefore(u??o.before).insertChild(t),u=xe(ye(r,o.element)),f++,d++}else de(r,o.withBefore(u??o.before)),d++}const s=Qt.get(r);null!==s&&Ur(s)?null===Rt&&(Rt=s.getFormat(),$t=s.getStyle(),Jt=s.__key):uo(s)&&d<=l&&!s.isInline()&&(Wt+=D),Ut(i)}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Kt.getElementByKey(e);he(n,t,d,l,o.withBefore(r??o.before))}else g&&!h&&se(e,f,s,o.element)}(n,i,c,o,s,r)}c.__lexicalTextContent=Wt,c.__lexicalFirstTextKey=Jt,Wt=i+Wt}(e,n,Pl(n,r,Kt)),ul(n)||(i=n,null==Rt||Rt===i.__textFormat||ie||i.setTextFormat(Rt),function(t){null==$t||$t===t.__textStyle||ie||t.setTextStyle($t)}(n))}function pe(t,e,n){const r=e.__lexicalFirstTextKey;if(null!=r){const e=t.__key;let i=r;for(;null!==i;){const t=Qt.get(i);if(void 0===t){i=null;break}if(t.__parent===e)break;i=t.__parent}if(null!==i&&!n.has(i)){const t=Qt.get(r);if(Ur(t))return Rt=t.getFormat(),void($t=t.getStyle())}}e.__lexicalFirstTextKey=Jt}function ye(e,n){const r=Gt.get(e);let i=Qt.get(e);void 0!==r&&void 0!==i||t(61);const o=re||qt.has(e)||Yt.has(e),s=Zs(Kt,e);if(r===i&&!o){let e;if(uo(r)){const n=s.__lexicalTextContent;"string"!=typeof n&&t(355,r.getType()),e=n,Vt(s)}else e=r.getTextContent();return Wt+=e,s}if(r!==i&&o&&Hs(ee,Bt,Ht,i,"updated"),ne.$updateDOM(i,r,s,Kt)){const r=de(e,null);return null===n&&t(62),n.replaceChild(r,s),oe(e,null),r}if(uo(r)){uo(i)||t(334,e);const n=i.__indent;(re||n!==r.__indent)&&ae(s,n);const l=i.__format;if((re||l!==r.__format)&&ue(s,l),o)_e(r,i,s),po(i)||i.isInline()||ge(0,i,s);else{const e=s.__lexicalTextContent;"string"!=typeof e&&t(356,r.getType()),Wt+=e,Vt(s)}if((re||i.__dir!==r.__dir||i.__parent!==r.__parent)&&(fe(s,i),po(i)&&!re))for(const t of i.getChildren())if(uo(t)){fe(Zs(Kt,t.getKey()),t)}}else{const t=i.getTextContent();if(go(i)){const t=i.decorate(Kt,zt);null!==t&&me(e,t)}Wt+=t}if(!ie&&po(i)){const t=i.getLatest();if(t.__cachedText!==Wt){const e=t.getWritable();e.__cachedText=Wt,i=e}}return ne.$decorateDOM(i,r,s,Kt),It(i),s}function me(t,e){let n=Kt._pendingDecorators;const r=Kt._decorators;if(null===n){if(r[t]===e)return;n=ws(Kt)}n[t]=e}function xe(t){let e=t.nextSibling;return null!==e&&e===Kt._blockCursorElement&&(e=e.nextSibling),e}function Ce(t,e){const n=new Set;for(let r=e;r<t.length;r++)n.add(t[r]);return n}function ve(t,e,n,r,i,o){Wt="",Rt=null,$t=null,Jt=null,re=2===r,Kt=n,zt=n._config,ne=n._config.dom||Vo,Bt=n._nodes,Ht=Kt._listeners.mutation,Yt=i,qt=o,Gt=t._nodeMap,Xt=t,Qt=e._nodeMap,ie=e._readOnly,Zt=et(n._keyToDOMMap),te=function(){const t=new Map,e=e=>{for(const n of e){const e=Qt.get(n);if(void 0===e)continue;const r=e.__parent;if(null===r)continue;let i=t.get(r);void 0===i&&(i=new Set,t.set(r,i)),i.add(n)}};return e(Yt.keys()),e(qt),t}();const s=new Map;return ee=s,ye("root",null),Kt=void 0,Bt=void 0,Yt=void 0,qt=void 0,Gt=void 0,Xt=void 0,Qt=void 0,zt=void 0,Zt=void 0,te=void 0,ee=void 0,ne=Vo,s}function Se(e){const n=Zt.get(e);return void 0===n&&t(75,e),n}function ke(t){return{type:t}}const Te=ke("SELECTION_CHANGE_COMMAND"),be=ke("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ne=ke("CLICK_COMMAND"),we=ke("BEFORE_INPUT_COMMAND"),Ee=ke("INPUT_COMMAND"),Oe=ke("COMPOSITION_START_COMMAND"),Me=ke("COMPOSITION_END_COMMAND"),Ae=ke("DELETE_CHARACTER_COMMAND"),De=ke("INSERT_LINE_BREAK_COMMAND"),Pe=ke("INSERT_PARAGRAPH_COMMAND"),Fe=ke("CONTROLLED_TEXT_INSERTION_COMMAND"),Ie=ke("PASTE_COMMAND"),Le=ke("REMOVE_TEXT_COMMAND"),ze=ke("DELETE_WORD_COMMAND"),Ke=ke("DELETE_LINE_COMMAND"),Be=ke("FORMAT_TEXT_COMMAND"),We=ke("UNDO_COMMAND"),Re=ke("REDO_COMMAND"),$e=ke("KEYDOWN_COMMAND"),Je=ke("KEY_ARROW_RIGHT_COMMAND"),je=ke("MOVE_TO_END"),Ue=ke("KEY_ARROW_LEFT_COMMAND"),Ve=ke("MOVE_TO_START"),He=ke("KEY_ARROW_UP_COMMAND"),Ye=ke("KEY_ARROW_DOWN_COMMAND"),qe=ke("KEY_ENTER_COMMAND"),Ge=ke("KEY_SPACE_COMMAND"),Xe=ke("KEY_BACKSPACE_COMMAND"),Qe=ke("KEY_ESCAPE_COMMAND"),Ze=ke("KEY_DELETE_COMMAND"),tn=ke("KEY_TAB_COMMAND"),en=ke("INSERT_TAB_COMMAND"),nn=ke("INDENT_CONTENT_COMMAND"),rn=ke("OUTDENT_CONTENT_COMMAND"),on=ke("DROP_COMMAND"),sn=ke("FORMAT_ELEMENT_COMMAND"),ln=ke("DRAGSTART_COMMAND"),cn=ke("DRAGOVER_COMMAND"),an=ke("DRAGEND_COMMAND"),un=ke("COPY_COMMAND"),fn=ke("CUT_COMMAND"),dn=ke("SELECT_ALL_COMMAND"),hn=ke("CLEAR_EDITOR_COMMAND"),gn=ke("CLEAR_HISTORY_COMMAND"),_n=ke("CAN_REDO_COMMAND"),pn=ke("CAN_UNDO_COMMAND"),yn=ke("FOCUS_COMMAND"),mn=ke("BLUR_COMMAND"),xn=ke("KEY_MODIFIER_COMMAND"),Cn=Object.freeze({}),vn=[["keydown",function(t,e){Sn=t.timeStamp,kn=t.key,"Backspace"!==t.key&&Un();if(e.isComposing())return;Qs(e,$e,t)}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Tl(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&co(e,()=>{Vl(n,e)||(An=!0)})}],["compositionstart",function(t,e){Qs(e,Oe,t)}],["compositionend",function(t,e){o?Pn=!0:l||!a&&!d?Qs(e,Me,t):(Fn=!0,In=t.data)}],["input",function(t,e){t.stopPropagation(),Un(),co(e,()=>{e.dispatchCommand(Ee,t)},{event:t}),bn=null}],["click",function(t,e){co(e,()=>{const n=xi(),r=yl(ll(e)),i=Ci();if(r)if(ei(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!po(e)&&1===Os().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(kl(n)||ds(n)){Ms(mi(i,r,e,t))}}Qs(e,Ne,t)})}],["cut",Cn],["copy",Cn],["dragstart",Cn],["dragover",Cn],["dragend",Cn],["paste",Cn],["focus",Cn],["blur",Cn],["drop",Cn]];s&&vn.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||o&&Xs(e))return;if("insertCompositionText"===n)return;Qs(e,we,t)}(t,e)]);let Sn=0,kn=null,Tn=0,bn=null,Nn=!1,wn=null;const En=new WeakMap,On=new WeakMap;let Mn=!1,An=!1,Dn=!1,Pn=!1,Fn=!1,In="",Ln=null,zn=[0,"",0,"root",0];function Kn(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=Vi(),u=yl(ll(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Ur(c)||(!i&&(!s||Tn<r+50)||c.isDirty()&&g<2||Ds(n))&&o.offset!==l.offset&&!c.isComposing()||fs(c)||c.isDirty()&&g>1||(i||!s)&&null!==h&&!c.isComposing()&&f!==Il(c,h,a)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==t.format||c.getStyle()!==t.style)||function(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;const n=t.anchor.offset,r=e.getParentOrThrow(),i=us(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return(Ur(e)||uo(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function Bn(t,e){return ds(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function Wn(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;Mn&&(Mn=!1,Bn(i,o)&&Bn(s,l)&&!Ln)||co(n,()=>{if(!r)return void Ms(null);if(!os(n,i,s))return;let c=xi();if(Ln&&ei(c)&&c.isCollapsed()){const t=c.anchor,e=Ln.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=Ln.clone(),Ms(c))}if(Ln=null,ei(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=!0);const o=ll(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=zn,h=Os(),g=!1===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)Rn(c,l,a);else if("text"===r.type)Ur(i)||t(141),$n(c,i);else if("element"===r.type&&!g){uo(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();Rn(t,n,r)}(c,e):Rn(c,c.format,"")}}else{const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,s=c.isBackward(),a=s?l:o,u=s?o:l,f=s?e:t,d=s?t:e;let h=2047,g=!1;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(Ur(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=!0,h&=e.getFormat(),0===h))break}c.format=g?h:0}}Qs(n,Te,void 0)})}function Rn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function $n(t,e){Rn(t,e.getFormat(),e.getStyle())}function Jn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function jn(t){if(null==t||t.length<=1||null==kn)return;const e=1===kn.length?kn:"Enter"===kn?"\n":"Tab"===kn?"\t":null;if(!e)return;const n=xi();if(!ei(n)||!n.isCollapsed())return;const r=n.anchor.getNode();if(!Ur(r))return;const{offset:i}=n.anchor;if(r.getTextContentSize()===i){const t=r.getNextSibling();if("\n"===e){if(No(t))t.selectEnd();else if(!t){const t=Gl(r,hi),e=t&&t.getNextSibling();uo(e)&&e.selectStart()}}else"\t"===e?qr(t)&&t.selectEnd():Ur(t)&&t.getTextContent()[0]===e&&t.select(1,1)}else r.getTextContent()[i]===e&&r.select(i+1,i+1)}function Un(){Nn=!1,null!==wn&&(clearTimeout(wn),wn=null)}function Vn(){Un(),Nn=!0,wn=setTimeout(Un,0)}function Hn(e){const n=e.inputType,r=Jn(e),i=Vi(),o=xi();if("insertText"===n&&e.data&&Nn){if(Un(),e.preventDefault(),ei(o)&&!o.isCollapsed()){const t=o.isBackward()?o.anchor:o.focus;o.anchor.set(t.key,t.offset,t.type),o.focus.set(t.key,t.offset,t.type)}return!0}if("deleteContentBackward"===n){if(null===o){const t=Ci();if(!ei(t))return!0;Ms(t.clone())}if(ei(o)){const n=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===kn&&s<Sn+30&&i.isComposing()&&n){if(Cs(null),Sn=0,setTimeout(()=>{co(i,()=>{Cs(null)})},30),ei(o)){const e=o.anchor.getNode();e.markDirty(),Ur(e)||t(142),$n(o,e)}}else{if(Cs(null),l&&null!==r&&!r.collapsed&&(o.applyDOMRange(r),!o.isCollapsed()))return e.preventDefault(),o.removeText(),!0;e.preventDefault();const t=o.anchor.getNode(),s=t.getTextContent(),c=t.canInsertTextAfter(),a=0===o.anchor.offset&&o.focus.offset===s.length;let u=f&&n&&!a&&c;if(u&&o.isCollapsed()&&(u=!go(Gs(o.anchor,!0))),!u){Qs(i,Ae,!0);const t=xi();f&&ei(t)&&t.isCollapsed()&&(Ln=t,setTimeout(()=>Ln=null))}}return!0}}var s;if(!ei(o))return!0;const c=e.data;null!==bn&&Ls(!1,i,bn),o.dirty&&null===bn||!o.isCollapsed()||po(o.anchor.getNode())||null===r||o.applyDOMRange(r),bn=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===c)e.preventDefault(),Qs(i,De,!1);else if(c===D)e.preventDefault(),Qs(i,Pe,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t)}else null!=c&&Kn(o,r,c,e.timeStamp,!0)?(e.preventDefault(),Qs(i,Fe,c),jn(c)):bn=c;return Tn=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Qs(i,Fe,e);jn((e.dataTransfer?e.dataTransfer.getData("text/plain"):null)??e.data);break;case"insertFromComposition":Cs(null),Qs(i,Fe,e);break;case"insertLineBreak":Cs(null),Qs(i,De,!1);break;case"insertParagraph":Cs(null),Dn&&!l?(Dn=!1,Qs(i,De,!1)):Qs(i,Pe,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Qs(i,Ie,e);break;case"deleteByComposition":(function(t,e){return t!==e||uo(t)||uo(e)||!us(t)||!us(e)})(d,h)&&Qs(i,Le,e);break;case"deleteByDrag":rl(vr),Qs(i,Le,e);break;case"deleteByCut":Qs(i,Le,e);break;case"deleteContent":Qs(i,Ae,!1);break;case"deleteWordBackward":Qs(i,ze,!0);break;case"deleteWordForward":Qs(i,ze,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Qs(i,Ke,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Qs(i,Ke,!1);break;case"formatStrikeThrough":Qs(i,Be,"strikethrough");break;case"formatBold":Qs(i,Be,"bold");break;case"formatItalic":Qs(i,Be,"italic");break;case"formatUnderline":Qs(i,Be,"underline");break;case"historyUndo":Qs(i,We,void 0);break;case"historyRedo":Qs(i,Re,void 0)}return!0}function Yn(t){const e=Vi();if(kl(t.target)&&Vl(t.target,e))return!0;const n=xi(),r=t.data,i=Jn(t);if(null!=r&&ei(n)&&Kn(n,i,r,t.timeStamp,!1)){Pn&&(Xn(e,r),Pn=!1);const i=n.anchor.getNode(),l=yl(ll(e));if(null===l)return!0;const c=n.isBackward(),a=c?n.anchor.offset:n.focus.offset,u=c?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Ur(i)&&null!==l.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+u)===Is(l.anchorNode)||Qs(e,Fe,r);const d=r.length;o&&d>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=d,n._cachedNodes=null,n._cachedIsBackward=null),f&&e.isComposing()&&(Sn=0,Cs(null))}else{Ls(!1,e,null!==r?r:void 0),Pn&&(Xn(e,r||void 0),Pn=!1)}return function(){$i();const t=Vi();dt(t)}(),!0}function qn(t){const e=Vi(),n=xi();if(ei(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();Cs(r.key),rl(Sr),(t.timeStamp<Sn+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Ur(i)&&i.getStyle()!==n.style)&&Qs(e,Fe,P)}return!0}function Gn(t){return Xn(Vi(),t.data),rl(kr),!0}function Xn(t,e){const n=t._compositionKey;if(Cs(null),null!==n&&null!=e){if(""===e){const e=Ss(n),r=t.getElementByKey(n),i=null!==r&&Ur(e)?Il(e,r,t):null;if(null!==i&&null!==i.nodeValue&&Ur(e)){const n=yl(ll(t));let r=null,o=null;null!==n&&n.anchorNode===i&&(r=n.anchorOffset,o=n.focusOffset),zs(e,i.nodeValue,r,o,!0)}return}if("\n"===e[e.length-1]){const e=xi();if(ei(e)||ri(e)){if(ei(e)){const t=e.focus;e.anchor.set(t.key,t.offset,t.type)}return void Qs(t,qe,null)}}}Ls(!0,t,e)}function Qn(t){const e=Vi();if(null==t.key)return!0;if(Fn){if(js(t))return co(e,()=>{Xn(e,In)}),Fn=!1,In="",!0;Fn=!1,In=""}if(function(t){return Rs(t,"ArrowRight",{shiftKey:"any"})}(t))Qs(e,Je,t);else if(function(t){return Rs(t,"ArrowRight",{...$s,shiftKey:"any"})}(t))Qs(e,je,t);else if(function(t){return Rs(t,"ArrowLeft",{shiftKey:"any"})}(t))Qs(e,Ue,t);else if(function(t){return Rs(t,"ArrowLeft",{...$s,shiftKey:"any"})}(t))Qs(e,Ve,t);else if(function(t){return Rs(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Qs(e,He,t);else if(function(t){return Rs(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Qs(e,Ye,t);else if(function(t){return Rs(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Dn=!0,Qs(e,qe,t);else if(function(t){return" "===t.key}(t))Qs(e,Ge,t);else if(function(t){return i&&Rs(t,"o",{ctrlKey:!0})}(t))t.preventDefault(),Dn=!0,Qs(e,De,!0);else if(function(t){return Rs(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Dn=!1,Qs(e,qe,t);else if(function(t){return Rs(t,"Backspace",{shiftKey:"any"})||i&&Rs(t,"h",{ctrlKey:!0})}(t))js(t)?Qs(e,Xe,t)&&Vn():(t.preventDefault(),Qs(e,Ae,!0));else if(function(t){return"Escape"===t.key}(t))Qs(e,Qe,t);else if(function(t){return Rs(t,"Delete",{})||i&&Rs(t,"d",{ctrlKey:!0})}(t))!function(t){return"Delete"===t.key}(t)?(t.preventDefault(),Qs(e,Ae,!1)):Qs(e,Ze,t);else if(function(t){return Rs(t,"Backspace",Js)}(t))t.preventDefault(),Qs(e,ze,!0);else if(function(t){return Rs(t,"Delete",Js)}(t))t.preventDefault(),Qs(e,ze,!1);else if(function(t){return i&&Rs(t,"Backspace",{metaKey:!0})}(t))t.preventDefault(),Qs(e,Ke,!0);else if(function(t){return i&&(Rs(t,"Delete",{metaKey:!0})||Rs(t,"k",{ctrlKey:!0}))}(t))t.preventDefault(),Qs(e,Ke,!1);else if(function(t){return Rs(t,"b",$s)}(t))t.preventDefault(),Qs(e,Be,"bold");else if(function(t){return Rs(t,"u",$s)}(t))t.preventDefault(),Qs(e,Be,"underline");else if(function(t){return Rs(t,"i",$s)}(t))t.preventDefault(),Qs(e,Be,"italic");else if(function(t){return Rs(t,"Tab",{shiftKey:"any"})}(t))Qs(e,tn,t);else if(function(t){return Rs(t,"z",$s)}(t))t.preventDefault(),Qs(e,We,void 0);else if(function(t){if(i)return Rs(t,"z",{metaKey:!0,shiftKey:!0});return Rs(t,"y",{ctrlKey:!0})||Rs(t,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),Qs(e,Re,void 0);else{const n=e._editorState._selection;!function(t){return Rs(t,"a",$s)}(t)?null===n||ei(n)||(!function(t){return Rs(t,"c",$s)}(t)?function(t){return Rs(t,"x",$s)}(t)&&(t.preventDefault(),Qs(e,fn,t)):(t.preventDefault(),Qs(e,un,t))):(t.preventDefault(),Qs(e,dn,t)&&Vn())}return function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey}(t)&&e.dispatchCommand(xn,t),!0}function Zn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const tr=new Map;function er(t){const e=ml(t.target);if(null===e)return;const n=ls(e.anchorNode);if(null===n)return;An&&(An=!1,co(n,()=>{const r=Ci(),i=e.anchorNode;if(kl(i)||ds(i)){Ms(mi(r,e,n,t))}}));const r=Ps(n),i=r[r.length-1],o=i._key,s=tr.get(o),l=s||i;l!==n&&Wn(e,l,!1),Wn(e,n,!0),n!==i?tr.set(o,n):s&&tr.delete(o)}function nr(t){t._lexicalHandled=!0}function rr(t){return!0===t._lexicalHandled}const ir=()=>{};function or(e){const n=En.get(e);if(void 0===n)return void ir();const r=On.get(n);if(void 0===r)return void ir();const i=r-1;i>=0||t(164),En.delete(e),On.set(n,i),0===i&&n.removeEventListener("selectionchange",er);const o=cs(e);ss(o)?(!function(t){if(null!==t._parentEditor){const e=Ps(t),n=e[e.length-1]._key;tr.get(n)===t&&tr.delete(n)}else tr.delete(t._key)}(o),e.__lexicalEditor=null):o&&t(198);const s=Zn(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[]}function sr(t,e,n){$i();const r=t.__key,i=t.getParent();if(null===i)return;const o=function(t){const e=xi();if(!ei(e)||!uo(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();ol(i,t)&&n.set(t.__key,0,"element");ol(o,t)&&r.set(t.__key,0,"element");return e}(t);let s=!1;if(ei(o)&&e){const e=o.anchor,n=o.focus;e.key===r&&(ki(e,t,i,t.getPreviousSibling(),t.getNextSibling()),s=!0),n.key===r&&(ki(n,t,i,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else ri(o)&&e&&t.isSelected()&&t.selectPrevious();if(ei(o)&&e&&!s){const e=t.getIndexWithinParent();ms(t),vi(o,i,e,-1)}else ms(t);n||ul(i)||i.canBeEmpty()||!i.isEmpty()||sr(i,e),e&&o&&po(i)&&i.isEmpty()&&i.selectEnd()}function lr(t){return t}const cr=Symbol.for("ephemeral");function ar(t){return t[cr]||!1}const ur={configurable:!0,enumerable:!1,value:void 0,writable:!0};class fr{__type;__key;__parent;__prev;__next;__state;[Pt];static getType(){const{ownNodeType:e}=Yl(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name)}$config(){return{}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",ur),Object.defineProperty(this,Pt,ur),ys(this,t)}getType(){return this.__type}isInline(){t(137,this.constructor.name)}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return!0;const e=Ss(t);if(null===e)break;t=e.__parent}return!1}isSelected(t){const e=t||xi();if(null==e)return!1;const n=e.getNodes().some(t=>t.__key===this.__key);if(Ur(this))return n;if(ei(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return!1;const t=this.getParent();if(go(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return-1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return null===t?null:Ss(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(ul(n))return uo(e)||e===this&&go(e)||t(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:Ss(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:Ss(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=uo(this)?this:this.getParent(),n=uo(t)?t:t.getParent(),r=e&&n?Ac(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=Ac(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===Ec(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(t){const e=Ac(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=uo(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f)}while(null===u);o=u}return n||r.reverse(),r}isDirty(){const t=Vi()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(ar(this))return this;const e=Ss(this.__key);return null===e&&t(113),e}getWritable(){if(ar(this))return this;$i();const t=ji(),e=Vi(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=xi();if(null!==s&&s.setCachedNodes(null),o.has(r))return xs(i),i;const l=Bl(i);return o.add(r),xs(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}getDOMSlot(t){return new H(t)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name)}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of St(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return(n.__state||i)&&vt(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){sr(this,!0,t)}replace(e,n){$i();let r=xi();null!==r&&(r=r.clone()),hl(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=null!==u?l.getIndexWithinParent():-1;ms(l),null!==u&&ei(r)&&vi(r,u,f,-1);const d=i.getPreviousSibling(),h=i.getNextSibling(),g=i.__prev,_=i.__next,p=i.__parent;if(sr(i,!1,!0),null===d)c.__first=s;else{d.getWritable().__next=s}if(l.__prev=g,null===h)c.__last=s;else{h.getWritable().__prev=s}l.__next=_,l.__parent=p,c.__size=a;let y=0;if(n&&(uo(this)&&uo(l)||t(139),y=l.getChildrenSize(),l.splice(y,0,this.getChildren())),ei(r)){Ms(r);const t=r.anchor,e=r.focus;t.key===o&&(n&&"element"===t.type?t.set(l.__key,y+t.offset,"element"):Zr(t,l)),e.key===o&&(n&&"element"===e.type?e.set(l.__key,y+e.offset,"element"):Zr(e,l))}return vs()===o&&Cs(s),l}insertAfter(t,e=!0){$i(),hl(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=xi();let s=!1,l=!1;if(null!==i){const n=t.getIndexWithinParent();if(ei(o)){const t=i.__key,e=o.anchor,r=o.focus;s="element"===e.type&&e.key===t&&e.offset===n+1,l="element"===r.type&&r.key===t&&r.offset===n+1}ms(r),e&&ei(o)&&vi(o,i,n,-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,e&&ei(o)){const t=this.getIndexWithinParent();vi(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element")}return t}insertBefore(t,e=!0){$i(),hl(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key,o=xi(),s=r.getParent(),l=null!==s?r.getIndexWithinParent():-1;ms(r),null!==s&&e&&ei(o)&&vi(o,s,l,-1);const c=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),u=n.__prev,f=this.getIndexWithinParent();if(null===c)a.__first=i;else{c.getWritable().__next=i}if(a.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,e&&ei(o)){vi(o,this.getParentOrThrow(),f)}return t}isParentRequired(){return!1}createParentElementNode(){return Do()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){$i();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(uo(n))return n.select();if(!Ur(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){$i();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(uo(n))return n.select(0,0);if(!Ur(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}function dr(t){return t instanceof fr}const hr="historic",gr="history-push",_r="history-merge",pr="paste",yr="collaboration",mr="skip-collab",xr="skip-scroll-into-view",Cr="skip-dom-selection",vr="skip-selection-focus",Sr="composition-start",kr="composition-end",Tr=/\s*!important\s*$/i;function br(t){const e={};if(!t)return e;let n="",r="",i=null,o=!1,s=!1,l=!1,c=0;for(let a=0;a<t.length;a++){const u=t[a];if(o)"*"===u&&"/"===t[a+1]&&(o=!1,a++);else if(s)l?r+=u:n+=u,s=!1;else if(null===i)if("/"!==u||"*"!==t[a+1])if('"'!==u&&"'"!==u)if("("!==u)if(")"!==u)if(l||":"!==u||0!==c){if(";"===u&&0===c){const t=n.trim(),i=r.trim();""!==t&&""!==i&&(e[t]=i),n="",r="",l=!1;continue}l?r+=u:n+=u}else l=!0;else c=Math.max(0,c-1),l?r+=u:n+=u;else c++,l?r+=u:n+=u;else i=u,l?r+=u:n+=u;else o=!0,a++;else l?r+=u:n+=u,"\\"===u?s=!0:u===i&&(i=null)}const a=n.trim(),u=r.trim();return""!==a&&""!==u&&(e[a]=u),e}function Nr(t,e,n){const r=Tr.test(n)?"important":"",i=""===r?n:n.replace(Tr,"").trim();t.setProperty(e,i,r)}function wr(t,e){for(const n in e){const r=e[n];null==r?t.removeProperty(n):Nr(t,n,r)}}function Er(t,e,n=""){if(e===n)return;const r=br(n),i=br(e);for(const e in i)delete r[e],Nr(t,e,i[e]);for(const e in r)t.removeProperty(e)}function Or(t,e){return 16&e?"code":e&k?"mark":32&e?"sub":64&e?"sup":null}function Mr(t,e){return 1&e?"strong":2&e?"em":"span"}function Ar(t,e,n,r,i){const o=r.classList;let s=Vs(i,"base");void 0!==s&&o.add(...s),s=Vs(i,"underlineStrikethrough");let l=!1;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=!0,c||o.add(...s)):c&&o.remove(...s));for(const t in K){const r=K[t];if(s=Vs(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s)}else e&r&&o.remove(...s)}}function Dr(t,e,n){const r=n.isComposing(),i=t+(r?A:""),s=Al(),l=Dl(s).$getDOMSlot(n,e,s),c=l.getFirstChild();if(null===c||c.nodeType!==Node.TEXT_NODE)return void l.insertChild(document.createTextNode(i));const a=c,u=a.nodeValue;if(u!==i)if(r||o){const[t,e,n]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;o+i<n&&o+i<r&&t[n-o-1]===e[r-o-1];)o++;return[i,n-i-o,e.slice(i,r-o)]}(u,i);0!==e&&a.deleteData(t,e),a.insertData(t,n)}else a.nodeValue=i}function Pr(t,e,n,r,i,o){Dr(i,t,e);const s=o.theme.text;void 0!==s&&Ar(0,0,r,t,s)}function Fr(t,e){const n=document.createElement(e);return n.appendChild(t),n}class Ir extends fr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new Ir(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return J[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===vs()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=K[t];return 0!==(this.getFormat()&e)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return _s(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const n=this.__format,r=Or(0,n),i=Mr(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l));Pr(l,this,0,n,this.__text,t);const c=this.__style;return""!==c&&Er(s.style,c),s}updateDOM(e,n,r){const i=this.__text,o=e.__format,s=this.__format,l=Or(0,o),c=Or(0,s),a=Mr(0,o),u=Mr(0,s);if((null===l?a:l)!==(null===c?u:c))return!0;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const o=document.createElement(u);return Pr(o,this,0,s,i,r),n.replaceChild(o,e),!1}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),Dr(i,f,this);const d=r.theme.text;void 0!==d&&o!==s&&Ar(0,o,s,f,d);const h=e.__style,g=this.__style;return h!==g&&Er(n.style,g,h),!1}static importDOM(){return{"#text":()=>({conversion:Wr,priority:0}),b:()=>({conversion:zr,priority:0}),code:()=>({conversion:Jr,priority:0}),em:()=>({conversion:Jr,priority:0}),i:()=>({conversion:Jr,priority:0}),mark:()=>({conversion:Jr,priority:0}),s:()=>({conversion:Jr,priority:0}),span:()=>({conversion:Lr,priority:0}),strong:()=>({conversion:Jr,priority:0}),sub:()=>({conversion:Jr,priority:0}),sup:()=>({conversion:Jr,priority:0}),u:()=>({conversion:Jr,priority:0})}}static importJSON(t){return jr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return kl(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Fr(n,"b")),this.hasFormat("italic")&&(n=Fr(n,"i")),this.hasFormat("strikethrough")&&(n=Fr(n,"s")),this.hasFormat("underline")&&(n=Fr(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?K[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?B[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=_s(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=$[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){$i();let n=t,r=e;const i=xi(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t)}else n=0,r=0;if(!ei(i))return gi(s,n,s,r,"text","text");{const t=vs();t!==i.anchor.key&&t!==i.focus.key||Cs(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=xi();if(r&&ei(c)){const e=t+s;c.setTextNodeRange(i,e,i,e)}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){$i();const e=this.getLatest(),n=e.getTextContent();if(""===n)return[];const r=e.__key,i=vs(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;e<o&&r<=l;r++){const i=t[r];i>e&&(s.push(n.slice(e,i)),e=i)}const c=s.length;if(1===c)return[e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=!1,p=null,y=null;const m=xi();if(ei(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e)}e.isSegmented()?(f=jr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=wt(e,f),_=!0):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=jr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=wt(e,n);const o=n.__key;i===r&&Cs(o),x.push(n)}const C=p?p.offset:null,v=y?y.offset:null;let S=0;for(const t of x){if(!p&&!y)break;const e=S+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=S&&(p.set(t.getKey(),C-S,"text"),C<e&&(p=null)),null!==y&&null!==v&&v<=e&&v>=S){y.set(t.getKey(),v-S,"text");break}S=e}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&xs(e);null!==n&&xs(n)}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),ei(m)&&vi(m,u,e,c-1)}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;vs()===i&&Cs(r);const l=xi();if(ei(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Ti(t,n,r,e,s),null!==o&&o.key===i&&Ti(o,n,r,e,s)}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Lr(t){return{forChild:Vr(t.style),node:null}}function zr(t){const e=t,n="normal"===e.style.fontWeight;return{forChild:Vr(e.style,n?void 0:"bold"),node:null}}const Kr=new WeakMap;function Br(t){if(!kl(t))return!1;if("PRE"===t.nodeName)return!0;const e=t.style.whiteSpace;return"string"==typeof e&&e.startsWith("pre")}function Wr(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=Kr.get(n))&&!Br(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)Kr.set(r[t],i);return i}(n))return{node:Mi(r)};if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return{node:null};if(" "===r[0]){let t=n,e=!0;for(;null!==t&&null!==(t=Rr(t,!1));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=!1;break}}e&&(r=r.slice(1))}if(" "===r[r.length-1]){let t=n,e=!0;for(;null!==t&&null!==(t=Rr(t,!0));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=!1;break}}e&&(r=r.slice(0,r.length-1))}return""===r?{node:null}:{node:jr(r)}}function Rr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t}if(n=t,kl(n)){const t=n.style.display;if(""===t&&!wl(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(ds(n))return n;if("BR"===n.nodeName)return null}}const $r={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Jr(t){const e=$r[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Vr(t.style,e),node:null}}function jr(t=""){return dl(new Ir(t))}function Ur(t){return t instanceof Ir}function Vr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Ur(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class Hr extends Ir{static getType(){return"tab"}static clone(t){return new Hr(t.__key)}constructor(t){super("\t",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=Vs(t.theme,"tab");if(void 0!==n){e.classList.add(...n)}return e}static importJSON(t){return Yr().updateFromJSON(t)}setTextContent(t){return"\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return"normal"!==e&&t(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Yr(){return dl(new Hr)}function qr(t){return t instanceof Hr}class Gr{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return wc(Rc(Dc(this,"next")),Rc(Dc(t,"next")))<0}getNode(){const e=Ss(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,o=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,Ri()||(vs()===o&&Cs(t),null!==i&&(i.setCachedNodes(null),ei(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function Xr(t,e,n){return new Gr(t,e,n)}function Qr(t,e){let n=e.__key,r=t.offset,i="element";if(Ur(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t)}else if(!uo(e)){const t=e.getNextSibling();if(Ur(t))n=t.__key,r=0,i="text";else{const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,i)}function Zr(t,e){if(uo(e)){const n=e.getLastDescendant();uo(n)||Ur(n)?Qr(t,n):Qr(t,e)}else Qr(t,e)}class ti{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!ri(t))return!1;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new ti(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(Ur(r))i=r.select();else{const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t)}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove()}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=Ss(t);null!==e&&n.push(e)}return Ri()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((xi()||Ci())===this&&t[0]){const e=hc(t[0],"next");Fc(bc(e,e))}for(const e of t)e.remove()}}function ei(t){return t instanceof ni}class ni{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!ei(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,o=new Set;for(const n of t)if(ac(n)){const{origin:t}=n;0===e.length?i.add(t):(o.add(t),e.push(t))}else{const{origin:t}=n;uo(t)&&o.has(t)||e.push(t)}r&&e.push(r.caret.origin);if(cc(t.focus)&&uo(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=yc(t.focus.origin,"previous");ac(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=xc(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!uo(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop()}if(0===e.length&&t.isCollapsed()){const n=Rc(t.anchor),r=Rc(t.anchor.getFlipped()),i=t=>sc(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o)}return e}(jc(Lc(this),"next"));return Ri()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){return this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text"),this}getTextContent(){const t=this.getNodes();if(0===t.length)return"";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=oi(this);let c="",a=!0;for(let u=0;u<t.length;u++){const f=t[u];if(uo(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=!1,Ur(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=o?t.slice(s):t.slice(l):f===n&&(t=o?t.slice(0,l):t.slice(0,s)),c+=t}else!go(f)&&!No(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(t){const e=Vi(),n=e.getEditorState()._selection,r=di(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,o,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),s&&(this.dirty=!0),At(this)}clone(){const t=this.anchor,e=this.focus;return new ni(Xr(t.key,t.offset,t.type),Xr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=_s(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=K[t];return 0!==(this.format&e)}insertRawText(t){this.insertNodes(Mi(t))}insertText(e){const n=this.anchor,r=this.focus,i=this.format,o=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const i=t.getNode(),o=i.getChildAtIndex(t.offset),s=jr();if(s.setFormat(n),s.setStyle(r),Po(o))o.splice(0,0,[s]);else{const t=po(i)?Do().append(s):s;null===o?i.append(t):o.insertBefore(t)}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text")}(s,l,i,o),"element"===l.type&&Pc(l,Rc(Dc(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Ur(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(fs(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Ur(t)&&t.canInsertTextBefore()&&!fs(t)||(t=jr(),t.setFormat(i),t.setStyle(o),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(fs(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Ur(t)&&!fs(t)||(t=jr(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=jr(d.getTextContent());t.setFormat(i),d.replace(t),d=t}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||uo(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),fi(this.anchor,this.focus),void this.insertText(e)}if(1===f){if(us(d)){const t=jr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===o){if(qr(d)){const t=jr(e);return t.setFormat(i),t.setStyle(o),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=jr(e);if(t.setFormat(i),t.setStyle(o),t.select(),0===c)d.insertBefore(t,!1);else{const[e]=d.splitText(c);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}d.setFormat(i),d.setStyle(o)}const r=a-c;d=d.spliceText(c,r,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null))}else{const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=uo(d)?d:d.getParentOrThrow();let r=uo(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(Ur(_)&&!us(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=jr(_.getTextContent());_.replace(t),_=t}po(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key)}else{const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove()}else t.add(_.__key);const o=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=o.length-1;t>=0;t--){const e=o[t];if(e.is(d)||uo(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,!1):e.remove())}if(!g){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(us(d))if(c===h)d.select();else{const t=jr(e);t.select(),d.replace(t)}else d=d.spliceText(c,h-c,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const t=xi()===this;Ic(this,Wc(Lc(this))),t&&xi()!==this&&Ms(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Cs(null);const n=this.getNodes(),r=[];for(const t of n)Ur(t)&&r.push(t);const i=e=>{n.forEach(n=>{if(uo(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r)}})},o=r.length;if(0===o)return this.toggleFormat(t),Cs(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s: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(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(fs(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else{const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text")}return void(this.format=g)}0===h||fs(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||fs(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,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(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=xi();return ei(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Gl(n,Ml),i=e[e.length-1];if(uo(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=Di(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(t=>(uo(t)||go(t))&&!t.isInline())){uo(r)||t(211,n.constructor.name,n.getType());const o=Di(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Do();let n=null;for(let r=0;r<t.length;r++){const i=t[r],o=No(i);if(o||go(i)&&i.isInline()||uo(i)&&i.isInline()||Ur(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),o))continue;null!==n&&n.append(i)}else e.append(i),n=null}return e}(e),s=o.getLastDescendant(),l=o.getChildren(),c=!uo(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;uo(f=u)&&Ml(f)&&!f.isEmpty()&&uo(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(uo(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n){const r=n.getParentOrThrow().getLastChild();let i=n;const o=[n];for(;i!==r;)i.getNextSibling()||t(140),i=i.getNextSibling(),o.push(i);let s=e;for(const t of o)s=s.insertAfter(t)}(r,u));const d=Gl(s,Ml);c&&uo(d)&&(c.canMergeWhenEmpty()||Ml(a))&&(d.append(...c.getChildren()),c.remove()),uo(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=uo(r)?r.getLastChild():null;No(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const t=Do();return Os().splice(this.anchor.offset,0,[t]),t.select(),t}const e=Di(this),n=Gl(this.anchor.getNode(),Ml);uo(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=n.insertNewAfter(this,!1);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(t){const e=bo();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n)}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[i,o]=oi(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[o,i]:[i,o];if(0===e)return[];if(1===e){if(Ur(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return[n]}if(Ur(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),Ur(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,e,n){if(Fi(this,t,e,n))return;const r="move"===t,i=Vi(),o=yl(ll(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===s||!uo(c)||c.isInline()||c.canBeEmpty()||pl(s,i,l),this.dirty){const t=Zs(i,this.anchor.key),e=Zs(i,this.focus.key);let n=t,r=e;if("text"===this.anchor.type){const e=this.anchor.getNode();n=Ur(e)?Il(e,t,i):null}if("text"===this.focus.type){const t=this.focus.getNode();r=Ur(t)?Il(t,e,i):null}n&&r&&bi(o,n,this.anchor.offset,r,this.focus.offset)}if(function(t,e,n,r){t.modify(e,n,r)}(o,t,e?"backward":"forward",n),o.rangeCount>0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=po(n)?n:al(n);if(this.applyDOMRange(t),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let t=0;t<n.length;t++){const e=n[t];ol(e,i)?r.push(e):s=!0}if(s&&r.length>0)if(e){const t=r[0];uo(t)?t.selectStart():t.getParentOrThrow().selectStart()}else{const t=r[r.length-1];uo(t)?t.selectEnd():t.getParentOrThrow().selectEnd()}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,i,o,!0)}(this)}}"lineboundary"===n&&Fi(this,t,e,n,"decorators")}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&uo(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(uo(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=kc(Dc(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(ac(e))if(e.origin.isInline());else{if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(uo(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=Rc(e);Ic(this,bc(t,t)),r.anchor.origin.remove()}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"})}else{if("merge-block"===t.type)break;if(cc(e)){if(uo(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(go(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&uo(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=pi();t.add(e.origin.getKey()),Ms(t)}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return e.origin.isEmpty()&&!n.isEmpty()&&e.origin.getParent()===n.getParent()?void e.origin.remove(!0):(Ic(this,bc(!e.origin.isEmpty()&&n.isEmpty()?zc(hc(n,e.direction)):r.anchor,e)),this.removeText())}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&si(this,e.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void ci(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void ci(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t<o,l=s?t:o,c=s?o:t,a=c-1;if(l!==a){(function(t){return!(Ds(t)||li(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type))}}}(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&po(t.getParent())&&null===t.getPreviousSibling()&&si(this,t)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word")}this.isCollapsed()?this.deleteCharacter(t):this.removeText()}isBackward(){const t=this._cachedIsBackward;if(null!==t)return t;const e=this.focus.isBefore(this.anchor);return Ri()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function ri(t){return t instanceof ti}function ii(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function oi(t){const e=t.getStartEndPoints();if(null===e)return[0,0];const[n,r]=e;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[ii(n),ii(r)]}function si(t,e){for(let n=e;n;n=n.getParent()){if(uo(n)){if(n.collapseAtStart(t))return!0;if(ul(n))break}if(n.getPreviousSibling())break}return!1}const li=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\ufe0f")&&e("#\ufe0f\u20e3")&&e("\u{1f44d}"))return e}catch(t){}return()=>!1})();function ci(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;t<o;t++){const r=t===o-1;if(l=s,s+=i[t].length,e&&s===n||s>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l))}function ai(e,n,r,i){let o,s=n,l=!1;if(kl(e)){let c=!1;const a=e.childNodes,u=a.length,f=i._blockCursorElement;s===u&&u>0&&(c=!0,s=u-1),void 0!==bs(e,i)||Vl(e,i)||(l=!0);let d=a[s],h=!1;if(d===f)d=a[s+1],h=!0;else if(null!==f){const t=f.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,f)&&s--}}if(o=As(d),Ur(o))s=_c(o,c?"next":"previous");else{let a=As(e);if(null===a)return null;if(uo(a)){const l=i.getElementByKey(a.getKey());null===l&&t(214);const u=Pl(a,l,i);[a,s]=u.resolveChildIndex(a,l,e,n),uo(a)||t(215),c&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let f=a.getChildAtIndex(s);if(uo(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=c?f.getLastDescendant():f.getFirstDescendant();null===t?a=f:(f=t,a=uo(f)?f:f.getParentOrThrow()),s=0}Ur(f)?(o=f,a=null,s=_c(f,c?"next":"previous")):f!==a&&c&&!h&&(uo(a)||t(216),s=Math.min(a.getChildrenSize(),s+1))}else{const t=a.getIndexWithinParent(),r=i.getElementByKey(a.getKey());let o="after";if(null!==r&&As(e)===a){const t=Pl(a,r,i);t.element!==r?o=t.resolveLeafPosition(r,e,n):0===n&&go(a)&&(o="before")}s="before"===o?t:t+1,a=a.getParentOrThrow()}if(uo(a))return[Xr(a.__key,s,"element"),l]}}else o=As(e);return Ur(o)?[Xr(o.__key,_c(o,s,"clamp"),"text"),l]:null}function ui(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&uo(o)&&o.isInline()){const e=o.getPreviousSibling();Ur(e)&&t.set(e.__key,e.getTextContent().length,"text")}}else uo(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Ur(r)&&t.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&uo(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&uo(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();Ur(e)&&t.set(e.__key,0,"text")}}}function fi(t,e,n){if("text"===t.type&&"text"===e.type){const n=t.isBefore(e),r=t.is(e);ui(t,n,r),ui(e,!n,r),r&&e.set(t.key,t.offset,t.type)}}function di(t,e,n,r,i,o){if(null===t||null===n||!os(i,t,n))return null;const s=ai(t,e,ei(o)?o.anchor:null,i);if(null===s)return null;const l=ai(n,r,ei(o)?o.focus:null,i);if(null===l)return null;const[c,a]=s,[u,f]=l;if("element"===c.type&&"element"===u.type){const e=As(t),r=As(n);if(go(e)&&go(r))return null}return fi(c,u),[c,u,a||f]}function hi(t){return uo(t)&&!t.isInline()}function gi(t,e,n,r,i,o){const s=ji(),l=new ni(Xr(t,e,i),Xr(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function _i(){const t=Xr("root",0,"element"),e=Xr("root",0,"element");return new ni(t,e,0,"")}function pi(){return new ti(new Set)}function yi(t,e){return mi(null,t,e,null)}function mi(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!it&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(ei(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&ei(t)&&!os(n,a,u))return t.clone();const h=di(a,f,u,d,n,t);if(null===h)return null;const[g,_,p]=h;let y=0,m="";if(ei(t)){const e=t.anchor;if(g.key===e.key)y=t.format,m=t.style;else{const t=g.getNode();Ur(t)?(y=t.getFormat(),m=t.getStyle()):uo(t)&&(y=t.getTextFormat(),m=t.getTextStyle())}}const x=new ni(g,_,y,m);return p&&(x.dirty=!0),x}function xi(){return ji()._selection}function Ci(){return Vi()._editorState._selection}function vi(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),o.set(c,n,"element"),Si(t)}}else{const s=t.isBackward(),l=s?o:i,a=l.getNode(),u=s?i:o,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element")}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element")}}Si(t)}function Si(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!uo(o))return;const t=o.getChildrenSize(),i=n>=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(Ur(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text")}return}if(uo(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(Ur(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text")}}if(uo(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(Ur(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text")}}}function ki(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,Ur(r)?(s=r.getTextContentSize(),l="text"):uo(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,Ur(i)?l="text":uo(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Ti(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function bi(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i)}catch(t){}}function Ni(t,e,n){const r=Zs(t,e.getKey());if(uo(e)){const i=Pl(e,r,t);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function wi(t,e,n,r,i,s){const l=document.activeElement;if(i.has(yr)&&l!==s||null!==l&&is(l))return;if(!ei(e))return void(null!==t&&os(n,r.anchorNode,r.focusNode)&&r.removeAllRanges());const c=e.anchor,a=e.focus,u=c.getNode(),f=a.getNode(),[d,h]=Ni(n,u,c.offset),[g,_]=Ni(n,f,a.offset),p=e.format,y=e.style,m=e.isCollapsed();let x=d,C=g,v=!1;var S,k,T,b,N;if(("text"===c.type?(x=Ur(u)?Il(u,d,n):null,v=u.getFormat()!==p||u.getStyle()!==y):ei(t)&&"text"===t.anchor.type&&(v=!0),"text"===a.type&&(C=Ur(f)?Il(f,g,n):null),null!==x&&null!==C)&&(m&&(null===t||v||ei(t)&&(t.format!==p||t.style!==y))&&(S=p,k=y,T=h,b=c.key,N=performance.now(),zn=[S,k,T,b,N]),"Range"===r.type&&m||r.anchorOffset!==h||r.focusOffset!==_||r.anchorNode!==x||r.focusNode!==C||(null!==l&&s.contains(l)||i.has(vr)||s.focus({preventScroll:!0}),"element"===c.type))){if(bi(r,x,h,C,_),!o||!e.isCollapsed()||null===s||i.has(vr)||null!==document.activeElement&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!i.has(xr)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=ei(e)&&"element"===e.anchor.type?x.childNodes[h]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect()}else e=t.getBoundingClientRect();!function(t,e,n){const r=el(n),i=sl(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e){const e=i.visualViewport;if(e){const t=e.offsetTop;l=t,c=t+e.height}else l=0,c=ll(t).innerHeight;const n=i.getComputedStyle(r.documentElement),o=parseFloat(n.scrollPaddingTop),s=parseFloat(n.scrollPaddingBottom);isFinite(o)&&(l+=o),isFinite(s)&&(c-=s)}else{const t=a.getBoundingClientRect();l=t.top,c=t.bottom}let n=0;if(o<l?n=-(l-o):s>c&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else{const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e}if(e)break;a=tl(a)}}(n,e,s)}}Mn=!0}}function Ei(t){let e=xi()||Ci();null===e&&(e=Os().selectEnd()),e.insertNodes(t)}function Oi(t,e){for(const n of t.split(/(\r?\n|\t)/))"\n"===n||"\r\n"===n?e.linebreak():"\t"===n?e.tab():""!==n&&e.text(n)}function Mi(t){const e=[];return Oi(t,{linebreak:()=>e.push(bo()),tab:()=>e.push(Yr()),text:t=>e.push(jr(t))}),e}function Ai(){const t=xi();return null===t?"":t.getTextContent()}function Di(e){let n=e;e.isCollapsed()||n.removeText();const r=xi();ei(r)&&(n=r),ei(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!Ml(o);){const t=o;if([o,s]=Pi(o,s),t.is(o))break}return s}function Pi(t,e){const n=t.getParent();if(!n){const t=Do();return Os().append(t),t.select(),[Os(),0]}if(Ur(t)){const r=t.splitText(e);if(0===r.length)return[n,t.getIndexWithinParent()];const i=0===e?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!uo(t)||0===e)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new ni(Xr(t.__key,e,"element"),Xr(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Fi(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),!0}const o=Dc(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!$c(c)){for(const t of c){a=!1;const{origin:e}=t;if(!go(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of kc(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(ac(t))t.origin.isInline()||(c=t);else{if(uo(t.origin))continue;go(t.origin)&&!t.origin.isInline()&&(c=t)}break}}if(c===o)return!1;if(l&&!s&&go(c.origin)&&c.origin.isKeyboardSelectable()){const t=pi();return t.add(c.origin.getKey()),Ms(t),!0}return c=Rc(c),l&&Pc(t.anchor,c),Pc(t.focus,c),a||!s}let Ii=null,Li=null,zi=!1,Ki=!1,Bi=0;const Wi={characterData:!0,childList:!0,subtree:!0};function Ri(){return zi||null!==Ii&&Ii._readOnly}function $i(){zi&&t(13)}function Ji(){Bi>99&&t(14)}function ji(){return null===Ii&&t(195,Yi()),Ii}function Ui(e){null!==ji()&&null===Li&&(Li=e),Li!==e&&t(365)}function Vi(){return null===Li&&t(337,Yi()),Li}function Hi(){Vi()._dirtyType=2}function Yi(){let t=0;const e=new Set,n=Go.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=cs(r);if(ss(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function qi(){return Li}function Gi(t,e,n){const r=e.__type,i=es(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t<s&&(o[t](e),e.isAttached());t++);}function Xi(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function Qi(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t)}function Zi(t){return to(t,Vi()._nodes)}function to(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const o=i.klass;e.type!==o.getType()&&t(18,o.name);const s=o.importJSON(e),l=e.children;if(uo(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=to(l[t],n);s.append(e)}return s}function eo(t,e,n){const r=Ii,i=zi,o=Li;Ii=e,zi=!0,Li=t;try{return n()}finally{Ii=r,zi=i,Li=o}}function no(e,n){const r=e._pendingEditorState,i=e._rootElement,o=e._headless||null===i;if(null===r)return void(e._deferred.length>0&&oo(e,e._deferred));const s=e._editorState,l=s._selection,c=r._selection,a=0!==e._dirtyType,u=Ii,f=zi,d=Li,h=e._updating,g=e._observer;let _=null;if(e._pendingEditorState=null,e._editorState=r,!o&&a&&null!==g){Li=e,Ii=r,zi=!1,e._updating=!0;try{const t=e._dirtyType,n=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),_=ve(s,r,e,t,n,i)}catch(t){if(t instanceof Error&&e._onError(t),Ki)throw t;return jo(e,null,i,r),ht(e),e._dirtyType=2,Ki=!0,no(e,s),void(Ki=!1)}finally{g.observe(i,Wi),e._updating=h,Ii=u,zi=f,Li=d}}r._readOnly||(r._readOnly=!0);const p=e._dirtyLeaves,y=e._dirtyElements,m=e._normalizedNodes,x=e._updateTags,C=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=ws(t)),delete r[o])}(e,r);const v=o?null:yl(ll(e));if(e._editable&&null!==v&&(a||null===c||c.dirty||!c.is(l))&&null!==i&&!x.has(Cr)){Li=e,Ii=r;try{if(null!==g&&g.disconnect(),a||null===c||c.dirty){const t=e._blockCursorElement;null!==t&&pl(t,e,i),wi(l,c,e,v,x,i)}!function(t,e,n){let r=t._blockCursorElement;if(ei(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,c=null;if(s===o.getChildrenSize()){_l(o.getChildAtIndex(s-1))&&(l=!0)}else{const e=o.getChildAtIndex(s);if(null!==e&&_l(e)){const n=e.getPreviousSibling();(null===n||_l(n))&&(l=!0,c=t.getElementByKey(e.__key))}}if(l){const n=Pl(o,t.getElementByKey(o.__key),t).element;return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=ea(r);r=e.blockCursor=t}void 0!==r&&n.classList.add(...r)}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&pl(r,t,e)}(e,i,c)}finally{null!==g&&g.observe(i,Wi),Li=d,Ii=u}}null!==_&&function(t,e,n,r,i){const o=Array.from(t._listeners.mutation),s=o.length;for(let t=0;t<s;t++){const[s,l]=o[t];for(const t of l){const o=e.get(t);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,_,x,p,s),ei(c)||null===c||null!==l&&l.is(c)||e.dispatchCommand(Te,void 0);const S=e._pendingDecorators;null!==S&&(e._decorators=S,e._pendingDecorators=null,ro("decorator",e,!0,S)),function(t,e,n){const r=Es(e),i=Es(n);r!==i&&ro("textcontent",t,!0,i)}(e,n||s,r),ro("update",e,!0,{dirtyElements:y,dirtyLeaves:p,editorState:r,mutatedNodes:_,normalizedNodes:m,prevEditorState:n||s,tags:x}),oo(e,C),function(e){const n=e._updates;if(0===n.length)return void(e._cascadeCount=0);if(e._cascadeCount++>99){e._updates=[],e._cascadeCount=0;try{t(343)}catch(t){t instanceof Error&&e._onError(t)}return}const r=n.shift();if(r){const[t,n]=r;lo(e,t,n)}}(e)}function ro(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=e._listeners[t],i=Array.from(n);for(const[t,e]of i){e&&e();const i=t(...r);n.has(t)?n.set(t,i):i&&i()}}finally{e._updating=i}}function io(t,e,n,r){const i=Ps(t);let o;for(let t=4;t>=0;t--)for(let s=0;s<i.length;s++){const l=i[s];if(s>0&&l._updating){o=l;break}const c=l._commands.get(e);if(void 0!==c){const e=c[t];if(e.size>0){let t=!1;if(co(l,()=>{for(const i of e)if(i(n,r))return void(t=!0)}),t)return t}}}return o&&o.update(()=>{io(o,e,n,r)}),!1}function oo(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=!0;try{for(let t=0;t<e.length;t++)e[t]()}finally{t._updating=n}}}function so(e,n){const r=e._updates;let i=n||!1;for(;0!==r.length;){const n=r.shift();if(n){const[r,o]=n,s=e._pendingEditorState;let l;void 0!==o&&(l=o.onUpdate,o.skipTransforms&&(i=!0),o.discrete&&(null===s&&t(191),s._flushSync=!0),l&&e._deferred.push(l),Qi(e,o.tag)),null==s?lo(e,r,o):r()}}return i}function lo(e,n,r){const i=e._updateTags;let o,s=!1,l=!1;void 0!==r&&(o=r.onUpdate,Qi(e,r.tag),s=r.skipTransforms||!1,l=r.discrete||!1),o&&e._deferred.push(o);const c=e._editorState;let a=e._pendingEditorState,u=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=yo(a||c),u=!0),a._flushSync=l;const f=Ii,d=zi,h=Li,g=e._updating;Ii=a,zi=!1,e._updating=!0,Li=e;const _=e._headless||null===e.getRootElement();Qo(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=yl(ll(t));return ei(n)||null==n?mi(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),s=so(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(ei(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);Ur(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&Mt(e)}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,o=vs(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);Ur(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Mt(r),void 0!==r&&Xi(r,o)&&Gi(e,r,s),n.add(t)}if(l=e._dirtyLeaves,c=l.size,c>0){Bi++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&Xi(c,o)&&Gi(e,c,s)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Bi++}e._dirtyLeaves=n,e._dirtyElements=r}(a,e),so(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(uo(e)&&rt(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)))}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t))}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(ei(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19)}else ri(o)&&0===o._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void no(e)}finally{Ii=f,zi=d,Li=h,e._updating=g,Bi=0}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);p?a._flushSync?(a._flushSync=!1,no(e)):u&&rs(()=>{no(e)}):(a._flushSync=!1,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null))}function co(t,e,n){Li===t&&void 0===n?e():lo(t,e,n)}class ao extends fr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return R[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=Vi()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Ur(e)&&t.push(e),uo(e)){const n=e.getAllTextNodes();t.push(...n)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;uo(t);){const e=t.getFirstChild();if(null===e)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;uo(t);){const e=t.getLastChild();if(null===e)break;t=e}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return uo(t)&&t.getLastDescendant()||t||null}const r=e[t];return uo(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:Ss(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:Ss(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),uo(i)&&r!==n-1&&!i.isInline()&&(t+=D)}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),uo(i)&&r!==n-1&&!i.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=W[t];return 0!==(this.getFormat()&e)}return!1}hasTextFormat(t){const e=K[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return _s(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){$i();const n=xi();let r=t,i=e;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Ur(t)||uo(t))return t.select(0,0)}else if(!(void 0!==t&&t!==o||void 0!==e&&e!==o)){const t=this.getLastChild();if(Ur(t)||uo(t))return t.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return ei(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):gi(s,r,s,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(t=>t.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t&&W[t]||0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){ar(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;ms(e.getWritable()),c.push(r),e=n}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,ms(n);const r=e.__key;if(null===d)o.__first=r,n.__prev=null;else{const t=d.getWritable();t.__next=r,n.__prev=t.__key}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e}if(e+n===i){if(null!==d){d.getWritable().__next=null,o.__last=d.__key}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key}else t.__prev=null}if(o.__size=f,c.length){const t=xi();if(ei(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:i}=t;fo(r,e,n)&&ki(r,r.getNode(),this,u,a),fo(i,e,n)&&ki(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||ul(this)||this.remove()}}return o}getDOMSlot(t){return new q(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(kl(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px",e.setAttribute("data-lexical-indent",String(t)));const n=this.getDirection();n&&(e.dir=n)}return{element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0===e&&""===n||ul(this)||this.getChildren().some(Ur)||(0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,e,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,e){const n=Pl(this,t,e);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function uo(t){return t instanceof ao}function fo(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return!0;r=r.getParent()}return!1}class ho extends fr{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function go(t){return t instanceof ho}class _o extends ao{__cachedText;static getType(){return"root"}static clone(){return new _o}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const t=this.__cachedText;return null===t||!Ri()&&0!==Vi()._dirtyType?super.getTextContent():t}remove(){t(52)}replace(e){t(53)}insertBefore(e){t(54)}insertAfter(e){t(55)}updateDOM(t,e){return!1}splice(e,n,r){for(const e of r)uo(e)||go(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return Os().updateFromJSON(t)}collapseAtStart(){return!0}}function po(t){return t instanceof _o}function yo(t){return new vo(et(t._nodeMap))}function mo(){return new vo(new Map([["root",new _o]]))}function xo(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),uo(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t<o.length;t++){const e=xo(o[t]);i.push(e)}}return n}function Co(t){return t instanceof vo}class vo{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return eo(e&&e.editor||null,this,t)}clone(t){const e=new vo(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=!0,e}toJSON(){return eo(null,this,()=>({root:xo(Os())}))}}class So extends ao{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class ko extends fr{static getType(){return"linebreak"}static clone(t){return new ko(t.__key)}constructor(t){super(t)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>wo(t)||Eo(t)?null:{conversion:To,priority:0}}}static importJSON(t){return bo().updateFromJSON(t)}}function To(t){return{node:bo()}}function bo(){return dl(new ko)}function No(t){return t instanceof ko}function wo(t){const e=t.parentElement;if(null!==e&&Ol(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Oo(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&Oo(n))return!0}}return!1}function Eo(t){const e=t.parentElement;if(null!==e&&Ol(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Oo(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&Oo(r))return!0}return!1}function Oo(t){return ds(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}class Mo extends ao{static getType(){return"paragraph"}static clone(t){return new Mo(t.__key)}createDOM(t){const e=document.createElement("p"),n=Vs(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n)}return e}updateDOM(t,e,n){return!1}static importDOM(){return{p:t=>({conversion:Ao,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(kl(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t)}return{element:e}}static importJSON(t){return Do().updateFromJSON(t)}exportJSON(){const t=super.exportJSON();if(void 0===t.textFormat||void 0===t.textStyle){const e=this.getChildren().find(Ur);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const n=Do();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Ur(t[0])&&""===t[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 Ao(t){const e=Do();if(Jl(e,t),Rl(t,e),""===e.getFormatType()){const n=t.getAttribute("align");n&&n&&n in W&&e.setFormat(n)}return $l(e,t),{node:e}}function Do(){return dl(new Mo)}function Po(t){return t instanceof Mo}const Fo=0,Io=1,Lo=2,zo=3,Ko=4,Bo=-8,Wo=-7,Ro=-6,$o=-5,Jo=-4;function jo(t,e,n,r,i){const o=t._keyToDOMMap;o.clear(),t._editorState=mo(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent="",function(t,e){const n=`__lexicalKey_${e._key}`;delete t[n]}(e,t)),null!==n&&(n.textContent="",o.set("root",n),Ts(n,t,"root"))}function Uo(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=Yl(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t)}if(t){const n=t.$transform;n&&e.add(n),r=t.extends}else{const t=Object.getPrototypeOf(r);r=t.prototype instanceof fr&&t!==fr?t:void 0}}return e}const Vo={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=ns(e,t.getType());return n&&void 0!==n.exportDOM?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,i)=>uo(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$shouldExclude:(t,e,n)=>uo(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function Ho(t){const e=t||{},n=qi(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||!1,s=mo(),l=e.namespace||(null!==i?i._config.namespace:Fs()),c=e.editorState,a=[_o,Ir,ko,Hr,Mo,So,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else{h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null}Yl(e);const i=e.getType(),o=Uo(e);h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:xt(a[t]),transforms:o})}}const g=new Go(s,i,h,{disableEvents:o,dom:{...Vo,...t&&t.dom},namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e])})};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n)}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),function(t){t.registerCommand(we,Hn,Fo),t.registerCommand(Ee,Yn,Fo),t.registerCommand(Oe,qn,Fo),t.registerCommand(Me,Gn,Fo),t.registerCommand($e,Qn,Fo)}(g),g}function Yo(t,e){const n=t.get(e);t.delete(e),n&&n()}function qo(t,e,n){return t.set(e,n),Yo.bind(null,t,e)}class Go{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new nt,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,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=Fs(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){return qo(this._listeners.update,t)}registerEditableListener(t){return qo(this._listeners.editable,t)}registerDecoratorListener(t){return qo(this._listeners.decorator,t)}registerTextContentListener(t){return qo(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return ia(qo(e,t,t(this._rootElement,null)||void 0),()=>function(t,e,n){const r=t.get(e);r&&r(),t.set(e,e(...n)||void 0)}(e,t,[null,this._rootElement]))}registerCommand(e,n,r){void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Z,new Z,new Z,new Z,new Z]);const o=i.get(e);void 0===o&&t(36,String(e));const s=function(t){return 7&t}(r),l=o[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.delete(n),o.every(t=>0===t.size)&&i.delete(e)}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Kl(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t)}return function(t,e){const n=Kl(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e)}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=Ss(e);t&&t.markDirty()}},null===t._pendingEditorState?{tag:_r}:void 0)}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Qs(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=Vs(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,jo(this,e,t,r,{preserveUpdateQueue:!0}),null!==e&&(this._config.disableEvents||or(e),null!=n&&e.classList.remove(...n)),null!==t){const e=sl(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,ht(this),this._updateTags.add(_r),no(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;En.set(t,n);const r=On.get(n)??0;r<1&&n.addEventListener("selectionchange",er),On.set(n,r+1),t.__lexicalEditor=e;const i=Zn(t);for(let n=0;n<vn.length;n++){const[r,o]=vn[n],s="function"==typeof o?t=>{rr(t)||(nr(t),(e.isEditable()||"click"===r)&&o(t,e))}:t=>{if(rr(t))return;nr(t);const n=e.isEditable();switch(r){case"cut":return n&&Qs(e,fn,t);case"copy":return Qs(e,un,t);case"paste":return n&&Qs(e,Ie,t);case"dragstart":return n&&Qs(e,ln,t);case"dragover":return n&&Qs(e,cn,t);case"dragend":return n&&Qs(e,an,t);case"focus":return n&&Qs(e,yn,t);case"blur":return n&&Qs(e,mn,t);case"drop":return n&&Qs(e,on,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s)})}}(t,this),null!=n&&t.classList.add(...n)}else this._window=null,this._updateTags.add(_r),no(this);ro("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=yo(e),r._selection=e._selection?e._selection.clone():null),dt(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),no(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&o.add(s),this._updating||no(this)}parseEditorState(t,e){return function(t,e,n){const r=mo(),i=Ii,o=zi,s=Li,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Ii=r,zi=!1,Li=e,Qo(null);try{const i=e._nodes;to(t.root,i),n&&n(),r._readOnly=!0}catch(t){t instanceof Error&&e._onError(t)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,Ii=i,zi=o,Li=s}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return no(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):lo(t,e,n)}(this,t,e)}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),co(this,()=>{const r=xi(),i=Os();null!==r?r.dirty||Ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),rl("focus"),il(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;null!==t&&t.blur();const e=yl(this._window);null!==e&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,ro("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}Go.version=Q;let Xo=null;function Qo(t){Xo=t}let Zo=1;function ts(){Zo=1}function es(e,n){const r=ns(e,n);return void 0===r&&t(30,n),r}function ns(t,e){return t._nodes.get(e)}const rs="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t)};function is(t){const e=document.activeElement;if(!kl(e))return!1;const n=e.nodeName;return go(Ns(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==cs(e))}function os(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!is(e)&&ls(e)===t}catch(t){return!1}}function ss(t){return t instanceof Go}function ls(t){let e=t;for(;null!=e;){const t=cs(e);if(ss(t))return t;e=tl(e)}return null}function cs(t){return t?t.__lexicalEditor:null}function as(t){return L.test(t)?"rtl":z.test(t)?"ltr":null}function us(t){return qr(t)||t.isToken()}function fs(t){return us(t)||t.isSegmented()}function ds(t){return Tl(t)&&3===t.nodeType}function hs(t){return Tl(t)&&9===t.nodeType}function gs(t){let e=t;for(;null!=e;){if(ds(e))return e;e=e.firstChild}return null}function _s(t,e,n){const r=K[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return"subscript"===e?i&=~K.superscript:"superscript"===e?i&=~K.subscript:"lowercase"===e?(i&=~K.uppercase,i&=~K.capitalize):"uppercase"===e?(i&=~K.lowercase,i&=~K.capitalize):"capitalize"===e&&(i&=~K.lowercase,i&=~K.uppercase),i}function ps(t){return Ur(t)||No(t)||go(t)}function ys(t,e){const n=function(){const t=Xo;return Xo=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);$i(),Ji();const r=Vi(),i=ji(),o=""+Zo++;i._nodeMap.set(o,t),uo(t)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),0===r._dirtyType&&(r._dirtyType=1),t.__key=o}function ms(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function xs(e){Ji(),ar(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=ji(),o=Vi(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,!1),r=t.__parent}}(r,s,l);const c=n.__key;0===o._dirtyType&&(o._dirtyType=1),uo(e)?l.set(c,!0):o._dirtyLeaves.add(c)}function Cs(t){$i();const e=Vi(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=Ss(n);null!==t&&t.getWritable()}if(null!==t){const e=Ss(t);null!==e&&e.getWritable()}}}function vs(){if(Ri())return null;return Vi()._compositionKey}function Ss(t,e){const n=(e||ji())._nodeMap.get(t);return void 0===n?null:n}function ks(t,e){const n=bs(t,Vi());return void 0!==n?Ss(n,e):null}function Ts(t,e,n){t[`__lexicalKey_${e._key}`]=n}function bs(t,e){return t[`__lexicalKey_${e._key}`]}function Ns(t,e){let n=t;for(;null!=n;){const t=ks(n,e);if(null!==t)return t;n=tl(n)}return null}function ws(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Es(t){return t.read(()=>Os().getTextContent())}function Os(){return ji()._nodeMap.get("root")}function Ms(t){$i();const e=ji();null!==t&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function As(t){const e=function(t,e){let n=t;for(;null!=n;){const t=bs(n,e);if(void 0!==t)return t;n=tl(n)}return null}(t,Vi());return null===e?null:Ss(e)}function Ds(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Ps(t){const e=[];for(let n=t;null!==n;n=n._parentEditor)e.push(n);return e}function Fs(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Is(t){return ds(t)?t.nodeValue:null}function Ls(t,e,n){const r=yl(ll(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=Is(i);const r=Ns(i);if(null!==e&&Ur(r)){if((e===A||e===P)&&n){const t=n.length;e=n,o=t,s=t}null!==e&&zs(r,e,o,s,t)}}}function zs(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let c=e;if((s||i)&&(e.endsWith(A)&&(c=e.slice(0,-A.length)),i)){const t=P;let e;for(;-1!==(e=c.indexOf(t));)c=c.slice(0,e)+c.slice(e+t.length),null!==n&&n>e&&(n=Math.max(e,n-t.length)),null!==r&&r>e&&(r=Math.max(e,r-t.length))}const u=o.getTextContent();if(i||c!==u){if(""===c){if(Cs(null),a||l||d)o.remove();else{const t=Vi();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove()})},20)}return}const e=o.getParent(),i=Ci(),u=o.getTextContentSize(),f=vs(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||ei(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=xi();if(!ei(g)||null===n||null===r)return void Ks(o,c,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=jr(o.getTextContent());o.replace(t),o=t}Ks(o,c,g)}}}function Ks(t,e,n){if(t.setTextContent(e),ei(n)){const e=t.getKey();let r=!1;for(const i of["anchor","focus"]){const o=n[i];"text"===o.type&&o.key===e&&(o.offset=_c(t,o.offset,"clamp"),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Bs(t,e,n){const r=e[n]||!1;return"any"===r||r===t[n]}function Ws(t,e){return Bs(t,e,"altKey")&&Bs(t,e,"ctrlKey")&&Bs(t,e,"shiftKey")&&Bs(t,e,"metaKey")}function Rs(t,e,n){if(!Ws(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1)return!1;if(1===t.key.length&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const $s={ctrlKey:!i,metaKey:i},Js={altKey:i,ctrlKey:!i};function js(t){return"Backspace"===t.key}function Us(t){const e=Os();if(ei(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),At(t),t}{const t=e.select(0,e.getChildrenSize());return Ms(At(t)),t}}function Vs(t,e){void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=ea(i);return n[e]=t,t}return i}function Hs(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o)}function Ys(t){const e=t.getType(),n=ji();if(n._readOnly){const t=Kl(n).get(e);return t?Array.from(t.values()):[]}const r=n._nodeMap,i=[];for(const[,n]of r)n instanceof t&&n.__type===e&&n.isAttached()&&i.push(n);return i}function qs(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function Gs(t,e){const n=t.offset;if("element"===t.type){return qs(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?qs(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Xs(t){const e=ll(t).event,n=e&&e.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Qs(t,e,n){return io(t,e,n,t)}function Zs(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function tl(t){const e=t.assignedSlot||t.parentElement;return bl(e)?e.host:e}function el(t){return hs(t)?t:kl(t)?t.ownerDocument:null}function nl(t){return Vi()._updateTags.has(t)}function rl(t){$i();Vi()._updateTags.add(t)}function il(t){$i();Vi()._deferred.push(t)}function ol(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return!0;n=n.getParent()}return!1}function sl(t){const e=el(t);return e?e.defaultView:null}function ll(e){const n=e._window;return null===n&&t(78),n}function cl(t){return uo(t)&&t.isInline()||go(t)&&t.isInline()}function al(t){let e=t.getParentOrThrow();for(;null!==e;){if(ul(e))return e;e=e.getParentOrThrow()}return e}function ul(t){return po(t)||uo(t)&&t.isShadowRoot()}function fl(t,e=!1){const n=t.constructor.clone(t);return ys(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function dl(e){const n=Vi(),r=e.getType(),i=ns(n,r);void 0===i&&t(200,e.constructor.name,r);const{replace:o,replaceWithKlass:s}=i;if(null!==o){const n=o(e),i=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function hl(e,n){!po(e.getParent())||uo(n)||go(n)||t(99)}function gl(e){const n=Ss(e);return null===n&&t(63,e),n}function _l(t){return(go(t)||uo(t)&&!t.canBeEmpty())&&!t.isInline()}function pl(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t)}function yl(t){return n?(t||window).getSelection():null}function ml(t){const e=sl(t);return e?e.getSelection():null}function xl(e,n){let r=e.getChildAtIndex(n);null==r&&(r=e),ul(e)&&t(102);const i=e=>{const n=e.getParentOrThrow(),o=ul(n),s=e!==r||o?fl(e):e;if(o)return uo(e)&&uo(s)||t(133),e.insertAfter(s),[e,s,s];{const[t,r,o]=i(n),l=e.getNextSiblings();return o.append(s,...l),[t,r,s]}},[o,s]=i(r);return[o,s]}function Cl(t){return kl(t)&&"A"===t.tagName}function vl(t){return kl(t)&&"TR"===t.tagName}function Sl(t){return kl(t)&&("TD"===t.tagName||"TH"===t.tagName)}function kl(t){return Tl(t)&&1===t.nodeType}function Tl(t){return"object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function bl(t){return Tl(t)&&11===t.nodeType}const Nl=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function wl(t){return!(!kl(t)||!t.style.display.startsWith("inline"))||Nl.test(t.nodeName)}const El=/^(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;function Ol(t){return(!kl(t)||!t.style.display.startsWith("inline"))&&El.test(t.nodeName)}function Ml(t){if(go(t)&&!t.isInline())return!0;if(!uo(t)||ul(t))return!1;const e=t.getFirstChild(),n=null===e||No(e)||Ur(e)||e.isInline();return!t.isInline()&&!1!==t.canBeEmpty()&&n}function Al(){return Vi()}function Dl(t=Al()){return t._config.dom||Vo}function Pl(e,n,r=Al()){const i=Dl(r).$getDOMSlot(e,n,r);return uo(e)&&(Fl(i)||t(344,e.getKey(),e.getType())),i}function Fl(t){return t instanceof q}function Il(t,e,n=Al()){return gs(Pl(t,e,n).element)}const Ll=new WeakMap,zl=new Map;function Kl(e){if(!e._readOnly&&e.isEmpty())return zl;e._readOnly||t(192);let n=Ll.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r)}return e}(e),Ll.set(e,n)),n}function Bl(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Wl(t){return(e=Bl(t))[cr]=!0,e;var e}function Rl(t,e){const n=t.getAttribute("data-lexical-indent");if(null!==n){const t=parseInt(n,10);if(Number.isFinite(t)&&t>=0)return void e.setIndent(t)}const r=parseInt(t.style.paddingInlineStart,10)||0,i=Math.round(r/40);e.setIndent(i)}function $l(t,e){const n=e.getAttribute("dir");return"ltr"===n||"rtl"===n?t.setDirection(n):t}function Jl(t,e){const n=e.style.textAlign;return n&&n in W?t.setFormat(n):t}function jl(t,e){t.__lexicalUnmanaged=!0,e&&void 0!==e.captureSelection&&(t.__lexicalCapturedSelection=e.captureSelection)}function Ul(t){return!0===t.__lexicalUnmanaged}function Vl(t,e){let n=t;for(;null!=n;){if(!0===n.__lexicalCapturedSelection)return!0;if(void 0!==bs(n,e))return!1;n=tl(n)}return!1}function Hl(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==fr[e]}function Yl(e){const n=U in e.prototype?e.prototype[U]():void 0,r=function(e){if(!(e===fr||e.prototype instanceof fr)){let n="<unknown>",r="<unknown>";try{n=e.getType()}catch(t){}try{Go.version&&(r=JSON.parse(Go.version))}catch(t){}t(290,e.name,n,r)}return e===ho||e===ao||e===fr}(e),i=!r&&Hl(e,"getType")?e.getType():void 0;let o,s=i;if(n)if(i)o=n[i];else for(const[t,e]of Object.entries(n))s=t,o=e;if(!r&&s&&(Hl(e,"getType")||(e.getType=()=>s),Hl(e,"clone")||(e.clone=t=>(Qo(t),new e)),Hl(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!Hl(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t)}return{ownNodeConfig:o,ownNodeType:s}}function ql(t){const e=Al();$i();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const Gl=(t,e)=>{let n=t;for(;null!=n&&!po(n);){if(e(n))return n;n=n.getParent()}return null};function Xl(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=null===n?Ss(i):n.get(i);null==e&&t(174),r.push(i),i=e.__next}return r}const Ql={next:"previous",previous:"next"};class Zl{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Nc({hasNext:cc,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return hc(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return hc(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e)}for(const e of i){if(l.size>0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else{const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e)}else null===n&&t(263,Array.from(l).join(" "))}else o.insert(e);o=hc(e,this.direction)}for(const t of l.values())t.remove();return this}}class tc extends Zl{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:yc(t,this.direction)}getParentCaret(t="root"){return hc(rc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=nc(this.direction);return hc(this.getNodeAtCaret(),t)||yc(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof tc&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const ec={root:po,shadowRoot:ul};function nc(t){return Ql[t]}function rc(t,e="root"){return ec[e](t)?null:t}class ic extends Zl{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:hc(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return uo(this.origin)?yc(this.origin,this.direction):null}getParentCaret(t="root"){return hc(rc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=nc(this.direction);return hc(this.getNodeAtCaret(),t)||yc(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof ic&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof ic||t instanceof oc)&&this.direction===t.direction&&this.origin.is(t.origin)}}class oc extends Zl{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:gc(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return hc(rc(this.getParentAtCaret(),t),this.direction)}getFlipped(){return gc(this.origin,nc(this.direction),this.offset)}isSamePointCaret(t){return t instanceof oc&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ic||t instanceof oc)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return hc(this.origin,this.direction)}}function sc(t){return t instanceof oc}function lc(t){return t instanceof Zl}function cc(t){return t instanceof ic}function ac(t){return t instanceof tc}const uc={next:class extends oc{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends oc{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},fc={next:class extends ic{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends ic{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},dc={next:class extends tc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends tc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function hc(t,e){return t?new fc[e](t):null}function gc(t,e,n){return t?new uc[e](t,_c(t,n)):null}function _c(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return(o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function pc(t,e){return new vc(t,e)}function yc(t,e){return uo(t)?new dc[e](t):null}function mc(t){return t&&t.getChildCaret()||t}function xc(t){return t&&mc(t.getAdjacentCaret())}class Cc{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new Cc(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return sc(e)?function(t,e){const{direction:n,origin:r}=t,i=_c(r,"focus"===e?nc(n):n);return pc(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return[pc(t,r.offset-t.offset),null]}return[e,n]}iterNodeCarets(t="root"){const e=sc(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=sc(n),i=e=>e.isSameNodeCaret(n)?null:xc(e)||e.getParentCaret(t);return Nc({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class vc{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return gc(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function Sc(t){return t instanceof vc}function kc(t){return bc(t,hc(Os(),t.direction))}function Tc(t){return bc(t,t)}function bc(e,n){return e.direction!==n.direction&&t(265),new Cc(e,n,e.direction)}function Nc(t){const{initial:e,hasNext:n,step:r,map:i}=t;let o=e;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const t={done:!1,value:i(o)};return o=r(o),t}}}function wc(e,n){const r=Ac(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case"same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===n.type?1:-1;case"branch":return Ec(r)}}function Ec(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let o=e,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function Oc(t,e){return e.is(t)}function Mc(t){return uo(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ac(e,n){if(e.is(n))return{commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=Mc(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,o]=Mc(n);i;o=i,i=i.getParent()){const s=r.get(i);if(void 0!==s)return null===s?(Oc(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===o?(Oc(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((uo(s)||Oc(e,s))&&(uo(o)||Oc(n,o))&&i.is(s.getParent())&&i.is(o.getParent())||t(278),{a:s,b:o,commonAncestor:i,type:"branch"})}return null}function Dc(e,n){const{type:r,key:i,offset:o}=e,s=gl(e.key);return"text"===r?(Ur(s)||t(266,s.getType(),i),gc(s,n,o)):(uo(s)||t(267,s.getType(),i),Uc(s,e.offset,n))}function Pc(e,n){const{origin:r,direction:i}=n,o="next"===i;sc(n)?e.set(r.getKey(),n.offset,"text"):cc(n)?Ur(r)?e.set(r.getKey(),_c(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(ac(n)&&uo(r)||t(268),e.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function Fc(t){const e=xi(),n=ei(e)?e:_i();return Ic(n,t),Ms(n),n}function Ic(t,e){Pc(t.anchor,e.anchor),Pc(t.focus,e.focus)}function Lc(t){const{anchor:e,focus:n}=t,r=Dc(e,"next"),i=Dc(n,"next"),o=wc(r,i)<=0?"next":"previous";return bc(Jc(r,o),Jc(i,o))}function zc(t){const{direction:e,origin:n}=t,r=hc(n,nc(e)).getNodeAtCaret();return r?hc(r,e):yc(n.getParentOrThrow(),e)}function Kc(t,e="root"){const n=[t];for(let r=ac(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(zc(r));return n}function Bc(t){return!!t&&t.origin.isAttached()}function Wc(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let o=n;const s=jc(e,i),l=Kc(s.anchor,r),c=Kc(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(ac(t))a.add(t.origin.getKey());else if(cc(t)){const{origin:e}=t;uo(e)&&!a.has(e.getKey())||u.push(e)}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=zc(hc(e,i)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===o||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){o="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=jr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=gc(n,i,e.offset)}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped())}}let f,d;for(const t of l)if(Bc(t)){f=Rc(t);break}for(const t of c)if(Bc(t)){d=Rc(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let c;for(c=0;c<l&&o[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(ul(i))return;!n&&e(i)&&(n=i)}return n},u=a(o,Ml),f=u&&a(s,t=>n.has(t.getKey())&&Ml(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;yc(t,"previous").splice(0,e.getChildren());let n=e.getParent();for(e.remove(!0);n&&n.isEmpty();){const t=n;n=n.getParent(),t.remove(!0)}}const g=[f,d,...l,...c].find(Bc);if(g){return Tc(Jc(Rc(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)))}function Rc(t){const e=function(t){let e=t;for(;ac(e);){const t=xc(e);if(!ac(t))break;e=t}return e}(t.getLatest()),{direction:n}=e;if(Ur(e.origin))return sc(e)?e:gc(e.origin,n,n);const r=e.getAdjacentCaret();return cc(r)&&Ur(r.origin)?gc(r.origin,n,nc(n)):e}function $c(t){return sc(t)&&t.offset!==_c(t.origin,t.direction)}function Jc(t,e){return t.direction===e?t:t.getFlipped()}function jc(t,e){return t.direction===e?t:bc(Jc(t.focus,e),Jc(t.anchor,e))}function Uc(t,e,n){let r=yc(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t}return Jc(r,n)}function Vc(t,e="root"){let n=0,r=t,i=xc(r);for(;null===i;){if(n--,i=r.getParentCaret(e),!i)return null;r=i,i=xc(r)}return i&&[i,n]}function Hc(e){const{origin:n,offset:r,direction:i}=e;if(r===_c(n,i))return e.getSiblingCaret();if(r===_c(n,nc(i)))return zc(e.getSiblingCaret());const[o]=n.splitText(r);return Ur(o)||t(281),Jc(hc(o,"next"),i)}function Yc(t,e){return!0}function qc(t,{$copyElementNode:e=fl,$splitTextPointCaretNext:n=Hc,rootMode:r="shadowRoot",$shouldSplit:i=Yc,removeEmptyDestination:o=!1}={}){if(sc(t))return n(t);const s=t.getParentCaret(r);if(s){const{origin:n}=s;if(ac(t)){const t=zc(s);if(o&&n.isEmpty())return n.remove(),t;if(!n.canBeEmpty()||!i(n,"first"))return t}const r=function(t){const e=[];for(let n=t.getAdjacentCaret();n;n=n.getAdjacentCaret())e.push(n.origin);return e}(t);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(e(n).splice(0,0,r))}return s}function Gc(t){return t}function Xc(...t){return t}function Qc(t,e){return[t,e]}function Zc(t){return t}function ta(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t}function ea(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function na(t,...e){const n=ea(...e);n.length>0&&t.classList.add(...n)}function ra(t,...e){const n=ea(...e);n.length>0&&t.classList.remove(...n)}function ia(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}export{rl as $addUpdateTag,dl as $applyNodeReplacement,Ui as $assumeActiveEditor,Dc as $caretFromPoint,Lc as $caretRangeFromSelection,Bl as $cloneWithProperties,Wl as $cloneWithPropertiesEphemeral,wc as $comparePointCaretNext,fl as $copyNode,ql as $create,Xl as $createChildrenArray,bo as $createLineBreakNode,pi as $createNodeSelection,Do as $createParagraphNode,Xr as $createPoint,_i as $createRangeSelection,yi as $createRangeSelectionFromDom,Yr as $createTabNode,jr as $createTextNode,kc as $extendCaretToRange,Gl as $findMatchingParent,Hi as $fullReconcile,Mi as $generateNodesFromRawText,xc as $getAdjacentChildCaret,Gs as $getAdjacentNode,Vc as $getAdjacentSiblingOrParentSiblingCaret,Jc as $getCaretInDirection,bc as $getCaretRange,jc as $getCaretRangeInDirection,oi as $getCharacterOffsets,yc as $getChildCaret,Uc as $getChildCaretAtIndex,mc as $getChildCaretOrSelf,Tc as $getCollapsedCaretRange,Ac as $getCommonAncestor,Ec as $getCommonAncestorResultBranchOrder,Pl as $getDOMSlot,Il as $getDOMTextNode,Al as $getEditor,Dl as $getEditorDOMRenderConfig,Ns as $getNearestNodeFromDOMNode,al as $getNearestRootOrShadowRoot,Ss as $getNodeByKey,gl as $getNodeByKeyOrThrow,ks as $getNodeFromDOMNode,Ci as $getPreviousSelection,Os as $getRoot,xi as $getSelection,hc as $getSiblingCaret,pt as $getState,yt as $getStateChange,Ai as $getTextContent,_c as $getTextNodeOffset,gc as $getTextPointCaret,pc as $getTextPointCaretSlice,vt as $getWritableNodeState,ol as $hasAncestor,nl as $hasUpdateTag,Ei as $insertNodes,hi as $isBlockElementNode,ac as $isChildCaret,go as $isDecoratorNode,Co as $isEditorState,Fl as $isElementDOMSlot,uo as $isElementNode,$c as $isExtendableTextPointCaret,cl as $isInlineElementOrDecoratorNode,ps as $isLeafNode,dr as $isLexicalNode,No as $isLineBreakNode,lc as $isNodeCaret,ri as $isNodeSelection,Po as $isParagraphNode,ei as $isRangeSelection,po as $isRootNode,ul as $isRootOrShadowRoot,cc as $isSiblingCaret,qr as $isTabNode,Ur as $isTextNode,sc as $isTextPointCaret,Sc as $isTextPointCaretSlice,fs as $isTokenOrSegmented,us as $isTokenOrTab,Ys as $nodesOfType,Rc as $normalizeCaret,At as $normalizeSelection__EXPERIMENTAL,il as $onUpdate,Zi as $parseSerializedNode,Wc as $removeTextFromCaretRange,zc as $rewindSiblingCaret,Us as $selectAll,Cs as $setCompositionKey,$l as $setDirectionFromDOM,Jl as $setFormatFromDOM,Pc as $setPointFromCaret,Ms as $setSelection,Fc as $setSelectionFromCaretRange,mt as $setState,qc as $splitAtPointCaretNext,xl as $splitNode,wi as $updateDOMSelection,Ic as $updateRangeSelectionFromCaretRange,So as ArtificialNode__DO_NOT_USE,we as BEFORE_INPUT_COMMAND,mn as BLUR_COMMAND,_n as CAN_REDO_COMMAND,pn as CAN_UNDO_COMMAND,s as CAN_USE_BEFORE_INPUT,n as CAN_USE_DOM,hn as CLEAR_EDITOR_COMMAND,gn as CLEAR_HISTORY_COMMAND,Ne as CLICK_COMMAND,yr as COLLABORATION_TAG,Jo as COMMAND_PRIORITY_BEFORE_CRITICAL,Bo as COMMAND_PRIORITY_BEFORE_EDITOR,$o as COMMAND_PRIORITY_BEFORE_HIGH,Wo as COMMAND_PRIORITY_BEFORE_LOW,Ro as COMMAND_PRIORITY_BEFORE_NORMAL,Ko as COMMAND_PRIORITY_CRITICAL,Fo as COMMAND_PRIORITY_EDITOR,zo as COMMAND_PRIORITY_HIGH,Io as COMMAND_PRIORITY_LOW,Lo as COMMAND_PRIORITY_NORMAL,Me as COMPOSITION_END_COMMAND,kr as COMPOSITION_END_TAG,Oe as COMPOSITION_START_COMMAND,Sr as COMPOSITION_START_TAG,Fe as CONTROLLED_TEXT_INSERTION_COMMAND,un as COPY_COMMAND,fn as CUT_COMMAND,Vo as DEFAULT_EDITOR_DOM_CONFIG,Ae as DELETE_CHARACTER_COMMAND,Ke as DELETE_LINE_COMMAND,ze as DELETE_WORD_COMMAND,an as DRAGEND_COMMAND,cn as DRAGOVER_COMMAND,ln as DRAGSTART_COMMAND,on as DROP_COMMAND,ho as DecoratorNode,ao as ElementNode,yn as FOCUS_COMMAND,sn as FORMAT_ELEMENT_COMMAND,Be as FORMAT_TEXT_COMMAND,hr as HISTORIC_TAG,_r as HISTORY_MERGE_TAG,gr as HISTORY_PUSH_TAG,nn as INDENT_CONTENT_COMMAND,Ee as INPUT_COMMAND,De as INSERT_LINE_BREAK_COMMAND,Pe as INSERT_PARAGRAPH_COMMAND,en as INSERT_TAB_COMMAND,Ml as INTERNAL_$isBlock,T as IS_ALL_FORMATTING,c as IS_ANDROID,f as IS_ANDROID_CHROME,i as IS_APPLE,d as IS_APPLE_WEBKIT,p as IS_BOLD,u as IS_CHROME,C as IS_CODE,o as IS_FIREFOX,k as IS_HIGHLIGHT,l as IS_IOS,y as IS_ITALIC,a as IS_SAFARI,m as IS_STRIKETHROUGH,v as IS_SUBSCRIPT,S as IS_SUPERSCRIPT,x as IS_UNDERLINE,Ye as KEY_ARROW_DOWN_COMMAND,Ue as KEY_ARROW_LEFT_COMMAND,Je as KEY_ARROW_RIGHT_COMMAND,He as KEY_ARROW_UP_COMMAND,Xe as KEY_BACKSPACE_COMMAND,Ze as KEY_DELETE_COMMAND,$e as KEY_DOWN_COMMAND,qe as KEY_ENTER_COMMAND,Qe as KEY_ESCAPE_COMMAND,xn as KEY_MODIFIER_COMMAND,Ge as KEY_SPACE_COMMAND,tn as KEY_TAB_COMMAND,ko as LineBreakNode,je as MOVE_TO_END,Ve as MOVE_TO_START,j as NODE_STATE_KEY,rn as OUTDENT_CONTENT_COMMAND,Ie as PASTE_COMMAND,pr as PASTE_TAG,Mo as ParagraphNode,Re as REDO_COMMAND,Le as REMOVE_TEXT_COMMAND,_o as RootNode,Te as SELECTION_CHANGE_COMMAND,be as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,dn as SELECT_ALL_COMMAND,mr as SKIP_COLLAB_TAG,Cr as SKIP_DOM_SELECTION_TAG,xr as SKIP_SCROLL_INTO_VIEW_TAG,vr as SKIP_SELECTION_FOCUS_TAG,K as TEXT_TYPE_TO_FORMAT,Hr as TabNode,Ir as TextNode,We as UNDO_COMMAND,na as addClassNamesToElement,lr as buildImportMap,Xc as configExtension,ke as createCommand,Ho as createEditor,xt as createSharedNodeState,_t as createState,Qc as declarePeerDependency,Gc as defineExtension,nc as flipDirection,el as getDOMOwnerDocument,yl as getDOMSelection,ml as getDOMSelectionFromTarget,gs as getDOMTextNode,cs as getEditorPropertyFromDOMNode,ls as getNearestEditorFromDOMNode,ns as getRegisteredNode,es as getRegisteredNodeOrThrow,Yl as getStaticNodeConfig,br as getStyleObjectFromCSS,as as getTextDirection,Uo as getTransformSetFromKlass,Ol as isBlockDomNode,Ri as isCurrentlyReadOnlyMode,Vl as isDOMCapturingSelection,hs as isDOMDocumentNode,Tl as isDOMNode,ds as isDOMTextNode,Ul as isDOMUnmanaged,bl as isDocumentFragment,Rs as isExactShortcutMatch,Cl as isHTMLAnchorElement,kl as isHTMLElement,Sl as isHTMLTableCellElement,vl as isHTMLTableRowElement,wl as isInlineDomNode,Eo as isLastChildInBlockNode,ss as isLexicalEditor,Ws as isModifierMatch,wo as isOnlyChildInBlockNode,is as isSelectionCapturedInDecoratorInput,os as isSelectionWithinEditor,Nc as makeStepwiseIterator,ia as mergeRegister,ea as normalizeClassNames,ra as removeClassNamesFromElement,ms as removeFromParent,ts as resetRandomKey,Zc as safeCast,Er as setDOMStyleFromCSS,wr as setDOMStyleObject,jl as setDOMUnmanaged,Rl as setNodeIndentFromDOM,ta as shallowMergeConfig,nr as stopLexicalPropagation,_s as toggleTextFormatType,Oi as tokenizeRawText};