403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/lexical/dev/dist/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/lexical/dev/dist/lexical.dev.bundle.min.js
this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e){"use strict";function t(e){return{type:e}}const n=t("SELECTION_CHANGE_COMMAND");const o=t("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND");const r=t("CLICK_COMMAND");const s=t("DELETE_CHARACTER_COMMAND");const i=t("INSERT_LINE_BREAK_COMMAND");const l=t("INSERT_PARAGRAPH_COMMAND");const c=t("CONTROLLED_TEXT_INSERTION_COMMAND");const a=t("PASTE_COMMAND");const u=t("REMOVE_TEXT_COMMAND");const f=t("DELETE_WORD_COMMAND");const d=t("DELETE_LINE_COMMAND");const h=t("FORMAT_TEXT_COMMAND");const g=t("UNDO_COMMAND");const _=t("REDO_COMMAND");const p=t("KEYDOWN_COMMAND");const m=t("KEY_ARROW_RIGHT_COMMAND");const N=t("MOVE_TO_END");const y=t("KEY_ARROW_LEFT_COMMAND");const C=t("MOVE_TO_START");const T=t("KEY_ARROW_UP_COMMAND");const E=t("KEY_ARROW_DOWN_COMMAND");const S=t("KEY_ENTER_COMMAND");const w=t("KEY_SPACE_COMMAND");const x=t("KEY_BACKSPACE_COMMAND");const b=t("KEY_ESCAPE_COMMAND");const O=t("KEY_DELETE_COMMAND");const M=t("KEY_TAB_COMMAND");const A=t("INSERT_TAB_COMMAND");const D=t("INDENT_CONTENT_COMMAND");const v=t("OUTDENT_CONTENT_COMMAND");const R=t("DROP_COMMAND");const k=t("FORMAT_ELEMENT_COMMAND");const I=t("DRAGSTART_COMMAND");const L=t("DRAGOVER_COMMAND");const P=t("DRAGEND_COMMAND");const $=t("COPY_COMMAND");const F=t("CUT_COMMAND");const K=t("SELECT_ALL_COMMAND");const B=t("CLEAR_EDITOR_COMMAND");const W=t("CLEAR_HISTORY_COMMAND");const z=t("CAN_REDO_COMMAND");const H=t("CAN_UNDO_COMMAND");const U=t("FOCUS_COMMAND");const Y=t("BLUR_COMMAND");const J=t("KEY_MODIFIER_COMMAND");const j=typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof window.document.createElement!=="undefined";const G=j&&"documentMode"in document?document.documentMode:null;const X=j&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);const V=j&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);const q=j&&"InputEvent"in window&&!G?"getTargetRanges"in new window.InputEvent("input"):false;const Q=j&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent);const Z=j&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const ee=j&&/Android/.test(navigator.userAgent);const te=j&&/^(?=.*Chrome).*/i.test(navigator.userAgent);const ne=j&&ee&&te;const oe=j&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!te;const re=1;const se=3;const ie=0;const le=1;const ce=2;const ae=0;const ue=1;const fe=2;const de=1;const he=1<<1;const ge=1<<2;const _e=1<<3;const pe=1<<4;const me=1<<5;const Ne=1<<6;const ye=1<<7;const Ce=de|he|ge|_e|pe|me|Ne|ye;const Te=1;const Ee=1<<1;const Se=1;const we=2;const xe=3;const be=4;const Oe=5;const Me=6;const Ae="\xa0";const De="\u200b";const ve=Q||Z||oe?Ae:De;const Re="\n\n";const ke=V?Ae:ve;const Ie="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc";const Le="A-Za-z\xc0-\xd6\xd8-\xf6"+"\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c"+"\ufe00-\ufe6f\ufefd-\uffff";const Pe=new RegExp("^[^"+Le+"]*["+Ie+"]");const $e=new RegExp("^[^"+Ie+"]*["+Le+"]");const Fe={bold:de,code:pe,highlight:ye,italic:he,strikethrough:ge,subscript:me,superscript:Ne,underline:_e};const Ke={directionless:Te,unmergeable:Ee};const Be={center:we,end:Me,justify:be,left:Se,right:xe,start:Oe};const We={[we]:"center",[Me]:"end",[be]:"justify",[Se]:"left",[xe]:"right",[Oe]:"start"};const ze={normal:ae,segmented:fe,token:ue};const He={[ae]:"normal",[fe]:"segmented",[ue]:"token"};function Ue(...e){const t=[];for(const n of e){if(n&&typeof n==="string"){for(const[e]of n.matchAll(/\S+/g)){t.push(e)}}}return t}const Ye=100;let Je=false;let je=0;function Ge(){return Je}function Xe(e){je=e.timeStamp}function Ve(e){if(je===0){eo(e).addEventListener("textInput",Xe,true)}}function qe(e,t,n){return t.__lexicalLineBreak===e||e[`__lexicalKey_${n._key}`]!==undefined}function Qe(e){return e.getEditorState().read((()=>{const e=ai();return e!==null?e.clone():null}))}function Ze(e,t,n){const o=ho(n._window);let r=null;let s=null;if(o!==null&&o.anchorNode===e){r=o.anchorOffset;s=o.focusOffset}const i=e.nodeValue;if(i!==null){Qt(t,i,r,s,false)}}function et(e,t,n){if(zs(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat()){return false}}return t.nodeType===se&&n.isAttached()}function tt(e,t,n){Je=true;const o=performance.now()-je>Ye;try{el(e,(()=>{const r=ai()||Qe(e);const s=new Map;const i=e.getRootElement();const l=e._editorState;const c=e._blockCursorElement;let a=false;let u="";for(let n=0;n<t.length;n++){const f=t[n];const d=f.type;const h=f.target;let g=Pt(h,l);if(g===null&&h!==i||sl(g)){continue}if(d==="characterData"){if(o&&Ds(g)&&et(r,h,g)){Ze(h,g,e)}}else if(d==="childList"){a=true;const t=f.addedNodes;for(let n=0;n<t.length;n++){const o=t[n];const r=Lt(o);const s=o.parentNode;if(s!=null&&o!==c&&r===null&&(o.nodeName!=="BR"||!qe(o,s,e))){if(V){const e=o.innerText||o.nodeValue;if(e){u+=e}}s.removeChild(o)}}const n=f.removedNodes;const o=n.length;if(o>0){let t=0;for(let r=0;r<o;r++){const o=n[r];if(o.nodeName==="BR"&&qe(o,h,e)||c===o){h.appendChild(o);t++}}if(o!==t){if(h===i){g=Wt(l)}s.set(h,g)}}}}if(s.size>0){for(const[t,n]of s){if(nl(n)){const o=n.getChildrenKeys();let r=t.firstChild;for(let n=0;n<o.length;n++){const s=o[n];const i=e.getElementByKey(s);if(i===null){continue}if(r==null){t.appendChild(i);r=i}else if(r!==i){t.replaceChild(i,r)}r=r.nextSibling}}else if(Ds(n)){n.markDirty()}}}const f=n.takeRecords();if(f.length>0){for(let t=0;t<f.length;t++){const n=f[t];const o=n.addedNodes;const r=n.target;for(let t=0;t<o.length;t++){const n=o[t];const s=n.parentNode;if(s!=null&&n.nodeName==="BR"&&!qe(n,r,e)){s.removeChild(n)}}}n.takeRecords()}if(r!==null){if(a){r.dirty=true;zt(r)}if(V&&Hn(e)){r.insertRawText(u)}}}))}finally{Je=false}}function nt(e){const t=e._observer;if(t!==null){const n=t.takeRecords();tt(e,n,t)}}function ot(e){Ve(e);e._observer=new MutationObserver(((t,n)=>{tt(e,t,n)}))}function rt(e,t){const n=e.__mode;const o=e.__format;const r=e.__style;const s=t.__mode;const i=t.__format;const l=t.__style;return(n===null||n===s)&&(o===null||o===i)&&(r===null||r===l)}function st(e,t){const n=e.mergeWithSibling(t);const o=Ri()._normalizedNodes;o.add(e.__key);o.add(t.__key);return n}function it(e){let t=e;if(t.__text===""&&t.isSimpleText()&&!t.isUnmergeable()){t.remove();return}let n;while((n=t.getPreviousSibling())!==null&&Ds(n)&&n.isSimpleText()&&!n.isUnmergeable()){if(n.__text===""){n.remove()}else if(rt(n,t)){t=st(n,t);break}else{break}}let o;while((o=t.getNextSibling())!==null&&Ds(o)&&o.isSimpleText()&&!o.isUnmergeable()){if(o.__text===""){o.remove()}else if(rt(t,o)){t=st(t,o);break}else{break}}}function lt(e){ct(e.anchor);ct(e.focus);return e}function ct(e){while(e.type==="element"){const t=e.getNode();const n=e.offset;let o;let r;if(n===t.getChildrenSize()){o=t.getChildAtIndex(n-1);r=true}else{o=t.getChildAtIndex(n);r=false}if(Ds(o)){e.set(o.__key,r?o.getTextContentSize():0,"text");break}else if(!nl(o)){break}e.set(o.__key,r?o.getChildrenSize():0,"element")}}let at=1;function ut(){at=1}function ft(){return""+at++}function dt(e,t){const n=e._nodes.get(t);if(n===undefined){{throw Error(`registeredNode: Type ${t} not found`)}}return n}const ht=typeof queueMicrotask==="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function gt(e){return sl(Pt(e))}function _t(e){const t=document.activeElement;if(t===null){return false}const n=t.nodeName;return sl(Pt(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&yt(t)==null)}function pt(e,t,n){const o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!_t(t)&&Nt(t)===e}catch(e){return false}}function mt(e){return e instanceof Ml}function Nt(e){let t=e;while(t!=null){const e=yt(t);if(mt(e)){return e}t=jn(t)}return null}function yt(e){return e?e.__lexicalEditor:null}function Ct(e){if(Pe.test(e)){return"rtl"}if($e.test(e)){return"ltr"}return null}function Tt(e){return e.isToken()||e.isSegmented()}function Et(e){return e.nodeType===se}function St(e){let t=e;while(t!=null){if(Et(t)){return t}t=t.firstChild}return null}function wt(e,t,n){const o=Fe[t];if(n!==null&&(e&o)===(n&o)){return e}let r=e^o;if(t==="subscript"){r&=~Fe.superscript}else if(t==="superscript"){r&=~Fe.subscript}return r}function xt(e){return Ds(e)||cs(e)||sl(e)}function bt(e,t){if(t!=null){{Ot(e,t)}e.__key=t;return}Ai();Di();const n=Ri();const o=vi();const r=ft();o._nodeMap.set(r,e);if(nl(e)){n._dirtyElements.set(r,true)}else{n._dirtyLeaves.add(r)}n._cloneNotNeeded.add(r);n._dirtyType=le;e.__key=r}function Ot(e,t){const n=Li();if(!n){return}const o=n._nodeMap.get(t);if(o&&o.constructor!==e.constructor){if(e.constructor.name!==o.constructor.name){{throw Error(`Lexical node with constructor ${e.constructor.name} attempted to re-use key from node in active editor state with constructor ${o.constructor.name}. Keys must not be re-used when the type is changed.`)}}else{{throw Error(`Lexical node with constructor ${e.constructor.name} attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.`)}}}}function Mt(e,t,n){let o=e;while(o!==null){if(n.has(o)){return}const e=t.get(o);if(e===undefined){break}n.set(o,false);o=e.__parent}}function At(e){const t=e.getParent();if(t!==null){const n=e.getWritable();const o=t.getWritable();const r=e.getPreviousSibling();const s=e.getNextSibling();if(r===null){if(s!==null){const e=s.getWritable();o.__first=s.__key;e.__prev=null}else{o.__first=null}}else{const e=r.getWritable();if(s!==null){const t=s.getWritable();t.__prev=e.__key;e.__next=t.__key}else{e.__next=null}n.__prev=null}if(s===null){if(r!==null){const e=r.getWritable();o.__last=r.__key;e.__next=null}else{o.__last=null}}else{const e=s.getWritable();if(r!==null){const t=r.getWritable();t.__next=e.__key;e.__prev=t.__key}else{e.__prev=null}n.__next=null}o.__size--;n.__parent=null}}function Dt(e){Di();const t=e.getLatest();const n=t.__parent;const o=vi();const r=Ri();const s=o._nodeMap;const i=r._dirtyElements;if(n!==null){Mt(n,s,i)}const l=t.__key;r._dirtyType=le;if(nl(e)){i.set(l,true)}else{r._dirtyLeaves.add(l)}}function vt(e){const t=e.getPreviousSibling();const n=e.getNextSibling();if(t!==null){Dt(t)}if(n!==null){Dt(n)}}function Rt(e){Ai();const t=Ri();const n=t._compositionKey;if(e!==n){t._compositionKey=e;if(n!==null){const e=It(n);if(e!==null){e.getWritable()}}if(e!==null){const t=It(e);if(t!==null){t.getWritable()}}}}function kt(){if(Mi()){return null}const e=Ri();return e._compositionKey}function It(e,t){const n=t||vi();const o=n._nodeMap.get(e);if(o===undefined){return null}return o}function Lt(e,t){const n=Ri();const o=e[`__lexicalKey_${n._key}`];if(o!==undefined){return It(o,t)}return null}function Pt(e,t){let n=e;while(n!=null){const e=Lt(n,t);if(e!==null){return e}n=jn(n)}return null}function $t(e){const t=e._decorators;const n=Object.assign({},t);e._pendingDecorators=n;return n}function Ft(e){return e.read((()=>Bt().getTextContent()))}function Kt(e,t){el(e,(()=>{const e=vi();if(e.isEmpty()){return}if(t==="root"){Bt().markDirty();return}const n=e._nodeMap;for(const[,e]of n){e.markDirty()}}),e._pendingEditorState===null?{tag:"history-merge"}:undefined)}function Bt(){return Wt(vi())}function Wt(e){return e._nodeMap.get("root")}function zt(e){Ai();const t=vi();if(e!==null){{if(Object.isFrozen(e)){{throw Error(`$setSelection called on frozen selection object. Ensure selection is cloned before passing in.`)}}}e.dirty=true;e.setCachedNodes(null)}t._selection=e}function Ht(){Ai();const e=Ri();nt(e)}function Ut(e){const t=Ri();const n=Jt(e,t);if(n===null){const n=t.getRootElement();if(e===n){return It("root")}return null}return It(n)}function Yt(e,t){return t?e.getTextContentSize():0}function Jt(e,t){let n=e;while(n!=null){const e=n[`__lexicalKey_${t._key}`];if(e!==undefined){return e}n=jn(n)}return null}function jt(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Gt(e){const t=[];let n=e;while(n!==null){t.push(n);n=n._parentEditor}return t}function Xt(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Vt(e){if(e.nodeType===se){return e.nodeValue}return null}function qt(e,t,n){const o=ho(t._window);if(o===null){return}const r=o.anchorNode;let{anchorOffset:s,focusOffset:i}=o;if(r!==null){let t=Vt(r);const o=Pt(r);if(t!==null&&Ds(o)){if(t===ve&&n){const e=n.length;t=n;s=e;i=e}if(t!==null){Qt(o,t,s,i,e)}}}}function Qt(e,t,n,o,r){let s=e;if(s.isAttached()&&(r||!s.isDirty())){const i=s.isComposing();let l=t;if((i||r)&&t[t.length-1]===ve){l=t.slice(0,-1)}const c=s.getTextContent();if(r||l!==c){if(l===""){Rt(null);if(!Q&&!Z&&!oe){const e=Ri();setTimeout((()=>{e.update((()=>{if(s.isAttached()){s.remove()}}))}),20)}else{s.remove()}return}const t=s.getParent();const r=ui();const c=s.getTextContentSize();const a=kt();const u=s.getKey();if(s.isToken()||a!==null&&u===a&&!i||zs(r)&&(t!==null&&!t.canInsertTextBefore()&&r.anchor.offset===0||r.anchor.key===e.__key&&r.anchor.offset===0&&!s.canInsertTextBefore()&&!i||r.focus.key===e.__key&&r.focus.offset===c&&!s.canInsertTextAfter()&&!i)){s.markDirty();return}const f=ai();if(!zs(f)||n===null||o===null){s.setTextContent(l);return}f.setTextNodeRange(s,n,s,o);if(s.isSegmented()){const e=s.getTextContent();const t=As(e);s.replace(t);s=t}s.setTextContent(l)}}}function Zt(e){const t=e.getPreviousSibling();return(Ds(t)||nl(t)&&t.isInline())&&!t.canInsertTextAfter()}function en(e,t){if(t.isSegmented()){return true}if(!e.isCollapsed()){return false}const n=e.anchor.offset;const o=t.getParentOrThrow();const r=t.isToken();if(n===0){return!t.canInsertTextBefore()||!o.canInsertTextBefore()&&!t.isComposing()||r||Zt(t)}else if(n===t.getTextContentSize()){return!t.canInsertTextAfter()||!o.canInsertTextAfter()&&!t.isComposing()||r}else{return false}}function tn(e,t,n,o){return e==="Tab"&&!t&&!n&&!o}function nn(e,t,n,o){return e.toLowerCase()==="b"&&!t&&vn(n,o)}function on(e,t,n,o){return e.toLowerCase()==="i"&&!t&&vn(n,o)}function rn(e,t,n,o){return e.toLowerCase()==="u"&&!t&&vn(n,o)}function sn(e,t){return Rn(e)&&!t}function ln(e,t){return Rn(e)&&t}function cn(e,t){return X&&t&&e.toLowerCase()==="o"}function an(e,t,n){return kn(e)&&(X?t:n)}function un(e,t,n){return Ln(e)&&(X?t:n)}function fn(e,t){return X&&t&&kn(e)}function dn(e,t){return X&&t&&Ln(e)}function hn(e,t,n,o){if(X){if(t||n){return false}return kn(e)||e.toLowerCase()==="h"&&o}if(o||t||n){return false}return kn(e)}function gn(e,t,n,o,r){if(X){if(n||o||r){return false}return Ln(e)||e.toLowerCase()==="d"&&t}if(t||o||r){return false}return Ln(e)}function _n(e,t,n,o){return e.toLowerCase()==="z"&&!t&&vn(n,o)}function pn(e,t,n,o){if(X){return e.toLowerCase()==="z"&&n&&t}return e.toLowerCase()==="y"&&o||e.toLowerCase()==="z"&&o&&t}function mn(e,t,n,o){if(t){return false}if(e.toLowerCase()==="c"){return X?n:o}return false}function Nn(e,t,n,o){if(t){return false}if(e.toLowerCase()==="x"){return X?n:o}return false}function yn(e){return e==="ArrowLeft"}function Cn(e){return e==="ArrowRight"}function Tn(e){return e==="ArrowUp"}function En(e){return e==="ArrowDown"}function Sn(e,t,n,o){return yn(e)&&!t&&!o&&!n}function wn(e,t,n,o,r){return yn(e)&&!o&&!n&&(t||r)}function xn(e,t,n,o){return Cn(e)&&!t&&!o&&!n}function bn(e,t,n,o,r){return Cn(e)&&!o&&!n&&(t||r)}function On(e,t,n){return Tn(e)&&!t&&!n}function Mn(e,t,n){return En(e)&&!t&&!n}function An(e,t,n,o){return e||t||n||o}function Dn(e){return e===" "}function vn(e,t){if(X){return e}return t}function Rn(e){return e==="Enter"}function kn(e){return e==="Backspace"}function In(e){return e==="Escape"}function Ln(e){return e==="Delete"}function Pn(e,t,n){return e.toLowerCase()==="a"&&vn(t,n)}function $n(){const e=Bt();const t=e.select(0,e.getChildrenSize());zt(lt(t))}function Fn(e,t){if(e.__lexicalClassNameCache===undefined){e.__lexicalClassNameCache={}}const n=e.__lexicalClassNameCache;const o=n[t];if(o!==undefined){return o}const r=e[t];if(typeof r==="string"){const e=Ue(r);n[t]=e;return e}return r}function Kn(e,t,n,o,r){if(n.size===0){return}const s=o.__type;const i=o.__key;const l=t.get(s);if(l===undefined){{throw Error(`Type ${s} not in registeredNodes`)}}const c=l.klass;let a=e.get(c);if(a===undefined){a=new Map;e.set(c,a)}const u=a.get(i);const f=u==="destroyed"&&r==="created";if(u===undefined||f){a.set(i,f?"updated":r)}}function Bn(e){const t=e.getType();const n=vi();if(n._readOnly){const e=wo(n).get(t);return e?Array.from(e.values()):[]}const o=n._nodeMap;const r=[];for(const[,n]of o){if(n instanceof e&&n.__type===t&&n.isAttached()){r.push(n)}}return r}function Wn(e,t,n){const o=e.getParent();let r=n;let s=e;if(o!==null){if(t&&n===0){r=s.getIndexWithinParent();s=o}else if(!t&&n===s.getChildrenSize()){r=s.getIndexWithinParent()+1;s=o}}return s.getChildAtIndex(t?r-1:r)}function zn(e,t){const n=e.offset;if(e.type==="element"){const o=e.getNode();return Wn(o,t,n)}else{const o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){const e=t?o.getPreviousSibling():o.getNextSibling();if(e===null){return Wn(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1))}return e}}return null}function Hn(e){const t=eo(e).event;const n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Un(e,t,n){return Xi(e,t,n)}function Yn(e){return!cl(e)&&!e.isLastChild()&&!e.isInline()}function Jn(e,t){const n=e._keyToDOMMap.get(t);if(n===undefined){{throw Error(`Reconciliation: could not find DOM element for node key ${t}`)}}return n}function jn(e){const t=e.assignedSlot||e.parentElement;return t!==null&&t.nodeType===11?t.host:t}function Gn(e,t,n){const o=n.ownerDocument;const r=o.defaultView;if(r===null){return}let{top:s,bottom:i}=t;let l=0;let c=0;let a=n;while(a!==null){const t=a===o.body;if(t){l=0;c=eo(e).innerHeight}else{const e=a.getBoundingClientRect();l=e.top;c=e.bottom}let n=0;if(s<l){n=-(l-s)}else if(i>c){n=i-c}if(n!==0){if(t){r.scrollBy(0,n)}else{const e=a.scrollTop;a.scrollTop+=n;const t=a.scrollTop-e;s-=t;i-=t}}if(t){break}a=jn(a)}}function Xn(e){const t=Ri();return t._updateTags.has(e)}function Vn(e){Ai();const t=Ri();t._updateTags.add(e)}function qn(e){const t=ai();if(!zs(t)||!nl(e)){return t}const{anchor:n,focus:o}=t;const r=n.getNode();const s=o.getNode();if(Qn(r,e)){n.set(e.__key,0,"element")}if(Qn(s,e)){o.set(e.__key,0,"element")}return t}function Qn(e,t){let n=e.getParent();while(n!==null){if(n.is(t)){return true}n=n.getParent()}return false}function Zn(e){const t=e.ownerDocument;return t&&t.defaultView||null}function eo(e){const t=e._window;if(t===null){{throw Error(`window object not found`)}}return t}function to(e){return nl(e)&&e.isInline()||sl(e)&&e.isInline()}function no(e){let t=e.getParentOrThrow();while(t!==null){if(oo(t)){return t}t=t.getParentOrThrow()}return t}function oo(e){return cl(e)||nl(e)&&e.isShadowRoot()}function ro(e){const t=e.constructor.clone(e);bt(t,null);return t}function so(e){const t=Ri();const n=e.constructor.getType();const o=t._nodes.get(n);if(o===undefined){{throw Error(`$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.`)}}const r=o.replace;if(r!==null){const t=r(e);if(!(t instanceof e.constructor)){{throw Error(`$initializeNode failed. Ensure replacement node is a subclass of the original node.`)}}return t}return e}function io(e,t){const n=e.getParent();if(cl(n)&&!nl(t)&&!sl(t)){{throw Error(`Only element or decorator nodes can be inserted in to the root node`)}}}function lo(e){const t=It(e);if(t===null){{throw Error(`Expected node with key ${e} to exist but it's not in the nodeMap.`)}}return t}function co(e){const t=e.theme;const n=document.createElement("div");n.contentEditable="false";n.setAttribute("data-lexical-cursor","true");let o=t.blockCursor;if(o!==undefined){if(typeof o==="string"){const e=Ue(o);o=t.blockCursor=e}if(o!==undefined){n.classList.add(...o)}}return n}function ao(e){return(sl(e)||nl(e)&&!e.canBeEmpty())&&!e.isInline()}function uo(e,t,n){n.style.removeProperty("caret-color");t._blockCursorElement=null;const o=e.parentElement;if(o!==null){o.removeChild(e)}}function fo(e,t,n){let o=e._blockCursorElement;if(zs(n)&&n.isCollapsed()&&n.anchor.type==="element"&&t.contains(document.activeElement)){const r=n.anchor;const s=r.getNode();const i=r.offset;const l=s.getChildrenSize();let c=false;let a=null;if(i===l){const e=s.getChildAtIndex(i-1);if(ao(e)){c=true}}else{const t=s.getChildAtIndex(i);if(ao(t)){const n=t.getPreviousSibling();if(n===null||ao(n)){c=true;a=e.getElementByKey(t.__key)}}}if(c){const n=e.getElementByKey(s.__key);if(o===null){e._blockCursorElement=o=co(e._config)}t.style.caretColor="transparent";if(a===null){n.appendChild(o)}else{n.insertBefore(o,a)}return}}if(o!==null){uo(o,e,t)}}function ho(e){return!j?null:(e||window).getSelection()}function go(e,t){let n=e.getChildAtIndex(t);if(n==null){n=e}if(!!oo(e)){throw Error(`Can not call $splitNode() on root element`)}const o=e=>{const t=e.getParentOrThrow();const r=oo(t);const s=e===n&&!r?e:ro(e);if(r){if(!(nl(e)&&nl(s))){throw Error(`Children of a root must be ElementNode`)}e.insertAfter(s);return[e,s,s]}else{const[n,r,i]=o(t);const l=e.getNextSiblings();i.append(s,...l);return[n,r,s]}};const[r,s]=o(n);return[r,s]}function _o(e){return po(e)&&e.tagName==="A"}function po(e){return e.nodeType===1}function mo(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function No(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function yo(e){if(cl(e)||sl(e)&&!e.isInline()){return true}if(!nl(e)||oo(e)){return false}const t=e.getFirstChild();const n=t===null||cs(t)||Ds(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==false&&n}function Co(e,t){let n=e;while(n!==null&&n.getParent()!==null&&!t(n)){n=n.getParentOrThrow()}return t(n)?n:null}function To(){return Ri()}const Eo=new WeakMap;const So=new Map;function wo(e){if(!e._readOnly&&e.isEmpty()){return So}if(!e._readOnly){throw Error(`getCachedTypeToNodeMap called with a writable EditorState`)}let t=Eo.get(e);if(!t){t=new Map;Eo.set(e,t);for(const[n,o]of e._nodeMap){const e=o.__type;let r=t.get(e);if(!r){r=new Map;t.set(e,r)}r.set(n,o)}}return t}function xo(e){const t=e.constructor;const n=t.clone(e);n.afterCloneFrom(e);{if(!(n.__key===e.__key)){throw Error(`$cloneWithProperties: ${t.name}.clone(node) (with type '${t.getType()}') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor`)}if(!(n.__parent===e.__parent&&n.__next===e.__next&&n.__prev===e.__prev)){throw Error(`$cloneWithProperties: ${t.name}.clone(node) (with type '${t.getType()}') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)`)}}return n}function bo(e,t){const n=e._decorators;const o=e._pendingDecorators;let r=o||n;const s=t._nodeMap;let i;for(i in r){if(!s.has(i)){if(r===n){r=$t(e)}delete r[i]}}}function Oo(e,t,n,o,r,s){let i=e.getFirstChild();while(i!==null){const e=i.__key;if(i.__parent===t){if(nl(i)){Oo(i,e,n,o,r,s)}if(!n.has(e)){s.delete(e)}r.push(e)}i=i.getNextSibling()}}function Mo(e,t,n,o){const r=e._nodeMap;const s=t._nodeMap;const i=[];for(const[e]of o){const t=s.get(e);if(t!==undefined){if(!t.isAttached()){if(nl(t)){Oo(t,e,r,s,i,o)}if(!r.has(e)){o.delete(e)}i.push(e)}}}for(const e of i){s.delete(e)}for(const e of n){const t=s.get(e);if(t!==undefined&&!t.isAttached()){if(!r.has(e)){n.delete(e)}s.delete(e)}}}let Ao="";let Do="";let vo=null;let Ro="";let ko="";let Io;let Lo;let Po;let $o=false;let Fo=false;let Ko;let Bo=null;let Wo;let zo;let Ho;let Uo;let Yo;let Jo;function jo(e,t){const n=Ho.get(e);if(t!==null){const n=mr(e);if(n.parentNode===t){t.removeChild(n)}}if(!Uo.has(e)){Lo._keyToDOMMap.delete(e)}if(nl(n)){const e=cr(n,Ho);Go(e,0,e.length-1,null)}if(n!==undefined){Kn(Jo,Po,Ko,n,"destroyed")}}function Go(e,t,n,o){let r=t;for(;r<=n;++r){const t=e[r];if(t!==undefined){jo(t,o)}}}function Xo(e,t){e.setProperty("text-align",t)}const Vo="40px";function qo(e,t){const n=Io.theme.indent;if(typeof n==="string"){const o=e.classList.contains(n);if(t>0&&!o){e.classList.add(n)}else if(t<1&&o){e.classList.remove(n)}}const o=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Vo;e.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * ${o})`)}function Qo(e,t){const n=e.style;if(t===0){Xo(n,"")}else if(t===Se){Xo(n,"left")}else if(t===we){Xo(n,"center")}else if(t===xe){Xo(n,"right")}else if(t===be){Xo(n,"justify")}else if(t===Oe){Xo(n,"start")}else if(t===Me){Xo(n,"end")}}function Zo(e,t,n){const o=Uo.get(e);if(o===undefined){{throw Error(`createNode: node does not exist in nodeMap`)}}const r=o.createDOM(Io,Lo);pr(e,r,Lo);if(Ds(o)){r.setAttribute("data-lexical-text","true")}else if(sl(o)){r.setAttribute("data-lexical-decorator","true")}if(nl(o)){const e=o.__indent;const t=o.__size;if(e!==0){qo(r,e)}if(t!==0){const e=t-1;const n=cr(o,Uo);er(n,e,o,r)}const n=o.__format;if(n!==0){Qo(r,n)}if(!o.isInline()){or(null,o,r)}if(Yn(o)){Ao+=Re;ko+=Re}}else{const t=o.getTextContent();if(sl(o)){const t=o.decorate(Lo,Io);if(t!==null){fr(e,t)}r.contentEditable="false"}else if(Ds(o)){if(!o.isDirectionless()){Do+=t}}Ao+=t;ko+=t}if(t!==null){if(n!=null){t.insertBefore(r,n)}else{const e=t.__lexicalLineBreak;if(e!=null){t.insertBefore(r,e)}else{t.appendChild(r)}}}{Object.freeze(o)}Kn(Jo,Po,Ko,o,"created");return r}function er(e,t,n,o){const r=Do;Do="";tr(e,n,0,t,o,null);ir(n,o);Do=r}function tr(e,t,n,o,r,s){const i=Ao;Ao="";let l=n;for(;l<=o;++l){Zo(e[l],r,s);const t=Uo.get(e[l]);if(t!==null&&Ds(t)){if(vo===null){vo=t.getFormat()}if(Ro===""){Ro=t.getStyle()}}}if(Yn(t)){Ao+=Re}r.__lexicalTextContent=Ao;Ao=i+Ao}function nr(e,t){const n=t.get(e);return cs(n)||sl(n)&&n.isInline()}function or(e,t,n){const o=e!==null&&(e.__size===0||nr(e.__last,Ho));const r=t.__size===0||nr(t.__last,Uo);if(o){if(!r){const e=n.__lexicalLineBreak;if(e!=null){try{n.removeChild(e)}catch(t){if(typeof t==="object"&&t!=null){const o=`${t.toString()} Parent: ${n.tagName}, child: ${e.tagName}.`;throw new Error(o)}else{throw t}}}n.__lexicalLineBreak=null}}else if(r){const e=document.createElement("br");n.__lexicalLineBreak=e;n.appendChild(e)}}function rr(e){if(Nl(e)&&vo!=null&&vo!==e.__textFormat&&!Fo){e.setTextFormat(vo);e.setTextStyle(Ro)}}function sr(e){if(Nl(e)&&Ro!==""&&Ro!==e.__textStyle&&!Fo){e.setTextStyle(Ro)}}function ir(e,t){const n=t.__lexicalDirTextContent;const o=t.__lexicalDir;if(n!==Do||o!==Bo){const n=Do==="";const r=n?Bo:Ct(Do);if(r!==o){const s=t.classList;const i=Io.theme;let l=o!==null?i[o]:undefined;let c=r!==null?i[r]:undefined;if(l!==undefined){if(typeof l==="string"){const e=Ue(l);l=i[o]=e}s.remove(...l)}if(r===null||n&&r==="ltr"){t.removeAttribute("dir")}else{if(c!==undefined){if(typeof c==="string"){const e=Ue(c);c=i[r]=e}if(c!==undefined){s.add(...c)}}t.dir=r}if(!Fo){const t=e.getWritable();t.__dir=r}}Bo=r;t.__lexicalDirTextContent=Do;t.__lexicalDir=r}}function lr(e,t,n){const o=Do;Do="";vo=null;Ro="";ar(e,t,n);ir(t,n);rr(t);sr(t);Do=o}function cr(e,t){const n=[];let o=e.__first;while(o!==null){const e=t.get(o);if(e===undefined){{throw Error(`createChildrenArray: node does not exist in nodeMap`)}}n.push(o);o=e.__next}return n}function ar(e,t,n){const o=Ao;const r=e.__size;const s=t.__size;Ao="";if(r===1&&s===1){const o=e.__first;const r=t.__first;if(o===r){ur(o,n)}else{const e=mr(o);const t=Zo(r,null,null);try{n.replaceChild(t,e)}catch(s){if(typeof s==="object"&&s!=null){const i=`${s.toString()} Parent: ${n.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${o}}.`;throw new Error(i)}else{throw s}}jo(o,null)}const s=Uo.get(r);if(Ds(s)){if(vo===null){vo=s.getFormat()}if(Ro===""){Ro=s.getStyle()}}}else{const o=cr(e,Ho);const i=cr(t,Uo);if(r===0){if(s!==0){tr(i,t,0,s-1,n,null)}}else if(s===0){if(r!==0){const e=n.__lexicalLineBreak;const t=e==null;Go(o,0,r-1,t?null:n);if(t){n.textContent=""}}}else{gr(t,o,i,r,s,n)}}if(Yn(t)){Ao+=Re}n.__lexicalTextContent=Ao;Ao=o+Ao}function ur(e,t){const n=Ho.get(e);let o=Uo.get(e);if(n===undefined||o===undefined){{throw Error(`reconcileNode: prevNode or nextNode does not exist in nodeMap`)}}const r=$o||zo.has(e)||Wo.has(e);const s=Jn(Lo,e);if(n===o&&!r){if(nl(n)){const e=s.__lexicalTextContent;if(e!==undefined){Ao+=e;ko+=e}const t=s.__lexicalDirTextContent;if(t!==undefined){Do+=t}}else{const e=n.getTextContent();if(Ds(n)&&!n.isDirectionless()){Do+=e}ko+=e;Ao+=e}return s}if(n!==o&&r){Kn(Jo,Po,Ko,o,"updated")}if(o.updateDOM(n,s,Io)){const n=Zo(e,null,null);if(t===null){{throw Error(`reconcileNode: parentDOM is null`)}}t.replaceChild(n,s);jo(e,null);return n}if(nl(n)&&nl(o)){const e=o.__indent;if(e!==n.__indent){qo(s,e)}const t=o.__format;if(t!==n.__format){Qo(s,t)}if(r){lr(n,o,s);if(!cl(o)&&!o.isInline()){or(n,o,s)}}if(Yn(o)){Ao+=Re;ko+=Re}}else{const t=o.getTextContent();if(sl(o)){const t=o.decorate(Lo,Io);if(t!==null){fr(e,t)}}else if(Ds(o)&&!o.isDirectionless()){Do+=t}Ao+=t;ko+=t}if(!Fo&&cl(o)&&o.__cachedText!==ko){const e=o.getWritable();e.__cachedText=ko;o=e}{Object.freeze(o)}return s}function fr(e,t){let n=Lo._pendingDecorators;const o=Lo._decorators;if(n===null){if(o[e]===t){return}n=$t(Lo)}n[e]=t}function dr(e){return e.firstChild}function hr(e){let t=e.nextSibling;if(t!==null&&t===Lo._blockCursorElement){t=t.nextSibling}return t}function gr(e,t,n,o,r,s){const i=o-1;const l=r-1;let c;let a;let u=dr(s);let f=0;let d=0;while(f<=i&&d<=l){const e=t[f];const o=n[d];if(e===o){u=hr(ur(o,s));f++;d++}else{if(c===undefined){c=new Set(t)}if(a===undefined){a=new Set(n)}const r=a.has(e);const i=c.has(o);if(!r){u=hr(mr(e));jo(e,s);f++}else if(!i){Zo(o,s,u);d++}else{const e=Jn(Lo,o);if(e===u){u=hr(ur(o,s))}else{if(u!=null){s.insertBefore(e,u)}else{s.appendChild(e)}ur(o,s)}f++;d++}}const r=Uo.get(o);if(r!==null&&Ds(r)){if(vo===null){vo=r.getFormat()}if(Ro===""){Ro=r.getStyle()}}}const h=f>i;const g=d>l;if(h&&!g){const t=n[l+1];const o=t===undefined?null:Lo.getElementByKey(t);tr(n,e,d,l,s,o)}else if(g&&!h){Go(t,f,i,s)}}function _r(e,t,n,o,r,s){Ao="";ko="";Do="";$o=o===ce;Bo=null;Lo=n;Io=n._config;Po=n._nodes;Ko=Lo._listeners.mutation;Wo=r;zo=s;Ho=e._nodeMap;Uo=t._nodeMap;Fo=t._readOnly;Yo=new Map(n._keyToDOMMap);const i=new Map;Jo=i;ur("root",null);Lo=undefined;Po=undefined;Wo=undefined;zo=undefined;Ho=undefined;Uo=undefined;Io=undefined;Yo=undefined;Jo=undefined;return i}function pr(e,t,n){const o=n._keyToDOMMap;t["__lexicalKey_"+n._key]=e;o.set(e,t)}function mr(e){const t=Yo.get(e);if(t===undefined){{throw Error(`Reconciliation: could not find DOM element for node key ${e}`)}}return t}const Nr=Object.freeze({});const yr=30;const Cr=[["keydown",Ur],["pointerdown",Lr],["compositionstart",Wr],["compositionend",Hr],["input",Br],["click",Ir],["cut",Nr],["copy",Nr],["dragstart",Nr],["dragover",Nr],["dragend",Nr],["paste",Nr],["focus",Nr],["blur",Nr],["drop",Nr]];if(q){Cr.push(["beforeinput",(e,t)=>Kr(e,t)])}let Tr=0;let Er=null;let Sr=0;let wr=null;const xr=new WeakMap;let br=false;let Or=false;let Mr=false;let Ar=false;let Dr=[0,"",0,"root",0];function vr(e,t,n,o,r){const s=e.anchor;const i=e.focus;const l=s.getNode();const c=Ri();const a=ho(c._window);const u=a!==null?a.anchorNode:null;const f=s.key;const d=c.getElementByKey(f);const h=n.length;return f!==i.key||!Ds(l)||(!r&&(!q||Sr<o+50)||l.isDirty()&&h<2||jt(n))&&s.offset!==i.offset&&!l.isComposing()||Tt(l)||l.isDirty()&&h>1||(r||!q)&&d!==null&&!l.isComposing()&&u!==St(d)||a!==null&&t!==null&&(!t.collapsed||t.startContainer!==a.anchorNode||t.startOffset!==a.anchorOffset)||l.getFormat()!==e.format||l.getStyle()!==e.style||en(e,l)}function Rr(e,t){return e!==null&&e.nodeValue!==null&&e.nodeType===se&&t!==0&&t!==e.nodeValue.length}function kr(e,t,o){const{anchorNode:r,anchorOffset:s,focusNode:i,focusOffset:l}=e;if(br){br=false;if(Rr(r,s)&&Rr(i,l)){return}}el(t,(()=>{if(!o){zt(null);return}if(!pt(t,r,i)){return}const c=ai();if(zs(c)){const n=c.anchor;const o=n.getNode();if(c.isCollapsed()){if(e.type==="Range"&&e.anchorNode===e.focusNode){c.dirty=true}const r=eo(t).event;const s=r?r.timeStamp:performance.now();const[i,l,a,u,f]=Dr;const d=Bt();const h=t.isComposing()===false&&d.getTextContent()==="";if(s<f+200&&n.offset===a&&n.key===u){c.format=i;c.style=l}else{if(n.type==="text"){if(!Ds(o)){throw Error(`Point.getNode() must return TextNode when type is text`)}c.format=o.getFormat();c.style=o.getStyle()}else if(n.type==="element"&&!h){const e=n.getNode();c.style="";if(e instanceof _l&&e.getChildrenSize()===0){c.format=e.getTextFormat();c.style=e.getTextStyle()}else{c.format=0}}}}else{const e=n.key;const t=c.focus;const o=t.key;const r=c.getNodes();const i=r.length;const a=c.isBackward();const u=a?l:s;const f=a?s:l;const d=a?o:e;const h=a?e:o;let g=Ce;let _=false;for(let e=0;e<i;e++){const t=r[e];const n=t.getTextContentSize();if(Ds(t)&&n!==0&&!(e===0&&t.__key===d&&u===n||e===i-1&&t.__key===h&&f===0)){_=true;g&=t.getFormat();if(g===0){break}}}c.format=_?g:0}}Un(t,n,undefined)}))}function Ir(e,t){el(t,(()=>{const n=ai();const o=ho(t._window);const s=ui();if(o){if(zs(n)){const t=n.anchor;const r=t.getNode();if(t.type==="element"&&t.offset===0&&n.isCollapsed()&&!cl(r)&&Bt().getChildrenSize()===1&&r.getTopLevelElementOrThrow().isEmpty()&&s!==null&&n.is(s)){o.removeAllRanges();n.dirty=true}else if(e.detail===3&&!n.isCollapsed()){const e=n.focus;const t=e.getNode();if(r!==t){if(nl(r)){r.select(0)}else{r.getParentOrThrow().select(0)}}}}else if(e.pointerType==="touch"){const n=o.anchorNode;if(n!==null){const r=n.nodeType;if(r===re||r===se){const n=ci(s,o,t,e);zt(n)}}}}Un(t,r,e)}))}function Lr(e,t){const n=e.target;const o=e.pointerType;if(n instanceof Node&&o!=="touch"){el(t,(()=>{if(!gt(n)){Or=true}}))}}function Pr(e){if(!e.getTargetRanges){return null}const t=e.getTargetRanges();if(t.length===0){return null}return t[0]}function $r(e,t){return e!==t||nl(e)||nl(t)||!e.isToken()||!t.isToken()}function Fr(e){return Er==="MediaLast"&&e<Tr+yr}function Kr(e,t){const n=e.inputType;const o=Pr(e);if(n==="deleteCompositionText"||V&&Hn(t)){return}else if(n==="insertCompositionText"){return}el(t,(()=>{const r=ai();if(n==="deleteContentBackward"){if(r===null){const e=ui();if(!zs(e)){return}zt(e.clone())}if(zs(r)){const n=r.anchor.key===r.focus.key;if(Fr(e.timeStamp)&&t.isComposing()&&n){Rt(null);Tr=0;setTimeout((()=>{el(t,(()=>{Rt(null)}))}),yr);if(zs(r)){const e=r.anchor.getNode();e.markDirty();r.format=e.getFormat();if(!Ds(e)){throw Error(`Anchor node must be a TextNode`)}r.style=e.getStyle()}}else{Rt(null);e.preventDefault();const o=r.anchor.getNode().getTextContent();const i=r.anchor.offset===0&&r.focus.offset===o.length;const l=ne&&n&&!i;if(!l){Un(t,s,true)}}return}}if(!zs(r)){return}const p=e.data;if(wr!==null){qt(false,t,wr)}if((!r.dirty||wr!==null)&&r.isCollapsed()&&!cl(r.anchor.getNode())&&o!==null){r.applyDOMRange(o)}wr=null;const m=r.anchor;const N=r.focus;const y=m.getNode();const C=N.getNode();if(n==="insertText"||n==="insertTranspose"){if(p==="\n"){e.preventDefault();Un(t,i,false)}else if(p===Re){e.preventDefault();Un(t,l,undefined)}else if(p==null&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault();r.insertRawText(t)}else if(p!=null&&vr(r,o,p,e.timeStamp,true)){e.preventDefault();Un(t,c,p)}else{wr=p}Sr=e.timeStamp;return}e.preventDefault();switch(n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":{Un(t,c,e);break}case"insertFromComposition":{Rt(null);Un(t,c,e);break}case"insertLineBreak":{Rt(null);Un(t,i,false);break}case"insertParagraph":{Rt(null);if(Mr&&!Z){Mr=false;Un(t,i,false)}else{Un(t,l,undefined)}break}case"insertFromPaste":case"insertFromPasteAsQuotation":{Un(t,a,e);break}case"deleteByComposition":{if($r(y,C)){Un(t,u,e)}break}case"deleteByDrag":case"deleteByCut":{Un(t,u,e);break}case"deleteContent":{Un(t,s,false);break}case"deleteWordBackward":{Un(t,f,true);break}case"deleteWordForward":{Un(t,f,false);break}case"deleteHardLineBackward":case"deleteSoftLineBackward":{Un(t,d,true);break}case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":{Un(t,d,false);break}case"formatStrikeThrough":{Un(t,h,"strikethrough");break}case"formatBold":{Un(t,h,"bold");break}case"formatItalic":{Un(t,h,"italic");break}case"formatUnderline":{Un(t,h,"underline");break}case"historyUndo":{Un(t,g,undefined);break}case"historyRedo":{Un(t,_,undefined);break}}}))}function Br(e,t){e.stopPropagation();el(t,(()=>{const n=ai();const o=e.data;const r=Pr(e);if(o!=null&&zs(n)&&vr(n,r,o,e.timeStamp,false)){if(Ar){zr(t,o);Ar=false}const r=n.anchor;const s=r.getNode();const i=ho(t._window);if(i===null){return}const l=n.isBackward();const a=l?n.anchor.offset:n.focus.offset;const u=l?n.focus.offset:n.anchor.offset;if(!q||n.isCollapsed()||!Ds(s)||i.anchorNode===null||s.getTextContent().slice(0,a)+o+s.getTextContent().slice(a+u)!==Vt(i.anchorNode)){Un(t,c,o)}const f=o.length;if(V&&f>1&&e.inputType==="insertCompositionText"&&!t.isComposing()){n.anchor.offset-=f}if(!Q&&!Z&&!oe&&t.isComposing()){Tr=0;Rt(null)}}else{const e=o!==null?o:undefined;qt(false,t,e);if(Ar){zr(t,o||undefined);Ar=false}}Ht()}));wr=null}function Wr(e,t){el(t,(()=>{const n=ai();if(zs(n)&&!t.isComposing()){const o=n.anchor;const r=n.anchor.getNode();Rt(o.key);if(e.timeStamp<Tr+yr||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ds(r)&&r.getStyle()!==n.style){Un(t,c,ke)}}}))}function zr(e,t){const n=e._compositionKey;Rt(null);if(n!==null&&t!=null){if(t===""){const t=It(n);const o=St(e.getElementByKey(n));if(o!==null&&o.nodeValue!==null&&Ds(t)){Qt(t,o.nodeValue,null,null,true)}return}if(t[t.length-1]==="\n"){const t=ai();if(zs(t)){const n=t.focus;t.anchor.set(n.key,n.offset,n.type);Un(e,S,null);return}}}qt(true,e,t)}function Hr(e,t){if(V){Ar=true}else{el(t,(()=>{zr(t,e.data)}))}}function Ur(e,t){Tr=e.timeStamp;Er=e.key;if(t.isComposing()){return}const{key:n,shiftKey:o,ctrlKey:r,metaKey:l,altKey:c}=e;if(Un(t,p,e)){return}if(n==null){return}if(xn(n,r,c,l)){Un(t,m,e)}else if(bn(n,r,o,c,l)){Un(t,N,e)}else if(Sn(n,r,c,l)){Un(t,y,e)}else if(wn(n,r,o,c,l)){Un(t,C,e)}else if(On(n,r,l)){Un(t,T,e)}else if(Mn(n,r,l)){Un(t,E,e)}else if(ln(n,o)){Mr=true;Un(t,S,e)}else if(Dn(n)){Un(t,w,e)}else if(cn(n,r)){e.preventDefault();Mr=true;Un(t,i,true)}else if(sn(n,o)){Mr=false;Un(t,S,e)}else if(hn(n,c,l,r)){if(kn(n)){Un(t,x,e)}else{e.preventDefault();Un(t,s,true)}}else if(In(n)){Un(t,b,e)}else if(gn(n,r,o,c,l)){if(Ln(n)){Un(t,O,e)}else{e.preventDefault();Un(t,s,false)}}else if(an(n,c,r)){e.preventDefault();Un(t,f,true)}else if(un(n,c,r)){e.preventDefault();Un(t,f,false)}else if(fn(n,l)){e.preventDefault();Un(t,d,true)}else if(dn(n,l)){e.preventDefault();Un(t,d,false)}else if(nn(n,c,l,r)){e.preventDefault();Un(t,h,"bold")}else if(rn(n,c,l,r)){e.preventDefault();Un(t,h,"underline")}else if(on(n,c,l,r)){e.preventDefault();Un(t,h,"italic")}else if(tn(n,c,r,l)){Un(t,M,e)}else if(_n(n,o,l,r)){e.preventDefault();Un(t,g,undefined)}else if(pn(n,o,l,r)){e.preventDefault();Un(t,_,undefined)}else{const s=t._editorState._selection;if(Us(s)){if(mn(n,o,l,r)){e.preventDefault();Un(t,$,e)}else if(Nn(n,o,l,r)){e.preventDefault();Un(t,F,e)}else if(Pn(n,l,r)){e.preventDefault();Un(t,K,e)}}else if(!V&&Pn(n,l,r)){e.preventDefault();Un(t,K,e)}}if(An(r,o,c,l)){Un(t,J,e)}}function Yr(e){let t=e.__lexicalEventHandles;if(t===undefined){t=[];e.__lexicalEventHandles=t}return t}const Jr=new Map;function jr(e){const t=e.target;const n=t==null?null:t.nodeType===9?t.defaultView:t.ownerDocument.defaultView;const o=ho(n);if(o===null){return}const r=Nt(o.anchorNode);if(r===null){return}if(Or){Or=false;el(r,(()=>{const t=ui();const n=o.anchorNode;if(n===null){return}const s=n.nodeType;if(s!==re&&s!==se){return}const i=ci(t,o,r,e);zt(i)}))}const s=Gt(r);const i=s[s.length-1];const l=i._key;const c=Jr.get(l);const a=c||i;if(a!==r){kr(o,a,false)}kr(o,r,true);if(r!==i){Jr.set(l,r)}else if(c){Jr.delete(l)}}function Gr(e){e._lexicalHandled=true}function Xr(e){const t=e._lexicalHandled===true;return t}function Vr(e,t){const n=e.ownerDocument;const o=xr.get(n);if(o===undefined||o<1){n.addEventListener("selectionchange",jr)}xr.set(n,(o||0)+1);e.__lexicalEditor=t;const r=Yr(e);for(let n=0;n<Cr.length;n++){const[o,s]=Cr[n];const i=typeof s==="function"?e=>{if(Xr(e)){return}Gr(e);if(t.isEditable()||o==="click"){s(e,t)}}:e=>{if(Xr(e)){return}Gr(e);const n=t.isEditable();switch(o){case"cut":return n&&Un(t,F,e);case"copy":return Un(t,$,e);case"paste":return n&&Un(t,a,e);case"dragstart":return n&&Un(t,I,e);case"dragover":return n&&Un(t,L,e);case"dragend":return n&&Un(t,P,e);case"focus":return n&&Un(t,U,e);case"blur":{return n&&Un(t,Y,e)}case"drop":return n&&Un(t,R,e)}};e.addEventListener(o,i);r.push((()=>{e.removeEventListener(o,i)}))}}function qr(e){const t=e.ownerDocument;const n=xr.get(t);if(!(n!==undefined)){throw Error(`Root element not registered`)}const o=n-1;if(!(o>=0)){throw Error(`Root element count less than 0`)}xr.set(t,o);if(o===0){t.removeEventListener("selectionchange",jr)}const r=yt(e);if(mt(r)){Qr(r);e.__lexicalEditor=null}else if(r){{throw Error(`Attempted to remove event handlers from a node that does not belong to this build of Lexical`)}}const s=Yr(e);for(let e=0;e<s.length;e++){s[e]()}e.__lexicalEventHandles=[]}function Qr(e){if(e._parentEditor!==null){const t=Gt(e);const n=t[t.length-1];const o=n._key;if(Jr.get(o)===e){Jr.delete(o)}}else{Jr.delete(e._key)}}function Zr(){br=true}function es(e,t,n,o,r){Dr=[e,t,n,o,r]}function ts(e,t,n){Ai();const o=e.__key;const r=e.getParent();if(r===null){return}const s=qn(e);let i=false;if(zs(s)&&t){const t=s.anchor;const n=s.focus;if(t.key===o){gi(t,e,r,e.getPreviousSibling(),e.getNextSibling());i=true}if(n.key===o){gi(n,e,r,e.getPreviousSibling(),e.getNextSibling());i=true}}else if(Us(s)&&t&&e.isSelected()){e.selectPrevious()}if(zs(s)&&t&&!i){const t=e.getIndexWithinParent();At(e);fi(s,r,t,-1)}else{At(e)}if(!n&&!oo(r)&&!r.canBeEmpty()&&r.isEmpty()){ts(r,t)}if(t&&cl(r)&&r.isEmpty()){r.selectEnd()}}class ns{static getType(){{throw Error(`LexicalNode: Node ${this.name} does not implement .getType().`)}}static clone(e){{throw Error(`LexicalNode: Node ${this.name} does not implement .clone().`)}}afterCloneFrom(e){this.__parent=e.__parent;this.__next=e.__next;this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType();this.__parent=null;this.__prev=null;this.__next=null;bt(this,e);{if(this.__type!=="root"){Ai();os(this.__type,this.constructor)}}}getType(){return this.__type}isInline(){{throw Error(`LexicalNode: Node ${this.constructor.name} does not implement .isInline().`)}}isAttached(){let e=this.__key;while(e!==null){if(e==="root"){return true}const t=It(e);if(t===null){break}e=t.__parent}return false}isSelected(e){const t=e||ai();if(t==null){return false}const n=t.getNodes().some((e=>e.__key===this.__key));if(Ds(this)){return n}const o=zs(t)&&t.anchor.type==="element"&&t.focus.type==="element";if(o){if(t.isCollapsed()){return false}const e=this.getParent();if(sl(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;const o=n.getNode();if(n.offset===o.getChildrenSize()&&o.is(e)&&o.getLastChildOrThrow().is(this)){return false}}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null){return-1}let t=e.getFirstChild();let n=0;while(t!==null){if(this.is(t)){return n}n++;t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;if(e===null){return null}return It(e)}getParentOrThrow(){const e=this.getParent();if(e===null){{throw Error(`Expected node ${this.__key} to have a parent.`)}}return e}getTopLevelElement(){let e=this;while(e!==null){const t=e.getParent();if(oo(t)){if(!(nl(e)||e===this&&sl(e))){throw Error(`Children of root nodes must be elements or decorators`)}return e}e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();if(e===null){{throw Error(`Expected node ${this.__key} to have a top parent element.`)}}return e}getParents(){const e=[];let t=this.getParent();while(t!==null){e.push(t);t=t.getParent()}return e}getParentKeys(){const e=[];let t=this.getParent();while(t!==null){e.push(t.__key);t=t.getParent()}return e}getPreviousSibling(){const e=this.getLatest();const t=e.__prev;return t===null?null:It(t)}getPreviousSiblings(){const e=[];const t=this.getParent();if(t===null){return e}let n=t.getFirstChild();while(n!==null){if(n.is(this)){break}e.push(n);n=n.getNextSibling()}return e}getNextSibling(){const e=this.getLatest();const t=e.__next;return t===null?null:It(t)}getNextSiblings(){const e=[];let t=this.getNextSibling();while(t!==null){e.push(t);t=t.getNextSibling()}return e}getCommonAncestor(e){const t=this.getParents();const n=e.getParents();if(nl(this)){t.unshift(this)}if(nl(e)){n.unshift(e)}const o=t.length;const r=n.length;if(o===0||r===0||t[o-1]!==n[r-1]){return null}const s=new Set(n);for(let e=0;e<o;e++){const n=t[e];if(s.has(n)){return n}}return null}is(e){if(e==null){return false}return this.__key===e.__key}isBefore(e){if(this===e){return false}if(e.isParentOf(this)){return true}if(this.isParentOf(e)){return false}const t=this.getCommonAncestor(e);let n=0;let o=0;let r=this;while(true){const e=r.getParentOrThrow();if(e===t){n=r.getIndexWithinParent();break}r=e}r=e;while(true){const e=r.getParentOrThrow();if(e===t){o=r.getIndexWithinParent();break}r=e}return n<o}isParentOf(e){const t=this.__key;if(t===e.__key){return false}let n=e;while(n!==null){if(n.__key===t){return true}n=n.getParent()}return false}getNodesBetween(e){const t=this.isBefore(e);const n=[];const o=new Set;let r=this;while(true){if(r===null){break}const s=r.__key;if(!o.has(s)){o.add(s);n.push(r)}if(r===e){break}const i=nl(r)?t?r.getFirstChild():r.getLastChild():null;if(i!==null){r=i;continue}const l=t?r.getNextSibling():r.getPreviousSibling();if(l!==null){r=l;continue}const c=r.getParentOrThrow();if(!o.has(c.__key)){n.push(c)}if(c===e){break}let a=null;let u=c;do{if(u===null){{throw Error(`getNodesBetween: ancestor is null`)}}a=t?u.getNextSibling():u.getPreviousSibling();u=u.getParent();if(u!==null){if(a===null&&!o.has(u.__key)){n.push(u)}}else{break}}while(a===null);r=a}if(!t){n.reverse()}return n}isDirty(){const e=Ri();const t=e._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){const e=It(this.__key);if(e===null){{throw Error(`Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editorState.read/editor.update.`)}}return e}getWritable(){Ai();const e=vi();const t=Ri();const n=e._nodeMap;const o=this.__key;const r=this.getLatest();const s=t._cloneNotNeeded;const i=ai();if(i!==null){i.setCachedNodes(null)}if(s.has(o)){Dt(r);return r}const l=xo(r);s.add(o);Dt(l);n.set(o,l);return l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){{throw Error(`createDOM: base method not extended`)}}updateDOM(e,t,n){{throw Error(`updateDOM: base method not extended`)}}exportDOM(e){const t=this.createDOM(e._config,e);return{element:t}}exportJSON(){{throw Error(`exportJSON: base method not extended`)}}static importJSON(e){{throw Error(`LexicalNode: Node ${this.name} does not implement .importJSON().`)}}static transform(){return null}remove(e){ts(this,true,e)}replace(e,t){Ai();let n=ai();if(n!==null){n=n.clone()}io(this,e);const o=this.getLatest();const r=this.__key;const s=e.__key;const i=e.getWritable();const l=this.getParentOrThrow().getWritable();const c=l.__size;At(i);const a=o.getPreviousSibling();const u=o.getNextSibling();const f=o.__prev;const d=o.__next;const h=o.__parent;ts(o,false,true);if(a===null){l.__first=s}else{const e=a.getWritable();e.__next=s}i.__prev=f;if(u===null){l.__last=s}else{const e=u.getWritable();e.__prev=s}i.__next=d;i.__parent=h;l.__size=c;if(t){if(!(nl(this)&&nl(i))){throw Error(`includeChildren should only be true for ElementNodes`)}this.getChildren().forEach((e=>{i.append(e)}))}if(zs(n)){zt(n);const e=n.anchor;const t=n.focus;if(e.key===r){Fs(e,i)}if(t.key===r){Fs(t,i)}}if(kt()===r){Rt(s)}return i}insertAfter(e,t=true){Ai();io(this,e);const n=this.getWritable();const o=e.getWritable();const r=o.getParent();const s=ai();let i=false;let l=false;if(r!==null){const t=e.getIndexWithinParent();At(o);if(zs(s)){const e=r.__key;const n=s.anchor;const o=s.focus;i=n.type==="element"&&n.key===e&&n.offset===t+1;l=o.type==="element"&&o.key===e&&o.offset===t+1}}const c=this.getNextSibling();const a=this.getParentOrThrow().getWritable();const u=o.__key;const f=n.__next;if(c===null){a.__last=u}else{const e=c.getWritable();e.__prev=u}a.__size++;n.__next=u;o.__next=f;o.__prev=n.__key;o.__parent=n.__parent;if(t&&zs(s)){const e=this.getIndexWithinParent();fi(s,a,e+1);const t=a.__key;if(i){s.anchor.set(t,e+2,"element")}if(l){s.focus.set(t,e+2,"element")}}return e}insertBefore(e,t=true){Ai();io(this,e);const n=this.getWritable();const o=e.getWritable();const r=o.__key;At(o);const s=this.getPreviousSibling();const i=this.getParentOrThrow().getWritable();const l=n.__prev;const c=this.getIndexWithinParent();if(s===null){i.__first=r}else{const e=s.getWritable();e.__next=r}i.__size++;n.__prev=r;o.__prev=l;o.__next=n.__key;o.__parent=n.__parent;const a=ai();if(t&&zs(a)){const e=this.getParentOrThrow();fi(a,e,c)}return e}isParentRequired(){return false}createParentElementNode(){return ml()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Ai();const n=this.getPreviousSibling();const o=this.getParentOrThrow();if(n===null){return o.select(0,0)}if(nl(n)){return n.select()}else if(!Ds(n)){const e=n.getIndexWithinParent()+1;return o.select(e,e)}return n.select(e,t)}selectNext(e,t){Ai();const n=this.getNextSibling();const o=this.getParentOrThrow();if(n===null){return o.select()}if(nl(n)){return n.select(0,0)}else if(!Ds(n)){const e=n.getIndexWithinParent();return o.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}}function os(e,t){const n=Ri()._nodes.get(e);if(n===undefined){{throw Error(`Create node: Attempted to create node ${t.name} that was not configured to be used on the editor.`)}}const o=n.klass;if(o!==t){{throw Error(`Create node: Type ${e} in node ${t.name} does not match registered node ${o.name} with the same type`)}}}function rs(e,t,n){const o=t.getParentOrThrow().getLastChild();let r=t;const s=[t];while(r!==o){if(!r.getNextSibling()){{throw Error(`insertRangeAfter: lastToInsert must be a later sibling of firstToInsert`)}}r=r.getNextSibling();s.push(r)}let i=e;for(const e of s){i=i.insertAfter(e)}}class ss extends ns{static getType(){return"linebreak"}static clone(e){return new ss(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}static importDOM(){return{br:e=>{if(as(e)||us(e)){return null}return{conversion:is,priority:0}}}}static importJSON(e){return ls()}exportJSON(){return{type:"linebreak",version:1}}}function is(e){return{node:ls()}}function ls(){return so(new ss)}function cs(e){return e instanceof ss}function as(e){const t=e.parentElement;if(t!==null&&No(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&fs(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&fs(n)){return true}}}return false}function us(e){const t=e.parentElement;if(t!==null&&No(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&fs(n)){return false}const o=t.lastChild;if(o===e||o.previousSibling===e&&fs(o)){return true}}return false}function fs(e){return e.nodeType===se&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function ds(e,t){if(t&pe){return"code"}if(t&ye){return"mark"}if(t&me){return"sub"}if(t&Ne){return"sup"}return null}function hs(e,t){if(t&de){return"strong"}if(t&he){return"em"}return"span"}function gs(e,t,n,o,r){const s=o.classList;let i=Fn(r,"base");if(i!==undefined){s.add(...i)}i=Fn(r,"underlineStrikethrough");let l=false;const c=t&_e&&t&ge;const a=n&_e&&n&ge;if(i!==undefined){if(a){l=true;if(!c){s.add(...i)}}else if(c){s.remove(...i)}}for(const e in Fe){const o=e;const a=Fe[o];i=Fn(r,e);if(i!==undefined){if(n&a){if(l&&(e==="underline"||e==="strikethrough")){if(t&a){s.remove(...i)}continue}if((t&a)===0||c&&e==="underline"||e==="strikethrough"){s.add(...i)}}else if(t&a){s.remove(...i)}}}}function _s(e,t){const n=e.length;const o=t.length;let r=0;let s=0;while(r<n&&r<o&&e[r]===t[r]){r++}while(s+r<n&&s+r<o&&e[n-s-1]===t[o-s-1]){s++}return[r,n-r-s,t.slice(r,o-s)]}function ps(e,t,n){const o=t.firstChild;const r=n.isComposing();const s=r?ve:"";const i=e+s;if(o==null){t.textContent=i}else{const e=o.nodeValue;if(e!==i){if(r||V){const[t,n,r]=_s(e,i);if(n!==0){o.deleteData(t,n)}o.insertData(t,r)}else{o.nodeValue=i}}}}function ms(e,t,n,o,r,s){ps(r,e,t);const i=s.theme;const l=i.text;if(l!==undefined){gs(n,0,o,e,l)}}function Ns(e,t){const n=document.createElement(t);n.appendChild(e);return n}class ys extends ns{static getType(){return"text"}static clone(e){return new ys(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e);this.__format=e.__format;this.__style=e.__style;this.__mode=e.__mode;this.__detail=e.__detail}constructor(e,t){super(t);this.__text=e;this.__format=0;this.__style="";this.__mode=0;this.__detail=0}getFormat(){const e=this.getLatest();return e.__format}getDetail(){const e=this.getLatest();return e.__detail}getMode(){const e=this.getLatest();return He[e.__mode]}getStyle(){const e=this.getLatest();return e.__style}isToken(){const e=this.getLatest();return e.__mode===ue}isComposing(){return this.__key===kt()}isSegmented(){const e=this.getLatest();return e.__mode===fe}isDirectionless(){const e=this.getLatest();return(e.__detail&Te)!==0}isUnmergeable(){const e=this.getLatest();return(e.__detail&Ee)!==0}hasFormat(e){const t=Fe[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){const e=this.getLatest();return e.__text}getFormatFlags(e,t){const n=this.getLatest();const o=n.__format;return wt(o,e,t)}canHaveFormat(){return true}createDOM(e,t){const n=this.__format;const o=ds(this,n);const r=hs(this,n);const s=o===null?r:o;const i=document.createElement(s);let l=i;if(this.hasFormat("code")){i.setAttribute("spellcheck","false")}if(o!==null){l=document.createElement(r);i.appendChild(l)}const c=this.__text;ms(l,this,r,n,c,e);const a=this.__style;if(a!==""){i.style.cssText=a}return i}updateDOM(e,t,n){const o=this.__text;const r=e.__format;const s=this.__format;const i=ds(this,r);const l=ds(this,s);const c=hs(this,r);const a=hs(this,s);const u=i===null?c:i;const f=l===null?a:l;if(u!==f){return true}if(i===l&&c!==a){const e=t.firstChild;if(e==null){{throw Error(`updateDOM: prevInnerDOM is null or undefined`)}}const r=document.createElement(a);ms(r,this,a,s,o,n);t.replaceChild(r,e);return false}let d=t;if(l!==null){if(i!==null){d=t.firstChild;if(d==null){{throw Error(`updateDOM: innerDOM is null or undefined`)}}}}ps(o,d,this);const h=n.theme;const g=h.text;if(g!==undefined&&r!==s){gs(a,r,s,d,g)}const _=e.__style;const p=this.__style;if(_!==p){t.style.cssText=p}return false}static importDOM(){return{"#text":()=>({conversion:xs,priority:0}),b:()=>({conversion:Ts,priority:0}),code:()=>({conversion:Ms,priority:0}),em:()=>({conversion:Ms,priority:0}),i:()=>({conversion:Ms,priority:0}),s:()=>({conversion:Ms,priority:0}),span:()=>({conversion:Cs,priority:0}),strong:()=>({conversion:Ms,priority:0}),sub:()=>({conversion:Ms,priority:0}),sup:()=>({conversion:Ms,priority:0}),u:()=>({conversion:Ms,priority:0})}}static importJSON(e){const t=As(e.text);t.setFormat(e.format);t.setDetail(e.detail);t.setMode(e.mode);t.setStyle(e.style);return t}exportDOM(e){let{element:t}=super.exportDOM(e);if(!(t!==null&&po(t))){throw Error(`Expected TextNode createDOM to always return a HTMLElement`)}t.style.whiteSpace="pre-wrap";if(this.hasFormat("bold")){t=Ns(t,"b")}if(this.hasFormat("italic")){t=Ns(t,"i")}if(this.hasFormat("strikethrough")){t=Ns(t,"s")}if(this.hasFormat("underline")){t=Ns(t,"u")}return{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){return}setFormat(e){const t=this.getWritable();t.__format=typeof e==="string"?Fe[e]:e;return t}setDetail(e){const t=this.getWritable();t.__detail=typeof e==="string"?Ke[e]:e;return t}setStyle(e){const t=this.getWritable();t.__style=e;return t}toggleFormat(e){const t=this.getFormat();const n=wt(t,e,null);return this.setFormat(n)}toggleDirectionless(){const e=this.getWritable();e.__detail^=Te;return e}toggleUnmergeable(){const e=this.getWritable();e.__detail^=Ee;return e}setMode(e){const t=ze[e];if(this.__mode===t){return this}const n=this.getWritable();n.__mode=t;return n}setTextContent(e){if(this.__text===e){return this}const t=this.getWritable();t.__text=e;return t}select(e,t){Ai();let n=e;let o=t;const r=ai();const s=this.getTextContent();const i=this.__key;if(typeof s==="string"){const e=s.length;if(n===undefined){n=e}if(o===undefined){o=e}}else{n=0;o=0}if(!zs(r)){return oi(i,n,i,o,"text","text")}else{const e=kt();if(e===r.anchor.key||e===r.focus.key){Rt(i)}r.setTextNodeRange(this,n,this,o)}return r}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,o){const r=this.getWritable();const s=r.__text;const i=n.length;let l=e;if(l<0){l=i+l;if(l<0){l=0}}const c=ai();if(o&&zs(c)){const t=e+i;c.setTextNodeRange(r,t,r,t)}const a=s.slice(0,l)+n+s.slice(l+t);r.__text=a;return r}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...e){Ai();const t=this.getLatest();const n=t.getTextContent();const o=t.__key;const r=kt();const s=new Set(e);const i=[];const l=n.length;let c="";for(let e=0;e<l;e++){if(c!==""&&s.has(e)){i.push(c);c=""}c+=n[e]}if(c!==""){i.push(c)}const a=i.length;if(a===0){return[]}else if(i[0]===n){return[t]}const u=i[0];const f=t.getParent();let d;const h=t.getFormat();const g=t.getStyle();const _=t.__detail;let p=false;if(t.isSegmented()){d=As(u);d.__format=h;d.__style=g;d.__detail=_;p=true}else{d=t.getWritable();d.__text=u}const m=ai();const N=[d];let y=u.length;for(let e=1;e<a;e++){const t=i[e];const n=t.length;const s=As(t).getWritable();s.__format=h;s.__style=g;s.__detail=_;const l=s.__key;const c=y+n;if(zs(m)){const e=m.anchor;const t=m.focus;if(e.key===o&&e.type==="text"&&e.offset>y&&e.offset<=c){e.key=l;e.offset-=y;m.dirty=true}if(t.key===o&&t.type==="text"&&t.offset>y&&t.offset<=c){t.key=l;t.offset-=y;m.dirty=true}}if(r===o){Rt(l)}y=c;N.push(s)}if(f!==null){vt(this);const e=f.getWritable();const t=this.getIndexWithinParent();if(p){e.splice(t,0,N);this.remove()}else{e.splice(t,1,N)}if(zs(m)){fi(m,f,t,a-1)}}return N}mergeWithSibling(e){const t=e===this.getPreviousSibling();if(!t&&e!==this.getNextSibling()){{throw Error(`mergeWithSibling: sibling must be a previous or next sibling`)}}const n=this.__key;const o=e.__key;const r=this.__text;const s=r.length;const i=kt();if(i===o){Rt(n)}const l=ai();if(zs(l)){const r=l.anchor;const i=l.focus;if(r!==null&&r.key===o){_i(r,t,n,e,s);l.dirty=true}if(i!==null&&i.key===o){_i(i,t,n,e,s);l.dirty=true}}const c=e.__text;const a=t?c+r:r+c;this.setTextContent(a);const u=this.getWritable();e.remove();return u}isTextEntity(){return false}}function Cs(e){const t=e;const n=t.style;return{forChild:vs(n),node:null}}function Ts(e){const t=e;const n=t.style.fontWeight==="normal";return{forChild:vs(t.style,n?undefined:"bold"),node:null}}const Es=new WeakMap;function Ss(e){return e.nodeName==="PRE"||e.nodeType===re&&e.style!==undefined&&e.style.whiteSpace!==undefined&&e.style.whiteSpace.startsWith("pre")}function ws(e){let t;let n=e.parentNode;const o=[e];while(n!==null&&(t=Es.get(n))===undefined&&!Ss(n)){o.push(n);n=n.parentNode}const r=t===undefined?n:t;for(let e=0;e<o.length;e++){Es.set(o[e],r)}return r}function xs(e){const t=e;const n=e.parentElement;if(!(n!==null)){throw Error(`Expected parentElement of Text not to be null`)}let o=t.textContent||"";if(ws(t)!==null){const e=o.split(/(\r?\n|\t)/);const t=[];const n=e.length;for(let o=0;o<n;o++){const n=e[o];if(n==="\n"||n==="\r\n"){t.push(ls())}else if(n==="\t"){t.push(ks())}else if(n!==""){t.push(As(n))}}return{node:t}}o=o.replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(o===""){return{node:null}}if(o[0]===" "){let e=t;let n=true;while(e!==null&&(e=bs(e,false))!==null){const t=e.textContent||"";if(t.length>0){if(/[ \t\n]$/.test(t)){o=o.slice(1)}n=false;break}}if(n){o=o.slice(1)}}if(o[o.length-1]===" "){let e=t;let n=true;while(e!==null&&(e=bs(e,true))!==null){const t=(e.textContent||"").replace(/^( |\t|\r?\n)+/,"");if(t.length>0){n=false;break}}if(n){o=o.slice(0,o.length-1)}}if(o===""){return{node:null}}return{node:As(o)}}function bs(e,t){let n=e;while(true){let e;while((e=t?n.nextSibling:n.previousSibling)===null){const e=n.parentElement;if(e===null){return null}n=e}n=e;if(n.nodeType===re){const e=n.style.display;if(e===""&&!mo(n)||e!==""&&!e.startsWith("inline")){return null}}let o=n;while((o=t?n.firstChild:n.lastChild)!==null){n=o}if(n.nodeType===se){return n}else if(n.nodeName==="BR"){return null}}}const Os={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ms(e){const t=Os[e.nodeName.toLowerCase()];if(t===undefined){return{node:null}}return{forChild:vs(e.style,t),node:null}}function As(e=""){return so(new ys(e))}function Ds(e){return e instanceof ys}function vs(e,t){const n=e.fontWeight;const o=e.textDecoration.split(" ");const r=n==="700"||n==="bold";const s=o.includes("line-through");const i=e.fontStyle==="italic";const l=o.includes("underline");const c=e.verticalAlign;return e=>{if(!Ds(e)){return e}if(r&&!e.hasFormat("bold")){e.toggleFormat("bold")}if(s&&!e.hasFormat("strikethrough")){e.toggleFormat("strikethrough")}if(i&&!e.hasFormat("italic")){e.toggleFormat("italic")}if(l&&!e.hasFormat("underline")){e.toggleFormat("underline")}if(c==="sub"&&!e.hasFormat("subscript")){e.toggleFormat("subscript")}if(c==="super"&&!e.hasFormat("superscript")){e.toggleFormat("superscript")}if(t&&!e.hasFormat(t)){e.toggleFormat(t)}return e}}class Rs extends ys{static getType(){return"tab"}static clone(e){return new Rs(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e);this.__text=e.__text}constructor(e){super("\t",e);this.__detail=Ee}static importDOM(){return null}static importJSON(e){const t=ks();t.setFormat(e.format);t.setStyle(e.style);return t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){{throw Error(`TabNode does not support setTextContent`)}}setDetail(e){{throw Error(`TabNode does not support setDetail`)}}setMode(e){{throw Error(`TabNode does not support setMode`)}}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function ks(){return so(new Rs)}function Is(e){return e instanceof Rs}class Ls{constructor(e,t,n){this._selection=null;this.key=e;this.offset=t;this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode();let n=e.getNode();const o=this.offset;const r=e.offset;if(nl(t)){const e=t.getDescendantByIndex(o);t=e!=null?e:t}if(nl(n)){const e=n.getDescendantByIndex(r);n=e!=null?e:n}if(t===n){return o<r}return t.isBefore(n)}getNode(){const e=this.key;const t=It(e);if(t===null){{throw Error(`Point.getNode: node not found`)}}return t}set(e,t,n){const o=this._selection;const r=this.key;this.key=e;this.offset=t;this.type=n;if(!Mi()){if(kt()===r){Rt(e)}if(o!==null){o.setCachedNodes(null);o.dirty=true}}}}function Ps(e,t,n){return new Ls(e,t,n)}function $s(e,t){let n=t.__key;let o=e.offset;let r="element";if(Ds(t)){r="text";const e=t.getTextContentSize();if(o>e){o=e}}else if(!nl(t)){const e=t.getNextSibling();if(Ds(e)){n=e.__key;o=0;r="text"}else{const e=t.getParent();if(e){n=e.__key;o=t.getIndexWithinParent()+1}}}e.set(n,o,r)}function Fs(e,t){if(nl(t)){const n=t.getLastDescendant();if(nl(n)||Ds(n)){$s(e,n)}else{$s(e,t)}}else{$s(e,t)}}function Ks(e,t,n,o){const r=e.getNode();const s=r.getChildAtIndex(e.offset);const i=As();const l=cl(r)?ml().append(i):i;i.setFormat(n);i.setStyle(o);if(s===null){r.append(l)}else{s.insertBefore(l)}if(e.is(t)){t.set(i.__key,0,"text")}e.set(i.__key,0,"text")}function Bs(e,t,n,o){e.key=t;e.offset=n;e.type=o}class Ws{constructor(e){this._cachedNodes=null;this._nodes=e;this.dirty=false}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Us(e)){return false}const t=this._nodes;const n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(e){this.dirty=true;this._nodes.add(e);this._cachedNodes=null}delete(e){this.dirty=true;this._nodes.delete(e);this._cachedNodes=null}clear(){this.dirty=true;this._nodes.clear();this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Ws(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes();const n=t.length;const o=t[n-1];let r;if(Ds(o)){r=o.select()}else{const e=o.getIndexWithinParent()+1;r=o.getParentOrThrow().select(e,e)}r.insertNodes(e);for(let e=0;e<n;e++){t[e].remove()}}getNodes(){const e=this._cachedNodes;if(e!==null){return e}const t=this._nodes;const n=[];for(const e of t){const t=It(e);if(t!==null){n.push(t)}}if(!Mi()){this._cachedNodes=n}return n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++){t+=e[n].getTextContent()}return t}}function zs(e){return e instanceof Hs}class Hs{constructor(e,t,n,o){this.anchor=e;this.focus=t;e._selection=this;t._selection=this;this._cachedNodes=null;this.format=n;this.style=o;this.dirty=false}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!zs(e)){return false}return this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null){return e}const t=this.anchor;const n=this.focus;const o=t.isBefore(n);const r=o?t:n;const s=o?n:t;let i=r.getNode();let l=s.getNode();const c=r.offset;const a=s.offset;if(nl(i)){const e=i.getDescendantByIndex(c);i=e!=null?e:i}if(nl(l)){let e=l.getDescendantByIndex(a);if(e!==null&&e!==i&&l.getChildAtIndex(a)===e){e=e.getPreviousSibling()}l=e!=null?e:l}let u;if(i.is(l)){if(nl(i)&&i.getChildrenSize()>0){u=[]}else{u=[i]}}else{u=i.getNodesBetween(l)}if(!Mi()){this._cachedNodes=u}return u}setTextNodeRange(e,t,n,o){Bs(this.anchor,e.__key,t,"text");Bs(this.focus,n.__key,o,"text");this._cachedNodes=null;this.dirty=true}getTextContent(){const e=this.getNodes();if(e.length===0){return""}const t=e[0];const n=e[e.length-1];const o=this.anchor;const r=this.focus;const s=o.isBefore(r);const[i,l]=Js(this);let c="";let a=true;for(let u=0;u<e.length;u++){const f=e[u];if(nl(f)&&!f.isInline()){if(!a){c+="\n"}if(f.isEmpty()){a=false}else{a=true}}else{a=false;if(Ds(f)){let e=f.getTextContent();if(f===t){if(f===n){if(o.type!=="element"||r.type!=="element"||r.offset===o.offset){e=i<l?e.slice(i,l):e.slice(l,i)}}else{e=s?e.slice(i):e.slice(l)}}else if(f===n){e=s?e.slice(0,l):e.slice(0,i)}c+=e}else if((sl(f)||cs(f))&&(f!==n||!this.isCollapsed())){c+=f.getTextContent()}}}return c}applyDOMRange(e){const t=Ri();const n=t.getEditorState();const o=n._selection;const r=ti(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,o);if(r===null){return}const[s,i]=r;Bs(this.anchor,s.key,s.offset,s.type);Bs(this.focus,i.key,i.offset,i.type);this._cachedNodes=null}clone(){const e=this.anchor;const t=this.focus;const n=new Hs(Ps(e.key,e.offset,e.type),Ps(t.key,t.offset,t.type),this.format,this.style);return n}toggleFormat(e){this.format=wt(this.format,e,null);this.dirty=true}setStyle(e){this.style=e;this.dirty=true}hasFormat(e){const t=Fe[e];return(this.format&t)!==0}insertRawText(e){const t=e.split(/(\r?\n|\t)/);const n=[];const o=t.length;for(let e=0;e<o;e++){const o=t[e];if(o==="\n"||o==="\r\n"){n.push(ls())}else if(o==="\t"){n.push(ks())}else{n.push(As(o))}}this.insertNodes(n)}insertText(e){const t=this.anchor;const n=this.focus;const o=this.format;const r=this.style;let s=t;let i=n;if(!this.isCollapsed()&&n.isBefore(t)){s=n;i=t}if(s.type==="element"){Ks(s,i,o,r)}const l=s.offset;let c=i.offset;const a=this.getNodes();const u=a.length;let f=a[0];if(!Ds(f)){{throw Error(`insertText: first node is not a text node`)}}const d=f.getTextContent();const h=d.length;const g=f.getParentOrThrow();const _=u-1;let p=a[_];if(u===1&&i.type==="element"){c=h;i.set(s.key,c,"text")}if(this.isCollapsed()&&l===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let t=f.getNextSibling();if(!Ds(t)||!t.canInsertTextBefore()||Tt(t)){t=As();t.setFormat(o);t.setStyle(r);if(!g.canInsertTextAfter()){g.insertAfter(t)}else{f.insertAfter(t)}}t.select(0,0);f=t;if(e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let t=f.getPreviousSibling();if(!Ds(t)||Tt(t)){t=As();t.setFormat(o);if(!g.canInsertTextBefore()){g.insertBefore(t)}else{f.insertBefore(t)}}t.select();f=t;if(e!==""){this.insertText(e);return}}else if(f.isSegmented()&&l!==h){const e=As(f.getTextContent());e.setFormat(o);f.replace(e);f=e}else if(!this.isCollapsed()&&e!==""){const t=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||nl(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter())){this.insertText("");ei(this.anchor,this.focus,null);this.insertText(e);return}}if(u===1){if(f.isToken()){const t=As(e);t.select();f.replace(t);return}const t=f.getFormat();const n=f.getStyle();if(l===c&&(t!==o||n!==r)){if(f.getTextContent()===""){f.setFormat(o);f.setStyle(r)}else{const t=As(e);t.setFormat(o);t.setStyle(r);t.select();if(l===0){f.insertBefore(t,false)}else{const[e]=f.splitText(l);e.insertAfter(t,false)}if(t.isComposing()&&this.anchor.type==="text"){this.anchor.offset-=e.length}return}}else if(Is(f)){const t=As(e);t.setFormat(o);t.setStyle(r);t.select();f.replace(t);return}const s=c-l;f=f.spliceText(l,s,e,true);if(f.getTextContent()===""){f.remove()}else if(this.anchor.type==="text"){if(f.isComposing()){this.anchor.offset-=e.length}else{this.format=t;this.style=n}}}else{const t=new Set([...f.getParentKeys(),...p.getParentKeys()]);const n=nl(f)?f:f.getParentOrThrow();let o=nl(p)?p:p.getParentOrThrow();let r=p;if(!n.is(o)&&o.isInline()){do{r=o;o=o.getParentOrThrow()}while(o.isInline())}if(i.type==="text"&&(c!==0||p.getTextContent()==="")||i.type==="element"&&p.getIndexWithinParent()<c){if(Ds(p)&&!p.isToken()&&c!==p.getTextContentSize()){if(p.isSegmented()){const e=As(p.getTextContent());p.replace(e);p=e}if(!cl(i.getNode())&&i.type==="text"){p=p.spliceText(0,c,"")}t.add(p.__key)}else{const e=p.getParentOrThrow();if(!e.canBeEmpty()&&e.getChildrenSize()===1){e.remove()}else{p.remove()}}}else{t.add(p.__key)}const s=o.getChildren();const d=new Set(a);const g=n.is(o);const _=n.isInline()&&f.getNextSibling()===null?n:f;for(let e=s.length-1;e>=0;e--){const t=s[e];if(t.is(f)||nl(t)&&t.isParentOf(f)){break}if(t.isAttached()){if(!d.has(t)||t.is(r)){if(!g){_.insertAfter(t,false)}}else{t.remove()}}}if(!g){let e=o;let n=null;while(e!==null){const o=e.getChildren();const r=o.length;if(r===0||o[r-1].is(n)){t.delete(e.__key);n=e}e=e.getParent()}}if(!f.isToken()){f=f.spliceText(l,h-l,e,true);if(f.getTextContent()===""){f.remove()}else if(f.isComposing()&&this.anchor.type==="text"){this.anchor.offset-=e.length}}else if(l===h){f.select()}else{const t=As(e);t.select();f.replace(t)}for(let e=1;e<u;e++){const n=a[e];const o=n.__key;if(!t.has(o)){n.remove()}}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed()){this.toggleFormat(e);Rt(null);return}const t=this.getNodes();const n=[];for(const e of t){if(Ds(e)){n.push(e)}}const o=n.length;if(o===0){this.toggleFormat(e);Rt(null);return}const r=this.anchor;const s=this.focus;const i=this.isBackward();const l=i?s:r;const c=i?r:s;let a=0;let u=n[0];let f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===u.getTextContentSize()){a=1;u=n[1];f=0}if(u==null){return}const d=u.getFormatFlags(e,null);const h=o-1;let g=n[h];const _=c.type==="text"?c.offset:g.getTextContentSize();if(u.is(g)){if(f===_){return}if(Tt(u)||f===0&&_===u.getTextContentSize()){u.setFormat(d)}else{const e=u.splitText(f,_);const t=f===0?e[0]:e[1];t.setFormat(d);if(l.type==="text"){l.set(t.__key,0,"text")}if(c.type==="text"){c.set(t.__key,_-f,"text")}}this.format=d;return}if(f!==0&&!Tt(u)){[,u]=u.splitText(f);f=0}u.setFormat(d);const p=g.getFormatFlags(e,d);if(_>0){if(_!==g.getTextContentSize()&&!Tt(g)){[g]=g.splitText(_)}g.setFormat(p)}for(let t=a+1;t<h;t++){const o=n[t];const r=o.getFormatFlags(e,p);o.setFormat(r)}if(l.type==="text"){l.set(u.__key,f,"text")}if(c.type==="text"){c.set(g.__key,_,"text")}this.format=d|p}insertNodes(e){if(e.length===0){return}if(this.anchor.key==="root"){this.insertParagraph();const t=ai();if(!zs(t)){throw Error(`Expected RangeSelection after insertParagraph`)}return t.insertNodes(e)}const t=this.isBackward()?this.focus:this.anchor;const n=Co(t.getNode(),yo);const o=e[e.length-1];if("__language"in n&&nl(n)){if("__language"in e[0]){this.insertText(e[0].getTextContent())}else{const t=yi(this);n.splice(t,0,e);o.selectEnd()}return}const r=e=>(nl(e)||sl(e))&&!e.isInline();if(!e.some(r)){if(!nl(n)){throw Error(`Expected 'firstBlock' to be an ElementNode`)}const t=yi(this);n.splice(t,0,e);o.selectEnd();return}const s=Ti(e);const i=s.getLastDescendant();const l=s.getChildren();const c=e=>nl(e)&&yo(e)&&!e.isEmpty()&&nl(n)&&(!n.isEmpty()||n.canMergeWhenEmpty());const a=!nl(n)||!n.isEmpty();const u=a?this.insertParagraph():null;const f=l[l.length-1];let d=l[0];if(c(d)){if(!nl(n)){throw Error(`Expected 'firstBlock' to be an ElementNode`)}n.append(...d.getChildren());d=l[1]}if(d){rs(n,d)}const h=Co(i,yo);if(u&&nl(h)&&(u.canMergeWhenEmpty()||yo(f))){h.append(...u.getChildren());u.remove()}if(nl(n)&&n.isEmpty()){n.remove()}i.selectEnd();const g=nl(n)?n.getLastChild():null;if(cs(g)&&h!==n){g.remove()}}insertParagraph(){if(this.anchor.key==="root"){const e=ml();Bt().splice(this.anchor.offset,0,[e]);e.select();return e}const e=yi(this);const t=Co(this.anchor.getNode(),yo);if(!nl(t)){throw Error(`Expected ancestor to be an ElementNode`)}const n=t.getChildAtIndex(e);const o=n?[n,...n.getNextSiblings()]:[];const r=t.insertNewAfter(this,false);if(r){r.append(...o);r.selectStart();return r}return null}insertLineBreak(e){const t=ls();this.insertNodes([t]);if(e){const e=t.getParentOrThrow();const n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=this.getNodes();const t=e.length;const n=t-1;const o=this.anchor;const r=this.focus;let s=e[0];let i=e[n];const[l,c]=Js(this);if(t===0){return[]}else if(t===1){if(Ds(s)&&!this.isCollapsed()){const e=l>c?c:l;const t=l>c?l:c;const n=s.splitText(e,t);const o=e===0?n[0]:n[1];return o!=null?[o]:[]}return[s]}const a=o.isBefore(r);if(Ds(s)){const t=a?l:c;if(t===s.getTextContentSize()){e.shift()}else if(t!==0){[,s]=s.splitText(t);e[0]=s}}if(Ds(i)){const t=i.getTextContent();const o=t.length;const r=a?c:l;if(r===0){e.pop()}else if(r!==o){[i]=i.splitText(r);e[n]=i}}return e}modify(e,t,n){const o=this.focus;const r=this.anchor;const s=e==="move";const i=zn(o,t);if(sl(i)&&!i.isIsolated()){if(s&&i.isKeyboardSelectable()){const e=si();e.add(i.__key);zt(e);return}const e=t?i.getPreviousSibling():i.getNextSibling();if(!Ds(e)){const n=i.getParentOrThrow();let l;let c;if(nl(e)){c=e.__key;l=t?e.getChildrenSize():0}else{l=i.getIndexWithinParent();c=n.__key;if(!t){l++}}o.set(c,l,"element");if(s){r.set(c,l,"element")}return}else{const n=e.__key;const i=t?e.getTextContent().length:0;o.set(n,i,"text");if(s){r.set(n,i,"text")}return}}const l=Ri();const c=ho(l._window);if(!c){return}const a=l._blockCursorElement;const u=l._rootElement;if(u!==null&&a!==null&&nl(i)&&!i.isInline()&&!i.canBeEmpty()){uo(a,l,u)}Gs(c,e,t?"backward":"forward",n);if(c.rangeCount>0){const e=c.getRangeAt(0);const n=this.anchor.getNode();const o=cl(n)?n:no(n);this.applyDOMRange(e);this.dirty=true;if(!s){const n=this.getNodes();const r=[];let s=false;for(let e=0;e<n.length;e++){const t=n[e];if(Qn(t,o)){r.push(t)}else{s=true}}if(s&&r.length>0){if(t){const e=r[0];if(nl(e)){e.selectStart()}else{e.getParentOrThrow().selectStart()}}else{const e=r[r.length-1];if(nl(e)){e.selectEnd()}else{e.getParentOrThrow().selectEnd()}}}if(c.anchorNode!==e.startContainer||c.anchorOffset!==e.startOffset){js(this)}}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&nl(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const e=t.getParent();const n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(nl(n)&&n.isShadowRoot()){return true}}return false}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let o=t.getNode();if(this.forwardDeletion(t,o,e)){return}const r=this.focus;const s=zn(r,e);if(sl(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&nl(o)&&o.getChildrenSize()===0){o.remove();const e=si();e.add(s.__key);zt(e)}else{s.remove();const e=Ri();e.dispatchCommand(n,undefined)}return}else if(!e&&nl(s)&&nl(o)&&o.isEmpty()){o.remove();s.selectStart();return}this.modify("extend",e,"character");if(!this.isCollapsed()){const n=r.type==="text"?r.getNode():null;o=t.type==="text"?t.getNode():null;if(n!==null&&n.isSegmented()){const t=r.offset;const s=n.getTextContentSize();if(n.is(o)||e&&t!==s||!e&&t!==0){Vs(n,e,t);return}}else if(o!==null&&o.isSegmented()){const r=t.offset;const s=o.getTextContentSize();if(o.is(n)||e&&r!==0||!e&&r!==s){Vs(o,e,r);return}}Xs(this,e)}else if(e&&t.offset===0){const e=t.type==="element"?t.getNode():t.getNode().getParentOrThrow();if(e.collapseAtStart(this)){return}}}this.removeText();if(e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const e=this.anchor.getNode();if(e.isEmpty()&&cl(e.getParent())&&e.getIndexWithinParent()===0){e.collapseAtStart(this)}}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t){this.insertText(" ")}this.modify("extend",e,"lineboundary");const n=e?this.focus:this.anchor;if(n.offset===0){this.modify("extend",e,"character")}if(t){const t=e?this.anchor:this.focus;t.set(t.key,t.offset+1,t.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor;const n=t.getNode();if(this.forwardDeletion(t,n,e)){return}this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Us(e){return e instanceof Ws}function Ys(e){const t=e.offset;if(e.type==="text"){return t}const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Js(e){const t=e.getStartEndPoints();if(t===null){return[0,0]}const[n,o]=t;if(n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset){return[0,0]}return[Ys(n),Ys(o)]}function js(e){const t=e.focus;const n=e.anchor;const o=n.key;const r=n.offset;const s=n.type;Bs(n,t.key,t.offset,t.type);Bs(t,o,r,s);e._cachedNodes=null}function Gs(e,t,n,o){e.modify(t,n,o)}function Xs(e,t){const n=e.anchor;const o=e.focus;const r=n.getNode();const s=o.getNode();if(r===s&&n.type==="text"&&o.type==="text"){const e=n.offset;const s=o.offset;const i=e<s;const l=i?e:s;const c=i?s:e;const a=c-1;if(l!==a){const e=r.getTextContent().slice(l,c);if(!jt(e)){if(t){o.offset=a}else{n.offset=a}}}}}function Vs(e,t,n){const o=e;const r=o.getTextContent();const s=r.split(/(?=\s)/g);const i=s.length;let l=0;let c=0;for(let e=0;e<i;e++){const o=s[e];const r=e===i-1;c=l;l+=o.length;if(t&&l===n||l>n||r){s.splice(e,1);if(r){c=undefined}break}}const a=s.join("").trim();if(a===""){o.remove()}else{o.setTextContent(a);o.select(c,c)}}function qs(e,t,n){const o=e.getParent();return n===null||o===null||!o.canBeEmpty()||o!==n.getNode()}function Qs(e,t,n,o){let r=t;let s;if(e.nodeType===re){let i=false;const l=e.childNodes;const c=l.length;const a=o._blockCursorElement;if(r===c){i=true;r=c-1}let u=l[r];let f=false;if(u===a){u=l[r+1];f=true}else if(a!==null){const n=a.parentNode;if(e===n){const e=Array.prototype.indexOf.call(n.children,a);if(t>e){r--}}}s=Ut(u);if(Ds(s)){r=Yt(s,i)}else{let o=Ut(e);if(o===null){return null}if(nl(o)){r=Math.min(o.getChildrenSize(),r);let e=o.getChildAtIndex(r);if(nl(e)&&qs(e,r,n)){const t=i?e.getLastDescendant():e.getFirstDescendant();if(t===null){o=e}else{e=t;o=nl(e)?e:e.getParentOrThrow()}r=0}if(Ds(e)){s=e;o=null;r=Yt(e,i)}else if(e!==o&&i&&!f){r++}}else{const n=o.getIndexWithinParent();if(t===0&&sl(o)&&Ut(e)===o){r=n}else{r=n+1}o=o.getParentOrThrow()}if(nl(o)){return Ps(o.__key,r,"element")}}}else{s=Ut(e)}if(!Ds(s)){return null}return Ps(s.__key,r,"text")}function Zs(e,t,n){const o=e.offset;const r=e.getNode();if(o===0){const o=r.getPreviousSibling();const s=r.getParent();if(!t){if(nl(o)&&!n&&o.isInline()){e.key=o.__key;e.offset=o.getChildrenSize();e.type="element"}else if(Ds(o)){e.key=o.__key;e.offset=o.getTextContent().length}}else if((n||!t)&&o===null&&nl(s)&&s.isInline()){const t=s.getPreviousSibling();if(Ds(t)){e.key=t.__key;e.offset=t.getTextContent().length}}}else if(o===r.getTextContent().length){const o=r.getNextSibling();const s=r.getParent();if(t&&nl(o)&&o.isInline()){e.key=o.__key;e.offset=0;e.type="element"}else if((n||t)&&o===null&&nl(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();if(Ds(t)){e.key=t.__key;e.offset=0}}}}function ei(e,t,n){if(e.type==="text"&&t.type==="text"){const o=e.isBefore(t);const r=e.is(t);Zs(e,o,r);Zs(t,!o,r);if(r){t.key=e.key;t.offset=e.offset;t.type=e.type}const s=Ri();if(s.isComposing()&&s._compositionKey!==e.key&&zs(n)){const o=n.anchor;const r=n.focus;Bs(e,o.key,o.offset,o.type);Bs(t,r.key,r.offset,r.type)}}}function ti(e,t,n,o,r,s){if(e===null||n===null||!pt(r,e,n)){return null}const i=Qs(e,t,zs(s)?s.anchor:null,r);if(i===null){return null}const l=Qs(n,o,zs(s)?s.focus:null,r);if(l===null){return null}if(i.type==="element"&&l.type==="element"){const t=Ut(e);const o=Ut(n);if(sl(t)&&sl(o)){return null}}ei(i,l,s);return[i,l]}function ni(e){return nl(e)&&!e.isInline()}function oi(e,t,n,o,r,s){const i=vi();const l=new Hs(Ps(e,t,r),Ps(n,o,s),0,"");l.dirty=true;i._selection=l;return l}function ri(){const e=Ps("root",0,"element");const t=Ps("root",0,"element");return new Hs(e,t,0,"")}function si(){return new Ws(new Set)}function ii(e){const t=e.getEditorState();const n=t._selection;const o=ho(e._window);if(zs(n)||n==null){return ci(n,o,e,null)}return n.clone()}function li(e,t){return ci(null,e,t,null)}function ci(e,t,n,o){const r=n._window;if(r===null){return null}const s=o||r.event;const i=s?s.type:undefined;const l=i==="selectionchange";const c=!Ge()&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===undefined);let a,u,f,d;if(!zs(e)||c){if(t===null){return null}a=t.anchorNode;u=t.focusNode;f=t.anchorOffset;d=t.focusOffset;if(l&&zs(e)&&!pt(n,a,u)){return e.clone()}}else{return e.clone()}const h=ti(a,f,u,d,n,e);if(h===null){return null}const[g,_]=h;return new Hs(g,_,!zs(e)?0:e.format,!zs(e)?"":e.style)}function ai(){const e=vi();return e._selection}function ui(){const e=Ri();return e._editorState._selection}function fi(e,t,n,o=1){const r=e.anchor;const s=e.focus;const i=r.getNode();const l=s.getNode();if(!t.is(i)&&!t.is(l)){return}const c=t.__key;if(e.isCollapsed()){const t=r.offset;if(n<=t&&o>0||n<t&&o<0){const n=Math.max(0,t+o);r.set(c,n,"element");s.set(c,n,"element");di(e)}}else{const i=e.isBackward();const l=i?s:r;const a=l.getNode();const u=i?r:s;const f=u.getNode();if(t.is(a)){const e=l.offset;if(n<=e&&o>0||n<e&&o<0){l.set(c,Math.max(0,e+o),"element")}}if(t.is(f)){const e=u.offset;if(n<=e&&o>0||n<e&&o<0){u.set(c,Math.max(0,e+o),"element")}}}di(e)}function di(e){const t=e.anchor;const n=t.offset;const o=e.focus;const r=o.offset;const s=t.getNode();const i=o.getNode();if(e.isCollapsed()){if(!nl(s)){return}const e=s.getChildrenSize();const r=n>=e;const i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Ds(i)){let e=0;if(r){e=i.getTextContentSize()}t.set(i.__key,e,"text");o.set(i.__key,e,"text")}return}if(nl(s)){const e=s.getChildrenSize();const o=n>=e;const r=o?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Ds(r)){let e=0;if(o){e=r.getTextContentSize()}t.set(r.__key,e,"text")}}if(nl(i)){const e=i.getChildrenSize();const t=r>=e;const n=t?i.getChildAtIndex(e-1):i.getChildAtIndex(r);if(Ds(n)){let e=0;if(t){e=n.getTextContentSize()}o.set(n.__key,e,"text")}}}function hi(e,t){const n=t.getEditorState();const o=n._selection;const r=e._selection;if(zs(r)){const e=r.anchor;const t=r.focus;let n;if(e.type==="text"){n=e.getNode();n.selectionTransform(o,r)}if(t.type==="text"){const e=t.getNode();if(n!==e){e.selectionTransform(o,r)}}}}function gi(e,t,n,o,r){let s=null;let i=0;let l=null;if(o!==null){s=o.__key;if(Ds(o)){i=o.getTextContentSize();l="text"}else if(nl(o)){i=o.getChildrenSize();l="element"}}else{if(r!==null){s=r.__key;if(Ds(r)){l="text"}else if(nl(r)){l="element"}}}if(s!==null&&l!==null){e.set(s,i,l)}else{i=t.getIndexWithinParent();if(i===-1){i=n.getChildrenSize()}e.set(n.__key,i,"element")}}function _i(e,t,n,o,r){if(e.type==="text"){e.key=n;if(!t){e.offset+=r}}else if(e.offset>o.getIndexWithinParent()){e.offset-=1}}function pi(e,t,n,o,r,s,i){const l=o.anchorNode;const c=o.focusNode;const a=o.anchorOffset;const u=o.focusOffset;const f=document.activeElement;if(r.has("collaboration")&&f!==s||f!==null&&_t(f)){return}if(!zs(t)){if(e!==null&&pt(n,l,c)){o.removeAllRanges()}return}const d=t.anchor;const h=t.focus;const g=d.key;const _=h.key;const p=Jn(n,g);const m=Jn(n,_);const N=d.offset;const y=h.offset;const C=t.format;const T=t.style;const E=t.isCollapsed();let S=p;let w=m;let x=false;if(d.type==="text"){S=St(p);const e=d.getNode();x=e.getFormat()!==C||e.getStyle()!==T}else if(zs(e)&&e.anchor.type==="text"){x=true}if(h.type==="text"){w=St(m)}if(S===null||w===null){return}if(E&&(e===null||x||zs(e)&&(e.format!==C||e.style!==T))){es(C,T,N,g,performance.now())}if(a===N&&u===y&&l===S&&c===w&&!(o.type==="Range"&&E)){if(f===null||!s.contains(f)){s.focus({preventScroll:true})}if(d.type!=="element"){return}}try{o.setBaseAndExtent(S,N,w,y)}catch(e){{console.warn(e)}}if(!r.has("skip-scroll-into-view")&&t.isCollapsed()&&s!==null&&s===document.activeElement){const e=t instanceof Hs&&t.anchor.type==="element"?S.childNodes[N]||null:o.rangeCount>0?o.getRangeAt(0):null;if(e!==null){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e);t=n.getBoundingClientRect()}else{t=e.getBoundingClientRect()}Gn(n,t,s)}}Zr()}function mi(e){let t=ai()||ui();if(t===null){t=Bt().selectEnd()}t.insertNodes(e)}function Ni(){const e=ai();if(e===null){return""}return e.getTextContent()}function yi(e){let t=e;if(!e.isCollapsed()){t.removeText()}const n=ai();if(zs(n)){t=n}if(!zs(t)){throw Error(`Unexpected dirty selection to be null`)}const o=t.anchor;let r=o.getNode();let s=o.offset;while(!yo(r)){[r,s]=Ci(r,s)}return s}function Ci(e,t){const n=e.getParent();if(!n){const e=ml();Bt().append(e);e.select();return[Bt(),0]}if(Ds(e)){const o=e.splitText(t);if(o.length===0){return[n,e.getIndexWithinParent()]}const r=t===0?0:1;const s=o[0].getIndexWithinParent()+r;return[n,s]}if(!nl(e)||t===0){return[n,e.getIndexWithinParent()]}const o=e.getChildAtIndex(t);if(o){const n=new Hs(Ps(e.__key,t,"element"),Ps(e.__key,t,"element"),0,"");const r=e.insertNewAfter(n);if(r){r.append(o,...o.getNextSiblings())}}return[n,e.getIndexWithinParent()+1]}function Ti(e){const t=ml();let n=null;for(let o=0;o<e.length;o++){const r=e[o];const s=cs(r);if(s||sl(r)&&r.isInline()||nl(r)&&r.isInline()||Ds(r)||r.isParentRequired()){if(n===null){n=r.createParentElementNode();t.append(n);if(s){continue}}if(n!==null){n.append(r)}}else{t.append(r);n=null}}return t}let Ei=null;let Si=null;let wi=false;let xi=false;let bi=0;const Oi={characterData:true,childList:true,subtree:true};function Mi(){return wi||Ei!==null&&Ei._readOnly}function Ai(){if(wi){{throw Error(`Cannot use method in read-only mode.`)}}}function Di(){if(bi>99){{throw Error(`One or more transforms are endlessly triggering additional transforms. May have encountered infinite recursion caused by transforms that have their preconditions too lose and/or conflict with each other.`)}}}function vi(){if(Ei===null){{throw Error(`Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().${ki()}`)}}return Ei}function Ri(){if(Si===null){{throw Error(`Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().${ki()}`)}}return Si}function ki(){let e=0;const t=new Set;const n=Ml.version;if(typeof window!=="undefined"){for(const o of document.querySelectorAll("[contenteditable]")){const r=yt(o);if(mt(r)){e++}else if(r){let e=String(r.constructor.version||"<0.17.1");if(e===n){e+=" (separately built, likely a bundler configuration issue)"}t.add(e)}}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;if(t.size){o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`}return o}function Ii(){return Si}function Li(){return Ei}function Pi(e,t,n){const o=t.__type;const r=dt(e,o);let s=n.get(o);if(s===undefined){s=Array.from(r.transforms);n.set(o,s)}const i=s.length;for(let e=0;e<i;e++){s[e](t);if(!t.isAttached()){break}}}function $i(e,t){return e!==undefined&&e.__key!==t&&e.isAttached()}function Fi(e,t){const n=t._dirtyLeaves;const o=e._nodeMap;for(const e of n){const t=o.get(e);if(Ds(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()){it(t)}}}function Ki(e,t){const n=t._dirtyLeaves;const o=t._dirtyElements;const r=e._nodeMap;const s=kt();const i=new Map;let l=n;let c=l.size;let a=o;let u=a.size;while(c>0||u>0){if(c>0){t._dirtyLeaves=new Set;for(const e of l){const o=r.get(e);if(Ds(o)&&o.isAttached()&&o.isSimpleText()&&!o.isUnmergeable()){it(o)}if(o!==undefined&&$i(o,s)){Pi(t,o,i)}n.add(e)}l=t._dirtyLeaves;c=l.size;if(c>0){bi++;continue}}t._dirtyLeaves=new Set;t._dirtyElements=new Map;for(const e of a){const n=e[0];const l=e[1];if(n!=="root"&&!l){continue}const c=r.get(n);if(c!==undefined&&$i(c,s)){Pi(t,c,i)}o.set(n,l)}l=t._dirtyLeaves;c=l.size;a=t._dirtyElements;u=a.size;bi++}t._dirtyLeaves=n;t._dirtyElements=o}function Bi(e){const t=e;return Wi(t,Ri()._nodes)}function Wi(e,t){const n=e.type;const o=t.get(n);if(o===undefined){{throw Error(`parseEditorState: type "${n}" + not found`)}}const r=o.klass;if(e.type!==r.getType()){{throw Error(`LexicalNode: Node ${r.name} does not implement .importJSON().`)}}const s=r.importJSON(e);const i=e.children;if(nl(s)&&Array.isArray(i)){for(let e=0;e<i.length;e++){const n=i[e];const o=Wi(n,t);s.append(o)}}return s}function zi(e,t,n){const o=fl();const r=Ei;const s=wi;const i=Si;const l=t._dirtyElements;const c=t._dirtyLeaves;const a=t._cloneNotNeeded;const u=t._dirtyType;t._dirtyElements=new Map;t._dirtyLeaves=new Set;t._cloneNotNeeded=new Set;t._dirtyType=0;Ei=o;wi=false;Si=t;try{const f=t._nodes;const d=e.root;Wi(d,f);if(n){n()}o._readOnly=true;{Ui(o)}}catch(e){if(e instanceof Error){t._onError(e)}}finally{t._dirtyElements=l;t._dirtyLeaves=c;t._cloneNotNeeded=a;t._dirtyType=u;Ei=r;wi=s;Si=i}return o}function Hi(e,t,n){const o=Ei;const r=wi;const s=Si;Ei=t;wi=true;Si=e;try{return n()}finally{Ei=o;wi=r;Si=s}}function Ui(e){const t=e._nodeMap;t.set=()=>{throw new Error("Cannot call set() on a frozen Lexical node map")};t.clear=()=>{throw new Error("Cannot call clear() on a frozen Lexical node map")};t.delete=()=>{throw new Error("Cannot call delete() on a frozen Lexical node map")}}function Yi(e,t){const o=e._pendingEditorState;const r=e._rootElement;const s=e._headless||r===null;if(o===null){return}const i=e._editorState;const l=i._selection;const c=o._selection;const a=e._dirtyType!==ie;const u=Ei;const f=wi;const d=Si;const h=e._updating;const g=e._observer;let _=null;e._pendingEditorState=null;e._editorState=o;if(!s&&a&&g!==null){Si=e;Ei=o;wi=false;e._updating=true;try{const t=e._dirtyType;const n=e._dirtyElements;const s=e._dirtyLeaves;g.disconnect();_=_r(i,o,e,t,n,s)}catch(t){if(t instanceof Error){e._onError(t)}if(!xi){xl(e,null,r,o);ot(e);e._dirtyType=ce;xi=true;Yi(e,i);xi=false}else{throw t}return}finally{g.observe(r,Oi);e._updating=h;Ei=u;wi=f;Si=d}}if(!o._readOnly){o._readOnly=true;{Ui(o);if(zs(c)){Object.freeze(c.anchor);Object.freeze(c.focus)}Object.freeze(c)}}const p=e._dirtyLeaves;const m=e._dirtyElements;const N=e._normalizedNodes;const y=e._updateTags;const C=e._deferred;if(a){e._dirtyType=ie;e._cloneNotNeeded.clear();e._dirtyLeaves=new Set;e._dirtyElements=new Map;e._normalizedNodes=new Set;e._updateTags=new Set}bo(e,o);const T=s?null:ho(e._window);if(e._editable&&T!==null&&(a||c===null||c.dirty)){Si=e;Ei=o;try{if(g!==null){g.disconnect()}if(a||c===null||c.dirty){const t=e._blockCursorElement;if(t!==null){uo(t,e,r)}pi(l,c,e,T,y,r)}fo(e,r,c);if(g!==null){g.observe(r,Oi)}}finally{Si=d;Ei=u}}if(_!==null){ji(e,_,y,p,i)}if(!zs(c)&&c!==null&&(l===null||!l.is(c))){e.dispatchCommand(n,undefined)}const E=e._pendingDecorators;if(E!==null){e._decorators=E;e._pendingDecorators=null;Gi("decorator",e,true,E)}Ji(e,t||i,o);Gi("update",e,true,{dirtyElements:m,dirtyLeaves:p,editorState:o,normalizedNodes:N,prevEditorState:t||i,tags:y});qi(e,C);Vi(e)}function Ji(e,t,n){const o=Ft(t);const r=Ft(n);if(o!==r){Gi("textcontent",e,true,r)}}function ji(e,t,n,o,r){const s=Array.from(e._listeners.mutation);const i=s.length;for(let e=0;e<i;e++){const[i,l]=s[e];const c=t.get(l);if(c!==undefined){i(c,{dirtyLeaves:o,prevEditorState:r,updateTags:n})}}}function Gi(e,t,n,...o){const r=t._updating;t._updating=n;try{const n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++){n[e].apply(null,o)}}finally{t._updating=r}}function Xi(e,t,n){if(e._updating===false||Si!==e){let o=false;e.update((()=>{o=Xi(e,t,n)}));return o}const o=Gt(e);for(let r=4;r>=0;r--){for(let s=0;s<o.length;s++){const i=o[s];const l=i._commands;const c=l.get(t);if(c!==undefined){const t=c[r];if(t!==undefined){const o=Array.from(t);const r=o.length;for(let t=0;t<r;t++){if(o[t](n,e)===true){return true}}}}}}return false}function Vi(e){const t=e._updates;if(t.length!==0){const n=t.shift();if(n){const[t,o]=n;Zi(e,t,o)}}}function qi(e,t){e._deferred=[];if(t.length!==0){const n=e._updating;e._updating=true;try{for(let e=0;e<t.length;e++){t[e]()}}finally{e._updating=n}}}function Qi(e,t){const n=e._updates;let o=t||false;while(n.length!==0){const t=n.shift();if(t){const[n,r]=t;let s;let i;if(r!==undefined){s=r.onUpdate;i=r.tag;if(r.skipTransforms){o=true}if(r.discrete){const t=e._pendingEditorState;if(!(t!==null)){throw Error(`Unexpected empty pending editor state on discrete nested update`)}t._flushSync=true}if(s){e._deferred.push(s)}if(i){e._updateTags.add(i)}}n()}}return o}function Zi(e,t,n){const o=e._updateTags;let r;let s;let i=false;let l=false;if(n!==undefined){r=n.onUpdate;s=n.tag;if(s!=null){o.add(s)}i=n.skipTransforms||false;l=n.discrete||false}if(r){e._deferred.push(r)}const c=e._editorState;let a=e._pendingEditorState;let u=false;if(a===null||a._readOnly){a=e._pendingEditorState=ul(a||c);u=true}a._flushSync=l;const f=Ei;const d=wi;const h=Si;const g=e._updating;Ei=a;wi=false;e._updating=true;Si=e;try{if(u){if(e._headless){if(c._selection!==null){a._selection=c._selection.clone()}}else{a._selection=ii(e)}}const n=e._compositionKey;t();i=Qi(e,i);hi(a,e);if(e._dirtyType!==ie){if(i){Fi(a,e)}else{Ki(a,e)}Qi(e);Mo(c,a,e._dirtyLeaves,e._dirtyElements)}const o=e._compositionKey;if(n!==o){a._flushSync=true}const r=a._selection;if(zs(r)){const e=a._nodeMap;const t=r.anchor.key;const n=r.focus.key;if(e.get(t)===undefined||e.get(n)===undefined){{throw Error(`updateEditor: selection has been lost because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node.`)}}}else if(Us(r)){if(r._nodes.size===0){a._selection=null}}}catch(t){if(t instanceof Error){e._onError(t)}e._pendingEditorState=c;e._dirtyType=ce;e._cloneNotNeeded.clear();e._dirtyLeaves=new Set;e._dirtyElements.clear();Yi(e);return}finally{Ei=f;wi=d;Si=h;e._updating=g;bi=0}const _=e._dirtyType!==ie||al(a,e);if(_){if(a._flushSync){a._flushSync=false;Yi(e)}else if(u){ht((()=>{Yi(e)}))}}else{a._flushSync=false;if(u){o.clear();e._deferred=[];e._pendingEditorState=null}}}function el(e,t,n){if(e._updating){e._updates.push([t,n])}else{Zi(e,t,n)}}class tl extends ns{constructor(e){super(e);this.__first=null;this.__last=null;this.__size=0;this.__format=0;this.__style="";this.__indent=0;this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e);this.__first=e.__first;this.__last=e.__last;this.__size=e.__size;this.__indent=e.__indent;this.__format=e.__format;this.__style=e.__style;this.__dir=e.__dir}getFormat(){const e=this.getLatest();return e.__format}getFormatType(){const e=this.getFormat();return We[e]||""}getStyle(){const e=this.getLatest();return e.__style}getIndent(){const e=this.getLatest();return e.__indent}getChildren(){const e=[];let t=this.getFirstChild();while(t!==null){e.push(t);t=t.getNextSibling()}return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();while(t!==null){e.push(t.__key);t=t.getNextSibling()}return e}getChildrenSize(){const e=this.getLatest();return e.__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Ri();const t=e._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const e=this.getLatest();const t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();while(t!==null){if(Ds(t)){e.push(t)}if(nl(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();while(nl(e)){const t=e.getFirstChild();if(t===null){break}e=t}return e}getLastDescendant(){let e=this.getLastChild();while(nl(e)){const t=e.getLastChild();if(t===null){break}e=t}return e}getDescendantByIndex(e){const t=this.getChildren();const n=t.length;if(e>=n){const e=t[n-1];return nl(e)&&e.getLastDescendant()||e||null}const o=t[e];return nl(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const e=this.getLatest();const t=e.__first;return t===null?null:It(t)}getFirstChildOrThrow(){const e=this.getFirstChild();if(e===null){{throw Error(`Expected node ${this.__key} to have a first child.`)}}return e}getLastChild(){const e=this.getLatest();const t=e.__last;return t===null?null:It(t)}getLastChildOrThrow(){const e=this.getLastChild();if(e===null){{throw Error(`Expected node ${this.__key} to have a last child.`)}}return e}getChildAtIndex(e){const t=this.getChildrenSize();let n;let o;if(e<t/2){n=this.getFirstChild();o=0;while(n!==null&&o<=e){if(o===e){return n}n=n.getNextSibling();o++}return null}n=this.getLastChild();o=t-1;while(n!==null&&o>=e){if(o===e){return n}n=n.getPreviousSibling();o--}return null}getTextContent(){let e="";const t=this.getChildren();const n=t.length;for(let o=0;o<n;o++){const r=t[o];e+=r.getTextContent();if(nl(r)&&o!==n-1&&!r.isInline()){e+=Re}}return e}getTextContentSize(){let e=0;const t=this.getChildren();const n=t.length;for(let o=0;o<n;o++){const r=t[o];e+=r.getTextContentSize();if(nl(r)&&o!==n-1&&!r.isInline()){e+=Re.length}}return e}getDirection(){const e=this.getLatest();return e.__dir}hasFormat(e){if(e!==""){const t=Be[e];return(this.getFormat()&t)!==0}return false}select(e,t){Ai();const n=ai();let o=e;let r=t;const s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const e=this.getFirstChild();if(Ds(e)||nl(e)){return e.select(0,0)}}else if((e===undefined||e===s)&&(t===undefined||t===s)){const e=this.getLastChild();if(Ds(e)||nl(e)){return e.select()}}}if(o===undefined){o=s}if(r===undefined){r=s}const i=this.__key;if(!zs(n)){return oi(i,o,i,r,"element","element")}else{n.anchor.set(i,o,"element");n.focus.set(i,r,"element");n.dirty=true}return n}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();const t=this.getChildren();t.forEach((e=>e.remove()));return e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();t.__dir=e;return t}setFormat(e){const t=this.getWritable();t.__format=e!==""?Be[e]:0;return this}setStyle(e){const t=this.getWritable();t.__style=e||"";return this}setIndent(e){const t=this.getWritable();t.__indent=e;return this}splice(e,t,n){const o=n.length;const r=this.getChildrenSize();const s=this.getWritable();const i=s.__key;const l=[];const c=[];const a=this.getChildAtIndex(e+t);let u=null;let f=r-t+o;if(e!==0){if(e===r){u=this.getLastChild()}else{const t=this.getChildAtIndex(e);if(t!==null){u=t.getPreviousSibling()}}}if(t>0){let e=u===null?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){if(e===null){{throw Error(`splice: sibling not found`)}}const t=e.getNextSibling();const n=e.__key;const o=e.getWritable();At(o);c.push(n);e=t}}let d=u;for(let e=0;e<o;e++){const t=n[e];if(d!==null&&t.is(d)){u=d=d.getPreviousSibling()}const o=t.getWritable();if(o.__parent===i){f--}At(o);const r=t.__key;if(d===null){s.__first=r;o.__prev=null}else{const e=d.getWritable();e.__next=r;o.__prev=e.__key}if(t.__key===i){{throw Error(`append: attempting to append self`)}}o.__parent=i;l.push(r);d=t}if(e+t===r){if(d!==null){const e=d.getWritable();e.__next=null;s.__last=d.__key}}else if(a!==null){const e=a.getWritable();if(d!==null){const t=d.getWritable();e.__prev=d.__key;t.__next=a.__key}else{e.__prev=null}}s.__size=f;if(c.length){const e=ai();if(zs(e)){const t=new Set(c);const n=new Set(l);const{anchor:o,focus:r}=e;if(ol(o,t,n)){gi(o,o.getNode(),this,u,a)}if(ol(r,t,n)){gi(r,r.getNode(),this,u,a)}if(f===0&&!this.canBeEmpty()&&!oo(this)){this.remove()}}}return s}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return true}collapseAtStart(e){return false}excludeFromCopy(e){return false}canReplaceWith(e){return true}canInsertAfter(e){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(e){return false}extractWithChild(e,t,n){return false}canMergeWhenEmpty(){return false}}function nl(e){return e instanceof tl}function ol(e,t,n){let o=e.getNode();while(o){const e=o.__key;if(t.has(e)&&!n.has(e)){return true}o=o.getParent()}return false}class rl extends ns{constructor(e){super(e)}decorate(e,t){{throw Error(`decorate: base method not extended`)}}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function sl(e){return e instanceof rl}class il extends tl{static getType(){return"root"}static clone(){return new il}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){{throw Error(`getTopLevelElementOrThrow: root nodes are not top level elements`)}}getTextContent(){const e=this.__cachedText;if(Mi()||Ri()._dirtyType===ie){if(e!==null){return e}}return super.getTextContent()}remove(){{throw Error(`remove: cannot be called on root nodes`)}}replace(e){{throw Error(`replace: cannot be called on root nodes`)}}insertBefore(e){{throw Error(`insertBefore: cannot be called on root nodes`)}}insertAfter(e){{throw Error(`insertAfter: cannot be called on root nodes`)}}updateDOM(e,t){return false}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(!nl(n)&&!sl(n)){{throw Error(`rootNode.append: Only element or decorator nodes can be appended to the root node`)}}}return super.append(...e)}static importJSON(e){const t=Bt();t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return true}}function ll(){return new il}function cl(e){return e instanceof il}function al(e,t){const n=t.getEditorState()._selection;const o=e._selection;if(o!==null){if(o.dirty||!o.is(n)){return true}}else if(n!==null){return true}return false}function ul(e){return new hl(new Map(e._nodeMap))}function fl(){return new hl(new Map([["root",ll()]]))}function dl(e){const t=e.exportJSON();const n=e.constructor;if(t.type!==n.getType()){{throw Error(`LexicalNode: Node ${n.name} does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.`)}}if(nl(e)){const o=t.children;if(!Array.isArray(o)){{throw Error(`LexicalNode: Node ${n.name} is an element but .exportJSON() does not have a children array.`)}}const r=e.getChildren();for(let e=0;e<r.length;e++){const t=r[e];const n=dl(t);o.push(n)}}return t}class hl{constructor(e,t){this._nodeMap=e;this._selection=t||null;this._flushSync=false;this._readOnly=false}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Hi(t&&t.editor||null,this,e)}clone(e){const t=new hl(this._nodeMap,e===undefined?this._selection:e);t._readOnly=true;return t}toJSON(){return Hi(null,this,(()=>({root:dl(Bt())})))}}class gl extends tl{static getType(){return"artificial"}createDOM(e){const t=document.createElement("div");return t}}class _l extends tl{constructor(e){super(e);this.__textFormat=0;this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){const e=this.getLatest();return e.__textFormat}setTextFormat(e){const t=this.getWritable();t.__textFormat=e;return t}hasTextFormat(e){const t=Fe[e];return(this.getTextFormat()&t)!==0}getTextStyle(){const e=this.getLatest();return e.__textStyle}setTextStyle(e){const t=this.getWritable();t.__textStyle=e;return t}static clone(e){return new _l(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e);this.__textFormat=e.__textFormat;this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p");const n=Fn(e.theme,"paragraph");if(n!==undefined){const e=t.classList;e.add(...n)}return t}updateDOM(e,t,n){return false}static importDOM(){return{p:e=>({conversion:pl,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&po(t)){if(this.isEmpty()){t.append(document.createElement("br"))}const e=this.getFormatType();t.style.textAlign=e;const n=this.getDirection();if(n){t.dir=n}const o=this.getIndent();if(o>0){t.style.textIndent=`${o*20}px`}}return{element:t}}static importJSON(e){const t=ml();t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);t.setTextFormat(e.textFormat);return t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=ml();n.setTextFormat(e.format);n.setTextStyle(e.style);const o=this.getDirection();n.setDirection(o);n.setFormat(this.getFormatType());n.setStyle(this.getTextStyle());this.insertAfter(n,t);return n}collapseAtStart(){const e=this.getChildren();if(e.length===0||Ds(e[0])&&e[0].getTextContent().trim()===""){const e=this.getNextSibling();if(e!==null){this.selectNext();this.remove();return true}const t=this.getPreviousSibling();if(t!==null){this.selectPrevious();this.remove();return true}}return false}}function pl(e){const t=ml();if(e.style){t.setFormat(e.style.textAlign);const n=parseInt(e.style.textIndent,10)/20;if(n>0){t.setIndent(n)}}return{node:t}}function ml(){return so(new _l)}function Nl(e){return e instanceof _l}const yl=true;const Cl=0;const Tl=1;const El=2;const Sl=3;const wl=4;function xl(e,t,n,o){const r=e._keyToDOMMap;r.clear();e._editorState=fl();e._pendingEditorState=o;e._compositionKey=null;e._dirtyType=ie;e._cloneNotNeeded.clear();e._dirtyLeaves=new Set;e._dirtyElements.clear();e._normalizedNodes=new Set;e._updateTags=new Set;e._updates=[];e._blockCursorElement=null;const s=e._observer;if(s!==null){s.disconnect();e._observer=null}if(t!==null){t.textContent=""}if(n!==null){n.textContent="";r.set("root",n)}}function bl(e,t){const n=new Map;const o=new Set;const r=e=>{Object.keys(e).forEach((t=>{let o=n.get(t);if(o===undefined){o=[];n.set(t,o)}o.push(e[t])}))};e.forEach((e=>{const t=e.klass.importDOM;if(t==null||o.has(t)){return}o.add(t);const n=t.call(e.klass);if(n!==null){r(n)}}));if(t){r(t)}return n}function Ol(e){const t=e||{};const n=Ii();const o=t.theme||{};const r=e===undefined?n:t.parentEditor||null;const s=t.disableEvents||false;const i=fl();const l=t.namespace||(r!==null?r._config.namespace:Xt());const c=t.editorState;const a=[il,ys,ss,Rs,_l,gl,...t.nodes||[]];const{onError:u,html:f}=t;const d=t.editable!==undefined?t.editable:true;let h;if(e===undefined&&n!==null){h=n._nodes}else{h=new Map;for(let e=0;e<a.length;e++){let t=a[e];let n=null;let o=null;if(typeof t!=="function"){const e=t;t=e.replace;n=e.with;o=e.withKlass||null}{const e=Object.prototype.hasOwnProperty.call(t,"getType")&&t.getType();const n=t.name;if(o){if(!(o.prototype instanceof t)){throw Error(`${o.name} doesn't extend the ${n}`)}}if(n!=="RootNode"&&e!=="root"&&e!=="artificial"){const e=t.prototype;["getType","clone"].forEach((e=>{if(!t.hasOwnProperty(e)){console.warn(`${n} must implement static "${e}" method`)}}));if(!t.hasOwnProperty("importDOM")&&t.hasOwnProperty("exportDOM")){console.warn(`${n} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`)}if(e instanceof rl){if(!e.hasOwnProperty("decorate")){console.warn(`${e.constructor.name} must implement "decorate" method`)}}if(!t.hasOwnProperty("importJSON")){console.warn(`${n} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`)}if(!e.hasOwnProperty("exportJSON")){console.warn(`${n} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`)}}}const r=t.getType();const s=t.transform();const i=new Set;if(s!==null){i.add(s)}h.set(r,{exportDOM:f&&f.export?f.export.get(t):undefined,klass:t,replace:n,replaceWithKlass:o,transforms:i})}}const g=new Ml(i,r,h,{disableEvents:s,namespace:l,theme:o},u?u:console.error,bl(h,f?f.import:undefined),d);if(c!==undefined){g._pendingEditorState=c;g._dirtyType=ce}return g}class Ml{constructor(e,t,n,o,r,s,i){this._parentEditor=t;this._rootElement=null;this._editorState=e;this._pendingEditorState=null;this._compositionKey=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=false;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=o;this._nodes=n;this._decorators={};this._pendingDecorators=null;this._dirtyType=ie;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=Xt();this._onError=r;this._htmlConversions=s;this._editable=i;this._headless=t!==null&&t._headless;this._window=null;this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;t.add(e);return()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;t.add(e);return()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;t.add(e);return()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;t.add(e);return()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;e(this._rootElement,null);t.add(e);return()=>{e(null,this._rootElement);t.delete(e)}}registerCommand(e,t,n){if(n===undefined){{throw Error(`Listener for type "command" requires a "priority".`)}}const o=this._commands;if(!o.has(e)){o.set(e,[new Set,new Set,new Set,new Set,new Set])}const r=o.get(e);if(r===undefined){{throw Error(`registerCommand: Command ${String(e)} not found in command map`)}}const s=r[n];s.add(t);return()=>{s.delete(t);if(r.every((e=>e.size===0))){o.delete(e)}}}registerMutationListener(e,t,n){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass;const r=this._listeners.mutation;r.set(t,o);const s=n&&n.skipInitialization;if(!(s===undefined?yl:s)){this.initializeMutationListener(t,o)}return()=>{r.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());if(t===undefined){{throw Error(`Node ${e.name} has not been registered. Ensure node has been passed to createEditor.`)}}return t}resolveRegisteredNodeAfterReplacements(e){while(e.replaceWithKlass){e=this.getRegisteredNode(e.replaceWithKlass)}return e}initializeMutationListener(e,t){const n=this._editorState;const o=wo(n).get(t.getType());if(!o){return}const r=new Map;for(const e of o.keys()){r.set(e,"created")}if(r.size>0){e(r,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);n.transforms.add(t);return n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t);const o=[n];const r=n.replaceWithKlass;if(r!=null){const e=this.registerNodeTransformToKlass(r,t);o.push(e)}Kt(this,e.getType());return()=>{o.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Un(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=Fn(this._config.theme,"root");const o=this._pendingEditorState||this._editorState;this._rootElement=e;xl(this,t,e,o);if(t!==null){if(!this._config.disableEvents){qr(t)}if(n!=null){t.classList.remove(...n)}}if(e!==null){const t=Zn(e);const o=e.style;o.userSelect="text";o.whiteSpace="pre-wrap";o.wordBreak="break-word";e.setAttribute("data-lexical-editor","true");this._window=t;this._dirtyType=ce;ot(this);this._updateTags.add("history-merge");Yi(this);if(!this._config.disableEvents){Vr(e,this)}if(n!=null){e.classList.add(...n)}}else{this._editorState=o;this._pendingEditorState=null;this._window=null}Gi("root",this,false,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){if(e.isEmpty()){{throw Error(`setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty.`)}}nt(this);const n=this._pendingEditorState;const o=this._updateTags;const r=t!==undefined?t.tag:null;if(n!==null&&!n.isEmpty()){if(r!=null){o.add(r)}Yi(this)}this._pendingEditorState=e;this._dirtyType=ce;this._dirtyElements.set("root",false);this._compositionKey=null;if(r!=null){o.add(r)}Yi(this)}parseEditorState(e,t){const n=typeof e==="string"?JSON.parse(e):e;return zi(n,this,t)}read(e){Yi(this);return this.getEditorState().read(e,{editor:this})}update(e,t){el(this,e,t)}focus(e,t={}){const n=this._rootElement;if(n!==null){n.setAttribute("autocapitalize","off");el(this,(()=>{const e=ai();const n=Bt();if(e!==null){e.dirty=true}else if(n.getChildrenSize()!==0){if(t.defaultSelection==="rootStart"){n.selectStart()}else{n.selectEnd()}}}),{onUpdate:()=>{n.removeAttribute("autocapitalize");if(e){e()}},tag:"focus"});if(this._pendingEditorState===null){n.removeAttribute("autocapitalize")}}}blur(){const e=this._rootElement;if(e!==null){e.blur()}const t=ho(this._window);if(t!==null){t.removeAllRanges()}}isEditable(){return this._editable}setEditable(e){if(this._editable!==e){this._editable=e;Gi("editable",this,true,e)}}toJSON(){return{editorState:this._editorState.toJSON()}}}Ml.version="0.17.1+dev.esm";var Al=Object.freeze({$addUpdateTag:Vn,$applyNodeReplacement:so,$cloneWithProperties:xo,$copyNode:ro,$createLineBreakNode:ls,$createNodeSelection:si,$createParagraphNode:ml,$createPoint:Ps,$createRangeSelection:ri,$createRangeSelectionFromDom:li,$createTabNode:ks,$createTextNode:As,$getAdjacentNode:zn,$getCharacterOffsets:Js,$getEditor:To,$getNearestNodeFromDOMNode:Pt,$getNearestRootOrShadowRoot:no,$getNodeByKey:It,$getNodeByKeyOrThrow:lo,$getPreviousSelection:ui,$getRoot:Bt,$getSelection:ai,$getTextContent:Ni,$hasAncestor:Qn,$hasUpdateTag:Xn,$insertNodes:mi,$isBlockElementNode:ni,$isDecoratorNode:sl,$isElementNode:nl,$isInlineElementOrDecoratorNode:to,$isLeafNode:xt,$isLineBreakNode:cs,$isNodeSelection:Us,$isParagraphNode:Nl,$isRangeSelection:zs,$isRootNode:cl,$isRootOrShadowRoot:oo,$isTabNode:Is,$isTextNode:Ds,$isTokenOrSegmented:Tt,$nodesOfType:Bn,$normalizeSelection__EXPERIMENTAL:lt,$parseSerializedNode:Bi,$selectAll:$n,$setCompositionKey:Rt,$setSelection:zt,$splitNode:go,ArtificialNode__DO_NOT_USE:gl,BLUR_COMMAND:Y,CAN_REDO_COMMAND:z,CAN_UNDO_COMMAND:H,CLEAR_EDITOR_COMMAND:B,CLEAR_HISTORY_COMMAND:W,CLICK_COMMAND:r,COMMAND_PRIORITY_CRITICAL:wl,COMMAND_PRIORITY_EDITOR:Cl,COMMAND_PRIORITY_HIGH:Sl,COMMAND_PRIORITY_LOW:Tl,COMMAND_PRIORITY_NORMAL:El,CONTROLLED_TEXT_INSERTION_COMMAND:c,COPY_COMMAND:$,CUT_COMMAND:F,DELETE_CHARACTER_COMMAND:s,DELETE_LINE_COMMAND:d,DELETE_WORD_COMMAND:f,DRAGEND_COMMAND:P,DRAGOVER_COMMAND:L,DRAGSTART_COMMAND:I,DROP_COMMAND:R,DecoratorNode:rl,ElementNode:tl,FOCUS_COMMAND:U,FORMAT_ELEMENT_COMMAND:k,FORMAT_TEXT_COMMAND:h,INDENT_CONTENT_COMMAND:D,INSERT_LINE_BREAK_COMMAND:i,INSERT_PARAGRAPH_COMMAND:l,INSERT_TAB_COMMAND:A,IS_ALL_FORMATTING:Ce,IS_BOLD:de,IS_CODE:pe,IS_HIGHLIGHT:ye,IS_ITALIC:he,IS_STRIKETHROUGH:ge,IS_SUBSCRIPT:me,IS_SUPERSCRIPT:Ne,IS_UNDERLINE:_e,KEY_ARROW_DOWN_COMMAND:E,KEY_ARROW_LEFT_COMMAND:y,KEY_ARROW_RIGHT_COMMAND:m,KEY_ARROW_UP_COMMAND:T,KEY_BACKSPACE_COMMAND:x,KEY_DELETE_COMMAND:O,KEY_DOWN_COMMAND:p,KEY_ENTER_COMMAND:S,KEY_ESCAPE_COMMAND:b,KEY_MODIFIER_COMMAND:J,KEY_SPACE_COMMAND:w,KEY_TAB_COMMAND:M,LineBreakNode:ss,MOVE_TO_END:N,MOVE_TO_START:C,OUTDENT_CONTENT_COMMAND:v,PASTE_COMMAND:a,ParagraphNode:_l,REDO_COMMAND:_,REMOVE_TEXT_COMMAND:u,RootNode:il,SELECTION_CHANGE_COMMAND:n,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:o,SELECT_ALL_COMMAND:K,TEXT_TYPE_TO_FORMAT:Fe,TabNode:Rs,TextNode:ys,UNDO_COMMAND:g,createCommand:t,createEditor:Ol,getEditorPropertyFromDOMNode:yt,getNearestEditorFromDOMNode:Nt,isBlockDomNode:No,isCurrentlyReadOnlyMode:Mi,isHTMLAnchorElement:_o,isHTMLElement:po,isInlineDomNode:mo,isLexicalEditor:mt,isSelectionCapturedInDecoratorInput:_t,isSelectionWithinEditor:pt,resetRandomKey:ut});const Dl="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,vl=Dl&&"documentMode"in document?document.documentMode:null,Rl=Dl&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),kl=Dl&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Il=!(!Dl||!("InputEvent"in window)||vl)&&"getTargetRanges"in new window.InputEvent("input"),Ll=Dl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Pl=Dl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$l=Dl&&/Android/.test(navigator.userAgent),Fl=Dl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Kl=Dl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Fl;function Bl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wl=Bl((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const zl=Object.freeze({});const Hl=Al;const Ul=Hl.$addUpdateTag;const Yl=Hl.$applyNodeReplacement;const Jl=Hl.$cloneWithProperties;const jl=Hl.$copyNode;const Gl=Hl.$createLineBreakNode;const Xl=Hl.$createNodeSelection;const Vl=Hl.$createParagraphNode;const ql=Hl.$createPoint;const Ql=Hl.$createRangeSelection;const Zl=Hl.$createRangeSelectionFromDom;const ec=Hl.$createTabNode;const tc=Hl.$createTextNode;const nc=Hl.$getAdjacentNode;const oc=Hl.$getCharacterOffsets;const rc=Hl.$getEditor;const sc=Hl.$getNearestNodeFromDOMNode;const ic=Hl.$getNearestRootOrShadowRoot;const lc=Hl.$getNodeByKey;const cc=Hl.$getNodeByKeyOrThrow;const ac=Hl.$getPreviousSelection;const uc=Hl.$getRoot;const fc=Hl.$getSelection;const dc=Hl.$getTextContent;const hc=Hl.$hasAncestor;const gc=Hl.$hasUpdateTag;const _c=Hl.$insertNodes;const pc=Hl.$isBlockElementNode;const mc=Hl.$isDecoratorNode;const Nc=Hl.$isElementNode;const yc=Hl.$isInlineElementOrDecoratorNode;const Cc=Hl.$isLeafNode;const Tc=Hl.$isLineBreakNode;const Ec=Hl.$isNodeSelection;const Sc=Hl.$isParagraphNode;const wc=Hl.$isRangeSelection;const xc=Hl.$isRootNode;const bc=Hl.$isRootOrShadowRoot;const Oc=Hl.$isTabNode;const Mc=Hl.$isTextNode;const Ac=Hl.$isTokenOrSegmented;const Dc=Hl.$nodesOfType;const vc=Hl.$normalizeSelection__EXPERIMENTAL;const Rc=Hl.$parseSerializedNode;const kc=Hl.$selectAll;const Ic=Hl.$setCompositionKey;const Lc=Hl.$setSelection;const Pc=Hl.$splitNode;const $c=Hl.ArtificialNode__DO_NOT_USE;const Fc=Hl.BLUR_COMMAND;const Kc=Hl.CAN_REDO_COMMAND;const Bc=Hl.CAN_UNDO_COMMAND;const Wc=Hl.CLEAR_EDITOR_COMMAND;const zc=Hl.CLEAR_HISTORY_COMMAND;const Hc=Hl.CLICK_COMMAND;const Uc=Hl.COMMAND_PRIORITY_CRITICAL;const Yc=Hl.COMMAND_PRIORITY_EDITOR;const Jc=Hl.COMMAND_PRIORITY_HIGH;const jc=Hl.COMMAND_PRIORITY_LOW;const Gc=Hl.COMMAND_PRIORITY_NORMAL;const Xc=Hl.CONTROLLED_TEXT_INSERTION_COMMAND;const Vc=Hl.COPY_COMMAND;const qc=Hl.CUT_COMMAND;const Qc=Hl.DELETE_CHARACTER_COMMAND;const Zc=Hl.DELETE_LINE_COMMAND;const ea=Hl.DELETE_WORD_COMMAND;const ta=Hl.DRAGEND_COMMAND;const na=Hl.DRAGOVER_COMMAND;const oa=Hl.DRAGSTART_COMMAND;const ra=Hl.DROP_COMMAND;const sa=Hl.DecoratorNode;const ia=Hl.ElementNode;const la=Hl.FOCUS_COMMAND;const ca=Hl.FORMAT_ELEMENT_COMMAND;const aa=Hl.FORMAT_TEXT_COMMAND;const ua=Hl.INDENT_CONTENT_COMMAND;const fa=Hl.INSERT_LINE_BREAK_COMMAND;const da=Hl.INSERT_PARAGRAPH_COMMAND;const ha=Hl.INSERT_TAB_COMMAND;const ga=Hl.IS_ALL_FORMATTING;const _a=Hl.IS_BOLD;const pa=Hl.IS_CODE;const ma=Hl.IS_HIGHLIGHT;const Na=Hl.IS_ITALIC;const ya=Hl.IS_STRIKETHROUGH;const Ca=Hl.IS_SUBSCRIPT;const Ta=Hl.IS_SUPERSCRIPT;const Ea=Hl.IS_UNDERLINE;const Sa=Hl.KEY_ARROW_DOWN_COMMAND;const wa=Hl.KEY_ARROW_LEFT_COMMAND;const xa=Hl.KEY_ARROW_RIGHT_COMMAND;const ba=Hl.KEY_ARROW_UP_COMMAND;const Oa=Hl.KEY_BACKSPACE_COMMAND;const Ma=Hl.KEY_DELETE_COMMAND;const Aa=Hl.KEY_DOWN_COMMAND;const Da=Hl.KEY_ENTER_COMMAND;const va=Hl.KEY_ESCAPE_COMMAND;const Ra=Hl.KEY_MODIFIER_COMMAND;const ka=Hl.KEY_SPACE_COMMAND;const Ia=Hl.KEY_TAB_COMMAND;const La=Hl.LineBreakNode;const Pa=Hl.MOVE_TO_END;const $a=Hl.MOVE_TO_START;const Fa=Hl.OUTDENT_CONTENT_COMMAND;const Ka=Hl.PASTE_COMMAND;const Ba=Hl.ParagraphNode;const Wa=Hl.REDO_COMMAND;const za=Hl.REMOVE_TEXT_COMMAND;const Ha=Hl.RootNode;const Ua=Hl.SELECTION_CHANGE_COMMAND;const Ya=Hl.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND;const Ja=Hl.SELECT_ALL_COMMAND;const ja=Hl.TEXT_TYPE_TO_FORMAT;const Ga=Hl.TabNode;const Xa=Hl.TextNode;const Va=Hl.UNDO_COMMAND;const qa=Hl.createCommand;const Qa=Hl.createEditor;const Za=Hl.getEditorPropertyFromDOMNode;const eu=Hl.getNearestEditorFromDOMNode;const tu=Hl.isBlockDomNode;const nu=Hl.isCurrentlyReadOnlyMode;const ou=Hl.isHTMLAnchorElement;const ru=Hl.isHTMLElement;const su=Hl.isInlineDomNode;const iu=Hl.isLexicalEditor;const lu=Hl.isSelectionCapturedInDecoratorInput;const cu=Hl.isSelectionWithinEditor;const au=Hl.resetRandomKey;var uu=Object.freeze({$addUpdateTag:Ul,$applyNodeReplacement:Yl,$cloneWithProperties:Jl,$copyNode:jl,$createLineBreakNode:Gl,$createNodeSelection:Xl,$createParagraphNode:Vl,$createPoint:ql,$createRangeSelection:Ql,$createRangeSelectionFromDom:Zl,$createTabNode:ec,$createTextNode:tc,$getAdjacentNode:nc,$getCharacterOffsets:oc,$getEditor:rc,$getNearestNodeFromDOMNode:sc,$getNearestRootOrShadowRoot:ic,$getNodeByKey:lc,$getNodeByKeyOrThrow:cc,$getPreviousSelection:ac,$getRoot:uc,$getSelection:fc,$getTextContent:dc,$hasAncestor:hc,$hasUpdateTag:gc,$insertNodes:_c,$isBlockElementNode:pc,$isDecoratorNode:mc,$isElementNode:Nc,$isInlineElementOrDecoratorNode:yc,$isLeafNode:Cc,$isLineBreakNode:Tc,$isNodeSelection:Ec,$isParagraphNode:Sc,$isRangeSelection:wc,$isRootNode:xc,$isRootOrShadowRoot:bc,$isTabNode:Oc,$isTextNode:Mc,$isTokenOrSegmented:Ac,$nodesOfType:Dc,$normalizeSelection__EXPERIMENTAL:vc,$parseSerializedNode:Rc,$selectAll:kc,$setCompositionKey:Ic,$setSelection:Lc,$splitNode:Pc,ArtificialNode__DO_NOT_USE:$c,BLUR_COMMAND:Fc,CAN_REDO_COMMAND:Kc,CAN_UNDO_COMMAND:Bc,CLEAR_EDITOR_COMMAND:Wc,CLEAR_HISTORY_COMMAND:zc,CLICK_COMMAND:Hc,COMMAND_PRIORITY_CRITICAL:Uc,COMMAND_PRIORITY_EDITOR:Yc,COMMAND_PRIORITY_HIGH:Jc,COMMAND_PRIORITY_LOW:jc,COMMAND_PRIORITY_NORMAL:Gc,CONTROLLED_TEXT_INSERTION_COMMAND:Xc,COPY_COMMAND:Vc,CUT_COMMAND:qc,DELETE_CHARACTER_COMMAND:Qc,DELETE_LINE_COMMAND:Zc,DELETE_WORD_COMMAND:ea,DRAGEND_COMMAND:ta,DRAGOVER_COMMAND:na,DRAGSTART_COMMAND:oa,DROP_COMMAND:ra,DecoratorNode:sa,ElementNode:ia,FOCUS_COMMAND:la,FORMAT_ELEMENT_COMMAND:ca,FORMAT_TEXT_COMMAND:aa,INDENT_CONTENT_COMMAND:ua,INSERT_LINE_BREAK_COMMAND:fa,INSERT_PARAGRAPH_COMMAND:da,INSERT_TAB_COMMAND:ha,IS_ALL_FORMATTING:ga,IS_BOLD:_a,IS_CODE:pa,IS_HIGHLIGHT:ma,IS_ITALIC:Na,IS_STRIKETHROUGH:ya,IS_SUBSCRIPT:Ca,IS_SUPERSCRIPT:Ta,IS_UNDERLINE:Ea,KEY_ARROW_DOWN_COMMAND:Sa,KEY_ARROW_LEFT_COMMAND:wa,KEY_ARROW_RIGHT_COMMAND:xa,KEY_ARROW_UP_COMMAND:ba,KEY_BACKSPACE_COMMAND:Oa,KEY_DELETE_COMMAND:Ma,KEY_DOWN_COMMAND:Aa,KEY_ENTER_COMMAND:Da,KEY_ESCAPE_COMMAND:va,KEY_MODIFIER_COMMAND:Ra,KEY_SPACE_COMMAND:ka,KEY_TAB_COMMAND:Ia,LineBreakNode:La,MOVE_TO_END:Pa,MOVE_TO_START:$a,OUTDENT_CONTENT_COMMAND:Fa,PASTE_COMMAND:Ka,ParagraphNode:Ba,REDO_COMMAND:Wa,REMOVE_TEXT_COMMAND:za,RootNode:Ha,SELECTION_CHANGE_COMMAND:Ua,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Ya,SELECT_ALL_COMMAND:Ja,TEXT_TYPE_TO_FORMAT:ja,TabNode:Ga,TextNode:Xa,UNDO_COMMAND:Va,createCommand:qa,createEditor:Qa,getEditorPropertyFromDOMNode:Za,getNearestEditorFromDOMNode:eu,isBlockDomNode:tu,isCurrentlyReadOnlyMode:nu,isHTMLAnchorElement:ou,isHTMLElement:ru,isInlineDomNode:su,isLexicalEditor:iu,isSelectionCapturedInDecoratorInput:lu,isSelectionWithinEditor:cu,resetRandomKey:au});const fu=new Map;function du(e){let t=e;while(t!=null){if(t.nodeType===Node.TEXT_NODE){return t}t=t.firstChild}return null}function hu(e){const t=e.parentNode;if(t==null){throw new Error("Should never happen")}return[t,Array.from(t.childNodes).indexOf(e)]}function gu(e,t,n,o,r){const s=t.getKey();const i=o.getKey();const l=document.createRange();let c=e.getElementByKey(s);let a=e.getElementByKey(i);let u=n;let f=r;if(Mc(t)){c=du(c)}if(Mc(o)){a=du(a)}if(t===undefined||o===undefined||c===null||a===null){return null}if(c.nodeName==="BR"){[c,u]=hu(c)}if(a.nodeName==="BR"){[a,f]=hu(a)}const d=c.firstChild;if(c===a&&d!=null&&d.nodeName==="BR"&&u===0&&f===0){f=1}try{l.setStart(c,u);l.setEnd(a,f)}catch(e){return null}if(l.collapsed&&(u!==f||s!==i)){l.setStart(a,f);l.setEnd(c,u)}return l}function _u(e,t){const n=e.getRootElement();if(n===null){return[]}const o=n.getBoundingClientRect();const r=getComputedStyle(n);const s=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight);const i=Array.from(t.getClientRects());let l=i.length;i.sort(((e,t)=>{const n=e.top-t.top;if(Math.abs(n)<=3){return e.left-t.left}return n}));let c;for(let e=0;e<l;e++){const t=i[e];const n=c&&c.top<=t.top&&c.top+c.height>t.top&&c.left+c.width>t.left;const r=t.width+s===o.width;if(n||r){i.splice(e--,1);l--;continue}c=t}return i}function pu(e){const t={};const n=e.split(";");for(const e of n){if(e!==""){const[n,o]=e.split(/:([^]+)/);if(n&&o){t[n.trim()]=o.trim()}}}return t}function mu(e){let t=fu.get(e);if(t===undefined){t=pu(e);fu.set(e,t)}{Object.freeze(t)}return t}function Nu(e){let t="";for(const n in e){if(n){t+=`${n}: ${e[n]};`}}return t}function yu(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!t.isSegmented()&&!t.isToken()&&n!==null){const[o,r]=n;const s=e.isBackward();const i=o.getNode();const l=r.getNode();const c=t.is(i);const a=t.is(l);if(c||a){const[n,o]=oc(e);const r=i.is(l);const c=t.is(s?l:i);const a=t.is(s?i:l);let u=0;let f=undefined;if(r){u=n>o?o:n;f=n>o?n:o}else if(c){const e=s?o:n;u=e;f=undefined}else if(a){const e=s?n:o;u=0;f=e}t.__text=t.__text.slice(u,f);return t}}return t}function Cu(e){if(e.type==="text"){return e.offset===e.getNode().getTextContentSize()}const t=e.getNode();if(!Nc(t)){throw Error(`isAtNodeEnd: node must be a TextNode or ElementNode`)}return e.offset===t.getChildrenSize()}function Tu(e,t,n){let o=t.getNode();let r=n;if(Nc(o)){const e=o.getDescendantByIndex(t.offset);if(e!==null){o=e}}while(r>0&&o!==null){if(Nc(o)){const e=o.getLastDescendant();if(e!==null){o=e}}let n=o.getPreviousSibling();let s=0;if(n===null){let e=o.getParentOrThrow();let t=e.getPreviousSibling();while(t===null){e=e.getParent();if(e===null){n=null;break}t=e.getPreviousSibling()}if(e!==null){s=e.isInline()?0:2;n=t}}let i=o.getTextContent();if(i===""&&Nc(o)&&!o.isInline()){i="\n\n"}const l=i.length;if(!Mc(o)||r>=l){const e=o.getParent();o.remove();if(e!=null&&e.getChildrenSize()===0&&!xc(e)){e.remove()}r-=l+s;o=n}else{const n=o.getKey();const s=e.getEditorState().read((()=>{const e=lc(n);if(Mc(e)&&e.isSimpleText()){return e.getTextContent()}return null}));const c=l-r;const a=i.slice(0,c);if(s!==null&&s!==i){const e=ac();let t=o;if(!o.isSimpleText()){const e=tc(s);o.replace(e);t=e}else{o.setTextContent(s)}if(wc(e)&&e.isCollapsed()){const n=e.anchor.offset;t.select(n,n)}}else if(o.isSimpleText()){const e=t.key===n;let s=t.offset;if(s<r){s=l}const i=e?s-r:0;const a=e?s:c;if(e&&i===0){const[e]=o.splitText(i,a);e.remove()}else{const[,e]=o.splitText(i,a);e.remove()}}else{const e=tc(a);o.replace(e)}r=0}}}function Eu(e){const t=e.getStyle();const n=pu(t);fu.set(t,n)}function Su(e,t){const n=mu("getStyle"in e?e.getStyle():e.style);const o=Object.entries(t).reduce(((t,[o,r])=>{if(typeof r==="function"){t[o]=r(n[o],e)}else if(r===null){delete t[o]}else{t[o]=r}return t}),{...n}||{});const r=Nu(o);e.setStyle(r);fu.set(r,o)}function wu(e,t){const n=e.getNodes();const o=n.length;const r=e.getStartEndPoints();if(r===null){return}const[s,i]=r;const l=o-1;let c=n[0];let a=n[l];if(e.isCollapsed()&&wc(e)){Su(e,t);return}const u=c.getTextContent();const f=u.length;const d=i.offset;let h=s.offset;const g=s.isBefore(i);let _=g?h:d;let p=g?d:h;const m=g?s.type:i.type;const N=g?i.type:s.type;const y=g?i.key:s.key;if(Mc(c)&&_===f){const e=c.getNextSibling();if(Mc(e)){h=0;_=0;c=e}}if(n.length===1){if(Mc(c)&&c.canHaveFormat()){_=m==="element"?0:h>d?d:h;p=N==="element"?f:h>d?h:d;if(_===p){return}if(Ac(c)||_===0&&p===f){Su(c,t);c.select(_,p)}else{const e=c.splitText(_,p);const n=_===0?e[0]:e[1];Su(n,t);n.select(0,p-_)}}}else{if(Mc(c)&&_<c.getTextContentSize()&&c.canHaveFormat()){if(_!==0&&!Ac(c)){c=c.splitText(_)[1];_=0;if(g){s.set(c.getKey(),_,"text")}else{i.set(c.getKey(),_,"text")}}Su(c,t)}if(Mc(a)&&a.canHaveFormat()){const e=a.getTextContent();const n=e.length;if(a.__key!==y&&p!==0){p=n}if(p!==n&&!Ac(a)){[a]=a.splitText(p)}if(p!==0||N==="element"){Su(a,t)}}for(let e=1;e<l;e++){const o=n[e];const r=o.getKey();if(Mc(o)&&o.canHaveFormat()&&r!==c.getKey()&&r!==a.getKey()&&!o.isToken()){Su(o,t)}}}}function xu(e,t){if(e===null){return}const n=e.getStartEndPoints();const o=n?n[0]:null;if(o!==null&&o.key==="root"){const e=t();const n=uc();const o=n.getFirstChild();if(o){o.replace(e,true)}else{n.append(e)}return}const r=e.getNodes();const s=o!==null?Fu(o.getNode(),$u):false;if(s&&r.indexOf(s)===-1){r.push(s)}for(let e=0;e<r.length;e++){const n=r[e];if(!$u(n)){continue}if(!Nc(n)){throw Error(`Expected block node to be an ElementNode`)}const o=t();o.setFormat(n.getFormatType());o.setIndent(n.getIndent());n.replace(o,true)}}function bu(e){return e.getNode().isAttached()}function Ou(e){let t=e;while(t!==null&&!bc(t)){const e=t.getLatest();const n=t.getParent();if(e.getChildrenSize()===0){t.remove(true)}t=n}}function Mu(e,t,n=null){const o=e.getStartEndPoints();const r=o?o[0]:null;const s=e.getNodes();const i=s.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){const e=r.type==="text"?r.getNode().getParentOrThrow():r.getNode();const o=e.getChildren();let s=t();s.setFormat(e.getFormatType());s.setIndent(e.getIndent());o.forEach((e=>s.append(e)));if(n){s=n.append(s)}e.replace(s);return}let l=null;let c=[];for(let o=0;o<i;o++){const r=s[o];if(bc(r)){Au(e,c,c.length,t,n);c=[];l=r}else if(l===null||l!==null&&hc(r,l)){c.push(r)}else{Au(e,c,c.length,t,n);c=[r]}}Au(e,c,c.length,t,n)}function Au(e,t,n,o,r=null){if(t.length===0){return}const s=t[0];const i=new Map;const l=[];let c=Nc(s)?s:s.getParentOrThrow();if(c.isInline()){c=c.getParentOrThrow()}let a=false;while(c!==null){const e=c.getPreviousSibling();if(e!==null){c=e;a=true;break}c=c.getParentOrThrow();if(bc(c)){break}}const u=new Set;for(let e=0;e<n;e++){const n=t[e];if(Nc(n)&&n.getChildrenSize()===0){u.add(n.getKey())}}const f=new Set;for(let e=0;e<n;e++){const n=t[e];let r=n.getParent();if(r!==null&&r.isInline()){r=r.getParent()}if(r!==null&&Cc(n)&&!f.has(n.getKey())){const e=r.getKey();if(i.get(e)===undefined){const t=o();t.setFormat(r.getFormatType());t.setIndent(r.getIndent());l.push(t);i.set(e,t);r.getChildren().forEach((e=>{t.append(e);f.add(e.getKey());if(Nc(e)){e.getChildrenKeys().forEach((e=>f.add(e)))}}));Ou(r)}}else if(u.has(n.getKey())){if(!Nc(n)){throw Error(`Expected node in emptyElements to be an ElementNode`)}const e=o();e.setFormat(n.getFormatType());e.setIndent(n.getIndent());l.push(e);n.remove(true)}}if(r!==null){for(let e=0;e<l.length;e++){const t=l[e];r.append(t)}}let d=null;if(bc(c)){if(a){if(r!==null){c.insertAfter(r)}else{for(let e=l.length-1;e>=0;e--){const t=l[e];c.insertAfter(t)}}}else{const e=c.getFirstChild();if(Nc(e)){c=e}if(e===null){if(r){c.append(r)}else{for(let e=0;e<l.length;e++){const t=l[e];c.append(t);d=t}}}else{if(r!==null){e.insertBefore(r)}else{for(let t=0;t<l.length;t++){const n=l[t];e.insertBefore(n);d=n}}}}}else{if(r){c.insertAfter(r)}else{for(let e=l.length-1;e>=0;e--){const t=l[e];c.insertAfter(t);d=t}}}const h=ac();if(wc(h)&&bu(h.anchor)&&bu(h.focus)){Lc(h.clone())}else if(d!==null){d.selectEnd()}else{e.dirty=true}}function Du(e,t){const n=nc(e.focus,t);return mc(n)&&!n.isIsolated()||Nc(n)&&!n.isInline()&&!n.canBeEmpty()}function vu(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Ru(e){const t=e.anchor.getNode();const n=xc(t)?t:t.getParentOrThrow();return n.getDirection()==="rtl"}function ku(e,t,n){const o=Ru(e);vu(e,t,n?!o:o,"character")}function Iu(e){const t=e.anchor;const n=e.focus;const o=t.getNode();const r=o.getTopLevelElementOrThrow();const s=r.getParentOrThrow();let i=s.getFirstDescendant();let l=s.getLastDescendant();let c="element";let a="element";let u=0;if(Mc(i)){c="text"}else if(!Nc(i)&&i!==null){i=i.getParentOrThrow()}if(Mc(l)){a="text";u=l.getTextContentSize()}else if(!Nc(l)&&l!==null){l=l.getParentOrThrow()}if(i&&l){t.set(i.getKey(),0,c);n.set(l.getKey(),u,a)}}function Lu(e,t,n){const o=e.getStyle();const r=mu(o);if(r!==null){return r[t]||n}return n}function Pu(e,t,n=""){let o=null;const r=e.getNodes();const s=e.anchor;const i=e.focus;const l=e.isBackward();const c=l?i.offset:s.offset;const a=l?i.getNode():s.getNode();if(wc(e)&&e.isCollapsed()&&e.style!==""){const n=e.style;const o=mu(n);if(o!==null&&t in o){return o[t]}}for(let e=0;e<r.length;e++){const s=r[e];if(e!==0&&c===0&&s.is(a)){continue}if(Mc(s)){const e=Lu(s,t,n);if(o===null){o=e}else if(o!==e){o="";break}}}return o===null?n:o}function $u(e){if(mc(e)){return false}if(!Nc(e)||bc(e)){return false}const t=e.getFirstChild();const n=t===null||Tc(t)||Mc(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==false&&n}function Fu(e,t){let n=e;while(n!==null&&n.getParent()!==null&&!t(n)){n=n.getParentOrThrow()}return t(n)?n:null}const Ku=Tu;var Bu=Object.freeze({$addNodeStyle:Eu,$getSelectionStyleValueForProperty:Pu,$isAtNodeEnd:Cu,$isParentElementRTL:Ru,$moveCaretSelection:vu,$moveCharacter:ku,$patchStyleText:wu,$selectAll:Iu,$setBlocksType:xu,$shouldOverrideDefaultCharacterSelection:Du,$sliceSelectedTextNodeContent:yu,$trimTextContentFromAnchor:Tu,$wrapNodes:Mu,createDOMRange:gu,createRectsFromDOMRange:_u,getStyleObjectFromCSS:mu,trimTextContentFromAnchor:Ku,$cloneWithProperties:Jl});function Wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zu=Wu((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const Hu=Bu;const Uu=Hu.$addNodeStyle;const Yu=Hu.$cloneWithProperties;const Ju=Hu.$getSelectionStyleValueForProperty;const ju=Hu.$isAtNodeEnd;const Gu=Hu.$isParentElementRTL;const Xu=Hu.$moveCaretSelection;const Vu=Hu.$moveCharacter;const qu=Hu.$patchStyleText;const Qu=Hu.$selectAll;const Zu=Hu.$setBlocksType;const ef=Hu.$shouldOverrideDefaultCharacterSelection;const tf=Hu.$sliceSelectedTextNodeContent;const nf=Hu.$trimTextContentFromAnchor;const of=Hu.$wrapNodes;const rf=Hu.createDOMRange;const sf=Hu.createRectsFromDOMRange;const lf=Hu.getStyleObjectFromCSS;const cf=Hu.trimTextContentFromAnchor;var af=Object.freeze({$addNodeStyle:Uu,$cloneWithProperties:Yu,$getSelectionStyleValueForProperty:Ju,$isAtNodeEnd:ju,$isParentElementRTL:Gu,$moveCaretSelection:Xu,$moveCharacter:Vu,$patchStyleText:qu,$selectAll:Qu,$setBlocksType:Zu,$shouldOverrideDefaultCharacterSelection:ef,$sliceSelectedTextNodeContent:tf,$trimTextContentFromAnchor:nf,$wrapNodes:of,createDOMRange:rf,createRectsFromDOMRange:sf,getStyleObjectFromCSS:lf,trimTextContentFromAnchor:cf});const uf=typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof window.document.createElement!=="undefined";const ff=uf&&"documentMode"in document?document.documentMode:null;const df=uf&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);const hf=uf&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);const gf=uf&&"InputEvent"in window&&!ff?"getTargetRanges"in new window.InputEvent("input"):false;const _f=uf&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent);const pf=uf&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const mf=uf&&/Android/.test(navigator.userAgent);const Nf=uf&&/^(?=.*Chrome).*/i.test(navigator.userAgent);const yf=uf&&mf&&Nf;const Cf=uf&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Nf;function Tf(...e){const t=[];for(const n of e){if(n&&typeof n==="string"){for(const[e]of n.matchAll(/\S+/g)){t.push(e)}}}return t}function Ef(...e){return()=>{for(let t=e.length-1;t>=0;t--){e[t]()}e.length=0}}function Sf(e){return`${e}px`}const wf={attributes:true,characterData:true,childList:true,subtree:true};function xf(e,t,n){let o=null;let r=null;let s=null;let i=[];const l=document.createElement("div");function c(){if(!(o!==null)){throw Error(`Unexpected null rootDOMNode`)}if(!(r!==null)){throw Error(`Unexpected null parentDOMNode`)}const{left:s,top:c}=o.getBoundingClientRect();const a=r;const u=sf(e,t);if(!l.isConnected){a.append(l)}let f=false;for(let e=0;e<u.length;e++){const t=u[e];const n=i[e]||document.createElement("div");const o=n.style;if(o.position!=="absolute"){o.position="absolute";f=true}const r=Sf(t.left-s);if(o.left!==r){o.left=r;f=true}const a=Sf(t.top-c);if(o.top!==a){n.style.top=a;f=true}const d=Sf(t.width);if(o.width!==d){n.style.width=d;f=true}const h=Sf(t.height);if(o.height!==h){n.style.height=h;f=true}if(n.parentNode!==l){l.append(n);f=true}i[e]=n}while(i.length>u.length){i.pop()}if(f){n(i)}}function a(){r=null;o=null;if(s!==null){s.disconnect()}s=null;l.remove();for(const e of i){e.remove()}i=[]}function u(){const t=e.getRootElement();if(t===null){return a()}const n=t.parentElement;if(!(n instanceof HTMLElement)){return a()}a();o=t;r=n;s=new MutationObserver((t=>{const n=e.getRootElement();const s=n&&n.parentElement;if(n!==o||s!==r){return u()}for(const e of t){if(!l.contains(e.target)){return c()}}}));s.observe(n,wf);c()}const f=e.registerRootListener(u);return()=>{f();a()}}function bf(e,t){let n=null;let o=null;let r=null;let s=null;let i=()=>{};function l(l){l.read((()=>{const l=fc();if(!wc(l)){n=null;o=null;r=null;s=null;i();i=()=>{};return}const{anchor:c,focus:a}=l;const u=c.getNode();const f=u.getKey();const d=c.offset;const h=a.getNode();const g=h.getKey();const _=a.offset;const p=e.getElementByKey(f);const m=e.getElementByKey(g);const N=n===null||p===null||d!==o||f!==n.getKey()||u!==n&&(!(n instanceof Xa)||u.updateDOM(n,p,e._config));const y=r===null||m===null||_!==s||g!==r.getKey()||h!==r&&(!(r instanceof Xa)||h.updateDOM(r,m,e._config));if(N||y){const n=e.getElementByKey(c.getNode().getKey());const o=e.getElementByKey(a.getNode().getKey());if(n!==null&&o!==null&&n.tagName==="SPAN"&&o.tagName==="SPAN"){const r=document.createRange();let s;let l;let u;let f;if(a.isBefore(c)){s=o;l=a.offset;u=n;f=c.offset}else{s=n;l=c.offset;u=o;f=a.offset}const d=s.firstChild;if(!(d!==null)){throw Error(`Expected text node to be first child of span`)}const h=u.firstChild;if(!(h!==null)){throw Error(`Expected text node to be first child of span`)}r.setStart(d,l);r.setEnd(h,f);i();i=xf(e,r,(e=>{for(const t of e){const e=t.style;if(e.background!=="Highlight"){e.background="Highlight"}if(e.color!=="HighlightText"){e.color="HighlightText"}if(e.zIndex!=="-1"){e.zIndex="-1"}if(e.pointerEvents!=="none"){e.pointerEvents="none"}if(e.marginTop!==Sf(-1.5)){e.marginTop=Sf(-1.5)}if(e.paddingTop!==Sf(4)){e.paddingTop=Sf(4)}if(e.paddingBottom!==Sf(0)){e.paddingBottom=Sf(0)}}if(t!==undefined){t(e)}}))}}n=u;o=d;r=h;s=_}))}l(e.getEditorState());return Ef(e.registerUpdateListener((({editorState:e})=>l(e))),i,(()=>{i()}))}const Of=gf;const Mf=uf;const Af=mf;const Df=yf;const vf=df;const Rf=Cf;const kf=Nf;const If=hf;const Lf=pf;const Pf=_f;function $f(e,...t){const n=Tf(...t);if(n.length>0){e.classList.add(...n)}}function Ff(e,...t){const n=Tf(...t);if(n.length>0){e.classList.remove(...n)}}function Kf(e,t){for(const n of t){if(e.type.startsWith(n)){return true}}return false}function Bf(e,t){const n=e[Symbol.iterator]();return new Promise(((e,o)=>{const r=[];const s=()=>{const{done:i,value:l}=n.next();if(i){return e(r)}const c=new FileReader;c.addEventListener("error",o);c.addEventListener("load",(()=>{const e=c.result;if(typeof e==="string"){r.push({file:l,result:e})}s()}));if(Kf(l,t)){c.readAsDataURL(l)}else{s()}};s()}))}function Wf(e,t){const n=[];const o=(e||uc()).getLatest();const r=t||(Nc(o)?o.getLastDescendant()||o:o);let s=o;let i=zf(s);while(s!==null&&!s.is(r)){n.push({depth:i,node:s});if(Nc(s)&&s.getChildrenSize()>0){s=s.getFirstChild();i++}else{let e=null;while(e===null&&s!==null){e=s.getNextSibling();if(e===null){s=s.getParent();i--}else{s=e}}}}if(s!==null&&s.is(r)){n.push({depth:i,node:s})}return n}function zf(e){let t=e;let n=0;while((t=t.getParent())!==null){n++}return n}function Hf(e){let t=e;if(Nc(t)&&t.getChildrenSize()>0){t=t.getLastChild()}else{let e=null;while(e===null&&t!==null){e=t.getPreviousSibling();if(e===null){t=t.getParent()}else{t=e}}}return t}function Uf(e,t){let n=e;while(n!=null){if(n instanceof t){return n}n=n.getParent()}return null}function Yf(e){const t=Jf(e,(e=>Nc(e)&&!e.isInline()));if(!Nc(t)){{throw Error(`Expected node ${e.__key} to have closest block element node.`)}}return t}const Jf=(e,t)=>{let n=e;while(n!==uc()&&n!=null){if(t(n)){return n}n=n.getParent()}return null};function jf(e,t,n,o){const r=e=>e instanceof t;const s=e=>{const t=e.getChildren();for(let e=0;e<t.length;e++){const n=t[e];if(r(n)){return null}}let n=e;let o=e;while(n!==null){o=n;n=n.getParent();if(r(n)){return{child:o,parent:n}}}return null};const i=e=>{const t=s(e);if(t!==null){const{child:r,parent:s}=t;if(r.is(e)){o(s,e);const t=r.getNextSiblings();const i=t.length;s.insertAfter(r);if(i!==0){const e=n(s);r.insertAfter(e);for(let n=0;n<i;n++){e.append(t[n])}}if(!s.canBeEmpty()&&s.getChildrenSize()===0){s.remove()}}}};return e.registerNodeTransform(t,i)}function Gf(e,t){const n=2;const o=new Map;const r=e._pendingEditorState;for(const[e,n]of t._nodeMap){o.set(e,Jl(n))}if(r){r._nodeMap=o}e._dirtyType=n;const s=t._selection;Lc(s===null?null:s.clone())}function Xf(e){const t=fc()||ac();if(wc(t)){const{focus:n}=t;const o=n.getNode();const r=n.offset;if(bc(o)){const t=o.getChildAtIndex(r);if(t==null){o.append(e)}else{t.insertBefore(e)}e.selectNext()}else{let t;let n;if(Mc(o)){t=o.getParentOrThrow();n=o.getIndexWithinParent();if(r>0){n+=1;o.splitText(r)}}else{t=o;n=r}const[,s]=Pc(t,n);s.insertBefore(e);s.selectStart()}}else{if(t!=null){const n=t.getNodes();n[n.length-1].getTopLevelElementOrThrow().insertAfter(e)}else{const t=uc();t.append(e)}const n=Vl();e.insertAfter(n);n.select()}return e.getLatest()}function Vf(e,t){const n=t();e.replace(n);n.append(e);return n}function qf(e,t){return e!==null?Object.getPrototypeOf(e).constructor.name===t.name:false}function Qf(e,t){const n=[];for(let o=0;o<e.length;o++){const r=t(e[o]);if(r!==null){n.push(r)}}return n}function Zf(e,t){const n=e.getFirstChild();if(n!==null){n.insertBefore(t)}else{e.append(t)}}function ed(e){if(If){return 1}let t=1;while(e){t*=Number(window.getComputedStyle(e).getPropertyValue("zoom"));e=e.parentElement}return t}function td(e){return e._parentEditor!==null}var nd=Object.freeze({$dfs:Wf,$filter:Qf,$findMatchingParent:Jf,$getNearestBlockElementAncestorOrThrow:Yf,$getNearestNodeOfType:Uf,$getNextRightPreorderNode:Hf,$insertFirst:Zf,$insertNodeToNearestRoot:Xf,$isEditorIsNestedEditor:td,$restoreEditorState:Gf,$wrapNodeInElement:Vf,CAN_USE_BEFORE_INPUT:Of,CAN_USE_DOM:Mf,IS_ANDROID:Af,IS_ANDROID_CHROME:Df,IS_APPLE:vf,IS_APPLE_WEBKIT:Rf,IS_CHROME:kf,IS_FIREFOX:If,IS_IOS:Lf,IS_SAFARI:Pf,addClassNamesToElement:$f,calculateZoomLevel:ed,isMimeType:Kf,markSelection:bf,mediaFileReader:Bf,mergeRegister:Ef,objectKlassEquals:qf,positionNodeOnRange:xf,registerNestedElementResolver:jf,removeClassNamesFromElement:Ff,$splitNode:Pc,isBlockDomNode:tu,isHTMLAnchorElement:ou,isHTMLElement:ru,isInlineDomNode:su});function od(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rd=od((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const sd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,id=sd&&"documentMode"in document?document.documentMode:null,ld=sd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),cd=sd&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ad=!(!sd||!("InputEvent"in window)||id)&&"getTargetRanges"in new window.InputEvent("input"),ud=sd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),fd=sd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,dd=sd&&/Android/.test(navigator.userAgent),hd=sd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gd=sd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!hd;const _d=nd;const pd=_d.$dfs;const md=_d.$filter;const Nd=_d.$findMatchingParent;const yd=_d.$getNearestBlockElementAncestorOrThrow;const Cd=_d.$getNearestNodeOfType;const Td=_d.$getNextRightPreorderNode;const Ed=_d.$insertFirst;const Sd=_d.$insertNodeToNearestRoot;const wd=_d.$isEditorIsNestedEditor;const xd=_d.$restoreEditorState;const bd=_d.$splitNode;const Od=_d.$wrapNodeInElement;const Md=_d.CAN_USE_BEFORE_INPUT;const Ad=_d.CAN_USE_DOM;const Dd=_d.IS_ANDROID;const vd=_d.IS_ANDROID_CHROME;const Rd=_d.IS_APPLE;const kd=_d.IS_APPLE_WEBKIT;const Id=_d.IS_CHROME;const Ld=_d.IS_FIREFOX;const Pd=_d.IS_IOS;const $d=_d.IS_SAFARI;const Fd=_d.addClassNamesToElement;const Kd=_d.calculateZoomLevel;const Bd=_d.isBlockDomNode;const Wd=_d.isHTMLAnchorElement;const zd=_d.isHTMLElement;const Hd=_d.isInlineDomNode;const Ud=_d.isMimeType;const Yd=_d.markSelection;const Jd=_d.mediaFileReader;const jd=_d.mergeRegister;const Gd=_d.objectKlassEquals;const Xd=_d.positionNodeOnRange;const Vd=_d.registerNestedElementResolver;const qd=_d.removeClassNamesFromElement;var Qd=Object.freeze({$dfs:pd,$filter:md,$findMatchingParent:Nd,$getNearestBlockElementAncestorOrThrow:yd,$getNearestNodeOfType:Cd,$getNextRightPreorderNode:Td,$insertFirst:Ed,$insertNodeToNearestRoot:Sd,$isEditorIsNestedEditor:wd,$restoreEditorState:xd,$splitNode:bd,$wrapNodeInElement:Od,CAN_USE_BEFORE_INPUT:Md,CAN_USE_DOM:Ad,IS_ANDROID:Dd,IS_ANDROID_CHROME:vd,IS_APPLE:Rd,IS_APPLE_WEBKIT:kd,IS_CHROME:Id,IS_FIREFOX:Ld,IS_IOS:Pd,IS_SAFARI:$d,addClassNamesToElement:Fd,calculateZoomLevel:Kd,isBlockDomNode:Bd,isHTMLAnchorElement:Wd,isHTMLElement:zd,isInlineDomNode:Hd,isMimeType:Ud,markSelection:Yd,mediaFileReader:Jd,mergeRegister:jd,objectKlassEquals:Gd,positionNodeOnRange:Xd,registerNestedElementResolver:Vd,removeClassNamesFromElement:qd});function Zd(e,t){const n=t.body?t.body.childNodes:[];let o=[];const r=[];for(let t=0;t<n.length;t++){const s=n[t];if(!oh.has(s.nodeName)){const t=rh(s,e,r,false);if(t!==null){o=o.concat(t)}}}ih(r);return o}function eh(e,t){if(typeof document==="undefined"||typeof window==="undefined"&&typeof global.window==="undefined"){throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.")}const n=document.createElement("div");const o=uc();const r=o.getChildren();for(let o=0;o<r.length;o++){const s=r[o];th(e,s,n,t)}return n.innerHTML}function th(e,t,n,o=null){let r=o!==null?t.isSelected(o):true;const s=Nc(t)&&t.excludeFromCopy("html");let i=t;if(o!==null){let e=Jl(t);e=Mc(e)&&o!==null?tf(o,e):e;i=e}const l=Nc(i)?i.getChildren():[];const c=e._nodes.get(i.getType());let a;if(c&&c.exportDOM!==undefined){a=c.exportDOM(e,i)}else{a=i.exportDOM(e)}const{element:u,after:f}=a;if(!u){return false}const d=document.createDocumentFragment();for(let n=0;n<l.length;n++){const s=l[n];const i=th(e,s,d,o);if(!r&&Nc(t)&&i&&t.extractWithChild(s,o,"html")){r=true}}if(r&&!s){if(zd(u)){u.append(d)}n.append(u);if(f){const e=f.call(i,u);if(e){u.replaceWith(e)}}}else{n.append(d)}return r}function nh(e,t){const{nodeName:n}=e;const o=t._htmlConversions.get(n.toLowerCase());let r=null;if(o!==undefined){for(const t of o){const n=t(e);if(n!==null&&(r===null||(r.priority||0)<(n.priority||0))){r=n}}}return r!==null?r.conversion:null}const oh=new Set(["STYLE","SCRIPT"]);function rh(e,t,n,o,r=new Map,s){let i=[];if(oh.has(e.nodeName)){return i}let l=null;const c=nh(e,t);const a=c?c(e):null;let u=null;if(a!==null){u=a.after;const t=a.node;l=Array.isArray(t)?t[t.length-1]:t;if(l!==null){for(const[,e]of r){l=e(l,s);if(!l){break}}if(l){i.push(...Array.isArray(t)?t:[l])}}if(a.forChild!=null){r.set(e.nodeName,a.forChild)}}const f=e.childNodes;let d=[];const h=l!=null&&bc(l)?false:l!=null&&pc(l)||o;for(let e=0;e<f.length;e++){d.push(...rh(f[e],t,n,h,new Map(r),l))}if(u!=null){d=u(d)}if(Bd(e)){if(!h){d=sh(e,d,Vl)}else{d=sh(e,d,(()=>{const e=new $c;n.push(e);return e}))}}if(l==null){if(d.length>0){i=i.concat(d)}else{if(Bd(e)&&lh(e)){i=i.concat(Gl())}}}else{if(Nc(l)){l.append(...d)}}return i}function sh(e,t,n){const o=e.style.textAlign;const r=[];let s=[];for(let e=0;e<t.length;e++){const i=t[e];if(pc(i)){if(o&&!i.getFormat()){i.setFormat(o)}r.push(i)}else{s.push(i);if(e===t.length-1||e<t.length-1&&pc(t[e+1])){const e=n();e.setFormat(o);e.append(...s);r.push(e);s=[]}}}return r}function ih(e){for(const t of e){if(t.getNextSibling()instanceof $c){t.insertAfter(Gl())}}for(const t of e){const e=t.getChildren();for(const n of e){t.insertBefore(n)}t.remove()}}function lh(e){if(e.nextSibling==null||e.previousSibling==null){return false}return su(e.nextSibling)&&su(e.previousSibling)}var ch=Object.freeze({$generateHtmlFromNodes:eh,$generateNodesFromDOM:Zd});const ah=ch;const uh=ah.$generateHtmlFromNodes;const fh=ah.$generateNodesFromDOM;var dh=Object.freeze({$generateHtmlFromNodes:uh,$generateNodesFromDOM:fh});function hh(e){let t=1;let n=e.getParent();while(n!=null){if($h(n)){const e=n.getParent();if(Yh(e)){t++;n=e.getParent();continue}{throw Error(`A ListItemNode must have a ListNode for a parent.`)}}return t}return t}function gh(e){let t=e.getParent();if(!Yh(t)){{throw Error(`A ListItemNode must have a ListNode for a parent.`)}}let n=t;while(n!==null){n=n.getParent();if(Yh(n)){t=n}}return t}function _h(e){let t=[];const n=e.getChildren().filter($h);for(let e=0;e<n.length;e++){const o=n[e];const r=o.getFirstChild();if(Yh(r)){t=t.concat(_h(r))}else{t.push(o)}}return t}function ph(e){return $h(e)&&Yh(e.getFirstChild())}function mh(e){let t=e;while(t.getNextSibling()==null&&t.getPreviousSibling()==null){const e=t.getParent();if(e==null||!($h(t)||Yh(t))){break}t=e}t.remove()}function Nh(e){const t=Ph();return t.append(e)}function yh(e,t){return $h(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function Ch(e,t){e.update((()=>{const e=fc();if(e!==null){const n=e.getNodes();if(wc(e)){const o=e.getStartEndPoints();if(!(o!==null)){throw Error(`insertList: anchor should be defined`)}const[r]=o;const s=r.getNode();const i=s.getParent();if(yh(s,n)){const e=Uh(t);if(bc(i)){s.replace(e);const t=Ph();if(Nc(s)){t.setFormat(s.getFormatType());t.setIndent(s.getIndent())}e.append(t)}else if($h(s)){const t=s.getParentOrThrow();Th(e,t.getChildren());t.replace(e)}return}}const o=new Set;for(let e=0;e<n.length;e++){const r=n[e];if(Nc(r)&&r.isEmpty()&&!$h(r)&&!o.has(r.getKey())){Eh(r,t);continue}if(Cc(r)){let e=r.getParent();while(e!=null){const n=e.getKey();if(Yh(e)){if(!o.has(n)){const r=Uh(t);Th(r,e.getChildren());e.replace(r);o.add(n)}break}else{const r=e.getParent();if(bc(r)&&!o.has(n)){o.add(n);Eh(e,t);break}e=r}}}}}}))}function Th(e,t){e.splice(e.getChildrenSize(),0,t)}function Eh(e,t){if(Yh(e)){return e}const n=e.getPreviousSibling();const o=e.getNextSibling();const r=Ph();r.setFormat(e.getFormatType());r.setIndent(e.getIndent());Th(r,e.getChildren());if(Yh(n)&&t===n.getListType()){n.append(r);e.remove();if(Yh(o)&&t===o.getListType()){Th(n,o.getChildren());o.remove()}return n}else if(Yh(o)&&t===o.getListType()){o.getFirstChildOrThrow().insertBefore(r);e.remove();return o}else{const n=Uh(t);n.append(r);e.replace(n);return n}}function Sh(e,t){const n=e.getLastChild();const o=t.getFirstChild();if(n&&o&&ph(n)&&ph(o)){Sh(n.getFirstChild(),o.getFirstChild());o.remove()}const r=t.getChildren();if(r.length>0){e.append(...r)}t.remove()}function wh(e){e.update((()=>{const e=fc();if(wc(e)){const t=new Set;const n=e.getNodes();const o=e.anchor.getNode();if(yh(o,n)){t.add(gh(o))}else{for(let e=0;e<n.length;e++){const o=n[e];if(Cc(o)){const e=Cd(o,vh);if(e!=null){t.add(gh(e))}}}}for(const n of t){let t=n;const o=_h(n);for(const n of o){const o=Vl();Th(o,n.getChildren());t.insertAfter(o);t=o;if(n.__key===e.anchor.key){e.anchor.set(o.getKey(),0,"element")}if(n.__key===e.focus.key){e.focus.set(o.getKey(),0,"element")}n.remove()}n.remove()}}}))}function xh(e){const t=e.getListType()!=="check";let n=e.getStart();for(const o of e.getChildren()){if($h(o)){if(o.getValue()!==n){o.setValue(n)}if(t&&o.getLatest().__checked!=null){o.setChecked(undefined)}if(!Yh(o.getFirstChild())){n++}}}}function bh(e){const t=e.getNextSibling();if(Yh(t)&&e.getListType()===t.getListType()){Sh(e,t)}}function Oh(e){const t=new Set;if(ph(e)||t.has(e.getKey())){return}const n=e.getParent();const o=e.getNextSibling();const r=e.getPreviousSibling();if(ph(o)&&ph(r)){const n=r.getFirstChild();if(Yh(n)){n.append(e);const r=o.getFirstChild();if(Yh(r)){const e=r.getChildren();Th(n,e);o.remove();t.add(o.getKey())}}}else if(ph(o)){const t=o.getFirstChild();if(Yh(t)){const n=t.getFirstChild();if(n!==null){n.insertBefore(e)}}}else if(ph(r)){const t=r.getFirstChild();if(Yh(t)){t.append(e)}}else{if(Yh(n)){const t=Ph();const s=Uh(n.getListType());t.append(s);s.append(e);if(r){r.insertAfter(t)}else if(o){o.insertBefore(t)}else{n.append(t)}}}}function Mh(e){if(ph(e)){return}const t=e.getParent();const n=t?t.getParent():undefined;const o=n?n.getParent():undefined;if(Yh(o)&&$h(n)&&Yh(t)){const o=t?t.getFirstChild():undefined;const r=t?t.getLastChild():undefined;if(e.is(o)){n.insertBefore(e);if(t.isEmpty()){n.remove()}}else if(e.is(r)){n.insertAfter(e);if(t.isEmpty()){n.remove()}}else{const o=t.getListType();const r=Ph();const s=Uh(o);r.append(s);e.getPreviousSiblings().forEach((e=>s.append(e)));const i=Ph();const l=Uh(o);i.append(l);Th(l,e.getNextSiblings());n.insertBefore(r);n.insertAfter(i);n.replace(e)}}}function Ah(){const e=fc();if(!wc(e)||!e.isCollapsed()){return false}const t=e.anchor.getNode();if(!$h(t)||t.getChildrenSize()!==0){return false}const n=gh(t);const o=t.getParent();if(!Yh(o)){throw Error(`A ListItemNode must have a ListNode for a parent.`)}const r=o.getParent();let s;if(bc(r)){s=Vl();n.insertAfter(s)}else if($h(r)){s=Ph();r.insertAfter(s)}else{return false}s.select();const i=t.getNextSiblings();if(i.length>0){const e=Uh(o.getListType());if(Sc(s)){s.insertAfter(e)}else{const t=Ph();t.append(e);s.insertAfter(t)}i.forEach((t=>{t.remove();e.append(t)}))}mh(t);return true}function Dh(...e){const t=[];for(const n of e){if(n&&typeof n==="string"){for(const[e]of n.matchAll(/\S+/g)){t.push(e)}}}return t}class vh extends ia{static getType(){return"listitem"}static clone(e){return new vh(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n);this.__value=e===undefined?1:e;this.__checked=t}createDOM(e){const t=document.createElement("li");const n=this.getParent();if(Yh(n)&&n.getListType()==="check"){kh(t,this,null)}t.value=this.__value;Rh(t,e.theme,this);return t}updateDOM(e,t,n){const o=this.getParent();if(Yh(o)&&o.getListType()==="check"){kh(t,this,e)}t.value=this.__value;Rh(t,n.theme,this);return false}static transform(){return e=>{if(!$h(e)){throw Error(`node is not a ListItemNode`)}if(e.__checked==null){return}const t=e.getParent();if(Yh(t)){if(t.getListType()!=="check"&&e.getChecked()!=null){e.setChecked(undefined)}}}}static importDOM(){return{li:()=>({conversion:Ih,priority:0})}}static importJSON(e){const t=Ph();t.setChecked(e.checked);t.setValue(e.value);t.setFormat(e.format);t.setDirection(e.direction);return t}exportDOM(e){const t=this.createDOM(e._config);t.style.textAlign=this.getFormatType();return{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Nc(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e);n.remove()}else{super.append(n)}}return this}replace(e,t){if($h(e)){return super.replace(e)}this.setIndent(0);const n=this.getParentOrThrow();if(!Yh(n)){return e}if(n.__first===this.getKey()){n.insertBefore(e)}else if(n.__last===this.getKey()){n.insertAfter(e)}else{const t=Uh(n.getListType());let o=this.getNextSibling();while(o){const e=o;o=o.getNextSibling();t.append(e)}n.insertAfter(e);e.insertAfter(t)}if(t){if(!Nc(e)){throw Error(`includeChildren should only be true for ElementNodes`)}this.getChildren().forEach((t=>{e.append(t)}))}this.remove();if(n.getChildrenSize()===0){n.remove()}return e}insertAfter(e,t=true){const n=this.getParentOrThrow();if(!Yh(n)){{throw Error(`insertAfter: list node is not parent of list item node`)}}if($h(e)){return super.insertAfter(e,t)}const o=this.getNextSiblings();n.insertAfter(e,t);if(o.length!==0){const r=Uh(n.getListType());o.forEach((e=>r.append(e)));e.insertAfter(r,t)}return e}remove(e){const t=this.getPreviousSibling();const n=this.getNextSibling();super.remove(e);if(t&&n&&ph(t)&&ph(n)){Sh(t.getFirstChild(),n.getFirstChild());n.remove()}}insertNewAfter(e,t=true){const n=Ph(this.__checked==null?undefined:false);this.insertAfter(n,t);return n}collapseAtStart(e){const t=Vl();const n=this.getChildren();n.forEach((e=>t.append(e)));const o=this.getParentOrThrow();const r=o.getParentOrThrow();const s=$h(r);if(o.getChildrenSize()===1){if(s){o.remove();r.select()}else{o.insertBefore(t);o.remove();const n=e.anchor;const r=e.focus;const s=t.getKey();if(n.type==="element"&&n.getNode().is(this)){n.set(s,n.offset,"element")}if(r.type==="element"&&r.getNode().is(this)){r.set(s,r.offset,"element")}}}else{o.insertBefore(t);this.remove()}return true}getValue(){const e=this.getLatest();return e.__value}setValue(e){const t=this.getWritable();t.__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();if(Yh(n)){t=n.getListType()}return t==="check"?Boolean(e.__checked):undefined}setChecked(e){const t=this.getWritable();t.__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null){return this.getLatest().__indent}let t=e.getParentOrThrow();let n=0;while($h(t)){t=t.getParentOrThrow().getParentOrThrow();n++}return n}setIndent(e){if(!(typeof e==="number")){throw Error(`Invalid indent value.`)}e=Math.floor(e);if(!(e>=0)){throw Error(`Indent value must be non-negative.`)}let t=this.getIndent();while(t!==e){if(t<e){Oh(this);t++}else{Mh(this);t--}}return this}canInsertAfter(e){return $h(e)}canReplaceWith(e){return $h(e)}canMergeWith(e){return Sc(e)||$h(e)}extractWithChild(e,t){if(!wc(t)){return false}const n=t.anchor.getNode();const o=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(o)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return true}createParentElementNode(){return Uh("bullet")}canMergeWhenEmpty(){return true}}function Rh(e,t,n){const o=[];const r=[];const s=t.list;const i=s?s.listitem:undefined;let l;if(s&&s.nested){l=s.nested.listitem}if(i!==undefined){o.push(...Dh(i))}if(s){const e=n.getParent();const t=Yh(e)&&e.getListType()==="check";const i=n.getChecked();if(!t||i){r.push(s.listitemUnchecked)}if(!t||!i){r.push(s.listitemChecked)}if(t){o.push(i?s.listitemChecked:s.listitemUnchecked)}}if(l!==undefined){const e=Dh(l);if(n.getChildren().some((e=>Yh(e)))){o.push(...e)}else{r.push(...e)}}if(r.length>0){qd(e,...r)}if(o.length>0){Fd(e,...o)}}function kh(e,t,n,o){if(Yh(t.getFirstChild())){e.removeAttribute("role");e.removeAttribute("tabIndex");e.removeAttribute("aria-checked")}else{e.setAttribute("role","checkbox");e.setAttribute("tabIndex","-1");if(!n||t.__checked!==n.__checked){e.setAttribute("aria-checked",t.getChecked()?"true":"false")}}}function Ih(e){const t=e.classList.contains("task-list-item");if(t){for(const t of e.children){if(t.tagName==="INPUT"){return Lh(t)}}}const n=e.getAttribute("aria-checked");const o=n==="true"?true:n==="false"?false:undefined;return{node:Ph(o)}}function Lh(e){const t=e.getAttribute("type")==="checkbox";if(!t){return{node:null}}const n=e.hasAttribute("checked");return{node:Ph(n)}}function Ph(e){return Yl(new vh(undefined,e))}function $h(e){return e instanceof vh}class Fh extends ia{static getType(){return"list"}static clone(e){const t=e.__listType||Hh[e.__tag];return new Fh(t,e.__start,e.__key)}constructor(e,t,n){super(n);const o=Hh[e]||e;this.__listType=o;this.__tag=o==="number"?"ol":"ul";this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e;t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag;const o=document.createElement(n);if(this.__start!==1){o.setAttribute("start",String(this.__start))}o.__lexicalListType=this.__listType;Kh(o,e.theme,this);return o}updateDOM(e,t,n){if(e.__tag!==this.__tag){return true}Kh(t,n.theme,this);return false}static transform(){return e=>{if(!Yh(e)){throw Error(`node is not a ListNode`)}bh(e);xh(e)}}static importDOM(){return{ol:()=>({conversion:zh,priority:0}),ul:()=>({conversion:zh,priority:0})}}static importJSON(e){const t=Uh(e.listType,e.start);t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&zd(t)){if(this.__start!==1){t.setAttribute("start",String(this.__start))}if(this.__listType==="check"){t.setAttribute("__lexicalListType","check")}}return{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return false}canIndent(){return false}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if($h(n)){super.append(n)}else{const e=Ph();if(Yh(n)){e.append(n)}else if(Nc(n)){const t=tc(n.getTextContent());e.append(t)}else{e.append(n)}super.append(e)}}return this}extractWithChild(e){return $h(e)}}function Kh(e,t,n){const o=[];const r=[];const s=t.list;if(s!==undefined){const e=s[`${n.__tag}Depth`]||[];const t=hh(n)-1;const i=t%e.length;const l=e[i];const c=s[n.__tag];let a;const u=s.nested;const f=s.checklist;if(u!==undefined&&u.list){a=u.list}if(c!==undefined){o.push(c)}if(f!==undefined&&n.__listType==="check"){o.push(f)}if(l!==undefined){o.push(...Dh(l));for(let t=0;t<e.length;t++){if(t!==i){r.push(n.__tag+t)}}}if(a!==undefined){const e=Dh(a);if(t>1){o.push(...e)}else{r.push(...e)}}}if(r.length>0){qd(e,...r)}if(o.length>0){Fd(e,...o)}}function Bh(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];if($h(o)){t.push(o);const e=o.getChildren();if(e.length>1){e.forEach((e=>{if(Yh(e)){t.push(Nh(e))}}))}}else{t.push(Nh(o))}}return t}function Wh(e){if(e.getAttribute("__lexicallisttype")==="check"||e.classList.contains("contains-task-list")){return true}for(const t of e.childNodes){if(zd(t)&&t.hasAttribute("aria-checked")){return true}}return false}function zh(e){const t=e.nodeName.toLowerCase();let n=null;if(t==="ol"){const t=e.start;n=Uh("number",t)}else if(t==="ul"){if(Wh(e)){n=Uh("check")}else{n=Uh("bullet")}}return{after:Bh,node:n}}const Hh={ol:"number",ul:"bullet"};function Uh(e,t=1){return Yl(new Fh(e,t))}function Yh(e){return e instanceof Fh}const Jh=qa("INSERT_UNORDERED_LIST_COMMAND");const jh=qa("INSERT_ORDERED_LIST_COMMAND");const Gh=qa("INSERT_CHECK_LIST_COMMAND");const Xh=qa("REMOVE_LIST_COMMAND");var Vh=Object.freeze({$createListItemNode:Ph,$createListNode:Uh,$getListDepth:hh,$handleListInsertParagraph:Ah,$isListItemNode:$h,$isListNode:Yh,INSERT_CHECK_LIST_COMMAND:Gh,INSERT_ORDERED_LIST_COMMAND:jh,INSERT_UNORDERED_LIST_COMMAND:Jh,ListItemNode:vh,ListNode:Fh,REMOVE_LIST_COMMAND:Xh,insertList:Ch,removeList:wh});function qh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qh=qh((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const Zh=qa("INSERT_UNORDERED_LIST_COMMAND"),eg=qa("INSERT_ORDERED_LIST_COMMAND"),tg=qa("INSERT_CHECK_LIST_COMMAND"),ng=qa("REMOVE_LIST_COMMAND");const og=Vh;const rg=og.$createListItemNode;const sg=og.$createListNode;const ig=og.$getListDepth;const lg=og.$handleListInsertParagraph;const cg=og.$isListItemNode;const ag=og.$isListNode;const ug=og.INSERT_CHECK_LIST_COMMAND;const fg=og.INSERT_ORDERED_LIST_COMMAND;const dg=og.INSERT_UNORDERED_LIST_COMMAND;const hg=og.ListItemNode;const gg=og.ListNode;const _g=og.REMOVE_LIST_COMMAND;const pg=og.insertList;const mg=og.removeList;var Ng=Object.freeze({$createListItemNode:rg,$createListNode:sg,$getListDepth:ig,$handleListInsertParagraph:lg,$isListItemNode:cg,$isListNode:ag,INSERT_CHECK_LIST_COMMAND:ug,INSERT_ORDERED_LIST_COMMAND:fg,INSERT_UNORDERED_LIST_COMMAND:dg,ListItemNode:hg,ListNode:gg,REMOVE_LIST_COMMAND:_g,insertList:pg,removeList:mg});const yg=new Set(["http:","https:","mailto:","sms:","tel:"]);class Cg extends ia{static getType(){return"link"}static clone(e){return new Cg(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:o=null,rel:r=null,title:s=null}=t;this.__url=e;this.__target=o;this.__rel=r;this.__title=s}createDOM(e){const t=document.createElement("a");t.href=this.sanitizeUrl(this.__url);if(this.__target!==null){t.target=this.__target}if(this.__rel!==null){t.rel=this.__rel}if(this.__title!==null){t.title=this.__title}Fd(t,e.theme.link);return t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const n=this.__url;const o=this.__target;const r=this.__rel;const s=this.__title;if(n!==e.__url){t.href=n}if(o!==e.__target){if(o){t.target=o}else{t.removeAttribute("target")}}if(r!==e.__rel){if(r){t.rel=r}else{t.removeAttribute("rel")}}if(s!==e.__title){if(s){t.title=s}else{t.removeAttribute("title")}}}return false}static importDOM(){return{a:e=>({conversion:Tg,priority:1})}}static importJSON(e){const t=Eg(e.url,{rel:e.rel,target:e.target,title:e.title});t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}sanitizeUrl(e){try{const t=new URL(e);if(!yg.has(t.protocol)){return"about:blank"}}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();t.__url=e}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();t.__target=e}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();t.__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();t.__title=e}insertNewAfter(e,t=true){const n=Eg(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});this.insertAfter(n,t);return n}canInsertTextBefore(){return false}canInsertTextAfter(){return false}canBeEmpty(){return false}isInline(){return true}extractWithChild(e,t,n){if(!wc(t)){return false}const o=t.anchor.getNode();const r=t.focus.getNode();return this.isParentOf(o)&&this.isParentOf(r)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Tg(e){let t=null;if(Wd(e)){const n=e.textContent;if(n!==null&&n!==""||e.children.length>0){t=Eg(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")})}}return{node:t}}function Eg(e,t){return Yl(new Cg(e,t))}function Sg(e){return e instanceof Cg}class wg extends Cg{constructor(e,t={},n){super(e,t,n);this.__isUnlinked=t.isUnlinked!==undefined&&t.isUnlinked!==null?t.isUnlinked:false}static getType(){return"autolink"}static clone(e){return new wg(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();t.__isUnlinked=e;return t}createDOM(e){if(this.__isUnlinked){return document.createElement("span")}else{return super.createDOM(e)}}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=xg(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=true){const n=this.getParentOrThrow().insertNewAfter(e,t);if(Nc(n)){const e=xg(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});n.append(e);return e}return null}}function xg(e,t){return Yl(new wg(e,t))}function bg(e){return e instanceof wg}const Og=qa("TOGGLE_LINK_COMMAND");function Mg(e,t={}){const{target:n,title:o}=t;const r=t.rel===undefined?"noreferrer":t.rel;const s=fc();if(!wc(s)){return}const i=s.extract();if(e===null){i.forEach((e=>{const t=e.getParent();if(!bg(t)&&Sg(t)){const e=t.getChildren();for(let n=0;n<e.length;n++){t.insertBefore(e[n])}t.remove()}}))}else{if(i.length===1){const t=i[0];const s=Dg(t,Sg);if(s!==null){s.setURL(e);if(n!==undefined){s.setTarget(n)}if(r!==null){s.setRel(r)}if(o!==undefined){s.setTitle(o)}return}}let t=null;let s=null;i.forEach((i=>{const l=i.getParent();if(l===s||l===null||Nc(i)&&!i.isInline()){return}if(Sg(l)){s=l;l.setURL(e);if(n!==undefined){l.setTarget(n)}if(r!==null){s.setRel(r)}if(o!==undefined){s.setTitle(o)}return}if(!l.is(t)){t=l;s=Eg(e,{rel:r,target:n,title:o});if(Sg(l)){if(i.getPreviousSibling()===null){l.insertBefore(s)}else{l.insertAfter(s)}}else{i.insertBefore(s)}}if(Sg(i)){if(i.is(s)){return}if(s!==null){const e=i.getChildren();for(let t=0;t<e.length;t++){s.append(e[t])}}i.remove();return}if(s!==null){s.append(i)}}))}}const Ag=Mg;function Dg(e,t){let n=e;while(n!==null&&n.getParent()!==null&&!t(n)){n=n.getParentOrThrow()}return t(n)?n:null}var vg=Object.freeze({$createAutoLinkNode:xg,$createLinkNode:Eg,$isAutoLinkNode:bg,$isLinkNode:Sg,$toggleLink:Mg,AutoLinkNode:wg,LinkNode:Cg,TOGGLE_LINK_COMMAND:Og,toggleLink:Ag});const Rg=qa("TOGGLE_LINK_COMMAND");const kg=vg;const Ig=kg.$createAutoLinkNode;const Lg=kg.$createLinkNode;const Pg=kg.$isAutoLinkNode;const $g=kg.$isLinkNode;const Fg=kg.$toggleLink;const Kg=kg.AutoLinkNode;const Bg=kg.LinkNode;const Wg=kg.TOGGLE_LINK_COMMAND;const zg=kg.toggleLink;var Hg=Object.freeze({$createAutoLinkNode:Ig,$createLinkNode:Lg,$isAutoLinkNode:Pg,$isLinkNode:$g,$toggleLink:Fg,AutoLinkNode:Kg,LinkNode:Bg,TOGGLE_LINK_COMMAND:Wg,toggleLink:zg});const Ug=typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof window.document.createElement!=="undefined";const Yg=e=>Ug?(e||window).getSelection():null;function Jg(e,t=fc()){if(t==null){{throw Error(`Expected valid LexicalSelection`)}}if(wc(t)&&t.isCollapsed()||t.getNodes().length===0){return""}return uh(e,t)}function jg(e,t=fc()){if(t==null){{throw Error(`Expected valid LexicalSelection`)}}if(wc(t)&&t.isCollapsed()||t.getNodes().length===0){return null}return JSON.stringify(Zg(e,t))}function Gg(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");if(n!=null){t.insertRawText(n)}}function Xg(e,t,n){const o=e.getData("application/x-lexical-editor");if(o){try{const e=JSON.parse(o);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes)){const o=e_(e.nodes);return Vg(n,o,t)}}catch(e){}}const r=e.getData("text/html");if(r){try{const e=new DOMParser;const o=e.parseFromString(r,"text/html");const s=fh(n,o);return Vg(n,s,t)}catch(e){}}const s=e.getData("text/plain")||e.getData("text/uri-list");if(s!=null){if(wc(t)){const e=s.split(/(\r?\n|\t)/);if(e[e.length-1]===""){e.pop()}for(let t=0;t<e.length;t++){const n=fc();if(wc(n)){const o=e[t];if(o==="\n"||o==="\r\n"){n.insertParagraph()}else if(o==="\t"){n.insertNodes([ec()])}else{n.insertText(o)}}}}else{t.insertRawText(s)}}}function Vg(e,t,n){if(!e.dispatchCommand(Ya,{nodes:t,selection:n})){n.insertNodes(t)}return}function qg(e){const t=e.exportJSON();const n=e.constructor;if(t.type!==n.getType()){{throw Error(`LexicalNode: Node ${n.name} does not implement .exportJSON().`)}}if(Nc(e)){const e=t.children;if(!Array.isArray(e)){{throw Error(`LexicalNode: Node ${n.name} is an element but .exportJSON() does not have a children array.`)}}}return t}function Qg(e,t,n,o=[]){let r=t!==null?n.isSelected(t):true;const s=Nc(n)&&n.excludeFromCopy("html");let i=n;if(t!==null){let e=Jl(n);e=Mc(e)&&t!==null?tf(t,e):e;i=e}const l=Nc(i)?i.getChildren():[];const c=qg(i);if(Mc(i)){const e=i.__text;if(e.length>0){c.text=e}else{r=false}}for(let o=0;o<l.length;o++){const s=l[o];const i=Qg(e,t,s,c.children);if(!r&&Nc(n)&&i&&n.extractWithChild(s,t,"clone")){r=true}}if(r&&!s){o.push(c)}else if(Array.isArray(c.children)){for(let e=0;e<c.children.length;e++){const t=c.children[e];o.push(t)}}return r}function Zg(e,t){const n=[];const o=uc();const r=o.getChildren();for(let o=0;o<r.length;o++){const s=r[o];Qg(e,t,s,n)}return{namespace:e._config.namespace,nodes:n}}function e_(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];const r=Rc(o);if(Mc(r)){Uu(r)}t.push(r)}return t}const t_=50;let n_=null;async function o_(e,t,n){if(n_!==null){return false}if(t!==null){return new Promise(((o,r)=>{e.update((()=>{o(r_(e,t,n))}))}))}const o=e.getRootElement();const r=e._window==null?window.document:e._window.document;const s=Yg(e._window);if(o===null||s===null){return false}const i=r.createElement("span");i.style.cssText="position: fixed; top: -1000px;";i.append(r.createTextNode("#"));o.append(i);const l=new Range;l.setStart(i,0);l.setEnd(i,1);s.removeAllRanges();s.addRange(l);return new Promise(((t,o)=>{const s=e.registerCommand(Vc,(o=>{if(Gd(o,ClipboardEvent)){s();if(n_!==null){window.clearTimeout(n_);n_=null}t(r_(e,o,n))}return true}),Uc);n_=window.setTimeout((()=>{s();n_=null;t(false)}),t_);r.execCommand("copy");i.remove()}))}function r_(e,t,n){if(n===undefined){const t=Yg(e._window);if(!t){return false}const o=t.anchorNode;const r=t.focusNode;if(o!==null&&r!==null&&!cu(e,o,r)){return false}const s=fc();if(s===null){return false}n=i_(s)}t.preventDefault();const o=t.clipboardData;if(o===null){return false}l_(o,n);return true}const s_=[["text/html",Jg],["application/x-lexical-editor",jg]];function i_(e=fc()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=rc();for(const[o,r]of s_){const s=r(n,e);if(s!==null){t[o]=s}}}return t}function l_(e,t){for(const n in t){const o=t[n];if(o!==undefined){e.setData(n,o)}}}var c_=Object.freeze({$generateJSONFromSelectedNodes:Zg,$generateNodesFromSerializedNodes:e_,$getClipboardDataFromSelection:i_,$getHtmlContent:Jg,$getLexicalContent:jg,$insertDataTransferForPlainText:Gg,$insertDataTransferForRichText:Xg,$insertGeneratedNodes:Vg,copyToClipboard:o_,setLexicalClipboardDataTransfer:l_});function a_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u_=a_((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const f_="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;const d_=c_;const h_=d_.$generateJSONFromSelectedNodes;const g_=d_.$generateNodesFromSerializedNodes;const __=d_.$getClipboardDataFromSelection;const p_=d_.$getHtmlContent;const m_=d_.$getLexicalContent;const N_=d_.$insertDataTransferForPlainText;const y_=d_.$insertDataTransferForRichText;const C_=d_.$insertGeneratedNodes;const T_=d_.copyToClipboard;const E_=d_.setLexicalClipboardDataTransfer;var S_=Object.freeze({$generateJSONFromSelectedNodes:h_,$generateNodesFromSerializedNodes:g_,$getClipboardDataFromSelection:__,$getHtmlContent:p_,$getLexicalContent:m_,$insertDataTransferForPlainText:N_,$insertDataTransferForRichText:y_,$insertGeneratedNodes:C_,copyToClipboard:T_,setLexicalClipboardDataTransfer:E_});const w_=0;const x_=1;const b_=2;const O_=0;const M_=1;const A_=2;const D_=3;const v_=4;function R_(e,t,n){const o=e._nodeMap;const r=[];for(const e of t){const t=o.get(e);if(t!==undefined){r.push(t)}}for(const[e,t]of n){if(!t){continue}const n=o.get(e);if(n!==undefined&&!xc(n)){r.push(n)}}return r}function k_(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r){return O_}const s=t._selection;const i=e._selection;if(r){return M_}if(!wc(s)||!wc(i)||!i.isCollapsed()||!s.isCollapsed()){return O_}const l=R_(t,n,o);if(l.length===0){return O_}if(l.length>1){const n=t._nodeMap;const o=n.get(s.anchor.key);const r=n.get(i.anchor.key);if(o&&r&&!e._nodeMap.has(o.__key)&&Mc(o)&&o.__text.length===1&&s.anchor.offset===1){return A_}return O_}const c=l[0];const a=e._nodeMap.get(c.__key);if(!Mc(a)||!Mc(c)||a.__mode!==c.__mode){return O_}const u=a.__text;const f=c.__text;if(u===f){return O_}const d=s.anchor;const h=i.anchor;if(d.key!==h.key||d.type!=="text"){return O_}const g=d.offset;const _=h.offset;const p=f.length-u.length;if(p===1&&_===g-1){return A_}if(p===-1&&_===g+1){return D_}if(p===-1&&_===g){return v_}return O_}function I_(e,t,n){const o=t._nodeMap.get(e);const r=n._nodeMap.get(e);const s=t._selection;const i=n._selection;const l=wc(s)&&wc(i)&&s.anchor.type==="element"&&s.focus.type==="element"&&i.anchor.type==="text"&&i.focus.type==="text";if(!l&&Mc(o)&&Mc(r)&&o.__parent===r.__parent){return JSON.stringify(t.read((()=>o.exportJSON())))===JSON.stringify(n.read((()=>r.exportJSON())))}return false}function L_(e,t){let n=Date.now();let o=O_;return(r,s,i,l,c,a)=>{const u=Date.now();if(a.has("historic")){o=O_;n=u;return b_}const f=k_(r,s,l,c,e.isComposing());const d=(()=>{const d=i===null||i.editor===e;const h=a.has("history-push");const g=!h&&d&&a.has("history-merge");if(g){return w_}if(r===null){return x_}const _=s._selection;const p=l.size>0||c.size>0;if(!p){if(_!==null){return w_}return b_}if(h===false&&f!==O_&&f===o&&u<n+t&&d){return w_}if(l.size===1){const e=Array.from(l)[0];if(I_(e,r,s)){return w_}}return x_})();n=u;o=f;return d}}function P_(e,t){const n=t.redoStack;const o=t.undoStack;if(n.length!==0){const r=t.current;if(r!==null){o.push(r);e.dispatchCommand(Bc,true)}const s=n.pop();if(n.length===0){e.dispatchCommand(Kc,false)}t.current=s||null;if(s){s.editor.setEditorState(s.editorState,{tag:"historic"})}}}function $_(e,t){const n=t.redoStack;const o=t.undoStack;const r=o.length;if(r!==0){const r=t.current;const s=o.pop();if(r!==null){n.push(r);e.dispatchCommand(Kc,true)}if(o.length===0){e.dispatchCommand(Bc,false)}t.current=s||null;if(s){s.editor.setEditorState(s.editorState,{tag:"historic"})}}}function F_(e){e.undoStack=[];e.redoStack=[];e.current=null}function K_(e,t,n){const o=L_(e,n);const r=({editorState:n,prevEditorState:r,dirtyLeaves:s,dirtyElements:i,tags:l})=>{const c=t.current;const a=t.redoStack;const u=t.undoStack;const f=c===null?null:c.editorState;if(c!==null&&n===f){return}const d=o(r,n,c,s,i,l);if(d===x_){if(a.length!==0){t.redoStack=[];e.dispatchCommand(Kc,false)}if(c!==null){u.push({...c});e.dispatchCommand(Bc,true)}}else if(d===b_){return}t.current={editor:e,editorState:n}};const s=jd(e.registerCommand(Va,(()=>{$_(e,t);return true}),Yc),e.registerCommand(Wa,(()=>{P_(e,t);return true}),Yc),e.registerCommand(Wc,(()=>{F_(t);return false}),Yc),e.registerCommand(zc,(()=>{F_(t);e.dispatchCommand(Kc,false);e.dispatchCommand(Bc,false);return true}),Yc),e.registerUpdateListener(r));return s}function B_(){return{current:null,redoStack:[],undoStack:[]}}var W_=Object.freeze({createEmptyHistoryState:B_,registerHistory:K_});const z_=W_;const H_=z_.createEmptyHistoryState;const U_=z_.registerHistory;var Y_=Object.freeze({createEmptyHistoryState:H_,registerHistory:U_});function J_(){const e=uc();return e.getTextContent()}function j_(e,t=true){if(e){return false}let n=J_();if(t){n=n.trim()}return n===""}function G_(e,t){return()=>j_(e,t)}function X_(e){if(!j_(e,false)){return false}const t=uc();const n=t.getChildren();const o=n.length;if(o>1){return false}for(let e=0;e<o;e++){const t=n[e];if(mc(t)){return false}if(Nc(t)){if(!Sc(t)){return false}if(t.__indent!==0){return false}const n=t.getChildren();const o=n.length;for(let t=0;t<o;t++){const t=n[e];if(!Mc(t)){return false}}}}return true}function V_(e){return()=>X_(e)}function q_(e,t){let n=e.getFirstChild();let o=0;e:while(n!==null){if(Nc(n)){const e=n.getFirstChild();if(e!==null){n=e;continue}}else if(Mc(n)){const e=n.getTextContentSize();if(o+e>t){return{node:n,offset:t-o}}o+=e}const e=n.getNextSibling();if(e!==null){n=e;continue}let r=n.getParent();while(r!==null){const e=r.getNextSibling();if(e!==null){n=e;continue e}r=r.getParent()}break}return null}function Q_(e,t,n,o){const r=e=>e instanceof n;const s=e=>{const t=tc(e.getTextContent());t.setFormat(e.getFormat());e.replace(t)};const i=e=>e.getLatest().__mode;const l=e=>{if(!e.isSimpleText()){return}let n=e.getPreviousSibling();let l=e.getTextContent();let c=e;let a;if(Mc(n)){const o=n.getTextContent();const c=o+l;const a=t(c);if(r(n)){if(a===null||i(n)!==0){s(n);return}else{const t=a.end-o.length;if(t>0){const r=l.slice(0,t);const s=o+r;n.select();n.setTextContent(s);if(t===l.length){e.remove()}else{const n=l.slice(t);e.setTextContent(n)}return}}}else if(a===null||a.start<o.length){return}}let u=0;while(true){a=t(l);let e=a===null?"":l.slice(a.end);l=e;if(e===""){const n=c.getNextSibling();if(Mc(n)){e=c.getTextContent()+n.getTextContent();const o=t(e);if(o===null){if(r(n)){s(n)}else{n.markDirty()}return}else if(o.start!==0){return}}}if(a===null){return}if(a.start===0&&Mc(n)&&n.isTextEntity()){u+=a.end;continue}let i;if(a.start===0){[i,c]=c.splitText(a.end)}else{[,i,c]=c.splitText(a.start+u,a.end+u)}if(!(i!==undefined)){throw Error(`${"nodeToReplace"} should not be undefined. You may want to check splitOffsets passed to the splitText.`)}const f=o(i);f.setFormat(i.getFormat());i.replace(f);if(c==null){return}u=0;n=f}};const c=e=>{const n=e.getTextContent();const o=t(n);if(o===null||o.start!==0){s(e);return}if(n.length>o.end){e.splitText(o.end);return}const i=e.getPreviousSibling();if(Mc(i)&&i.isTextEntity()){s(i);s(e)}const l=e.getNextSibling();if(Mc(l)&&l.isTextEntity()){s(l);if(r(e)){s(e)}}};const a=e.registerNodeTransform(Xa,l);const u=e.registerNodeTransform(n,c);return[a,u]}var Z_=Object.freeze({$canShowPlaceholder:X_,$canShowPlaceholderCurry:V_,$findTextIntersectionFromCharacters:q_,$isRootTextContentEmpty:j_,$isRootTextContentEmptyCurry:G_,$rootTextContent:J_,registerLexicalTextEntity:Q_});function ep(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tp=ep((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const np=Z_;const op=np.$canShowPlaceholder;const rp=np.$canShowPlaceholderCurry;const sp=np.$findTextIntersectionFromCharacters;const ip=np.$isRootTextContentEmpty;const lp=np.$isRootTextContentEmptyCurry;const cp=np.$rootTextContent;const ap=np.registerLexicalTextEntity;var up=Object.freeze({$canShowPlaceholder:op,$canShowPlaceholderCurry:rp,$findTextIntersectionFromCharacters:sp,$isRootTextContentEmpty:ip,$isRootTextContentEmptyCurry:lp,$rootTextContent:cp,registerLexicalTextEntity:ap});function fp(e,t){if(typeof document.caretRangeFromPoint!=="undefined"){const n=document.caretRangeFromPoint(e,t);if(n===null){return null}return{node:n.startContainer,offset:n.startOffset}}else if(document.caretPositionFromPoint!=="undefined"){const n=document.caretPositionFromPoint(e,t);if(n===null){return null}return{node:n.offsetNode,offset:n.offset}}else{return null}}const dp=typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof window.document.createElement!=="undefined";const hp=dp&&"documentMode"in document?document.documentMode:null;const gp=dp&&"InputEvent"in window&&!hp?"getTargetRanges"in new window.InputEvent("input"):false;const _p=dp&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent);const pp=dp&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const mp=dp&&/^(?=.*Chrome).*/i.test(navigator.userAgent);const Np=dp&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!mp;const yp=qa("DRAG_DROP_PASTE_FILE");class Cp extends ia{static getType(){return"quote"}static clone(e){return new Cp(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");Fd(t,e.theme.quote);return t}updateDOM(e,t){return false}static importDOM(){return{blockquote:e=>({conversion:bp,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&zd(t)){if(this.isEmpty()){t.append(document.createElement("br"))}const e=this.getFormatType();t.style.textAlign=e;const n=this.getDirection();if(n){t.dir=n}}return{element:t}}static importJSON(e){const t=Tp();t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=Vl();const o=this.getDirection();n.setDirection(o);this.insertAfter(n,t);return n}collapseAtStart(){const e=Vl();const t=this.getChildren();t.forEach((t=>e.append(t)));this.replace(e);return true}canMergeWhenEmpty(){return true}}function Tp(){return Yl(new Cp)}function Ep(e){return e instanceof Cp}class Sp extends ia{static getType(){return"heading"}static clone(e){return new Sp(e.__tag,e.__key)}constructor(e,t){super(t);this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag;const n=document.createElement(t);const o=e.theme;const r=o.heading;if(r!==undefined){const e=r[t];Fd(n,e)}return n}updateDOM(e,t){return false}static importDOM(){return{h1:e=>({conversion:xp,priority:0}),h2:e=>({conversion:xp,priority:0}),h3:e=>({conversion:xp,priority:0}),h4:e=>({conversion:xp,priority:0}),h5:e=>({conversion:xp,priority:0}),h6:e=>({conversion:xp,priority:0}),p:e=>{const t=e;const n=t.firstChild;if(n!==null&&wp(n)){return{conversion:()=>({node:null}),priority:3}}return null},span:e=>{if(wp(e)){return{conversion:e=>({node:Op("h1")}),priority:3}}return null}}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&zd(t)){if(this.isEmpty()){t.append(document.createElement("br"))}const e=this.getFormatType();t.style.textAlign=e;const n=this.getDirection();if(n){t.dir=n}}return{element:t}}static importJSON(e){const t=Op(e.tag);t.setFormat(e.format);t.setIndent(e.indent);t.setDirection(e.direction);return t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=true){const n=e?e.anchor.offset:0;const o=this.getLastDescendant();const r=!o||e&&e.anchor.key===o.getKey()&&n===o.getTextContentSize();const s=r||!e?Vl():Op(this.getTag());const i=this.getDirection();s.setDirection(i);this.insertAfter(s,t);if(n===0&&!this.isEmpty()&&e){const e=Vl();e.select();this.replace(e,true)}return s}collapseAtStart(){const e=!this.isEmpty()?Op(this.getTag()):Vl();const t=this.getChildren();t.forEach((t=>e.append(t)));this.replace(e);return true}extractWithChild(){return true}}function wp(e){if(e.nodeName.toLowerCase()==="span"){return e.style.fontSize==="26pt"}return false}function xp(e){const t=e.nodeName.toLowerCase();let n=null;if(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6"){n=Op(t);if(e.style!==null){n.setFormat(e.style.textAlign)}}return{node:n}}function bp(e){const t=Tp();if(e.style!==null){t.setFormat(e.style.textAlign)}return{node:t}}function Op(e){return Yl(new Sp(e))}function Mp(e){return e instanceof Sp}function Ap(e,t){e.preventDefault();t.update((()=>{const n=fc();const o=Gd(e,InputEvent)||Gd(e,KeyboardEvent)?null:e.clipboardData;if(o!=null&&n!==null){y_(o,n,t)}}),{tag:"paste"})}async function Dp(e,t){await T_(t,Gd(e,ClipboardEvent)?e:null);t.update((()=>{const e=fc();if(wc(e)){e.removeText()}else if(Ec(e)){e.getNodes().forEach((e=>e.remove()))}}))}function vp(e){let t=null;if(Gd(e,DragEvent)){t=e.dataTransfer}else if(Gd(e,ClipboardEvent)){t=e.clipboardData}if(t===null){return[false,[],false]}const n=t.types;const o=n.includes("Files");const r=n.includes("text/html")||n.includes("text/plain");return[o,Array.from(t.files),r]}function Rp(e){const t=fc();if(!wc(t)){return false}const n=new Set;const o=t.getNodes();for(let t=0;t<o.length;t++){const r=o[t];const s=r.getKey();if(n.has(s)){continue}const i=Nd(r,(e=>Nc(e)&&!e.isInline()));if(i===null){continue}const l=i.getKey();if(i.canIndent()&&!n.has(l)){n.add(l);e(i)}}return n.size>0}function kp(e){const t=sc(e);return mc(t)}function Ip(e){const t=e.focus;return t.key==="root"&&t.offset===uc().getChildrenSize()}function Lp(e){const t=jd(e.registerCommand(Hc,(e=>{const t=fc();if(Ec(t)){t.clear();return true}return false}),0),e.registerCommand(Qc,(e=>{const t=fc();if(!wc(t)){return false}t.deleteCharacter(e);return true}),Yc),e.registerCommand(ea,(e=>{const t=fc();if(!wc(t)){return false}t.deleteWord(e);return true}),Yc),e.registerCommand(Zc,(e=>{const t=fc();if(!wc(t)){return false}t.deleteLine(e);return true}),Yc),e.registerCommand(Xc,(t=>{const n=fc();if(typeof t==="string"){if(n!==null){n.insertText(t)}}else{if(n===null){return false}const o=t.dataTransfer;if(o!=null){y_(o,n,e)}else if(wc(n)){const e=t.data;if(e){n.insertText(e)}return true}}return true}),Yc),e.registerCommand(za,(()=>{const e=fc();if(!wc(e)){return false}e.removeText();return true}),Yc),e.registerCommand(aa,(e=>{const t=fc();if(!wc(t)){return false}t.formatText(e);return true}),Yc),e.registerCommand(ca,(e=>{const t=fc();if(!wc(t)&&!Ec(t)){return false}const n=t.getNodes();for(const t of n){const n=Nd(t,(e=>Nc(e)&&!e.isInline()));if(n!==null){n.setFormat(e)}}return true}),Yc),e.registerCommand(fa,(e=>{const t=fc();if(!wc(t)){return false}t.insertLineBreak(e);return true}),Yc),e.registerCommand(da,(()=>{const e=fc();if(!wc(e)){return false}e.insertParagraph();return true}),Yc),e.registerCommand(ha,(()=>{_c([ec()]);return true}),Yc),e.registerCommand(ua,(()=>Rp((e=>{const t=e.getIndent();e.setIndent(t+1)}))),Yc),e.registerCommand(Fa,(()=>Rp((e=>{const t=e.getIndent();if(t>0){e.setIndent(t-1)}}))),Yc),e.registerCommand(ba,(e=>{const t=fc();if(Ec(t)&&!kp(e.target)){const e=t.getNodes();if(e.length>0){e[0].selectPrevious();return true}}else if(wc(t)){const n=nc(t.focus,true);if(!e.shiftKey&&mc(n)&&!n.isIsolated()&&!n.isInline()){n.selectPrevious();e.preventDefault();return true}}return false}),Yc),e.registerCommand(Sa,(e=>{const t=fc();if(Ec(t)){const e=t.getNodes();if(e.length>0){e[0].selectNext(0,0);return true}}else if(wc(t)){if(Ip(t)){e.preventDefault();return true}const n=nc(t.focus,false);if(!e.shiftKey&&mc(n)&&!n.isIsolated()&&!n.isInline()){n.selectNext();e.preventDefault();return true}}return false}),Yc),e.registerCommand(wa,(e=>{const t=fc();if(Ec(t)){const n=t.getNodes();if(n.length>0){e.preventDefault();n[0].selectPrevious();return true}}if(!wc(t)){return false}if(ef(t,true)){const n=e.shiftKey;e.preventDefault();Vu(t,n,true);return true}return false}),Yc),e.registerCommand(xa,(e=>{const t=fc();if(Ec(t)&&!kp(e.target)){const n=t.getNodes();if(n.length>0){e.preventDefault();n[0].selectNext(0,0);return true}}if(!wc(t)){return false}const n=e.shiftKey;if(ef(t,false)){e.preventDefault();Vu(t,n,false);return true}return false}),Yc),e.registerCommand(Oa,(t=>{if(kp(t.target)){return false}const n=fc();if(!wc(n)){return false}t.preventDefault();const{anchor:o}=n;const r=o.getNode();if(n.isCollapsed()&&o.offset===0&&!xc(r)){const t=yd(r);if(t.getIndent()>0){return e.dispatchCommand(Fa,undefined)}}return e.dispatchCommand(Qc,true)}),Yc),e.registerCommand(Ma,(t=>{if(kp(t.target)){return false}const n=fc();if(!wc(n)){return false}t.preventDefault();return e.dispatchCommand(Qc,false)}),Yc),e.registerCommand(Da,(t=>{const n=fc();if(!wc(n)){return false}if(t!==null){if((pp||_p||Np)&&gp){return false}t.preventDefault();if(t.shiftKey){return e.dispatchCommand(fa,false)}}return e.dispatchCommand(da,undefined)}),Yc),e.registerCommand(va,(()=>{const t=fc();if(!wc(t)){return false}e.blur();return true}),Yc),e.registerCommand(ra,(t=>{const[,n]=vp(t);if(n.length>0){const o=t.clientX;const r=t.clientY;const s=fp(o,r);if(s!==null){const{offset:t,node:o}=s;const r=sc(o);if(r!==null){const e=Ql();if(Mc(r)){e.anchor.set(r.getKey(),t,"text");e.focus.set(r.getKey(),t,"text")}else{const t=r.getParentOrThrow().getKey();const n=r.getIndexWithinParent()+1;e.anchor.set(t,n,"element");e.focus.set(t,n,"element")}const n=vc(e);Lc(n)}e.dispatchCommand(yp,n)}t.preventDefault();return true}const o=fc();if(wc(o)){return true}return false}),Yc),e.registerCommand(oa,(e=>{const[t]=vp(e);const n=fc();if(t&&!wc(n)){return false}return true}),Yc),e.registerCommand(na,(e=>{const[t]=vp(e);const n=fc();if(t&&!wc(n)){return false}const o=e.clientX;const r=e.clientY;const s=fp(o,r);if(s!==null){const t=sc(s.node);if(mc(t)){e.preventDefault()}}return true}),Yc),e.registerCommand(Ja,(()=>{kc();return true}),Yc),e.registerCommand(Vc,(t=>{T_(e,Gd(t,ClipboardEvent)?t:null);return true}),Yc),e.registerCommand(qc,(t=>{Dp(t,e);return true}),Yc),e.registerCommand(Ka,(t=>{const[,n,o]=vp(t);if(n.length>0&&!o){e.dispatchCommand(yp,n);return true}if(lu(t.target)){return false}const r=fc();if(r!==null){Ap(t,e);return true}return false}),Yc));return t}var Pp=Object.freeze({$createHeadingNode:Op,$createQuoteNode:Tp,$isHeadingNode:Mp,$isQuoteNode:Ep,DRAG_DROP_PASTE:yp,HeadingNode:Sp,QuoteNode:Cp,eventFiles:vp,registerRichText:Lp});const $p="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Fp=$p&&"documentMode"in document?document.documentMode:null,Kp=!(!$p||!("InputEvent"in window)||Fp)&&"getTargetRanges"in new window.InputEvent("input"),Bp=$p&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wp=$p&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zp=$p&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Hp=$p&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!zp,Up=qa("DRAG_DROP_PASTE_FILE");const Yp=Pp;const Jp=Yp.$createHeadingNode;const jp=Yp.$createQuoteNode;const Gp=Yp.$isHeadingNode;const Xp=Yp.$isQuoteNode;const Vp=Yp.DRAG_DROP_PASTE;const qp=Yp.HeadingNode;const Qp=Yp.QuoteNode;const Zp=Yp.eventFiles;const em=Yp.registerRichText;var tm=Object.freeze({$createHeadingNode:Jp,$createQuoteNode:jp,$isHeadingNode:Gp,$isQuoteNode:Xp,DRAG_DROP_PASTE:Vp,HeadingNode:qp,QuoteNode:Qp,eventFiles:Zp,registerRichText:em});const nm=/^(\d+(?:\.\d+)?)px$/;const om=75;const rm={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class sm extends ia{static getType(){return"tablecell"}static clone(e){const t=new sm(e.__headerState,e.__colSpan,e.__width,e.__key);t.__rowSpan=e.__rowSpan;t.__backgroundColor=e.__backgroundColor;return t}static importDOM(){return{td:e=>({conversion:im,priority:0}),th:e=>({conversion:im,priority:0})}}static importJSON(e){const t=e.colSpan||1;const n=e.rowSpan||1;const o=lm(e.headerState,t,e.width||undefined);o.__rowSpan=n;o.__backgroundColor=e.backgroundColor||null;return o}constructor(e=rm.NO_STATUS,t=1,n,o){super(o);this.__colSpan=t;this.__rowSpan=1;this.__headerState=e;this.__width=n;this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());if(this.__width){t.style.width=`${this.__width}px`}if(this.__colSpan>1){t.colSpan=this.__colSpan}if(this.__rowSpan>1){t.rowSpan=this.__rowSpan}if(this.__backgroundColor!==null){t.style.backgroundColor=this.__backgroundColor}Fd(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader);return t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const e=t;e.style.border="1px solid black";if(this.__colSpan>1){e.colSpan=this.__colSpan}if(this.__rowSpan>1){e.rowSpan=this.__rowSpan}e.style.width=`${this.getWidth()||om}px`;e.style.verticalAlign="top";e.style.textAlign="start";const n=this.getBackgroundColor();if(n!==null){e.style.backgroundColor=n}else if(this.hasHeader()){e.style.backgroundColor="#f2f3f5"}}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){this.getWritable().__colSpan=e;return this}getRowSpan(){return this.__rowSpan}setRowSpan(e){this.getWritable().__rowSpan=e;return this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){const t=this.getWritable();t.__headerState=e;return this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();t.__width=e;return this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();if((t.__headerState&e)===e){t.__headerState-=e}else{t.__headerState+=e}return t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==rm.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return true}collapseAtStart(){return true}canBeEmpty(){return false}canIndent(){return false}}function im(e){const t=e;const n=e.nodeName.toLowerCase();let o=undefined;if(nm.test(t.style.width)){o=parseFloat(t.style.width)}const r=lm(n==="th"?rm.ROW:rm.NO_STATUS,t.colSpan,o);r.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;if(s!==""){r.__backgroundColor=s}const i=t.style;const l=i.textDecoration.split(" ");const c=i.fontWeight==="700"||i.fontWeight==="bold";const a=l.includes("line-through");const u=i.fontStyle==="italic";const f=l.includes("underline");return{after:e=>{if(e.length===0){e.push(Vl())}return e},forChild:(e,t)=>{if(cm(t)&&!Nc(e)){const t=Vl();if(Tc(e)&&e.getTextContent()==="\n"){return null}if(Mc(e)){if(c){e.toggleFormat("bold")}if(a){e.toggleFormat("strikethrough")}if(u){e.toggleFormat("italic")}if(f){e.toggleFormat("underline")}}t.append(e);return t}return e},node:r}}function lm(e,t=1,n){return Yl(new sm(e,t,n))}function cm(e){return e instanceof sm}const am=qa("INSERT_TABLE_COMMAND");class um extends ia{static getType(){return"tablerow"}static clone(e){return new um(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:fm,priority:0})}}static importJSON(e){return dm(e.height)}constructor(e,t){super(t);this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");if(this.__height){t.style.height=`${this.__height}px`}Fd(t,e.theme.tableRow);return t}isShadowRoot(){return true}setHeight(e){const t=this.getWritable();t.__height=e;return this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return false}canIndent(){return false}}function fm(e){const t=e;let n=undefined;if(nm.test(t.style.height)){n=parseFloat(t.style.height)}return{node:dm(n)}}function dm(e){return Yl(new um(e))}function hm(e){return e instanceof um}const gm=typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof window.document.createElement!=="undefined";function _m(e,t,n=true){const o=wN();for(let r=0;r<e;r++){const e=dm();for(let o=0;o<t;o++){let t=rm.NO_STATUS;if(typeof n==="object"){if(r===0&&n.rows){t|=rm.ROW}if(o===0&&n.columns){t|=rm.COLUMN}}else if(n){if(r===0){t|=rm.ROW}if(o===0){t|=rm.COLUMN}}const s=lm(t);const i=Vl();i.append(tc());s.append(i);e.append(s)}o.append(e)}return o}function pm(e){const t=Nd(e,(e=>cm(e)));if(cm(t)){return t}return null}function mm(e){const t=Nd(e,(e=>hm(e)));if(hm(t)){return t}throw new Error("Expected table cell to be inside of table row.")}function Nm(e){const t=Nd(e,(e=>xN(e)));if(xN(t)){return t}throw new Error("Expected table cell to be inside of table.")}function ym(e){const t=mm(e);const n=Nm(t);return n.getChildren().findIndex((e=>e.is(t)))}function Cm(e){const t=mm(e);return t.getChildren().findIndex((t=>t.is(e)))}function Tm(e,t){const n=Nm(e);const{x:o,y:r}=n.getCordsFromCellNode(e,t);return{above:n.getCellNodeFromCords(o,r-1,t),below:n.getCellNodeFromCords(o,r+1,t),left:n.getCellNodeFromCords(o-1,r,t),right:n.getCellNodeFromCords(o+1,r,t)}}function Em(e,t){const n=e.getChildren();if(t>=n.length||t<0){throw new Error("Expected table cell to be inside of table row.")}const o=n[t];o.remove();return e}function Sm(e,t,n=true,o,r){const s=e.getChildren();if(t>=s.length||t<0){throw new Error("Table row target index out of range")}const i=s[t];if(hm(i)){for(let e=0;e<o;e++){const e=i.getChildren();const t=e.length;const o=dm();for(let n=0;n<t;n++){const t=e[n];if(!cm(t)){throw Error(`Expected table cell`)}const{above:s,below:i}=Tm(t,r);let l=rm.NO_STATUS;const c=s&&s.getWidth()||i&&i.getWidth()||undefined;if(s&&s.hasHeaderState(rm.COLUMN)||i&&i.hasHeaderState(rm.COLUMN)){l|=rm.COLUMN}const a=lm(l,1,c);a.append(Vl());o.append(a)}if(n){i.insertAfter(o)}else{i.insertBefore(o)}}}else{throw new Error("Row before insertion index does not exist.")}return e}const wm=(e,t)=>{if(e===rm.BOTH||e===t){return t}return rm.NO_STATUS};function xm(e=true){const t=fc();if(!(wc(t)||Km(t))){throw Error(`Expected a RangeSelection or TableSelection`)}const n=t.focus.getNode();const[o,,r]=Pm(n);const[s,i]=Im(r,o,o);const l=s[0].length;const{startRow:c}=i;if(e){const e=c+o.__rowSpan-1;const t=s[e];const n=dm();for(let o=0;o<l;o++){const{cell:r,startRow:s}=t[o];if(s+r.__rowSpan-1<=e){const e=t[o].cell;const r=e.__headerState;const s=wm(r,rm.COLUMN);n.append(lm(s).append(Vl()))}else{r.setRowSpan(r.__rowSpan+1)}}const i=r.getChildAtIndex(e);if(!hm(i)){throw Error(`focusEndRow is not a TableRowNode`)}i.insertAfter(n)}else{const e=s[c];const t=dm();for(let n=0;n<l;n++){const{cell:o,startRow:r}=e[n];if(r===c){const o=e[n].cell;const r=o.__headerState;const s=wm(r,rm.COLUMN);t.append(lm(s).append(Vl()))}else{o.setRowSpan(o.__rowSpan+1)}}const n=r.getChildAtIndex(c);if(!hm(n)){throw Error(`focusEndRow is not a TableRowNode`)}n.insertBefore(t)}}function bm(e,t,n=true,o,r){const s=e.getChildren();const i=[];for(let e=0;e<s.length;e++){const n=s[e];if(hm(n)){for(let e=0;e<o;e++){const e=n.getChildren();if(t>=e.length||t<0){throw new Error("Table column target index out of range")}const o=e[t];if(!cm(o)){throw Error(`Expected table cell`)}const{left:s,right:l}=Tm(o,r);let c=rm.NO_STATUS;if(s&&s.hasHeaderState(rm.ROW)||l&&l.hasHeaderState(rm.ROW)){c|=rm.ROW}const a=lm(c);a.append(Vl());i.push({newTableCell:a,targetCell:o})}}}i.forEach((({newTableCell:e,targetCell:t})=>{if(n){t.insertAfter(e)}else{t.insertBefore(e)}}));return e}function Om(e=true){const t=fc();if(!(wc(t)||Km(t))){throw Error(`Expected a RangeSelection or TableSelection`)}const n=t.anchor.getNode();const o=t.focus.getNode();const[r]=Pm(n);const[s,,i]=Pm(o);const[l,c,a]=Im(i,s,r);const u=l.length;const f=e?Math.max(c.startColumn,a.startColumn):Math.min(c.startColumn,a.startColumn);const d=e?f+s.__colSpan-1:f-1;const h=i.getFirstChild();if(!hm(h)){throw Error(`Expected firstTable child to be a row`)}let g=null;function _(e=rm.NO_STATUS){const t=lm(e).append(Vl());if(g===null){g=t}return t}let p=h;e:for(let e=0;e<u;e++){if(e!==0){const e=p.getNextSibling();if(!hm(e)){throw Error(`Expected row nextSibling to be a row`)}p=e}const t=l[e];const n=t[d<0?0:d].cell.__headerState;const o=wm(n,rm.ROW);if(d<0){Rm(p,_(o));continue}const{cell:r,startColumn:s,startRow:i}=t[d];if(s+r.__colSpan-1<=d){let n=r;let s=i;let l=d;while(s!==e&&n.__rowSpan>1){l-=r.__colSpan;if(l>=0){const{cell:e,startRow:o}=t[l];n=e;s=o}else{p.append(_(o));continue e}}n.insertAfter(_(o))}else{r.setColSpan(r.__colSpan+1)}}if(g!==null){vm(g)}}function Mm(e,t){const n=e.getChildren();for(let e=0;e<n.length;e++){const o=n[e];if(hm(o)){const e=o.getChildren();if(t>=e.length||t<0){throw new Error("Table column target index out of range")}e[t].remove()}}return e}function Am(){const e=fc();if(!(wc(e)||Km(e))){throw Error(`Expected a RangeSelection or TableSelection`)}const t=e.anchor.getNode();const n=e.focus.getNode();const[o,,r]=Pm(t);const[s]=Pm(n);const[i,l,c]=Im(r,o,s);const{startRow:a}=l;const{startRow:u}=c;const f=u+s.__rowSpan-1;if(i.length===f-a+1){r.remove();return}const d=i[0].length;const h=i[f+1];const g=r.getChildAtIndex(f+1);for(let e=f;e>=a;e--){for(let t=d-1;t>=0;t--){const{cell:n,startRow:o,startColumn:r}=i[e][t];if(r!==t){continue}if(e===a&&o<a){n.setRowSpan(n.__rowSpan-(o-a))}if(o>=a&&o+n.__rowSpan-1>f){n.setRowSpan(n.__rowSpan-(f-o+1));if(!(g!==null)){throw Error(`Expected nextRowNode not to be null`)}if(t===0){Rm(g,n)}else{const{cell:e}=h[t-1];e.insertAfter(n)}}}const t=r.getChildAtIndex(e);if(!hm(t)){throw Error(`Expected GridNode childAtIndex(${String(e)}) to be RowNode`)}t.remove()}if(h!==undefined){const{cell:e}=h[0];vm(e)}else{const e=i[a-1];const{cell:t}=e[0];vm(t)}}function Dm(){const e=fc();if(!(wc(e)||Km(e))){throw Error(`Expected a RangeSelection or TableSelection`)}const t=e.anchor.getNode();const n=e.focus.getNode();const[o,,r]=Pm(t);const[s]=Pm(n);const[i,l,c]=Im(r,o,s);const{startColumn:a}=l;const{startRow:u,startColumn:f}=c;const d=Math.min(a,f);const h=Math.max(a+o.__colSpan-1,f+s.__colSpan-1);const g=h-d+1;const _=i[0].length;if(_===h-d+1){r.selectPrevious();r.remove();return}const p=i.length;for(let e=0;e<p;e++){for(let t=d;t<=h;t++){const{cell:n,startColumn:o}=i[e][t];if(o<d){if(t===d){const e=d-o;n.setColSpan(n.__colSpan-Math.min(g,n.__colSpan-e))}}else if(o+n.__colSpan-1>h){if(t===h){const e=h-o+1;n.setColSpan(n.__colSpan-e)}}else{n.remove()}}}const m=i[u];const N=a>f?m[a+o.__colSpan]:m[f+s.__colSpan];if(N!==undefined){const{cell:e}=N;vm(e)}else{const e=f<a?m[f-1]:m[a-1];const{cell:t}=e;vm(t)}}function vm(e){const t=e.getFirstDescendant();if(t==null){e.selectStart()}else{t.getParentOrThrow().selectStart()}}function Rm(e,t){const n=e.getFirstChild();if(n!==null){n.insertBefore(t)}else{e.append(t)}}function km(){const e=fc();if(!(wc(e)||Km(e))){throw Error(`Expected a RangeSelection or TableSelection`)}const t=e.anchor.getNode();const[n,o,r]=Pm(t);const s=n.__colSpan;const i=n.__rowSpan;if(s>1){for(let e=1;e<s;e++){n.insertAfter(lm(rm.NO_STATUS).append(Vl()))}n.setColSpan(1)}if(i>1){const[e,t]=Im(r,n,n);const{startColumn:l,startRow:c}=t;let a;for(let t=1;t<i;t++){const n=c+t;const r=e[n];a=(a||o).getNextSibling();if(!hm(a)){throw Error(`Expected row next sibling to be a row`)}let i=null;for(let e=0;e<l;e++){const t=r[e];const o=t.cell;if(t.startRow===n){i=o}if(o.__colSpan>1){e+=o.__colSpan-1}}if(i===null){for(let e=0;e<s;e++){Rm(a,lm(rm.NO_STATUS).append(Vl()))}}else{for(let e=0;e<s;e++){i.insertAfter(lm(rm.NO_STATUS).append(Vl()))}}}n.setRowSpan(1)}}function Im(e,t,n){const[o,r,s]=Lm(e,t,n);if(!(r!==null)){throw Error(`Anchor not found in Grid`)}if(!(s!==null)){throw Error(`Focus not found in Grid`)}return[o,r,s]}function Lm(e,t,n){const o=[];let r=null;let s=null;function i(e,i,l){const c={cell:l,startColumn:i,startRow:e};const a=l.__rowSpan;const u=l.__colSpan;for(let t=0;t<a;t++){if(o[e+t]===undefined){o[e+t]=[]}for(let n=0;n<u;n++){o[e+t][i+n]=c}}if(t!==null&&t.is(l)){r=c}if(n!==null&&n.is(l)){s=c}}function l(e,t){return o[e]===undefined||o[e][t]===undefined}const c=e.getChildren();for(let e=0;e<c.length;e++){const t=c[e];if(!hm(t)){throw Error(`Expected GridNode children to be TableRowNode`)}const n=t.getChildren();let o=0;for(const t of n){if(!cm(t)){throw Error(`Expected TableRowNode children to be TableCellNode`)}while(!l(e,o)){o++}i(e,o,t);o+=t.__colSpan}}return[o,r,s]}function Pm(e){let t;if(e instanceof sm){t=e}else if("__type"in e){const n=Nd(e,cm);if(!cm(n)){throw Error(`Expected to find a parent TableCellNode`)}t=n}else{const n=Nd(e.getNode(),cm);if(!cm(n)){throw Error(`Expected to find a parent TableCellNode`)}t=n}const n=t.getParent();if(!hm(n)){throw Error(`Expected TableCellNode to have a parent TableRowNode`)}const o=n.getParent();if(!xN(o)){throw Error(`Expected TableRowNode to have a parent GridNode`)}return[t,n,o]}function $m(e){const[t,,n]=Pm(e);const o=n.getChildren();const r=o.length;const s=o[0].getChildren().length;const i=new Array(r);for(let e=0;e<r;e++){i[e]=new Array(s)}for(let e=0;e<r;e++){const n=o[e];const r=n.getChildren();let s=0;for(let n=0;n<r.length;n++){while(i[e][s]){s++}const o=r[n];const l=o.__rowSpan||1;const c=o.__colSpan||1;for(let t=0;t<l;t++){for(let n=0;n<c;n++){i[e+t][s+n]=o}}if(t===o){return{colSpan:c,columnIndex:s,rowIndex:e,rowSpan:l}}s+=c}}return null}class Fm{constructor(e,t,n){this.anchor=t;this.focus=n;t._selection=this;n._selection=this;this._cachedNodes=null;this.dirty=false;this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Km(e)){return false}return this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=true;this.tableKey=e;this.anchor.key=t;this.focus.key=n;this._cachedNodes=null}clone(){return new Fm(this.tableKey,this.anchor,this.focus)}isCollapsed(){return false}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();if(!Nc(t)){throw Error(`Expected TableSelection focus to be an ElementNode`)}const n=vc(t.select(0,t.getChildrenSize()));n.insertNodes(e)}getShape(){const e=lc(this.anchor.key);if(!cm(e)){throw Error(`Expected TableSelection anchor to be (or a child of) TableCellNode`)}const t=$m(e);if(!(t!==null)){throw Error(`getCellRect: expected to find AnchorNode`)}const n=lc(this.focus.key);if(!cm(n)){throw Error(`Expected TableSelection focus to be (or a child of) TableCellNode`)}const o=$m(n);if(!(o!==null)){throw Error(`getCellRect: expected to find focusCellNode`)}const r=Math.min(t.columnIndex,o.columnIndex);const s=Math.max(t.columnIndex,o.columnIndex);const i=Math.min(t.rowIndex,o.rowIndex);const l=Math.max(t.rowIndex,o.rowIndex);return{fromX:Math.min(r,s),fromY:Math.min(i,l),toX:Math.max(r,s),toY:Math.max(i,l)}}getNodes(){const e=this._cachedNodes;if(e!==null){return e}const t=this.anchor.getNode();const n=this.focus.getNode();const o=Nd(t,cm);const r=Nd(n,cm);if(!cm(o)){throw Error(`Expected TableSelection anchor to be (or a child of) TableCellNode`)}if(!cm(r)){throw Error(`Expected TableSelection focus to be (or a child of) TableCellNode`)}const s=o.getParent();if(!hm(s)){throw Error(`Expected anchorCell to have a parent TableRowNode`)}const i=s.getParent();if(!xN(i)){throw Error(`Expected tableNode to have a parent TableNode`)}const l=r.getParents()[1];if(l!==i){if(!i.isParentOf(r)){const e=i.getParent();if(!(e!=null)){throw Error(`Expected gridParent to have a parent`)}this.set(this.tableKey,e.getKey(),r.getKey())}else{const e=l.getParent();if(!(e!=null)){throw Error(`Expected focusCellParent to have a parent`)}this.set(this.tableKey,r.getKey(),e.getKey())}return this.getNodes()}const[c,a,u]=Im(i,o,r);let f=Math.min(a.startColumn,u.startColumn);let d=Math.min(a.startRow,u.startRow);let h=Math.max(a.startColumn+a.cell.__colSpan-1,u.startColumn+u.cell.__colSpan-1);let g=Math.max(a.startRow+a.cell.__rowSpan-1,u.startRow+u.cell.__rowSpan-1);let _=f;let p=d;let m=f;let N=d;function y(e){const{cell:t,startColumn:n,startRow:o}=e;f=Math.min(f,n);d=Math.min(d,o);h=Math.max(h,n+t.__colSpan-1);g=Math.max(g,o+t.__rowSpan-1)}while(f<_||d<p||h>m||g>N){if(f<_){const e=N-p;const t=_-1;for(let n=0;n<=e;n++){y(c[p+n][t])}_=t}if(d<p){const e=m-_;const t=p-1;for(let n=0;n<=e;n++){y(c[t][_+n])}p=t}if(h>m){const e=N-p;const t=m+1;for(let n=0;n<=e;n++){y(c[p+n][t])}m=t}if(g>N){const e=m-_;const t=N+1;for(let n=0;n<=e;n++){y(c[t][_+n])}N=t}}const C=[i];let T=null;for(let e=d;e<=g;e++){for(let t=f;t<=h;t++){const{cell:n}=c[e][t];const o=n.getParent();if(!hm(o)){throw Error(`Expected TableCellNode parent to be a TableRowNode`)}if(o!==T){C.push(o)}C.push(n,...Wm(n));T=o}}if(!nu()){this._cachedNodes=C}return C}getTextContent(){const e=this.getNodes().filter((e=>cm(e)));let t="";for(let n=0;n<e.length;n++){const o=e[n];const r=o.__parent;const s=(e[n+1]||{}).__parent;t+=o.getTextContent()+(s!==r?"\n":"\t")}return t}}function Km(e){return e instanceof Fm}function Bm(){const e=ql("root",0,"element");const t=ql("root",0,"element");return new Fm("root",e,t)}function Wm(e){const t=[];const n=[e];while(n.length>0){const o=n.pop();if(!(o!==undefined)){throw Error(`Stack.length > 0; can't be undefined`)}if(Nc(o)){n.unshift(...o.getChildren())}if(o!==e){t.push(o)}}return t}class zm{constructor(e,t){this.isHighlightingCells=false;this.anchorX=-1;this.anchorY=-1;this.focusX=-1;this.focusY=-1;this.listenersToRemove=new Set;this.tableNodeKey=t;this.editor=e;this.table={columns:0,domRows:[],rows:0};this.tableSelection=null;this.anchorCellNodeKey=null;this.focusCellNodeKey=null;this.anchorCell=null;this.focusCell=null;this.hasHijackedSelectionStyles=false;this.trackTable();this.isSelecting=false}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach((e=>e()))}trackTable(){const e=new MutationObserver((e=>{this.editor.update((()=>{let t=false;for(let n=0;n<e.length;n++){const o=e[n];const r=o.target;const s=r.nodeName;if(s==="TABLE"||s==="TBODY"||s==="THEAD"||s==="TR"){t=true;break}}if(!t){return}const n=this.editor.getElementByKey(this.tableNodeKey);if(!n){throw new Error("Expected to find TableElement in DOM")}this.table=Vm(n)}))}));this.editor.update((()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t){throw new Error("Expected to find TableElement in DOM")}this.table=Vm(t);e.observe(t,{attributes:true,childList:true,subtree:true})}))}clearHighlight(){const e=this.editor;this.isHighlightingCells=false;this.anchorX=-1;this.anchorY=-1;this.focusX=-1;this.focusY=-1;this.tableSelection=null;this.anchorCellNodeKey=null;this.focusCellNodeKey=null;this.anchorCell=null;this.focusCell=null;this.hasHijackedSelectionStyles=false;this.enableHighlightStyle();e.update((()=>{const t=lc(this.tableNodeKey);if(!xN(t)){throw new Error("Expected TableNode.")}const n=e.getElementByKey(this.tableNodeKey);if(!n){throw new Error("Expected to find TableElement in DOM")}const o=Vm(n);qm(e,o,null);Lc(null);e.dispatchCommand(Ua,undefined)}))}enableHighlightStyle(){const e=this.editor;e.update((()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t){throw new Error("Expected to find TableElement in DOM")}qd(t,e._config.theme.tableSelection);t.classList.remove("disable-selection");this.hasHijackedSelectionStyles=false}))}disableHighlightStyle(){const e=this.editor;e.update((()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t){throw new Error("Expected to find TableElement in DOM")}Fd(t,e._config.theme.tableSelection);this.hasHijackedSelectionStyles=true}))}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e;this.isHighlightingCells=true;this.disableHighlightStyle();qm(t,this.table,this.tableSelection)}else if(e==null){this.clearHighlight()}else{this.tableNodeKey=e.tableKey;this.updateTableTableSelection(e)}}setFocusCellForSelection(e,t=false){const n=this.editor;n.update((()=>{const o=lc(this.tableNodeKey);if(!xN(o)){throw new Error("Expected TableNode.")}const r=n.getElementByKey(this.tableNodeKey);if(!r){throw new Error("Expected to find TableElement in DOM")}const s=e.x;const i=e.y;this.focusCell=e;if(this.anchorCell!==null){const e=Um(n._window);if(e){e.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}}if(!this.isHighlightingCells&&(this.anchorX!==s||this.anchorY!==i||t)){this.isHighlightingCells=true;this.disableHighlightStyle()}else if(s===this.focusX&&i===this.focusY){return}this.focusX=s;this.focusY=i;if(this.isHighlightingCells){const t=sc(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&cm(t)&&o.is(aN(t))){const e=t.getKey();this.tableSelection=this.tableSelection.clone()||Bm();this.focusCellNodeKey=e;this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey);Lc(this.tableSelection);n.dispatchCommand(Ua,undefined);qm(n,this.table,this.tableSelection)}}}))}setAnchorCellForSelection(e){this.isHighlightingCells=false;this.anchorCell=e;this.anchorX=e.x;this.anchorY=e.y;this.editor.update((()=>{const t=sc(e.elem);if(cm(t)){const e=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Bm();this.anchorCellNodeKey=e}}))}formatCells(e){this.editor.update((()=>{const t=fc();if(!Km(t)){{throw Error(`Expected grid selection`)}}const n=Ql();const o=n.anchor;const r=n.focus;t.getNodes().forEach((t=>{if(cm(t)&&t.getTextContentSize()!==0){o.set(t.getKey(),0,"element");r.set(t.getKey(),t.getChildrenSize(),"element");n.formatText(e)}}));Lc(t);this.editor.dispatchCommand(Ua,undefined)}))}clearText(){const e=this.editor;e.update((()=>{const t=lc(this.tableNodeKey);if(!xN(t)){throw new Error("Expected TableNode.")}const n=fc();if(!Km(n)){{throw Error(`Expected grid selection`)}}const o=n.getNodes().filter(cm);if(o.length===this.table.columns*this.table.rows){t.selectPrevious();t.remove();const e=uc();e.selectStart();return}o.forEach((e=>{if(Nc(e)){const t=Vl();const n=tc();t.append(n);e.append(t);e.getChildren().forEach((e=>{if(e!==t){e.remove()}}))}}));qm(e,this.table,null);Lc(null);e.dispatchCommand(Ua,undefined)}))}}const Hm="__lexicalTableSelection";const Um=e=>gm?(e||window).getSelection():null;const Ym=e=>(e.buttons&1)===1;function Jm(e,t,n,o){const r=n.getRootElement();if(r===null){throw new Error("No root element.")}const s=new zm(n,e.getKey());const i=n._window||window;jm(t,s);const l=()=>{const e=()=>{s.isSelecting=false;i.removeEventListener("mouseup",e);i.removeEventListener("mousemove",t)};const t=n=>{setTimeout((()=>{if(!Ym(n)&&s.isSelecting){s.isSelecting=false;i.removeEventListener("mouseup",e);i.removeEventListener("mousemove",t);return}const o=Xm(n.target);if(o!==null&&(s.anchorX!==o.x||s.anchorY!==o.y)){n.preventDefault();s.setFocusCellForSelection(o)}}),0)};return{onMouseMove:t,onMouseUp:e}};t.addEventListener("mousedown",(e=>{setTimeout((()=>{if(e.button!==0){return}if(!i){return}const t=Xm(e.target);if(t!==null){fN(e);s.setAnchorCellForSelection(t)}const{onMouseUp:n,onMouseMove:o}=l();s.isSelecting=true;i.addEventListener("mouseup",n);i.addEventListener("mousemove",o)}),0)}));const c=e=>{if(e.button!==0){return}n.update((()=>{const t=fc();const n=e.target;if(Km(t)&&t.tableKey===s.tableNodeKey&&r.contains(n)){s.clearHighlight()}}))};i.addEventListener("mousedown",c);s.listenersToRemove.add((()=>i.removeEventListener("mousedown",c)));s.listenersToRemove.add(n.registerCommand(Sa,(t=>uN(n,t,"down",e,s)),Jc));s.listenersToRemove.add(n.registerCommand(ba,(t=>uN(n,t,"up",e,s)),Jc));s.listenersToRemove.add(n.registerCommand(wa,(t=>uN(n,t,"backward",e,s)),Jc));s.listenersToRemove.add(n.registerCommand(xa,(t=>uN(n,t,"forward",e,s)),Jc));s.listenersToRemove.add(n.registerCommand(va,(e=>{const t=fc();if(Km(t)){const n=Nd(t.focus.getNode(),cm);if(cm(n)){fN(e);n.selectEnd();return true}}return false}),Jc));const a=t=>()=>{const n=fc();if(!oN(n,e)){return false}if(Km(n)){s.clearText();return true}else if(wc(n)){const o=Nd(n.anchor.getNode(),(e=>cm(e)));if(!cm(o)){return false}const r=n.anchor.getNode();const i=n.focus.getNode();const l=e.isParentOf(r);const c=e.isParentOf(i);const a=l&&!c||c&&!l;if(a){s.clearText();return true}const u=Nd(n.anchor.getNode(),(e=>Nc(e)));const f=u&&Nd(u,(e=>Nc(e)&&cm(e.getParent())));if(!Nc(f)||!Nc(u)){return false}if(t===Zc&&f.getPreviousSibling()===null){return true}}return false};[ea,Zc,Qc].forEach((e=>{s.listenersToRemove.add(n.registerCommand(e,a(e),Uc))}));const u=t=>{const n=fc();if(!oN(n,e)){const e=n?n.getNodes():null;if(e){const t=e.find((e=>xN(e)&&e.getKey()===s.tableNodeKey));if(xN(t)){const e=t.getParent();if(!e){return false}t.remove()}}return false}if(Km(n)){if(t){t.preventDefault();t.stopPropagation()}s.clearText();return true}else if(wc(n)){const e=Nd(n.anchor.getNode(),(e=>cm(e)));if(!cm(e)){return false}}return false};s.listenersToRemove.add(n.registerCommand(Oa,u,Uc));s.listenersToRemove.add(n.registerCommand(Ma,u,Uc));s.listenersToRemove.add(n.registerCommand(qc,(e=>{const t=fc();if(t){if(!(Km(t)||wc(t))){return false}void T_(n,Gd(e,ClipboardEvent)?e:null,__(t));const o=u(e);if(wc(t)){t.removeText()}return o}return false}),Uc));s.listenersToRemove.add(n.registerCommand(aa,(t=>{const n=fc();if(!oN(n,e)){return false}if(Km(n)){s.formatCells(t);return true}else if(wc(n)){const e=Nd(n.anchor.getNode(),(e=>cm(e)));if(!cm(e)){return false}}return false}),Uc));s.listenersToRemove.add(n.registerCommand(ca,(t=>{const n=fc();if(!Km(n)||!oN(n,e)){return false}const o=n.anchor.getNode();const r=n.focus.getNode();if(!cm(o)||!cm(r)){return false}const[s,i,l]=Im(e,o,r);const c=Math.max(i.startRow,l.startRow);const a=Math.max(i.startColumn,l.startColumn);const u=Math.min(i.startRow,l.startRow);const f=Math.min(i.startColumn,l.startColumn);for(let e=u;e<=c;e++){for(let n=f;n<=a;n++){const o=s[e][n].cell;o.setFormat(t);const r=o.getChildren();for(let e=0;e<r.length;e++){const n=r[e];if(Nc(n)&&!n.isInline()){n.setFormat(t)}}}}return true}),Uc));s.listenersToRemove.add(n.registerCommand(Xc,(t=>{const o=fc();if(!oN(o,e)){return false}if(Km(o)){s.clearHighlight();return false}else if(wc(o)){const r=Nd(o.anchor.getNode(),(e=>cm(e)));if(!cm(r)){return false}if(typeof t==="string"){const r=CN(n,o,e);if(r){yN(r,e,[tc(t)]);return true}}}return false}),Uc));if(o){s.listenersToRemove.add(n.registerCommand(Ia,(t=>{const n=fc();if(!wc(n)||!n.isCollapsed()||!oN(n,e)){return false}const o=cN(n.anchor.getNode());if(o===null){return false}fN(t);const r=e.getCordsFromCellNode(o,s.table);tN(s,e,r.x,r.y,!t.shiftKey?"forward":"backward");return true}),Uc))}s.listenersToRemove.add(n.registerCommand(la,(t=>e.isSelected()),Jc));function f(t){const n=e.getCordsFromCellNode(t,s.table);return e.getDOMCellFromCordsOrThrow(n.x,n.y,s.table)}s.listenersToRemove.add(n.registerCommand(Ya,(e=>{const{nodes:t,selection:n}=e;const o=n.getStartEndPoints();const r=Km(n);const s=wc(n);const i=s&&Nd(n.anchor.getNode(),(e=>cm(e)))!==null&&Nd(n.focus.getNode(),(e=>cm(e)))!==null||r;if(t.length!==1||!xN(t[0])||!i||o===null){return false}const[l]=o;const c=t[0];const a=c.getChildren();const u=c.getFirstChildOrThrow().getChildrenSize();const f=c.getChildrenSize();const d=Nd(l.getNode(),(e=>cm(e)));const h=d&&Nd(d,(e=>hm(e)));const g=h&&Nd(h,(e=>xN(e)));if(!cm(d)||!hm(h)||!xN(g)){return false}const _=h.getIndexWithinParent();const p=Math.min(g.getChildrenSize()-1,_+f-1);const m=d.getIndexWithinParent();const N=Math.min(h.getChildrenSize()-1,m+u-1);const y=Math.min(m,N);const C=Math.min(_,p);const T=Math.max(m,N);const E=Math.max(_,p);const S=g.getChildren();let w=0;for(let e=C;e<=E;e++){const t=S[e];if(!hm(t)){return false}const n=a[w];if(!hm(n)){return false}const o=t.getChildren();const r=n.getChildren();let s=0;for(let e=y;e<=T;e++){const t=o[e];if(!cm(t)){return false}const n=r[s];if(!cm(n)){return false}const i=t.getChildren();n.getChildren().forEach((e=>{if(Mc(e)){const n=Vl();n.append(e);t.append(e)}else{t.append(e)}}));i.forEach((e=>e.remove()));s++}w++}return true}),Uc));s.listenersToRemove.add(n.registerCommand(Ua,(()=>{const t=fc();const o=ac();if(wc(t)){const{anchor:o,focus:r}=t;const c=o.getNode();const a=r.getNode();const u=cN(c);const d=cN(a);const h=!!(u&&e.is(aN(u)));const g=!!(d&&e.is(aN(d)));const _=h!==g;const p=h&&g;const m=t.isBackward();if(_){const o=t.clone();if(g){const[t]=Im(e,d,d);const n=t[0][0].cell;const r=t[t.length-1].at(-1).cell;o.focus.set(m?n.getKey():r.getKey(),m?n.getChildrenSize():r.getChildrenSize(),"element")}Lc(o);Zm(n,s)}else if(p){if(!u.is(d)){s.setAnchorCellForSelection(f(u));s.setFocusCellForSelection(f(d),true);if(!s.isSelecting){setTimeout((()=>{const{onMouseUp:e,onMouseMove:t}=l();s.isSelecting=true;i.addEventListener("mouseup",e);i.addEventListener("mousemove",t)}),0)}}}}else if(t&&Km(t)&&t.is(o)&&t.tableKey===e.getKey()){const o=Um(n._window);if(o&&o.anchorNode&&o.focusNode){const r=sc(o.focusNode);const s=r&&!e.is(aN(r));const i=sc(o.anchorNode);const l=i&&e.is(aN(i));if(s&&l&&o.rangeCount>0){const r=Zl(o,n);if(r){r.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element");o.removeAllRanges();Lc(r)}}}}if(t&&!t.is(o)&&(Km(t)||Km(o))&&s.tableSelection&&!s.tableSelection.is(o)){if(Km(t)&&t.tableKey===s.tableNodeKey){s.updateTableTableSelection(t)}else if(!Km(t)&&Km(o)&&o.tableKey===s.tableNodeKey){s.updateTableTableSelection(null)}return false}if(s.hasHijackedSelectionStyles&&!e.isSelected()){eN(n,s)}else if(!s.hasHijackedSelectionStyles&&e.isSelected()){Zm(n,s)}return false}),Uc));s.listenersToRemove.add(n.registerCommand(da,(()=>{const t=fc();if(!wc(t)||!t.isCollapsed()||!oN(t,e)){return false}const o=CN(n,t,e);if(o){yN(o,e);return true}return false}),Uc));return s}function jm(e,t){e[Hm]=t}function Gm(e){return e[Hm]}function Xm(e){let t=e;while(t!=null){const e=t.nodeName;if(e==="TD"||e==="TH"){const e=t._cell;if(e===undefined){return null}return e}t=t.parentNode}return null}function Vm(e){const t=[];const n={columns:0,domRows:t,rows:0};let o=e.firstChild;let r=0;let s=0;t.length=0;while(o!=null){const e=o.nodeName;if(e==="TD"||e==="TH"){const e=o;const n={elem:e,hasBackgroundColor:e.style.backgroundColor!=="",highlighted:false,x:r,y:s};o._cell=n;let i=t[s];if(i===undefined){i=t[s]=[]}i[r]=n}else{const e=o.firstChild;if(e!=null){o=e;continue}}const n=o.nextSibling;if(n!=null){r++;o=n;continue}const i=o.parentNode;if(i!=null){const e=i.nextSibling;if(e==null){break}s++;r=0;o=e}}n.columns=r+1;n.rows=s+1;return n}function qm(e,t,n){const o=new Set(n?n.getNodes():[]);Qm(t,((t,n)=>{const r=t.elem;if(o.has(n)){t.highlighted=true;iN(e,t)}else{t.highlighted=false;lN(e,t);if(!r.getAttribute("style")){r.removeAttribute("style")}}}))}function Qm(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const o=n[e];if(!o){continue}for(let n=0;n<o.length;n++){const r=o[n];if(!r){continue}const s=sc(r.elem);if(s!==null){t(r,s,{x:n,y:e})}}}}function Zm(e,t){t.disableHighlightStyle();Qm(t.table,(t=>{t.highlighted=true;iN(e,t)}))}function eN(e,t){t.enableHighlightStyle();Qm(t.table,(t=>{const n=t.elem;t.highlighted=false;lN(e,t);if(!n.getAttribute("style")){n.removeAttribute("style")}}))}const tN=(e,t,n,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":if(n!==(s?e.table.columns-1:0)){rN(t.getCellNodeFromCordsOrThrow(n+(s?1:-1),o,e.table),s)}else{if(o!==(s?e.table.rows-1:0)){rN(t.getCellNodeFromCordsOrThrow(s?0:e.table.columns-1,o+(s?1:-1),e.table),s)}else if(!s){t.selectPrevious()}else{t.selectNext()}}return true;case"up":if(o!==0){rN(t.getCellNodeFromCordsOrThrow(n,o-1,e.table),false)}else{t.selectPrevious()}return true;case"down":if(o!==e.table.rows-1){rN(t.getCellNodeFromCordsOrThrow(n,o+1,e.table),true)}else{t.selectNext()}return true;default:return false}};const nN=(e,t,n,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":if(n!==(s?e.table.columns-1:0)){e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n+(s?1:-1),o,e.table))}return true;case"up":if(o!==0){e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o-1,e.table));return true}else{return false}case"down":if(o!==e.table.rows-1){e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o+1,e.table));return true}else{return false}default:return false}};function oN(e,t){if(wc(e)||Km(e)){const n=t.isParentOf(e.anchor.getNode());const o=t.isParentOf(e.focus.getNode());return n&&o}return false}function rN(e,t){if(t){e.selectStart()}else{e.selectEnd()}}const sN="172,206,247";function iN(e,t){const n=t.elem;const o=sc(n);if(!cm(o)){throw Error(`Expected to find LexicalNode from Table Cell DOMNode`)}const r=o.getBackgroundColor();if(r===null){n.style.setProperty("background-color",`rgb(${sN})`)}else{n.style.setProperty("background-image",`linear-gradient(to right, rgba(${sN},0.85), rgba(${sN},0.85))`)}n.style.setProperty("caret-color","transparent")}function lN(e,t){const n=t.elem;const o=sc(n);if(!cm(o)){throw Error(`Expected to find LexicalNode from Table Cell DOMNode`)}const r=o.getBackgroundColor();if(r===null){n.style.removeProperty("background-color")}n.style.removeProperty("background-image");n.style.removeProperty("caret-color")}function cN(e){const t=Nd(e,cm);return cm(t)?t:null}function aN(e){const t=Nd(e,xN);return xN(t)?t:null}function uN(e,t,n,o,r){if((n==="up"||n==="down")&&dN(e)){return false}const s=fc();if(!oN(s,o)){if(wc(s)){if(s.isCollapsed()&&n==="backward"){const e=s.anchor.type;const n=s.anchor.offset;if(e!=="element"&&!(e==="text"&&n===0)){return false}const o=s.anchor.getNode();if(!o){return false}const r=Nd(o,(e=>Nc(e)&&!e.isInline()));if(!r){return false}const i=r.getPreviousSibling();if(!i||!xN(i)){return false}fN(t);i.selectEnd();return true}else if(t.shiftKey&&(n==="up"||n==="down")){const e=s.focus.getNode();if(bc(e)){const e=s.getNodes()[0];if(e){const t=Nd(e,cm);if(t&&o.isParentOf(t)){const e=o.getFirstDescendant();const t=o.getLastDescendant();if(!e||!t){return false}const[n]=Pm(e);const[s]=Pm(t);const i=o.getCordsFromCellNode(n,r.table);const l=o.getCordsFromCellNode(s,r.table);const c=o.getDOMCellFromCordsOrThrow(i.x,i.y,r.table);const a=o.getDOMCellFromCordsOrThrow(l.x,l.y,r.table);r.setAnchorCellForSelection(c);r.setFocusCellForSelection(a,true);return true}}return false}else{const t=Nd(e,(e=>Nc(e)&&!e.isInline()));if(!t){return false}const o=n==="down"?t.getNextSibling():t.getPreviousSibling();if(xN(o)&&r.tableNodeKey===o.getKey()){const e=o.getFirstDescendant();const t=o.getLastDescendant();if(!e||!t){return false}const[r]=Pm(e);const[i]=Pm(t);const l=s.clone();l.focus.set((n==="up"?r:i).getKey(),n==="up"?0:i.getChildrenSize(),"element");Lc(l);return true}}}}return false}if(wc(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s;const c=Nd(i.getNode(),cm);const a=Nd(l.getNode(),cm);if(!cm(c)||!c.is(a)){return false}const u=aN(c);if(u!==o&&u!=null){const o=e.getElementByKey(u.getKey());if(o!=null){r.table=Vm(o);return uN(e,t,n,u,r)}}if(n==="backward"||n==="forward"){const e=i.type;const r=i.offset;const l=i.getNode();if(!l){return false}const c=s.getNodes();if(c.length===1&&mc(c[0])){return false}if(hN(e,r,l,n)){return pN(t,l,o,n)}return false}const f=e.getElementByKey(c.__key);const d=e.getElementByKey(i.key);if(d==null||f==null){return false}let h;if(i.type==="element"){h=d.getBoundingClientRect()}else{const e=window.getSelection();if(e===null||e.rangeCount===0){return false}const t=e.getRangeAt(0);h=t.getBoundingClientRect()}const g=n==="up"?c.getFirstChild():c.getLastChild();if(g==null){return false}const _=e.getElementByKey(g.__key);if(_==null){return false}const p=_.getBoundingClientRect();const m=n==="up"?p.top>h.top-h.height:h.bottom+h.height>p.bottom;if(m){fN(t);const e=o.getCordsFromCellNode(c,r.table);if(t.shiftKey){const t=o.getDOMCellFromCordsOrThrow(e.x,e.y,r.table);r.setAnchorCellForSelection(t);r.setFocusCellForSelection(t,true)}else{return tN(r,o,e.x,e.y,n)}return true}}else if(Km(s)){const{anchor:i,focus:l}=s;const c=Nd(i.getNode(),cm);const a=Nd(l.getNode(),cm);const[u]=s.getNodes();const f=e.getElementByKey(u.getKey());if(!cm(c)||!cm(a)||!xN(u)||f==null){return false}r.updateTableTableSelection(s);const d=Vm(f);const h=o.getCordsFromCellNode(c,d);const g=o.getDOMCellFromCordsOrThrow(h.x,h.y,d);r.setAnchorCellForSelection(g);fN(t);if(t.shiftKey){const e=o.getCordsFromCellNode(a,d);return nN(r,u,e.x,e.y,n)}else{a.selectEnd()}return true}return false}function fN(e){e.preventDefault();e.stopImmediatePropagation();e.stopPropagation()}function dN(e){const t=e.getRootElement();if(!t){return false}return t.hasAttribute("aria-controls")&&t.getAttribute("aria-controls")==="typeahead-menu"}function hN(e,t,n,o){return gN(e,n,o)||_N(e,t,n,o)}function gN(e,t,n){return e==="element"&&(n==="backward"?t.getPreviousSibling()===null:t.getNextSibling()===null)}function _N(e,t,n,o){const r=Nd(n,(e=>Nc(e)&&!e.isInline()));if(!r){return false}const s=o==="backward"?t===0:t===n.getTextContentSize();return e==="text"&&s&&(o==="backward"?r.getPreviousSibling()===null:r.getNextSibling()===null)}function pN(e,t,n,o){const r=Nd(t,cm);if(!cm(r)){return false}const[s,i]=Im(n,r,r);if(!mN(s,i,o)){return false}const l=NN(t,o,n);if(!l||xN(l)){return false}fN(e);if(o==="backward"){l.selectEnd()}else{l.selectStart()}return true}function mN(e,t,n){const o=e[0][0];const r=e[e.length-1][e[0].length-1];const{startColumn:s,startRow:i}=t;return n==="backward"?s===o.startColumn&&i===o.startRow:s===r.startColumn&&i===r.startRow}function NN(e,t,n){const o=Nd(e,(e=>Nc(e)&&!e.isInline()));if(!o){return undefined}const r=t==="backward"?o.getPreviousSibling():o.getNextSibling();return r&&xN(r)?r:t==="backward"?n.getPreviousSibling():n.getNextSibling()}function yN(e,t,n){const o=Vl();if(e==="first"){t.insertBefore(o)}else{t.insertAfter(o)}o.append(...n||[]);o.selectEnd()}function CN(e,t,n){const o=n.getParent();if(!o){return undefined}const r=e.getElementByKey(o.getKey());if(!r){return undefined}const s=window.getSelection();if(!s||s.anchorNode!==r){return undefined}const i=Nd(t.anchor.getNode(),(e=>cm(e)));if(!i){return undefined}const l=Nd(i,(e=>xN(e)));if(!xN(l)||!l.is(n)){return undefined}const[c,a]=Im(n,i,i);const u=c[0][0];const f=c[c.length-1][c[0].length-1];const{startRow:d,startColumn:h}=a;const g=d===u.startRow&&h===u.startColumn;const _=d===f.startRow&&h===f.startColumn;if(g){return"first"}else if(_){return"last"}else{return undefined}}class TN extends ia{static getType(){return"table"}static clone(e){return new TN(e.__key)}static importDOM(){return{table:e=>({conversion:SN,priority:1})}}static importJSON(e){return wN()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const n=document.createElement("table");Fd(n,e.theme.table);return n}updateDOM(){return false}exportDOM(e){return{...super.exportDOM(e),after:e=>{if(e){const t=e.cloneNode();const n=document.createElement("colgroup");const o=document.createElement("tbody");if(zd(e)){o.append(...e.children)}const r=this.getFirstChildOrThrow();if(!hm(r)){throw new Error("Expected to find row node.")}const s=r.getChildrenSize();for(let e=0;e<s;e++){const e=document.createElement("col");n.append(e)}t.replaceChildren(n,o);return t}}}}canBeEmpty(){return false}isShadowRoot(){return true}getCordsFromCellNode(e,t){const{rows:n,domRows:o}=t;for(let t=0;t<n;t++){const n=o[t];if(n==null){continue}const r=n.findIndex((t=>{if(!t){return}const{elem:n}=t;const o=sc(n);return o===e}));if(r!==-1){return{x:r,y:t}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:o}=n;const r=o[t];if(r==null){return null}const s=e<r.length?e:r.length-1;const i=r[s];if(i==null){return null}return i}getDOMCellFromCordsOrThrow(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(!o){throw new Error("Cell not found at cords.")}return o}getCellNodeFromCords(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(o==null){return null}const r=sc(o.elem);if(cm(r)){return r}return null}getCellNodeFromCordsOrThrow(e,t,n){const o=this.getCellNodeFromCords(e,t,n);if(!o){throw new Error("Node at cords not TableCellNode.")}return o}canSelectBefore(){return true}canIndent(){return false}}function EN(e,t){const n=e.getElementByKey(t.getKey());if(n==null){throw new Error("Table Element Not Found")}return Vm(n)}function SN(e){return{node:wN()}}function wN(){return Yl(new TN)}function xN(e){return e instanceof TN}var bN=Object.freeze({$computeTableMap:Im,$computeTableMapSkipCellCheck:Lm,$createTableCellNode:lm,$createTableNode:wN,$createTableNodeWithDimensions:_m,$createTableRowNode:dm,$createTableSelection:Bm,$deleteTableColumn:Mm,$deleteTableColumn__EXPERIMENTAL:Dm,$deleteTableRow__EXPERIMENTAL:Am,$findCellNode:cN,$findTableNode:aN,$getElementForTableNode:EN,$getNodeTriplet:Pm,$getTableCellNodeFromLexicalNode:pm,$getTableCellNodeRect:$m,$getTableColumnIndexFromTableCellNode:Cm,$getTableNodeFromLexicalNodeOrThrow:Nm,$getTableRowIndexFromTableCellNode:ym,$getTableRowNodeFromTableCellNodeOrThrow:mm,$insertTableColumn:bm,$insertTableColumn__EXPERIMENTAL:Om,$insertTableRow:Sm,$insertTableRow__EXPERIMENTAL:xm,$isTableCellNode:cm,$isTableNode:xN,$isTableRowNode:hm,$isTableSelection:Km,$removeTableRowAtIndex:Em,$unmergeCell:km,INSERT_TABLE_COMMAND:am,TableCellHeaderStates:rm,TableCellNode:sm,TableNode:TN,TableObserver:zm,TableRowNode:um,applyTableHandlers:Jm,getDOMCellFromTarget:Xm,getTableObserverFromTableElement:Gm});const ON=qa("INSERT_TABLE_COMMAND");function MN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AN=MN((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const DN="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;const vN=bN;const RN=vN.$computeTableMap;const kN=vN.$computeTableMapSkipCellCheck;const IN=vN.$createTableCellNode;const LN=vN.$createTableNode;const PN=vN.$createTableNodeWithDimensions;const $N=vN.$createTableRowNode;const FN=vN.$createTableSelection;const KN=vN.$deleteTableColumn;const BN=vN.$deleteTableColumn__EXPERIMENTAL;const WN=vN.$deleteTableRow__EXPERIMENTAL;const zN=vN.$findCellNode;const HN=vN.$findTableNode;const UN=vN.$getElementForTableNode;const YN=vN.$getNodeTriplet;const JN=vN.$getTableCellNodeFromLexicalNode;const jN=vN.$getTableCellNodeRect;const GN=vN.$getTableColumnIndexFromTableCellNode;const XN=vN.$getTableNodeFromLexicalNodeOrThrow;const VN=vN.$getTableRowIndexFromTableCellNode;const qN=vN.$getTableRowNodeFromTableCellNodeOrThrow;const QN=vN.$insertTableColumn;const ZN=vN.$insertTableColumn__EXPERIMENTAL;const ey=vN.$insertTableRow;const ty=vN.$insertTableRow__EXPERIMENTAL;const ny=vN.$isTableCellNode;const oy=vN.$isTableNode;const ry=vN.$isTableRowNode;const sy=vN.$isTableSelection;const iy=vN.$removeTableRowAtIndex;const ly=vN.$unmergeCell;const cy=vN.INSERT_TABLE_COMMAND;const ay=vN.TableCellHeaderStates;const uy=vN.TableCellNode;const fy=vN.TableNode;const dy=vN.TableObserver;const hy=vN.TableRowNode;const gy=vN.applyTableHandlers;const _y=vN.getDOMCellFromTarget;const py=vN.getTableObserverFromTableElement;var my=Object.freeze({$computeTableMap:RN,$computeTableMapSkipCellCheck:kN,$createTableCellNode:IN,$createTableNode:LN,$createTableNodeWithDimensions:PN,$createTableRowNode:$N,$createTableSelection:FN,$deleteTableColumn:KN,$deleteTableColumn__EXPERIMENTAL:BN,$deleteTableRow__EXPERIMENTAL:WN,$findCellNode:zN,$findTableNode:HN,$getElementForTableNode:UN,$getNodeTriplet:YN,$getTableCellNodeFromLexicalNode:JN,$getTableCellNodeRect:jN,$getTableColumnIndexFromTableCellNode:GN,$getTableNodeFromLexicalNodeOrThrow:XN,$getTableRowIndexFromTableCellNode:VN,$getTableRowNodeFromTableCellNodeOrThrow:qN,$insertTableColumn:QN,$insertTableColumn__EXPERIMENTAL:ZN,$insertTableRow:ey,$insertTableRow__EXPERIMENTAL:ty,$isTableCellNode:ny,$isTableNode:oy,$isTableRowNode:ry,$isTableSelection:sy,$removeTableRowAtIndex:iy,$unmergeCell:ly,INSERT_TABLE_COMMAND:cy,TableCellHeaderStates:ay,TableCellNode:uy,TableNode:fy,TableObserver:dy,TableRowNode:hy,applyTableHandlers:gy,getDOMCellFromTarget:_y,getTableObserverFromTableElement:py});e.Core=uu;e.Html=dh;e.List=Ng;e.Link=Hg;e.Clipboard=S_;e.Selection=af;e.History=Y_;e.Utils=Qd;e.Text=up;e.RichText=tm;e.Table=my})(this.BX.UI.Lexical=this.BX.UI.Lexical||{});
//# sourceMappingURL=lexical.dev.bundle.map.js

Youez - 2016 - github.com/yon3zu
LinuXploit