@remit/web-client-dist 0.0.290 → 0.0.291

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/assets/ComposeBody-DaCf9LLf.js +25 -0
  2. package/assets/{ConfirmDialog-DqB3Rbjm.js → ConfirmDialog-B6-FfLVH.js} +1 -1
  3. package/assets/{ErrorState-CX_D6Xql.js → ErrorState-utteSi16.js} +1 -1
  4. package/assets/{OnboardingWizard-Bk9gVnlk.js → OnboardingWizard-NroKo96d.js} +1 -1
  5. package/assets/{account-form-helpers-DBL_ZqQY.js → account-form-helpers-DdpEcSjA.js} +1 -1
  6. package/assets/{accounts-BVyS9-Y5.js → accounts-5tD5o_MC.js} +1 -1
  7. package/assets/{advanced-JD-Hc-Ef.js → advanced-6hgL18d0.js} +1 -1
  8. package/assets/{appearance-cO9emIfw.js → appearance-DaGgLSlq.js} +1 -1
  9. package/assets/{avatar-eLMokW-q.js → avatar-DpPgnEGf.js} +1 -1
  10. package/assets/{browser-ponyfill-Cq6pSZNB.js → browser-ponyfill-gqTNvcHO.js} +1 -1
  11. package/assets/{circle-check-Cn8kes8N.js → circle-check-nxAIm1AP.js} +1 -1
  12. package/assets/{download-CC_qU92e.js → download-CeXHmzmZ.js} +1 -1
  13. package/assets/{filters-B1UUp_1K.js → filters-QdxlFx_C.js} +1 -1
  14. package/assets/{flagged-WlDzs2j0.js → flagged-CspB_FKf.js} +1 -1
  15. package/assets/{folders-NN-6aajk.js → folders-DRHzhYTo.js} +1 -1
  16. package/assets/{index-DaW7byR_.js → index-BByLRtAL.js} +53 -53
  17. package/assets/index-D-Q6AkNW.js +1 -0
  18. package/assets/{index-DidEu5F1.css → index-DKrlREWN.css} +1 -1
  19. package/assets/{index-_7RPHQOi.js → index-gJHnJuPV.js} +1 -1
  20. package/assets/{kbd-DKierQwd.js → kbd-FXchXcdL.js} +1 -1
  21. package/assets/{labels-DeOQsZYk.js → labels-Xmg7R1Qt.js} +1 -1
  22. package/assets/mail-BTLrLOwu.js +118 -0
  23. package/assets/{move-options-LKmxTRE3.js → move-options-CB-_Smlt.js} +1 -1
  24. package/assets/{onboarding-DG8_xgny.js → onboarding-B-tIkrgT.js} +1 -1
  25. package/assets/{pencil-Cgqu0Tfw.js → pencil-B9rEX7cn.js} +1 -1
  26. package/assets/{senders-BeqSgU0W.js → senders-D1VrDKFy.js} +1 -1
  27. package/assets/settings-CoPUDMV9.js +1 -0
  28. package/assets/{settings-screen-BoWzuTqz.js → settings-screen-BKlK_0yG.js} +1 -1
  29. package/assets/{shield-check-BD14rqWn.js → shield-check-BKoajq2L.js} +1 -1
  30. package/assets/{suggested-vips-BDsrmYVZ.js → suggested-vips-BP5G77uV.js} +1 -1
  31. package/assets/{useDebouncedValue-BO7FerED.js → useDebouncedValue-CI6kcpUy.js} +1 -1
  32. package/assets/{useFilters-D6ZmBc0K.js → useFilters-yQMkml1t.js} +1 -1
  33. package/assets/{useLabels-DfcDpqEu.js → useLabels-Bxb9JZKq.js} +1 -1
  34. package/assets/{useSignature-Bqj-YqCC.js → useSignature-B4GrDAQe.js} +1 -1
  35. package/index.html +2 -2
  36. package/package.json +1 -1
  37. package/assets/ComposeBody-D9vG71zt.js +0 -26
  38. package/assets/index-C4k2Z7XH.js +0 -1
  39. package/assets/mail-QnOovAPJ.js +0 -118
  40. package/assets/settings-paTToAbQ.js +0 -1
@@ -0,0 +1,25 @@
1
+ import{a as vo,r as L,j as H,a0 as Dc}from"./index-BByLRtAL.js";import{s as Zu,U as sg}from"./mail-BTLrLOwu.js";import"./pencil-B9rEX7cn.js";import"./avatar-DpPgnEGf.js";import"./kbd-FXchXcdL.js";import"./shield-check-BKoajq2L.js";import"./account-form-helpers-DdpEcSjA.js";import"./useSignature-B4GrDAQe.js";import"./useDebouncedValue-CI6kcpUy.js";import"./useFilters-yQMkml1t.js";import"./ErrorState-utteSi16.js";import"./format-CKZmh-Ru.js";import"./move-options-CB-_Smlt.js";import"./useLabels-Bxb9JZKq.js";import"./ConfirmDialog-B6-FfLVH.js";import"./circle-check-nxAIm1AP.js";const lg=vo("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const cg=vo("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const ag=vo("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const ug=vo("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const fg=vo("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),tf=L.createContext(null);function dg(n,t){return{getTheme:function(){return t??null}}}function oe(){const n=L.useContext(tf);return n==null&&(function(t,...e){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const i of e)o.append("v",i);throw r.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),n}function $(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ef(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);e.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Vt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hg=Vt&&"documentMode"in document?document.documentMode:null,Ne=Vt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Oe=Vt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xr=!(!Vt||!("InputEvent"in window)||hg)&&"getTargetRanges"in new window.InputEvent("input"),mn=Vt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nf=Vt&&/Android/.test(navigator.userAgent),No=Vt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!nf,rf=Vt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ci=Vt&&nf&&rf,To=Vt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ne&&!rf,gg=0,pg=1,mg=2,zs=1,Bs=2,Ws=4,Us=8,_g=16,ps=32,ms=64,Rl=128,yg=1,xg=2,Cg=3,Sg=4,bg=5,vg=6,so=No||mn||To?" ":"​",En=`
2
+
3
+ `,Ll=Oe?" ":so,nn={bold:1,capitalize:1024,code:16,highlight:Rl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ng={directionless:1,unmergeable:2},ai={center:2,end:6,justify:4,left:1,right:3,start:5},Tg={[xg]:"center",[vg]:"end",[Sg]:"justify",[yg]:"left",[Cg]:"right",[bg]:"start"},kg={normal:0,segmented:2,token:1},wg={[gg]:"normal",[mg]:"segmented",[pg]:"token"},Pc="$config";function Rc(){return St()._blockCursorElement}function Eg(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let of=class Xo{element;before;after;constructor(t,e,r){this.element=t,this.before=e||null,this.after=r||null}withBefore(t){return new Xo(this.element,t,this.after)}withAfter(t){return new Xo(this.element,this.before,t)}withElement(t){return this.element===t?this:new Xo(t,this.before,this.after)}insertChild(t){const e=this.getInsertionAnchor();return e!==null&&e.parentElement!==this.element&&$(357),this.element.insertBefore(t,e),this}removeChild(t){return t.parentElement!==this.element&&$(358),this.element.removeChild(t),this}replaceChild(t,e){return e.parentElement!==this.element&&$(359),this.element.replaceChild(t,e),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,r){if(this.element===t)return e===t&&r===0?"before":"after";const o=Lc(t,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(t.childNodes,o);if(i<0)return"after";if(e===t)return r<=i?"before":"after";const s=Lc(t,e);if(s===null)return"after";const l=Array.prototype.indexOf.call(t.childNodes,s);return l>=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Lc(n,t){let e=t;for(;e!==null&&e.parentNode!==n;)e=e.parentNode;return e}let sf=class Go extends of{withBefore(t){return new Go(this.element,t,this.after)}withAfter(t){return new Go(this.element,this.before,t)}withElement(t){return this.element===t?this:new Go(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;for(;Eg(e);)t=e,e=e.nextSibling;const r=t?t.nextSibling:this.element.firstChild;return r!==null&&r===Rc()?r:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,t===null)this.removeManagedLineBreak();else{const e=t==="decorator"&&(To||mn||No);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,r=t.nodeName==="IMG"?t.nextSibling:null;r&&e.removeChild(r),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===(e.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=Z().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),t){const s=Z().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==t&&o!==e;o=o.nextSibling)r++;return r}resolveChildIndex(t,e,r,o){if(r===this.element){const c=this.getFirstChildOffset(),a=Rc(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let h=c;h<f;h++)u[h]!==a&&d++;return[t,Math.min(d,t.getChildrenSize())]}const i=Ic(e,r);i.push(o);const s=Ic(e,this.element);let l=t.getIndexWithinParent();for(let c=0;c<s.length;c++){const a=i[c],u=s[c];if(a===void 0||a<u)break;if(a>u){l+=1;break}}return[t.getParentOrThrow(),l]}};function Ic(n,t){const e=[];let r=t;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;e.push(o)}return r!==n&&$(225),e.reverse()}let lf;try{lf="0.49.0+prod.esm"}catch{}const cf=lf??'"<unknown>+source"';let Ur=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const Nn=null;function af(n,t=1e3){return n instanceof js?n.clone():n.size<t?new Map(n):new js().init(new Map(n),void 0,n.size)}let js=class uf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new uf().init(this._old,this._nursery,this._size)}init(t,e,r){return this._old=t,this._nursery=e,this._size=r,this}get size(){return this._size}has(t){return this.get(t)!==void 0}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return e!==void 0?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===Nn?void 0:e}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const e=new Map(this._old);for(const[r,o]of this._nursery)o!==Nn?e.set(r,o):e.delete(r);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const r=this.getWithTombstone(t);if(r===e)return this;const o=this.getNursery();return r!==Nn&&r!==void 0||(this._size++,r===Nn&&o.delete(t)),o.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,Nn),this._size--),e}getOrInsert(t,e){const r=this.get(t);return r!==void 0?r:(this.set(t,e),e)}getOrInsertComputed(t,e){const r=this.get(t);if(r!==void 0)return r;const o=e(t);return this.set(t,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(e)for(const r of e){const o=r[0],i=t?t.get(o):void 0;i!==Nn&&(i!==void 0&&(r[1]=i),yield r)}if(t)for(const r of t)r[1]===Nn||e&&e.has(r[0])||(yield r)}forEach(t,e){e!==void 0&&(t=t.bind(e));for(const[r,o]of this.entries())t(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function ui(n,t,e,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===t&&((C(s)||tn(s)&&s.__slots!==null)&&ui(s,l,e,r,o,i),e.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of tn(n)&&n.__slots!==null?n.__slots.values():[]){const l=r.get(s);l!==void 0&&Ln(l)&&l.__slotHost===t&&((C(l)||tn(l)&&l.__slots!==null)&&ui(l,s,e,r,o,i),e.has(s)||i.delete(s),o.push(s))}}let Hs=!1,Il=0;function $g(n){Il=n.timeStamp}function _s(n,t,e){const r=n.nodeName==="BR",o=t.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Ir(n,e)!==void 0}function Og(n,t,e){const r=Dt(se(e)),o=r&&re(r,e._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const l=n.nodeValue;l!==null&&sc(t,l,i,s,!1)}function Ag(n,t,e){if(w(n)){const r=n.anchor.getNode();if(r.is(e)&&n.format!==r.getFormat())return!1}return ie(t)&&e.isAttached()}function Mg(n,t,e){for(let r=n;r&&!Ld(r);r=jn(r)){const o=Ir(r,t);if(o!==void 0){const i=tt(o,e);if(i)return G(i)||!B(r)?void 0:[r,i]}}}function ff(n,t,e){Hs=!0;const r=performance.now()-Il>100;try{me(n,()=>{const o=A()||(function(f){return f.read("latest",()=>{const d=A();return d!==null?d.clone():null})})(n),i=new Map,s=n._editorState,l=n._blockCursorElement;let c=!1,a="";for(let f=0;f<t.length;f++){const d=t[f],h=d.type,g=d.target,_=Mg(g,n,s);if(!_)continue;const[p,m]=_;if(h==="characterData")r&&O(m)&&ie(g)&&Ag(o,g,m)&&Og(g,m,n);else if(h==="childList"){c=!0;const y=d.addedNodes;for(let T=0;T<y.length;T++){const v=y[T],N=bd(v),S=v.parentNode;if(!(S==null||v===l||N!==null||_s(v,S,n)||n._slotsUsed&&B(v)&&v.hasAttribute("data-lexical-slot")||Ld(v))){if(Oe){const k=(B(v)?v.innerText:null)||v.nodeValue;k&&(a+=k)}S.removeChild(v)}}const x=d.removedNodes,b=x.length;if(b>0){let T=0;for(let v=0;v<b;v++){const N=x[v];(_s(N,g,n)||l===N)&&(g.appendChild(N),T++)}b!==T&&i.set(p,m)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,n);const u=e.takeRecords();if(u.length>0){for(let f=0;f<u.length;f++){const d=u[f],h=d.addedNodes,g=d.target;for(let _=0;_<h.length;_++){const p=h[_],m=p.parentNode;m==null||p.nodeName!=="BR"||_s(p,g,n)||m.removeChild(p)}}e.takeRecords()}o!==null&&(c&&gt(o),Oe&&Ed(n)&&o.insertRawText(a))})}finally{Hs=!1}}function df(n){const t=n._observer;t!==null&&ff(n,t.takeRecords(),t)}function hf(n){(function(t){Il===0&&se(t).addEventListener("textInput",$g,!0)})(n),n._observer=new MutationObserver((t,e)=>{ff(n,t,e)})}const Kc="latest";let Fg=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||Rg).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}};function ko(n,t){return new Fg(n,t)}function wo(n,t,e=Kc){const r=(e===Kc?n.getLatest():n).__state;return r?r.getValue(t):t.defaultValue}function ar(n,t,e){let r;if(Pt(),typeof e=="function"){const i=n.getLatest(),s=wo(i,t);if(r=e(s),t.isEqual(s,r))return i}else r=e;const o=n.getWritable();return pf(o).updateFromKnown(t,r),o}function Dg(n){const t=new Map,e=new Set;for(const{ownNodeConfig:r}of dc(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&e.add(i.key)):i=o,t.set(i.key,i)}return{flatKeys:e,sharedConfigMap:t}}const zc=new Set(["__proto__","constructor","prototype"]);let Pg=class gf{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,r=void 0,o=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:(function(c,a,u){let f=u.size;if(a)for(const d in a){const h=c.get(d);h&&u.has(h)||f++}return f})(s,r,o);this.size=l}getValue(t){const e=this.knownState.get(t);if(e!==void 0)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let r=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const o=this.unknownState[t.key];o!==void 0&&(r=t.parse(o)),this.updateFromKnown(t,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete t[r.key]:t[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in t&&(e[r]=t[r],delete t[r]);return Bc(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:r}=this,o=new Map(this.knownState);return new gf(t,e,(function(i,s,l){let c;if(l)for(const[a,u]of Object.entries(l)){if(zc.has(a))continue;const f=i.get(a);f?s.has(f)||s.set(f,f.parse(u)):(c=c||{},c[a]=u)}return c})(e.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const r=t.key;this.sharedNodeState.sharedConfigMap.set(r,t);const{knownState:o,unknownState:i}=this;o.has(t)||i&&r in i||(i&&(delete i[r],this.unknownState=Bc(i)),this.size++),o.set(t,e)}updateFromUnknown(t,e){if(zc.has(t))return;const r=this.sharedNodeState.sharedConfigMap.get(t);r?this.updateFromKnown(r,r.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const r of e.keys())e.set(r,r.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[r,o]of Object.entries(t))this.updateFromUnknown(r,o)}};function pf(n){const t=n.getWritable(),e=t.__state?t.__state.getWritable(t):new Pg(t,mf(t));return t.__state=e,e}function mf(n){return n.__state?n.__state.sharedNodeState:xd(St(),n.getType()).sharedNodeState}function Bc(n){if(n)for(const t in n)return n}function Rg(n){return n}function Wc(n,t,e){for(const[r,o]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const i=e?e.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function Uc(n,t,e){const{unknownState:r}=t,o=e?e.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function jc(n,t){const e=n.__state;return e&&e.node===n?e.getWritable(t):e}function Hc(n,t){const e=n.__mode,r=n.__format,o=n.__style,i=t.__mode,s=t.__format,l=t.__style,c=n.__state,a=t.__state;return(e===null||e===i)&&(r===null||r===s)&&(o===null||o===l)&&(n.__state===null||c===a||(function(u,f){if(u===f)return!0;const d=new Set;return!(u&&Wc(d,u,f)||f&&Wc(d,f,u)||u&&Uc(d,u,f)||f&&Uc(d,f,u))})(c,a))}function Jc(n,t){const e=n.mergeWithSibling(t),r=ft()._normalizedNodes;return r.add(n.__key),r.add(t.__key),e}function qc(n){let t,e,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&O(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Hc(t,r)){r=Jc(t,r);break}break}t.remove()}for(;(e=r.getNextSibling())!==null&&O(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Hc(r,e)){r=Jc(r,e);break}break}e.remove()}}else r.remove()}function De(n){return Vc(n.anchor),Vc(n.focus),n}function Vc(n){for(;n.type==="element";){const t=n.getNode(),e=n.offset;let r,o;if(e===t.getChildrenSize()?(r=t.getChildAtIndex(e-1),o=!0):(r=t.getChildAtIndex(e),o=!1),O(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const lo=Symbol.for("@lexical/CachedTextSize");function Yc(n,t){return qs.read(()=>{let e=0,r=n;for(let o=0;o<t&&r!==null;o++){const i=Te.get(r);if(i===void 0&&$(345,r),C(i)){const s=Nt.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)e+=i.getTextContentSize();else{const l=Mn.get(r),c=l&&l.__lexicalTextContent;typeof c!="string"&&$(346,i.getType()),e+=c.length}o<t-1&&!i.isInline()&&(e+=2)}else{const s=i[lo];s===void 0&&$(347,i.getType(),r),e+=s}r=i.__next}return e},{editor:lt})}function _f(n){C(n)||n[lo]===void 0&&(n[lo]=O(n)?n.__text.length:n.getTextContentSize())}const Lg=4;let co,lt,ao,Q="",Tt=null,jt=null,Kt=null;function Pe(){return{firstTextKey:Kt,format:Tt,style:jt}}function de(n){n.firstTextKey!==null&&(Tt=n.format,jt=n.style,Kt=n.firstTextKey)}function Js(n){if(Kt!==null)return;const t=n.__lexicalFirstTextKey;if(t===void 0&&$(348),t===null)return;const e=Nt.get(t);O(e)&&(Tt=e.getFormat(),jt=e.getStyle(),Kt=t)}let Bi,to,eo,Te,qs,Nt,Mn,Vs,uo,Fn,Ge=!1,fi=!1;function fn(n,t){const e=Te.get(n),r=Nt.has(n);if(t!==null){const o=Zs(n);o.parentNode===t&&t.removeChild(o)}if(!r){if(lt._keyToDOMMap.delete(n),C(e)){const o=Oi(e,Te);Ys(o,0,o.length-1,null)}if(e!==void 0){for(const o of le(e).values()){const i=Gs(o);fn(o,null),i!==null&&i.remove()}lc(uo,ao,Bi,e,"destroyed")}}}function Ys(n,t,e,r){for(let o=t;o<=e;++o){const i=n[o];i!==void 0&&fn(i,r)}}function Tn(n,t){n.setProperty("text-align",t)}const Ig="40px";function yf(n,t){const e=co.theme.indent;if(typeof e=="string"){const r=n.classList.contains(e);t>0&&!r?n.classList.add(e):t<1&&r&&n.classList.remove(e)}n.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * var(--lexical-indent-base-value, ${Ig}))`)}function xf(n,t){const e=n.style;t===0?Tn(e,""):t===1?Tn(e,"left"):t===2?Tn(e,"center"):t===3?Tn(e,"right"):t===4?Tn(e,"justify"):t===5?Tn(e,"start"):t===6&&Tn(e,"end")}function Xs(n,t){const e=(function(r){const o=r.__dir;if(o!==null)return o;if(Et(r))return null;const i=r.getParent();return i===null||xt(i)&&i.__dir===null?"auto":null})(t);e!==null?n.dir=e:n.removeAttribute("dir")}function Cf(n){const t=Z().createElement("div");return t.setAttribute("data-lexical-slot",n),t.style.display="none",t}function Sf(n,t,e){t||n.contentEditable==="false"?Vp(e,lt):e.removeAttribute("contenteditable")}function Xc(n,t,e){const r=Q,o=Pe();Q="";let i="";const s=G(n);for(const[l,c]of e){const a=Cf(l);Sf(t,s,a),t.appendChild(a),Q="";const u=Pe();dn(c,Se(n,a,lt)),de(u),bf(n,l,t,a),i+=Q}return de(o),Q=r,i}function le(n){return tn(n)&&n.__slots!==null?n.__slots:zd}function bf(n,t,e,r){const o=Fn.$getSlotTargetElement(n,t,e,lt);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function Gs(n){const t=Mn.get(n);return t!==void 0?t.parentElement:null}function Gc(n,t,e){const r=le(n),o=le(t);for(const[u,f]of r)if(!o.has(u)){const d=Gs(f);fn(f,null),d!==null&&d.remove()}const i=Q,s=Pe();let l="",c=null;const a=G(t);for(const[u,f]of o){const d=r.get(u);let h=d!==void 0?Gs(d):null;Q="";const g=Pe();if(h===null){h=Cf(u);let _=null;for(const p of e.children)if(!p.hasAttribute("data-lexical-slot")){_=p;break}e.insertBefore(h,_),dn(f,Se(t,h,lt))}else d===f?Xe(f,h):(d!==void 0&&fn(d,h),dn(f,Se(t,h,lt)));if(de(g),Sf(e,a,h),bf(t,u,e,h),l+=Q,h.parentElement===e){const _=c===null?e.firstChild:c.nextSibling;_!==h&&e.insertBefore(h,_),c=h}}return de(s),Q=i,l}function dn(n,t){const e=Nt.get(n);if(e===void 0&&$(60),t!==null){const o=Te.get(n);if(o!==void 0){const i=Mn.get(n);if(i!==void 0){const s=Ln(o)?o.__slotHost:null,l=Ln(e)?e.__slotHost:null,c=o.__parent!==e.__parent||s!==l,a=l!==null&&i.parentElement!==t.element;if(c||a)return t.insertChild(i),Xe(n,t.element)}}}const r=Fn.$createDOM(e,lt);if((function(o,i,s){const l=s._keyToDOMMap;vd(i,s,o),l.set(o,i)})(n,r,lt),O(e)?r.setAttribute("data-lexical-text","true"):G(e)&&(r.setAttribute("data-lexical-decorator","true"),Ei(r,{captureSelection:!0})),C(e)){const o=e.__indent,i=e.__size;Xs(r,e),o!==0&&yf(r,o);const s=le(e),l=s.size>0?Xc(e,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,Q+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const a=Q,u=i-1;if(Qs(Oi(e,Nt),e,0,u,Se(e,r,lt)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,Q=a+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const c=e.__format;c!==0&&xf(r,c),e.isInline()||vf(null,e,r)}else{const o=e.getTextContent();if(G(e)){const i=e.decorate(lt,co);i!==null&&Nf(n,i),r.contentEditable="false";const s=le(e);s.size>0&&Xc(e,r,s)}Q+=o}return t!==null&&t.insertChild(r),Fn.$decorateDOM(e,null,r,lt),_f(e),lc(uo,ao,Bi,e,"created"),r}function Qs(n,t,e,r,o){const i=Q,s=Pe();Q="",Tt=null,jt=null,Kt=null;let l=e;for(;l<=r;++l){const a=Pe();dn(n[l],o);const u=Nt.get(n[l]);u!==null&&O(u)?Tt===null&&(Tt=u.getFormat(),jt=u.getStyle(),Kt=u.__key):C(u)&&l<r&&!u.isInline()&&(Q+=En),de(a)}const c=lt._keyToDOMMap.get(t.__key);c===void 0&&$(349,t.__key),c.__lexicalTextContent=Q,c.__lexicalFirstTextKey=Kt,Q=i+Q,de(s)}function vf(n,t,e){const r=Se(t,e,lt),o=r.element.__lexicalLastChildKind??null,i=(function(s,l){if(s){const c=s.__last;if(c){const a=l.get(c);if(a)return It(a)?"line-break":G(a)&&a.isInline()?"decorator":null}return le(s).size>0?null:"empty"}return null})(t,Nt);o!==i&&r.setManagedLineBreak(i)}function Kg(n,t,e){var r;Tt=null,jt=null,Kt=null,(function(o,i,s){const l=Q,c=o.__size,a=i.__size;Q="";const u=s.element,f=lt._keyToDOMMap.get(i.__key);f===void 0&&$(351,i.__key);const d=a-c;if(!Ge&&Math.abs(d)<=1&&c>=Lg&&o.__first===i.__first&&(d!==0||!lt._cloneNotNeeded.has(o.__key))){const h=f.__lexicalTextContent,g=Vs.get(o.__key);if(!Ge&&typeof h=="string"&&g!==void 0){const _=(function(p,m){const y=m.size;if(y===0||y>=p.__size)return null;let x=p.__last,b=null,T=0;for(;x!==null&&T<y;){if(!m.has(x))return null;b=x;const v=Nt.get(x);if(v===void 0)return null;x=v.__prev,T++}return T!==y||x!==null&&m.has(x)?null:b})(i,g);if(_!==null){const p=g.size;if(d===0){const m=Yc(_,p);let y=_,x=0;for(;y!==null&&x<p;){const S=Nt.get(y);if(S===void 0)break;const k=Pe();Xe(y,u),O(S)&&Tt===null&&(Tt=S.getFormat(),jt=S.getStyle(),Kt=S.__key),de(k),y=S.__next,x++}let b="";for(y=_,x=0;y!==null&&x<p;){const S=Nt.get(y);if(S===void 0)break;let k;if(C(S)){const M=lt._keyToDOMMap.get(y),E=M&&M.__lexicalTextContent;typeof E!="string"&&$(352,S.getType()),k=E}else k=S.getTextContent();b+=k,x<p-1&&C(S)&&!S.isInline()&&(b+=En),y=S.__next,x++}const T=f.__lexicalSlotTextLength||0,v=T>0?h.slice(T):h,N=v.slice(0,v.length-m)+b;return f.__lexicalTextContent=N,Q=l+N,void Qc(i,f,g)}if((function(m,y,x,b,T,v,N,S){if(S!==1&&S!==-1||N!==(S===1?2:1))return!1;const M=N-S;let E=m.__last;for(let it=0;it<M-1;it++){if(E===null)return!1;const Mt=Te.get(E);if(Mt===void 0)return!1;E=Mt.__prev}if(E===null)return!1;const F=Nt.get(v),R=Te.get(E);if(F===void 0||R===void 0||F.__prev!==R.__prev)return!1;const z=[];let q=v;for(let it=0;it<N;it++){if(q===null)return!1;z.push(q);const Mt=Nt.get(q);q=Mt?Mt.__next:null}const ot=[];q=E;for(let it=0;it<M;it++){if(q===null)return!1;ot.push(q);const Mt=Te.get(q);q=Mt?Mt.__next:null}const ct=new Set(ot),st=new Set(z),I=[];let P=0,W=0;for(;P<M&&W<N;)if(z[W]===ot[P])I.push({key:z[W],kind:"reconcile"}),P++,W++;else if(st.has(ot[P])){if(ct.has(z[W]))return!1;I.push({key:z[W],kind:"create",nextIndex:W}),W++}else I.push({key:ot[P],kind:"destroy"}),P++;for(;P<M;)I.push({key:ot[P++],kind:"destroy"});for(;W<N;)I.push({key:z[W],kind:"create",nextIndex:W}),W++;const at=Yc(E,M);for(const it of I){const Mt=Pe();if(it.kind==="reconcile")Xe(it.key,x.element);else if(it.kind==="destroy")fn(it.key,x.element);else{let ue=null;for(let Yn=it.nextIndex+1;Yn<N;Yn++){const Wr=lt._keyToDOMMap.get(z[Yn]);if(Wr!==void 0){ue=Wr;break}}dn(it.key,x.withBefore(ue??x.before))}if(it.kind!=="destroy"){const ue=Nt.get(it.key);ue&&O(ue)&&Tt===null&&(Tt=ue.getFormat(),jt=ue.getStyle(),Kt=ue.__key)}de(Mt)}let nt="";for(let it=0;it<N;it++){const Mt=Nt.get(z[it]);if(Mt===void 0)return!1;let ue;if(C(Mt)){const Yn=lt._keyToDOMMap.get(z[it]),Wr=Yn&&Yn.__lexicalTextContent;typeof Wr!="string"&&$(350,Mt.getType()),ue=Wr}else ue=Mt.getTextContent();nt+=ue,it<N-1&&C(Mt)&&!Mt.isInline()&&(nt+=En)}const At=b.__lexicalSlotTextLength||0,ae=At>0?T.slice(At):T;return b.__lexicalTextContent=ae.slice(0,ae.length-at)+nt,!0})(o,0,s,f,h,_,p,d)){const m=f.__lexicalTextContent;return typeof m!="string"&&$(353),Q=l+m,void Qc(i,f,g)}}}if(d===0){let _=o.__first,p=0;for(;_!==null;){const m=Nt.get(_);if(m===void 0)break;const y=Ge||eo.has(_)||to.has(_),x=Pe();if(y)Xe(_,u);else{let b,T;if(C(m)){T=Mn.get(_);const v=T&&T.__lexicalTextContent;typeof v!="string"&&$(354,m.getType()),b=v}else b=m.getTextContent();Q+=b,T!==void 0&&Js(T)}O(m)?Tt===null&&(Tt=m.getFormat(),jt=m.getStyle(),Kt=m.__key):C(m)&&p<a-1&&!m.isInline()&&(Q+=En),de(x),_=m.__next,p++}return f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Kt,void(Q=l+Q)}}if(c===1&&a===1){const h=o.__first,g=i.__first;if(h===g)Xe(h,u);else{const p=Zs(h),m=dn(g,null);try{p.parentNode===u?u.replaceChild(m,p):s.insertChild(m)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${m.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(x)}throw y}fn(h,null)}const _=Nt.get(g);O(_)&&Tt===null&&(Tt=_.getFormat(),jt=_.getStyle(),Kt=_.__key)}else{const h=Oi(o,Te),g=Oi(i,Nt);if(h.length!==c&&$(227),g.length!==a&&$(228),c===0)a!==0&&Qs(g,i,0,a-1,s);else if(a===0){if(c!==0){const _=s.after==null&&s.before==null&&le(i).size===0&&s.element.__lexicalLineBreak==null;Ys(h,0,c-1,_?null:u),_&&(u.textContent="")}}else(function(_,p,m,y,x,b){const T=y-1,v=x-1;let N,S,k=b.getFirstChild(),M=0,E=0;for(;M<=T&&E<=v;){const z=p[M],q=m[E],ot=Pe();if(z===q)k=ys(Xe(q,b.element)),M++,E++;else{if(S===void 0&&(S=Zc(m,E)),N===void 0)N=Zc(p,M);else if(!N.has(z)){M++,de(ot);continue}if(!S.has(z)){k=ys(Zs(z)),fn(z,b.element),M++,N.delete(z),de(ot);continue}if(N.has(q)){const st=Tr(lt,q);st!==k&&b.withBefore(k??b.before).insertChild(st),k=ys(Xe(q,b.element)),M++,E++}else dn(q,b.withBefore(k??b.before)),E++}const ct=Nt.get(q);ct!==null&&O(ct)?Tt===null&&(Tt=ct.getFormat(),jt=ct.getStyle(),Kt=ct.__key):C(ct)&&E<=v&&!ct.isInline()&&(Q+=En),de(ot)}const F=M>T,R=E>v;if(F&&!R){const z=m[v+1],q=z===void 0?null:lt.getElementByKey(z);Qs(m,_,E,v,b.withBefore(q??b.before))}else R&&!F&&Ys(p,M,T,b.element)})(i,h,g,c,a,s)}f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Kt,Q=l+Q})(n,t,Se(t,e,lt)),xt(t)||(r=t,Tt==null||Tt===r.__textFormat||fi||r.setTextFormat(Tt),(function(o){jt==null||jt===o.__textStyle||fi||o.setTextStyle(jt)})(t))}function Qc(n,t,e){const r=t.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=Nt.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!e.has(i)){const s=Nt.get(r);if(O(s))return Tt=s.getFormat(),void(jt=s.getStyle())}}t.__lexicalFirstTextKey=Kt}function Xe(n,t){const e=Te.get(n);let r=Nt.get(n);e!==void 0&&r!==void 0||$(61);const o=Ge||eo.has(n)||to.has(n),i=Tr(lt,n);if(e===r&&!o){let s;if(C(e)){const l=i.__lexicalTextContent;typeof l!="string"&&$(355,e.getType()),s=l,Js(i)}else s=e.getTextContent();return Q+=s,i}if(e!==r&&o&&lc(uo,ao,Bi,r,"updated"),Fn.$updateDOM(r,e,i,lt)){const s=dn(n,null);return t===null&&$(62),t.replaceChild(s,i),fn(n,null),s}if(C(e)){C(r)||$(334,n);const s=r.__indent;(Ge||s!==e.__indent)&&yf(i,s);const l=r.__format;(Ge||l!==e.__format)&&xf(i,l);const c=o&&(le(r).size>0||le(e).size>0)?Gc(e,r,i):"";if(o){const a=Q;if(Kg(e,r,i),Et(r)||r.isInline()||vf(0,r,i),c!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=c+u,Q=a+c+u,i.__lexicalSlotTextLength=c.length}else(le(r).size>0||le(e).size>0)&&(i.__lexicalSlotTextLength=0)}else{const a=i.__lexicalTextContent;typeof a!="string"&&$(356,e.getType()),Q+=a,Js(i)}if((Ge||r.__dir!==e.__dir||r.__parent!==e.__parent)&&(Xs(i,r),Et(r)&&!Ge))for(const a of r.getChildren())C(a)&&Xs(Tr(lt,a.getKey()),a)}else{const s=r.getTextContent();if(G(r)){const l=r.decorate(lt,co);l!==null&&Nf(n,l),o&&(le(r).size>0||le(e).size>0)&&Gc(e,r,i)}Q+=s}if(!fi&&Et(r)){const s=r.getLatest();if(s.__cachedText!==Q){const l=s.getWritable();l.__cachedText=Q,r=l}}return Fn.$decorateDOM(r,e,i,lt),_f(r),i}function Nf(n,t){let e=lt._pendingDecorators;const r=lt._decorators;if(e===null){if(r[n]===t)return;e=Nd(lt)}e[n]=t}function ys(n){let t=n.nextSibling;return t!==null&&t===lt._blockCursorElement&&(t=t.nextSibling),t}function Zc(n,t){const e=new Set;for(let r=t;r<n.length;r++)e.add(n[r]);return e}function zg(n,t,e,r,o,i){Q="",Tt=null,jt=null,Kt=null,Ge=r===2,lt=e,co=e._config,Fn=e._config.dom||vi,ao=e._nodes,Bi=lt._listeners.mutation,to=o,eo=i,Te=n._nodeMap,qs=n,Nt=t._nodeMap,fi=t._readOnly,Mn=af(e._keyToDOMMap),Vs=(function(){const l=new Map,c=a=>{for(const u of a){const f=Nt.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let h=l.get(d);h===void 0&&(h=new Set,l.set(d,h)),h.add(u)}};return c(to.keys()),c(eo),l})();const s=new Map;return uo=s,Xe("root",null),lt=void 0,ao=void 0,to=void 0,eo=void 0,Te=void 0,qs=void 0,Nt=void 0,co=void 0,Mn=void 0,Vs=void 0,uo=void 0,Fn=vi,s}function Zs(n){const t=Mn.get(n);return t===void 0&&$(75,n),t}function K(n){return{type:n}}const Re=K("SELECTION_CHANGE_COMMAND"),Tf=K("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Wi=K("CLICK_COMMAND"),kf=K("BEFORE_INPUT_COMMAND"),wf=K("INPUT_COMMAND"),Ef=K("COMPOSITION_START_COMMAND"),$f=K("COMPOSITION_END_COMMAND"),hn=K("DELETE_CHARACTER_COMMAND"),ur=K("INSERT_LINE_BREAK_COMMAND"),Dn=K("INSERT_PARAGRAPH_COMMAND"),On=K("CONTROLLED_TEXT_INSERTION_COMMAND"),Rr=K("PASTE_COMMAND"),Qo=K("REMOVE_TEXT_COMMAND"),Cr=K("DELETE_WORD_COMMAND"),Sr=K("DELETE_LINE_COMMAND"),ke=K("FORMAT_TEXT_COMMAND"),Bg=K("SET_TEXT_FORMAT_COMMAND"),Ui=K("UNDO_COMMAND"),ji=K("REDO_COMMAND"),Kl=K("KEYDOWN_COMMAND"),zl=K("KEY_ARROW_RIGHT_COMMAND"),Of=K("MOVE_TO_END"),Bl=K("KEY_ARROW_LEFT_COMMAND"),Af=K("MOVE_TO_START"),Wl=K("KEY_ARROW_UP_COMMAND"),Ul=K("KEY_ARROW_DOWN_COMMAND"),di=K("KEY_ENTER_COMMAND"),Mf=K("KEY_SPACE_COMMAND"),Hi=K("KEY_BACKSPACE_COMMAND"),jl=K("KEY_ESCAPE_COMMAND"),Hl=K("KEY_DELETE_COMMAND"),Jl=K("KEY_TAB_COMMAND"),Wg=K("INSERT_TAB_COMMAND"),Ug=K("INDENT_CONTENT_COMMAND"),ta=K("OUTDENT_CONTENT_COMMAND"),Ff=K("DROP_COMMAND"),Df=K("FORMAT_ELEMENT_COMMAND"),Pf=K("DRAGSTART_COMMAND"),Rf=K("DRAGOVER_COMMAND"),jg=K("DRAGEND_COMMAND"),Eo=K("COPY_COMMAND"),Ji=K("CUT_COMMAND"),ql=K("SELECT_ALL_COMMAND"),Hg=K("CLEAR_EDITOR_COMMAND"),Jg=K("CLEAR_HISTORY_COMMAND"),Yr=K("CAN_REDO_COMMAND"),Xr=K("CAN_UNDO_COMMAND"),Lf=K("FOCUS_COMMAND"),qg=K("BLUR_COMMAND"),Vg=K("KEY_MODIFIER_COMMAND");function Yg(n){const t=new Map;return{dispose(){for(const e of t.values())e.dispose();t.clear()},register(e,r){let o=t.get(e);o===void 0&&(o={dispose:n(e,r),holders:new Set},t.set(e,o));const i=()=>{const s=t.get(e);s&&s.holders.delete(i)&&s.holders.size===0&&(t.delete(e),s.dispose())};return o.holders.add(i),i}}}function no(n,t,e,r){return n.addEventListener(t,e,r),n.removeEventListener.bind(n,t,e,r)}const qe=Object.freeze({}),tl=[["keydown",function(n,t){const e=t._inputState;e.lastKeyDownTimeStamp=n.timeStamp,e.lastKeyCode=n.key,n.key!=="Backspace"&&fo(e),!t.isComposing()&&D(t,Kl,n)}],["pointerdown",function(n,t){const e=Rn(n),r=n.pointerType;Ae(e)&&r!=="touch"&&r!=="pen"&&n.button===0&&me(t,()=>{$i(e,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,t){D(t,Ef,n)}],["compositionend",function(n,t){const e=t._inputState;Oe?e.compositionPhase="ending-firefox":mn||!No&&!To?D(t,$f,n):(e.compositionPhase="ending-safari",e.compositionEndData=n.data)}],["input",function(n,t){n.stopPropagation();const e=t._inputState;fo(e),me(t,()=>{Bf(n,t)||t.dispatchCommand(wf,n)},{event:n}),e.unprocessedBeforeInputData=null}],["click",function(n,t){me(t,()=>{const e=A(),r=Dt(se(t)),o=ce();if(r){if(w(e)){const i=e.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&e.isCollapsed()&&!Et(s)&&Ct().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&e.is(o)&&(r.removeAllRanges(),e.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=re(r,t._rootElement).anchorNode;(B(i)||ie(i))&&gt(go(o,r,t,n))}}if(Oe&&r!==null&&r.rangeCount===0){const i=t._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let l=i.childNodes.length;for(let a=0;a<i.childNodes.length;a++){const u=i.childNodes[a];if(B(u)){const f=u.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){l=a;break}}}r.setBaseAndExtent(i,l,i,l);const c=go(o,r,t,n);c!==null?gt(c):r.removeAllRanges()}}D(t,Wi,n)})}],["cut",qe],["copy",qe],["dragstart",qe],["dragover",qe],["dragend",qe],["paste",qe],["focus",qe],["blur",qe],["drop",qe]];xr&&tl.push(["beforeinput",(n,t)=>(function(e,r){const o=e.inputType;o==="deleteCompositionText"||Oe&&Ed(r)||o!=="insertCompositionText"&&me(r,()=>{Bf(e,r)||D(r,kf,e)},{event:e})})(n,t)]);const el=new WeakMap,hi=new WeakMap,Xg=Yg(n=>(n.addEventListener("selectionchange",ia),()=>n.removeEventListener("selectionchange",ia)));function If(n,t,e,r,o,i){const s=n.anchor,l=n.focus,c=s.getNode(),a=ft();let u;if(i!==void 0)u=i;else{const _=Dt(se(a));u=_!==null?re(_,a._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,h=a.getElementByKey(d),g=e.length;return d!==l.key||!O(c)||(!o&&(!xr||a._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&g<2||Td(e))&&s.offset!==l.offset&&!c.isComposing()||_e(c)||c.isDirty()&&g>1||(o||!xr)&&h!==null&&!c.isComposing()&&f!==pn(c,h,a)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==n.format||c.getStyle()!==n.style)||(function(_,p){if(p.isSegmented())return!0;if(!_.isCollapsed())return!1;const m=_.anchor.offset,y=p.getParentOrThrow(),x=Ni(p);return m===0?!p.canInsertTextBefore()||!y.canInsertTextBefore()&&!p.isComposing()||x||(function(b){const T=b.getPreviousSibling();return(O(T)||C(T)&&T.isInline())&&!T.canInsertTextAfter()})(p):m===p.getTextContentSize()&&(!p.canInsertTextAfter()||!y.canInsertTextAfter()&&!p.isComposing()||x)})(n,c)}function ea(n,t){return ie(n)&&n.nodeValue!==null&&t!==0&&t!==n.nodeValue.length}function na(n,t,e){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=re(n,t._rootElement),l=t._inputState;l.isSelectionChangeFromDOMUpdate&&(l.isSelectionChangeFromDOMUpdate=!1,ea(r,o)&&ea(i,s)&&!l.postDeleteSelectionToRestore)||me(t,()=>{if(!e)return void gt(null);if(!Oo(t,r,i))return;let c=A();if(l.postDeleteSelectionToRestore&&w(c)&&c.isCollapsed()){const a=c.anchor,u=l.postDeleteSelectionToRestore.anchor;(a.key===u.key&&a.offset===u.offset+1||a.offset===1&&u.getNode().is(a.getNode().getPreviousSibling()))&&(c=l.postDeleteSelectionToRestore.clone(),gt(c))}if(l.postDeleteSelectionToRestore=null,w(c)){const a=c.anchor,u=a.getNode();if(c.isCollapsed()){n.type==="Range"&&r===i&&(c.dirty=!0);const f=se(t).event,d=f?f.timeStamp:performance.now(),{format:h,style:g,offset:_,key:p,timeStamp:m}=l.collapsedSelectionFormat,y=Ct(),x=t.isComposing()===!1&&y.getTextContent()==="";if(d<m+200&&a.offset===_&&a.key===p)Zo(c,h,g);else if(a.type==="text")O(u)||$(141),Kf(c,u);else if(a.type==="element"&&!x){C(u)||$(259);const b=a.getNode();b.isEmpty()?(function(T,v){const N=v.getTextFormat(),S=v.getTextStyle();Zo(T,N,S)})(c,b):Zo(c,c.format,"")}}else{const f=a.key,d=c.focus.key,h=c.getNodes(),g=h.length,_=c.isBackward(),p=_?s:o,m=_?o:s,y=_?d:f,x=_?f:d;let b=2047,T=!1;for(let v=0;v<g;v++){const N=h[v],S=N.getTextContentSize();if(O(N)&&S!==0&&!(v===0&&N.__key===y&&p===S||v===g-1&&N.__key===x&&m===0)&&(T=!0,b&=N.getFormat(),b===0))break}c.format=T?b:0}}D(t,Re)})}function Zo(n,t,e){n.format===t&&n.style===e||(n.format=t,n.style=e,n.dirty=!0)}function Kf(n,t){Zo(n,t.getFormat(),t.getStyle())}function zf(n){if(!n.getTargetRanges)return null;const t=n.getTargetRanges();return t.length===0?null:t[0]}function ra(n){const{lastKeyCode:t}=ft()._inputState;if(n==null||n.length<=1||t==null)return;const e=t.length===1?t:t==="Enter"?`
4
+ `:t==="Tab"?" ":null;if(!e)return;const r=A();if(!w(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!O(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(e===`
5
+ `){if(It(s))s.selectEnd();else if(!s){const l=U(o,vr),c=l&&l.getNextSibling();C(c)&&c.selectStart()}}else e===" "?br(s)&&s.selectEnd():O(s)&&s.getTextContent()[0]===e&&s.select(1,1)}else o.getTextContent()[i]===e&&o.select(i+1,i+1)}function fo(n){n.isInsertTextAfterHandledSelectionCommand=!1,n.handledSelectionCommandTimeoutId!==null&&(clearTimeout(n.handledSelectionCommandTimeoutId),n.handledSelectionCommandTimeoutId=null)}function oa(n){fo(n),n.isInsertTextAfterHandledSelectionCommand=!0,n.handledSelectionCommandTimeoutId=setTimeout(()=>fo(n),0)}function Bf(n,t){const e=Rn(n);if(B(e)&&$i(e,t))return!0;const r=t.getRootElement();if(r===null)return!1;const o=Er(r.ownerDocument);return o!==null&&r.contains(o)&&$i(o,t)}function Gg(n){const t=n.inputType,e=zf(n),r=ft(),o=r._inputState,i=A();if(t==="insertText"&&n.data&&o.isInsertTextAfterHandledSelectionCommand){if(fo(o),n.preventDefault(),w(i)&&!i.isCollapsed()){const f=i.isBackward()?i.anchor:i.focus;i.anchor.set(f.key,f.offset,f.type),i.focus.set(f.key,f.offset,f.type)}return!0}if(t==="deleteContentBackward"){if(i===null){const f=ce();if(!w(f))return!0;gt(f.clone())}if(w(i)){const f=i.anchor.key===i.focus.key;if((function(d,h){return d.lastKeyCode==="MediaLast"&&h<d.lastKeyDownTimeStamp+30})(o,n.timeStamp)&&r.isComposing()&&f){if(Rt(null),o.lastKeyDownTimeStamp=0,setTimeout(()=>{me(r,()=>{Rt(null)})},30),w(i)){const d=i.anchor.getNode();d.markDirty(),O(d)||$(142),Kf(i,d)}}else{if(Rt(null),mn&&e!==null&&!e.collapsed&&(i.applyDOMRange(e),!i.isCollapsed()))return n.preventDefault(),i.removeText(),!0;n.preventDefault();const d=i.anchor.getNode(),h=d.getTextContent(),g=d.canInsertTextAfter(),_=i.anchor.offset===0&&i.focus.offset===h.length;let p=ci&&f&&!_&&g;if(p&&i.isCollapsed()&&(p=!G(Pp(i.anchor,!0))),!p){D(r,hn,!0);const m=A();ci&&w(m)&&m.isCollapsed()&&(o.postDeleteSelectionToRestore=m,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!w(i))return!0;const s=n.data;o.unprocessedBeforeInputData!==null&&ic(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||Et(i.anchor.getNode())||e===null||i.applyDOMRange(e),o.unprocessedBeforeInputData=null;const l=i.anchor,c=i.focus,a=l.getNode(),u=c.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
6
+ `)n.preventDefault(),D(r,ur,!1);else if(s===En)n.preventDefault(),D(r,Dn);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(f)}else s!=null&&If(i,e,s,n.timeStamp,!0)?(n.preventDefault(),D(r,On,s),ra(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=n.timeStamp,!0}switch(n.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":D(r,On,n),ra((n.dataTransfer?n.dataTransfer.getData("text/plain"):null)??n.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;Rt(null),f||D(r,On,n),ti(d);break}case"insertLineBreak":Rt(null),D(r,ur,!1);break;case"insertParagraph":Rt(null),o.isInsertLineBreak&&!mn?(o.isInsertLineBreak=!1,D(r,ur,!1)):D(r,Dn);break;case"insertFromPaste":case"insertFromPasteAsQuotation":D(r,Rr,n);break;case"deleteByComposition":(function(f,d){return f!==d||C(f)||C(d)||!Ni(f)||!Ni(d)})(a,u)&&D(r,Qo,n);break;case"deleteByDrag":kr(ol),D(r,Qo,n);break;case"deleteByCut":D(r,Qo,n);break;case"deleteContent":D(r,hn,!1);break;case"deleteWordBackward":D(r,Cr,!0);break;case"deleteWordForward":D(r,Cr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":D(r,Sr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":D(r,Sr,!1);break;case"formatStrikeThrough":D(r,ke,"strikethrough");break;case"formatBold":D(r,ke,"bold");break;case"formatItalic":D(r,ke,"italic");break;case"formatUnderline":D(r,ke,"underline");break;case"historyUndo":D(r,Ui);break;case"historyRedo":D(r,ji)}return!0}function Qg(n){const t=ft(),e=t._inputState,r=A(),o=n.data,i=zf(n);let s=!1;if(o!=null&&w(r)){const l=Dt(se(t)),c=l!==null?re(l,t._rootElement):null,a=n.inputType==="insertCompositionText"&&e.compositionPhase!=="ending-firefox"&&!t.isComposing();a&&(e.hadOrphanedCompositionEvents=!0);const u=r.anchor.getNode(),f=n.inputType==="insertCompositionText"&&e.compositionPhase!=="ending-firefox"&&t.isComposing()&&O(u)&&_e(u);if(!a&&!f&&If(r,i,o,n.timeStamp,!1,c)){if(s=!0,e.compositionPhase==="ending-firefox"){const m=gi(t,o);if(e.compositionPhase="idle",m)return kr(mi),Ma(),!0}const d=r.anchor.getNode();if(l===null||c===null)return!0;const h=r.isBackward(),g=h?r.anchor.offset:r.focus.offset,_=h?r.focus.offset:r.anchor.offset;xr&&!r.isCollapsed()&&O(d)&&c.anchorNode!==null&&d.getTextContent().slice(0,g)+o+d.getTextContent().slice(g+_)===wd(c.anchorNode)||D(t,On,o);const p=o.length;Oe&&p>1&&n.inputType==="insertCompositionText"&&!t.isComposing()&&(r.anchor.offset-=p,r._cachedNodes=null,r._cachedIsBackward=null),ci&&t.isComposing()&&(e.lastKeyDownTimeStamp=0,Rt(null))}}return s||(ic(!1,t,o!==null?o:void 0),e.compositionPhase==="ending-firefox"&&(gi(t,o||void 0),kr(mi),e.compositionPhase="idle")),Ma(),!0}function Zg(n){const t=ft(),e=t._inputState,r=A();if(w(r)&&!t.isComposing()){e.compositionPhase="composing",e.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(Rt(o.key),kr(qf),n.timeStamp<e.lastKeyDownTimeStamp+30||o.type==="element"||!r.isCollapsed()||!ci&&(i.getFormat()!==r.format||O(i)&&i.getStyle()!==r.style)||O(i)&&(_e(i)||o.offset===0&&!i.canInsertTextBefore()||o.offset===i.getTextContentSize()&&!i.canInsertTextAfter())){D(t,On,Ll);const s=A();w(s)&&Rt(s.anchor.key)}}return!0}function tp(n){const t=ft();return t._inputState.compositionPhase="idle",gi(t,n.data),kr(mi),!0}function ti(n){if(n===null)return;const t=tt(n);if(!O(t)||t.getType()==="text"||_e(t)||!t.isAttached())return;const e=A(),r=w(e)&&e.anchor.key===n?e.anchor.offset:null,o=wt(t.getTextContent());if(o.setFormat(t.getFormat()),o.setStyle(t.getStyle()),t.replace(o),r!==null){const i=Math.min(r,o.getTextContentSize());o.select(i,i)}}function gi(n,t){const e=n._compositionKey;if(Rt(null),e!==null&&t!=null){if(t===""){const o=tt(e),i=n.getElementByKey(e),s=i!==null&&O(o)?pn(o,i,n):null;if(s!==null&&s.nodeValue!==null&&O(o)){const l=Dt(se(n)),c=l&&re(l,n._rootElement);let a=null,u=null;c!==null&&c.anchorNode===s&&(a=c.anchorOffset,u=c.focusOffset),sc(o,s.nodeValue,a,u,!0)}return ti(e),!1}if(t[t.length-1]===`
7
+ `){const o=A();if(w(o)||dt(o)){if(w(o)){const i=o.focus;o.anchor.set(i.key,i.offset,i.type)}return D(n,di,null),ti(e),!1}}const r=tt(e);if(r!==null&&O(r)&&_e(r)){r.markDirty();const o=A(),i=r.getTextContentSize(),s=w(o)&&o.anchor.key===e?o.anchor.offset:i;return r.select(s,s).insertText(t),!0}}return ic(!0,n,t),ti(e),!1}function ep(n){const t=ft(),e=t._inputState;if(n.key==null)return!0;if(e.compositionPhase==="ending-safari"){const r=Da(n);if(r&&me(t,()=>{gi(t,e.compositionEndData)}),e.compositionPhase="idle",e.compositionEndData="",r)return!0}if((function(r){return pt(r,"ArrowRight",{shiftKey:"any"})})(n))D(t,zl,n);else if((function(r){return pt(r,"ArrowRight",{...Ye,shiftKey:"any"})})(n))D(t,Of,n);else if((function(r){return pt(r,"ArrowLeft",{shiftKey:"any"})})(n))D(t,Bl,n);else if((function(r){return pt(r,"ArrowLeft",{...Ye,shiftKey:"any"})})(n))D(t,Af,n);else if((function(r){return pt(r,"ArrowUp",{altKey:"any",shiftKey:"any"})})(n))D(t,Wl,n);else if((function(r){return pt(r,"ArrowDown",{altKey:"any",shiftKey:"any"})})(n))D(t,Ul,n);else if((function(r){return pt(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(n))e.isInsertLineBreak=!0,D(t,di,n);else if((function(r){return r.key===" "})(n))D(t,Mf,n);else if((function(r){return Ne&&pt(r,"o",{ctrlKey:!0})})(n))n.preventDefault(),e.isInsertLineBreak=!0,D(t,ur,!0);else if((function(r){return pt(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(n))e.isInsertLineBreak=!1,D(t,di,n);else if((function(r){return pt(r,"Backspace",{shiftKey:"any"})||Ne&&pt(r,"h",{ctrlKey:!0})})(n))Da(n)?D(t,Hi,n)&&oa(e):(n.preventDefault(),D(t,hn,!0));else if((function(r){return r.key==="Escape"})(n))D(t,jl,n);else if((function(r){return pt(r,"Delete",{})||Ne&&pt(r,"d",{ctrlKey:!0})})(n))(function(r){return r.key==="Delete"})(n)?D(t,Hl,n):(n.preventDefault(),D(t,hn,!1));else if((function(r){return pt(r,"Backspace",Fa)})(n))n.preventDefault(),D(t,Cr,!0);else if((function(r){return pt(r,"Delete",Fa)})(n))n.preventDefault(),D(t,Cr,!1);else if((function(r){return Ne&&pt(r,"Backspace",{metaKey:!0})})(n))n.preventDefault(),D(t,Sr,!0);else if((function(r){return Ne&&(pt(r,"Delete",{metaKey:!0})||pt(r,"k",{ctrlKey:!0}))})(n))n.preventDefault(),D(t,Sr,!1);else if((function(r){return pt(r,"b",Ye)})(n))n.preventDefault(),D(t,ke,"bold");else if((function(r){return pt(r,"u",Ye)})(n))n.preventDefault(),D(t,ke,"underline");else if((function(r){return pt(r,"i",Ye)})(n))n.preventDefault(),D(t,ke,"italic");else if((function(r){return pt(r,"Tab",{shiftKey:"any"})})(n))D(t,Jl,n);else if((function(r){return pt(r,"z",Ye)})(n))n.preventDefault(),D(t,Ui);else if((function(r){return Ne?pt(r,"z",{metaKey:!0,shiftKey:!0}):pt(r,"y",{ctrlKey:!0})||pt(r,"z",{ctrlKey:!0,shiftKey:!0})})(n))n.preventDefault(),D(t,ji);else{const r=t._editorState._selection;(function(o){return pt(o,"a",Ye)})(n)?(n.preventDefault(),D(t,ql,n)&&oa(e)):r===null||w(r)||((function(o){return pt(o,"c",Ye)})(n)?(n.preventDefault(),D(t,Eo,n)):(function(o){return pt(o,"x",Ye)})(n)&&(n.preventDefault(),D(t,Ji,n)))}return(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(n)&&t.dispatchCommand(Vg,n),!0}function Wf(n){let t=n.__lexicalEventHandles;return t===void 0&&(t=[],n.__lexicalEventHandles=t),t}const fr=new Map;function ia(n){const t=Lp(n.target);if(t===null)return;const e=cc(n.target);let r=null,o=null;const i=e!==null?hi.get(e):void 0;if(e!==null){if(i!==void 0){const f=i.editors;let d=i.hasShadowEditor;if(d===void 0){d=!1;for(const h of f)if(h._rootElement!==null&&je(h._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let h=null,g=null;for(const _ of f){const p=_._rootElement;if(p===null)continue;const m=re(t,p).anchorNode;if(m!==null&&hr(m)===_){if(je(p.getRootNode())){r=_,o=m;break}h===null&&(h=_,g=m)}}r===null&&h!==null&&(r=h,o=g)}else{const h=t.anchorNode;h===null||B(h)&&h.shadowRoot!==null||(r=hr(h),r!==null&&(o=h))}}if(r===null){const f=Er(e);r=f!==null?hr(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;me(r,()=>{const f=ce(),d=o??re(t,r._rootElement).anchorNode;(B(d)||ie(d))&&gt(go(f,t,r,n))})}const s=oc(r),l=s[s.length-1],c=l._key,a=fr.get(c),u=a||l;u!==r&&na(t,u,!1),na(t,r,!0),r!==l?fr.set(c,r):a&&fr.delete(c)}function sa(n){n._lexicalHandled=!0}function la(n){return n._lexicalHandled===!0}function np(n){const t=el.get(n);if(t===void 0)return;const e=hi.get(t);if(e===void 0)return;el.delete(n);const r=Lr(n);Ao(r)?((function(i){if(i._parentEditor!==null){const s=oc(i),l=s[s.length-1]._key;fr.get(l)===i&&fr.delete(l)}else fr.delete(i._key)})(r),e.editors.delete(r),e.hasShadowEditor=void 0,n.__lexicalEditor=null):r&&$(198);const o=Wf(n);for(let i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}function nl(n,t,e){Pt();const r=n.__key,o=n.getParent();if(o===null)return void(Wt(n)!==null&&$(367,r,String(Wt(n))));const i=(function(l){const c=A();if(!w(c)||!C(l))return c;const{anchor:a,focus:u}=c,f=a.getNode(),d=u.getNode();return wr(f,l)&&a.set(l.__key,0,"element"),wr(d,l)&&u.set(l.__key,0,"element"),c})(n);let s=!1;if(w(i)&&t){const l=i.anchor,c=i.focus;l.key===r&&(yi(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),c.key===r&&(yi(c,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else dt(i)&&t&&n.isSelected()&&n.selectPrevious();if(w(i)&&t&&!s){const l=n.getIndexWithinParent();Le(n),kn(i,o,l,-1)}else Le(n);e||xt(o)||o.canBeEmpty()||!o.isEmpty()||nl(o,t),t&&i&&Et(o)&&o.isEmpty()&&o.selectEnd()}const Uf=Symbol.for("ephemeral");function pi(n){return n[Uf]||!1}const ca={configurable:!0,enumerable:!1,value:void 0,writable:!0};let Zt=class{__type;__key;__parent;__prev;__next;__state;[lo];static getType(){const{ownNodeType:t}=fc(this);return t===void 0&&$(64,this.name),t}static clone(t){$(65,this.name)}$config(){return{}}config(t,e){const r=e.extends||Kd(this.constructor);return Object.assign(e,{extends:r}),typeof t=="string"&&Object.assign(e,{type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}resetOnCopyNodeFrom(t){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",ca),Object.defineProperty(this,lo,ca),Sd(this,t)}getType(){return this.__type}isInline(){$(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;const e=tt(t);if(e===null)break;t=e.__parent!==null?e.__parent:Wt(e)}return!1}isSelected(t){const e=t||A();if(e==null)return!1;const r=e.getNodes().some(o=>o.__key===this.__key);if(O(this))return r;if(w(e)&&e.anchor.type==="element"&&e.focus.type==="element"){if(e.isCollapsed())return!1;const o=this.getParent();if(G(this)&&this.isInline()&&o){const i=e.isBackward()?e.focus:e.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(t===null)return-1;let e=t.getFirstChild(),r=0;for(;e!==null;){if(this.is(e))return r;r++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return t===null?null:tt(t)}getParentOrThrow(){const t=this.getParent();return t===null&&$(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){const e=t.getParent();if(xt(e)||Wt(t)!==null)return C(t)||t===this&&G(t)||$(194),t;t=e}return null}getTopLevelElementOrThrow(){const t=this.getTopLevelElement();return t===null&&$(67,this.__key),t}getParents(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return t===null?null:tt(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(e===null)return t;let r=e.getFirstChild();for(;r!==null&&!r.is(this);)t.push(r),r=r.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return t===null?null:tt(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;e!==null;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=C(this)?this:this.getParent(),r=C(t)?t:t.getParent(),o=e&&r?hl(e,r):null;return o?o.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){const e=hl(this,t);return e!==null&&(e.type==="descendant"||(e.type==="branch"?jd(e)===-1:(e.type!=="same"&&e.type!=="ancestor"&&$(279),!1)))}isParentOf(t){return wr(t,this)}getNodesBetween(t){const e=this.isBefore(t),r=[],o=new Set;let i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===t)break;const l=C(i)?e?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const c=e?i.getNextSibling():i.getPreviousSibling();if(c!==null){i=c;continue}const a=i.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===t)break;let u=null,f=a;do{if(f===null&&$(68),u=e?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);i=u}return e||r.reverse(),r}isDirty(){const t=ft()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(pi(this))return this;const t=tt(this.__key);return t===null&&$(113),t}getWritable(){if(pi(this))return this;Pt();const t=ln(),e=ft(),r=t._nodeMap,o=this.__key,i=this.getLatest(),s=e._cloneNotNeeded,l=A();if(l!==null&&l.setCachedNodes(null),s.has(o))return Ti(i),i;const c=Rd(i);return s.add(o),Ti(c),r.set(o,c),c}getTextContent(){return Bd(this)}getTextContentSize(){return this.getTextContent().length}createDOM(t,e){$(70)}updateDOM(t,e,r){$(71)}getDOMSlot(t){return new of(t)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){$(18,this.name)}updateFromJSON(t){return(function(e,r){const o=e.getWritable(),i=r.$;let s=i;for(const l of mf(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&pf(e).updateFromJSON(s),o})(this,t)}static transform(){return null}remove(t){nl(this,!0,t)}replace(t,e){Pt();let r=A();r!==null&&(r=r.clone()),ws(this,t);const o=this.getLatest(),i=this.__key,s=t.__key,l=t.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=u!==null?l.getIndexWithinParent():-1;Le(l),u!==null&&w(r)&&kn(r,u,f,-1);const d=o.getPreviousSibling(),h=o.getNextSibling(),g=o.__prev,_=o.__next,p=o.__parent;nl(o,!1,!0),d===null?c.__first=s:d.getWritable().__next=s,l.__prev=g,h===null?c.__last=s:h.getWritable().__prev=s,l.__next=_,l.__parent=p,c.__size=a;let m=0;e&&(C(this)&&C(l)||$(139),m=l.getChildrenSize(),l.splice(m,0,this.getChildren()));const y=ye(this);if(y.length>0){tn(this)&&tn(l)||$(368,this.__key,l.__key);for(const x of y){const b=In(this,x);b!==null&&(tm(this,x),Wd(l,x,b))}}if(w(r)){gt(r);const x=r.anchor,b=r.focus;x.key===i&&(e&&x.type==="element"?x.set(l.__key,m+x.offset,"element"):da(x,l)),b.key===i&&(e&&b.type==="element"?b.set(l.__key,m+b.offset,"element"):da(b,l))}return Ie()===i&&Rt(s),l}insertAfter(t,e=!0){Pt(),ws(this,t);const r=this.getWritable(),o=t.getWritable();this.getParentOrThrow();const i=o.getParent(),s=A();let l=!1,c=!1;if(i!==null){const h=t.getIndexWithinParent();if(w(s)){const g=i.__key,_=s.anchor,p=s.focus;l=_.type==="element"&&_.key===g&&_.offset===h+1,c=p.type==="element"&&p.key===g&&p.offset===h+1}Le(o),e&&w(s)&&kn(s,i,h,-1)}else Le(o);const a=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(a===null?u.__last=f:a.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,e&&w(s)){const h=this.getIndexWithinParent();kn(s,u,h+1);const g=u.__key;l&&s.anchor.set(g,h+2,"element"),c&&s.focus.set(g,h+2,"element")}return t}insertBefore(t,e=!0){Pt(),ws(this,t);const r=this.getWritable(),o=t.getWritable();this.getParentOrThrow();const i=o.__key,s=A(),l=o.getParent(),c=l!==null?o.getIndexWithinParent():-1;Le(o),l!==null&&e&&w(s)&&kn(s,l,c,-1);const a=this.getPreviousSibling(),u=this.getParentOrThrow().getWritable(),f=r.__prev,d=this.getIndexWithinParent();return a===null?u.__first=i:a.getWritable().__next=i,u.__size++,r.__prev=i,o.__prev=f,o.__next=r.__key,o.__parent=r.__parent,e&&w(s)&&kn(s,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return V()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Pt();const r=pe(this);if(r!==null)return r.selectPrevious(t,e);const o=this.getPreviousSibling(),i=this.getParentOrThrow();if(o===null)return i.select(0,0);if(C(o))return o.select();if(!O(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(t,e)}selectNext(t,e){Pt();const r=pe(this);if(r!==null)return r.selectNext(t,e);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(C(o))return o.select(0,0);if(!O(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}};function jf(n){return n instanceof Zt}const rl="historic",rp="history-push",dr="history-merge",Hf="paste",Jf="cut",op="collaboration",ip="skip-scroll-into-view",sp="skip-dom-selection",ol="skip-selection-focus",qf="composition-start",mi="composition-end",lp="!important";function _i(n){const t={};if(!n)return t;let e="",r="",o=null,i=!1,s=!1,l=!1,c=0;const a=n.length;let u=-1;for(let h=0;h<a;h++){const g=n[h];if(i)g==="*"&&n[h+1]==="/"&&(i=!1,h++);else if(s)u===-1&&(u=h),s=!1;else if(o===null)if(g!=="/"||n[h+1]!=="*")if(g!=='"'&&g!=="'")if(g!=="(")if(g!==")")if(l||g!==":"||c!==0){if(g===";"&&c===0){u!==-1&&(l?r+=n.slice(u,h):e+=n.slice(u,h),u=-1);const _=e.trim(),p=r.trim();_!==""&&p!==""&&(t[_]=p),e="",r="",l=!1;continue}u===-1&&(u=h)}else u!==-1&&(e+=n.slice(u,h),u=-1),l=!0;else u===-1&&(u=h),c=Math.max(0,c-1);else u===-1&&(u=h),c++;else u===-1&&(u=h),o=g;else u!==-1&&(l?r+=n.slice(u,h):e+=n.slice(u,h),u=-1),i=!0,h++;else u===-1&&(u=h),g==="\\"?s=!0:g===o&&(o=null)}u!==-1&&(l?r+=n.slice(u,a):e+=n.slice(u,a));const f=e.trim(),d=r.trim();return f!==""&&d!==""&&(t[f]=d),t}function cp(n,t,e){const r=e.trimEnd(),o=r.length-10;o>=0&&r.slice(o).toLowerCase()===lp?n.setProperty(t,r.slice(0,o).trim(),"important"):n.setProperty(t,e,"")}function gn(n,t,e=""){if(t===e)return;const r=_i(e),o=_i(t);for(const i in o)delete r[i],cp(n,i,o[i]);for(const i in r)n.removeProperty(i)}function xs(n,t){return 16&t?"code":t&Rl?"mark":32&t?"sub":64&t?"sup":null}function Cs(n,t){return 1&t?"strong":2&t?"em":"span"}function Vf(n,t,e,r,o){const i=r.classList;let s=gr(o,"base");s!==void 0&&i.add(...s),s=gr(o,"underlineStrikethrough");let l=!1;const c=8&t&&4&t;s!==void 0&&(8&e&&4&e?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const a in nn){const u=nn[a];if(s=gr(o,a),s!==void 0)if(e&u){if(l&&(a==="underline"||a==="strikethrough")){t&u&&i.remove(...s);continue}((t&u)===0||c&&a==="underline"||a==="strikethrough")&&i.add(...s)}else t&u&&i.remove(...s)}}function Yf(n,t,e){const r=e.isComposing(),o=n+(r?so:""),i=St(),s=ts(i).$getDOMSlot(e,t,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(Z().createTextNode(o));const c=l,a=c.nodeValue;if(a!==o)if(r||Oe){const[u,f,d]=(function(h,g){const _=h.length,p=g.length;let m=0,y=0;for(;m<_&&m<p&&h[m]===g[m];)m++;for(;y+m<_&&y+m<p&&h[_-y-1]===g[p-y-1];)y++;return[m,_-m-y,g.slice(m,p-y)]})(a,o);f!==0&&c.deleteData(u,f),c.insertData(u,d)}else c.nodeValue=o}function aa(n,t,e,r,o,i){Yf(o,n,t);const s=i.theme.text;s!==void 0&&Vf(0,0,r,n,s)}function Do(n,t){const e=Z().createElement(t);return e.appendChild(n),e}function il(n){return n!=null&&n.__isInlineFormattable===!0}class rn extends Zt{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config("text",{importDOM:{"#text":()=>({conversion:dp,priority:0}),b:()=>({conversion:up,priority:0}),code:()=>({conversion:Ve,priority:0}),em:()=>({conversion:Ve,priority:0}),i:()=>({conversion:Ve,priority:0}),mark:()=>({conversion:Ve,priority:0}),s:()=>({conversion:Ve,priority:0}),span:()=>({conversion:ap,priority:0}),strong:()=>({conversion:Ve,priority:0}),sub:()=>({conversion:Ve,priority:0}),sup:()=>({conversion:Ve,priority:0}),u:()=>({conversion:Ve,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return wg[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Ie()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const e=nn[t];return(this.getFormat()&e)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return Pn(this.getLatest().__format,t,e)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,e){const r=this.__format,o=xs(0,r),i=Cs(0,r),s=o===null?i:o,l=Z().createElement(s);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),o!==null&&(c=Z().createElement(i),l.appendChild(c)),aa(c,this,0,r,this.__text,t);const a=this.__style;return a!==""&&gn(l.style,a),l}updateDOM(t,e,r){const o=this.__text,i=t.__format,s=this.__format,l=xs(0,i),c=xs(0,s),a=Cs(0,i),u=Cs(0,s);if((l===null?a:l)!==(c===null?u:c))return!0;if(l===c&&a!==u){const _=e.firstChild;_==null&&$(48);const p=Z().createElement(u);return aa(p,this,0,s,o,r),e.replaceChild(p,_),!1}let f=e;c!==null&&l!==null&&(f=e.firstChild,f==null&&$(49)),Yf(o,f,this);const d=r.theme.text;d!==void 0&&i!==s&&Vf(0,i,s,f,d);const h=t.__style,g=this.__style;return h!==g&&gn(e.style,g,h),!1}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:e}=super.exportDOM(t);return B(e)||$(132),e.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?e.style.textTransform="lowercase":this.hasFormat("uppercase")?e.style.textTransform="uppercase":this.hasFormat("capitalize")&&(e.style.textTransform="capitalize"),this.hasFormat("bold")&&(e=Do(e,"b")),this.hasFormat("italic")&&(e=Do(e,"i")),this.hasFormat("strikethrough")&&(e=Do(e,"s")),this.hasFormat("underline")&&(e=Do(e,"u")),{element:e}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format=typeof t=="string"?nn[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail=typeof t=="string"?Ng[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=Pn(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=kg[t];if(this.__mode===e)return this;const r=this.getWritable();return r.__mode=e,r}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Pt();let r=t,o=e;const i=A(),s=this.getTextContent(),l=this.__key;if(typeof s=="string"){const c=s.length;r===void 0&&(r=c),o===void 0&&(o=c)}else r=0,o=0;if(!w(i))return id(l,r,l,o,"text","text");{const c=Ie();c!==i.anchor.key&&c!==i.focus.key||Rt(l),i.setTextNodeRange(this,r,this,o)}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,r,o){const i=this.getWritable(),s=i.__text,l=r.length;let c=t;c<0&&(c=l+c,c<0&&(c=0));const a=A();if(o&&w(a)){const f=t+l;a.setTextNodeRange(i,f,i,f)}const u=s.slice(0,c)+r+s.slice(c+e);return i.__text=u,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Pt();const e=this.getLatest(),r=e.getTextContent();if(r==="")return[];const o=e.__key,i=Ie(),s=r.length;t.sort((S,k)=>S-k),t.push(s);const l=[],c=t.length;for(let S=0,k=0;S<s&&k<=c;k++){const M=t[k];M>S&&(l.push(r.slice(S,M)),S=M)}const a=l.length;if(a===1)return[e];const u=l[0],f=e.getParent();let d;const h=e.getFormat(),g=e.getStyle(),_=e.__detail;let p=!1,m=null,y=null;const x=A();if(w(x)){const[S,k]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];S.type==="text"&&S.key===o&&(m=S),k.type==="text"&&k.key===o&&(y=k)}e.isSegmented()?(d=wt(u),d.__format=h,d.__style=g,d.__detail=_,d.__state=jc(e,d),p=!0):d=e.setTextContent(u);const b=[d];for(let S=1;S<a;S++){const k=wt(l[S]);k.__format=h,k.__style=g,k.__detail=_,k.__state=jc(e,k);const M=k.__key;i===o&&Rt(M),b.push(k)}const T=m?m.offset:null,v=y?y.offset:null;let N=0;for(const S of b){if(!m&&!y)break;const k=N+S.getTextContentSize();if(m!==null&&T!==null&&T<=k&&T>=N&&(m.set(S.getKey(),T-N,"text"),T<k&&(m=null)),y!==null&&v!==null&&v<=k&&v>=N){y.set(S.getKey(),v-N,"text");break}N=k}if(f!==null){(function(M){const E=M.getPreviousSibling(),F=M.getNextSibling();E!==null&&Ti(E),F!==null&&Ti(F)})(this);const S=f.getWritable(),k=this.getIndexWithinParent();p?(S.splice(k,0,b),this.remove()):S.splice(k,1,b),w(x)&&kn(x,f,k,a-1)}return b}mergeWithSibling(t){const e=t===this.getPreviousSibling();e||t===this.getNextSibling()||$(50);const r=this.__key,o=t.__key,i=this.__text,s=i.length;Ie()===o&&Rt(r);const l=A();if(w(l)){const f=l.anchor,d=l.focus;f!==null&&f.key===o&&Sa(f,e,r,t,s),d!==null&&d.key===o&&Sa(d,e,r,t,s)}const c=t.__text,a=e?c+i:i+c;this.setTextContent(a);const u=this.getWritable();return t.remove(),u}isTextEntity(){return!1}}function ap(n){return{forChild:Vl(n.style),node:null}}function up(n){const t=n,e=t.style.fontWeight==="normal";return{forChild:Vl(t.style,e?void 0:"bold"),node:null}}const ua=new WeakMap;function fp(n){if(!B(n))return!1;if(n.nodeName==="PRE")return!0;const t=n.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function dp(n){const t=n;n.parentElement===null&&$(129);let e=t.textContent||"";if((function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=ua.get(i))===void 0&&!fp(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let c=0;c<s.length;c++)ua.set(s[c],l);return l})(t)!==null)return{node:po(e)};if(e=e.replace(/\r/g,"").replace(/[ \t\n]+/g," "),e==="")return{node:null};if(e[0]===" "){let r=t,o=!0;for(;r!==null&&(r=fa(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(e=e.slice(1)),o=!1;break}}o&&(e=e.slice(1))}if(e[e.length-1]===" "){let r=t,o=!0;for(;r!==null&&(r=fa(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(e=e.slice(0,e.length-1))}return e===""?{node:null}:{node:wt(e)}}function fa(n,t){let e=n;for(;;){let r;for(;(r=t?e.nextSibling:e.previousSibling)===null;){const i=e.parentElement;if(i===null)return null;e=i}if(e=r,B(e)){const i=e.style.display;if(i===""&&!wi(e)||i!==""&&!i.startsWith("inline"))return null}let o=e;for(;(o=t?e.firstChild:e.lastChild)!==null;)e=o;if(ie(e))return e;if(e.nodeName==="BR")return null}}const hp={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ve(n){const t=hp[n.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Vl(n.style,t),node:null}}function wt(n=""){return Gt(new rn(n))}function O(n){return n instanceof rn}function Vl(n,t){const e=n.fontWeight,r=n.textDecoration.split(" "),o=e==="700"||e==="bold",i=r.includes("line-through"),s=n.fontStyle==="italic",l=r.includes("underline"),c=n.verticalAlign;return a=>((O(a)||il(a))&&(o&&!a.hasFormat("bold")&&a.toggleFormat("bold"),i&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),s&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),c!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),t&&!a.hasFormat(t)&&a.toggleFormat(t)),a)}class qi extends rn{$config(){return this.config("tab",{extends:rn})}constructor(t=void 0){super(" ",t),this.__detail=2}createDOM(t){const e=super.createDOM(t),r=gr(t.theme,"tab");return r!==void 0&&e.classList.add(...r),e}setTextContent(t){return super.setTextContent(" ")}spliceText(t,e,r,o){return r===""&&e===0||r===" "&&e===1||$(286),this}setDetail(t){return t!==2&&$(127),this}setMode(t){return t!=="normal"&&$(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Vi(){return Gt(new qi)}function br(n){return n instanceof qi}class gp{key;offset;type;_selection;constructor(t,e,r){this._selection=null,this.key=t,this.offset=e,this.type=r}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:xo(Ut(Jt(this,"next")),Ut(Jt(t,"next")))<0}getNode(){const t=tt(this.key);return t===null&&$(20),t}set(t,e,r,o){const i=this._selection,s=this.key;o&&this.key===t&&this.offset===e&&this.type===r||(this.key=t,this.offset=e,this.type=r,_n()||(Ie()===s&&Rt(t),i!==null&&(i.setCachedNodes(null),w(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function ne(n,t,e){return new gp(n,t,e)}function Ss(n,t){let e=t.__key,r=n.offset,o="element";if(O(t)){o="text";const i=t.getTextContentSize();r>i&&(r=i)}else if(!C(t)){const i=t.getNextSibling();if(O(i))e=i.__key,r=0,o="text";else{const s=t.getParent();s&&(e=s.__key,r=t.getIndexWithinParent()+1)}}n.set(e,r,o)}function da(n,t){if(C(t)){const e=t.getLastDescendant();C(e)||O(e)?Ss(n,e):Ss(n,t)}else Ss(n,t)}function ha(n,t,e,r){const o=n.getNode(),i=o.getChildAtIndex(n.offset),s=wt();if(s.setFormat(e),s.setStyle(r),cn(i))i.splice(0,0,[s]);else if(i!==null){const l=xt(o)?V().append(s):s;i.insertBefore(l)}else if(xt(o)){const l=o.getLastChild();C(l)&&!l.isInline()&&l.isEmpty()?l.append(s):o.append(V().append(s))}else o.append(s);n.is(t)&&t.set(s.__key,0,"text"),n.set(s.__key,0,"text")}function ga(n,t,e,r){const o=n.anchor.getNode();O(o)||$(398);const i=n.anchor.offset,s=wt(t);s.setFormat(e),s.setStyle(r);const l=o.getParentOrThrow();if(i===0)l.isInline()&&!o.__prev?l.insertBefore(s):o.insertBefore(s,!1);else if(i===o.getTextContentSize())l.isInline()&&!o.__next?l.insertAfter(s):o.insertAfter(s,!1);else{const[c]=o.splitText(i);c.insertAfter(s,!1)}o.getTextContent()===""&&o.isAttached()&&o.remove(),s.selectEnd(),s.isComposing()&&n.anchor.type==="text"&&n.anchor.set(n.anchor.key,n.anchor.offset-t.length,n.anchor.type)}class Yi{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!dt(t))return!1;const e=this._nodes,r=t._nodes;return e.size===r.size&&Array.from(e).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new Yi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes().filter(s=>Wt(s)===null),r=e.length;if(r===0)return;const o=e[r-1];let i;if(O(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(t);for(let s=0;s<r;s++)e[s].remove()}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=this._nodes,r=[];for(const o of e){const i=tt(o);i!==null&&r.push(i)}return _n()||(this._cachedNodes=r),r}getTextContent(){const t=this.getNodes();let e="";for(let r=0;r<t.length;r++)e+=t[r].getTextContent();return e}deleteNodes(){const t=this.getNodes().filter(e=>Wt(e)===null);if((A()||ce())===this&&t[0]){const e=et(t[0],"next");Ar(Ee(e,e))}for(const e of t)e.remove();Xf()}}function Xf(){const n=Ct();if(n.isEmpty()){const t=V();n.append(t),t.select()}}function w(n){return n instanceof Un}class Un{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(t,e,r,o){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!w(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=(function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,c=new Set;for(const a of r)if(Ht(a)){const{origin:u}=a;o.length===0?l.add(u):(c.add(u),o.push(u))}else{const{origin:u}=a;C(u)&&c.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),Me(r.focus)&&C(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let a=Ft(r.focus.origin,"previous");Ht(a)&&l.has(a.origin)&&!a.origin.isEmpty()&&a.origin.is(o[o.length-1]);a=Bn(a))l.delete(a.origin),o.pop();for(;o.length>1;){const a=o[o.length-1];if(!C(a)||c.has(a)||a.isEmpty()||l.has(a))break;o.pop()}if(o.length===0&&r.isCollapsed()){const a=Ut(r.anchor),u=Ut(r.anchor.getFlipped()),f=h=>xe(h)?h.origin:h.getNodeAtCaret(),d=f(a)||f(u)||(r.anchor.getNodeAtCaret()?a.origin:u.origin);o.push(d)}return o})(mc(gl(this),"next"));return _n()||(this._cachedNodes=e),e}setTextNodeRange(t,e,r,o){return this.anchor.set(t.__key,e,"text"),this.focus.set(r.__key,o,"text"),this}getTextContent(){const t=this.getNodes();if(t.length===0)return"";const e=t[0],r=t[t.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,c]=sl(this);let a="",u=!0;for(let f=0;f<t.length;f++){const d=t[f];if(C(d)&&!d.isInline()){u||(a+=`
8
+ `);let h="";for(const g of ye(d)){const _=In(d,g);_!==null&&(h+=_.getTextContent())}h!==""?(a+=h,u=!1):u=!d.isEmpty()}else if(u=!1,O(d)){let h=d.getTextContent();d===e?d===r?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(h=l<c?h.slice(l,c):h.slice(c,l)):h=s?h.slice(l):h.slice(c):d===r&&(h=s?h.slice(0,c):h.slice(0,l)),a+=h}else!G(d)&&!It(d)||d===r&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(t){const e=ft(),r=e.getEditorState()._selection,o=od(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,r);if(o===null)return;const[i,s,l]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),l&&(this.dirty=!0),De(this)}clone(){const t=this.anchor,e=this.focus;return new Un(ne(t.key,t.offset,t.type),ne(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Pn(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=nn[t];return(this.format&e)!==0}insertRawText(t){this.insertNodes(po(t))}insertText(t){let e=this.format,r=this.style;if(!this.isCollapsed()){const f=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(O(f)&&(e=f.getFormat(),r=f.getStyle()),this.removeText(),this.format=e,this.style=r,t==="")return;if(Ie()===null)return this.anchor.type==="element"&&ha(this.anchor,this.focus,e,r),void ga(this,t,e,r)}this.anchor.type==="element"&&ha(this.anchor,this.focus,e,r);const o=this.anchor.getNode();O(o)||$(398);const i=this.anchor.offset,s=o.getParentOrThrow(),l=o.getTextContentSize();if(_e(o)||i===0&&(!o.canInsertTextBefore()||!s.canInsertTextBefore()&&!o.__prev)||i===l&&(!o.canInsertTextAfter()||!s.canInsertTextAfter()&&!o.__next)){if(o.isSegmented()&&i!==0&&i!==l){if(Ie()!==null)o.setMode("normal").setFormat(e).setStyle(r);else{const d=wt(o.getTextContent());d.setFormat(e),d.setStyle(r),o.replace(d),d.select(i,i)}return void(t!==""&&this.insertText(t))}if(t==="")return;if(i===0){const d=o.getPreviousSibling();if(O(d)&&d.canInsertTextAfter()&&!_e(d))d.select();else{const h=wt();h.setFormat(e),h.setStyle(r),s.canInsertTextBefore()?o.insertBefore(h):s.insertBefore(h),h.select()}return void this.insertText(t)}if(i===l){const d=o.getNextSibling();if(O(d)&&d.canInsertTextBefore()&&!_e(d))d.select(0,0);else{const h=wt();h.setFormat(e),h.setStyle(r),s.canInsertTextAfter()?o.insertAfter(h):s.insertAfter(h),h.select(0,0)}return void this.insertText(t)}const f=wt(t);return f.setFormat(e),f.setStyle(r),o.replace(f),void f.select()}if(t==="")return;const c=s.isInline()&&i===0&&!o.__prev,a=s.isInline()&&i===l&&!o.__next,u=o.getFormat()!==e||o.getStyle()!==r;if(c||a||u){if(o.getTextContent()!==""||c||a)return void ga(this,t,e,r);o.setFormat(e),o.setStyle(r)}o.spliceText(i,0,t,!0),o.isComposing()&&this.anchor.type==="text"&&this.anchor.set(this.anchor.key,this.anchor.offset-t.length,this.anchor.type)}removeText(){const t=A()===this;oi(this,cm(gl(this))),t&&A()!==this&&gt(this)}formatText(t,e=null){Qf(this,t,e)}insertNodes(t){if(t.length===0)return;this.isCollapsed()||this.removeText();const e=this.anchor.getNode();if(this.anchor.type==="element"&&C(e)&&Wt(e)!==null){let _=e.isShadowRoot()?e.getFirstChild()??e.append(V()).getFirstChild():e.getFirstChild();if(e.isShadowRoot()&&_!==null&&!C(_)){const p=V();_.insertBefore(p),_=p}if(_!==null){_.selectStart();const p=A();return w(p)||$(369),p.insertNodes(t)}}if(this.anchor.type==="element"&&xt(e)){const _=vs(t),p=_.getLastDescendant();return e.splice(this.anchor.offset,0,_.getChildren()),void(p!==null&&p.selectEnd())}let r=(this.isBackward()?this.focus:this.anchor).getNode(),o=U(r,zt);const i=t[t.length-1];if(C(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{const _=jr(this);o.splice(_,0,t),i.selectEnd()}return}if(!t.some(_=>(C(_)||G(_))&&!_.isInline())){C(o)||$(211,r.constructor.name,r.getType());const _=jr(this);return o.splice(_,0,t),void i.selectEnd()}if(C(o)&&Wt(o)!==null){const _=jr(this),p=cl(t);o.splice(_,0,p);const m=p[p.length-1];return void(m!==void 0?m.selectEnd():o.select(_,_))}if(o===null){const _=vs(t),p=_.getLastDescendant();let m=Jt(this.anchor,"next");for(const y of _.getChildren())m=is(y,m);return void(p!==null&&p.selectEnd())}if(C(o)&&!o.isParentRequired()&&!xt(o.getParentOrThrow())){const _=jr(this),p=cl(t);o.splice(_,0,p);const m=p[p.length-1];return void(m!==void 0?m.selectEnd():o.select(_,_))}const s=vs(t),l=s.getLastDescendant(),c=s.getChildren(),a=!C(o)||!o.isEmpty()?this.insertParagraph():null;a&&!o.isAttached()&&(r=this.anchor.getNode(),o=U(r,zt));const u=c[c.length-1];let f=c[0];var d;C(d=f)&&zt(d)&&!d.isEmpty()&&C(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(C(o)||$(211,r.constructor.name,r.getType()),o.append(...f.getChildren()),f=c[1]),f&&(o===null&&$(212,r.constructor.name,r.getType()),(function(_,p){const m=p.getParentOrThrow().getLastChild();let y=p;const x=[p];for(;y!==m;)y.getNextSibling()||$(140),y=y.getNextSibling(),x.push(y);let b=_;for(const T of x)b=b.insertAfter(T)})(o,f));const h=U(l,zt);a&&C(h)&&(a.canMergeWhenEmpty()||zt(u))&&(h.append(...a.getChildren()),a.remove()),C(o)&&o.isEmpty()&&o.remove(),l.selectEnd();const g=C(o)?o.getLastChild():null;It(g)&&h!==o&&g.remove()}insertParagraph(){const t=this.anchor.getNode();if(this.anchor.type==="element"&&xt(t)){const l=V();return t.splice(this.anchor.offset,0,[l]),l.select(),l}const e=jr(this),r=U(this.anchor.getNode(),zt);if(r!==null&&Wt(r)!==null)return null;C(r)||$(213);const o=r.getChildAtIndex(e),i=o?[o,...o.getNextSiblings()]:[],s=r.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(t){const e=Ue();if(this.insertNodes([e]),t){const r=e.getParentOrThrow(),o=e.getIndexWithinParent();r.select(o,o)}}extract(){const t=[...this.getNodes()],e=t.length;let r=t[0],o=t[e-1];const[i,s]=sl(this),l=this.isBackward(),[c,a]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(e===0)return[];if(e===1){if(O(r)&&!this.isCollapsed()){const d=r.splitText(u,f),h=u===0?d[0]:d[1];return h?(c.set(h.getKey(),0,"text"),a.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(O(r)&&(u===r.getTextContentSize()?t.shift():u!==0&&([,r]=r.splitText(u),t[0]=r,c.set(r.getKey(),0,"text"))),O(o)){const d=o.getTextContent().length;f===0?t.pop():f!==d&&([o]=o.splitText(f),t[t.length-1]=o,a.set(o.getKey(),o.getTextContentSize(),"text"))}return t}modify(t,e,r){if(Ci(this,t,e,r))return;const o=t==="move",i=ft(),s=Dt(se(i));if(!s)return;const l=i._blockCursorElement,c=i._rootElement,a=this.focus.getNode();c===null||l===null||!C(a)||a.isInline()||a.canBeEmpty()||ki(l,i,c);const u=Tr(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=O(a)?pn(a,u,i):null),this.dirty){const d=Tr(i,this.anchor.key);let h=d;if(this.anchor.type==="text"){const g=this.anchor.getNode();h=O(g)?pn(g,d,i):null}h&&f&&xi(s,h,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&O(a)&&a.isUnmergeable()&&(e?this.focus.offset===0:this.focus.offset===a.getTextContentSize())){const d=et(a,e?"previous":"next").getNodeAtCaret();if(O(d)){if(!o){const h=d.getTextContentSize();return e?this.focus.set(d.__key,h-1,"text"):this.focus.set(d.__key,1,"text"),void(this.dirty=!0)}{const h=i.getElementByKey(d.getKey()),g=h?pn(d,h,i):null;if(g){const _=e?g.length:0;xi(s,g,_,g,_)}}}}if(td(s,t,e?"backward":"forward",r),s.rangeCount>0){const d=Zi(s,i._rootElement),h=d||s.getRangeAt(0),g=this.anchor.getNode(),_=Et(g)?g:$d(g);this.applyDOMRange(h),this.dirty=!0,!o&&(ed(this,e,_),(d?s.direction!=="backward":s.anchorNode===h.startContainer&&s.anchorOffset===h.startOffset)||Zf(this))}r==="lineboundary"&&Ci(this,t,e,r,"decorators")}forwardDeletion(t,e,r){if(!r&&(t.type==="element"&&C(e)&&t.offset===e.getChildrenSize()||t.type==="text"&&t.offset===e.getTextContentSize())){const o=e.getParent(),i=e.getNextSibling()||(o===null?null:o.getNextSibling());if(C(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,t))return;const i=Or(Jt(r,t?"previous":"next"));if(i.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const c of i.iterNodeCarets("shadowRoot"))if(Ht(c)){if(!c.origin.isInline()){if(c.origin.isShadowRoot()){if(l.type==="merge-block")break;if(C(i.anchor.origin)&&i.anchor.origin.isEmpty()){const a=Ut(c);oi(this,Ee(a,a)),i.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:c,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(Me(c)){if(C(c.origin)){if(c.origin.isInline()){if(!c.origin.isParentOf(i.anchor.origin))break}else l={block:c.origin,type:"merge-next-block"};continue}if(G(c.origin)){if(!c.origin.isIsolated())if(ye(c.origin).length>0){if(C(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const a=ho();a.add(c.origin.getKey()),gt(a)}}else if(l.type==="merge-next-block"&&(c.origin.isKeyboardSelectable()||!c.origin.isInline())&&C(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const a=ho();a.add(c.origin.getKey()),gt(a)}else c.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:c,block:a}=l;return ye(a).length>0?void 0:c.origin.isEmpty()&&!a.isEmpty()&&c.origin.getParent()===a.getParent()?void c.origin.remove(!0):(oi(this,Ee(!c.origin.isEmpty()&&a.isEmpty()?bn(et(a,c.direction)):i.anchor,c)),this.removeText())}for(let c=r.getNode();c!==null;){if(Wt(c)!==null)return;if(C(c)&&c.isShadowRoot())break;c=c.getParent()}}const s=this.focus;if(bs(this,t,"character"),this.isCollapsed()){if(t&&r.offset===0&&ma(this,r.getNode()))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(o)||t&&c!==a||!t&&c!==0)return void _a(l,t,c)}else if(o!==null&&o.isSegmented()){const c=r.offset,a=o.getTextContentSize();if(o.is(l)||t&&c!==0||!t&&c!==a)return void _a(o,t,c)}(function(c,a){const u=c.anchor,f=c.focus,d=u.getNode(),h=f.getNode();if(d===h&&u.type==="text"&&f.type==="text"){const g=u.offset,_=f.offset,p=g<_,m=p?g:_,y=p?_:g,x=y-1;m!==x&&(function(b){return!(Td(b)||mp(b))})(d.getTextContent().slice(m,y))&&(a?f.set(f.key,x,f.type):u.set(u.key,x,u.type))}})(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&Et(r.getParent())&&r.getPreviousSibling()===null&&ma(this,r),Xf()}}deleteLine(t){const e=ll(this.anchor);if(e!==null&&G(pe(e)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(t);this.isCollapsed()&&bs(this,t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):U(this.anchor.getNode(),zt)!==U(this.focus.getNode(),zt)?(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(t)):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,r=e.getNode();if(this.forwardDeletion(e,r,t))return;bs(this,t,"word")}this.isCollapsed()?this.deleteCharacter(t):this.removeText()}isBackward(){const t=this._cachedIsBackward;if(t!==null)return t;const e=this.focus.isBefore(this.anchor);return _n()||(this._cachedIsBackward=e),e}getStartEndPoints(){return[this.anchor,this.focus]}}function dt(n){return n instanceof Yi}function Gf(n,t){if(dt(n)){for(const m of n.getNodes())il(m)&&m.setFormat(t(m.getFormat()));return}if(n.isCollapsed())return n.setFormat(t(n.format)),void Rt(null);const e=[];for(const m of n.getNodes())O(m)?e.push(m):C(m)?m.setTextFormat(t(m.getTextFormat())):il(m)&&m.setFormat(t(m.getFormat()));const r=e.length;if(r===0)return n.setFormat(t(n.format)),void Rt(null);const o=n.anchor,i=n.focus,s=n.isBackward(),l=s?i:o,c=s?o:i;let a=0,u=e[0],f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===u.getTextContentSize()&&(a=1,u=e[1],f=0),u==null)return;const d=r-1;let h=e[d];const g=c.type==="text"?c.offset:h.getTextContentSize();if(u.is(h)){if(f===g)return;const m=t(u.getFormat());if(_e(u)||f===0&&g===u.getTextContentSize())u.setFormat(m);else{const y=u.splitText(f,g),x=f===0?y[0]:y[1];x.setFormat(m),l.type==="text"&&l.set(x.__key,0,"text"),c.type==="text"&&c.set(x.__key,g-f,"text")}return void(n.format=m)}f===0||_e(u)||([,u]=u.splitText(f),f=0);const _=t(u.getFormat());u.setFormat(_);const p=t(h.getFormat());g>0&&(g===h.getTextContentSize()||_e(h)||([h]=h.splitText(g)),h.setFormat(p));for(let m=a+1;m<d;m++){const y=e[m];y.setFormat(t(y.getFormat()))}l.type==="text"&&l.set(u.__key,f,"text"),c.type==="text"&&c.set(h.__key,g,"text"),n.format=_|p}function pp(n,t){const e=[];for(const[r,o]of Object.entries(t))typeof o=="boolean"&&e.push([r,o]);e.length!==0&&Gf(n,r=>{for(const[o,i]of e)r=Pn(r,o,i?nn[o]:0);return r})}function Qf(n,t,e=null){const r=e===null&&w(n)?Pn(n.format,t,null):e;Gf(n,o=>Pn(o,t,r))}function pa(n){const t=n.offset;if(n.type==="text")return t;const e=n.getNode();return t===e.getChildrenSize()?e.getTextContent().length:0}function sl(n){const t=n.getStartEndPoints();if(t===null)return[0,0];const[e,r]=t;return e.type==="element"&&r.type==="element"&&e.key===r.key&&e.offset===r.offset?[0,0]:[pa(e),pa(r)]}function ma(n,t){for(let e=t;e;e=e.getParent()){if(C(e)){if(e.collapseAtStart(n))return!0;if(xt(e))break}if(e.getPreviousSibling())break}return!1}function Zf(n){const t=n.focus,e=n.anchor,r=e.key,o=e.offset,i=e.type;e.set(t.key,t.offset,t.type,!0),t.set(r,o,i,!0)}function td(n,t,e,r){n.modify(t,e,r)}function ed(n,t,e){const r=n.getNodes(),o=r.filter(l=>wr(l,e));if(o.length===0||o.length===r.length)return!1;const i=t?o[0]:o[o.length-1],s=C(i)?i:i.getParentOrThrow();return t?s.selectStart():s.selectEnd(),!0}function bs(n,t,e){if(Ci(n,"extend",t,e))return;const r=ft(),o=Dt(se(r));if(!o||typeof o.modify!="function")return;const i=r._blockCursorElement,s=r._rootElement,l=n.anchor,c=n.focus.getNode();s===null||i===null||!C(c)||c.isInline()||c.canBeEmpty()||ki(i,r,s);const a=k=>{const M=k.getNode(),E=r.getElementByKey(k.key);return E!==null&&k.type==="text"&&O(M)?pn(M,E,r):E},u=l.getNode(),f=a(l);if(f===null)return;const d=l.offset,h=n.isCollapsed(),g=n.focus,_=h?f:a(g);if(_===null)return;const p=g.offset;if(xi(o,_,p,_,p),td(o,"move",t?"backward":"forward",e),o.rangeCount===0)return;const m=Zi(o,s)||o.getRangeAt(0),y=m.startContainer,x=m.startOffset;if(h&&e==="character"&&l.type==="text"&&O(u)&&u.isUnmergeable()&&d===(t?0:u.getTextContentSize())){const k=et(u,t?"previous":"next").getNodeAtCaret();if(O(k)){const M=t?k.getTextContentSize()-1:1;return n.focus.set(k.__key,M,"text"),void(n.dirty=!0)}}if(h&&e==="character"&&l.type==="text"){const k=t?0:u.getTextContentSize(),M=y===f?x:d!==k?k:-1;if(M>=0)return void(M!==d&&(n.focus.set(l.key,M,"text"),n.dirty=!0))}const[b,T,v,N]=t?[y,x,f,d]:[f,d,y,x],S=Et(u)?u:$d(u);n.applyDOMRange({collapsed:!1,endContainer:v,endOffset:N,startContainer:b,startOffset:T}),n.dirty=!0,!ed(n,t,S)&&t&&Zf(n),e==="lineboundary"&&Ci(n,"extend",t,e,"decorators")}const mp=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),t=n.test.bind(n);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch{}return()=>!1})();function _a(n,t,e){const r=n,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let a=0;a<i;a++){const u=a===i-1;if(l=s,s+=o[a].length,t&&s===e||s>e||u){o.splice(a,1),u&&(l=void 0);break}}const c=o.join("").trim();c===""?r.remove():(r.setTextContent(c),r.select(l,l))}function ya(n,t,e,r){let o,i=t,s=!1;if(B(n)){let l=!1;const c=n.childNodes,a=c.length,u=r._blockCursorElement;i===a&&a>0&&(l=!0,i=a-1),Ir(n,r)!==void 0||$i(n,r)||(s=!0);let f=c[i],d=!1;if(f===u)f=c[i+1],d=!0;else if(u!==null){const h=u.parentNode;n===h&&t>Array.prototype.indexOf.call(h.children,u)&&i--}if(o=sr(f),O(o))i=Be(o,l?"next":"previous");else{let h=sr(n);if(h===null)return null;if(C(h)){const g=r.getElementByKey(h.getKey());g===null&&$(214),[h,i]=Se(h,g,r).resolveChildIndex(h,g,n,t),C(h)||$(215),l&&i>=h.getChildrenSize()&&(i=Math.max(0,h.getChildrenSize()-1));let p=h.getChildAtIndex(i);if(C(p)&&(function(m,y,x){const b=m.getParent();return x===null||b===null||!b.canBeEmpty()||b!==x.getNode()})(p,0,e)){const m=l?p.getLastDescendant():p.getFirstDescendant();m===null?h=p:(p=m,h=C(p)?p:p.getParentOrThrow()),i=0}O(p)?(o=p,h=null,i=Be(p,l?"next":"previous")):p!==h&&l&&!d&&(C(h)||$(216),i=Math.min(h.getChildrenSize(),i+1))}else{const g=pe(h),_=g!==null?g:h,p=_.getIndexWithinParent(),m=r.getElementByKey(h.getKey());let y="after";if(m!==null&&sr(n)===h){const x=Se(h,m,r);x.element!==m?y=x.resolveLeafPosition(m,n,t):t===0&&G(h)&&(y="before")}i=y==="before"?p:p+1,h=_.getParentOrThrow()}if(C(h))return[ne(h.__key,i,"element"),s]}}else o=sr(n);return O(o)?[ne(o.__key,Be(o,i,"clamp"),"text"),s]:null}function xa(n,t,e){const r=n.offset,o=n.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(t){if((e||!t)&&i===null&&C(s)&&s.isInline()){const l=s.getPreviousSibling();O(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else C(i)&&!e&&i.isInline()?n.set(i.__key,i.getChildrenSize(),"element"):O(i)&&!o.isUnmergeable()&&n.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(t&&C(i)&&i.isInline())n.set(i.__key,0,"element");else if((e||t)&&i===null&&C(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();O(l)&&n.set(l.__key,0,"text")}}}function ll(n){const t=tt(n.key);return t===null?null:es(t)}function nd(n,t,e){const r=ll(n),o=ll(t);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=e(r,o);if(r!==null)return C(r)?t.set(r.getKey(),i?r.getChildrenSize():0,"element"):t.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=pe(o);if(s===null)return!1;const l=s.getParent();if(l===null)return!1;const c=s.getIndexWithinParent();return t.set(l.getKey(),i?c+1:c,"element"),!0}function rd(n){const t=nd(n.anchor,n.focus,(e,r)=>(function(o,i,s,l){if(s!==null&&l!==null){const u=pe(s),f=pe(l);if(u!==null&&u.is(f)){for(const d of ns(u).values()){if(d===s.getKey())return!0;if(d===l.getKey())return!1}return!0}return u===null||f===null||u.isBefore(f)}if(s!==null){const u=pe(s),f=tt(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const c=pe(l),a=tt(o.key);return c!==null&&a!==null&&!c.is(a)&&!c.isParentOf(a)&&a.isBefore(c)})(n.anchor,n.focus,e,r));return t&&(n.dirty=!0),t}function od(n,t,e,r,o,i){if(n===null||e===null||!Oo(o,n,e))return null;const s=ya(n,t,w(i)?i.anchor:null,o);if(s===null)return null;const l=ya(e,r,w(i)?i.focus:null,o);if(l===null)return null;const[c,a]=s,[u,f]=l;if(c.type==="element"&&u.type==="element"){const h=sr(n),g=sr(e);if(G(h)&&G(g))return null}const d=o._slotsUsed&&nd(c,u,()=>(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return(function(h,g){if(h.type==="text"&&g.type==="text"){const _=h.isBefore(g),p=h.is(g);xa(h,_,p),xa(g,!_,p),p&&g.set(h.key,h.offset,h.type)}})(c,u),[c,u,a||f||d]}function vr(n){return C(n)&&!n.isInline()}function id(n,t,e,r,o,i){const s=ln(),l=new Un(ne(n,t,o),ne(e,r,i),0,"");return l.dirty=!0,s._selection=l,l}function Yl(){const n=ne("root",0,"element"),t=ne("root",0,"element");return new Un(n,t,0,"")}function ho(){return new Yi(new Set)}function _p(n,t){return go(null,n,t,null)}function go(n,t,e,r){const o=e._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",c=!Hs&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let a,u,f,d;if(w(n)&&!c)return n.clone();{if(t===null)return null;const b=re(t,e._rootElement);if(a=b.anchorNode,u=b.focusNode,f=b.anchorOffset,d=b.focusOffset,(l||s===void 0)&&w(n)&&!Oo(e,a,u))return n.clone()}const h=od(a,f,u,d,e,n);if(h===null)return null;const[g,_,p]=h;let m=0,y="";if(w(n)){const b=n.anchor;if(g.key===b.key)m=n.format,y=n.style;else{const T=g.getNode();O(T)?(m=T.getFormat(),y=T.getStyle()):C(T)&&(m=T.getTextFormat(),y=T.getTextStyle())}}const x=new Un(g,_,m,y);return p&&(x.dirty=!0),x}function A(){return ln()._selection}function ce(){return ft()._editorState._selection}function kn(n,t,e,r=1){const o=n.anchor,i=n.focus,s=o.getNode(),l=i.getNode();if(!t.is(s)&&!t.is(l))return;const c=t.__key;if(n.isCollapsed()){const a=o.offset;if(e<=a&&r>0||e<a&&r<0){const u=Math.max(0,a+r);o.set(c,u,"element"),i.set(c,u,"element"),Ca(n)}}else{const a=n.isBackward(),u=a?i:o,f=u.getNode(),d=a?o:i,h=d.getNode();if(t.is(f)){const g=u.offset;(e<=g&&r>0||e<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}if(t.is(h)){const g=d.offset;(e<=g&&r>0||e<g&&r<0)&&d.set(c,Math.max(0,g+r),"element")}}Ca(n)}function Ca(n){const t=n.anchor,e=t.offset,r=n.focus,o=r.offset,i=t.getNode(),s=r.getNode();if(n.isCollapsed()){if(!C(i))return;const l=i.getChildrenSize(),c=e>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(e);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),t.set(a.__key,u,"text"),r.set(a.__key,u,"text")}return}if(C(i)){const l=i.getChildrenSize(),c=e>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(e);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),t.set(a.__key,u,"text")}}if(C(s)){const l=s.getChildrenSize(),c=o>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}function yi(n,t,e,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,O(r)?(s=r.getTextContentSize(),l="text"):C(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,O(o)?l="text":C(o)&&(l="element")),i!==null&&l!==null?n.set(i,s,l):(s=t.getIndexWithinParent(),s===-1&&(s=e.getChildrenSize()),n.set(e.__key,s,"element"))}function Sa(n,t,e,r,o){n.type==="text"?n.set(e,n.offset+(t?0:o),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function xi(n,t,e,r,o){try{n.setBaseAndExtent(t,e,r,o)}catch{}}function ba(n,t,e){const r=Tr(n,t.getKey());if(C(t)){const o=Se(t,r,n);return[o.element,e+o.getFirstChildOffset()]}return[r,e]}function yp(n,t,e,r,o,i){const s=i.getRootNode(),l=Cn(s)||je(s)?Er(s):null;if(o.has(op)&&l!==i||l!==null&&rc(l,l))return;const c=re(r,i);let a;if(!w(t))return void(n!==null&&Oo(e,c.anchorNode,c.focusNode)&&r.removeAllRanges());const u=t.anchor,f=t.focus,d=u.getNode(),h=f.getNode(),[g,_]=ba(e,d,u.offset),[p,m]=ba(e,h,f.offset),y=t.format,x=t.style,b=t.isCollapsed();let T=g,v=p,N=!1;if(u.type==="text"?(T=O(d)?pn(d,g,e):null,N=d.getFormat()!==y||d.getStyle()!==x):w(n)&&n.anchor.type==="text"&&(N=!0),f.type==="text"&&(v=O(h)?pn(h,p,e):null),T!==null&&v!==null){if(b&&(n===null||N||w(n)&&(n.format!==y||n.style!==x))&&(function(S,k,M,E,F,R){S._inputState.collapsedSelectionFormat={format:k,key:F,offset:E,style:M,timeStamp:R}})(e,y,x,_,u.key,performance.now()),(r.type!=="Range"||!b)&&c.anchorOffset===_&&c.focusOffset===m&&c.anchorNode===T&&c.focusNode===v){if(l===null||!i.contains(l)){const S=l!==null?hr(l):null;S!==null&&S!==e||o.has(ol)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(xi(r,T,_,v,m),Oe&&t.isCollapsed()&&i!==null&&!o.has(ol)){const S=_o(i);if(S===null||!i.contains(S)){const k=Er(i.ownerDocument),M=k!==null?hr(k):null;M!==null&&M!==e||i.focus({preventScroll:!0})}}if(!o.has(ip)&&t.isCollapsed()&&i!==null&&i===_o(i)){const S=w(t)&&t.anchor.type==="element"?T.childNodes[_]||null:(a===void 0&&(a=Dd(r,i)),a);if(S!==null){let k;if(ie(S)){const M=S.ownerDocument.createRange();M.selectNode(S),k=M.getBoundingClientRect()}else k=S.getBoundingClientRect();(function(M,E,F){const R=cc(F),z=ac(R);if(R===null||z===null)return;const q=F.getBoundingClientRect();if(E.bottom<q.top)return;let{top:ot,bottom:ct}=E,st=0,I=0,P=F;for(;P!==null;){const W=P===R.body;if(W){const nt=z.visualViewport;if(nt){const Mt=nt.offsetTop;st=Mt,I=Mt+nt.height}else st=0,I=se(M).innerHeight;const At=z.getComputedStyle(R.documentElement),ae=parseFloat(At.scrollPaddingTop),it=parseFloat(At.scrollPaddingBottom);isFinite(ae)&&(st+=ae),isFinite(it)&&(I-=it)}else{const nt=P===F?q:P.getBoundingClientRect();st=nt.top,I=nt.bottom}let at=0;if(ot<st?at=-(st-ot):ct>I&&(at=ct-I),at!==0)if(W)z.scrollBy(0,at);else{const nt=P.scrollTop;P.scrollTop+=at;const At=P.scrollTop-nt;ot-=At,ct-=At}if(W)break;P=jn(P)}})(e,k,i)}}(function(S){S._inputState.isSelectionChangeFromDOMUpdate=!0})(e)}}function Xl(n){let t=A()||ce();t===null&&(t=Ct().selectEnd()),t.insertNodes(n)}function sd(n,t){for(const e of n.split(/(\r?\n|\t)/))e===`
9
+ `||e===`\r
10
+ `?t.linebreak():e===" "?t.tab():e!==""&&t.text(e)}function po(n){const t=[];return sd(n,{linebreak:()=>t.push(Ue()),tab:()=>t.push(Vi()),text:e=>t.push(wt(e))}),t}function cl(n){const t=[];for(const e of n)It(e)||(!C(e)&&!G(e)||e.isInline()?t.push(e):C(e)&&t.push(...cl(e.getChildren())));return t}function jr(n){let t=n;n.isCollapsed()||t.removeText();const e=A();w(e)&&(t=e),w(t)||$(161);const r=t.anchor;let o=r.getNode(),i=r.offset;for(;!zt(o)&&Wt(o)===null;){const s=o;if([o,i]=xp(o,i),s.is(o))break}return i}function xp(n,t){const e=n.getParent();if(!e){const o=V();return Ct().append(o),o.select(),[Ct(),0]}if(O(n)){const o=n.splitText(t);if(o.length===0)return[e,n.getIndexWithinParent()];const i=t===0?0:1;return[e,o[0].getIndexWithinParent()+i]}if(!C(n)||t===0)return[e,n.getIndexWithinParent()];const r=n.getChildAtIndex(t);if(r){const o=new Un(ne(n.__key,t,"element"),ne(n.__key,t,"element"),0,""),i=n.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[e,n.getIndexWithinParent()+1]}function va(n){return It(n)||uc(n)||O(n)||n.isParentRequired()}function vs(n){const t=V();let e=null;for(let r=0;r<n.length;r++){const o=n[r];if(va(o)){if(e===null){e=o.createParentElementNode(),t.append(e);const i=n[r+1];if(It(o)&&(i===void 0||!va(i)))continue}e.append(o)}else t.append(o),e=null}return t}function Ci(n,t,e,r,o="decorators-and-blocks"){if(t==="move"&&r==="character"&&!n.isCollapsed()){const[u,f]=e===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return f.set(u.key,u.offset,u.type),!0}const i=Jt(n.focus,e?"previous":"next"),s=r==="lineboundary",l=t==="move";let c=i,a=o==="decorators-and-blocks";if(!os(c)){for(const u of c){a=!1;const{origin:f}=u;if(!G(f)||f.isIsolated()||(c=u,!s||!f.isInline()))break}if(a)for(const u of Or(i).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Ht(u))u.origin.isInline()||(c=u);else{if(C(u.origin))continue;G(u.origin)&&!u.origin.isInline()&&(c=u)}break}}if(c===i)return!1;if(l&&!s&&G(c.origin)&&c.origin.isKeyboardSelectable()){const u=ho();return u.add(c.origin.getKey()),gt(u),!0}return c=Ut(c),l&&we(n.anchor,c),we(n.focus,c),a||!s}let Lt=null,$t=null,ee=!1,Ns=!1,ei=!1;const Ts=new Set;let ni=0;const Na={characterData:!0,childList:!0,subtree:!0};function _n(){return ee||Lt!==null&&Lt._readOnly}function Pt(){ee&&$(13)}function ld(){ni>99&&$(14)}function ln(){return Lt===null&&$(195,ad()),Lt}function Cp(n){ln()!==null&&$t===null&&($t=n),$t!==n&&ef(378)}function ft(){return $t===null&&$(337,ad()),$t}function cd(){ft()._dirtyType=2}function ad(){let n=0;const t=new Set,e=Nr.version;if(typeof window<"u")for(const o of Md(document)){const i=Lr(o);if(Ao(i))n++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===e&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${e}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function ud(){return $t}function Ta(n,t,e){const r=t.__type,o=xd(n,r);let i=e.get(r);i===void 0&&(i=Array.from(o.transforms),e.set(r,i));const s=i.length;for(let l=0;l<s&&(i[l](t),t.isAttached());l++);}function ka(n,t){return n!==void 0&&n.__key!==t&&n.isAttached()}function fd(n,t){if(!t)return;const e=n._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const o of r)e.add(o)}function Sp(n){return Si(n,ft()._nodes)}function Si(n,t){const e=n.type,r=t.get(e);r===void 0&&$(17,e);const o=r.klass;n.type!==o.getType()&&$(18,o.name);const i=o.importJSON(n),s=n.children;if(C(i)&&Array.isArray(s))for(let c=0;c<s.length;c++){const a=Si(s[c],t);i.append(a)}const l=n.$slots;if(l){tn(i)||$(379,o.name);for(const c in l)Wd(i,c,Si(l[c],t))}return i}function wa(n,t,e){const r=Lt,o=ee,i=$t;Lt=t,ee=!0,$t=n;try{return e()}finally{Lt=r,ee=o,$t=i}}function un(n,t){const e=ei;ei=!0;try{(function(r,o){const i=r._pendingEditorState,s=r._rootElement,l=r._headless||s===null;if(i===null)return void(!r._updating&&r._deferred.length>0&&Ea(r,r._deferred));const c=r._editorState,a=c._selection,u=i._selection,f=r._dirtyType!==0,d=Lt,h=ee,g=$t,_=r._updating,p=r._observer;let m=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&p!==null){$t=r,Lt=i,ee=!1,r._updating=!0;try{const S=r._dirtyType,k=r._dirtyElements,M=r._dirtyLeaves;p.disconnect(),m=zg(c,i,r,S,k,M)}catch(S){if(S instanceof Error&&r._onError(S),Ns)throw S;return _d(r,null,s,i),hf(r),r._dirtyType=2,Ns=!0,un(r,c),void(Ns=!1)}finally{p.observe(s,Na),r._updating=_,Lt=d,ee=h,$t=g}}i._readOnly||(i._readOnly=!0);const y=r._dirtyLeaves,x=r._dirtyElements,b=r._normalizedNodes,T=r._updateTags;f&&(r._dirtyType=0,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set),r._updateTags=new Set,(function(S,k){const M=S._decorators;let E=S._pendingDecorators||M;const F=k._nodeMap;let R;for(R in E)F.has(R)||(E===M&&(E=Nd(S)),delete E[R])})(r,i);const v=l?null:Dt(se(r));if(r._editable&&v!==null&&(f||u===null||u.dirty||!u.is(a))&&s!==null&&!T.has(sp)){$t=r,Lt=i;try{if(p!==null&&p.disconnect(),f||u===null||u.dirty){const S=r._blockCursorElement;S!==null&&ki(S,r,s),yp(a,u,r,v,T,s)}(function(S,k,M){let E=S._blockCursorElement;if(w(M)&&M.isCollapsed()&&M.anchor.type==="element"&&k.contains(_o(k))){const F=M.anchor,R=F.getNode(),z=F.offset;let q=!1,ot=null;if(z===R.getChildrenSize())ri(R.getChildAtIndex(z-1))&&(q=!0);else{const ct=R.getChildAtIndex(z);if(ct!==null&&ri(ct)){const st=ct.getPreviousSibling();(st===null||ri(st))&&(q=!0,ot=S.getElementByKey(ct.__key))}}if(q){const ct=Se(R,S.getElementByKey(R.__key),S).element;return E===null&&(S._blockCursorElement=E=(function(st){const I=st.theme,P=Z().createElement("div");P.contentEditable="false",P.setAttribute("data-lexical-cursor","true");let W=I.blockCursor;if(W!==void 0){if(typeof W=="string"){const at=en(W);W=I.blockCursor=at}W!==void 0&&P.classList.add(...W)}return P})(S._config)),k.style.caretColor="transparent",void(ot===null?ct.appendChild(E):ct.insertBefore(E,ot))}}E!==null&&ki(E,S,k)})(r,s,u)}finally{p!==null&&p.observe(s,Na),$t=g,Lt=d}}m!==null&&(function(S,k,M,E,F){const R=Array.from(S._listeners.mutation),z=R.length;for(let q=0;q<z;q++){const[ot,ct]=R[q];for(const st of ct){const I=k.get(st);I!==void 0&&ot(I,{dirtyLeaves:E,prevEditorState:F,updateTags:M})}}})(r,m,T,y,c),w(u)||u===null||a!==null&&a.is(u)||r.dispatchCommand(Re);const N=r._pendingDecorators;N!==null&&(r._decorators=N,r._pendingDecorators=null,ro("decorator",r,!0,N)),(function(S,k,M){const E=Aa(k),F=Aa(M);E!==F&&ro("textcontent",S,!0,F)})(r,o||c,i),ro("update",r,!0,{dirtyElements:x,dirtyLeaves:y,editorState:i,mutatedNodes:m,normalizedNodes:b,prevEditorState:o||c,tags:T}),!_&&Ea(r,r._deferred),(function(S){const k=S._updates;if(k.length===0)return void(S._cascadeCount=0);if((function(E){Ts.has(E)||(Ts.add(E),setTimeout(()=>{Ts.delete(E),E._cascadeCount=0},0))})(S),S._cascadeCount++>99)return S._updates=[],S._cascadeCount=0,void S._onWarn(new Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${S._config.namespace}`));const M=k.shift();if(M){const[E,F]=M;mo(S,E,F)}})(r)})(n,t)}finally{ei=e}}function ro(n,t,e,...r){const o=t._updating;t._updating=e;try{const i=t._listeners[n],s=Array.from(i);for(const[l,c]of s){c&&c();const a=l(...r);i.has(l)?i.set(l,a):a&&a()}}finally{t._updating=o}}function dd(n,t,e,r){const o=oc(n);let i;if(!ei)for(let s=0;s<o.length;s++)o[s]._updating||(o[s]._cascadeCount=0);for(let s=4;s>=0;s--)for(let l=0;l<o.length;l++){const c=o[l];if(l>0&&c._updating){i=c;break}const a=c._commands.get(t);if(a!==void 0){const u=a[s];if(u.size>0){let f=!1;if(me(c,()=>{for(const d of u)if(d(e,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{dd(i,t,e,r)}),!1}function Ea(n,t){if(n._deferred=[],t.length!==0){const e=n._updating;n._updating=!0;try{for(let r=0;r<t.length;r++)t[r]()}finally{n._updating=e}}}function $a(n,t){const e=n._updates;let r=t||!1;for(;e.length!==0;){const o=e.shift();if(o){const[i,s]=o,l=n._pendingEditorState;let c;s!==void 0&&(c=s.onUpdate,s.skipTransforms&&(r=!0),s.discrete&&(l===null&&$(191),l._flushSync=!0),c&&n._deferred.push(c),fd(n,s.tag)),l==null?mo(n,i,s):i()}}return r}function mo(n,t,e){const r=n._updateTags;let o,i=!1,s=!1;e!==void 0&&(o=e.onUpdate,fd(n,e.tag),i=e.skipTransforms||!1,s=e.discrete||!1),o&&n._deferred.push(o);const l=n._editorState;let c=n._pendingEditorState,a=!1;(c===null||c._readOnly)&&(c=n._pendingEditorState=hd(c||l),a=!0),c._flushSync=s;const u=Lt,f=ee,d=$t,h=n._updating;Lt=c,ee=!1,n._updating=!0,$t=n;const g=n._headless||n.getRootElement()===null;tc(null);try{a&&(g?l._selection!==null&&(c._selection=l._selection.clone()):c._selection=(function(y,x){const b=y.getEditorState()._selection,T=Dt(se(y));return w(b)||b==null?go(b,T,y,x):b.clone()})(n,e&&e.event||null));const p=n._compositionKey;t(),i=$a(n,i),(function(y,x){const b=x.getEditorState()._selection,T=y._selection;if(w(T)){const v=T.anchor,N=T.focus;let S;if(v.type==="text"&&(S=v.getNode(),S.selectionTransform(b,T)),N.type==="text"){const k=N.getNode();S!==k&&k.selectionTransform(b,T)}}})(c,n),n._dirtyType!==0&&(i?(function(y,x){const b=x._dirtyLeaves,T=y._nodeMap;for(const v of b){const N=T.get(v);O(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&qc(N)}})(c,n):(function(y,x){const b=x._dirtyLeaves,T=x._dirtyElements,v=y._nodeMap,N=Ie(),S=new Map;let k=b,M=k.size,E=T,F=E.size;for(;M>0||F>0;){if(M>0){x._dirtyLeaves=new Set;for(const R of k){const z=v.get(R);O(z)&&z.isAttached()&&z.isSimpleText()&&!z.isUnmergeable()&&qc(z),z!==void 0&&ka(z,N)&&Ta(x,z,S),b.add(R)}if(k=x._dirtyLeaves,M=k.size,M>0){ni++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,E.delete("root")&&E.set("root",!0);for(const R of E){const z=R[0],q=R[1];if(T.set(z,q),!q)continue;const ot=v.get(z);ot!==void 0&&ka(ot,N)&&Ta(x,ot,S)}k=x._dirtyLeaves,M=k.size,E=x._dirtyElements,F=E.size,ni++}x._dirtyLeaves=b,x._dirtyElements=T})(c,n),$a(n),(function(y,x,b,T){const v=y._nodeMap,N=x._nodeMap,S=[];for(const[E]of T){const F=N.get(E);F!==void 0&&(F.isAttached()||(C(F)&&ui(F,E,v,N,S,T),v.has(E)||T.delete(E),S.push(E)))}for(const E of b){const F=N.get(E);F===void 0||F.isAttached()||(tn(F)&&F.__slots!==null&&ui(F,E,v,N,S,b),v.has(E)||b.delete(E),S.push(E))}for(const E of S)N.delete(E);const k=ft(),M=k._compositionKey;M===null||N.has(M)||(k._compositionKey=null)})(l,c,n._dirtyLeaves,n._dirtyElements)),p!==n._compositionKey&&(c._flushSync=!0);const m=c._selection;if(w(m)){n._slotsUsed&&rd(m);const y=c._nodeMap,x=m.anchor.key,b=m.focus.key;y.get(x)!==void 0&&y.get(b)!==void 0||$(19)}else dt(m)&&m._nodes.size===0&&(c._selection=null)}catch(p){return p instanceof Error&&n._onError(p),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void un(n)}finally{Lt=u,ee=f,$t=d,n._updating=h,ni=0}n._dirtyType!==0||n._deferred.length>0||(function(p,m){const y=m.getEditorState()._selection,x=p._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(c,n)?c._flushSync?(c._flushSync=!1,un(n)):a&&Ap(()=>{un(n)}):(c._flushSync=!1,a&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function me(n,t,e){$t===n&&e===void 0?_n()?mo(n,t,e):t():mo(n,t,e)}function bp(n){if(xt(n)){let t=null;for(const e of n.getChildren())t=e.isInline()?(t||e.replace(e.createParentElementNode())).append(e):null}}class bt extends Zt{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for("ElementNode"),{$transform:bp,extends:Zt})}constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="",this.__slotHost=null,this.__slots=null}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size,this.__slotHost=t.__slotHost,this.__slotHost!==null&&this.__parent!==null&&$(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=t.__slots),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return Tg[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;e!==null;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;e!==null;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&ye(this).length===0}isDirty(){const t=ft()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return e!==null&&e.is(t)}getAllTextNodes(){const t=[];for(const r of ye(this)){const o=In(this,r);C(o)&&t.push(...o.getAllTextNodes())}let e=this.getFirstChild();for(;e!==null;){if(O(e)&&t.push(e),C(e)){const r=e.getAllTextNodes();t.push(...r)}e=e.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;C(t);){const e=t.getFirstChild();if(e===null)break;t=e}return t}getLastDescendant(){let t=this.getLastChild();for(;C(t);){const e=t.getLastChild();if(e===null)break;t=e}return t}getDescendantByIndex(t){const e=this.getChildren(),r=e.length;if(t>=r){const i=e[r-1];return C(i)&&i.getLastDescendant()||i||null}const o=e[t];return C(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:tt(t)}getFirstChildOrThrow(){const t=this.getFirstChild();return t===null&&$(45,this.__key),t}getLastChild(){const t=this.getLatest().__last;return t===null?null:tt(t)}getLastChildOrThrow(){const t=this.getLastChild();return t===null&&$(96,this.__key),t}getChildAtIndex(t){const e=this.getChildrenSize();let r,o;if(t<e/2){for(r=this.getFirstChild(),o=0;r!==null&&o<=t;){if(o===t)return r;r=r.getNextSibling(),o++}return null}for(r=this.getLastChild(),o=e-1;r!==null&&o>=t;){if(o===t)return r;r=r.getPreviousSibling(),o--}return null}getTextContent(){let t=Bd(this);const e=this.getChildren(),r=e.length;for(let o=0;o<r;o++){const i=e[o];t+=i.getTextContent(),C(i)&&o!==r-1&&!i.isInline()&&(t+=En)}return t}getTextContentSize(){let t=(function(o){let i=0;for(const s of ye(o)){const l=In(o,s);l!==null&&(i+=l.getTextContentSize())}return i})(this);const e=this.getChildren(),r=e.length;for(let o=0;o<r;o++){const i=e[o];t+=i.getTextContentSize(),C(i)&&o!==r-1&&!i.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){const e=ai[t];return(this.getFormat()&e)!==0}return!1}hasTextFormat(t){const e=nn[t];return(this.getTextFormat()&e)!==0}getFormatFlags(t,e){return Pn(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Pt();const r=A();let o=t,i=e;const s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&e===0){const c=this.getFirstChild();if(O(c)||C(c))return c.select(0,0)}else if(!(t!==void 0&&t!==s||e!==void 0&&e!==s)){const c=this.getLastChild();if(O(c)||C(c))return c.select()}}o===void 0&&(o=s),i===void 0&&(i=s);const l=this.__key;return w(r)?(r.anchor.set(l,o,"element"),r.focus.set(l,i,"element"),r.dirty=!0,r):id(l,o,l,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(e=>e.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=t!==""&&ai[t]||0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(t,e,r){pi(this)&&$(324,this.__key,this.__type);const o=this.getChildrenSize(),i=this.getWritable();t+e<=o||$(226,String(t),String(e),String(o));for(const h of r);const s=i.__key,l=[],c=[],a=this.getChildAtIndex(t+e);let u=null,f=o-e+r.length;if(t!==0)if(t===o)u=this.getLastChild();else{const h=this.getChildAtIndex(t);h!==null&&(u=h.getPreviousSibling())}if(e>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<e;g++){h===null&&$(100);const _=h.getNextSibling(),p=h.__key;Le(h.getWritable()),c.push(p),h=_}}let d=u;for(const h of r){d!==null&&h.is(d)&&(u=d=d.getPreviousSibling());const g=h.getWritable();g.__parent===s&&f--,Le(g);const _=h.__key;if(d===null)i.__first=_,g.__prev=null;else{const p=d.getWritable();p.__next=_,g.__prev=p.__key}h.__key===s&&$(76),g.__parent=s,l.push(_),d=h}if(t+e===o)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(a!==null){const h=a.getWritable();if(d!==null){const g=d.getWritable();h.__prev=d.__key,g.__next=a.__key}else h.__prev=null}if(i.__size=f,c.length){const h=A();if(w(h)){const g=new Set(c),_=new Set(l),{anchor:p,focus:m}=h;Oa(p,g,_)&&yi(p,p.getNode(),this,u,a),Oa(m,g,_)&&yi(m,m.getNode(),this,u,a),f!==0||this.canBeEmpty()||xt(this)||this.remove()}}return i}getDOMSlot(t){return new sf(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(B(e)){const r=this.getIndent();r>0&&(e.style.paddingInlineStart=40*r+"px",e.setAttribute("data-lexical-indent",String(r)));const o=this.getDirection();o&&(e.dir=o)}return{element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),r=this.getTextStyle();return e===0&&r===""||xt(this)||this.getChildren().some(O)||(e!==0&&(t.textFormat=e),r!==""&&(t.textStyle=r)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,e,r){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,e){const r=Se(this,t,e);let o=r.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const s=e.getElementByKey(i.getKey());s!==null&&(o==null?(r.insertChild(s),o=s):o!==s&&r.replaceChild(s,o),o=o.nextSibling)}}}function C(n){return n instanceof bt}function Oa(n,t,e){let r=n.getNode();for(;r;){const o=r.__key;if(t.has(o)&&!e.has(o))return!0;r=r.getParent()}return!1}class Gl extends Zt{__slotHost;__slots;constructor(t){super(t),this.__slotHost=null,this.__slots=null}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__slotHost=t.__slotHost,this.__slotHost!==null&&this.__parent!==null&&$(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=t.__slots)}decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function G(n){return n instanceof Gl}class Xi extends bt{__cachedText;$config(){return this.config("root",{extends:bt})}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const t=this.__cachedText;return t===null||!_n()&&ft()._dirtyType!==0?super.getTextContent():t}remove(){$(52)}replace(t){$(53)}insertBefore(t){$(54)}insertAfter(t){$(55)}updateDOM(t,e){return!1}splice(t,e,r){for(const o of r)C(o)||G(o)||$(282);return super.splice(t,e,r)}static importJSON(t){return Ct().updateFromJSON(t)}collapseAtStart(){return!0}}function Et(n){return n instanceof Xi}function hd(n){return new $o(af(n._nodeMap),null,n._slotsUsed)}function Ql(){return new $o(new Map([["root",new Xi]]),null,!1)}function al(n){const t=n.exportJSON(),e=n.constructor;if(t.type!==e.getType()&&$(130,e.name),C(n)){const o=t.children;Array.isArray(o)||$(59,e.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const l=al(i[s]);o.push(l)}}const r=ye(n);if(r.length>0){const o={};for(const i of r){const s=In(n,i);s===null&&$(366,e.name,i),o[i]=al(s)}t.$slots=o}return t}function vp(n){return n instanceof $o}class $o{_nodeMap;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(t,e=null,r=!1){this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=r}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,e){return wa(e&&e.editor||null,this,t)}clone(t){const e=new $o(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return e._readOnly=!0,e}toJSON(){return wa(null,this,()=>({root:al(Ct())}))}}class Zl extends bt{$config(){return this.config("artificial",{extends:bt})}createDOM(t){return Z().createElement("div")}}class Gi extends Zt{$config(){return this.config("linebreak",{importDOM:{br:t=>gd(t)||pd(t)?null:{conversion:Np,priority:0}}})}getTextContent(){return`
11
+ `}createDOM(){return Z().createElement("br")}updateDOM(){return!1}isInline(){return!0}}function Np(n){return{node:Ue()}}function Ue(){return Gt(new Gi)}function It(n){return n instanceof Gi}function gd(n){const t=n.parentElement;if(t!==null&&$r(t)){const e=t.firstChild;if(e===n||e.nextSibling===n&&bi(e)){const r=t.lastChild;if(r===n||r.previousSibling===n&&bi(r))return!0}}return!1}function pd(n){const t=n.parentElement;if(t!==null&&$r(t)){const e=t.firstChild;if(e===n||e.nextSibling===n&&bi(e))return!1;const r=t.lastChild;if(r===n||r.previousSibling===n&&bi(r))return!0}return!1}function bi(n){return ie(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}class Qi extends bt{$config(){return this.config("paragraph",{extends:bt,importDOM:{p:()=>({conversion:Tp,priority:0})}})}createDOM(t){const e=Z().createElement("p"),r=gr(t.theme,"paragraph");return r!==void 0&&e.classList.add(...r),e}updateDOM(t,e,r){return!1}exportDOM(t){const{element:e}=super.exportDOM(t);if(B(e)){this.isEmpty()&&e.append(Z().createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r)}return{element:e}}exportJSON(){const t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){const e=this.getChildren().find(O);e?(t.textFormat=e.getFormat(),t.textStyle=e.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,e){const r=V();r.setTextFormat(t.format),r.setTextStyle(t.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,e),r}collapseAtStart(){const t=this.getChildren();if(t.length===0||O(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Tp(n){const t=V();if(Je(t,n),Hn(n,t),t.getFormatType()===""){const e=n.getAttribute("align");e&&e&&e in ai&&t.setFormat(e)}return be(t,n),{node:t}}function V(){return Gt(new Qi)}function cn(n){return n instanceof Qi}function kp(n){console.warn(n)}const X=0,he=1,fe=3,md=4,wp=-8;function _d(n,t,e,r,o){const i=n._keyToDOMMap;i.clear(),n._editorState=Ql(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(n._updateTags=new Set,n._updates=[],n._cascadeCount=0),n._blockCursorElement=null,n._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(n._inputState.handledSelectionCommandTimeoutId),n._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),t!==null&&(t.textContent="",(function(l,c){const a=`__lexicalKey_${c._key}`;delete l[a]})(t,n)),e!==null&&(e.textContent="",i.set("root",e),vd(e,n,"root"))}function Ep(n){const t=new Set,e=new Set;for(const{klass:r,ownNodeConfig:o}of dc(n)){const i=r.transform;if(!e.has(i)){e.add(i);const s=r.transform();s&&t.add(s)}if(o){const s=o.$transform;s&&t.add(s)}}return t}const vi={$createDOM:(n,t)=>n.createDOM(t._config,t),$decorateDOM:(n,t,e,r)=>{},$exportDOM:(n,t)=>{const e=nc(t,n.getType());return e&&e.exportDOM!==void 0?e.exportDOM(t,n):n.exportDOM(t)},$extractWithChild:(n,t,e,r,o)=>C(n)&&n.extractWithChild(t,e,r),$getDOMSlot:(n,t,e)=>n.getDOMSlot(t),$getSlotTargetElement:(n,t,e,r)=>null,$shouldExclude:(n,t,e)=>C(n)&&n.excludeFromCopy("html"),$shouldInclude:(n,t,e)=>!t||n.isSelected(t),$updateDOM:(n,t,e,r)=>n.updateDOM(t,e,r._config)};function yd(n){const t=n||{},e=ud(),r=t.theme||{},o=n===void 0?e:t.parentEditor||null,i=t.disableEvents||!1,s=Ql(),l=t.namespace||(o!==null?o._config.namespace:kd()),c=t.editorState,a=[Xi,rn,Gi,qi,Qi,Zl,...t.nodes||[]],{onError:u,onWarn:f,html:d}=t,h=t.editable===void 0||t.editable;let g;if(n===void 0&&e!==null)g=e._nodes;else{g=new Map;for(let p=0;p<a.length;p++){let m=a[p],y=null,x=null;if(m&&typeof m=="object"){const v=m;m=v.replace,y=v.with,x=v.withKlass||null}if(typeof m!="function"||!m.prototype||!(m===Zt||m.prototype instanceof Zt)){let v="<unknown>";try{v=JSON.parse(cf)}catch{}$(365,String(p-a.length+(t.nodes?t.nodes.length:0)),typeof m=="function"?`${m.name}${typeof m.getType=="function"?` (type ${String(m.getType())})`:""}`:String(m),String(v))}fc(m);const b=m.getType(),T=Ep(m);g.set(b,{exportDOM:d&&d.export?d.export.get(m):void 0,klass:m,replace:y,replaceWithKlass:x,sharedNodeState:Dg(a[p]),transforms:T})}}const _=new Nr(s,o,g,{disableEvents:i,dom:{...vi,...n&&n.dom},namespace:l,theme:r},u||console.error,f||kp,(function(p,m){const y=new Map,x=new Set,b=T=>{Object.keys(T).forEach(v=>{let N=y.get(v);N===void 0&&(N=[],y.set(v,N)),N.push(T[v])})};return p.forEach(T=>{const v=T.klass.importDOM;if(v==null||x.has(v))return;x.add(v);const N=v.call(T.klass);N!==null&&b(N)}),m&&b(m),y})(g,d?d.import:void 0),h,n);return c!==void 0&&(_._pendingEditorState=c,_._dirtyType=2),(function(p){p.registerCommand(kf,Gg,X),p.registerCommand(wf,Qg,X),p.registerCommand(Ef,Zg,X),p.registerCommand($f,tp,X),p.registerCommand(Kl,ep,X)})(_),_}function $p(n,t){const e=n.get(t);n.delete(t),e&&e()}function Hr(n,t,e){return n.set(t,e),$p.bind(null,n,t)}class Nr{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_inputState;_createEditorArgs;constructor(t,e,r,o,i,s,l,c,a){this._createEditorArgs=a,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new js,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=kd(),this._onError=i,this._onWarn=s,this._htmlConversions=l,this._editable=c,this._headless=e!==null&&e._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){return Hr(this._listeners.update,t)}registerEditableListener(t){return Hr(this._listeners.editable,t)}registerDecoratorListener(t){return Hr(this._listeners.decorator,t)}registerTextContentListener(t){return Hr(this._listeners.textcontent,t)}registerRootListener(t){const e=this._listeners.root;return qt(Hr(e,t,t(this._rootElement,null)||void 0),()=>(function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)})(e,t,[null,this._rootElement]))}registerCommand(t,e,r){r===void 0&&$(35);const o=this._commands;o.has(t)||o.set(t,[new Ur,new Ur,new Ur,new Ur,new Ur]);const i=o.get(t);i===void 0&&$(36,String(t));const s=(function(c){return 7&c})(r),l=i[s];return s!==r?l.addFront(e):l.addBack(e),()=>{l.delete(e),i.every(c=>c.size===0)&&o.delete(t)}}registerMutationListener(t,e,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let s=i.get(e);s===void 0&&(s=new Set,i.set(e,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(e,o),()=>{s.delete(o),s.size===0&&i.delete(e)}}getRegisteredNode(t){const e=this._nodes.get(t.getType());return e===void 0&&$(37,t.name),e}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const r=this._editorState,o=La(r).get(e.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const r=this.getRegisteredNode(t);return r.transforms.add(e),r}registerNodeTransform(t,e){const r=this.registerNodeTransformToKlass(t,e),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,e);o.push(s)}return(function(s,l){const c=La(s.getEditorState()),a=[];for(const u of l){const f=c.get(u);f&&a.push(f)}a.length!==0&&s.update(()=>{for(const u of a)for(const f of u.keys()){const d=tt(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:dr}:void 0)})(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(e))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,...e){return D(this,t,...e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const r=gr(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=t,_d(this,e,t,o,{preserveUpdateQueue:!0}),e!==null&&(this._config.disableEvents||np(e),r!=null&&e.classList.remove(...r)),t!==null){const i=ac(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,hf(this),this._updateTags.add(dr),un(this),this._config.disableEvents||(function(l,c){const a=l.ownerDocument;el.set(l,a);let u=hi.get(a);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},hi.set(a,u)),u.editors.add(c),u.hasShadowEditor=void 0,l.__lexicalEditor=c;const f=Wf(l);f.push(Xg.register(a));for(let d=0;d<tl.length;d++){const[h,g]=tl[d],_=typeof g=="function"?p=>{la(p)||(sa(p),(c.isEditable()||h==="click")&&g(p,c))}:p=>{if(la(p))return;sa(p);const m=c.isEditable();switch(h){case"cut":return m&&D(c,Ji,p);case"copy":return D(c,Eo,p);case"paste":return m&&D(c,Rr,p);case"dragstart":return m&&D(c,Pf,p);case"dragover":return m&&D(c,Rf,p);case"dragend":return m&&D(c,jg,p);case"focus":return m&&D(c,Lf,p);case"blur":return m&&D(c,qg,p);case"drop":return m&&D(c,Ff,p)}};f.push(no(l,h,_))}})(t,this),r!=null&&t.classList.add(...r)}else this._window=null,this._updateTags.add(dr),un(this);ro("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,e){t.isEmpty()&&$(38);let r=t;r._readOnly&&(r=hd(t),r._selection=t._selection?t._selection.clone():null),df(this);const o=this._pendingEditorState,i=e!==void 0?e.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),un(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||t._slotsUsed,me(this,()=>{if(i&&this._updateTags.add(i),t._parsed)for(const[s,l]of r._nodeMap.entries())C(l)?this._dirtyElements.set(s,!0):this._dirtyLeaves.add(s)},{discrete:!this._updating||void 0})}parseEditorState(t,e){return(function(r,o,i){const s=Ql(),l=Lt,c=ee,a=$t,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Lt=s,ee=!1,$t=o,tc(null);try{const g=o._nodes;Si(r.root,g),i&&i(),s._readOnly=!0,s._parsed=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=h,Lt=l,ee=c,$t=a}return s})(typeof t=="string"?JSON.parse(t):t,this,e)}read(...t){const[e,r]=t.length===1?["force-commit",t[0]]:t;return e==="force-commit"&&un(this),(e==="pending"?this._pendingEditorState||this._editorState:this.getEditorState()).read(r,{editor:this})}update(t,e){(function(r,o,i){r._updating?r._updates.push([o,i]):mo(r,o,i)})(this,t,e)}focus(t,e={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),me(this,()=>{const o=A(),i=Ct();o!==null?o.dirty||gt(o.clone()):i.getChildrenSize()!==0&&(e.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),kr("focus"),Rp(()=>{r.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;t!==null&&t.blur();const e=Dt(this._window);e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,ro("editable",this,!0,t),this._slotsUsed&&this.update(()=>cd()))}toJSON(){return{editorState:this._editorState.toJSON()}}}Nr.version=cf;let ul=null;function tc(n){ul=n}const ec=Symbol("INTERNAL_SKIP_AFTER_CLONE_FROM");let Op=1;function xd(n,t){const e=nc(n,t);return e===void 0&&$(30,t),e}function nc(n,t){return n._nodes.get(t)}const Ap=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function rc(n,t){const e=t!==void 0?t:(()=>{const i=n.getRootNode();return Cn(i)||je(i)?Er(i):null})();if(!B(e)||e.hasAttribute("data-lexical-slot"))return!1;const r=Xt(e),o=e.nodeName;return jf(r)&&(o==="INPUT"||o==="TEXTAREA"||e.contentEditable==="true"&&Lr(e)==null)}function Oo(n,t,e){const r=n.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(e))return!1}catch{return!1}return hr(t)===n&&n.read("latest",()=>!rc(t))}function Ao(n){return n instanceof Nr}function hr(n){let t=n;for(;t!=null;){const e=Lr(t);if(Ao(e))return e;t=jn(t)}return null}function Lr(n){return n?n.__lexicalEditor:null}function Ni(n){return br(n)||n.isToken()}function _e(n){return Ni(n)||n.isSegmented()}function ie(n){return Ae(n)&&n.nodeType===3}function Cn(n){return Ae(n)&&n.nodeType===9}function Mp(n){let t=n;for(;t!=null;){if(ie(t))return t;t=t.firstChild}return null}function Pn(n,t,e){const r=nn[t];if(e!==null&&(n&r)===(e&r))return n;let o=n^r;return t==="subscript"?o&=-65:t==="superscript"?o&=-33:t==="lowercase"?(o&=-513,o&=-1025):t==="uppercase"?(o&=-257,o&=-1025):t==="capitalize"&&(o&=-257,o&=-513),o}function Cd(n){return O(n)||It(n)||G(n)}function Sd(n,t){const e=(function(){const s=ul;return ul=null,s})();if((t=t||e&&e.__key)!=null)return void(n.__key=t);Pt(),ld();const r=ft(),o=ln(),i=""+Op++;o._nodeMap.set(i,n),C(n)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),n.__key=i}function Le(n){Wt(n)!==null&&$(380,n.__key,String(Wt(n)));const t=n.getParent();if(t!==null){const e=n.getWritable(),r=t.getWritable(),o=n.getPreviousSibling(),i=n.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,c=o!==null?o.getWritable():null,a=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),c!==null&&(c.__next=s),a!==null&&(a.__prev=l),e.__prev=null,e.__next=null,e.__parent=null,r.__size--}}function Ti(n){ld(),pi(n)&&$(323,n.__key,n.__type);const t=n.getLatest(),e=t.__parent!==null?t.__parent:Ln(t)?t.__slotHost:null,r=ln(),o=ft(),i=r._nodeMap,s=o._dirtyElements;e!==null&&(function(c,a,u){let f=c;for(;f!==null;){if(u.has(f))return;const d=a.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent!==null?d.__parent:Ln(d)?d.__slotHost:null}})(e,i,s);const l=t.__key;o._dirtyType===0&&(o._dirtyType=1),C(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function Rt(n){Pt();const t=ft(),e=t._compositionKey;if(n!==e){if(t._compositionKey=n,e!==null){const r=tt(e);r!==null&&r.getWritable()}if(n!==null){const r=tt(n);r!==null&&r.getWritable()}}}function Ie(){return _n()?null:ft()._compositionKey}function tt(n,t){const e=(t||ln())._nodeMap.get(n);return e===void 0?null:e}function bd(n,t){const e=Ir(n,ft());return e!==void 0?tt(e,t):null}function vd(n,t,e){n[`__lexicalKey_${t._key}`]=e}function Ir(n,t){return n[`__lexicalKey_${t._key}`]}function Xt(n,t){let e=n;for(;e!=null;){const r=bd(e,t);if(r!==null)return r;e=jn(e)}return null}function Nd(n){const t=n._decorators,e=Object.assign({},t);return n._pendingDecorators=e,e}function Aa(n){return n.read(()=>Ct().getTextContent())}function Ct(){return ln()._nodeMap.get("root")}function gt(n){Pt();const t=ln();n!==null&&(n.dirty=!0,n.setCachedNodes(null),w(n)&&ft()._slotsUsed&&rd(n)),t._selection=n}function Ma(){Pt(),df(ft())}function sr(n){const t=(function(e,r){let o=e;for(;o!=null;){const i=Ir(o,r);if(i!==void 0)return i;o=jn(o)}return null})(n,ft());return t===null?null:tt(t)}function Td(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function oc(n){const t=[];for(let e=n;e!==null;e=e._parentEditor)t.push(e);return t}function kd(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function wd(n){return ie(n)?n.nodeValue:null}function ic(n,t,e){const r=Dt(se(t));if(r===null)return;const o=re(r,t._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let c=wd(i);const a=Xt(i);if(c!==null&&O(a)){if((c===so||c===Ll)&&e){const u=e.length;c=e,s=u,l=u}c!==null&&sc(a,c,s,l,n)}}}function sc(n,t,e,r,o){let i=n;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();if(i.isToken()&&s)return;let l=t;if((s||o)&&(t.endsWith(so)&&(l=t.slice(0,-so.length)),o)){const a=Ll;let u;for(;(u=l.indexOf(a))!==-1;)l=l.slice(0,u)+l.slice(u+a.length),e!==null&&e>u&&(e=Math.max(u,e-a.length)),r!==null&&r>u&&(r=Math.max(u,r-a.length))}const c=i.getTextContent();if(o||l!==c){const a=A();if(l===""){if(Rt(null),No||mn||To)i.remove();else{const _=ft();ks(i,"",a),setTimeout(()=>{_.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=ce(),d=i.getTextContentSize(),h=Ie(),g=i.getKey();if(i.isToken()&&!s||h!==null&&g===h&&!s||w(f)&&(u!==null&&!u.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===d&&!i.canInsertTextAfter()&&!s))return void i.markDirty();if(!w(a)||e===null||r===null)return void ks(i,l,a);if(a.setTextNodeRange(i,e,i,r),i.isSegmented()){const _=wt(i.getTextContent());i.replace(_),i=_}ks(i,l,a)}}}function ks(n,t,e){if(n.setTextContent(t),w(e)){const r=n.getKey();let o=!1;for(const i of["anchor","focus"]){const s=e[i];s.type==="text"&&s.key===r&&(s.offset=Be(n,s.offset,"clamp"),o=!0)}o&&(e._cachedNodes=null,e._cachedIsBackward=null)}}function Po(n,t,e){const r=t[e]||!1;return r==="any"||r===n[e]}function Fp(n,t){return Po(n,t,"altKey")&&Po(n,t,"ctrlKey")&&Po(n,t,"shiftKey")&&Po(n,t,"metaKey")}function pt(n,t,e){if(!Fp(n,e))return!1;if(n.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||n.key.length===1&&n.key.charCodeAt(0)<=127)return!1;if(n.code.startsWith("Digit")&&/^\d$/.test(t))return n.code===`Digit${t}`;const r="Key"+t.toUpperCase();return n.code===r}const Ye={ctrlKey:!Ne,metaKey:Ne},Fa={altKey:Ne,ctrlKey:!Ne};function Da(n){return n.key==="Backspace"}function Dp(n){const t=Ct();if(w(n)){const e=n.anchor,r=n.focus,o=e.getNode();if(Et(o))return e.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),De(n),n;const i=o.getTopLevelElementOrThrow(),s=i.getParent();if(s===null)return C(i)&&(e.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),De(n)),n;const l=s;return e.set(l.getKey(),0,"element"),r.set(l.getKey(),l.getChildrenSize(),"element"),De(n),n}{const e=t.select(0,t.getChildrenSize());return gt(De(e)),e}}function gr(n,t){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const e=n.__lexicalClassNameCache,r=e[t];if(r!==void 0)return r;const o=n[t];if(typeof o=="string"){const i=en(o);return e[t]=i,i}return o}function lc(n,t,e,r,o){if(e.size===0)return;const i=r.__type,s=r.__key,l=t.get(i);l===void 0&&$(33,i);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const u=a.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&a.set(s,f?"updated":o)}function Pa(n,t,e){const r=n.getParent();let o=e,i=n;return r!==null&&(e===0&&(o=i.getIndexWithinParent(),i=r)),i.getChildAtIndex(o-1)}function Pp(n,t){const e=n.offset;if(n.type==="element")return Pa(n.getNode(),t,e);{const r=n.getNode();if(e===0||!t){const o=r.getPreviousSibling();return o===null?Pa(r.getParentOrThrow(),t,r.getIndexWithinParent()+0):o}}return null}function Ed(n){const t=se(n).event,e=t&&t.inputType;return e==="insertFromPaste"||e==="insertFromPasteAsQuotation"}function D(n,t,...e){return dd(n,t,e[0],n)}function Tr(n,t){const e=n._keyToDOMMap.get(t);return e===void 0&&$(75,t),e}function jn(n){const t=n.assignedSlot||n.parentElement;if(t!==null)return t;const e=n.parentNode;return je(e)?e.host:null}function cc(n){return Cn(n)?n:B(n)?n.ownerDocument:null}function kr(n){Pt(),ft()._updateTags.add(n)}function Rp(n){Pt(),ft()._deferred.push(n)}function wr(n,t){let e=n.getParent();for(;e!==null;){if(e.is(t))return!0;e=e.getParent()}return!1}function ac(n){const t=cc(n);return t?t.defaultView:null}function se(n){const t=n._window;return t===null&&$(78),t}function uc(n){return C(n)&&n.isInline()||G(n)&&n.isInline()}function $d(n){let t=n.getLatest();for(;t!==null;){if(Wt(t)!==null&&C(t))return t;const e=t.getParentOrThrow();if(xt(e))return e;t=e}return t}function oo(n){return C(n)&&n.isShadowRoot()}function xt(n){return Et(n)||oo(n)}function Bt(n,t=!1){const e=n.constructor.clone(n,ec);return Sd(e,null),e.afterCloneFrom(n),t||e.resetOnCopyNodeFrom(n),e}function Gt(n){const t=ft(),e=n.getType(),r=nc(t,e);r===void 0&&$(200,n.constructor.name,e);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(n),l=s.constructor;return i!==null?s instanceof i||$(201,i.name,i.getType(),l.name,l.getType(),n.constructor.name,e):s instanceof n.constructor&&l!==n.constructor||$(202,l.name,l.getType(),n.constructor.name,e),s.__key===n.__key&&$(203,n.constructor.name,e,l.name,l.getType()),s}return n}function ws(n,t){!Et(n.getParent())||C(t)||G(t)||$(99)}function Od(n){const t=tt(n);return t===null&&$(63,n),t}function ri(n){if(!n||n.isInline())return!1;if(G(n))return!0;if(C(n)){if(n.isShadowRoot()){const t=n.getParent();return!(C(t)&&t.isShadowRoot())}return!n.canBeEmpty()}return!1}function ki(n,t,e){e.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Dt(n){return Vt?(n||window).getSelection():null}function Lp(n){const t=ac(n);return t?t.getSelection():null}function je(n){return fl(n)&&"host"in n}const Ip=[];function Ad(n){const t=n.getRootNode();if(t===n||!je(t))return Ip;const e=[t];let r=t.host;for(;;){const o=r.getRootNode();if(o===r||!je(o))break;e.push(o),r=o.host}return e}function*Md(n){const t=[n];let e;for(;e=t.pop();){yield*e.querySelectorAll('[data-lexical-editor="true"]');const r=(Cn(e)?e:e.ownerDocument).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&t.push(o.shadowRoot)}}function Fd(n){return n!==null?n.ownerDocument:document}function Z(){const n=ud();return Fd(n!==null?n._rootElement:null)}function Zi(n,t){if(t===null||typeof n.getComposedRanges!="function")return null;const e=Ad(t);if(e.length===0)return null;const r=n.getComposedRanges;try{const o=r.call(n,{shadowRoots:e})[0];if(o!==void 0)return o}catch{}try{const o=r.apply(n,e)[0];if(o!==void 0)return o}catch{}return null}function Dd(n,t){const e=Zi(n,t);if(e!==null){const r=Kp(e);if(r!==null)return r}return n.rangeCount>0?n.getRangeAt(0):null}function re(n,t){const e=Zi(n,t);return e===null?n:zp(e,Bp(n))}function Kp(n){const t=n.startContainer.ownerDocument;if(t===null)return null;const e=t.createRange();try{return e.setStart(n.startContainer,n.startOffset),e.setEnd(n.endContainer,n.endOffset),e}catch{return null}}function zp(n,t){const{startContainer:e,startOffset:r,endContainer:o,endOffset:i}=n;return t==="backward"?{anchorNode:o,anchorOffset:i,direction:t,focusNode:e,focusOffset:r}:{anchorNode:e,anchorOffset:r,direction:t,focusNode:o,focusOffset:i}}function Bp(n){return n.direction}function _o(n){const t=n.getRootNode();return Cn(t)||je(t)?t.activeElement:null}function Er(n){let t=n.activeElement;for(;t!==null&&t.shadowRoot!==null;){const e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function Rn(n){const t=n.target;if(t!==null&&B(t)&&t.shadowRoot!==null&&typeof n.composedPath=="function"){const e=n.composedPath();if(e.length>0)return e[0]}return t}function Pd(n){return B(n)&&n.tagName==="A"}function Wp(n){return B(n)&&n.tagName==="TR"}function B(n){return Ae(n)&&n.nodeType===1}function Ae(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function fl(n){return Ae(n)&&n.nodeType===11}const Up=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function wi(n){return!(!B(n)||!n.style.display.startsWith("inline"))||Up.test(n.nodeName)}const jp=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function $r(n){return(!B(n)||!n.style.display.startsWith("inline"))&&jp.test(n.nodeName)}function zt(n){if(G(n)&&!n.isInline())return!0;if(!C(n)||xt(n))return!1;const t=n.getFirstChild(),e=t===null||It(t)||O(t)||t.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&e}function St(){return ft()}function ts(n=St()){return n._config.dom||vi}function Se(n,t,e=St()){const r=ts(e).$getDOMSlot(n,t,e);return C(n)&&(Hp(r)||$(344,n.getKey(),n.getType())),r}function Hp(n){return n instanceof sf}function pn(n,t,e=St()){return Mp(Se(n,t,e).element)}const Ra=new WeakMap,Jp=new Map;function La(n){if(!n._readOnly&&n.isEmpty())return Jp;n._readOnly||$(192);let t=Ra.get(n);return t||(t=(function(e){const r=new Map;for(const[o,i]of e._nodeMap){const s=i.__type;let l=r.get(s);l||(l=new Map,r.set(s,l)),l.set(o,i)}return r})(n),Ra.set(n,t)),t}function Rd(n){const t=n.constructor.clone(n,ec);return t.afterCloneFrom(n),t}function qp(n){return(t=Rd(n))[Uf]=!0,t;var t}function Hn(n,t){const e=n.getAttribute("data-lexical-indent");if(e!==null){const i=parseInt(e,10);if(Number.isFinite(i)&&i>=0)return void t.setIndent(i)}const r=parseInt(n.style.paddingInlineStart,10)||0,o=Math.round(r/40);t.setIndent(o)}function be(n,t){const e=t.getAttribute("dir");return e==="ltr"||e==="rtl"?n.setDirection(e):n}function Je(n,t){const e=t.style.textAlign;return e&&e in ai?n.setFormat(e):n}function Ei(n,t){n.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(n.__lexicalCapturedSelection=t.captureSelection)}function Ld(n){return n.__lexicalUnmanaged===!0}function Vp(n,t=St()){const e=t.isEditable();n.contentEditable=e?"true":"false",e?n.__lexicalEditor=t:delete n.__lexicalEditor}function $i(n,t){let e=n;for(;e!=null;){if(e.__lexicalCapturedSelection===!0)return!0;if(B(e)&&e.hasAttribute("data-lexical-slot")||Ir(e,t)!==void 0)return!1;e=jn(e)}return!1}function Jr(n,t){return(function(e,r){return Object.prototype.hasOwnProperty.call(e,r)})(n,t)&&n[t]!==Zt[t]}const Ia=new WeakMap,Ka=Symbol("lexical.synthesizedGetType");function fc(n){const t=Ia.get(n);if(t)return t;const e=n.prototype!=null&&Pc in n.prototype?n.prototype[Pc]():void 0,r=(function(a){if(!(a===Zt||a.prototype instanceof Zt)){let u="<unknown>",f="<unknown>";try{u=a.getType()}catch{}try{Nr.version&&(f=JSON.parse(Nr.version))}catch{}$(290,a.name,u,f)}return a===Gl||a===bt||a===Zt})(n),o=!r&&Jr(n,"getType")?n.getType:void 0,i=o&&!(Ka in o)?o.call(n):void 0;let s,l=i;if(e)if(i)s=e[i];else{for(const[a,u]of Object.entries(e))l=a,s=u;if(!s)for(const a of Object.getOwnPropertySymbols(e)){const u=e[a];if(u){s=u;break}}}if(!r&&l){if(!Jr(n,"getType")){const a=n,u=function(){return this!==a?Zt.getType.call(this):l};u[Ka]=!0,n.getType=u}if(Jr(n,"clone")||(n.clone=(a,u)=>{tc(a);const f=new n;return u!==ec&&f.afterCloneFrom(a),f}),Jr(n,"importJSON")||(n.importJSON=s&&s.$importJSON||(a=>new n().updateFromJSON(a))),!Jr(n,"importDOM")&&s){const{importDOM:a}=s;a&&(n.importDOM=()=>a)}}const c={klass:n,ownNodeConfig:s,ownNodeType:l};return Ia.set(n,c),c}function*dc(n){for(let t=n;t&&(t===Zt||jf(t.prototype));){const e=fc(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||Kd(t)}}function Id(n){const t=St();return Pt(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(n))).klass}const U=(n,t)=>{let e=n;for(;e!=null&&!Et(e);){if(t(e))return e;e=e.getParent()}return null};function Oi(n,t){const e=[];let r=n.__first;for(;r!==null;){const o=t===null?tt(r):t.get(r);o==null&&$(174),e.push(r),r=o.__next}return e}function Kd(n){const t=Object.getPrototypeOf(n);if(typeof t=="function"&&t!==Function.prototype)return t;const e=n.prototype&&Object.getPrototypeOf(n.prototype);return e?e.constructor:null}const zd=new Map;function tn(n){return C(n)||G(n)}function Ln(n){return C(n)||G(n)}function Wt(n){const t=n.getLatest();return Ln(t)?t.__slotHost:null}function pe(n){const t=Wt(n);if(t===null)return null;const e=tt(t);return C(e)||G(e)||$(370),e}function Yp(n){const t=pe(n);if(t===null)return null;const e=n.getLatest().__key;for(const[r,o]of ns(t))if(o===e)return r;return null}function es(n){let t=n.getLatest();for(;t!==null;){if(Wt(t)!==null)return t;t=t.getParent()}return null}function ns(n){const t=n.getLatest();return tn(t)&&t.__slots!==null?t.__slots:zd}function ye(n){return Array.from(ns(n).keys())}function In(n,t){const e=ns(n).get(t);return e===void 0?null:tt(e)}const Xp=["__proto__","constructor","prototype"],za=Symbol("slotMapOwner");function dl(n){let t=n.__slots;return t!==null&&t[za]===n||(t=new Map(t),t[za]=n,n.__slots=t),t}const Ba=new WeakMap,Gp=[];function Qp(n){for(const{ownNodeConfig:t}of dc(n)){const e=t&&t.slots;if(e)return e}return Gp}function Bd(n){let t="";for(const e of ye(n)){const r=In(n,e);r!==null&&(t+=r.getTextContent())}return t}function Wa(n,t,e){const r=e.get(n),o=e.get(t);return r!==void 0?o!==void 0?r-o:-1:o!==void 0?1:n<t?-1:n>t?1:0}function Zp(n){const t=n.__slots;if(t===null||t.size<2)return;const e=(function(s){let l=Ba.get(s);if(l===void 0){const c=Qp(s),a=new Map;for(const u of c)Xp.includes(u)&&$(371,s.name,u),a.has(u)&&$(372,s.name,u),a.set(u,a.size);l=a,Ba.set(s,l)}return l})(n.constructor);let r=null,o=!0;for(const s of t.keys()){if(r!==null&&Wa(r,s,e)>0){o=!1;break}r=s}if(o)return;const i=Array.from(t).sort(([s],[l])=>Wa(s,l,e));t.clear();for(const[s,l]of i)t.set(s,l)}function Wd(n,t,e){t!=="__proto__"&&t!=="constructor"&&t!=="prototype"||$(373,t);const r=n.getLatest();if(r.__slots!==null&&r.__slots.get(t)===e.getLatest().__key)return r;(!C(e)&&!G(e)||e.isInline())&&$(374,e.__key);const o=n.getWritable(),i=dl(o),s=i.get(t);s!==void 0&&Ud(s);const l=e.getWritable(),c=pe(l);if(c!==null){const a=Yp(l);a!==null&&dl(c.getWritable()).delete(a),l.__slotHost=null}return Le(l),l.__slotHost=o.__key,i.set(t,l.__key),Zp(o),(function(){const a=St();a._slotsUsed=!0,a._pendingEditorState&&(a._pendingEditorState._slotsUsed=!0)})(),o}function tm(n,t){const e=n.getWritable();if(e.__slots===null)return e;const r=e.__slots.get(t);return r!==void 0&&(Ud(r),dl(e).delete(t)),e}function Ud(n){const t=tt(n);if(t===null)return;const e=t.getWritable();Ln(e)||$(377,n),e.__slotHost=null,e.remove()}const em={next:"previous",previous:"next"};class hc{origin;constructor(t){this.origin=t}[Symbol.iterator](){return rs({hasNext:Me,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return et(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return et(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const r=this.getNodeAtCaret();return t.is(this.origin)||t.is(r)||(r===null?this.insert(t):r.replace(t,e)),this}splice(t,e,r="next"){const o=r===this.direction?e:Array.from(e).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let c=i.getAdjacentCaret();c!==null&&l.size<t;c=c.getAdjacentCaret()){const a=c.origin.getWritable();l.set(a.getKey(),a)}for(const c of o){if(l.size>0){const a=i.getNodeAtCaret();if(a){if(l.delete(a.getKey()),l.delete(c.getKey()),!(a.is(c)||i.origin.is(c))){const u=c.getParent();u&&u.is(s)&&c.remove(),a.replace(c)}}else a===null&&$(263,Array.from(l).join(" "))}else i.insert(c);i=et(c,this.direction)}for(const c of l.values())c.remove();return this}}class yo extends hc{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Ft(t,this.direction)}getParentCaret(t="root"){return et(gc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Sn(this.direction);return et(this.getNodeAtCaret(),t)||Ft(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof yo&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const nm={root:Et,shadowRoot:xt};function Sn(n){return em[n]}function gc(n,t="root"){return n===null||nm[t](n)?null:Wt(n)===null?n:null}class Kn extends hc{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:et(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return C(this.origin)?Ft(this.origin,this.direction):null}getParentCaret(t="root"){return et(gc(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Sn(this.direction);return et(this.getNodeAtCaret(),t)||Ft(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Kn&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof Kn||t instanceof zn)&&this.direction===t.direction&&this.origin.is(t.origin)}}class zn extends hc{type="text";offset;constructor(t,e){super(t),this.offset=e}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:yn(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return et(gc(this.getParentAtCaret(),t),this.direction)}getFlipped(){return yn(this.origin,Sn(this.direction),this.offset)}isSamePointCaret(t){return t instanceof zn&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Kn||t instanceof zn)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return et(this.origin,this.direction)}}function xe(n){return n instanceof zn}function Me(n){return n instanceof Kn}function Ht(n){return n instanceof yo}const rm={next:class extends zn{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends zn{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},om={next:class extends Kn{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends Kn{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},im={next:class extends yo{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(n){return this.origin.splice(0,0,[n]),this}},previous:class extends yo{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(n){return this.origin.splice(this.origin.getChildrenSize(),0,[n]),this}}};function et(n,t){return n?new om[t](n):null}function yn(n,t,e){return n?new rm[t](n,Be(n,e)):null}function Be(n,t,e="error"){const r=n.getTextContentSize();let o=t==="next"?r:t==="previous"?0:t;return(o<0||o>r)&&(e!=="clamp"&&ef(284,String(t),String(r),n.getKey()),o=o<0?0:r),o}function Ua(n,t){return new lm(n,t)}function Ft(n,t){return C(n)?new im[t](n):null}function sm(n){return n&&n.getChildCaret()||n}function Bn(n){return n&&sm(n.getAdjacentCaret())}class pc{type="node-caret-range";direction;anchor;focus;constructor(t,e,r){this.anchor=t,this.focus=e,this.direction=r}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new pc(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=o=>{const i=this[o].getLatest();return xe(i)?(function(s,l){const{direction:c,origin:a}=s,u=Be(a,l==="focus"?Sn(c):c);return Ua(s,u-s.offset)})(i,o):null},e=t("anchor"),r=t("focus");if(e&&r){const{caret:o}=e,{caret:i}=r;if(o.isSameNodeCaret(i))return[Ua(o,i.offset-o.offset),null]}return[e,r]}iterNodeCarets(t="root"){const e=xe(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=xe(r),i=s=>s.isSameNodeCaret(r)?null:Bn(s)||s.getParentCaret(t);return rs({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:e.isSameNodeCaret(r)?null:i(e),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class lm{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,r=e+t;return r<e?[r,e]:[e,r]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[r,o]=this.getSliceIndices(),i=t.getTextContent();return yn(t.setTextContent(i.slice(0,r)+i.slice(o)),e,r)}}function Or(n){return Ee(n,et(Ct(),n.direction))}function Mo(n){return Ee(n,n)}function Ee(n,t){return n.direction!==t.direction&&$(265),new pc(n,t,n.direction)}function rs(n){const{initial:t,hasNext:e,step:r,map:o}=n;let i=t;return{[Symbol.iterator](){return this},next(){if(!e(i))return{done:!0,value:void 0};const s={done:!1,value:o(i)};return i=r(i),s}}}function xo(n,t){const e=hl(n.origin,t.origin);switch(e===null&&$(275,n.origin.getKey(),t.origin.getKey()),e.type){case"same":{const r=n.type==="text",o=t.type==="text";return r&&o?(function(i,s){return Math.sign(i-s)})(n.offset,t.offset):n.type===t.type?0:r?-1:o?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return jd(e)}}function jd(n){const{a:t,b:e}=n,r=t.__key,o=e.__key;let i=t,s=e;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===o)return-1;if(s.__key===r)return 1}return i===null?1:-1}function Ro(n,t){return t.is(n)}function ja(n){return C(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function hl(n,t){if(n.is(t))return{commonAncestor:n,type:"same"};const e=new Map;for(let[r,o]=ja(n);r;o=r,r=r.getParent())e.set(r,o);for(let[r,o]=ja(t);r;o=r,r=r.getParent()){const i=e.get(r);if(i!==void 0)return i===null?(Ro(n,r)||$(276),{commonAncestor:r,type:"ancestor"}):o===null?(Ro(t,r)||$(277),{commonAncestor:r,type:"descendant"}):((C(i)||Ro(n,i))&&(C(o)||Ro(t,o))&&r.is(i.getParent())&&r.is(o.getParent())||$(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function Jt(n,t){const{type:e,key:r,offset:o}=n,i=Od(n.key);return e==="text"?(O(i)||$(266,i.getType(),r),yn(i,t,o)):(C(i)||$(267,i.getType(),r),pl(i,n.offset,t))}function we(n,t){const{origin:e,direction:r}=t,o=r==="next";xe(t)?n.set(e.getKey(),t.offset,"text"):Me(t)?O(e)?n.set(e.getKey(),Be(e,r),"text"):n.set(e.getParentOrThrow().getKey(),e.getIndexWithinParent()+(o?1:0),"element"):(Ht(t)&&C(e)||$(268),n.set(e.getKey(),o?0:e.getChildrenSize(),"element"))}function Ar(n){const t=A(),e=w(t)?t:Yl();return oi(e,n),gt(e),e}function oi(n,t){we(n.anchor,t.anchor),we(n.focus,t.focus)}function gl(n){const{anchor:t,focus:e}=n,r=Jt(t,"next"),o=Jt(e,"next"),i=xo(r,o)<=0?"next":"previous";return Ee(on(r,i),on(o,i))}function bn(n){const{direction:t,origin:e}=n,r=et(e,Sn(t)).getNodeAtCaret();return r?et(r,t):Ft(e.getParentOrThrow(),t)}function Ha(n,t="root"){const e=[n];for(let r=Ht(n)?n.getParentCaret(t):n.getSiblingCaret();r!==null;r=r.getParentCaret(t))e.push(bn(r));return e}function Es(n){return!!n&&n.origin.isAttached()}function cm(n,t="removeEmptySlices"){if(n.isCollapsed())return n;const e="root",r="next";let o=t;const i=mc(n,r),s=Ha(i.anchor,e),l=Ha(i.focus.getFlipped(),e),c=new Set,a=[];for(const _ of i.iterNodeCarets(e))if(Ht(_))c.add(_.origin.getKey());else if(Me(_)){const{origin:p}=_;C(p)&&!c.has(p.getKey())||a.push(p)}const u=new Set;for(const _ of a){const p=_.getParent();p===null||c.has(p.getKey())||u.add(p),Le(_)}for(const _ of u)!_.canBeEmpty()&&!xt(_)&&_.isEmpty()&&_.isAttached()&&_.remove();for(const _ of i.getTextSlices()){if(!_)continue;const{origin:p}=_.caret,m=p.getTextContentSize(),y=bn(et(p,r)),x=p.getMode();if(Math.abs(_.distance)===m&&o==="removeEmptySlices"||x==="token"&&_.distance!==0)y.remove();else if(_.distance!==0){o="removeEmptySlices";let b=_.removeTextSlice();const T=_.caret.origin;if(x==="segmented"){const v=b.origin,N=wt(v.getTextContent()).setStyle(v.getStyle()).setFormat(v.getFormat());y.replaceOrInsert(N),b=yn(N,r,b.offset)}T.is(s[0].origin)&&(s[0]=b),T.is(l[0].origin)&&(l[0]=b.getFlipped())}}let f,d;for(const _ of s)if(Es(_)){f=Ut(_);break}for(const _ of l)if(Es(_)){d=Ut(_);break}const h=(function(_,p,m){if(!_||!p)return null;const y=_.getParentAtCaret(),x=p.getParentAtCaret();if(!y||!x)return null;const b=y.getParents().reverse();b.push(y);const T=x.getParents().reverse();T.push(x);const v=Math.min(b.length,T.length);let N;for(N=0;N<v&&b[N]===T[N];N++);const S=(E,F)=>{let R;for(let z=N;z<E.length;z++){const q=E[z];if(xt(q))return;!R&&F(q)&&(R=q)}return R},k=S(b,zt),M=k&&S(T,E=>m.has(E.getKey())&&zt(E));return M&&ye(M).length>0?null:k&&M?[k,M]:null})(f,d,c);if(h){const[_,p]=h;Ft(_,"previous").splice(0,p.getChildren());let m=p.getParent();for(p.remove(!0);m&&m.isEmpty();){const y=m;m=m.getParent(),y.remove(!0)}}else if(d){const _=(function(y){if(Ht(y)){const x=y.origin;if(zt(x))return x}else{const x=y.getParentAtCaret();if(x&&zt(x))return x}return null})(d),p=_&&_.getParent(),m=_&&_.getParents().findLast(oo);if(_&&p&&!Et(p)&&_.isEmpty()&&c.has(_.getKey())&&ye(_).length===0&&(!m||c.has(m.getKey()))){_.remove(!0);let y=p;for(;y&&!Et(y)&&y.isEmpty();){const x=y.getParent();if(x&&Et(x)&&x.getChildrenSize()<=1)break;const b=y;y=x,b.remove(!0)}}}const g=[f,d,...s,...l].find(Es);if(g)return Mo(on(Ut(g),n.direction));$(269,JSON.stringify(s.map(_=>_.origin.__key)))}function Ut(n){const t=(function(o){let i=o;for(;Ht(i);){const s=Bn(i);if(!Ht(s))break;i=s}return i})(n.getLatest()),{direction:e}=t;if(O(t.origin))return xe(t)?t:yn(t.origin,e,e);const r=t.getAdjacentCaret();return Me(r)&&O(r.origin)?yn(r.origin,e,Sn(e)):t}function os(n){return xe(n)&&n.offset!==Be(n.origin,n.direction)}function on(n,t){return n.direction===t?n:n.getFlipped()}function mc(n,t){return n.direction===t?n:Ee(on(n.focus,t),on(n.anchor,t))}function pl(n,t,e){let r=Ft(n,"next");for(let o=0;o<t;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return on(r,e)}function Hd(n,t="root"){let e=0,r=n,o=Bn(r);for(;o===null;){if(e--,o=r.getParentCaret(t),!o)return null;r=o,o=Bn(r)}return o&&[o,e]}function am(n){const{origin:t,offset:e,direction:r}=n;if(e===Be(t,r))return n.getSiblingCaret();if(e===Be(t,Sn(r)))return bn(n.getSiblingCaret());const[o]=t.splitText(e);return O(o)||$(281),on(et(o,"next"),r)}function um(n,t){return!0}function Jd(n,{$copyElementNode:t=Bt,$splitTextPointCaretNext:e=am,rootMode:r="shadowRoot",$shouldSplit:o=um,removeEmptyDestination:i=!1}={}){if(xe(n))return e(n);const s=n.getParentCaret(r);if(s){const{origin:l}=s;if(Ht(n)){const a=bn(s);if(i&&l.isEmpty())return l.remove(),a;if(!l.canBeEmpty()||!o(l,"first"))return a}const c=(function(a){const u=[];for(let f=a.getAdjacentCaret();f;f=f.getAdjacentCaret())u.push(f.origin);return u})(n);(c.length>0||!i&&l.canBeEmpty()&&o(l,"last"))&&s.insert(t(l).splice(0,0,c))}return s}function is(n,t,e){let r=on(t,"next");xe(r)&&(r.offset===0?r=et(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=et(r.origin,"next"))),r.origin.is(n)&&(Me(r)||$(342,n.getKey(),n.getType()),r=bn(r)),(n.is(r.getNodeAtCaret())||n.is(r.getFlipped().getNodeAtCaret()))&&n.remove(!0);for(let o=r;o;o=Jd(o,e))r=o;return xe(r)&&$(283),r.insert(n.isInline()?V().append(n):n),on(et(n.getLatest(),"next"),t.direction)}function _c(n,t){if(!t||n===t)return n;for(const e in t)if(n[e]!==t[e])return{...n,...t};return n}function en(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}function kt(n,...t){const e=en(...t);e.length>0&&n.classList.add(...e)}function We(n,...t){const e=en(...t);e.length>0&&n.classList.remove(...e)}function qt(...n){return()=>{for(let t=n.length-1;t>=0;t--)n[t]();n.length=0}}const fm=Vt?L.useLayoutEffect:L.useEffect,Lo={tag:dr};function dm({initialConfig:n,children:t}){const e=L.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,onWarn:l,editorState:c,html:a}=n,u=dg(null,r),f=yd({editable:n.editable,html:a,namespace:o,nodes:i,onError:d=>s(d,f),...l?{onWarn:d=>l(d,f)}:{},theme:r});return(function(d,h){if(h!==null){if(h===void 0)d.update(()=>{const g=Ct();if(g.isEmpty()){const _=V();g.append(_);const p=d.getRootElement(),m=Vt&&p!==null?_o(p):null;(A()!==null||m!==null&&m===p)&&_.select()}},Lo);else if(h!==null)switch(typeof h){case"string":{const g=d.parseEditorState(h);d.setEditorState(g,Lo);break}case"object":d.setEditorState(h,Lo);break;case"function":d.update(()=>{Ct().isEmpty()&&h(d)},Lo)}}})(f,c),[f,u]},[]);return fm(()=>{const r=n.editable,[o]=e;o.setEditable(r===void 0||r)},[]),H.jsx(tf.Provider,{value:e,children:t})}function hm(){return Ct().getTextContent()}function gm(n,t=!0){if(n)return!1;let e=hm();return t&&(e=e.trim()),e===""}function pm(n){if(!gm(n,!1))return!1;const t=Ct().getChildren(),e=t.length;if(e>1)return!1;for(let r=0;r<e;r++){const o=t[r];if(G(o))return!1;if(C(o)){if(!cn(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let l=0;l<s;l++){const c=i[r];if(!O(c))return!1}}}return!0}function qd(n){return()=>pm(n)}const Vd=Vt?L.useLayoutEffect:L.useEffect;function mm({editor:n,ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:l,ariaLabel:c,ariaLabelledBy:a,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:g,id:_,role:p="textbox",spellCheck:m=!0,style:y,tabIndex:x,"data-testid":b,...T},v){const[N,S]=L.useState(n.isEditable()),k=L.useCallback(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?n.setRootElement(E):n.setRootElement(null)},[n]),M=L.useMemo(()=>(function(...E){return F=>{for(const R of E)typeof R=="function"?R(F):R!=null&&(R.current=F)}})(v,k),[k,v]);return Vd(()=>(S(n.isEditable()),n.registerEditableListener(E=>{S(E)})),[n]),H.jsx("div",{"aria-activedescendant":N?t:void 0,"aria-autocomplete":N?e:"none","aria-controls":N?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":N&&p==="combobox"?!!s:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":c,"aria-labelledby":a,"aria-multiline":u,"aria-owns":N?f:void 0,"aria-readonly":!N||void 0,"aria-required":d,autoCapitalize:h,className:g,contentEditable:N,"data-testid":b,id:_,ref:M,role:p,spellCheck:m,style:y,tabIndex:x??(N?void 0:-1),...T})}const _m=L.forwardRef(mm);function Ja(n){return n.read("latest",qd(n.isComposing()))}const ym=L.forwardRef(xm);function xm(n,t){const{placeholder:e,...r}=n,[o]=oe();return H.jsxs(H.Fragment,{children:[H.jsx(_m,{editor:o,...r,ref:t}),e!=null&&H.jsx(Cm,{editor:o,content:e})]})}function Cm({content:n,editor:t}){const e=(function(s){const[l,c]=L.useState(()=>Ja(s));return Vd(()=>{function a(){const u=Ja(s);c(u)}return a(),qt(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),l})(t),[r,o]=L.useState(t.isEditable());if(L.useLayoutEffect(()=>(o(t.isEditable()),t.registerEditableListener(s=>{o(s)})),[t]),!e)return null;let i=null;return typeof n=="function"?i=n(r):n!==null&&(i=n),i===null?null:H.jsx("div",{"aria-hidden":!0,children:i})}class Sm extends L.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,e){this.props.onError(t instanceof Error?t:new Error(String(t),{cause:t}),e)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function bm({children:n,fallback:t,onError:e}){return H.jsx(Sm,{fallback:t===void 0?H.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):t,onError:e,children:n})}function Yd(n){const t=St().getElementByKey(n.getKey());if(t===null)return null;const e=t.ownerDocument.defaultView;return e===null?null:e.getComputedStyle(t)}function Xd(n){return Yd(Et(n)?n:n.getParentOrThrow())}function Io(n){const t=Xd(n);return t!==null&&t.direction==="rtl"}function Gd(n,t,e="self"){const r=n.getStartEndPoints();if(t.isSelected(n)&&!_e(t)&&r!==null){const[o,i]=r,s=n.isBackward(),l=o.getNode(),c=i.getNode(),a=t.is(l),u=t.is(c);if(a||u){const[f,d]=sl(n),h=l.is(c),g=t.is(s?c:l),_=t.is(s?l:c);let p,m=0;h?(m=f>d?d:f,p=f>d?f:d):g?(m=s?d:f,p=void 0):_&&(m=0,p=s?f:d);const y=t.__text.slice(m,p);y!==t.__text&&(e==="clone"&&(t=qp(t)),t.__text=y)}}return t}function vm(n,t){const e=n.getFormatType(),r=n.getIndent();e!==t.getFormatType()&&t.setFormat(e),r!==t.getIndent()&&t.setIndent(r)}function Nm(n,t,e){let r=Jt(n,e);if(os(r))return!1;for(;r;r=r.getParentCaret()){const o=r.getParentAtCaret();if(!o||r.getNodeAtCaret())return!1;if(t.is(o))return!0}return!1}function Tm(n,t,e=vm){if(!n)return;const r=n.getStartEndPoints();let o=!1,i=null;const s=new Map;if(r){const[l,c]=r,a=U(l.getNode(),zt);i=U(c.getNode(),zt);const u=n.isBackward()?"previous":"next";o=C(i)&&!i.is(a)&&(function(f,d,h){const g=f.getNode();return(!C(g)||!g.isEmpty())&&Nm(f,d,h)})(c,i,Sn(u)),C(a)&&s.set(a.getKey(),a),C(i)&&!o&&s.set(i.getKey(),i)}for(const l of n.getNodes())if(C(l)&&zt(l)){if(o&&l.is(i))continue;s.set(l.getKey(),l)}else if(!r){const c=U(l,zt);C(c)&&s.set(c.getKey(),c)}for(const l of s.values()){const c=t();e(l,c),l.replace(c,!0)}}function Qd(n){const t=Zd(n);return t!==null&&t.writingMode==="vertical-rl"}function Zd(n){const t=n.anchor.getNode();return C(t)?Yd(t):Xd(t)}function qa(n,t){let e=Qd(n)?!t:t;th(n)&&(e=!e);const r=Jt(n.focus,e?"previous":"next");if(os(r))return!1;if(xe(r)&&!br(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if(O(o)&&!br(o))return!0}for(const o of Or(r)){if(Ht(o))return!o.origin.isInline();if(!C(o.origin)){if(G(o.origin))return!0;break}}return!1}function km(n,t,e,r){n.modify(t?"extend":"move",e,r)}function th(n){const t=Zd(n);return t!==null&&t.direction==="rtl"}function Va(n,t,e){const r=th(n);let o;o=Qd(n)||r?!e:e,km(n,t,o,"character")}function wm(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Em(n,t){return Array.from($m(n))}function $m(n,t){return Am("next",n)}function Om(n,t){const e=Hd(et(n,t));return e&&e[0]}function Am(n,t,e){const r=Ct(),o=t||r,i=C(o)?Ft(o,n):et(o,n),s=Mm(o),l=Om(o,n);let c=s;return rs({hasNext:a=>a!==null,initial:i,map:a=>({depth:c,node:a.origin}),step:a=>{if(a.isSameNodeCaret(l))return null;Ht(a)&&c++;const u=Hd(a);return!u||u[0].isSameNodeCaret(l)?null:(c+=u[1],u[0])}})}function Mm(n){let t=-1;for(let e=n;e!==null;e=e.getParent()??pe(e))t++;return t}function Fm(n,t){let e=n;for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null}function Dm(n){const t=U(n,e=>C(e)&&!e.isInline());return C(t)||wm(4,n.__key),t}function Pm(n){const t=A()||ce();let e;if(w(t))e=Jt(t.focus,"next");else{if(t!=null){const s=t.getNodes(),l=s[s.length-1];l&&(e=et(l,"next"))}e=e||Ft(Ct(),"previous").getFlipped().insert(V())}const r=is(n,e),o=Bn(r),i=Ht(o)?Ut(o):r;return Ar(Mo(i)),n.getLatest()}function Ke(n,t){return n!==null&&Object.getPrototypeOf(n).constructor.name===t.name}function Ko(n){let t=null;if(Ke(n,DragEvent)?t=n.dataTransfer:Ke(n,ClipboardEvent)&&(t=n.clipboardData),t===null)return[!1,[],!1];const e=t.types,r=e.includes("Files"),o=e.includes("text/html")||e.includes("text/plain");return[r,Array.from(t.files),o]}function Ya(n){const t=A();if(!w(t))return!1;const e=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(e.has(s))continue;const l=U(i,a=>C(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!e.has(c)&&(e.add(c),n(l))}return e.size>0}function Rm(n,t){Ft(n,"next").insert(t)}function eh(n,t){return nh(n,t,null)}function nh(n,t,e){let r=!1;for(const o of rh(n))t(o)?e!==null&&e(o):(r=!0,C(o)&&nh(o,t,e||(i=>o.insertAfter(i))),o.remove());return r}function Ai(n,t){const e=[],r=Array.from(n).reverse();for(let o=r.pop();o!==void 0;o=r.pop())if(t(o))e.push(o);else if(C(o))for(const i of rh(o))r.push(i);return e}function rh(n){return Lm(Ft(n,"previous"))}function Lm(n){return rs({hasNext:Me,initial:n.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}const Im=Symbol.for("preact-signals");function yc(){if(An>1)return void An--;let n,t=!1;for(!(function(){let e=Mi;for(Mi=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o})();io!==void 0;){let e=io;for(io=void 0,Fi++;e!==void 0;){const r=e.u;if(e.u=void 0,e.f&=-3,!(8&e.f)&&oh(e))try{e.c()}catch(o){t||(n=o,t=!0)}e=r}}if(Fi=0,An--,t)throw n}let ht,io;function Xa(n){const t=ht;ht=void 0;try{return n()}finally{ht=t}}let Mi,An=0,Fi=0,Ga=0,ii=0;function Qa(n){if(ht===void 0)return;let t=n.n;return t===void 0||t.t!==ht?(t={i:0,S:n,p:ht.s,n:void 0,t:ht,e:void 0,x:void 0,r:t},ht.s!==void 0&&(ht.s.n=t),ht.s=t,n.n=t,32&ht.f&&n.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ht.s,t.n=void 0,ht.s.n=t,ht.s=t),t):void 0}function Yt(n,t){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Fo(n,t){return new Yt(n,t)}function oh(n){for(let t=n.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Za(n){for(let t=n.s;t!==void 0;t=t.n){const e=t.S.n;if(e!==void 0&&(t.r=e),t.S.n=t,t.i=-1,t.n===void 0){n.s=t;break}}}function ih(n){let t,e=n.s;for(;e!==void 0;){const r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):t=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}n.s=t}function Xn(n,t){Yt.call(this,void 0),this.x=n,this.s=void 0,this.g=ii-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function sh(n){const t=n.m;if(n.m=void 0,typeof t=="function"){An++;const e=ht;ht=void 0;try{t()}catch(r){throw n.f&=-2,n.f|=8,xc(n),r}finally{ht=e,yc()}}}function xc(n){for(let t=n.s;t!==void 0;t=t.n)t.S.U(t);n.x=void 0,n.s=void 0,sh(n)}function Km(n){if(ht!==this)throw new Error("Out-of-order effect");ih(this),ht=n,this.f&=-2,8&this.f&&xc(this),yc()}function or(n,t){this.x=n,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function Cc(n,t){const e=new or(n,t);try{e.c()}catch(o){throw e.d(),o}const r=e.d.bind(e);return r[Symbol.dispose]=r,r}function zm(n,t={}){const e={};for(const r in n){const o=t[r],i=Fo(o===void 0?n[r]:o);e[r]=i}return e}Yt.prototype.brand=Im,Yt.prototype.h=function(){return!0},Yt.prototype.S=function(n){const t=this.t;t!==n&&n.e===void 0&&(n.x=t,this.t=n,t!==void 0?t.e=n:Xa(()=>{var e;(e=this.W)==null||e.call(this)}))},Yt.prototype.U=function(n){if(this.t!==void 0){const t=n.e,e=n.x;t!==void 0&&(t.x=e,n.e=void 0),e!==void 0&&(e.e=t,n.x=void 0),n===this.t&&(this.t=e,e===void 0&&Xa(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Yt.prototype.subscribe=function(n){return Cc(()=>{const t=this.value,e=ht;ht=void 0;try{n(t)}finally{ht=e}},{name:"sub"})},Yt.prototype.valueOf=function(){return this.value},Yt.prototype.toString=function(){return this.value+""},Yt.prototype.toJSON=function(){return this.value},Yt.prototype.peek=function(){const n=ht;ht=void 0;try{return this.value}finally{ht=n}},Object.defineProperty(Yt.prototype,"value",{get(){const n=Qa(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Fi>100)throw new Error("Cycle detected");(function(t){An!==0&&Fi===0&&t.l!==Ga&&(t.l=Ga,Mi={S:t,v:t.v,i:t.i,o:Mi})})(this),this.v=n,this.i++,ii++,An++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{yc()}}}}),Xn.prototype=new Yt,Xn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ii))return!0;if(this.g=ii,this.f|=1,this.i>0&&!oh(this))return this.f&=-2,!0;const n=ht;try{Za(this),ht=this;const t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return ht=n,ih(this),this.f&=-2,!0},Xn.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Yt.prototype.S.call(this,n)},Xn.prototype.U=function(n){if(this.t!==void 0&&(Yt.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Xn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let n=this.t;n!==void 0;n=n.x)n.t.N()}},Object.defineProperty(Xn.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=Qa(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),or.prototype.c=function(){const n=this.S();try{if(8&this.f||this.x===void 0)return;const t=this.x();typeof t=="function"&&(this.m=t)}finally{n()}},or.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,sh(this),Za(this),An++;const n=ht;return ht=this,Km.bind(this,n)},or.prototype.N=function(){2&this.f||(this.f|=2,this.u=io,io=this)},or.prototype.d=function(){this.f|=8,1&this.f||xc(this)},or.prototype.dispose=function(){this.d()};function Bm(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function Wm(n,t){let e;return Fo(n(),{unwatched(){e&&(e(),e=void 0)},watched(){this.value=n(),e=t(this)}})}function _t(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let lh;try{lh="0.49.0+prod.esm"}catch{}const Um=lh??'"<unknown>+source"',jm=new Set(["__proto__","constructor","prototype"]);function ch(n,t){if(n&&t&&!Array.isArray(t)&&typeof n=="object"&&typeof t=="object"){const e=n,r=t;for(const o in r)!jm.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=ch(e[o],r[o]));return n}return t}const Sc=0,ml=1,ah=2,$s=3,zo=4,Gn=5,Os=6,qr=7;function As(n){return n.id===Sc}function uh(n){return n.id===ah}function Hm(n){return(function(t){return t.id===ml})(n)||_t(305,String(n.id),String(ml)),Object.assign(n,{id:ah})}const Jm=new Set;let qm=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:Sc}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):_c;for(const r of this.configs)t=e(t,r);return t}init(t){const e=this.state;uh(e)||_t(306,String(e.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=(function(l,c,a){return Object.assign(l,{config:c,id:$s,registerState:a})})(e,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(t,i.config,r)),this.state=(function(l,c,a){return Object.assign(l,{id:zo,initResult:c,registerState:a})})(i,s,o)}build(t){const e=this.state;let r;e.id!==zo&&_t(307,String(e.id),String(Gn)),this.extension.build&&(r=this.extension.build(t,e.config,e.registerState));const o={...e.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(i,s,l){return Object.assign(i,{id:Gn,output:s,registerState:l})})(e,r,o)}register(t,e){this._signal=e;const r=this.state;r.id!==Gn&&_t(308,String(r.id),String(Gn));const o=this.extension.register&&this.extension.register(t,r.config,r.registerState);return this.state=(function(i){return Object.assign(i,{id:Os})})(r),()=>{const i=this.state;i.id!==qr&&_t(309,String(r.id),String(qr)),this.state=(function(s){return Object.assign(s,{id:Gn})})(i),o&&o()}}afterRegistration(t){const e=this.state;let r;return e.id!==Os&&_t(310,String(e.id),String(Os)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=(function(o){return Object.assign(o,{id:qr})})(e),r}getSignal(){return this._signal===void 0&&_t(311),this._signal}getInitResult(){this.extension.init===void 0&&_t(312,this.extension.name);const t=this.state;return(function(e){return e.id>=zo})(t)||_t(313,String(t.id),String(zo)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return(function(e){return e.id>=$s})(t)||_t(314,String(t.id),String($s)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&_t(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&_t(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return(function(e){return e.id>=qr})(t)||_t(316,String(t.id),String(qr)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Jm}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(e){return e.id>=Gn})(t)||_t(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}};const tu={tag:dr};function Vm(){const n=Ct();n.isEmpty()&&n.append(V())}const Ym={config:{setOptions:tu,updateOptions:tu},init:({$initialEditorState:n=Vm})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:t,setOptions:e},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(vp(i))n.setEditorState(i,e);else if(typeof i=="function")n.update(()=>{i(n)},t);else if(i&&(typeof i=="string"||typeof i=="object")){const s=n.parseEditorState(i);n.setEditorState(s,e)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Xi,rn,Gi,qi,Qi]},eu=Symbol.for("@lexical/extension/LexicalBuilder");function nu(){}function Xm(n){throw n}function Bo(n){return Array.isArray(n)?n:[n]}const Ms=Um;let fh=class si{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ms,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[Bo(Ym)];for(const r of t)e.push(Bo(r));return new si(e)}static maybeFromEditor(t){const e=t[eu];return e&&(e.PACKAGE_VERSION!==Ms&&_t(292,e.PACKAGE_VERSION,Ms),e instanceof si||_t(293)),e}static fromEditor(t){const e=si.maybeFromEditor(t);return e===void 0&&_t(294),e}constructEditor(){const{$initialEditorState:t,onError:e,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign(yd({...o,...e?{onError:s=>{e(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[eu]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let t=nu;function e(){try{t()}finally{t=nu}}const r=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=qt(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&_t(295,t.name),e}addEdge(t,e,r){const o=this.outgoingConfigEdges.get(t);o?o.set(e,r):this.outgoingConfigEdges.set(t,new Map([[e,r]]));const i=this.incomingEdges.get(e);i?i.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&_t(296);const e=Bo(t),[r]=e;typeof r.name!="string"&&_t(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&_t(298,r.name),!o){o=new qm(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&_t(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&_t(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=Bo(s);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[s,l]of r.peerDependencies||[])this.addEdge(r.name,s,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(r,o)=>{let i=r.state;if(uh(i))return;const s=r.extension.name;var l;As(i)||_t(300,s,o||"[unknown]"),As(l=i)||_t(304,String(l.id),String(Sc)),i=Object.assign(l,{id:ml}),r.state=i;const c=this.outgoingConfigEdges.get(s);if(c)for(const a of c.keys()){const u=this.extensionNameMap.get(a);u&&e(u,s)}i=Hm(i),r.state=i,t.push(r)};for(const r of this.extensionNameMap.values())As(r.state)&&e(r);for(const r of t)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const l of i)s.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&_t(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of e){const l=s.register(t,i);l&&o.push(l)}for(const s of e){const l=s.afterRegistration(t);l&&o.push(l)}return qt(...o)}buildCreateEditorArgs(){const t={},e=new Set,r=new Map,o=new Map,i={},s={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.onWarn!==void 0&&(t.onWarn=f.onWarn),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of Bm(f)){if(typeof d!="function"){const h=r.get(d.replace);h&&_t(302,f.name,d.replace.name,h.extension.name),r.set(d.replace,u)}e.add(d)}if(f.html){if(f.html.export)for(const[d,h]of f.html.export.entries())o.set(d,h);f.html.import&&Object.assign(i,f.html.import)}f.theme&&ch(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=[...e]);const c=Object.keys(i).length>0,a=o.size>0;(c||a)&&(t.html={},c&&(t.html.import=i),a&&(t.html.export=o));for(const u of l)u.init(t);return t.onError||(t.onError=Xm),t}};function Kr(n,t){const e=fh.maybeFromEditor(n);if(!e)return;const r=e.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function Gm(n){return Kr(St(),n)}let bc=class extends Gl{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:Qm,priority:0})}})}exportDOM(){return{element:Z().createElement("hr")}}createDOM(t){const e=Z().createElement("hr");return kt(e,t.theme.hr),e}getTextContent(){return`
12
+ `}isInline(){return!1}updateDOM(){return!1}};function Qm(){return{node:dh()}}function dh(){return Id(bc)}function Zm(n,t,e,r,o){if(n===null||e.size===0&&r.size===0&&!o)return 0;const i=t._selection,s=n._selection;if(o)return 1;if(!(w(i)&&w(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=(function(m,y,x){const b=m._nodeMap,T=[];for(const v of y){const N=b.get(v);N!==void 0&&T.push(N)}for(const[v,N]of x){if(!N)continue;const S=b.get(v);S===void 0||Et(S)||T.push(S)}return T})(t,e,r);if(l.length===0)return 0;if(l.length>1){const m=t._nodeMap,y=m.get(i.anchor.key),x=m.get(s.anchor.key);return y&&x&&!n._nodeMap.has(y.__key)&&O(y)&&y.__text.length===1&&i.anchor.offset===1?2:0}const c=l[0],a=n._nodeMap.get(c.__key);if(!O(a)||!O(c)||a.__mode!==c.__mode)return 0;const u=a.__text,f=c.__text;if(u===f)return 0;const d=i.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return 0;const g=d.offset,_=h.offset,p=f.length-u.length;return p===1&&_===g-1?2:p===-1&&_===g+1?3:p===-1&&_===g?4:0}function t_(n,t,e){let r=e(),o=0,i=r,s=0,l=null;return(c,a,u,f,d,h)=>{const g=e();if(h.has(qf)&&(i=r,s=o,l=c),h.has(rl))return o=0,r=g,2;h.has(mi)&&l&&(r=i,o=s,c=l);const _=h.has(Hf)||h.has(Jf)?0:Zm(c,a,f,d,n.isComposing()),p=(()=>{const m=u===null||u.editor===n,y=h.has(rp);if(!y&&m&&h.has(dr))return 0;if(_===1)return 2;if(c===null)return 1;const x=a._selection;if(!(f.size>0||d.size>0))return x!==null?0:2;const b=typeof t=="number"?t:t.peek();return y===!1&&_!==0&&_===o&&g<r+b&&m||f.size===1&&(function(T,v,N){const S=v._nodeMap.get(T),k=N._nodeMap.get(T),M=v._selection,E=N._selection;return!(w(M)&&w(E)&&M.anchor.type==="element"&&M.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!O(S)||!O(k)||S.__parent!==k.__parent)&&JSON.stringify(v.read(()=>S.exportJSON()))===JSON.stringify(N.read(()=>k.exportJSON()))})(Array.from(f)[0],c,a)?0:1})();return r=g,o=_,p}}function ru(n,t){n.undoStack=[],n.redoStack=[],n.current=null}function e_(n,t,e,r=Date.now,o,i=null){const s=t_(n,e,r);return qt(n.registerCommand(Ui,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(f.length!==0){const d=c.current,h=f.pop();d!==null&&(u.push(d),l.dispatchCommand(Yr,!0)),f.length===0&&l.dispatchCommand(Xr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:rl})}})(n,t),!0),X),n.registerCommand(ji,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(u.length!==0){const d=c.current;d!==null&&(f.push(d),l.dispatchCommand(Xr,!0));const h=u.pop();u.length===0&&l.dispatchCommand(Yr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:rl})}})(n,t),!0),X),n.registerCommand(Hg,()=>(ru(t),!1),X),n.registerCommand(Jg,()=>(ru(t),n.dispatchCommand(Yr,!1),n.dispatchCommand(Xr,!1),!0),X),n.registerUpdateListener(({editorState:l,prevEditorState:c,dirtyLeaves:a,dirtyElements:u,tags:f})=>{const d=t.current,h=t.redoStack,g=t.undoStack,_=d===null?null:d.editorState;if(d!==null&&l===_)return;const p=s(c,l,d,a,u,f);if(p===1){if(h.length!==0&&(t.redoStack=[],n.dispatchCommand(Yr,!1)),d!==null){g.push({...d});const m=typeof i=="number"||i===null?i:i.peek();m!==null&&g.length>m&&g.splice(0,g.length-m),n.dispatchCommand(Xr,!0)}}else if(p===2)return;t.current={editor:n,editorState:l}}))}function n_(){return{current:null,redoStack:[],undoStack:[]}}function r_({delay:n,externalHistoryState:t}){const[e]=oe();return(function(r,o,i=1e3){const s=L.useMemo(()=>o||n_(),[o]);L.useEffect(()=>e_(r,s,i),[i,r,s])})(e,t,n),null}function zr(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let pr;function hh(n,t){const{key:e}=t;return n&&e in n?n[e]:t.defaultValue}function gh(n){return pr&&pr.editor===n?pr:void 0}function o_(n,t){if("cfg"in t){const{cfg:e,updater:r}=t;return[e,r(hh(n,e))]}return t}function i_(n,t){let e=t;for(const r of n){const[o,i]=o_(e,r),s=o.key;if(e===t&&hh(e,o)===i)continue;const l=e===t||e===void 0?s_(t):e;l[s]=i,e=l}return e}function s_(n){return Object.create(n||null)}function Di(n,t){return[n,t]}function l_(n,t,e,r=St()){const o=pr,i=gh(r);try{return pr={...i,editor:r,[n]:t},e()}finally{pr=o}}function c_(n,t=()=>{}){return(e,r=St())=>o=>{const i=gh(r),s=i&&i[n],l=i_(e,s||t(r));return l&&l!==s?l_(n,l,o,r):o()}}function ph(n,t,e,r){return Object.assign(ko(Symbol(t),{isEqual:r,parse:e}),{[n]:!0})}function a_(n){if(!Cn(n))return;const t=n;if(t.querySelector("style")===null)return;const e=new Map;function r(o){let i=e.get(o);if(i===void 0){i=new Set;for(let s=0;s<o.style.length;s++)i.add(o.style[s]);e.set(o,i)}return i}try{for(const o of Array.from(t.styleSheets)){let i;try{i=o.cssRules}catch{continue}for(const s of Array.from(i)){if(!Ke(s,CSSStyleRule))continue;let l;try{l=t.querySelectorAll(s.selectorText)}catch{continue}for(const c of Array.from(l)){if(!B(c))continue;const a=r(c);for(let u=0;u<s.style.length;u++){const f=s.style[u];a.has(f)||c.style.setProperty(f,s.style.getPropertyValue(f),s.style.getPropertyPriority(f))}}}}}catch{}}const mh="@lexical/html/DOM",_h=Symbol.for("@lexical/html/DOMExportContext"),u_=Symbol.for("@lexical/html/DOMImportContext");function f_(n,t,e){return ph(_h,n,t,e)}const d_=f_("isExport",Boolean);function h_(n){const t=Kr(n,mh);return t?t.output.defaults:void 0}function g_(n){const t=Kr(n,mh);return t?t.output.runtime:void 0}function p_(n=St()){const t=g_(n);return t?t.getSessionConfig():ts(n)}const m_=c_(_h,h_),ss=Symbol.for("@lexical/html/SelectorImpl");function Co(n,t){const e={kind:"element",predicate:(r=t,r.length===0?B:r.length===1?r[0]:(i,s)=>{for(const l of r)if(!l(i,s))return!1;return!0}),tags:n};var r;const o=i=>Co(n,[...t,i]);return{[ss]:e,attr:(i,s,l)=>o(_l(i,s,l)),classAll:(...i)=>o(xh(i)),classAny:(...i)=>o((function(s){const l=yh(s);return l.length===0?()=>!1:c=>{if(!B(c))return!1;const a=c.classList;for(const u of l)if(a.contains(u))return!0;return!1}})(i)),styleAny:(i,s,l)=>o((function(c,a,u){if(typeof a=="string")return f=>B(f)&&f.style.getPropertyValue(c)===a;if(a instanceof RegExp){const f=u&&u.capture,d=a;return(h,g)=>{if(!B(h))return!1;const _=h.style.getPropertyValue(c);if(!_)return!1;const p=_.match(d);return p!==null&&(f!==void 0&&(g[f]=p),!0)}}zr(362,JSON.stringify(c))})(i,s,l))}}function yh(n){const t=[];for(const e of n)e&&t.push(e);return t}function xh(n){const t=yh(n);return t.length===0?()=>!0:e=>{if(!B(e))return!1;const r=e.classList;for(const o of t)if(!r.contains(o))return!1;return!0}}function _l(n,t,e){if(t===!0)return r=>B(r)&&r.hasAttribute(n);if(typeof t=="string")return r=>B(r)&&r.getAttribute(n)===t;if(t instanceof RegExp){const r=e&&e.capture,o=t;return(i,s)=>{if(!B(i))return!1;const l=i.getAttribute(n);if(l==null)return!1;const c=l.match(o);return c!==null&&(r!==void 0&&(s[r]=c),!0)}}zr(361,JSON.stringify(n))}const __={kind:"text",predicate:ie,tags:new Set},y_={[ss]:__},x_={kind:"comment",predicate:n=>n.nodeType===8,tags:new Set},C_={[ss]:x_},lr={any:()=>Co(new Set,[]),comment:()=>C_,tag(...n){n.length>0||zr(363);const t=new Set;for(const e of n)t.add(e.toUpperCase());return Co(t,[])},text:()=>y_};function Ch(n,t){return B(n)&&n.nodeName===t.toUpperCase()}const Sh=/[A-Za-z0-9_-]/;class S_{constructor(t,e){this.source=t,this.pos=e}peek(t=0){return this.source[this.pos+t]||""}consume(){return this.source[this.pos++]||""}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){const t=this.pos;for(;!this.eof()&&Sh.test(this.peek());)this.pos++;return this.source.slice(t,this.pos)}readQuoted(){const t=this.consume();this.assert(t==='"'||t==="'","expected quote");const e=this.pos;for(;!this.eof()&&this.peek()!==t;)this.peek()==="\\"?this.pos+=2:this.pos++;this.assert(!this.eof(),"unterminated string");const r=this.source.slice(e,this.pos);return this.pos++,r.replace(/\\(.)/g,"$1")}assert(t,e){t||zr(364,String(this.pos+1),e,this.source)}}function b_(n){const t=new Set,e=[],r=[];if(n.skipWhitespace(),n.peek()==="*")n.consume();else if(Sh.test(n.peek())){const o=n.readIdent();o&&t.add(o.toUpperCase())}for(;!n.eof();){const o=n.peek();if(o==="."){n.consume();const i=n.readIdent();n.assert(i!=="",'expected class name after "."'),r.push(i)}else if(o==="#"){n.consume();const i=n.readIdent();n.assert(i!=="",'expected id after "#"'),e.push(_l("id",i))}else{if(o!=="[")break;{n.consume(),n.skipWhitespace();const i=n.readIdent();n.assert(i!=="",'expected attribute name after "["'),n.skipWhitespace();let s=!0;if(n.peek()==="="){n.consume(),n.skipWhitespace();const l=n.peek();l==='"'||l==="'"?s=n.readQuoted():(s=n.readIdent(),n.assert(s!=="","expected attribute value")),n.skipWhitespace()}n.assert(n.peek()==="]",'expected "]"'),n.consume(),e.push(_l(i,s))}}}return r.length>0&&e.push(xh(r)),{predicates:e,tags:t}}function v_(n){const t=new S_(n,0),e=[];for(;;){const o=b_(t);if(e.push(o),t.skipWhitespace(),t.eof())break;t.assert(t.peek()===",",'expected "," (selector lists are the only supported combinator)'),t.consume(),t.skipWhitespace()}if(e.length===1)return Co(e[0].tags,e[0].predicates);const r=new Set;if(e.every(o=>o.tags.size>0))for(const o of e)for(const i of o.tags)r.add(i);return Co(r,[(o,i)=>{for(const s of e){const l=o.nodeName;if(s.tags.size>0&&!s.tags.has(l))continue;let c=!0;for(const a of s.predicates)if(!a(o,i)){c=!1;break}if(c)return!0}return!1}])}function vc(n,t,e){return ph(u_,n,t,e)}const So=vc("textFormat",()=>0),yl=vc("textStyle",()=>({}));function N_(n){if(!B(n))return!1;if(n.nodeName==="PRE")return!0;const t=n.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function T_(n){if(ie(n))return!0;if(!B(n))return!1;const t=n.style.display;return t?t.startsWith("inline"):!$r(n)&&wi(n)}const k_=vc("whitespaceConfig",()=>({isInline:T_,preservesWhitespace:N_}));function Nc(n){return vr(n)||G(n)&&!n.isInline()}function bh(n,t){const e=[];let r=[];const o=()=>{r.length!==0&&(e.push(t().splice(0,0,r)),r=[])};for(const i of n)if(Nc(i)){if(o(),C(i)){const s=bh(i.getChildren(),t);i.splice(0,i.getChildrenSize(),s)}e.push(i)}else r.push(i);return o(),e}function Tc(n,t){if(!B(t))return n;const e=t.style.textAlign;if(!kc(e))return n;for(const r of n)vr(r)&&r.getFormatType()===""&&r.setFormat(e);return n}function w_(n,t,e){n.length===1&&It(n[0])&&(n=[]);const r=V();if(B(e)){const o=e.style.textAlign;kc(o)&&r.setFormat(o)}return[r.splice(0,0,n)]}const vh={$accepts:Nc,$packageRun:w_,name:"BlockSchema"},Jn=lr,E_=new Set(["center","end","justify","left","right","start"]);function kc(n){return E_.has(n)}const $_={B:{fontWeight:"bold"},EM:{fontStyle:"italic"},I:{fontStyle:"italic"},S:{textDecoration:"line-through"},STRONG:{fontWeight:"bold"},SUB:{verticalAlign:"sub"},SUP:{verticalAlign:"super"},U:{textDecoration:"underline"}},O_={CODE:_g,MARK:Rl},A_=new Set(["font-weight","font-style","text-decoration","vertical-align"]),M_={$import:(n,t)=>{const e=n.get(So),r=$_[t.nodeName],o=(function(d){return{fontStyle:d.style.fontStyle,fontWeight:d.style.fontWeight,textDecoration:d.style.textDecoration,verticalAlign:d.style.verticalAlign}})(t),i=r?(s=r,{fontStyle:(l=o).fontStyle||s.fontStyle,fontWeight:l.fontWeight||s.fontWeight,textDecoration:l.textDecoration||s.textDecoration,verticalAlign:l.verticalAlign||s.verticalAlign}):o;var s,l;let c=(a=e,u=(function(d){let h=0,g=0;const{fontWeight:_,fontStyle:p,textDecoration:m,verticalAlign:y}=d;if(_==="700"||_==="bold"?h|=zs:_!=="normal"&&_!=="400"||(g|=zs),p==="italic"?h|=Bs:p==="normal"&&(g|=Bs),m){const x=m.split(" ");x.includes("underline")&&(h|=Us),x.includes("line-through")&&(h|=Ws),x.includes("none")&&(g|=Us|Ws)}return y==="sub"?(h|=ps,g|=ms):y==="super"?(h|=ms,g|=ps):y==="baseline"&&(g|=ps|ms),{clear:g,set:h}})(i),a&~u.clear|u.set);var a,u;const f=O_[t.nodeName];return f&&(c|=f),c===e?n.$importChildren(t):n.$importChildren(t,{context:[Di(So,c)]})},match:Jn.tag("b","strong","em","i","code","mark","s","sub","sup","u","span"),name:"@lexical/html/inline-format"};function ou(n,t,e){let r=n;for(;;){let o=null;for(;(o=t?r.nextSibling:r.previousSibling)===null;){const s=r.parentNode;if(s===null)return null;r=s}if(r=o,!e.isInline(r))return null;let i=r;for(;(i=t?r.firstChild:r.lastChild)!==null;)r=i;if(ie(r))return r;if(r.nodeName==="BR")return null}}function iu(n,t){return t!==0&&O(n)?n.setFormat(t):n}function su(n,t){if(O(n)){const e=(function(r){let o="";for(const i in r)A_.has(i)||(o+=`${i}: ${r[i]}; `);return o.trimEnd()})(t);e!==""&&n.setStyle(e)}return n}const F_={$import:(n,t)=>{const e=n.get(So),r=n.get(yl),o=n.get(k_);if((function(l,c){let a=l.parentNode;for(;a!==null;){if(c.preservesWhitespace(a))return!0;a=a.parentNode}return!1})(t,o)){const l=po(t.textContent||"");for(const c of l)iu(c,e),su(c,r);return l}const i=(function(l,c){let a=(l.textContent||"").replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(a.length===0)return"";if(a[0]===" "){let u=l,f=!0;for(;u!==null&&(u=ou(u,!1,c))!==null;){const d=u.textContent||"";if(d.length>0){/[ \t\n]$/.test(d)&&(a=a.slice(1)),f=!1;break}}f&&(a=a.slice(1))}if(a.length>0&&a[a.length-1]===" "){let u=l,f=!0;for(;u!==null&&(u=ou(u,!0,c))!==null;)if((u.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){f=!1;break}f&&(a=a.slice(0,-1))}return a})(t,o);if(i==="")return[];const s=wt(i);return iu(s,e),su(s,r),[s]},match:Jn.text(),name:"@lexical/html/#text"},D_={$import:()=>[],match:Jn.tag("script","style"),name:"@lexical/html/script-style-ignore"},P_={$import:(n,t)=>gd(t)||pd(t)?[]:[Ue()],match:Jn.tag("br"),name:"@lexical/html/br"},R_={$import:(n,t)=>{const e=V();if(Je(e,t),Hn(t,e),e.getFormatType()===""){const r=t.getAttribute("align");r&&kc(r)&&e.setFormat(r)}return be(e,t),[e.splice(0,0,n.$importChildren(t))]},match:Jn.tag("p"),name:"@lexical/html/p"},L_={$import:(n,t,e)=>St().hasNode(bc)?[dh()]:e(),match:Jn.tag("hr"),name:"@lexical/html/hr"};Jn.any();function I_(n,t){const e=[];let r=0,o=0;for(;r<n.length&&o<t.length;)n[r]<=t[o]?e.push(n[r++]):e.push(t[o++]);for(;r<n.length;)e.push(n[r++]);for(;o<t.length;)e.push(t[o++]);return e}function K_(n){const t=[],e=new Map,r=[],o=[],i=[],s=new Set;n.forEach((c,a)=>{const u=(function(d){const h=d[ss];return h===void 0&&zr(360),h})(c.match),f=c.name||(function(d,h){return d.kind==="text"?`#text@${h}`:d.kind==="comment"?`#comment@${h}`:d.tags.size===0?`*@${h}`:`${Array.from(d.tags).join(",").toLowerCase()}@${h}`})(u,a);if(c.name&&s.add(c.name),t.push({$import:c.$import,name:f,predicate:u.predicate}),u.kind==="text")o.push(a);else if(u.kind==="comment")i.push(a);else if(u.tags.size===0)r.push(a);else for(const d of u.tags){let h=e.get(d);h||(h=[],e.set(d,h)),h.push(a)}});const l=new Map;if(r.length===0)for(const[c,a]of e)l.set(c,a);else for(const[c,a]of e)l.set(c,I_(a,r));return{byTag:l,commentIndices:i,rules:t,textIndices:o,wildcardIndices:r}}function z_(n){const t=[];for(const e of n)if(B_(e))for(const r of e.rules)t.push(r);else t.push(e);return t}function B_(n){return typeof n=="object"&&n!==null&&"__type"in n&&n.__type==="CompiledOverlayRules"}function Nh(n){const t=z_(n);return{__type:"CompiledOverlayRules",dispatch:K_(t),rules:t}}lr.any();const Ot={any:lr.any,comment:lr.comment,css:v_,tag:lr.tag,text:lr.text},Th=new Set(["STYLE","SCRIPT"]);function kh(n,t){a_(t);const e=Cn(t)?t.body.childNodes:t.childNodes,r=[],o=[];for(const i of e)if(!Th.has(i.nodeName)){const s=$h(i,n,o,!1);if(s!==null)for(const l of s)r.push(l)}return(function(i){for(const s of i)s.getParent()&&s.getNextSibling()instanceof Zl&&s.insertAfter(Ue());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}})(o),r}function W_(n,t=null,e=St()){return m_([Di(d_,!0)],e)(()=>{const r=Ct(),o=p_(e),i=w(t)?es(t.anchor.getNode()):null,s=n.append.bind(n);for(const l of(C(i)?i:r).getChildren())Eh(e,l,s,t,o);return n})}function wh(n,t=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&zr(338),Cp(n),W_(Z().createElement("div"),t,n).innerHTML}function Eh(n,t,e,r=null,o=ts(n)){let i=o.$shouldInclude(t,r,n);const s=o.$shouldExclude(t,r,n);let l=t;r!==null&&O(t)&&(l=Gd(r,t,"clone"));const c=o.$exportDOM(l,n),{element:a,after:u,append:f,$getChildNodes:d}=c;if(!a)return!1;const h=Z().createDocumentFragment(),g=d?d():C(l)?l.getChildren():[],_=i&&dt(r)&&C(t)?null:r,p=h.append.bind(h);for(const m of g){const y=Eh(n,m,p,_,o);!i&&y&&o.$extractWithChild(t,m,r,"html",n)&&(i=!0)}if(i&&!s){if((B(a)||fl(a))&&(f?f(h):a.append(h)),e(a),u){const m=u.call(l,a);m&&(fl(a)?a.replaceChildren(m):a.replaceWith(m))}}else e(h);return i}function $h(n,t,e,r,o=new Map,i){const s=[];if(Th.has(n.nodeName))return s;let l=null;const c=(function(g,_){const{nodeName:p}=g,m=_._htmlConversions.get(p.toLowerCase());let y=null;if(m!==void 0)for(const x of m){const b=x(g);b!==null&&(y===null||(y.priority||0)<=(b.priority||0))&&(y=b)}return y!==null?y.conversion:null})(n,t),a=c?c(n):null;let u=null;if(a!==null){u=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,_]of o)if(l=_(l,i),!l)break;l&&s.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&o.set(n.nodeName,a.forChild)}const f=n.childNodes;let d=[];const h=(l==null||!xt(l))&&(l!=null&&vr(l)||r);for(let g=0;g<f.length;g++)d.push(...$h(f[g],t,e,h,new Map(o),l));if(u!=null&&(d=u(d)),$r(n)&&(d=U_(n,d,h?()=>{const g=new Zl;return e.push(g),g}:V)),l==null)if(d.length>0)for(const g of d)s.push(g);else $r(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:wi(g.nextSibling)&&wi(g.previousSibling)})(n)&&s.push(Ue());else C(l)&&l.append(...d);return s}function U_(n,t,e){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const l=t[s];if(vr(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===t.length-1||s<t.length-1&&vr(t[s+1])){const c=e();c.setFormat(r),c.append(...i),o.push(c),i=[]}}return o}const lu=new Set(["http:","https:","mailto:","sms:","tel:"]);class xn extends bt{__url;__target;__rel;__title;$config(){return this.config("link",{extends:bt,importDOM:{a:()=>({conversion:H_,priority:1})}})}constructor(t="",e={},r){super(r);const{target:o=null,rel:i=null,title:s=null}=e;this.__url=t,this.__target=o,this.__rel=i,this.__title=s}afterCloneFrom(t){super.afterCloneFrom(t),this.__url=t.__url,this.__rel=t.__rel,this.__target=t.__target,this.__title=t.__title}createDOM(t){const e=Z().createElement("a");return this.updateLinkDOM(null,e,t),kt(e,t.theme.link),e}updateLinkDOM(t,e,r){if(Pd(e)){t&&t.__url===this.__url||(e.href=this.sanitizeUrl(this.__url));for(const o of["target","rel","title"]){const i=`__${o}`,s=this[i];t&&t[i]===s||(s?e[o]=s:e.removeAttribute(o))}}}updateDOM(t,e,r){return this.updateLinkDOM(t,e,r),!1}updateFromJSON(t){return super.updateFromJSON(t).setURL(t.url).setRel(t.rel||null).setTarget(t.target||null).setTitle(t.title||null)}sanitizeUrl(t){const e=t;t=fu(t);try{const r=new URL(fu(t));if(!lu.has(r.protocol))return"about:blank"}catch{const o=e.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(o!=null&&!lu.has(`${o[1].toLowerCase()}:`))return"about:blank"}return t}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=!0){const r=Bt(this);return this.insertAfter(r,e),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,e,r){if(!w(e))return!1;const o=e.anchor.getNode(),i=e.focus.getNode();return(this.is(o)||this.isParentOf(o))&&(this.is(i)||this.isParentOf(i))&&e.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(t){return this.getType()===t.getType()&&this.__url===t.__url&&this.__target===t.__target&&this.__rel===t.__rel&&this.__title===t.__title}}function cu(n){const t=Jt(n,"next");return[t,t.getFlipped()]}function au(n,t){for(const e of t)if(e.origin.isAttached()){const r=Ut(e);return void we(n,r)}}function j_(n){const t=A();let e=null,r=null;function o(){w(t)&&(au(t.anchor,e),au(t.focus,r),De(t))}w(t)&&(e=cu(t.anchor),r=cu(t.focus));let i=!1;for(const l of Ft(n,"next")){const c=l.origin;if(C(c)&&!c.isInline()){const a=c.getChildren();if(a.length>0){const u=Bt(n);u.append(...a),c.append(u),i=!0}is(c,bn(l),{$shouldSplit:()=>!1})}}function s(l,c,a){const[u,f]=l,d=g=>Me(g)&&g.origin.is(c);if(!d(u)&&!d(f))return l;const h=Ut(Ft(a,"next"));return[h,h.getFlipped()]}if(n.isAttached()){const l=n.getPreviousSibling();if(Qt(l)&&l.shouldMergeAdjacentLink(n))return e&&(e=s(e,l,n)),r&&(r=s(r,l,n)),l.append(...n.getChildren()),n.remove(),void o();const c=n.getNextSibling();Qt(c)&&n.shouldMergeAdjacentLink(c)&&(e&&(e=s(e,n,c)),r&&(r=s(r,n,c)),n.append(...c.getChildren()),c.remove(),i=!0)}if(i){if(!n.canBeEmpty()&&n.isEmpty()){const l=n.getParent();n.remove(),l&&l.isEmpty()&&l.remove()}o()}}function H_(n){let t=null;if(Pd(n)){const e=n.textContent;(e!==null&&e!==""||n.children.length>0)&&(t=bo(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:t}}function bo(n="",t){return Gt(new xn(n,t))}function Qt(n){return n instanceof xn}class wc extends xn{__isUnlinked;constructor(t="",e={},r){super(t,e,r),this.__isUnlinked=e.isUnlinked!==void 0&&e.isUnlinked!==null&&e.isUnlinked}afterCloneFrom(t){super.afterCloneFrom(t),this.__isUnlinked=t.__isUnlinked}$config(){return this.config("autolink",{extends:xn})}shouldMergeAdjacentLink(t){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?Z().createElement("span"):super.createDOM(t)}updateDOM(t,e,r){return super.updateDOM(t,e,r)||t.__isUnlinked!==this.__isUnlinked}updateFromJSON(t){return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked||!1)}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(t,e=!0){const r=J_(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,e),r}}function J_(n="",t){return Gt(new wc(n,t))}function ir(n){return n instanceof wc}const xl=K("TOGGLE_LINK_COMMAND");function uu(n,t){if(n.type==="element"){const e=n.getNode();return C(e)||(function(r,...o){const i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",r);for(const l of o)s.append("v",l);throw i.search=s.toString(),Error(`Minified Lexical error #${r}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),e.getChildren()[n.offset+t]||null}return null}function Fs(n,t={}){let e;if(n&&typeof n=="object"){const{url:u,...f}=n;e=u,t={...f,...t}}else e=n;const{target:r,title:o}=t,i=t.rel===void 0?"noreferrer":t.rel,s=A();if(s===null||!w(s)&&!dt(s))return;if(dt(s)){const u=s.getNodes();return u.length===0?void 0:void u.forEach(f=>{if(e===null){const d=U(f,h=>!ir(h)&&Qt(h));d&&(d.insertBefore(f),d.getChildren().length===0&&d.remove())}else{const d=U(f,h=>!ir(h)&&Qt(h));if(d)d.setURL(e),r!==void 0&&d.setTarget(r),i!==void 0&&d.setRel(i);else{const h=bo(e,{rel:i,target:r});f.insertBefore(h),h.append(f)}}})}if(s.isCollapsed()&&e===null)for(const u of s.getNodes()){const f=U(u,d=>!ir(d)&&Qt(d));return void(f!==null&&(f.getParentOrThrow().splice(f.getIndexWithinParent(),0,f.getChildren()),f.remove()))}const l=s.extract();if(e===null){const u=new Set;return void l.forEach(f=>{const d=U(f,h=>!ir(h)&&Qt(h));if(d!==null){const h=d.getKey();if(u.has(h))return;(function(g,_){const p=new Set(_.filter(S=>g.isParentOf(S)).map(S=>S.getKey())),m=g.getChildren(),y=S=>p.has(S.getKey())||C(S)&&_.some(k=>g.isParentOf(k)&&S.isParentOf(k)),x=m.filter(y);if(x.length===m.length)return m.forEach(S=>g.insertBefore(S)),void g.remove();const b=m.findIndex(y),T=m.findLastIndex(y),v=b===0,N=T===m.length-1;if(v)x.forEach(S=>g.insertBefore(S));else if(N)for(let S=x.length-1;S>=0;S--)g.insertAfter(x[S]);else{for(let k=x.length-1;k>=0;k--)g.insertAfter(x[k]);const S=m.slice(T+1);if(S.length>0){const k=Bt(g);x[x.length-1].insertAfter(k),S.forEach(M=>k.append(M))}}})(d,l),u.add(h)}})}const c=new Set,a=u=>{c.has(u.getKey())||(c.add(u.getKey()),u.setURL(e),r!==void 0&&u.setTarget(r),i!==void 0&&u.setRel(i),o!==void 0&&u.setTitle(o))};if(l.length===1){const u=l[0],f=U(u,Qt);if(f!==null)return a(f)}(function(u){const f=A();if(!w(f))return u();const d=De(f),h=d.isBackward(),g=uu(d.anchor,h?-1:0),_=uu(d.focus,h?0:-1);if(u(),g||_){const p=A();if(w(p)){const m=p.clone();if(g){const y=g.getParent();y&&m.anchor.set(y.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(_){const y=_.getParent();y&&m.focus.set(y.getKey(),_.getIndexWithinParent()+(h?0:1),"element")}gt(De(m))}}})(()=>{let u=null;for(const f of l){if(!f.isAttached())continue;const d=U(f,Qt);if(d){a(d);continue}if(C(f)){if(!f.isInline())continue;if(Qt(f)){if(!(ir(f)||u!==null&&u.getParentOrThrow().isParentOf(f))){a(f),u=f;continue}for(const g of f.getChildren())f.insertBefore(g);f.remove();continue}}const h=f.getPreviousSibling();Qt(h)&&h.is(u)?h.append(f):(u=bo(e,{rel:i,target:r,title:o}),f.insertAfter(u),u.append(f))}})}const q_=/^\+?[0-9\s()-]{5,}$/;function fu(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:q_.test(n)?`tel:${n}`:`https://${n}`}Ot.tag("a");function V_(n,t){return qt(n.registerNodeTransform(xn,j_),n.registerCommand(xl,e=>{const r=t.validateUrl.peek(),o=t.attributes.peek();if(e===null)return Fs(null),!0;if(typeof e=="string")return!(r!==void 0&&!r(e))&&(Fs(e,o),!0);{const{url:i,target:s,rel:l,title:c}=e;return Fs(i,{...o,rel:l,target:s,title:c}),!0}},X),Cc(()=>{const e=t.validateUrl.value;if(!e)return;const r=t.attributes.value;return n.registerCommand(Rr,o=>{const i=A();if(!w(i)||i.isCollapsed()||!Ke(o,ClipboardEvent)||o.clipboardData===null)return!1;const s=o.clipboardData.getData("text");return e(s)?!i.getNodes().some(l=>C(l)||O(l)&&!l.isSimpleText())&&(n.dispatchCommand(xl,{...r,url:s}),o.preventDefault(),!0):!1},he)}))}function Y_({validateUrl:n,attributes:t}){const[e]=oe();return L.useEffect(()=>{if(!e.hasNodes([xn]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),L.useEffect(()=>V_(e,zm({attributes:t,validateUrl:n})),[e,n,t]),null}function an(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Cl(n){let t=1,e=n.getParent();for(;e!=null;){if(rt(e)){const r=e.getParent();if(Y(r)){t++,e=r.getParent();continue}an(40)}return t}return t}function Sl(n){const t=n.getParent();Y(t)||an(40);let e=t,r=t;for(;r!==null;)r=r.getParent(),Y(r)&&(e=r);return e}function Oh(n){let t=[];const e=n.getChildren().filter(rt);for(let r=0;r<e.length;r++){const o=e[r],i=o.getFirstChild();Y(i)?t=t.concat(Oh(i)):t.push(o)}return t}function ge(n){return rt(n)&&Y(n.getFirstChild())}function Ah(n,t){return rt(n)&&(t.length===0||t.length===1&&n.is(t[0])&&n.getChildrenSize()===0)}function du(n){const t=A();if(t!==null){let e=t.getNodes();if(w(t)){const[o]=t.getStartEndPoints(),i=o.getNode(),s=i.getParent();if(xt(i)){const l=i.getFirstChild();if(l)e=l.selectStart().getNodes();else{const c=V();i.append(c),e=c.select().getNodes()}}else if(Ah(i,e)){const l=$e(n);if(xt(s)){i.replace(l);const c=He();C(i)&&(c.setFormat(i.getFormatType()),c.setIndent(i.getIndent())),l.append(c)}else if(rt(i)){const c=i.getParentOrThrow();Wn(l,c.getChildren()),c.replace(l)}return}}const r=new Set;for(let o=0;o<e.length;o++){const i=e[o];if(C(i)&&i.isEmpty()&&!rt(i)&&!r.has(i.getKey())){hu(i,n);continue}let s=Cd(i)?i.getParent():rt(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(Y(s)){if(!r.has(l)){const c=$e(n);Wn(c,s.getChildren()),s.replace(c),r.add(l)}break}{const c=s.getParent();if(xt(c)&&!r.has(l)){r.add(l),hu(s,n);break}s=c}}}}}function Wn(n,t){n.splice(n.getChildrenSize(),0,t)}function hu(n,t){if(Y(n))return n;const e=n.getPreviousSibling(),r=n.getNextSibling(),o=He();let i;if(Wn(o,n.getChildren()),Y(e)&&t===e.getListType())e.append(o),Y(r)&&t===r.getListType()&&(Wn(e,r.getChildren()),r.remove()),i=e;else if(Y(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=$e(t);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=A();return w(s)&&(i.getKey()===s.anchor.key&&s.anchor.set(o.getKey(),s.anchor.offset,"element"),i.getKey()===s.focus.key&&s.focus.set(o.getKey(),s.focus.offset,"element")),n.remove(),i}function Ec(n,t){const e=n.getLastChild(),r=t.getFirstChild();e&&r&&ge(e)&&ge(r)&&(Ec(e.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&n.append(...o),t.remove()}function X_(){const n=A();if(w(n)){const t=new Set,e=n.getNodes(),r=n.anchor.getNode();if(Ah(r,e))t.add(Sl(r));else for(let o=0;o<e.length;o++){const i=e[o];if(Cd(i)){const s=Fm(i,vn);s!=null&&t.add(Sl(s))}}for(const o of t){let i=o;const s=Oh(o);for(const l of s){const c=V().setTextStyle(n.style).setTextFormat(n.format);Wn(c,l.getChildren()),i.insertAfter(c),i=c,l.__key===n.anchor.key&&we(n.anchor,Ut(Ft(c,"next"))),l.__key===n.focus.key&&we(n.focus,Ut(Ft(c,"next"))),l.remove()}o.remove()}}}function Mh(n){const t=n.getListType()!=="check";let e=n.getStart();for(const r of n.getChildren())rt(r)&&(r.getValue()!==e&&r.setValue(e),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),Y(r.getFirstChild())||e++)}function G_(n){const t=new Set;if(ge(n)||t.has(n.getKey()))return;const e=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(ge(r)&&ge(o)){const i=o.getFirstChild();if(Y(i)){i.append(n);const s=r.getFirstChild();Y(s)&&(Wn(i,s.getChildren()),r.remove(),t.add(r.getKey()))}}else if(ge(r)){const i=r.getFirstChild();if(Y(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(ge(o)){const i=o.getFirstChild();Y(i)&&i.append(n)}else if(Y(e)){const i=Bt(n),s=Bt(e);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):e.append(i)}}function gu(n){if(ge(n))return;const t=n.getParent(),e=t?t.getParent():void 0;if(Y(e?e.getParent():void 0)&&rt(e)&&Y(t)){const r=t?t.getFirstChild():void 0,o=t?t.getLastChild():void 0;if(n.is(r))e.insertBefore(n),t.isEmpty()&&e.remove();else if(n.is(o))e.insertAfter(n),t.isEmpty()&&e.remove();else{const i=Bt(n),s=Bt(t);i.append(s),n.getPreviousSiblings().forEach(a=>s.append(a));const l=Bt(n),c=Bt(t);l.append(c),Wn(c,n.getNextSiblings()),e.insertBefore(i),e.insertAfter(l),e.replace(n)}}}function Q_(n=!1){const t=A();if(!w(t)||!t.isCollapsed())return!1;const e=t.anchor.getNode();let r=null;if(rt(e)&&e.getChildrenSize()===0)r=e;else if(O(e)){const a=e.getParent();rt(a)&&a.getChildren().every(u=>O(u)&&u.getTextContent().trim()==="")&&(r=a)}if(r===null)return!1;const o=Sl(r),i=r.getParent();Y(i)||an(40);const s=i.getParent();let l;if(xt(s))l=V(),o.insertAfter(l);else{if(!rt(s))return!1;l=Bt(s),s.insertAfter(l)}l.setTextStyle(t.style).setTextFormat(t.format).select();const c=r.getNextSiblings();if(c.length>0){const a=n?(function(f,d){return f.getStart()+d.getIndexWithinParent()})(i,r):1,u=Bt(i).setStart(a);if(rt(l)){const f=Bt(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...c)}return(function(a){let u=a;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!rt(f)&&!Y(f))break;u=f}u.remove()})(r),!0}let vn=class extends bt{__value;__checked;$config(){return this.config("listitem",{$transform:t=>{const e=t.getParent();if(Y(e))e.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0);else if(e){const r=t.createParentElementNode();Y(r)||an(340);const o=[t];for(const i of["previous","next"]){o.reverse();for(const{origin:s}of et(t,i)){if(!rt(s))break;o.push(s)}}t.insertBefore(r),r.splice(0,0,o),xt(e)||(is(r,bn(et(r,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),e.isEmpty()&&e.isAttached()&&e.remove())}},extends:bt,importDOM:{li:()=>({conversion:Z_,priority:0})}})}constructor(t=1,e=void 0,r){super(r),this.__value=t===void 0?1:t,this.__checked=e}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked}createDOM(t){const e=Z().createElement("li");return this.updateListItemDOM(null,e,t),e}updateListItemDOM(t,e,r){(function(s,l){const c=l.getParent();!Y(c)||c.getListType()!=="check"||Y(l.getFirstChild())?(s.removeAttribute("role"),s.removeAttribute("tabIndex"),s.removeAttribute("aria-checked")):(s.setAttribute("role","checkbox"),s.setAttribute("tabIndex","-1"),s.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(e,this),e.value=this.__value,(function(s,l,c){const a=l.list;if(!a)return;const u=a.listitem,f=a.nested&&a.nested.listitem,d=c.getParent(),h=Y(d)&&d.getListType()==="check",g=c.getChecked(),_=c.getChildren().some(y=>Y(y)),p=[];a.listitemChecked!==void 0&&p.push(a.listitemChecked),a.listitemUnchecked!==void 0&&p.push(a.listitemUnchecked),f!==void 0&&p.push(...en(f)),p.length>0&&We(s,...p);const m=[];if(u!==void 0&&m.push(...en(u)),h){const y=g?a.listitemChecked:a.listitemUnchecked;y!==void 0&&m.push(y)}f!==void 0&&_&&m.push(...en(f)),m.length>0&&kt(s,...m)})(e,r.theme,this);const o=t?t.__style:"",i=this.__style;o!==i&&gn(e.style,i,o),(function(s,l,c){const a=l.__textStyle,u=c?c.__textStyle:"";if(c!==null&&u===a)return;const f=_i(a);for(const d in f)s.style.setProperty(`--listitem-marker-${d}`,f[d]);if(u!=="")for(const d in _i(u))d in f||s.style.removeProperty(`--listitem-marker-${d}`)})(e,this,t)}updateDOM(t,e,r){const o=e;return this.updateListItemDOM(t,o,r),!1}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const e=this.createDOM(t._config),r=this.getFormatType();r&&(e.style.textAlign=r);const o=this.getDirection();return o&&(e.dir=o),ge(this)?{after(i){if(B(i)){const s=i.previousElementSibling;if(B(s)&&s.nodeName==="LI"){for(;i.firstChild;)s.append(i.firstChild);i.remove()}}return i},element:e}:{element:e}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let e=0;e<t.length;e++){const r=t[e];if(C(r)&&this.canMergeWith(r)){const o=r.getChildren();this.append(...o),r.remove()}else super.append(r)}return this}replace(t,e){if(rt(t))return super.replace(t);this.setIndent(0);const r=this.getParentOrThrow();if(!Y(r))return t;if(r.__first===this.getKey())r.insertBefore(t);else if(r.__last===this.getKey())r.insertAfter(t);else{const s=Bt(r);let l=this.getNextSibling();for(;l;){const c=l;l=l.getNextSibling(),s.append(c)}r.insertAfter(t),t.insertAfter(s)}const o=this.__key;let i=0;if(e&&(C(t)||an(139),i=t.getChildrenSize(),t.splice(i,0,this.getChildren())),e&&C(t)){const s=A();if(w(s))for(const l of s.getStartEndPoints())l.key===o&&l.type==="element"&&l.set(t.getKey(),i+l.offset,"element")}return this.remove(),r.getChildrenSize()===0&&r.remove(),t}insertAfter(t,e=!0){const r=this.getParentOrThrow();if(Y(r)||an(39),rt(t))return super.insertAfter(t,e);const o=this.getNextSiblings();if(r.insertAfter(t,e),o.length!==0){const i=Bt(r);o.forEach(s=>i.append(s)),t.insertAfter(i,e)}return t}remove(t){const e=this.getPreviousSibling(),r=this.getNextSibling();super.remove(t),e&&r&&ge(e)&&ge(r)&&(Ec(e.getFirstChild(),r.getFirstChild()),r.remove())}resetOnCopyNodeFrom(t){super.resetOnCopyNodeFrom(t),t.getChecked()&&this.setChecked(!1)}insertNewAfter(t,e=!0){const r=Bt(this);return this.insertAfter(r,e),r}collapseAtStart(t){if(ge(this))return!1;const e=this.getParentOrThrow();if(rt(e.getParentOrThrow()))return gu(this),!0;const r=V().append(...this.getChildren()),o=this.getNextSiblings();if(o.length>0){const i=Bt(e);i.append(...o),e.insertAfter(i)}return e.insertAfter(r),this.remove(),e.getChildrenSize()===0&&e.remove(),r.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(t){const e=this.getWritable();return e.__value=t,e}getChecked(){const t=this.getLatest();let e;const r=this.getParent();return Y(r)&&(e=r.getListType()),e==="check"?!!t.__checked:void 0}setChecked(t){const e=this.getWritable();return e.__checked=t,e}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(t===null||!this.isAttached())return this.getLatest().__indent;let e=t.getParentOrThrow(),r=0;for(;rt(e);)e=e.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(t){typeof t!="number"&&an(117),(t=Math.floor(t))>=0||an(199);let e=this.getIndent();for(;e!==t;)e<t?(G_(this),e++):(gu(this),e--);return this}canInsertAfter(t){return rt(t)}canReplaceWith(t){return rt(t)}canMergeWith(t){return rt(t)||cn(t)}extractWithChild(t,e){if(!w(e))return!1;const r=e.anchor.getNode(),o=e.focus.getNode();return this.isParentOf(r)&&this.isParentOf(o)&&this.getTextContent().length===e.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return $e("bullet")}canMergeWhenEmpty(){return!0}};function Z_(n){if(n.classList.contains("task-list-item")){for(const r of n.children)if(r.tagName==="INPUT")return pu(r)}if(n.classList.contains("joplin-checkbox")){for(const r of n.children)if(r.classList.contains("checkbox-wrapper")&&r.children.length>0&&r.children[0].tagName==="INPUT")return pu(r.children[0])}const t=n.getAttribute("aria-checked"),e=He(t==="true"||t!=="false"&&void 0);return Je(e,n),{after:Fh.bind(null,e),node:be(e,n)}}function pu(n){if(n.getAttribute("type")!=="checkbox")return{node:null};const t=He(n.hasAttribute("checked"));return{after:Fh.bind(null,t),node:t}}function Fh(n,t){const e=t[0];return t.length===1&&cn(e)&&!n.getFormatType()&&e.getFormatType()?(n.setFormat(e.getFormatType()),e.getChildren()):t}function He(n){return Gt(new vn(void 0,n))}function rt(n){return n instanceof vn}let qn=class extends bt{__tag;__start;__listType;$config(){return this.config("list",{$transform:t=>{(function(e){const r=e.getNextSibling();Y(r)&&e.getListType()===r.getListType()&&Ec(e,r)})(t),Mh(t)},extends:bt,importDOM:{ol:()=>({conversion:_u,priority:0}),ul:()=>({conversion:_u,priority:0})}})}constructor(t="number",e=1,r){super(r);const o=ty[t]||t;this.__listType=o,this.__tag=o==="number"?"ol":"ul",this.__start=e}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start}getTag(){return this.getLatest().__tag}setListType(t){const e=this.getWritable();return e.__listType=t,e.__tag=t==="number"?"ol":"ul",e}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const e=this.getWritable();return e.__start=t,e}createDOM(t,e){const r=this.__tag,o=Z().createElement(r);return this.__start!==1&&o.setAttribute("start",String(this.__start)),o.__lexicalListType=this.__listType,mu(o,t.theme,this),o}updateDOM(t,e,r){return t.__tag!==this.__tag||t.__listType!==this.__listType||(mu(e,r.theme,this),t.__start!==this.__start&&e.setAttribute("start",String(this.__start)),!1)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const e=this.createDOM(t._config,t);return B(e)&&(this.__start!==1&&e.setAttribute("start",String(this.__start)),this.__listType==="check"&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(t,e,r){let o=r;for(let i=0;i<r.length;i++){const s=r[i];rt(s)||(o===r&&(o=[...r]),o[i]=this.createListItemNode().append(!C(s)||Y(s)||s.isInline()?s:wt(s.getTextContent())))}return super.splice(t,e,o)}extractWithChild(t){return rt(t)}createListItemNode(){return He()}};function mu(n,t,e){const r=[],o=[],i=t.list;if(i!==void 0){const s=i[`${e.__tag}Depth`]||[],l=Cl(e)-1,c=l%s.length,a=s[c],u=i[e.__tag];let f;const d=i.nested,h=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),h!==void 0&&e.__listType==="check"&&r.push(h),a!==void 0){r.push(...en(a));for(let g=0;g<s.length;g++)g!==c&&o.push(e.__tag+g)}if(f!==void 0){const g=en(f);l>1?r.push(...g):o.push(...g)}}o.length>0&&We(n,...o),r.length>0&&kt(n,...r)}function _u(n){let t;if((function(e){return B(e)&&e.nodeName.toLowerCase()==="ol"})(n)){const e=n.start;t=$e("number",e)}else t=(function(e){if(e.getAttribute("__lexicallisttype")==="check"||e.classList.contains("contains-task-list")||e.getAttribute("data-is-checklist")==="1")return!0;for(const r of e.childNodes)if(B(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(n)?$e("check"):$e("bullet");return be(t,n),{after:e=>(function(r,o){const i=o.createListItemNode.bind(o),s=[];for(let l=0;l<r.length;l++){const c=r[l];if(rt(c)){s.push(c);const a=c.getChildren();a.length>1&&a.forEach(u=>{Y(u)&&s.push(i().append(u))})}else s.push(i().append(c))}return s})(e,t),node:t}}const ty={ol:"number",ul:"bullet"};function $e(n="number",t=1){return Gt(new qn(n,t))}function Y(n){return n instanceof qn}function ey(n){const t=[];for(const e of n)if(rt(e)){t.push(e);const r=e.getChildren();if(r.length>1)for(const o of r)Y(o)&&t.push(He().append(o))}else t.push(He().append(e));return t}const ny={$import:(n,t)=>{let e;var r;return Ch(t,"ol")?e=$e("number",t.start):e=(r=t).matches('[__lexicallisttype="check"], .contains-task-list, [data-is-checklist="1"]')||r.querySelector(":scope > [aria-checked]")!==null?$e("check"):$e("bullet"),be(e,t),[e.splice(0,0,Tc(ey(n.$importChildren(t)),t))]},match:Ot.tag("ol","ul"),name:"@lexical/list/list"};function Dh(n,t){if(t.length!==1)return t;const e=t[0];return cn(e)&&!n.getFormatType()&&e.getFormatType()?(n.setFormat(e.getFormatType()),e.getChildren()):t}function Ph(n){const t=s=>Nc(s)&&!Y(s);if(!n.some(t))return n;const e=[];let r=[];const o=()=>{r.length>0&&(e.push(r),r=[])};for(const s of n)t(s)?(o(),e.push(C(s)?s.getChildren():[s])):r.push(s);o();const i=[];for(const s of e)i.length>0&&i.push(Ue()),i.push(...s);return i}const ry={$import:(n,t)=>{const e=t.getAttribute("aria-checked"),r=He(e==="true"||e!=="false"&&void 0);return Je(r,t),be(r,t),[r.splice(0,0,Ph(Dh(r,n.$importChildren(t))))]},match:Ot.tag("li"),name:"@lexical/list/li"};function yu(n,t,e){const r=Ch(e,"input")?e:e.querySelector('input[type="checkbox"]');if(!r||r.getAttribute("type")!=="checkbox")return[];const o=He(r.hasAttribute("checked"));return Je(o,t),be(o,t),[o.splice(0,0,Ph(Dh(o,n.$importChildren(t))))]}Ot.tag("li").classAll("task-list-item"),Ot.tag("li").classAll("joplin-checkbox");const oy=K("UPDATE_LIST_START_COMMAND"),iy=K("INSERT_UNORDERED_LIST_COMMAND"),sy=K("INSERT_ORDERED_LIST_COMMAND"),ly=K("REMOVE_LIST_COMMAND");function xu(n,t){return qt(n.registerCommand(sy,()=>(du("number"),!0),he),n.registerCommand(oy,e=>{const{listNodeKey:r,newStart:o}=e,i=tt(r);return!!Y(i)&&(i.getListType()==="number"&&(i.setStart(o),Mh(i)),!0)},he),n.registerCommand(iy,()=>(du("bullet"),!0),he),n.registerCommand(ly,()=>(X_(),!0),he),n.registerCommand(Dn,()=>Q_(!!(t&&t.restoreNumbering)),he),n.registerCommand(Hi,e=>{const r=A();if(!w(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!rt(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!rt(i)||!i.collapseAtStart(r))&&(e.preventDefault(),!0)},wp),n.registerNodeTransform(vn,e=>{const r=e.getFirstChild();if(r){if(O(r)){const o=r.getStyle(),i=r.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==i&&e.setTextFormat(i)}}else{const o=A();w(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}}),n.registerNodeTransform(rn,e=>{const r=e.getParent();if(rt(r)&&e.is(r.getFirstChild())){const o=e.getStyle(),i=e.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function cy(n){const t=e=>{const r=e.getParent();if(Y(e.getFirstChild())||!Y(r))return;const o=U(e,i=>rt(i)&&Y(i.getParent())&&rt(i.getPreviousSibling()));if(o===null&&e.getIndent()>0)e.setIndent(0);else if(rt(o)){const i=o.getPreviousSibling();if(rt(i)){const s=(function(c){let a=c,u=a.getFirstChild();for(;Y(u);){const f=u.getLastChild();if(!rt(f))break;a=f,u=a.getFirstChild()}return a})(i),l=s.getParent();if(Y(l)){const c=Cl(l);c+1<Cl(r)&&e.setIndent(c)}}}};return n.registerNodeTransform(qn,e=>{const r=[e];for(;r.length>0;){const o=r.shift();if(Y(o)){for(const i of o.getChildren())if(rt(i)){t(i);const s=i.getFirstChild();Y(s)&&r.push(s)}}}})}function ay({hasStrictIndent:n=!1,shouldPreserveNumbering:t=!1}){const[e]=oe();return L.useEffect(()=>{if(!e.hasNodes([qn,vn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[e]),L.useEffect(()=>qt(xu(e,{restoreNumbering:t}),n?cy(e):()=>{}),[e,n,t]),(function(r){L.useEffect(()=>xu(r),[r])})(e),null}const uy=Vt?L.useLayoutEffect:L.useEffect;function fy(n){return{initialValueFn:()=>n.isEditable(),subscribe:t=>n.registerEditableListener(t)}}function dy(){return(function(n){const[t]=oe(),e=L.useMemo(()=>n(t),[t,n]),[r,o]=L.useState(()=>e.initialValueFn()),i=L.useRef(r);return uy(()=>{const{initialValueFn:s,subscribe:l}=e,c=s();return i.current!==c&&(i.current=c,o(c)),l(a=>{i.current=a,o(a)})},[e,n]),r})(fy)}const hy={name:"@lexical/react/ReactProvider"},gy={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},Pi=Symbol.for("@lexical/dragon/WindowState");function py(n,t,e){const r=(function(o){let i=o[Pi];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[Pi]=i),i})(n);if(r.installs.size===0){const o=yy.bind(n);n.addEventListener("message",o,!0),r.dispose=()=>{n.removeEventListener("message",o,!0)}}if(r.installs.add(t),e){const o=r.editors.get(e)||new Set;o.add(t),r.editors.set(e,o)}return my.bind(null,n,r,t,e)}function my(n,t,e,r){if(r){const o=t.editors.get(r);o&&o.delete(e)&&o.size===0&&t.editors.delete(r)}t.installs.delete(e)&&t.installs.size===0&&(t.dispose(),delete n[Pi])}function Cu(n){return n&&n.ownerDocument.defaultView}function _y(n){const t=Wm(()=>Cu(n.getRootElement()),e=>n.registerRootListener(r=>{e.value=Cu(r)}));return Cc(()=>{const e=t.value;if(e)return py(e,Symbol("@lexical/dragon/editorInstall"),n)})}function yy(n){if(n.origin!==this.location.origin)return;const t=(function(r){const o=r[Pi];if(o===void 0)return null;const i=Lr(Er(r.document));return Ao(i)&&o.editors.has(i)?i:null})(this);if(t===null)return;const e=n.data;if(typeof e=="string"){let r;try{r=JSON.parse(e)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const o=r.payload;if(o&&o.functionId==="makeChanges"){const i=o.args;if(Array.isArray(i)){const[s,l,c,a,u,f]=i;if(![s,l,a,u].every(Number.isFinite)||typeof c!="string"&&c!==-1)return;t.update(()=>{const d=A();if(w(d)){const h=d.anchor;let g=h.getNode(),_=0,p=0;if(O(g)&&s>=0&&l>=0&&(_=s,p=s+l,d.setTextNodeRange(g,_,g,p)),typeof c!="string"||_===p&&c===""||(d.insertRawText(c),g=h.getNode()),O(g)){const m=g.getTextContentSize();_=Math.min(Math.max(a,0),m),p=a<0||u<0?_:Math.min(a+u,m),d.setTextNodeRange(g,_,g,p)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const m=gy[f];m!==void 0&&d.formatText(m)}n.stopImmediatePropagation()}})}}}}}function Ri(n,t,e=null){const r=Fd(e),o=e?Ad(e):[],i=e!==null&&o.length>0;if(i&&typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,t,{shadowRoots:o});if(s!==null&&(function(l,c){for(let a=l;a!==null;){if(a===c)return!0;a=jn(a)}return!1})(s.offsetNode,e))return{node:s.offsetNode,offset:s.offset}}if(i){const s=e.getRootNode();if(je(s)){const l=s.elementFromPoint(n,t);if(l!==null&&e.contains(l)){const c=(function(a,u,f,d){const h=d.createRange(),g=N=>u<N.top?N.top-u:u>N.bottom?u-N.bottom:0,_=N=>a<N.left?N.left-a:a>N.right?a-N.right:0,p=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let m=null,y=1/0,x=1/0;for(let N=p.nextNode();N;N=p.nextNode()){h.selectNodeContents(N);for(const S of h.getClientRects()){const k=g(S),M=_(S);(k<y||k===y&&M<x)&&(y=k,x=M,m=N)}}if(m===null)return null;let b=0,T=1/0,v=1/0;for(let N=0;N<=m.length;N++){h.setStart(m,N),h.collapse(!0);const S=h.getBoundingClientRect(),k=g(S),M=Math.abs(a-S.left);(k<T||k===T&&M<v)&&(T=k,v=M,b=N)}return{node:m,offset:b}})(n,t,l,r);if(c!==null)return c}}}if(typeof r.caretRangeFromPoint=="function"){const s=r.caretRangeFromPoint(n,t);return s===null?null:{node:s.startContainer,offset:s.startOffset}}if(typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,t);return s===null?null:{node:s.offsetNode,offset:s.offset}}return null}function cr(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const bl={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function xy(n){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:t=>t}).createHTML(n):n}const Su=(n,t)=>{if(!w(t))return t.insertRawText(n),!0;const e=r=>{const o=A();w(o)&&r(o)};return sd(n,{linebreak:()=>e(r=>r.insertParagraph()),tab:()=>e(r=>r.insertNodes([Vi()])),text:r=>e(o=>o.insertText(r))}),!0},vl={"application/x-lexical-editor":[(n,t,e)=>{try{const r=St(),o=JSON.parse(n);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return bu(r,wy(o.nodes),t),!0}catch(r){console.error(r)}return e()}],"text/html":[(n,t,e)=>{try{const r=St(),o=new DOMParser().parseFromString(xy(n),"text/html");return bu(r,kh(r,o),t),!0}catch(r){return console.error(r),e()}}],"text/plain":[Su],"text/uri-list":[Su]};function Cy(n,t,e,r){if(!n)return!1;const o=i=>!!n[i]&&n[i](t,e,o.bind(null,i-1),r);return o(n.length-1)}function Rh(n,t,e){const r=t.getData("text/plain");for(const o of(function(i){return Object.keys(i.$importMimeType).filter(s=>i.$importMimeType[s]!==void 0).sort((s,l)=>{const c=i.priority[s],a=i.priority[l];return c===void 0&&a===void 0?s<l?-1:s>l?1:0:c===void 0?1:a===void 0?-1:c-a})})(n)){const i=t.getData(o);if(i&&(o!=="text/html"||i!==r)&&Cy(n.$importMimeType[o],i,e,t))return!0}return!1}const Sy={$importMimeType:vl,$insertDataTransfer:(n,t)=>Rh({$importMimeType:vl,priority:bl},n,t),priority:bl},by={build:(n,t)=>({$importMimeType:t.$importMimeType,$insertDataTransfer:(e,r)=>Rh(t,e,r),priority:t.priority}),config:{$importMimeType:vl,priority:bl},mergeConfig(n,t){const e=_c(n,t);if(t.$importMimeType){const r={...n.$importMimeType};for(const[o,i]of Object.entries(t.$importMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}e.$importMimeType=r}return t.priority&&(e.priority={...n.priority,...t.priority}),e},name:"@lexical/clipboard/Import"};function Lh(n,t=A()){return t==null&&cr(166),w(t)&&t.isCollapsed()||t.getNodes().length===0?"":wh(n,t)}function Ih(n,t=A()){return t==null&&cr(166),w(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(ky(n,t))}function Nl(n,t,e){(function(){const r=Gm(by.name);return r?r.output:Sy})().$insertDataTransfer(n,t)}const Kh="application/x-lexical-drag";function vy(n,t){const e={editorKey:t.getKey()};n.setData(Kh,JSON.stringify(e))}function Ny(n,t,e){const r=n.dataTransfer;if(r===null)return!1;const o=(function(a){const u=a.getData(Kh);if(!u)return null;let f;try{f=JSON.parse(u)}catch{return null}return(d=f)!==null&&typeof d=="object"&&"editorKey"in d&&typeof d.editorKey=="string"?f:null;var d})(r);if(o===null)return!1;const i=(function(a,u){const f=Ri(a.clientX,a.clientY,u.getRootElement());if(f===null)return null;const d=Xt(f.node);if(d===null)return null;if(O(d))return yn(d,"next",f.offset);if(C(d))return pl(d,f.offset,"next");const h=d.getParent();return h===null?null:pl(h,d.getIndexWithinParent()+1,"next")})(n,t);if(i===null)return!1;const s=Jd(i);if(s===null)return!1;const l=o.editorKey===t.getKey(),c=A();if(l){if(!w(c)||c.isCollapsed())return!1;if((function(a,u){const{anchor:f,focus:d}=mc(gl(u),"next");return xo(f,a)<0&&xo(a,d)<0})(i,c))return n.preventDefault(),!0;c.removeText()}if(!s.origin.isAttached())return n.preventDefault(),!0;if(e(r,Ar(Mo(s)),t),!l){const a=t.getRootElement(),u=a?a.ownerDocument:null,f=u?(function(d,h){for(const g of Md(h)){const _=Lr(g);if(Ao(_)&&_.getKey()===d&&B(g))return g}return null})(o.editorKey,u):null;f!==null&&f.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return n.preventDefault(),!0}function Ty(n,t){return Ny(n,t,Nl)}function bu(n,t,e){n.dispatchCommand(Tf,{nodes:t,selection:e})||(e.insertNodes(t),(function(r){if(w(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=Jt(o,"previous");if(s)if(xe(s))i=s.origin;else{const l=Ee(s,Ft(Ct(),"next").getFlipped());for(const c of l){if(O(c.origin)){i=c.origin;break}if(C(c.origin)&&!c.origin.isInline())break}}if(i&&O(i)){const l=i.getFormat(),c=i.getStyle();r.format===l&&r.style===c||(r.format=l,r.style=c,r.dirty=!0)}}})(e))}function Tl(n,t,e,r=[]){let o=t===null||e.isSelected(t);const i=C(e)&&e.excludeFromCopy("html");let s=e;t!==null&&O(s)&&(s=Gd(t,s,"clone"));const l=C(s)?s.getChildren():[],c=(function(u){const f=u.exportJSON(),d=u.constructor;if(f.type!==d.getType()&&cr(58,d.name),C(u)){const h=f.children;Array.isArray(h)||cr(59,d.name)}return f})(s);O(s)&&s.getTextContentSize()===0&&(o=!1);const a=o&&dt(t)&&C(e)?null:t;for(let u=0;u<l.length;u++){const f=l[u],d=Tl(n,a,f,c.children);!o&&C(e)&&d&&e.extractWithChild(f,t,"clone")&&(o=!0)}if(o&&!i){const u=ye(s);if(u.length>0){const f={};for(const d of u){const h=In(s,d);h===null&&cr(366,s.constructor.name,d);const g=[];Tl(n,null,h,g),g.length===1&&g[0].type===h.getType()||cr(385,d,s.constructor.name,String(g.length),String(g.length>0?g[0].type:"none")),f[d]=g[0]}c.$slots=f}}if(o&&!i)r.push(c);else if(Array.isArray(c.children))for(let u=0;u<c.children.length;u++){const f=c.children[u];r.push(f)}return o}function ky(n,t){const e=[],r=Ct(),o=w(t)?t.anchor.getNode():dt(t)?t.getNodes()[0]??null:null,i=o!==null?es(o):null,s=(C(i)?i:r).getChildren();for(let l=0;l<s.length;l++)Tl(n,t,s[l],e);return{namespace:n._config.namespace,nodes:e}}function wy(n){const t=[];for(const e of n)t.push(Sp(e));return t}let Qn=null;async function kl(n,t,e){if(Qn!==null)return!1;if(t!==null)return new Promise((a,u)=>{n.update(()=>{a(vu(n,t,e))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=Dt(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(i.createTextNode("#")),r.append(l);const c=i.createRange();return c.setStart(l,0),c.setEnd(l,1),s.removeAllRanges(),s.addRange(c),new Promise((a,u)=>{const f=n.registerCommand(Eo,d=>(Ke(d,ClipboardEvent)&&(f(),Qn!==null&&(o.clearTimeout(Qn),Qn=null),a(vu(n,d,e))),!0),md);Qn=o.setTimeout(()=>{f(),Qn=null,a(!1)},50),i.execCommand("copy"),l.remove()})}function vu(n,t,e){if(e===void 0){const o=Dt(n._window),i=A();if(!i||i.isCollapsed()||!o)return!1;const s=re(o,n.getRootElement()),l=s.anchorNode,c=s.focusNode;if(l!==null&&c!==null&&!Oo(n,l,c))return!1;e=$c(i)}t.preventDefault();const r=t.clipboardData;return r!==null&&(zh(r,e),!0)}const Ey=[["text/html",Lh],["application/x-lexical-editor",Ih]];function $c(n=A()){return(function(t,e){const r={"text/plain":""};for(const[o,i]of Object.entries(t))if(i){const s=Oy(i,e);s!==null&&(r[o]=s)}return r})($y(),n)}function zh(n,t){for(const[e]of Ey)t[e]===void 0&&n.setData(e,"");for(const e in t){const r=t[e];r!==void 0&&n.setData(e,r)}}function $y(n=St()){const t=Kr(n,Ay.name);return t?t.output:Bh}const Bh={"application/x-lexical-editor":[(n,t)=>n?Ih(St(),n):t()],"text/html":[(n,t)=>n?Lh(St(),n):t()],"text/plain":[(n,t)=>n?n.getTextContent():t()]};function Oy(n,t){const e=r=>n[r]?n[r](t,e.bind(null,r-1)):null;return e(n.length-1)}const Ay={build:(n,t,e)=>t.$exportMimeType,config:{$exportMimeType:Bh},mergeConfig(n,t){const e=_c(n,t);if(t.$exportMimeType){const r={...n.$exportMimeType};for(const[o,i]of Object.entries(t.$exportMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}e.$exportMimeType=r}return e},name:"@lexical/clipboard/GetClipboardData"},My={$import:(n,t)=>{const e=Mr(t.nodeName.toLowerCase());return Hn(t,e),Je(e,t),be(e,t),[e.splice(0,0,n.$importChildren(t))]},match:Ot.tag("h1","h2","h3","h4","h5","h6"),name:"@lexical/rich-text/heading"},Fy={$import:(n,t)=>{const e=Br();return Je(e,t),Hn(t,e),be(e,t),[e.splice(0,0,n.$importChildren(t))]},match:Ot.tag("blockquote"),name:"@lexical/rich-text/blockquote"};Ot.tag("blockquote");Ot.tag("p"),Ot.tag("span");const Nu=K("DRAG_DROP_PASTE_FILE"),Ds=ko("shadowRoot",{parse:Boolean});class ls extends bt{$config(){return this.config("quote",{extends:bt,importDOM:{blockquote:()=>({conversion:Dy,priority:0})},stateConfigs:[{flat:!0,stateConfig:Ds}]})}isShadowRoot(){return wo(this,Ds)}setIsShadowRoot(t){return ar(this,Ds,t)}createDOM(t){const e=Z().createElement("blockquote");return kt(e,t.theme.quote),e}updateDOM(t,e,r){return!1}exportDOM(t){const{element:e}=super.exportDOM(t);if(B(e)){this.isEmpty()&&e.append(Z().createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r);const o=this.getDirection();o&&(e.dir=o)}return{element:e}}exportJSON(){return super.exportJSON()}static importJSON(t){return Br().updateFromJSON(t)}insertNewAfter(t,e){const r=V(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,e),r}collapseAtStart(){if(this.isShadowRoot()){for(const e of this.getChildren())this.insertBefore(e);return this.remove(),!0}const t=V();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),!0}canMergeWhenEmpty(){return!0}}function Br(n){const t=Gt(new ls);return n&&n.shadowRoot?t.setIsShadowRoot(!0):t}function wl(n){return n instanceof ls}let cs=class extends bt{__tag;$config(){return this.config("heading",{extends:bt,importDOM:{h1:()=>({conversion:Zn,priority:0}),h2:()=>({conversion:Zn,priority:0}),h3:()=>({conversion:Zn,priority:0}),h4:()=>({conversion:Zn,priority:0}),h5:()=>({conversion:Zn,priority:0}),h6:()=>({conversion:Zn,priority:0}),p:t=>{const e=t.firstChild;return e!==null&&Tu(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Tu(t)?{conversion:()=>({node:Mr("h1")}),priority:3}:null}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__tag=t.__tag}constructor(t="h1",e){super(e),this.__tag=t}getTag(){return this.getLatest().__tag}setTag(t){const e=this.getWritable();return e.__tag=t,e}createDOM(t){const e=this.__tag,r=Z().createElement(e),o=t.theme.heading;if(o!==void 0){const i=o[e];kt(r,i)}return r}updateDOM(t,e,r){return t.__tag!==this.__tag}exportDOM(t){const{element:e}=super.exportDOM(t);if(B(e)){this.isEmpty()&&e.append(Z().createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r);const o=this.getDirection();o&&(e.dir=o)}return{element:e}}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=!0){const r=t?t.anchor.offset:0,o=this.getLastDescendant(),i=!o||t&&t.anchor.key===o.getKey()&&r===o.getTextContentSize()||!t?V():Mr(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,e),r===0&&!this.isEmpty()&&t){const l=V();l.select(),this.replace(l,!0)}return i}collapseAtStart(){if(this.isEmpty()){const t=V();this.getChildren().forEach(e=>t.append(e)),this.replace(t)}return!0}extractWithChild(){return!0}};function Tu(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Zn(n){const t=n.nodeName.toLowerCase();let e=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(e=Mr(t),Hn(n,e),Je(e,n),be(e,n)),{node:e}}function Dy(n){const t=Br();return Je(t,n),Hn(n,t),be(t,n),{node:t}}function Mr(n="h1"){return Gt(new cs(n))}function Wh(n){return n instanceof cs}function ku(n){const t=Xt(n);return G(t)}function tr(n,t,e,r){let o=!1,i=null;if(n.isCollapsed()&&n.anchor.type==="text"){const l=n.anchor.getNode();if(O(l)){i=l;const c=n.anchor.offset,a=c===l.getTextContentSize()&&l.getNextSibling()===null,u=c===0&&l.getPreviousSibling()===null;o=e==="end"&&a||e==="start"&&u||e==="both"&&(a||u)}}let s=!1;for(const[l,c]of Object.entries(r)){if(c==null||!c[t])continue;const a=l;if(c.onlyAtBoundary){if(!(o&&i&&O(i)&&i.hasFormat(a)))continue;s=!0}n.hasFormat(a)&&n.toggleFormat(a)}s&&n.setStyle("")}const Py={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function Wo(n,t){return(function(e,r){if(!e.isCollapsed())return!1;const o=Jt(e.focus,r),i=U(o.origin,oo);if(!i)return!1;const s=e.focus.getNode();if(!i.is(s)&&!wr(s,i))return!1;const l=Ee(o,et(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const c=Ee(l.anchor.getSiblingCaret(),l.focus);let a=c.anchor.origin;for(const f of c){if(!Me(f)||!f.origin.is(a.getParent()))return!1;a=f.origin}let u=i;for(const f of Or(et(i,r))){if(!f.origin.is(u.getParent())){if(ri(f.origin)){const d=et(u,r);return Ar(Ee(d,d)),!0}break}if(!oo(f.origin))break;u=f.origin}return!1})(n,t)||(function(e,r){if(!e.isCollapsed()||e.anchor.type!=="element")return!1;const o=Jt(e.anchor,r).getNodeAtCaret();return!(!oo(o)||o.isInline()||(Ar(Mo(Ut(Ft(o,r)))),0))})(n,t)}function wu(n){return G(n)&&!n.isInline()&&!n.isIsolated()&&n.isKeyboardSelectable()}function Uo(n){const t=ho();t.add(n),gt(t)}function Eu(n,t){if(!n.isCollapsed())return!1;const e=n.focus,r=e.getNode(),o=t?"previous":"next",i=Jt(e,o);if(e.type==="element"&&C(r)&&xt(r)){const m=i.getNodeAtCaret();return!(m===null||!wu(m))&&(Uo(m.__key),!0)}const s=U(C(r)?r:r.getParentOrThrow(),m=>C(m)&&!m.isInline()&&xt(m.getParent()));if(s===null)return!1;const l=et(s,o).getNodeAtCaret();if(l===null||!wu(l))return!1;if(s.getTextContentSize()===0)return Uo(l.__key),!0;const c=St().getRootElement();if(c===null)return!1;const a=Dt(c.ownerDocument.defaultView);if(a===null||a.rangeCount===0)return!1;const u=a.anchorNode,f=a.anchorOffset,d=a.focusNode,h=a.focusOffset;a.modify("move",t?"backward":"forward","line");const g=a.anchorNode,_=a.anchorOffset;if(g===null)return $u(a,u,f,d,h),!1;const p=Xt(g);return $u(a,u,f,d,h),p===null?!1:(g===u&&_===f||!p.is(s)&&!wr(p,s))&&(Uo(l.__key),!0)}function $u(n,t,e,r,o){t!==null&&r!==null&&n.setBaseAndExtent(t,e,r,o)}function Ou(n,t){if(!n.isCollapsed())return!1;const e=n.focus.getNode(),r=U(C(e)?e:e.getParentOrThrow(),p=>C(p)&&!p.isInline());if(r===null)return!1;const o=St(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const p of r.getChildren())if(C(p)&&p.isInline()){const m=o.getElementByKey(p.getKey());if(m!==null){const y=s.getComputedStyle(m).display;if(y==="inline-grid"||y==="inline-flex"){l=!0;break}}}if(!l)return!1;const c=et(r,t?"previous":"next").getNodeAtCaret();if(c===null||!C(c)){if(t){const p=r.getFirstDescendant();O(p)?p.select(0,0):r.select(0,0)}else{const p=r.getLastDescendant();if(O(p)){const m=p.getTextContentSize();p.select(m,m)}else{const m=r.getChildrenSize();r.select(m,m)}}return!0}const a=o.getElementByKey(c.getKey());if(a===null)return!1;const u=Dt(s);if(u===null||u.rangeCount===0)return!1;const f=u.getRangeAt(0).cloneRange();f.collapse(!0);const d=f.getBoundingClientRect(),h=a.getBoundingClientRect(),g=h.top+h.height/2;if(d.height>0){const p=Ri(d.left,g,i);if(p!==null&&a.contains(p.node)){const m=i.ownerDocument.createRange();return m.setStart(p.node,p.offset),m.collapse(!0),n.applyDOMRange(m),n.dirty=!0,!0}}const _=t?c.getLastDescendant():c.getFirstDescendant();if(O(_)){const p=t?_.getTextContentSize():0;_.select(p,p)}else{const p=c.getChildrenSize();c.select(t?p:0,t?p:0)}return!0}function jo(n,t){const e=et(n,t),r=e.getAdjacentCaret();r!==null&&C(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Ar(Mo(e)):t==="next"?n.selectNext(0,0):n.selectPrevious()}function Au(n,t,e){e.preventDefault(),e.stopPropagation();const r=n.getNodes();if(r.length===0)return!0;const o=r.map(c=>et(c,"next")).sort(xo),i=(t?o[0]:o[o.length-1]).origin,s=U(i,c=>c!==i&&C(c)&&!c.isInline())??Ct(),l=t?0:s.getChildrenSize();return s.select(l,l),!0}function Ry(n,t=Fo(Py)){return qt(n.registerCommand(Wi,()=>{const e=A();return dt(e)?(e.clear(),!0):(w(e)&&tr(e,"click","both",t.peek()),!1)},X),n.registerCommand(hn,e=>{const r=A();return w(r)?(r.deleteCharacter(e),!0):!!dt(r)&&(r.deleteNodes(),!0)},X),n.registerCommand(Cr,e=>{const r=A();return!!w(r)&&(r.deleteWord(e),!0)},X),n.registerCommand(Sr,e=>{const r=A();return!!w(r)&&(r.deleteLine(e),!0)},X),n.registerCommand(On,e=>{const r=A();if(typeof e=="string")r!==null&&r.insertText(e);else{if(r===null)return!1;const o=e.dataTransfer;if(o!=null)Nl(o,r);else if(w(r)){const i=e.data;return i&&r.insertText(i),!0}}return!0},X),n.registerCommand(Qo,()=>{const e=A();return!!w(e)&&(e.removeText(),!0)},X),n.registerCommand(ke,e=>{const r=A();return!(!w(r)&&!dt(r))&&(Qf(r,e),!0)},X),n.registerCommand(Bg,e=>{const r=A();return!(!w(r)&&!dt(r))&&(pp(r,e),!0)},X),n.registerCommand(Df,e=>{const r=A();if(!w(r)&&!dt(r))return!1;const o=r.getNodes();for(const i of o){const s=U(i,l=>C(l)&&!l.isInline());s!==null&&s.setFormat(e)}return!0},X),n.registerCommand(ur,e=>{const r=A();return!!w(r)&&(r.insertLineBreak(e),!0)},X),n.registerCommand(Dn,()=>{const e=A();return!!w(e)&&(e.insertParagraph(),!0)},X),n.registerCommand(Wg,()=>{const e=Vi(),r=A();return w(r)&&(e.setFormat(r.format),e.setStyle(r.style)),Xl([e]),!0},X),n.registerCommand(Ug,()=>Ya(e=>{const r=e.getIndent();e.setIndent(r+1)}),X),n.registerCommand(ta,()=>Ya(e=>{const r=e.getIndent();r>0&&e.setIndent(Math.max(0,r-1))}),X),n.registerCommand(Wl,e=>{const r=A();if(dt(r)){const o=r.getNodes();if(o.length>0)return e.preventDefault(),jo(o[0],"previous"),!0}else if(w(r)&&((function(o){const i=o.focus;return i.key==="root"&&i.offset===0})(r)||!e.shiftKey&&Wo(r,"previous")||!e.shiftKey&&Eu(r,!0)||!e.shiftKey&&Ou(r,!0)))return e.preventDefault(),!0;return!1},X),n.registerCommand(Ul,e=>{const r=A();if(dt(r)){const o=r.getNodes();if(o.length>0)return e.preventDefault(),jo(o[0],"next"),!0}else if(w(r)&&((function(o){const i=o.focus;return i.key==="root"&&i.offset===Ct().getChildrenSize()})(r)||!e.shiftKey&&Wo(r,"next")||!e.shiftKey&&Eu(r,!1)||!e.shiftKey&&Ou(r,!1)))return e.preventDefault(),!0;return!1},X),n.registerCommand(Bl,e=>{const r=A();if(dt(r)){const o=r.getNodes();if(o.length>0)return e.preventDefault(),jo(o[0],Io(o[0])?"next":"previous"),!0}if(!w(r))return!1;if(!e.shiftKey&&Wo(r,Io(r.anchor.getNode())?"next":"previous"))return e.preventDefault(),!0;if(e.shiftKey||tr(r,"arrow","start",t.peek()),qa(r,!0)){const o=e.shiftKey;return e.preventDefault(),Va(r,o,!0),!0}return!1},X),n.registerCommand(zl,e=>{const r=A();if(dt(r)){const o=r.getNodes();if(o.length>0)return e.preventDefault(),jo(o[0],Io(o[0])?"previous":"next"),!0}if(!w(r))return!1;if(!e.shiftKey&&Wo(r,Io(r.anchor.getNode())?"previous":"next"))return e.preventDefault(),!0;if(e.shiftKey||tr(r,"arrow","end",t.peek()),qa(r,!1)){const o=e.shiftKey;return e.preventDefault(),Va(r,o,!1),!0}return!1},X),n.registerCommand(Hi,e=>{const r=A();if(!dt(r)&&ku(e.target))return!1;if(w(r)){if((function(o){if(!o.isCollapsed())return!1;const{anchor:i}=o;if(i.offset!==0)return!1;const s=i.getNode();if(Et(s))return!1;const l=Dm(s);return l.getIndent()>0&&(l.is(s)||s.is(l.getFirstDescendant()))})(r))return e.preventDefault(),n.dispatchCommand(ta);if(mn&&xr)return!1}else if(!dt(r))return!1;return e.preventDefault(),n.dispatchCommand(hn,!0)},X),n.registerCommand(Hl,e=>{const r=A();return!(!dt(r)&&ku(e.target))&&!(!w(r)&&!dt(r))&&(e.preventDefault(),n.dispatchCommand(hn,!1))},X),n.registerCommand(di,e=>{let r=A();if(dt(r)){const o=r.getNodes();o.length===1&&G(o[0])&&!o[0].isInline()&&(r=o[0].selectNext())}if(!w(r))return!1;if(tr(r,"enter","both",t.peek()),e!==null){if((mn||No||To)&&xr)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(ur,!1)}return n.dispatchCommand(Dn)},X),n.registerCommand(jl,()=>{const e=A();return!!w(e)&&(n.blur(),!0)},X),n.registerCommand(Ff,e=>{const[,r]=Ko(e);if(r.length>0){const o=e.clientX,i=e.clientY,s=Ri(o,i,n.getRootElement());if(s!==null){const{offset:l,node:c}=s,a=Xt(c);if(a!==null){const u=Yl();if(O(a))u.anchor.set(a.getKey(),l,"text"),u.focus.set(a.getKey(),l,"text");else{const d=a.getParentOrThrow().getKey(),h=a.getIndexWithinParent()+1;u.anchor.set(d,h,"element"),u.focus.set(d,h,"element")}const f=De(u);gt(f)}n.dispatchCommand(Nu,r)}return e.preventDefault(),!0}return Ty(e,n)},X),n.registerCommand(Pf,e=>{const[r]=Ko(e),o=A();return!(r&&!w(o))&&(w(o)&&!o.isCollapsed()&&e.dataTransfer!==null&&(zh(e.dataTransfer,$c(o)),vy(e.dataTransfer,n)),!0)},X),n.registerCommand(Rf,e=>{const[r]=Ko(e),o=A();if(r&&!w(o))return!1;const i=e.clientX,s=e.clientY,l=Ri(i,s,n.getRootElement());if(l!==null){const c=Xt(l.node);G(c)&&e.preventDefault()}return!0},X),n.registerCommand(ql,()=>{const e=A();return Dp(w(e)&&es(e.anchor.getNode())!==null?e:null),!0},X),n.registerCommand(Eo,e=>(kl(n,Ke(e,ClipboardEvent)?e:null),!0),X),n.registerCommand(Ji,e=>((async function(r,o){await kl(o,Ke(r,ClipboardEvent)?r:null),o.update(()=>{const i=A();w(i)?i.removeText():dt(i)&&i.getNodes().forEach(s=>s.remove())},{tag:Jf})})(e,n),!0),X),n.registerCommand(Rr,e=>{const[,r,o]=Ko(e);return r.length>0&&!o?(n.dispatchCommand(Nu,r),!0):Ae(e.target)&&rc(e.target)?!1:A()!==null&&((function(i,s){i.preventDefault(),s.update(()=>{const l=A(),c=Ke(i,InputEvent)||Ke(i,KeyboardEvent)?null:i.clipboardData;c!=null&&l!==null&&Nl(c,l)},{tag:Hf})})(e,n),!0)},X),n.registerCommand(Mf,()=>{const e=A();return w(e)&&tr(e,"space","both",t.peek()),!1},X),n.registerCommand(Jl,()=>{const e=A();return w(e)&&tr(e,"tab","both",t.peek()),!1},X),n.registerCommand(Of,e=>{const r=A();if(dt(r))return Au(r,!1,e);if(!w(r))return!1;const{anchor:o}=r;if(o.type!=="element"||o.offset!==0)return!1;const i=o.getNode();if(!C(i))return!1;const s=i.getFirstChild();if(!G(s)||!s.isInline())return!1;const l=i.getKey(),c=i.selectEnd();return e.shiftKey&&c.anchor.set(l,0,"element"),e.preventDefault(),e.stopPropagation(),!0},X),n.registerCommand(Af,e=>{const r=A();if(dt(r))return Au(r,!0,e);if(!w(r))return!1;const{anchor:o,focus:i}=r,s=U(i.getNode(),a=>C(a)&&!a.isInline());if(s===null)return!1;const l=s.getFirstChild();if(!G(l)||!l.isInline()||U(o.getNode(),a=>C(a)&&!a.isInline())!==s)return!1;const c=s.getKey();return(i.type!=="element"||i.key!==c||i.offset!==0)&&(r.focus.set(c,0,"element"),e.shiftKey||r.anchor.set(c,0,"element"),e.preventDefault(),e.stopPropagation(),!0)},X))}function Ly(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Oc=Vt?L.useLayoutEffect:L.useEffect;function Iy({editor:n,ErrorBoundary:t}){return(function(e,r){const[o,i]=L.useState(()=>e.getDecorators());return Oc(()=>e.registerDecoratorListener(s=>{Dc.flushSync(()=>{i(s)})}),[e]),L.useEffect(()=>{i(e.getDecorators())},[e]),L.useMemo(()=>{const s=[],l=Object.keys(o);for(let c=0;c<l.length;c++){const a=l[c],u=H.jsx(r,{onError:d=>e._onError(d),children:H.jsx(L.Suspense,{fallback:null,children:o[a]})}),f=e.getElementByKey(a);f!==null&&s.push(Dc.createPortal(u,f,a))}return s},[r,o,e])})(n,t)}function Ky({editor:n,ErrorBoundary:t}){return(function(e){const r=fh.maybeFromEditor(e);if(r&&r.hasExtensionByName(hy.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&Ly(320,o);return!0}return!1})(n)?null:H.jsx(Iy,{editor:n,ErrorBoundary:t})}function Mu(n){return n.read("latest",qd(n.isComposing()))}function zy({contentEditable:n,placeholder:t=null,ErrorBoundary:e}){const[r]=oe();return(function(o){Oc(()=>qt(Ry(o),_y(o)),[o])})(r),H.jsxs(H.Fragment,{children:[n,H.jsx(By,{content:t}),H.jsx(Ky,{editor:r,ErrorBoundary:e})]})}function By({content:n}){const[t]=oe(),e=(function(o){const[i,s]=L.useState(()=>Mu(o));return Oc(()=>{function l(){const c=Mu(o);s(c)}return l(),qt(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i})(t),r=dy();return e?typeof n=="function"?n(r):n:null}const mr=/^(\d+(?:\.\d+)?)px$/,ut={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};let Vn=class extends bt{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;$config(){return this.config("tablecell",{extends:bt,importDOM:{td:()=>({conversion:Fu,priority:0}),th:()=>({conversion:Fu,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__rowSpan=t.__rowSpan,this.__backgroundColor=t.__backgroundColor,this.__verticalAlign=t.__verticalAlign,this.__colSpan=t.__colSpan,this.__headerState=t.__headerState,this.__width=t.__width}updateFromJSON(t){return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan||1).setRowSpan(t.rowSpan||1).setWidth(t.width||void 0).setBackgroundColor(t.backgroundColor||null).setVerticalAlign(t.verticalAlign||void 0)}constructor(t=ut.NO_STATUS,e=1,r,o){super(o),this.__colSpan=e,this.__rowSpan=1,this.__headerState=t,this.__width=r,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(t){const e=Z().createElement(this.getTag());return this.__width&&(e.style.width=`${this.__width}px`),this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(e.style.backgroundColor=this.__backgroundColor),El(this.__verticalAlign)&&(e.style.verticalAlign=this.__verticalAlign),kt(e,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),e}exportDOM(t){const e=super.exportDOM(t);if(B(e.element)){const r=e.element;r.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign=this.getVerticalAlign()||"top",r.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return e}exportJSON(){return{...super.exportJSON(),...El(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(t){const e=this.getWritable();return e.__colSpan=t,e}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(t){const e=this.getWritable();return e.__rowSpan=t,e}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(t,e=ut.BOTH){const r=this.getWritable();return r.__headerState=t&e|r.__headerState&~e,r}getHeaderStyles(){return this.getLatest().__headerState}setWidth(t){const e=this.getWritable();return e.__width=t,e}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(t){const e=this.getWritable();return e.__backgroundColor=t,e}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(t){const e=this.getWritable();return e.__verticalAlign=t||void 0,e}toggleHeaderStyle(t){const e=this.getWritable();return(e.__headerState&t)===t?e.__headerState-=t:e.__headerState+=t,e}hasHeaderState(t){return(this.getHeaderStyles()&t)===t}hasHeader(){return this.getLatest().__headerState!==ut.NO_STATUS}updateDOM(t){return t.__headerState!==this.__headerState||t.__width!==this.__width||t.__colSpan!==this.__colSpan||t.__rowSpan!==this.__rowSpan||t.__backgroundColor!==this.__backgroundColor||t.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function El(n){return n==="middle"||n==="bottom"}function Fu(n){const t=n,e=n.nodeName.toLowerCase();let r;mr.test(t.style.width)&&(r=parseFloat(t.style.width));let o=ut.NO_STATUS;if(e==="th"){const _=t.getAttribute("scope");if(_==="col")o=ut.COLUMN;else if(_==="row")o=ut.ROW;else{const p=t.parentElement,m=B(p)&&p.nodeName.toLowerCase()==="tr"&&B(p.parentElement)&&(p.parentElement.nodeName.toLowerCase()==="thead"||p.rowIndex===0),y=t.cellIndex===0;m&&(o|=ut.ROW),y&&(o|=ut.COLUMN),o===ut.NO_STATUS&&(o=ut.ROW)}}const i=Ce(o,t.colSpan,r);i.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const l=t.style.verticalAlign;El(l)&&(i.__verticalAlign=l);const c=t.style,a=(c&&c.textDecoration||"").split(" "),u=c.fontWeight==="700"||c.fontWeight==="bold",f=a.includes("line-through"),d=c.fontStyle==="italic",h=a.includes("underline"),g=c.color;return{after:_=>{const p=[];let m=null;const y=()=>{if(m){const x=m.getFirstChild();It(x)&&m.getChildrenSize()===1&&x.remove()}};for(const x of _)if(uc(x)||O(x)||It(x)){if(O(x)&&(u&&x.toggleFormat("bold"),f&&x.toggleFormat("strikethrough"),d&&x.toggleFormat("italic"),h&&x.toggleFormat("underline"),g)){const b=x.getStyle();b.includes("color:")||x.setStyle(b+`color: ${g};`)}m?m.append(x):(m=V().append(x),p.push(m))}else p.push(x),y(),m=null;return y(),p.length===0&&p.push(V()),p},node:i}}function Ce(n=ut.NO_STATUS,t=1,e){return Gt(new Vn(n,t,e))}function J(n){return n instanceof Vn}const Wy=K("INSERT_TABLE_COMMAND");function j(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class as extends bt{__height;$config(){return this.config("tablerow",{extends:bt,importDOM:{tr:()=>({conversion:Uy,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__height=t.__height}updateFromJSON(t){return super.updateFromJSON(t).setHeight(t.height)}constructor(t=void 0,e){super(e),this.__height=t}exportJSON(){const t=this.getHeight();return{...super.exportJSON(),...t===void 0?void 0:{height:t}}}createDOM(t){const e=Z().createElement("tr");return this.__height&&(e.style.height=`${this.__height}px`),kt(e,t.theme.tableRow),e}extractWithChild(t,e,r){return r==="html"}isShadowRoot(){return!0}setHeight(t){const e=this.getWritable();return e.__height=t,e}getHeight(){return this.getLatest().__height}updateDOM(t){return t.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function Uy(n){const t=n;let e;return mr.test(t.style.height)&&(e=parseFloat(t.style.height)),{after:r=>Ai(r,J),node:Fr(e)}}function Fr(n){return Gt(new as(n))}function vt(n){return n instanceof as}function jy(n,t,e=!0){const r=hs();for(let o=0;o<n;o++){const i=Fr();for(let s=0;s<t;s++){let l=ut.NO_STATUS;typeof e=="object"?(o===0&&e.rows&&(l|=ut.ROW),s===0&&e.columns&&(l|=ut.COLUMN)):e&&(o===0&&(l|=ut.ROW),s===0&&(l|=ut.COLUMN));const c=Ce(l),a=V();a.append(wt()),c.append(a),i.append(c)}r.append(i)}return r}function Hy(n){const t=U(n,e=>yt(e));if(yt(t))return t;throw new Error("Expected table cell to be inside of table.")}const $l=(n,t)=>n===ut.BOTH||n===t?t:ut.NO_STATUS;function Jy(n,t=!0){const[,,e]=ze(n),[r,o]=Fe(e,n,n),i=r[0].length,{startRow:s}=o;let l=null;if(t){const c=s+n.__rowSpan-1,a=r[c],u=Fr();for(let d=0;d<i;d++){const{cell:h,startRow:g}=a[d];if(g+h.__rowSpan-1<=c){const _=a[d].cell.__headerState,p=$l(_,ut.COLUMN);u.append(Ce(p).append(V()))}else h.setRowSpan(h.__rowSpan+1)}const f=e.getChildAtIndex(c);vt(f)||j(256),f.insertAfter(u),l=u}else{const c=s,a=r[c],u=Fr();for(let d=0;d<i;d++){const{cell:h,startRow:g}=a[d];if(g===c){const _=a[d].cell.__headerState,p=$l(_,ut.COLUMN);u.append(Ce(p).append(V()))}else h.setRowSpan(h.__rowSpan+1)}const f=e.getChildAtIndex(c);vt(f)||j(257),f.insertBefore(u),l=u}return l}function qy(n,t=!0,e=!0){const[,,r]=ze(n),[o,i]=Fe(r,n,n),s=o.length,{startColumn:l}=i,c=t?l+n.__colSpan-1:l-1,a=r.getFirstChild();vt(a)||j(120);let u=null;function f(g=ut.NO_STATUS){const _=Ce(g).append(V());return u===null&&(u=_),_}let d=a;t:for(let g=0;g<s;g++){if(g!==0){const T=d.getNextSibling();vt(T)||j(121),d=T}const _=o[g],p=_[c<0?0:c].cell.__headerState,m=$l(p,ut.ROW);if(c<0){Uh(d,f(m));continue}const{cell:y,startColumn:x,startRow:b}=_[c];if(x+y.__colSpan-1<=c){let T=y,v=b,N=c;for(;v!==g&&T.__rowSpan>1;){if(N-=y.__colSpan,!(N>=0)){d.append(f(m));continue t}{const{cell:S,startRow:k}=_[N];T=S,v=k}}T.insertAfter(f(m))}else y.setColSpan(y.__colSpan+1)}u!==null&&e&&Vy(u);const h=r.getColWidths();if(h){const g=[...h],_=c<0?0:c,p=g[_];g.splice(_,0,p),r.setColWidths(g)}return u}function Vy(n){const t=n.getFirstDescendant();t==null?n.selectStart():t.getParentOrThrow().selectStart()}function Uh(n,t){const e=n.getFirstChild();e!==null?e.insertBefore(t):n.append(t)}function Yy(n){if(n.length===0)return null;const t=Hy(n[0]),[e]=Ze(t,null,null);let r=1/0,o=-1/0,i=1/0,s=-1/0;const l=new Set;for(const h of e)for(const g of h){if(!g||!g.cell)continue;const _=g.cell.getKey();if(!l.has(_)&&n.some(p=>p.is(g.cell))){l.add(_);const p=g.startRow,m=g.startColumn,y=g.cell.__rowSpan||1,x=g.cell.__colSpan||1;r=Math.min(r,p),o=Math.max(o,p+y-1),i=Math.min(i,m),s=Math.max(s,m+x-1)}}if(r===1/0||i===1/0)return null;const c=o-r+1,a=s-i+1,u=e[r][i];if(!u.cell)return null;const f=u.cell;f.setColSpan(a),f.setRowSpan(c);const d=new Set([f.getKey()]);for(let h=r;h<=o;h++)for(let g=i;g<=s;g++){const _=e[h][g];if(!_.cell)continue;const p=_.cell,m=p.getKey();d.has(m)||(d.add(m),Xy(p)||f.append(...p.getChildren()),p.remove())}return f.getChildrenSize()===0&&f.append(V()),f}function Xy(n){if(n.getChildrenSize()!==1)return!1;const t=n.getFirstChildOrThrow();return!(!cn(t)||!t.isEmpty())}function Gy(n){const[t,e,r]=ze(n),o=t.__colSpan,i=t.__rowSpan;if(o===1&&i===1)return;const[s,l]=Fe(r,t,t),{startColumn:c,startRow:a}=l,u=t.__headerState&ut.COLUMN,f=Array.from({length:o},(g,_)=>{let p=u;for(let m=0;p!==0&&m<s.length;m++)p&=s[m][_+c].cell.__headerState;return p}),d=t.__headerState&ut.ROW,h=Array.from({length:i},(g,_)=>{let p=d;for(let m=0;p!==0&&m<s[0].length;m++)p&=s[_+a][m].cell.__headerState;return p});if(o>1){for(let g=1;g<o;g++)t.insertAfter(Ce(f[g]|h[0]).append(V()));t.setColSpan(1)}if(i>1){let g;for(let _=1;_<i;_++){const p=a+_,m=s[p];g=(g||e).getNextSibling(),vt(g)||j(125);let y=null;for(let x=0;x<c;x++){const b=m[x],T=b.cell;b.startRow===p&&(y=T),T.__colSpan>1&&(x+=T.__colSpan-1)}if(y===null)for(let x=o-1;x>=0;x--)Uh(g,Ce(f[x]|h[_]).append(V()));else for(let x=o-1;x>=0;x--)y.insertAfter(Ce(f[x]|h[_]).append(V()))}t.setRowSpan(1)}}function Fe(n,t,e){const[r,o,i]=Ze(n,t,e);return o===null&&j(207),i===null&&j(208),[r,o,i]}function Ze(n,t,e){const r=[];let o=null,i=null;function s(c){let a=r[c];return a===void 0&&(r[c]=a=[]),a}const l=n.getChildren();for(let c=0;c<l.length;c++){const a=l[c];vt(a)||j(209);const u=s(c);for(let f=a.getFirstChild(),d=0;f!=null;f=f.getNextSibling()){for(J(f)||j(147);u[d]!==void 0;)d++;const h={cell:f,startColumn:d,startRow:c},{__rowSpan:g,__colSpan:_}=f;for(let p=0;p<g&&!(c+p>=l.length);p++){const m=s(c+p);for(let y=0;y<_;y++)m[d+y]=h}t!==null&&o===null&&t.is(f)&&(o=h),e!==null&&i===null&&e.is(f)&&(i=h)}}return[r,o,i]}function ze(n){let t;if(n instanceof Vn)t=n;else if("__type"in n){const o=U(n,J);J(o)||j(148),t=o}else{const o=U(n.getNode(),J);J(o)||j(148),t=o}const e=t.getParent();vt(e)||j(149);const r=e.getParent();return yt(r)||j(210),[t,e,r]}function Li(n,t,e){let r,o=Math.min(t.startColumn,e.startColumn),i=Math.min(t.startRow,e.startRow),s=Math.max(t.startColumn+t.cell.__colSpan-1,e.startColumn+e.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,e.startRow+e.cell.__rowSpan-1);do{r=!1;for(let c=0;c<n.length;c++)for(let a=0;a<n[0].length;a++){const u=n[c][a];if(!u)continue;const f=u.startColumn+u.cell.__colSpan-1,d=u.startRow+u.cell.__rowSpan-1,h=u.startColumn<=s&&f>=o,g=u.startRow<=l&&d>=i;if(h&&g){const _=Math.min(o,u.startColumn),p=Math.max(s,f),m=Math.min(i,u.startRow),y=Math.max(l,d);_===o&&p===s&&m===i&&y===l||(o=_,s=p,i=m,l=y,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:o,minRow:i}}function Du(n){const[t,,e]=ze(n),r=e.getChildren().filter(vt),o=r.length,i=r[0].getChildren().length,s=new Array(o);for(let l=0;l<o;l++)s[l]=new Array(i);for(let l=0;l<o;l++){const c=r[l].getChildren().filter(J);let a=0;for(let u=0;u<c.length;u++){for(;s[l][a];)a++;const f=c[u],d=f.__rowSpan||1,h=f.__colSpan||1;for(let g=0;g<d;g++)for(let _=0;_<h;_++)s[l+g][a+_]=f;if(t===f)return{colSpan:h,columnIndex:a,rowIndex:l,rowSpan:d};a+=h}}return null}function jh(n,t){const e=t.getStartEndPoints(),r=mt(t);if(e===null)return!1;const[o,i]=e,[s,l,c]=ze(o),a=U(i.getNode(),E=>J(E));if(!(J(s)&&J(a)&&vt(l)&&yt(c)))return!1;const[u,f,d]=Fe(c,s,a),[h]=Ze(n,null,null),g=u.length,_=g>0?u[0].length:0;let p=f.startRow,m=f.startColumn,y=h.length,x=y>0?h[0].length:0;if(r){const E=Li(u,f,d),F=E.maxRow-E.minRow+1,R=E.maxColumn-E.minColumn+1;p=E.minRow,m=E.minColumn,y=Math.min(y,F),x=Math.min(x,R)}let b=!1;const T=Math.min(g,p+y)-1,v=Math.min(_,m+x)-1,N=new Set;for(let E=p;E<=T;E++)for(let F=m;F<=v;F++){const R=u[E][F];N.has(R.cell.getKey())||R.cell.__rowSpan===1&&R.cell.__colSpan===1||(Gy(R.cell),N.add(R.cell.getKey()),b=!0)}let[S]=Ze(c.getWritable(),null,null);const k=y-g+p;for(let E=0;E<k;E++)Jy(S[g-1][0].cell);const M=x-_+m;for(let E=0;E<M;E++)qy(S[0][_-1].cell,!0,!1);[S]=Ze(c.getWritable(),null,null);for(let E=p;E<p+y;E++)for(let F=m;F<m+x;F++){const R=E-p,z=F-m,q=h[R][z];if(q.startRow!==R||q.startColumn!==z)continue;const ot=q.cell;if(ot.__rowSpan!==1||ot.__colSpan!==1){const P=[],W=Math.min(E+ot.__rowSpan,p+y)-1,at=Math.min(F+ot.__colSpan,m+x)-1;for(let nt=E;nt<=W;nt++)for(let At=F;At<=at;At++){const ae=S[nt][At];P.push(ae.cell)}Yy(P),b=!0}const{cell:ct}=S[E][F],st=ot.getBackgroundColor();st!=null&&ct.setBackgroundColor(st);const I=ct.getChildren();ot.getChildren().forEach(P=>{O(P)&&V().append(P),ct.append(P)}),I.forEach(P=>P.remove())}if(r&&b){const[E]=Ze(c.getWritable(),null,null);E[f.startRow][f.startColumn].cell.selectEnd()}return!0}function Ps(n){const[[t,e,r,o],[i,s,l,c]]=["anchor","focus"].map(a=>{const u=n[a].getNode(),f=U(u,J);J(f)||j(238,a,u.getKey(),u.getType());const d=f.getParent();vt(d)||j(239,a);const h=d.getParent();return yt(h)||j(240,a),[u,f,d,h]});return o.is(c)||j(241),{anchorCell:e,anchorNode:t,anchorRow:r,anchorTable:o,focusCell:s,focusNode:i,focusRow:l,focusTable:c}}class us{tableKey;anchor;focus;_cachedNodes;dirty;constructor(t,e,r){this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=t}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const t=tt(this.tableKey),e=tt(this.anchor.key),r=tt(this.focus.key);return t!==null&&e!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return mt(t)&&this.tableKey===t.tableKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)}set(t,e,r){this.dirty=this.dirty||t!==this.tableKey||e!==this.anchor.key||r!==this.focus.key,this.tableKey=t,this.anchor.key=e,this.focus.key=r,this._cachedNodes=null}clone(){return new us(this.tableKey,ne(this.anchor.key,this.anchor.offset,this.anchor.type),ne(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(t){if(t==="")return;const e=(t.endsWith(`
13
+ `)?t.slice(0,-1):t).split(`
14
+ `).map(i=>i.split(" ")),r=hs();for(const i of e){const s=Fr();for(const l of i){const c=Ce(ut.NO_STATUS),a=V();l&&a.append(wt(l)),c.append(a),s.append(c)}r.append(s)}const{anchorCell:o}=Ps(this);jh(r,o.select(0,o.getChildrenSize()))}insertText(){}hasFormat(t){let e=0;this.getNodes().filter(J).forEach(o=>{const i=o.getFirstChild();cn(i)&&(e|=i.getTextFormat())});const r=nn[t];return(e&r)!==0}insertNodes(t){const e=this.focus.getNode();C(e)||j(151),De(e.select(0,e.getChildrenSize())).insertNodes(t)}getShape(){const{anchorCell:t,focusCell:e}=Ps(this),r=Du(t);r===null&&j(153);const o=Du(e);o===null&&j(155);const i=Math.min(r.columnIndex,o.columnIndex),s=Math.max(r.columnIndex+r.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(r.rowIndex,o.rowIndex),c=Math.max(r.rowIndex+r.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(l,c),toX:Math.max(i,s),toY:Math.max(l,c)}}getNodes(){if(!this.isValid())return[];const t=this._cachedNodes;if(t!==null)return t;const{anchorTable:e,anchorCell:r,focusCell:o}=Ps(this),i=o.getParents()[1];if(i!==e){if(e.isParentOf(o)){const p=i.getParent();p==null&&j(159),this.set(this.tableKey,o.getKey(),p.getKey())}else{const p=e.getParent();p==null&&j(158),this.set(this.tableKey,p.getKey(),o.getKey())}return this.getNodes()}const[s,l,c]=Fe(e,r,o),{minColumn:a,maxColumn:u,minRow:f,maxRow:d}=Li(s,l,c),h=new Map([[e.getKey(),e]]);let g=null;for(let p=f;p<=d;p++)for(let m=a;m<=u;m++){const{cell:y}=s[p][m],x=y.getParent();vt(x)||j(160),x!==g&&(h.set(x.getKey(),x),g=x),h.has(y.getKey())||Qy(y,b=>{h.set(b.getKey(),b)})}const _=Array.from(h.values());return _n()||(this._cachedNodes=_),_}getTextContent(){const t=this.getNodes().filter(r=>J(r));let e="";for(let r=0;r<t.length;r++){const o=t[r],i=o.__parent,s=(t[r+1]||{}).__parent;e+=o.getTextContent()+(s!==i?`
15
+ `:" ")}return e}}function mt(n){return n instanceof us}function Ol(n,t,e){n.getKey(),t.getKey(),e.getKey();const r=A(),o=mt(r)?r.clone():new us("root",ne("root",0,"element"),ne("root",0,"element"));return o.set(n.getKey(),t.getKey(),e.getKey()),o}function Qy(n,t){const e=[[n]];for(let r=e.at(-1);r!==void 0&&e.length>0;r=e.at(-1)){const o=r.pop();o===void 0?e.pop():t(o)!==!1&&C(o)&&e.push(o.getChildren())}}function Hh(n,t=St()){const e=tt(n);yt(e)||j(231,n);const r=sn(e,t.getElementByKey(n));return r===null&&j(232,n),{tableElement:r,tableNode:e}}class Zy{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(t){this.nextFocus=t}getAndClearNextFocus(){const{nextFocus:t}=this;return t!==null&&(this.nextFocus=null),t}setShouldCheckSelectionForTable(t){this.shouldCheckSelectionForTable=t}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:t}=this;return t?(this.shouldCheckSelectionForTable=null,t):null}removeObserver(t){const e=this.observers.get(t);return e!==void 0&&(e[0].removeListeners(),this.observers.delete(t),!0)}removeAllObservers(){for(const t of Array.from(this.observers.keys()))this.removeObserver(t)}$getTableNodesAndObservers(){const t=[];for(const[e,[r]]of Array.from(this.observers.entries())){const o=tt(e);yt(o)?t.push([o,r]):this.removeObserver(e)}return t}}class tx{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(t,e){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=e,this.editor=t,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach(t=>t()),this.listenersToRemove.clear()}$lookup(){return Hh(this.tableNodeKey,this.editor)}trackTable(){const t=new MutationObserver(e=>{this.editor.read("latest",()=>{let r=!1;for(let s=0;s<e.length;s++){const l=e[s].target.nodeName;if(l==="TABLE"||l==="TBODY"||l==="THEAD"||l==="TR"){r=!0;break}}if(!r)return;const{tableNode:o,tableElement:i}=this.$lookup();this.table=yr(o,i)})});this.editor.read("latest",()=>{const{tableNode:e,tableElement:r}=this.$lookup();this.table=yr(e,r),t.observe(r,{attributes:!0,childList:!0,subtree:!0})})}$clearHighlight(t=!0){const e=this.editor;this.isHighlightingCells=!1,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=!1,this.$enableHighlightStyle();const{tableNode:r,tableElement:o}=this.$lookup();Ho(e,yr(r,o),null),t&&A()!==null&&(gt(null),e.dispatchCommand(Re))}$enableHighlightStyle(){const t=this.editor,{tableElement:e}=this.$lookup();We(e,t._config.theme.tableSelection),e.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:t}=this.$lookup();kt(t,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(t){if(t!==null){t.tableKey!==this.tableNodeKey&&j(233,t.tableKey,this.tableNodeKey);const e=this.editor;this.tableSelection=t,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Ho(e,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){const t=Dt(this.editor._window);t&&t.rangeCount>0&&t.removeAllRanges()}}$setFocusCellForSelection(t,e=!1){const r=this.editor,{tableNode:o}=this.$lookup(),i=t.x,s=t.y;if(this.focusCell=t,!this.isHighlightingCells&&(e||this.anchorX!==i||this.anchorY!==s||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&i===this.focusX&&s===this.focusY)return!1;if(this.focusX=i,this.focusY=s,this.isHighlightingCells){const l=Ml(o,t.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let c=l;if(c===null&&e&&(c=o.getCellNodeFromCords(i,s,this.table)),c!==null){const a=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=c.getKey(),this.tableSelection=Ol(o,a,c),gt(this.tableSelection),r.dispatchCommand(Re),Ho(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){const t=this.anchorCellNodeKey?tt(this.anchorCellNodeKey):null;return J(t)?t:null}$getAnchorTableCellOrThrow(){const t=this.$getAnchorTableCell();return t===null&&j(234),t}$getFocusTableCell(){const t=this.focusCellNodeKey?tt(this.focusCellNodeKey):null;return J(t)?t:null}$getFocusTableCellOrThrow(){const t=this.$getFocusTableCell();return t===null&&j(235),t}$setAnchorCellForSelection(t){this.isHighlightingCells=!1,this.anchorCell=t,this.anchorX=t.x,this.anchorY=t.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:e}=this.$lookup(),r=Ml(e,t.elem);if(r!==null){const o=r.getKey();this.tableSelection!=null?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(e.getKey(),o,o)):this.tableSelection=Ol(e,r,r),this.anchorCellNodeKey=o}}$formatCells(t){const e=A();mt(e)||j(236);const r=Yl(),o=r.anchor,i=r.focus,s=e.getNodes().filter(J);s.length>0||j(237);const l=s[0].getFirstChild(),c=cn(l)?l.getFormatFlags(t,null):null;s.forEach(a=>{o.set(a.getKey(),0,"element"),i.set(a.getKey(),a.getChildrenSize(),"element"),r.formatText(t,c)}),gt(e),this.editor.dispatchCommand(Re)}$clearText(){const{editor:t}=this,e=tt(this.tableNodeKey);if(!yt(e))throw new Error("Expected TableNode.");const r=A();mt(r)||j(253);const o=r.getNodes().filter(J),i=e.getFirstChild(),s=e.getLastChild();if(o.length>0&&i!==null&&s!==null&&vt(i)&&vt(s)&&o[0]===i.getFirstChild()&&o[o.length-1]===s.getLastChild()){e.selectPrevious();const l=e.getParent();return e.remove(),void(Et(l)&&l.isEmpty()&&t.dispatchCommand(Dn))}o.forEach(l=>{if(C(l)){const c=V(),a=wt();c.append(a),l.append(c),l.getChildren().forEach(u=>{u!==c&&u.remove()})}}),Ho(t,this.table,null),gt(null),t.dispatchCommand(Re)}}const _r="__lexicalTableSelection";function Jh(n){const t=Od(n);return yt(t)||j(386,n),t}const er=40;function Rs(n,t,e){const r=o=>Math.max(1,Math.ceil(Math.min(er,o)/er*18));return n<=t+er?-r(t+er-n):n>=e-er?r(n-(e-er)):0}function wn(n){return B(n)&&n.nodeName==="TABLE"}function sn(n,t){if(!t)return t;const e=wn(t)?t:t.querySelector("table");return wn(e)||j(341,n.constructor.name,n.getType(),n.getKey(),t.nodeName),e}function fs(n){return n._window}function ds(n,t){for(let e=t,r=null;e!==null;e=e.getParent()){if(n.is(e))return r;J(e)&&(r=e)}return null}const ex=[[Ul,"down"],[Wl,"up"],[Bl,"backward"],[zl,"forward"]],nx=[Cr,Sr,hn],rx=[Hi,Hl];function ox(n,t){return n.registerRootListener(e=>{if(e===null)return;const r=n._window;if(r!==null)return no(r,"pointerdown",o=>{const i=Rn(o);if(o.button!==0||!Ae(i)||!e.contains(i))return;const s=(function(l){const c=Ii(l);if(c===null)return null;let a=c.elem;for(;a!=null;){if(a.nodeName==="TABLE"&&_r in a&&a[_r])return{cellElement:c,tableElement:a,tableObserver:a[_r]};a=a.parentNode}return null})(i);n.update(()=>{if(mt(A())){for(const[u]of t.observers.values())u.$clearHighlight(!1);gt(null),n.dispatchCommand(Re)}if(!s)return;const{tableObserver:l,tableElement:c,cellElement:a}=s;(function(u,f,d,h,g,_){const p=u._window;if(!p)return;const m=b=>{if(g.isSelecting)return;g.isSelecting=!0,b!==null&&g.anchorCell===null&&u.update(()=>{g.$setAnchorCellForSelection(b)});let T=f.clientX,v=f.clientY,N=null;const S=()=>{g.isSelecting=!1,N!==null&&(p.cancelAnimationFrame(N),N=null),p.removeEventListener("pointerup",ct),p.removeEventListener("pointermove",st)},k=(I,P)=>{const W=h.getRootNode();if(!Cn(W)&&!je(W))return null;for(const at of W.elementsFromPoint(I,P)){const nt=Ru(h,at);if(nt)return nt}return null},M=(I,P)=>{g.anchorCell===null&&u.update(()=>{g.$setAnchorCellForSelection(I)}),g.focusCell!==null&&I.elem===g.focusCell.elem||(_.setNextFocus({focusCell:I,override:P,tableKey:g.tableNodeKey}),u.dispatchCommand(Re))},E=I=>{for(let P=h.parentElement;P;P=P.parentElement)if(I==="x"?P.scrollWidth>P.clientWidth:P.scrollHeight>P.clientHeight){const W=p.getComputedStyle(P),at=I==="x"?W.overflowX:W.overflowY;if(at==="auto"||at==="scroll")return P}return null},F=(I,P,W)=>{let at,nt;if(I===null)at=0,nt=W==="x"?p.innerWidth:p.innerHeight;else{const it=I.getBoundingClientRect();at=W==="x"?it.left:it.top,nt=W==="x"?it.right:it.bottom}const At=Rs(P,at,nt);if(At===0)return!1;if(I===null){const it=W==="x"?p.scrollX:p.scrollY;return p.scrollBy(W==="x"?At:0,W==="x"?0:At),(W==="x"?p.scrollX:p.scrollY)!==it}if(W==="x"){const it=I.scrollLeft;return I.scrollLeft+=At,I.scrollLeft!==it}const ae=I.scrollTop;return I.scrollTop+=At,I.scrollTop!==ae},R=(I,P)=>{let W=T,at=v;if(I===null)W=Math.min(Math.max(W,1),p.innerWidth-1);else{const nt=I.getBoundingClientRect();W=Math.min(Math.max(W,nt.left+1),nt.right-1)}if(P===null)at=Math.min(Math.max(at,1),p.innerHeight-1);else{const nt=P.getBoundingClientRect();at=Math.min(Math.max(at,nt.top+1),nt.bottom-1)}return[W,at]},z=()=>{const I=E("x");if(I!==null){const nt=I.getBoundingClientRect();if(Rs(T,nt.left,nt.right)!==0)return!0}const P=E("y"),W=P===null?0:P.getBoundingClientRect().top,at=P===null?p.innerHeight:P.getBoundingClientRect().bottom;return Rs(v,W,at)!==0},q=()=>{if(N=null,!g.isSelecting)return;const I=E("x"),P=E("y"),W=I!==null&&F(I,T,"x"),at=F(P,v,"y");if(W||at){const[nt,At]=R(I,P),ae=k(nt,At);ae&&M(ae,!1),N=p.requestAnimationFrame(q)}},ot=()=>{N===null&&g.pointerType!=="touch"&&z()&&(N=p.requestAnimationFrame(q))},ct=()=>{S()},st=I=>{if(!(nt=>!(1&~nt.buttons))(I)&&g.isSelecting)return void S();const P=Rn(I);if(!Ae(P))return;T=I.clientX,v=I.clientY;let W=null;const at=!(Oe||h.contains(P));W=at?Ru(h,P):k(I.clientX,I.clientY),W&&M(W,at),ot()};p.addEventListener("pointerup",ct,g.listenerOptions),p.addEventListener("pointermove",st,g.listenerOptions)};g.pointerType=f.pointerType;const y=Jh(g.tableNodeKey),x=ce();if(Oe&&f.shiftKey&&ve(x,y)&&(w(x)||mt(x))){const b=x.anchor.getNode(),T=ds(y,x.anchor.getNode());T?(g.$setAnchorCellForSelection($n(g,T)),g.$setFocusCellForSelection(d),Qe(f)):(y.isBefore(b)?y.selectStart():y.selectEnd()).anchor.set(x.anchor.key,x.anchor.offset,x.anchor.type)}else f.pointerType!=="touch"&&g.$setAnchorCellForSelection(d);m(d)})(n,o,a,c,l,t)})})})}function ix(n,t,e,r,o){const i=e.getRootElement(),s=fs(e);i!==null&&s!==null||j(246);const l=new tx(e,n.getKey()),c=sn(n,t);(function(d,h){Pu(d)!==null&&j(205),d[_r]=h})(c,l),l.listenersToRemove.add(()=>(function(d,h){Pu(d)===h&&delete d[_r]})(c,l)),l.listenersToRemove.add(no(c,"mousedown",d=>{const h=Rn(d);d.detail>=3&&Ae(h)&&Ii(h)!==null&&d.preventDefault()},l.listenerOptions));for(const[d,h]of ex)l.listenersToRemove.add(e.registerCommand(d,g=>Yh(e,g,h,n,l,o),fe));l.listenersToRemove.add(e.registerCommand(jl,d=>{const h=A();if(mt(h)){const g=ds(n,h.focus.getNode());if(g!==null)return Qe(d),g.selectEnd(),!0}return!1},fe));const a=()=>{const d=A();return!!ve(d,n)&&!!mt(d)&&(l.$clearText(),!0)};for(const d of nx)l.listenersToRemove.add(e.registerCommand(d,a,fe));const u=d=>{const h=A();if(!mt(h)&&!w(h))return!1;const g=n.isParentOf(h.anchor.getNode());if(g!==n.isParentOf(h.focus.getNode())){const _=g?"anchor":"focus",p=g?"focus":"anchor",{key:m,offset:y,type:x}=h[p];return n[h[_].isBefore(h[p])?"selectPrevious":"selectNext"]()[p].set(m,y,x),!1}return!!ve(h,n)&&!!mt(h)&&(d&&(d.preventDefault(),d.stopPropagation()),l.$clearText(),!0)};for(const d of rx)l.listenersToRemove.add(e.registerCommand(d,u,fe));l.listenersToRemove.add(e.registerCommand(Ji,d=>{const h=A();if(h){if(!mt(h)&&!w(h))return!1;kl(e,Ke(d,ClipboardEvent)?d:null,$c(h));const g=u(d);return w(h)?(h.removeText(),!0):g}return!1},fe));const f=i.ownerDocument;return l.listenersToRemove.add(no(f,"paste",d=>{d.defaultPrevented||e.read("latest",()=>{const h=A();return i.contains(f.activeElement)&&mt(h)&&ve(h,n)})&&(d.preventDefault(),e.dispatchCommand(Rr,d))})),l.listenersToRemove.add(no(f,"copy",d=>{if(d.defaultPrevented)return;const h=Rn(d);h===i||Ae(h)&&i.contains(h)||e.read("latest",()=>{const g=A();return i.contains(_o(i))&&mt(g)&&ve(g,n)})&&(d.preventDefault(),e.dispatchCommand(Eo,d))})),l.listenersToRemove.add(e.registerCommand(ke,d=>{const h=A();return!!ve(h,n)&&!!mt(h)&&(l.$formatCells(d),!0)},fe)),l.listenersToRemove.add(e.registerCommand(Df,d=>{const h=A();if(!mt(h)||!ve(h,n))return!1;const g=h.anchor.getNode(),_=h.focus.getNode();if(!J(g)||!J(_))return!1;const[p,m,y]=Fe(n,g,_),x=Math.max(m.startRow+m.cell.__rowSpan-1,y.startRow+y.cell.__rowSpan-1),b=Math.max(m.startColumn+m.cell.__colSpan-1,y.startColumn+y.cell.__colSpan-1),T=Math.min(m.startRow,y.startRow),v=Math.min(m.startColumn,y.startColumn);if(T===0&&v===0&&x===p.length-1&&b===p[0].length-1)return n.setFormat(d),!0;const N=new Set;for(let S=T;S<=x;S++)for(let k=v;k<=b;k++){const M=p[S][k].cell;if(N.has(M))continue;N.add(M),M.setFormat(d);const E=M.getChildren();for(let F=0;F<E.length;F++){const R=E[F];C(R)&&!R.isInline()&&R.setFormat(d)}}return!0},fe)),l.listenersToRemove.add(e.registerCommand(On,d=>{const h=A();if(!ve(h,n))return!1;if(mt(h))return l.$clearHighlight(),!1;if(w(h)){const g=U(h.anchor.getNode(),_=>J(_));if(!J(g))return!1;if(typeof d=="string"){const _=Iu(e,h,n);if(_)return Lu(_,n,[wt(d)]),!0}}return!1},fe)),r&&l.listenersToRemove.add(e.registerCommand(Jl,d=>{const h=A();if(!w(h)||!h.isCollapsed()||!ve(h,n))return!1;const g=Gr(h.anchor.getNode());return!(g===null||!n.is(Dr(g)))&&(Qe(d),(function(_,p){const m=p==="next"?"getNextSibling":"getPreviousSibling",y=p==="next"?"getFirstChild":"getLastChild",x=_[m]();if(C(x))return x.selectEnd();const b=U(_,vt);b===null&&j(247);for(let v=b[m]();vt(v);v=v[m]()){const N=v[y]();if(C(N))return N.selectEnd()}const T=U(b,yt);T===null&&j(248),p==="next"?T.selectNext():T.selectPrevious()})(g,d.shiftKey?"previous":"next"),!0)},fe)),l.listenersToRemove.add(e.registerCommand(Lf,d=>n.isSelected(),fe)),l.listenersToRemove.add(e.registerCommand(Dn,()=>{const d=A();if(!w(d)||!d.isCollapsed()||!ve(d,n))return!1;const h=Iu(e,d,n);return!!h&&(Lu(h,n),!0)},fe)),l}function sx(n,t){const e=A(),r=ce(),o=n.getAndClearNextFocus();if(o!==null){const{tableKey:s,focusCell:l}=o,c=n.observers.get(s);c||j(335,s);const[a]=c;if(mt(e)&&e.tableKey===a.tableNodeKey)return(l.x!==a.focusX||l.y!==a.focusY)&&(a.$setFocusCellForSelection(l),!0);if(a.anchorCell!==null&&a.anchorCellNodeKey!==null&&l.elem!==a.anchorCell.elem&&a.tableSelection!==null)return a.$setFocusCellForSelection(l,!0),!0}const i=n.getAndClearShouldCheckSelectionForTable();if(i&&w(r)&&w(e)&&e.isCollapsed()){const s=tt(i);if(yt(s)){const l=e.anchor.getNode(),c=s.getFirstChild(),a=Gr(l);if(a!==null&&vt(c)){const u=c.getFirstChild();if(J(u)&&s.is(U(a,f=>f.is(s)||f.is(u))))return u.selectStart(),!0}}}mt(e)&&(function(s,l){const c=fs(s),a=ce();if(!l.is(a))return;const u=Jh(l.tableKey),f=Dt(c),d=f&&re(f,s.getRootElement());if(f&&d&&d.anchorNode&&d.focusNode){const h=Xt(d.focusNode),g=h&&!u.isParentOf(h),_=Xt(d.anchorNode),p=_&&u.isParentOf(_);if(g&&p&&f.rangeCount>0){const m=_p(f,s);m&&(m.anchor.set(u.getKey(),l.isBackward()?u.getChildrenSize():0,"element"),f.removeAllRanges(),gt(m))}}})(t,e),w(e)&&(function(s,l){const c=ce(),{anchor:a,focus:u}=s,f=a.getNode(),d=u.getNode(),h=Gr(f),g=Gr(d),_=h?Dr(h):null,p=g?Dr(g):null,m=s.isBackward(),y=h&&g&&_&&p&&_.is(p),x=p&&(!_||_.isParentOf(p)),b=_&&(!p||p.isParentOf(_));if(x){const T=s.clone(),[v]=Fe(p,g,g),N=v[0][0].cell,S=v[v.length-1].at(-1).cell;T.focus.set(m?N.getKey():S.getKey(),m?0:S.getChildrenSize(),"element"),gt(T)}else if(b){const T=s.clone(),[v]=Fe(_,h,h),N=v[0][0].cell,S=v[v.length-1].at(-1).cell;T.anchor.set(m?S.getKey():N.getKey(),m?S.getChildrenSize():0,"element"),gt(T)}else if(y){const T=l.observers.get(_.getKey());T||j(335,_.getKey());const[v]=T;if(h.is(g)||(v.$setAnchorCellForSelection($n(v,h)),v.$setFocusCellForSelection($n(v,g),!0)),v.pointerType==="touch"&&v.isSelecting&&s.isCollapsed()&&w(c)&&c.isCollapsed()){const N=Gr(c.anchor.getNode());N&&!N.is(g)&&(v.$setAnchorCellForSelection($n(v,N)),v.$setFocusCellForSelection($n(v,g),!0),v.pointerType=null)}}})(e,n);for(const[s,l]of n.$getTableNodesAndObservers())lx(t,s,l);return!1}function lx(n,t,e){const r=A(),o=ce();r&&!r.is(o)&&(mt(r)||mt(o))&&e.tableSelection&&!e.tableSelection.is(o)&&(mt(r)&&r.tableKey===e.tableNodeKey?e.$updateTableTableSelection(r):!mt(r)&&mt(o)&&o.tableKey===e.tableNodeKey&&e.$updateTableTableSelection(null)),e.hasHijackedSelectionStyles&&!t.isSelected()?(function(i,s){s.$enableHighlightStyle(),Al(s.table,l=>{const c=l.elem;l.highlighted=!1,Vh(i,l),c.getAttribute("style")||c.removeAttribute("style")})})(n,e):!e.hasHijackedSelectionStyles&&t.isSelected()&&(function(i,s){s.$disableHighlightStyle(),Al(s.table,l=>{l.highlighted=!0,qh(i,l)})})(n,e)}function Pu(n){return n[_r]||null}function Ii(n){let t=n;for(;t!=null;){const e=t.nodeName;if(e==="TD"||e==="TH"){const r=t._cell;return r===void 0?null:r}t=t.parentNode}return null}function Ru(n,t){if(!n.contains(t))return null;let e=null;for(let r=t;r!=null;r=r.parentNode){if(r===n)return e;const o=r.nodeName;o!=="TD"&&o!=="TH"||(e=r._cell||null)}return null}function yr(n,t){const e=[],r={columns:0,domRows:e,rows:0};let o=sn(n,t).querySelector("tr"),i=0,s=0;for(e.length=0;o!=null;){const l=o.nodeName;if(l==="TD"||l==="TH"){const u={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:i,y:s};o._cell=u;let f=e[s];f===void 0&&(f=e[s]=[]),f[i]=u}else{const u=o.firstChild;if(u!=null){o=u;continue}}const c=o.nextSibling;if(c!=null){i++,o=c;continue}const a=o.parentNode;if(a!=null){const u=a.nextSibling;if(u==null)break;s++,i=0,o=u}}return r.columns=i+1,r.rows=s+1,r}function Ho(n,t,e){const r=new Set(e?e.getNodes():[]);Al(t,(o,i)=>{const s=o.elem;r.has(i)?(o.highlighted=!0,qh(n,o)):(o.highlighted=!1,Vh(n,o),s.getAttribute("style")||s.removeAttribute("style"))})}function Al(n,t){const{domRows:e}=n;for(let r=0;r<e.length;r++){const o=e[r];if(o)for(let i=0;i<o.length;i++){const s=o[i];if(!s)continue;const l=Xt(s.elem);l!==null&&t(s,l,{x:i,y:r})}}}const cx=(n,t,e,r,o)=>{const i=o==="forward";switch(o){case"backward":case"forward":return e!==(i?n.table.columns-1:0)?qo(t.getCellNodeFromCordsOrThrow(e+(i?1:-1),r,n.table),i):r!==(i?n.table.rows-1:0)?qo(t.getCellNodeFromCordsOrThrow(i?0:n.table.columns-1,r+(i?1:-1),n.table),i):i?t.selectNext():t.selectPrevious(),!0;case"up":return r!==0?qo(t.getCellNodeFromCordsOrThrow(e,r-1,n.table),!1):t.selectPrevious(),!0;case"down":return r!==n.table.rows-1?qo(t.getCellNodeFromCordsOrThrow(e,r+1,n.table),!0):t.selectNext(),!0;default:return!1}};function Ls(n,t){let e,r;if(t.startColumn===n.minColumn)e="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==n.maxColumn)return null;e="maxColumn"}if(t.startRow===n.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==n.maxRow)return null;r="maxRow"}return[e,r]}function Jo([n,t]){return[n==="minColumn"?"maxColumn":"minColumn",t==="minRow"?"maxRow":"minRow"]}function nr(n,t,[e,r]){const o=t[r],i=n[o];i===void 0&&j(250,r,String(o));const s=t[e],l=i[s];return l===void 0&&j(250,e,String(s)),l}function ax(n,t,e,r,o){const i=Li(t,e,r),s=(function(v,N){const{minColumn:S,maxColumn:k,minRow:M,maxRow:E}=N;let F=1,R=1,z=1,q=1;const ot=v[M],ct=v[E];for(let st=S;st<=k;st++)F=Math.max(F,ot[st].cell.__rowSpan),q=Math.max(q,ct[st].cell.__rowSpan);for(let st=M;st<=E;st++)R=Math.max(R,v[st][S].cell.__colSpan),z=Math.max(z,v[st][k].cell.__colSpan);return{bottomSpan:q,leftSpan:R,rightSpan:z,topSpan:F}})(t,i),{topSpan:l,leftSpan:c,bottomSpan:a,rightSpan:u}=s,f=(function(v,N){const S=Ls(v,N);return S===null&&j(249,N.cell.getKey()),S})(i,e),[d,h]=Jo(f);let g=i[d],_=i[h];o==="forward"?g+=d==="maxColumn"?1:c:o==="backward"?g-=d==="minColumn"?1:u:o==="down"?_+=h==="maxRow"?1:l:o==="up"&&(_-=h==="minRow"?1:a);const p=t[_];if(p===void 0)return!1;const m=p[g];if(m===void 0)return!1;const[y,x]=(function(v,N,S){const k=Li(v,N,S),M=Ls(k,N);if(M)return[nr(v,k,M),nr(v,k,Jo(M))];const E=Ls(k,S);if(E)return[nr(v,k,Jo(E)),nr(v,k,E)];const F=["minColumn","minRow"];return[nr(v,k,F),nr(v,k,Jo(F))]})(t,e,m),b=$n(n,y.cell),T=$n(n,x.cell);return n.$setAnchorCellForSelection(b),n.$setFocusCellForSelection(T,!0),!0}function ve(n,t){if(w(n)||mt(n)){const e=t.isParentOf(n.anchor.getNode()),r=t.isParentOf(n.focus.getNode());return e&&r}return!1}function qo(n,t){t?n.selectStart():n.selectEnd()}function qh(n,t){const e=t.elem,r=n._config.theme;J(Xt(e))||j(131),kt(e,r.tableCellSelected)}function Vh(n,t){const e=t.elem;J(Xt(e))||j(131);const r=n._config.theme;We(e,r.tableCellSelected)}function Gr(n){const t=U(n,J);return J(t)?t:null}function Dr(n){const t=U(n,yt);return yt(t)?t:null}function ux(n,t,e,r,o,i,s){const l=Jt(e.focus,o?"previous":"next");if(os(l))return!1;let c=l;for(const p of Or(l).iterNodeCarets("shadowRoot")){if(!Me(p)||!C(p.origin))return!1;c=p}const a=c.getParentAtCaret();if(!J(a))return!1;const u=a,f=(function(p){for(const m of Or(p).iterNodeCarets("root")){const{origin:y}=m;if(J(y)){if(Ht(m))return Ft(y,p.direction)}else if(!vt(y))break}return null})(et(u,c.direction)),d=U(u,yt);if(!d||!d.is(i))return!1;const h=n.getElementByKey(u.getKey()),g=Ii(h);if(!h||!g)return!1;const _=dx(n,d);if(s.table=_,f)if(r==="extend"){const p=Ii(n.getElementByKey(f.origin.getKey()));if(!p)return!1;s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(p,!0)}else{const p=Ut(f);we(e.anchor,p),we(e.focus,p)}else if(r==="extend")s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(g,!0);else{const p=(function(m){const y=Bn(m);return Ht(y)?Ut(y):m})(et(d,l.direction));we(e.anchor,p),we(e.focus,p)}return Qe(t),!0}function Yh(n,t,e,r,o,i){if((e==="up"||e==="down")&&(function(l){const c=l.getRootElement();return c?c.hasAttribute("aria-controls")&&c.getAttribute("aria-controls")==="typeahead-menu":!1})(n))return!1;const s=A();if(!ve(s,r)){if(w(s)){if(e==="backward"){if(s.focus.offset>0)return!1;const l=(function(a){for(let u=a,f=a;f!==null;u=f,f=f.getParent())if(C(f)){if(f!==u&&f.getFirstChild()!==u)return null;if(!f.isInline())return f}return null})(s.focus.getNode());if(!l)return!1;const c=l.getPreviousSibling();return!!yt(c)&&(Qe(t),t.shiftKey?s.focus.set(c.getParentOrThrow().getKey(),c.getIndexWithinParent(),"element"):c.selectEnd(),!0)}if(t.shiftKey&&(e==="up"||e==="down")){const l=s.focus.getNode();if(!s.isCollapsed()&&(e==="up"&&!s.isBackward()||e==="down"&&s.isBackward())){let c=U(l,h=>yt(h));if(J(c)&&(c=U(c,yt)),c!==r||!c)return!1;const a=e==="down"?c.getNextSibling():c.getPreviousSibling();if(!a)return!1;let u=0;e==="up"&&C(a)&&(u=a.getChildrenSize());let f=a;e==="up"&&C(a)&&(f=a.getLastChild()||a,u=O(f)?f.getTextContentSize():0);const d=s.clone();return d.focus.set(f.getKey(),u,O(f)?"text":"element"),gt(d),Qe(t),!0}if(xt(l)){const c=e==="up"?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(c&&ds(r,c)!==null){const a=r.getFirstDescendant(),u=r.getLastDescendant();if(!a||!u)return!1;const[f]=ze(a),[d]=ze(u),h=r.getCordsFromCellNode(f,o.table),g=r.getCordsFromCellNode(d,o.table),_=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table);return o.$setAnchorCellForSelection(_),o.$setFocusCellForSelection(p,!0),!0}return!1}{let c=U(l,u=>C(u)&&!u.isInline());if(J(c)&&(c=U(c,yt)),!c)return!1;const a=e==="down"?c.getNextSibling():c.getPreviousSibling();if(yt(a)&&o.tableNodeKey===a.getKey()){const u=a.getFirstDescendant(),f=a.getLastDescendant();if(!u||!f)return!1;const[d]=ze(u),[h]=ze(f),g=s.clone();return g.focus.set((e==="up"?d:h).getKey(),e==="up"?0:h.getChildrenSize(),"element"),Qe(t),gt(g),!0}}}}return e==="down"&&Ki(n)&&i.setShouldCheckSelectionForTable(r.getKey()),!1}if(w(s)){if(e==="backward"||e==="forward")return ux(n,t,s,t.shiftKey?"extend":"move",e==="backward",r,o);if(s.isCollapsed()){const{anchor:l,focus:c}=s,a=U(l.getNode(),J),u=U(c.getNode(),J);if(!J(a)||!a.is(u))return!1;const f=Dr(a);if(f!==r&&f!=null){const y=sn(f,n.getElementByKey(f.getKey()));if(y!=null)return o.table=yr(f,y),Yh(n,t,e,f,o,i)}const d=n.getElementByKey(a.__key),h=n.getElementByKey(l.key);if(h==null||d==null)return!1;let g;if(l.type==="element")g=h.getBoundingClientRect();else{const y=Dt(fs(n));if(y===null||y.rangeCount===0)return!1;const x=Dd(y,n.getRootElement());if(x===null)return!1;g=x.getBoundingClientRect()}const _=e==="up"?a.getFirstChild():a.getLastChild();if(_==null)return!1;const p=n.getElementByKey(_.__key);if(p==null)return!1;const m=p.getBoundingClientRect();if(e==="up"?m.top>g.top-g.height:g.bottom+g.height>m.bottom){Qe(t);const y=r.getCordsFromCellNode(a,o.table);if(!t.shiftKey)return cx(o,r,y.x,y.y,e);{const x=r.getDOMCellFromCordsOrThrow(y.x,y.y,o.table);o.$setAnchorCellForSelection(x),o.$setFocusCellForSelection(x,!0)}return!0}}}else if(mt(s)){const{anchor:l,focus:c,tableKey:a}=s;if(a!==r.getKey())return!1;const u=U(l.getNode(),J),f=U(c.getNode(),J),[d]=s.getNodes();yt(d)||j(251);const h=sn(d,n.getElementByKey(d.getKey()));if(!J(u)||!J(f)||!yt(d)||h==null)return!1;o.$updateTableTableSelection(s);const g=yr(d,h),_=r.getCordsFromCellNode(u,g),p=r.getDOMCellFromCordsOrThrow(_.x,_.y,g);if(o.$setAnchorCellForSelection(p),Qe(t),t.shiftKey){const[m,y,x]=Fe(r,u,f);return ax(o,m,y,x,e)}return f.selectEnd(),!0}return!1}function Qe(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Lu(n,t,e){const r=V();n==="first"?t.insertBefore(r):t.insertAfter(r),r.append(...e||[]),r.selectEnd()}function Iu(n,t,e){const r=e.getParent();if(!r)return;const o=Dt(fs(n));if(!o)return;const i=re(o,n.getRootElement()).anchorNode,s=n.getElementByKey(r.getKey()),l=sn(e,n.getElementByKey(e.getKey()));if(!i||!s||!l||!s.contains(i)||l.contains(i))return;const c=U(t.anchor.getNode(),y=>J(y));if(!c)return;const a=U(c,y=>yt(y));if(!yt(a)||!a.is(e))return;const[u,f]=Fe(e,c,c),d=u[0][0],h=u[u.length-1][u[0].length-1],{startRow:g,startColumn:_}=f,p=g===d.startRow&&_===d.startColumn,m=g===h.startRow&&_===h.startColumn;return p?"first":m?"last":void 0}function $n(n,t){const{tableNode:e}=n.$lookup(),r=e.getCordsFromCellNode(t,n.table);return e.getDOMCellFromCordsOrThrow(r.x,r.y,n.table)}function Ml(n,t,e){return ds(n,Xt(t,e))}function Ku(n){return B(n)&&n.nodeName==="DIV"}function zu(n,t,e){let r=n.querySelector(":scope > colgroup");if(!e)return void(r&&r.remove());r||(r=Z().createElement("colgroup"),Ei(r),n.insertBefore(r,n.firstChild));const o=[];for(let i=0;i<t;i++){const s=Z().createElement("col"),l=e[i];l&&(s.style.width=`${l}px`),o.push(s)}r.replaceChildren(...o)}function Bu(n,t,e){if(!t.theme.tableAlignment)return;const r=[],o=[];for(const i of["center","right"]){const s=t.theme.tableAlignment[i];s&&(i===e?o:r).push(s)}We(n,...r),kt(n,...o)}const Fl=new WeakSet;function Ki(n=St()){return Fl.has(n)}function Wu(n=St()){const t=Kr(n,"@lexical/table/Table");return!!t&&t.output.hasStickyScrollbar.peek()&&t.output.hasHorizontalScroll.peek()}function fx(n,t){t?Fl.add(n):Fl.delete(n)}class Pr extends bt{__rowStriping=!1;__frozenColumnCount=0;__frozenRowCount=0;__colWidths=void 0;$config(){return this.config("table",{extends:bt,importDOM:{table:()=>({conversion:hx,priority:1})}})}getColWidths(){return this.getLatest().__colWidths}setColWidths(t){const e=this.getWritable();return e.__colWidths=t,e}afterCloneFrom(t){super.afterCloneFrom(t),this.__colWidths=t.__colWidths,this.__rowStriping=t.__rowStriping,this.__frozenColumnCount=t.__frozenColumnCount,this.__frozenRowCount=t.__frozenRowCount}updateFromJSON(t){return super.updateFromJSON(t).setRowStriping(t.rowStriping||!1).setFrozenColumns(t.frozenColumnCount||0).setFrozenRows(t.frozenRowCount||0).setColWidths(t.colWidths)}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(t,e,r){return r==="html"}getDOMSlot(t){const e=wn(t)?t:t.querySelector("table");return wn(e)||j(229),super.getDOMSlot(t).withElement(e).withAfter(e.querySelector(":scope > colgroup"))}createDOM(t,e){const r=Z().createElement("table");if(this.__style&&gn(r.style,this.__style),this.getColWidths()){const o=Z().createElement("colgroup");r.appendChild(o),Ei(o)}if(kt(r,t.theme.table),this.updateTableElement(null,r,t),Ki(e)){const o=Wu(e),i=(function(s,l,c){const a=Z().createElement("div"),u=l.theme.tableScrollableWrapper;return u?kt(a,u):a.style.overflowX="auto",c&&(a.style.scrollbarWidth="none"),a.appendChild(s),a})(r,t,o);if(this.updateTableWrapper(null,i,r,t),o){const s=(function(c){const a=Z(),u=a.createElement("div"),f=c.theme.tableStickyScrollbar;f?kt(u,f):(u.style.position="sticky",u.style.bottom="0",u.style.overflowX="scroll",u.style.overflowY="hidden"),u.style.display="none",u.setAttribute("aria-hidden","true"),u.tabIndex=-1;const d=a.createElement("div");return d.style.height="1px",d.style.width="0px",u.appendChild(d),u})(t),l=Z().createElement("div");return l.setAttribute("data-lexical-sticky-scrollbar","true"),l.appendChild(i),l.appendChild(s),Ei(s),l}return i}return r}updateTableWrapper(t,e,r,o){this.__frozenColumnCount!==(t?t.__frozenColumnCount:0)&&(function(i,s,l,c){c>0?(kt(i,l.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(We(i,l.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(e,r,o,this.__frozenColumnCount),this.__frozenRowCount!==(t?t.__frozenRowCount:0)&&(function(i,s,l,c){c>0?(kt(i,l.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(We(i,l.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(e,r,o,this.__frozenRowCount)}updateTableElement(t,e,r){this.__style!==(t?t.__style:"")&&gn(e.style,this.__style,t?t.__style:""),this.__rowStriping!==(!!t&&t.__rowStriping)&&(function(s,l,c){c?(kt(s,l.theme.tableRowStriping),s.setAttribute("data-lexical-row-striping","true")):(We(s,l.theme.tableRowStriping),s.removeAttribute("data-lexical-row-striping"))})(e,r,this.__rowStriping);const o=t?t.getColumnCount():0,i=t?t.__colWidths:void 0;this.getColumnCount()===o&&this.getColWidths()===i||zu(e,this.getColumnCount(),this.getColWidths()),Bu(e,r,this.getFormatType())}updateDOM(t,e,r){const o=sn(this,e);if(e===o===Ki())return!0;if(Ku(e)){if(e.hasAttribute("data-lexical-sticky-scrollbar")!==Wu())return!0;const i=o.parentElement;Ku(i)&&this.updateTableWrapper(t,i,o,r)}return this.updateTableElement(t,o,r),!1}scaleDOMColWidths(t,e){const r=this.getColWidths();r&&zu(sn(this,t),this.getColumnCount(),r.map(o=>o*e))}exportDOM(t){const e=super.exportDOM(t),{element:r}=e;return{after:o=>{if(e.after&&(o=e.after(o)),!wn(o)&&B(o)&&(o=o.querySelector("table")),!wn(o))return null;Bu(o,t._config,this.getFormatType());const[i]=Ze(this,null,null),s=new Map;for(const u of i)for(const f of u){const d=f.cell.getKey();s.has(d)||s.set(d,{colSpan:f.cell.getColSpan(),startColumn:f.startColumn})}const l=new Set;for(const u of o.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const f=u.getAttribute("data-temporary-table-cell-lexical-key");if(f){const d=s.get(f);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),d){s.delete(f);for(let h=0;h<d.colSpan;h++)l.add(h+d.startColumn)}}}const c=o.querySelector(":scope > colgroup");if(c){const u=Array.from(o.querySelectorAll(":scope > colgroup > col")).filter((f,d)=>l.has(d));c.replaceChildren(...u)}const a=o.querySelectorAll(":scope > tr");if(a.length>0){const u=Z().createElement("tbody");for(const f of a)u.appendChild(f);o.append(u)}return o},element:!wn(r)&&B(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(t,e){const{rows:r,domRows:o}=e;for(let i=0;i<r;i++){const s=o[i];if(s!=null)for(let l=0;l<s.length;l++){const c=s[l];if(c==null)continue;const{elem:a}=c,u=Ml(this,a);if(u!==null&&t.is(u))return{x:l,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(t,e,r){const{domRows:o}=r,i=o[e];if(i==null)return null;const s=i[t<i.length?t:i.length-1];return s??null}getDOMCellFromCordsOrThrow(t,e,r){const o=this.getDOMCellFromCords(t,e,r);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(t,e,r){const o=this.getDOMCellFromCords(t,e,r);if(o==null)return null;const i=Xt(o.elem);return J(i)?i:null}getCellNodeFromCordsOrThrow(t,e,r){const o=this.getCellNodeFromCords(t,e,r);if(!o)throw new Error("Node at cords not TableCellNode.");return o}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(t){const e=this.getWritable();return e.__rowStriping=t,e}setFrozenColumns(t){const e=this.getWritable();return e.__frozenColumnCount=t,e}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(t){const e=this.getWritable();return e.__frozenRowCount=t,e}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const t=this.getFirstChild();if(!vt(t))return 0;let e=0;return t.getChildren().forEach(r=>{J(r)&&(e+=r.getColSpan())}),e}}function dx(n,t){const e=n.getElementByKey(t.getKey());return e===null&&j(230),yr(t,e)}function hx(n){const t=hs();n.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const e=n.querySelector(":scope > colgroup");if(e){let r=[];for(const o of e.querySelectorAll(":scope > col")){let i=o.style.width||"";if(!mr.test(i)&&(i=o.getAttribute("width")||"",!/^\d+$/.test(i))){r=void 0;break}r.push(parseFloat(i))}r&&t.setColWidths(r)}return{after:r=>Ai(r,vt),node:t}}function hs(){return Gt(new Pr)}function yt(n){return n instanceof Pr}function gx(n){vt(n.getParent())?n.isEmpty()&&n.append(V()):n.remove()}function px(n){yt(n.getParent())?eh(n,J):n.remove()}function mx(n){eh(n,vt);const[t]=Ze(n,null,null),e=t.reduce((s,l)=>Math.max(s,l.length),0),r=n.getChildren();for(let s=0;s<t.length;++s){const l=r[s];if(!l)continue;vt(l)||j(254,l.constructor.name,l.getType());const c=t[s].reduce((a,u)=>u?1+a:a,0);if(c!==e)for(let a=c;a<e;++a){const u=Ce();u.append(V()),l.append(u)}}const o=n.getColWidths(),i=n.getColumnCount();if(o&&o.length!==i){let s;if(i<o.length)s=o.slice(0,i);else if(o.length>0){const l=o[o.length-1];s=[...o,...Array(i-o.length).fill(l)]}n.setColWidths(s)}}function _x(n){if(n.detail<3||!Ae(n.target))return!1;const t=Xt(n.target);if(t===null)return!1;const e=U(t,r=>C(r)&&!r.isInline());return e===null?!1:!!J(e.getParent())&&(e.select(0),!0)}function yx(){const n=A();if(!w(n))return!1;const t=Dr(n.anchor.getNode());if(t===null)return!1;const e=Ct();if(!e.is(t.getParent())||e.getChildrenSize()!==1)return!1;const[r]=Ze(t,null,null);if(r.length===0||r[0].length===0)return!1;const o=r[0][0];if(!o||!o.cell)return!1;const i=r[r.length-1],s=i[i.length-1];if(!s||!s.cell)return!1;const l=Ol(t,o.cell,s.cell);return gt(l),!0}function xx(n){return n.registerNodeTransform(Vn,t=>{if(t.getColSpan()>1||t.getRowSpan()>1){const[,,e]=ze(t),[r]=Fe(e,t,t),o=r.length,i=r[0].length;let s=e.getFirstChild();vt(s)||j(175);const l=[];for(let c=0;c<o;c++){c!==0&&(s=s.getNextSibling(),vt(s)||j(175));let a=null;for(let u=0;u<i;u++){const f=r[c][u],d=f.cell;if(f.startRow===c&&f.startColumn===u)a=d,l.push(d);else if(d.getColSpan()>1||d.getRowSpan()>1){J(d)||j(176);const h=Ce(d.__headerState);a!==null?a.insertAfter(h):Rm(s,h)}}}for(const c of l)c.setColSpan(1),c.setRowSpan(1)}})}function Cx(n,t=!0){const e=new Zy,r=(o,i,s)=>{const l=sn(o,s),c=ix(o,l,n,t,e);e.observers.set(i,[c,l])};return qt(ox(n,e),n.registerCommand(Re,()=>sx(e,n),fe),n.registerMutationListener(Pr,o=>{n.read("latest",()=>{for(const[i,s]of o){const l=e.observers.get(i);if(s==="created"||s==="updated"){const{tableNode:c,tableElement:a}=Hh(i);l===void 0?r(c,i,a):a!==l[1]&&(e.removeObserver(i),r(c,i,a))}else s==="destroyed"&&e.removeObserver(i)}})},{skipInitialization:!1}),()=>{e.removeAllObservers()})}function Sx(n,t){n.hasNodes([Pr])||j(255);const{hasNestedTables:e=Fo(!1)}=t??{};return qt(n.registerCommand(Wy,r=>(function({rows:o,columns:i,includeHeaders:s},l){const c=A()||ce();if(!c||!w(c)||!l&&Dr(c.anchor.getNode()))return!1;const a=jy(Number(o),Number(i),s);Pm(a);const u=a.getFirstDescendant();return O(u)&&u.select(),!0})(r,e.peek()),X),n.registerCommand(Tf,(r,o)=>n===o&&(function(i,s){const{nodes:l,selection:c}=i;if(!l.some(f=>yt(f)||Em(f).some(d=>yt(d.node)))){if(mt(c)){let f="",d=!1;for(const h of l){const g=C(h)&&!h.isInline();f.length>0&&(g||d)&&(f+=`
16
+ `),f+=h.getTextContent(),d=g}return c.insertRawText(f),!0}return!1}const a=mt(c),u=w(c);return u&&U(c.anchor.getNode(),f=>J(f))!==null&&U(c.focus.getNode(),f=>J(f))!==null||a?l.length===1&&yt(l[0])?jh(l[0],c):!(u&&s.peek()&&!(function(f){return!!(mt(f)&&!f.focus.getNode().is(f.anchor.getNode())||w(f)&&J(f.anchor.getNode())&&!f.anchor.getNode().is(f.focus.getNode()))})(c)):!1})(r,e),X),n.registerCommand(ql,yx,he),n.registerCommand(Wi,_x,X),n.registerNodeTransform(Pr,mx),n.registerNodeTransform(as,px),n.registerNodeTransform(Vn,gx))}Ot.tag("table"),Ot.tag("tr"),Ot.tag("td","th");function bx({hasCellMerge:n=!0,hasCellBackgroundColor:t=!0,hasTabHandler:e=!0,hasHorizontalScroll:r=!1,hasNestedTables:o=!1}){const[i]=oe();L.useEffect(()=>{Ki(i)!==r&&(fx(i,r),i.update(cd))},[i,r]);const s=(function(l){const[c]=L.useState(()=>Fo(l));return c.peek()!==l&&(c.value=l),c})(o);return L.useEffect(()=>Sx(i,{hasNestedTables:s}),[i,s]),L.useEffect(()=>Cx(i,e),[i,e]),L.useEffect(()=>{if(!n)return xx(i)},[i,n]),L.useEffect(()=>{if(!t)return i.registerNodeTransform(Vn,l=>{l.getBackgroundColor()!==null&&l.setBackgroundColor(null)})},[i,t,n]),null}function vx(n,t){let e=n;for(let r=et(n,t);r&&(Gh(r.origin)||br(r.origin));r=r.getAdjacentCaret())e=r.origin;return e}function Nx(n){return vx(n,"previous")}function Xh(n,t){for(const e of n.childNodes)if(B(e)&&e.tagName===t||Xh(e,t))return!0;return!1}const Qr="data-language",Vr="data-highlight-language",Vo="data-theme";class gs extends bt{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:bt,importDOM:{code:t=>t.textContent!=null&&(/\r?\n/.test(t.textContent)||Xh(t,"BR"))?{conversion:Uu,priority:1}:null,div:()=>({conversion:Tx,priority:1}),pre:()=>({conversion:Uu,priority:0}),table:t=>Is(t)?{conversion:kx,priority:3}:null,td:t=>{const e=t,r=e.closest("table");return e.classList.contains("js-file-line")||r&&Is(r)?{conversion:ju,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&Is(e)?{conversion:ju,priority:3}:null}}})}constructor(t=void 0,e){super(e),this.__language=t||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported}createDOM(t){const e=Z().createElement("code");kt(e,t.theme.code),e.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(e.setAttribute(Qr,r),this.getIsSyntaxHighlightSupported()&&e.setAttribute(Vr,r));const o=this.getTheme();o&&e.setAttribute(Vo,o);const i=this.getStyle();return i&&gn(e.style,i),e}updateDOM(t,e,r){const o=this.__language,i=t.__language;o?o!==i&&e.setAttribute(Qr,o):i&&e.removeAttribute(Qr);const s=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&i?s&&o?o!==i&&e.setAttribute(Vr,o):e.removeAttribute(Vr):s&&o&&e.setAttribute(Vr,o);const l=this.__theme,c=t.__theme;l?l!==c&&e.setAttribute(Vo,l):c&&e.removeAttribute(Vo);const a=this.__style,u=t.__style;return a!==u&&gn(e.style,a,u),!1}exportDOM(t){const e=Z().createElement("pre");kt(e,t._config.theme.code),e.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(e.setAttribute(Qr,r),this.getIsSyntaxHighlightSupported()&&e.setAttribute(Vr,r));const o=this.getTheme();o&&e.setAttribute(Vo,o);const i=this.getStyle();return i&&gn(e.style,i),{element:e}}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,e=!0){if(!Kr(St(),"@lexical/code")){const s=wx(t);if(s)return s}const{anchor:r,focus:o}=t,i=(r.isBefore(o)?r:o).getNode();if(O(i)){let s=Nx(i);const l=[];for(;;)if(br(s))l.push(Vi()),s=s.getNextSibling();else{if(!Gh(s))break;{let g=0;const _=s.getTextContent(),p=s.getTextContentSize();for(;g<p&&_[g]===" ";)g++;if(g!==0&&l.push(Ex(" ".repeat(g))),g!==p)break;s=s.getNextSibling()}}const c=i.splitText(r.offset)[0],a=r.offset===0?0:1,u=c.getIndexWithinParent()+a,f=i.getParentOrThrow(),d=[Ue(),...l];f.splice(u,0,d);const h=l[l.length-1];h?h.select():r.offset===0?c.selectPrevious():c.getNextSibling().selectNext(0,0)}if(Ac(i)){const{offset:s}=t.anchor;i.splice(s,0,[Ue()]),i.select(s+1,s+1)}return null}canIndent(){return!1}collapseAtStart(){const t=V();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),!0}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const e=this.getWritable();return e.__isSyntaxHighlightSupported=t,e}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const e=this.getWritable();return e.__theme=t||void 0,e}getTheme(){return this.getLatest().__theme}}function te(n,t){return Id(gs).setLanguage(n).setTheme(t)}function Ac(n){return n instanceof gs}function Uu(n){return{node:te(n.getAttribute(Qr))}}function Tx(n){const t=n,e=Hu(t);return e||(function(r){let o=r.parentElement;for(;o!==null;){if(Hu(o))return!0;o=o.parentElement}return!1})(t)?{node:e?te():null}:{node:null}}function kx(){return{node:te()}}function ju(){return{node:null}}function Hu(n){return n.style.fontFamily.match("monospace")!==null}function Is(n){return n.classList.contains("js-file-line-container")}function wx(n){const{anchor:t}=n;if(n.isCollapsed()&&t.type==="element"){const e=t.getNode();if(Ac(e)){const r=e.getChildrenSize();if(r>=2&&t.offset===r){const o=e.getLastChild();if(It(o)&&It(o.getPreviousSibling())){const i=V();return e.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}class Mc extends rn{__highlightType;constructor(t="",e,r){super(t,r),this.__highlightType=e}$config(){return this.config("code-highlight",{extends:rn})}afterCloneFrom(t){super.afterCloneFrom(t),this.__highlightType=t.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return!1}createDOM(t){const e=super.createDOM(t),r=Ks(t.theme,this.__highlightType);return kt(e,r),e}updateDOM(t,e,r){const o=super.updateDOM(t,e,r),i=Ks(r.theme,t.__highlightType),s=Ks(r.theme,this.__highlightType);return i!==s&&(i&&We(e,i),s&&kt(e,s)),o}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return te()}}function Ks(n,t){return t&&n&&n.codeHighlight&&n.codeHighlight[t]}function Ex(n="",t){return Gt(new Mc(n,t))}function Gh(n){return n instanceof Mc}const Qh="data-language";function Zh(n){return n.style.fontFamily.match("monospace")!==null}function Dl(n){let t=n.parentElement;for(;t!==null;){if(Zh(t))return!0;t=t.parentElement}return!1}const $x=Nh([{$import:(n,t)=>n.$importChildren(t),match:Ot.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),Ox={$import:(n,t)=>[te(t.getAttribute(Qh)).splice(0,0,n.$importChildren(t))],match:Ot.tag("pre"),name:"@lexical/code/pre"},Ax={$import:(n,t,e)=>{const r=t.textContent||"";return/\r?\n/.test(r)||t.querySelector("br")!==null?[te(t.getAttribute(Qh)).splice(0,0,n.$importChildren(t))]:e()},match:Ot.tag("code"),name:"@lexical/code/code-multiline"};function Yo(n){if(!B(n))return!1;const t=n.style.fontFamily,e=n.style.whiteSpace;return typeof t=="string"&&/monospace/i.test(t)&&typeof e=="string"&&e.startsWith("pre")}function Mx(n){let t=!1;const e=[];let r="",o=!1;const i=()=>{o&&(e.push(r),r="",o=!1)};for(const s of Array.from(n.childNodes))if(B(s))s.tagName==="DIV"?(i(),e.push(s.textContent||""),t=!0):s.tagName==="BR"?(i(),e.push(""),t=!0):(r+=s.textContent||"",o=!0);else if(ie(s)){const l=s.textContent||"";l.length>0&&(r+=l,o=!0)}return i(),t?e:null}Ot.tag("div"),Ot.tag("div","br");const Fx={$import:(n,t,e)=>Zh(t)?[te().splice(0,0,n.$importChildren(t))]:Dl(t)?n.$importChildren(t):e(),match:Ot.tag("div"),name:"@lexical/code/div"};Ot.tag("table").classAll("js-file-line-container"),Ot.tag("td").classAll("js-file-line");function Dx(n,t){const e={};for(const r of n){const o=t(r);o&&(e[o]?e[o].push(r):e[o]=[r])}return e}function Px(n){const t=Dx(n,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}const Rx=/^\s{0,3}$/;function Ju(n){if(!cn(n))return!1;const t=n.getFirstChild();return t==null||n.getChildrenSize()===1&&O(t)&&Rx.test(t.getTextContent())}function qu(n){return n.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(t,e)=>String.fromCodePoint(Number(e)))}const Lx=/^(\s*)(\d{1,})\.\s/,Ix=/^(\s*)[-*+]\s/,Kx=/^(#{1,6})\s/,zx=/^>\s/,Bx=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,Wx=/^[ \t]*`{3,}$/,Zr=ko("mdListMarker",{parse:n=>typeof n=="string"&&/^[-*+]$/.test(n)?n:"-",resetOnCopyNode:!0}),Vu=ko("mdCodeFence",{parse:n=>typeof n=="string"&&/^`{3,}$/.test(n)?n:"```",resetOnCopyNode:!0}),tg=ko("mdHardLineBreak",{parse:n=>typeof n=="string"&&/^(\\| {2,})$/.test(n)?n:"",resetOnCopyNode:!0});function Ux(n){if(n.endsWith("\\"))return[n.slice(0,-1),"\\"];const t=n.match(/^(.*?\S)( {2,})$/);return t?[t[1],t[2]]:null}function jx(n){const t=n.getChildren(),e=t.length-1,r=t[e];if(!O(r))return null;const o=r.getTextContent(),i=Ux(o);if(i!==null){const[s,l]=i;return r.setTextContent(s),l}return/^ {2,}$/.test(o)&&(function(s,l){for(let c=l-1;c>=0;c--){if(It(s[c]))return!1;if(/\S/.test(s[c].getTextContent()))return!0}return!1})(t,e)?(r.setTextContent(""),o):null}function Hx(n){const t=Ue(),e=jx(n);return e!==null&&ar(t,tg,e),t}const eg=n=>(t,e,r,o)=>{const i=n(r);i.append(...e),t.replace(i),o||i.select(0,0)},ng=n=>(t,e,r,o)=>{if(Wh(t))return!1;const i=t.getPreviousSibling(),s=t.getNextSibling(),l=He(n==="check"?r[3]==="x":void 0),c=r[0].trim()[0],a=n!=="bullet"&&n!=="check"||c!==Zr.parse(c)?void 0:c;if(Y(s)&&s.getListType()===n){a&&ar(s,Zr,a);const f=s.getFirstChild();f!==null?f.insertBefore(l):s.append(l),n==="number"&&s.setStart(Number(r[2])),t.remove()}else if(Y(i)&&i.getListType()===n)a&&ar(i,Zr,a),i.append(l),t.remove();else{const f=$e(n,n==="number"?Number(r[2]):void 0);a&&ar(f,Zr,a),f.append(l),t.replace(f)}l.append(...e),o||l.select(0,0);const u=(function(f){const d=f.match(/\t/g),h=f.match(/ /g);let g=0;return d&&(g+=d.length),h&&(g+=Math.floor(h.length/4)),g})(r[1]);u&&l.setIndent(u)},Fc=(n,t,e,r)=>{const o=[],i=n.getChildren();let s=0;for(const l of i)if(rt(l)){if(l.getChildrenSize()===1){const h=l.getFirstChild();if(Y(h)){const g=Fc(h,t,e+1,r);g&&o.push(g);continue}}if(r&&!l.getChildren().some(h=>h.isSelected(r)))continue;const c=" ".repeat(4*e),a=n.getListType(),u=wo(n,Zr),f=a==="number"?`${n.getStart()+s}. `:a==="check"?`${u} [${l.getChecked()?"x":" "}] `:u+" ";let d=t(l);a!=="number"&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),o.push(c+f+d),s++}return o.join(`
17
+ `)},Jx={dependencies:[cs],export:(n,t)=>{if(!Wh(n))return null;const e=Number(n.getTag().slice(1));return"#".repeat(e)+" "+t(n)},regExp:Kx,replace:eg(n=>{const t="h"+n[1].length;return Mr(t)}),triggerOnEnter:!0,type:"element"},qx={dependencies:[ls],export:(n,t)=>{if(!wl(n))return null;const e=t(n).split(`
18
+ `),r=[];for(const o of e)r.push("> "+o);return r.join(`
19
+ `)},regExp:zx,replace:(n,t,e,r)=>{if(r){const i=n.getPreviousSibling();if(wl(i))return i.splice(i.getChildrenSize(),0,[Hx(i),...t]),void n.remove()}const o=Br();o.append(...t),n.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},li={dependencies:[gs],export:n=>{if(!Ac(n))return null;const t=n.getTextContent();let e=wo(n,Vu);if(t.indexOf(e)>-1){const r=t.match(/`{3,}/g);if(r){const o=Math.max(...r.map(i=>i.length));e="`".repeat(o+1)}}return e+(n.getLanguage()||"")+(t?`
20
+ `+t:"")+`
21
+ `+e},handleImportAfterStartMatch:({lines:n,rootNode:t,startLineIndex:e,startMatch:r})=>{const o=r[1],i=o.trim().length,s=n[e],l=r.index+o.length,c=s.slice(l),a=new RegExp(`\`{${i},}$`);if(a.test(c)){const h=c.match(a),g=c.slice(0,c.lastIndexOf(h[0])),_=[...r];return _[2]="",li.replace(t,null,_,h,[g],!0),[!0,e]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let h=e+1;h<n.length;h++){const g=n[h];if(u.test(g)){const _=g.match(u),p=n.slice(e+1,h),m=s.slice(r[0].length);return m.length>0&&p.unshift(m),li.replace(t,null,r,_,p,!0),[!0,h]}}const f=n.slice(e+1),d=s.slice(r[0].length);return d.length>0&&f.unshift(d),li.replace(t,null,r,null,f,!0),[!0,n.length-1]},regExpEnd:{optional:!0,regExp:Wx},regExpStart:Bx,replace:(n,t,e,r,o,i)=>{let s,l;const c=e[1]?e[1].trim():"```",a=e[2]||void 0;if(!t&&o){if(o.length===1)r?(s=te(a),l=o[0]):(s=te(a),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=te(a),o.length>0&&(o[0].trim().length===0?o.shift():o[0].startsWith(" ")&&(o[0]=o[0].slice(1)));o.length>0&&!o[o.length-1].length;)o.pop();l=o.join(`
22
+ `)}ar(s,Vu,c);const u=wt(l);s.append(u),n.append(s)}else t&&eg(u=>te(u?u[2]:void 0))(n,t,e,i)},type:"multiline-element"},Vx={dependencies:[qn,vn],export:(n,t,e)=>Y(n)?Fc(n,t,0,e):null,regExp:Ix,replace:ng("bullet"),triggerOnEnter:!0,type:"element"},Yx={dependencies:[qn,vn],export:(n,t,e)=>Y(n)?Fc(n,t,0,e):null,regExp:Lx,replace:ng("number"),triggerOnEnter:!0,type:"element"},Xx={format:["code"],tag:"`",type:"text-format"},Gx={format:["highlight"],tag:"==",type:"text-format"},Qx={format:["bold","italic"],tag:"***",type:"text-format"},Zx={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},tC={format:["bold"],tag:"**",type:"text-format"},eC={format:["bold"],intraword:!1,tag:"__",type:"text-format"},nC={format:["strikethrough"],tag:"~~",type:"text-format"},rC={format:["italic"],tag:"*",type:"text-format"},oC={format:["italic"],intraword:!1,tag:"_",type:"text-format"},iC={dependencies:[xn],export:(n,t,e)=>{if(!Qt(n)||ir(n))return null;const r=t(n);let o=n.getTitle();return o!=null&&(o=o.replace(/([\\"])/g,"\\$1")),o?`[${r}](${n.getURL()} "${o}")`:`[${r}](${n.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(n,t)=>{if(U(n,Qt))return;const[,e,r,o]=t,i=r!=null?qu(r):void 0,s=o!=null?qu(o):void 0,l=bo(i,{title:s}),c=e.split("[").length-1,a=e.split("]").length-1;let u=e,f="";if(c<a)return;if(c>a){const h=e.split("[");f="["+h[0],u=h.slice(1).join("[")}const d=wt(u);return d.setFormat(n.getFormat()),l.append(d),n.replace(l),f&&l.insertBefore(wt(f)),d},trigger:")",type:"text-match"},sC=[Jx,qx,Vx,Yx],lC=[li],cC=[Xx,Qx,Zx,tC,eC,Gx,rC,oC,nC],aC=[iC],rg=[...sC,...lC,...cC,...aC];function uC(n,t,e,r,o){for(const i of t){if(!i.export)continue;const s=i.export(n,l=>zi(l,e,r,void 0,void 0,o));if(s!=null)return s}return C(n)?zi(n,e,r,void 0,void 0,o):G(n)?n.getTextContent():null}function zi(n,t,e,r,o,i=!1){const s=[],l=n.getChildren();r||(r=[]),o||(o=[]);t:for(const c of l){for(const a of e){if(!a.export)continue;const u=a.export(c,f=>zi(f,t,e,r,[...o,...r],i),(f,d)=>Yu(f,d,t,r,o,i));if(u!=null){s.push(u);continue t}}It(c)?s.push(fC(c)):O(c)?s.push(Yu(c,c.getTextContent(),t,r,o,i)):C(c)?s.push(zi(c,t,e,r,o,i)):G(c)&&s.push(c.getTextContent())}return s.join("")}function fC(n){return wo(n,tg)+`
23
+ `}function Yu(n,t,e,r,o,i=!1){const s=n.hasFormat("code");let l,c,a,u,f=t;if(s||(f=i?f.replace(/([*_`~])/g,"\\$1"):f.replace(/([*_`~\\])/g,"\\$1")),s){const{fence:y,padded:x}=(function(b){const T=b.match(/`+/g),v=T?Math.max(...T.map(N=>N.length)):0;return{fence:"`".repeat(v+1),padded:b.length===0||b.includes("`")||/^\s/.test(b)&&/\s$/.test(b)?` ${b} `:b}})(t);l="",a="",c=y+x+y,u=!1}else{const y=f.match(/^(\s*)(.*?)(\s*)$/s)||["","",f,""];l=y[1],c=y[2],a=y[3],u=c===""}let d="",h="",g="";const _=Xu(n,!0),p=Xu(n,!1),m=new Set;for(const y of e){const x=y.format[0],b=y.tag;x!=="code"&&Gu(n,x)&&!m.has(x)&&(m.add(x),Gu(_,x)&&r.find(T=>T.tag===b)||(r.push({format:x,tag:b}),d+=b))}for(let y=0;y<r.length;y++){const x=Pl(n,r[y].format),b=Pl(p,r[y].format);if(x&&b)continue;const T=[...r];for(;T.length>y;){const v=T.pop();o&&v&&o.find(N=>N.tag===v.tag)||(v&&typeof v.tag=="string"&&(x?b||(g+=v.tag):h+=v.tag),r.pop())}break}return u&&!n.hasFormat("code")?h+f:h+l+d+c+g+a}function Xu(n,t){const e=t?n.getPreviousSibling():n.getNextSibling();return O(e)?e:null}function Pl(n,t){return O(n)&&n.hasFormat(t)}function Gu(n,t){return!!Pl(n,t)&&(t==="code"||!n||!/^\s*$/.test(n.getTextContent()))}function dC(n=rg,t,e=!1){return(function(o,i=!1){const s=Px(o),l=[...s.multilineElement,...s.element],c=!i,a=s.textFormat.filter(u=>u.format.length===1).sort((u,f)=>Number(u.format.includes("code"))-Number(f.format.includes("code")));return u=>{const f=[],d=(u||Ct()).getChildren();for(let h=0;h<d.length;h++){const g=d[h],_=uC(g,l,a,s.textMatch,i);_!=null&&f.push(c&&h>0&&!Ju(g)&&!Ju(d[h-1])?`
24
+ `.concat(_):_)}return f.join(`
25
+ `)}})(n,e)(t)}const og=(n,t)=>{const e=new DOMParser().parseFromString(Zu(t),"text/html");return kh(n,e)},hC=n=>({html:Zu(wh(n,null)),text:dC(rg)});function Qu(n,t){return n.read("latest",()=>{const e=tt(t);return e!==null&&e.isSelected()})}function gC(n){const[t]=oe(),[e,r]=L.useState(()=>Qu(t,n));return L.useEffect(()=>{let o=!0;const i=t.registerUpdateListener(()=>{o&&r(Qu(t,n))});return()=>{o=!1,i()}},[t,n]),[e,L.useCallback(o=>{t.update(()=>{let i=A();dt(i)||(i=ho(),gt(i)),dt(i)&&(o?i.add(n):i.delete(n))})},[t,n]),L.useCallback(()=>{t.update(()=>{const o=A();dt(o)&&o.clear()})},[t])]}function pC({nodeKey:n}){const[t]=oe(),[e,r,o]=gC(n);return L.useEffect(()=>qt(t.registerCommand(Wi,i=>{const s=t.getElementByKey(n);return Rn(i)===s&&(i.shiftKey||o(),r(!e),!0)},he)),[o,t,e,n,r]),L.useEffect(()=>{const i=t.getElementByKey(n),s=t._config.theme.hrSelected??"selected";i!==null&&(e?kt(i,s):We(i,s))},[t,e,n]),null}class ig extends bc{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:mC,priority:0})}})}decorate(){return H.jsx(pC,{nodeKey:this.__key})}}function mC(){return{node:_C()}}function _C(){return Gt(new ig)}const yC=[cs,ls,qn,vn,xn,wc,Pr,as,Vn,gs,Mc,ig],xC={code:"block my-2 rounded bg-surface-sunken p-2 font-mono text-xs whitespace-pre-wrap",heading:{h1:"mt-3 mb-1 text-xl font-semibold",h2:"mt-3 mb-1 text-lg font-semibold",h3:"mt-2 mb-1 text-base font-semibold",h4:"mt-2 mb-1 text-sm font-semibold",h5:"mt-2 mb-1 text-sm font-semibold",h6:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide"},hr:"my-3 border-t border-line",link:"text-accent underline",list:{listitem:"ml-2",nested:{listitem:"list-none"},ol:"my-1 list-decimal pl-6",ul:"my-1 list-disc pl-6"},paragraph:"my-1",quote:"my-1 border-l-2 border-fg-subtle/30 pl-3 text-fg-muted [&_p]:my-0.5",table:"my-2 w-full table-fixed border-collapse",tableCell:"border border-line px-2 py-1 align-top",tableCellHeader:"bg-surface-sunken font-semibold",text:{bold:"font-semibold",code:"rounded bg-surface-sunken px-1 font-mono text-xs",italic:"italic",strikethrough:"line-through",underline:"underline"}},rr=({isActive:n,onClick:t,children:e,title:r})=>H.jsx("button",{type:"button",onMouseDown:o=>{o.preventDefault(),t()},title:r,"aria-label":r,"aria-pressed":n,className:`p-1.5 rounded transition-colors ${n?"text-fg bg-accent-2-soft":"text-fg-muted hover:text-fg hover:bg-surface-raised"}`,children:e}),CC={bold:!1,italic:!1,quote:!1,link:null,canUndo:!1,canRedo:!1},SC=()=>{const[n]=oe(),[t,e]=L.useState(CC),[r,o]=L.useState(null),i=L.useRef(null),s=L.useCallback(()=>{const a=A();if(!w(a))return;const u=a.anchor.getNode(),f=U(u,Qt),d=U(u,wl);e(h=>({...h,bold:a.hasFormat("bold"),italic:a.hasFormat("italic"),quote:d!==null,link:Qt(f)?f.getURL():null}))},[]);L.useEffect(()=>qt(n.registerUpdateListener(({editorState:a})=>{a.read(s)}),n.registerCommand(Re,()=>(s(),!1),he),n.registerCommand(Xr,a=>(e(u=>({...u,canUndo:a})),!1),he),n.registerCommand(Yr,a=>(e(u=>({...u,canRedo:a})),!1),he)),[n,s]),L.useEffect(()=>{r!==null&&i.current?.focus()},[r]);const l=()=>{n.update(()=>{const a=A();w(a)&&Tm(a,()=>t.quote?V():Br())})},c=a=>{const u=a.trim();n.dispatchCommand(xl,u===""?null:u),o(null),n.focus()};return H.jsxs("div",{className:"border-b border-line",children:[H.jsxs("div",{className:"flex items-center gap-0.5 px-3 py-1",children:[H.jsx(rr,{isActive:t.bold,onClick:()=>n.dispatchCommand(ke,"bold"),title:"Bold (Ctrl+B)",children:H.jsx(lg,{className:"size-4"})}),H.jsx(rr,{isActive:t.italic,onClick:()=>n.dispatchCommand(ke,"italic"),title:"Italic (Ctrl+I)",children:H.jsx(cg,{className:"size-4"})}),H.jsx(rr,{isActive:t.link!==null,onClick:()=>o(t.link??"https://"),title:"Link (Ctrl+K)",children:H.jsx(ag,{className:"size-4"})}),H.jsx(rr,{isActive:t.quote,onClick:l,title:"Blockquote",children:H.jsx(ug,{className:"size-4"})}),H.jsx("div",{className:"mx-1.5 h-4 w-px bg-line"}),H.jsx(rr,{isActive:!1,onClick:()=>n.dispatchCommand(Ui,void 0),title:"Undo (Ctrl+Z)",children:H.jsx(sg,{className:`size-4 ${t.canUndo?"":"opacity-40"}`})}),H.jsx(rr,{isActive:!1,onClick:()=>n.dispatchCommand(ji,void 0),title:"Redo (Ctrl+Y)",children:H.jsx(fg,{className:`size-4 ${t.canRedo?"":"opacity-40"}`})})]}),r!==null&&H.jsxs("div",{className:"flex items-center gap-2 border-t border-line px-3 py-1.5",children:[H.jsx("input",{ref:i,type:"url",value:r,"aria-label":"Link address",placeholder:"https://example.com",className:"min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",onChange:a=>o(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),c(r)),a.key==="Escape"&&(a.preventDefault(),o(null),n.focus())}}),H.jsx("button",{type:"button",className:"text-xs text-accent hover:underline",onClick:()=>c(r),children:"Apply"}),t.link!==null&&H.jsx("button",{type:"button",className:"text-xs text-fg-muted hover:text-fg",onClick:()=>c(""),children:"Remove"})]})]})},bC=()=>{const[n]=oe(),t=L.useRef(!1);return L.useEffect(()=>qt(n.registerCommand(Kl,e=>((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="v"&&(t.current=e.shiftKey),!1),he),n.registerCommand(Rr,e=>{if(!(e instanceof ClipboardEvent))return!1;const r=e.clipboardData;if(!r)return!1;const o=t.current;if(t.current=!1,o){const s=A();return w(s)?(e.preventDefault(),s.insertRawText(r.getData("text/plain")),!0):!1}const i=r.getData("text/html");return i?(e.preventDefault(),Xl(og(n,i)),!0):!1},md)),[n]),null},vC=({onChange:n})=>{const[t]=oe(),e=L.useRef(n);return L.useEffect(()=>{e.current=n},[n]),L.useEffect(()=>{const r=()=>e.current(t.read(()=>hC(t)));return r(),t.registerUpdateListener(({dirtyElements:o,dirtyLeaves:i})=>{o.size===0&&i.size===0||r()})},[t]),null},NC=({enabled:n})=>{const[t]=oe();return L.useEffect(()=>{if(!n)return;const e=setTimeout(()=>t.focus(),0);return()=>clearTimeout(e)},[t,n]),null},TC=n=>t=>{const e=og(t,n);e.length!==0&&(Ct().select(),Xl(e))},kC=({initialHtml:n,onChange:t,onSubmit:e,autoFocus:r=!1,placeholder:o="Write your message…",ariaLabel:i="Message body"})=>H.jsxs(dm,{initialConfig:{namespace:"compose",nodes:yC,theme:xC,editorState:n?TC(n):void 0,onError:s=>{throw s}},children:[H.jsx(SC,{}),H.jsx("div",{className:"relative",children:H.jsx(zy,{contentEditable:H.jsx(ym,{"aria-label":i,"aria-placeholder":o,"data-testid":"compose-body",className:"min-h-[120px] w-full bg-canvas px-3 py-2 text-sm text-fg outline-none",placeholder:H.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 px-3 py-2 text-sm text-fg-subtle",children:o}),onKeyDown:s=>{e&&(!(s.metaKey||s.ctrlKey)||s.key!=="Enter"||(s.preventDefault(),e()))}}),ErrorBoundary:bm})}),H.jsx(r_,{}),H.jsx(ay,{}),H.jsx(Y_,{}),H.jsx(bx,{}),H.jsx(bC,{}),H.jsx(NC,{enabled:r}),t&&H.jsx(vC,{onChange:t})]}),QC=({initialHtml:n,onChange:t,onSubmit:e,autoFocus:r})=>H.jsx(kC,{initialHtml:n,onChange:t,onSubmit:e,autoFocus:r});export{QC as ComposeBody};